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

    stats_clear(&stats);

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

    /* first line is always first sequence ID */
    if (T[i] != '>') {
        fprintf(stderr, "parasail_stat_fasta_buffer: "
                "poorly formatted FASTA file\n");
        return NULL;
    }

    i = skip_line(T, i);
    ++i;

    /* count that first sequence */
    ++seq;

    /* read rest of file */
    while (i<size) {
        if (T[i] == '>') {
            /* encountered a new sequence */
            ++seq;
            stats_sample_value(&stats, c);
            c = 0;
            i = skip_line(T, i);
        }
        else if (isalpha(T[i])) {
            ++c;
            ++c_tot;
        }
        else if (T[i] == '\n' || T[i] == '\r') {
            /* ignore newline */
            /* for the case of "\r\n" or "\n\r" */
            if (i+1<size && (T[i+1] == '\n' || T[i+1] == '\r')) {
                ++i;
            }
        }
        else if (isprint(T[i])) {
            fprintf(stderr, "parasail_stat_fasta_buffer: "
                    "non-alpha character ('%c')\n", T[i]);
            return NULL;
        }
        else {
            fprintf(stderr, "parasail_stat_fasta_buffer: "
                    "non-printing character ('%d')\n", T[i]);
            return NULL;
        }
        ++i;
    }

    /* still should have one sequence in the pipe */
    if (0 == c) {
        fprintf(stderr, "parasail_stat_fasta_buffer: "
                "empty sequence at end of input\n");
        return NULL;
    }
    stats_sample_value(&stats, c);

    pfs = (parasail_file_stat_t*)malloc(sizeof(parasail_file_stat_t));
    if (NULL == pfs) {
        perror("malloc");
        fprintf(stderr, "parasail_stat_fasta_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 %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
testq %rdi, %rdi
je 0x2518bb
movq %rdi, %r14
cmpb $0x3e, (%rdi)
jne 0x2518c2
movq %rsi, %r13
movb $0x3e, %al
movl $0x1, %ebx
cmpb $0xa, %al
je 0x2514d8
movzbl %al, %eax
cmpl $0xd, %eax
je 0x2514d8
movb (%r14,%rbx), %al
incq %rbx
jmp 0x2514c3
movzbl (%r14,%rbx), %eax
cmpl $0xa, %eax
je 0x2514e7
cmpl $0xd, %eax
jne 0x2514ed
leaq 0x1(%rbx), %rbp
jmp 0x2514f3
movq %rbx, %rbp
decq %rbx
cmpq %r13, %rbp
jge 0x2518b4
xorpd %xmm0, %xmm0
movsd %xmm0, 0x10(%rsp)
movl $0x1, %edx
movq $0x0, 0x60(%rsp)
movq 0x3c6b04(%rip), %xmm6   # 0x618020
movapd 0x3c6b0b(%rip), %xmm9   # 0x618030
xorl %eax, %eax
movsd %xmm0, 0x8(%rsp)
xorpd %xmm7, %xmm7
xorpd %xmm8, %xmm8
xorl %r12d, %r12d
movsbq (%r14,%rbp), %r15
cmpq $0x3e, %r15
jne 0x2515e6
movq %rax, %xmm0
punpckldq %xmm6, %xmm0    # xmm0 = xmm0[0],xmm6[0],xmm0[1],xmm6[1]
subpd %xmm9, %xmm0
movapd %xmm0, %xmm2
unpckhpd %xmm0, %xmm2            # xmm2 = xmm2[1],xmm0[1]
addsd %xmm0, %xmm2
movapd %xmm2, %xmm1
movapd %xmm2, %xmm0
testq %r12, %r12
je 0x251583
movsd 0x8(%rsp), %xmm1
minsd %xmm2, %xmm1
movsd 0x10(%rsp), %xmm0
maxsd %xmm2, %xmm0
incq %rdx
incq %r12
movapd %xmm2, %xmm3
subsd %xmm8, %xmm3
movq %r12, %xmm4
punpckldq %xmm6, %xmm4    # xmm4 = xmm4[0],xmm6[0],xmm4[1],xmm6[1]
subpd %xmm9, %xmm4
movapd %xmm4, %xmm5
unpckhpd %xmm4, %xmm5            # xmm5 = xmm5[1],xmm4[1]
addsd %xmm4, %xmm5
movapd %xmm3, %xmm4
divsd %xmm5, %xmm4
addsd %xmm4, %xmm8
subsd %xmm8, %xmm2
mulsd %xmm3, %xmm2
addsd %xmm2, %xmm7
movb $0x3e, %al
cmpb $0xa, %al
je 0x25167c
movzbl %al, %eax
cmpl $0xd, %eax
je 0x25167c
movb 0x1(%r14,%rbp), %al
incq %rbp
jmp 0x2515c8
movq %rax, 0x20(%rsp)
movapd %xmm8, 0x50(%rsp)
movapd %xmm7, 0x30(%rsp)
movq %r12, 0x40(%rsp)
movq %rdx, %r12
callq 0x1f0190
movq (%rax), %rax
movzwl (%rax,%r15,2), %eax
btl $0xa, %eax
jb 0x2516a1
cmpb $0xd, %r15b
je 0x25162a
movzbl %r15b, %ecx
cmpl $0xa, %ecx
jne 0x2518e2
addq $0x2, %rbx
cmpq %r13, %rbx
jge 0x2516e6
movzbl (%r14,%rbx), %eax
cmpl $0xd, %eax
movq 0x3c69d9(%rip), %xmm6   # 0x618020
movq %r12, %rdx
movapd 0x30(%rsp), %xmm7
movapd 0x50(%rsp), %xmm8
movapd 0x3c69d0(%rip), %xmm9   # 0x618030
je 0x25170e
cmpl $0xa, %eax
movq 0x40(%rsp), %r12
jne 0x251716
movq %rbx, %rbp
jmp 0x251716
leaq 0x1(%rbp), %rax
movzbl 0x1(%r14,%rbp), %ecx
cmpl $0xa, %ecx
je 0x251690
cmpl $0xd, %ecx
jne 0x2516d6
movsd %xmm1, 0x8(%rsp)
movsd %xmm0, 0x10(%rsp)
movq %rax, %rbp
jmp 0x2516e2
movq 0x20(%rsp), %rax
incq %rax
incq 0x60(%rsp)
movq 0x3c696a(%rip), %xmm6   # 0x618020
movq %r12, %rdx
movq 0x40(%rsp), %r12
movapd 0x30(%rsp), %xmm7
movapd 0x50(%rsp), %xmm8
movapd 0x3c695c(%rip), %xmm9   # 0x618030
jmp 0x25171b
movsd %xmm1, 0x8(%rsp)
movsd %xmm0, 0x10(%rsp)
xorl %eax, %eax
jmp 0x25171b
movq 0x3c6932(%rip), %xmm6   # 0x618020
movq %r12, %rdx
movq 0x40(%rsp), %r12
movapd 0x30(%rsp), %xmm7
movapd 0x50(%rsp), %xmm8
movapd 0x3c6924(%rip), %xmm9   # 0x618030
jmp 0x251716
movq %rbx, %rbp
movq 0x40(%rsp), %r12
movq 0x20(%rsp), %rax
movq %rbp, %rbx
incq %rbp
cmpq %r13, %rbp
jl 0x251539
testq %rax, %rax
je 0x2518b4
movapd %xmm8, 0x50(%rsp)
movapd %xmm7, 0x30(%rsp)
movq %rdx, %r14
movq %rax, %xmm0
punpckldq 0x3c68d0(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x3c68d8(%rip), %xmm0   # 0x618030
movapd %xmm0, %xmm2
unpckhpd %xmm0, %xmm2            # xmm2 = xmm2[1],xmm0[1]
addsd %xmm0, %xmm2
movapd %xmm2, %xmm1
movapd %xmm2, %xmm0
testq %r12, %r12
je 0x251785
movsd 0x8(%rsp), %xmm1
minsd %xmm2, %xmm1
movsd 0x10(%rsp), %xmm0
maxsd %xmm2, %xmm0
movapd %xmm1, 0x10(%rsp)
movapd %xmm0, 0x20(%rsp)
movapd %xmm2, 0x40(%rsp)
movl $0x28, %edi
callq 0x1f01f0
testq %rax, %rax
je 0x2518c9
movq %rax, %rbx
movapd 0x40(%rsp), %xmm0
movapd %xmm0, %xmm1
movapd 0x50(%rsp), %xmm5
subsd %xmm5, %xmm1
leaq 0x1(%r12), %rax
movq %rax, %xmm2
movq 0x3c684d(%rip), %xmm4   # 0x618020
punpckldq %xmm4, %xmm2    # xmm2 = xmm2[0],xmm4[0],xmm2[1],xmm4[1]
movapd 0x3c6851(%rip), %xmm6   # 0x618030
subpd %xmm6, %xmm2
movapd %xmm2, %xmm3
unpckhpd %xmm2, %xmm3            # xmm3 = xmm3[1],xmm2[1]
addsd %xmm2, %xmm3
movapd %xmm1, %xmm7
divsd %xmm3, %xmm7
addsd %xmm5, %xmm7
subsd %xmm7, %xmm0
mulsd %xmm1, %xmm0
addsd 0x30(%rsp), %xmm0
movq %r14, (%rbx)
movq 0x60(%rsp), %rax
movq %rax, 0x8(%rbx)
movsd 0x3fb273(%rip), %xmm1   # 0x64ca90
movapd 0x10(%rsp), %xmm2
cvttsd2si %xmm2, %rax
subsd %xmm1, %xmm2
cvttsd2si %xmm2, %rcx
movq %rax, %rdx
sarq $0x3f, %rdx
andq %rcx, %rdx
movapd 0x20(%rsp), %xmm2
cvttsd2si %xmm2, %rcx
orq %rax, %rdx
subsd %xmm1, %xmm2
cvttsd2si %xmm2, %rax
movq %rdx, 0x10(%rbx)
movq %rcx, %rdx
sarq $0x3f, %rdx
andq %rax, %rdx
orq %rcx, %rdx
movq %rdx, 0x18(%rbx)
movq %r12, %xmm1
punpckldq %xmm4, %xmm1    # xmm1 = xmm1[0],xmm4[0],xmm1[1],xmm4[1]
subpd %xmm6, %xmm1
movapd %xmm1, %xmm2
unpckhpd %xmm1, %xmm2            # xmm2 = xmm2[1],xmm1[1]
addsd %xmm1, %xmm2
divsd %xmm2, %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jb 0x251894
sqrtsd %xmm0, %xmm0
jmp 0x2518a5
movapd %xmm7, 0x30(%rsp)
callq 0x1f0120
movapd 0x30(%rsp), %xmm7
unpcklpd %xmm0, %xmm7            # xmm7 = xmm7[0],xmm0[0]
cvtpd2ps %xmm7, %xmm0
movlpd %xmm0, 0x20(%rbx)
jmp 0x2518d0
callq 0x1f0866
jmp 0x2518ce
callq 0x1f0882
jmp 0x2518ce
callq 0x1f0820
jmp 0x2518ce
callq 0x1f083c
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
btl $0xe, %eax
movq 0x5906eb(%rip), %rax    # 0x7e1fd8
movq (%rax), %rdi
jb 0x2518fb
leaq 0x3fb4fa(%rip), %rsi    # 0x64cdf3
jmp 0x251902
leaq 0x3fb4b9(%rip), %rsi    # 0x64cdbb
xorl %ebx, %ebx
movl %r15d, %edx
xorl %eax, %eax
callq 0x1f0220
jmp 0x2518d0