// File: RuiDGPires[P]CrimLang/src/semantic_analiser.cpp
// Function: sc_Tracker::var_declaration(crl::Node*)
void _sc_Tracker::var_declaration(crl::Node *node){
	Context::Item item;
	item.type = Context::Item::Type::VAR;
	if (node->get_child(0)->type == crl::Node::Type::VECTOR){
		item.subtype = ((crl::Leaf *) node->get_child(0)->get_child(0))->token.str;
		item._is_vector = true;
		item.vec_size = atoi(((crl::Leaf *) node->get_child(0)->get_child(1))->token.str.c_str());
	}else
		item.subtype = ((crl::Leaf *) node->get_child(0))->token.str;
	item.name = ((crl::Leaf *) node->get_child(1))->token.str;

	if (node->annotation == "mut")
		item._mutable = true;


	if (node->children.size() == 3){
		ASSERT(node->get_child(2)->type == crl::Node::Type::ASSIGN, "Must be assign if children size is 3");
		ASSERT(node->get_child(2)->get_child(0)->type == crl::Node::Type::EXPRESSION, "Must assign an expression");
		this->expression(node->get_child(2)->get_child(0), item.subtype);
	}
	this->add(item);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x200, %rsp            # imm = 0x200
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x180(%rbp)
leaq -0x80(%rbp), %rdi
callq 0x6c30
movl $0x3, -0x80(%rbp)
movq -0x10(%rbp), %rdi
movq (%rdi), %rax
movq 0x18(%rax), %rax
xorl %esi, %esi
callq *%rax
movq %rax, -0x178(%rbp)
jmp 0x20d96
movq -0x178(%rbp), %rax
cmpl $0x19, 0x8(%rax)
jne 0x20e5e
movq -0x10(%rbp), %rdi
movq (%rdi), %rax
movq 0x18(%rax), %rax
xorl %esi, %esi
callq *%rax
movq %rax, -0x188(%rbp)
jmp 0x20dbf
movq -0x188(%rbp), %rdi
movq (%rdi), %rax
movq 0x18(%rax), %rax
xorl %esi, %esi
callq *%rax
movq %rax, -0x190(%rbp)
jmp 0x20dda
movq -0x190(%rbp), %rsi
addq $0x58, %rsi
leaq -0x58(%rbp), %rdi
callq 0x4050
jmp 0x20df0
movb $0x1, -0x38(%rbp)
movq -0x10(%rbp), %rdi
movq (%rdi), %rax
movq 0x18(%rax), %rax
xorl %esi, %esi
callq *%rax
movq %rax, -0x198(%rbp)
jmp 0x20e0c
movq -0x198(%rbp), %rdi
movq (%rdi), %rax
movq 0x18(%rax), %rax
movl $0x1, %esi
callq *%rax
movq %rax, -0x1a0(%rbp)
jmp 0x20e2a
movq -0x1a0(%rbp), %rdi
addq $0x58, %rdi
callq 0x4140
movq %rax, %rdi
callq 0x44b0
movl %eax, -0x34(%rbp)
jmp 0x20e8e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
jmp 0x21230
movq -0x10(%rbp), %rdi
movq (%rdi), %rax
movq 0x18(%rax), %rax
xorl %esi, %esi
callq *%rax
movq %rax, -0x1a8(%rbp)
jmp 0x20e76
movq -0x1a8(%rbp), %rsi
addq $0x58, %rsi
leaq -0x58(%rbp), %rdi
callq 0x4050
jmp 0x20e8c
jmp 0x20e8e
movq -0x10(%rbp), %rdi
movq (%rdi), %rax
movq 0x18(%rax), %rax
movl $0x1, %esi
callq *%rax
movq %rax, -0x1b0(%rbp)
jmp 0x20ea9
movq -0x1b0(%rbp), %rsi
addq $0x58, %rsi
leaq -0x78(%rbp), %rdi
callq 0x4050
jmp 0x20ebf
movq -0x10(%rbp), %rdi
addq $0x30, %rdi
leaq 0xa582(%rip), %rsi      # 0x2b450
callq 0x66e0
movb %al, -0x1b1(%rbp)
jmp 0x20edb
movb -0x1b1(%rbp), %al
testb $0x1, %al
jne 0x20ee7
jmp 0x20eeb
movb $0x1, -0x30(%rbp)
movq -0x10(%rbp), %rdi
addq $0x10, %rdi
callq 0x51d0
cmpq $0x3, %rax
jne 0x211cd
movq -0x10(%rbp), %rdi
movq (%rdi), %rax
movq 0x18(%rax), %rax
movl $0x2, %esi
callq *%rax
movq %rax, -0x1c0(%rbp)
jmp 0x20f1d
movq -0x1c0(%rbp), %rax
cmpl $0x6, 0x8(%rax)
je 0x21011
movb $0x1, -0xb2(%rbp)
movl $0x50, %edi
callq 0x4190
movq %rax, -0x1d0(%rbp)
leaq -0xb1(%rbp), %rdi
movq %rdi, -0x1c8(%rbp)
callq 0x4590
movq -0x1c8(%rbp), %rdx
leaq 0xa9b8(%rip), %rsi      # 0x2b91f
leaq -0xb0(%rbp), %rdi
callq 0x52e0
jmp 0x20f75
movq -0x1d0(%rbp), %rdi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
leaq -0xb0(%rbp), %rcx
movl %edx, %esi
callq 0x9140
jmp 0x20f91
movq -0x1d0(%rbp), %rdi
movb $0x0, -0xb2(%rbp)
leaq 0x18dda(%rip), %rsi     # 0x39d80
leaq -0x17c9d(%rip), %rdx    # 0x9310
callq 0x4550
jmp 0x21245
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
jmp 0x20fe9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
leaq -0xb0(%rbp), %rdi
callq 0x41e0
leaq -0xb1(%rbp), %rdi
callq 0x4360
testb $0x1, -0xb2(%rbp)
jne 0x21000
jmp 0x2100c
movq -0x1d0(%rbp), %rdi
callq 0x4230
jmp 0x21230
movq -0x10(%rbp), %rdi
movq (%rdi), %rax
movq 0x18(%rax), %rax
movl $0x2, %esi
callq *%rax
movq %rax, -0x1d8(%rbp)
jmp 0x2102c
movq -0x1d8(%rbp), %rdi
movq (%rdi), %rax
movq 0x18(%rax), %rax
xorl %esi, %esi
callq *%rax
movq %rax, -0x1e0(%rbp)
jmp 0x21047
movq -0x1e0(%rbp), %rax
cmpl $0xd, 0x8(%rax)
je 0x2113b
movb $0x1, -0xda(%rbp)
movl $0x50, %edi
callq 0x4190
movq %rax, -0x1f0(%rbp)
leaq -0xd9(%rbp), %rdi
movq %rdi, -0x1e8(%rbp)
callq 0x4590
movq -0x1e8(%rbp), %rdx
leaq 0xa8b3(%rip), %rsi      # 0x2b944
leaq -0xd8(%rbp), %rdi
callq 0x52e0
jmp 0x2109f
movq -0x1f0(%rbp), %rdi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
leaq -0xd8(%rbp), %rcx
movl %edx, %esi
callq 0x9140
jmp 0x210bb
movq -0x1f0(%rbp), %rdi
movb $0x0, -0xda(%rbp)
leaq 0x18cb0(%rip), %rsi     # 0x39d80
leaq -0x17dc7(%rip), %rdx    # 0x9310
callq 0x4550
jmp 0x21245
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
jmp 0x21113
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
leaq -0xd8(%rbp), %rdi
callq 0x41e0
leaq -0xd9(%rbp), %rdi
callq 0x4360
testb $0x1, -0xda(%rbp)
jne 0x2112a
jmp 0x21136
movq -0x1f0(%rbp), %rdi
callq 0x4230
jmp 0x21230
movq -0x10(%rbp), %rdi
movq (%rdi), %rax
movq 0x18(%rax), %rax
movl $0x2, %esi
callq *%rax
movq %rax, -0x1f8(%rbp)
jmp 0x21156
movq -0x1f8(%rbp), %rdi
movq (%rdi), %rax
movq 0x18(%rax), %rax
xorl %esi, %esi
callq *%rax
movq %rax, -0x200(%rbp)
jmp 0x21171
leaq -0x58(%rbp), %rsi
leaq -0x100(%rbp), %rdi
callq 0x4150
jmp 0x21183
movq -0x200(%rbp), %rsi
movq -0x180(%rbp), %rdi
leaq -0x100(%rbp), %rdx
callq 0x21250
jmp 0x2119f
leaq -0x100(%rbp), %rdi
callq 0x41e0
jmp 0x211cd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
leaq -0x100(%rbp), %rdi
callq 0x41e0
jmp 0x21230
leaq -0x170(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0x6d30
jmp 0x211df
movq -0x180(%rbp), %rdi
leaq -0x170(%rbp), %rsi
callq 0x20120
jmp 0x211f4
leaq -0x170(%rbp), %rdi
callq 0x6df0
leaq -0x80(%rbp), %rdi
callq 0x6df0
addq $0x200, %rsp            # imm = 0x200
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
leaq -0x170(%rbp), %rdi
callq 0x6df0
leaq -0x80(%rbp), %rdi
callq 0x6df0
movq -0x88(%rbp), %rdi
callq 0x4580
nopw %cs:(%rax,%rax)