// File: /workspace/github_c_makefile_star2_O0/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 %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl $0x1, -0x1c(%rbp)
movq $0x0, -0x28(%rbp)
movq $0x0, -0x30(%rbp)
movq $0x0, -0x38(%rbp)
movq $0x0, -0x40(%rbp)
movq $0x0, -0x48(%rbp)
movq $0x0, -0x80(%rbp)
leaq -0x78(%rbp), %rdi
callq 0x1f4fa0
xorl %eax, %eax
cmpq -0x10(%rbp), %rax
jne 0x1f4c70
movq 0xc2d386(%rip), %rax    # 0xe21fd8
movq (%rax), %rdi
leaq 0xb0d29b(%rip), %rsi    # 0xd01ef7
movb $0x0, %al
callq 0x1f01f0
movq $0x0, -0x8(%rbp)
jmp 0x1f4f90
jmp 0x1f4c72
movq -0x28(%rbp), %rax
cmpq -0x18(%rbp), %rax
jge 0x1f4ea4
movq -0x10(%rbp), %rax
movq -0x28(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x40, %eax
je 0x1f4cba
movq 0xc2d340(%rip), %rax    # 0xe21fd8
movq (%rax), %rdi
movq -0x48(%rbp), %rdx
leaq 0xb0d27b(%rip), %rsi    # 0xd01f21
movb $0x0, %al
callq 0x1f01f0
movq $0x0, -0x8(%rbp)
jmp 0x1f4f90
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0x1f4cd5
movl $0x0, -0x1c(%rbp)
jmp 0x1f4d05
movaps 0xad8334(%rip), %xmm1   # 0xccd010
movq -0x38(%rbp), %xmm0
punpckldq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movapd 0xad8333(%rip), %xmm1   # 0xccd020
subpd %xmm1, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
leaq -0x78(%rbp), %rdi
callq 0x1f5090
movq $0x0, -0x38(%rbp)
movq -0x10(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0x1f5000
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
movq -0x48(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x48(%rbp)
movq -0x10(%rbp), %rax
movq -0x28(%rbp), %rcx
movsbl (%rax,%rcx), %ecx
xorl %eax, %eax
cmpl $0xa, %ecx
movb %al, -0x81(%rbp)
je 0x1f4d67
movq -0x10(%rbp), %rax
movq -0x28(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0xd, %eax
setne %al
movb %al, -0x81(%rbp)
movb -0x81(%rbp), %al
testb $0x1, %al
jne 0x1f4d73
jmp 0x1f4d8d
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0x1f4d36
movq -0x28(%rbp), %rax
addq $0x1, %rax
cmpq -0x18(%rbp), %rax
jge 0x1f4dcb
movq -0x10(%rbp), %rax
movq -0x28(%rbp), %rcx
movsbl 0x1(%rax,%rcx), %eax
cmpl $0xa, %eax
je 0x1f4dbf
movq -0x10(%rbp), %rax
movq -0x28(%rbp), %rcx
movsbl 0x1(%rax,%rcx), %eax
cmpl $0xd, %eax
jne 0x1f4dcb
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
movaps 0xad823e(%rip), %xmm1   # 0xccd010
movq -0x38(%rbp), %xmm0
punpckldq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movapd 0xad823d(%rip), %xmm1   # 0xccd020
subpd %xmm1, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
leaq -0x78(%rbp), %rdi
callq 0x1f5090
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
movq -0x48(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x48(%rbp)
movq -0x10(%rbp), %rax
movq -0x28(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x2b, %eax
je 0x1f4e4d
movq 0xc2d1ad(%rip), %rax    # 0xe21fd8
movq (%rax), %rdi
movq -0x48(%rbp), %rdx
leaq 0xb0d0e8(%rip), %rsi    # 0xd01f21
movb $0x0, %al
callq 0x1f01f0
movq $0x0, -0x8(%rbp)
jmp 0x1f4f90
movq -0x10(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0x1f5000
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
movq -0x48(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x48(%rbp)
movq -0x10(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0x1f5000
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
movq -0x48(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x48(%rbp)
jmp 0x1f4c72
movl $0x28, %edi
callq 0x1f01c0
movq %rax, -0x80(%rbp)
xorl %eax, %eax
cmpq -0x80(%rbp), %rax
jne 0x1f4eeb
leaq 0xb0ccae(%rip), %rdi    # 0xd01b6f
callq 0x1f0120
movq 0xc2d10b(%rip), %rax    # 0xe21fd8
movq (%rax), %rdi
leaq 0xb0d08d(%rip), %rsi    # 0xd01f64
movb $0x0, %al
callq 0x1f01f0
movq $0x0, -0x8(%rbp)
jmp 0x1f4f90
movq -0x30(%rbp), %rcx
movq -0x80(%rbp), %rax
movq %rcx, (%rax)
movq -0x40(%rbp), %rcx
movq -0x80(%rbp), %rax
movq %rcx, 0x8(%rax)
movsd -0x58(%rbp), %xmm0
movsd 0xb0cba9(%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 -0x80(%rbp), %rax
movq %rcx, 0x10(%rax)
movsd -0x50(%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 -0x80(%rbp), %rax
movq %rcx, 0x18(%rax)
movsd -0x70(%rbp), %xmm0
cvtsd2ss %xmm0, %xmm0
movq -0x80(%rbp), %rax
movss %xmm0, 0x20(%rax)
leaq -0x78(%rbp), %rdi
callq 0x1f5200
cvtsd2ss %xmm0, %xmm0
movq -0x80(%rbp), %rax
movss %xmm0, 0x24(%rax)
movq -0x80(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x90, %rsp
popq %rbp
retq
nopl (%rax)