Could someone interpret this assembly code line by line? Thanks gcc2_compiled.: ___gnu_compiled_c: .def ___main; .scl 2; .type 32; .endef .text LC0: .ascii "----------------------------\12\0" LC1: .ascii "%sargc:%d\12\0" LC2: .ascii "%sargv:\12\0" LC3: .ascii "%s\12\0" .align 4 .globl _main .def _main; .scl 2; .type 32; .endef _main: pushl %ebp movl %esp,%ebp subl $16,%esp call ___main movl 8(%ebp),%eax pushl %eax pushl $LC0 pushl $LC1 call _printf addl $12,%esp pushl $LC0 pushl $LC2 call _printf addl $8,%esp movl $0,-4(%ebp) .p2align 4,,7 L2: movl -4(%ebp),%eax cmpl 8(%ebp),%eax jl L5 jmp L3 .p2align 4,,7 L5: movl -4(%ebp),%eax leal 0(,%eax,4),%edx movl 12(%ebp),%eax movl (%eax,%edx),%edx pushl %edx pushl $LC3 call _printf addl $8,%esp L4: incl -4(%ebp) jmp L2 .p2align 4,,7 L3: L1: movl %ebp,%esp popl %ebp ret .def _printf; .scl 2; .type 32; .endef
Could someone interpret this assembly code line by line?
Thanks
gcc2_compiled.:
___gnu_compiled_c:
.def ___main; .scl 2; .type 32; .endef
.text
LC0:
.ascii "----------------------------\12\0"
LC1:
.ascii "%sargc:%d\12\0"
LC2:
.ascii "%sargv:\12\0"
LC3:
.ascii "%s\12\0"
.align 4
.globl _main
.def _main; .scl 2; .type 32; .endef
_main:
pushl %ebp
movl %esp,%ebp
subl $16,%esp
call ___main
movl 8(%ebp),%eax
pushl %eax
pushl $LC0
pushl $LC1
call _printf
addl $12,%esp
pushl $LC0
pushl $LC2
call _printf
addl $8,%esp
movl $0,-4(%ebp)
.p2align 4,,7
L2:
movl -4(%ebp),%eax
cmpl 8(%ebp),%eax
jl L5
jmp L3
.p2align 4,,7
L5:
movl -4(%ebp),%eax
leal 0(,%eax,4),%edx
movl 12(%ebp),%eax
movl (%eax,%edx),%edx
pushl %edx
pushl $LC3
call _printf
addl $8,%esp
L4:
incl -4(%ebp)
jmp L2
.p2align 4,,7
L3:
L1:
movl %ebp,%esp
popl %ebp
ret
.def _printf; .scl 2; .type 32; .endef

Step by step
Solved in 3 steps









