// File: /workspace/github_c_makefile_star2_O3/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 $0x238, %rsp            # imm = 0x238
movq %rdx, 0x18(%rsp)
movq %rsi, %r14
movq %rdi, %rbx
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rdi)
movups %xmm0, (%rdi)
movl $0x10000, %edi          # imm = 0x10000
callq 0x1110
testq %rax, %rax
je 0x3101
movq %rax, %r12
movl $0x1, %esi
movl $0x10000, %edx          # imm = 0x10000
movq %rax, %rdi
movq %r14, %rcx
callq 0x1080
testq %rax, %rax
je 0x30e8
movq %r14, 0x10(%rsp)
movq %rbx, 0x8(%rsp)
movq $0x0, (%rsp)
leaq 0x13179(%rip), %r8      # 0x160f0
leaq 0x3172(%rip), %r14      # 0x60f0
xorl %ebx, %ebx
xorl %r15d, %r15d
xorl %ebp, %ebp
xorl %r13d, %r13d
movq 0x18(%rsp), %rcx
movl 0x24(%rcx), %ecx
cmpl $0x2, %ecx
jl 0x2fee
shll $0x8, %r13d
xorps %xmm0, %xmm0
movaps %xmm0, 0x30(%rsp)
movaps %xmm0, 0x20(%rsp)
testq %rax, %rax
jle 0x303c
leaq (%r12,%rax), %rcx
leaq (%r8,%r13,8), %rdx
movq %r12, %rsi
movzbl (%rsi), %edi
incq %rsi
movq (%rdx,%rdi,8), %rdx
movq %rdx, %r13
subq %r8, %r13
shrq $0xb, %r13
incq 0x20(%rsp,%r13,8)
cmpq %rcx, %rsi
jb 0x2fba
movq 0x20(%rsp), %rcx
movq 0x28(%rsp), %rdx
movq 0x30(%rsp), %rsi
addq 0x38(%rsp), %rcx
jmp 0x3046
xorps %xmm0, %xmm0
testl %ecx, %ecx
je 0x304e
movaps %xmm0, 0x20(%rsp)
testq %rax, %rax
jle 0x308b
leaq (%r12,%rax), %rcx
movl %r13d, %r13d
movq %r12, %rdx
movzbl (%rdx), %esi
incq %rdx
shlq $0x8, %r13
addq %r14, %r13
movzbl (%rsi,%r13), %r13d
incl 0x20(%rsp,%r13,4)
cmpq %rcx, %rdx
jb 0x300d
movl 0x20(%rsp), %ecx
movl 0x24(%rsp), %edi
movl 0x28(%rsp), %r8d
addl 0x2c(%rsp), %ecx
jmp 0x3092
shrl $0x8, %r13d
xorl %esi, %esi
xorl %edx, %edx
xorl %ecx, %ecx
addq %rsi, %rcx
addq %rdx, %rcx
jmp 0x309c
movaps %xmm0, 0x20(%rsp)
movl %r13d, %r13d
xorl %ecx, %ecx
movzbl (%r12,%rcx), %edx
shlq $0x8, %r13
addq %r14, %r13
movzbl (%rdx,%r13), %r13d
incl 0x20(%rsp,%r13,4)
incq %rcx
cmpq %rcx, %rax
jne 0x3058
movl 0x24(%rsp), %edx
movl 0x28(%rsp), %esi
leal (%rsi,%rdx), %ecx
addl 0x20(%rsp), %ecx
addl 0x2c(%rsp), %ecx
jmp 0x309c
xorl %r8d, %r8d
xorl %edi, %edi
xorl %ecx, %ecx
movl %edi, %edx
movl %r8d, %esi
addl %r8d, %ecx
addl %edi, %ecx
addq %rcx, (%rsp)
addq %rsi, %r15
addq %rdx, %rbp
addq %rax, %rbx
movl $0x1, %esi
movl $0x10000, %edx          # imm = 0x10000
movq %r12, %rdi
movq 0x10(%rsp), %rcx
callq 0x1080
testq %rax, %rax
leaq 0x13026(%rip), %r8      # 0x160f0
jne 0x2f88
movq 0x8(%rsp), %rax
movq %rbp, (%rax)
movq %r15, 0x8(%rax)
movq %rbx, 0x18(%rax)
movq (%rsp), %rcx
movq %rcx, 0x10(%rax)
movq %r12, %rdi
addq $0x238, %rsp            # imm = 0x238
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1030
callq 0x1050