// File: /workspace/github_c_makefile_star2_O2/robertdavidgraham[P]wc2/wc2.c
// Function: parse_file
static struct results
parse_file(FILE *fp, const struct config *cfg)
{
    enum {BUFSIZE=65536};
    struct results results = {0, 0, 0, 0};
    unsigned state = 0; /* state held between chunks */
    unsigned char *buf;

    buf = malloc(BUFSIZE);
    if (buf == NULL)
        abort();

    /* Process a 64k chunk at a time */
    for (;;) {
        size_t count;
        struct results x;

        /* Read the next chunk of data from the file */
        count = fread(buf, 1, BUFSIZE, fp);
        if (count <= 0)
            break;

        /* Do the word-count algorithm */
        if (cfg->is_pointer_arithmetic > 1)
            x = parse_chunk_pp(buf, count, &state);
        else if (cfg->is_pointer_arithmetic)
            x = parse_chunk_p(buf, count, &state);
        else
            x = parse_chunk(buf, count, &state);

        /* Sum the results */
        results.line_count += x.line_count;
        results.word_count += x.word_count;
        results.byte_count += x.byte_count;
        results.char_count += x.char_count;
    }

    free(buf);
    return results;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x248, %rsp            # imm = 0x248
movq %rdx, 0x20(%rsp)
movq %rsi, 0x28(%rsp)
movq %rdi, 0x18(%rsp)
movl $0x10000, %edi          # imm = 0x10000
callq 0x1110
testq %rax, %rax
je 0x2156
movq %rax, %r15
movq $0x0, 0x10(%rsp)
leaq 0x130fb(%rip), %rbx     # 0x150f0
leaq 0x30f4(%rip), %r12      # 0x50f0
xorl %r13d, %r13d
xorl %ebp, %ebp
movq $0x0, 0x8(%rsp)
xorl %r14d, %r14d
movl $0x10000, %edx          # imm = 0x10000
movq %r15, %rdi
pushq $0x1
popq %rsi
movq 0x28(%rsp), %rcx
callq 0x1080
testq %rax, %rax
je 0x211b
movq 0x20(%rsp), %rcx
movl 0x24(%rcx), %ecx
cmpl $0x2, %ecx
jl 0x2074
leaq (%r15,%rax), %rcx
shll $0x8, %r14d
leaq (%rbx,%r14,8), %r14
xorps %xmm0, %xmm0
movaps %xmm0, 0x40(%rsp)
movaps %xmm0, 0x30(%rsp)
movq %r15, %rdx
cmpq %rcx, %rdx
jae 0x20a8
movzbl (%rdx), %esi
incq %rdx
movq (%r14,%rsi,8), %r14
movq %r14, %rsi
subq %rbx, %rsi
shrq $0xb, %rsi
incq 0x30(%rsp,%rsi,8)
jmp 0x2054
movl %r14d, %r14d
testl %ecx, %ecx
je 0x20c9
leaq (%r15,%rax), %rcx
xorps %xmm0, %xmm0
movaps %xmm0, 0x30(%rsp)
movq %r15, %rdx
cmpq %rcx, %rdx
jae 0x20f3
movzbl (%rdx), %esi
incq %rdx
shlq $0x8, %r14
addq %r12, %r14
movzbl (%rsi,%r14), %r14d
incl 0x30(%rsp,%r14,4)
jmp 0x208a
subq %rbx, %r14
shrq $0xb, %r14
movq 0x38(%rsp), %rcx
movq 0x40(%rsp), %rdx
leaq (%rdx,%rcx), %rsi
addq 0x30(%rsp), %rsi
addq 0x48(%rsp), %rsi
jmp 0x2106
xorps %xmm0, %xmm0
movaps %xmm0, 0x30(%rsp)
xorl %ecx, %ecx
cmpq %rcx, %rax
je 0x20f3
movzbl (%r15,%rcx), %edx
shlq $0x8, %r14
addq %r12, %r14
movzbl (%rdx,%r14), %r14d
incl 0x30(%rsp,%r14,4)
incq %rcx
jmp 0x20d3
movl 0x34(%rsp), %ecx
movl 0x38(%rsp), %edx
leal (%rdx,%rcx), %esi
addl 0x30(%rsp), %esi
addl 0x3c(%rsp), %esi
addq %rcx, 0x8(%rsp)
addq %rdx, %rbp
addq %rax, %r13
addq %rsi, 0x10(%rsp)
jmp 0x200d
movq 0x18(%rsp), %rbx
movq %rbp, 0x8(%rbx)
movq %r13, 0x18(%rbx)
movq 0x10(%rsp), %rax
movq %rax, 0x10(%rbx)
movq 0x8(%rsp), %rax
movq %rax, (%rbx)
movq %r15, %rdi
callq 0x1030
movq %rbx, %rax
addq $0x248, %rsp            # imm = 0x248
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x1050