// File: /workspace/github_cpp_makefile_star2_O3/RuiDGPires[P]CrimLang/src/semantic_analiser.cpp
// Function: sc_Tracker::func_call(crl::Node*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void _sc_Tracker::func_call(crl::Node *node, std::string annotation){
	size_t size = node->children.size();
	std::string func_name = get_token(node->get_child(0)).str;
	Context::Item item = this->context->seek(func_name);

	ASSERT(item.type == Context::Item::Type::FUNC || item.type == Context::Item::Type::CAS, "'" + func_name + "' is not a function");

	ASSERT(item.subtype == annotation, "Return type does not match expression type");
	
	ASSERT(item.args.size() == size - 1, "Functions do not match");

	node->argc = size - 1;

	for (size_t i = 1; i < size; i++){
		crl::Node *arg = node->get_child(i);
		ASSERT(arg->type == crl::Node::Type::ARG, "Argument isn't of type ARG");
		if (item.args[i-1].second){
			ASSERT(arg->annotation == "ref", "Mutable function argments must be passed as references");
			Context::Item aux = this->context->seek(get_token(arg->get_child(0)).str);
			ASSERT(aux.type == Context::Item::Type::VAR, "No variable with this name");
			ASSERT(aux._mutable, "Variable must be mutable to be passed by reference");
			ASSERT(aux.subtype == item.args[i-1].first, "Passed variable type does not match function argument type");
		}else{
			this->expression(arg->get_child(0), item.args[i-1].first);
			arg->annotation = item.args[i-1].first;
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x2a8, %rsp            # imm = 0x2A8
movq %rdx, %r15
movq %rsi, %rbx
movq %rdi, -0x30(%rbp)
movq 0x18(%rsi), %rax
subq 0x10(%rsi), %rax
movq %rax, -0x38(%rbp)
movq (%rsi), %rax
movq %rsi, %rdi
xorl %esi, %esi
callq *0x18(%rax)
movq %rax, %r12
leaq -0x250(%rbp), %r14
movq %r14, -0x10(%r14)
movq 0x58(%rax), %rsi
movq 0x60(%rax), %rdx
addq %rsi, %rdx
leaq -0x260(%rbp), %r13
movq %r13, %rdi
callq 0x4d52
movl 0x80(%r12), %eax
movl %eax, 0x28(%r13)
movq 0x78(%r12), %rax
movq %rax, 0x20(%r13)
leaq -0x48(%rbp), %rcx
movq %rcx, -0x10(%rcx)
movq (%r13), %rax
cmpq %r14, %rax
je 0x16ea0
movq %rax, -0x58(%rbp)
movq -0x250(%rbp), %rax
movq %rax, -0x48(%rbp)
jmp 0x16ea7
movups (%r14), %xmm0
movups %xmm0, (%rcx)
leaq -0x260(%rbp), %rdi
movq 0x8(%rdi), %rax
movq %rax, -0x50(%rbp)
movq %r14, (%rdi)
movq $0x0, 0x8(%rdi)
movb $0x0, 0x10(%rdi)
callq 0x191f8
movq -0x30(%rbp), %rax
movq 0x8(%rax), %r12
leaq -0xe0(%rbp), %r14
movq %r14, -0x10(%r14)
movq -0x58(%rbp), %rsi
movq -0x50(%rbp), %rdx
addq %rsi, %rdx
leaq -0xf0(%rbp), %rdi
callq 0x4d52
leaq -0x260(%rbp), %rdi
leaq -0xf0(%rbp), %rdx
movq %r12, %rsi
callq 0x442e
movq -0xf0(%rbp), %rdi
cmpq %r14, %rdi
je 0x16f25
movq -0xe0(%rbp), %rsi
incq %rsi
callq 0x3230
movl -0x260(%rbp), %eax
decl %eax
cmpl $0x2, %eax
jae 0x1749b
movq -0x230(%rbp), %rdx
cmpq 0x8(%r15), %rdx
jne 0x1742f
testq %rdx, %rdx
je 0x16f63
movq (%r15), %rsi
movq -0x238(%rbp), %rdi
callq 0x3240
testl %eax, %eax
jne 0x1742f
movq -0x38(%rbp), %rdx
sarq $0x3, %rdx
movq -0x200(%rbp), %rcx
subq -0x208(%rbp), %rcx
sarq $0x3, %rcx
movabsq $-0x3333333333333333, %rax # imm = 0xCCCCCCCCCCCCCCCD
imulq %rcx, %rax
leaq -0x1(%rdx), %rcx
cmpq %rcx, %rax
jne 0x174f7
movl %eax, 0x50(%rbx)
movq %rdx, -0x38(%rbp)
cmpq $0x2, %rdx
jb 0x171dc
movl $0x1, %r15d
xorl %r14d, %r14d
movq %rbx, -0xa0(%rbp)
movq (%rbx), %rax
movq %rbx, %rdi
movl %r15d, %esi
callq *0x18(%rax)
movq %rax, %r12
cmpl $0x12, 0x8(%rax)
jne 0x17213
movq -0x208(%rbp), %rax
cmpb $0x1, 0x20(%rax,%r14)
jne 0x17085
movq %r12, %rdi
addq $0x30, %rdi
leaq 0x452d(%rip), %rsi      # 0x1b520
callq 0x30a0
testl %eax, %eax
jne 0x173c3
movq -0x30(%rbp), %rax
movq 0x8(%rax), %r13
movq (%r12), %rax
movq %r12, %rdi
xorl %esi, %esi
callq *0x18(%rax)
leaq -0xc0(%rbp), %rbx
movq %rax, %r12
movq %rbx, -0xd0(%rbp)
movq 0x58(%rax), %rsi
movq 0x60(%rax), %rdx
addq %rsi, %rdx
leaq -0xd0(%rbp), %rdi
callq 0x4d52
movl 0x80(%r12), %eax
movl %eax, 0x18(%rbx)
movq 0x78(%r12), %rax
movq %rax, 0x10(%rbx)
leaq -0x88(%rbp), %r12
movq %r12, -0x98(%rbp)
movq -0xd0(%rbp), %rax
cmpq %rbx, %rax
je 0x170fc
movq %rax, -0x98(%rbp)
movq -0xc0(%rbp), %rax
movq %rax, -0x88(%rbp)
jmp 0x17104
movq (%r12), %rax
movq %r12, %rdi
xorl %esi, %esi
callq *0x18(%rax)
movq %rax, %r13
movq -0x208(%rbp), %rax
leaq -0x68(%rbp), %rcx
movq %rcx, -0x78(%rbp)
movq (%rax,%r14), %rsi
movq 0x8(%rax,%r14), %rdx
addq %rsi, %rdx
leaq -0x78(%rbp), %rdi
callq 0x4d52
movq -0x30(%rbp), %rdi
movq %r13, %rsi
leaq -0x78(%rbp), %rdx
callq 0x14bc2
movq -0x78(%rbp), %rdi
leaq -0x68(%rbp), %rax
cmpq %rax, %rdi
je 0x170e1
movq -0x68(%rbp), %rsi
incq %rsi
callq 0x3230
movq -0x208(%rbp), %rsi
addq %r14, %rsi
addq $0x30, %r12
movq %r12, %rdi
callq 0x3150
jmp 0x171cb
movups (%rbx), %xmm0
movups %xmm0, (%r12)
movq -0xc8(%rbp), %rax
movq %rax, -0x90(%rbp)
movq %rbx, -0xd0(%rbp)
movq $0x0, -0xc8(%rbp)
movb $0x0, -0xc0(%rbp)
leaq -0x2d0(%rbp), %rdi
movq %r13, %rsi
leaq -0x98(%rbp), %rdx
callq 0x442e
movq -0x98(%rbp), %rdi
cmpq %r12, %rdi
movq -0xa0(%rbp), %rbx
je 0x17163
movq -0x88(%rbp), %rsi
incq %rsi
callq 0x3230
leaq -0xd0(%rbp), %rdi
callq 0x191f8
cmpl $0x3, -0x2d0(%rbp)
jne 0x17357
cmpb $0x0, -0x280(%rbp)
je 0x172eb
movq -0x208(%rbp), %rax
movq -0x2a0(%rbp), %rdx
cmpq 0x8(%rax,%r14), %rdx
jne 0x1727f
testq %rdx, %rdx
je 0x171bf
movq (%rax,%r14), %rsi
movq -0x2a8(%rbp), %rdi
callq 0x3240
testl %eax, %eax
jne 0x1727f
leaq -0x2d0(%rbp), %rdi
callq 0x4824
incq %r15
addq $0x28, %r14
cmpq %r15, -0x38(%rbp)
jne 0x16fb9
leaq -0x260(%rbp), %rdi
callq 0x4824
movq -0x58(%rbp), %rdi
leaq -0x48(%rbp), %rax
cmpq %rax, %rdi
je 0x17201
movq -0x48(%rbp), %rsi
incq %rsi
callq 0x3230
addq $0x2a8, %rsp            # imm = 0x2A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x50, %edi
callq 0x3120
movq %rax, %r14
leaq -0x1a0(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x4952(%rip), %rsi      # 0x1bb84
leaq 0x4965(%rip), %rdx      # 0x1bb9e
leaq -0x1b0(%rbp), %rdi
callq 0x4336
movb $0x1, %r12b
leaq -0x1b0(%rbp), %rcx
movq %r14, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x5470
xorl %r12d, %r12d
leaq 0xbb0d(%rip), %rsi      # 0x22d78
leaq -0x11c8c(%rip), %rdx    # 0x55e6
movq %r14, %rdi
callq 0x33d0
jmp 0x175bd
movl $0x50, %edi
callq 0x3120
movq %rax, %r14
leaq -0x120(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x4986(%rip), %rsi      # 0x1bc24
leaq 0x49b9(%rip), %rdx      # 0x1bc5e
leaq -0x130(%rbp), %rdi
callq 0x4336
movb $0x1, %r12b
leaq -0x130(%rbp), %rcx
movq %r14, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x5470
xorl %r12d, %r12d
leaq 0xbaa1(%rip), %rsi      # 0x22d78
leaq -0x11cf8(%rip), %rdx    # 0x55e6
movq %r14, %rdi
callq 0x33d0
jmp 0x175bd
movl $0x50, %edi
callq 0x3120
movq %rax, %r14
leaq -0x140(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x48e7(%rip), %rsi      # 0x1bbf1
leaq 0x4912(%rip), %rdx      # 0x1bc23
leaq -0x150(%rbp), %rdi
callq 0x4336
movb $0x1, %r12b
leaq -0x150(%rbp), %rcx
movq %r14, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x5470
xorl %r12d, %r12d
leaq 0xba35(%rip), %rsi      # 0x22d78
leaq -0x11d64(%rip), %rdx    # 0x55e6
movq %r14, %rdi
callq 0x33d0
jmp 0x175bd
movl $0x50, %edi
callq 0x3120
movq %rax, %r14
leaq -0x160(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x4860(%rip), %rsi      # 0x1bbd6
leaq 0x4873(%rip), %rdx      # 0x1bbf0
leaq -0x170(%rbp), %rdi
callq 0x4336
movb $0x1, %r12b
leaq -0x170(%rbp), %rcx
movq %r14, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x5470
xorl %r12d, %r12d
leaq 0xb9c9(%rip), %rsi      # 0x22d78
leaq -0x11dd0(%rip), %rdx    # 0x55e6
movq %r14, %rdi
callq 0x33d0
jmp 0x175bd
movl $0x50, %edi
callq 0x3120
movq %rax, %r14
leaq -0x180(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x47bd(%rip), %rsi      # 0x1bb9f
leaq 0x47ec(%rip), %rdx      # 0x1bbd5
leaq -0x190(%rbp), %rdi
callq 0x4336
movb $0x1, %r12b
leaq -0x190(%rbp), %rcx
movq %r14, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x5470
xorl %r12d, %r12d
leaq 0xb95d(%rip), %rsi      # 0x22d78
leaq -0x11e3c(%rip), %rdx    # 0x55e6
movq %r14, %rdi
callq 0x33d0
jmp 0x175bd
movl $0x50, %edi
callq 0x3120
movq %rax, %r14
leaq -0x1e0(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x46f4(%rip), %rsi      # 0x1bb42
leaq 0x4717(%rip), %rdx      # 0x1bb6c
leaq -0x1f0(%rbp), %rdi
callq 0x4336
movb $0x1, %r12b
leaq -0x1f0(%rbp), %rcx
movq %r14, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x5470
xorl %r12d, %r12d
leaq 0xb8f1(%rip), %rsi      # 0x22d78
leaq -0x11ea8(%rip), %rdx    # 0x55e6
movq %r14, %rdi
callq 0x33d0
jmp 0x175bd
movl $0x50, %edi
callq 0x3120
movq %rax, %r14
leaq 0x3da4(%rip), %rsi      # 0x1b253
leaq -0x2d0(%rbp), %rdi
leaq -0x58(%rbp), %rdx
callq 0x40f1
leaq 0x4668(%rip), %rsi      # 0x1bb2e
leaq -0x2d0(%rbp), %rdi
callq 0x3430
leaq -0x100(%rbp), %r12
movq %r12, -0x10(%r12)
movq (%rax), %rcx
movq %rax, %rdx
addq $0x10, %rdx
cmpq %rdx, %rcx
jne 0x17560
movups (%rdx), %xmm0
movups %xmm0, (%r12)
jmp 0x17571
movl $0x50, %edi
callq 0x3120
movq %rax, %r14
leaq -0x1c0(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x4657(%rip), %rsi      # 0x1bb6d
leaq 0x4666(%rip), %rdx      # 0x1bb83
leaq -0x1d0(%rbp), %rdi
callq 0x4336
movb $0x1, %r12b
leaq -0x1d0(%rbp), %rcx
movq %r14, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x5470
xorl %r12d, %r12d
leaq 0xb829(%rip), %rsi      # 0x22d78
leaq -0x11f70(%rip), %rdx    # 0x55e6
movq %r14, %rdi
callq 0x33d0
jmp 0x175bd
movq %rcx, -0x110(%rbp)
movq (%rdx), %rcx
movq %rcx, -0x100(%rbp)
movq 0x8(%rax), %rsi
leaq -0x110(%rbp), %rcx
movq %rsi, 0x8(%rcx)
movq %rdx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movb $0x1, %r15b
movq %r14, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x5470
xorl %r15d, %r15d
leaq 0xb7ca(%rip), %rsi      # 0x22d78
leaq -0x11fcf(%rip), %rdx    # 0x55e6
movq %r14, %rdi
callq 0x33d0
movq %rax, %rbx
movq -0x110(%rbp), %rdi
cmpq %r12, %rdi
je 0x175db
movq -0x100(%rbp), %rsi
incq %rsi
callq 0x3230
leaq -0x2c0(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x175fa
movq -0x2c0(%rbp), %rsi
incq %rsi
callq 0x3230
testb %r15b, %r15b
jne 0x1778e
jmp 0x177c9
movq %rax, %rbx
leaq -0x2c0(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1778e
movq -0x2c0(%rbp), %rsi
incq %rsi
callq 0x3230
jmp 0x1778e
movq %rax, %rbx
movq -0x1d0(%rbp), %rdi
cmpq %r15, %rdi
je 0x17784
movq -0x1c0(%rbp), %rsi
jmp 0x1777c
jmp 0x1778b
jmp 0x1778b
movq %rax, %rbx
movq -0x1f0(%rbp), %rdi
cmpq %r15, %rdi
je 0x17784
movq -0x1e0(%rbp), %rsi
jmp 0x1777c
jmp 0x1778b
movq %rax, %rbx
movq -0xf0(%rbp), %rdi
cmpq %r14, %rdi
je 0x177d5
movq -0xe0(%rbp), %rsi
incq %rsi
callq 0x3230
jmp 0x177d5
movq %rax, %rbx
jmp 0x177d5
movq %rax, %rbx
movq -0x190(%rbp), %rdi
cmpq %r15, %rdi
je 0x17784
movq -0x180(%rbp), %rsi
jmp 0x1777c
jmp 0x1778b
movq %rax, %rbx
movq -0x170(%rbp), %rdi
cmpq %r15, %rdi
je 0x17725
movq -0x160(%rbp), %rsi
jmp 0x1771d
jmp 0x1772c
movq %rax, %rbx
movq -0x150(%rbp), %rdi
cmpq %r15, %rdi
je 0x17725
movq -0x140(%rbp), %rsi
jmp 0x1771d
jmp 0x1772c
movq %rax, %rbx
movq -0x130(%rbp), %rdi
cmpq %r15, %rdi
je 0x17725
movq -0x120(%rbp), %rsi
incq %rsi
callq 0x3230
testb %r12b, %r12b
jne 0x1772f
jmp 0x17737
movq %rax, %rbx
movq %r14, %rdi
callq 0x31a0
leaq -0x2d0(%rbp), %rdi
callq 0x4824
jmp 0x177c9
movq %rax, %rbx
movq -0x78(%rbp), %rdi
leaq -0x68(%rbp), %rax
cmpq %rax, %rdi
je 0x177c9
movq -0x68(%rbp), %rsi
incq %rsi
callq 0x3230
jmp 0x177c9
movq %rax, %rbx
movq -0x1b0(%rbp), %rdi
cmpq %r15, %rdi
je 0x17784
movq -0x1a0(%rbp), %rsi
incq %rsi
callq 0x3230
testb %r12b, %r12b
jne 0x1778e
jmp 0x177c9
movq %rax, %rbx
movq %r14, %rdi
callq 0x31a0
jmp 0x177c9
movq %rax, %rbx
movq -0x98(%rbp), %rdi
cmpq %r12, %rdi
je 0x177b6
movq -0x88(%rbp), %rsi
incq %rsi
callq 0x3230
leaq -0xd0(%rbp), %rdi
callq 0x191f8
jmp 0x177c9
jmp 0x177c6
movq %rax, %rbx
leaq -0x260(%rbp), %rdi
callq 0x4824
leaq -0x48(%rbp), %rax
movq -0x58(%rbp), %rdi
cmpq %rax, %rdi
je 0x177ee
movq -0x48(%rbp), %rsi
incq %rsi
callq 0x3230
movq %rbx, %rdi
callq 0x33f0