// File: /workspace/github_cpp_makefile_star2_O1/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 0xc49c(%rip), %rsi      # 0xbe1a9
leaq 0x8(%rsp), %r15
movq %r15, %rdi
movl $0x2, %edx
callq 0xb0100
leaq 0xa0(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rsi
movq %r15, %rdx
callq 0x11170
cmpq %rbx, %r14
je 0xb1d4a
leaq 0xa0(%rsp), %rsi
movq %rbx, %rdi
callq 0x12170
leaq 0xa0(%rsp), %r14
movq %r14, %rdi
callq 0xb0188
leaq 0x8(%rsp), %rdi
callq 0xb0188
xorps %xmm0, %xmm0
movaps %xmm0, 0x40(%r14)
movaps %xmm0, 0x30(%r14)
movaps %xmm0, 0x20(%r14)
movaps %xmm0, 0x10(%r14)
movaps %xmm0, (%r14)
leaq 0xa0(%rsp), %rdi
xorl %esi, %esi
callq 0xb38fe
leaq 0x120(%rsp), %rdi
movq %rbx, %rsi
callq 0xb01c0
leaq 0x120(%rsp), %rdi
movl $0x1, %esi
callq 0xb191c
movl %eax, %ebp
leaq 0x8(%rsp), %rdi
movq %rbx, %rsi
callq 0xb01c0
leaq 0x8(%rsp), %rsi
movl %ebp, 0x28(%rsi)
leaq 0xa0(%rsp), %rdi
callq 0xb3a9c
leaq 0x8(%rsp), %rdi
callq 0xb0188
leaq 0x120(%rsp), %rdi
callq 0xb0188
movq 0xb0(%rsp), %rax
movslq 0x28(%rax), %rax
movq 0x6d612(%rip), %rcx     # 0x11f410
shlq $0x4, %rax
movl $0xffffffff, (%rcx,%rax) # imm = 0xFFFFFFFF
movb $0x1, 0xc(%rcx,%rax)
movq 0xb0(%rsp), %rsi
cmpq %rsi, 0xd0(%rsp)
je 0xb2214
leaq 0x60(%rsp), %r14
leaq 0x8(%rsp), %r12
leaq 0x50(%rsp), %r15
movl 0x28(%rsi), %eax
movl %eax, 0x3c(%rsp)
leaq 0x70(%rsp), %rdi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x111e0
movq 0x70(%rsp), %rax
movq 0x78(%rsp), %rcx
testq %rcx, %rcx
je 0xb1e6c
movq 0x6c162(%rip), %rdx     # 0x11dfc0
cmpb $0x0, (%rdx)
je 0xb1e68
incl 0x8(%rcx)
jmp 0xb1e6c
lock
incl 0x8(%rcx)
movq %rax, 0x40(%rsp)
movq %rcx, 0x48(%rsp)
movq 0x78(%rsp), %rdi
testq %rdi, %rdi
je 0xb1e9f
movq 0x6c139(%rip), %rax     # 0x11dfc0
cmpb $0x0, (%rax)
je 0xb1e91
incl 0x8(%rdi)
jmp 0xb1e95
lock
incl 0x8(%rdi)
testq %rdi, %rdi
je 0xb1e9f
callq 0x278ec
cmpq $0x0, 0x48(%rsp)
je 0xb21d3
leaq 0x40(%rsp), %rdi
callq 0x115a0
movq %rax, %rbp
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
leaq 0x18(%rsp), %rax
movq %rax, 0x8(%rsp)
movq %r12, %rdi
callq 0x27dc8
movq %r15, %r13
movq 0x10(%rsp), %r15
cmpq $0x2, %r15
jb 0xb1f16
movq 0x8(%rbp), %rax
testq %rax, %rax
je 0xb1f4e
movq 0x20(%rbp), %rcx
movl %ecx, %edx
notb %dl
movq %rbp, %rsi
testb $0x3, %dl
je 0xb1f3f
movl %ecx, %edx
andl $0x3, %edx
jne 0xb1f4e
movq (%rbp), %rdx
cmpb $0x2f, -0x1(%rdx,%rax)
je 0xb1f4e
testb $0x3, %cl
je 0xb1f1d
xorl %eax, %eax
jmp 0xb1f26
xorl %ebx, %ebx
jmp 0xb1fb6
leaq 0x20(%rbp), %rdi
callq 0x11220
leaq -0x30(%rax), %rsi
testb $0x3, 0x20(%rbp)
cmovneq %rax, %rsi
cmovneq %rbp, %rsi
movl 0x20(%rsi), %eax
notl %eax
testb $0x3, %al
jne 0xb1f4e
leaq 0xf8(%rsp), %rdi
callq 0xb01c0
jmp 0xb1f5b
leaq 0xf8(%rsp), %rdi
callq 0xb30cc
movq 0xf8(%rsp), %rsi
leaq 0x90(%rsp), %rax
movq %rax, 0x80(%rsp)
movq 0x100(%rsp), %rdx
addq %rsi, %rdx
leaq 0x80(%rsp), %rdi
callq 0x27dc8
movq 0x80(%rsp), %rax
movq 0x88(%rsp), %rcx
movq %rcx, 0x50(%rsp)
movq %rax, 0x58(%rsp)
movq %r13, %rdi
leaq 0xc1fa(%rip), %rsi      # 0xbe1a9
callq 0xb098c
movl %eax, %ebx
cmpq $0x2, %r15
movq %r13, %r15
jb 0xb1ff1
movq 0x80(%rsp), %rdi
leaq 0x90(%rsp), %rax
cmpq %rax, %rdi
je 0xb1fe4
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x11360
leaq 0xf8(%rsp), %rdi
callq 0xb0188
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0xb200d
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x11360
testb %bl, %bl
jne 0xb21c4
leaq 0x6d40c(%rip), %rdi     # 0x11f428
leaq 0x3c(%rsp), %rsi
callq 0xb3698
movq %rax, %rbx
movq 0x8(%rbp), %rax
testq %rax, %rax
je 0xb208c
movq 0x20(%rbp), %rcx
movl %ecx, %edx
notb %dl
movq %rbp, %rsi
testb $0x3, %dl
je 0xb2082
movl %ecx, %edx
andl $0x3, %edx
jne 0xb208c
movq (%rbp), %rdx
cmpb $0x2f, -0x1(%rdx,%rax)
je 0xb208c
testb $0x3, %cl
je 0xb205d
xorl %eax, %eax
jmp 0xb2066
leaq 0x20(%rbp), %rdi
callq 0x11220
leaq -0x30(%rax), %rcx
testb $0x3, 0x20(%rbp)
cmovneq %rax, %rcx
movq %rbp, %rsi
cmoveq %rcx, %rsi
movl 0x20(%rsi), %eax
notl %eax
testb $0x3, %al
jne 0xb208c
movq %r12, %rdi
callq 0xb01c0
jmp 0xb2094
movq %r12, %rdi
callq 0xb30cc
movq 0x8(%rsp), %rsi
movq %r14, 0x50(%rsp)
movq 0x10(%rsp), %rdx
addq %rsi, %rdx
movq %r15, %rdi
callq 0x27dc8
movq %r12, %rdi
callq 0xb0188
movq %rbx, %rdi
movq %r15, %rsi
callq 0x9bd66
testq %rax, %rax
jne 0xb213e
movl $0xffffffff, 0x8(%rsp)  # imm = 0xFFFFFFFF
leaq 0x18(%rsp), %rax
movb $0x0, -0x4(%rax)
movq $0x0, -0xc(%rax)
movq 0x6d332(%rip), %rsi     # 0x11f418
cmpq 0x6d333(%rip), %rsi     # 0x11f420
je 0xb2101
movups 0x8(%rsp), %xmm0
movups %xmm0, (%rsi)
addq $0x10, 0x6d319(%rip)    # 0x11f418
jmp 0xb2110
leaq 0x6d308(%rip), %rdi     # 0x11f410
movq %r12, %rdx
callq 0xb322e
movq 0x6d301(%rip), %r15     # 0x11f418
movq 0x6d2f2(%rip), %r14     # 0x11f410
movq %rbx, %rdi
movq %r13, %rsi
callq 0x9c09a
subq %r14, %r15
shrq $0x4, %r15
decl %r15d
movl %r15d, (%rax)
leaq 0x60(%rsp), %r14
movq %r13, %r15
movq %rbx, %rdi
movq %r15, %rsi
callq 0x9c09a
movl (%rax), %ebx
movslq %ebx, %r15
movq 0x6d2bb(%rip), %rax     # 0x11f410
shlq $0x4, %r15
movl $0xffffffff, (%rax,%r15) # imm = 0xFFFFFFFF
movq %rbp, %rdi
callq 0x11160
movq 0x6d2a0(%rip), %rcx     # 0x11f410
addq %r15, %rcx
addq $0xc, %rcx
cmpb $0x2, %al
jne 0xb21a7
movb $0x1, (%rcx)
movq %r12, %rdi
movq %rbp, %rsi
callq 0xb01c0
movl %ebx, 0x30(%rsp)
leaq 0xa0(%rsp), %rdi
movq %r12, %rsi
callq 0xb3a9c
movq %r12, %rdi
callq 0xb0188
jmp 0xb21aa
movb $0x0, (%rcx)
movq 0x50(%rsp), %rdi
cmpq %r14, %rdi
movq %r13, %r15
je 0xb21c4
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x11360
leaq 0x40(%rsp), %rdi
callq 0x11130
jmp 0xb1e9f
movq 0x48(%rsp), %rdi
testq %rdi, %rdi
je 0xb21e2
callq 0x278ec
movq 0x78(%rsp), %rdi
testq %rdi, %rdi
je 0xb21f1
callq 0x278ec
leaq 0xa0(%rsp), %rdi
callq 0xb3d32
movq 0xb0(%rsp), %rsi
cmpq %rsi, 0xd0(%rsp)
jne 0xb1e33
leaq 0xa0(%rsp), %rdi
callq 0xb30f4
addq $0x148, %rsp            # imm = 0x148
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0xb0188
jmp 0xb2259
jmp 0xb226b
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0xb0188
jmp 0xb231c
movq %rax, %rbx
leaq 0x120(%rsp), %rdi
callq 0xb0188
jmp 0xb230f
movq %rax, %rbx
jmp 0xb230f
jmp 0xb227c
jmp 0xb22ee
movq %rax, %rbx
jmp 0xb22b6
movq %rax, %rbx
leaq 0x60(%rsp), %r14
jmp 0xb22d3
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0xb0188
jmp 0xb22d3
jmp 0xb22d0
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0xb0188
jmp 0xb22f1
movq %rax, %rbx
leaq 0xf8(%rsp), %rdi
callq 0xb0188
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0xb22f1
movq 0x18(%rsp), %rsi
jmp 0xb22e2
jmp 0xb22d0
jmp 0xb22ee
movq %rax, %rbx
movq 0x50(%rsp), %rdi
cmpq %r14, %rdi
je 0xb22f1
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x11360
jmp 0xb22f1
jmp 0xb22ee
movq %rax, %rbx
movq 0x48(%rsp), %rdi
testq %rdi, %rdi
je 0xb2300
callq 0x278ec
movq 0x78(%rsp), %rdi
testq %rdi, %rdi
je 0xb230f
callq 0x278ec
leaq 0xa0(%rsp), %rdi
callq 0xb30f4
movq %rbx, %rdi
callq 0x11580