// .................................................. // Intermediate code for Factorial, after canonisation of intm tree // Source code was this: // --------------------------------------------------------------------------- // class Factorial{ // public static void main(String[] a){ // System.out.println(new Fac().ComputeFac(10)); // } // } // class Fac { // public int ComputeFac(int num){ // int num_aux ; // if (num < 1) // num_aux = 1 ; // else // num_aux = num * (this.ComputeFac(num-1)) ; // return num_aux ; // } // } // --------------------------------------------------------------------------- // NB: hacked to pass commandline argument as t77 // call like this: muHwI F3.intm 5 FCT LFactorial$main(REG t1, REG t77) = { L7: t34 <- CALL L_halloc_obj(0) t35 <- CALL L_init_obj(t34, 0) t39 <- CALL LFac$ComputeFac(t34, t77) CALL L_print(t39) JUMP L6 [L6] L6: } FCT LFac$ComputeFac(REG t1, REG t36) = { L9: CJUMP (t36<1) ? L3 : L4 L4: t42 <- t37 t41 <- t36 t40 <- CALL LFac$ComputeFac(t1, (t36-1)) t37 <- (t41*t40) JUMP L5 [L5] L5: t2 <- t37 JUMP L8 [L8] L3: t37 <- 1 JUMP L5 [L5] L8: }