// File: 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
subq $0x150, %rsp            # imm = 0x150
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0xe0(%rbp)
movq -0x10(%rbp), %rdi
addq $0x10, %rdi
callq 0x51d0
movq %rax, -0x20(%rbp)
movq $0x0, -0x28(%rbp)
movq -0x10(%rbp), %rdi
movq -0x28(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x28(%rbp)
movl %eax, %esi
movq (%rdi), %rax
callq *0x18(%rax)
movq -0xe0(%rbp), %rdi
movq %rax, %rsi
movq -0x18(%rbp), %rdx
callq 0xc2a0
movq -0xe0(%rbp), %rsi
movl %eax, -0x2c(%rbp)
addq $0x500, %rsi            # imm = 0x500
movl -0x2c(%rbp), %edx
leaq -0x50(%rbp), %rdi
callq 0x13040
movq -0x28(%rbp), %rax
cmpq -0x20(%rbp), %rax
jae 0xa60f
movq -0x10(%rbp), %rdi
movl -0x28(%rbp), %esi
incl %esi
movq (%rdi), %rax
movq 0x18(%rax), %rax
callq *%rax
movq %rax, -0xe8(%rbp)
jmp 0xa3bf
movq -0xe8(%rbp), %rsi
movq -0xe0(%rbp), %rdi
movq -0x18(%rbp), %rdx
callq 0xc2a0
movl %eax, -0xec(%rbp)
jmp 0xa3de
movl -0xec(%rbp), %eax
movl %eax, -0x54(%rbp)
movq -0x10(%rbp), %rdi
movl -0x28(%rbp), %esi
movq (%rdi), %rax
movq 0x18(%rax), %rax
callq *%rax
movq %rax, -0xf8(%rbp)
jmp 0xa400
movq -0xf8(%rbp), %rsi
leaq -0x98(%rbp), %rdi
callq 0xa2e0
jmp 0xa415
movl -0x78(%rbp), %eax
movl %eax, -0xfc(%rbp)
leaq -0x98(%rbp), %rdi
callq 0x285a0
movl -0xfc(%rbp), %eax
cmpl $0x36, %eax
jne 0xa51a
movq -0x18(%rbp), %rdi
addq $0x10, %rdi
leaq 0x20ea6(%rip), %rsi     # 0x2b2ee
callq 0x42e0
movq %rax, -0x108(%rbp)
jmp 0xa456
movq -0x108(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x42c0
movq %rax, -0x110(%rbp)
jmp 0xa46f
movq -0x110(%rbp), %rdi
leaq 0x20b88(%rip), %rsi     # 0x2b005
callq 0x42e0
movq %rax, -0x118(%rbp)
jmp 0xa48b
movq -0xe0(%rbp), %rsi
addq $0x500, %rsi            # imm = 0x500
movl -0x54(%rbp), %edx
leaq -0xb8(%rbp), %rdi
callq 0x13040
jmp 0xa4aa
movq -0x118(%rbp), %rdi
leaq -0xb8(%rbp), %rsi
callq 0x42c0
movq %rax, -0x120(%rbp)
jmp 0xa4c6
movq -0x120(%rbp), %rdi
leaq 0x2100f(%rip), %rsi     # 0x2b4e3
callq 0x42e0
jmp 0xa4db
leaq -0xb8(%rbp), %rdi
callq 0x41e0
jmp 0xa5e4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0xa630
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0xb8(%rbp), %rdi
callq 0x41e0
jmp 0xa630
movq -0x18(%rbp), %rdi
addq $0x10, %rdi
leaq 0x20dc0(%rip), %rsi     # 0x2b2e9
callq 0x42e0
movq %rax, -0x128(%rbp)
jmp 0xa537
movq -0x128(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x42c0
movq %rax, -0x130(%rbp)
jmp 0xa550
movq -0x130(%rbp), %rdi
leaq 0x20aa7(%rip), %rsi     # 0x2b005
callq 0x42e0
movq %rax, -0x138(%rbp)
jmp 0xa56c
movq -0xe0(%rbp), %rsi
addq $0x500, %rsi            # imm = 0x500
movl -0x54(%rbp), %edx
leaq -0xd8(%rbp), %rdi
callq 0x13040
jmp 0xa58b
movq -0x138(%rbp), %rdi
leaq -0xd8(%rbp), %rsi
callq 0x42c0
movq %rax, -0x140(%rbp)
jmp 0xa5a7
movq -0x140(%rbp), %rdi
leaq 0x20f2e(%rip), %rsi     # 0x2b4e3
callq 0x42e0
jmp 0xa5bc
leaq -0xd8(%rbp), %rdi
callq 0x41e0
jmp 0xa5e4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0xd8(%rbp), %rdi
callq 0x41e0
jmp 0xa630
movq -0xe0(%rbp), %rdi
addq $0x500, %rdi            # imm = 0x500
movl -0x54(%rbp), %esi
callq 0x13240
jmp 0xa5fc
jmp 0xa5fe
movq -0x28(%rbp), %rax
addq $0x2, %rax
movq %rax, -0x28(%rbp)
jmp 0xa396
movl -0x2c(%rbp), %eax
movl %eax, -0x144(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x41e0
movl -0x144(%rbp), %eax
addq $0x150, %rsp            # imm = 0x150
popq %rbp
retq
leaq -0x50(%rbp), %rdi
callq 0x41e0
movq -0x60(%rbp), %rdi
callq 0x4580
nopw %cs:(%rax,%rax)