Can anyone help me understand what this assembly code is doing?
00401318 push %ebp
00401319 mov %esp,%ebp
0040131B and $0xfffffff0,%esp
0040131E sub $0x10,%esp
00401321 call 0x405200 <__main>
00401326 movl $0x407024,(%esp)
0040132D call 0x4054c0
This looks like x86, and I'm no pro that this assembly, but here's my understanding push %ebp # Push register ebp onto the stack mov %esp,%ebp # Copy the contents of esp to ebp and $0xfffffff0,%esp # bitwise AND the number 0xfffffff0 with register esp sub $0x10,%esp # Subtract the number 0x10 from esp call 0x405200 <__main> # Call __main (which lives at 0x405200) movl $0x407024,(%esp) # This one I'm not sure on.. call 0x4054c0 <puts> # Call puts xor %eax,%eax # XOR register eax and eax leave ret Yeah, that's the best I've got. I could be completely off base since x86 assembly allows a lot of things that assembly languages I've studied do not. But hopefully this helps a little. My best guess is this block of code just inits your program and calls main.
The only thing I know about x86 assembly is that 'xor eax, eax' basically zeroes eax.
Wish I would learn asm someday :( In TAOCP once I'm done with that very hard math stuff right at the beginning of the book, I will be learning the MMIX architecture.
Right. eax (or the accumulator) is generally considered the return value. So if the program reaches that point its return value is 0 indicating success. Best of luck with the asm and MMIX. :)
The math isn't really hard (they are all solved problems)... the hard part is the book basically saying to you "so you understand the theory behind it... but can you code it?"
How am I supposed to write a program that takes other programs as input and proves them by induction?
might be maths easy for u...
Join our real-time social learning platform and learn together with your friends!