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

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

	for (; i < size; i += 2){
		u32 reg2 = this->comparison(node->get_child(i+1), stream);
		if (get_token(node->get_child(i)).type == crl::Token::Type::LAND)
			stream << "LAND " << reg_name << " " << reg_tracker.reg_name(reg2) << "\n";
		else
			stream << "LOR " << reg_name << " " << reg_tracker.reg_name(reg2) << "\n";
		reg_tracker.free(reg2);
	}
	return reg1; 
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq %rdx, %rbx
movq %rdi, %r15
movq (%rsi), %rax
movq 0x18(%rsi), %r12
subq 0x10(%rsi), %r12
sarq $0x3, %r12
movq %rsi, -0x80(%rbp)
movq %rsi, %rdi
xorl %esi, %esi
callq *0x18(%rax)
movq %r15, %rdi
movq %rax, %rsi
movq %rbx, -0x78(%rbp)
movq %rbx, %rdx
callq 0x7eac
movq %r15, -0xb8(%rbp)
leaq 0x500(%r15), %r14
leaq -0xa0(%rbp), %rdi
movq %r14, %rsi
movl %eax, -0x3c(%rbp)
movl %eax, %edx
callq 0xdda4
movq %r12, -0xb0(%rbp)
cmpq $0x2, %r12
jb 0x65a7
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
movq -0x78(%rbp), %rax
addq $0x10, %rax
movq %rax, -0x30(%rbp)
movl $0x1, %ebx
leaq 0x3f(%rcx), %rax
movq %rax, -0xa8(%rbp)
leal 0x1(%rbx), %esi
movq -0x80(%rbp), %rdi
movq (%rdi), %rax
callq *0x18(%rax)
movq -0xb8(%rbp), %rdi
movq %rax, %rsi
movq -0x78(%rbp), %rdx
callq 0x7eac
movq %rax, -0x38(%rbp)
movq -0x80(%rbp), %rdi
movq (%rdi), %rax
movq %rbx, %r15
movl %ebx, %esi
callq *0x18(%rax)
leaq -0x60(%rbp), %r13
leaq -0x70(%rbp), %rbx
movq %rax, %r12
movq %r13, -0x70(%rbp)
movq 0x58(%rax), %rsi
movq 0x60(%rax), %rdx
addq %rsi, %rdx
movq %rbx, %rdi
callq 0x4d52
movl 0x80(%r12), %eax
movl %eax, 0x18(%r13)
movq 0x78(%r12), %rax
movq %rax, 0x10(%r13)
movl -0x50(%rbp), %r12d
movq %rbx, %rdi
callq 0x191f8
cmpl $0x36, %r12d
jne 0x64c0
movl $0x5, %edx
movq -0x30(%rbp), %rdi
leaq 0x14e9a(%rip), %rsi     # 0x1b2ee
callq 0x3280
movq %r15, %rbx
movq -0xa0(%rbp), %rsi
movq -0x98(%rbp), %rdx
movq -0x30(%rbp), %rdi
callq 0x3280
movq %rax, %r12
movl $0x1, %edx
movq %rax, %rdi
leaq 0x14b80(%rip), %rsi     # 0x1b005
callq 0x3280
leaq -0x70(%rbp), %rdi
movq %r14, %rsi
movq -0x38(%rbp), %rdx
callq 0xdda4
movq -0x70(%rbp), %rsi
movq -0x68(%rbp), %rdx
movq %r12, %rdi
callq 0x3280
movl $0x1, %edx
movq %rax, %rdi
leaq 0x1502a(%rip), %rsi     # 0x1b4e3
callq 0x3280
jmp 0x653a
movl $0x4, %edx
movq -0x30(%rbp), %rdi
leaq 0x14e19(%rip), %rsi     # 0x1b2e9
callq 0x3280
movq %r15, %rbx
movq -0xa0(%rbp), %rsi
movq -0x98(%rbp), %rdx
movq -0x30(%rbp), %rdi
callq 0x3280
movq %rax, %r12
movl $0x1, %edx
movq %rax, %rdi
leaq 0x14b04(%rip), %rsi     # 0x1b005
callq 0x3280
leaq -0x70(%rbp), %rdi
movq %r14, %rsi
movq -0x38(%rbp), %rdx
callq 0xdda4
movq -0x70(%rbp), %rsi
movq -0x68(%rbp), %rdx
movq %r12, %rdi
callq 0x3280
movl $0x1, %edx
movq %rax, %rdi
leaq 0x14fae(%rip), %rsi     # 0x1b4e3
callq 0x3280
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0x6553
movq -0x60(%rbp), %rsi
incq %rsi
callq 0x3230
movq -0x38(%rbp), %rcx
leal 0x3f(%rcx), %eax
testl %ecx, %ecx
cmovnsl %ecx, %eax
movslq %ecx, %rdi
sarl $0x6, %eax
cltq
shlq $0x3, %rax
addq (%r14), %rax
andq -0xa8(%rbp), %rdi
xorl %edx, %edx
movabsq $-0x8000000000000000, %rsi # imm = 0x8000000000000000
cmpq %rsi, %rdi
setbe %dl
movq $-0x2, %rsi
rolq %cl, %rsi
andq %rsi, -0x8(%rax,%rdx,8)
addq $0x2, %rbx
cmpq -0xb0(%rbp), %rbx
jb 0x63c8
leaq -0x90(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x65c6
movq -0x90(%rbp), %rsi
incq %rsi
callq 0x3230
movl -0x3c(%rbp), %eax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x6601
jmp 0x6601
jmp 0x65e1
movq %rax, %rbx
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0x6604
movq -0x60(%rbp), %rsi
incq %rsi
callq 0x3230
jmp 0x6604
jmp 0x6601
movq %rax, %rbx
leaq -0x90(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x6623
movq -0x90(%rbp), %rsi
incq %rsi
callq 0x3230
movq %rbx, %rdi
callq 0x33f0
nop