[gnu.gcc.bug] gcc bug -- NeXT version 16

mdixon@parc.xerox.com (Mike Dixon) (10/14/89)

the code generated for lines 1880-1903 of the enclosed source file,
which (cleaned up slightly) look like this:
	if (trans10(X10,X12,&X16[0])) goto L5;
	{
	    int X19[2],X18,X17;

	    if (X16[0] != 0) goto L6;
	    X17 = S3[0];
	    X18 = S3[1];
	    if (((X17==0))) {
		int X20;

		union_tset(X16[1],X18,&X20);
		X19[0] = 0;
		X19[1] = X20;
		}
	    else {
		X19[1] = X16[1];
		X19[0] = 0;
		}
	    S3[0] = X19[0];
	    S3[1] = X19[1];
	    }
	goto L7;
is this:
    0xc9ee <trans9+182>:	pea -40(fp)
    0xc9f2 <trans9+186>:	movel a1,-(sp)
    0xc9f4 <trans9+188>:	movel a0,-(sp)
    0xc9f6 <trans9+190>:	bsr 0xc88e <trans10>
    0xc9fa <trans9+194>:	addaw #12,sp
    0xc9fe <trans9+198>:	tstl d0
    0xca00 <trans9+200>:	bne 0xcad0 <trans9+408>
    0xca04 <trans9+204>:	tstl -40(fp)
    0xca08 <trans9+208>:	bne 0xca2c <trans9+244>
    0xca0a <trans9+210>:	movel a5,d0
    0xca0c <trans9+212>:	tstl a4
    0xca0e <trans9+214>:	bne 0xca24 <trans9+236>
    0xca10 <trans9+216>:	pea -56(fp)
    0xca14 <trans9+220>:	movel d0,-(sp)
    0xca16 <trans9+222>:	movel -36(fp),-(sp)
    0xca1a <trans9+226>:	bsr 0x3fca <union_tset>
    0xca20 <trans9+232>:	addaw #12,sp
    0xca24 <trans9+236>:	moveal d0,a4
    0xca26 <trans9+238>:	moveal d1,a5
    0xca28 <trans9+240>:	bra 0xcad0 <trans9+408>
which stores the wrong values in S3 (a4 & a5)

this is NeXT version 16 (GNU version 1.34) of the compiler, with
options -g and -O.  the program works when compiled without
optimization.

(in case you hadn't guessed, this code wasn't written by a human)

here's the source file:
------------------------------------------------------------
#include "sk.h"
/* dynamic PLAN-SEQ-BLK */
struct D21 {
int F0[3];};

/* dynamic MAP-SEQ-BLK */
struct D20 {
int F0[3];};

/* dynamic MAP */
struct D19 {
int F0,F1,F2[3],F3[6],F4[2];};

/* dynamic SHUFFLE-SEQ-BLK */
struct D17 {
int F0[5];};

/* dynamic INST-SEQ-BLK */
struct D16 {
int F0[8];};

/* dynamic TEST-BLK */
struct D15 {
int F0[6];};

/* dynamic FOR-INFO */
struct D14 {
int F0[3],F1,F2,F3,F4[2];};

/* dynamic TRANS */
struct D13 {
int F0,F1;};

/* dynamic CACHE-ENTRY */
struct D12 {
int F0,F1,F2[2],F3[2];};

/* dynamic PLAN */
struct D11 {
int F0[4],F1[2];};

/* dynamic NAME */
struct D10 {
int F0,F1,F2[2],F3[2],F4;};

/* dynamic STRING-SEQ-BLK */
struct D7 {
int F0[3];};

/* dynamic TUPLE-BLK */
struct D6 {
int F0[3];};

/* dynamic TSET */
struct D5 {
int F0,F1,F2[2];};

/* dynamic ID-SEQ-BLK */
struct D4 {
int F0[3];};

/* dynamic ID */
struct D3 {
int F0,F1,F2,F3[2],F4,F5;};

/* dynamic TYPE-SEQ-BLK */
struct D2 {
int F0[3];};

/* dynamic TYPE */
struct D1 {
int F0[2],F1[2],F2,F3[2],F4[2],F5[2];};

int local_stores[2],all_maps[2],cache[2],next_string_num,all_strings[2],string_id_tset,bool_tset,win_tset,char_tset,nneg_tset,int_tset,tv_in_action_id,true_id,false_id,start_id,win_id,char_id,int_id,truth_value_type,action_type,string_type,character_type,number_type,unnamed,all_named_ids[2],scope_depth,at_eof,next_char,next_token[2];
static struct {int L;char Y[6];} Y5 = {6,"select"};
static struct {int L;char Y[6];} Y4 = {6,"split "};
static struct {int L;char Y[3];} Y3 = {3,"in "};
static struct {int L;char Y[3];} Y2 = {3,"-- "};
static struct {int L;char Y[7];} Y1 = {7,"\nwith:"};
static struct {int L;char Y[14];} Y0 = {14,"can't resolve:"};

static void trans31(int,int,int,int);
static void trans30(int,int,int);
static void trans29(int,int);
static void trans28(int,int);
static void trans27(int,int);
static void trans26(int,int result[1]);
static void trans25(int);
void resolve(int);
static void trans24(int,int,int,int,int,int,int,int,int result[7]);
static void trans23(int,int,int,int,int result[7]);
static void trans22(int,int,int,int,int,int,int,int,int result[7]);
static int trans21(int,int,int,int result[1]);
static void trans20(int,int,int,int,int,int result[7]);
static void trans19(int,int,int,int,int result[1]);
static void trans18(int,int,int,int,int result[7]);
static void trans17(int,int,int,int,int,int,int result[4]);
static void trans16(int,int,int,int,int,int result[1]);
static void trans15(int,int,int result[1]);
int translate(int,int,int result[1]);
static void trans14(int,int,int,int result[1]);
static void trans13(int,int result[1]);
static void trans12(int,int,int result[4]);
static int trans11(int,int,int,int,int,int,int result[1]);
static int trans10(int,int,int result[4]);
static void trans9(int,int,int result[4]);
static void trans8(int,int result[1]);
static void trans7(int,int,int,int result[1]);
static void trans6(int,int,int,int result[1]);
static void trans5(int,int,int,int,int result[1]);
static void trans4(int,int,int,int,int result[1]);
static void trans3(int,int result[1]);
static void trans2(int,int,int,int,int,int,int result[1]);
static void trans1(int,int,int,int,int result[3]);
void cons_plan_seq(int,int,int,int result[1]);

/* proc print(select(CHOICES),SCOPE-DEPTH) */
static void trans31(int X0,int X1,int X2,int X3) {
/* print(NIL) */
print_string(((int)&Y5));
/* print(plans,indent) */
trans28(X0,X3);
}

/* proc print(split(ID,PLAN-SEQ),SCOPE-DEPTH) */
static void trans30(int X0,int X1,int X2) {
/* print(NIL) */
print_string(((int)&Y4));
/* print(id) */
print_id(X0);
/* print(arms,indent) */
trans28(X1,X2);
}

/* proc print(narrow(TSET),SCOPE-DEPTH) */
static void trans29(int X0,int X1) {
/* print(NIL) */
print_string(((int)&Y3));
/* print(t) */
print_tset(X0);
}

/* proc print(PLAN-SEQ,SCOPE-DEPTH) */
static void trans28(int X0,int X1) {
/* for seq(PLAN,PLAN-SEQ-OR-NIL) <- plans,rest */
{
int X2[3];

X2[0] = ((struct D21 *)X0)->F0[0];
X2[1] = ((struct D21 *)X0)->F0[1];
X2[2] = ((struct D21 *)X0)->F0[2];
L1:;
/* print(p,indent) */
trans27(X2[0],X1);
/* endfor */
{
int X5,X4,X3;

if (X2[1] != 0) goto L2;
X3 = ((struct D21 *)X2[2])->F0[0];
X4 = ((struct D21 *)X2[2])->F0[1];
X5 = ((struct D21 *)X2[2])->F0[2];
X2[0] = X3;
X2[1] = X4;
X2[2] = X5;
goto L1;
}
}
L2:;
}

/* proc print(PLAN,SCOPE-DEPTH) */
static void trans27(int X0,int X1) {
int X2;

/* SCOPE-DEPTH <- +(indent,3) */
X2 = X1+3;
if (!(0<=X2)) error();
/* for PLAN <- plan,rest(p) and BOOL <- true,false */
{
int X8,X7,X6,X5,X4,X3;

X3 = X0;
X4 = 1;
L1:;
/* if first-line */
if (!(X4)) goto L3;
/* new-line(indent) */
new_line(X1);
/* print(NIL) */
print_string(((int)&Y2));
goto L4;
/* else */
L3:;
/* new-line(rest-indent) */
new_line(X2);
L4:;
/* endif */
/* print(first(p),rest-indent) */
X5 = ((struct D11 *)X3)->F0[0];
X6 = ((struct D11 *)X3)->F0[1];
X7 = ((struct D11 *)X3)->F0[2];
X8 = ((struct D11 *)X3)->F0[3];
if (((X5==2))) {
trans31(X6,X7,X8,X2);
}
else {
if (((X5==1))) {
trans30(X6,X7,X2);
}
else {
if (((X5==3))) {
print_map(X6);
}
else {
trans29(X6,X2);
}
}
}
/* endfor */
{
int X10,X9;

X9 = ((struct D11 *)X3)->F1[0];
X10 = ((struct D11 *)X3)->F1[1];
if (X9 != 0) goto L2;
X3 = X10;
X4 = 0;
goto L1;
}
}
L2:;
}

/* proc resolve-choices(PLAN-SEQ) -> PLAN-SEQ */
static void trans26(int X0,int X1[1]) {
int X4,X2;

/* if seq(PLAN,PLAN-SEQ) <- plans */
{
int X5,X3;

X2 = ((struct D21 *)X0)->F0[0];
X3 = ((struct D21 *)X0)->F0[1];
X4 = ((struct D21 *)X0)->F0[2];
if (X3 != 0) goto L1;
/* PLAN-SEQ <- resolve-choices(rest) */
{
int X11;

trans26(X4,&X5);
/* if PLAN-SEQ <- resolve-new-choice(first,domain(first),new-rest) */
{
int X10,X9,X8,X7,X6;

X6 = ((struct D11 *)X2)->F0[0];
X7 = ((struct D11 *)X2)->F0[1];
X8 = ((struct D11 *)X2)->F0[2];
X9 = ((struct D11 *)X2)->F0[3];
trans4(X6,X7,X8,X9,&X10);
if (trans21(X2,X10,X5,&X11)) goto L2;
/* return result */
X1[0] = X11;
return;
}
goto L3;
/* else */
L2:;
/* report-error */
if (!(1)) error();
/* print(NIL) */
print_string(((int)&Y0));
/* print(first,0) */
trans27(X2,0);
/* print(NIL) */
print_string(((int)&Y1));
/* print(rest,0) */
trans28(X4,0);
/* abort-compile */
abort_compile();
L3:;
/* endif */
}
}
goto L4;
/* else */
L1:;
/* return plans */
X1[0] = X0;
return;
L4:;
/* endif */
error();
}

/* proc resolve(PLAN-SEQ) */
static void trans25(int X0) {
/* for seq(PLAN,PLAN-SEQ-OR-NIL) <- plans,rest */
{
int X1[3];

X1[0] = ((struct D21 *)X0)->F0[0];
X1[1] = ((struct D21 *)X0)->F0[1];
X1[2] = ((struct D21 *)X0)->F0[2];
L1:;
/* resolve(plan) */
resolve(X1[0]);
/* endfor */
{
int X4,X3,X2;

if (X1[1] != 0) goto L2;
X2 = ((struct D21 *)X1[2])->F0[0];
X3 = ((struct D21 *)X1[2])->F0[1];
X4 = ((struct D21 *)X1[2])->F0[2];
X1[0] = X2;
X1[1] = X3;
X1[2] = X4;
goto L1;
}
}
L2:;
}

/* proc resolve(PLAN) */
void resolve(int X0) {
/* for PLAN <- plan,next */
{
int X3,X2,X1;

X1 = X0;
L1:;
/* PLAN-OR-NIL <- rest(p) */
{
int X7,X6,X5,X4;

X2 = ((struct D11 *)X1)->F1[0];
X3 = ((struct D11 *)X1)->F1[1];
/* ACTION <- first(p) */
X4 = ((struct D11 *)X1)->F0[0];
X5 = ((struct D11 *)X1)->F0[1];
X6 = ((struct D11 *)X1)->F0[2];
X7 = ((struct D11 *)X1)->F0[3];
/* if split(ID,PLAN-SEQ) <- first */
if (X4 != 1) goto L3;
/* resolve(arms) */
trans25(X6);
goto L4;
/* else */
L3:;
/* if select(CHOICES) <- first */
if (X4 != 2) goto L5;
/* CHOICES <- choices */
{
int X8;

/* resolve(plans) */
trans25(X5);
/* if not disjoint */
if (!(X7)) goto L7;
goto L6;
L7:;
/* PLAN-SEQ <- resolve-choices(plans) */
{
int X9;

trans26(X5,&X8);
/* if seq(PLAN,Planseq/nil) <- new-plans */
{
int X17,X15,X14,X13,X12,X11,X10;

X9 = ((struct D21 *)X8)->F0[0];
X10 = ((struct D21 *)X8)->F0[1];
X11 = ((struct D21 *)X8)->F0[2];
if (X10 != 1) goto L8;
/* set(first(p),first(one)) */
X12 = ((struct D11 *)X9)->F0[0];
X13 = ((struct D11 *)X9)->F0[1];
X14 = ((struct D11 *)X9)->F0[2];
X15 = ((struct D11 *)X9)->F0[3];
((struct D11 *)X1)->F0[0] = X12;
((struct D11 *)X1)->F0[1] = X13;
((struct D11 *)X1)->F0[2] = X14;
((struct D11 *)X1)->F0[3] = X15;
/* if PLAN <- rest(one) */
{
int X18,X16;

X16 = ((struct D11 *)X9)->F1[0];
X17 = ((struct D11 *)X9)->F1[1];
if (X16 != 0) goto L9;
/* set(rest(p),append(rest,next)) */
if (((X2==0))) {
trans15(X17,X3,&X18);
}
else {
X18 = X17;
}
((struct D11 *)X1)->F1[0] = 0;
((struct D11 *)X1)->F1[1] = X18;
}
L9:;
/* endif */
}
goto L10;
/* else */
L8:;
/* set(first(p),select(choices(new-plans,t,true))) */
((struct D11 *)X1)->F0[0] = 2;
((struct D11 *)X1)->F0[1] = X8;
((struct D11 *)X1)->F0[2] = X6;
((struct D11 *)X1)->F0[3] = 1;
L10:;
/* endif */
}
L6:;
/* endif */
}
L5:;
/* endif */
L4:;
/* endif */
/* endfor */
if (X2 != 0) goto L2;
X1 = X3;
goto L1;
}
}
L2:;
}

/* proc factor-splits(ID,PLAN-SEQ,PLAN-SEQ,PLAN-SEQ,PLAN-OR-NIL,PLAN-OR-NIL) -> MERGE-RESULT */
static void trans24(int X0,int X1,int X2,int X3,int X4,int X5,int X6,int X7,int X8[7]) {
int X10;

/* PLAN <- add-step(make-split(id,x-tails),x-rest) */
{
int X12,X9[4];

trans12(X0,X2,&X9[0]);
trans2(X9[0],X9[1],X9[2],X9[3],X4,X5,&X10);
/* PLAN <- add-step(make-split(id,y-tails),y-rest) */
{
int X13[7],X11[4];

trans12(X0,X3,&X11[0]);
trans2(X11[0],X11[1],X11[2],X11[3],X6,X7,&X12);
/* MERGE-RESULT <- merge-plans(new-x,new-y) */
trans18(0,X10,0,X12,&X13[0]);
/* if can't <- merge */
if (X13[0] != 2) goto L1;
/* return can't */
X8[0] = 2;
return;
L1:;
/* endif */
/* ACTION <- split(id,prefixes) */
/* if same <- merge */
{
int X14;

if (X13[0] != 1) goto L2;
/* false */
if (!(0)) error();
/* return upto(add-step(prefix,new-x),Plan/nil,Plan/nil) */
X8[0] = 0;
trans2(1,X0,X1,NIL,0,X10,&X14);
X8[1] = 0;
X8[2] = X14;
X8[3] = 1;
X8[5] = 1;
return;
}
goto L3;
/* else */
L2:;
/* if UPTO <- merge */
{
int X15;

if (X13[0] != 0) goto L4;
/* return upto(add-step(prefix,p1),p2,p3) */
X8[0] = 0;
trans2(1,X0,X1,NIL,X13[1],X13[2],&X15);
X8[1] = 0;
X8[2] = X15;
X8[4] = X13[4];
X8[3] = X13[3];
X8[6] = X13[6];
X8[5] = X13[5];
return;
}
L4:;
/* endif */
L3:;
/* endif */
error();
}
}
}

/* proc walk-arms(PLAN-SEQ,PLAN-SEQ,BOOL,BOOL) -> WALK-RESULT */
static void trans23(int X0,int X1,int X2,int X3,int X4[7]) {
int X7,X6,X5;

/* seq(PLAN,PLAN-SEQ-OR-NIL) <- xs */
{
int X10,X9,X8;

X5 = ((struct D21 *)X0)->F0[0];
X6 = ((struct D21 *)X0)->F0[1];
X7 = ((struct D21 *)X0)->F0[2];
/* seq(PLAN,PLAN-SEQ-OR-NIL) <- ys */
{
int X11[7];

X8 = ((struct D21 *)X1)->F0[0];
X9 = ((struct D21 *)X1)->F0[1];
X10 = ((struct D21 *)X1)->F0[2];
/* MERGE-RESULT <- merge-plans(x,y) */
trans18(0,X5,0,X8,&X11[0]);
{
int S6;

{
int X14[7],S7;

/* set(match',match) */
S6 = X2;
/* set(factorable',factorable) */
S7 = X3;
/* if same <- merge */
if (X11[0] != 1) goto L1;
/* set(factorable',true) */
S7 = 1;
goto L2;
/* else */
L1:;
/* set(match',false) */
S6 = 0;
/* if not can't <- merge */
if (X11[0] != 2) goto L4;
goto L3;
L4:;
/* set(factorable',true) */
S7 = 1;
L3:;
/* endif */
L2:;
/* endif */
/* WALK-RESULT <- walk-arms(x-rest,y-rest,match',factorable') */
{
int X13,X12;

X12 = S6;
X13 = S7;
if (((X6==0) && (X9==0))) {
trans23(X7,X10,X12,X13,&X14[0]);
}
else if (((X6==1) && (X9==1))) {
if (((X12==0) && (X13==0))) {
X14[0] = 0;
X14[1] = 1;
}
else if (((X12==1)) || ((X12==0) && (X13==1))) {
if (((X12==0) && (X13==1))) {
X14[0] = 1;
X14[1] = 1;
X14[3] = 1;
X14[5] = 1;
}
else {
X14[0] = 0;
X14[1] = 0;
}
}
else error();
}
else error();
/* if factor(PLAN-SEQ-OR-NIL,PLAN-SEQ-OR-NIL,PLAN-SEQ-OR-NIL) <- rest */
if (X14[0] != 1) goto L5;
/* if same <- merge */
{
int X16;

if (X11[0] != 1) goto L6;
/* PLAN <- one-step(narrow(codomain(x))) */
{
int X19,X18,X17,X15;

trans3(X5,&X15);
trans2(0,X15,NIL,NIL,1,NIL,&X16);
/* return factor(seq(x,p1),seq(nothing,p2),seq(nothing,p3)) */
X4[0] = 1;
cons_plan_seq(X5,X14[1],X14[2],&X17);
X4[1] = 0;
X4[2] = X17;
cons_plan_seq(X16,X14[3],X14[4],&X18);
X4[3] = 0;
X4[4] = X18;
cons_plan_seq(X16,X14[5],X14[6],&X19);
X4[5] = 0;
X4[6] = X19;
return;
}
}
goto L7;
/* else */
L6:;
/* if can't <- merge */
{
int X31;

if (X11[0] != 2) goto L8;
/* PLAN <- one-step(narrow(union(domain(x),domain(y)))) */
{
int X34,X33,X32,X30,X29,X28,X27,X26,X25,X24,X23,X22,X21,X20;

X20 = ((struct D11 *)X5)->F0[0];
X21 = ((struct D11 *)X5)->F0[1];
X22 = ((struct D11 *)X5)->F0[2];
X23 = ((struct D11 *)X5)->F0[3];
trans4(X20,X21,X22,X23,&X24);
X25 = ((struct D11 *)X8)->F0[0];
X26 = ((struct D11 *)X8)->F0[1];
X27 = ((struct D11 *)X8)->F0[2];
X28 = ((struct D11 *)X8)->F0[3];
trans4(X25,X26,X27,X28,&X29);
union_tset(X24,X29,&X30);
trans2(0,X30,NIL,NIL,1,NIL,&X31);
/* return factor(seq(nothing,p1),seq(x,p2),seq(y,p3)) */
X4[0] = 1;
cons_plan_seq(X31,X14[1],X14[2],&X32);
X4[1] = 0;
X4[2] = X32;
cons_plan_seq(X5,X14[3],X14[4],&X33);
X4[3] = 0;
X4[4] = X33;
cons_plan_seq(X8,X14[5],X14[6],&X34);
X4[5] = 0;
X4[6] = X34;
return;
}
}
goto L9;
/* else */
L8:;
/* UPTO <- merge */
{
int X37,X36,X35;

if (X11[0] != 0) error();
/* return factor(seq(q1,p1),seq(q2,p2),seq(q3,p3)) */
X4[0] = 1;
if (X11[1] != 0) error();
cons_plan_seq(X11[2],X14[1],X14[2],&X35);
X4[1] = 0;
X4[2] = X35;
if (X11[3] != 0) error();
cons_plan_seq(X11[4],X14[3],X14[4],&X36);
X4[3] = 0;
X4[4] = X36;
if (X11[5] != 0) error();
cons_plan_seq(X11[6],X14[5],X14[6],&X37);
X4[5] = 0;
X4[6] = X37;
return;
}
L9:;
/* endif */
L7:;
/* endif */
goto L10;
/* else */
L5:;
/* return rest */
X4[6] = X14[6];
X4[5] = X14[5];
X4[4] = X14[4];
X4[3] = X14[3];
X4[2] = X14[2];
X4[1] = X14[1];
X4[0] = X14[0];
return;
L10:;
/* endif */
error();
}
}
}
}
}
}

/* proc merge-splits(split(ID,PLAN-SEQ),split(ID,PLAN-SEQ),PLAN-OR-NIL,PLAN-OR-NIL) -> MERGE-RESULT */
static void trans22(int X0,int X1,int X2,int X3,int X4,int X5,int X6,int X7,int X8[7]) {
int X10[7],X9;

/* eq(x-id,y-id) */
X9 = X0==X2;
if (!(X9)) error();
/* WALK-RESULT <- walk-arms(x-arms,y-arms,true,false) */
trans23(X1,X3,1,0,&X10[0]);
/* if same <- walk */
{
int X11[7];

if (X10[0] != 0) goto L1;
if (X10[1] != 0) goto L1;
/* return add(split(x-id,x-arms),merge-plans(x-rest,y-rest)) */
trans18(X4,X5,X6,X7,&X11[0]);
if (((X11[0]==2))) {
X8[0] = 2;
}
else {
if (((X11[0]==1))) {
X8[0] = 1;
}
else {
int X12;

X8[0] = 0;
trans2(1,X0,X1,NIL,X11[1],X11[2],&X12);
X8[1] = 0;
X8[2] = X12;
X8[3] = X11[3];
X8[4] = X11[4];
X8[5] = X11[5];
X8[6] = X11[6];
}
}
return;
}
goto L2;
/* else */
L1:;
/* if can't <- walk */
if (X10[0] != 0) goto L3;
if (X10[1] != 1) goto L3;
/* false */
if (!(0)) error();
goto L4;
/* else */
L3:;
/* factor(PLAN-SEQ,PLAN-SEQ,PLAN-SEQ) <- walk */
if (X10[0] != 1) error();
if (X10[1] != 0) error();
if (X10[3] != 0) error();
if (X10[5] != 0) error();
/* return factor-splits(x-id,p1,p2,p3,x-rest,y-rest) */
trans24(X0,X10[2],X10[4],X10[6],X4,X5,X6,X7,&X8[0]);
return;
L4:;
/* endif */
L2:;
/* endif */
error();
}

/* proc resolve-new-choice(PLAN,TSET,PLAN-SEQ) -> PLAN-SEQ */
static int trans21(int X0,int X1,int X2,int X3[1]) {
int X6,X5,X4;

/* seq(PLAN,PLAN-SEQ-OR-NIL) <- old */
{
int X11;

X4 = ((struct D21 *)X2)->F0[0];
X5 = ((struct D21 *)X2)->F0[1];
X6 = ((struct D21 *)X2)->F0[2];
/* TSET <- domain(first) */
{
int X14[7],X13,X12,X10,X9,X8,X7;

X7 = ((struct D11 *)X4)->F0[0];
X8 = ((struct D11 *)X4)->F0[1];
X9 = ((struct D11 *)X4)->F0[2];
X10 = ((struct D11 *)X4)->F0[3];
trans4(X7,X8,X9,X10,&X11);
/* if disjoint(new-t,first-t) */
disjoint(X1,X11,&X12);
if (!(X12)) goto L1;
/* if PLAN-SEQ <- resolve-new-choice(new,new-t,rest) */
if (((X5==0))) {
if (trans21(X0,X1,X6,&X13)) goto L2;
}
else {
cons_plan_seq(X0,1,NIL,&X13);
}
/* return seq(first,resolved) */
cons_plan_seq(X4,0,X13,&X3[0]);
return 0;
goto L3;
/* else */
L2:;
/* fail */
return 1;
L3:;
/* endif */
goto L4;
/* else */
L1:;
/* MERGE-RESULT <- merge-plans(new,first) */
{
int X15;

trans18(0,X0,0,X4,&X14[0]);
/* if same <- merge */
if (X14[0] != 1) goto L5;
/* return old */
X3[0] = X2;
return 0;
goto L6;
/* else */
L5:;
/* if PLAN <- make-plan(merge) and PLAN-SEQ <- resolve-new-choice(new,union(new-t,first-t),rest) */
{
int X25;

if (((X14[0]==0 && (((X14[1]==0) && (X14[3]==1) && (X14[5]==1)))))) {
X15 = X14[2];
}
else if (((X14[0]==0 && (((X14[1]==0) && (X14[3]==0) && (X14[5]==0)))))) {
int X23,X22[3],X21,X20,X19,X18,X17,X16;

cons_plan_seq(X14[6],1,NIL,&X16);
X17 = ((struct D11 *)X14[6])->F0[0];
X18 = ((struct D11 *)X14[6])->F0[1];
X19 = ((struct D11 *)X14[6])->F0[2];
X20 = ((struct D11 *)X14[6])->F0[3];
trans4(X17,X18,X19,X20,&X21);
trans1(X14[4],X16,X21,1,&X22[0]);
trans2(2,X22[0],X22[1],X22[2],1,NIL,&X23);
trans15(X14[2],X23,&X15);
}
else goto L7;
{
int X24;

union_tset(X1,X11,&X24);
if (((X5==0))) {
if (trans21(X0,X24,X6,&X25)) goto L7;
}
else {
cons_plan_seq(X0,1,NIL,&X25);
}
/* return resolved */
X3[0] = X25;
return 0;
}
}
goto L8;
/* else */
L7:;
/* fail */
return 1;
L8:;
/* endif */
L6:;
/* endif */
}
L4:;
/* endif */
error();
}
}
}

/* proc add-to-select(PLAN,choices(PLAN-SEQ,TSET,true),PLAN-OR-NIL) -> MERGE-RESULT */
static void trans20(int X0,int X1,int X2,int X3,int X4,int X5[7]) {
int X10;

/* TSET <- domain(plan) */
{
int X11,X9,X8,X7,X6;

X6 = ((struct D11 *)X0)->F0[0];
X7 = ((struct D11 *)X0)->F0[1];
X8 = ((struct D11 *)X0)->F0[2];
X9 = ((struct D11 *)X0)->F0[3];
trans4(X6,X7,X8,X9,&X10);
/* PLAN-SEQ <- append-each(plans,tail) */
{
int X15;

if (((X3==0))) {
int X14,X13,X12;

X12 = ((struct D21 *)X1)->F0[0];
X13 = ((struct D21 *)X1)->F0[1];
X14 = ((struct D21 *)X1)->F0[2];
trans19(X12,X13,X14,X4,&X11);
}
else {
X11 = X1;
}
/* if PLAN-SEQ <- resolve-new-choice(plan,plan-t,old) */
{
int X17,X16;

if (trans21(X0,X10,X11,&X15)) goto L1;
/* return upto(one-step(select(choices(new-plans,union(t,plan-t),true))),Plan/nil,Plan/nil) */
X5[0] = 0;
union_tset(X2,X10,&X16);
trans2(2,X15,X16,1,1,NIL,&X17);
X5[1] = 0;
X5[2] = X17;
X5[3] = 1;
X5[5] = 1;
return;
}
goto L2;
/* else */
L1:;
/* return can't */
X5[0] = 2;
return;
L2:;
/* endif */
error();
}
}
}

/* proc append-each(seq(PLAN,PLAN-SEQ-OR-NIL),PLAN) -> PLAN-SEQ */
static void trans19(int X0,int X1,int X2,int X3,int X4[1]) {
int X6[2],X5;

/* return seq(append(p,tail),append-each(rest,tail)) */
trans15(X0,X3,&X5);
if (((X1==0))) {
int X10,X9,X8,X7;

X7 = ((struct D21 *)X2)->F0[0];
X8 = ((struct D21 *)X2)->F0[1];
X9 = ((struct D21 *)X2)->F0[2];
trans19(X7,X8,X9,X3,&X10);
X6[0] = 0;
X6[1] = X10;
}
else {
X6[0] = 1;
}
cons_plan_seq(X5,X6[0],X6[1],&X4[0]);
return;
error();
}

/* proc merge-plans(PLAN-OR-NIL,PLAN-OR-NIL) -> MERGE-RESULT */
static void trans18(int X0,int X1,int X2,int X3,int X4[7]) {
int X67,X66,X65,X61,X60,X59,X48,X47,X32,X17;

/* if Plan/nil <- x */
if (X0 != 1) goto L1;
/* if Plan/nil <- y */
if (X2 != 1) goto L2;
/* return same */
X4[0] = 1;
return;
goto L3;
/* else */
L2:;
/* return upto(Plan/nil,Plan/nil,y) */
X4[0] = 0;
X4[1] = 1;
X4[3] = 1;
X4[6] = X3;
X4[5] = X2;
return;
L3:;
/* endif */
goto L4;
/* else */
L1:;
/* if Plan/nil <- y or disjoint(domain(x),domain(y)) */
if (X2 != 1) goto L6;
goto L7;
L6:;
{
int X15,X14,X13,X12,X11,X10,X9,X8,X7,X6,X5;

if (X0 != 0) error();
X5 = ((struct D11 *)X1)->F0[0];
X6 = ((struct D11 *)X1)->F0[1];
X7 = ((struct D11 *)X1)->F0[2];
X8 = ((struct D11 *)X1)->F0[3];
trans4(X5,X6,X7,X8,&X9);
if (X2 != 0) error();
X10 = ((struct D11 *)X3)->F0[0];
X11 = ((struct D11 *)X3)->F0[1];
X12 = ((struct D11 *)X3)->F0[2];
X13 = ((struct D11 *)X3)->F0[3];
trans4(X10,X11,X12,X13,&X14);
disjoint(X9,X14,&X15);
if (!(X15)) goto L5;
}
L7:;
/* return upto(Plan/nil,x,y) */
X4[0] = 0;
X4[1] = 1;
X4[4] = X1;
X4[3] = X0;
X4[6] = X3;
X4[5] = X2;
return;
goto L8;
/* else */
L5:;
/* if narrow(TSET) <- first(x) and narrow(TSET) <- first(y) */
{
int X21,X19,X18,X16;

if (X0 != 0) goto L9;
X16 = ((struct D11 *)X1)->F0[0];
X17 = ((struct D11 *)X1)->F0[1];
X18 = ((struct D11 *)X1)->F0[2];
X19 = ((struct D11 *)X1)->F0[3];
if (X16 != 0) goto L9;
{
int X29[7],X28,X27,X26,X25,X24,X23,X22,X20;

if (X2 != 0) goto L9;
X20 = ((struct D11 *)X3)->F0[0];
X21 = ((struct D11 *)X3)->F0[1];
X22 = ((struct D11 *)X3)->F0[2];
X23 = ((struct D11 *)X3)->F0[3];
if (X20 != 0) goto L9;
/* if eq(x-t,y-t) */
X24 = X17==X21;
if (!(X24)) goto L10;
/* return add(narrow(x-t),merge-plans(rest(x),rest(y))) */
if (X0 != 0) error();
X25 = ((struct D11 *)X1)->F1[0];
X26 = ((struct D11 *)X1)->F1[1];
if (X2 != 0) error();
X27 = ((struct D11 *)X3)->F1[0];
X28 = ((struct D11 *)X3)->F1[1];
trans18(X25,X26,X27,X28,&X29[0]);
if (((X29[0]==2))) {
X4[0] = 2;
}
else {
if (((X29[0]==1))) {
X4[0] = 1;
}
else {
int X30;

X4[0] = 0;
trans2(0,X17,NIL,NIL,X29[1],X29[2],&X30);
X4[1] = 0;
X4[2] = X30;
X4[3] = X29[3];
X4[4] = X29[4];
X4[5] = X29[5];
X4[6] = X29[6];
}
}
return;
goto L11;
/* else */
L10:;
/* return can't */
X4[0] = 2;
return;
L11:;
/* endif */
}
}
goto L12;
/* else */
L9:;
/* if apply(MAP) <- first(x) and apply(MAP) <- first(y) */
{
int X36,X34,X33,X31;

if (X0 != 0) goto L13;
X31 = ((struct D11 *)X1)->F0[0];
X32 = ((struct D11 *)X1)->F0[1];
X33 = ((struct D11 *)X1)->F0[2];
X34 = ((struct D11 *)X1)->F0[3];
if (X31 != 3) goto L13;
{
int X44[7],X43,X42,X41,X40,X39,X38,X37,X35;

if (X2 != 0) goto L13;
X35 = ((struct D11 *)X3)->F0[0];
X36 = ((struct D11 *)X3)->F0[1];
X37 = ((struct D11 *)X3)->F0[2];
X38 = ((struct D11 *)X3)->F0[3];
if (X35 != 3) goto L13;
/* if eq(x-m,y-m) */
X39 = X32==X36;
if (!(X39)) goto L14;
/* return add(apply(x-m),merge-plans(rest(x),rest(y))) */
if (X0 != 0) error();
X40 = ((struct D11 *)X1)->F1[0];
X41 = ((struct D11 *)X1)->F1[1];
if (X2 != 0) error();
X42 = ((struct D11 *)X3)->F1[0];
X43 = ((struct D11 *)X3)->F1[1];
trans18(X40,X41,X42,X43,&X44[0]);
if (((X44[0]==2))) {
X4[0] = 2;
}
else {
if (((X44[0]==1))) {
X4[0] = 1;
}
else {
int X45;

X4[0] = 0;
trans2(3,X32,NIL,NIL,X44[1],X44[2],&X45);
X4[1] = 0;
X4[2] = X45;
X4[3] = X44[3];
X4[4] = X44[4];
X4[5] = X44[5];
X4[6] = X44[6];
}
}
return;
goto L15;
/* else */
L14:;
/* return can't */
X4[0] = 2;
return;
L15:;
/* endif */
}
}
goto L16;
/* else */
L13:;
/* if split(ID,PLAN-SEQ) <- first(x) and split(ID,PLAN-SEQ) <- first(y) */
{
int X52,X51,X49,X46;

if (X0 != 0) goto L17;
X46 = ((struct D11 *)X1)->F0[0];
X47 = ((struct D11 *)X1)->F0[1];
X48 = ((struct D11 *)X1)->F0[2];
X49 = ((struct D11 *)X1)->F0[3];
if (X46 != 1) goto L17;
{
int X57,X56,X55,X54,X53,X50;

if (X2 != 0) goto L17;
X50 = ((struct D11 *)X3)->F0[0];
X51 = ((struct D11 *)X3)->F0[1];
X52 = ((struct D11 *)X3)->F0[2];
X53 = ((struct D11 *)X3)->F0[3];
if (X50 != 1) goto L17;
/* return merge-splits(x-s,y-s,rest(x),rest(y)) */
if (X0 != 0) error();
X54 = ((struct D11 *)X1)->F1[0];
X55 = ((struct D11 *)X1)->F1[1];
if (X2 != 0) error();
X56 = ((struct D11 *)X3)->F1[0];
X57 = ((struct D11 *)X3)->F1[1];
trans22(X47,X48,X51,X52,X54,X55,X56,X57,&X4[0]);
return;
}
}
goto L18;
/* else */
L17:;
/* if select(CHOICES) <- first(x) */
{
int X63,X62,X58;

if (X0 != 0) goto L19;
X58 = ((struct D11 *)X1)->F0[0];
X59 = ((struct D11 *)X1)->F0[1];
X60 = ((struct D11 *)X1)->F0[2];
X61 = ((struct D11 *)X1)->F0[3];
if (X58 != 2) goto L19;
/* return add-to-select(y,choices,rest(x)) */
if (X2 != 0) error();
if (X61 != 1) error();
if (X0 != 0) error();
X62 = ((struct D11 *)X1)->F1[0];
X63 = ((struct D11 *)X1)->F1[1];
trans20(X3,X59,X60,X62,X63,&X4[0]);
return;
}
goto L20;
/* else */
L19:;
/* if select(CHOICES) <- first(y) */
{
int X69,X68,X64;

if (X2 != 0) goto L21;
X64 = ((struct D11 *)X3)->F0[0];
X65 = ((struct D11 *)X3)->F0[1];
X66 = ((struct D11 *)X3)->F0[2];
X67 = ((struct D11 *)X3)->F0[3];
if (X64 != 2) goto L21;
/* return add-to-select(x,choices,rest(y)) */
if (X0 != 0) error();
if (X67 != 1) error();
if (X2 != 0) error();
X68 = ((struct D11 *)X3)->F1[0];
X69 = ((struct D11 *)X3)->F1[1];
trans20(X1,X65,X66,X68,X69,&X4[0]);
return;
}
goto L22;
/* else */
L21:;
/* return can't */
X4[0] = 2;
return;
L22:;
/* endif */
L20:;
/* endif */
L18:;
/* endif */
L16:;
/* endif */
L12:;
/* endif */
L8:;
/* endif */
L4:;
/* endif */
error();
}

/* proc trans-with-maps(TSET,TSET,CHOICES-OR-NIL) -> CHOICES-OR-NIL */
static void trans17(int X0,int X1,int X2,int X3,int X4,int X5,int X6[4]) {
int S5[4];

/* set(result,simple) */
S5[0] = X2;
S5[1] = X3;
S5[2] = X4;
S5[3] = X5;
/* for seq(MAP,MAP-SEQ) <- all-maps,rest */
{
int X10,X9,X8,X7[3];

X8 = all_maps[0];
X9 = all_maps[1];
if (X8 != 0) goto L2;
X7[0] = ((struct D20 *)X9)->F0[0];
X7[1] = ((struct D20 *)X9)->F0[1];
X7[2] = ((struct D20 *)X9)->F0[2];
L1:;
/* TSET <- domain(map) */
{
int X12[4],X11;

X10 = ((struct D19 *)X7[0])->F0;
/* if share-ids(map-domain,from) and CHOICES <- simple-translations(from,map-domain) and PLAN <- translate(codomain(map),to) */
share_ids(X10,X0,&X11);
if (!(X11)) goto L3;
{
int X14;

trans9(X0,X10,&X12[0]);
if (X12[0] != 0) goto L3;
{
int X21[3],X20,X19,X18,X17,X16,X15,X13;

X13 = ((struct D19 *)X7[0])->F1;
if (translate(X13,X1,&X14)) goto L3;
/* set(result,add-choice(make-select(arg,add-step(apply(map),tail)),result)) */
trans2(3,X7[0],NIL,NIL,0,X14,&X15);
trans16(X12[1],X12[2],X12[3],0,X15,&X16);
X17 = S5[0];
X18 = S5[1];
X19 = S5[2];
X20 = S5[3];
if (((X17==1))) {
int X25,X24,X23,X22;

cons_plan_seq(X16,1,NIL,&X21[0]);
X22 = ((struct D11 *)X16)->F0[0];
X23 = ((struct D11 *)X16)->F0[1];
X24 = ((struct D11 *)X16)->F0[2];
X25 = ((struct D11 *)X16)->F0[3];
trans4(X22,X23,X24,X25,&X21[1]);
X21[2] = 1;
}
else {
trans1(X16,X18,X19,X20,&X21[0]);
}
S5[0] = 0;
S5[1] = X21[0];
S5[2] = X21[1];
S5[3] = X21[2];
}
}
L3:;
/* endif */
/* endfor */
{
int X28,X27,X26;

if (X7[1] != 0) goto L2;
X26 = ((struct D20 *)X7[2])->F0[0];
X27 = ((struct D20 *)X7[2])->F0[1];
X28 = ((struct D20 *)X7[2])->F0[2];
X7[0] = X26;
X7[1] = X27;
X7[2] = X28;
goto L1;
}
}
}
L2:;
/* return result */
X6[0] = S5[0];
X6[1] = S5[1];
X6[2] = S5[2];
X6[3] = S5[3];
return;
error();
}

/* proc make-select(CHOICES,PLAN-OR-NIL) -> PLAN */
static void trans16(int X0,int X1,int X2,int X3,int X4,int X5[1]) {
/* CHOICES <- choices */
{
int X6;

/* if seq(PLAN,Planseq/nil) <- plans */
{
int X8,X7;

X6 = ((struct D21 *)X0)->F0[0];
X7 = ((struct D21 *)X0)->F0[1];
X8 = ((struct D21 *)X0)->F0[2];
if (X7 != 1) goto L1;
/* return append(plan,rest) */
if (((X3==0))) {
trans15(X6,X4,&X5[0]);
}
else {
X5[0] = X6;
}
return;
}
goto L2;
/* else */
L1:;
/* return add-step(select(choices),rest) */
trans2(2,X0,X1,X2,X3,X4,&X5[0]);
return;
L2:;
/* endif */
error();
}
}

/* proc append(PLAN,PLAN) -> PLAN */
static void trans15(int X0,int X1,int X2[1]) {
int X23,X22,X21,X20,X11,X4;

/* if PLAN <- rest(x) */
{
int X9,X8,X7,X6,X5,X3;

X3 = ((struct D11 *)X0)->F1[0];
X4 = ((struct D11 *)X0)->F1[1];
if (X3 != 0) goto L1;
/* return add-step(first(x),append(rest,y)) */
X5 = ((struct D11 *)X0)->F0[0];
X6 = ((struct D11 *)X0)->F0[1];
X7 = ((struct D11 *)X0)->F0[2];
X8 = ((struct D11 *)X0)->F0[3];
trans15(X4,X1,&X9);
trans2(X5,X6,X7,X8,0,X9,&X2[0]);
return;
}
goto L2;
/* else */
L1:;
/* if narrow(TSET) <- first(x) and subset(domain(y),t) */
{
int X19,X18,X17,X16,X15,X14,X13,X12,X10;

X10 = ((struct D11 *)X0)->F0[0];
X11 = ((struct D11 *)X0)->F0[1];
X12 = ((struct D11 *)X0)->F0[2];
X13 = ((struct D11 *)X0)->F0[3];
if (X10 != 0) goto L3;
X14 = ((struct D11 *)X1)->F0[0];
X15 = ((struct D11 *)X1)->F0[1];
X16 = ((struct D11 *)X1)->F0[2];
X17 = ((struct D11 *)X1)->F0[3];
trans4(X14,X15,X16,X17,&X18);
subset(X18,X11,&X19);
if (!(X19)) goto L3;
/* return y */
X2[0] = X1;
return;
}
goto L4;
/* else */
L3:;
/* return add-step(first(x),y) */
X20 = ((struct D11 *)X0)->F0[0];
X21 = ((struct D11 *)X0)->F0[1];
X22 = ((struct D11 *)X0)->F0[2];
X23 = ((struct D11 *)X0)->F0[3];
trans2(X20,X21,X22,X23,0,X1,&X2[0]);
return;
L4:;
/* endif */
L2:;
/* endif */
error();
}

/* proc translate(TSET,TSET) -> PLAN */
int translate(int X0,int X1,int X2[1]) {
int X15,X3;

/* if subset(x,y) */
subset(X0,X1,&X3);
if (!(X3)) goto L1;
/* return one-step(narrow(x)) */
trans2(0,X0,NIL,NIL,1,NIL,&X2[0]);
return 0;
L1:;
/* endif */
/* for CACHE-ENTRY <- cache,next(c) */
{
int X12,X10,X9,X8,X7,X6,X5,X4;

X5 = cache[0];
X6 = cache[1];
if (X5 != 0) goto L3;
X4 = X6;
L2:;
/* if eq(from(c),x) and eq(to(c),y) */
X7 = ((struct D12 *)X4)->F0;
X8 = X7==X0;
if (!(X8)) goto L4;
X9 = ((struct D12 *)X4)->F1;
X10 = X9==X1;
if (!(X10)) goto L4;
/* if PLAN <- plan(c) */
{
int X11;

X11 = ((struct D12 *)X4)->F2[0];
X12 = ((struct D12 *)X4)->F2[1];
if (X11 != 0) goto L5;
/* return p */
X2[0] = X12;
return 0;
}
goto L6;
/* else */
L5:;
/* fail */
return 1;
L6:;
/* endif */
L4:;
/* endif */
/* endfor */
{
int X14,X13;

X13 = ((struct D12 *)X4)->F3[0];
X14 = ((struct D12 *)X4)->F3[1];
if (X13 != 0) goto L3;
X4 = X14;
goto L2;
}
}
L3:;
/* CACHE-ENTRY <- new */
{
int X17,X16;

X15 = (int)malloc(6*sizeof(int));
/* set(from(cache-entry),x) */
((struct D12 *)X15)->F0 = X0;
/* set(to(cache-entry),y) */
((struct D12 *)X15)->F1 = X1;
/* unset(plan(cache-entry)) */
((struct D12 *)X15)->F2[0] = 1;
((struct D12 *)X15)->F2[1] = NIL;
/* set(next(cache-entry),cache) */
X16 = cache[0];
X17 = cache[1];
((struct D12 *)X15)->F3[0] = X16;
((struct D12 *)X15)->F3[1] = X17;
/* set(cache,cache-entry) */
cache[0] = 0;
cache[1] = X15;
{
int X25,X24,X23,S4[4];

/* begin */
{
int X18[4];

/* CHOICES-OR-NIL <- simple-translations(x,y) */
{
int X21[4];

trans9(X0,X1,&X18[0]);
/* if CHOICES <- simple */
{
int X19[2];

if (X18[0] != 0) goto L7;
/* if TSET <- subtract(x,t) */
{
int X20[4];

subtract(X0,X18[2],&X19[0]);
if (X19[0] != 0) goto L8;
/* set(result,trans-with-maps(r,y,simple)) */
trans17(X19[1],X1,X18[0],X18[1],X18[2],X18[3],&X20[0]);
S4[0] = X20[0];
S4[1] = X20[1];
S4[2] = X20[2];
S4[3] = X20[3];
}
goto L9;
/* else */
L8:;
/* set(result,simple) */
S4[0] = X18[0];
S4[1] = X18[1];
S4[2] = X18[2];
S4[3] = X18[3];
L9:;
/* endif */
}
goto L10;
/* else */
L7:;
/* set(result,trans-with-maps(x,y,Choices/nil)) */
trans17(X0,X1,1,NIL,NIL,NIL,&X21[0]);
S4[0] = X21[0];
S4[1] = X21[1];
S4[2] = X21[2];
S4[3] = X21[3];
L10:;
/* endif */
}
}
/* end */
/* if CHOICES <- result */
{
int X26,X22;

X22 = S4[0];
X23 = S4[1];
X24 = S4[2];
X25 = S4[3];
if (X22 != 0) goto L11;
/* PLAN <- make-select(choices,Plan/nil) */
trans16(X23,X24,X25,1,NIL,&X26);
/* set(plan(cache-entry),r) */
((struct D12 *)X15)->F2[0] = 0;
((struct D12 *)X15)->F2[1] = X26;
/* return r */
X2[0] = X26;
return 0;
}
goto L12;
/* else */
L11:;
/* fail */
return 1;
L12:;
/* endif */
error();
}
}
}

/* proc narrow-tsets(seq(PLAN,PLAN-SEQ-OR-NIL)) -> TUPLE */
static void trans14(int X0,int X1,int X2,int X3[1]) {
int X5;

/* narrow(TSET) <- first(p) */
{
int X8[2],X7,X6,X4;

X4 = ((struct D11 *)X0)->F0[0];
X5 = ((struct D11 *)X0)->F0[1];
X6 = ((struct D11 *)X0)->F0[2];
X7 = ((struct D11 *)X0)->F0[3];
if (X4 != 0) error();
/* return seq(t,narrow-tsets(rest)) */
if (((X1==0))) {
int X12,X11,X10,X9;

X9 = ((struct D21 *)X2)->F0[0];
X10 = ((struct D21 *)X2)->F0[1];
X11 = ((struct D21 *)X2)->F0[2];
trans14(X9,X10,X11,&X12);
X8[0] = 0;
X8[1] = X12;
}
else {
X8[0] = 1;
}
cons_tuple(X5,X8[0],X8[1],&X3[0]);
return;
error();
}
}

/* proc just-narrows(PLAN-SEQ) -> BOOL */
static void trans13(int X0,int X1[1]) {
/* for seq(PLAN,PLAN-SEQ-OR-NIL) <- plans,rest */
{
int X2[3];

X2[0] = ((struct D21 *)X0)->F0[0];
X2[1] = ((struct D21 *)X0)->F0[1];
X2[2] = ((struct D21 *)X0)->F0[2];
L1:;
/* if not narrow(TSET) <- first(p) and Plan/nil <- rest(p) */
{
int X4;

{
int X6,X5,X3;

X3 = ((struct D11 *)X2[0])->F0[0];
X4 = ((struct D11 *)X2[0])->F0[1];
X5 = ((struct D11 *)X2[0])->F0[2];
X6 = ((struct D11 *)X2[0])->F0[3];
if (X3 != 0) goto L4;
{
int X8,X7;

X7 = ((struct D11 *)X2[0])->F1[0];
X8 = ((struct D11 *)X2[0])->F1[1];
if (X7 != 1) goto L4;
}
}
}
goto L3;
L4:;
/* return false */
X1[0] = 0;
return;
L3:;
/* endif */
/* endfor */
{
int X11,X10,X9;

if (X2[1] != 0) goto L2;
X9 = ((struct D21 *)X2[2])->F0[0];
X10 = ((struct D21 *)X2[2])->F0[1];
X11 = ((struct D21 *)X2[2])->F0[2];
X2[0] = X9;
X2[1] = X10;
X2[2] = X11;
goto L1;
}
}
L2:;
/* return true */
X1[0] = 1;
return;
error();
}

/* proc make-split(ID,PLAN-SEQ) -> ACTION */
static void trans12(int X0,int X1,int X2[4]) {
int X7,X6,X5,X4,X3;

/* if just-narrows(arms) */
trans13(X1,&X3);
if (!(X3)) goto L1;
/* return narrow(tset(id,narrow-tsets(arms))) */
X2[0] = 0;
X4 = ((struct D21 *)X1)->F0[0];
X5 = ((struct D21 *)X1)->F0[1];
X6 = ((struct D21 *)X1)->F0[2];
trans14(X4,X5,X6,&X7);
cons_tuple_tset(X0,X7,&X2[1]);
return;
goto L2;
/* else */
L1:;
/* return split(id,arms) */
X2[0] = 1;
X2[1] = X0;
X2[2] = X1;
return;
L2:;
/* endif */
error();
}

/* proc trans-tuple(seq(TSET,TUPLE-OR-NIL),seq(TSET,TUPLE-OR-NIL)) -> PLAN-SEQ */
static int trans11(int X0,int X1,int X2,int X3,int X4,int X5,int X6[1]) {
int X7;

/* if PLAN <- translate(x,y) */
{
int X14;

if (translate(X0,X3,&X7)) goto L1;
/* if Tuple/nil <- x-rest */
if (X1 != 1) goto L2;
/* return seq(p,Planseq/nil) */
cons_plan_seq(X7,1,NIL,&X6[0]);
return 0;
goto L3;
/* else */
L2:;
/* if PLAN-SEQ <- trans-tuple(x-rest,y-rest) */
{
int X13,X12,X11,X10,X9,X8;

if (X1 != 0) goto L4;
X8 = ((struct D6 *)X2)->F0[0];
X9 = ((struct D6 *)X2)->F0[1];
X10 = ((struct D6 *)X2)->F0[2];
if (X4 != 0) goto L4;
X11 = ((struct D6 *)X5)->F0[0];
X12 = ((struct D6 *)X5)->F0[1];
X13 = ((struct D6 *)X5)->F0[2];
if (trans11(X8,X9,X10,X11,X12,X13,&X14)) goto L4;
/* return seq(p,rest) */
cons_plan_seq(X7,0,X14,&X6[0]);
return 0;
}
L4:;
/* endif */
L3:;
/* endif */
}
L1:;
/* endif */
/* fail */
return 1;
error();
}

/* proc trans-id(TSET,TSET) -> ACTION */
static int trans10(int X0,int X1,int X2[4]) {
int X13,X3;

/* if TUPLE <- first-tuple(from) and TUPLE <- first-tuple(to) */
{
int X4;

if (first_tuple(X0,&X3)) goto L1;
{
int X11;

if (first_tuple(X1,&X4)) goto L1;
/* if PLAN-SEQ <- trans-tuple(x,y) */
{
int X12,X10,X9,X8,X7,X6,X5;

X5 = ((struct D6 *)X3)->F0[0];
X6 = ((struct D6 *)X3)->F0[1];
X7 = ((struct D6 *)X3)->F0[2];
X8 = ((struct D6 *)X4)->F0[0];
X9 = ((struct D6 *)X4)->F0[1];
X10 = ((struct D6 *)X4)->F0[2];
if (trans11(X5,X6,X7,X8,X9,X10,&X11)) goto L2;
/* return make-split(id(from),arms) */
X12 = ((struct D5 *)X0)->F0;
trans12(X12,X11,&X2[0]);
return 0;
}
goto L3;
/* else */
L2:;
/* fail */
return 1;
L3:;
/* endif */
}
}
goto L4;
/* else */
L1:;
/* if TSET <- intersect-id(from,to) */
if (intersect_id(X0,X1,&X13)) goto L5;
/* return narrow(t) */
X2[0] = 0;
X2[1] = X13;
return 0;
goto L6;
/* else */
L5:;
/* fail */
return 1;
L6:;
/* endif */
L4:;
/* endif */
error();
}

/* proc simple-translations(TSET,TSET) -> CHOICES-OR-NIL */
static void trans9(int X0,int X1,int X2[4]) {
int X8,X7,X6,X5,X4,X3;

/* if subset(from,to) */
subset(X0,X1,&X3);
if (!(X3)) goto L1;
/* return one-choice(one-step(narrow(from))) */
trans2(0,X0,NIL,NIL,1,NIL,&X4);
X2[0] = 0;
cons_plan_seq(X4,1,NIL,&X2[1]);
X5 = ((struct D11 *)X4)->F0[0];
X6 = ((struct D11 *)X4)->F0[1];
X7 = ((struct D11 *)X4)->F0[2];
X8 = ((struct D11 *)X4)->F0[3];
trans4(X5,X6,X7,X8,&X2[2]);
X2[3] = 1;
return;
L1:;
/* endif */
{
int S0[2];

{
int S1[2];

{
int S2[4];

{
int X45,X10,S3[2];

/* set(from',from) */
S0[0] = 0;
S0[1] = X0;
/* set(to',to) */
S1[0] = 0;
S1[1] = X1;
/* set(result,Choices/nil) */
S2[0] = 1;
S2[1] = NIL;
S2[2] = NIL;
S2[3] = NIL;
/* set(narrow,Tset/nil) */
S3[0] = 1;
S3[1] = NIL;
/* while TSET <- from' and TSET <- to' */
L2:;
{
int X12,X9;

X9 = S0[0];
X10 = S0[1];
if (X9 != 0) goto L3;
{
int X43,X42,X41,X40,X39,X38,X37,X36,X35,X34,X33,X32,X31,X16[4],X15,X14,X13,X11;

X11 = S1[0];
X12 = S1[1];
if (X11 != 0) goto L3;
/* if eq(id(from-t),id(to-t)) */
X13 = ((struct D5 *)X10)->F0;
X14 = ((struct D5 *)X12)->F0;
X15 = X13==X14;
if (!(X15)) goto L4;
/* if ACTION <- trans-id(from-t,to-t) */
{
int X26[3],X25,X24,X23,X22,X21;

if (trans10(X10,X12,&X16[0])) goto L5;
/* if narrow(TSET) <- a */
{
int X19[2],X18,X17;

if (X16[0] != 0) goto L6;
/* set(narrow,union(t,narrow)) */
X17 = S3[0];
X18 = S3[1];
if (((X17==0))) {
int X20;

union_tset(X16[1],X18,&X20);
X19[0] = 0;
X19[1] = X20;
}
else {
X19[1] = X16[1];
X19[0] = 0;
}
S3[0] = X19[0];
S3[1] = X19[1];
}
goto L7;
/* else */
L6:;
/* set(result,add-choice(one-step(a),result)) */
trans2(X16[0],X16[1],X16[2],X16[3],1,NIL,&X21);
X22 = S2[0];
X23 = S2[1];
X24 = S2[2];
X25 = S2[3];
if (((X22==1))) {
int X30,X29,X28,X27;

cons_plan_seq(X21,1,NIL,&X26[0]);
X27 = ((struct D11 *)X21)->F0[0];
X28 = ((struct D11 *)X21)->F0[1];
X29 = ((struct D11 *)X21)->F0[2];
X30 = ((struct D11 *)X21)->F0[3];
trans4(X27,X28,X29,X30,&X26[1]);
X26[2] = 1;
}
else {
trans1(X21,X23,X24,X25,&X26[0]);
}
S2[0] = 0;
S2[1] = X26[0];
S2[2] = X26[1];
S2[3] = X26[2];
L7:;
/* endif */
}
L5:;
/* endif */
/* set(from',rest(from-t)) */
X31 = ((struct D5 *)X10)->F2[0];
X32 = ((struct D5 *)X10)->F2[1];
S0[0] = X31;
S0[1] = X32;
/* set(to',rest(to-t)) */
X33 = ((struct D5 *)X12)->F2[0];
X34 = ((struct D5 *)X12)->F2[1];
S1[0] = X33;
S1[1] = X34;
goto L8;
/* else */
L4:;
/* if lt(id(from-t),id(to-t)) */
X35 = ((struct D5 *)X10)->F0;
X36 = ((struct D5 *)X12)->F0;
X37 = ((struct D3 *)X35)->F1;
X38 = ((struct D3 *)X36)->F1;
X39 = X37<X38;
if (!(X39)) goto L9;
/* set(from',rest(from-t)) */
X40 = ((struct D5 *)X10)->F2[0];
X41 = ((struct D5 *)X10)->F2[1];
S0[0] = X40;
S0[1] = X41;
goto L10;
/* else */
L9:;
/* set(to',rest(to-t)) */
X42 = ((struct D5 *)X12)->F2[0];
X43 = ((struct D5 *)X12)->F2[1];
S1[0] = X42;
S1[1] = X43;
L10:;
/* endif */
L8:;
/* endif */
}
}
/* endwhile */
goto L2;
L3:;
/* if TSET <- narrow */
{
int X50,X49,X48,X47,X46,X44;

X44 = S3[0];
X45 = S3[1];
if (X44 != 0) goto L11;
/* return add-choice(one-step(narrow(t)),result) */
trans2(0,X45,NIL,NIL,1,NIL,&X46);
X47 = S2[0];
X48 = S2[1];
X49 = S2[2];
X50 = S2[3];
if (((X47==1))) {
int X54,X53,X52,X51;

X2[0] = 0;
cons_plan_seq(X46,1,NIL,&X2[1]);
X51 = ((struct D11 *)X46)->F0[0];
X52 = ((struct D11 *)X46)->F0[1];
X53 = ((struct D11 *)X46)->F0[2];
X54 = ((struct D11 *)X46)->F0[3];
trans4(X51,X52,X53,X54,&X2[2]);
X2[3] = 1;
}
else {
int X55[3];

trans1(X46,X48,X49,X50,&X55[0]);
X2[0] = 0;
X2[1] = X55[0];
X2[2] = X55[1];
X2[3] = X55[2];
}
return;
}
goto L12;
/* else */
L11:;
/* return result */
X2[0] = S2[0];
X2[1] = S2[1];
X2[2] = S2[2];
X2[3] = S2[3];
return;
L12:;
/* endif */
error();
}
}
}
}
}

/* proc unioned-codomains(PLAN-SEQ) -> TSET */
static void trans8(int X0,int X1[1]) {
/* for seq(PLAN,PLAN-SEQ-OR-NIL) <- plans,rest and TSET <- codomain(p),union(result,codomain(p)) */
{
int X3,X2[3];

X2[0] = ((struct D21 *)X0)->F0[0];
X2[1] = ((struct D21 *)X0)->F0[1];
X2[2] = ((struct D21 *)X0)->F0[2];
trans3(X2[0],&X3);
L1:;
/* if Planseq/nil <- rest */
if (X2[1] != 1) goto L3;
/* return result */
X1[0] = X3;
return;
L3:;
/* endif */
/* endfor */
{
int X8,X7,X6,X5,X4;

if (X2[1] != 0) goto L2;
X4 = ((struct D21 *)X2[2])->F0[0];
X5 = ((struct D21 *)X2[2])->F0[1];
X6 = ((struct D21 *)X2[2])->F0[2];
X2[0] = X4;
X2[1] = X5;
X2[2] = X6;
trans3(X2[0],&X7);
union_tset(X3,X7,&X8);
X3 = X8;
goto L1;
}
}
L2:;
error();
}

/* proc codomains(seq(PLAN,PLAN-SEQ-OR-NIL)) -> TUPLE */
static void trans7(int X0,int X1,int X2,int X3[1]) {
int X5[2],X4;

/* return seq(codomain(p),codomains(rest)) */
trans3(X0,&X4);
if (((X1==0))) {
int X9,X8,X7,X6;

X6 = ((struct D21 *)X2)->F0[0];
X7 = ((struct D21 *)X2)->F0[1];
X8 = ((struct D21 *)X2)->F0[2];
trans7(X6,X7,X8,&X9);
X5[0] = 0;
X5[1] = X9;
}
else {
X5[0] = 1;
}
cons_tuple(X4,X5[0],X5[1],&X3[0]);
return;
error();
}

/* proc domains(seq(PLAN,PLAN-SEQ-OR-NIL)) -> TUPLE */
static void trans6(int X0,int X1,int X2,int X3[1]) {
int X9[2],X8,X7,X6,X5,X4;

/* return seq(domain(p),domains(rest)) */
X4 = ((struct D11 *)X0)->F0[0];
X5 = ((struct D11 *)X0)->F0[1];
X6 = ((struct D11 *)X0)->F0[2];
X7 = ((struct D11 *)X0)->F0[3];
trans4(X4,X5,X6,X7,&X8);
if (((X1==0))) {
int X13,X12,X11,X10;

X10 = ((struct D21 *)X2)->F0[0];
X11 = ((struct D21 *)X2)->F0[1];
X12 = ((struct D21 *)X2)->F0[2];
trans6(X10,X11,X12,&X13);
X9[0] = 0;
X9[1] = X13;
}
else {
X9[0] = 1;
}
cons_tuple(X8,X9[0],X9[1],&X3[0]);
return;
error();
}

/* proc codomain(ACTION) -> TSET */
static void trans5(int X0,int X1,int X2,int X3,int X4[1]) {
/* if narrow(TSET) <- a */
if (X0 != 0) goto L1;
/* return t */
X4[0] = X1;
return;
goto L2;
/* else */
L1:;
/* if select(CHOICES) <- a */
if (X0 != 2) goto L3;
/* return unioned-codomains(plans) */
trans8(X1,&X4[0]);
return;
goto L4;
/* else */
L3:;
/* if apply(MAP) <- a */
if (X0 != 3) goto L5;
/* return codomain(map) */
X4[0] = ((struct D19 *)X1)->F1;
return;
goto L6;
/* else */
L5:;
/* split(ID,PLAN-SEQ) <- a */
{
int X8,X7,X6,X5;

if (X0 != 1) error();
/* return tset(id,codomains(plans)) */
X5 = ((struct D21 *)X2)->F0[0];
X6 = ((struct D21 *)X2)->F0[1];
X7 = ((struct D21 *)X2)->F0[2];
trans7(X5,X6,X7,&X8);
cons_tuple_tset(X1,X8,&X4[0]);
return;
}
L6:;
/* endif */
L4:;
/* endif */
L2:;
/* endif */
error();
}

/* proc domain(ACTION) -> TSET */
static void trans4(int X0,int X1,int X2,int X3,int X4[1]) {
/* if narrow(TSET) <- a */
if (X0 != 0) goto L1;
/* return t */
X4[0] = X1;
return;
goto L2;
/* else */
L1:;
/* if select(CHOICES) <- a */
if (X0 != 2) goto L3;
/* return t */
X4[0] = X2;
return;
goto L4;
/* else */
L3:;
/* if apply(MAP) <- a */
if (X0 != 3) goto L5;
/* return domain(map) */
X4[0] = ((struct D19 *)X1)->F0;
return;
goto L6;
/* else */
L5:;
/* split(ID,PLAN-SEQ) <- a */
{
int X8,X7,X6,X5;

if (X0 != 1) error();
/* return tset(id,domains(plans)) */
X5 = ((struct D21 *)X2)->F0[0];
X6 = ((struct D21 *)X2)->F0[1];
X7 = ((struct D21 *)X2)->F0[2];
trans6(X5,X6,X7,&X8);
cons_tuple_tset(X1,X8,&X4[0]);
return;
}
L6:;
/* endif */
L4:;
/* endif */
L2:;
/* endif */
error();
}

/* proc codomain(PLAN) -> TSET */
static void trans3(int X0,int X1[1]) {
/* for PLAN <- plan,rest(p) */
{
int X2;

X2 = X0;
L1:;
/* if Plan/nil <- rest(p) */
{
int X8,X7,X6,X5,X4,X3;

X3 = ((struct D11 *)X2)->F1[0];
X4 = ((struct D11 *)X2)->F1[1];
if (X3 != 1) goto L3;
/* return codomain(first(p)) */
X5 = ((struct D11 *)X2)->F0[0];
X6 = ((struct D11 *)X2)->F0[1];
X7 = ((struct D11 *)X2)->F0[2];
X8 = ((struct D11 *)X2)->F0[3];
trans5(X5,X6,X7,X8,&X1[0]);
return;
}
L3:;
/* endif */
/* endfor */
{
int X10,X9;

X9 = ((struct D11 *)X2)->F1[0];
X10 = ((struct D11 *)X2)->F1[1];
if (X9 != 0) goto L2;
X2 = X10;
goto L1;
}
}
L2:;
error();
}

/* proc add-step(ACTION,PLAN-OR-NIL) -> PLAN */
static void trans2(int X0,int X1,int X2,int X3,int X4,int X5,int X6[1]) {
int X7;

/* PLAN <- new */
X7 = (int)malloc(6*sizeof(int));
/* set(rest(plan),rest) */
((struct D11 *)X7)->F1[0] = X4;
((struct D11 *)X7)->F1[1] = X5;
/* set(first(plan),first) */
((struct D11 *)X7)->F0[0] = X0;
((struct D11 *)X7)->F0[1] = X1;
((struct D11 *)X7)->F0[2] = X2;
((struct D11 *)X7)->F0[3] = X3;
/* return plan */
X6[0] = X7;
return;
error();
}

/* proc add-choice(PLAN,CHOICES) -> CHOICES */
static void trans1(int X0,int X1,int X2,int X3,int X4[3]) {
int X9;

/* TSET <- domain(plan) */
{
int X10,X8,X7,X6,X5;

X5 = ((struct D11 *)X0)->F0[0];
X6 = ((struct D11 *)X0)->F0[1];
X7 = ((struct D11 *)X0)->F0[2];
X8 = ((struct D11 *)X0)->F0[3];
trans4(X5,X6,X7,X8,&X9);
/* PLAN-SEQ <- seq(plan,plans) */
{
int X11;

cons_plan_seq(X0,0,X1,&X10);
/* TSET <- union(t,plan-t) */
union_tset(X2,X9,&X11);
/* if disjoint */
if (!(X3)) goto L1;
/* return choices(new-plans,new-t,disjoint(t,plan-t)) */
X4[0] = X10;
X4[1] = X11;
disjoint(X2,X9,&X4[2]);
return;
goto L2;
/* else */
L1:;
/* return choices(new-plans,new-t,false) */
X4[0] = X10;
X4[1] = X11;
X4[2] = 0;
return;
L2:;
/* endif */
error();
}
}
}

/* proc seq(PLAN,PLAN-SEQ-OR-NIL) -> PLAN-SEQ */
void cons_plan_seq(int X0,int X1,int X2,int X3[1]) {
int X4;

/* PLAN-SEQ-BLK <- new */
X4 = (int)malloc(3*sizeof(int));
/* set(contents(b),d) */
((struct D21 *)X4)->F0[0] = X0;
((struct D21 *)X4)->F0[1] = X1;
((struct D21 *)X4)->F0[2] = X2;
/* return b */
X3[0] = X4;
return;
error();
}
------------------------------------------------------------
and the include file:
------------------------------------------------------------
#include <limits.h>
#define NIL 0

volatile void error (void);
------------------------------------------------------------