// File: /workspace/github_cpp_makefile_star2_O3/zerolfx[P]P-Machine/in.cpp
// Function: In::execute(StackMachine*)
void In::execute(StackMachine *stack) 
{	
	switch(fType)
	{
		case integer:
		{
			int inputvalue;
			cin >> inputvalue;
			stack->fStore.push_back(new StackInteger(inputvalue));
			break;
		}	
		case real:
		{
			double inputvalue;
			cin >> inputvalue;
			stack->fStore.push_back(new StackReal(inputvalue));
			break;
		}
		case character:
		{
			char inputvalue;
			cin >> inputvalue;
			stack->fStore.push_back(new StackCharacter(inputvalue));
			break;
		}
		case boolean:
		{
			bool inputvalue;
			cin >> inputvalue;
			stack->fStore.push_back(new StackBoolean(inputvalue));
			break;
		}
		case address:
		{
			throw ExecutionError("instruction in: input of address at runtime is not allowed");
		}
	}
	
	// SP := SP + 1
	++stack->fSP;
	
	// adding cost of this instruction
	stack->fTime.count("in");

}

// 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 0x188bc
leaq 0xd886(%rip), %rcx      # 0x26068
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x1b7e6(%rip), %rdi     # 0x33fd8
leaq -0x40(%rbp), %r15
movq %r15, %rsi
callq 0x6130
movl $0x10, %edi
callq 0x6200
movq %rax, %r14
movsd (%r15), %xmm0
movq %rax, %rdi
callq 0x1abfc
leaq 0x18(%rbx), %rdi
leaq -0x48(%rbp), %rsi
jmp 0x188b4
movq 0x1b7ac(%rip), %rdi     # 0x33fd8
leaq -0x48(%rbp), %r15
movq %r15, %rsi
callq 0x61a0
movl $0x10, %edi
callq 0x6200
movq %rax, %r14
movzbl (%r15), %esi
movq %rax, %rdi
callq 0x1ae40
jmp 0x188ac
movq 0x1b77e(%rip), %rdi     # 0x33fd8
leaq -0x48(%rbp), %r15
movq %r15, %rsi
callq 0x62e0
movl $0x10, %edi
callq 0x6200
movq %rax, %r14
movsbl (%r15), %esi
movq %rax, %rdi
callq 0x1b03c
jmp 0x188ac
movq 0x1b750(%rip), %rdi     # 0x33fd8
leaq -0x48(%rbp), %r15
movq %r15, %rsi
callq 0x6120
movl $0x10, %edi
callq 0x6200
movq %rax, %r14
movl (%r15), %esi
movq %rax, %rdi
callq 0x1a9d4
leaq 0x18(%rbx), %rdi
leaq -0x40(%rbp), %rsi
movq %r14, (%rsi)
callq 0xa334
incl 0xb4(%rbx)
leaq -0x30(%rbp), %r14
movq %r14, -0x10(%r14)
leaq 0xd7ea(%rip), %rsi      # 0x260bb
leaq 0xd7e5(%rip), %rdx      # 0x260bd
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 0x18906
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 0xd751(%rip), %rsi      # 0x26080
leaq 0xd784(%rip), %rdx      # 0x260ba
leaq -0x40(%rbp), %rdi
callq 0x746c
movb $0x1, %r12b
leaq -0x40(%rbp), %rsi
movq %r14, %rdi
callq 0x1b14c
xorl %r12d, %r12d
leaq 0x1a130(%rip), %rsi     # 0x32a88
leaq 0x280b(%rip), %rdx      # 0x1b16a
movq %r14, %rdi
callq 0x63e0
movq %rax, %rbx
movq -0x40(%rbp), %rdi
cmpq %r15, %rdi
je 0x1897f
movq -0x30(%rbp), %rsi
incq %rsi
callq 0x6210
testb %r12b, %r12b
jne 0x18989
jmp 0x189c3
movq %rax, %rbx
movq %r14, %rdi
callq 0x6170
jmp 0x189c3
jmp 0x18999
jmp 0x18999
jmp 0x18999
movq %rax, %rbx
movl $0x10, %esi
movq %r14, %rdi
jmp 0x189b9
movq %rax, %rbx
movq -0x40(%rbp), %rdi
cmpq %r14, %rdi
je 0x189c3
movq -0x30(%rbp), %rsi
incq %rsi
callq 0x6210
jmp 0x189c3
movq %rax, %rbx
movq %rbx, %rdi
callq 0x6410
nop