// File: 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
movq %rsp, %rbp
subq $0x730, %rsp            # imm = 0x730
movq %rdi, -0x638(%rbp)
movq %rdi, %rax
movq %rax, -0x630(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x10(%rbp), %rdi
movq %rdi, -0x628(%rbp)
callq 0x38fd0
movq -0x628(%rbp), %rax
cmpl $-0x12, 0xd0(%rax)
je 0x5623d
leaq -0x39(%rbp), %rdi
movq %rdi, -0x640(%rbp)
callq 0x119d0
movq -0x640(%rbp), %rdx
leaq 0xfb1ba(%rip), %rsi     # 0x151384
leaq -0x38(%rbp), %rdi
callq 0x24740
jmp 0x561d5
movq -0x628(%rbp), %rsi
movq -0x638(%rbp), %rdi
movq %rsi, %rcx
addq $0x58, %rcx
leaq -0x38(%rbp), %rdx
callq 0x3f820
jmp 0x561f5
leaq -0x38(%rbp), %rdi
callq 0x11360
leaq -0x39(%rbp), %rdi
callq 0x11600
jmp 0x56dad
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x5622f
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 0x56dbd
movq -0x628(%rbp), %rsi
addq $0xb0, %rsi
leaq 0xfb151(%rip), %rdx     # 0x1513a3
leaq -0x70(%rbp), %rdi
callq 0x24ec0
movq -0x628(%rbp), %rdi
callq 0x38fd0
jmp 0x56269
movq -0x628(%rbp), %rsi
addq $0x28, %rsi
leaq -0xc0(%rbp), %rdi
callq 0x11a70
jmp 0x56282
movq -0x628(%rbp), %rcx
addq $0x58, %rcx
leaq -0x98(%rbp), %rdi
leaq -0xc0(%rbp), %rsi
leaq -0x70(%rbp), %rdx
callq 0xc75a0
jmp 0x562a6
leaq -0xc0(%rbp), %rdi
callq 0x24b40
leaq 0x18fe27(%rip), %rdi    # 0x1e60e0
movq %rdi, -0x650(%rbp)
callq 0x5a050
movq -0x650(%rbp), %rdi
movq %rax, -0xd0(%rbp)
callq 0x5a080
movq %rax, -0xd8(%rbp)
movq -0xd0(%rbp), %rdi
movq -0xd8(%rbp), %rsi
leaq -0x98(%rbp), %rdx
callq 0x5a000
movq %rax, -0x648(%rbp)
jmp 0x56302
movq -0x648(%rbp), %rax
movq %rax, -0xc8(%rbp)
leaq 0x18fdc9(%rip), %rdi    # 0x1e60e0
callq 0x5a080
movq %rax, -0xe0(%rbp)
leaq -0xc8(%rbp), %rdi
leaq -0xe0(%rbp), %rsi
callq 0x59fc0
testb $0x1, %al
jne 0x5633f
jmp 0x566aa
movq -0x628(%rbp), %rax
cmpl $0x3b, 0xd0(%rax)
je 0x5667d
leaq -0x121(%rbp), %rdi
movq %rdi, -0x658(%rbp)
callq 0x119d0
movq -0x658(%rbp), %rdx
leaq 0xfae1c(%rip), %rsi     # 0x151190
leaq -0x120(%rbp), %rdi
callq 0x24740
jmp 0x56382
movb $0x1, -0x17a(%rbp)
leaq -0x170(%rbp), %rax
movq %rax, -0x668(%rbp)
movq %rax, -0x178(%rbp)
leaq -0x179(%rbp), %rdi
movq %rdi, -0x660(%rbp)
callq 0x119d0
movq -0x668(%rbp), %rdi
movq -0x660(%rbp), %rdx
leaq 0xf9d50(%rip), %rsi     # 0x150116
callq 0x24740
jmp 0x563cd
movb $0x0, -0x17a(%rbp)
leaq -0x170(%rbp), %rax
movq %rax, -0x150(%rbp)
movq $0x1, -0x148(%rbp)
leaq -0x17b(%rbp), %rdi
movq %rdi, -0x670(%rbp)
callq 0x26e30
movq -0x670(%rbp), %rcx
movq -0x150(%rbp), %rsi
movq -0x148(%rbp), %rdx
leaq -0x140(%rbp), %rdi
callq 0x2d6a0
jmp 0x56423
leaq -0x100(%rbp), %rdi
leaq -0x120(%rbp), %rsi
leaq -0x140(%rbp), %rdx
callq 0x9e250
jmp 0x5643f
movq -0x628(%rbp), %rsi
movq -0x638(%rbp), %rdi
movq %rsi, %rcx
addq $0x58, %rcx
leaq -0x100(%rbp), %rdx
callq 0x3f820
jmp 0x56462
leaq -0x100(%rbp), %rdi
callq 0x11360
leaq -0x140(%rbp), %rdi
callq 0x25b00
leaq -0x17b(%rbp), %rdi
callq 0x279c0
leaq -0x170(%rbp), %rax
movq %rax, -0x680(%rbp)
addq $0x20, %rax
movq %rax, -0x678(%rbp)
movq -0x678(%rbp), %rdi
addq $-0x20, %rdi
movq %rdi, -0x688(%rbp)
callq 0x11360
movq -0x680(%rbp), %rcx
movq -0x688(%rbp), %rax
cmpq %rcx, %rax
movq %rax, -0x678(%rbp)
jne 0x5649f
leaq -0x179(%rbp), %rdi
callq 0x11600
leaq -0x120(%rbp), %rdi
callq 0x11360
leaq -0x121(%rbp), %rdi
callq 0x11600
movl $0x1, -0x180(%rbp)
jmp 0x56d7f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x56da2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0xc0(%rbp), %rdi
callq 0x24b40
jmp 0x56da2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x56d96
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x5666c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x565fc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x565a4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x56598
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x100(%rbp), %rdi
callq 0x11360
leaq -0x140(%rbp), %rdi
callq 0x25b00
leaq -0x17b(%rbp), %rdi
callq 0x279c0
leaq -0x170(%rbp), %rax
movq %rax, -0x698(%rbp)
addq $0x20, %rax
movq %rax, -0x690(%rbp)
movq -0x690(%rbp), %rdi
addq $-0x20, %rdi
movq %rdi, -0x6a0(%rbp)
callq 0x11360
movq -0x698(%rbp), %rcx
movq -0x6a0(%rbp), %rax
cmpq %rcx, %rax
movq %rax, -0x690(%rbp)
jne 0x565c9
jmp 0x565fc
leaq -0x179(%rbp), %rdi
callq 0x11600
testb $0x1, -0x17a(%rbp)
jne 0x56613
jmp 0x56660
movq -0x178(%rbp), %rax
leaq -0x170(%rbp), %rcx
cmpq %rax, %rcx
movq %rax, -0x6a8(%rbp)
je 0x5665e
movq -0x6a8(%rbp), %rdi
addq $-0x20, %rdi
movq %rdi, -0x6b0(%rbp)
callq 0x11360
movq -0x6b0(%rbp), %rax
leaq -0x170(%rbp), %rcx
cmpq %rcx, %rax
movq %rax, -0x6a8(%rbp)
jne 0x5662d
jmp 0x56660
leaq -0x120(%rbp), %rdi
callq 0x11360
leaq -0x121(%rbp), %rdi
callq 0x11600
jmp 0x56d96
movq -0x628(%rbp), %rdi
callq 0x38fd0
jmp 0x5668b
movq -0x638(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x58bf0
movl $0x1, -0x180(%rbp)
jmp 0x56d7f
leaq 0x18fa2f(%rip), %rdi    # 0x1e60e0
leaq -0x98(%rbp), %rsi
callq 0x5a0b0
jmp 0x566bf
leaq -0x1a1(%rbp), %rdi
movq %rdi, -0x6b8(%rbp)
callq 0x119d0
movq -0x6b8(%rbp), %rdx
leaq 0xf9ab2(%rip), %rsi     # 0x150192
leaq -0x1a0(%rbp), %rdi
callq 0x24740
jmp 0x566ee
leaq -0x1a1(%rbp), %rdi
callq 0x11600
leaq -0x1c8(%rbp), %rdi
callq 0x117c0
leaq -0x3f0(%rbp), %rdi
leaq -0x98(%rbp), %rsi
callq 0x2d3f0
jmp 0x5671b
leaq -0x3d0(%rbp), %rdi
leaq -0x3f0(%rbp), %rsi
movl $0x8, %edx
callq 0x118f0
jmp 0x56735
leaq -0x3f0(%rbp), %rdi
callq 0x11360
leaq -0x3d0(%rbp), %rdi
callq 0x118d0
movb %al, -0x6b9(%rbp)
jmp 0x56755
movb -0x6b9(%rbp), %al
testb $0x1, %al
jne 0x56764
jmp 0x5687a
jmp 0x56766
leaq -0x3d0(%rbp), %rdi
leaq -0x1c8(%rbp), %rsi
callq 0x110d0
movq %rax, -0x6c8(%rbp)
jmp 0x56782
movq -0x6c8(%rbp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
addq %rax, %rdi
callq 0x11730
movb %al, -0x6c9(%rbp)
jmp 0x567a0
movb -0x6c9(%rbp), %al
testb $0x1, %al
jne 0x567af
jmp 0x5686a
leaq 0xfbd1f(%rip), %rdx     # 0x1524d5
leaq -0x410(%rbp), %rdi
leaq -0x1c8(%rbp), %rsi
callq 0x24ec0
jmp 0x567cb
leaq -0x1a0(%rbp), %rdi
leaq -0x410(%rbp), %rsi
callq 0x11750
jmp 0x567e0
leaq -0x410(%rbp), %rdi
callq 0x11360
jmp 0x56766
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x1a1(%rbp), %rdi
callq 0x11600
jmp 0x56d96
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x56d65
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x3f0(%rbp), %rdi
callq 0x11360
jmp 0x56d65
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x56d59
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x410(%rbp), %rdi
callq 0x11360
jmp 0x56d59
leaq -0x3d0(%rbp), %rdi
callq 0x110f0
jmp 0x56878
jmp 0x5687a
leaq -0x498(%rbp), %rdi
leaq -0x98(%rbp), %rsi
callq 0x5a120
jmp 0x5688f
leaq -0x470(%rbp), %rdi
leaq -0x498(%rbp), %rsi
callq 0x2d3f0
jmp 0x568a4
leaq -0x450(%rbp), %rdi
leaq -0x470(%rbp), %rsi
movl $0x2, %edx
callq 0x5a220
jmp 0x568be
leaq -0x428(%rbp), %rdi
leaq -0x1a0(%rbp), %rsi
leaq -0x450(%rbp), %rdx
callq 0x35510
jmp 0x568da
leaq -0x450(%rbp), %rdi
callq 0x24b40
leaq -0x470(%rbp), %rdi
callq 0x11360
leaq -0x498(%rbp), %rdi
callq 0x24b40
leaq -0x570(%rbp), %rdi
leaq -0x428(%rbp), %rsi
leaq -0x98(%rbp), %rdx
callq 0x38f50
jmp 0x5691a
movq -0x628(%rbp), %rax
movq -0x18(%rbp), %rdx
movq 0x8(%rax), %rcx
leaq -0x580(%rbp), %rdi
leaq -0x570(%rbp), %rsi
callq 0x56dd0
jmp 0x5693e
movq -0x628(%rbp), %rax
cmpl $0x3b, 0xd0(%rax)
je 0x56cb0
leaq -0x5c1(%rbp), %rdi
movq %rdi, -0x6d8(%rbp)
callq 0x119d0
movq -0x6d8(%rbp), %rdx
leaq 0xfa81d(%rip), %rsi     # 0x151190
leaq -0x5c0(%rbp), %rdi
callq 0x24740
jmp 0x56981
movb $0x1, -0x61a(%rbp)
leaq -0x610(%rbp), %rax
movq %rax, -0x6e8(%rbp)
movq %rax, -0x618(%rbp)
leaq -0x619(%rbp), %rdi
movq %rdi, -0x6e0(%rbp)
callq 0x119d0
movq -0x6e8(%rbp), %rdi
movq -0x6e0(%rbp), %rdx
leaq 0xf9751(%rip), %rsi     # 0x150116
callq 0x24740
jmp 0x569cc
movb $0x0, -0x61a(%rbp)
leaq -0x610(%rbp), %rax
movq %rax, -0x5f0(%rbp)
movq $0x1, -0x5e8(%rbp)
leaq -0x61b(%rbp), %rdi
movq %rdi, -0x6f0(%rbp)
callq 0x26e30
movq -0x6f0(%rbp), %rcx
movq -0x5f0(%rbp), %rsi
movq -0x5e8(%rbp), %rdx
leaq -0x5e0(%rbp), %rdi
callq 0x2d6a0
jmp 0x56a22
leaq -0x5a0(%rbp), %rdi
leaq -0x5c0(%rbp), %rsi
leaq -0x5e0(%rbp), %rdx
callq 0x9e250
jmp 0x56a3e
movq -0x628(%rbp), %rsi
movq -0x638(%rbp), %rdi
movq %rsi, %rcx
addq $0x58, %rcx
leaq -0x5a0(%rbp), %rdx
callq 0x3f820
jmp 0x56a61
leaq -0x5a0(%rbp), %rdi
callq 0x11360
leaq -0x5e0(%rbp), %rdi
callq 0x25b00
leaq -0x61b(%rbp), %rdi
callq 0x279c0
leaq -0x610(%rbp), %rax
movq %rax, -0x700(%rbp)
addq $0x20, %rax
movq %rax, -0x6f8(%rbp)
movq -0x6f8(%rbp), %rdi
addq $-0x20, %rdi
movq %rdi, -0x708(%rbp)
callq 0x11360
movq -0x700(%rbp), %rcx
movq -0x708(%rbp), %rax
cmpq %rcx, %rax
movq %rax, -0x6f8(%rbp)
jne 0x56a9e
leaq -0x619(%rbp), %rdi
callq 0x11600
leaq -0x5c0(%rbp), %rdi
callq 0x11360
leaq -0x5c1(%rbp), %rdi
callq 0x11600
movl $0x1, -0x180(%rbp)
jmp 0x56ceb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x56b42
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x56b36
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x450(%rbp), %rdi
callq 0x24b40
leaq -0x470(%rbp), %rdi
callq 0x11360
leaq -0x498(%rbp), %rdi
callq 0x24b40
jmp 0x56d59
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x56d4d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x56d41
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x56c9f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x56c2f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x56bd7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x56bcb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x5a0(%rbp), %rdi
callq 0x11360
leaq -0x5e0(%rbp), %rdi
callq 0x25b00
leaq -0x61b(%rbp), %rdi
callq 0x279c0
leaq -0x610(%rbp), %rax
movq %rax, -0x718(%rbp)
addq $0x20, %rax
movq %rax, -0x710(%rbp)
movq -0x710(%rbp), %rdi
addq $-0x20, %rdi
movq %rdi, -0x720(%rbp)
callq 0x11360
movq -0x718(%rbp), %rcx
movq -0x720(%rbp), %rax
cmpq %rcx, %rax
movq %rax, -0x710(%rbp)
jne 0x56bfc
jmp 0x56c2f
leaq -0x619(%rbp), %rdi
callq 0x11600
testb $0x1, -0x61a(%rbp)
jne 0x56c46
jmp 0x56c93
movq -0x618(%rbp), %rax
leaq -0x610(%rbp), %rcx
cmpq %rax, %rcx
movq %rax, -0x728(%rbp)
je 0x56c91
movq -0x728(%rbp), %rdi
addq $-0x20, %rdi
movq %rdi, -0x730(%rbp)
callq 0x11360
movq -0x730(%rbp), %rax
leaq -0x610(%rbp), %rcx
cmpq %rcx, %rax
movq %rax, -0x728(%rbp)
jne 0x56c60
jmp 0x56c93
leaq -0x5c0(%rbp), %rdi
callq 0x11360
leaq -0x5c1(%rbp), %rdi
callq 0x11600
jmp 0x56d35
movq -0x628(%rbp), %rdi
callq 0x38fd0
jmp 0x56cbe
movq -0x638(%rbp), %rdi
leaq -0x580(%rbp), %rsi
callq 0x58f90
movl $0x1, -0x180(%rbp)
jmp 0x56ceb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x56d35
leaq -0x580(%rbp), %rdi
callq 0x24b20
leaq -0x570(%rbp), %rdi
callq 0x2d050
leaq -0x428(%rbp), %rdi
callq 0x2d090
leaq -0x3d0(%rbp), %rdi
callq 0x11140
leaq -0x1c8(%rbp), %rdi
callq 0x11360
leaq -0x1a0(%rbp), %rdi
callq 0x11360
jmp 0x56d7f
leaq -0x580(%rbp), %rdi
callq 0x24b20
leaq -0x570(%rbp), %rdi
callq 0x2d050
leaq -0x428(%rbp), %rdi
callq 0x2d090
leaq -0x3d0(%rbp), %rdi
callq 0x11140
leaq -0x1c8(%rbp), %rdi
callq 0x11360
leaq -0x1a0(%rbp), %rdi
callq 0x11360
jmp 0x56d96
leaq -0x98(%rbp), %rdi
callq 0x24b40
leaq -0x70(%rbp), %rdi
callq 0x11360
jmp 0x56dad
leaq -0x98(%rbp), %rdi
callq 0x24b40
leaq -0x70(%rbp), %rdi
callq 0x11360
jmp 0x56dbd
movq -0x630(%rbp), %rax
addq $0x730, %rsp            # imm = 0x730
popq %rbp
retq
movq -0x48(%rbp), %rdi
callq 0x119c0
nopw %cs:(%rax,%rax)