.arch armv6 .eabi_attribute 27, 3 .eabi_attribute 28, 1 .fpu vfp .eabi_attribute 20, 1 .eabi_attribute 21, 1 .eabi_attribute 23, 3 .eabi_attribute 24, 1 .eabi_attribute 25, 1 .eabi_attribute 26, 2 .eabi_attribute 30, 1 .eabi_attribute 34, 1 .eabi_attribute 18, 4 .file "collatz.c" .text .align 2 .global collatz .type collatz, %function collatz: @ args = 0, pretend = 0, frame = 0 @ frame_needed = 0, uses_anonymous_args = 0 @ link register save eliminated. mov r3, #0 b .L2 .L5: tst r0, #1 addeq r0, r0, r0, lsr #31 moveq r0, r0, asr #1 .L3: addne r0, r0, r0, asl #1 addne r0, r0, #1 .L4: add r3, r3, #1 .L2: cmp r0, #1 bne .L5 mov r0, r3 bx lr .size collatz, .-collatz .align 2 .global fill_collatz_table .type fill_collatz_table, %function fill_collatz_table: @ args = 0, pretend = 0, frame = 0 @ frame_needed = 0, uses_anonymous_args = 0 cmp r1, #0 bxle lr stmfd sp!, {r4, r5, r6, lr} mov r6, r1 mov r5, r0 mov r3, #0 str r3, [r0] mov r4, #1 b .L8 .L9: mov r0, r4 bl collatz str r0, [r5, r4, asl #2] add r4, r4, #1 .L8: cmp r4, r6 blt .L9 ldmfd sp!, {r4, r5, r6, pc} .size fill_collatz_table, .-fill_collatz_table .align 2 .global print_table .type print_table, %function print_table: @ args = 0, pretend = 0, frame = 0 @ frame_needed = 0, uses_anonymous_args = 0 stmfd sp!, {r4, r5, r6, lr} mov r6, r0 mov r5, r1 mov r4, #1 b .L13 .L14: ldr r3, .L16 ldr r0, [r3] ldr r1, .L16+4 mov r2, r4 ldr r3, [r6, r4, asl #2] bl fprintf add r4, r4, #1 .L13: cmp r4, r5 blt .L14 ldmfd sp!, {r4, r5, r6, pc} .L17: .align 2 .L16: .word stdout .word .LC0 .size print_table, .-print_table .align 2 .global main .type main, %function main: @ args = 0, pretend = 0, frame = 800 @ frame_needed = 0, uses_anonymous_args = 0 str lr, [sp, #-4]! sub sp, sp, #804 mov r0, sp mov r1, #200 bl fill_collatz_table mov r0, sp mov r1, #200 bl print_table mov r0, #0 add sp, sp, #804 @ sp needed ldr pc, [sp], #4 .size main, .-main .section .rodata.str1.4,"aMS",%progbits,1 .align 2 .LC0: .ascii "%4d --> %8d\012\000" .ident "GCC: (Raspbian 4.9.2-10+deb8u2) 4.9.2" .section .note.GNU-stack,"",%progbits