// File: /workspace/github_cpp_makefile_star2_O3/Nallantli[P]Rossa/main/rossa/node_parser/node_parser.cpp
// Function: node_parser_t::parseLoadNode(std::vector<node_scope_t, std::allocator<node_scope_t>>*)
ptr_node_t node_parser_t::parseLoadNode(std::vector<node_scope_t> *scopes)
{
	nextToken();
	if (currentToken.type != TOK_STR_LIT)
		return logErrorN(_EXPECTED_FILE_, currentToken);
	std::string filename = currentToken.valueString + ".ra";
	nextToken();

	auto path = dir::findFile(currentFile.parent_path(), filename, &currentToken);

	if (std::find(dir::loaded.begin(), dir::loaded.end(), path) != dir::loaded.end())
	{
		if (currentToken.type != ';')
			return logErrorN(util::format(_EXPECTED_ERROR_, {";"}), currentToken);
		nextToken();
		return nullptr;
	}

	dir::loaded.push_back(path);

	std::string content = "";
	std::string line;
	std::ifstream myfile(path.string());
	if (myfile.is_open())
	{
		while (getline(myfile, line))
			content += line + "\n";
		myfile.close();
	}

	auto tokens = lexString(content, path.filename().string());
	node_parser_t np(tokens, path);
	auto n = np.parse(scopes, consts);

	if (currentToken.type != ';')
		return logErrorN(util::format(_EXPECTED_ERROR_, {";"}), currentToken);
	nextToken();

	return n;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x448, %rsp            # imm = 0x448
movq %rdx, 0xf8(%rsp)
movq %rsi, %r15
movq %rdi, %r14
movq %rsi, %rdi
callq 0x2549e
leaq 0x58(%r15), %r13
cmpl $-0x12, 0xd0(%r15)
jne 0x367f1
leaq 0xd8(%rsp), %r12
movq %r12, -0x10(%r12)
movq 0xb0(%r15), %rsi
movq 0xb8(%r15), %rdx
addq %rsi, %rdx
leaq 0xc8(%rsp), %rbx
movq %rbx, %rdi
callq 0x1ded4
leaq 0x4d756(%rip), %rsi     # 0x83a94
movq %rbx, %rdi
callq 0x10770
movq %r15, %rdi
callq 0x2549e
leaq 0x28(%r15), %rsi
leaq 0x240(%rsp), %rdi
callq 0x10760
leaq 0x58(%rsp), %rdi
leaq 0x240(%rsp), %rsi
leaq 0xc8(%rsp), %rdx
movq %r13, %rcx
callq 0x55f7c
leaq 0x240(%rsp), %rdi
callq 0x1d5ee
leaq 0x7fbb0(%rip), %rbx     # 0xb5f40
movq (%rbx), %rdi
movq 0x8(%rbx), %rsi
leaq 0x58(%rsp), %rdx
callq 0x3bc35
cmpq 0x8(%rbx), %rax
je 0x363c9
cmpl $0x3b, 0xd0(%r15)
jne 0x3682b
movq %r15, %rdi
callq 0x2549e
xorps %xmm0, %xmm0
movups %xmm0, (%r14)
jmp 0x367b5
movq %r13, 0xe8(%rsp)
movq %r15, 0x10(%rsp)
leaq 0x7fb63(%rip), %rdi     # 0xb5f40
leaq 0x58(%rsp), %r15
movq %r15, %rsi
callq 0x37150
movq %r14, 0xf0(%rsp)
leaq 0x48(%rsp), %r13
movq %r13, -0x10(%r13)
xorl %eax, %eax
movq %rax, -0x8(%r13)
movb %al, (%r13)
leaq 0xb8(%rsp), %rcx
movq %rcx, -0x10(%rcx)
movq %rax, -0x8(%rcx)
movb %al, (%rcx)
movq 0x58(%rsp), %rsi
leaq 0x128(%rsp), %r14
movq %r14, -0x10(%r14)
movq 0x60(%rsp), %rdx
addq %rsi, %rdx
leaq 0x118(%rsp), %rdi
callq 0x1e698
leaq 0x240(%rsp), %rbp
leaq 0x118(%rsp), %rsi
movq %rbp, %rdi
movl $0x8, %edx
callq 0x10670
movq 0x118(%rsp), %rdi
cmpq %r14, %rdi
je 0x36477
movq 0x128(%rsp), %rsi
incq %rsi
callq 0x103d0
leaq 0x2b8(%rsp), %rdi
callq 0x100b0
testb %al, %al
je 0x36568
leaq 0xa8(%rsp), %r12
leaq 0x118(%rsp), %r15
leaq 0x4e65a(%rip), %r13     # 0x84afd
leaq 0x38(%rsp), %rbx
movq 0x240(%rsp), %rax
movq -0x18(%rax), %rdi
addq %rbp, %rdi
movl $0xa, %esi
callq 0x103a0
movsbl %al, %edx
movq %rbp, %rdi
movq %r12, %rsi
callq 0x10720
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x36549
movq %r14, 0x118(%rsp)
movq 0xa8(%rsp), %rsi
movq 0xb0(%rsp), %rdx
addq %rsi, %rdx
movq %r15, %rdi
callq 0x1ded4
movq %r15, %rdi
movq %r13, %rsi
callq 0x10770
movq 0x118(%rsp), %rsi
movq 0x120(%rsp), %rdx
movq %rbx, %rdi
callq 0x10120
movq 0x118(%rsp), %rdi
cmpq %r14, %rdi
je 0x364a8
movq 0x128(%rsp), %rsi
incq %rsi
callq 0x103d0
jmp 0x364a8
leaq 0x240(%rsp), %rdi
leaq 0xd8(%rsp), %r12
leaq 0x48(%rsp), %r13
callq 0x100a0
leaq 0x58(%rsp), %r15
movq 0x60(%rsp), %rcx
testq %rcx, %rcx
movq 0xf0(%rsp), %r14
je 0x365ed
movq 0x78(%rsp), %rax
movl %eax, %edx
notb %dl
testb $0x3, %dl
je 0x365db
movl %eax, %edx
andl $0x3, %edx
jne 0x365ed
movq 0x58(%rsp), %rdx
cmpb $0x2f, -0x1(%rdx,%rcx)
je 0x365ed
andq $0x3, %rax
je 0x365a8
leaq 0x58(%rsp), %r15
jmp 0x365d6
leaq 0x78(%rsp), %rbx
movq %rbx, %rdi
callq 0x10270
movq (%rbx), %rcx
leaq -0x30(%rax), %rdx
addq $-0x10, %rax
testb $0x3, %cl
leaq 0x58(%rsp), %r15
cmoveq %rdx, %r15
cmovneq %rbx, %rax
movq (%rax), %rax
andl $0x3, %eax
cmpl $0x3, %eax
jne 0x365ed
leaq 0x80(%rsp), %rdi
movq %r15, %rsi
callq 0x1e566
jmp 0x365fa
leaq 0x80(%rsp), %rdi
callq 0x24fda
movq 0x80(%rsp), %rsi
leaq 0x28(%rsp), %r15
movq %r15, -0x10(%r15)
movq 0x88(%rsp), %rdx
addq %rsi, %rdx
leaq 0x18(%rsp), %rdi
callq 0x1e698
leaq 0x118(%rsp), %rdi
leaq 0x18(%rsp), %rsi
movl $0x2, %edx
callq 0x3717c
leaq 0x1f0(%rsp), %rdi
leaq 0x38(%rsp), %rsi
leaq 0x118(%rsp), %rdx
callq 0x237c5
leaq 0x118(%rsp), %rdi
callq 0x1d5ee
movq 0x18(%rsp), %rdi
cmpq %r15, %rdi
je 0x36675
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x103d0
leaq 0x80(%rsp), %rdi
callq 0x1d5ee
leaq 0x118(%rsp), %rdi
leaq 0x1f0(%rsp), %rsi
leaq 0x58(%rsp), %rdx
callq 0x2540c
movq 0x10(%rsp), %rax
movq 0x8(%rax), %rax
leaq 0x118(%rsp), %rdi
movq %rax, 0x8(%rdi)
callq 0x2549e
leaq 0x100(%rsp), %rdi
leaq 0x118(%rsp), %rsi
movq 0xf8(%rsp), %rdx
callq 0x25cd8
movq 0x10(%rsp), %rdi
cmpl $0x3b, 0xd0(%rdi)
jne 0x368c8
callq 0x2549e
movaps 0x100(%rsp), %xmm0
movups %xmm0, (%r14)
leaq 0x1d8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x36717
movq 0x1d8(%rsp), %rsi
incq %rsi
callq 0x103d0
leaq 0x1a8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x36738
movq 0x1a8(%rsp), %rsi
incq %rsi
callq 0x103d0
leaq 0x170(%rsp), %rdi
callq 0x1d5ee
leaq 0x140(%rsp), %rdi
callq 0x1d5ee
leaq 0x128(%rsp), %rdi
callq 0x20a7e
leaq 0x1f0(%rsp), %rdi
callq 0x20a7e
leaq 0x240(%rsp), %rdi
callq 0x100d0
movq 0xa8(%rsp), %rdi
leaq 0xb8(%rsp), %rax
cmpq %rax, %rdi
je 0x3679e
movq 0xb8(%rsp), %rsi
incq %rsi
callq 0x103d0
movq 0x38(%rsp), %rdi
cmpq %r13, %rdi
je 0x367b5
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x103d0
leaq 0x58(%rsp), %rdi
callq 0x1d5ee
movq 0xc8(%rsp), %rdi
cmpq %r12, %rdi
je 0x367dc
movq 0xd8(%rsp), %rsi
incq %rsi
callq 0x103d0
movq %r14, %rax
addq $0x448, %rsp            # imm = 0x448
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x250(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x4d271(%rip), %rsi     # 0x83a75
leaq 0x4d288(%rip), %rdx     # 0x83a93
leaq 0x240(%rsp), %rdi
callq 0x1e698
leaq 0x240(%rsp), %rdx
movq %r15, %rsi
movq %r13, %rcx
callq 0x29658
movq %r15, %rbx
leaq 0x128(%rsp), %r14
movq %r14, -0x10(%r14)
movabsq $0x6465746365707845, %rax # imm = 0x6465746365707845
movq %rax, (%r14)
movabsq $0x607d307b60206465, %rax # imm = 0x607D307B60206465
movq %rax, 0x6(%r14)
movq $0xe, -0x8(%r14)
movb $0x0, 0xe(%r14)
leaq 0x90(%rsp), %r15
movq %r15, -0x10(%r15)
movw $0x3b, (%r15)
movq $0x1, -0x8(%r15)
leaq 0x38(%rsp), %rdi
leaq 0x80(%rsp), %rsi
leaq 0xa8(%rsp), %rcx
movl $0x1, %edx
callq 0x20b38
leaq 0x240(%rsp), %rdi
leaq 0x118(%rsp), %rsi
leaq 0x38(%rsp), %rdx
callq 0x47db4
leaq 0x240(%rsp), %rdx
movq %rbx, %rsi
movq %r13, %rcx
callq 0x29658
movq %r15, 0x18(%rsp)
movabsq $0x6465746365707845, %rax # imm = 0x6465746365707845
movq %rax, 0x28(%rsp)
movabsq $0x607d307b60206465, %rax # imm = 0x607D307B60206465
movq %rax, 0x2e(%rsp)
movq $0xe, 0x20(%rsp)
movb $0x0, 0x36(%rsp)
leaq 0x218(%rsp), %r14
movq %r14, -0x10(%r14)
movw $0x3b, (%r14)
movq $0x1, -0x8(%r14)
leaq 0x228(%rsp), %rdi
leaq 0x208(%rsp), %rsi
leaq 0xf(%rsp), %rcx
movl $0x1, %edx
callq 0x20b38
leaq 0x80(%rsp), %rdi
leaq 0x18(%rsp), %rsi
leaq 0x228(%rsp), %rdx
callq 0x47db4
leaq 0x80(%rsp), %rdx
movq 0x10(%rsp), %rsi
movq 0xe8(%rsp), %rcx
callq 0x29658
movq %rax, %rbx
leaq 0x90(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3698f
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x103d0
jmp 0x3698f
movq %rax, %rbx
leaq 0x228(%rsp), %rdi
callq 0x1db60
jmp 0x369e0
jmp 0x36b99
movq %rax, %rbx
leaq 0x250(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x369cc
movq 0x250(%rsp), %rsi
incq %rsi
callq 0x103d0
jmp 0x369cc
movq %rax, %rbx
leaq 0x38(%rsp), %rdi
callq 0x1db60
jmp 0x36a19
jmp 0x36b99
movq %rax, %rbx
movq 0x208(%rsp), %rdi
cmpq %r14, %rdi
je 0x369fd
movq 0x218(%rsp), %rsi
incq %rsi
callq 0x103d0
movq 0x18(%rsp), %rdi
cmpq %r15, %rdi
je 0x36a57
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x103d0
jmp 0x36a57
movq %rax, %rbx
movq 0x80(%rsp), %rdi
cmpq %r15, %rdi
je 0x36a36
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x103d0
movq 0x118(%rsp), %rdi
cmpq %r14, %rdi
je 0x36bea
movq 0x128(%rsp), %rsi
jmp 0x36be2
movq %rax, %rbx
movq 0x108(%rsp), %rdi
testq %rdi, %rdi
je 0x36b1a
callq 0x1e5bc
jmp 0x36b1a
movq %rax, %rbx
jmp 0x36b27
movq %rax, %rbx
leaq 0x118(%rsp), %rdi
callq 0x1d5ee
jmp 0x36a8f
movq %rax, %rbx
movq 0x18(%rsp), %rdi
cmpq %r15, %rdi
je 0x36aab
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x103d0
jmp 0x36aab
movq %rax, %rbx
leaq 0x80(%rsp), %rdi
callq 0x1d5ee
jmp 0x36b9c
movq %rax, %rbx
movq 0x118(%rsp), %rdi
cmpq %r14, %rdi
je 0x36ba9
movq 0x128(%rsp), %rsi
incq %rsi
callq 0x103d0
jmp 0x36ba9
movq %rax, %rbx
jmp 0x36ba9
movq %rax, %rbx
movq 0x240(%rsp), %rdi
cmpq %r14, %rdi
je 0x36c19
movq 0x250(%rsp), %rsi
jmp 0x36c11
movq %rax, %rbx
jmp 0x36c19
movq %rax, %rbx
leaq 0x118(%rsp), %rdi
callq 0x20a1e
leaq 0x1f0(%rsp), %rdi
callq 0x20a7e
jmp 0x36b9c
jmp 0x36b38
movq %rax, %rbx
jmp 0x36bea
movq %rax, %rbx
leaq 0x240(%rsp), %rdi
jmp 0x36bef
jmp 0x36b52
movq %rax, %rbx
jmp 0x36bf4
movq %rax, %rbx
movq 0xc8(%rsp), %rdi
cmpq %r12, %rdi
jne 0x36c09
jmp 0x36c19
jmp 0x36b75
movq %rax, %rbx
movq 0x118(%rsp), %rdi
cmpq %r14, %rdi
je 0x36b9c
movq 0x128(%rsp), %rsi
incq %rsi
callq 0x103d0
jmp 0x36b9c
jmp 0x36b99
movq %rax, %rbx
leaq 0x240(%rsp), %rdi
callq 0x100d0
movq 0xa8(%rsp), %rdi
leaq 0xb8(%rsp), %rax
cmpq %rax, %rdi
je 0x36bce
movq 0xb8(%rsp), %rsi
incq %rsi
callq 0x103d0
movq 0x38(%rsp), %rdi
leaq 0x48(%rsp), %rax
cmpq %rax, %rdi
je 0x36bea
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x103d0
leaq 0x58(%rsp), %rdi
callq 0x1d5ee
movq 0xc8(%rsp), %rdi
leaq 0xd8(%rsp), %rax
cmpq %rax, %rdi
je 0x36c19
movq 0xd8(%rsp), %rsi
incq %rsi
callq 0x103d0
movq %rbx, %rdi
callq 0x106f0
nop