// File: /workspace/github_c_makefile_star2_O1/nh13[P]ksw/src/parasail/src/io.c
// Function: parasail_stat_fastq_buffer
parasail_file_stat_t* parasail_stat_fastq_buffer(const char *T, off_t size)
{
    int first = 1;
    off_t i = 0;
    unsigned long seq = 0;
    unsigned long c = 0;
    unsigned long c_tot = 0;
    unsigned long line = 0;
    stats_t stats;
    parasail_file_stat_t *pfs = NULL;

    stats_clear(&stats);

    if (NULL == T) {
        fprintf(stderr, "parasail_stat_fastq_buffer: NULL pointer\n");
        return NULL;
    }

    /* read file */
    while (i<size) {
        if (T[i] != '@') {
            fprintf(stderr, "parasail_stat_fastq_buffer: "
                    "poorly formatted FASTQ file, line %lu\n", line);
            return NULL;
        }

        /* encountered a new sequence */
        ++seq;
        if (first) {
            first = 0;
        }
        else {
            stats_sample_value(&stats, c);
        }
        c = 0;

        i = skip_line(T, i);

        /* go to next line */
        ++i;
        ++line;

        /* rest of next line is the sequence */
        while (T[i] != '\n' && T[i] != '\r') {
            ++c;
            ++i;
        }

        /* for the case of "\r\n" or "\n\r" */
        if (i+1<size && (T[i+1] == '\n' || T[i+1] == '\r')) {
            ++i;
        }

        stats_sample_value(&stats, c);

        /* go to next line */
        ++i;
        ++line;

        if (T[i] != '+') {
            fprintf(stderr, "parasail_stat_fastq_buffer: "
                    "poorly formatted FASTQ file, line %lu\n", line);
            return NULL;
        }

        i = skip_line(T, i);

        /* go to next line */
        ++i;
        ++line;

        /* rest of next line are the quality control values */
        i = skip_line(T, i);

        /* go to next line */
        ++i;
        ++line;
    }

    pfs = (parasail_file_stat_t*)malloc(sizeof(parasail_file_stat_t));
    if (NULL == pfs) {
        perror("malloc");
        fprintf(stderr, "parasail_stat_fastq_buffer: "
                "cannont allocate parasail_file_stat_t");
        return NULL;
    }

    pfs->sequences = seq;
    pfs->characters = c_tot;
    pfs->shortest = (unsigned long)stats._min;
    pfs->longest = (unsigned long)stats._max;
    pfs->mean = (float)stats._mean;
    pfs->stddev = (float)stats_stddev(&stats);

    return pfs;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x38, %rsp
testq %rdi, %rdi
je 0x251ae2
testq %rsi, %rsi
jle 0x251a51
xorpd %xmm2, %xmm2
xorl %edx, %edx
movq 0x39387b(%rip), %xmm0   # 0x5e5020
movapd 0x393883(%rip), %xmm1   # 0x5e5030
xorl %ecx, %ecx
xorl %r14d, %r14d
xorl %r8d, %r8d
xorl %r10d, %r10d
xorpd %xmm5, %xmm5
xorpd %xmm10, %xmm10
xorpd %xmm4, %xmm4
xorl %r9d, %r9d
cmpb $0x40, (%rdi,%r8)
jne 0x251af0
testb $0x1, %r10b
je 0x251857
movq %rcx, %xmm6
punpckldq %xmm0, %xmm6    # xmm6 = xmm6[0],xmm0[0],xmm6[1],xmm0[1]
subpd %xmm1, %xmm6
movapd %xmm6, %xmm3
unpckhpd %xmm6, %xmm3            # xmm3 = xmm3[1],xmm6[1]
addsd %xmm6, %xmm3
movapd %xmm3, %xmm7
movapd %xmm3, %xmm8
testq %r9, %r9
je 0x251811
minsd %xmm3, %xmm5
maxsd %xmm3, %xmm2
movapd %xmm5, %xmm7
movapd %xmm2, %xmm8
incq %r9
movapd %xmm3, %xmm2
subsd %xmm4, %xmm2
movq %r9, %xmm5
punpckldq %xmm0, %xmm5    # xmm5 = xmm5[0],xmm0[0],xmm5[1],xmm0[1]
subpd %xmm1, %xmm5
movapd %xmm5, %xmm9
unpckhpd %xmm5, %xmm9            # xmm9 = xmm9[1],xmm5[1]
addsd %xmm5, %xmm9
movapd %xmm2, %xmm6
divsd %xmm9, %xmm6
addsd %xmm4, %xmm6
subsd %xmm6, %xmm3
mulsd %xmm2, %xmm3
addsd %xmm10, %xmm3
movq %r9, %rax
jmp 0x25186c
movq %r9, %rax
movapd %xmm4, %xmm6
movapd %xmm10, %xmm3
movapd %xmm5, %xmm7
movapd %xmm2, %xmm8
incq %r14
movzbl (%rdi,%r8), %ecx
cmpl $0xa, %ecx
je 0x251883
cmpl $0xd, %ecx
je 0x251883
incq %r8
jmp 0x25186f
leaq 0x1(%r8), %r10
movzbl 0x1(%rdi,%r8), %ecx
cmpl $0xa, %ecx
je 0x25189a
cmpl $0xd, %ecx
je 0x25189a
movq %r8, %r10
addq $0x2, %r10
xorl %ecx, %ecx
movzbl -0x1(%rdi,%r10), %r8d
cmpl $0xa, %r8d
je 0x2518ba
cmpl $0xd, %r8d
je 0x2518ba
incq %rcx
incq %r10
jmp 0x2518a0
leaq -0x1(%r10), %r8
cmpq %rsi, %r10
jge 0x2518d4
movzbl (%rdi,%r10), %r9d
cmpl $0xa, %r9d
je 0x2518d7
cmpl $0xd, %r9d
je 0x2518d7
movq %r8, %r10
movq %rcx, %xmm2
punpckldq %xmm0, %xmm2    # xmm2 = xmm2[0],xmm0[0],xmm2[1],xmm0[1]
subpd %xmm1, %xmm2
movapd %xmm2, %xmm10
unpckhpd %xmm2, %xmm10           # xmm10 = xmm10[1],xmm2[1]
addsd %xmm2, %xmm10
movapd %xmm10, %xmm5
movapd %xmm10, %xmm2
testq %rax, %rax
je 0x251915
minsd %xmm10, %xmm7
maxsd %xmm10, %xmm8
movapd %xmm7, %xmm5
movapd %xmm8, %xmm2
leaq 0x1(%rax), %r9
movq %r9, %xmm4
punpckldq %xmm0, %xmm4    # xmm4 = xmm4[0],xmm0[0],xmm4[1],xmm0[1]
subpd %xmm1, %xmm4
cmpb $0x2b, 0x1(%r10,%rdi)
jne 0x251b0c
movapd %xmm10, %xmm7
subsd %xmm6, %xmm7
movapd %xmm4, %xmm8
unpckhpd %xmm4, %xmm8            # xmm8 = xmm8[1],xmm4[1]
addsd %xmm4, %xmm8
movapd %xmm7, %xmm4
divsd %xmm8, %xmm4
addsd %xmm6, %xmm4
subsd %xmm4, %xmm10
mulsd %xmm7, %xmm10
addsd %xmm3, %xmm10
addq $0x2, %r10
movq %r10, %r8
movzbl -0x1(%rdi,%r8), %r10d
cmpl $0xa, %r10d
je 0x251984
cmpl $0xd, %r10d
je 0x251984
incq %r8
jmp 0x25196d
movzbl (%rdi,%r8), %r10d
cmpl $0xa, %r10d
je 0x251998
cmpl $0xd, %r10d
je 0x251998
decq %r8
incq %r8
movzbl (%rdi,%r8), %r10d
incq %r8
cmpl $0xd, %r10d
je 0x2519af
cmpl $0xa, %r10d
jne 0x25199b
movzbl (%rdi,%r8), %r10d
cmpl $0xa, %r10d
je 0x2519c3
cmpl $0xd, %r10d
je 0x2519c3
decq %r8
incq %r8
addq $0x4, %rdx
movb $0x1, %r10b
cmpq %rsi, %r8
jl 0x2517c8
movapd %xmm10, 0x20(%rsp)
cvttsd2si %xmm5, %rcx
movsd 0x3c80a6(%rip), %xmm0   # 0x619a90
subsd %xmm0, %xmm5
cvttsd2si %xmm5, %rdx
movq %rcx, %r15
sarq $0x3f, %r15
andq %rdx, %r15
orq %rcx, %r15
cvttsd2si %xmm2, %rcx
subsd %xmm0, %xmm2
cvttsd2si %xmm2, %rdx
movq %rcx, %r12
sarq $0x3f, %r12
andq %rdx, %r12
xorps %xmm0, %xmm0
cvtsd2ss %xmm4, %xmm0
movss %xmm0, 0xc(%rsp)
movq %rax, %xmm0
punpckldq 0x3935ee(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x3935f6(%rip), %xmm0   # 0x5e5030
orq %rcx, %r12
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
movapd %xmm1, 0x10(%rsp)
jmp 0x251a79
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rsp)
xorps %xmm0, %xmm0
movss %xmm0, 0xc(%rsp)
movsd 0x39359e(%rip), %xmm0   # 0x5e5008
movapd %xmm0, 0x10(%rsp)
xorl %r15d, %r15d
xorl %r12d, %r12d
xorl %r14d, %r14d
movl $0x28, %edi
callq 0x1f01f0
testq %rax, %rax
je 0x251ae9
movq %rax, %rbx
movq %r14, (%rax)
movq $0x0, 0x8(%rax)
movq %r15, 0x10(%rax)
movq %r12, 0x18(%rax)
movss 0xc(%rsp), %xmm0
movss %xmm0, 0x20(%rax)
movapd 0x20(%rsp), %xmm0
divsd 0x10(%rsp), %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jb 0x251ac5
sqrtsd %xmm0, %xmm0
jmp 0x251aca
callq 0x1f0120
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x24(%rbx)
movq %rbx, %rax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
callq 0x1f08e7
jmp 0x251b14
callq 0x1f08bd
jmp 0x251b14
movq 0x55b4e1(%rip), %rax    # 0x7acfd8
movq (%rax), %rdi
leaq 0x3c83f8(%rip), %rsi    # 0x619ef9
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x1f0220
jmp 0x251ad3
movq %rdx, %rdi
callq 0x1f089e
xorl %ebx, %ebx
jmp 0x251ad3