Convert the following code in to ARM assembly language Tripl

Convert the following code in to ARM assembly language.

Triple Max

// Return max of three variables

int max(int a, int b, int c) {

// Fill in your own code for this function

}

int main() {

// Use registers for local variables

int x = 10;

int y = 5;

int z = 20;

int max = max(x, y, z);

printf(\"max = %d\ \", max);

return 0;

}

Solution

program

   pushl %eax
pushl %ecx
pushl %edx
pushl $5
pushl $4
pushl $3
call add3
pushl %ebp
movl %esp, %ebp
pushl %ebx
pushl %esi
pushl %edi
subl $4, %esp
movl 8(%ebp), %eax
addl 12(%ebp), %eax
addl 16(%ebp), %eax
movl %eax, -16(%ebp)
movl -16(%ebp), %eax
movl -12(%ebp), %edi
movl -8(%ebp), %esi
movl -4(%ebp), %ebx
movl %ebp, %esp
popl %ebp
ret
addl $12, %esp
movl %eax, wherever
popl %edx
popl %ecx
popl %eax

Convert the following code in to ARM assembly language. Triple Max // Return max of three variables int max(int a, int b, int c) { // Fill in your own code for
Convert the following code in to ARM assembly language. Triple Max // Return max of three variables int max(int a, int b, int c) { // Fill in your own code for

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site