# Code generation for arrays and records, nesting
type arrContent = record of {a : int, b : int, c : int};
type myArr1 = array of arrContent;
type myArr2 = array of myArr1;
type myArr3 = array of myArr2;

var a : myArr3;
var t1 : int, t2 : int, t3 : int;
var p1 : arrContent;
var p2 : myArr1;
var p3 : myArr2;

allocate a of length 5;

t1 = 0;
while ( t1 < |a| ) do
{
  allocate a[t1] of length 6;
  t2 = 0;
  while ( t2 < |a[t1]| ) do
  {
    allocate a[t1][t2] of length 7;
    t3 = 0;
    while ( t3 < |a[t1][t2]| ) do
    {
      allocate a[t1][t2][t3];
      a[t1][t2][t3].a = t1;
      a[t1][t2][t3].b = t2;
      a[t1][t2][t3].c = t3;
      t3 = t3 + 1;
    } 
    t2 = t2 + 1;
  } 
  t1 = t1 + 1;
} 

write a[4][5][6].a * 100 + a[4][5][6].b * 10 +a[4][5][6].c;
p1 = a[4][5][6];
a[4][5][6] = a[4][5][5];
a[4][5][5] = p1;
write a[4][5][6].a * 100 + a[4][5][6].b * 10 +a[4][5][6].c;
p2 = a[4][5];
a[4][5] = a[4][4];
a[4][4] = p2;
write a[4][5][6].a * 100 + a[4][5][6].b * 10 +a[4][5][6].c;
p3 = a[4];
a[4] = a[3];
a[3] = p3;
write a[4][5][6].a * 100 + a[4][5][6].b * 10 +a[4][5][6].c;

