Skip to content

3.70

A.

  • e1.p 0
  • e1.y 8
  • e2.x 0
  • e2.next 8

B.

16 bytes

C.

    void proc (union ele *up) up in %rdi
1   proc:
2   movq    8(%rdi), %rax   # %rax = up->next
3   movq    (%rax), %rdx    # %rdx = up->next->p
4   movq    (%rdx), %rdx    # %rdx = *(up->next->p)
5   subq    8(%rax), %rdx   # %rdx = *(up->next->p) - up->next->y
6   movq    %rdx, (%rdi)    # up->x = *(up->next->p) - up->next->y
7   ret

Filling in the C code:

void proc (union ele *up) {
    up->x = *(up->next->p) - up->next->y;
}