// File: /workspace/github_cpp_makefile_star2_O2/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 %rbx
subq $0x38, %rsp
movq %rsi, %rbx
movl 0x8(%rdi), %eax
cmpq $0x4, %rax
ja 0x9653
leaq 0x1547e(%rip), %rcx     # 0x1e798
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq -0x30(%rbp), %rdi
xorps %xmm0, %xmm0
callq 0x177d4
movslq 0xb4(%rbx), %rax
movq 0x18(%rbx), %rcx
movq (%rcx,%rax,8), %rax
testq %rax, %rax
je 0x96a0
movq (%rax), %rax
movq -0x8(%rax), %rsi
leaq 0x25873(%rip), %rdi     # 0x2ebc8
callq 0x76ba
testb %al, %al
jne 0x9742
pushq $0x10
popq %rdi
callq 0x61d0
movq %rax, %r14
leaq 0x18(%rbx), %r15
movslq 0xb4(%rbx), %rax
movq 0x18(%rbx), %rcx
movq (%rcx,%rax,8), %rdi
leaq 0x256a9(%rip), %rsi     # 0x2ea30
leaq 0x2583a(%rip), %rdx     # 0x2ebc8
xorl %ecx, %ecx
callq 0x6230
leaq 0x25774(%rip), %rcx     # 0x2eb10
addq $0x10, %rcx
movq %rcx, (%r14)
movsd 0x8(%rax), %xmm0
movsd %xmm0, 0x8(%r14)
leaq -0x50(%rbp), %rsi
movq %r14, (%rsi)
movq %r15, %rdi
callq 0x99a0
leaq -0x30(%rbp), %rdi
callq 0x17802
jmp 0x9653
leaq -0x30(%rbp), %rdi
xorl %esi, %esi
callq 0x1704c
movslq 0xb4(%rbx), %rax
movq 0x18(%rbx), %rcx
movq (%rcx,%rax,8), %rax
testq %rax, %rax
je 0x9691
movq (%rax), %rax
movq -0x8(%rax), %rsi
leaq 0x25564(%rip), %rdi     # 0x2e960
callq 0x76ba
testb %al, %al
jne 0x96aa
pushq $0x10
popq %rdi
callq 0x61d0
movq %rax, %r14
leaq 0x18(%rbx), %r15
movslq 0xb4(%rbx), %rax
movq 0x18(%rbx), %rcx
movq (%rcx,%rax,8), %rdi
leaq 0x25602(%rip), %rsi     # 0x2ea30
leaq 0x2552b(%rip), %rdx     # 0x2e960
xorl %ecx, %ecx
callq 0x6230
leaq 0x25465(%rip), %rcx     # 0x2e8a8
addq $0x10, %rcx
movq %rcx, (%r14)
movl 0x8(%rax), %eax
movl %eax, 0x8(%r14)
leaq -0x50(%rbp), %rsi
movq %r14, (%rsi)
movq %r15, %rdi
callq 0x99a0
leaq -0x30(%rbp), %rdi
callq 0x17070
jmp 0x9653
leaq -0x30(%rbp), %rdi
xorl %esi, %esi
callq 0x17a18
movslq 0xb4(%rbx), %rax
movq 0x18(%rbx), %rcx
movq (%rcx,%rax,8), %rax
testq %rax, %rax
je 0x9696
movq (%rax), %rax
movq -0x8(%rax), %rsi
leaq 0x257f9(%rip), %rdi     # 0x2ec98
callq 0x76ba
testb %al, %al
jne 0x96f6
pushq $0x10
popq %rdi
callq 0x61d0
movq %rax, %r14
leaq 0x18(%rbx), %r15
movslq 0xb4(%rbx), %rax
movq 0x18(%rbx), %rcx
movq (%rcx,%rax,8), %rdi
leaq 0x2555f(%rip), %rsi     # 0x2ea30
leaq 0x257c0(%rip), %rdx     # 0x2ec98
xorl %ecx, %ecx
callq 0x6230
leaq 0x256fa(%rip), %rcx     # 0x2ebe0
addq $0x10, %rcx
movq %rcx, (%r14)
movl 0x8(%rax), %eax
movl %eax, 0x8(%r14)
leaq -0x50(%rbp), %rsi
movq %r14, (%rsi)
movq %r15, %rdi
callq 0x99a0
leaq -0x30(%rbp), %rdi
callq 0x17a3c
jmp 0x9653
leaq -0x30(%rbp), %rdi
pushq $0x61
popq %rsi
callq 0x17c08
movslq 0xb4(%rbx), %rax
movq 0x18(%rbx), %rcx
movq (%rcx,%rax,8), %rax
testq %rax, %rax
je 0x969b
movq (%rax), %rax
movq -0x8(%rax), %rsi
leaq 0x25825(%rip), %rdi     # 0x2ed68
callq 0x76ba
testb %al, %al
jne 0x978e
pushq $0x10
popq %rdi
callq 0x61d0
movq %rax, %r14
leaq 0x18(%rbx), %r15
movslq 0xb4(%rbx), %rax
movq 0x18(%rbx), %rcx
movq (%rcx,%rax,8), %rdi
leaq 0x254bb(%rip), %rsi     # 0x2ea30
leaq 0x257ec(%rip), %rdx     # 0x2ed68
xorl %ecx, %ecx
callq 0x6230
leaq 0x25726(%rip), %rcx     # 0x2ecb0
addq $0x10, %rcx
movq %rcx, (%r14)
movb 0x8(%rax), %al
movb %al, 0x8(%r14)
leaq -0x50(%rbp), %rsi
movq %r14, (%rsi)
movq %r15, %rdi
callq 0x99a0
leaq -0x30(%rbp), %rdi
callq 0x17c2c
jmp 0x9653
leaq -0x30(%rbp), %rdi
xorl %esi, %esi
callq 0x175ac
movslq 0xb4(%rbx), %rax
movq 0x18(%rbx), %rcx
movq (%rcx,%rax,8), %rax
testq %rax, %rax
je 0x96a5
movq (%rax), %rax
movq -0x8(%rax), %rsi
leaq 0x25512(%rip), %rdi     # 0x2eaf8
callq 0x76ba
testb %al, %al
jne 0x97d7
pushq $0x10
popq %rdi
callq 0x61d0
movq %rax, %r14
leaq 0x18(%rbx), %r15
movslq 0xb4(%rbx), %rax
movq 0x18(%rbx), %rcx
movq (%rcx,%rax,8), %rdi
leaq 0x25418(%rip), %rsi     # 0x2ea30
leaq 0x254d9(%rip), %rdx     # 0x2eaf8
xorl %ecx, %ecx
callq 0x6230
leaq 0x25413(%rip), %rcx     # 0x2ea40
addq $0x10, %rcx
movq %rcx, (%r14)
movl 0x8(%rax), %eax
movl %eax, 0x8(%r14)
leaq -0x50(%rbp), %rsi
movq %r14, (%rsi)
movq %r15, %rdi
callq 0x99a0
leaq -0x30(%rbp), %rdi
callq 0x175d0
incl 0xb4(%rbx)
leaq 0x1528b(%rip), %rsi     # 0x1e8eb
leaq -0x50(%rbp), %rdi
leaq -0x30(%rbp), %rdx
callq 0x72a6
addq $0x78, %rbx
leaq -0x50(%rbp), %rsi
movq %rbx, %rdi
callq 0x1925e
leaq -0x50(%rbp), %rdi
callq 0x60d0
addq $0x38, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
callq 0x6220
callq 0x6220
callq 0x6220
callq 0x6220
callq 0x6220
pushq $0x20
popq %rdi
callq 0x60f0
movq %rax, %r14
leaq 0x151f0(%rip), %rsi     # 0x1e8ac
leaq -0x50(%rbp), %rdi
leaq -0x19(%rbp), %rdx
callq 0x72a6
movb $0x1, %r15b
leaq -0x50(%rbp), %rsi
movq %r14, %rdi
callq 0x17d10
xorl %r15d, %r15d
leaq 0x243a6(%rip), %rsi     # 0x2da88
leaq 0xe631(%rip), %rdx      # 0x17d1a
movq %r14, %rdi
callq 0x63c0
jmp 0x981e
pushq $0x20
popq %rdi
callq 0x60f0
movq %rax, %r14
leaq 0x15124(%rip), %rsi     # 0x1e82c
leaq -0x50(%rbp), %rdi
leaq -0x19(%rbp), %rdx
callq 0x72a6
movb $0x1, %r15b
leaq -0x50(%rbp), %rsi
movq %r14, %rdi
callq 0x17d10
xorl %r15d, %r15d
leaq 0x2435a(%rip), %rsi     # 0x2da88
leaq 0xe5e5(%rip), %rdx      # 0x17d1a
movq %r14, %rdi
callq 0x63c0
jmp 0x981e
pushq $0x20
popq %rdi
callq 0x60f0
movq %rax, %r14
leaq 0x1509c(%rip), %rsi     # 0x1e7f0
leaq -0x50(%rbp), %rdi
leaq -0x19(%rbp), %rdx
callq 0x72a6
movb $0x1, %r15b
leaq -0x50(%rbp), %rsi
movq %r14, %rdi
callq 0x17d10
xorl %r15d, %r15d
leaq 0x2430e(%rip), %rsi     # 0x2da88
leaq 0xe599(%rip), %rdx      # 0x17d1a
movq %r14, %rdi
callq 0x63c0
jmp 0x981e
pushq $0x20
popq %rdi
callq 0x60f0
movq %rax, %r14
leaq 0x150cb(%rip), %rsi     # 0x1e86b
leaq -0x50(%rbp), %rdi
leaq -0x19(%rbp), %rdx
callq 0x72a6
movb $0x1, %r15b
leaq -0x50(%rbp), %rsi
movq %r14, %rdi
callq 0x17d10
xorl %r15d, %r15d
leaq 0x242c2(%rip), %rsi     # 0x2da88
leaq 0xe54d(%rip), %rdx      # 0x17d1a
movq %r14, %rdi
callq 0x63c0
jmp 0x981e
pushq $0x20
popq %rdi
callq 0x60f0
movq %rax, %r14
leaq 0x14fc8(%rip), %rsi     # 0x1e7b1
leaq -0x50(%rbp), %rdi
leaq -0x19(%rbp), %rdx
callq 0x72a6
movb $0x1, %r15b
leaq -0x50(%rbp), %rsi
movq %r14, %rdi
callq 0x17d10
xorl %r15d, %r15d
leaq 0x24279(%rip), %rsi     # 0x2da88
leaq 0xe504(%rip), %rdx      # 0x17d1a
movq %r14, %rdi
callq 0x63c0
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x60d0
testb %r15b, %r15b
jne 0x9837
jmp 0x98d7
movq %rax, %rbx
movq %r14, %rdi
callq 0x6150
jmp 0x98d7
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x60d0
testb %r15b, %r15b
jne 0x985d
jmp 0x98f3
movq %rax, %rbx
movq %r14, %rdi
callq 0x6150
jmp 0x98f3
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x60d0
testb %r15b, %r15b
jne 0x9880
jmp 0x98e5
movq %rax, %rbx
movq %r14, %rdi
callq 0x6150
jmp 0x98e5
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x60d0
testb %r15b, %r15b
jne 0x98a0
jmp 0x9901
movq %rax, %rbx
movq %r14, %rdi
callq 0x6150
jmp 0x9901
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x60d0
testb %r15b, %r15b
jne 0x98c0
jmp 0x990f
movq %rax, %rbx
movq %r14, %rdi
callq 0x6150
jmp 0x990f
jmp 0x98d4
jmp 0x98e2
jmp 0x98f0
jmp 0x98fe
jmp 0x990c
movq %rax, %rbx
leaq -0x30(%rbp), %rdi
callq 0x175d0
jmp 0x992b
movq %rax, %rbx
leaq -0x30(%rbp), %rdi
callq 0x17802
jmp 0x992b
movq %rax, %rbx
leaq -0x30(%rbp), %rdi
callq 0x17c2c
jmp 0x992b
movq %rax, %rbx
leaq -0x30(%rbp), %rdi
callq 0x17a3c
jmp 0x992b
movq %rax, %rbx
leaq -0x30(%rbp), %rdi
callq 0x17070
jmp 0x992b
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x60d0
jmp 0x992b
movq %rax, %rbx
movq %rbx, %rdi
callq 0x63f0
nop