What is to key to translating code written in C into assembly code? I have tell what the funcation is doing and what arguments passed. Where do I start I do not have mystery.c I am onyl given this. where/how do I start
It looks like you need to understand the assembly language. A starting point would be a helpful tutorial and a copy of the instruction set.
C/C++ compilers are often equiped to generate the assembly language along with the object file. You might want to look at that to get a feel for translated C/C++ code.
where would I find a good tutorial on assembly language? I have only find college course summaries of what is taught. My professor does not want us to have the instruction set.
Here's a quick translation into pseudocode. I still don't know what it does though!
1 2 3 4 5 6 7 8 9 10 11 12 13 14
LocalVar1 = 0
LocalVar2 = 0
JUMP L2
L3:
A = LocalVar2
A <<= 2 // Arithmetic shift left
A += Param1
LocalVar1 += *A
LocalVar2 += 1
L2:
JUMP L3 if LocalVar2 < Param2
A = LocalVar1 // Put return value in A.
LEAVE // Clean up stack.
RETURN
Edit: Now that I look at it, though, I guess it's summing an array of integers perhaps?