// File: Nallantli[P]Rossa/main/rossa/node_parser/node_parser.cpp
// Function: node_parser_t::parseUnitNode(std::vector<node_scope_t, std::allocator<node_scope_t>>*)
ptr_node_t node_parser_t::parseUnitNode(std::vector<node_scope_t> *scopes)
{
	if (currentToken.type == NULL_TOK)
		return logErrorN(_UNEXPECTED_TERMINATION_, currentToken);

	ptr_node_t ret = nullptr;
	switch (currentToken.type)
	{
	case ';':
	case 0:
		return nullptr;
	case TOK_NUM:
	case TOK_IDF:
	case TOK_TRUE:
	case TOK_FALSE:
	case TOK_NIL:
	case TOK_STR_LIT:
	case '@':
	case '[':
	case '{':
	case TOK_NIL_NAME:
	case TOK_NUMBER:
	case TOK_STRING:
	case TOK_BOOLEAN:
	case TOK_ARRAY:
	case TOK_DICTIONARY:
	case TOK_OBJECT:
	case TOK_FUNCTION:
	case TOK_TYPE_NAME:
	case TOK_POINTER:
	case TOK_NO_PARAM_LAMBDA:
	case TOK_LAMBDA:
		ret = parseBaseNode(scopes);
		return parseTrailingNode(scopes, ret, true);
	case TOK_EXTERN_CALL:
		return parseExternCallNode(scopes);
	case TOK_CALL_OP:
		return parseCallOpNode(scopes);
	case TOK_ALLOC:
	case TOK_LENGTH:
	case TOK_CHARN:
	case TOK_CHARS:
	case TOK_PARSE:
		return parseCallBuiltNode(scopes);
	case TOK_NEW:
		return parseNewNode(scopes);
	case TOK_OPR:
		return parseUnOpNode(scopes);
	case TOK_EACH:
		return parseEachNode(scopes);
	case '(':
		nextToken();
		if ((ret = parseEquNode(scopes)))
		{
			if (currentToken.type != ')')
				return logErrorN(util::format(_EXPECTED_ERROR_, {")"}), currentToken);
			ret = std::make_shared<ParenNode>(*scopes, ret, currentToken);
			nextToken();
			return parseTrailingNode(scopes, ret, true);
		}
		return logErrorN(_FAILURE_PARSE_CODE_, currentToken);
	default:
		return logErrorN(_FAILURE_PARSE_CODE_, currentToken);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x250, %rsp            # imm = 0x250
movq %rdi, -0x1b0(%rbp)
movq %rdi, %rax
movq %rax, -0x1a8(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x1a0(%rbp)
cmpl $0x0, 0xd0(%rax)
jne 0x44cc1
leaq -0x39(%rbp), %rdi
movq %rdi, -0x1b8(%rbp)
callq 0x119d0
movq -0x1b8(%rbp), %rdx
leaq 0x10c635(%rip), %rsi    # 0x151283
leaq -0x38(%rbp), %rdi
callq 0x24740
jmp 0x44c59
movq -0x1a0(%rbp), %rsi
movq -0x1b0(%rbp), %rdi
movq %rsi, %rcx
addq $0x58, %rcx
leaq -0x38(%rbp), %rdx
callq 0x3f820
jmp 0x44c79
leaq -0x38(%rbp), %rdi
callq 0x11360
leaq -0x39(%rbp), %rdi
callq 0x11600
jmp 0x453d4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x44cb3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x11360
leaq -0x39(%rbp), %rdi
callq 0x11600
jmp 0x453e4
xorl %eax, %eax
movl %eax, %esi
leaq -0x60(%rbp), %rdi
callq 0x58bf0
movq -0x1a0(%rbp), %rax
movl 0xd0(%rax), %eax
addl $0x3c, %eax
movl %eax, %ecx
movq %rcx, -0x1c0(%rbp)
subl $0xb7, %eax
ja 0x45317
movq -0x1c0(%rbp), %rax
leaq 0x10bec0(%rip), %rcx    # 0x150bc0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x1b0(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x58bf0
movl $0x1, -0x64(%rbp)
jmp 0x453be
movq -0x1a0(%rbp), %rsi
movq -0x18(%rbp), %rdx
leaq -0x78(%rbp), %rdi
callq 0x47b00
jmp 0x44d3b
leaq -0x60(%rbp), %rdi
movq %rdi, -0x1c8(%rbp)
leaq -0x78(%rbp), %rsi
movq %rsi, -0x1d0(%rbp)
callq 0x577a0
movq -0x1d0(%rbp), %rdi
callq 0x24b20
movq -0x1b0(%rbp), %rdi
movq -0x1a0(%rbp), %rsi
movq -0x1c8(%rbp), %rcx
movq -0x18(%rbp), %rdx
movb $0x1, -0x79(%rbp)
leaq -0x79(%rbp), %r8
callq 0x3d860
jmp 0x44d8a
movl $0x1, -0x64(%rbp)
jmp 0x453be
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x453c9
movq -0x1a0(%rbp), %rsi
movq -0x1b0(%rbp), %rdi
movq -0x18(%rbp), %rdx
callq 0x3f950
jmp 0x44dc0
movl $0x1, -0x64(%rbp)
jmp 0x453be
movq -0x1a0(%rbp), %rsi
movq -0x1b0(%rbp), %rdi
movq -0x18(%rbp), %rdx
callq 0x408b0
jmp 0x44de5
movl $0x1, -0x64(%rbp)
jmp 0x453be
movq -0x1a0(%rbp), %rsi
movq -0x1b0(%rbp), %rdi
movq -0x18(%rbp), %rdx
callq 0x3ee50
jmp 0x44e0a
movl $0x1, -0x64(%rbp)
jmp 0x453be
movq -0x1a0(%rbp), %rsi
movq -0x1b0(%rbp), %rdi
movq -0x18(%rbp), %rdx
callq 0x44970
jmp 0x44e2f
movl $0x1, -0x64(%rbp)
jmp 0x453be
movq -0x1a0(%rbp), %rsi
movq -0x1b0(%rbp), %rdi
movq -0x18(%rbp), %rdx
callq 0x4abd0
jmp 0x44e54
movl $0x1, -0x64(%rbp)
jmp 0x453be
movq -0x1a0(%rbp), %rsi
movq -0x1b0(%rbp), %rdi
movq -0x18(%rbp), %rdx
callq 0x4dec0
jmp 0x44e79
movl $0x1, -0x64(%rbp)
jmp 0x453be
movq -0x1a0(%rbp), %rdi
callq 0x38fd0
jmp 0x44e93
movq -0x1a0(%rbp), %rsi
movq -0x18(%rbp), %rdx
leaq -0x90(%rbp), %rdi
callq 0x3f500
jmp 0x44eac
leaq -0x60(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0x577a0
movq %rax, %rdi
callq 0x57630
movb %al, -0x1d1(%rbp)
leaq -0x90(%rbp), %rdi
callq 0x24b20
movb -0x1d1(%rbp), %al
testb $0x1, %al
jne 0x44ee5
jmp 0x4526a
movq -0x1a0(%rbp), %rax
cmpl $0x29, 0xd0(%rax)
je 0x451e1
leaq -0xd1(%rbp), %rdi
movq %rdi, -0x1e0(%rbp)
callq 0x119d0
movq -0x1e0(%rbp), %rdx
leaq 0x10c276(%rip), %rsi    # 0x151190
leaq -0xd0(%rbp), %rdi
callq 0x24740
jmp 0x44f28
movb $0x1, -0x12a(%rbp)
leaq -0x120(%rbp), %rax
movq %rax, -0x1f0(%rbp)
movq %rax, -0x128(%rbp)
leaq -0x129(%rbp), %rdi
movq %rdi, -0x1e8(%rbp)
callq 0x119d0
movq -0x1f0(%rbp), %rdi
movq -0x1e8(%rbp), %rdx
leaq 0x10dd7d(%rip), %rsi    # 0x152ce9
callq 0x24740
jmp 0x44f73
movb $0x0, -0x12a(%rbp)
leaq -0x120(%rbp), %rax
movq %rax, -0x100(%rbp)
movq $0x1, -0xf8(%rbp)
leaq -0x12b(%rbp), %rdi
movq %rdi, -0x1f8(%rbp)
callq 0x26e30
movq -0x1f8(%rbp), %rcx
movq -0x100(%rbp), %rsi
movq -0xf8(%rbp), %rdx
leaq -0xf0(%rbp), %rdi
callq 0x2d6a0
jmp 0x44fc9
leaq -0xb0(%rbp), %rdi
leaq -0xd0(%rbp), %rsi
leaq -0xf0(%rbp), %rdx
callq 0x9e250
jmp 0x44fe5
movq -0x1a0(%rbp), %rsi
movq -0x1b0(%rbp), %rdi
movq %rsi, %rcx
addq $0x58, %rcx
leaq -0xb0(%rbp), %rdx
callq 0x3f820
jmp 0x45008
leaq -0xb0(%rbp), %rdi
callq 0x11360
leaq -0xf0(%rbp), %rdi
callq 0x25b00
leaq -0x12b(%rbp), %rdi
callq 0x279c0
leaq -0x120(%rbp), %rax
movq %rax, -0x208(%rbp)
addq $0x20, %rax
movq %rax, -0x200(%rbp)
movq -0x200(%rbp), %rdi
addq $-0x20, %rdi
movq %rdi, -0x210(%rbp)
callq 0x11360
movq -0x208(%rbp), %rcx
movq -0x210(%rbp), %rax
cmpq %rcx, %rax
movq %rax, -0x200(%rbp)
jne 0x45045
leaq -0x129(%rbp), %rdi
callq 0x11600
leaq -0xd0(%rbp), %rdi
callq 0x11360
leaq -0xd1(%rbp), %rdi
callq 0x11600
movl $0x1, -0x64(%rbp)
jmp 0x453be
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x451d0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x45160
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x45108
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x450fc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0xb0(%rbp), %rdi
callq 0x11360
leaq -0xf0(%rbp), %rdi
callq 0x25b00
leaq -0x12b(%rbp), %rdi
callq 0x279c0
leaq -0x120(%rbp), %rax
movq %rax, -0x220(%rbp)
addq $0x20, %rax
movq %rax, -0x218(%rbp)
movq -0x218(%rbp), %rdi
addq $-0x20, %rdi
movq %rdi, -0x228(%rbp)
callq 0x11360
movq -0x220(%rbp), %rcx
movq -0x228(%rbp), %rax
cmpq %rcx, %rax
movq %rax, -0x218(%rbp)
jne 0x4512d
jmp 0x45160
leaq -0x129(%rbp), %rdi
callq 0x11600
testb $0x1, -0x12a(%rbp)
jne 0x45177
jmp 0x451c4
movq -0x128(%rbp), %rax
leaq -0x120(%rbp), %rcx
cmpq %rax, %rcx
movq %rax, -0x230(%rbp)
je 0x451c2
movq -0x230(%rbp), %rdi
addq $-0x20, %rdi
movq %rdi, -0x238(%rbp)
callq 0x11360
movq -0x238(%rbp), %rax
leaq -0x120(%rbp), %rcx
cmpq %rcx, %rax
movq %rax, -0x230(%rbp)
jne 0x45191
jmp 0x451c4
leaq -0xd0(%rbp), %rdi
callq 0x11360
leaq -0xd1(%rbp), %rdi
callq 0x11600
jmp 0x453c9
movq -0x1a0(%rbp), %rcx
movq -0x18(%rbp), %rsi
addq $0x58, %rcx
leaq -0x140(%rbp), %rdi
leaq -0x60(%rbp), %rdx
callq 0x596f0
jmp 0x45202
leaq -0x60(%rbp), %rdi
leaq -0x140(%rbp), %rsi
movq %rsi, -0x240(%rbp)
callq 0x59770
movq -0x240(%rbp), %rdi
callq 0x597a0
movq -0x1a0(%rbp), %rdi
callq 0x38fd0
jmp 0x45233
movq -0x1a0(%rbp), %rsi
movq -0x1b0(%rbp), %rdi
movq -0x18(%rbp), %rdx
movb $0x1, -0x141(%rbp)
leaq -0x60(%rbp), %rcx
leaq -0x141(%rbp), %r8
callq 0x3d860
jmp 0x4525e
movl $0x1, -0x64(%rbp)
jmp 0x453be
leaq -0x169(%rbp), %rdi
movq %rdi, -0x248(%rbp)
callq 0x119d0
movq -0x248(%rbp), %rdx
leaq 0x10bf9b(%rip), %rsi    # 0x151226
leaq -0x168(%rbp), %rdi
callq 0x24740
jmp 0x45299
movq -0x1a0(%rbp), %rsi
movq -0x1b0(%rbp), %rdi
movq %rsi, %rcx
addq $0x58, %rcx
leaq -0x168(%rbp), %rdx
callq 0x3f820
jmp 0x452bc
leaq -0x168(%rbp), %rdi
callq 0x11360
leaq -0x169(%rbp), %rdi
callq 0x11600
movl $0x1, -0x64(%rbp)
jmp 0x453be
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x45306
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x168(%rbp), %rdi
callq 0x11360
leaq -0x169(%rbp), %rdi
callq 0x11600
jmp 0x453c9
leaq -0x191(%rbp), %rdi
movq %rdi, -0x250(%rbp)
callq 0x119d0
movq -0x250(%rbp), %rdx
leaq 0x10beee(%rip), %rsi    # 0x151226
leaq -0x190(%rbp), %rdi
callq 0x24740
jmp 0x45346
movq -0x1a0(%rbp), %rsi
movq -0x1b0(%rbp), %rdi
movq %rsi, %rcx
addq $0x58, %rcx
leaq -0x190(%rbp), %rdx
callq 0x3f820
jmp 0x45369
leaq -0x190(%rbp), %rdi
callq 0x11360
leaq -0x191(%rbp), %rdi
callq 0x11600
movl $0x1, -0x64(%rbp)
jmp 0x453be
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x453b0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x190(%rbp), %rdi
callq 0x11360
leaq -0x191(%rbp), %rdi
callq 0x11600
jmp 0x453c9
leaq -0x60(%rbp), %rdi
callq 0x24b20
jmp 0x453d4
leaq -0x60(%rbp), %rdi
callq 0x24b20
jmp 0x453e4
movq -0x1a8(%rbp), %rax
addq $0x250, %rsp            # imm = 0x250
popq %rbp
retq
movq -0x48(%rbp), %rdi
callq 0x119c0
nopl (%rax)