// File: Heptagon196[P]Gos/GosFileSystem.cpp
// Function: Gos::FileSystem::Iterate(std::filesystem::__cxx11::path, std::function<void (std::filesystem::__cxx11::path)>)
void Gos::FileSystem::Iterate(Path dir, std::function<void(Path)> action) {
    dir = dir.lexically_relative(".");
    std::queue<std::pair<Path, int>> dirs;
    dirs.push({dir, FileSystem::GetFile(dir, false)});
    while (!dirs.empty()) {
        int cur = dirs.front().second;
        for (auto& file: instance.structure[cur]) {
            if (file.first == ".") {
                continue;
            }
            Path curPath = dirs.front().first;
            curPath.append(file.first);
            if (instance.files[file.second].directory) {
                dirs.push({curPath, file.second});
            } else {
                action(curPath.lexically_relative("."));
            }
        }
        dirs.pop();
    }
}

// Assembly:
subq $0x238, %rsp            # imm = 0x238
movq %rdi, 0x38(%rsp)
movq %rsi, 0x30(%rsp)
movq %rdi, 0x230(%rsp)
movq %rsi, 0x228(%rsp)
leaq 0x1e989(%rip), %rsi     # 0x20cb61
leaq 0x1d8(%rsp), %rdi
movq %rdi, 0x40(%rsp)
movl $0x2, %edx
callq 0x1e6fb0
movq 0x38(%rsp), %rsi
movq 0x40(%rsp), %rdx
leaq 0x200(%rsp), %rdi
callq 0x13180
jmp 0x1ee208
movq 0x38(%rsp), %rdi
leaq 0x200(%rsp), %rsi
movq %rsi, 0x28(%rsp)
callq 0x1ef5e0
movq 0x28(%rsp), %rdi
callq 0x1e7130
leaq 0x1d8(%rsp), %rdi
callq 0x1e7130
leaq 0x178(%rsp), %rdi
callq 0x1ef650
movq 0x38(%rsp), %rsi
leaq 0x118(%rsp), %rdi
callq 0x1e7280
jmp 0x1ee257
leaq 0x118(%rsp), %rdi
xorl %esi, %esi
callq 0x1ed070
movl %eax, 0x24(%rsp)
jmp 0x1ee26c
movq 0x38(%rsp), %rsi
movl 0x24(%rsp), %eax
movl %eax, 0x144(%rsp)
leaq 0x148(%rsp), %rdi
leaq 0x144(%rsp), %rdx
callq 0x1ef6b0
jmp 0x1ee293
leaq 0x178(%rsp), %rdi
leaq 0x148(%rsp), %rsi
callq 0x1ef680
jmp 0x1ee2aa
leaq 0x148(%rsp), %rdi
callq 0x1ef6f0
leaq 0x118(%rsp), %rdi
callq 0x1e7130
leaq 0x178(%rsp), %rdi
callq 0x1ef730
movb %al, 0x23(%rsp)
jmp 0x1ee2d7
movb 0x23(%rsp), %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x1ee2e6
jmp 0x1ee60c
leaq 0x178(%rsp), %rdi
callq 0x1ef720
movq %rax, 0x18(%rsp)
jmp 0x1ee2fa
movq 0x18(%rsp), %rax
movl 0x28(%rax), %eax
movl %eax, 0x114(%rsp)
leaq 0x114188(%rip), %rdi    # 0x302498
leaq 0x114(%rsp), %rsi
callq 0x1ef410
movq %rax, 0x10(%rsp)
jmp 0x1ee324
movq 0x10(%rsp), %rax
movq %rax, 0x108(%rsp)
movq 0x108(%rsp), %rdi
callq 0x1b4d60
movq %rax, 0x100(%rsp)
movq 0x108(%rsp), %rdi
callq 0x1b4780
movq %rax, 0xf8(%rsp)
leaq 0x100(%rsp), %rdi
leaq 0xf8(%rsp), %rsi
callq 0x1b4730
xorb $-0x1, %al
testb $0x1, %al
jne 0x1ee37b
jmp 0x1ee5f8
leaq 0x100(%rsp), %rdi
callq 0x1b4d90
movq %rax, 0xf0(%rsp)
movq 0xf0(%rsp), %rdi
leaq 0x1e7c2(%rip), %rsi     # 0x20cb61
callq 0x56430
movb %al, 0xf(%rsp)
jmp 0x1ee3aa
movb 0xf(%rsp), %al
testb $0x1, %al
jne 0x1ee3b7
jmp 0x1ee444
jmp 0x1ee5d7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1d0(%rsp)
movl %eax, 0x1cc(%rsp)
leaq 0x1d8(%rsp), %rdi
callq 0x1e7130
jmp 0x1ee62e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1d0(%rsp)
movl %eax, 0x1cc(%rsp)
jmp 0x1ee621
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1d0(%rsp)
movl %eax, 0x1cc(%rsp)
jmp 0x1ee432
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1d0(%rsp)
movl %eax, 0x1cc(%rsp)
leaq 0x148(%rsp), %rdi
callq 0x1ef6f0
leaq 0x118(%rsp), %rdi
callq 0x1e7130
jmp 0x1ee621
leaq 0x178(%rsp), %rdi
callq 0x1ef720
movq %rax, (%rsp)
jmp 0x1ee457
movq (%rsp), %rsi
leaq 0xc8(%rsp), %rdi
callq 0x1e7280
jmp 0x1ee46a
movq 0xf0(%rsp), %rsi
leaq 0xc8(%rsp), %rdi
callq 0x1e7340
jmp 0x1ee481
movq 0xf0(%rsp), %rax
movslq 0x20(%rax), %rsi
leaq 0x113fd4(%rip), %rdi    # 0x302468
addq $0x18, %rdi
callq 0x1ef700
testb $0x1, 0xc(%rax)
je 0x1ee532
movq 0xf0(%rsp), %rdx
addq $0x20, %rdx
leaq 0x98(%rsp), %rdi
leaq 0xc8(%rsp), %rsi
callq 0x1efba0
jmp 0x1ee4ca
leaq 0x178(%rsp), %rdi
leaq 0x98(%rsp), %rsi
callq 0x1ef680
jmp 0x1ee4e1
leaq 0x98(%rsp), %rdi
callq 0x1ef6f0
jmp 0x1ee5ca
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1d0(%rsp)
movl %eax, 0x1cc(%rsp)
jmp 0x1ee5e9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1d0(%rsp)
movl %eax, 0x1cc(%rsp)
leaq 0x98(%rsp), %rdi
callq 0x1ef6f0
jmp 0x1ee5e9
leaq 0x1e628(%rip), %rsi     # 0x20cb61
leaq 0x48(%rsp), %rdi
movl $0x2, %edx
callq 0x1e6fb0
jmp 0x1ee54a
leaq 0x70(%rsp), %rdi
leaq 0xc8(%rsp), %rsi
leaq 0x48(%rsp), %rdx
callq 0x13180
jmp 0x1ee563
movq 0x30(%rsp), %rdi
leaq 0x70(%rsp), %rsi
callq 0x1efbe0
jmp 0x1ee574
leaq 0x70(%rsp), %rdi
callq 0x1e7130
leaq 0x48(%rsp), %rdi
callq 0x1e7130
jmp 0x1ee5ca
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1d0(%rsp)
movl %eax, 0x1cc(%rsp)
jmp 0x1ee5be
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1d0(%rsp)
movl %eax, 0x1cc(%rsp)
leaq 0x70(%rsp), %rdi
callq 0x1e7130
leaq 0x48(%rsp), %rdi
callq 0x1e7130
jmp 0x1ee5e9
leaq 0xc8(%rsp), %rdi
callq 0x1e7130
leaq 0x100(%rsp), %rdi
callq 0x1b4e20
jmp 0x1ee35b
leaq 0xc8(%rsp), %rdi
callq 0x1e7130
jmp 0x1ee621
leaq 0x178(%rsp), %rdi
callq 0x1efa10
jmp 0x1ee607
jmp 0x1ee2c4
leaq 0x178(%rsp), %rdi
callq 0x1efa20
addq $0x238, %rsp            # imm = 0x238
retq
leaq 0x178(%rsp), %rdi
callq 0x1efa20
movq 0x1d0(%rsp), %rdi
callq 0x133f0
nopl (%rax,%rax)