// File: linuxmao-org[P]VL1-emulator/utils/sources/rescc.cpp
// Function: load_json(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, nlohmann::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, bool, long, unsigned long, double, std::allocator, nlohmann::adl_serializer>&)
static bool load_json(const std::string &path, nlohmann::json &json)
{
	FILE_u file(fopen(path.c_str(), "rb"));
	if (!file)
		return false;

	if (fseek(file.get(), 0, SEEK_END) != 0)
		return false;

	off_t size = ftell(file.get());

	if (fseek(file.get(), 0, SEEK_SET) != 0)
		return false;

	std::unique_ptr<char[]> data(new char[size]);
	if (fread(data.get(), size, 1, file.get()) != 1)
		return false;

	file.reset();

	json = nlohmann::json::parse(&data[0], &data[size]);

	return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xe0, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rdi
callq 0x4140
movq %rax, %rdi
leaq 0x20847(%rip), %rsi     # 0x259cd
callq 0x43b0
movq %rax, %rsi
leaq -0x20(%rbp), %rdi
callq 0x5a60
leaq -0x20(%rbp), %rdi
callq 0x5a90
testb $0x1, %al
jne 0x51b4
movb $0x0, -0x1(%rbp)
movl $0x1, -0x24(%rbp)
jmp 0x53d1
leaq -0x20(%rbp), %rdi
callq 0x5ac0
movq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
movl $0x2, %edx
callq 0x4390
movl %eax, -0x7c(%rbp)
jmp 0x51d3
movl -0x7c(%rbp), %eax
cmpl $0x0, %eax
je 0x51fc
movb $0x0, -0x1(%rbp)
movl $0x1, -0x24(%rbp)
jmp 0x53d1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0x53e8
leaq -0x20(%rbp), %rdi
callq 0x5ac0
movq %rax, %rdi
callq 0x4030
movq %rax, -0x88(%rbp)
jmp 0x5216
movq -0x88(%rbp), %rax
movq %rax, -0x40(%rbp)
leaq -0x20(%rbp), %rdi
callq 0x5ac0
movq %rax, %rdi
xorl %edx, %edx
movl %edx, %esi
callq 0x4390
movl %eax, -0x8c(%rbp)
jmp 0x523e
movl -0x8c(%rbp), %eax
cmpl $0x0, %eax
je 0x5259
movb $0x0, -0x1(%rbp)
movl $0x1, -0x24(%rbp)
jmp 0x53d1
movq -0x40(%rbp), %rdi
callq 0x4040
movq %rax, -0x98(%rbp)
jmp 0x526b
movq -0x98(%rbp), %rsi
leaq -0x48(%rbp), %rdi
movq %rdi, -0xb8(%rbp)
callq 0x5d10
movq -0xb8(%rbp), %rdi
callq 0x5d40
movq %rax, -0xb0(%rbp)
movq -0x40(%rbp), %rax
movq %rax, -0xa8(%rbp)
leaq -0x20(%rbp), %rdi
callq 0x5ac0
movq -0xb0(%rbp), %rdi
movq -0xa8(%rbp), %rsi
movq %rax, %rcx
movl $0x1, %edx
callq 0x44b0
movq %rax, -0xa0(%rbp)
jmp 0x52cd
movq -0xa0(%rbp), %rax
cmpq $0x1, %rax
je 0x52fb
movb $0x0, -0x1(%rbp)
movl $0x1, -0x24(%rbp)
jmp 0x53bb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0x53c6
xorl %eax, %eax
movl %eax, %esi
movq %rsi, -0xc8(%rbp)
leaq -0x20(%rbp), %rdi
callq 0x5af0
movq -0xc8(%rbp), %rsi
leaq -0x48(%rbp), %rdi
callq 0x5f50
movq %rax, -0xc0(%rbp)
jmp 0x5328
movq -0x40(%rbp), %rsi
leaq -0x48(%rbp), %rdi
callq 0x5f50
movq %rax, -0xd0(%rbp)
jmp 0x533e
xorl %eax, %eax
movl %eax, %esi
leaq -0x78(%rbp), %rdi
movq %rdi, -0xd8(%rbp)
callq 0x5f80
movq -0xc0(%rbp), %rsi
movq -0xd0(%rbp), %rdx
movq -0xd8(%rbp), %rcx
leaq -0x58(%rbp), %rdi
movl $0x1, %r8d
callq 0x5d70
jmp 0x5378
movq -0x18(%rbp), %rdi
leaq -0x58(%rbp), %rsi
callq 0x5fc0
leaq -0x58(%rbp), %rdi
callq 0x5cd0
leaq -0x78(%rbp), %rdi
callq 0x6030
movb $0x1, -0x1(%rbp)
movl $0x1, -0x24(%rbp)
jmp 0x53bb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x78(%rbp), %rdi
callq 0x6030
jmp 0x53c6
leaq -0x48(%rbp), %rdi
callq 0x6050
jmp 0x53d1
leaq -0x48(%rbp), %rdi
callq 0x6050
jmp 0x53e8
leaq -0x20(%rbp), %rdi
callq 0x5b50
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0xe0, %rsp
popq %rbp
retq
leaq -0x20(%rbp), %rdi
callq 0x5b50
movq -0x30(%rbp), %rdi
callq 0x4550
nopw (%rax,%rax)