Stack Example

In class, we looked at the following code and drew the associated runtime stack at various points in the program.
#include <stdio.h>

main() {
   int a,b;
   scanf("%d",&a);
   scanf("%d",&b);
   printf("%d",call_max(a,b));
}

int call_max(int x, int y) {
    return max(&x,&y);
}
  
int max(int *x, int *y) {
   if (*x > *y) return *x;
   else return *y;
}
Assembly code for the example