// File: /workspace/github_cpp_makefile_star2_O3/zerolfx[P]P-Machine/neg.cpp
// Function: Neg::execute(StackMachine*)
void Neg::execute(StackMachine *stack) 
{
	// check if the stack contains at least one entry
	if(stack->fSP < 0)
		throw ExecutionError("instruction neg: 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 add: 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 add: SP does not point to element of type real.");
				
			break;
		}
	}
	
	// actual operation
	stack->fStore[stack->fSP]->neg();
	
	// adding cost of this instruction
	stack->fTime.count("neg");
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x30, %rsp
cmpl $0x0, 0xb4(%rsi)
js 0x13c56
movq %rsi, %rbx
movl 0x8(%rdi), %eax
testl %eax, %eax
je 0x13b92
cmpl $0x1, %eax
jne 0x13bf0
leaq -0x50(%rbp), %rdi
xorl %esi, %esi
callq 0x1a9d4
movslq 0xb4(%rbx), %rax
movq 0x18(%rbx), %rcx
movq (%rcx,%rax,8), %rax
testq %rax, %rax
je 0x13d59
movq (%rax), %rax
movq -0x8(%rax), %rax
leaq 0x1ff94(%rip), %rcx     # 0x33af8
movq 0x8(%rcx), %rdi
movq 0x8(%rax), %rsi
cmpq %rsi, %rdi
je 0x13b87
cmpb $0x2a, (%rdi)
je 0x13caf
callq 0x6310
testl %eax, %eax
jne 0x13caf
leaq -0x50(%rbp), %rdi
callq 0x1a9f8
jmp 0x13bf0
leaq -0x50(%rbp), %rdi
xorps %xmm0, %xmm0
callq 0x1abfc
movslq 0xb4(%rbx), %rax
movq 0x18(%rbx), %rcx
movq (%rcx,%rax,8), %rax
testq %rax, %rax
je 0x13d5e
movq (%rax), %rax
movq -0x8(%rax), %rax
leaq 0x20004(%rip), %rcx     # 0x33bc8
movq 0x8(%rcx), %rdi
movq 0x8(%rax), %rsi
cmpq %rsi, %rdi
je 0x13be7
cmpb $0x2a, (%rdi)
je 0x13d05
callq 0x6310
testl %eax, %eax
jne 0x13d05
leaq -0x50(%rbp), %rdi
callq 0x1ac2a
movslq 0xb4(%rbx), %rax
movq 0x18(%rbx), %rcx
movq (%rcx,%rax,8), %rdi
movq (%rdi), %rax
callq *0x28(%rax)
leaq -0x30(%rbp), %r14
movq %r14, -0x10(%r14)
leaq 0x115d1(%rip), %rsi     # 0x251e5
leaq 0x115cd(%rip), %rdx     # 0x251e8
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 0x13c49
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 0x1153b(%rip), %rsi     # 0x251ad
leaq 0x1156b(%rip), %rdx     # 0x251e4
leaq -0x40(%rbp), %rdi
callq 0x746c
movb $0x1, %r12b
leaq -0x40(%rbp), %rsi
movq %r14, %rdi
callq 0x1b14c
xorl %r12d, %r12d
leaq 0x1eded(%rip), %rsi     # 0x32a88
leaq 0x74c8(%rip), %rdx      # 0x1b16a
movq %r14, %rdi
callq 0x63e0
jmp 0x13d59
movl $0x20, %edi
callq 0x6100
movq %rax, %r14
leaq -0x30(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0xf527(%rip), %rsi      # 0x231f2
leaq 0xf55e(%rip), %rdx      # 0x23230
leaq -0x40(%rbp), %rdi
callq 0x746c
movb $0x1, %r12b
leaq -0x40(%rbp), %rsi
movq %r14, %rdi
callq 0x1b14c
xorl %r12d, %r12d
leaq 0x1ed94(%rip), %rsi     # 0x32a88
leaq 0x746f(%rip), %rdx      # 0x1b16a
movq %r14, %rdi
callq 0x63e0
jmp 0x13d59
movl $0x20, %edi
callq 0x6100
movq %rax, %r14
leaq -0x30(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0xf553(%rip), %rsi      # 0x23274
leaq 0xf587(%rip), %rdx      # 0x232af
leaq -0x40(%rbp), %rdi
callq 0x746c
movb $0x1, %r12b
leaq -0x40(%rbp), %rsi
movq %r14, %rdi
callq 0x1b14c
xorl %r12d, %r12d
leaq 0x1ed3e(%rip), %rsi     # 0x32a88
leaq 0x7419(%rip), %rdx      # 0x1b16a
movq %r14, %rdi
callq 0x63e0
callq 0x6250
callq 0x6250
movq %rax, %rbx
movq -0x40(%rbp), %rdi
cmpq %r15, %rdi
je 0x13d7b
movq -0x30(%rbp), %rsi
incq %rsi
callq 0x6210
testb %r12b, %r12b
jne 0x13d85
jmp 0x13dbe
movq %rax, %rbx
movq %r14, %rdi
callq 0x6170
jmp 0x13dbe
movq %rax, %rbx
movq -0x40(%rbp), %rdi
cmpq %r15, %rdi
je 0x13da7
movq -0x30(%rbp), %rsi
incq %rsi
callq 0x6210
testb %r12b, %r12b
jne 0x13db1
jmp 0x13dcc
movq %rax, %rbx
movq %r14, %rdi
callq 0x6170
jmp 0x13dcc
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x1ac2a
jmp 0x13e20
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x1a9f8
jmp 0x13e20
movq %rax, %rbx
movq -0x40(%rbp), %rdi
cmpq %r15, %rdi
je 0x13def
movq -0x30(%rbp), %rsi
incq %rsi
callq 0x6210
testb %r12b, %r12b
jne 0x13df9
jmp 0x13e20
movq %rax, %rbx
movq %r14, %rdi
callq 0x6170
jmp 0x13e20
movq %rax, %rbx
movq -0x40(%rbp), %rdi
cmpq %r14, %rdi
je 0x13e20
movq -0x30(%rbp), %rsi
incq %rsi
callq 0x6210
jmp 0x13e20
movq %rax, %rbx
movq %rbx, %rdi
callq 0x6410