Written work 10
Due on November 29th @ 3:00 PM (in class, to Drew, or at Engineering front office)
Not accepted late
Question 1

Draw the x64 assembly for the following 3AC program:

		fn_foo: enter foo
		        [a] := 2
                        [b] := 3
		   L_1: [c] := [a] LT64 [b]
                        ifz [c] goto L_2
                        call bar
                        goto L_1
                   L_2: nop
                   L_3: leave
		

Question 2

Assume a function printString has been defined that prints a string. Show the x64 code corresponding to the the following snippet:

	void v(){
		console << "Hello world!";
	}
	

Question 3

Assume that there is a C compiler that uses the same allocation record scheme that we have presented in class. Show what the stack might look like at entry to v:

	int64_t v(int64_t c){
		int64_t a;
		int64_t b;
	}
	void main(){
		int64_t l;
		v(l + 2);
	}
	

Question 4

What is an ABI? What is the benefit of allowing two languages to have compatible ABIs?