// File: /workspace/github_cpp_makefile_star2_O2/zerolfx[P]P-Machine/dec.cpp
// Function: Dec::execute(StackMachine*)
void Dec::execute(StackMachine *stack)
{
	// check if the stack contains at least one entry
	if(stack->fSP < 0)
		throw ExecutionError("instruction dec: 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 dec: 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 dec: 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 dec: 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 dec: 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 dec: SP does not point to element of type address.");

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

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x38, %rsp
cmpl $0x0, 0xb4(%rsi)
js 0x89f3
movq %rsi, %rbx
movq %rdi, %r14
movl 0xc(%rdi), %eax
cmpq $0x4, %rax
ja 0x899f
leaq 0x15ca4(%rip), %rcx     # 0x1e4c4
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 0x8a49
movq (%rax), %rax
movq -0x8(%rax), %rsi
leaq 0x2636d(%rip), %rdi     # 0x2ebc8
callq 0x76ba
testb %al, %al
jne 0x8b3c
leaq -0x30(%rbp), %rdi
callq 0x17802
jmp 0x899f
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 0x8a3f
movq (%rax), %rax
movq -0x8(%rax), %rsi
leaq 0x260b9(%rip), %rdi     # 0x2e960
callq 0x76ba
testb %al, %al
jne 0x8a58
leaq -0x30(%rbp), %rdi
callq 0x17070
jmp 0x899f
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 0x8a44
movq (%rax), %rax
movq -0x8(%rax), %rsi
leaq 0x263a5(%rip), %rdi     # 0x2ec98
callq 0x76ba
testb %al, %al
jne 0x8aa4
leaq -0x30(%rbp), %rdi
callq 0x17a3c
jmp 0x899f
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 0x8a4e
movq (%rax), %rax
movq -0x8(%rax), %rsi
leaq 0x26428(%rip), %rdi     # 0x2ed68
callq 0x76ba
testb %al, %al
jne 0x8af0
leaq -0x30(%rbp), %rdi
callq 0x17c2c
jmp 0x899f
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 0x8a53
movq (%rax), %rax
movq -0x8(%rax), %rsi
leaq 0x2616f(%rip), %rdi     # 0x2eaf8
callq 0x76ba
testb %al, %al
jne 0x8b85
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 0x15c8d(%rip), %rsi     # 0x1e64f
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 0x15ad8(%rip), %rsi     # 0x1e4dd
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 0x2505d(%rip), %rsi     # 0x2da88
leaq 0xf2e8(%rip), %rdx      # 0x17d1a
movq %r14, %rdi
callq 0x63c0
jmp 0x8bcc
callq 0x6220
callq 0x6220
callq 0x6220
callq 0x6220
callq 0x6220
pushq $0x20
popq %rdi
callq 0x60f0
movq %rax, %r14
leaq 0x15ba6(%rip), %rsi     # 0x1e610
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 0x24ff8(%rip), %rsi     # 0x2da88
leaq 0xf283(%rip), %rdx      # 0x17d1a
movq %r14, %rdi
callq 0x63c0
jmp 0x8bcc
pushq $0x20
popq %rdi
callq 0x60f0
movq %rax, %r14
leaq 0x15ada(%rip), %rsi     # 0x1e590
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 0x24fac(%rip), %rsi     # 0x2da88
leaq 0xf237(%rip), %rdx      # 0x17d1a
movq %r14, %rdi
callq 0x63c0
jmp 0x8bcc
pushq $0x20
popq %rdi
callq 0x60f0
movq %rax, %r14
leaq 0x15acd(%rip), %rsi     # 0x1e5cf
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 0x24f60(%rip), %rsi     # 0x2da88
leaq 0xf1eb(%rip), %rdx      # 0x17d1a
movq %r14, %rdi
callq 0x63c0
jmp 0x8bcc
pushq $0x20
popq %rdi
callq 0x60f0
movq %rax, %r14
leaq 0x15a06(%rip), %rsi     # 0x1e554
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 0x24f14(%rip), %rsi     # 0x2da88
leaq 0xf19f(%rip), %rdx      # 0x17d1a
movq %r14, %rdi
callq 0x63c0
jmp 0x8bcc
pushq $0x20
popq %rdi
callq 0x60f0
movq %rax, %r14
leaq 0x1597e(%rip), %rsi     # 0x1e515
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 0x24ecb(%rip), %rsi     # 0x2da88
leaq 0xf156(%rip), %rdx      # 0x17d1a
movq %r14, %rdi
callq 0x63c0
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x60d0
testb %r15b, %r15b
jne 0x8bfb
jmp 0x8c75
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x60d0
testb %r15b, %r15b
jne 0x8c08
jmp 0x8c83
movq %rax, %rbx
movq %r14, %rdi
callq 0x6150
jmp 0x8c75
movq %rax, %rbx
movq %r14, %rdi
callq 0x6150
jmp 0x8c83
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x60d0
testb %r15b, %r15b
jne 0x8c28
jmp 0x8c91
movq %rax, %rbx
movq %r14, %rdi
callq 0x6150
jmp 0x8c91
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x60d0
testb %r15b, %r15b
jne 0x8c48
jmp 0x8c9f
movq %rax, %rbx
movq %r14, %rdi
callq 0x6150
jmp 0x8c9f
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x60d0
testb %r15b, %r15b
jne 0x8c68
jmp 0x8cad
movq %rax, %rbx
movq %r14, %rdi
callq 0x6150
jmp 0x8cad
movq %rax, %rbx
leaq -0x30(%rbp), %rdi
callq 0x175d0
jmp 0x8ce9
movq %rax, %rbx
leaq -0x30(%rbp), %rdi
callq 0x17802
jmp 0x8ce9
movq %rax, %rbx
leaq -0x30(%rbp), %rdi
callq 0x17c2c
jmp 0x8ce9
movq %rax, %rbx
leaq -0x30(%rbp), %rdi
callq 0x17a3c
jmp 0x8ce9
movq %rax, %rbx
leaq -0x30(%rbp), %rdi
callq 0x17070
jmp 0x8ce9
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x60d0
testb %r15b, %r15b
jne 0x8cce
jmp 0x8ce9
movq %rax, %rbx
movq %r14, %rdi
callq 0x6150
jmp 0x8ce9
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x60d0
jmp 0x8ce9
movq %rax, %rbx
movq %rbx, %rdi
callq 0x63f0
nop