// File: Heptagon196[P]Gos/GosFileSystem.cpp
// Function: Gos::FileSystem::Read(std::filesystem::__cxx11::path)
std::stringstream Gos::FileSystem::Read(Path path) {
    std::stringstream ss;
    File& file = instance.files[FileSystem::GetFile(path, false)];
    if (file.packID == -1) {
        std::ifstream fin;
        fin.open(path, std::ios::binary);
        ss << fin.rdbuf();
        fin.close();
    } else {
        std::ifstream fin;
        char* buffer = new char[file.fileSize];
        fin.open(instance.dataPacks[file.packID], std::ios::binary);
        fin.seekg(file.packPos);
        fin.read(buffer, file.fileSize);
        fin.close();
        ss.write(buffer, file.fileSize);
        delete[] buffer;
    }
    return ss;
}

// Assembly:
subq $0x4c8, %rsp            # imm = 0x4C8
movq %rsi, 0x40(%rsp)
movq %rdi, 0x30(%rsp)
movq %rdi, %rax
movq %rax, 0x38(%rsp)
movq %rdi, 0x4c0(%rsp)
movq %rsi, 0x4b8(%rsp)
movb $0x0, 0x4b7(%rsp)
callq 0x131b0
movq 0x40(%rsp), %rsi
leaq 0x480(%rsp), %rdi
callq 0x1e7280
jmp 0x1eeb3a
leaq 0x480(%rsp), %rdi
xorl %esi, %esi
callq 0x1ed070
movl %eax, 0x2c(%rsp)
jmp 0x1eeb4f
movl 0x2c(%rsp), %eax
movslq %eax, %rsi
leaq 0x11390b(%rip), %rdi    # 0x302468
addq $0x18, %rdi
callq 0x1ef700
movq %rax, 0x20(%rsp)
leaq 0x480(%rsp), %rdi
callq 0x1e7130
movq 0x20(%rsp), %rax
movq %rax, 0x4a8(%rsp)
movq 0x4a8(%rsp), %rax
cmpl $-0x1, (%rax)
jne 0x1eec77
leaq 0x268(%rsp), %rdi
callq 0x131f0
jmp 0x1eeba5
movq 0x40(%rsp), %rsi
leaq 0x268(%rsp), %rdi
movl $0x4, %edx
callq 0x1efac0
jmp 0x1eebbe
movq 0x30(%rsp), %rax
addq $0x10, %rax
movq %rax, 0x10(%rsp)
leaq 0x268(%rsp), %rdi
callq 0x132b0
movq %rax, 0x18(%rsp)
jmp 0x1eebe0
movq 0x18(%rsp), %rsi
movq 0x10(%rsp), %rdi
callq 0x13150
jmp 0x1eebf1
leaq 0x268(%rsp), %rdi
callq 0x133d0
jmp 0x1eec00
leaq 0x268(%rsp), %rdi
callq 0x13040
jmp 0x1eed8c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x478(%rsp)
movl %eax, 0x474(%rsp)
jmp 0x1eedb5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x478(%rsp)
movl %eax, 0x474(%rsp)
leaq 0x480(%rsp), %rdi
callq 0x1e7130
jmp 0x1eedb5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x478(%rsp)
movl %eax, 0x474(%rsp)
leaq 0x268(%rsp), %rdi
callq 0x13040
jmp 0x1eedb5
leaq 0x60(%rsp), %rdi
callq 0x131f0
jmp 0x1eec83
movq 0x4a8(%rsp), %rax
movslq 0x8(%rax), %rdi
callq 0x132c0
movq %rax, 0x8(%rsp)
jmp 0x1eec9b
movq 0x8(%rsp), %rax
movq %rax, 0x58(%rsp)
movq 0x4a8(%rsp), %rax
movslq (%rax), %rsi
leaq 0x1137b1(%rip), %rdi    # 0x302468
callq 0x1dd580
movq %rax, %rsi
leaq 0x60(%rsp), %rdi
movl $0x4, %edx
callq 0x13160
jmp 0x1eecd0
movq 0x4a8(%rsp), %rax
movslq 0x4(%rax), %rsi
leaq 0x48(%rsp), %rdi
callq 0x1efc30
jmp 0x1eece8
movq 0x48(%rsp), %rsi
movq 0x50(%rsp), %rdx
leaq 0x60(%rsp), %rdi
callq 0x13350
jmp 0x1eecfe
movq 0x58(%rsp), %rsi
movq 0x4a8(%rsp), %rax
movslq 0x8(%rax), %rdx
leaq 0x60(%rsp), %rdi
callq 0x132f0
jmp 0x1eed1b
leaq 0x60(%rsp), %rdi
callq 0x133d0
jmp 0x1eed27
movq 0x30(%rsp), %rdi
addq $0x10, %rdi
movq 0x58(%rsp), %rsi
movq 0x4a8(%rsp), %rax
movslq 0x8(%rax), %rdx
callq 0x13320
jmp 0x1eed48
movq 0x58(%rsp), %rax
movq %rax, (%rsp)
cmpq $0x0, %rax
je 0x1eed60
movq (%rsp), %rdi
callq 0x13220
leaq 0x60(%rsp), %rdi
callq 0x13040
jmp 0x1eed8c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x478(%rsp)
movl %eax, 0x474(%rsp)
leaq 0x60(%rsp), %rdi
callq 0x13040
jmp 0x1eedb5
movb $0x1, 0x4b7(%rsp)
testb $0x1, 0x4b7(%rsp)
jne 0x1eeda8
movq 0x30(%rsp), %rdi
callq 0x13240
movq 0x38(%rsp), %rax
addq $0x4c8, %rsp            # imm = 0x4C8
retq
movq 0x30(%rsp), %rdi
callq 0x13240
movq 0x478(%rsp), %rdi
callq 0x133f0
nopl (%rax)