// File: /workspace/github_cpp_makefile_star2_O1/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 0xabbd
movq %rsi, %rbx
movl 0x8(%rdi), %eax
cmpq $0x4, %rax
ja 0xaa91
leaq 0x191a5(%rip), %rcx     # 0x23918
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq -0x50(%rbp), %rdi
xorps %xmm0, %xmm0
callq 0x1aec8
movslq 0xb4(%rbx), %r15
movq 0x18(%rbx), %r12
movq (%r12,%r15,8), %rax
testq %rax, %rax
je 0xac26
movq (%rax), %rax
movq -0x8(%rax), %rax
leaq 0x2941a(%rip), %rcx     # 0x33bc8
movq 0x8(%rcx), %r14
movq 0x8(%rax), %rsi
cmpq %rsi, %r14
je 0xa7d5
cmpb $0x2a, (%r14)
je 0xace4
movq %r14, %rdi
callq 0x6310
testl %eax, %eax
jne 0xace4
movq -0x8(%r12,%r15,8), %rax
testq %rax, %rax
je 0xac26
movq (%rax), %rax
movq -0x8(%rax), %rax
movq 0x8(%rax), %rsi
cmpq %rsi, %r14
je 0xa80d
cmpb $0x2a, (%r14)
je 0xaea6
movq %r14, %rdi
callq 0x6310
testl %eax, %eax
jne 0xaea6
leaq -0x50(%rbp), %rdi
callq 0x1aef6
jmp 0xaa91
leaq -0x50(%rbp), %rdi
xorl %esi, %esi
callq 0x1a3d0
movslq 0xb4(%rbx), %r15
movq 0x18(%rbx), %r12
movq (%r12,%r15,8), %rax
testq %rax, %rax
je 0xac17
movq (%rax), %rax
movq -0x8(%rax), %rax
leaq 0x29114(%rip), %rcx     # 0x33960
movq 0x8(%rcx), %r14
movq 0x8(%rax), %rsi
cmpq %rsi, %r14
je 0xa873
cmpb $0x2a, (%r14)
je 0xac30
movq %r14, %rdi
callq 0x6310
testl %eax, %eax
jne 0xac30
movq -0x8(%r12,%r15,8), %rax
testq %rax, %rax
je 0xac17
movq (%rax), %rax
movq -0x8(%rax), %rax
movq 0x8(%rax), %rsi
cmpq %rsi, %r14
je 0xa8ab
cmpb $0x2a, (%r14)
je 0xadf2
movq %r14, %rdi
callq 0x6310
testl %eax, %eax
jne 0xadf2
leaq -0x50(%rbp), %rdi
callq 0x1a3f4
jmp 0xaa91
leaq -0x50(%rbp), %rdi
xorl %esi, %esi
callq 0x1b10c
movslq 0xb4(%rbx), %r15
movq 0x18(%rbx), %r12
movq (%r12,%r15,8), %rax
testq %rax, %rax
je 0xac1c
movq (%rax), %rax
movq -0x8(%rax), %rax
leaq 0x293ae(%rip), %rcx     # 0x33c98
movq 0x8(%rcx), %r14
movq 0x8(%rax), %rsi
cmpq %rsi, %r14
je 0xa911
cmpb $0x2a, (%r14)
je 0xac8a
movq %r14, %rdi
callq 0x6310
testl %eax, %eax
jne 0xac8a
movq -0x8(%r12,%r15,8), %rax
testq %rax, %rax
je 0xac1c
movq (%rax), %rax
movq -0x8(%rax), %rax
movq 0x8(%rax), %rsi
cmpq %rsi, %r14
je 0xa949
cmpb $0x2a, (%r14)
je 0xae4c
movq %r14, %rdi
callq 0x6310
testl %eax, %eax
jne 0xae4c
leaq -0x50(%rbp), %rdi
callq 0x1b130
jmp 0xaa91
leaq -0x50(%rbp), %rdi
movl $0x61, %esi
callq 0x1b308
movslq 0xb4(%rbx), %r15
movq 0x18(%rbx), %r12
movq (%r12,%r15,8), %rax
testq %rax, %rax
je 0xac21
movq (%rax), %rax
movq -0x8(%rax), %rax
leaq 0x293dd(%rip), %rcx     # 0x33d68
movq 0x8(%rcx), %r14
movq 0x8(%rax), %rsi
cmpq %rsi, %r14
je 0xa9b2
cmpb $0x2a, (%r14)
je 0xad3e
movq %r14, %rdi
callq 0x6310
testl %eax, %eax
jne 0xad3e
movq -0x8(%r12,%r15,8), %rax
testq %rax, %rax
je 0xac21
movq (%rax), %rax
movq -0x8(%rax), %rax
movq 0x8(%rax), %rsi
cmpq %rsi, %r14
je 0xa9ea
cmpb $0x2a, (%r14)
je 0xaf00
movq %r14, %rdi
callq 0x6310
testl %eax, %eax
jne 0xaf00
leaq -0x50(%rbp), %rdi
callq 0x1b32c
jmp 0xaa91
leaq -0x50(%rbp), %rdi
xorl %esi, %esi
callq 0x1aca0
movslq 0xb4(%rbx), %r15
movq 0x18(%rbx), %r12
movq (%r12,%r15,8), %rax
testq %rax, %rax
je 0xac2b
movq (%rax), %rax
movq -0x8(%rax), %rax
leaq 0x290cf(%rip), %rcx     # 0x33af8
movq 0x8(%rcx), %r14
movq 0x8(%rax), %rsi
cmpq %rsi, %r14
je 0xaa50
cmpb $0x2a, (%r14)
je 0xad98
movq %r14, %rdi
callq 0x6310
testl %eax, %eax
jne 0xad98
movq -0x8(%r12,%r15,8), %rax
testq %rax, %rax
je 0xac2b
movq (%rax), %rax
movq -0x8(%rax), %rax
movq 0x8(%rax), %rsi
cmpq %rsi, %r14
je 0xaa88
cmpb $0x2a, (%r14)
je 0xaf57
movq %r14, %rdi
callq 0x6310
testl %eax, %eax
jne 0xaf57
leaq -0x50(%rbp), %rdi
callq 0x1acc4
movslq 0xb4(%rbx), %rax
movq 0x18(%rbx), %rcx
movq -0x8(%rcx,%rax,8), %rsi
movq (%rcx,%rax,8), %rdi
callq 0x1abd5
movl %eax, %r15d
movl $0x10, %edi
callq 0x6200
movq %rax, %r14
testb %r15b, %r15b
je 0xaace
movq %r14, %rdi
movl $0x1, %esi
callq 0x1b10c
jmp 0xaad8
movq %r14, %rdi
xorl %esi, %esi
callq 0x1b10c
movslq 0xb4(%rbx), %rax
movq 0x18(%rbx), %rcx
movq (%rcx,%rax,8), %r15
testq %r15, %r15
je 0xab01
movq %r15, %rdi
callq 0x1a5cc
movl $0x8, %esi
movq %r15, %rdi
callq 0x6210
leaq 0x18(%rbx), %r15
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 0xab3b
movq %r12, %rdi
callq 0x1a5cc
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 0xa3ae
leaq -0x30(%rbp), %r14
movq %r14, -0x10(%r14)
leaq 0x19077(%rip), %rsi     # 0x23bf2
leaq 0x19073(%rip), %rdx     # 0x23bf5
leaq -0x40(%rbp), %rdi
callq 0x746c
addq $0x78, %rbx
leaq -0x40(%rbp), %rsi
movq %rbx, %rdi
callq 0x1ce78
movq -0x40(%rbp), %rdi
cmpq %r14, %rdi
je 0xabb0
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), %r12
movq %r12, -0x10(%r12)
leaq 0x18d57(%rip), %rsi     # 0x23931
leaq 0x18d88(%rip), %rdx     # 0x23969
leaq -0x40(%rbp), %rdi
callq 0x746c
movb $0x1, %r15b
leaq -0x40(%rbp), %rsi
movq %r14, %rdi
callq 0x1b418
xorl %r15d, %r15d
leaq 0x27e85(%rip), %rsi     # 0x32a88
leaq 0x1082c(%rip), %rdx     # 0x1b436
movq %r14, %rdi
callq 0x63e0
jmp 0xafac
callq 0x6250
callq 0x6250
callq 0x6250
callq 0x6250
callq 0x6250
movl $0x20, %edi
callq 0x6100
movq %rax, %r14
leaq -0x30(%rbp), %r12
movq %r12, -0x10(%r12)
leaq 0x18f23(%rip), %rsi     # 0x23b70
leaq 0x18f5a(%rip), %rdx     # 0x23bae
leaq -0x40(%rbp), %rdi
callq 0x746c
movb $0x1, %r15b
leaq -0x40(%rbp), %rsi
movq %r14, %rdi
callq 0x1b418
xorl %r15d, %r15d
leaq 0x27e12(%rip), %rsi     # 0x32a88
leaq 0x107b9(%rip), %rdx     # 0x1b436
movq %r14, %rdi
callq 0x63e0
jmp 0xafac
movl $0x20, %edi
callq 0x6100
movq %rax, %r14
leaq -0x30(%rbp), %r12
movq %r12, -0x10(%r12)
leaq 0x18dc1(%rip), %rsi     # 0x23a68
leaq 0x18df8(%rip), %rdx     # 0x23aa6
leaq -0x40(%rbp), %rdi
callq 0x746c
movb $0x1, %r15b
leaq -0x40(%rbp), %rsi
movq %r14, %rdi
callq 0x1b418
xorl %r15d, %r15d
leaq 0x27db8(%rip), %rsi     # 0x32a88
leaq 0x1075f(%rip), %rdx     # 0x1b436
movq %r14, %rdi
callq 0x63e0
jmp 0xafac
movl $0x20, %edi
callq 0x6100
movq %rax, %r14
leaq -0x30(%rbp), %r12
movq %r12, -0x10(%r12)
leaq 0x18ceb(%rip), %rsi     # 0x239ec
leaq 0x18d1f(%rip), %rdx     # 0x23a27
leaq -0x40(%rbp), %rdi
callq 0x746c
movb $0x1, %r15b
leaq -0x40(%rbp), %rsi
movq %r14, %rdi
callq 0x1b418
xorl %r15d, %r15d
leaq 0x27d5e(%rip), %rsi     # 0x32a88
leaq 0x10705(%rip), %rdx     # 0x1b436
movq %r14, %rdi
callq 0x63e0
jmp 0xafac
movl $0x20, %edi
callq 0x6100
movq %rax, %r14
leaq -0x30(%rbp), %r12
movq %r12, -0x10(%r12)
leaq 0x18d8f(%rip), %rsi     # 0x23aea
leaq 0x18dc8(%rip), %rdx     # 0x23b2a
leaq -0x40(%rbp), %rdi
callq 0x746c
movb $0x1, %r15b
leaq -0x40(%rbp), %rsi
movq %r14, %rdi
callq 0x1b418
xorl %r15d, %r15d
leaq 0x27d04(%rip), %rsi     # 0x32a88
leaq 0x106ab(%rip), %rdx     # 0x1b436
movq %r14, %rdi
callq 0x63e0
jmp 0xafac
movl $0x20, %edi
callq 0x6100
movq %rax, %r14
leaq -0x30(%rbp), %r12
movq %r12, -0x10(%r12)
leaq 0x18bb5(%rip), %rsi     # 0x2396a
leaq 0x18bec(%rip), %rdx     # 0x239a8
leaq -0x40(%rbp), %rdi
callq 0x746c
movb $0x1, %r15b
leaq -0x40(%rbp), %rsi
movq %r14, %rdi
callq 0x1b418
xorl %r15d, %r15d
leaq 0x27caa(%rip), %rsi     # 0x32a88
leaq 0x10651(%rip), %rdx     # 0x1b436
movq %r14, %rdi
callq 0x63e0
jmp 0xafac
movl $0x20, %edi
callq 0x6100
movq %rax, %r14
leaq -0x30(%rbp), %r12
movq %r12, -0x10(%r12)
leaq 0x18da0(%rip), %rsi     # 0x23baf
leaq 0x18ddb(%rip), %rdx     # 0x23bf1
leaq -0x40(%rbp), %rdi
callq 0x746c
movb $0x1, %r15b
leaq -0x40(%rbp), %rsi
movq %r14, %rdi
callq 0x1b418
xorl %r15d, %r15d
leaq 0x27c50(%rip), %rsi     # 0x32a88
leaq 0x105f7(%rip), %rdx     # 0x1b436
movq %r14, %rdi
callq 0x63e0
jmp 0xafac
movl $0x20, %edi
callq 0x6100
movq %rax, %r14
leaq -0x30(%rbp), %r12
movq %r12, -0x10(%r12)
leaq 0x18c3e(%rip), %rsi     # 0x23aa7
leaq 0x18c79(%rip), %rdx     # 0x23ae9
leaq -0x40(%rbp), %rdi
callq 0x746c
movb $0x1, %r15b
leaq -0x40(%rbp), %rsi
movq %r14, %rdi
callq 0x1b418
xorl %r15d, %r15d
leaq 0x27bf6(%rip), %rsi     # 0x32a88
leaq 0x1059d(%rip), %rdx     # 0x1b436
movq %r14, %rdi
callq 0x63e0
jmp 0xafac
movl $0x20, %edi
callq 0x6100
movq %rax, %r14
leaq -0x30(%rbp), %r12
movq %r12, -0x10(%r12)
leaq 0x18b65(%rip), %rsi     # 0x23a28
leaq 0x18b9d(%rip), %rdx     # 0x23a67
leaq -0x40(%rbp), %rdi
callq 0x746c
movb $0x1, %r15b
leaq -0x40(%rbp), %rsi
movq %r14, %rdi
callq 0x1b418
xorl %r15d, %r15d
leaq 0x27b9c(%rip), %rsi     # 0x32a88
leaq 0x10543(%rip), %rdx     # 0x1b436
movq %r14, %rdi
callq 0x63e0
jmp 0xafac
movl $0x20, %edi
callq 0x6100
movq %rax, %r14
leaq -0x30(%rbp), %r12
movq %r12, -0x10(%r12)
leaq 0x18c0e(%rip), %rsi     # 0x23b2b
leaq 0x18c4b(%rip), %rdx     # 0x23b6f
leaq -0x40(%rbp), %rdi
callq 0x746c
movb $0x1, %r15b
leaq -0x40(%rbp), %rsi
movq %r14, %rdi
callq 0x1b418
xorl %r15d, %r15d
leaq 0x27b42(%rip), %rsi     # 0x32a88
leaq 0x104e9(%rip), %rdx     # 0x1b436
movq %r14, %rdi
callq 0x63e0
jmp 0xafac
movl $0x20, %edi
callq 0x6100
movq %rax, %r14
leaq -0x30(%rbp), %r12
movq %r12, -0x10(%r12)
leaq 0x18a35(%rip), %rsi     # 0x239a9
leaq 0x18a70(%rip), %rdx     # 0x239eb
leaq -0x40(%rbp), %rdi
callq 0x746c
movb $0x1, %r15b
leaq -0x40(%rbp), %rsi
movq %r14, %rdi
callq 0x1b418
xorl %r15d, %r15d
leaq 0x27aeb(%rip), %rsi     # 0x32a88
leaq 0x10492(%rip), %rdx     # 0x1b436
movq %r14, %rdi
callq 0x63e0
jmp 0xafd2
jmp 0xafec
jmp 0xb008
jmp 0xb022
jmp 0xb03e
jmp 0xb058
jmp 0xb06d
jmp 0xb087
jmp 0xb09c
jmp 0xb0b6
movq %rax, %rbx
movq -0x40(%rbp), %rdi
cmpq %r12, %rdi
je 0xaff2
movq -0x30(%rbp), %rsi
incq %rsi
callq 0x6210
jmp 0xaff2
movq %rax, %rbx
movb $0x1, %r15b
testb %r15b, %r15b
je 0xb0ce
movq %r14, %rdi
callq 0x6170
jmp 0xb0ce
movq %rax, %rbx
movq -0x40(%rbp), %rdi
cmpq %r12, %rdi
je 0xb028
movq -0x30(%rbp), %rsi
incq %rsi
callq 0x6210
jmp 0xb028
movq %rax, %rbx
movb $0x1, %r15b
testb %r15b, %r15b
je 0xb0f0
movq %r14, %rdi
callq 0x6170
jmp 0xb0f0
movq %rax, %rbx
movq -0x40(%rbp), %rdi
cmpq %r12, %rdi
je 0xb05e
movq -0x30(%rbp), %rsi
incq %rsi
callq 0x6210
jmp 0xb05e
movq %rax, %rbx
movb $0x1, %r15b
testb %r15b, %r15b
je 0xb0df
movq %r14, %rdi
callq 0x6170
jmp 0xb0df
movq %rax, %rbx
movq -0x40(%rbp), %rdi
cmpq %r12, %rdi
je 0xb08d
movq -0x30(%rbp), %rsi
incq %rsi
callq 0x6210
jmp 0xb08d
movq %rax, %rbx
movb $0x1, %r15b
testb %r15b, %r15b
je 0xb0fe
movq %r14, %rdi
callq 0x6170
jmp 0xb0fe
movq %rax, %rbx
movq -0x40(%rbp), %rdi
cmpq %r12, %rdi
je 0xb0bc
movq -0x30(%rbp), %rsi
incq %rsi
callq 0x6210
jmp 0xb0bc
movq %rax, %rbx
movb $0x1, %r15b
testb %r15b, %r15b
je 0xb10c
movq %r14, %rdi
callq 0x6170
jmp 0xb10c
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x1acc4
jmp 0xb172
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x1aef6
jmp 0xb172
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x1b32c
jmp 0xb172
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x1b130
jmp 0xb172
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x1a3f4
jmp 0xb172
jmp 0xb119
movq %rax, %rbx
movl $0x10, %esi
movq %r14, %rdi
jmp 0xb168
movq %rax, %rbx
movq -0x40(%rbp), %rdi
cmpq %r12, %rdi
je 0xb146
movq -0x30(%rbp), %rsi
incq %rsi
callq 0x6210
jmp 0xb146
movq %rax, %rbx
movb $0x1, %r15b
testb %r15b, %r15b
je 0xb172
movq %r14, %rdi
callq 0x6170
jmp 0xb172
movq %rax, %rbx
movq -0x40(%rbp), %rdi
cmpq %r14, %rdi
je 0xb172
movq -0x30(%rbp), %rsi
incq %rsi
callq 0x6210
jmp 0xb172
movq %rax, %rbx
movq %rbx, %rdi
callq 0x6410