// File: /workspace/github_cpp_makefile_star2_O1/zerolfx[P]P-Machine/xor.cpp
// Function: Xor::execute(StackMachine*)
void Xor::execute(StackMachine *stack)
{
    // check if the stack contains at least two entries
    if(stack->fSP < 1)
        throw ExecutionError("instruction xor: requires 2 stackelements to be present.");

    StackBoolean p1;

    if(typeid(p1) != typeid(*(stack->fStore[stack->fSP])))
        throw ExecutionError("instruction xor: SP does not point to element of type boolean.");
    if(typeid(p1) != typeid(*(stack->fStore[stack->fSP - 1])))
        throw ExecutionError("instruction xor: SP - 1 does not point to element of type boolean.");


    // actual xor-operation
    stack->fStore[stack->fSP - 1]->xori(stack->fStore[stack->fSP]);

    // SP := SP - 1
    delete stack->fStore[stack->fSP];
    stack->fStore[stack->fSP] = 0;
    stack->fStore.pop_back();
    --stack->fSP;

    // adding cost of this instruction
    stack->fTime.count("xor");
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
cmpl $0x0, 0xb4(%rsi)
jle 0x7b6c
movq %rsi, %rbx
leaq -0x58(%rbp), %rdi
xorl %esi, %esi
callq 0x1b10c
movslq 0xb4(%rbx), %r12
movq 0x18(%rbx), %r13
movq (%r13,%r12,8), %r14
testq %r14, %r14
je 0x7ab6
movq (%r14), %rax
movq -0x8(%rax), %rax
leaq 0x2c2f1(%rip), %rcx     # 0x33c98
movq 0x8(%rcx), %r15
movq 0x8(%rax), %rsi
cmpq %rsi, %r15
je 0x79ce
cmpb $0x2a, (%r15)
je 0x7abb
movq %r15, %rdi
callq 0x6310
testl %eax, %eax
jne 0x7abb
movq -0x8(%r13,%r12,8), %r12
testq %r12, %r12
je 0x7ab6
movq (%r12), %r13
movq -0x8(%r13), %rax
movq 0x8(%rax), %rsi
cmpq %rsi, %r15
je 0x7a07
cmpb $0x2a, (%r15)
je 0x7b15
movq %r15, %rdi
callq 0x6310
testl %eax, %eax
jne 0x7b15
movq %r12, %rdi
movq %r14, %rsi
callq *0x40(%r13)
movslq 0xb4(%rbx), %rax
movq 0x18(%rbx), %rcx
movq (%rcx,%rax,8), %r14
testq %r14, %r14
je 0x7a3a
movq %r14, %rdi
callq 0x1a5cc
movl $0x8, %esi
movq %r14, %rdi
callq 0x6210
movslq 0xb4(%rbx), %rax
movq 0x18(%rbx), %rcx
movq $0x0, (%rcx,%rax,8)
addq $-0x8, 0x20(%rbx)
decl %eax
movl %eax, 0xb4(%rbx)
leaq -0x38(%rbp), %r14
movq %r14, -0x10(%r14)
leaq 0x1b747(%rip), %rsi     # 0x231b0
leaq 0x1b743(%rip), %rdx     # 0x231b3
leaq -0x48(%rbp), %rdi
callq 0x746c
addq $0x78, %rbx
leaq -0x48(%rbp), %rsi
movq %rbx, %rdi
callq 0x1ce78
movq -0x48(%rbp), %rdi
cmpq %r14, %rdi
je 0x7a9e
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x6210
leaq -0x58(%rbp), %rdi
callq 0x1b130
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x6250
movl $0x20, %edi
callq 0x6100
movq %rax, %r14
leaq -0x38(%rbp), %r12
movq %r12, -0x10(%r12)
leaq 0x1b656(%rip), %rsi     # 0x2312e
leaq 0x1b68d(%rip), %rdx     # 0x2316c
leaq -0x48(%rbp), %rdi
callq 0x746c
movb $0x1, %r15b
leaq -0x48(%rbp), %rsi
movq %r14, %rdi
callq 0x1b418
xorl %r15d, %r15d
leaq 0x2af87(%rip), %rsi     # 0x32a88
leaq 0x1392e(%rip), %rdx     # 0x1b436
movq %r14, %rdi
callq 0x63e0
jmp 0x7bc1
movl $0x20, %edi
callq 0x6100
movq %rax, %r14
leaq -0x38(%rbp), %r12
movq %r12, -0x10(%r12)
leaq 0x1b63b(%rip), %rsi     # 0x2316d
leaq 0x1b676(%rip), %rdx     # 0x231af
leaq -0x48(%rbp), %rdi
callq 0x746c
movb $0x1, %r15b
leaq -0x48(%rbp), %rsi
movq %r14, %rdi
callq 0x1b418
xorl %r15d, %r15d
leaq 0x2af2d(%rip), %rsi     # 0x32a88
leaq 0x138d4(%rip), %rdx     # 0x1b436
movq %r14, %rdi
callq 0x63e0
jmp 0x7bc1
movl $0x20, %edi
callq 0x6100
movq %rax, %r14
leaq -0x38(%rbp), %r12
movq %r12, -0x10(%r12)
leaq 0x1b56c(%rip), %rsi     # 0x230f5
leaq 0x1b59d(%rip), %rdx     # 0x2312d
leaq -0x48(%rbp), %rdi
callq 0x746c
movb $0x1, %r15b
leaq -0x48(%rbp), %rsi
movq %r14, %rdi
callq 0x1b418
xorl %r15d, %r15d
leaq 0x2aed6(%rip), %rsi     # 0x32a88
leaq 0x1387d(%rip), %rdx     # 0x1b436
movq %r14, %rdi
callq 0x63e0
movq %rax, %rbx
movq -0x48(%rbp), %rdi
cmpq %r12, %rdi
je 0x7be1
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x6210
jmp 0x7be1
movq %rax, %rbx
movb $0x1, %r15b
testb %r15b, %r15b
je 0x7c4b
movq %r14, %rdi
callq 0x6170
jmp 0x7c4b
jmp 0x7bf4
jmp 0x7c0e
movq %rax, %rbx
movq -0x48(%rbp), %rdi
cmpq %r12, %rdi
je 0x7c14
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x6210
jmp 0x7c14
movq %rax, %rbx
movb $0x1, %r15b
testb %r15b, %r15b
je 0x7c42
movq %r14, %rdi
callq 0x6170
jmp 0x7c42
movq %rax, %rbx
movq -0x48(%rbp), %rdi
cmpq %r14, %rdi
je 0x7c42
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x6210
jmp 0x7c42
jmp 0x7c3f
movq %rax, %rbx
leaq -0x58(%rbp), %rdi
callq 0x1b130
movq %rbx, %rdi
callq 0x6410
nop