// File: /workspace/github_cpp_makefile_star2_O3/zerolfx[P]P-Machine/les.cpp
// Function: Les::execute(StackMachine*)
void Les::execute(StackMachine *stack) 
{
	// check if the stack contains at least two entries
	if(stack->fSP < 1)
		throw ExecutionError("instruction les: requires 2 stackelements to be present.");

	switch(fType)
	{
		case integer:
		{
			StackInteger p1;

			// check if the two uppermost stackentries are of type integer
			if(typeid(p1) != typeid(*(stack->fStore[stack->fSP])))
				throw ExecutionError("instruction les: SP does not point to element of type integer.");
			if(typeid(p1) != typeid(*(stack->fStore[stack->fSP - 1])))
				throw ExecutionError("instruction les: SP - 1 does not point to element of type integer.");

			break;
		}	
		case real:
		{
			StackReal p1;
			// check if the two uppermost stackentries are of type real
			if(typeid(p1) != typeid(*(stack->fStore[stack->fSP])))
				throw ExecutionError("instruction les: SP does not point to element of type real.");
			if(typeid(p1) != typeid(*(stack->fStore[stack->fSP - 1])))
				throw ExecutionError("instruction les: SP - 1 does not point to element of type real.");
			break;
		}
		case boolean:
		{
			StackBoolean p1;
			// check if the two uppermost stackentries are of type real
			if(typeid(p1) != typeid(*(stack->fStore[stack->fSP])))
				throw ExecutionError("instruction les: SP does not point to element of type boolean.");
			if(typeid(p1) != typeid(*(stack->fStore[stack->fSP - 1])))
				throw ExecutionError("instruction les: SP - 1 does not point to element of type boolean.");
			break;
		}
		case character:
		{
			StackCharacter p1;
			// check if the two uppermost stackentries are of type real
			if(typeid(p1) != typeid(*(stack->fStore[stack->fSP])))
				throw ExecutionError("instruction les: SP does not point to element of type character.");
			if(typeid(p1) != typeid(*(stack->fStore[stack->fSP - 1])))
				throw ExecutionError("instruction les: SP - 1 does not point to element of type character.");
			break;
		}
		case address:
		{
			StackAddress p1;
			// check if the two uppermost stackentries are of type real
			if(typeid(p1) != typeid(*(stack->fStore[stack->fSP])))
				throw ExecutionError("instruction les: SP does not point to element of type address.");
			if(typeid(p1) != typeid(*(stack->fStore[stack->fSP - 1])))
				throw ExecutionError("instruction les: SP - 1 does not point to element of type address.");
			break;
		}

	}
		
	// compare
	StackBoolean *result;
	if(*(stack->fStore[stack->fSP - 1]) < *(stack->fStore[stack->fSP]))
		result = new StackBoolean(true);
	else
		result = new StackBoolean(false);
		
	// remove operands
	delete stack->fStore[stack->fSP];
	stack->fStore[stack->fSP] = 0;
	delete stack->fStore[stack->fSP - 1];
	stack->fStore[stack->fSP - 1] = 0;
	stack->fStore.pop_back();
	stack->fStore.pop_back();
	--stack->fSP;

	// put result on top of stack
	stack->fStore.push_back(result);
	
	// adding cost of this instruction
	stack->fTime.count("les");

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x30, %rsp
cmpl $0x0, 0xb4(%rsi)
jle 0x10559
movq %rsi, %rbx
movl 0x8(%rdi), %eax
cmpq $0x4, %rax
ja 0x1042d
leaq 0x14b09(%rip), %rcx     # 0x24c18
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq -0x50(%rbp), %rdi
xorps %xmm0, %xmm0
callq 0x1abfc
movslq 0xb4(%rbx), %r15
movq 0x18(%rbx), %r12
movq (%r12,%r15,8), %rax
testq %rax, %rax
je 0x105c1
movq (%rax), %rax
movq -0x8(%rax), %rax
leaq 0x23a7e(%rip), %rcx     # 0x33bc8
movq 0x8(%rcx), %r14
movq 0x8(%rax), %rsi
cmpq %rsi, %r14
je 0x10171
cmpb $0x2a, (%r14)
je 0x1067d
movq %r14, %rdi
callq 0x6310
testl %eax, %eax
jne 0x1067d
movq -0x8(%r12,%r15,8), %rax
testq %rax, %rax
je 0x105c1
movq (%rax), %rax
movq -0x8(%rax), %rax
movq 0x8(%rax), %rsi
cmpq %rsi, %r14
je 0x101a9
cmpb $0x2a, (%r14)
je 0x1083a
movq %r14, %rdi
callq 0x6310
testl %eax, %eax
jne 0x1083a
leaq -0x50(%rbp), %rdi
callq 0x1ac2a
jmp 0x1042d
leaq -0x50(%rbp), %rdi
xorl %esi, %esi
callq 0x1a104
movslq 0xb4(%rbx), %r15
movq 0x18(%rbx), %r12
movq (%r12,%r15,8), %rax
testq %rax, %rax
je 0x105b2
movq (%rax), %rax
movq -0x8(%rax), %rax
leaq 0x23778(%rip), %rcx     # 0x33960
movq 0x8(%rcx), %r14
movq 0x8(%rax), %rsi
cmpq %rsi, %r14
je 0x1020f
cmpb $0x2a, (%r14)
je 0x105cb
movq %r14, %rdi
callq 0x6310
testl %eax, %eax
jne 0x105cb
movq -0x8(%r12,%r15,8), %rax
testq %rax, %rax
je 0x105b2
movq (%rax), %rax
movq -0x8(%rax), %rax
movq 0x8(%rax), %rsi
cmpq %rsi, %r14
je 0x10247
cmpb $0x2a, (%r14)
je 0x10788
movq %r14, %rdi
callq 0x6310
testl %eax, %eax
jne 0x10788
leaq -0x50(%rbp), %rdi
callq 0x1a128
jmp 0x1042d
leaq -0x50(%rbp), %rdi
xorl %esi, %esi
callq 0x1ae40
movslq 0xb4(%rbx), %r15
movq 0x18(%rbx), %r12
movq (%r12,%r15,8), %rax
testq %rax, %rax
je 0x105b7
movq (%rax), %rax
movq -0x8(%rax), %rax
leaq 0x23a12(%rip), %rcx     # 0x33c98
movq 0x8(%rcx), %r14
movq 0x8(%rax), %rsi
cmpq %rsi, %r14
je 0x102ad
cmpb $0x2a, (%r14)
je 0x10624
movq %r14, %rdi
callq 0x6310
testl %eax, %eax
jne 0x10624
movq -0x8(%r12,%r15,8), %rax
testq %rax, %rax
je 0x105b7
movq (%rax), %rax
movq -0x8(%rax), %rax
movq 0x8(%rax), %rsi
cmpq %rsi, %r14
je 0x102e5
cmpb $0x2a, (%r14)
je 0x107e1
movq %r14, %rdi
callq 0x6310
testl %eax, %eax
jne 0x107e1
leaq -0x50(%rbp), %rdi
callq 0x1ae64
jmp 0x1042d
leaq -0x50(%rbp), %rdi
movl $0x61, %esi
callq 0x1b03c
movslq 0xb4(%rbx), %r15
movq 0x18(%rbx), %r12
movq (%r12,%r15,8), %rax
testq %rax, %rax
je 0x105bc
movq (%rax), %rax
movq -0x8(%rax), %rax
leaq 0x23a41(%rip), %rcx     # 0x33d68
movq 0x8(%rcx), %r14
movq 0x8(%rax), %rsi
cmpq %rsi, %r14
je 0x1034e
cmpb $0x2a, (%r14)
je 0x106d6
movq %r14, %rdi
callq 0x6310
testl %eax, %eax
jne 0x106d6
movq -0x8(%r12,%r15,8), %rax
testq %rax, %rax
je 0x105bc
movq (%rax), %rax
movq -0x8(%rax), %rax
movq 0x8(%rax), %rsi
cmpq %rsi, %r14
je 0x10386
cmpb $0x2a, (%r14)
je 0x10893
movq %r14, %rdi
callq 0x6310
testl %eax, %eax
jne 0x10893
leaq -0x50(%rbp), %rdi
callq 0x1b060
jmp 0x1042d
leaq -0x50(%rbp), %rdi
xorl %esi, %esi
callq 0x1a9d4
movslq 0xb4(%rbx), %r15
movq 0x18(%rbx), %r12
movq (%r12,%r15,8), %rax
testq %rax, %rax
je 0x105c6
movq (%rax), %rax
movq -0x8(%rax), %rax
leaq 0x23733(%rip), %rcx     # 0x33af8
movq 0x8(%rcx), %r14
movq 0x8(%rax), %rsi
cmpq %rsi, %r14
je 0x103ec
cmpb $0x2a, (%r14)
je 0x1072f
movq %r14, %rdi
callq 0x6310
testl %eax, %eax
jne 0x1072f
movq -0x8(%r12,%r15,8), %rax
testq %rax, %rax
je 0x105c6
movq (%rax), %rax
movq -0x8(%rax), %rax
movq 0x8(%rax), %rsi
cmpq %rsi, %r14
je 0x10424
cmpb $0x2a, (%r14)
je 0x108e9
movq %r14, %rdi
callq 0x6310
testl %eax, %eax
jne 0x108e9
leaq -0x50(%rbp), %rdi
callq 0x1a9f8
movslq 0xb4(%rbx), %rax
movq 0x18(%rbx), %rcx
movq -0x8(%rcx,%rax,8), %rdi
movq (%rcx,%rax,8), %rsi
callq 0x1a987
movl %eax, %r15d
movl $0x10, %edi
callq 0x6200
movq %rax, %r14
testb %r15b, %r15b
je 0x1046a
movq %r14, %rdi
movl $0x1, %esi
callq 0x1ae40
jmp 0x10474
movq %r14, %rdi
xorl %esi, %esi
callq 0x1ae40
movslq 0xb4(%rbx), %rax
movq 0x18(%rbx), %rcx
movq (%rcx,%rax,8), %r12
testq %r12, %r12
je 0x10490
movq %r12, %rdi
callq 0x1a300
leaq 0x18(%rbx), %r15
movl $0x8, %esi
movq %r12, %rdi
callq 0x6210
movslq 0xb4(%rbx), %rax
movq 0x18(%rbx), %rcx
movq $0x0, (%rcx,%rax,8)
movq 0x18(%rbx), %rcx
movq -0x8(%rcx,%rax,8), %r12
testq %r12, %r12
je 0x104ca
movq %r12, %rdi
callq 0x1a300
movl $0x8, %esi
movq %r12, %rdi
callq 0x6210
movslq 0xb4(%rbx), %rax
movq 0x18(%rbx), %rcx
movq $0x0, -0x8(%rcx,%rax,8)
addq $-0x10, 0x20(%rbx)
decq %rax
movl %eax, 0xb4(%rbx)
leaq -0x40(%rbp), %rsi
movq %r14, (%rsi)
movq %r15, %rdi
callq 0xa334
leaq -0x30(%rbp), %r14
movq %r14, -0x10(%r14)
leaq 0x149db(%rip), %rsi     # 0x24ef2
leaq 0x149d7(%rip), %rdx     # 0x24ef5
leaq -0x40(%rbp), %rdi
callq 0x746c
addq $0x78, %rbx
leaq -0x40(%rbp), %rsi
movq %rbx, %rdi
callq 0x1cbc8
movq -0x40(%rbp), %rdi
cmpq %r14, %rdi
je 0x1054c
movq -0x30(%rbp), %rsi
incq %rsi
callq 0x6210
addq $0x30, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movl $0x20, %edi
callq 0x6100
movq %rax, %r14
leaq -0x30(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x146bc(%rip), %rsi     # 0x24c31
leaq 0x146ed(%rip), %rdx     # 0x24c69
leaq -0x40(%rbp), %rdi
callq 0x746c
movb $0x1, %r12b
leaq -0x40(%rbp), %rsi
movq %r14, %rdi
callq 0x1b14c
xorl %r12d, %r12d
leaq 0x224ea(%rip), %rsi     # 0x32a88
leaq 0xabc5(%rip), %rdx      # 0x1b16a
movq %r14, %rdi
callq 0x63e0
jmp 0x1093d
callq 0x6250
callq 0x6250
callq 0x6250
callq 0x6250
callq 0x6250
movl $0x20, %edi
callq 0x6100
movq %rax, %r14
leaq -0x30(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x14889(%rip), %rsi     # 0x24e70
leaq 0x148c0(%rip), %rdx     # 0x24eae
leaq -0x40(%rbp), %rdi
callq 0x746c
movb $0x1, %r12b
leaq -0x40(%rbp), %rsi
movq %r14, %rdi
callq 0x1b14c
xorl %r12d, %r12d
leaq 0x22478(%rip), %rsi     # 0x32a88
leaq 0xab53(%rip), %rdx      # 0x1b16a
movq %r14, %rdi
callq 0x63e0
jmp 0x1093d
movl $0x20, %edi
callq 0x6100
movq %rax, %r14
leaq -0x30(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x14728(%rip), %rsi     # 0x24d68
leaq 0x1475f(%rip), %rdx     # 0x24da6
leaq -0x40(%rbp), %rdi
callq 0x746c
movb $0x1, %r12b
leaq -0x40(%rbp), %rsi
movq %r14, %rdi
callq 0x1b14c
xorl %r12d, %r12d
leaq 0x2241f(%rip), %rsi     # 0x32a88
leaq 0xaafa(%rip), %rdx      # 0x1b16a
movq %r14, %rdi
callq 0x63e0
jmp 0x1093d
movl $0x20, %edi
callq 0x6100
movq %rax, %r14
leaq -0x30(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x14653(%rip), %rsi     # 0x24cec
leaq 0x14687(%rip), %rdx     # 0x24d27
leaq -0x40(%rbp), %rdi
callq 0x746c
movb $0x1, %r12b
leaq -0x40(%rbp), %rsi
movq %r14, %rdi
callq 0x1b14c
xorl %r12d, %r12d
leaq 0x223c6(%rip), %rsi     # 0x32a88
leaq 0xaaa1(%rip), %rdx      # 0x1b16a
movq %r14, %rdi
callq 0x63e0
jmp 0x1093d
movl $0x20, %edi
callq 0x6100
movq %rax, %r14
leaq -0x30(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x146f8(%rip), %rsi     # 0x24dea
leaq 0x14731(%rip), %rdx     # 0x24e2a
leaq -0x40(%rbp), %rdi
callq 0x746c
movb $0x1, %r12b
leaq -0x40(%rbp), %rsi
movq %r14, %rdi
callq 0x1b14c
xorl %r12d, %r12d
leaq 0x2236d(%rip), %rsi     # 0x32a88
leaq 0xaa48(%rip), %rdx      # 0x1b16a
movq %r14, %rdi
callq 0x63e0
jmp 0x1093d
movl $0x20, %edi
callq 0x6100
movq %rax, %r14
leaq -0x30(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x1451f(%rip), %rsi     # 0x24c6a
leaq 0x14556(%rip), %rdx     # 0x24ca8
leaq -0x40(%rbp), %rdi
callq 0x746c
movb $0x1, %r12b
leaq -0x40(%rbp), %rsi
movq %r14, %rdi
callq 0x1b14c
xorl %r12d, %r12d
leaq 0x22314(%rip), %rsi     # 0x32a88
leaq 0xa9ef(%rip), %rdx      # 0x1b16a
movq %r14, %rdi
callq 0x63e0
jmp 0x1093d
movl $0x20, %edi
callq 0x6100
movq %rax, %r14
leaq -0x30(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x1470b(%rip), %rsi     # 0x24eaf
leaq 0x14746(%rip), %rdx     # 0x24ef1
leaq -0x40(%rbp), %rdi
callq 0x746c
movb $0x1, %r12b
leaq -0x40(%rbp), %rsi
movq %r14, %rdi
callq 0x1b14c
xorl %r12d, %r12d
leaq 0x222bb(%rip), %rsi     # 0x32a88
leaq 0xa996(%rip), %rdx      # 0x1b16a
movq %r14, %rdi
callq 0x63e0
jmp 0x1093d
movl $0x20, %edi
callq 0x6100
movq %rax, %r14
leaq -0x30(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x145aa(%rip), %rsi     # 0x24da7
leaq 0x145e5(%rip), %rdx     # 0x24de9
leaq -0x40(%rbp), %rdi
callq 0x746c
movb $0x1, %r12b
leaq -0x40(%rbp), %rsi
movq %r14, %rdi
callq 0x1b14c
xorl %r12d, %r12d
leaq 0x22262(%rip), %rsi     # 0x32a88
leaq 0xa93d(%rip), %rdx      # 0x1b16a
movq %r14, %rdi
callq 0x63e0
jmp 0x1093d
movl $0x20, %edi
callq 0x6100
movq %rax, %r14
leaq -0x30(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x144d2(%rip), %rsi     # 0x24d28
leaq 0x1450a(%rip), %rdx     # 0x24d67
leaq -0x40(%rbp), %rdi
callq 0x746c
movb $0x1, %r12b
leaq -0x40(%rbp), %rsi
movq %r14, %rdi
callq 0x1b14c
xorl %r12d, %r12d
leaq 0x22209(%rip), %rsi     # 0x32a88
leaq 0xa8e4(%rip), %rdx      # 0x1b16a
movq %r14, %rdi
callq 0x63e0
jmp 0x1093d
movl $0x20, %edi
callq 0x6100
movq %rax, %r14
leaq -0x30(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x1457c(%rip), %rsi     # 0x24e2b
leaq 0x145b9(%rip), %rdx     # 0x24e6f
leaq -0x40(%rbp), %rdi
callq 0x746c
movb $0x1, %r12b
leaq -0x40(%rbp), %rsi
movq %r14, %rdi
callq 0x1b14c
xorl %r12d, %r12d
leaq 0x221b0(%rip), %rsi     # 0x32a88
leaq 0xa88b(%rip), %rdx      # 0x1b16a
movq %r14, %rdi
callq 0x63e0
jmp 0x1093d
movl $0x20, %edi
callq 0x6100
movq %rax, %r14
leaq -0x30(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x143a4(%rip), %rsi     # 0x24ca9
leaq 0x143df(%rip), %rdx     # 0x24ceb
leaq -0x40(%rbp), %rdi
callq 0x746c
movb $0x1, %r12b
leaq -0x40(%rbp), %rsi
movq %r14, %rdi
callq 0x1b14c
xorl %r12d, %r12d
leaq 0x2215a(%rip), %rsi     # 0x32a88
leaq 0xa835(%rip), %rdx      # 0x1b16a
movq %r14, %rdi
callq 0x63e0
jmp 0x10960
jmp 0x10982
jmp 0x10992
jmp 0x109b4
jmp 0x109c4
jmp 0x109e3
jmp 0x109f0
jmp 0x10a0f
jmp 0x10a1c
jmp 0x10a3b
movq %rax, %rbx
movq -0x40(%rbp), %rdi
cmpq %r15, %rdi
je 0x10978
movq -0x30(%rbp), %rsi
incq %rsi
callq 0x6210
testb %r12b, %r12b
jne 0x10985
jmp 0x10a4b
movq %rax, %rbx
movq %r14, %rdi
callq 0x6170
jmp 0x10a4b
movq %rax, %rbx
movq -0x40(%rbp), %rdi
cmpq %r15, %rdi
je 0x109aa
movq -0x30(%rbp), %rsi
incq %rsi
callq 0x6210
testb %r12b, %r12b
jne 0x109b7
jmp 0x10a6d
movq %rax, %rbx
movq %r14, %rdi
callq 0x6170
jmp 0x10a6d
movq %rax, %rbx
movq -0x40(%rbp), %rdi
cmpq %r15, %rdi
je 0x109dc
movq -0x30(%rbp), %rsi
incq %rsi
callq 0x6210
testb %r12b, %r12b
jne 0x109e6
jmp 0x10a5c
movq %rax, %rbx
movq %r14, %rdi
callq 0x6170
jmp 0x10a5c
movq %rax, %rbx
movq -0x40(%rbp), %rdi
cmpq %r15, %rdi
je 0x10a08
movq -0x30(%rbp), %rsi
incq %rsi
callq 0x6210
testb %r12b, %r12b
jne 0x10a12
jmp 0x10a7b
movq %rax, %rbx
movq %r14, %rdi
callq 0x6170
jmp 0x10a7b
movq %rax, %rbx
movq -0x40(%rbp), %rdi
cmpq %r15, %rdi
je 0x10a34
movq -0x30(%rbp), %rsi
incq %rsi
callq 0x6210
testb %r12b, %r12b
jne 0x10a3e
jmp 0x10a89
movq %rax, %rbx
movq %r14, %rdi
callq 0x6170
jmp 0x10a89
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x1a9f8
jmp 0x10aec
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x1ac2a
jmp 0x10aec
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x1b060
jmp 0x10aec
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x1ae64
jmp 0x10aec
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x1a128
jmp 0x10aec
jmp 0x10a96
movq %rax, %rbx
movl $0x10, %esi
movq %r14, %rdi
jmp 0x10ae2
movq %rax, %rbx
movq -0x40(%rbp), %rdi
cmpq %r15, %rdi
je 0x10abb
movq -0x30(%rbp), %rsi
incq %rsi
callq 0x6210
testb %r12b, %r12b
jne 0x10ac5
jmp 0x10aec
movq %rax, %rbx
movq %r14, %rdi
callq 0x6170
jmp 0x10aec
movq %rax, %rbx
movq -0x40(%rbp), %rdi
cmpq %r14, %rdi
je 0x10aec
movq -0x30(%rbp), %rsi
incq %rsi
callq 0x6210
jmp 0x10aec
movq %rax, %rbx
movq %rbx, %rdi
callq 0x6410