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

	
	// actual or-operation
	stack->fStore[stack->fSP - 1]->ori(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("or");

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x38, %rsp
cmpl $0x0, 0xb4(%rsi)
jle 0x12ee5
movq %rsi, %rbx
leaq -0x50(%rbp), %rdi
xorl %esi, %esi
callq 0x17a18
movslq 0xb4(%rbx), %rax
movq 0x18(%rbx), %rcx
movq (%rcx,%rax,8), %rax
testq %rax, %rax
je 0x12ee0
movq (%rax), %rax
movq -0x8(%rax), %rsi
leaq 0x1be98(%rip), %rdi     # 0x2ec98
callq 0x76ba
testb %al, %al
jne 0x12f31
movslq 0xb4(%rbx), %rax
movq 0x18(%rbx), %rcx
movq -0x8(%rcx,%rax,8), %rax
testq %rax, %rax
je 0x12ee0
movq (%rax), %rax
movq -0x8(%rax), %rsi
leaq 0x1be64(%rip), %rdi     # 0x2ec98
callq 0x76ba
testb %al, %al
jne 0x12f7a
movslq 0xb4(%rbx), %rax
movq 0x18(%rbx), %rcx
movq -0x8(%rcx,%rax,8), %rdi
movq (%rcx,%rax,8), %rsi
movq (%rdi), %rax
callq *0x38(%rax)
movslq 0xb4(%rbx), %rax
movq 0x18(%rbx), %rcx
movq (%rcx,%rax,8), %r14
testq %r14, %r14
je 0x12e77
movq %r14, %rdi
callq 0x17248
pushq $0x8
popq %rsi
movq %r14, %rdi
callq 0x61e0
movslq 0xb4(%rbx), %rax
movq 0x18(%rbx), %rcx
andq $0x0, (%rcx,%rax,8)
addq $-0x8, 0x20(%rbx)
decl %eax
movl %eax, 0xb4(%rbx)
leaq 0xebc0(%rip), %rsi      # 0x21a66
leaq -0x40(%rbp), %rdi
leaq -0x19(%rbp), %rdx
callq 0x72a6
addq $0x78, %rbx
leaq -0x40(%rbp), %rsi
movq %rbx, %rdi
callq 0x1925e
leaq -0x40(%rbp), %rdi
callq 0x60d0
leaq -0x50(%rbp), %rdi
callq 0x17a3c
addq $0x38, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
callq 0x6220
pushq $0x20
popq %rdi
callq 0x60f0
movq %rax, %r14
leaq 0xd776(%rip), %rsi      # 0x2066d
leaq -0x40(%rbp), %rdi
leaq -0x50(%rbp), %rdx
callq 0x72a6
movb $0x1, %r15b
leaq -0x40(%rbp), %rsi
movq %r14, %rdi
callq 0x17d10
xorl %r15d, %r15d
leaq 0x1ab6b(%rip), %rsi     # 0x2da88
leaq 0x4df6(%rip), %rdx      # 0x17d1a
movq %r14, %rdi
callq 0x63c0
jmp 0x12fc1
pushq $0x20
popq %rdi
callq 0x60f0
movq %rax, %r14
leaq 0xd762(%rip), %rsi      # 0x206a5
leaq -0x40(%rbp), %rdi
leaq -0x19(%rbp), %rdx
callq 0x72a6
movb $0x1, %r15b
leaq -0x40(%rbp), %rsi
movq %r14, %rdi
callq 0x17d10
xorl %r15d, %r15d
leaq 0x1ab1f(%rip), %rsi     # 0x2da88
leaq 0x4daa(%rip), %rdx      # 0x17d1a
movq %r14, %rdi
callq 0x63c0
jmp 0x12fc1
pushq $0x20
popq %rdi
callq 0x60f0
movq %rax, %r14
leaq 0xd757(%rip), %rsi      # 0x206e3
leaq -0x40(%rbp), %rdi
leaq -0x19(%rbp), %rdx
callq 0x72a6
movb $0x1, %r15b
leaq -0x40(%rbp), %rsi
movq %r14, %rdi
callq 0x17d10
xorl %r15d, %r15d
leaq 0x1aad6(%rip), %rsi     # 0x2da88
leaq 0x4d61(%rip), %rdx      # 0x17d1a
movq %r14, %rdi
callq 0x63c0
jmp 0x12fc5
jmp 0x12fd8
movq %rax, %rbx
leaq -0x40(%rbp), %rdi
callq 0x60d0
testb %r15b, %r15b
jne 0x12fdb
jmp 0x13018
movq %rax, %rbx
movq %r14, %rdi
callq 0x6150
jmp 0x13018
movq %rax, %rbx
leaq -0x40(%rbp), %rdi
callq 0x60d0
testb %r15b, %r15b
jne 0x12ffb
jmp 0x13021
movq %rax, %rbx
movq %r14, %rdi
callq 0x6150
jmp 0x13021
movq %rax, %rbx
leaq -0x40(%rbp), %rdi
callq 0x60d0
jmp 0x13018
jmp 0x13015
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x17a3c
movq %rbx, %rdi
callq 0x63f0
nop