// File: /workspace/github_cpp_makefile_star2_O1/akojo[P]quickfind/qfind.cpp
// Function: main
int main(int argc, char *argv[])
{
    auto flags = 0;
    int opt{};

    while ((opt = getopt(argc, argv, "adfh")) != -1) {
        switch (opt) {
        case 'a':
            flags |= DW_HIDDEN;
            break;
        case 'd':
            flags |= DW_DIRECTORIES;
            break;
        case 'f':
            flags |= DW_FILES;
            break;
        case 'h':
        case '?':
        default:
            usage();
        }
    }
    argc -= optind;
    argv += optind;

    if ((flags & (DW_DIRECTORIES | DW_FILES)) == 0) {
        flags |= DW_DIRECTORIES | DW_FILES;
    }

    vector<string> dirs = { "." };
    if (argc > 1) {
        dirs.clear();
        for (int i = 1; i < argc; ++i) {
            auto len = strlen(argv[i]);
            if (argv[i][len - 1] == '/')
                argv[i][len - 1] = '\0';
            dirs.emplace_back(argv[i]);
        }
    }

    string pattern = argc == 0 ? "" : *argv;
    vector<wstr> strings;
    for (auto& dir : dirs)
        dirwalk(dir, flags, [&](auto name) { strings.emplace_back(name); });
    auto last = match(strings.begin(), strings.end(), pattern);
    for_each(strings.begin(), last, [](auto& s) { puts(s.str.c_str()); });

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
movq %rsi, %r14
movl %edi, %ebp
xorl %r15d, %r15d
leaq 0x2c7e(%rip), %rbx      # 0x512b
movl %ebp, %edi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x2030
cmpl $0x63, %eax
jle 0x24d4
cmpl $0x66, %eax
je 0x24e0
cmpl $0x64, %eax
jne 0x277d
movl $0x2, %ecx
jmp 0x24e5
movl $0x1, %ecx
cmpl $0x61, %eax
je 0x24e5
jmp 0x24ea
movl $0x4, %ecx
orl %ecx, %r15d
jmp 0x24ad
cmpl $-0x1, %eax
jne 0x277d
movq 0x4ad6(%rip), %rax      # 0x6fd0
movslq (%rax), %rbx
movl %r15d, %eax
orl $0x6, %eax
testb $0x6, %r15b
cmovnel %r15d, %eax
movl %eax, 0xc(%rsp)
leaq 0x20(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x2c10(%rip), %rsi      # 0x5130
leaq 0x2c0a(%rip), %rdx      # 0x5131
leaq 0x10(%rsp), %rdi
callq 0x2a8c
leaq 0x58(%rsp), %rdi
leaq 0x10(%rsp), %rsi
leaq 0x30(%rsp), %rcx
movl $0x1, %edx
callq 0x28ac
movl %ebp, %r15d
movq %rbx, 0x50(%rsp)
subl %ebx, %r15d
movq 0x10(%rsp), %rdi
cmpq %r12, %rdi
je 0x256c
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x2140
cmpl $0x2, %r15d
jl 0x2602
movq 0x58(%rsp), %rbx
movq 0x60(%rsp), %r12
cmpq %rbx, %r12
je 0x25b3
leaq 0x10(%rbx), %r13
movq -0x10(%r13), %rdi
cmpq %rdi, %r13
je 0x259e
movq (%r13), %rsi
incq %rsi
callq 0x2140
leaq 0x20(%r13), %rax
addq $0x10, %r13
cmpq %r12, %r13
movq %rax, %r13
jne 0x2589
movq %rbx, 0x60(%rsp)
cmpl $0x3, %r15d
movl $0x2, %ebx
cmovgel %r15d, %ebx
movq 0x50(%rsp), %rax
leaq (%r14,%rax,8), %r15
addq $0x8, %r15
decq %rbx
leaq 0x58(%rsp), %r12
movq (%r15), %r13
movq %r13, %rdi
callq 0x2080
cmpb $0x2f, -0x1(%r13,%rax)
jne 0x25ee
movb $0x0, -0x1(%r13,%rax)
movq %r12, %rdi
movq %r15, %rsi
callq 0x28f4
addq $0x8, %r15
decq %rbx
jne 0x25d5
movq 0x50(%rsp), %rax
cmpl %ebp, %eax
jne 0x2614
leaq 0x2b7a(%rip), %rsi      # 0x518c
jmp 0x2618
movq (%r14,%rax,8), %rsi
leaq 0x10(%rsp), %rdi
leaq 0x30(%rsp), %rdx
callq 0x286e
xorps %xmm0, %xmm0
movaps %xmm0, 0x30(%rsp)
movq $0x0, 0x40(%rsp)
movq 0x58(%rsp), %rbp
movq 0x60(%rsp), %rbx
cmpq %rbx, %rbp
je 0x2706
leaq 0xa8(%rsp), %r13
leaq 0x98(%rsp), %r15
leaq 0x1e6(%rip), %r14       # 0x2848
leaq 0x70(%rsp), %r12
movq %r13, 0x98(%rsp)
movq (%rbp), %rsi
movq 0x8(%rbp), %rdx
addq %rsi, %rdx
movq %r15, %rdi
callq 0x29fc
xorps %xmm0, %xmm0
movaps %xmm0, 0x70(%rsp)
movaps %xmm0, 0x80(%rsp)
leaq 0x30(%rsp), %rax
movq %rax, 0x70(%rsp)
leaq 0x191(%rip), %rax       # 0x2834
movq %rax, 0x88(%rsp)
movq %r14, 0x80(%rsp)
movq %r15, %rdi
movl 0xc(%rsp), %esi
movq %r12, %rdx
callq 0x314c
movq 0x80(%rsp), %rax
testq %rax, %rax
je 0x26dc
movq %r12, %rdi
movq %r12, %rsi
movl $0x3, %edx
callq *%rax
movq 0x98(%rsp), %rdi
cmpq %r13, %rdi
je 0x26f9
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x2140
addq $0x20, %rbp
cmpq %rbx, %rbp
jne 0x2667
movq 0x30(%rsp), %rdi
movq 0x38(%rsp), %rsi
leaq 0x10(%rsp), %rdx
callq 0x33b8
movq %rax, %rbx
movq 0x30(%rsp), %r14
cmpq %rax, %r14
leaq 0x20(%rsp), %r15
je 0x273e
movq 0x8(%r14), %rdi
callq 0x21d0
addq $0x28, %r14
cmpq %rbx, %r14
jne 0x272c
leaq 0x30(%rsp), %rdi
callq 0x293a
movq 0x10(%rsp), %rdi
cmpq %r15, %rdi
je 0x275f
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x2140
leaq 0x58(%rsp), %rdi
callq 0x2996
xorl %eax, %eax
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x23ac
jmp 0x27b2
jmp 0x27ad
movq %rax, %rbx
movq 0x10(%rsp), %rdi
cmpq %r12, %rdi
je 0x2823
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x2140
jmp 0x2823
movq %rax, %rbx
jmp 0x2823
jmp 0x282b
movq %rax, %rbx
jmp 0x2819
movq %rax, %rbx
jmp 0x27f3
movq %rax, %rbx
movq 0x80(%rsp), %rax
testq %rax, %rax
je 0x27d6
leaq 0x70(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
movq 0x98(%rsp), %rdi
cmpq %r13, %rdi
je 0x27f3
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x2140
leaq 0x30(%rsp), %rdi
callq 0x293a
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x2819
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x2140
leaq 0x58(%rsp), %rdi
callq 0x2996
movq %rbx, %rdi
callq 0x2200
movq %rax, %rdi
callq 0x29f1
nop