// File: /workspace/github_cpp_makefile_star2_O1/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 0x18b44
leaq 0xd5fe(%rip), %rcx      # 0x26068
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x1b55e(%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 0x1aec8
leaq 0x18(%rbx), %rdi
leaq -0x48(%rbp), %rsi
jmp 0x18b3c
movq 0x1b524(%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 0x1b10c
jmp 0x18b34
movq 0x1b4f6(%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 0x1b308
jmp 0x18b34
movq 0x1b4c8(%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 0x1aca0
leaq 0x18(%rbx), %rdi
leaq -0x40(%rbp), %rsi
movq %r14, (%rsi)
callq 0xa3ae
incl 0xb4(%rbx)
leaq -0x30(%rbp), %r14
movq %r14, -0x10(%r14)
leaq 0xd562(%rip), %rsi      # 0x260bb
leaq 0xd55d(%rip), %rdx      # 0x260bd
leaq -0x40(%rbp), %rdi
callq 0x746c
addq $0x78, %rbx
leaq -0x40(%rbp), %rsi
movq %rbx, %rdi
callq 0x1ce78
movq -0x40(%rbp), %rdi
cmpq %r14, %rdi
je 0x18b8e
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), %r12
movq %r12, -0x10(%r12)
leaq 0xd4c8(%rip), %rsi      # 0x26080
leaq 0xd4fb(%rip), %rdx      # 0x260ba
leaq -0x40(%rbp), %rdi
callq 0x746c
movb $0x1, %r15b
leaq -0x40(%rbp), %rsi
movq %r14, %rdi
callq 0x1b418
xorl %r15d, %r15d
leaq 0x19ea7(%rip), %rsi     # 0x32a88
leaq 0x284e(%rip), %rdx      # 0x1b436
movq %r14, %rdi
callq 0x63e0
movq %rax, %rbx
movq -0x40(%rbp), %rdi
cmpq %r12, %rdi
je 0x18c10
movq -0x30(%rbp), %rsi
incq %rsi
callq 0x6210
jmp 0x18c10
movq %rax, %rbx
movb $0x1, %r15b
testb %r15b, %r15b
je 0x18c4f
movq %r14, %rdi
callq 0x6170
jmp 0x18c4f
jmp 0x18c25
jmp 0x18c25
jmp 0x18c25
movq %rax, %rbx
movl $0x10, %esi
movq %r14, %rdi
jmp 0x18c45
movq %rax, %rbx
movq -0x40(%rbp), %rdi
cmpq %r14, %rdi
je 0x18c4f
movq -0x30(%rbp), %rsi
incq %rsi
callq 0x6210
jmp 0x18c4f
movq %rax, %rbx
movq %rbx, %rdi
callq 0x6410
nop