// File: /workspace/github_cpp_makefile_star2_O3/zerolfx[P]P-Machine/dpl.cpp
// Function: Dpl::execute(StackMachine*)
void Dpl::execute(StackMachine *stack)
{
	switch(fType)
	{
		case integer:
		{
			StackInteger p1;

			// check if uppermost stackentry is of type integer
			if(typeid(p1) != typeid(*stack->fStore[stack->fSP]))
			{
				throw ExecutionError("instruction dpl: SP does not point to element of type integer.");
			}
			else
			{
				stack->fStore.push_back(new StackInteger(*(dynamic_cast<StackInteger*>(stack->fStore[stack->fSP]))));
			}
				
			break;
		}	
		case real:
		{
			StackReal p1;
			// check if uppermost stackentry is of type real
			if(typeid(p1) != typeid(*stack->fStore[stack->fSP]))
			{
				throw ExecutionError("instruction dpl: SP does not point to element of type real.");
			}
			else
			{
				stack->fStore.push_back(new StackReal(*(dynamic_cast<StackReal*>(stack->fStore[stack->fSP]))));
			}


			break;
		}
		case boolean:
		{
			StackBoolean p1;
			
			// check if uppermost stackentry is of type boolean
			if(typeid(p1) != typeid(*stack->fStore[stack->fSP]))
			{
				throw ExecutionError("instruction dpl: SP does not point to element of type boolean.");
			}
			else
			{
				stack->fStore.push_back(new StackBoolean(*(dynamic_cast<StackBoolean*>(stack->fStore[stack->fSP]))));
			}


			break;
		}
		case character:
		{
			StackCharacter p1;
			
			// check if uppermost stackentry is of type character
			if(typeid(p1) != typeid(*stack->fStore[stack->fSP]))
			{
				throw ExecutionError("instruction dpl: SP does not point to element of type character.");
			}
			else
			{
				stack->fStore.push_back(new StackCharacter(*(dynamic_cast<StackCharacter*>(stack->fStore[stack->fSP]))));
			}


			break;
		}
		case address:
		{
			StackAddress p1;

			// check if constant is of type address
			if(typeid(p1) != typeid(*stack->fStore[stack->fSP]))
			{
				throw ExecutionError("instruction dpl: SP does not point to element of type address.");
			}
			else
			{
				stack->fStore.push_back(new StackAddress(*(dynamic_cast<StackAddress*>(stack->fStore[stack->fSP]))));
			}

			break;
		}
	}
	
	// fSP = fSP + 1
	++stack->fSP;
	
	// adding cost of this instruction
	stack->fTime.count("dpl");

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x30, %rsp
movq %rsi, %rbx
movl 0x8(%rdi), %eax
cmpq $0x4, %rax
ja 0x9f1d
leaq 0x19bf2(%rip), %rcx     # 0x23798
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq -0x50(%rbp), %rdi
xorps %xmm0, %xmm0
callq 0x1abfc
movslq 0xb4(%rbx), %rax
movq 0x18(%rbx), %rcx
movq (%rcx,%rax,8), %r14
testq %r14, %r14
je 0xa138
movq (%r14), %rax
movq -0x8(%rax), %rax
leaq 0x29fe7(%rip), %rcx     # 0x33bc8
movq 0x8(%rcx), %rdi
movq 0x8(%rax), %rsi
cmpq %rsi, %rdi
je 0x9c04
cmpb $0x2a, (%rdi)
je 0xa07f
callq 0x6310
testl %eax, %eax
jne 0xa07f
movl $0x10, %edi
callq 0x6200
movq %rax, %r15
leaq 0x18(%rbx), %r12
leaq 0x29e14(%rip), %rsi     # 0x33a30
leaq 0x29fa5(%rip), %rdx     # 0x33bc8
movq %r14, %rdi
xorl %ecx, %ecx
callq 0x6260
leaq 0x29edc(%rip), %rcx     # 0x33b10
addq $0x10, %rcx
movq %rcx, (%r15)
movsd 0x8(%rax), %xmm0
movsd %xmm0, 0x8(%r15)
leaq -0x40(%rbp), %rsi
movq %r15, (%rsi)
movq %r12, %rdi
callq 0xa334
leaq -0x50(%rbp), %rdi
callq 0x1ac2a
jmp 0x9f1d
leaq -0x50(%rbp), %rdi
xorl %esi, %esi
callq 0x1a104
movslq 0xb4(%rbx), %rax
movq 0x18(%rbx), %rcx
movq (%rcx,%rax,8), %r14
testq %r14, %r14
je 0xa129
movq (%r14), %rax
movq -0x8(%rax), %rax
leaq 0x29ccc(%rip), %rcx     # 0x33960
movq 0x8(%rcx), %rdi
movq 0x8(%rax), %rsi
cmpq %rsi, %rdi
je 0x9cb7
cmpb $0x2a, (%rdi)
je 0x9f74
callq 0x6310
testl %eax, %eax
jne 0x9f74
movl $0x10, %edi
callq 0x6200
movq %rax, %r15
leaq 0x18(%rbx), %r12
leaq 0x29d61(%rip), %rsi     # 0x33a30
leaq 0x29c8a(%rip), %rdx     # 0x33960
movq %r14, %rdi
xorl %ecx, %ecx
callq 0x6260
leaq 0x29bc1(%rip), %rcx     # 0x338a8
addq $0x10, %rcx
movq %rcx, (%r15)
movl 0x8(%rax), %eax
movl %eax, 0x8(%r15)
leaq -0x40(%rbp), %rsi
movq %r15, (%rsi)
movq %r12, %rdi
callq 0xa334
leaq -0x50(%rbp), %rdi
callq 0x1a128
jmp 0x9f1d
leaq -0x50(%rbp), %rdi
xorl %esi, %esi
callq 0x1ae40
movslq 0xb4(%rbx), %rax
movq 0x18(%rbx), %rcx
movq (%rcx,%rax,8), %r14
testq %r14, %r14
je 0xa12e
movq (%r14), %rax
movq -0x8(%rax), %rax
leaq 0x29f55(%rip), %rcx     # 0x33c98
movq 0x8(%rcx), %rdi
movq 0x8(%rax), %rsi
cmpq %rsi, %rdi
je 0x9d66
cmpb $0x2a, (%rdi)
je 0x9fcd
callq 0x6310
testl %eax, %eax
jne 0x9fcd
movl $0x10, %edi
callq 0x6200
movq %rax, %r15
leaq 0x18(%rbx), %r12
leaq 0x29cb2(%rip), %rsi     # 0x33a30
leaq 0x29f13(%rip), %rdx     # 0x33c98
movq %r14, %rdi
xorl %ecx, %ecx
callq 0x6260
leaq 0x29e4a(%rip), %rcx     # 0x33be0
addq $0x10, %rcx
movq %rcx, (%r15)
movl 0x8(%rax), %eax
movl %eax, 0x8(%r15)
leaq -0x40(%rbp), %rsi
movq %r15, (%rsi)
movq %r12, %rdi
callq 0xa334
leaq -0x50(%rbp), %rdi
callq 0x1ae64
jmp 0x9f1d
leaq -0x50(%rbp), %rdi
movl $0x61, %esi
callq 0x1b03c
movslq 0xb4(%rbx), %rax
movq 0x18(%rbx), %rcx
movq (%rcx,%rax,8), %r14
testq %r14, %r14
je 0xa133
movq (%r14), %rax
movq -0x8(%rax), %rax
leaq 0x29f73(%rip), %rcx     # 0x33d68
movq 0x8(%rcx), %rdi
movq 0x8(%rax), %rsi
cmpq %rsi, %rdi
je 0x9e18
cmpb $0x2a, (%rdi)
je 0xa026
callq 0x6310
testl %eax, %eax
jne 0xa026
movl $0x10, %edi
callq 0x6200
movq %rax, %r15
leaq 0x18(%rbx), %r12
leaq 0x29c00(%rip), %rsi     # 0x33a30
leaq 0x29f31(%rip), %rdx     # 0x33d68
movq %r14, %rdi
xorl %ecx, %ecx
callq 0x6260
leaq 0x29e68(%rip), %rcx     # 0x33cb0
addq $0x10, %rcx
movq %rcx, (%r15)
movb 0x8(%rax), %al
movb %al, 0x8(%r15)
leaq -0x40(%rbp), %rsi
movq %r15, (%rsi)
movq %r12, %rdi
callq 0xa334
leaq -0x50(%rbp), %rdi
callq 0x1b060
jmp 0x9f1d
leaq -0x50(%rbp), %rdi
xorl %esi, %esi
callq 0x1a9d4
movslq 0xb4(%rbx), %rax
movq 0x18(%rbx), %rcx
movq (%rcx,%rax,8), %r14
testq %r14, %r14
je 0xa13d
movq (%r14), %rax
movq -0x8(%rax), %rax
leaq 0x29c54(%rip), %rcx     # 0x33af8
movq 0x8(%rcx), %rdi
movq 0x8(%rax), %rsi
cmpq %rsi, %rdi
je 0x9ec7
cmpb $0x2a, (%rdi)
je 0xa0d5
callq 0x6310
testl %eax, %eax
jne 0xa0d5
movl $0x10, %edi
callq 0x6200
movq %rax, %r15
leaq 0x18(%rbx), %r12
leaq 0x29b51(%rip), %rsi     # 0x33a30
leaq 0x29c12(%rip), %rdx     # 0x33af8
movq %r14, %rdi
xorl %ecx, %ecx
callq 0x6260
leaq 0x29b49(%rip), %rcx     # 0x33a40
addq $0x10, %rcx
movq %rcx, (%r15)
movl 0x8(%rax), %eax
movl %eax, 0x8(%r15)
leaq -0x40(%rbp), %rsi
movq %r15, (%rsi)
movq %r12, %rdi
callq 0xa334
leaq -0x50(%rbp), %rdi
callq 0x1a9f8
incl 0xb4(%rbx)
leaq -0x30(%rbp), %r14
movq %r14, -0x10(%r14)
leaq 0x199b9(%rip), %rsi     # 0x238eb
leaq 0x199b5(%rip), %rdx     # 0x238ee
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 0x9f67
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 0x1991c(%rip), %rsi     # 0x238ac
leaq 0x19953(%rip), %rdx     # 0x238ea
leaq -0x40(%rbp), %rdi
callq 0x746c
movb $0x1, %r12b
leaq -0x40(%rbp), %rsi
movq %r14, %rdi
callq 0x1b14c
xorl %r12d, %r12d
leaq 0x28acf(%rip), %rsi     # 0x32a88
leaq 0x111aa(%rip), %rdx     # 0x1b16a
movq %r14, %rdi
callq 0x63e0
jmp 0xa129
movl $0x20, %edi
callq 0x6100
movq %rax, %r14
leaq -0x30(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x19843(%rip), %rsi     # 0x2382c
leaq 0x1987a(%rip), %rdx     # 0x2386a
leaq -0x40(%rbp), %rdi
callq 0x746c
movb $0x1, %r12b
leaq -0x40(%rbp), %rsi
movq %r14, %rdi
callq 0x1b14c
xorl %r12d, %r12d
leaq 0x28a76(%rip), %rsi     # 0x32a88
leaq 0x11151(%rip), %rdx     # 0x1b16a
movq %r14, %rdi
callq 0x63e0
jmp 0xa129
movl $0x20, %edi
callq 0x6100
movq %rax, %r14
leaq -0x30(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x19829(%rip), %rsi     # 0x2386b
leaq 0x19862(%rip), %rdx     # 0x238ab
leaq -0x40(%rbp), %rdi
callq 0x746c
movb $0x1, %r12b
leaq -0x40(%rbp), %rsi
movq %r14, %rdi
callq 0x1b14c
xorl %r12d, %r12d
leaq 0x28a1d(%rip), %rsi     # 0x32a88
leaq 0x110f8(%rip), %rdx     # 0x1b16a
movq %r14, %rdi
callq 0x63e0
jmp 0xa129
movl $0x20, %edi
callq 0x6100
movq %rax, %r14
leaq -0x30(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x19755(%rip), %rsi     # 0x237f0
leaq 0x19789(%rip), %rdx     # 0x2382b
leaq -0x40(%rbp), %rdi
callq 0x746c
movb $0x1, %r12b
leaq -0x40(%rbp), %rsi
movq %r14, %rdi
callq 0x1b14c
xorl %r12d, %r12d
leaq 0x289c4(%rip), %rsi     # 0x32a88
leaq 0x1109f(%rip), %rdx     # 0x1b16a
movq %r14, %rdi
callq 0x63e0
jmp 0xa129
movl $0x20, %edi
callq 0x6100
movq %rax, %r14
leaq -0x30(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x196c0(%rip), %rsi     # 0x237b1
leaq 0x196f7(%rip), %rdx     # 0x237ef
leaq -0x40(%rbp), %rdi
callq 0x746c
movb $0x1, %r12b
leaq -0x40(%rbp), %rsi
movq %r14, %rdi
callq 0x1b14c
xorl %r12d, %r12d
leaq 0x2896e(%rip), %rsi     # 0x32a88
leaq 0x11049(%rip), %rdx     # 0x1b16a
movq %r14, %rdi
callq 0x63e0
callq 0x6250
callq 0x6250
callq 0x6250
callq 0x6250
callq 0x6250
movq %rax, %rbx
movq -0x40(%rbp), %rdi
cmpq %r15, %rdi
je 0xa15a
movq -0x30(%rbp), %rsi
incq %rsi
callq 0x6210
testb %r12b, %r12b
jne 0xa189
jmp 0xa23d
movq %rax, %rbx
movq -0x40(%rbp), %rdi
cmpq %r15, %rdi
je 0xa17c
movq -0x30(%rbp), %rsi
incq %rsi
callq 0x6210
testb %r12b, %r12b
jne 0xa199
jmp 0xa24b
movq %rax, %rbx
movq %r14, %rdi
callq 0x6170
jmp 0xa23d
movq %rax, %rbx
movq %r14, %rdi
callq 0x6170
jmp 0xa24b
movq %rax, %rbx
movq -0x40(%rbp), %rdi
cmpq %r15, %rdi
je 0xa1be
movq -0x30(%rbp), %rsi
incq %rsi
callq 0x6210
testb %r12b, %r12b
jne 0xa1cb
jmp 0xa259
movq %rax, %rbx
movq %r14, %rdi
callq 0x6170
jmp 0xa259
movq %rax, %rbx
movq -0x40(%rbp), %rdi
cmpq %r15, %rdi
je 0xa1f0
movq -0x30(%rbp), %rsi
incq %rsi
callq 0x6210
testb %r12b, %r12b
jne 0xa1fa
jmp 0xa267
movq %rax, %rbx
movq %r14, %rdi
callq 0x6170
jmp 0xa267
movq %rax, %rbx
movq -0x40(%rbp), %rdi
cmpq %r15, %rdi
je 0xa21c
movq -0x30(%rbp), %rsi
incq %rsi
callq 0x6210
testb %r12b, %r12b
jne 0xa226
jmp 0xa275
movq %rax, %rbx
movq %r14, %rdi
callq 0x6170
jmp 0xa275
jmp 0xa23a
jmp 0xa248
jmp 0xa256
jmp 0xa264
jmp 0xa272
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x1a9f8
jmp 0xa29d
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x1ac2a
jmp 0xa29d
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x1b060
jmp 0xa29d
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x1ae64
jmp 0xa29d
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x1a128
jmp 0xa29d
movq %rax, %rbx
movq -0x40(%rbp), %rdi
cmpq %r14, %rdi
je 0xa29d
movq -0x30(%rbp), %rsi
incq %rsi
callq 0x6210
jmp 0xa29d
movq %rax, %rbx
movq %rbx, %rdi
callq 0x6410
nop