// File: /workspace/github_cpp_makefile_star2_O2/RuiDGPires[P]CrimLang/src/generator.cpp
// Function: gc_Tracker::comparison(crl::Node*, std::__cxx11::basic_stringstream<char, std::char_traits<char>, std::allocator<char>>&)
u32 _gc_Tracker::comparison(crl::Node *node, std::stringstream &stream){
	size_t size = node->children.size();
	size_t i = 0;

	u32 reg1 = this->basic_expression(node->get_child(i++), stream);
	std::string name1 = reg_tracker.reg_name(reg1);

	for (; i < size; i += 2){
		u32 reg2 = this->basic_expression(node->get_child(i+1), stream);
		bool is_signed = node->get_child(0)->annotation == "i32";
		if (get_token(node->get_child(i)).type == crl::Token::Type::EQL)
			stream << "XOR " << name1 << " " << reg_tracker.reg_name(reg2) << "\n" <<
				"LNOT " << name1 << "\n";
		else if (get_token(node->get_child(i)).type == crl::Token::Type::NEQ)
			stream << "XOR " << name1 << " " << reg_tracker.reg_name(reg2) << "\n";
		else if (get_token(node->get_child(i)).type == crl::Token::Type::GTR)
			stream << "GT" << std::string(is_signed ? "I": "U") << " " << name1 << " " << reg_tracker.reg_name(reg2) << "\n"; 
		else if (get_token(node->get_child(i)).type == crl::Token::Type::LEQ)
			stream << "GT" << std::string(is_signed ? "I": "U") << " " << name1 << " " << reg_tracker.reg_name(reg2) << "\n" <<
				"LNOT " << name1 << "\n";
		else if (get_token(node->get_child(i)).type == crl::Token::Type::GEQ){
			u32 reg3 = reg_tracker.alloc();
			std::string name2 = reg_tracker.reg_name(reg2);
			std::string name3 = reg_tracker.reg_name(reg3);

			stream <<
				"MOV " << name3 << " " << name1 << "\n" <<
				"GT" << std::string(is_signed ? "I": "U") << " " << name1 << " " << name2 << "\n" <<
				"XOR " << name2 << " " << name3 << "\n" <<
				"LNOT " << name2 << "\n" <<
				"LOR " << name1 << " " << name2 << "\n";
			reg_tracker.free(reg3);
		} else if (get_token(node->get_child(i)).type == crl::Token::Type::LSS){
			u32 reg3 = reg_tracker.alloc();
			std::string name2 = reg_tracker.reg_name(reg2);
			std::string name3 = reg_tracker.reg_name(reg3);

			stream <<
				"MOV " << name3 << " " << name1 << "\n" <<
				"GT" << std::string(is_signed ? "I": "U") << " " << name1 << " " << name2 << "\n" <<
				"LNOT " << name1 << "\n" <<
				"XOR " << name2 << " " << name3 << "\n" <<
				"LAND " << name1 << " " << name2 << "\n";
			reg_tracker.free(reg3);
		}

		reg_tracker.free(reg2);
	}
	return reg1; 
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd8, %rsp
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
movq (%rsi), %rax
movq 0x18(%rsi), %rcx
subq 0x10(%rsi), %rcx
sarq $0x3, %rcx
movq %rcx, -0xd8(%rbp)
movq %rsi, %rdi
xorl %esi, %esi
callq *0x18(%rax)
movq %r15, %rdi
movq %rax, %rsi
movq %rbx, %rdx
callq 0x676e
movq %r15, -0xc8(%rbp)
leaq 0x500(%r15), %rsi
leaq -0xb8(%rbp), %rdi
movq %rsi, -0x40(%rbp)
movl %eax, -0xbc(%rbp)
movl %eax, %edx
callq 0xab34
movq %rbx, -0xd0(%rbp)
leaq 0x10(%rbx), %rax
movq %rax, -0x48(%rbp)
pushq $0x1
popq %r12
cmpq -0xd8(%rbp), %r12
jae 0x733d
leal 0x1(%r12), %esi
movq (%r14), %rax
movq %r14, %rdi
callq *0x18(%rax)
movq -0xc8(%rbp), %rdi
movq %rax, %rsi
movq -0xd0(%rbp), %rdx
callq 0x676e
movl %eax, -0x2c(%rbp)
movq (%r14), %rax
movq %r14, %rdi
xorl %esi, %esi
callq *0x18(%rax)
addq $0x30, %rax
movq %rax, %rdi
leaq 0xe6f9(%rip), %rsi      # 0x152ce
callq 0x410a
movl %eax, %r13d
movq (%r14), %rax
movq %r14, %rdi
movl %r12d, %esi
callq *0x18(%rax)
leaq -0x78(%rbp), %r15
addq $0x58, %rax
movq %r15, %rdi
movq %rax, %rsi
callq 0xb24a
movl -0x58(%rbp), %ebx
movq %r15, %rdi
callq 0x135f8
cmpl $0x2f, %ebx
jne 0x6c9c
movq -0x48(%rbp), %rdi
leaq 0xe6b7(%rip), %rsi      # 0x152d2
callq 0x3230
movq %rax, %rdi
leaq -0xb8(%rbp), %rsi
callq 0x3220
movq %rax, %rdi
leaq 0xe3cc(%rip), %rsi      # 0x15005
callq 0x3230
movq %rax, %rbx
movq %r15, %rdi
movq -0x40(%rbp), %rsi
movl -0x2c(%rbp), %edx
callq 0xab34
movq %rbx, %rdi
movq %r15, %rsi
callq 0x3220
movq %rax, %rdi
leaq 0xe87e(%rip), %rsi      # 0x154e3
callq 0x3230
movq %rax, %rdi
leaq 0xe663(%rip), %rsi      # 0x152d7
callq 0x3230
movq %rax, %rdi
leaq -0xb8(%rbp), %rsi
callq 0x3220
movq %rax, %rdi
leaq 0xe851(%rip), %rsi      # 0x154e3
callq 0x3230
jmp 0x731f
movq (%r14), %rax
movq %r14, %rdi
movl %r12d, %esi
callq *0x18(%rax)
addq $0x58, %rax
movq %r15, %rdi
movq %rax, %rsi
callq 0xb24a
movl -0x58(%rbp), %ebx
movq %r15, %rdi
callq 0x135f8
cmpl $0x34, %ebx
jne 0x6d26
movq -0x48(%rbp), %rdi
leaq 0xe600(%rip), %rsi      # 0x152d2
callq 0x3230
movq %rax, %rdi
leaq -0xb8(%rbp), %rsi
callq 0x3220
movq %rax, %rdi
leaq 0xe315(%rip), %rsi      # 0x15005
callq 0x3230
movq %rax, %rbx
movq %r15, %rdi
movq -0x40(%rbp), %rsi
movl -0x2c(%rbp), %edx
callq 0xab34
movq %rbx, %rdi
movq %r15, %rsi
callq 0x3220
movq %rax, %rdi
leaq 0xe7c7(%rip), %rsi      # 0x154e3
callq 0x3230
jmp 0x731f
movq (%r14), %rax
movq %r14, %rdi
movl %r12d, %esi
callq *0x18(%rax)
addq $0x58, %rax
movq %r15, %rdi
movq %rax, %rsi
callq 0xb24a
movl -0x58(%rbp), %ebx
movq %r15, %rdi
callq 0x135f8
cmpl $0x32, %ebx
jne 0x6dfc
movq -0x48(%rbp), %rdi
leaq 0xe57d(%rip), %rsi      # 0x152dd
callq 0x3230
movq %rax, %rbx
testb %r13b, %r13b
leaq 0xe570(%rip), %rsi      # 0x152e2
leaq 0xe567(%rip), %rax      # 0x152e0
cmovneq %rax, %rsi
movq %r15, %rdi
leaq -0xf8(%rbp), %rdx
callq 0x3be4
movq %rbx, %rdi
movq %r15, %rsi
callq 0x3220
movq %rax, %rdi
leaq 0xe264(%rip), %rsi      # 0x15005
callq 0x3230
movq %rax, %rdi
leaq -0xb8(%rbp), %rsi
callq 0x3220
movq %rax, %rdi
leaq 0xe246(%rip), %rsi      # 0x15005
callq 0x3230
movq %rax, %rbx
leaq -0x98(%rbp), %r15
movq %r15, %rdi
movq -0x40(%rbp), %rsi
movl -0x2c(%rbp), %edx
callq 0xab34
movq %rbx, %rdi
movq %r15, %rsi
callq 0x3220
movq %rax, %rdi
leaq 0xe6f1(%rip), %rsi      # 0x154e3
callq 0x3230
jmp 0x7313
movq (%r14), %rax
movq %r14, %rdi
movl %r12d, %esi
callq *0x18(%rax)
addq $0x58, %rax
movq %r15, %rdi
movq %rax, %rsi
callq 0xb24a
movl -0x58(%rbp), %ebx
movq %r15, %rdi
callq 0x135f8
cmpl $0x31, %ebx
jne 0x6eff
movq -0x48(%rbp), %rdi
leaq 0xe4a7(%rip), %rsi      # 0x152dd
callq 0x3230
movq %rax, %rbx
testb %r13b, %r13b
leaq 0xe49a(%rip), %rsi      # 0x152e2
leaq 0xe491(%rip), %rax      # 0x152e0
cmovneq %rax, %rsi
movq %r15, %rdi
leaq -0xf8(%rbp), %rdx
callq 0x3be4
movq %rbx, %rdi
movq %r15, %rsi
callq 0x3220
movq %rax, %rdi
leaq 0xe18e(%rip), %rsi      # 0x15005
callq 0x3230
movq %rax, %rdi
leaq -0xb8(%rbp), %rsi
callq 0x3220
movq %rax, %rdi
leaq 0xe170(%rip), %rsi      # 0x15005
callq 0x3230
movq %rax, %rbx
leaq -0x98(%rbp), %r15
movq %r15, %rdi
movq -0x40(%rbp), %rsi
movl -0x2c(%rbp), %edx
callq 0xab34
movq %rbx, %rdi
movq %r15, %rsi
callq 0x3220
movq %rax, %rdi
leaq 0xe61b(%rip), %rsi      # 0x154e3
callq 0x3230
movq %rax, %rdi
leaq 0xe400(%rip), %rsi      # 0x152d7
callq 0x3230
movq %rax, %rdi
leaq -0xb8(%rbp), %rsi
callq 0x3220
movq %rax, %rdi
leaq 0xe5ee(%rip), %rsi      # 0x154e3
callq 0x3230
jmp 0x7313
movq (%r14), %rax
movq %r14, %rdi
movl %r12d, %esi
callq *0x18(%rax)
addq $0x58, %rax
movq %r15, %rdi
movq %rax, %rsi
callq 0xb24a
movl -0x58(%rbp), %ebx
movq %r15, %rdi
callq 0x135f8
cmpl $0x30, %ebx
jne 0x710a
movq -0x40(%rbp), %rbx
movq %rbx, %rdi
callq 0xaa6c
movl %eax, -0x34(%rbp)
leaq -0x78(%rbp), %rdi
movq %rbx, %rsi
movl -0x2c(%rbp), %edx
callq 0xab34
leaq -0x98(%rbp), %rdi
movq %rbx, %rsi
movl -0x34(%rbp), %edx
callq 0xab34
movq -0x48(%rbp), %rdi
leaq 0xe37b(%rip), %rsi      # 0x152e4
callq 0x3230
movq %rax, %rdi
leaq -0x98(%rbp), %rsi
callq 0x3220
movq %rax, %rdi
leaq 0xe07e(%rip), %rsi      # 0x15005
callq 0x3230
movq %rax, %rdi
leaq -0xb8(%rbp), %rsi
callq 0x3220
movq %rax, %rdi
leaq 0xe53e(%rip), %rsi      # 0x154e3
callq 0x3230
movq %rax, %rdi
leaq 0xe329(%rip), %rsi      # 0x152dd
callq 0x3230
movq %rax, %rbx
testb %r13b, %r13b
leaq 0xe31c(%rip), %rsi      # 0x152e2
leaq 0xe313(%rip), %rax      # 0x152e0
cmovneq %rax, %rsi
leaq -0xf8(%rbp), %r15
movq %r15, %rdi
leaq -0x2d(%rbp), %rdx
callq 0x3be4
movq %rbx, %rdi
movq %r15, %rsi
callq 0x3220
movq %rax, %rdi
leaq 0xe00c(%rip), %rsi      # 0x15005
callq 0x3230
movq %rax, %rdi
leaq -0xb8(%rbp), %rsi
callq 0x3220
movq %rax, %rdi
leaq 0xdfee(%rip), %rsi      # 0x15005
callq 0x3230
movq %rax, %rdi
leaq -0x78(%rbp), %rsi
callq 0x3220
movq %rax, %rdi
leaq 0xe4b1(%rip), %rsi      # 0x154e3
callq 0x3230
movq %rax, %rdi
leaq 0xe291(%rip), %rsi      # 0x152d2
callq 0x3230
movq %rax, %rdi
leaq -0x78(%rbp), %rsi
callq 0x3220
movq %rax, %rdi
leaq 0xdfa9(%rip), %rsi      # 0x15005
callq 0x3230
movq %rax, %rdi
leaq -0x98(%rbp), %rsi
callq 0x3220
movq %rax, %rdi
leaq 0xe469(%rip), %rsi      # 0x154e3
callq 0x3230
movq %rax, %rdi
leaq 0xe24e(%rip), %rsi      # 0x152d7
callq 0x3230
movq %rax, %rdi
leaq -0x78(%rbp), %rsi
callq 0x3220
movq %rax, %rdi
leaq 0xe43f(%rip), %rsi      # 0x154e3
callq 0x3230
movq %rax, %rdi
leaq 0xe236(%rip), %rsi      # 0x152e9
callq 0x3230
movq %rax, %rdi
leaq -0xb8(%rbp), %rsi
callq 0x3220
movq %rax, %rdi
leaq 0xdf34(%rip), %rsi      # 0x15005
callq 0x3230
movq %rax, %rdi
leaq -0x78(%rbp), %rsi
callq 0x3220
movq %rax, %rdi
leaq 0xe3f7(%rip), %rsi      # 0x154e3
callq 0x3230
movq %r15, %rdi
callq 0x3110
movq -0x40(%rbp), %rdi
movl -0x34(%rbp), %esi
callq 0xac12
jmp 0x7313
movq (%r14), %rax
movq %r14, %rdi
movl %r12d, %esi
callq *0x18(%rax)
addq $0x58, %rax
movq %r15, %rdi
movq %rax, %rsi
callq 0xb24a
movl -0x58(%rbp), %ebx
movq %r15, %rdi
callq 0x135f8
cmpl $0x33, %ebx
jne 0x7328
movq -0x40(%rbp), %rbx
movq %rbx, %rdi
callq 0xaa6c
movl %eax, -0x34(%rbp)
leaq -0x78(%rbp), %rdi
movq %rbx, %rsi
movl -0x2c(%rbp), %edx
callq 0xab34
leaq -0x98(%rbp), %rdi
movq %rbx, %rsi
movl -0x34(%rbp), %edx
callq 0xab34
movq -0x48(%rbp), %rdi
leaq 0xe170(%rip), %rsi      # 0x152e4
callq 0x3230
movq %rax, %rdi
leaq -0x98(%rbp), %rsi
callq 0x3220
movq %rax, %rdi
leaq 0xde73(%rip), %rsi      # 0x15005
callq 0x3230
movq %rax, %rdi
leaq -0xb8(%rbp), %rsi
callq 0x3220
movq %rax, %rdi
leaq 0xe333(%rip), %rsi      # 0x154e3
callq 0x3230
movq %rax, %rdi
leaq 0xe11e(%rip), %rsi      # 0x152dd
callq 0x3230
movq %rax, %rbx
testb %r13b, %r13b
leaq 0xe111(%rip), %rsi      # 0x152e2
leaq 0xe108(%rip), %rax      # 0x152e0
cmovneq %rax, %rsi
leaq -0xf8(%rbp), %r15
movq %r15, %rdi
leaq -0x2d(%rbp), %rdx
callq 0x3be4
movq %rbx, %rdi
movq %r15, %rsi
callq 0x3220
movq %rax, %rdi
leaq 0xde01(%rip), %rsi      # 0x15005
callq 0x3230
movq %rax, %rdi
leaq -0xb8(%rbp), %rsi
callq 0x3220
movq %rax, %rdi
leaq 0xdde3(%rip), %rsi      # 0x15005
callq 0x3230
movq %rax, %rdi
leaq -0x78(%rbp), %rsi
callq 0x3220
movq %rax, %rdi
leaq 0xe2a6(%rip), %rsi      # 0x154e3
callq 0x3230
movq %rax, %rdi
leaq 0xe08b(%rip), %rsi      # 0x152d7
callq 0x3230
movq %rax, %rdi
leaq -0xb8(%rbp), %rsi
callq 0x3220
movq %rax, %rdi
leaq 0xe279(%rip), %rsi      # 0x154e3
callq 0x3230
movq %rax, %rdi
leaq 0xe059(%rip), %rsi      # 0x152d2
callq 0x3230
movq %rax, %rdi
leaq -0x78(%rbp), %rsi
callq 0x3220
movq %rax, %rdi
leaq 0xdd71(%rip), %rsi      # 0x15005
callq 0x3230
movq %rax, %rdi
leaq -0x98(%rbp), %rsi
callq 0x3220
movq %rax, %rdi
leaq 0xe231(%rip), %rsi      # 0x154e3
callq 0x3230
movq %rax, %rdi
leaq 0xe02d(%rip), %rsi      # 0x152ee
callq 0x3230
movq %rax, %rdi
leaq -0xb8(%rbp), %rsi
callq 0x3220
movq %rax, %rdi
leaq 0xdd26(%rip), %rsi      # 0x15005
callq 0x3230
movq %rax, %rdi
leaq -0x78(%rbp), %rsi
callq 0x3220
movq %rax, %rdi
leaq 0xe1e9(%rip), %rsi      # 0x154e3
callq 0x3230
movq %r15, %rdi
callq 0x3110
movq -0x40(%rbp), %rdi
movl -0x34(%rbp), %esi
callq 0xac12
leaq -0x98(%rbp), %rdi
callq 0x3110
leaq -0x78(%rbp), %rdi
callq 0x3110
movq -0x40(%rbp), %rdi
movl -0x2c(%rbp), %esi
callq 0xac12
addq $0x2, %r12
jmp 0x6b88
leaq -0xb8(%rbp), %rdi
callq 0x3110
movl -0xbc(%rbp), %eax
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x73c9
jmp 0x73bb
jmp 0x73c9
jmp 0x738b
jmp 0x738b
jmp 0x73c9
jmp 0x73bb
jmp 0x73c9
jmp 0x73c9
jmp 0x73c9
jmp 0x73bb
jmp 0x738b
jmp 0x73c9
jmp 0x73c9
jmp 0x73bb
jmp 0x738b
jmp 0x73bb
jmp 0x73c9
jmp 0x738b
jmp 0x73c9
jmp 0x7398
movq %rax, %rbx
jmp 0x73a7
jmp 0x73c9
jmp 0x73bb
jmp 0x73bb
jmp 0x73c9
movq %rax, %rbx
leaq -0xf8(%rbp), %rdi
callq 0x3110
leaq -0x98(%rbp), %rdi
callq 0x3110
jmp 0x73be
jmp 0x73c9
jmp 0x73c9
jmp 0x73c9
movq %rax, %rbx
leaq -0x78(%rbp), %rdi
callq 0x3110
jmp 0x73cc
movq %rax, %rbx
leaq -0xb8(%rbp), %rdi
callq 0x3110
movq %rbx, %rdi
callq 0x3410