// File: AlphaTechnolog[P]fsls/fsls.cpp
// Function: main
int main(int argc, char * argv[]) {
    DIR *dir; struct dirent * entry;
    vector<string> filenames;
    string path;
    bool show_hidden = false;

    for (int i = 0; i < argc; i++) {
        if (argv[i][0] == '-' && argv[i][1] == 'h') {
            show_usage(argv);
            exit(0);
        }
        if (argc < 2 || (argv[i][0] == '-' && argc == 2)) {
            path = "./";
        } else {
            path = argv[1];
        }
        if (argv[i][0] == '-' && argv[i][1] == 'l') {
            show_hidden = true;
        }
    }

    if ((dir = opendir(path.c_str())) != NULL) {
        while ((entry = readdir(dir)) != NULL) {
            filenames.push_back(entry->d_name);
        }
        closedir(dir);
    } else {
        perror("opendir");
        return 1;
    }

    for (string filename : filenames) {
        if (filename == ".") continue;
        if (filename == "..") continue;
        if (filename[0] == '.' && !show_hidden) continue;
        cout << filename << endl;
    }

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x110, %rsp            # imm = 0x110
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x2890
leaq -0x58(%rbp), %rdi
callq 0x2210
movb $0x0, -0x59(%rbp)
movl $0x0, -0x60(%rbp)
movl -0x60(%rbp), %eax
cmpl -0x8(%rbp), %eax
jge 0x2584
movq -0x10(%rbp), %rax
movslq -0x60(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movsbl (%rax), %eax
cmpl $0x2d, %eax
jne 0x24fe
movq -0x10(%rbp), %rax
movslq -0x60(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movsbl 0x1(%rax), %eax
cmpl $0x68, %eax
jne 0x24fe
movq -0x10(%rbp), %rdi
callq 0x2410
jmp 0x24e6
xorl %edi, %edi
callq 0x21e0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0x2872
cmpl $0x2, -0x8(%rbp)
jl 0x251e
movq -0x10(%rbp), %rax
movslq -0x60(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movsbl (%rax), %eax
cmpl $0x2d, %eax
jne 0x2532
cmpl $0x2, -0x8(%rbp)
jne 0x2532
leaq 0x1b03(%rip), %rsi      # 0x4028
leaq -0x58(%rbp), %rdi
callq 0x2200
jmp 0x2530
jmp 0x2547
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
leaq -0x58(%rbp), %rdi
callq 0x2200
jmp 0x2545
jmp 0x2547
movq -0x10(%rbp), %rax
movslq -0x60(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movsbl (%rax), %eax
cmpl $0x2d, %eax
jne 0x2574
movq -0x10(%rbp), %rax
movslq -0x60(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movsbl 0x1(%rax), %eax
cmpl $0x6c, %eax
jne 0x2574
movb $0x1, -0x59(%rbp)
jmp 0x2576
movl -0x60(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x60(%rbp)
jmp 0x24a6
leaq -0x58(%rbp), %rdi
callq 0x2080
movq %rax, %rdi
callq 0x2230
movq %rax, -0xd8(%rbp)
jmp 0x259e
movq -0xd8(%rbp), %rax
movq %rax, -0x18(%rbp)
cmpq $0x0, %rax
je 0x268d
jmp 0x25b5
movq -0x18(%rbp), %rdi
callq 0x2240
movq %rax, -0xe0(%rbp)
jmp 0x25c7
movq -0xe0(%rbp), %rax
movq %rax, -0x20(%rbp)
cmpq $0x0, %rax
je 0x2680
movq -0x20(%rbp), %rax
addq $0x13, %rax
movq %rax, -0xf0(%rbp)
leaq -0x91(%rbp), %rdi
movq %rdi, -0xe8(%rbp)
callq 0x2290
movq -0xf0(%rbp), %rsi
movq -0xe8(%rbp), %rdx
leaq -0x90(%rbp), %rdi
callq 0x28e0
jmp 0x261a
leaq -0x38(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0x28b0
jmp 0x262c
leaq -0x90(%rbp), %rdi
callq 0x20d0
leaq -0x91(%rbp), %rdi
callq 0x21b0
jmp 0x25b5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0x266f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0x90(%rbp), %rdi
callq 0x20d0
leaq -0x91(%rbp), %rdi
callq 0x21b0
jmp 0x2872
movq -0x18(%rbp), %rdi
callq 0x2260
jmp 0x268b
jmp 0x26b1
leaq 0x1997(%rip), %rdi      # 0x402b
callq 0x2120
jmp 0x269b
movl $0x1, -0x4(%rbp)
movl $0x1, -0x98(%rbp)
jmp 0x2854
leaq -0x38(%rbp), %rax
movq %rax, -0xa0(%rbp)
movq -0xa0(%rbp), %rdi
callq 0x2990
movq %rax, -0xa8(%rbp)
movq -0xa0(%rbp), %rdi
callq 0x29c0
movq %rax, -0xb0(%rbp)
leaq -0xa8(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
callq 0x29f0
testb $0x1, %al
jne 0x26fe
jmp 0x2843
leaq -0xa8(%rbp), %rdi
callq 0x2a30
movq %rax, %rsi
leaq -0xd0(%rbp), %rdi
callq 0x2090
jmp 0x271b
leaq 0x1912(%rip), %rsi      # 0x4034
leaq -0xd0(%rbp), %rdi
callq 0x2a50
movb %al, -0xf1(%rbp)
jmp 0x2736
movb -0xf1(%rbp), %al
testb $0x1, %al
jne 0x2742
jmp 0x276e
movl $0x8, -0x98(%rbp)
jmp 0x2816
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0xd0(%rbp), %rdi
callq 0x20d0
jmp 0x2872
leaq 0x18be(%rip), %rsi      # 0x4033
leaq -0xd0(%rbp), %rdi
callq 0x2a50
movb %al, -0xf2(%rbp)
jmp 0x2789
movb -0xf2(%rbp), %al
testb $0x1, %al
jne 0x2795
jmp 0x27a1
movl $0x8, -0x98(%rbp)
jmp 0x2816
xorl %eax, %eax
movl %eax, %esi
leaq -0xd0(%rbp), %rdi
callq 0x22c0
movq %rax, -0x100(%rbp)
jmp 0x27ba
movq -0x100(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2e, %eax
jne 0x27db
testb $0x1, -0x59(%rbp)
jne 0x27db
movl $0x8, -0x98(%rbp)
jmp 0x2816
movq 0x37f6(%rip), %rdi      # 0x5fd8
leaq -0xd0(%rbp), %rsi
callq 0x2150
movq %rax, -0x108(%rbp)
jmp 0x27f7
movq -0x108(%rbp), %rdi
movq 0x37c3(%rip), %rsi      # 0x5fc8
callq 0x2190
jmp 0x280c
movl $0x0, -0x98(%rbp)
leaq -0xd0(%rbp), %rdi
callq 0x20d0
movl -0x98(%rbp), %eax
testl %eax, %eax
je 0x2830
jmp 0x282e
jmp 0x2832
jmp 0x2832
leaq -0xa8(%rbp), %rdi
callq 0x2a80
jmp 0x26e2
movl $0x0, -0x4(%rbp)
movl $0x1, -0x98(%rbp)
leaq -0x58(%rbp), %rdi
callq 0x20d0
leaq -0x38(%rbp), %rdi
callq 0x2aa0
movl -0x4(%rbp), %eax
addq $0x110, %rsp            # imm = 0x110
popq %rbp
retq
leaq -0x58(%rbp), %rdi
callq 0x20d0
leaq -0x38(%rbp), %rdi
callq 0x2aa0
movq -0x68(%rbp), %rdi
callq 0x2280
nopl (%rax)