// File: /workspace/github_c_makefile_star2_O1/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 0x342(%rip), %rax       # 0x2602
leaq -0x64(%rip), %r13       # 0x2263
testl %r8d, %r8d
cmovneq %rax, %r13
movq $0x0, 0x18(%rsp)
leaq 0x3ea(%rip), %rbx       # 0x26c8
leaq 0x10(%rsp), %rdi
movq %r12, %rsi
callq 0x142c
testl %eax, %eax
jne 0x23a8
movq 0x10(%rsp), %rsi
movl $0x1, %edi
xorl %edx, %edx
callq 0x1e3a
testq %rax, %rax
je 0x244b
movq %rax, %r15
movq %rbx, %rdx
movq %rax, %r14
testb %bpl, %bpl
je 0x2372
movl $0x10, %edi
callq 0x1100
movq 0x10(%rsp), %rdi
testq %rax, %rax
je 0x2478
movq %rax, %r14
callq 0x10c0
movq %rax, (%r14)
movq %r13, %rdi
callq 0x1518
movq %rax, 0x8(%r14)
testq %rax, %rax
je 0x23dd
movq 0x8(%r14), %rdi
movq %r15, %rsi
movq %rbx, %rdx
callq 0x1540
testl %eax, %eax
jne 0x23d4
leaq 0x397(%rip), %rdx       # 0x2704
movq %r14, 0x18(%rsp)
movq 0x8(%rsp), %rdi
movq %r14, %rsi
callq 0x1540
testl %eax, %eax
je 0x22de
cmpl $0x2, %eax
jne 0x23f7
movq 0x10(%rsp), %rdi
callq 0x1030
movq %r15, %rdi
callq 0x1030
movq 0x18(%rsp), %rdi
jmp 0x2450
movq %r12, %rdi
callq 0x1060
testl %eax, %eax
je 0x23c5
leaq 0xd78(%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 0x2463
movq 0x10(%rsp), %rdi
callq 0x1030
movq %r15, %rdi
callq 0x1030
movq %r14, %rdi
jmp 0x2480
movq 0x3bfa(%rip), %rax      # 0x5ff8
movq (%rax), %rcx
leaq 0xd30(%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 0x24ca
movl $0x1, %edi
callq 0x1150
movq 0x10(%rsp), %rdi
callq 0x1030
movzbl %bpl, %esi
movq 0x8(%rsp), %rdi
callq 0x268b
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 0x268b