// File: /workspace/github_cpp_makefile_star2_O1/RuiDGPires[P]CrimLang/src/generator.cpp
// Function: gc_Tracker::declaration_var(crl::Node*)
void _gc_Tracker::declaration_var(crl::Node *node){
	ASSERT(node->get_child(0)->type == crl::Node::Type::LEAF, "Var declaration must start with type");
	ASSERT(node->get_child(1)->type == crl::Node::Type::LEAF, "Var declaration must have a name as second token");
	std::string type = get_token(node->get_child(0)).str;
	std::string name = get_token(node->get_child(1)).str;


	u32 size = size_of(type);

	this->stream_defines << "%define " << name << " " << symb_tracker.global_create(name, size) << "\n";

	if (node->children.size() == 3){
		ASSERT(node->get_child(2)->type == crl::Node::Type::ASSIGN, "Third child must be assign");
		this->expression(node->get_child(2)->get_child(0), this->stream_global_vars);
		this->stream_global_vars << 
			"; Global " << name << "\n" << 
			"MVI R1 " << name << "\n" <<
			"; Pop the result from the expression\n";
		for (u32 i = 0; i < size; i++)
				this->stream_global_vars <<
				"POP R2\n" <<
				"STORE m[R1][" << size - i - 1<< "] R2\n";
		this->stream_global_vars << "\n";
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x118, %rsp            # imm = 0x118
movq %rsi, %r14
movq %rdi, %rbx
movq (%rsi), %rax
movq %rsi, %rdi
xorl %esi, %esi
callq *0x18(%rax)
cmpl $0x10, 0x8(%rax)
jne 0x9194
movq (%r14), %rax
movq %r14, %rdi
movl $0x1, %esi
callq *0x18(%rax)
cmpl $0x10, 0x8(%rax)
jne 0x9201
movq (%r14), %rax
movq %r14, %rdi
xorl %esi, %esi
callq *0x18(%rax)
movq %rax, %r15
leaq -0xc8(%rbp), %r13
movq %r13, -0x10(%r13)
movq 0x58(%rax), %rsi
movq 0x60(%rax), %rdx
addq %rsi, %rdx
leaq -0xd8(%rbp), %r12
movq %r12, %rdi
callq 0x4d4a
movl 0x80(%r15), %eax
movl %eax, 0x28(%r12)
movq 0x78(%r15), %rax
movq %rax, 0x20(%r12)
leaq -0x58(%rbp), %rcx
movq %rcx, -0x10(%rcx)
movq (%r12), %rax
cmpq %r13, %rax
je 0x8e43
movq %rax, -0x68(%rbp)
movq -0xc8(%rbp), %rax
movq %rax, -0x58(%rbp)
jmp 0x8e4b
movups (%r13), %xmm0
movups %xmm0, (%rcx)
leaq -0xd8(%rbp), %rdi
movq 0x8(%rdi), %rax
movq %rax, -0x60(%rbp)
movq %r13, (%rdi)
movq $0x0, 0x8(%rdi)
movb $0x0, 0x10(%rdi)
callq 0x192b0
movq (%r14), %rax
movq %r14, %rdi
movl $0x1, %esi
callq *0x18(%rax)
movq %rax, %r15
leaq -0xd8(%rbp), %rdi
movq %r13, (%rdi)
movq 0x58(%rax), %rsi
movq 0x60(%rax), %rdx
addq %rsi, %rdx
callq 0x4d4a
movl 0x80(%r15), %eax
movl %eax, -0xb0(%rbp)
movq 0x78(%r15), %rax
movq %rax, -0xb8(%rbp)
leaq -0x38(%rbp), %rcx
movq %rcx, -0x10(%rcx)
movq -0xd8(%rbp), %rax
cmpq %r13, %rax
je 0x8ed6
movq %rax, -0x48(%rbp)
movq -0xc8(%rbp), %rax
movq %rax, -0x38(%rbp)
jmp 0x8ede
movups (%r13), %xmm0
movups %xmm0, (%rcx)
leaq -0xd8(%rbp), %rdi
movq 0x8(%rdi), %rax
movq %rax, -0x40(%rbp)
movq %r13, (%rdi)
movq $0x0, 0x8(%rdi)
movb $0x0, 0x10(%rdi)
callq 0x192b0
leaq -0x98(%rbp), %r12
movq %r12, -0x10(%r12)
movq -0x68(%rbp), %rsi
movq -0x60(%rbp), %rdx
addq %rsi, %rdx
leaq -0xa8(%rbp), %rdi
callq 0x4d4a
leaq -0xa8(%rbp), %rdi
callq 0x93d7
movl %eax, %r15d
movq -0xa8(%rbp), %rdi
cmpq %r12, %rdi
je 0x8f4e
movq -0x98(%rbp), %rsi
incq %rsi
callq 0x3230
leaq 0x18(%rbx), %r12
leaq 0x123f6(%rip), %rsi     # 0x1b34f
movl $0x8, %edx
movq %r12, %rdi
callq 0x3280
movq -0x48(%rbp), %rsi
movq -0x40(%rbp), %rdx
movq %r12, %rdi
callq 0x3280
movq %rax, %r12
leaq 0x12085(%rip), %rsi     # 0x1b005
movl $0x1, %edx
movq %rax, %rdi
callq 0x3280
leaq -0x78(%rbp), %r13
movq %r13, -0x10(%r13)
movq -0x48(%rbp), %rsi
movq -0x40(%rbp), %rdx
addq %rsi, %rdx
leaq -0x88(%rbp), %rdi
callq 0x4d4a
leaq 0x530(%rbx), %rdi
leaq -0x88(%rbp), %rsi
movl %r15d, %edx
callq 0xdee8
movl %eax, %esi
movq %r12, %rdi
callq 0x3170
leaq 0x12510(%rip), %rsi     # 0x1b4e3
movl $0x1, %edx
movq %rax, %rdi
callq 0x3280
movq -0x88(%rbp), %rdi
cmpq %r13, %rdi
je 0x8ff8
movq -0x78(%rbp), %rsi
incq %rsi
callq 0x3230
movq 0x18(%r14), %rax
subq 0x10(%r14), %rax
cmpq $0x18, %rax
jne 0x9150
movq (%r14), %rax
movq %r14, %rdi
movl $0x2, %esi
callq *0x18(%rax)
cmpl $0x6, 0x8(%rax)
jne 0x926b
movq (%r14), %rax
movq %r14, %rdi
movl $0x2, %esi
callq *0x18(%rax)
movq (%rax), %rcx
movq %rax, %rdi
xorl %esi, %esi
callq *0x18(%rcx)
leaq 0x190(%rbx), %rdx
movq %rbx, %rdi
movq %rax, %rsi
callq 0x8c94
addq $0x1a0, %rbx            # imm = 0x1A0
leaq 0x12318(%rip), %rsi     # 0x1b373
movl $0x9, %edx
movq %rbx, %rdi
callq 0x3280
movq -0x48(%rbp), %rsi
movq -0x40(%rbp), %rdx
movq %rbx, %rdi
callq 0x3280
movq %rax, %r14
leaq 0x12461(%rip), %rsi     # 0x1b4e3
movl $0x1, %edx
movq %rax, %rdi
callq 0x3280
leaq 0x122e7(%rip), %rsi     # 0x1b37d
movl $0x7, %edx
movq %r14, %rdi
callq 0x3280
movq -0x48(%rbp), %rsi
movq -0x40(%rbp), %rdx
movq %r14, %rdi
callq 0x3280
movq %rax, %r14
leaq 0x12426(%rip), %rsi     # 0x1b4e3
movl $0x1, %edx
movq %rax, %rdi
callq 0x3280
leaq 0x122b4(%rip), %rsi     # 0x1b385
movl $0x25, %edx
movq %r14, %rdi
callq 0x3280
testl %r15d, %r15d
je 0x913c
movl %r15d, %r13d
leaq 0x122be(%rip), %r14     # 0x1b3ab
leaq 0x122bf(%rip), %r15     # 0x1b3b3
leaq 0x122c5(%rip), %r12     # 0x1b3c0
movl $0x7, %edx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3280
movl $0xc, %edx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x3280
leal -0x1(%r13), %esi
movq %rbx, %rdi
callq 0x3170
movl $0x5, %edx
movq %rax, %rdi
movq %r12, %rsi
callq 0x3280
decq %r13
jne 0x90fb
leaq 0x123a0(%rip), %rsi     # 0x1b4e3
movl $0x1, %edx
movq %rbx, %rdi
callq 0x3280
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x9169
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x3230
movq -0x68(%rbp), %rdi
leaq -0x58(%rbp), %rax
cmpq %rax, %rdi
je 0x9182
movq -0x58(%rbp), %rsi
incq %rsi
callq 0x3230
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x50, %edi
callq 0x3120
movq %rax, %r14
leaq -0x128(%rbp), %r12
movq %r12, -0x10(%r12)
leaq 0x12145(%rip), %rsi     # 0x1b2f9
leaq 0x12162(%rip), %rdx     # 0x1b31d
leaq -0x138(%rbp), %rdi
callq 0x433a
movb $0x1, %r15b
leaq -0x138(%rbp), %rcx
movq %r14, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x5470
xorl %r15d, %r15d
leaq 0x19b8b(%rip), %rsi     # 0x22d78
leaq -0x3c0e(%rip), %rdx     # 0x55e6
movq %r14, %rdi
callq 0x33d0
jmp 0x92d3
movl $0x50, %edi
callq 0x3120
movq %rax, %r14
leaq -0x108(%rbp), %r12
movq %r12, -0x10(%r12)
leaq 0x120fd(%rip), %rsi     # 0x1b31e
leaq 0x12126(%rip), %rdx     # 0x1b34e
leaq -0x118(%rbp), %rdi
callq 0x433a
movb $0x1, %r15b
leaq -0x118(%rbp), %rcx
movq %r14, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x5470
xorl %r15d, %r15d
leaq 0x19b1e(%rip), %rsi     # 0x22d78
leaq -0x3c7b(%rip), %rdx     # 0x55e6
movq %r14, %rdi
callq 0x33d0
jmp 0x92d3
movl $0x50, %edi
callq 0x3120
movq %rax, %r14
leaq -0xe8(%rbp), %r12
movq %r12, -0x10(%r12)
leaq 0x120cd(%rip), %rsi     # 0x1b358
leaq 0x120e0(%rip), %rdx     # 0x1b372
leaq -0xf8(%rbp), %rdi
callq 0x433a
movb $0x1, %r15b
leaq -0xf8(%rbp), %rcx
movq %r14, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x5470
xorl %r15d, %r15d
leaq 0x19ab4(%rip), %rsi     # 0x22d78
leaq -0x3ce5(%rip), %rdx     # 0x55e6
movq %r14, %rdi
callq 0x33d0
movq %rax, %rbx
movq -0xf8(%rbp), %rdi
cmpq %r12, %rdi
je 0x92f9
movq -0xe8(%rbp), %rsi
incq %rsi
callq 0x3230
jmp 0x92f9
movq %rax, %rbx
movb $0x1, %r15b
testb %r15b, %r15b
je 0x939d
movq %r14, %rdi
callq 0x31a0
jmp 0x939d
movq %rax, %rbx
movq -0x118(%rbp), %rdi
cmpq %r12, %rdi
je 0x934f
movq -0x108(%rbp), %rsi
jmp 0x933f
jmp 0x9349
movq %rax, %rbx
movq -0x138(%rbp), %rdi
cmpq %r12, %rdi
je 0x934f
movq -0x128(%rbp), %rsi
incq %rsi
callq 0x3230
jmp 0x934f
movq %rax, %rbx
movb $0x1, %r15b
testb %r15b, %r15b
je 0x93cf
movq %r14, %rdi
callq 0x31a0
jmp 0x93cf
movq %rax, %rbx
movq -0xa8(%rbp), %rdi
cmpq %r12, %rdi
je 0x939d
movq -0x98(%rbp), %rsi
jmp 0x938e
movq %rax, %rbx
jmp 0x93b6
movq %rax, %rbx
movq -0x88(%rbp), %rdi
cmpq %r13, %rdi
je 0x939d
movq -0x78(%rbp), %rsi
incq %rsi
callq 0x3230
jmp 0x939d
jmp 0x939a
movq %rax, %rbx
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x93b6
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x3230
movq -0x68(%rbp), %rdi
leaq -0x58(%rbp), %rax
cmpq %rax, %rdi
je 0x93cf
movq -0x58(%rbp), %rsi
incq %rsi
callq 0x3230
movq %rbx, %rdi
callq 0x33f0