void* SVETLANA_createHardOptimisedMethod(byte* pCode, int length) {

    int i ;
    byte asmCode[19] = { 0x55,
			 0x89, 0xe5,
			 0x8b, 0x45, 0x08,
			 0x8b, 0x50, 0x08,
			 0x03, 0x50, 0x04,
			 0x89, 0x10,
			 0xc9,
			 0xc3};

    byte* codeMem = (byte*) malloc( 64 );
    assert(codeMem);
    for( i = 0; i < 19; i++)
	{
	    codeMem[i] = asmCode[i];
	}
    fprintf(stderr, "Returning method at %x %i \n", codeMem, length); 
    return codeMem;
}

//Now let us try to construct assembly code from the _bytecodes_, the four codes are:
/*
Method int stupidMethod(int, int)
   0 iload_1
   1 iload_2
   2 iadd
   3 ireturn   
*/

/*Something like:

iload_1: Load base_pointer + 8 + 4 and put it on the stack 
iload_2: Load base_pointer + 8 + 8 and put it on the stack 
iadd:    Add the two values on the stack and save in the topmost place
ireturn: Does nothing

Ok now we can do (iload1)
    pushl 0xc(%ebp)
Ok now we can do (iload2)
    pushl 0x10(%ebp)
and iadd
    addl  $0x4(%esp), (%esp)

*/


//Ok, now the interpreter should call this method when it sees "stupidMethod"
//Does it make any sense to have the pi32Vars? These are the previous methods vars
//Take out the pi32Vars

void* do_asm_stupidMethod(  int32* piOptop)
{
    //C prologue
    // pushl %ebp  push base pointer onto stack
    // movl %esp,%ebp make
    /*    __asm__ ("movl %eax,":(pi32Vars + 1));
    __asm__ ("\n movl %ebx, pi32Vars + 2");
    __asm__ ("\n addl %ebx,%eax");
    __asm__ ("\n movl %ecx, pbOptop");
   __asm__ ("\n movl %ecx[$0], %ebx");*/
  //  pi32Vars = NULL;
  //    int a = pi32Vars[0]; 
  ///    a++;
  //    pi32Vars[0] = a;
    int c = piOptop[1] + piOptop[2]; //Remember to skip the aref!
    *(piOptop) = c;
}


