// File: /workspace/github_cpp_makefile_star2_O2/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:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x148, %rsp            # imm = 0x148
movq %rdi, %rbx
leaq 0xa1b2(%rip), %rsi      # 0x97201
leaq 0x50(%rsp), %r14
pushq $0x2
popq %rdx
movq %r14, %rdi
callq 0x8b5a4
leaq 0x80(%rsp), %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x11170
leaq 0x80(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x8defa
movq %r14, %rdi
callq 0x8b62c
leaq 0x50(%rsp), %rdi
callq 0x8b62c
leaq 0x80(%rsp), %rdi
callq 0x8df32
leaq 0x100(%rsp), %rdi
movq %rbx, %rsi
callq 0x8b67e
leaq 0x100(%rsp), %rdi
pushq $0x1
popq %rsi
callq 0x8cde6
movl %eax, %ebp
leaq 0x50(%rsp), %rdi
movq %rbx, %rsi
callq 0x8b67e
leaq 0x50(%rsp), %rsi
movl %ebp, 0x28(%rsi)
leaq 0x80(%rsp), %rdi
callq 0x8ebaa
leaq 0x50(%rsp), %r12
movq %r12, %rdi
callq 0x8b62c
leaq 0x100(%rsp), %rdi
callq 0x8b62c
leaq 0x80(%rsp), %rax
movq 0x10(%rax), %rsi
movslq 0x28(%rsi), %rax
movq 0x7a2e7(%rip), %rcx     # 0x107400
shlq $0x4, %rax
orl $-0x1, (%rcx,%rax)
movb $0x1, 0xc(%rcx,%rax)
leaq 0x40(%rsp), %rbx
leaq 0xd0(%rsp), %r15
leaq 0x128(%rsp), %rbp
cmpq %rsi, 0xb0(%rsp)
je 0x8d385
movl 0x28(%rsi), %eax
movl %eax, 0xc(%rsp)
movq %rbx, %rdi
callq 0x8df4e
leaq 0x30(%rsp), %rdi
movq %rbx, %rsi
callq 0x8e118
movaps 0x30(%rsp), %xmm0
movaps %xmm0, 0x10(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x30(%rsp)
leaq 0x38(%rsp), %rdi
callq 0x21624
leaq 0xf0(%rsp), %rdi
movq %rbx, %rsi
callq 0x8e118
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rsp)
leaq 0xf8(%rsp), %rdi
callq 0x21624
leaq 0x10(%rsp), %rbx
movq 0x18(%rsp), %rax
cmpq 0x28(%rsp), %rax
je 0x8d348
movq %rbx, %rdi
callq 0x11590
movq %rax, %r13
movq %r15, %rdi
movq %rax, %rsi
callq 0x8b610
cmpq $0x2, 0xd8(%rsp)
jb 0x8d226
movq %r12, %rdi
movq %r13, %rsi
callq 0x8df58
movq %rbp, %rdi
movq %r12, %rsi
callq 0x8b610
movq %rbp, %rdi
leaq 0xa005(%rip), %rsi      # 0x97201
callq 0x8b65c
movl %eax, %r14d
movq %rbp, %rdi
callq 0x209be
movq %r12, %rdi
callq 0x8b62c
movq %r15, %rdi
callq 0x209be
testb %r14b, %r14b
je 0x8d22e
jmp 0x8d33b
movq %r15, %rdi
callq 0x209be
leaq 0x7a1e3(%rip), %rdi     # 0x107418
leaq 0xc(%rsp), %rsi
callq 0x8e7c8
movq %rax, %r14
movq %r12, %rdi
movq %r13, %rsi
callq 0x8df58
movq %r15, %rdi
movq %r12, %rsi
callq 0x8b610
movq %r12, %rdi
callq 0x8b62c
movq %r14, %rdi
movq %r15, %rsi
callq 0x7a3e8
testq %rax, %rax
jne 0x8d2b9
orl $-0x1, 0x50(%rsp)
movb $0x0, 0xc(%r12)
andq $0x0, 0x4(%r12)
leaq 0x7a178(%rip), %rdi     # 0x107400
movq %r12, %rsi
callq 0x8e2d6
movq 0x7a171(%rip), %rbp     # 0x107408
movq 0x7a162(%rip), %rbx     # 0x107400
movq %r14, %rdi
movq %r15, %rsi
callq 0x7a76e
subq %rbx, %rbp
shrq $0x4, %rbp
decl %ebp
movl %ebp, (%rax)
leaq 0x10(%rsp), %rbx
movq %r14, %rdi
movq %r15, %rsi
callq 0x7a76e
movl (%rax), %r14d
movslq %r14d, %rbp
movq 0x7a12f(%rip), %rax     # 0x107400
shlq $0x4, %rbp
orl $-0x1, (%rax,%rbp)
movq %r13, %rdi
callq 0x11160
movq 0x7a118(%rip), %rcx     # 0x107400
addq %rbp, %rcx
addq $0xc, %rcx
cmpb $0x2, %al
jne 0x8d328
movb $0x1, (%rcx)
movq %r12, %rdi
movq %r13, %rsi
callq 0x8b67e
leaq 0x128(%rsp), %rbp
movl %r14d, 0x78(%rsp)
leaq 0x80(%rsp), %rdi
movq %r12, %rsi
callq 0x8ebaa
movq %r12, %rdi
callq 0x8b62c
jmp 0x8d333
movb $0x0, (%rcx)
leaq 0x128(%rsp), %rbp
movq %r15, %rdi
callq 0x209be
movq %rbx, %rdi
callq 0x11130
jmp 0x8d1ab
leaq 0x28(%rsp), %rdi
callq 0x21624
leaq 0x18(%rsp), %rdi
callq 0x21624
leaq 0x48(%rsp), %rdi
callq 0x21624
leaq 0x80(%rsp), %rdi
callq 0x8ee32
movq 0x90(%rsp), %rsi
leaq 0x40(%rsp), %rbx
jmp 0x8d13b
leaq 0x80(%rsp), %rdi
callq 0x8e150
addq $0x148, %rsp            # imm = 0x148
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0x8b62c
jmp 0x8d3ca
jmp 0x8d3d9
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0x8b62c
jmp 0x8d44e
movq %rax, %rbx
leaq 0x100(%rsp), %rdi
callq 0x8b62c
jmp 0x8d441
movq %rax, %rbx
jmp 0x8d441
jmp 0x8d413
jmp 0x8d413
jmp 0x8d3e6
jmp 0x8d413
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0x8b62c
jmp 0x8d416
jmp 0x8d413
jmp 0x8d40e
jmp 0x8d40e
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0x8b62c
jmp 0x8d423
jmp 0x8d413
jmp 0x8d40e
movq %rax, %rbx
jmp 0x8d423
movq %rax, %rbx
leaq 0xd0(%rsp), %rdi
callq 0x209be
leaq 0x28(%rsp), %rdi
callq 0x21624
leaq 0x18(%rsp), %rdi
callq 0x21624
leaq 0x48(%rsp), %rdi
callq 0x21624
leaq 0x80(%rsp), %rdi
callq 0x8e150
movq %rbx, %rdi
callq 0x11570