// File: /workspace/github_cpp_makefile_star2_O2/RuiDGPires[P]CrimLang/src/generator.cpp
// Function: gc_Tracker::assign_op(crl::Node*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void _gc_Tracker::assign_op(crl::Node *node, std::string op){
	crl::Token t;

	
	u32 reg1 = reg_tracker.alloc();
	std::string name1 = reg_tracker.reg_name(reg1);
	u32 reg2 = this->expression_reg(node->get_child(1), stream_funcs);
	std::string name2 = reg_tracker.reg_name(reg2);
	u32 offset = 0;

	if (node->get_child(0)->type == crl::Node::Type::VECTOR){
		t = get_token(node->get_child(0)->get_child(0));
		offset = atoi(get_token(node->get_child(0)->get_child(1)).str.c_str());
	}else
		t = get_token(node->get_child(0));

	if (symb_tracker.has_local(t.str)){
		std::pair<u32, bool> p = symb_tracker.get_local(t.str);

		if (p.second){
			u32 reg3 = reg_tracker.alloc();
			std::string name3 = reg_tracker.reg_name(reg3);
			stream_funcs <<
				"LOAD " << name1 << " m[RF][-" << p.first << "]\n" <<
				"LOAD " << name3 << " m[" << name1  << "][-" << offset << "]\n" <<
				op << " " << name3 << " " << name2 << "\n" <<
				"STORE m[" << name1 << "][-" << offset << "] " << name3 << "\n";
			reg_tracker.free(reg3);
		}else
			stream_funcs <<
				"LOAD " << name1 << " m[RF][-" << p.first + offset << "]\n" <<
				op << " " << name1 << " " << name2 << "\n" <<
				"STORE m[RF][-" << p.first + offset<< "] " << name1 << "\n";
	}else{
		u32 reg3 = reg_tracker.alloc();
		std::string name3 = reg_tracker.reg_name(reg3);

		stream_funcs	<<
		 	"MVI " << name1 << " " << t.str << "\n" <<
			"LOAD " << name3 << " m[" << name1 << "][-" << offset << "]\n" <<
			op << " " << name3 << " " << name2 <<  "\n" <<
			"STORE m[" << name1 << "][-" << offset << "] " << name3 << "\n";
		reg_tracker.free(reg3);
	}
	
	reg_tracker.free(reg1);
	reg_tracker.free(reg2);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xf8, %rsp
movq %rdx, -0x30(%rbp)
movq %rsi, %r15
movq %rdi, %r14
leaq -0xd8(%rbp), %rdi
callq 0x135b0
leaq 0x500(%r14), %rbx
movq %rbx, %rdi
callq 0xaa6c
leaq -0x88(%rbp), %rdi
movq %rbx, %rsi
movl %eax, -0x38(%rbp)
movl %eax, %edx
callq 0xab34
movq (%r15), %rax
pushq $0x1
popq %rsi
movq %r15, %rdi
callq *0x18(%rax)
leaq 0x318(%r14), %rdx
movq %r14, %rdi
movq %rax, %rsi
callq 0x586e
leaq -0xa8(%rbp), %rdi
movq %rbx, %rsi
movl %eax, -0x34(%rbp)
movl %eax, %edx
callq 0xab34
movq (%r15), %rax
movq %r15, %rdi
xorl %esi, %esi
callq *0x18(%rax)
cmpl $0x19, 0x8(%rax)
jne 0x9d5b
movq (%r15), %rax
movq %r15, %rdi
xorl %esi, %esi
callq *0x18(%rax)
movq (%rax), %rcx
movq %rax, %rdi
xorl %esi, %esi
callq *0x18(%rcx)
addq $0x58, %rax
leaq -0x68(%rbp), %rdi
movq %rax, %rsi
callq 0xb24a
leaq -0xd8(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x3df4
leaq -0x68(%rbp), %rdi
callq 0x135f8
movq (%r15), %rax
movq %r15, %rdi
xorl %esi, %esi
callq *0x18(%rax)
movq (%rax), %rcx
pushq $0x1
popq %rsi
movq %rax, %rdi
callq *0x18(%rcx)
addq $0x58, %rax
leaq -0x68(%rbp), %rdi
movq %rax, %rsi
callq 0xb24a
leaq -0x68(%rbp), %r15
movq (%r15), %rdi
callq 0x3350
movl %eax, %r13d
movq %r15, %rdi
callq 0x135f8
jmp 0x9d92
movq (%r15), %rax
movq %r15, %rdi
xorl %esi, %esi
callq *0x18(%rax)
addq $0x58, %rax
leaq -0x68(%rbp), %rdi
movq %rax, %rsi
callq 0xb24a
leaq -0xd8(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x3df4
leaq -0x68(%rbp), %rdi
callq 0x135f8
xorl %r13d, %r13d
leaq -0x118(%rbp), %rdi
leaq -0xd8(%rbp), %rsi
callq 0x32f0
leaq 0x530(%r14), %r15
leaq -0x118(%rbp), %rsi
movq %r15, %rdi
callq 0xabb4
movl %eax, %r12d
leaq -0x118(%rbp), %rdi
callq 0x3110
testb %r12b, %r12b
je 0x9f03
leaq -0xf8(%rbp), %rdi
leaq -0xd8(%rbp), %rsi
callq 0x32f0
leaq -0xf8(%rbp), %rsi
movq %r15, %rdi
callq 0xabee
movq %rax, %r15
leaq -0xf8(%rbp), %rdi
callq 0x3110
btq $0x20, %r15
jb 0xa099
addq $0x328, %r14            # imm = 0x328
leaq 0xb423(%rip), %rsi      # 0x15240
movq %r14, %rdi
callq 0x3230
leaq -0x88(%rbp), %rsi
movq %rax, %rdi
callq 0x3220
leaq 0xb7a5(%rip), %rsi      # 0x155e0
movq %rax, %rdi
callq 0x3230
addl %r15d, %r13d
movq %rax, %rdi
movq %r13, %rsi
callq 0x3180
leaq 0xb3ee(%rip), %rsi      # 0x15246
movq %rax, %rdi
callq 0x3230
movq %rax, %rdi
movq -0x30(%rbp), %rsi
callq 0x3220
leaq 0xb192(%rip), %rsi      # 0x15005
movq %rax, %rdi
callq 0x3230
leaq -0x88(%rbp), %rsi
movq %rax, %rdi
callq 0x3220
leaq 0xb174(%rip), %rsi      # 0x15005
movq %rax, %rdi
callq 0x3230
leaq -0xa8(%rbp), %rsi
movq %rax, %rdi
callq 0x3220
leaq 0xb634(%rip), %rsi      # 0x154e3
movq %rax, %rdi
callq 0x3230
leaq 0xb71d(%rip), %rsi      # 0x155db
movq %rax, %rdi
callq 0x3230
movq %rax, %rdi
movq %r13, %rsi
callq 0x3180
leaq 0xb700(%rip), %rsi      # 0x155d8
movq %rax, %rdi
callq 0x3230
leaq -0x88(%rbp), %rsi
movq %rax, %rdi
callq 0x3220
leaq 0xb5ed(%rip), %rsi      # 0x154e3
movq %rax, %rdi
callq 0x3230
jmp 0xa22f
movq %rbx, %rdi
callq 0xaa6c
movl %eax, %r15d
leaq -0x68(%rbp), %rdi
movq %rbx, %rsi
movl %eax, %edx
callq 0xab34
addq $0x328, %r14            # imm = 0x328
leaq 0xb31f(%rip), %rsi      # 0x15249
movq %r14, %rdi
callq 0x3230
leaq -0x88(%rbp), %rsi
movq %rax, %rdi
callq 0x3220
leaq 0xb0bd(%rip), %rsi      # 0x15005
movq %rax, %rdi
callq 0x3230
leaq -0xd8(%rbp), %rsi
movq %rax, %rdi
callq 0x3220
leaq 0xb57d(%rip), %rsi      # 0x154e3
movq %rax, %rdi
callq 0x3230
leaq 0xb2cb(%rip), %rsi      # 0x15240
movq %rax, %rdi
callq 0x3230
leaq -0x68(%rbp), %rsi
movq %rax, %rdi
callq 0x3220
leaq 0xb644(%rip), %rsi      # 0x155d4
movq %rax, %rdi
callq 0x3230
leaq -0x88(%rbp), %rsi
movq %rax, %rdi
callq 0x3220
leaq 0xb637(%rip), %rsi      # 0x155e5
movq %rax, %rdi
callq 0x3230
movl %r13d, %r14d
movq %rax, %rdi
movq %r14, %rsi
callq 0x3180
leaq 0xb27b(%rip), %rsi      # 0x15246
movq %rax, %rdi
callq 0x3230
movq %rax, %rdi
movq -0x30(%rbp), %rsi
callq 0x3220
leaq 0xb01f(%rip), %rsi      # 0x15005
movq %rax, %rdi
callq 0x3230
leaq -0x68(%rbp), %rsi
movq %rax, %rdi
callq 0x3220
leaq 0xb004(%rip), %rsi      # 0x15005
movq %rax, %rdi
callq 0x3230
leaq -0xa8(%rbp), %rsi
movq %rax, %rdi
callq 0x3220
leaq 0xb4c4(%rip), %rsi      # 0x154e3
movq %rax, %rdi
callq 0x3230
leaq 0xb5a1(%rip), %rsi      # 0x155cf
movq %rax, %rdi
callq 0x3230
leaq -0x88(%rbp), %rsi
movq %rax, %rdi
callq 0x3220
leaq 0xb599(%rip), %rsi      # 0x155e5
movq %rax, %rdi
callq 0x3230
movq %rax, %rdi
movq %r14, %rsi
callq 0x3180
leaq 0xb572(%rip), %rsi      # 0x155d8
movq %rax, %rdi
callq 0x3230
leaq -0x68(%rbp), %rsi
movq %rax, %rdi
callq 0x3220
leaq 0xb462(%rip), %rsi      # 0x154e3
movq %rax, %rdi
callq 0x3230
movq %rbx, %rdi
movl %r15d, %esi
callq 0xac12
jmp 0xa226
movq %rbx, %rdi
callq 0xaa6c
movl %eax, %r12d
leaq -0x68(%rbp), %rdi
movq %rbx, %rsi
movl %eax, %edx
callq 0xab34
addq $0x328, %r14            # imm = 0x328
leaq 0xb180(%rip), %rsi      # 0x15240
movq %r14, %rdi
callq 0x3230
leaq -0x88(%rbp), %rsi
movq %rax, %rdi
callq 0x3220
leaq 0xb502(%rip), %rsi      # 0x155e0
movq %rax, %rdi
callq 0x3230
movl %r15d, %esi
movq %rax, %rdi
callq 0x3180
leaq 0xb14e(%rip), %rsi      # 0x15246
movq %rax, %rdi
callq 0x3230
leaq 0xb139(%rip), %rsi      # 0x15240
movq %rax, %rdi
callq 0x3230
leaq -0x68(%rbp), %rsi
movq %rax, %rdi
callq 0x3220
leaq 0xb4b2(%rip), %rsi      # 0x155d4
movq %rax, %rdi
callq 0x3230
leaq -0x88(%rbp), %rsi
movq %rax, %rdi
callq 0x3220
leaq 0xb4a5(%rip), %rsi      # 0x155e5
movq %rax, %rdi
callq 0x3230
movl %r13d, %r14d
movq %rax, %rdi
movq %r14, %rsi
callq 0x3180
leaq 0xb0e9(%rip), %rsi      # 0x15246
movq %rax, %rdi
callq 0x3230
movq %rax, %rdi
movq -0x30(%rbp), %rsi
callq 0x3220
leaq 0xae8d(%rip), %rsi      # 0x15005
movq %rax, %rdi
callq 0x3230
leaq -0x68(%rbp), %rsi
movq %rax, %rdi
callq 0x3220
leaq 0xae72(%rip), %rsi      # 0x15005
movq %rax, %rdi
callq 0x3230
leaq -0xa8(%rbp), %rsi
movq %rax, %rdi
callq 0x3220
leaq 0xb332(%rip), %rsi      # 0x154e3
movq %rax, %rdi
callq 0x3230
leaq 0xb40f(%rip), %rsi      # 0x155cf
movq %rax, %rdi
callq 0x3230
leaq -0x88(%rbp), %rsi
movq %rax, %rdi
callq 0x3220
leaq 0xb407(%rip), %rsi      # 0x155e5
movq %rax, %rdi
callq 0x3230
movq %rax, %rdi
movq %r14, %rsi
callq 0x3180
leaq 0xb3e0(%rip), %rsi      # 0x155d8
movq %rax, %rdi
callq 0x3230
leaq -0x68(%rbp), %rsi
movq %rax, %rdi
callq 0x3220
leaq 0xb2d0(%rip), %rsi      # 0x154e3
movq %rax, %rdi
callq 0x3230
movq %rbx, %rdi
movl %r12d, %esi
callq 0xac12
leaq -0x68(%rbp), %rdi
callq 0x3110
movq %rbx, %rdi
movl -0x38(%rbp), %esi
callq 0xac12
movq %rbx, %rdi
movl -0x34(%rbp), %esi
callq 0xac12
leaq -0xa8(%rbp), %rdi
callq 0x3110
leaq -0x88(%rbp), %rdi
callq 0x3110
leaq -0xd8(%rbp), %rdi
callq 0x135f8
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xa2c1
jmp 0xa2c1
jmp 0xa2c1
movq %rax, %rbx
leaq -0xf8(%rbp), %rdi
jmp 0xa2cf
jmp 0xa2c1
jmp 0xa291
movq %rax, %rbx
leaq -0x68(%rbp), %rdi
callq 0x135f8
jmp 0xa2d4
movq %rax, %rbx
leaq -0x118(%rbp), %rdi
jmp 0xa2cf
jmp 0xa2c1
jmp 0xa2ba
jmp 0xa2b1
movq %rax, %rbx
jmp 0xa2ec
jmp 0xa2c1
jmp 0xa2c1
movq %rax, %rbx
jmp 0xa2e0
jmp 0xa2c1
movq %rax, %rbx
jmp 0xa2d4
jmp 0xa2c8
movq %rax, %rbx
leaq -0x68(%rbp), %rdi
callq 0x3110
leaq -0xa8(%rbp), %rdi
callq 0x3110
leaq -0x88(%rbp), %rdi
callq 0x3110
leaq -0xd8(%rbp), %rdi
callq 0x135f8
movq %rbx, %rdi
callq 0x3410