// File: /workspace/github_cpp_makefile_star2_O2/zerolfx[P]P-Machine/inc.cpp
// Function: Inc::execute(StackMachine*)
void Inc::execute(StackMachine *stack)
{
	// check if the stack contains at least one entry
	
	if(stack->fSP < 0)
		throw ExecutionError("instruction inc: requires 1 stackelement to be present.");
		
	switch(fType)
	{
		case integer:
		{
			StackInteger p1;

			// check if the  uppermost stackentry is of type integer
			if(typeid(p1) != typeid(*(stack->fStore[stack->fSP])))
				throw ExecutionError("instruction inc: SP does not point to element of type integer.");

			break;
		}	
		case real:
		{
			StackReal p1;
			// check if the  uppermost stackentry is of type real
			if(typeid(p1) != typeid(*(stack->fStore[stack->fSP])))
				throw ExecutionError("instruction inc: SP does not point to element of type real.");

			break;
		}
		case boolean:
		{
			StackBoolean p1;
			// check if the  uppermost stackentry is of type boolean
			if(typeid(p1) != typeid(*(stack->fStore[stack->fSP])))
				throw ExecutionError("instruction inc: SP does not point to element of type boolean.");

			break;
		}
		case character:
		{
			StackCharacter p1;
			// check if the  uppermost stackentriy is of type character
			if(typeid(p1) != typeid(*(stack->fStore[stack->fSP])))
				throw ExecutionError("instruction inc: SP does not point to element of type character.");

			break;
		}
		case address:
		{
			StackAddress p1;
			// check if the uppermost stackentry is of type address
			if(typeid(p1) != typeid(*(stack->fStore[stack->fSP])))
				throw ExecutionError("instruction inc: SP does not point to element of type address.");

			break;
		}
	}
	
	// actual increment
	stack->fStore[stack->fSP]->inc(fP);
	
	// adding cost of this instruction
	stack->fTime.count("inc");

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x38, %rsp
cmpl $0x0, 0xb4(%rsi)
js 0xbdbd
movq %rsi, %rbx
movq %rdi, %r14
movl 0xc(%rdi), %eax
cmpq $0x4, %rax
ja 0xbd69
leaq 0x1362e(%rip), %rcx     # 0x1f218
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 0xbe13
movq (%rax), %rax
movq -0x8(%rax), %rsi
leaq 0x22fa3(%rip), %rdi     # 0x2ebc8
callq 0x76ba
testb %al, %al
jne 0xbf06
leaq -0x30(%rbp), %rdi
callq 0x17802
jmp 0xbd69
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 0xbe09
movq (%rax), %rax
movq -0x8(%rax), %rsi
leaq 0x22cef(%rip), %rdi     # 0x2e960
callq 0x76ba
testb %al, %al
jne 0xbe22
leaq -0x30(%rbp), %rdi
callq 0x17070
jmp 0xbd69
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 0xbe0e
movq (%rax), %rax
movq -0x8(%rax), %rsi
leaq 0x22fdb(%rip), %rdi     # 0x2ec98
callq 0x76ba
testb %al, %al
jne 0xbe6e
leaq -0x30(%rbp), %rdi
callq 0x17a3c
jmp 0xbd69
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 0xbe18
movq (%rax), %rax
movq -0x8(%rax), %rsi
leaq 0x2305e(%rip), %rdi     # 0x2ed68
callq 0x76ba
testb %al, %al
jne 0xbeba
leaq -0x30(%rbp), %rdi
callq 0x17c2c
jmp 0xbd69
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 0xbe1d
movq (%rax), %rax
movq -0x8(%rax), %rsi
leaq 0x22da5(%rip), %rdi     # 0x2eaf8
callq 0x76ba
testb %al, %al
jne 0xbf4f
leaq -0x30(%rbp), %rdi
callq 0x175d0
movslq 0xb4(%rbx), %rax
movq 0x18(%rbx), %rcx
movq (%rcx,%rax,8), %rdi
movl 0x8(%r14), %esi
movq (%rdi), %rax
callq *0x80(%rax)
leaq 0x13617(%rip), %rsi     # 0x1f3a3
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
pushq $0x20
popq %rdi
callq 0x60f0
movq %rax, %r14
leaq 0x13462(%rip), %rsi     # 0x1f231
leaq -0x50(%rbp), %rdi
leaq -0x30(%rbp), %rdx
callq 0x72a6
movb $0x1, %r15b
leaq -0x50(%rbp), %rsi
movq %r14, %rdi
callq 0x17d10
xorl %r15d, %r15d
leaq 0x21c93(%rip), %rsi     # 0x2da88
leaq 0xbf1e(%rip), %rdx      # 0x17d1a
movq %r14, %rdi
callq 0x63c0
jmp 0xbf96
callq 0x6220
callq 0x6220
callq 0x6220
callq 0x6220
callq 0x6220
pushq $0x20
popq %rdi
callq 0x60f0
movq %rax, %r14
leaq 0x13530(%rip), %rsi     # 0x1f364
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 0x21c2e(%rip), %rsi     # 0x2da88
leaq 0xbeb9(%rip), %rdx      # 0x17d1a
movq %r14, %rdi
callq 0x63c0
jmp 0xbf96
pushq $0x20
popq %rdi
callq 0x60f0
movq %rax, %r14
leaq 0x13464(%rip), %rsi     # 0x1f2e4
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 0x21be2(%rip), %rsi     # 0x2da88
leaq 0xbe6d(%rip), %rdx      # 0x17d1a
movq %r14, %rdi
callq 0x63c0
jmp 0xbf96
pushq $0x20
popq %rdi
callq 0x60f0
movq %rax, %r14
leaq 0x13457(%rip), %rsi     # 0x1f323
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 0x21b96(%rip), %rsi     # 0x2da88
leaq 0xbe21(%rip), %rdx      # 0x17d1a
movq %r14, %rdi
callq 0x63c0
jmp 0xbf96
pushq $0x20
popq %rdi
callq 0x60f0
movq %rax, %r14
leaq 0x13390(%rip), %rsi     # 0x1f2a8
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 0x21b4a(%rip), %rsi     # 0x2da88
leaq 0xbdd5(%rip), %rdx      # 0x17d1a
movq %r14, %rdi
callq 0x63c0
jmp 0xbf96
pushq $0x20
popq %rdi
callq 0x60f0
movq %rax, %r14
leaq 0x13308(%rip), %rsi     # 0x1f269
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 0x21b01(%rip), %rsi     # 0x2da88
leaq 0xbd8c(%rip), %rdx      # 0x17d1a
movq %r14, %rdi
callq 0x63c0
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x60d0
testb %r15b, %r15b
jne 0xbfc5
jmp 0xc03f
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x60d0
testb %r15b, %r15b
jne 0xbfd2
jmp 0xc04d
movq %rax, %rbx
movq %r14, %rdi
callq 0x6150
jmp 0xc03f
movq %rax, %rbx
movq %r14, %rdi
callq 0x6150
jmp 0xc04d
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x60d0
testb %r15b, %r15b
jne 0xbff2
jmp 0xc05b
movq %rax, %rbx
movq %r14, %rdi
callq 0x6150
jmp 0xc05b
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x60d0
testb %r15b, %r15b
jne 0xc012
jmp 0xc069
movq %rax, %rbx
movq %r14, %rdi
callq 0x6150
jmp 0xc069
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x60d0
testb %r15b, %r15b
jne 0xc032
jmp 0xc077
movq %rax, %rbx
movq %r14, %rdi
callq 0x6150
jmp 0xc077
movq %rax, %rbx
leaq -0x30(%rbp), %rdi
callq 0x175d0
jmp 0xc0b3
movq %rax, %rbx
leaq -0x30(%rbp), %rdi
callq 0x17802
jmp 0xc0b3
movq %rax, %rbx
leaq -0x30(%rbp), %rdi
callq 0x17c2c
jmp 0xc0b3
movq %rax, %rbx
leaq -0x30(%rbp), %rdi
callq 0x17a3c
jmp 0xc0b3
movq %rax, %rbx
leaq -0x30(%rbp), %rdi
callq 0x17070
jmp 0xc0b3
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x60d0
testb %r15b, %r15b
jne 0xc098
jmp 0xc0b3
movq %rax, %rbx
movq %r14, %rdi
callq 0x6150
jmp 0xc0b3
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x60d0
jmp 0xc0b3
movq %rax, %rbx
movq %rbx, %rdi
callq 0x63f0
nop