// Integer multiplication.

.method imul
.args   3                       // ( int x, int y )
.define x = 1
.define y = 2                    
.locals 2                       // int p, int sign;
.define p = 3
.define sign = 4	

	bipush 1		
	istore sign		// sign = 1
	iload x
	IFLT if1		// ( x < 0 )
	goto end_if1		
if1:	
	bipush 0
	iload x
	isub
	istore x		// x = -x
	bipush 0
	istore sign		// sign = 0
	
end_if1:
        bipush 0
        istore p                // p = 0;

while:                          // while        
        iload x
	ifeq end_while		// ( x == 0 ) 
	iload x
        iflt  end_while         //    ( x > 0 )
                                // {
        iload x
        bipush 1
        isub
        istore x                //    x = x - 1;
        iload p
        iload y
        iadd
        istore p                //    p = p + y;
        goto while              // }
end_while:

	iload sign
	IFEQ if2		// ( sign == 0 )
	goto end_if2

if2:
	bipush 0
	iload p
	isub
	istore p		// ( p = -p )

end_if2:
        iload  p
        ireturn                 // return p;

.method main
.args   3
.define j = 2
.define i = 1
.define OBJREF = 44
  
        bipush OBJREF
        iload i
        iload j
        invokevirtual imul      
        ireturn                 // return imul(2,3);
