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

	iload y
	IFEQ end_if1		// ( y == 0 )		
	
	iload x
	iflt if2		// ( x < 0 )
	goto ty
if2:
	bipush 0
	iload x
	isub
	istore x		// x = -x
	bipush 1
	iload sign
	iadd        		// sign++
	istore sign
	
ty:
        iload y
	iflt if3		// ( y < 0 )
	goto pre_w 
if3:
	bipush 0
	iload y
	isub
	istore y		// y = -y
	bipush 1
	iload sign
	iadd        		// sign++
	istore sign

pre_w:
	bipush 0
	istore q		// q = 0

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

	bipush 1
	iload sign
	isub
	IFEQ if4		// ( sign == 0 )
	goto end_if2

if4:
	bipush 0
	iload q
	isub
	istore q		// ( q = -q )
	goto end_if2


end_if1:
        bipush 0
        ireturn                 // return 0;


end_if2:
	iload q
	ireturn			// return q

.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   1
.define OBJREF = 44
    
        bipush OBJREF
	bipush 8  
	bipush OBJREF
        bipush 2
	bipush 5
        invokevirtual imul     
	iadd
	bipush 1
	bipush OBJREF
	bipush 3
	bipush 2
	invokevirtual imul
	iadd
	bipush 4
	isub
	invokevirtual idiv
        ireturn                 // return aritmetisk udtryk
