// File: /workspace/github_cpp_makefile_star2_O1/zerolfx[P]P-Machine/out.cpp
// Function: Out::execute(StackMachine*)
void Out::execute(StackMachine *stack) 
{	
	switch(fType)
	{
		case integer:
		{
			StackInteger p1;
			if(typeid(p1) != typeid(*(stack->fStore[stack->fSP])))
				throw ExecutionError("instruction out: SP does not point to element of type integer.");
			
			cout << *stack->fStore[stack->fSP];
			
			// SP := SP + 1
			delete stack->fStore[stack->fSP];
			stack->fStore.pop_back();
			--stack->fSP;
		
			break;
		}
		case character:
		{
			StackCharacter p1;
			if(typeid(p1) != typeid(*(stack->fStore[stack->fSP])))
				throw ExecutionError("instruction out: SP does not point to element of type character.");
			
			cout << *stack->fStore[stack->fSP];
			
			// SP := SP + 1
			delete stack->fStore[stack->fSP];
			stack->fStore.pop_back();
			--stack->fSP;
		
			break;
		}
		case boolean:
		{
			StackBoolean p1;
			if(typeid(p1) != typeid(*(stack->fStore[stack->fSP])))
				throw ExecutionError("instruction out: SP does not point to element of type boolean.");
			
			cout << *stack->fStore[stack->fSP];
			
			// SP := SP + 1
			delete stack->fStore[stack->fSP];
			stack->fStore.pop_back();
			--stack->fSP;
		
			break;
		}
		case address:
		{
			StackAddress p1;
			if(typeid(p1) != typeid(*(stack->fStore[stack->fSP])))
				throw ExecutionError("instruction out: SP does not point to element of type boolean.");

			cout << *stack->fStore[stack->fSP];
			
			// SP := SP + 1
			delete stack->fStore[stack->fSP];
			stack->fStore.pop_back();
			--stack->fSP;
		
			break;
		}	
		case real:
		{
			StackInteger p1;
			StackReal p2;
				
			if(fPrecisionMarker)
			{
				// check if the two uppermost stackentries are of type integer and real respectively
				if(typeid(p1) != typeid(*(stack->fStore[stack->fSP])))
					throw ExecutionError("instruction out: SP does not point to element of type integer.");
				if(typeid(p2) != typeid(*(stack->fStore[stack->fSP - 1])))
					throw ExecutionError("instruction out: SP - 1 does not point to element of type real.");
								
				cout.precision(stack->fStore[stack->fSP]->getValue());
				cout << *stack->fStore[stack->fSP - 1];
				
				delete stack->fStore[stack->fSP];
				delete stack->fStore[stack->fSP - 1];
				stack->fStore.pop_back();
				stack->fStore.pop_back();
				stack->fSP -= 2;
			}
			else
			{
				if(typeid(p2) != typeid(*(stack->fStore[stack->fSP])))
					throw ExecutionError("instruction out: SP does not point to element of type real.");
				
				cout << *stack->fStore[stack->fSP];
				
				delete stack->fStore[stack->fSP];
				stack->fStore.pop_back();
				--stack->fSP;
			}			
			break;
		}
	}

	// adding cost of this instruction
	stack->fTime.count("out");
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rsi, %rbx
movl 0x8(%rdi), %eax
cmpq $0x4, %rax
ja 0x191fc
leaq 0xd326(%rip), %rcx      # 0x260c0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq %rdi, %r15
leaq -0x58(%rbp), %rdi
xorl %esi, %esi
callq 0x1aca0
leaq -0x68(%rbp), %rdi
xorps %xmm0, %xmm0
callq 0x1aec8
movslq 0xb4(%rbx), %r13
movq 0x18(%rbx), %r12
movq (%r12,%r13,8), %r14
cmpb $0x1, 0xc(%r15)
jne 0x19160
testq %r14, %r14
je 0x1924f
movq (%r14), %r15
movq -0x8(%r15), %rax
leaq 0x1ad0a(%rip), %rcx     # 0x33af8
movq 0x8(%rcx), %rdi
movq 0x8(%rax), %rsi
cmpq %rsi, %rdi
je 0x18e11
cmpb $0x2a, (%rdi)
je 0x193d0
callq 0x6310
testl %eax, %eax
jne 0x193d0
movq -0x8(%r12,%r13,8), %rax
testq %rax, %rax
je 0x1924f
movq %r15, %r13
movq (%rax), %rax
movq -0x8(%rax), %rax
leaq 0x1ad98(%rip), %rcx     # 0x33bc8
movq 0x8(%rcx), %rdi
movq 0x8(%rax), %rsi
cmpq %rsi, %rdi
je 0x18e53
cmpb $0x2a, (%rdi)
je 0x19481
callq 0x6310
testl %eax, %eax
jne 0x19481
movq 0x1b166(%rip), %r15     # 0x33fc0
movq (%r15), %rax
movq -0x18(%rax), %r12
movq %r14, %rdi
callq *0x68(%r13)
cltq
movq %rax, 0x8(%r15,%r12)
movslq 0xb4(%rbx), %rax
movq 0x18(%rbx), %rcx
movq -0x8(%rcx,%rax,8), %rsi
movq %r15, %rdi
callq 0x1abbb
movslq 0xb4(%rbx), %rax
movq 0x18(%rbx), %rcx
movq (%rcx,%rax,8), %r14
testq %r14, %r14
je 0x18eb0
movq %r14, %rdi
callq 0x1a5cc
movl $0x8, %esi
movq %r14, %rdi
callq 0x6210
movslq 0xb4(%rbx), %rax
movq 0x18(%rbx), %rcx
movq -0x8(%rcx,%rax,8), %r14
movl $0xfffffffe, %r15d      # imm = 0xFFFFFFFE
movq $-0x10, %r12
jmp 0x191c5
leaq -0x58(%rbp), %rdi
xorl %esi, %esi
callq 0x1a3d0
movslq 0xb4(%rbx), %rax
movq 0x18(%rbx), %rcx
movq (%rcx,%rax,8), %r14
testq %r14, %r14
je 0x193bc
movq (%r14), %rax
movq -0x8(%rax), %rax
leaq 0x1aa5d(%rip), %rcx     # 0x33960
movq 0x8(%rcx), %rdi
movq 0x8(%rax), %rsi
cmpq %rsi, %rdi
je 0x18f26
cmpb $0x2a, (%rdi)
je 0x19254
callq 0x6310
testl %eax, %eax
jne 0x19254
movq 0x1b093(%rip), %rdi     # 0x33fc0
movq %r14, %rsi
callq 0x1abbb
movslq 0xb4(%rbx), %rax
movq 0x18(%rbx), %rcx
movq (%rcx,%rax,8), %r14
testq %r14, %r14
je 0x18f5e
movq %r14, %rdi
callq 0x1a5cc
movl $0x8, %esi
movq %r14, %rdi
callq 0x6210
addq $-0x8, 0x20(%rbx)
decl 0xb4(%rbx)
leaq -0x58(%rbp), %rdi
callq 0x1a3f4
jmp 0x191fc
leaq -0x58(%rbp), %rdi
xorl %esi, %esi
callq 0x1b10c
movslq 0xb4(%rbx), %rax
movq 0x18(%rbx), %rcx
movq (%rcx,%rax,8), %r14
testq %r14, %r14
je 0x193c1
movq (%r14), %rax
movq -0x8(%rax), %rax
leaq 0x1acf0(%rip), %rcx     # 0x33c98
movq 0x8(%rcx), %rdi
movq 0x8(%rax), %rsi
cmpq %rsi, %rdi
je 0x18fcb
cmpb $0x2a, (%rdi)
je 0x192ae
callq 0x6310
testl %eax, %eax
jne 0x192ae
movq 0x1afee(%rip), %rdi     # 0x33fc0
movq %r14, %rsi
callq 0x1abbb
movslq 0xb4(%rbx), %rax
movq 0x18(%rbx), %rcx
movq (%rcx,%rax,8), %r14
testq %r14, %r14
je 0x19003
movq %r14, %rdi
callq 0x1a5cc
movl $0x8, %esi
movq %r14, %rdi
callq 0x6210
addq $-0x8, 0x20(%rbx)
decl 0xb4(%rbx)
leaq -0x58(%rbp), %rdi
callq 0x1b130
jmp 0x191fc
leaq -0x58(%rbp), %rdi
movl $0x61, %esi
callq 0x1b308
movslq 0xb4(%rbx), %rax
movq 0x18(%rbx), %rcx
movq (%rcx,%rax,8), %r14
testq %r14, %r14
je 0x193c6
movq (%r14), %rax
movq -0x8(%rax), %rax
leaq 0x1ad18(%rip), %rcx     # 0x33d68
movq 0x8(%rcx), %rdi
movq 0x8(%rax), %rsi
cmpq %rsi, %rdi
je 0x19073
cmpb $0x2a, (%rdi)
je 0x19308
callq 0x6310
testl %eax, %eax
jne 0x19308
movq 0x1af46(%rip), %rdi     # 0x33fc0
movq %r14, %rsi
callq 0x1abbb
movslq 0xb4(%rbx), %rax
movq 0x18(%rbx), %rcx
movq (%rcx,%rax,8), %r14
testq %r14, %r14
je 0x190ab
movq %r14, %rdi
callq 0x1a5cc
movl $0x8, %esi
movq %r14, %rdi
callq 0x6210
addq $-0x8, 0x20(%rbx)
decl 0xb4(%rbx)
leaq -0x58(%rbp), %rdi
callq 0x1b32c
jmp 0x191fc
leaq -0x58(%rbp), %rdi
xorl %esi, %esi
callq 0x1aca0
movslq 0xb4(%rbx), %rax
movq 0x18(%rbx), %rcx
movq (%rcx,%rax,8), %r14
testq %r14, %r14
je 0x193cb
movq (%r14), %rax
movq -0x8(%rax), %rax
leaq 0x1aa03(%rip), %rcx     # 0x33af8
movq 0x8(%rcx), %rdi
movq 0x8(%rax), %rsi
cmpq %rsi, %rdi
je 0x19118
cmpb $0x2a, (%rdi)
je 0x19362
callq 0x6310
testl %eax, %eax
jne 0x19362
movq 0x1aea1(%rip), %rdi     # 0x33fc0
movq %r14, %rsi
callq 0x1abbb
movslq 0xb4(%rbx), %rax
movq 0x18(%rbx), %rcx
movq (%rcx,%rax,8), %r14
testq %r14, %r14
je 0x19150
movq %r14, %rdi
callq 0x1a5cc
movl $0x8, %esi
movq %r14, %rdi
callq 0x6210
addq $-0x8, 0x20(%rbx)
decl 0xb4(%rbx)
jmp 0x191f3
testq %r14, %r14
je 0x1924f
movq (%r14), %rax
movq -0x8(%rax), %rax
leaq 0x1aa51(%rip), %rcx     # 0x33bc8
movq 0x8(%rcx), %rdi
movq 0x8(%rax), %rsi
cmpq %rsi, %rdi
je 0x1919a
cmpb $0x2a, (%rdi)
je 0x1942a
callq 0x6310
testl %eax, %eax
jne 0x1942a
movq 0x1ae1f(%rip), %rdi     # 0x33fc0
movq %r14, %rsi
callq 0x1abbb
movslq 0xb4(%rbx), %rax
movq 0x18(%rbx), %rcx
movq (%rcx,%rax,8), %r14
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
movq $-0x8, %r12
testq %r14, %r14
je 0x191df
movq %r14, %rdi
callq 0x1a5cc
movl $0x8, %esi
movq %r14, %rdi
callq 0x6210
addq %r12, 0x20(%rbx)
addl %r15d, 0xb4(%rbx)
leaq -0x68(%rbp), %rdi
callq 0x1aef6
leaq -0x58(%rbp), %rdi
callq 0x1acc4
leaq -0x38(%rbp), %r14
movq %r14, -0x10(%r14)
leaq 0xd009(%rip), %rsi      # 0x26214
leaq 0xd005(%rip), %rdx      # 0x26217
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 0x19240
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x6210
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x6250
movl $0x20, %edi
callq 0x6100
movq %rax, %r14
leaq -0x38(%rbp), %r12
movq %r12, -0x10(%r12)
leaq 0xcee8(%rip), %rsi      # 0x26159
leaq 0xcf1f(%rip), %rdx      # 0x26197
leaq -0x48(%rbp), %rdi
callq 0x746c
movb $0x1, %r15b
leaq -0x48(%rbp), %rsi
movq %r14, %rdi
callq 0x1b418
xorl %r15d, %r15d
leaq 0x197ee(%rip), %rsi     # 0x32a88
leaq 0x2195(%rip), %rdx      # 0x1b436
movq %r14, %rdi
callq 0x63e0
jmp 0x194d6
movl $0x20, %edi
callq 0x6100
movq %rax, %r14
leaq -0x38(%rbp), %r12
movq %r12, -0x10(%r12)
leaq 0xce8e(%rip), %rsi      # 0x26159
leaq 0xcec5(%rip), %rdx      # 0x26197
leaq -0x48(%rbp), %rdi
callq 0x746c
movb $0x1, %r15b
leaq -0x48(%rbp), %rsi
movq %r14, %rdi
callq 0x1b418
xorl %r15d, %r15d
leaq 0x19794(%rip), %rsi     # 0x32a88
leaq 0x213b(%rip), %rdx      # 0x1b436
movq %r14, %rdi
callq 0x63e0
jmp 0x194d6
movl $0x20, %edi
callq 0x6100
movq %rax, %r14
leaq -0x38(%rbp), %r12
movq %r12, -0x10(%r12)
leaq 0xcdf3(%rip), %rsi      # 0x26118
leaq 0xce2c(%rip), %rdx      # 0x26158
leaq -0x48(%rbp), %rdi
callq 0x746c
movb $0x1, %r15b
leaq -0x48(%rbp), %rsi
movq %r14, %rdi
callq 0x1b418
xorl %r15d, %r15d
leaq 0x1973a(%rip), %rsi     # 0x32a88
leaq 0x20e1(%rip), %rdx      # 0x1b436
movq %r14, %rdi
callq 0x63e0
jmp 0x194d6
movl $0x20, %edi
callq 0x6100
movq %rax, %r14
leaq -0x38(%rbp), %r12
movq %r12, -0x10(%r12)
leaq 0xcd5a(%rip), %rsi      # 0x260d9
leaq 0xcd91(%rip), %rdx      # 0x26117
leaq -0x48(%rbp), %rdi
callq 0x746c
movb $0x1, %r15b
leaq -0x48(%rbp), %rsi
movq %r14, %rdi
callq 0x1b418
xorl %r15d, %r15d
leaq 0x196e0(%rip), %rsi     # 0x32a88
leaq 0x2087(%rip), %rdx      # 0x1b436
movq %r14, %rdi
callq 0x63e0
jmp 0x194d6
callq 0x6250
callq 0x6250
callq 0x6250
callq 0x6250
movl $0x20, %edi
callq 0x6100
movq %rax, %r14
leaq -0x38(%rbp), %r12
movq %r12, -0x10(%r12)
leaq 0xccec(%rip), %rsi      # 0x260d9
leaq 0xcd23(%rip), %rdx      # 0x26117
leaq -0x48(%rbp), %rdi
callq 0x746c
movb $0x1, %r15b
leaq -0x48(%rbp), %rsi
movq %r14, %rdi
callq 0x1b418
xorl %r15d, %r15d
leaq 0x19672(%rip), %rsi     # 0x32a88
leaq 0x2019(%rip), %rdx      # 0x1b436
movq %r14, %rdi
callq 0x63e0
jmp 0x194d6
movl $0x20, %edi
callq 0x6100
movq %rax, %r14
leaq -0x38(%rbp), %r12
movq %r12, -0x10(%r12)
leaq 0xcd91(%rip), %rsi      # 0x261d8
leaq 0xcdc5(%rip), %rdx      # 0x26213
leaq -0x48(%rbp), %rdi
callq 0x746c
movb $0x1, %r15b
leaq -0x48(%rbp), %rsi
movq %r14, %rdi
callq 0x1b418
xorl %r15d, %r15d
leaq 0x19618(%rip), %rsi     # 0x32a88
leaq 0x1fbf(%rip), %rdx      # 0x1b436
movq %r14, %rdi
callq 0x63e0
jmp 0x194d6
movl $0x20, %edi
callq 0x6100
movq %rax, %r14
leaq -0x38(%rbp), %r12
movq %r12, -0x10(%r12)
leaq 0xccfa(%rip), %rsi      # 0x26198
leaq 0xcd32(%rip), %rdx      # 0x261d7
leaq -0x48(%rbp), %rdi
callq 0x746c
movb $0x1, %r15b
leaq -0x48(%rbp), %rsi
movq %r14, %rdi
callq 0x1b418
xorl %r15d, %r15d
leaq 0x195c1(%rip), %rsi     # 0x32a88
leaq 0x1f68(%rip), %rdx      # 0x1b436
movq %r14, %rdi
callq 0x63e0
jmp 0x194de
jmp 0x194f8
jmp 0x194de
jmp 0x194f8
movq %rax, %rbx
movq -0x48(%rbp), %rdi
cmpq %r12, %rdi
je 0x194fe
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x6210
jmp 0x194fe
movq %rax, %rbx
movb $0x1, %r15b
testb %r15b, %r15b
je 0x1960b
movq %r14, %rdi
callq 0x6170
jmp 0x1960b
movq %rax, %rbx
movq -0x48(%rbp), %rdi
cmpq %r12, %rdi
je 0x19534
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x6210
jmp 0x19534
movq %rax, %rbx
movb $0x1, %r15b
testb %r15b, %r15b
je 0x19614
movq %r14, %rdi
callq 0x6170
jmp 0x19614
movq %rax, %rbx
movq -0x48(%rbp), %rdi
cmpq %r12, %rdi
je 0x1956a
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x6210
jmp 0x1956a
movq %rax, %rbx
movb $0x1, %r15b
testb %r15b, %r15b
je 0x195e1
movq %r14, %rdi
callq 0x6170
jmp 0x195e1
movq %rax, %rbx
movq -0x48(%rbp), %rdi
cmpq %r12, %rdi
je 0x19599
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x6210
jmp 0x19599
movq %rax, %rbx
movb $0x1, %r15b
testb %r15b, %r15b
je 0x195ef
movq %r14, %rdi
callq 0x6170
jmp 0x195ef
movq %rax, %rbx
movq -0x48(%rbp), %rdi
cmpq %r12, %rdi
je 0x195c8
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x6210
jmp 0x195c8
movq %rax, %rbx
movb $0x1, %r15b
testb %r15b, %r15b
je 0x195fd
movq %r14, %rdi
callq 0x6170
jmp 0x195fd
jmp 0x195d9
movq %rax, %rbx
jmp 0x19614
movq %rax, %rbx
leaq -0x58(%rbp), %rdi
callq 0x1b32c
jmp 0x1963c
movq %rax, %rbx
leaq -0x58(%rbp), %rdi
callq 0x1b130
jmp 0x1963c
movq %rax, %rbx
leaq -0x58(%rbp), %rdi
callq 0x1a3f4
jmp 0x1963c
movq %rax, %rbx
leaq -0x68(%rbp), %rdi
callq 0x1aef6
leaq -0x58(%rbp), %rdi
callq 0x1acc4
jmp 0x1963c
movq %rax, %rbx
movq -0x48(%rbp), %rdi
cmpq %r14, %rdi
je 0x1963c
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x6210
jmp 0x1963c
movq %rax, %rbx
movq %rbx, %rdi
callq 0x6410