How to convert this c++ code into assembly?
for (a=0; a<=y; a++)
for (b=0; b<=y/2; b++) for (c=0; c<=y/3; c++) if ((a + 2*b + 3*c) ==y) count++; |
Have you tried using a compiler?
Code:
g++ -S file.cpp |
thanks
i dont know how to use it...can pls post the assembly code..it is urgent i need it
|
hmmm ... urgent to you perhaps which now makes it sound and look like a homework question.
If not homework, please explain what you are trying to do and where you are stuck? Note: Answers not excepted will be, turn code into assembler and don't know how. |
gcc -S <input file> -o <output file>
|
Moved: This thread is more suitable in Programming and has been moved accordingly to help your thread/question get the exposure it deserves.
|
Quote:
|
Quote:
Is y a global variable? Or is y a parameter that was pushed on the stack? Or is y a parameter stored in the EAX register when the code snippet was executed? Is count a global variable or is it something to be returned on the stack or EAX register? Does count need to be initialized? Maybe y and count are addresses that were pushed on the stack before this code snippet was run? Maybe y and count are addresses that were stored in the EAX and EBX registers before this code snippet was run? BTW If you use CODE tags the program fragment will display the way you intended. |
All times are GMT -5. The time now is 03:05 AM. |