// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq $0x0, -0x20(%rbp)
movq $0x0, -0x28(%rbp)
movq $0x0, -0x30(%rbp)
movq $0x0, -0x38(%rbp)
movq $0x0, -0x70(%rbp)
leaq -0x68(%rbp), %rdi
callq 0x1f4fa0
xorl %eax, %eax
cmpq -0x10(%rbp), %rax
jne 0x1f487e
movq 0xc2d778(%rip), %rax    # 0xe21fd8
movq (%rax), %rdi
leaq 0xb0d516(%rip), %rsi    # 0xd01d80
movb $0x0, %al
callq 0x1f01f0
movq $0x0, -0x8(%rbp)
jmp 0x1f4be1
movq -0x10(%rbp), %rax
movq -0x20(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x3e, %eax
je 0x1f48b4
movq 0xc2d742(%rip), %rax    # 0xe21fd8
movq (%rax), %rdi
leaq 0xb0d50a(%rip), %rsi    # 0xd01daa
movb $0x0, %al
callq 0x1f01f0
movq $0x0, -0x8(%rbp)
jmp 0x1f4be1
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x1f5000
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rax
cmpq -0x18(%rbp), %rax
jge 0x1f4a98
movq -0x10(%rbp), %rax
movq -0x20(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x3e, %eax
jne 0x1f4955
movq -0x28(%rbp), %rax
incq %rax
movq %rax, -0x28(%rbp)
movaps 0xad8702(%rip), %xmm1   # 0xccd010
movq -0x30(%rbp), %xmm0
punpckldq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movapd 0xad8701(%rip), %xmm1   # 0xccd020
subpd %xmm1, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
leaq -0x68(%rbp), %rdi
callq 0x1f5090
movq $0x0, -0x30(%rbp)
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x1f5000
movq %rax, -0x20(%rbp)
jmp 0x1f4a87
callq 0x1f0170
movq (%rax), %rax
movq -0x10(%rbp), %rcx
movq -0x20(%rbp), %rdx
movsbl (%rcx,%rdx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x400, %eax            # imm = 0x400
cmpl $0x0, %eax
je 0x1f4997
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
jmp 0x1f4a85
movq -0x10(%rbp), %rax
movq -0x20(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0xa, %eax
je 0x1f49b9
movq -0x10(%rbp), %rax
movq -0x20(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0xd, %eax
jne 0x1f49fc
movq -0x20(%rbp), %rax
addq $0x1, %rax
cmpq -0x18(%rbp), %rax
jge 0x1f49f7
movq -0x10(%rbp), %rax
movq -0x20(%rbp), %rcx
movsbl 0x1(%rax,%rcx), %eax
cmpl $0xa, %eax
je 0x1f49eb
movq -0x10(%rbp), %rax
movq -0x20(%rbp), %rcx
movsbl 0x1(%rax,%rcx), %eax
cmpl $0xd, %eax
jne 0x1f49f7
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x1f4a83
callq 0x1f0170
movq (%rax), %rax
movq -0x10(%rbp), %rcx
movq -0x20(%rbp), %rdx
movsbl (%rcx,%rdx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x4000, %eax           # imm = 0x4000
cmpl $0x0, %eax
je 0x1f4a52
movq 0xc2d5b0(%rip), %rax    # 0xe21fd8
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movq -0x20(%rbp), %rcx
movsbl (%rax,%rcx), %edx
leaq 0xb0d3a5(%rip), %rsi    # 0xd01de3
movb $0x0, %al
callq 0x1f01f0
movq $0x0, -0x8(%rbp)
jmp 0x1f4be1
movq 0xc2d57f(%rip), %rax    # 0xe21fd8
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movq -0x20(%rbp), %rcx
movsbl (%rax,%rcx), %edx
leaq 0xb0d3ac(%rip), %rsi    # 0xd01e1b
movb $0x0, %al
callq 0x1f01f0
movq $0x0, -0x8(%rbp)
jmp 0x1f4be1
jmp 0x1f4a85
jmp 0x1f4a87
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x1f48dd
xorl %eax, %eax
cmpq -0x30(%rbp), %rax
jne 0x1f4ac5
movq 0xc2d531(%rip), %rax    # 0xe21fd8
movq (%rax), %rdi
leaq 0xb0d3a5(%rip), %rsi    # 0xd01e56
movb $0x0, %al
callq 0x1f01f0
movq $0x0, -0x8(%rbp)
jmp 0x1f4be1
movaps 0xad8544(%rip), %xmm1   # 0xccd010
movq -0x30(%rbp), %xmm0
punpckldq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movapd 0xad8543(%rip), %xmm1   # 0xccd020
subpd %xmm1, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
leaq -0x68(%rbp), %rdi
callq 0x1f5090
movl $0x28, %edi
callq 0x1f01c0
movq %rax, -0x70(%rbp)
xorl %eax, %eax
cmpq -0x70(%rbp), %rax
jne 0x1f4b3c
leaq 0xb0d05d(%rip), %rdi    # 0xd01b6f
callq 0x1f0120
movq 0xc2d4ba(%rip), %rax    # 0xe21fd8
movq (%rax), %rdi
leaq 0xb0d36a(%rip), %rsi    # 0xd01e92
movb $0x0, %al
callq 0x1f01f0
movq $0x0, -0x8(%rbp)
jmp 0x1f4be1
movq -0x28(%rbp), %rcx
movq -0x70(%rbp), %rax
movq %rcx, (%rax)
movq -0x38(%rbp), %rcx
movq -0x70(%rbp), %rax
movq %rcx, 0x8(%rax)
movsd -0x48(%rbp), %xmm0
movsd 0xb0cf58(%rip), %xmm2   # 0xd01ab8
movaps %xmm0, %xmm1
subsd %xmm2, %xmm1
cvttsd2si %xmm1, %rax
cvttsd2si %xmm0, %rcx
movq %rcx, %rdx
sarq $0x3f, %rdx
andq %rdx, %rax
orq %rax, %rcx
movq -0x70(%rbp), %rax
movq %rcx, 0x10(%rax)
movsd -0x40(%rbp), %xmm0
movaps %xmm0, %xmm1
subsd %xmm2, %xmm1
cvttsd2si %xmm1, %rax
cvttsd2si %xmm0, %rcx
movq %rcx, %rdx
sarq $0x3f, %rdx
andq %rdx, %rax
orq %rax, %rcx
movq -0x70(%rbp), %rax
movq %rcx, 0x18(%rax)
movsd -0x60(%rbp), %xmm0
cvtsd2ss %xmm0, %xmm0
movq -0x70(%rbp), %rax
movss %xmm0, 0x20(%rax)
leaq -0x68(%rbp), %rdi
callq 0x1f5200
cvtsd2ss %xmm0, %xmm0
movq -0x70(%rbp), %rax
movss %xmm0, 0x24(%rax)
movq -0x70(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x70, %rsp
popq %rbp
retq
nopl (%rax,%rax)