// File: /workspace/github_cpp_makefile_star2_O1/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 %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rsi, %rbx
movl 0x8(%rdi), %eax
cmpq $0x4, %rax
ja 0x9f7e
leaq 0x19ba0(%rip), %rcx     # 0x23798
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq -0x58(%rbp), %rdi
xorps %xmm0, %xmm0
callq 0x1aec8
movslq 0xb4(%rbx), %r12
movq 0x18(%rbx), %r13
movq (%r13,%r12,8), %rax
testq %rax, %rax
je 0xa1a0
movq (%rax), %rax
movq -0x8(%rax), %rax
leaq 0x29f94(%rip), %rcx     # 0x33bc8
movq 0x8(%rcx), %rdi
movq 0x8(%rax), %rsi
cmpq %rsi, %rdi
je 0x9c57
cmpb $0x2a, (%rdi)
je 0xa0e5
callq 0x6310
testl %eax, %eax
jne 0xa0e5
movl $0x10, %edi
callq 0x6200
movq %rax, %r14
leaq 0x18(%rbx), %r15
movq (%r13,%r12,8), %rdi
leaq 0x29dbc(%rip), %rsi     # 0x33a30
leaq 0x29f4d(%rip), %rdx     # 0x33bc8
xorl %ecx, %ecx
callq 0x6260
leaq 0x29e87(%rip), %rcx     # 0x33b10
addq $0x10, %rcx
movq %rcx, (%r14)
movsd 0x8(%rax), %xmm0
movsd %xmm0, 0x8(%r14)
leaq -0x48(%rbp), %rsi
movq %r14, (%rsi)
movq %r15, %rdi
callq 0xa3ae
leaq -0x58(%rbp), %rdi
callq 0x1aef6
jmp 0x9f7e
leaq -0x58(%rbp), %rdi
xorl %esi, %esi
callq 0x1a3d0
movslq 0xb4(%rbx), %r12
movq 0x18(%rbx), %r13
movq (%r13,%r12,8), %rax
testq %rax, %rax
je 0xa191
movq (%rax), %rax
movq -0x8(%rax), %rax
leaq 0x29c76(%rip), %rcx     # 0x33960
movq 0x8(%rcx), %rdi
movq 0x8(%rax), %rsi
cmpq %rsi, %rdi
je 0x9d0d
cmpb $0x2a, (%rdi)
je 0x9fd7
callq 0x6310
testl %eax, %eax
jne 0x9fd7
movl $0x10, %edi
callq 0x6200
movq %rax, %r14
leaq 0x18(%rbx), %r15
movq (%r13,%r12,8), %rdi
leaq 0x29d06(%rip), %rsi     # 0x33a30
leaq 0x29c2f(%rip), %rdx     # 0x33960
xorl %ecx, %ecx
callq 0x6260
leaq 0x29b69(%rip), %rcx     # 0x338a8
addq $0x10, %rcx
movq %rcx, (%r14)
movl 0x8(%rax), %eax
movl %eax, 0x8(%r14)
leaq -0x48(%rbp), %rsi
movq %r14, (%rsi)
movq %r15, %rdi
callq 0xa3ae
leaq -0x58(%rbp), %rdi
callq 0x1a3f4
jmp 0x9f7e
leaq -0x58(%rbp), %rdi
xorl %esi, %esi
callq 0x1b10c
movslq 0xb4(%rbx), %r12
movq 0x18(%rbx), %r13
movq (%r13,%r12,8), %rax
testq %rax, %rax
je 0xa196
movq (%rax), %rax
movq -0x8(%rax), %rax
leaq 0x29efc(%rip), %rcx     # 0x33c98
movq 0x8(%rcx), %rdi
movq 0x8(%rax), %rsi
cmpq %rsi, %rdi
je 0x9dbf
cmpb $0x2a, (%rdi)
je 0xa031
callq 0x6310
testl %eax, %eax
jne 0xa031
movl $0x10, %edi
callq 0x6200
movq %rax, %r14
leaq 0x18(%rbx), %r15
movq (%r13,%r12,8), %rdi
leaq 0x29c54(%rip), %rsi     # 0x33a30
leaq 0x29eb5(%rip), %rdx     # 0x33c98
xorl %ecx, %ecx
callq 0x6260
leaq 0x29def(%rip), %rcx     # 0x33be0
addq $0x10, %rcx
movq %rcx, (%r14)
movl 0x8(%rax), %eax
movl %eax, 0x8(%r14)
leaq -0x48(%rbp), %rsi
movq %r14, (%rsi)
movq %r15, %rdi
callq 0xa3ae
leaq -0x58(%rbp), %rdi
callq 0x1b130
jmp 0x9f7e
leaq -0x58(%rbp), %rdi
movl $0x61, %esi
callq 0x1b308
movslq 0xb4(%rbx), %r12
movq 0x18(%rbx), %r13
movq (%r13,%r12,8), %rax
testq %rax, %rax
je 0xa19b
movq (%rax), %rax
movq -0x8(%rax), %rax
leaq 0x29f17(%rip), %rcx     # 0x33d68
movq 0x8(%rcx), %rdi
movq 0x8(%rax), %rsi
cmpq %rsi, %rdi
je 0x9e74
cmpb $0x2a, (%rdi)
je 0xa08b
callq 0x6310
testl %eax, %eax
jne 0xa08b
movl $0x10, %edi
callq 0x6200
movq %rax, %r14
leaq 0x18(%rbx), %r15
movq (%r13,%r12,8), %rdi
leaq 0x29b9f(%rip), %rsi     # 0x33a30
leaq 0x29ed0(%rip), %rdx     # 0x33d68
xorl %ecx, %ecx
callq 0x6260
leaq 0x29e0a(%rip), %rcx     # 0x33cb0
addq $0x10, %rcx
movq %rcx, (%r14)
movb 0x8(%rax), %al
movb %al, 0x8(%r14)
leaq -0x48(%rbp), %rsi
movq %r14, (%rsi)
movq %r15, %rdi
callq 0xa3ae
leaq -0x58(%rbp), %rdi
callq 0x1b32c
jmp 0x9f7e
leaq -0x58(%rbp), %rdi
xorl %esi, %esi
callq 0x1aca0
movslq 0xb4(%rbx), %r12
movq 0x18(%rbx), %r13
movq (%r13,%r12,8), %rax
testq %rax, %rax
je 0xa1a5
movq (%rax), %rax
movq -0x8(%rax), %rax
leaq 0x29bf5(%rip), %rcx     # 0x33af8
movq 0x8(%rcx), %rdi
movq 0x8(%rax), %rsi
cmpq %rsi, %rdi
je 0x9f26
cmpb $0x2a, (%rdi)
je 0xa13c
callq 0x6310
testl %eax, %eax
jne 0xa13c
movl $0x10, %edi
callq 0x6200
movq %rax, %r14
leaq 0x18(%rbx), %r15
movq (%r13,%r12,8), %rdi
leaq 0x29aed(%rip), %rsi     # 0x33a30
leaq 0x29bae(%rip), %rdx     # 0x33af8
xorl %ecx, %ecx
callq 0x6260
leaq 0x29ae8(%rip), %rcx     # 0x33a40
addq $0x10, %rcx
movq %rcx, (%r14)
movl 0x8(%rax), %eax
movl %eax, 0x8(%r14)
leaq -0x48(%rbp), %rsi
movq %r14, (%rsi)
movq %r15, %rdi
callq 0xa3ae
leaq -0x58(%rbp), %rdi
callq 0x1acc4
incl 0xb4(%rbx)
leaq -0x38(%rbp), %r14
movq %r14, -0x10(%r14)
leaq 0x19958(%rip), %rsi     # 0x238eb
leaq 0x19954(%rip), %rdx     # 0x238ee
leaq -0x48(%rbp), %rdi
callq 0x746c
addq $0x78, %rbx
leaq -0x48(%rbp), %rsi
movq %rbx, %rdi
callq 0x1ce78
movq -0x48(%rbp), %rdi
cmpq %r14, %rdi
je 0x9fc8
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x6210
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x20, %edi
callq 0x6100
movq %rax, %r14
leaq -0x38(%rbp), %r12
movq %r12, -0x10(%r12)
leaq 0x198b8(%rip), %rsi     # 0x238ac
leaq 0x198ef(%rip), %rdx     # 0x238ea
leaq -0x48(%rbp), %rdi
callq 0x746c
movb $0x1, %r15b
leaq -0x48(%rbp), %rsi
movq %r14, %rdi
callq 0x1b418
xorl %r15d, %r15d
leaq 0x28a6b(%rip), %rsi     # 0x32a88
leaq 0x11412(%rip), %rdx     # 0x1b436
movq %r14, %rdi
callq 0x63e0
jmp 0xa191
movl $0x20, %edi
callq 0x6100
movq %rax, %r14
leaq -0x38(%rbp), %r12
movq %r12, -0x10(%r12)
leaq 0x197de(%rip), %rsi     # 0x2382c
leaq 0x19815(%rip), %rdx     # 0x2386a
leaq -0x48(%rbp), %rdi
callq 0x746c
movb $0x1, %r15b
leaq -0x48(%rbp), %rsi
movq %r14, %rdi
callq 0x1b418
xorl %r15d, %r15d
leaq 0x28a11(%rip), %rsi     # 0x32a88
leaq 0x113b8(%rip), %rdx     # 0x1b436
movq %r14, %rdi
callq 0x63e0
jmp 0xa191
movl $0x20, %edi
callq 0x6100
movq %rax, %r14
leaq -0x38(%rbp), %r12
movq %r12, -0x10(%r12)
leaq 0x197c3(%rip), %rsi     # 0x2386b
leaq 0x197fc(%rip), %rdx     # 0x238ab
leaq -0x48(%rbp), %rdi
callq 0x746c
movb $0x1, %r15b
leaq -0x48(%rbp), %rsi
movq %r14, %rdi
callq 0x1b418
xorl %r15d, %r15d
leaq 0x289b7(%rip), %rsi     # 0x32a88
leaq 0x1135e(%rip), %rdx     # 0x1b436
movq %r14, %rdi
callq 0x63e0
jmp 0xa191
movl $0x20, %edi
callq 0x6100
movq %rax, %r14
leaq -0x38(%rbp), %r12
movq %r12, -0x10(%r12)
leaq 0x196ee(%rip), %rsi     # 0x237f0
leaq 0x19722(%rip), %rdx     # 0x2382b
leaq -0x48(%rbp), %rdi
callq 0x746c
movb $0x1, %r15b
leaq -0x48(%rbp), %rsi
movq %r14, %rdi
callq 0x1b418
xorl %r15d, %r15d
leaq 0x2895d(%rip), %rsi     # 0x32a88
leaq 0x11304(%rip), %rdx     # 0x1b436
movq %r14, %rdi
callq 0x63e0
jmp 0xa191
movl $0x20, %edi
callq 0x6100
movq %rax, %r14
leaq -0x38(%rbp), %r12
movq %r12, -0x10(%r12)
leaq 0x19658(%rip), %rsi     # 0x237b1
leaq 0x1968f(%rip), %rdx     # 0x237ef
leaq -0x48(%rbp), %rdi
callq 0x746c
movb $0x1, %r15b
leaq -0x48(%rbp), %rsi
movq %r14, %rdi
callq 0x1b418
xorl %r15d, %r15d
leaq 0x28906(%rip), %rsi     # 0x32a88
leaq 0x112ad(%rip), %rdx     # 0x1b436
movq %r14, %rdi
callq 0x63e0
callq 0x6250
callq 0x6250
callq 0x6250
callq 0x6250
callq 0x6250
movq %rax, %rbx
movq -0x48(%rbp), %rdi
cmpq %r12, %rdi
je 0xa1e4
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x6210
jmp 0xa1e4
movq %rax, %rbx
movq -0x48(%rbp), %rdi
cmpq %r12, %rdi
je 0xa200
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x6210
jmp 0xa200
movq %rax, %rbx
movb $0x1, %r15b
testb %r15b, %r15b
je 0xa2b7
movq %r14, %rdi
callq 0x6170
jmp 0xa2b7
movq %rax, %rbx
movb $0x1, %r15b
testb %r15b, %r15b
je 0xa2c5
movq %r14, %rdi
callq 0x6170
jmp 0xa2c5
movq %rax, %rbx
movq -0x48(%rbp), %rdi
cmpq %r12, %rdi
je 0xa236
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x6210
jmp 0xa236
movq %rax, %rbx
movb $0x1, %r15b
testb %r15b, %r15b
je 0xa2d3
movq %r14, %rdi
callq 0x6170
jmp 0xa2d3
movq %rax, %rbx
movq -0x48(%rbp), %rdi
cmpq %r12, %rdi
je 0xa26c
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x6210
jmp 0xa26c
movq %rax, %rbx
movb $0x1, %r15b
testb %r15b, %r15b
je 0xa2e1
movq %r14, %rdi
callq 0x6170
jmp 0xa2e1
movq %rax, %rbx
movq -0x48(%rbp), %rdi
cmpq %r12, %rdi
je 0xa29b
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x6210
jmp 0xa29b
movq %rax, %rbx
movb $0x1, %r15b
testb %r15b, %r15b
je 0xa2ef
movq %r14, %rdi
callq 0x6170
jmp 0xa2ef
jmp 0xa2b4
jmp 0xa2c2
jmp 0xa2d0
jmp 0xa2de
jmp 0xa2ec
movq %rax, %rbx
leaq -0x58(%rbp), %rdi
callq 0x1acc4
jmp 0xa317
movq %rax, %rbx
leaq -0x58(%rbp), %rdi
callq 0x1aef6
jmp 0xa317
movq %rax, %rbx
leaq -0x58(%rbp), %rdi
callq 0x1b32c
jmp 0xa317
movq %rax, %rbx
leaq -0x58(%rbp), %rdi
callq 0x1b130
jmp 0xa317
movq %rax, %rbx
leaq -0x58(%rbp), %rdi
callq 0x1a3f4
jmp 0xa317
movq %rax, %rbx
movq -0x48(%rbp), %rdi
cmpq %r14, %rdi
je 0xa317
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x6210
jmp 0xa317
movq %rax, %rbx
movq %rbx, %rdi
callq 0x6410
nop