// File: /workspace/github_cpp_makefile_star2_O3/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 $0x128, %rsp            # imm = 0x128
movq %rdi, %rbx
leaq 0xc352(%rip), %rsi      # 0xbd179
leaq 0x40(%rsp), %r15
movq %r15, %rdi
movl $0x2, %edx
callq 0xaf246
leaq 0xb0(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rsi
movq %r15, %rdx
callq 0x11170
cmpq %rbx, %r14
je 0xb0e64
leaq 0xb0(%rsp), %rsi
movq %rbx, %rdi
callq 0x1217a
leaq 0xb0(%rsp), %r14
movq %r14, %rdi
callq 0xaf2ce
leaq 0x40(%rsp), %rdi
callq 0xaf2ce
xorps %xmm0, %xmm0
movaps %xmm0, 0x40(%r14)
movaps %xmm0, 0x30(%r14)
movaps %xmm0, 0x20(%r14)
movaps %xmm0, 0x10(%r14)
movaps %xmm0, (%r14)
leaq 0xb0(%rsp), %rdi
xorl %esi, %esi
callq 0xb29c2
leaq 0x100(%rsp), %rdi
movq %rbx, %rsi
callq 0xaf306
leaq 0x100(%rsp), %rdi
movl $0x1, %esi
callq 0xb0a48
movl %eax, %ebp
leaq 0x40(%rsp), %rdi
movq %rbx, %rsi
callq 0xaf306
leaq 0x40(%rsp), %rsi
movl %ebp, 0x28(%rsi)
leaq 0xb0(%rsp), %rdi
callq 0xb2b60
leaq 0x40(%rsp), %rdi
callq 0xaf2ce
leaq 0x100(%rsp), %rdi
callq 0xaf2ce
movq 0xc0(%rsp), %rsi
movslq 0x28(%rsi), %rax
movq 0x6d4f8(%rip), %rcx     # 0x11e410
shlq $0x4, %rax
movl $0xffffffff, (%rcx,%rax) # imm = 0xFFFFFFFF
movb $0x1, 0xc(%rcx,%rax)
cmpq %rsi, 0xe0(%rsp)
je 0xb1313
leaq 0x30(%rsp), %rbx
leaq 0x90(%rsp), %r15
leaq 0x20(%rsp), %r12
leaq 0x40(%rsp), %r13
movl 0x28(%rsi), %eax
movl %eax, 0x1c(%rsp)
leaq 0x70(%rsp), %rdi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x111e0
movq 0x70(%rsp), %rax
movq 0x78(%rsp), %rdi
testq %rdi, %rdi
je 0xb0f8c
movq 0x6c048(%rip), %rcx     # 0x11cfc0
cmpb $0x0, (%rcx)
je 0xb0f9c
incl 0x8(%rdi)
movq %rax, 0x8(%rsp)
movq %rdi, 0x10(%rsp)
jmp 0xb0fb7
movq %rax, 0x8(%rsp)
movq $0x0, 0x10(%rsp)
jmp 0xb0fd1
lock
incl 0x8(%rdi)
movq %rax, 0x8(%rsp)
movq %rdi, 0x10(%rsp)
movq 0x78(%rsp), %rax
movq %rax, %rdi
testq %rax, %rax
je 0xb0fd1
movq 0x6c002(%rip), %rax     # 0x11cfc0
cmpb $0x0, (%rax)
je 0xb0fc8
incl 0x8(%rdi)
jmp 0xb0fcc
lock
incl 0x8(%rdi)
callq 0x26e8e
cmpq $0x0, 0x10(%rsp)
je 0xb12e1
leaq 0x8(%rsp), %rdi
callq 0x115a0
movq %rax, %r14
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
movq %rbx, 0x20(%rsp)
movq %r12, %rdi
callq 0x27370
cmpq $0x2, 0x28(%rsp)
jb 0xb1068
movq 0x8(%r14), %rcx
testq %rcx, %rcx
je 0xb106f
movq 0x20(%r14), %rax
movl %eax, %edx
notb %dl
movq %r14, %rsi
testb $0x3, %dl
je 0xb105e
movl %eax, %edx
andl $0x3, %edx
jne 0xb106f
movq (%r14), %rdx
cmpb $0x2f, -0x1(%rdx,%rcx)
je 0xb106f
movq %r14, %rsi
testb $0x3, %al
jne 0xb1058
leaq 0x20(%r14), %rdi
callq 0x11220
movq %rax, %rsi
movq 0x20(%r14), %rax
addq $-0x30, %rsi
testb $0x3, %al
cmovneq %r14, %rsi
movq 0x20(%rsi), %rax
notl %eax
testb $0x3, %al
jne 0xb106f
movq %r13, %rdi
callq 0xaf306
jmp 0xb1077
xorl %ebp, %ebp
jmp 0xb10f4
movq %r13, %rdi
callq 0xb21a8
movq 0x40(%rsp), %rsi
movq %r15, 0x80(%rsp)
movq 0x48(%rsp), %rdx
addq %rsi, %rdx
leaq 0x80(%rsp), %rdi
callq 0x27370
movq 0x80(%rsp), %rax
movq 0x88(%rsp), %rcx
movq %rcx, 0xa0(%rsp)
movq %rax, 0xa8(%rsp)
leaq 0xa0(%rsp), %rdi
leaq 0xc0b1(%rip), %rsi      # 0xbd179
callq 0xafadc
movl %eax, %ebp
movq 0x80(%rsp), %rdi
cmpq %r15, %rdi
je 0xb10ec
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x11360
movq %r13, %rdi
callq 0xaf2ce
movq 0x20(%rsp), %rdi
cmpq %rbx, %rdi
je 0xb110b
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x11360
testb %bpl, %bpl
jne 0xb12d2
leaq 0x6d30d(%rip), %rdi     # 0x11e428
leaq 0x1c(%rsp), %rsi
callq 0xb274c
movq %rax, %rbp
movq 0x8(%r14), %rcx
testq %rcx, %rcx
je 0xb1187
movq 0x20(%r14), %rax
movl %eax, %edx
notb %dl
movq %r14, %rsi
testb $0x3, %dl
je 0xb117d
movl %eax, %edx
andl $0x3, %edx
jne 0xb1187
movq (%r14), %rdx
cmpb $0x2f, -0x1(%rdx,%rcx)
je 0xb1187
movq %r14, %rsi
testb $0x3, %al
jne 0xb1177
leaq 0x20(%r14), %rdi
callq 0x11220
movq %rax, %rsi
movq 0x20(%r14), %rax
addq $-0x30, %rsi
testb $0x3, %al
cmovneq %r14, %rsi
movq 0x20(%rsi), %rax
notl %eax
testb $0x3, %al
jne 0xb1187
movq %r13, %rdi
callq 0xaf306
jmp 0xb118f
movq %r13, %rdi
callq 0xb21a8
movq 0x40(%rsp), %rsi
movq %rbx, 0x20(%rsp)
movq 0x48(%rsp), %rdx
addq %rsi, %rdx
movq %r12, %rdi
callq 0x27370
movq %r13, %rdi
callq 0xaf2ce
movq %rbp, %rdi
movq %r12, %rsi
callq 0x9b13a
testq %rax, %rax
jne 0xb123f
movl $0xffffffff, 0x40(%rsp) # imm = 0xFFFFFFFF
leaq 0x44(%rsp), %rax
movb $0x0, 0x8(%rax)
movq $0x0, (%rax)
movq 0x6d238(%rip), %rsi     # 0x11e418
cmpq 0x6d239(%rip), %rsi     # 0x11e420
je 0xb1205
movups 0x40(%rsp), %xmm0
movups %xmm0, (%rsi)
movq 0x6d220(%rip), %r15     # 0x11e418
addq $0x10, %r15
movq %r15, 0x6d215(%rip)     # 0x11e418
jmp 0xb121b
leaq 0x6d204(%rip), %rdi     # 0x11e410
movq %r13, %rdx
callq 0xb2318
movq 0x6d1fd(%rip), %r15     # 0x11e418
movq 0x6d1ee(%rip), %rbx     # 0x11e410
movq %rbp, %rdi
movq %r12, %rsi
callq 0x9b46a
subq %rbx, %r15
shrq $0x4, %r15
decl %r15d
movl %r15d, (%rax)
leaq 0x30(%rsp), %rbx
movq %rbp, %rdi
movq %r12, %rsi
callq 0x9b46a
movl (%rax), %ebp
movslq %ebp, %r15
movq 0x6d1ba(%rip), %rax     # 0x11e410
shlq $0x4, %r15
movl $0xffffffff, (%rax,%r15) # imm = 0xFFFFFFFF
movq %r14, %rdi
callq 0x11160
movq 0x6d19f(%rip), %rcx     # 0x11e410
addq %r15, %rcx
addq $0xc, %rcx
cmpb $0x2, %al
jne 0xb12b0
movb $0x1, (%rcx)
movq %r13, %rdi
movq %r14, %rsi
callq 0xaf306
leaq 0x90(%rsp), %r15
movl %ebp, 0x68(%rsp)
leaq 0xb0(%rsp), %rdi
movq %r13, %rsi
callq 0xb2b60
movq %r13, %rdi
callq 0xaf2ce
jmp 0xb12bb
movb $0x0, (%rcx)
leaq 0x90(%rsp), %r15
movq 0x20(%rsp), %rdi
cmpq %rbx, %rdi
je 0xb12d2
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x11360
leaq 0x8(%rsp), %rdi
callq 0x11130
jmp 0xb0fd1
movq 0x78(%rsp), %rdi
testq %rdi, %rdi
je 0xb12f0
callq 0x26e8e
leaq 0xb0(%rsp), %rdi
callq 0xb2dfe
movq 0xc0(%rsp), %rsi
cmpq %rsi, 0xe0(%rsp)
jne 0xb0f4d
leaq 0xb0(%rsp), %rdi
callq 0xb21d0
addq $0x128, %rsp            # imm = 0x128
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
leaq 0x40(%rsp), %rdi
callq 0xaf2ce
jmp 0xb1358
jmp 0xb1367
movq %rax, %r14
leaq 0x40(%rsp), %rdi
callq 0xaf2ce
jmp 0xb13ee
movq %rax, %r14
leaq 0x100(%rsp), %rdi
callq 0xaf2ce
jmp 0xb13e1
movq %rax, %r14
jmp 0xb13e1
jmp 0xb13a2
jmp 0xb13c0
jmp 0xb13a2
movq %rax, %r14
leaq 0x30(%rsp), %rbx
jmp 0xb13a5
jmp 0xb138f
jmp 0xb13a2
movq %rax, %r14
leaq 0x40(%rsp), %rdi
callq 0xaf2ce
jmp 0xb13c3
movq %rax, %r14
leaq 0x40(%rsp), %rdi
callq 0xaf2ce
jmp 0xb13a5
jmp 0xb13a2
jmp 0xb13c0
movq %rax, %r14
movq 0x20(%rsp), %rdi
cmpq %rbx, %rdi
je 0xb13c3
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x11360
jmp 0xb13c3
jmp 0xb13c0
movq %rax, %r14
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0xb13d2
callq 0x26e8e
movq 0x78(%rsp), %rdi
testq %rdi, %rdi
je 0xb13e1
callq 0x26e8e
leaq 0xb0(%rsp), %rdi
callq 0xb21d0
movq %r14, %rdi
callq 0x11580