// File: iamlouk[P]asbi/src/parser.cc
// Function: asbi::Parser::parse_cmp()
ast::Node* Parser::parse_cmp() {
	auto left = parse_addsub();
	auto t = tokenizer.peek().type;
	while (t == tok::Equals || t == tok::EqualsNot || t == tok::Smaller || t == tok::Bigger || t == tok::SmallerOrEqual || t == tok::BiggerOrEqual) {
		tokenizer.next();
		auto right = parse_addsub();
		if (t == tok::Equals)
			left = new ast::InfixOperator(ast::InfixOperator::Equals,    left, right);
		else if (t == tok::EqualsNot)
			left = new ast::InfixOperator(ast::InfixOperator::EqualsNot, left, right);
		else if (t == tok::Smaller)
			left = new ast::InfixOperator(ast::InfixOperator::Smaller,   left, right);
		else if (t == tok::Bigger)
			left = new ast::InfixOperator(ast::InfixOperator::Bigger,    left, right);
		else if (t == tok::SmallerOrEqual)
			left = new ast::InfixOperator(ast::InfixOperator::SmallerOrEqual, left, right);
		else if (t == tok::BiggerOrEqual)
			left = new ast::InfixOperator(ast::InfixOperator::BiggerOrEqual,  left, right);
		t = tokenizer.peek().type;
	}
	return left;
}

// Assembly:
subq $0xa8, %rsp
movq %rdi, 0xa0(%rsp)
movq 0xa0(%rsp), %rdi
movq %rdi, 0x40(%rsp)
callq 0xf7f0
movq 0x40(%rsp), %rdi
movq %rax, 0x98(%rsp)
callq 0x92b0
movq %rax, 0x80(%rsp)
movq %rdx, 0x88(%rsp)
movl 0x80(%rsp), %eax
movl %eax, 0x94(%rsp)
movb $0x1, %al
cmpl $0xe, 0x94(%rsp)
movb %al, 0x3f(%rsp)
je 0xf4f0
movb $0x1, %al
cmpl $0xf, 0x94(%rsp)
movb %al, 0x3f(%rsp)
je 0xf4f0
movb $0x1, %al
cmpl $0x10, 0x94(%rsp)
movb %al, 0x3f(%rsp)
je 0xf4f0
movb $0x1, %al
cmpl $0x11, 0x94(%rsp)
movb %al, 0x3f(%rsp)
je 0xf4f0
movb $0x1, %al
cmpl $0x12, 0x94(%rsp)
movb %al, 0x3f(%rsp)
je 0xf4f0
cmpl $0x13, 0x94(%rsp)
sete %al
movb %al, 0x3f(%rsp)
movb 0x3f(%rsp), %al
testb $0x1, %al
jne 0xf4fd
jmp 0xf7d0
movq 0x40(%rsp), %rdi
callq 0x9340
movq 0x40(%rsp), %rdi
movq %rax, 0x70(%rsp)
movq %rdx, 0x78(%rsp)
callq 0xf7f0
movq %rax, 0x68(%rsp)
cmpl $0xe, 0x94(%rsp)
jne 0xf58c
movl $0x20, %edi
callq 0x6460
movq %rax, %rdi
movq %rdi, %rax
movq %rax, 0x30(%rsp)
movq 0x98(%rsp), %rdx
movq 0x68(%rsp), %rcx
movl $0x6, %esi
callq 0x122f0
jmp 0xf558
movq 0x30(%rsp), %rax
movq %rax, 0x98(%rsp)
jmp 0xf7ac
movq 0x30(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x60(%rsp)
movl %eax, 0x5c(%rsp)
movl $0x20, %esi
callq 0x6470
jmp 0xf7e0
cmpl $0xf, 0x94(%rsp)
jne 0xf5f8
movl $0x20, %edi
callq 0x6460
movq %rax, %rdi
movq %rdi, %rax
movq %rax, 0x28(%rsp)
movq 0x98(%rsp), %rdx
movq 0x68(%rsp), %rcx
movl $0x7, %esi
callq 0x122f0
jmp 0xf5c4
movq 0x28(%rsp), %rax
movq %rax, 0x98(%rsp)
jmp 0xf7aa
movq 0x28(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x60(%rsp)
movl %eax, 0x5c(%rsp)
movl $0x20, %esi
callq 0x6470
jmp 0xf7e0
cmpl $0x10, 0x94(%rsp)
jne 0xf664
movl $0x20, %edi
callq 0x6460
movq %rax, %rdi
movq %rdi, %rax
movq %rax, 0x20(%rsp)
movq 0x98(%rsp), %rdx
movq 0x68(%rsp), %rcx
movl $0xa, %esi
callq 0x122f0
jmp 0xf630
movq 0x20(%rsp), %rax
movq %rax, 0x98(%rsp)
jmp 0xf7a8
movq 0x20(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x60(%rsp)
movl %eax, 0x5c(%rsp)
movl $0x20, %esi
callq 0x6470
jmp 0xf7e0
cmpl $0x11, 0x94(%rsp)
jne 0xf6d0
movl $0x20, %edi
callq 0x6460
movq %rax, %rdi
movq %rdi, %rax
movq %rax, 0x18(%rsp)
movq 0x98(%rsp), %rdx
movq 0x68(%rsp), %rcx
movl $0x8, %esi
callq 0x122f0
jmp 0xf69c
movq 0x18(%rsp), %rax
movq %rax, 0x98(%rsp)
jmp 0xf7a6
movq 0x18(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x60(%rsp)
movl %eax, 0x5c(%rsp)
movl $0x20, %esi
callq 0x6470
jmp 0xf7e0
cmpl $0x12, 0x94(%rsp)
jne 0xf73c
movl $0x20, %edi
callq 0x6460
movq %rax, %rdi
movq %rdi, %rax
movq %rax, 0x10(%rsp)
movq 0x98(%rsp), %rdx
movq 0x68(%rsp), %rcx
movl $0xb, %esi
callq 0x122f0
jmp 0xf708
movq 0x10(%rsp), %rax
movq %rax, 0x98(%rsp)
jmp 0xf7a4
movq 0x10(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x60(%rsp)
movl %eax, 0x5c(%rsp)
movl $0x20, %esi
callq 0x6470
jmp 0xf7e0
cmpl $0x13, 0x94(%rsp)
jne 0xf7a2
movl $0x20, %edi
callq 0x6460
movq %rax, %rdi
movq %rdi, %rax
movq %rax, 0x8(%rsp)
movq 0x98(%rsp), %rdx
movq 0x68(%rsp), %rcx
movl $0x9, %esi
callq 0x122f0
jmp 0xf774
movq 0x8(%rsp), %rax
movq %rax, 0x98(%rsp)
jmp 0xf7a2
movq 0x8(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x60(%rsp)
movl %eax, 0x5c(%rsp)
movl $0x20, %esi
callq 0x6470
jmp 0xf7e0
jmp 0xf7a4
jmp 0xf7a6
jmp 0xf7a8
jmp 0xf7aa
jmp 0xf7ac
movq 0x40(%rsp), %rdi
callq 0x92b0
movq %rax, 0x48(%rsp)
movq %rdx, 0x50(%rsp)
movl 0x48(%rsp), %eax
movl %eax, 0x94(%rsp)
jmp 0xf491
movq 0x98(%rsp), %rax
addq $0xa8, %rsp
retq
movq 0x60(%rsp), %rdi
callq 0x67a0
nopw (%rax,%rax)