struct S {
double x;
int *ip;
int a[12];
};
Assuming the function foo on the left is compiled into the assembly on the right, what expression is
missing at the blank after the return keyword?
int foo(struct S *ptr) {
return _____________;
}
foo:
movq 8(%rdi), %rax
movl (%rax), %eax
ret
a) ptr->a[0]
b) ptr->a[1]
c) *ptr->ip
d) ptr->a
int foo(struct S *ptr) {
return _____________;
}
foo:
movq 8(%rdi), %rax
movl (%rax), %eax
ret

struct S double x int ip int a12 Assuming.pdf

  • 1.
    struct S { doublex; int *ip; int a[12]; }; Assuming the function foo on the left is compiled into the assembly on the right, what expression is missing at the blank after the return keyword? int foo(struct S *ptr) { return _____________; } foo: movq 8(%rdi), %rax movl (%rax), %eax ret a) ptr->a[0] b) ptr->a[1] c) *ptr->ip d) ptr->a int foo(struct S *ptr) { return _____________; } foo: movq 8(%rdi), %rax movl (%rax), %eax ret