// File: 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
subq $0x230, %rsp            # imm = 0x230
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x190(%rbp)
movq -0x10(%rbp), %rax
cmpl $0x0, 0xb4(%rax)
jge 0x11b97
movb $0x1, -0x45(%rbp)
movl $0x20, %edi
callq 0x7110
movq %rax, -0x1a0(%rbp)
leaq -0x31(%rbp), %rdi
movq %rdi, -0x198(%rbp)
callq 0x74f0
movq -0x198(%rbp), %rdx
leaq 0x2671f(%rip), %rsi     # 0x38231
leaq -0x30(%rbp), %rdi
callq 0x8940
jmp 0x11b1d
movq -0x1a0(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x283d0
jmp 0x11b2f
movq -0x1a0(%rbp), %rdi
movb $0x0, -0x45(%rbp)
leaq 0x37f3f(%rip), %rsi     # 0x49a80
leaq 0x168b8(%rip), %rdx     # 0x28400
callq 0x74a0
jmp 0x1235c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x11b75
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x7170
leaq -0x31(%rbp), %rdi
callq 0x72e0
testb $0x1, -0x45(%rbp)
jne 0x11b86
jmp 0x11b92
movq -0x1a0(%rbp), %rdi
callq 0x71c0
jmp 0x12353
movq -0x190(%rbp), %rax
movl 0xc(%rax), %eax
movq %rax, -0x1a8(%rbp)
subq $0x4, %rax
ja 0x1227a
movq -0x1a8(%rbp), %rax
leaq 0x26658(%rip), %rcx     # 0x38218
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq -0x58(%rbp), %rdi
xorl %esi, %esi
callq 0x27340
movq -0x10(%rbp), %rdi
addq $0x18, %rdi
movq -0x10(%rbp), %rax
movslq 0xb4(%rax), %rsi
callq 0x8e70
movq (%rax), %rax
movq %rax, -0x1b0(%rbp)
cmpq $0x0, %rax
jne 0x11c03
callq 0x7300
jmp 0x11c03
movq -0x1b0(%rbp), %rax
movq (%rax), %rax
movq -0x8(%rax), %rsi
leaq 0x38ed8(%rip), %rdi     # 0x4aaf0
callq 0x9370
testb $0x1, %al
jne 0x11c26
jmp 0x11ce9
movb $0x1, -0x7a(%rbp)
movl $0x20, %edi
callq 0x7110
movq %rax, -0x1c0(%rbp)
leaq -0x79(%rbp), %rdi
movq %rdi, -0x1b8(%rbp)
callq 0x74f0
movq -0x1b8(%rbp), %rdx
leaq 0x26610(%rip), %rsi     # 0x38269
leaq -0x78(%rbp), %rdi
callq 0x8940
jmp 0x11c64
movq -0x1c0(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0x283d0
jmp 0x11c76
movq -0x1c0(%rbp), %rdi
movb $0x0, -0x7a(%rbp)
leaq 0x37df8(%rip), %rsi     # 0x49a80
leaq 0x16771(%rip), %rdx     # 0x28400
callq 0x74a0
jmp 0x1235c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x11cf7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x11cca
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x78(%rbp), %rdi
callq 0x7170
leaq -0x79(%rbp), %rdi
callq 0x72e0
testb $0x1, -0x7a(%rbp)
jne 0x11cdb
jmp 0x11ce7
movq -0x1c0(%rbp), %rdi
callq 0x71c0
jmp 0x11cf7
leaq -0x58(%rbp), %rdi
callq 0x27380
jmp 0x1227a
leaq -0x58(%rbp), %rdi
callq 0x27380
jmp 0x12353
leaq -0x90(%rbp), %rdi
xorps %xmm0, %xmm0
callq 0x27840
movq -0x10(%rbp), %rdi
addq $0x18, %rdi
movq -0x10(%rbp), %rax
movslq 0xb4(%rax), %rsi
callq 0x8e70
movq (%rax), %rax
movq %rax, -0x1c8(%rbp)
cmpq $0x0, %rax
jne 0x11d43
callq 0x7300
jmp 0x11d43
movq -0x1c8(%rbp), %rax
movq (%rax), %rax
movq -0x8(%rax), %rsi
leaq 0x38e68(%rip), %rdi     # 0x4abc0
callq 0x9370
testb $0x1, %al
jne 0x11d66
jmp 0x11e41
movb $0x1, -0xb2(%rbp)
movl $0x20, %edi
callq 0x7110
movq %rax, -0x1d8(%rbp)
leaq -0xb1(%rbp), %rdi
movq %rdi, -0x1d0(%rbp)
callq 0x74f0
movq -0x1d0(%rbp), %rdx
leaq 0x26509(%rip), %rsi     # 0x382a8
leaq -0xb0(%rbp), %rdi
callq 0x8940
jmp 0x11dad
movq -0x1d8(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
callq 0x283d0
jmp 0x11dc2
movq -0x1d8(%rbp), %rdi
movb $0x0, -0xb2(%rbp)
leaq 0x37ca9(%rip), %rsi     # 0x49a80
leaq 0x16622(%rip), %rdx     # 0x28400
callq 0x74a0
jmp 0x1235c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x11e52
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x11e1c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0xb0(%rbp), %rdi
callq 0x7170
leaq -0xb1(%rbp), %rdi
callq 0x72e0
testb $0x1, -0xb2(%rbp)
jne 0x11e33
jmp 0x11e3f
movq -0x1d8(%rbp), %rdi
callq 0x71c0
jmp 0x11e52
leaq -0x90(%rbp), %rdi
callq 0x27880
jmp 0x1227a
leaq -0x90(%rbp), %rdi
callq 0x27880
jmp 0x12353
leaq -0xc8(%rbp), %rdi
xorl %esi, %esi
callq 0x27d20
movq -0x10(%rbp), %rdi
addq $0x18, %rdi
movq -0x10(%rbp), %rax
movslq 0xb4(%rax), %rsi
callq 0x8e70
movq (%rax), %rax
movq %rax, -0x1e0(%rbp)
cmpq $0x0, %rax
jne 0x11ea0
callq 0x7300
jmp 0x11ea0
movq -0x1e0(%rbp), %rax
movq (%rax), %rax
movq -0x8(%rax), %rsi
leaq 0x38ddb(%rip), %rdi     # 0x4ac90
callq 0x9370
testb $0x1, %al
jne 0x11ec3
jmp 0x11f9e
movb $0x1, -0xea(%rbp)
movl $0x20, %edi
callq 0x7110
movq %rax, -0x1f0(%rbp)
leaq -0xe9(%rbp), %rdi
movq %rdi, -0x1e8(%rbp)
callq 0x74f0
movq -0x1e8(%rbp), %rdx
leaq 0x263e8(%rip), %rsi     # 0x382e4
leaq -0xe8(%rbp), %rdi
callq 0x8940
jmp 0x11f0a
movq -0x1f0(%rbp), %rdi
leaq -0xe8(%rbp), %rsi
callq 0x283d0
jmp 0x11f1f
movq -0x1f0(%rbp), %rdi
movb $0x0, -0xea(%rbp)
leaq 0x37b4c(%rip), %rsi     # 0x49a80
leaq 0x164c5(%rip), %rdx     # 0x28400
callq 0x74a0
jmp 0x1235c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x11faf
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x11f79
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0xe8(%rbp), %rdi
callq 0x7170
leaq -0xe9(%rbp), %rdi
callq 0x72e0
testb $0x1, -0xea(%rbp)
jne 0x11f90
jmp 0x11f9c
movq -0x1f0(%rbp), %rdi
callq 0x71c0
jmp 0x11faf
leaq -0xc8(%rbp), %rdi
callq 0x27d70
jmp 0x1227a
leaq -0xc8(%rbp), %rdi
callq 0x27d70
jmp 0x12353
leaq -0x100(%rbp), %rdi
movl $0x61, %esi
callq 0x28170
movq -0x10(%rbp), %rdi
addq $0x18, %rdi
movq -0x10(%rbp), %rax
movslq 0xb4(%rax), %rsi
callq 0x8e70
movq (%rax), %rax
movq %rax, -0x1f8(%rbp)
cmpq $0x0, %rax
jne 0x12000
callq 0x7300
jmp 0x12000
movq -0x1f8(%rbp), %rax
movq (%rax), %rax
movq -0x8(%rax), %rsi
leaq 0x38d4b(%rip), %rdi     # 0x4ad60
callq 0x9370
testb $0x1, %al
jne 0x12023
jmp 0x120fe
movb $0x1, -0x122(%rbp)
movl $0x20, %edi
callq 0x7110
movq %rax, -0x208(%rbp)
leaq -0x121(%rbp), %rdi
movq %rdi, -0x200(%rbp)
callq 0x74f0
movq -0x200(%rbp), %rdx
leaq 0x262c7(%rip), %rsi     # 0x38323
leaq -0x120(%rbp), %rdi
callq 0x8940
jmp 0x1206a
movq -0x208(%rbp), %rdi
leaq -0x120(%rbp), %rsi
callq 0x283d0
jmp 0x1207f
movq -0x208(%rbp), %rdi
movb $0x0, -0x122(%rbp)
leaq 0x379ec(%rip), %rsi     # 0x49a80
leaq 0x16365(%rip), %rdx     # 0x28400
callq 0x74a0
jmp 0x1235c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x1210f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x120d9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x120(%rbp), %rdi
callq 0x7170
leaq -0x121(%rbp), %rdi
callq 0x72e0
testb $0x1, -0x122(%rbp)
jne 0x120f0
jmp 0x120fc
movq -0x208(%rbp), %rdi
callq 0x71c0
jmp 0x1210f
leaq -0x100(%rbp), %rdi
callq 0x281b0
jmp 0x1227a
leaq -0x100(%rbp), %rdi
callq 0x281b0
jmp 0x12353
leaq -0x138(%rbp), %rdi
xorl %esi, %esi
callq 0x26800
movq -0x10(%rbp), %rdi
addq $0x18, %rdi
movq -0x10(%rbp), %rax
movslq 0xb4(%rax), %rsi
callq 0x8e70
movq (%rax), %rax
movq %rax, -0x210(%rbp)
cmpq $0x0, %rax
jne 0x1215d
callq 0x7300
jmp 0x1215d
movq -0x210(%rbp), %rax
movq (%rax), %rax
movq -0x8(%rax), %rsi
leaq 0x387e6(%rip), %rdi     # 0x4a958
callq 0x9370
testb $0x1, %al
jne 0x12180
jmp 0x1225b
movb $0x1, -0x15a(%rbp)
movl $0x20, %edi
callq 0x7110
movq %rax, -0x220(%rbp)
leaq -0x159(%rbp), %rdi
movq %rdi, -0x218(%rbp)
callq 0x74f0
movq -0x218(%rbp), %rdx
leaq 0x261ab(%rip), %rsi     # 0x38364
leaq -0x158(%rbp), %rdi
callq 0x8940
jmp 0x121c7
movq -0x220(%rbp), %rdi
leaq -0x158(%rbp), %rsi
callq 0x283d0
jmp 0x121dc
movq -0x220(%rbp), %rdi
movb $0x0, -0x15a(%rbp)
leaq 0x3788f(%rip), %rsi     # 0x49a80
leaq 0x16208(%rip), %rdx     # 0x28400
callq 0x74a0
jmp 0x1235c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x12269
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x12236
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x158(%rbp), %rdi
callq 0x7170
leaq -0x159(%rbp), %rdi
callq 0x72e0
testb $0x1, -0x15a(%rbp)
jne 0x1224d
jmp 0x12259
movq -0x220(%rbp), %rdi
callq 0x71c0
jmp 0x12269
leaq -0x138(%rbp), %rdi
callq 0x26840
jmp 0x1227a
leaq -0x138(%rbp), %rdi
callq 0x26840
jmp 0x12353
movq -0x10(%rbp), %rax
movq %rax, %rdi
addq $0x18, %rdi
movslq 0xb4(%rax), %rsi
callq 0x8e70
movq %rax, %rcx
movq -0x190(%rbp), %rax
movq (%rcx), %rdi
movl 0x8(%rax), %esi
movq (%rdi), %rax
movq 0x80(%rax), %rax
callq *%rax
movq -0x10(%rbp), %rax
addq $0x78, %rax
movq %rax, -0x230(%rbp)
leaq -0x181(%rbp), %rdi
movq %rdi, -0x228(%rbp)
callq 0x74f0
movq -0x228(%rbp), %rdx
leaq 0x260c6(%rip), %rsi     # 0x383a3
leaq -0x180(%rbp), %rdi
callq 0x8940
jmp 0x122eb
movq -0x230(%rbp), %rdi
leaq -0x180(%rbp), %rsi
callq 0x2c4d0
jmp 0x12300
leaq -0x180(%rbp), %rdi
callq 0x7170
leaq -0x181(%rbp), %rdi
callq 0x72e0
addq $0x230, %rsp            # imm = 0x230
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x12347
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x180(%rbp), %rdi
callq 0x7170
leaq -0x181(%rbp), %rdi
callq 0x72e0
movq -0x40(%rbp), %rdi
callq 0x74e0
nopl (%rax)