// File: /workspace/github_cpp_makefile_star2_O3/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 $0xa8, %rsp
movq %rsi, %r14
movl %edi, %ebp
xorl %r15d, %r15d
leaq 0x2c5e(%rip), %rbx      # 0x512b
movl %ebp, %edi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x2030
cmpl $0x63, %eax
jle 0x24f4
cmpl $0x66, %eax
je 0x2500
cmpl $0x64, %eax
jne 0x2785
movl $0x2, %ecx
jmp 0x2505
movl $0x1, %ecx
cmpl $0x61, %eax
je 0x2505
jmp 0x250a
movl $0x4, %ecx
orl %ecx, %r15d
jmp 0x24cd
cmpl $-0x1, %eax
jne 0x2785
movq 0x4ab6(%rip), %rax      # 0x6fd0
movslq (%rax), %r12
movl %r15d, %eax
orl $0x6, %eax
testb $0x6, %r15b
cmovnel %r15d, %eax
movl %eax, 0xc(%rsp)
leaq 0x20(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x2bf1(%rip), %rsi      # 0x5130
leaq 0x2beb(%rip), %rdx      # 0x5131
leaq 0x10(%rsp), %rdi
callq 0x2aa2
leaq 0x50(%rsp), %rdi
leaq 0x10(%rsp), %rsi
leaq 0x30(%rsp), %rcx
movl $0x1, %edx
callq 0x28b0
movl %ebp, %ebx
movq %r12, 0x48(%rsp)
subl %r12d, %ebx
movq 0x10(%rsp), %rdi
cmpq %r15, %rdi
je 0x258a
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x2140
cmpl $0x2, %ebx
jl 0x2614
movq 0x50(%rsp), %r15
movq 0x58(%rsp), %r12
cmpq %r15, %r12
je 0x25d0
leaq 0x10(%r15), %r13
movq -0x10(%r13), %rdi
cmpq %rdi, %r13
je 0x25bb
movq (%r13), %rsi
incq %rsi
callq 0x2140
leaq 0x20(%r13), %rax
addq $0x10, %r13
cmpq %r12, %r13
movq %rax, %r13
jne 0x25a6
movq %r15, 0x58(%rsp)
movl %ebx, %ebx
movq 0x48(%rsp), %rax
leaq (%r14,%rax,8), %r15
addq $0x8, %r15
decq %rbx
leaq 0x50(%rsp), %r12
movq (%r15), %r13
movq %r13, %rdi
callq 0x2080
cmpb $0x2f, -0x1(%r13,%rax)
jne 0x2600
movb $0x0, -0x1(%r13,%rax)
movq %r12, %rdi
movq %r15, %rsi
callq 0x28f8
addq $0x8, %r15
decq %rbx
jne 0x25e7
movq 0x48(%rsp), %rax
cmpl %ebp, %eax
jne 0x2626
leaq 0x2b68(%rip), %rsi      # 0x518c
jmp 0x262a
movq (%r14,%rax,8), %rsi
leaq 0x10(%rsp), %rdi
leaq 0x30(%rsp), %rdx
callq 0x2872
xorps %xmm0, %xmm0
movaps %xmm0, 0x30(%rsp)
movq $0x0, 0x40(%rsp)
movq 0x50(%rsp), %rbp
movq 0x58(%rsp), %rbx
cmpq %rbx, %rbp
je 0x2717
leaq 0x98(%rsp), %r13
leaq 0x88(%rsp), %r15
leaq 0x1d8(%rip), %r14       # 0x284c
leaq 0x68(%rsp), %r12
movq %r13, 0x88(%rsp)
movq (%rbp), %rsi
movq 0x8(%rbp), %rdx
addq %rsi, %rdx
movq %r15, %rdi
callq 0x2a0c
movq $0x0, 0x70(%rsp)
leaq 0x30(%rsp), %rax
movq %rax, 0x68(%rsp)
leaq 0x18a(%rip), %rax       # 0x2838
movq %rax, 0x80(%rsp)
movq %r14, 0x78(%rsp)
movq %r15, %rdi
movl 0xc(%rsp), %esi
movq %r12, %rdx
callq 0x3130
movq 0x78(%rsp), %rax
testq %rax, %rax
je 0x26e1
movq %r12, %rdi
movq %r12, %rsi
movl $0x3, %edx
callq *%rax
movq 0x88(%rsp), %rdi
cmpq %r13, %rdi
je 0x26fe
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x2140
addq $0x20, %rbp
cmpq %rbx, %rbp
jne 0x2679
movq 0x30(%rsp), %rdi
movq 0x38(%rsp), %rsi
jmp 0x271b
xorl %esi, %esi
xorl %edi, %edi
leaq 0x10(%rsp), %rdx
leaq 0x20(%rsp), %r15
callq 0x339c
movq %rax, %rbx
movq 0x30(%rsp), %r14
cmpq %rbx, %r14
je 0x2746
movq 0x8(%r14), %rdi
callq 0x21d0
addq $0x28, %r14
jmp 0x2732
leaq 0x30(%rsp), %rdi
callq 0x2944
movq 0x10(%rsp), %rdi
cmpq %r15, %rdi
je 0x2767
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x2140
leaq 0x50(%rsp), %rdi
callq 0x29a2
xorl %eax, %eax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x23cc
jmp 0x27ba
jmp 0x27b5
movq %rax, %rbx
movq 0x10(%rsp), %rdi
cmpq %r15, %rdi
je 0x2828
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x2140
jmp 0x2828
movq %rax, %rbx
jmp 0x2828
jmp 0x2830
movq %rax, %rbx
jmp 0x281e
movq %rax, %rbx
jmp 0x27f8
movq %rax, %rbx
movq 0x78(%rsp), %rax
testq %rax, %rax
je 0x27db
leaq 0x68(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
movq 0x88(%rsp), %rdi
cmpq %r13, %rdi
je 0x27f8
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x2140
leaq 0x30(%rsp), %rdi
callq 0x2944
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x281e
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x2140
leaq 0x50(%rsp), %rdi
callq 0x29a2
movq %rbx, %rdi
callq 0x2200
movq %rax, %rdi
callq 0x2a00