// File: zerolfx[P]P-Machine/not.cpp
// Function: Not::execute(StackMachine*)
void Not::execute(StackMachine *stack) 
{
	// check if the stack contains at least one entry
	if(stack->fSP < 0)
		throw ExecutionError("instruction not: requires 1 stackelement to be present.");
		
	StackBoolean p1;
	
	if(typeid(p1) != typeid(*(stack->fStore[stack->fSP])))
		throw ExecutionError("instruction not: SP does not point to element of type boolean.");

	
	// actual not-operation
	stack->fStore[stack->fSP]->noti();
	
	// adding cost of this instruction
	stack->fTime.count("not");

	
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xe0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
cmpl $0x0, 0xb4(%rax)
jge 0x1ea2c
movb $0x1, -0x45(%rbp)
movl $0x20, %edi
callq 0x7110
movq %rax, -0xb8(%rbp)
leaq -0x31(%rbp), %rdi
movq %rdi, -0xb0(%rbp)
callq 0x74f0
movq -0xb0(%rbp), %rdx
leaq 0x1ac46(%rip), %rsi     # 0x395ed
leaq -0x30(%rbp), %rdi
callq 0x8940
jmp 0x1e9b2
movq -0xb8(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x283d0
jmp 0x1e9c4
movq -0xb8(%rbp), %rdi
movb $0x0, -0x45(%rbp)
leaq 0x2b0aa(%rip), %rsi     # 0x49a80
leaq 0x9a23(%rip), %rdx      # 0x28400
callq 0x74a0
jmp 0x1ec38
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x1ea0a
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 0x1ea1b
jmp 0x1ea27
movq -0xb8(%rbp), %rdi
callq 0x71c0
jmp 0x1ec2f
leaq -0x58(%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, -0xc0(%rbp)
cmpq $0x0, %rax
jne 0x1ea66
callq 0x7300
jmp 0x1ea66
movq -0xc0(%rbp), %rax
movq (%rax), %rax
movq -0x8(%rax), %rsi
leaq 0x2c215(%rip), %rdi     # 0x4ac90
callq 0x9370
testb $0x1, %al
jne 0x1ea89
jmp 0x1eb52
movb $0x1, -0x7a(%rbp)
movl $0x20, %edi
callq 0x7110
movq %rax, -0xd0(%rbp)
leaq -0x79(%rbp), %rdi
movq %rdi, -0xc8(%rbp)
callq 0x74f0
movq -0xc8(%rbp), %rdx
leaq 0x1ab69(%rip), %rsi     # 0x39625
leaq -0x78(%rbp), %rdi
callq 0x8940
jmp 0x1eac7
movq -0xd0(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0x283d0
jmp 0x1ead9
movq -0xd0(%rbp), %rdi
movb $0x0, -0x7a(%rbp)
leaq 0x2af95(%rip), %rsi     # 0x49a80
leaq 0x990e(%rip), %rdx      # 0x28400
callq 0x74a0
jmp 0x1ec38
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x1ec26
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x1eb30
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 0x1eb41
jmp 0x1eb4d
movq -0xd0(%rbp), %rdi
callq 0x71c0
jmp 0x1ec26
movq -0x10(%rbp), %rax
movq %rax, %rdi
addq $0x18, %rdi
movslq 0xb4(%rax), %rsi
callq 0x8e70
movq (%rax), %rdi
movq (%rdi), %rax
movq 0x48(%rax), %rax
callq *%rax
jmp 0x1eb77
movq -0x10(%rbp), %rax
addq $0x78, %rax
movq %rax, -0xe0(%rbp)
leaq -0xa1(%rbp), %rdi
movq %rdi, -0xd8(%rbp)
callq 0x74f0
movq -0xd8(%rbp), %rdx
leaq 0x1aabd(%rip), %rsi     # 0x39664
leaq -0xa0(%rbp), %rdi
callq 0x8940
jmp 0x1ebb5
movq -0xe0(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x2c4d0
jmp 0x1ebca
leaq -0xa0(%rbp), %rdi
callq 0x7170
leaq -0xa1(%rbp), %rdi
callq 0x72e0
leaq -0x58(%rbp), %rdi
callq 0x27d70
addq $0xe0, %rsp
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x1ec1a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0xa0(%rbp), %rdi
callq 0x7170
leaq -0xa1(%rbp), %rdi
callq 0x72e0
leaq -0x58(%rbp), %rdi
callq 0x27d70
movq -0x40(%rbp), %rdi
callq 0x74e0
nopl (%rax,%rax)