Annotations in // ****************** METHOD ************** SEQ( LABEL tct12.main, // main method EXP( // EXP throws out the result CALL( // of the call this is NAME print, // necessary for print CALL( // because it doesn't return NAME first.foo, // anything. ESEQ( SEQ( // first argument to foo is SEQ( // the object; this code MOVE( // is the allocation and TEMP t37, // initialization. CALL( NAME malloc, CONST 8)), MOVE( MEM( BINOP(PLUS, TEMP t37, CONST 0)), CONST 0)), MOVE( MEM( BINOP(PLUS, TEMP t37, CONST 4)), CONST 0)), TEMP t37), CONST 1, // the other arguments CONST 0, CONST 3)))) ******************* METHOD ***************** SEQ( SEQ( SEQ( SEQ( SEQ( LABEL first.foo, MOVE( // variable initialization TEMP t36, CONST 0)), MOVE( MEM( BINOP(PLUS, // x = TEMP t25, CONST 0)), ESEQ( // allocate the array SEQ( // we allocate one MOVE( // extra word to TEMP t38, // store the length. CALL( NAME malloc, BINOP(MUL, BINOP(PLUS, // this adds one to TEMP t35, // the length CONST 1), CONST 4))), MOVE( // this puts the length MEM( // into that first TEMP t38), // slot of the array TEMP t35)), // (we adjust index TEMP t38))), // appropriately in x[index]) MOVE( TEMP t36, CONST 0)), SEQ( SEQ( LABEL L4, // top of the while loop CJUMP(EQ, ESEQ( // this ESEQ computes index < count SEQ( // and places the result (1 or 0) SEQ( // in t39 CJUMP(LT, TEMP t36, TEMP t35, L0,L1), // L0 is true label, L1 false label SEQ( SEQ( SEQ( LABEL L0, MOVE( TEMP t39, CONST 1)), JUMP( NAME L2)), // L2 is the joining point SEQ( LABEL L1, MOVE( TEMP t39, CONST 0)))), LABEL L2), TEMP t39), CONST 1, // index < count means t39 = 1 L5,L6)), // L5 is body of loop, L6 exit SEQ( SEQ( LABEL L5, SEQ( SEQ( LABEL L3, // I use a label at the top of MOVE( // nested statements just to MEM( // be sure I have some statement BINOP(PLUS, MEM( BINOP(PLUS, // x TEMP t25, CONST 0)), BINOP(MUL, // [index] BINOP(PLUS, TEMP t36, CONST 1), CONST 4))), TEMP t33)), // = z JUMP( NAME L4))), // back to top of loop LABEL L6))), MOVE( TEMP t2, // t2 is the RV MEM( BINOP(PLUS, // length is the 0th item TEMP t25, // in the array CONST 0))))