// File: Heptagon196[P]Gos/GosFileSystem.cpp
// Function: Gos::FileSystem::AddDirectory(std::filesystem::__cxx11::path)
void Gos::FileSystem::AddDirectory(Path dir) {
    dir = dir.lexically_relative(".");
    std::queue<std::pair<Path, int>> dirs;
    dirs.push({dir, FileSystem::GetFile(dir, true)});
    instance.files[dirs.front().second].packID = -1;
    instance.files[dirs.front().second].directory = true;
    while (!dirs.empty()) {
        int cur = dirs.front().second;
        for (auto& file: std::filesystem::directory_iterator(dirs.front().first)) {
            if (file.path().string().length() > 1 && file.path().filename().string().starts_with(".")) {
                continue;
            }
            auto& s = instance.structure[cur];
            std::string name = file.path().filename().string();
            if (s.find(name) == s.end()) {
                instance.files.push_back({ -1, 0, 0 });
                s[name] = instance.files.size() - 1;
            }
            int nxt = s[name];
            instance.files[nxt].packID = -1;
            if (std::filesystem::is_directory(file.status())) {
                instance.files[nxt].directory = true;
                dirs.push({ file.path(), nxt });
            } else {
                instance.files[nxt].directory = false;
            }
        }
        dirs.pop();
    }
}

// Assembly:
subq $0x328, %rsp            # imm = 0x328
movq %rdi, 0x78(%rsp)
movq %rdi, 0x320(%rsp)
leaq 0x1f676(%rip), %rsi     # 0x20cb61
leaq 0x2d0(%rsp), %rdi
movq %rdi, 0x80(%rsp)
movl $0x2, %edx
callq 0x1e6fb0
movq 0x78(%rsp), %rsi
movq 0x80(%rsp), %rdx
leaq 0x2f8(%rsp), %rdi
callq 0x13180
jmp 0x1ed521
movq 0x78(%rsp), %rdi
leaq 0x2f8(%rsp), %rsi
movq %rsi, 0x70(%rsp)
callq 0x1ef5e0
movq 0x70(%rsp), %rdi
callq 0x1e7130
leaq 0x2d0(%rsp), %rdi
callq 0x1e7130
leaq 0x270(%rsp), %rdi
callq 0x1ef650
movq 0x78(%rsp), %rsi
leaq 0x210(%rsp), %rdi
callq 0x1e7280
jmp 0x1ed570
leaq 0x210(%rsp), %rdi
movl $0x1, %esi
callq 0x1ed070
movl %eax, 0x6c(%rsp)
jmp 0x1ed588
movq 0x78(%rsp), %rsi
movl 0x6c(%rsp), %eax
movl %eax, 0x23c(%rsp)
leaq 0x240(%rsp), %rdi
leaq 0x23c(%rsp), %rdx
callq 0x1ef6b0
jmp 0x1ed5af
leaq 0x270(%rsp), %rdi
leaq 0x240(%rsp), %rsi
callq 0x1ef680
jmp 0x1ed5c6
leaq 0x240(%rsp), %rdi
callq 0x1ef6f0
leaq 0x210(%rsp), %rdi
callq 0x1e7130
leaq 0x270(%rsp), %rdi
callq 0x1ef720
movq %rax, 0x60(%rsp)
jmp 0x1ed5f4
movq 0x60(%rsp), %rax
movslq 0x28(%rax), %rsi
leaq 0x114e7c(%rip), %rdi    # 0x302480
callq 0x1ef700
movl $0xffffffff, (%rax)     # imm = 0xFFFFFFFF
leaq 0x270(%rsp), %rdi
callq 0x1ef720
movq %rax, 0x58(%rsp)
jmp 0x1ed623
movq 0x58(%rsp), %rax
movslq 0x28(%rax), %rsi
leaq 0x114e35(%rip), %rdi    # 0x302468
addq $0x18, %rdi
callq 0x1ef700
movb $0x1, 0xc(%rax)
leaq 0x270(%rsp), %rdi
callq 0x1ef730
movb %al, 0x57(%rsp)
jmp 0x1ed653
movb 0x57(%rsp), %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x1ed662
jmp 0x1edc8a
leaq 0x270(%rsp), %rdi
callq 0x1ef720
movq %rax, 0x48(%rsp)
jmp 0x1ed676
movq 0x48(%rsp), %rax
movl 0x28(%rax), %eax
movl %eax, 0x20c(%rsp)
leaq 0x270(%rsp), %rdi
callq 0x1ef720
movq %rax, 0x40(%rsp)
jmp 0x1ed699
movq 0x40(%rsp), %rsi
leaq 0x1f0(%rsp), %rdi
callq 0x1ef750
jmp 0x1ed6ad
leaq 0x1f0(%rsp), %rax
movq %rax, 0x200(%rsp)
movq 0x200(%rsp), %rsi
leaq 0x1d0(%rsp), %rdi
callq 0x1ef7b0
leaq 0x1e0(%rsp), %rdi
leaq 0x1d0(%rsp), %rsi
callq 0x1ef780
leaq 0x1d0(%rsp), %rdi
callq 0x1ef7e0
movq 0x200(%rsp), %rsi
leaq 0x1b0(%rsp), %rdi
callq 0x1ef7b0
leaq 0x1c0(%rsp), %rdi
leaq 0x1b0(%rsp), %rsi
callq 0x1ef7f0
leaq 0x1b0(%rsp), %rdi
callq 0x1ef7e0
leaq 0x1e0(%rsp), %rdi
leaq 0x1c0(%rsp), %rsi
callq 0x1ef830
testb $0x1, %al
jne 0x1ed7fc
leaq 0x1c0(%rsp), %rdi
callq 0x1ef7e0
leaq 0x1e0(%rsp), %rdi
callq 0x1ef7e0
leaq 0x1f0(%rsp), %rdi
callq 0x1ef7e0
jmp 0x1edc76
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2c8(%rsp)
movl %eax, 0x2c4(%rsp)
leaq 0x2d0(%rsp), %rdi
callq 0x1e7130
jmp 0x1edcac
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2c8(%rsp)
movl %eax, 0x2c4(%rsp)
jmp 0x1edc9f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2c8(%rsp)
movl %eax, 0x2c4(%rsp)
jmp 0x1ed7ea
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2c8(%rsp)
movl %eax, 0x2c4(%rsp)
leaq 0x240(%rsp), %rdi
callq 0x1ef6f0
leaq 0x210(%rsp), %rdi
callq 0x1e7130
jmp 0x1edc9f
leaq 0x1e0(%rsp), %rdi
callq 0x13540
movq %rax, 0x1a8(%rsp)
movq 0x1a8(%rsp), %rdi
callq 0x1ef860
movq %rax, %rsi
movb $0x0, 0x13f(%rsp)
movb $0x0, 0x13e(%rsp)
leaq 0x188(%rsp), %rdi
callq 0x1e70b0
jmp 0x1ed840
leaq 0x188(%rsp), %rdi
callq 0x55b20
movq %rax, %rcx
xorl %eax, %eax
cmpq $0x1, %rcx
movb %al, 0x3f(%rsp)
jbe 0x1ed8ba
movq 0x1a8(%rsp), %rdi
callq 0x1ef860
movq %rax, %rsi
leaq 0x140(%rsp), %rdi
callq 0x1ef870
jmp 0x1ed87b
movb $0x1, 0x13f(%rsp)
leaq 0x168(%rsp), %rdi
leaq 0x140(%rsp), %rsi
callq 0x1e70b0
jmp 0x1ed89a
movb $0x1, 0x13e(%rsp)
leaq 0x168(%rsp), %rdi
leaq 0x1f2b0(%rip), %rsi     # 0x20cb61
callq 0x1e7220
movb %al, 0x3f(%rsp)
movb 0x3f(%rsp), %al
movb %al, 0x3e(%rsp)
testb $0x1, 0x13e(%rsp)
jne 0x1ed8ce
jmp 0x1ed8db
leaq 0x168(%rsp), %rdi
callq 0x52f50
testb $0x1, 0x13f(%rsp)
jne 0x1ed8e7
jmp 0x1ed8f4
leaq 0x140(%rsp), %rdi
callq 0x1e7130
leaq 0x188(%rsp), %rdi
callq 0x52f50
movb 0x3e(%rsp), %al
testb $0x1, %al
jne 0x1ed90b
jmp 0x1ed980
jmp 0x1edc2c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2c8(%rsp)
movl %eax, 0x2c4(%rsp)
jmp 0x1edc4d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2c8(%rsp)
movl %eax, 0x2c4(%rsp)
jmp 0x1ed96e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2c8(%rsp)
movl %eax, 0x2c4(%rsp)
testb $0x1, 0x13f(%rsp)
jne 0x1ed95f
jmp 0x1ed96c
leaq 0x140(%rsp), %rdi
callq 0x1e7130
jmp 0x1ed96e
leaq 0x188(%rsp), %rdi
callq 0x52f50
jmp 0x1edc4d
leaq 0x114b11(%rip), %rdi    # 0x302498
leaq 0x20c(%rsp), %rsi
callq 0x1ef410
movq %rax, 0x30(%rsp)
jmp 0x1ed99b
movq 0x30(%rsp), %rax
movq %rax, 0x130(%rsp)
movq 0x1a8(%rsp), %rdi
callq 0x1ef860
movq %rax, %rsi
leaq 0xe8(%rsp), %rdi
callq 0x1ef870
jmp 0x1ed9c7
leaq 0x110(%rsp), %rdi
leaq 0xe8(%rsp), %rsi
callq 0x1e70b0
jmp 0x1ed9de
leaq 0xe8(%rsp), %rdi
callq 0x1e7130
movq 0x130(%rsp), %rdi
leaq 0x110(%rsp), %rsi
callq 0x1b4750
movq %rax, 0x28(%rsp)
jmp 0x1eda07
movq 0x28(%rsp), %rax
movq %rax, 0xe0(%rsp)
movq 0x130(%rsp), %rdi
callq 0x1b4780
movq %rax, 0xd8(%rsp)
leaq 0xe0(%rsp), %rdi
leaq 0xd8(%rsp), %rsi
callq 0x1b4730
testb $0x1, %al
jne 0x1eda47
jmp 0x1edb00
movl $0xffffffff, 0xc8(%rsp) # imm = 0xFFFFFFFF
movl $0x0, 0xcc(%rsp)
movl $0x0, 0xd0(%rsp)
movb $0x0, 0xd4(%rsp)
leaq 0x114a09(%rip), %rdi    # 0x302480
leaq 0xc8(%rsp), %rsi
callq 0x1ef160
jmp 0x1eda86
leaq 0x1149f3(%rip), %rdi    # 0x302480
callq 0x1ef560
decl %eax
movl %eax, 0x1c(%rsp)
movq 0x130(%rsp), %rdi
leaq 0x110(%rsp), %rsi
callq 0x1b4880
movq %rax, 0x20(%rsp)
jmp 0x1edab4
movq 0x20(%rsp), %rax
movl 0x1c(%rsp), %ecx
movl %ecx, (%rax)
jmp 0x1edb00
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2c8(%rsp)
movl %eax, 0x2c4(%rsp)
leaq 0xe8(%rsp), %rdi
callq 0x1e7130
jmp 0x1edc4d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2c8(%rsp)
movl %eax, 0x2c4(%rsp)
jmp 0x1edc40
movq 0x130(%rsp), %rdi
leaq 0x110(%rsp), %rsi
callq 0x1b4880
movq %rax, 0x10(%rsp)
jmp 0x1edb1c
movq 0x10(%rsp), %rax
movl (%rax), %eax
movl %eax, 0xc4(%rsp)
movslq 0xc4(%rsp), %rsi
leaq 0x114947(%rip), %rdi    # 0x302480
callq 0x1ef700
movl $0xffffffff, (%rax)     # imm = 0xFFFFFFFF
movq 0x1a8(%rsp), %rdi
callq 0x1ef9a0
movq %rax, 0x8(%rsp)
jmp 0x1edb58
movq 0x8(%rsp), %rax
movq %rax, 0xbc(%rsp)
movq 0xbc(%rsp), %rdi
callq 0x1ef980
testb $0x1, %al
jne 0x1edb7b
jmp 0x1edc03
movslq 0xc4(%rsp), %rsi
leaq 0x1148f6(%rip), %rdi    # 0x302480
callq 0x1ef700
movb $0x1, 0xc(%rax)
movq 0x1a8(%rsp), %rdi
callq 0x1ef860
movq %rax, %rsi
leaq 0x88(%rsp), %rdi
leaq 0xc4(%rsp), %rdx
callq 0x1ef9d0
jmp 0x1edbba
leaq 0x270(%rsp), %rdi
leaq 0x88(%rsp), %rsi
callq 0x1ef680
jmp 0x1edbd1
leaq 0x88(%rsp), %rdi
callq 0x1ef6f0
jmp 0x1edc1f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2c8(%rsp)
movl %eax, 0x2c4(%rsp)
leaq 0x88(%rsp), %rdi
callq 0x1ef6f0
jmp 0x1edc40
movslq 0xc4(%rsp), %rsi
leaq 0x114856(%rip), %rdi    # 0x302468
addq $0x18, %rdi
callq 0x1ef700
movb $0x0, 0xc(%rax)
leaq 0x110(%rsp), %rdi
callq 0x52f50
leaq 0x1e0(%rsp), %rdi
callq 0x134d0
jmp 0x1edc3b
jmp 0x1ed72b
leaq 0x110(%rsp), %rdi
callq 0x52f50
leaq 0x1c0(%rsp), %rdi
callq 0x1ef7e0
leaq 0x1e0(%rsp), %rdi
callq 0x1ef7e0
leaq 0x1f0(%rsp), %rdi
callq 0x1ef7e0
jmp 0x1edc9f
leaq 0x270(%rsp), %rdi
callq 0x1efa10
jmp 0x1edc85
jmp 0x1ed640
leaq 0x270(%rsp), %rdi
callq 0x1efa20
addq $0x328, %rsp            # imm = 0x328
retq
leaq 0x270(%rsp), %rdi
callq 0x1efa20
movq 0x2c8(%rsp), %rdi
callq 0x133f0
nopl (%rax)