.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, 2 .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. cmp r0, #1 mov r2, #0 beq .L2 .L3: add r3, r0, r0, asl #1 tst r0, #1 add r3, r3, #1 add r0, r0, r0, lsr #31 movne r0, r3 moveq r0, r0, asr #1 cmp r0, #1 add r2, r2, #1 bne .L3 .L2: mov r0, r2 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 mov ip, #0 cmp r1, #1 str ip, [r0] beq .L20 str lr, [sp, #-4]! mov lr, #1 .L14: add lr, lr, #1 cmp lr, r1 str ip, [r0, #4]! beq .L21 .L13: cmp lr, #1 moveq ip, #0 beq .L14 mov r3, lr mov ip, #0 .L12: add r2, r3, r3, asl #1 tst r3, #1 add r2, r2, #1 add r3, r3, r3, lsr #31 movne r3, r2 moveq r3, r3, asr #1 cmp r3, #1 add ip, ip, #1 bne .L12 add lr, lr, #1 cmp lr, r1 str ip, [r0, #4]! bne .L13 .L21: ldr pc, [sp], #4 .L20: bx lr .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 cmp r1, #1 bxle lr stmfd sp!, {r3, r4, r5, r6, r7, lr} mov r6, r1 ldr r7, .L29 mov r5, r0 mov r4, #1 .L24: mov r2, r4 ldr r0, [r7] ldr r1, .L29+4 ldr r3, [r5, #4]! add r4, r4, #1 bl fprintf cmp r4, r6 bne .L24 ldmfd sp!, {r3, r4, r5, r6, r7, pc} .L30: .align 2 .L29: .word stdout .word .LC0 .size print_table, .-print_table .section .text.startup,"ax",%progbits .align 2 .global main .type main, %function main: @ args = 0, pretend = 0, frame = 800 @ frame_needed = 0, uses_anonymous_args = 0 stmfd sp!, {r4, lr} sub sp, sp, #800 mov lr, #1 add r0, sp, #800 mov r3, #0 cmp lr, #1 str r3, [r0, #-800]! mov r4, r3 mov r1, #2 mov r3, lr beq .L33 .L42: mov ip, #0 .L34: add r2, r3, r3, asl #1 tst r3, #1 add r2, r2, #1 add r3, r3, r3, lsr #31 movne r3, r2 moveq r3, r3, asr #1 cmp r3, #1 add ip, ip, #1 bne .L34 cmp r1, #200 str ip, [r0, lr, asl #2] beq .L41 .L35: add lr, lr, #1 cmp lr, #1 add r1, r1, #1 mov r3, lr bne .L42 .L33: str r4, [r0, #4] b .L35 .L41: bl print_table mov r0, #0 add sp, sp, #800 @ sp needed ldmfd sp!, {r4, pc} .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