WCU / Cybersecurity
~/CSC 471/Class 03/KP 10
Class 03 · KP 10 / 21

A Concrete C Function

int add_squares(int a, int b) {
    int x = a * a;
    int y = b * b;
    return x + y;
}
  • Two int parameters arrive in registers (edi, esi).
  • Two locals, x and y, live in the frame.
  • Let us see how the compiler lays this out on the stack.