// File: /workspace/github_cpp_makefile_star2_O2/pranavmodx[P]modlang/src/evaluator.cpp
// Function: Evaluator::evalIntegerInfixExpression(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, Object*, Object*)
Object *Evaluator::evalIntegerInfixExpression(std::string operand, Object *left, Object *right)
{
	int leftVal = ((Integer *)left)->value;
	int rightVal = ((Integer *)right)->value;

	Object *res;

	if (operand == "+")
		res = new Integer(leftVal + rightVal);
	else if (operand == "-")
		res = new Integer(leftVal - rightVal);
	else if (operand == "*")
		res = new Integer(leftVal * rightVal);
	else if (operand == "/" && rightVal != 0)
		res = new Integer(leftVal / rightVal);
	else if (operand == "%" && rightVal != 0)
		res = new Integer(leftVal % rightVal);

	else if (operand == "==")
		return leftVal == rightVal ? __TRUE : __FALSE;
	else if (operand == "!=")
		return leftVal != rightVal ? __TRUE : __FALSE;
	else if (operand == ">")
		return leftVal > rightVal ? __TRUE : __FALSE;
	else if (operand == "<")
		return leftVal < rightVal ? __TRUE : __FALSE;
	else if (operand == ">=")
		return leftVal >= rightVal ? __TRUE : __FALSE;
	else if (operand == "<=")
		return leftVal <= rightVal ? __TRUE : __FALSE;

	else
	{
		Object *error = new Error("error: unknown operator -> " + left->type() + " " + operand + " " + right->type());
		return error;
	}

	return res;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xe8, %rsp
movq %rcx, %r14
movq %rdx, %r12
movq %rsi, %r15
movl 0x8(%rdx), %ebp
movl 0x8(%rcx), %r13d
leaq 0x4263(%rip), %rsi      # 0x1c025
movq %r15, %rdi
callq 0x18aa7
testb %al, %al
je 0x17dec
pushq $0x10
popq %rdi
callq 0x51d0
movq %rax, %rbx
addl %ebp, %r13d
leaq 0x11ce5(%rip), %rax     # 0x29ac8
movq %rax, (%rbx)
movl %r13d, 0x8(%rbx)
jmp 0x17e1a
leaq 0x4d88(%rip), %rsi      # 0x1cb7b
movq %r15, %rdi
callq 0x18aa7
testb %al, %al
je 0x17e2f
pushq $0x10
popq %rdi
callq 0x51d0
movq %rax, %rbx
subl %r13d, %ebp
leaq 0x11cb4(%rip), %rax     # 0x29ac8
movq %rax, (%rbx)
movl %ebp, 0x8(%rbx)
movq %rbx, %rax
addq $0xe8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x41f3(%rip), %rsi      # 0x1c029
movq %r15, %rdi
callq 0x18aa7
testb %al, %al
je 0x17e53
pushq $0x10
popq %rdi
callq 0x51d0
movq %rax, %rbx
imull %ebp, %r13d
jmp 0x17ddc
leaq 0x41d1(%rip), %rsi      # 0x1c02b
movq %r15, %rdi
callq 0x18aa7
testl %r13d, %r13d
setne %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x17e8f
pushq $0x10
popq %rdi
callq 0x51d0
movq %rax, %rbx
movl %ebp, %eax
cltd
idivl %r13d
leaq 0x11c41(%rip), %rcx     # 0x29ac8
movq %rcx, (%rbx)
movl %eax, 0x8(%rbx)
jmp 0x17e1a
testl %r13d, %r13d
setne %bl
leaq 0x4191(%rip), %rsi      # 0x1c02d
movq %r15, %rdi
callq 0x18aa7
andb %bl, %al
cmpb $0x1, %al
jne 0x17ecd
pushq $0x10
popq %rdi
callq 0x51d0
movq %rax, %rbx
movl %ebp, %eax
cltd
idivl %r13d
leaq 0x11c06(%rip), %rax     # 0x29ac8
movq %rax, (%rbx)
movl %edx, 0x8(%rbx)
jmp 0x17e1a
leaq 0x4163(%rip), %rsi      # 0x1c037
movq %r15, %rdi
callq 0x18aa7
testb %al, %al
je 0x17eee
cmpl %r13d, %ebp
jne 0x17f06
leaq 0x14614(%rip), %rax     # 0x2c500
jmp 0x17f0d
leaq 0x4145(%rip), %rsi      # 0x1c03a
movq %r15, %rdi
callq 0x18aa7
testb %al, %al
je 0x17f15
cmpl %r13d, %ebp
jne 0x17ee5
leaq 0x145fb(%rip), %rax     # 0x2c508
movq (%rax), %rbx
jmp 0x17e1a
leaq 0x4113(%rip), %rsi      # 0x1c02f
movq %r15, %rdi
callq 0x18aa7
testb %al, %al
je 0x17f2f
cmpl %r13d, %ebp
jg 0x17ee5
jmp 0x17f06
leaq 0x4305(%rip), %rsi      # 0x1c23b
movq %r15, %rdi
callq 0x18aa7
testb %al, %al
je 0x17f49
cmpl %r13d, %ebp
jl 0x17ee5
jmp 0x17f06
leaq 0x40e4(%rip), %rsi      # 0x1c034
movq %r15, %rdi
callq 0x18aa7
testb %al, %al
je 0x17f63
cmpl %r13d, %ebp
jge 0x17ee5
jmp 0x17f06
leaq 0x40c7(%rip), %rsi      # 0x1c031
movq %r15, %rdi
callq 0x18aa7
testb %al, %al
je 0x17f81
cmpl %r13d, %ebp
jle 0x17ee5
jmp 0x17f06
pushq $0x28
popq %rdi
callq 0x51d0
movq %rax, %rbx
movq (%r12), %rax
leaq 0x28(%rsp), %rdi
movq %r12, %rsi
callq *(%rax)
leaq 0x4bf5(%rip), %rsi      # 0x1cb96
leaq 0x48(%rsp), %rdi
leaq 0x28(%rsp), %rdx
callq 0xd257
leaq 0x423b(%rip), %rdx      # 0x1c1f2
leaq 0x68(%rsp), %rdi
leaq 0x48(%rsp), %rsi
callq 0xd12a
leaq 0x88(%rsp), %rdi
leaq 0x68(%rsp), %rsi
movq %r15, %rdx
callq 0xd238
leaq 0x4210(%rip), %rdx      # 0x1c1f2
leaq 0xa8(%rsp), %rdi
leaq 0x88(%rsp), %rsi
callq 0xd12a
movq (%r14), %rax
leaq 0x8(%rsp), %rdi
movq %r14, %rsi
callq *(%rax)
leaq 0xc8(%rsp), %rdi
leaq 0xa8(%rsp), %rsi
leaq 0x8(%rsp), %rdx
callq 0xd149
leaq 0xc8(%rsp), %rsi
movq %rbx, %rdi
callq 0x12cc2
leaq 0xc8(%rsp), %rdi
callq 0x5388
leaq 0x8(%rsp), %rdi
callq 0x5388
leaq 0xa8(%rsp), %rdi
callq 0x5388
leaq 0x88(%rsp), %rdi
callq 0x5388
leaq 0x68(%rsp), %rdi
callq 0x5388
leaq 0x48(%rsp), %rdi
callq 0x5388
leaq 0x28(%rsp), %rdi
callq 0x5388
jmp 0x17e1a
movq %rax, %r14
leaq 0xc8(%rsp), %rdi
callq 0x5388
jmp 0x18097
movq %rax, %r14
leaq 0x8(%rsp), %rdi
callq 0x5388
jmp 0x180a6
movq %rax, %r14
leaq 0xa8(%rsp), %rdi
callq 0x5388
jmp 0x180b8
movq %rax, %r14
leaq 0x88(%rsp), %rdi
callq 0x5388
jmp 0x180ca
movq %rax, %r14
leaq 0x68(%rsp), %rdi
callq 0x5388
leaq 0x48(%rsp), %rdi
callq 0x5388
leaq 0x28(%rsp), %rdi
callq 0x5388
pushq $0x28
popq %rsi
movq %rbx, %rdi
callq 0x51e0
movq %r14, %rdi
callq 0x5330
movq %rax, %r14
jmp 0x180d4
movq %rax, %r14
jmp 0x180de
movq %rax, %r14
jmp 0x180e8