// File: /workspace/github_c_makefile_star2_O2/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, %rbx
movl %edi, %ebp
leaq 0x21f3(%rip), %rsi      # 0x3d60
pushq $0x10
popq %rcx
leaq 0x10(%rsp), %rdi
rep  movsq (%rsi), %es:(%rdi)
cmpl $0x1, %ebp
jne 0x1bb8
leaq 0x186(%rip), %rdi       # 0x1d0a
callq 0x1374
testq %rax, %rax
je 0x1cec
movq %rax, %rbx
movq 0x2434(%rip), %rax      # 0x3fd0
movq (%rax), %rsi
leaq 0x52c(%rip), %rdi       # 0x20d2
movq %rbx, %rdx
callq 0x1d23
movq %rbx, %rdi
callq 0x1e12
jmp 0x1c2c
movq (%rbx), %r14
leaq 0x516(%rip), %r15       # 0x20d8
leaq 0x10(%rsp), %r12
leaq 0xc(%rsp), %r13
movl %ebp, %edi
movq %rbx, %rsi
movq %r15, %rdx
movq %r12, %rcx
movq %r13, %r8
callq 0x1080
testl %eax, %eax
je 0x1bea
cmpl $0x64, %eax
je 0x1bf3
jmp 0x1bfc
movl 0xc(%rsp), %eax
cmpl $0x2, %eax
jne 0x1c10
movb $0x1, 0x24ca(%rip)      # 0x40c4
jmp 0x1bcc
cmpl $-0x1, %eax
je 0x1c40
cmpl $0x68, %eax
je 0x1c1d
cmpl $0x76, %eax
je 0x1c27
jmp 0x1cdc
cmpl $0x1, %eax
je 0x1c27
testl %eax, %eax
jne 0x1cdc
movq %r14, %rdi
callq 0x1e2d
jmp 0x1c2c
callq 0x1ea5
xorl %eax, %eax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xc3(%rip), %rdi        # 0x1d0a
callq 0x1374
testq %rax, %rax
je 0x1cec
movq %rax, %r14
movq 0x2379(%rip), %rax      # 0x3fd8
movslq (%rax), %r12
cmpl %ebp, %r12d
jge 0x1cbb
movslq %ebp, %rbp
leaq 0x46b(%rip), %r15       # 0x20dc
cmpq %rbp, %r12
jge 0x1cd4
movq (%rbx,%r12,8), %rdi
movq %r15, %rsi
callq 0x1110
movq (%rbx,%r12,8), %rdi
testq %rax, %rax
je 0x1caa
movq %rax, %r13
movq %rax, %rsi
movq %r14, %rdx
callq 0x1d23
movq %r13, %rdi
callq 0x1070
cmpl $-0x1, %eax
jne 0x1cb6
movq (%rbx,%r12,8), %rdi
leaq 0x42e(%rip), %rsi       # 0x20df
callq 0x133c
incq %r12
jmp 0x1c71
movq 0x230e(%rip), %rax      # 0x3fd0
movq (%rax), %rsi
leaq 0x406(%rip), %rdi       # 0x20d2
movq %r14, %rdx
callq 0x1d23
movq %r14, %rdi
jmp 0x1bb1
movq %r14, %rdi
callq 0x1e2d
pushq $0x1
popq %rdi
callq 0x1130
movq 0x2305(%rip), %rax      # 0x3ff8
movq (%rax), %rcx
leaq 0x3c5(%rip), %rdi       # 0x20c2
pushq $0xf
popq %rsi
pushq $0x1
popq %rdx
callq 0x1140
jmp 0x1ce4