.file "collatz.c" .text .globl collatz .type collatz, @function collatz: .LFB23: .cfi_startproc cmpl $1, %edi je .L6 movl $0, %eax jmp .L5 .L3: leal 1(%rdi,%rdi,2), %edi .L4: addl $1, %eax cmpl $1, %edi je .L8 .L5: testb $1, %dil jne .L3 movl %edi, %edx shrl $31, %edx addl %edx, %edi sarl %edi jmp .L4 .L8: rep ret .L6: movl $0, %eax ret .cfi_endproc .LFE23: .size collatz, .-collatz .globl fill_collatz_table .type fill_collatz_table, @function fill_collatz_table: .LFB24: .cfi_startproc testl %esi, %esi jle .L14 movl $0, (%rdi) cmpl $1, %esi jle .L14 pushq %r12 .cfi_def_cfa_offset 16 .cfi_offset 12, -16 pushq %rbp .cfi_def_cfa_offset 24 .cfi_offset 6, -24 pushq %rbx .cfi_def_cfa_offset 32 .cfi_offset 3, -32 movq %rdi, %rbp leal -2(%rsi), %r12d addq $2, %r12 movl $1, %ebx .L11: movl %ebx, %edi call collatz movl %eax, 0(%rbp,%rbx,4) addq $1, %rbx cmpq %r12, %rbx jne .L11 popq %rbx .cfi_def_cfa_offset 24 popq %rbp .cfi_def_cfa_offset 16 popq %r12 .cfi_def_cfa_offset 8 ret .L14: .cfi_restore 3 .cfi_restore 6 .cfi_restore 12 rep ret .cfi_endproc .LFE24: .size fill_collatz_table, .-fill_collatz_table .section .rodata.str1.1,"aMS",@progbits,1 .LC0: .string "%4d --> %8d\n" .text .globl print_table .type print_table, @function print_table: .LFB25: .cfi_startproc cmpl $1, %esi jle .L22 pushq %r13 .cfi_def_cfa_offset 16 .cfi_offset 13, -16 pushq %r12 .cfi_def_cfa_offset 24 .cfi_offset 12, -24 pushq %rbp .cfi_def_cfa_offset 32 .cfi_offset 6, -32 pushq %rbx .cfi_def_cfa_offset 40 .cfi_offset 3, -40 subq $8, %rsp .cfi_def_cfa_offset 48 movq %rdi, %rbp leal -2(%rsi), %r12d addq $2, %r12 movl $1, %ebx leaq .LC0(%rip), %r13 .L19: movl 0(%rbp,%rbx,4), %r8d movl %ebx, %ecx movq %r13, %rdx movl $1, %esi movq stdout(%rip), %rdi movl $0, %eax call __fprintf_chk@PLT addq $1, %rbx cmpq %r12, %rbx jne .L19 addq $8, %rsp .cfi_def_cfa_offset 40 popq %rbx .cfi_def_cfa_offset 32 popq %rbp .cfi_def_cfa_offset 24 popq %r12 .cfi_def_cfa_offset 16 popq %r13 .cfi_def_cfa_offset 8 ret .L22: .cfi_restore 3 .cfi_restore 6 .cfi_restore 12 .cfi_restore 13 rep ret .cfi_endproc .LFE25: .size print_table, .-print_table .globl main .type main, @function main: .LFB26: .cfi_startproc pushq %rbx .cfi_def_cfa_offset 16 .cfi_offset 3, -16 subq $816, %rsp .cfi_def_cfa_offset 832 movq %fs:40, %rax movq %rax, 808(%rsp) xorl %eax, %eax movq %rsp, %rbx movl $200, %esi movq %rbx, %rdi call fill_collatz_table movl $200, %esi movq %rbx, %rdi call print_table movq 808(%rsp), %rdx xorq %fs:40, %rdx jne .L28 movl $0, %eax addq $816, %rsp .cfi_remember_state .cfi_def_cfa_offset 16 popq %rbx .cfi_def_cfa_offset 8 ret .L28: .cfi_restore_state call __stack_chk_fail@PLT .cfi_endproc .LFE26: .size main, .-main .ident "GCC: (Ubuntu 7.3.0-27ubuntu1~18.04) 7.3.0" .section .note.GNU-stack,"",@progbits