// File: /workspace/github_cpp_makefile_star2_O1/RuiDGPires[P]CrimLang/src/semantic_analiser.cpp
// Function: sc_Tracker::expression_get_type[abi:cxx11](crl::Node*)
std::string _sc_Tracker::expression_get_type(crl::Node *node){
	size_t size = node->children.size();

	std::stack<crl::Node *> stack;

	for (size_t i = 0; i < size; i++){
		stack.push(node->get_child(i));
	}

	while(!stack.empty()){
		crl::Node *current = stack.top();
		stack.pop();
		switch (current->type){
		case crl::Node::Type::CALL:
			{
			std::string func_name = get_token(node->get_child(0)).str;
			Context::Item item = this->context->seek(func_name);
			return item.subtype;
			}
			break;
			
		case crl::Node::Type::DEC:
		case crl::Node::Type::INC:
			if (((crl::Leaf *) current->get_child(0))->token.type == crl::Token::Type::IDENT){
				Context::Item item = this->context->seek(((crl::Leaf *) current->get_child(0))->token.str);
				return item.subtype;
			}else ASSERT(false, "Unkown type");
			break;
		case crl::Node::Type::CAST:
			return get_token(current->get_child(1)).str;
			break;
		case crl::Node::Type::VECTOR:
			{
			Context::Item item = this->context->seek(((crl::Leaf *) current->get_child(0))->token.str);
			return item.subtype;
			}
			break;
		case crl::Node::Type::LEAF:
			if (((crl::Leaf *) current)->token.type == crl::Token::Type::IDENT){
				Context::Item item = this->context->seek(((crl::Leaf *) current)->token.str);
				return item.subtype;
			}else if (((crl::Leaf *) current)->token.type == crl::Token::Type::INT);
			else if (((crl::Leaf *) current)->token.type == crl::Token::Type::DEC)
				return "f32";
			else if (((crl::Leaf *) current)->token.type == crl::Token::Type::STRING)
				return "string";
			break;

		case crl::Node::Type::COMPARISON:
			if (current->children.size() > 1){
				return "u32";
				break;
			}
		default:
			for (size_t i = 0; i < current->children.size(); i++)
				stack.push(current->get_child(i));
			break;
		}
	}
	return "i32"; // Default type
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x198, %rsp            # imm = 0x198
movq %rdx, %r15
movq %rsi, -0x38(%rbp)
movq %rdi, -0x30(%rbp)
movq 0x10(%rdx), %rbx
movq 0x18(%rdx), %r13
xorps %xmm0, %xmm0
leaq -0x1a0(%rbp), %rdi
movaps %xmm0, 0x40(%rdi)
movaps %xmm0, 0x30(%rdi)
movaps %xmm0, 0x20(%rdi)
movaps %xmm0, 0x10(%rdi)
movaps %xmm0, (%rdi)
xorl %esi, %esi
callq 0x18e58
subq %rbx, %r13
je 0x17d97
sarq $0x3, %r13
cmpq $0x1, %r13
adcq $0x0, %r13
xorl %r14d, %r14d
leaq -0x1a0(%rbp), %rbx
leaq -0xa8(%rbp), %r12
movq (%r15), %rax
movq %r15, %rdi
movl %r14d, %esi
callq *0x18(%rax)
movq %rax, -0xa8(%rbp)
movq %rbx, %rdi
movq %r12, %rsi
callq 0x18fe0
incq %r14
cmpq %r14, %r13
jne 0x17d71
movq -0x170(%rbp), %rax
cmpq -0x190(%rbp), %rax
je 0x17ed4
leaq -0x1a0(%rbp), %r13
leaq -0xa8(%rbp), %r14
movq -0x168(%rbp), %rdi
movq %rax, %rcx
cmpq %rdi, %rax
jne 0x17ddb
movq -0x158(%rbp), %rcx
movq -0x8(%rcx), %rcx
movl $0x200, %edx            # imm = 0x200
addq %rdx, %rcx
movq -0x8(%rcx), %r12
cmpq %rdi, %rax
je 0x17dea
addq $-0x8, %rax
jmp 0x17e25
movl $0x200, %esi            # imm = 0x200
callq 0x3230
movq -0x158(%rbp), %rax
leaq -0x8(%rax), %rcx
movq %rcx, -0x158(%rbp)
movq -0x8(%rax), %rax
movq %rax, -0x168(%rbp)
leaq 0x200(%rax), %rcx
movq %rcx, -0x160(%rbp)
addq $0x1f8, %rax            # imm = 0x1F8
movq %rax, -0x170(%rbp)
movl 0x8(%r12), %eax
addl $-0xc, %eax
cmpl $0xd, %eax
ja 0x17e7e
leaq 0x3a58(%rip), %rcx      # 0x1b898
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl 0x78(%r12), %eax
cmpl $0x1c, %eax
je 0x18139
cmpl $0x14, %eax
je 0x181eb
cmpl $0x1, %eax
jne 0x17ec0
jmp 0x1815f
movq 0x18(%r12), %rax
subq 0x10(%r12), %rax
cmpq $0x9, %rax
jae 0x18113
movq 0x18(%r12), %rax
cmpq 0x10(%r12), %rax
je 0x17ec0
xorl %ebx, %ebx
movq (%r12), %rax
movq %r12, %rdi
movl %ebx, %esi
callq *0x18(%rax)
movq %rax, -0xa8(%rbp)
movq %r13, %rdi
movq %r14, %rsi
callq 0x18fe0
incq %rbx
movq 0x18(%r12), %rax
subq 0x10(%r12), %rax
sarq $0x3, %rax
cmpq %rax, %rbx
jb 0x17e8c
movq -0x170(%rbp), %rax
cmpq -0x190(%rbp), %rax
jne 0x17db9
movq -0x30(%rbp), %rbx
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
leaq 0x33e8(%rip), %rsi      # 0x1b2ce
leaq 0x33e4(%rip), %rdx      # 0x1b2d1
movq %rbx, %rdi
callq 0x433a
jmp 0x18311
movq (%r12), %rax
movq %r12, %rdi
xorl %esi, %esi
callq *0x18(%rax)
cmpl $0x1, 0x78(%rax)
jne 0x18332
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rbx
movq (%r12), %rax
movq %r12, %rdi
xorl %esi, %esi
callq *0x18(%rax)
leaq -0x118(%rbp), %r14
movq %r14, -0x10(%r14)
movq 0x58(%rax), %rsi
movq 0x60(%rax), %rdx
addq %rsi, %rdx
leaq -0x128(%rbp), %rdi
callq 0x4d4a
leaq -0xa8(%rbp), %rdi
leaq -0x128(%rbp), %rdx
movq %rbx, %rsi
callq 0x442e
movq -0x30(%rbp), %rbx
movq -0x128(%rbp), %rdi
cmpq %r14, %rdi
je 0x17f7b
movq -0x118(%rbp), %rsi
incq %rsi
callq 0x3230
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
movq -0x80(%rbp), %rsi
movq -0x78(%rbp), %rdx
addq %rsi, %rdx
movq %rbx, %rdi
callq 0x4d4a
jmp 0x181da
movq (%r15), %rax
movq %r15, %rdi
xorl %esi, %esi
callq *0x18(%rax)
movq %rax, %rbx
leaq -0x98(%rbp), %r15
movq %r15, -0x10(%r15)
movq 0x58(%rax), %rsi
movq 0x60(%rax), %rdx
addq %rsi, %rdx
leaq -0xa8(%rbp), %rdi
callq 0x4d4a
movl 0x80(%rbx), %eax
movl %eax, -0x80(%rbp)
movq 0x78(%rbx), %rax
movq %rax, -0x88(%rbp)
leaq -0xb8(%rbp), %r14
movq %r14, -0x10(%r14)
movq -0xa8(%rbp), %rax
cmpq %r15, %rax
je 0x18211
movq %rax, -0xc8(%rbp)
movq -0x98(%rbp), %rax
movq %rax, -0xb8(%rbp)
jmp 0x18219
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rbx
movq (%r12), %rax
movq %r12, %rdi
xorl %esi, %esi
callq *0x18(%rax)
leaq -0xf8(%rbp), %r14
movq %r14, -0x10(%r14)
movq 0x58(%rax), %rsi
movq 0x60(%rax), %rdx
addq %rsi, %rdx
leaq -0x108(%rbp), %rdi
callq 0x4d4a
leaq -0xa8(%rbp), %rdi
leaq -0x108(%rbp), %rdx
movq %rbx, %rsi
callq 0x442e
movq -0x108(%rbp), %rdi
cmpq %r14, %rdi
movq -0x30(%rbp), %rbx
je 0x1807e
movq -0xf8(%rbp), %rsi
incq %rsi
callq 0x3230
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
movq -0x80(%rbp), %rsi
movq -0x78(%rbp), %rdx
addq %rsi, %rdx
movq %rbx, %rdi
callq 0x4d4a
jmp 0x181da
movq (%r12), %rax
movq %r12, %rdi
movl $0x1, %esi
callq *0x18(%rax)
movq %rax, %rbx
leaq -0x98(%rbp), %r14
movq %r14, -0x10(%r14)
movq 0x58(%rax), %rsi
movq 0x60(%rax), %rdx
addq %rsi, %rdx
leaq -0xa8(%rbp), %rdi
callq 0x4d4a
movl 0x80(%rbx), %eax
movl %eax, -0x80(%rbp)
movq 0x78(%rbx), %rax
movq %rax, -0x88(%rbp)
movq -0x30(%rbp), %rbx
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
movq -0xa8(%rbp), %rcx
cmpq %r14, %rcx
je 0x182e7
movq %rcx, (%rbx)
movq -0x98(%rbp), %rax
movq %rax, 0x10(%rbx)
jmp 0x182ee
movq -0x30(%rbp), %rbx
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
leaq 0x356e(%rip), %rsi      # 0x1b693
leaq 0x356a(%rip), %rdx      # 0x1b696
movq %rbx, %rdi
callq 0x433a
jmp 0x18311
movq -0x30(%rbp), %rbx
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
leaq 0x3ae0(%rip), %rsi      # 0x1bc2b
leaq 0x3adf(%rip), %rdx      # 0x1bc31
movq %rbx, %rdi
callq 0x433a
jmp 0x18311
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rbx
leaq -0xd8(%rbp), %r14
movq %r14, -0x10(%r14)
movq 0x58(%r12), %rsi
movq 0x60(%r12), %rdx
addq %rsi, %rdx
leaq -0xe8(%rbp), %rdi
callq 0x4d4a
leaq -0xa8(%rbp), %rdi
leaq -0xe8(%rbp), %rdx
movq %rbx, %rsi
callq 0x442e
movq -0x30(%rbp), %rbx
movq -0xe8(%rbp), %rdi
cmpq %r14, %rdi
je 0x181c0
movq -0xd8(%rbp), %rsi
incq %rsi
callq 0x3230
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
movq -0x80(%rbp), %rsi
movq -0x78(%rbp), %rdx
addq %rsi, %rdx
movq %rbx, %rdi
callq 0x4d4a
leaq -0xa8(%rbp), %rdi
callq 0x4816
jmp 0x18311
movq -0x30(%rbp), %rbx
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
leaq 0x349a(%rip), %rsi      # 0x1b697
leaq 0x3496(%rip), %rdx      # 0x1b69a
movq %rbx, %rdi
callq 0x433a
jmp 0x18311
movups (%r15), %xmm0
movups %xmm0, (%r14)
leaq -0xa8(%rbp), %rdi
movq 0x8(%rdi), %rax
movq %rax, -0xc0(%rbp)
movq %r15, (%rdi)
movq $0x0, 0x8(%rdi)
movb $0x0, 0x10(%rdi)
callq 0x192b0
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rbx
leaq -0x138(%rbp), %r15
movq %r15, -0x10(%r15)
movq -0xc8(%rbp), %rsi
movq -0xc0(%rbp), %rdx
addq %rsi, %rdx
leaq -0x148(%rbp), %rdi
callq 0x4d4a
leaq -0xa8(%rbp), %rdi
leaq -0x148(%rbp), %rdx
movq %rbx, %rsi
callq 0x442e
movq -0x148(%rbp), %rdi
cmpq %r15, %rdi
je 0x182a0
movq -0x138(%rbp), %rsi
incq %rsi
callq 0x3230
movq -0x30(%rbp), %rbx
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
movq -0x80(%rbp), %rsi
movq -0x78(%rbp), %rdx
addq %rsi, %rdx
movq %rbx, %rdi
callq 0x4d4a
leaq -0xa8(%rbp), %rdi
callq 0x4816
movq -0xc8(%rbp), %rdi
cmpq %r14, %rdi
je 0x18311
movq -0xb8(%rbp), %rsi
incq %rsi
callq 0x3230
jmp 0x18311
movups (%r14), %xmm0
movups %xmm0, (%rax)
leaq -0xa8(%rbp), %rdi
movq 0x8(%rdi), %rax
movq %rax, 0x8(%rbx)
movq %r14, (%rdi)
movq $0x0, 0x8(%rdi)
movb $0x0, 0x10(%rdi)
callq 0x192b0
leaq -0x1a0(%rbp), %rdi
callq 0x18b52
movq %rbx, %rax
addq $0x198, %rsp            # imm = 0x198
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x50, %edi
callq 0x3120
movq %rax, %r14
leaq -0x1b0(%rbp), %r12
movq %r12, -0x10(%r12)
leaq 0x38cd(%rip), %rsi      # 0x1bc1f
leaq 0x38d1(%rip), %rdx      # 0x1bc2a
leaq -0x1c0(%rbp), %rdi
callq 0x433a
movb $0x1, %r15b
leaq -0x1c0(%rbp), %rcx
movq %r14, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x5470
xorl %r15d, %r15d
leaq 0xa9ed(%rip), %rsi      # 0x22d78
leaq -0x12dac(%rip), %rdx    # 0x55e6
movq %r14, %rdi
callq 0x33d0
jmp 0x18472
movq %rax, %rbx
movq -0xe8(%rbp), %rdi
cmpq %r14, %rdi
je 0x184b4
movq -0xd8(%rbp), %rsi
jmp 0x18499
jmp 0x184b1
jmp 0x184b1
jmp 0x184b1
jmp 0x184b1
movq %rax, %rbx
leaq -0xa8(%rbp), %rdi
callq 0x4816
jmp 0x18408
movq %rax, %rbx
movq -0x148(%rbp), %rdi
cmpq %r15, %rdi
je 0x18408
movq -0x138(%rbp), %rsi
incq %rsi
callq 0x3230
jmp 0x18408
jmp 0x18472
movq %rax, %rbx
movq -0xc8(%rbp), %rdi
cmpq %r14, %rdi
je 0x184b4
movq -0xb8(%rbp), %rsi
jmp 0x18499
movq %rax, %rbx
movq -0x108(%rbp), %rdi
cmpq %r14, %rdi
je 0x184b4
movq -0xf8(%rbp), %rsi
jmp 0x18499
movq %rax, %rbx
movq -0x1c0(%rbp), %rdi
cmpq %r12, %rdi
je 0x18463
movq -0x1b0(%rbp), %rsi
incq %rsi
callq 0x3230
jmp 0x18463
movq %rax, %rbx
movb $0x1, %r15b
testb %r15b, %r15b
je 0x184b4
movq %r14, %rdi
callq 0x31a0
jmp 0x184b4
movq %rax, %rbx
leaq -0xa8(%rbp), %rdi
callq 0x4816
jmp 0x184b4
movq %rax, %rbx
movq -0x128(%rbp), %rdi
cmpq %r14, %rdi
je 0x184b4
movq -0x118(%rbp), %rsi
incq %rsi
callq 0x3230
jmp 0x184b4
jmp 0x184b1
jmp 0x184b1
jmp 0x184b1
jmp 0x184b1
jmp 0x184b1
jmp 0x184b1
jmp 0x184b1
movq %rax, %rbx
leaq -0x1a0(%rbp), %rdi
callq 0x18b52
movq %rbx, %rdi
callq 0x33f0