// File: /workspace/github_cpp_makefile_star2_O3/zerolfx[P]P-Machine/equ.cpp
// Function: Equ::execute(StackMachine*)
void Equ::execute(StackMachine *stack) 
{
	// check if the stack contains at least two entries
	if(stack->fSP < 1)
		throw ExecutionError("instruction equ: 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 equ: SP does not point to element of type integer.");
			if(typeid(p1) != typeid(*(stack->fStore[stack->fSP - 1])))
				throw ExecutionError("instruction equ: 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 equ: SP does not point to element of type real.");
			if(typeid(p1) != typeid(*(stack->fStore[stack->fSP - 1])))
				throw ExecutionError("instruction equ: 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 equ: SP does not point to element of type boolean.");
			if(typeid(p1) != typeid(*(stack->fStore[stack->fSP - 1])))
				throw ExecutionError("instruction equ: 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 equ: SP does not point to element of type character.");
			if(typeid(p1) != typeid(*(stack->fStore[stack->fSP - 1])))
				throw ExecutionError("instruction equ: 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 equ: SP does not point to element of type address.");
			if(typeid(p1) != typeid(*(stack->fStore[stack->fSP - 1])))
				throw ExecutionError("instruction equ: SP - 1 does not point to element of type address.");
			break;
		}

	}
		
	// compare
	StackBoolean *result;
	if(*(stack->fStore[stack->fSP]) == *(stack->fStore[stack->fSP - 1]))
		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("equ");

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x30, %rsp
cmpl $0x0, 0xb4(%rsi)
jle 0xab4d
movq %rsi, %rbx
movl 0x8(%rdi), %eax
cmpq $0x4, %rax
ja 0xaa21
leaq 0x19215(%rip), %rcx     # 0x23918
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 0xabb5
movq (%rax), %rax
movq -0x8(%rax), %rax
leaq 0x2948a(%rip), %rcx     # 0x33bc8
movq 0x8(%rcx), %r14
movq 0x8(%rax), %rsi
cmpq %rsi, %r14
je 0xa765
cmpb $0x2a, (%r14)
je 0xac71
movq %r14, %rdi
callq 0x6310
testl %eax, %eax
jne 0xac71
movq -0x8(%r12,%r15,8), %rax
testq %rax, %rax
je 0xabb5
movq (%rax), %rax
movq -0x8(%rax), %rax
movq 0x8(%rax), %rsi
cmpq %rsi, %r14
je 0xa79d
cmpb $0x2a, (%r14)
je 0xae2e
movq %r14, %rdi
callq 0x6310
testl %eax, %eax
jne 0xae2e
leaq -0x50(%rbp), %rdi
callq 0x1ac2a
jmp 0xaa21
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 0xaba6
movq (%rax), %rax
movq -0x8(%rax), %rax
leaq 0x29184(%rip), %rcx     # 0x33960
movq 0x8(%rcx), %r14
movq 0x8(%rax), %rsi
cmpq %rsi, %r14
je 0xa803
cmpb $0x2a, (%r14)
je 0xabbf
movq %r14, %rdi
callq 0x6310
testl %eax, %eax
jne 0xabbf
movq -0x8(%r12,%r15,8), %rax
testq %rax, %rax
je 0xaba6
movq (%rax), %rax
movq -0x8(%rax), %rax
movq 0x8(%rax), %rsi
cmpq %rsi, %r14
je 0xa83b
cmpb $0x2a, (%r14)
je 0xad7c
movq %r14, %rdi
callq 0x6310
testl %eax, %eax
jne 0xad7c
leaq -0x50(%rbp), %rdi
callq 0x1a128
jmp 0xaa21
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 0xabab
movq (%rax), %rax
movq -0x8(%rax), %rax
leaq 0x2941e(%rip), %rcx     # 0x33c98
movq 0x8(%rcx), %r14
movq 0x8(%rax), %rsi
cmpq %rsi, %r14
je 0xa8a1
cmpb $0x2a, (%r14)
je 0xac18
movq %r14, %rdi
callq 0x6310
testl %eax, %eax
jne 0xac18
movq -0x8(%r12,%r15,8), %rax
testq %rax, %rax
je 0xabab
movq (%rax), %rax
movq -0x8(%rax), %rax
movq 0x8(%rax), %rsi
cmpq %rsi, %r14
je 0xa8d9
cmpb $0x2a, (%r14)
je 0xadd5
movq %r14, %rdi
callq 0x6310
testl %eax, %eax
jne 0xadd5
leaq -0x50(%rbp), %rdi
callq 0x1ae64
jmp 0xaa21
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 0xabb0
movq (%rax), %rax
movq -0x8(%rax), %rax
leaq 0x2944d(%rip), %rcx     # 0x33d68
movq 0x8(%rcx), %r14
movq 0x8(%rax), %rsi
cmpq %rsi, %r14
je 0xa942
cmpb $0x2a, (%r14)
je 0xacca
movq %r14, %rdi
callq 0x6310
testl %eax, %eax
jne 0xacca
movq -0x8(%r12,%r15,8), %rax
testq %rax, %rax
je 0xabb0
movq (%rax), %rax
movq -0x8(%rax), %rax
movq 0x8(%rax), %rsi
cmpq %rsi, %r14
je 0xa97a
cmpb $0x2a, (%r14)
je 0xae87
movq %r14, %rdi
callq 0x6310
testl %eax, %eax
jne 0xae87
leaq -0x50(%rbp), %rdi
callq 0x1b060
jmp 0xaa21
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 0xabba
movq (%rax), %rax
movq -0x8(%rax), %rax
leaq 0x2913f(%rip), %rcx     # 0x33af8
movq 0x8(%rcx), %r14
movq 0x8(%rax), %rsi
cmpq %rsi, %r14
je 0xa9e0
cmpb $0x2a, (%r14)
je 0xad23
movq %r14, %rdi
callq 0x6310
testl %eax, %eax
jne 0xad23
movq -0x8(%r12,%r15,8), %rax
testq %rax, %rax
je 0xabba
movq (%rax), %rax
movq -0x8(%rax), %rax
movq 0x8(%rax), %rsi
cmpq %rsi, %r14
je 0xaa18
cmpb $0x2a, (%r14)
je 0xaedd
movq %r14, %rdi
callq 0x6310
testl %eax, %eax
jne 0xaedd
leaq -0x50(%rbp), %rdi
callq 0x1a9f8
movslq 0xb4(%rbx), %rax
movq 0x18(%rbx), %rcx
movq -0x8(%rcx,%rax,8), %rsi
movq (%rcx,%rax,8), %rdi
callq 0x1a909
movl %eax, %r15d
movl $0x10, %edi
callq 0x6200
movq %rax, %r14
testb %r15b, %r15b
je 0xaa5e
movq %r14, %rdi
movl $0x1, %esi
callq 0x1ae40
jmp 0xaa68
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 0xaa84
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 0xaabe
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 0x190e7(%rip), %rsi     # 0x23bf2
leaq 0x190e3(%rip), %rdx     # 0x23bf5
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 0xab40
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 0x18dc8(%rip), %rsi     # 0x23931
leaq 0x18df9(%rip), %rdx     # 0x23969
leaq -0x40(%rbp), %rdi
callq 0x746c
movb $0x1, %r12b
leaq -0x40(%rbp), %rsi
movq %r14, %rdi
callq 0x1b14c
xorl %r12d, %r12d
leaq 0x27ef6(%rip), %rsi     # 0x32a88
leaq 0x105d1(%rip), %rdx     # 0x1b16a
movq %r14, %rdi
callq 0x63e0
jmp 0xaf31
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 0x18f95(%rip), %rsi     # 0x23b70
leaq 0x18fcc(%rip), %rdx     # 0x23bae
leaq -0x40(%rbp), %rdi
callq 0x746c
movb $0x1, %r12b
leaq -0x40(%rbp), %rsi
movq %r14, %rdi
callq 0x1b14c
xorl %r12d, %r12d
leaq 0x27e84(%rip), %rsi     # 0x32a88
leaq 0x1055f(%rip), %rdx     # 0x1b16a
movq %r14, %rdi
callq 0x63e0
jmp 0xaf31
movl $0x20, %edi
callq 0x6100
movq %rax, %r14
leaq -0x30(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x18e34(%rip), %rsi     # 0x23a68
leaq 0x18e6b(%rip), %rdx     # 0x23aa6
leaq -0x40(%rbp), %rdi
callq 0x746c
movb $0x1, %r12b
leaq -0x40(%rbp), %rsi
movq %r14, %rdi
callq 0x1b14c
xorl %r12d, %r12d
leaq 0x27e2b(%rip), %rsi     # 0x32a88
leaq 0x10506(%rip), %rdx     # 0x1b16a
movq %r14, %rdi
callq 0x63e0
jmp 0xaf31
movl $0x20, %edi
callq 0x6100
movq %rax, %r14
leaq -0x30(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x18d5f(%rip), %rsi     # 0x239ec
leaq 0x18d93(%rip), %rdx     # 0x23a27
leaq -0x40(%rbp), %rdi
callq 0x746c
movb $0x1, %r12b
leaq -0x40(%rbp), %rsi
movq %r14, %rdi
callq 0x1b14c
xorl %r12d, %r12d
leaq 0x27dd2(%rip), %rsi     # 0x32a88
leaq 0x104ad(%rip), %rdx     # 0x1b16a
movq %r14, %rdi
callq 0x63e0
jmp 0xaf31
movl $0x20, %edi
callq 0x6100
movq %rax, %r14
leaq -0x30(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x18e04(%rip), %rsi     # 0x23aea
leaq 0x18e3d(%rip), %rdx     # 0x23b2a
leaq -0x40(%rbp), %rdi
callq 0x746c
movb $0x1, %r12b
leaq -0x40(%rbp), %rsi
movq %r14, %rdi
callq 0x1b14c
xorl %r12d, %r12d
leaq 0x27d79(%rip), %rsi     # 0x32a88
leaq 0x10454(%rip), %rdx     # 0x1b16a
movq %r14, %rdi
callq 0x63e0
jmp 0xaf31
movl $0x20, %edi
callq 0x6100
movq %rax, %r14
leaq -0x30(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x18c2b(%rip), %rsi     # 0x2396a
leaq 0x18c62(%rip), %rdx     # 0x239a8
leaq -0x40(%rbp), %rdi
callq 0x746c
movb $0x1, %r12b
leaq -0x40(%rbp), %rsi
movq %r14, %rdi
callq 0x1b14c
xorl %r12d, %r12d
leaq 0x27d20(%rip), %rsi     # 0x32a88
leaq 0x103fb(%rip), %rdx     # 0x1b16a
movq %r14, %rdi
callq 0x63e0
jmp 0xaf31
movl $0x20, %edi
callq 0x6100
movq %rax, %r14
leaq -0x30(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x18e17(%rip), %rsi     # 0x23baf
leaq 0x18e52(%rip), %rdx     # 0x23bf1
leaq -0x40(%rbp), %rdi
callq 0x746c
movb $0x1, %r12b
leaq -0x40(%rbp), %rsi
movq %r14, %rdi
callq 0x1b14c
xorl %r12d, %r12d
leaq 0x27cc7(%rip), %rsi     # 0x32a88
leaq 0x103a2(%rip), %rdx     # 0x1b16a
movq %r14, %rdi
callq 0x63e0
jmp 0xaf31
movl $0x20, %edi
callq 0x6100
movq %rax, %r14
leaq -0x30(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x18cb6(%rip), %rsi     # 0x23aa7
leaq 0x18cf1(%rip), %rdx     # 0x23ae9
leaq -0x40(%rbp), %rdi
callq 0x746c
movb $0x1, %r12b
leaq -0x40(%rbp), %rsi
movq %r14, %rdi
callq 0x1b14c
xorl %r12d, %r12d
leaq 0x27c6e(%rip), %rsi     # 0x32a88
leaq 0x10349(%rip), %rdx     # 0x1b16a
movq %r14, %rdi
callq 0x63e0
jmp 0xaf31
movl $0x20, %edi
callq 0x6100
movq %rax, %r14
leaq -0x30(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x18bde(%rip), %rsi     # 0x23a28
leaq 0x18c16(%rip), %rdx     # 0x23a67
leaq -0x40(%rbp), %rdi
callq 0x746c
movb $0x1, %r12b
leaq -0x40(%rbp), %rsi
movq %r14, %rdi
callq 0x1b14c
xorl %r12d, %r12d
leaq 0x27c15(%rip), %rsi     # 0x32a88
leaq 0x102f0(%rip), %rdx     # 0x1b16a
movq %r14, %rdi
callq 0x63e0
jmp 0xaf31
movl $0x20, %edi
callq 0x6100
movq %rax, %r14
leaq -0x30(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x18c88(%rip), %rsi     # 0x23b2b
leaq 0x18cc5(%rip), %rdx     # 0x23b6f
leaq -0x40(%rbp), %rdi
callq 0x746c
movb $0x1, %r12b
leaq -0x40(%rbp), %rsi
movq %r14, %rdi
callq 0x1b14c
xorl %r12d, %r12d
leaq 0x27bbc(%rip), %rsi     # 0x32a88
leaq 0x10297(%rip), %rdx     # 0x1b16a
movq %r14, %rdi
callq 0x63e0
jmp 0xaf31
movl $0x20, %edi
callq 0x6100
movq %rax, %r14
leaq -0x30(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x18ab0(%rip), %rsi     # 0x239a9
leaq 0x18aeb(%rip), %rdx     # 0x239eb
leaq -0x40(%rbp), %rdi
callq 0x746c
movb $0x1, %r12b
leaq -0x40(%rbp), %rsi
movq %r14, %rdi
callq 0x1b14c
xorl %r12d, %r12d
leaq 0x27b66(%rip), %rsi     # 0x32a88
leaq 0x10241(%rip), %rdx     # 0x1b16a
movq %r14, %rdi
callq 0x63e0
jmp 0xaf54
jmp 0xaf76
jmp 0xaf86
jmp 0xafa8
jmp 0xafb8
jmp 0xafd7
jmp 0xafe4
jmp 0xb003
jmp 0xb010
jmp 0xb02f
movq %rax, %rbx
movq -0x40(%rbp), %rdi
cmpq %r15, %rdi
je 0xaf6c
movq -0x30(%rbp), %rsi
incq %rsi
callq 0x6210
testb %r12b, %r12b
jne 0xaf79
jmp 0xb03f
movq %rax, %rbx
movq %r14, %rdi
callq 0x6170
jmp 0xb03f
movq %rax, %rbx
movq -0x40(%rbp), %rdi
cmpq %r15, %rdi
je 0xaf9e
movq -0x30(%rbp), %rsi
incq %rsi
callq 0x6210
testb %r12b, %r12b
jne 0xafab
jmp 0xb061
movq %rax, %rbx
movq %r14, %rdi
callq 0x6170
jmp 0xb061
movq %rax, %rbx
movq -0x40(%rbp), %rdi
cmpq %r15, %rdi
je 0xafd0
movq -0x30(%rbp), %rsi
incq %rsi
callq 0x6210
testb %r12b, %r12b
jne 0xafda
jmp 0xb050
movq %rax, %rbx
movq %r14, %rdi
callq 0x6170
jmp 0xb050
movq %rax, %rbx
movq -0x40(%rbp), %rdi
cmpq %r15, %rdi
je 0xaffc
movq -0x30(%rbp), %rsi
incq %rsi
callq 0x6210
testb %r12b, %r12b
jne 0xb006
jmp 0xb06f
movq %rax, %rbx
movq %r14, %rdi
callq 0x6170
jmp 0xb06f
movq %rax, %rbx
movq -0x40(%rbp), %rdi
cmpq %r15, %rdi
je 0xb028
movq -0x30(%rbp), %rsi
incq %rsi
callq 0x6210
testb %r12b, %r12b
jne 0xb032
jmp 0xb07d
movq %rax, %rbx
movq %r14, %rdi
callq 0x6170
jmp 0xb07d
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x1a9f8
jmp 0xb0e0
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x1ac2a
jmp 0xb0e0
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x1b060
jmp 0xb0e0
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x1ae64
jmp 0xb0e0
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x1a128
jmp 0xb0e0
jmp 0xb08a
movq %rax, %rbx
movl $0x10, %esi
movq %r14, %rdi
jmp 0xb0d6
movq %rax, %rbx
movq -0x40(%rbp), %rdi
cmpq %r15, %rdi
je 0xb0af
movq -0x30(%rbp), %rsi
incq %rsi
callq 0x6210
testb %r12b, %r12b
jne 0xb0b9
jmp 0xb0e0
movq %rax, %rbx
movq %r14, %rdi
callq 0x6170
jmp 0xb0e0
movq %rax, %rbx
movq -0x40(%rbp), %rdi
cmpq %r14, %rdi
je 0xb0e0
movq -0x30(%rbp), %rsi
incq %rsi
callq 0x6210
jmp 0xb0e0
movq %rax, %rbx
movq %rbx, %rdi
callq 0x6410