In: Computer Science
Translate the following C code into M4K assembly language. You do not have to use the frame pointer, just use $sp if you need to use the stack. You do not have to show the stack initialization nor stack cleanup. If you need a specific value for an address, just make an assumption.
int A;
main()
{
int B = 5;
B = A+B
}; // main
//Disassembly starts here
!main()
{
//stack and frame pointer init // you do not have to show it
! int B = 5; //fill in the blanks
! B = A + B; //fill in the blanks
} // main
A:
.zero 4
main:
push rbp
mov rbp, rsp
mov DWORD PTR [rbp-4], 5
mov eax, DWORD PTR A[rip]
add DWORD PTR [rbp-4], eax
mov eax, 0
pop rbp
ret