// File: /workspace/github_c_makefile_star2_O3/chbarts[P]aa-tree/nuniq.c
// Function: main
int main(int argc, char *argv[])
{
    aa *tree;
    char *pnam;
    FILE *fin;
    int i, lind, c;
    extern int optind;
    struct option longopts[] = {
        {"help", 0, 0, 0},
        {"version", 0, 0, 0},
        {"duplicates", 0, 0, 0},
        {0, 0, 0, 0}
    };

    if (1 == argc) {
        if ((tree = aa_new(comparator)) == NULL) {
            fprintf(stderr, "aa_new() error\n");
            exit(EXIT_FAILURE);
        }

        dofile("stdin", stdin, tree);
        cleanup(tree);
        return 0;
    }

    pnam = argv[0];

    while ((c = getopt_long(argc, argv, "hvd", longopts, &lind)) != -1) {
        switch (c) {
        case 0:
            switch (lind) {
            case 0:
                usage(pnam);
                return 0;
                break;
            case 1:
                version();
                return 0;
                break;
            case 2:
                d = 1;
                break;
            default:
                usage(pnam);
                exit(EXIT_FAILURE);
                break;
            }

            break;
        case 'h':
            usage(pnam);
            return 0;
            break;
        case 'v':
            version();
            return 0;
            break;
        case 'd':
            d = 1;
            break;
        default:
            usage(pnam);
            exit(EXIT_FAILURE);
            break;
        }
    }

    if ((tree = aa_new(comparator)) == NULL) {
        fprintf(stderr, "aa_new() error\n");
        exit(EXIT_FAILURE);
    }

    if (optind >= argc) {
        dofile("stdin", stdin, tree);
    } else {
        for (i = optind; i < argc; i++) {
            if ((fin = fopen(argv[i], "rb")) == NULL) {
                handle_ferr(argv[i], "nuniq");
                continue;
            }

            dofile(argv[i], fin, tree);

            if (fclose(fin) == EOF) {
                handle_ferr(argv[i], "nuniq");
            }
        }
    }

    cleanup(tree);
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq %rsi, %r15
movl %edi, %ebx
leaq 0x30a3(%rip), %rsi      # 0x4d60
leaq 0x10(%rsp), %rdi
movl $0x10, %ecx
rep  movsq (%rsi), %es:(%rdi)
cmpl $0x1, %ebx
jne 0x1d1b
leaq 0x1a7(%rip), %rdi       # 0x1e7d
callq 0x1448
testq %rax, %rax
je 0x1e73
movq %rax, %rbx
movq 0x32e2(%rip), %rax      # 0x4fd0
movq (%rax), %rsi
leaq 0x13da(%rip), %rdi      # 0x30d2
movq %rbx, %rdx
callq 0x1e98
leaq 0x369(%rip), %rsi       # 0x2070
movq %rbx, %rdi
xorl %edx, %edx
callq 0x189d
movq %rbx, %rdi
callq 0x19b3
jmp 0x1d8f
movq (%r15), %r14
leaq 0x13b3(%rip), %r12      # 0x30d8
leaq 0x10(%rsp), %r13
leaq 0xc(%rsp), %rbp
movl %ebx, %edi
movq %r15, %rsi
movq %r12, %rdx
movq %r13, %rcx
movq %rbp, %r8
callq 0x1080
cmpl $0x63, %eax
jle 0x1d4e
cmpl $0x64, %eax
je 0x1d5b
jmp 0x1d64
testl %eax, %eax
jne 0x1da3
movl 0xc(%rsp), %eax
cmpl $0x2, %eax
jne 0x1d73
movb $0x1, 0x3362(%rip)      # 0x50c4
jmp 0x1d2f
cmpl $0x68, %eax
je 0x1d80
cmpl $0x76, %eax
je 0x1d8a
jmp 0x1e61
cmpl $0x1, %eax
je 0x1d8a
testl %eax, %eax
jne 0x1e61
movq %r14, %rdi
callq 0x1f62
jmp 0x1d8f
callq 0x1fdd
xorl %eax, %eax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpl $-0x1, %eax
jne 0x1e61
leaq 0xca(%rip), %rdi        # 0x1e7d
callq 0x1448
testq %rax, %rax
je 0x1e78
movq %rax, %r14
movq 0x320d(%rip), %rax      # 0x4fd8
movslq (%rax), %rax
cmpl %eax, %ebx
jle 0x1e2f
leaq (%r15,%rax,8), %rbp
subl %eax, %ebx
xorl %r12d, %r12d
leaq 0x12fa(%rip), %r15      # 0x30dc
movq (%rbp,%r12,8), %rdi
movq %r15, %rsi
callq 0x1110
movq (%rbp,%r12,8), %rdi
testq %rax, %rax
je 0x1e19
movq %rax, %r13
movq %rax, %rsi
movq %r14, %rdx
callq 0x1e98
movq %r13, %rdi
callq 0x1070
cmpl $-0x1, %eax
jne 0x1e25
movq (%rbp,%r12,8), %rdi
leaq 0x12bf(%rip), %rsi      # 0x30df
callq 0x1170
incq %r12
cmpl %r12d, %ebx
jne 0x1de2
jmp 0x1e48
movq 0x319a(%rip), %rax      # 0x4fd0
movq (%rax), %rsi
leaq 0x1292(%rip), %rdi      # 0x30d2
movq %r14, %rdx
callq 0x1e98
leaq 0x221(%rip), %rsi       # 0x2070
movq %r14, %rdi
xorl %edx, %edx
callq 0x189d
movq %r14, %rdi
jmp 0x1d14
movq %r14, %rdi
callq 0x1f62
movl $0x1, %edi
callq 0x1130
callq 0x11cd
callq 0x11a8