// File: /workspace/github_cpp_makefile_star2_O3/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 0x18d98
subq %rbx, %r13
je 0x17c75
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 0x18f20
incq %r14
cmpq %r14, %r13
jne 0x17c4f
movq -0x170(%rbp), %rax
cmpq -0x190(%rbp), %rax
je 0x17dbc
leaq -0x1a0(%rbp), %r13
leaq -0xa8(%rbp), %r14
leaq 0x3c3a(%rip), %rbx      # 0x1b8d8
movq -0x168(%rbp), %rdi
cmpq %rdi, %rax
je 0x17cb4
movq -0x8(%rax), %r12
addq $-0x8, %rax
jmp 0x17d03
movq -0x158(%rbp), %rax
movq -0x8(%rax), %rax
movq 0x1f8(%rax), %r12
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)
movl $0x1f8, %ecx            # imm = 0x1F8
addq %rcx, %rax
movq %rax, -0x170(%rbp)
movl 0x8(%r12), %ecx
addl $-0xc, %ecx
cmpl $0xd, %ecx
ja 0x17d5c
movslq (%rbx,%rcx,4), %rcx
addq %rbx, %rcx
jmpq *%rcx
movl 0x78(%r12), %ecx
cmpl $0x1c, %ecx
je 0x18031
cmpl $0x14, %ecx
je 0x180e7
cmpl $0x1, %ecx
jne 0x17daf
jmp 0x18059
movq 0x10(%r12), %rcx
movq 0x18(%r12), %rdx
movq %rdx, %rsi
subq %rcx, %rsi
cmpq $0x9, %rsi
jb 0x17d66
jmp 0x18009
movq 0x10(%r12), %rcx
movq 0x18(%r12), %rdx
cmpq %rcx, %rdx
je 0x17daf
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 0x18f20
incq %rbx
movq 0x18(%r12), %rax
subq 0x10(%r12), %rax
sarq $0x3, %rax
cmpq %rax, %rbx
jb 0x17d6d
movq -0x170(%rbp), %rax
leaq 0x3b29(%rip), %rbx      # 0x1b8d8
cmpq -0x190(%rbp), %rax
jne 0x17c9e
movq -0x30(%rbp), %r12
leaq 0x10(%r12), %rax
movq %rax, (%r12)
leaq 0x34fe(%rip), %rsi      # 0x1b2ce
leaq 0x34fa(%rip), %rdx      # 0x1b2d1
movq %r12, %rdi
callq 0x4336
jmp 0x1820e
movq (%r12), %rax
movq %r12, %rdi
xorl %esi, %esi
callq *0x18(%rax)
cmpl $0x1, 0x78(%rax)
jne 0x1822f
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 0x4d52
leaq -0xa8(%rbp), %rdi
leaq -0x128(%rbp), %rdx
movq %rbx, %rsi
callq 0x442e
movq -0x30(%rbp), %r12
movq -0x128(%rbp), %rdi
cmpq %r14, %rdi
je 0x17e65
movq -0x118(%rbp), %rsi
incq %rsi
callq 0x3230
leaq 0x10(%r12), %rax
movq %rax, (%r12)
movq -0x80(%rbp), %rsi
movq -0x78(%rbp), %rdx
addq %rsi, %rdx
movq %r12, %rdi
callq 0x4d52
jmp 0x180d6
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 0x4d52
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
movq -0x30(%rbp), %r12
je 0x1810f
movq %rax, -0xc8(%rbp)
movq -0x98(%rbp), %rax
movq %rax, -0xb8(%rbp)
jmp 0x18117
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 0x4d52
leaq -0xa8(%rbp), %rdi
leaq -0x108(%rbp), %rdx
movq %rbx, %rsi
callq 0x442e
movq -0x30(%rbp), %r12
movq -0x108(%rbp), %rdi
cmpq %r14, %rdi
je 0x17f6e
movq -0xf8(%rbp), %rsi
incq %rsi
callq 0x3230
leaq 0x10(%r12), %rax
movq %rax, (%r12)
movq -0x80(%rbp), %rsi
movq -0x78(%rbp), %rdx
addq %rsi, %rdx
movq %r12, %rdi
callq 0x4d52
jmp 0x180d6
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 0x4d52
movl 0x80(%rbx), %eax
movl %eax, -0x80(%rbp)
movq 0x78(%rbx), %rax
movq %rax, -0x88(%rbp)
movq -0x30(%rbp), %r12
leaq 0x10(%r12), %rax
movq %rax, (%r12)
movq -0xa8(%rbp), %rcx
cmpq %r14, %rcx
je 0x181e3
movq %rcx, (%r12)
movq -0x98(%rbp), %rax
movq %rax, 0x10(%r12)
jmp 0x181ea
movq -0x30(%rbp), %r12
leaq 0x10(%r12), %rax
movq %rax, (%r12)
leaq 0x3676(%rip), %rsi      # 0x1b693
leaq 0x3672(%rip), %rdx      # 0x1b696
movq %r12, %rdi
callq 0x4336
jmp 0x1820e
movq -0x30(%rbp), %r12
leaq 0x10(%r12), %rax
movq %rax, (%r12)
leaq 0x3c26(%rip), %rsi      # 0x1bc6b
leaq 0x3c25(%rip), %rdx      # 0x1bc71
movq %r12, %rdi
callq 0x4336
jmp 0x1820e
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 0x4d52
leaq -0xa8(%rbp), %rdi
leaq -0xe8(%rbp), %rdx
movq %rbx, %rsi
callq 0x442e
movq -0x30(%rbp), %r12
movq -0xe8(%rbp), %rdi
cmpq %r14, %rdi
je 0x180ba
movq -0xd8(%rbp), %rsi
incq %rsi
callq 0x3230
leaq 0x10(%r12), %rax
movq %rax, (%r12)
movq -0x80(%rbp), %rsi
movq -0x78(%rbp), %rdx
addq %rsi, %rdx
movq %r12, %rdi
callq 0x4d52
leaq -0xa8(%rbp), %rdi
callq 0x4824
jmp 0x1820e
movq -0x30(%rbp), %r12
leaq 0x10(%r12), %rax
movq %rax, (%r12)
leaq 0x359c(%rip), %rsi      # 0x1b697
leaq 0x3598(%rip), %rdx      # 0x1b69a
movq %r12, %rdi
callq 0x4336
jmp 0x1820e
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 0x191f8
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 0x4d52
leaq -0xa8(%rbp), %rdi
leaq -0x148(%rbp), %rdx
movq %rbx, %rsi
callq 0x442e
movq -0x148(%rbp), %rdi
cmpq %r15, %rdi
je 0x1819e
movq -0x138(%rbp), %rsi
incq %rsi
callq 0x3230
leaq 0x10(%r12), %rax
movq %rax, (%r12)
movq -0x80(%rbp), %rsi
movq -0x78(%rbp), %rdx
addq %rsi, %rdx
movq %r12, %rdi
callq 0x4d52
leaq -0xa8(%rbp), %rdi
callq 0x4824
movq -0xc8(%rbp), %rdi
cmpq %r14, %rdi
je 0x1820e
movq -0xb8(%rbp), %rsi
incq %rsi
callq 0x3230
jmp 0x1820e
movups (%r14), %xmm0
movups %xmm0, (%rax)
leaq -0xa8(%rbp), %rdi
movq 0x8(%rdi), %rax
movq %rax, 0x8(%r12)
movq %r14, (%rdi)
movq $0x0, 0x8(%rdi)
movb $0x0, 0x10(%rdi)
callq 0x191f8
leaq -0x1a0(%rbp), %rdi
callq 0x18a7e
movq %r12, %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), %r15
movq %r15, -0x10(%r15)
leaq 0x3a11(%rip), %rsi      # 0x1bc5f
leaq 0x3a15(%rip), %rdx      # 0x1bc6a
leaq -0x1c0(%rbp), %rdi
callq 0x4336
movb $0x1, %r12b
leaq -0x1c0(%rbp), %rcx
movq %r14, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x5470
xorl %r12d, %r12d
leaq 0xaaf1(%rip), %rsi      # 0x22d78
leaq -0x12ca8(%rip), %rdx    # 0x55e6
movq %r14, %rdi
callq 0x33d0
jmp 0x18367
movq %rax, %rbx
movq -0xe8(%rbp), %rdi
cmpq %r14, %rdi
je 0x183a9
movq -0xd8(%rbp), %rsi
jmp 0x1838e
jmp 0x183a6
jmp 0x183a6
jmp 0x183a6
jmp 0x183a6
movq %rax, %rbx
leaq -0xa8(%rbp), %rdi
callq 0x4824
jmp 0x18304
movq %rax, %rbx
movq -0x148(%rbp), %rdi
cmpq %r15, %rdi
je 0x18304
movq -0x138(%rbp), %rsi
incq %rsi
callq 0x3230
jmp 0x18304
jmp 0x18367
movq %rax, %rbx
movq -0xc8(%rbp), %rdi
cmpq %r14, %rdi
je 0x183a9
movq -0xb8(%rbp), %rsi
jmp 0x1838e
movq %rax, %rbx
movq -0x108(%rbp), %rdi
cmpq %r14, %rdi
je 0x183a9
movq -0xf8(%rbp), %rsi
jmp 0x1838e
movq %rax, %rbx
movq -0x1c0(%rbp), %rdi
cmpq %r15, %rdi
je 0x18353
movq -0x1b0(%rbp), %rsi
incq %rsi
callq 0x3230
testb %r12b, %r12b
jne 0x1835d
jmp 0x183a9
movq %rax, %rbx
movq %r14, %rdi
callq 0x31a0
jmp 0x183a9
movq %rax, %rbx
leaq -0xa8(%rbp), %rdi
callq 0x4824
jmp 0x183a9
movq %rax, %rbx
movq -0x128(%rbp), %rdi
cmpq %r14, %rdi
je 0x183a9
movq -0x118(%rbp), %rsi
incq %rsi
callq 0x3230
jmp 0x183a9
jmp 0x183a6
jmp 0x183a6
jmp 0x183a6
jmp 0x183a6
jmp 0x183a6
jmp 0x183a6
jmp 0x183a6
movq %rax, %rbx
leaq -0x1a0(%rbp), %rdi
callq 0x18a7e
movq %rbx, %rdi
callq 0x33f0
nop