// File: /workspace/github_c_makefile_star2_O3/chbarts[P]aa-tree/sort.c
// Function: dofile
static void dofile(char *fname, FILE * fin, aa * tree, bool numer,
                   bool rev)
{
    char *ln;
    ll *lln;
    tstruct *tstr = NULL;

    while (fggets(&ln, fin) == 0) {
        if ((lln = new_node(1, ln, NULL)) == NULL) {
            free(ln);
            error(tree, numer);
        }

        if (numer) {
            if ((tstr = malloc(sizeof(tstruct))) == NULL) {
                free(ln);
                free(lln);
                error(tree, numer);
            }

            tstr->num = atoll(ln);

            if ((tstr->tree =
                 aa_new(rev ? rcomparator : comparator)) == NULL) {
                free(ln);
                free(lln);
                free(tstr);
                error(tree, numer);
            }

            switch (aa_add(tstr->tree, lln, duplicate)) {
            case 0:
                break;
            case 2:            /* memory error */
                free(ln);
                free(lln);
                free(tstr);
                error(tree, numer);
                break;
            default:           /* can't happen */
                fprintf(stderr, "can't happen\n");
                free(ln);
                free(lln);
                free(tstr);
                cleanup(tree, numer);
                exit(EXIT_FAILURE);
                break;
            }
        }

        switch (aa_add
                (tree, numer ? (void *) tstr : (void *) lln,
                 numer ? nduplicate : duplicate)) {
        case 0:                /* no error */
            break;
        case 2:                /* memory error */
            free(ln);
            free(lln);
            free(tstr);
            error(tree, numer);
            break;
        default:               /* can't happen */
            fprintf(stderr, "can't happen\n");
            free(ln);
            free(lln);
            free(tstr);
            cleanup(tree, numer);
            exit(EXIT_FAILURE);
            break;
        }
    }

    if (ferror(fin) != 0)
        handle_ferr(fname, "sort");
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %ecx, %ebp
movq %rdx, 0x8(%rsp)
movq %rsi, %r12
movq %rdi, 0x20(%rsp)
leaq 0x341(%rip), %rax       # 0x25c6
leaq -0x64(%rip), %r13       # 0x2228
testl %r8d, %r8d
cmovneq %rax, %r13
movq $0x0, 0x18(%rsp)
leaq 0x3e9(%rip), %rbx       # 0x268c
leaq 0x10(%rsp), %rdi
movq %r12, %rsi
callq 0x142c
testl %eax, %eax
jne 0x236c
movq 0x10(%rsp), %rsi
movl $0x1, %edi
xorl %edx, %edx
callq 0x1e28
testq %rax, %rax
je 0x240f
movq %rax, %r15
movq %rbx, %rdx
movq %rax, %r14
testb %bpl, %bpl
je 0x2336
movl $0x10, %edi
callq 0x1100
movq 0x10(%rsp), %rdi
testq %rax, %rax
je 0x243c
movq %rax, %r14
callq 0x10c0
movq %rax, (%r14)
movq %r13, %rdi
callq 0x1518
movq %rax, 0x8(%r14)
testq %rax, %rax
je 0x23a1
movq %rax, %rdi
movq %r15, %rsi
movq %rbx, %rdx
callq 0x1540
testl %eax, %eax
jne 0x2398
leaq 0x397(%rip), %rdx       # 0x26c8
movq %r14, 0x18(%rsp)
movq 0x8(%rsp), %rdi
movq %r14, %rsi
callq 0x1540
testl %eax, %eax
je 0x22a3
cmpl $0x2, %eax
jne 0x23bb
movq 0x10(%rsp), %rdi
callq 0x1030
movq %r15, %rdi
callq 0x1030
movq 0x18(%rsp), %rdi
jmp 0x2414
movq %r12, %rdi
callq 0x1060
testl %eax, %eax
je 0x2389
leaq 0xdb4(%rip), %rsi       # 0x3133
movq 0x20(%rsp), %rdi
callq 0x1190
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpl $0x2, %eax
jne 0x2427
movq 0x10(%rsp), %rdi
callq 0x1030
movq %r15, %rdi
callq 0x1030
movq %r14, %rdi
jmp 0x2444
movq 0x3c36(%rip), %rax      # 0x5ff8
movq (%rax), %rcx
leaq 0xd6c(%rip), %rdi       # 0x3138
movl $0xd, %esi
movl $0x1, %edx
callq 0x1160
movq 0x10(%rsp), %rdi
callq 0x1030
movq %r15, %rdi
callq 0x1030
movq 0x18(%rsp), %rdi
callq 0x1030
movzbl %bpl, %esi
movq 0x8(%rsp), %rdi
callq 0x248e
movl $0x1, %edi
callq 0x1150
movq 0x10(%rsp), %rdi
callq 0x1030
movzbl %bpl, %esi
movq 0x8(%rsp), %rdi
callq 0x264f
leaq 0x10(%rsp), %rdi
movq %r15, %rsi
movq %r14, %rdx
movq 0x8(%rsp), %rcx
callq 0x1281
callq 0x1030
movq %r15, %rdi
callq 0x1030
movq 0x8(%rsp), %rdi
movl $0x1, %esi
callq 0x264f