// File: /workspace/github_cpp_makefile_star2_O1/RuiDGPires[P]CrimLang/src/semantic_analiser.cpp
// Function: sc_Tracker::func_declaration(crl::Node*)
void _sc_Tracker::func_declaration(crl::Node *node){
	this->func_returns = false;
	Context::Item item;
	item.type = Context::Item::Type::FUNC;
	item.subtype = ((crl::Leaf *)node->get_child(0))->token.str;
	item.name = ((crl::Leaf *)node->get_child(1))->token.str;
	ASSERT(item.name != "_start", "_start is a reserved name");

	// Parse once to add to the args to the declaration
	int i;
	for (i = 2; node->get_child(i)->type == crl::Node::Type::ARG; i++){
		crl::Node *arg = node->get_child(i);
		std::string var_type = ((crl::Leaf *) arg->get_child(0))->token.str;

		item.args.push_back(std::pair<std::string, bool>(var_type, arg->annotation == "mut"));
	}

	node->argc = i - 2; // Store the number of arguments

	this->add(item);

	this->enter();
	// Add args to the function context
	i = 2;
	for (; node->get_child(i)->type == crl::Node::Type::ARG; i++){
		crl::Node *arg = node->get_child(i);
		Context::Item arg_item;
		arg_item.type = Context::Item::Type::VAR;
		arg_item.subtype = ((crl::Leaf *) arg->get_child(0))->token.str;
		arg_item.name = ((crl::Leaf *) arg->get_child(1))->token.str;
		arg_item._mutable = arg->annotation == "mut";
		this->add(arg_item);
	}
	this->block(node->get_child(i), item.subtype);
	
	ASSERT(func_returns, "Functions must return on all possible paths");
	this->leave();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x258, %rsp            # imm = 0x258
movq %rsi, %r14
xorl %eax, %eax
movq %rdi, -0x30(%rbp)
movb %al, 0x10(%rdi)
leaq -0x1f0(%rbp), %rcx
movq %rcx, -0x10(%rcx)
movq %rax, -0x8(%rcx)
movb %al, (%rcx)
leaq -0x1d0(%rbp), %rcx
movq %rcx, -0x10(%rcx)
movq %rax, -0x8(%rcx)
movb %al, (%rcx)
movb %al, 0x10(%rcx)
movl $0x0, 0x14(%rcx)
movb %al, 0x18(%rcx)
xorps %xmm0, %xmm0
movups %xmm0, 0x20(%rcx)
movq %rax, 0x30(%rcx)
movl $0x1, -0x38(%rcx)
movq (%rsi), %rax
movq %rsi, %rdi
xorl %esi, %esi
callq *0x18(%rax)
leaq -0x1e0(%rbp), %rdi
addq $0x58, %rax
movq %rax, %rsi
callq 0x3150
movq (%r14), %rax
movq %r14, %rdi
movl $0x1, %esi
callq *0x18(%rax)
leaq -0x200(%rbp), %rbx
addq $0x58, %rax
movq %rbx, %rdi
movq %rax, %rsi
callq 0x3150
leaq 0x777a(%rip), %rsi      # 0x1b8e6
movq %rbx, %rdi
callq 0x30a0
testl %eax, %eax
je 0x14569
xorl %ebx, %ebx
leaq -0xb0(%rbp), %r12
leaq -0xc0(%rbp), %r13
leal 0x2(%rbx), %r15d
movq (%r14), %rax
movq %r14, %rdi
movl %r15d, %esi
callq *0x18(%rax)
cmpl $0x12, 0x8(%rax)
jne 0x14260
movq (%r14), %rax
movq %r14, %rdi
movl %r15d, %esi
callq *0x18(%rax)
movq %rax, %r15
movq (%rax), %rax
movq %r15, %rdi
xorl %esi, %esi
callq *0x18(%rax)
leaq -0x40(%rbp), %rcx
movq %rcx, -0x50(%rbp)
movq 0x58(%rax), %rsi
movq 0x60(%rax), %rdx
addq %rsi, %rdx
leaq -0x50(%rbp), %rdi
callq 0x4d4a
addq $0x30, %r15
movq %r15, %rdi
leaq 0x7266(%rip), %rsi      # 0x1b450
callq 0x30a0
movl %eax, %r15d
movq %r12, -0xc0(%rbp)
movq -0x50(%rbp), %rsi
movq -0x48(%rbp), %rdx
addq %rsi, %rdx
movq %r13, %rdi
callq 0x4d4a
testl %r15d, %r15d
sete -0xa0(%rbp)
leaq -0x1b0(%rbp), %rdi
movq %r13, %rsi
callq 0x18bac
movq -0xc0(%rbp), %rdi
cmpq %r12, %rdi
je 0x14240
movq -0xb0(%rbp), %rsi
incq %rsi
callq 0x3230
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x14259
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x3230
incl %ebx
jmp 0x1418c
movl %ebx, 0x50(%r14)
movl -0x208(%rbp), %eax
leaq -0x270(%rbp), %rdi
movl %eax, -0x8(%rdi)
leaq -0x260(%rbp), %rbx
movq %rbx, -0x10(%rbx)
movq -0x200(%rbp), %rsi
movq -0x1f8(%rbp), %rdx
addq %rsi, %rdx
callq 0x4d4a
leaq -0x250(%rbp), %rdi
leaq -0x240(%rbp), %r12
movq %r12, -0x10(%r12)
movq -0x1e0(%rbp), %rsi
movq -0x1d8(%rbp), %rdx
addq %rsi, %rdx
callq 0x4d4a
leaq -0x1c0(%rbp), %rcx
movb 0x8(%rcx), %al
leaq -0x220(%rbp), %rdi
movb %al, -0x8(%rdi)
movq (%rcx), %rax
movq %rax, -0x10(%rdi)
leaq -0x1b0(%rbp), %rsi
callq 0x4ad0
leaq -0x278(%rbp), %rsi
movq -0x30(%rbp), %rbx
movq %rbx, %rdi
callq 0x13bf4
leaq -0x278(%rbp), %rdi
callq 0x4816
movq %rbx, %rdi
callq 0x13b84
leaq -0x190(%rbp), %r12
leaq -0x180(%rbp), %rax
movq %rax, -0xc8(%rbp)
movl $0x2, %ebx
xorl %r13d, %r13d
movq (%r14), %rax
movq %r14, %rdi
movl %ebx, %esi
callq *0x18(%rax)
cmpl $0x12, 0x8(%rax)
movq (%r14), %rax
movq 0x18(%rax), %rax
jne 0x144ba
movq %r14, %rdi
movl %ebx, %esi
callq *%rax
movq %rax, %r15
leaq -0xa8(%rbp), %rax
movq %rax, -0xb8(%rbp)
movq %r13, -0xb0(%rbp)
movb %r13b, -0xa8(%rbp)
leaq -0x88(%rbp), %rax
movq %rax, -0x98(%rbp)
movq %r13, -0x90(%rbp)
movb %r13b, -0x88(%rbp)
movb %r13b, -0x78(%rbp)
movl $0x0, -0x74(%rbp)
movb %r13b, -0x70(%rbp)
leaq -0x68(%rbp), %rax
movq %r13, 0x10(%rax)
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movl $0x3, -0xc0(%rbp)
movq (%r15), %rax
movq %r15, %rdi
xorl %esi, %esi
callq *0x18(%rax)
addq $0x58, %rax
leaq -0x98(%rbp), %rdi
movq %rax, %rsi
callq 0x3150
movq (%r15), %rax
movq %r15, %rdi
movl $0x1, %esi
callq *0x18(%rax)
addq $0x58, %rax
leaq -0xb8(%rbp), %rdi
movq %rax, %rsi
callq 0x3150
addq $0x30, %r15
movq %r15, %rdi
leaq 0x7055(%rip), %rsi      # 0x1b450
callq 0x30a0
testl %eax, %eax
sete -0x70(%rbp)
movl -0xc0(%rbp), %eax
movl %eax, -0x198(%rbp)
leaq -0x180(%rbp), %rax
movq %rax, -0x190(%rbp)
movq -0xb8(%rbp), %rsi
movq -0xb0(%rbp), %rdx
addq %rsi, %rdx
movq %r12, %rdi
callq 0x4d4a
leaq -0x160(%rbp), %rax
movq %rax, -0x170(%rbp)
movq -0x98(%rbp), %rsi
movq -0x90(%rbp), %rdx
addq %rsi, %rdx
leaq -0x170(%rbp), %rdi
callq 0x4d4a
leaq -0xb8(%rbp), %rcx
movb 0x48(%rcx), %al
movb %al, 0x48(%r12)
movq 0x40(%rcx), %rax
movq %rax, 0x40(%r12)
leaq -0x140(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x4ad0
movq -0x30(%rbp), %rdi
leaq -0x198(%rbp), %r15
movq %r15, %rsi
callq 0x13bf4
movq %r15, %rdi
callq 0x4816
leaq -0xc0(%rbp), %rdi
callq 0x4816
incl %ebx
jmp 0x14329
movq %r14, %rdi
movl %ebx, %esi
callq *%rax
movq %rax, %rbx
leaq -0xd8(%rbp), %r14
movq %r14, -0x10(%r14)
movq -0x1e0(%rbp), %rsi
movq -0x1d8(%rbp), %rdx
addq %rsi, %rdx
leaq -0xe8(%rbp), %rdi
callq 0x4d4a
leaq -0xe8(%rbp), %rdx
movq -0x30(%rbp), %rdi
movq %rbx, %rsi
callq 0x147d2
movq -0xe8(%rbp), %rdi
cmpq %r14, %rdi
je 0x1451a
movq -0xd8(%rbp), %rsi
incq %rsi
callq 0x3230
movq -0x30(%rbp), %rax
cmpb $0x0, 0x10(%rax)
je 0x145d1
movq %rax, %rcx
movq 0x8(%rax), %rbx
movq (%rbx), %rax
movq %rax, 0x8(%rcx)
movq %rbx, %rdi
callq 0x4420
movl $0x38, %esi
movq %rbx, %rdi
callq 0x3230
leaq -0x208(%rbp), %rdi
callq 0x4816
addq $0x258, %rsp            # imm = 0x258
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x50, %edi
callq 0x3120
movq %rax, %r14
leaq -0x118(%rbp), %r12
movq %r12, -0x10(%r12)
leaq 0x7364(%rip), %rsi      # 0x1b8ed
leaq 0x7376(%rip), %rdx      # 0x1b906
leaq -0x128(%rbp), %rdi
callq 0x433a
movb $0x1, %bl
leaq -0x128(%rbp), %rcx
movq %r14, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x5470
xorl %ebx, %ebx
leaq 0xe7b8(%rip), %rsi      # 0x22d78
leaq -0xefe1(%rip), %rdx     # 0x55e6
movq %r14, %rdi
callq 0x33d0
jmp 0x14637
movl $0x50, %edi
callq 0x3120
movq %rax, %r14
leaq -0xf8(%rbp), %r12
movq %r12, -0x10(%r12)
leaq 0x7316(%rip), %rsi      # 0x1b907
leaq 0x733a(%rip), %rdx      # 0x1b932
leaq -0x108(%rbp), %rdi
callq 0x433a
movb $0x1, %bl
leaq -0x108(%rbp), %rcx
movq %r14, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x5470
xorl %ebx, %ebx
leaq 0xe750(%rip), %rsi      # 0x22d78
leaq -0xf049(%rip), %rdx     # 0x55e6
movq %r14, %rdi
callq 0x33d0
movq %rax, %r15
movq -0x108(%rbp), %rdi
cmpq %r12, %rdi
je 0x14676
movq -0xf8(%rbp), %rsi
jmp 0x14667
jmp 0x14671
movq %rax, %r15
movq -0x128(%rbp), %rdi
cmpq %r12, %rdi
je 0x14676
movq -0x118(%rbp), %rsi
incq %rsi
callq 0x3230
jmp 0x14676
movq %rax, %r15
movb $0x1, %bl
testb %bl, %bl
je 0x147be
movq %r14, %rdi
callq 0x31a0
jmp 0x147be
movq %rax, %r15
movq -0xe8(%rbp), %rdi
cmpq %r14, %rdi
je 0x147be
movq -0xd8(%rbp), %rsi
jmp 0x1479a
movq %rax, %r15
leaq -0x278(%rbp), %rdi
jmp 0x147b9
movq %rax, %r15
movq -0x250(%rbp), %rdi
cmpq %r12, %rdi
je 0x146dc
movq -0x240(%rbp), %rsi
incq %rsi
callq 0x3230
jmp 0x146dc
movq %rax, %r15
movq -0x270(%rbp), %rdi
cmpq %rbx, %rdi
je 0x147be
movq -0x260(%rbp), %rsi
jmp 0x1479a
jmp 0x147aa
jmp 0x147aa
jmp 0x147aa
movq %rax, %r15
leaq -0x198(%rbp), %rdi
callq 0x4816
jmp 0x147b2
movq %rax, %r15
movq -0x170(%rbp), %rdi
leaq -0x160(%rbp), %rax
cmpq %rax, %rdi
je 0x14745
movq -0x160(%rbp), %rsi
incq %rsi
callq 0x3230
jmp 0x14745
movq %rax, %r15
movq -0x190(%rbp), %rdi
cmpq -0xc8(%rbp), %rdi
je 0x147b2
movq -0x180(%rbp), %rsi
incq %rsi
callq 0x3230
jmp 0x147b2
movq %rax, %r15
movq -0xc0(%rbp), %rdi
cmpq %r12, %rdi
je 0x14789
movq -0xb0(%rbp), %rsi
incq %rsi
callq 0x3230
jmp 0x14789
movq %rax, %r15
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x147be
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x3230
jmp 0x147be
jmp 0x147aa
jmp 0x147aa
jmp 0x147aa
movq %rax, %r15
jmp 0x147be
movq %rax, %r15
leaq -0xc0(%rbp), %rdi
callq 0x4816
leaq -0x208(%rbp), %rdi
callq 0x4816
movq %r15, %rdi
callq 0x33f0