Question: A C function procprob has four arguments u, a, v, and b. Each is either a signed number or a pointer to a signed number,

A C function procprob has four arguments u, a, v, and b. Each is either a signed number or a pointer to a signed number, where the numbers have different sizes. The function has the following body:

1 2 3 4  *u += a; *v += b; return sizeof (a) + sizeof (b); It compiles to the following x86-64 code:

(a) C code void proc(long int { 1 2 3 4 } (b) Generated assembly code 5 6 7 8 al, long #alp. a2, int *a2p.

5 6 movl ret $6, %eax

Determine a valid ordering and types of the four parameters. There are two correct answers.

1 2 3 4 *u += a; *v += b; return sizeof (a)+ sizeof (b); It compiles to the following x86-64 code: procprob: movslq %edi, %rdi addq %rdi, (%rdx) addb %sil, (%rcx)

Step by Step Solution

3.28 Rating (157 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

This problem is a bit tricky due to the mixing of different data sizes Let us first describe one ans... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Computer Systems A Programmers Perspective Questions!