// File: 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
movq %rsp, %rbp
subq $0x1b0, %rsp            # imm = 0x1B0
movq %rsi, -0x148(%rbp)
movq %rdi, %rax
movq -0x148(%rbp), %rdi
movq %rdi, -0x140(%rbp)
movq %rax, -0x10(%rbp)
movq %rdi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq -0x20(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, -0x2c(%rbp)
movq -0x28(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, -0x30(%rbp)
leaq 0xef8b(%rip), %rsi      # 0x45029
callq 0x385c0
testb $0x1, %al
jne 0x360a9
jmp 0x36101
movl $0x10, %edi
callq 0x52a0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x150(%rbp)
movl -0x2c(%rbp), %esi
movl -0x30(%rbp), %eax
addl %eax, %esi
callq 0x37510
jmp 0x360cf
movq -0x150(%rbp), %rax
movq %rax, -0x38(%rbp)
jmp 0x3670e
movq -0x150(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
movl $0x10, %esi
callq 0x52b0
jmp 0x36723
movq -0x140(%rbp), %rdi
leaq 0xfbec(%rip), %rsi      # 0x45cfb
callq 0x385c0
testb $0x1, %al
jne 0x3611a
jmp 0x36172
movl $0x10, %edi
callq 0x52a0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x158(%rbp)
movl -0x2c(%rbp), %esi
movl -0x30(%rbp), %eax
subl %eax, %esi
callq 0x37510
jmp 0x36140
movq -0x158(%rbp), %rax
movq %rax, -0x38(%rbp)
jmp 0x3670c
movq -0x158(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
movl $0x10, %esi
callq 0x52b0
jmp 0x36723
movq -0x140(%rbp), %rdi
leaq 0xeead(%rip), %rsi      # 0x4502d
callq 0x385c0
testb $0x1, %al
jne 0x3618b
jmp 0x361e4
movl $0x10, %edi
callq 0x52a0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x160(%rbp)
movl -0x2c(%rbp), %esi
movl -0x30(%rbp), %eax
imull %eax, %esi
callq 0x37510
jmp 0x361b2
movq -0x160(%rbp), %rax
movq %rax, -0x38(%rbp)
jmp 0x3670a
movq -0x160(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
movl $0x10, %esi
callq 0x52b0
jmp 0x36723
movq -0x140(%rbp), %rdi
leaq 0xee3d(%rip), %rsi      # 0x4502f
callq 0x385c0
testb $0x1, %al
jne 0x361fd
jmp 0x3625e
cmpl $0x0, -0x30(%rbp)
je 0x3625e
movl $0x10, %edi
callq 0x52a0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x168(%rbp)
movl -0x2c(%rbp), %eax
movl -0x30(%rbp), %ecx
cltd
idivl %ecx
movl %eax, %esi
callq 0x37510
jmp 0x3622c
movq -0x168(%rbp), %rax
movq %rax, -0x38(%rbp)
jmp 0x36708
movq -0x168(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
movl $0x10, %esi
callq 0x52b0
jmp 0x36723
movq -0x140(%rbp), %rdi
leaq 0xedc5(%rip), %rsi      # 0x45031
callq 0x385c0
testb $0x1, %al
jne 0x36277
jmp 0x362d8
cmpl $0x0, -0x30(%rbp)
je 0x362d8
movl $0x10, %edi
callq 0x52a0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x170(%rbp)
movl -0x2c(%rbp), %eax
movl -0x30(%rbp), %ecx
cltd
idivl %ecx
movl %edx, %esi
callq 0x37510
jmp 0x362a6
movq -0x170(%rbp), %rax
movq %rax, -0x38(%rbp)
jmp 0x36706
movq -0x170(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
movl $0x10, %esi
callq 0x52b0
jmp 0x36723
movq -0x140(%rbp), %rdi
leaq 0xed55(%rip), %rsi      # 0x4503b
callq 0x385c0
testb $0x1, %al
jne 0x362f1
jmp 0x3632d
movl -0x2c(%rbp), %eax
cmpl -0x30(%rbp), %eax
jne 0x3630c
leaq 0x302c8(%rip), %rax     # 0x665c8
movq (%rax), %rax
movq %rax, -0x178(%rbp)
jmp 0x3631d
leaq 0x302bd(%rip), %rax     # 0x665d0
movq (%rax), %rax
movq %rax, -0x178(%rbp)
movq -0x178(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x36716
movq -0x140(%rbp), %rdi
leaq 0xed03(%rip), %rsi      # 0x4503e
callq 0x385c0
testb $0x1, %al
jne 0x36346
jmp 0x36382
movl -0x2c(%rbp), %eax
cmpl -0x30(%rbp), %eax
je 0x36361
leaq 0x30273(%rip), %rax     # 0x665c8
movq (%rax), %rax
movq %rax, -0x180(%rbp)
jmp 0x36372
leaq 0x30268(%rip), %rax     # 0x665d0
movq (%rax), %rax
movq %rax, -0x180(%rbp)
movq -0x180(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x36716
movq -0x140(%rbp), %rdi
leaq 0xeca3(%rip), %rsi      # 0x45033
callq 0x385c0
testb $0x1, %al
jne 0x3639b
jmp 0x363d7
movl -0x2c(%rbp), %eax
cmpl -0x30(%rbp), %eax
jle 0x363b6
leaq 0x3021e(%rip), %rax     # 0x665c8
movq (%rax), %rax
movq %rax, -0x188(%rbp)
jmp 0x363c7
leaq 0x30213(%rip), %rax     # 0x665d0
movq (%rax), %rax
movq %rax, -0x188(%rbp)
movq -0x188(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x36716
movq -0x140(%rbp), %rdi
leaq 0xefda(%rip), %rsi      # 0x453bf
callq 0x385c0
testb $0x1, %al
jne 0x363f0
jmp 0x3642c
movl -0x2c(%rbp), %eax
cmpl -0x30(%rbp), %eax
jge 0x3640b
leaq 0x301c9(%rip), %rax     # 0x665c8
movq (%rax), %rax
movq %rax, -0x190(%rbp)
jmp 0x3641c
leaq 0x301be(%rip), %rax     # 0x665d0
movq (%rax), %rax
movq %rax, -0x190(%rbp)
movq -0x190(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x36716
movq -0x140(%rbp), %rdi
leaq 0xebfe(%rip), %rsi      # 0x45038
callq 0x385c0
testb $0x1, %al
jne 0x36445
jmp 0x36481
movl -0x2c(%rbp), %eax
cmpl -0x30(%rbp), %eax
jl 0x36460
leaq 0x30174(%rip), %rax     # 0x665c8
movq (%rax), %rax
movq %rax, -0x198(%rbp)
jmp 0x36471
leaq 0x30169(%rip), %rax     # 0x665d0
movq (%rax), %rax
movq %rax, -0x198(%rbp)
movq -0x198(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x36716
movq -0x140(%rbp), %rdi
leaq 0xeba6(%rip), %rsi      # 0x45035
callq 0x385c0
testb $0x1, %al
jne 0x3649a
jmp 0x364d6
movl -0x2c(%rbp), %eax
cmpl -0x30(%rbp), %eax
jg 0x364b5
leaq 0x3011f(%rip), %rax     # 0x665c8
movq (%rax), %rax
movq %rax, -0x1a0(%rbp)
jmp 0x364c6
leaq 0x30114(%rip), %rax     # 0x665d0
movq (%rax), %rax
movq %rax, -0x1a0(%rbp)
movq -0x1a0(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x36716
movl $0x28, %edi
callq 0x52a0
movq %rax, -0x1a8(%rbp)
movb $0x1, -0x131(%rbp)
movq -0x20(%rbp), %rsi
movq (%rsi), %rax
movq (%rax), %rax
leaq -0x110(%rbp), %rdi
callq *%rax
jmp 0x36503
leaq 0xf80c(%rip), %rsi      # 0x45d16
leaq -0xf0(%rbp), %rdi
leaq -0x110(%rbp), %rdx
callq 0x1bde0
jmp 0x3651f
leaq 0xee50(%rip), %rdx      # 0x45376
leaq -0xd0(%rbp), %rdi
leaq -0xf0(%rbp), %rsi
callq 0x1bb10
jmp 0x3653b
movq -0x140(%rbp), %rdx
leaq -0xb0(%rbp), %rdi
leaq -0xd0(%rbp), %rsi
callq 0x1bd90
jmp 0x36557
leaq 0xee18(%rip), %rdx      # 0x45376
leaq -0x90(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
callq 0x1bb10
jmp 0x36573
movq -0x28(%rbp), %rsi
movq (%rsi), %rax
movq (%rax), %rax
leaq -0x130(%rbp), %rdi
callq *%rax
jmp 0x36588
leaq -0x70(%rbp), %rdi
leaq -0x90(%rbp), %rsi
leaq -0x130(%rbp), %rdx
callq 0x1bb80
jmp 0x365a1
movq -0x1a8(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x2b980
jmp 0x365b3
movb $0x0, -0x131(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x5518
leaq -0x130(%rbp), %rdi
callq 0x5518
leaq -0x90(%rbp), %rdi
callq 0x5518
leaq -0xb0(%rbp), %rdi
callq 0x5518
leaq -0xd0(%rbp), %rdi
callq 0x5518
leaq -0xf0(%rbp), %rdi
callq 0x5518
leaq -0x110(%rbp), %rdi
callq 0x5518
movq -0x1a8(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x36716
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x366e8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x366dc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x366d0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x366c4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x366b8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x366ac
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x366a0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x5518
leaq -0x130(%rbp), %rdi
callq 0x5518
leaq -0x90(%rbp), %rdi
callq 0x5518
leaq -0xb0(%rbp), %rdi
callq 0x5518
leaq -0xd0(%rbp), %rdi
callq 0x5518
leaq -0xf0(%rbp), %rdi
callq 0x5518
leaq -0x110(%rbp), %rdi
callq 0x5518
testb $0x1, -0x131(%rbp)
jne 0x366f3
jmp 0x36704
movq -0x1a8(%rbp), %rdi
movl $0x28, %esi
callq 0x52b0
jmp 0x36723
jmp 0x36708
jmp 0x3670a
jmp 0x3670c
jmp 0x3670e
movq -0x38(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x1b0, %rsp            # imm = 0x1B0
popq %rbp
retq
movq -0x40(%rbp), %rdi
callq 0x5490
nopl (%rax)