// File: /workspace/github_c_makefile_star2_O2/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 0x354(%rip), %rax       # 0x2389
leaq -0x62(%rip), %r13       # 0x1fda
testl %r8d, %r8d
cmovneq %rax, %r13
movq $0x0, 0x18(%rsp)
leaq 0x3f4(%rip), %rbx       # 0x2447
leaq 0x10(%rsp), %rdi
movq %r12, %rsi
callq 0x127c
testl %eax, %eax
jne 0x2118
movq 0x10(%rsp), %rsi
pushq $0x1
popq %rdi
xorl %edx, %edx
callq 0x1c25
testq %rax, %rax
je 0x21b1
movq %rax, %r15
movq %rbx, %rdx
movq %rax, %r14
testb %bpl, %bpl
je 0x20e2
pushq $0x10
popq %rdi
callq 0x1100
movq 0x10(%rsp), %rdi
testq %rax, %rax
je 0x220d
movq %rax, %r14
callq 0x10c0
movq %rax, (%r14)
movq %r13, %rdi
callq 0x1394
movq %rax, 0x8(%r14)
testq %rax, %rax
je 0x2149
movq %rax, %rdi
movq %r15, %rsi
movq %rbx, %rdx
callq 0x13bc
testl %eax, %eax
jne 0x2144
leaq 0x3a6(%rip), %rdx       # 0x2483
movq %r14, 0x18(%rsp)
movq 0x8(%rsp), %rdi
movq %r14, %rsi
callq 0x13bc
testl %eax, %eax
je 0x2053
cmpl $0x2, %eax
jne 0x2163
movq 0x10(%rsp), %rdi
callq 0x1030
movq %r15, %rdi
callq 0x1030
movq 0x18(%rsp), %rdi
jmp 0x21b6
movq %r12, %rdi
callq 0x1060
testl %eax, %eax
je 0x2135
leaq 0x1008(%rip), %rsi      # 0x3133
movq 0x20(%rsp), %rdi
callq 0x135c
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpl $0x2, %eax
jne 0x21c1
movq 0x10(%rsp), %rdi
callq 0x1030
movq %r15, %rdi
callq 0x1030
movq %r14, %rdi
jmp 0x2215
movq 0x3e8e(%rip), %rax      # 0x5ff8
movq (%rax), %rcx
leaq 0xfc4(%rip), %rdi       # 0x3138
pushq $0xd
popq %rsi
pushq $0x1
popq %rdx
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 0x2258
pushq $0x1
popq %rdi
callq 0x1150
movq 0x10(%rsp), %rdi
callq 0x1030
movzbl %bpl, %esi
jmp 0x221d
movq 0x3e30(%rip), %rax      # 0x5ff8
movq (%rax), %rcx
leaq 0xf66(%rip), %rdi       # 0x3138
pushq $0xd
popq %rsi
pushq $0x1
popq %rdx
callq 0x1160
movq 0x10(%rsp), %rdi
callq 0x1030
movq %r15, %rdi
callq 0x1030
movq %r14, %rdi
callq 0x1030
pushq $0x1
popq %rbx
movq 0x8(%rsp), %rdi
movl %ebx, %esi
callq 0x2258
movl %ebx, %edi
callq 0x1150
callq 0x1030
movq %r15, %rdi
callq 0x1030
pushq $0x1
popq %rsi
movq 0x8(%rsp), %rdi
callq 0x2410