// File: /workspace/github_c_makefile_star2_O0/chbarts[P]aa-tree/sort.c
// Function: main
int main(int argc, char *argv[])
{
    aa *tree;
    char *pnam;
    FILE *fin;
    int i, lind, c;
    bool uniq = false, rev = false, numer = false;
    extern int optind;
    struct option longopts[] = {
        {"uniqify", 0, 0, 0},
        {"reverse", 0, 0, 0},
        {"numer", 0, 0, 0},
        {"help", 0, 0, 0},
        {"version", 0, 0, 0},
        {0, 0, 0, 0}
    };

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

        dofile("stdin", stdin, tree, false, false);
        aa_traverse(tree, printall, TRAV_IN);
        cleanup(tree, numer);
        return 0;
    }

    pnam = argv[0];

    while ((c = getopt_long(argc, argv, "urnhv", longopts, &lind)) != -1) {
        switch (c) {
        case 0:
            switch (lind) {
            case 0:
                uniq = true;
                break;
            case 1:
                rev = true;
                break;
            case 2:
                numer = true;
                break;
            case 3:
                usage(pnam);
                return 0;
                break;
            case 4:
                version();
                return 0;
                break;
            default:
                usage(pnam);
                exit(EXIT_FAILURE);
                break;
            }

            break;
        case 'u':
            uniq = true;
            break;
        case 'r':
            rev = true;
            break;
        case 'n':
            numer = true;
            break;
        case 'h':
            usage(pnam);
            return 0;
            break;
        case 'v':
            version();
            return 0;
            break;
        default:
            usage(pnam);
            exit(EXIT_FAILURE);
            break;
        }
    }

    if (rev && numer) {
        if ((tree = aa_new(rncomparator)) == NULL) {
            fprintf(stderr, "aa_new error\n");
            exit(EXIT_FAILURE);
        }
    } else if (numer) {
        if ((tree = aa_new(ncomparator)) == NULL) {
            fprintf(stderr, "aa_new error\n");
            exit(EXIT_FAILURE);
        }
    } else if (rev) {
        if ((tree = aa_new(rcomparator)) == NULL) {
            fprintf(stderr, "aa_new error\n");
            exit(EXIT_FAILURE);
        }
    } else {
        if ((tree = aa_new(comparator)) == NULL) {
            fprintf(stderr, "aa_new error\n");
            exit(EXIT_FAILURE);
        }
    }

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

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

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

    if (uniq && numer) {
        aa_traverse(tree, printn, TRAV_IN);
    } else if (uniq) {
        aa_traverse(tree, print, TRAV_IN);
    } else if (numer) {
        aa_traverse(tree, printalln, TRAV_IN);
    } else {
        aa_traverse(tree, printall, TRAV_IN);
    }

    cleanup(tree, numer);
    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)
movb $0x0, -0x35(%rbp)
movb $0x0, -0x36(%rbp)
movb $0x0, -0x37(%rbp)
leaq -0x100(%rbp), %rdi
leaq 0x43bd(%rip), %rsi      # 0x6d20
movl $0xc0, %edx
callq 0x10e0
cmpl $0x1, -0x8(%rbp)
jne 0x29fe
leaq 0x472(%rip), %rdi       # 0x2df0
callq 0x1430
movq %rax, -0x18(%rbp)
cmpq $0x0, %rax
jne 0x29af
movq 0x4664(%rip), %rax      # 0x6ff8
movq (%rax), %rdi
leaq 0x1744(%rip), %rsi      # 0x40e2
movb $0x0, %al
callq 0x10d0
movl $0x1, %edi
callq 0x1140
movq 0x461a(%rip), %rax      # 0x6fd0
movq (%rax), %rsi
movq -0x18(%rbp), %rdx
leaq 0x172e(%rip), %rdi      # 0x40f2
xorl %r8d, %r8d
movl %r8d, %ecx
callq 0x2e70
movq -0x18(%rbp), %rdi
leaq 0x766(%rip), %rsi       # 0x3140
xorl %edx, %edx
callq 0x1af0
movq -0x18(%rbp), %rdi
movb -0x37(%rbp), %al
andb $0x1, %al
movzbl %al, %esi
callq 0x31a0
movl $0x0, -0x4(%rbp)
jmp 0x2ddd
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x20(%rbp)
movl -0x8(%rbp), %edi
movq -0x10(%rbp), %rsi
leaq -0x100(%rbp), %rcx
leaq 0x16da(%rip), %rdx      # 0x40f8
leaq -0x30(%rbp), %r8
callq 0x1070
movl %eax, -0x34(%rbp)
cmpl $-0x1, %eax
je 0x2b5e
movl -0x34(%rbp), %eax
movl %eax, -0x104(%rbp)
testl %eax, %eax
je 0x2a9a
jmp 0x2a42
movl -0x104(%rbp), %eax
subl $0x68, %eax
je 0x2b20
jmp 0x2a53
movl -0x104(%rbp), %eax
subl $0x6e, %eax
je 0x2b1a
jmp 0x2a64
movl -0x104(%rbp), %eax
subl $0x72, %eax
je 0x2b14
jmp 0x2a75
movl -0x104(%rbp), %eax
subl $0x75, %eax
je 0x2b0e
jmp 0x2a86
movl -0x104(%rbp), %eax
subl $0x76, %eax
je 0x2b35
jmp 0x2b46
movl -0x30(%rbp), %eax
movq %rax, -0x110(%rbp)
subq $0x4, %rax
ja 0x2af9
movq -0x110(%rbp), %rax
leaq 0x15f8(%rip), %rcx      # 0x40b0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movb $0x1, -0x35(%rbp)
jmp 0x2b0c
movb $0x1, -0x36(%rbp)
jmp 0x2b0c
movb $0x1, -0x37(%rbp)
jmp 0x2b0c
movq -0x20(%rbp), %rdi
callq 0x31f0
movl $0x0, -0x4(%rbp)
jmp 0x2ddd
callq 0x3290
movl $0x0, -0x4(%rbp)
jmp 0x2ddd
movq -0x20(%rbp), %rdi
callq 0x31f0
movl $0x1, %edi
callq 0x1140
jmp 0x2b59
movb $0x1, -0x35(%rbp)
jmp 0x2b59
movb $0x1, -0x36(%rbp)
jmp 0x2b59
movb $0x1, -0x37(%rbp)
jmp 0x2b59
movq -0x20(%rbp), %rdi
callq 0x31f0
movl $0x0, -0x4(%rbp)
jmp 0x2ddd
callq 0x3290
movl $0x0, -0x4(%rbp)
jmp 0x2ddd
movq -0x20(%rbp), %rdi
callq 0x31f0
movl $0x1, %edi
callq 0x1140
jmp 0x2a09
testb $0x1, -0x36(%rbp)
je 0x2ba7
testb $0x1, -0x37(%rbp)
je 0x2ba7
leaq 0x77f(%rip), %rdi       # 0x32f0
callq 0x1430
movq %rax, -0x18(%rbp)
cmpq $0x0, %rax
jne 0x2ba2
movq 0x4471(%rip), %rax      # 0x6ff8
movq (%rax), %rdi
leaq 0x156d(%rip), %rsi      # 0x40fe
movb $0x0, %al
callq 0x10d0
movl $0x1, %edi
callq 0x1140
jmp 0x2c65
testb $0x1, -0x37(%rbp)
je 0x2be7
leaq 0x79c(%rip), %rdi       # 0x3350
callq 0x1430
movq %rax, -0x18(%rbp)
cmpq $0x0, %rax
jne 0x2be5
movq 0x442e(%rip), %rax      # 0x6ff8
movq (%rax), %rdi
leaq 0x152a(%rip), %rsi      # 0x40fe
movb $0x0, %al
callq 0x10d0
movl $0x1, %edi
callq 0x1140
jmp 0x2c63
testb $0x1, -0x36(%rbp)
je 0x2c27
leaq 0x7bc(%rip), %rdi       # 0x33b0
callq 0x1430
movq %rax, -0x18(%rbp)
cmpq $0x0, %rax
jne 0x2c25
movq 0x43ee(%rip), %rax      # 0x6ff8
movq (%rax), %rdi
leaq 0x14ea(%rip), %rsi      # 0x40fe
movb $0x0, %al
callq 0x10d0
movl $0x1, %edi
callq 0x1140
jmp 0x2c61
leaq 0x1c2(%rip), %rdi       # 0x2df0
callq 0x1430
movq %rax, -0x18(%rbp)
cmpq $0x0, %rax
jne 0x2c5f
movq 0x43b4(%rip), %rax      # 0x6ff8
movq (%rax), %rdi
leaq 0x14b0(%rip), %rsi      # 0x40fe
movb $0x0, %al
callq 0x10d0
movl $0x1, %edi
callq 0x1140
jmp 0x2c61
jmp 0x2c63
jmp 0x2c65
movq 0x436c(%rip), %rax      # 0x6fd8
movl (%rax), %eax
cmpl -0x8(%rbp), %eax
jl 0x2ca4
movq 0x4356(%rip), %rax      # 0x6fd0
movq (%rax), %rsi
movq -0x18(%rbp), %rdx
movb -0x37(%rbp), %cl
movb -0x36(%rbp), %al
leaq 0x1464(%rip), %rdi      # 0x40f2
andb $0x1, %cl
andb $0x1, %al
movzbl %cl, %ecx
movzbl %al, %r8d
callq 0x2e70
jmp 0x2d5b
movq 0x432d(%rip), %rax      # 0x6fd8
movl (%rax), %eax
movl %eax, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
cmpl -0x8(%rbp), %eax
jge 0x2d59
movq -0x10(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x143d(%rip), %rsi      # 0x410c
callq 0x1120
movq %rax, -0x28(%rbp)
cmpq $0x0, %rax
jne 0x2cf8
movq -0x10(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x141e(%rip), %rsi      # 0x410f
callq 0x13e0
jmp 0x2d4b
movq -0x10(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
movq -0x28(%rbp), %rsi
movq -0x18(%rbp), %rdx
movb -0x37(%rbp), %cl
movb -0x36(%rbp), %al
andb $0x1, %cl
andb $0x1, %al
movzbl %cl, %ecx
movzbl %al, %r8d
callq 0x2e70
movq -0x28(%rbp), %rdi
callq 0x1060
cmpl $-0x1, %eax
jne 0x2d49
movq -0x10(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x13cb(%rip), %rsi      # 0x410f
callq 0x13e0
jmp 0x2d4b
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x2cb0
jmp 0x2d5b
testb $0x1, -0x35(%rbp)
je 0x2d7b
testb $0x1, -0x37(%rbp)
je 0x2d7b
movq -0x18(%rbp), %rdi
leaq 0x6be(%rip), %rsi       # 0x3430
xorl %edx, %edx
callq 0x1af0
jmp 0x2dc5
testb $0x1, -0x35(%rbp)
je 0x2d95
movq -0x18(%rbp), %rdi
leaq 0x6e4(%rip), %rsi       # 0x3470
xorl %edx, %edx
callq 0x1af0
jmp 0x2dc3
testb $0x1, -0x37(%rbp)
je 0x2daf
movq -0x18(%rbp), %rdi
leaq 0x70a(%rip), %rsi       # 0x34b0
xorl %edx, %edx
callq 0x1af0
jmp 0x2dc1
movq -0x18(%rbp), %rdi
leaq 0x386(%rip), %rsi       # 0x3140
xorl %edx, %edx
callq 0x1af0
jmp 0x2dc3
jmp 0x2dc5
movq -0x18(%rbp), %rdi
movb -0x37(%rbp), %al
andb $0x1, %al
movzbl %al, %esi
callq 0x31a0
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x110, %rsp            # imm = 0x110
popq %rbp
retq
nopl (%rax)