#include <civlc.cvh>

int *p;
_Bool start = $false;
$scope root = $here;
void f(){
  $when(start);
  p = (int*) $malloc(root, sizeof(int));
  h = &fh;
  //$free(&fh, p);
}

void g(){
  $heap gh;

  $when(start);
  h = &gh;
  //p = (int*) $malloc(h, sizeof(int));
  //$free(&gh, p);
}

void main(){
  $proc ps[2];

  ps[0] = $spawn f();
  ps[1] = $spawn g();
  start = $true;
  $wait ps[0];
  $wait ps[1];
  $free(h, p);
}
