#include <iostream>

// Forward definitions
int f(int& x);

// Global definitions
static int x = 0;
int y = 0;

int main() {
  for (int i=0; i < 5; i++) {
    int arg = x;
    int r = f(x);
    cout << " f(" << arg << ") -> " << r;
    cout << " Glob x=" << x << endl;
    cout << " Glob y=" << y << endl;
  }
}
int f(int& x) {
  int y=0;
  static int z=0;
  y++;
  z+=2;
  x = y + z;
  cout << " Loc x=" << x;
  cout << " Loc y=" << y;
  cout << " Loc z=" << z;
  return z;
} 
