output: arm asm
.file "test_arm.c"
.text
.align 2
.global DoSomeThing
.type DoSomeThing, %function
DoSomeThing:
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 1, uses_anonymous_args = 0
mov ip, sp
stmfd sp!, {fp, ip, lr, pc}
sub fp, ip, #4
ldmfd sp, {fp, sp, pc}
.size DoSomeThing, .-DoSomeThing
.align 2
.global DoOtherThing
.type DoOtherThing, %function
DoOtherThing:
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 1, uses_anonymous_args = 0
mov ip, sp
stmfd sp!, {fp, ip, lr, pc}
sub fp, ip, #4
ldmfd sp, {fp, sp, pc}
.size DoOtherThing, .-DoOtherThing
.align 2
.global fun1
.type fun1, %function
fun1:
@ args = 0, pretend = 0, frame = 8
@ frame_needed = 1, uses_anonymous_args = 0
mov ip, sp
stmfd sp!, {fp, ip, lr, pc}
sub fp, ip, #4
sub sp, sp, #8
str r0, [fp, #-16]
mov r3, #1
str r3, [fp, #-20]
.L4:
ldr r2, [fp, #-20]
ldr r3, [fp, #-16]
cmp r2, r3
bge .L5
ldr r3, .L9
ldr r3, [r3, #0]
cmp r3, #0
beq .L7
bl DoSomeThing
b .L6
.L7:
bl DoOtherThing
.L6:
ldr r3, [fp, #-20]
add r3, r3, #1
str r3, [fp, #-20]
b .L4
.L5:
ldr r3, [fp, #-20]
mov r0, r3
sub sp, fp, #12
ldmfd sp, {fp, sp, pc}
.L10:
.align 2
.L9:
.word condition
.size fun1, .-fun1
.align 2
.global fun2
.type fun2, %function
fun2:
@ args = 0, pretend = 0, frame = 8
@ frame_needed = 1, uses_anonymous_args = 0
mov ip, sp
stmfd sp!, {fp, ip, lr, pc}
sub fp, ip, #4
sub sp, sp, #8
str r0, [fp, #-16]
ldr r3, .L20
ldr r3, [r3, #0]
cmp r3, #0
beq .L12
mov r3, #1
str r3, [fp, #-20]
.L13:
ldr r2, [fp, #-20]
ldr r3, [fp, #-16]
cmp r2, r3
bge .L16
bl DoSomeThing
ldr r3, [fp, #-20]
add r3, r3, #1
str r3, [fp, #-20]
b .L13
.L12:
mov r3, #1
str r3, [fp, #-20]
.L17:
ldr r2, [fp, #-20]
ldr r3, [fp, #-16]
cmp r2, r3
bge .L16
bl DoOtherThing
ldr r3, [fp, #-20]
add r3, r3, #1
str r3, [fp, #-20]
b .L17
.L16:
ldr r3, [fp, #-20]
mov r0, r3
sub sp, fp, #12
ldmfd sp, {fp, sp, pc}
.L21:
.align 2
.L20:
.word condition
.size fun2, .-fun2
.align 2
.global main
.type main, %function
main:
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 1, uses_anonymous_args = 0
mov ip, sp
stmfd sp!, {fp, ip, lr, pc}
sub fp, ip, #4
mov r0, #100
bl fun1
mov r0, #100
bl fun2
mov r3, #0
mov r0, r3
ldmfd sp, {fp, sp, pc}
.size main, .-main
.comm condition,4,4
.ident "GCC: (GNU) 3.4.4" |