// File: /workspace/github_c_makefile_star2_O1/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 0x309b(%rip), %rsi      # 0x4d60
leaq 0x10(%rsp), %rdi
movl $0x10, %ecx
rep  movsq (%rsi), %es:(%rdi)
cmpl $0x1, %ebx
jne 0x1d23
leaq 0x1a7(%rip), %rdi       # 0x1e85
callq 0x1448
testq %rax, %rax
je 0x1e7b
movq %rax, %rbx
movq 0x32da(%rip), %rax      # 0x4fd0
movq (%rax), %rsi
leaq 0x13d2(%rip), %rdi      # 0x30d2
movq %rbx, %rdx
callq 0x1ea0
leaq 0x369(%rip), %rsi       # 0x2078
movq %rbx, %rdi
xorl %edx, %edx
callq 0x18a4
movq %rbx, %rdi
callq 0x19ba
jmp 0x1d97
movq (%r15), %r14
leaq 0x13ab(%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 0x1d56
cmpl $0x64, %eax
je 0x1d63
jmp 0x1d6c
testl %eax, %eax
jne 0x1dab
movl 0xc(%rsp), %eax
cmpl $0x2, %eax
jne 0x1d7b
movb $0x1, 0x335a(%rip)      # 0x50c4
jmp 0x1d37
cmpl $0x68, %eax
je 0x1d88
cmpl $0x76, %eax
je 0x1d92
jmp 0x1e69
cmpl $0x1, %eax
je 0x1d92
testl %eax, %eax
jne 0x1e69
movq %r14, %rdi
callq 0x1f6a
jmp 0x1d97
callq 0x1fe5
xorl %eax, %eax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpl $-0x1, %eax
jne 0x1e69
leaq 0xca(%rip), %rdi        # 0x1e85
callq 0x1448
testq %rax, %rax
je 0x1e80
movq %rax, %r14
movq 0x3205(%rip), %rax      # 0x4fd8
movslq (%rax), %rax
cmpl %eax, %ebx
jle 0x1e37
leaq (%r15,%rax,8), %rbp
subl %eax, %ebx
xorl %r12d, %r12d
leaq 0x12f2(%rip), %r15      # 0x30dc
movq (%rbp,%r12,8), %rdi
movq %r15, %rsi
callq 0x1110
movq (%rbp,%r12,8), %rdi
testq %rax, %rax
je 0x1e21
movq %rax, %r13
movq %rax, %rsi
movq %r14, %rdx
callq 0x1ea0
movq %r13, %rdi
callq 0x1070
cmpl $-0x1, %eax
jne 0x1e2d
movq (%rbp,%r12,8), %rdi
leaq 0x12b7(%rip), %rsi      # 0x30df
callq 0x1170
incq %r12
cmpl %r12d, %ebx
jne 0x1dea
jmp 0x1e50
movq 0x3192(%rip), %rax      # 0x4fd0
movq (%rax), %rsi
leaq 0x128a(%rip), %rdi      # 0x30d2
movq %r14, %rdx
callq 0x1ea0
leaq 0x221(%rip), %rsi       # 0x2078
movq %r14, %rdi
xorl %edx, %edx
callq 0x18a4
movq %r14, %rdi
jmp 0x1d1c
movq %r14, %rdi
callq 0x1f6a
movl $0x1, %edi
callq 0x1130
callq 0x11cd
callq 0x11a8