// File: /workspace/github_c_makefile_star2_O3/nh13[P]ksw/src/parasail/src/parser.c
// Function: parasail_sequences_from_file
parasail_sequences_t* parasail_sequences_from_file(const char *filename)
{
#if HAVE_ZLIB
    gzFile fp;
#else
    FILE* fp;
    int is_stdin = 0;
#endif
    kseq_t *seq = NULL;
    int l = 0;
    parasail_sequences_t *retval = NULL;
    parasail_sequence_t *sequences = NULL;
    unsigned long count = 0;
    unsigned long capacity = 1000;
    size_t chars = 0;
    stats_t stats;
    int error_during_kseq = 0;

    stats_clear(&stats);

    retval = (parasail_sequences_t*)malloc(sizeof(parasail_sequences_t));
    if (NULL == retval) {
        perror("malloc");
        fprintf(stderr, "parasail_sequences_from_file: failed\n");
        return NULL;
    }
    sequences = (parasail_sequence_t*)malloc(sizeof(parasail_sequence_t) * capacity);
    if (NULL == sequences) {
        perror("malloc");
        fprintf(stderr, "parasail_sequences_from_file: failed\n");
        free(retval);
        return NULL;
    }

    /* check for stdin instead of a normal filename */
    if (0 == strncmp("stdin", filename, 5)) {
#if HAVE_ZLIB
        fp = gzdopen(fileno(stdin), "r");
        if (fp == Z_NULL) {
            perror("gzdopen");
            fprintf(stderr, "parasail_sequences_from_file: failed\n");
            free(sequences);
            free(retval);
            return NULL;
        }
#else
        fp = stdin;
        is_stdin = 1;
#endif
    }
    else {
        /* open the file */
        errno = 0;
#if HAVE_ZLIB
        fp = gzopen(filename, "r");
        if (fp == Z_NULL) {
            perror("gzopen");
            fprintf(stderr, "parasail_sequences_from_file: failed\n");
            free(sequences);
            free(retval);
            return NULL;
        }
#else
        fp = fopen(filename, "r");
        if (fp == NULL) {
            perror("fopen");
            fprintf(stderr, "parasail_sequences_from_file: failed\n");
            free(sequences);
            free(retval);
            return NULL;
        }
#endif
    }
    
    /* initialize kseq structures */
#if HAVE_ZLIB
    seq = kseq_init(fp);
#else
    seq = kseq_init(fileno(fp));
#endif

    /* parse file */
    while ((l = kseq_read(seq)) >= 0) {
        errno = 0;
        sequences[count].name.l = seq->name.l;
        sequences[count].comment.l = seq->comment.l;
        sequences[count].seq.l = seq->seq.l;
        sequences[count].qual.l = seq->qual.l;
        sequences[count].name.s = NULL;
        sequences[count].comment.s = NULL;
        sequences[count].seq.s = NULL;
        sequences[count].qual.s = NULL;

        stats_sample_value(&stats, seq->seq.l);
        chars += seq->seq.l;

        if (sequences[count].name.l) {
            sequences[count].name.s = strdup_rpl(seq->name.s);
            if (NULL == sequences[count].name.s) {
                perror("strdup name");
                error_during_kseq = 1;
                break;
            }
        }
        if (sequences[count].comment.l) {
            sequences[count].comment.s = strdup_rpl(seq->comment.s);
            if (NULL == sequences[count].comment.s) {
                perror("strdup comment");
                error_during_kseq = 1;
                break;
            }
        }
        if (sequences[count].seq.l) {
            sequences[count].seq.s = strdup_rpl(seq->seq.s);
            if (NULL == sequences[count].seq.s) {
                perror("strdup seq");
                error_during_kseq = 1;
                break;
            }
        }
        if (sequences[count].qual.l) {
            sequences[count].qual.s = strdup_rpl(seq->qual.s);
            if (NULL == sequences[count].qual.s) {
                perror("strdup qual");
                error_during_kseq = 1;
                break;
            }
        }
        ++count;

        /* allocate more space for sequences if we ran out */
        if (count >= capacity) {
            parasail_sequence_t *new_sequences = NULL;
            capacity *= 2;
            errno = 0;
            new_sequences = (parasail_sequence_t*)realloc(sequences, sizeof(parasail_sequence_t) * capacity);
            if (NULL == new_sequences) {
                perror("realloc");
                error_during_kseq = 2;
                break;
            }
            sequences = new_sequences;
            errno = 0;
        }
    }
    kseq_destroy(seq);
#if HAVE_ZLIB
    gzclose(fp);
#else
    if (!is_stdin) {
        fclose(fp);
    }
#endif

    retval->seqs = sequences;
    retval->l = count;
    retval->characters = chars;
    retval->shortest = stats._min;
    retval->longest = stats._max;
    retval->mean = stats._mean;
    retval->stddev = stats_stddev(&stats);

    if (0 != error_during_kseq) {
        fprintf(stderr, "parasail_sequences_from_file: failed\n");
        if (1 == error_during_kseq) {
            retval->l++;
        }
        parasail_sequences_free(retval);
        return NULL;
    }

    return retval;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movq %rdi, %rbx
movl $0x30, %edi
callq 0x129190
testq %rax, %rax
je 0x18ca89
movq %rax, %r14
movl $0xfa00, %edi           # imm = 0xFA00
callq 0x129190
movq %rax, 0x58(%rsp)
testq %rax, %rax
je 0x18ca90
leaq 0x4018fc(%rip), %rdi    # 0x58dbcd
movl $0x5, %edx
movq %rbx, %rsi
callq 0x1290b0
movl %eax, %ebp
testl %eax, %eax
je 0x18c318
callq 0x129030
movl $0x0, (%rax)
leaq 0x40153b(%rip), %rsi    # 0x58d831
movq %rbx, %rdi
callq 0x129160
movq %rax, %rdi
testq %rax, %rax
jne 0x18c322
movq 0x58(%rsp), %rdi
movq %r14, %rsi
callq 0x12a1ff
jmp 0x18caae
movq 0x50acb1(%rip), %rax    # 0x696fd0
movq (%rax), %rdi
movl %ebp, 0x8(%rsp)
movq %r14, 0x28(%rsp)
movq %rdi, 0x98(%rsp)
callq 0x129140
movl %eax, %ebp
movl $0x1, %edi
movl $0x70, %esi
callq 0x1290e0
movq %rax, %r13
movl $0x1, %edi
movl $0x18, %esi
callq 0x1290e0
movq %rax, %rbx
movl %ebp, 0x14(%rax)
movl $0x4000, %edi           # imm = 0x4000
callq 0x129190
movq %rax, (%rbx)
movq %rbx, 0x68(%r13)
leaq 0x48(%r13), %rbp
leaq 0x30(%r13), %r12
leaq 0x18(%r13), %rax
movq %rax, 0xa0(%rsp)
movl $0x3e8, %eax            # imm = 0x3E8
movq %rax, 0x70(%rsp)
xorpd %xmm0, %xmm0
movapd %xmm0, 0x80(%rsp)
xorl %eax, %eax
xorl %r15d, %r15d
xorpd %xmm1, %xmm1
movapd %xmm1, 0x30(%rsp)
movapd %xmm1, 0x40(%rsp)
movq $0x0, 0x78(%rsp)
movq %r12, 0x68(%rsp)
testl %eax, %eax
movapd %xmm0, 0x10(%rsp)
je 0x18c50a
xorl %eax, %eax
movq %rax, 0x48(%r13)
movq %rax, 0x30(%r13)
movq %rax, 0x18(%r13)
movq %rbx, %rdi
xorl %esi, %esi
movq %r13, %rdx
leaq 0xc(%rsp), %rcx
xorl %r8d, %r8d
callq 0x18cc88
testl %eax, %eax
js 0x18ca70
cmpl $0xa, 0xc(%rsp)
je 0x18c41a
movq %rbx, %rdi
movl $0x2, %esi
movq 0xa0(%rsp), %rdx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x18cc88
cmpq $0x0, 0x40(%r13)
jne 0x18c437
movq $0x100, 0x38(%r13)      # imm = 0x100
movl $0x100, %edi            # imm = 0x100
callq 0x129190
movq %rax, 0x40(%r13)
movl 0xc(%rbx), %eax
movl $0xfffffffd, %r14d      # imm = 0xFFFFFFFD
cmpl $-0x1, %eax
movq 0x68(%rsp), %r12
je 0x18c5a8
cmpl $0x0, 0x10(%rbx)
movl 0x8(%rbx), %ecx
je 0x18c45f
cmpl %eax, %ecx
jge 0x18c585
movq (%rbx), %rsi
cmpl %eax, %ecx
jl 0x18c494
movl $0x0, 0x8(%rbx)
movl 0x14(%rbx), %edi
movl $0x4000, %edx           # imm = 0x4000
callq 0x1291d0
movl %eax, 0xc(%rbx)
cmpl $-0x1, %eax
je 0x18c59b
testl %eax, %eax
je 0x18c593
movl 0x8(%rbx), %ecx
movq (%rbx), %rsi
leal 0x1(%rcx), %edx
movl %edx, 0x8(%rbx)
movslq %ecx, %rcx
movb (%rsi,%rcx), %cl
movzbl %cl, %edx
movl %edx, 0xc(%rsp)
cmpl $0x2a, %edx
jg 0x18c4b3
cmpl $0xa, %edx
je 0x18c4fc
jmp 0x18c4ce
cmpl $0x2b, %edx
je 0x18c5ad
cmpl $0x3e, %edx
je 0x18c58d
cmpl $0x40, %edx
je 0x18c58d
movq 0x30(%r13), %rax
movq 0x40(%r13), %rdx
leaq 0x1(%rax), %rsi
movq %rsi, 0x30(%r13)
movb %cl, (%rdx,%rax)
movq %rbx, %rdi
movl $0x2, %esi
movq %r12, %rdx
xorl %ecx, %ecx
movl $0x1, %r8d
callq 0x18cc88
movl 0xc(%rbx), %eax
cmpl $-0x1, %eax
jne 0x18c44e
jmp 0x18c5a8
leaq 0x10(%rbx), %r14
movl 0xc(%rbx), %eax
cmpl $-0x1, %eax
je 0x18c90d
cmpl $0x0, 0x10(%rbx)
movl 0x8(%rbx), %ecx
je 0x18c52b
cmpl %eax, %ecx
jge 0x18c90d
movq (%rbx), %rsi
cmpl %eax, %ecx
jl 0x18c561
movl $0x0, 0x8(%rbx)
movl 0x14(%rbx), %edi
movl $0x4000, %edx           # imm = 0x4000
callq 0x1291d0
movl %eax, 0xc(%rbx)
leal 0x1(%rax), %ecx
cmpl $0x2, %ecx
jb 0x18c900
movl 0x8(%rbx), %ecx
movq (%rbx), %rsi
movapd 0x10(%rsp), %xmm0
leal 0x1(%rcx), %edx
movl %edx, 0x8(%rbx)
movslq %ecx, %rcx
movzbl (%rsi,%rcx), %ecx
movl %ecx, 0xc(%rsp)
cmpl $0x40, %ecx
je 0x18c57c
cmpl $0x3e, %ecx
jne 0x18c511
movl %ecx, 0x60(%r13)
jmp 0x18c3ce
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
jmp 0x18c5a8
movl %edx, 0x60(%r13)
jmp 0x18c5ad
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
jmp 0x18c5a1
movl $0xfffffffd, %r14d      # imm = 0xFFFFFFFD
movl $0x1, 0x10(%rbx)
movl %r14d, 0xc(%rsp)
movq 0x30(%r13), %r14
movq 0x38(%r13), %r12
leaq 0x1(%r14), %rcx
movq 0x40(%r13), %rax
cmpq %r12, %rcx
jb 0x18c609
movq %rcx, %rdx
shrq %rdx
orq %rcx, %rdx
movq %rdx, %rcx
shrq $0x2, %rcx
orq %rdx, %rcx
movq %rcx, %rdx
shrq $0x4, %rdx
orq %rcx, %rdx
movq %rdx, %rcx
shrq $0x8, %rcx
orq %rdx, %rcx
movq %rcx, %r12
shrq $0x10, %r12
orq %rcx, %r12
incq %r12
movq %r12, 0x38(%r13)
movq %rax, %rdi
movq %r12, %rsi
callq 0x1291f0
movq %rax, 0x40(%r13)
movb $0x0, (%rax,%r14)
cmpl $0x2b, 0xc(%rsp)
jne 0x18c706
cmpq %r12, 0x50(%r13)
jae 0x18c633
movq %r12, 0x50(%r13)
movq 0x58(%r13), %rdi
movq %r12, %rsi
callq 0x1291f0
movq %rax, 0x58(%r13)
leaq 0x10(%rbx), %r14
movl 0xc(%rbx), %eax
movapd 0x10(%rsp), %xmm0
movq 0x68(%rsp), %r12
cmpl $-0x1, %eax
je 0x18c6b1
cmpl $0x0, 0x10(%rbx)
movl 0x8(%rbx), %ecx
je 0x18c65b
cmpl %eax, %ecx
jge 0x18c90d
movq (%rbx), %rsi
cmpl %eax, %ecx
jl 0x18c692
movl $0x0, 0x8(%rbx)
movl 0x14(%rbx), %edi
movl $0x4000, %edx           # imm = 0x4000
callq 0x1291d0
movl %eax, 0xc(%rbx)
cmpl $-0x1, %eax
je 0x18c6aa
testl %eax, %eax
movapd 0x10(%rsp), %xmm0
je 0x18c906
movl 0x8(%rbx), %ecx
movq (%rbx), %rsi
leal 0x1(%rcx), %edx
movl %edx, 0x8(%rbx)
movslq %ecx, %rcx
movzbl (%rsi,%rcx), %ecx
movl %ecx, 0xc(%rsp)
cmpl $0xa, %ecx
jne 0x18c645
jmp 0x18c6b9
movl $0x1, (%r14)
movl $0xfffffffd, 0xc(%rsp)  # imm = 0xFFFFFFFD
movq %rbx, %rdi
movl $0x2, %esi
movq %rbp, %rdx
xorl %ecx, %ecx
movl $0x1, %r8d
callq 0x18cc88
testl %eax, %eax
js 0x18c6ed
movq (%rbp), %r14
movq (%r12), %rax
xorl %ecx, %ecx
cmpq %rax, %r14
setb %cl
movl %ecx, 0xc(%rsp)
jb 0x18c6b9
jmp 0x18c6f5
movq (%r12), %rax
movq (%rbp), %r14
movl $0x0, 0x60(%r13)
cmpq %r14, %rax
jne 0x18ca70
testl %r14d, %r14d
js 0x18ca70
callq 0x129030
movq %rax, %rbx
movl $0x0, (%rax)
movq (%r13), %rcx
movq %r15, %rdi
shlq $0x6, %r15
movq 0x58(%rsp), %rsi
movq %rcx, (%rsi,%r15)
movq 0x18(%r13), %rax
movq %rax, 0x10(%rsi,%r15)
movq %r14, 0x20(%rsi,%r15)
movq 0x48(%r13), %rdx
movq %rdx, 0x30(%rsi,%r15)
xorl %edx, %edx
movq %rdx, 0x8(%rsi,%r15)
movq %rdx, 0x18(%rsi,%r15)
movq %rdx, 0x28(%rsi,%r15)
movq %rdx, 0x38(%rsi,%r15)
movq %r14, %xmm1
punpckldq 0x401415(%rip), %xmm1 # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x40141d(%rip), %xmm1   # 0x58db90
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
movapd %xmm0, %xmm2
movapd %xmm0, %xmm1
movq %rdi, 0x60(%rsp)
testq %rdi, %rdi
je 0x18c7a5
movapd 0x30(%rsp), %xmm2
minsd %xmm0, %xmm2
movapd 0x40(%rsp), %xmm1
maxsd %xmm0, %xmm1
movsd %xmm1, 0x40(%rsp)
movsd %xmm2, 0x30(%rsp)
addq 0x58(%rsp), %r15
movq 0x60(%rsp), %rdx
leaq 0x1(%rdx), %r12
movapd %xmm0, %xmm1
movapd 0x80(%rsp), %xmm4
subsd %xmm4, %xmm1
movq %r12, %xmm2
punpckldq 0x4013a3(%rip), %xmm2 # xmm2 = xmm2[0],mem[0],xmm2[1],mem[1]
subpd 0x4013ab(%rip), %xmm2   # 0x58db90
movapd %xmm2, %xmm3
unpckhpd %xmm2, %xmm3            # xmm3 = xmm3[1],xmm2[1]
addsd %xmm2, %xmm3
movapd %xmm1, %xmm2
divsd %xmm3, %xmm2
addsd %xmm2, %xmm4
movapd %xmm4, 0x80(%rsp)
subsd %xmm4, %xmm0
mulsd %xmm1, %xmm0
movapd 0x10(%rsp), %xmm1
addsd %xmm0, %xmm1
movapd %xmm1, 0x10(%rsp)
addq %r14, 0x78(%rsp)
testq %rcx, %rcx
je 0x18c842
movq 0x10(%r13), %rdi
callq 0x18cb3c
movq %rax, 0x8(%r15)
testq %rax, %rax
je 0x18cab3
movq 0x10(%r15), %rax
testq %rax, %rax
je 0x18c85d
movq 0x28(%r13), %rdi
callq 0x18cb3c
movq %rax, 0x18(%r15)
testq %rax, %rax
je 0x18cabc
cmpq $0x0, 0x20(%r15)
je 0x18c87a
movq 0x40(%r13), %rdi
callq 0x18cb3c
movq %rax, 0x28(%r15)
testq %rax, %rax
je 0x18cac5
cmpq $0x0, 0x30(%r15)
je 0x18c897
movq 0x58(%r13), %rdi
callq 0x18cb3c
movq %rax, 0x38(%r15)
testq %rax, %rax
je 0x18cace
movq 0x70(%rsp), %r14
cmpq %r14, %r12
jb 0x18c8d4
movl $0x0, (%rbx)
movq %r14, %rsi
shlq $0x7, %rsi
movq 0x58(%rsp), %rdi
callq 0x1291f0
testq %rax, %rax
je 0x18cb0d
addq %r14, %r14
movq %r14, 0x70(%rsp)
movl $0x0, (%rbx)
movq %rax, 0x58(%rsp)
movq 0x68(%r13), %rbx
movl 0x60(%r13), %eax
movq %r12, %r15
movsd 0x30(%rsp), %xmm0
movaps %xmm0, 0x30(%rsp)
movsd 0x40(%rsp), %xmm0
movaps %xmm0, 0x40(%rsp)
movapd 0x10(%rsp), %xmm0
jmp 0x18c3c0
movapd 0x10(%rsp), %xmm0
movl $0x1, (%r14)
xorl %ebx, %ebx
movq %r15, %r12
testq %r13, %r13
movq 0x28(%rsp), %r14
movl 0x8(%rsp), %ebp
je 0x18c97f
movl %ebx, 0x68(%rsp)
movq %r15, %rbx
movapd %xmm0, 0x10(%rsp)
movq 0x10(%r13), %rdi
callq 0x129170
movq 0x28(%r13), %rdi
callq 0x129170
movq 0x40(%r13), %rdi
callq 0x129170
movq 0x58(%r13), %rdi
callq 0x129170
movq 0x68(%r13), %r15
testq %r15, %r15
je 0x18c96a
movq (%r15), %rdi
callq 0x129170
movq %r15, %rdi
callq 0x129170
movq %r13, %rdi
callq 0x129170
movapd 0x10(%rsp), %xmm0
movq %rbx, %r15
movl 0x68(%rsp), %ebx
testl %ebp, %ebp
je 0x18c99c
movq 0x98(%rsp), %rdi
movapd %xmm0, 0x10(%rsp)
callq 0x129130
movapd 0x10(%rsp), %xmm0
movq 0x58(%rsp), %rax
movq %rax, (%r14)
movq %r15, 0x8(%r14)
movq 0x78(%rsp), %rax
movq %rax, 0x10(%r14)
movapd 0x30(%rsp), %xmm2
cvttsd2si %xmm2, %rax
movsd 0x3d3094(%rip), %xmm1   # 0x55fa58
subsd %xmm1, %xmm2
cvttsd2si %xmm2, %rcx
movq %rax, %rdx
sarq $0x3f, %rdx
andq %rcx, %rdx
orq %rax, %rdx
movq %rdx, 0x18(%r14)
movapd 0x40(%rsp), %xmm2
cvttsd2si %xmm2, %rax
subsd %xmm1, %xmm2
cvttsd2si %xmm2, %rcx
movq %rax, %rdx
sarq $0x3f, %rdx
andq %rcx, %rdx
orq %rax, %rdx
decq %r12
movq %r12, %xmm2
punpckldq 0x401171(%rip), %xmm2 # xmm2 = xmm2[0],mem[0],xmm2[1],mem[1]
subpd 0x401179(%rip), %xmm2   # 0x58db90
movq %rdx, 0x20(%r14)
movapd %xmm2, %xmm1
unpckhpd %xmm2, %xmm1            # xmm1 = xmm1[1],xmm2[1]
addsd %xmm2, %xmm1
divsd %xmm1, %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jb 0x18ca3b
sqrtsd %xmm0, %xmm0
jmp 0x18ca40
callq 0x1290f0
movapd 0x80(%rsp), %xmm1
unpcklpd %xmm0, %xmm1            # xmm1 = xmm1[0],xmm0[0]
cvtpd2ps %xmm1, %xmm0
movlpd %xmm0, 0x28(%r14)
testl %ebx, %ebx
jne 0x18ca9a
movq %r14, %rax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %ebx, %ebx
movq %r15, %r12
movq 0x28(%rsp), %r14
movl 0x8(%rsp), %ebp
movapd 0x10(%rsp), %xmm0
jmp 0x18c920
callq 0x12a2c9
jmp 0x18caae
movq %r14, %rdi
callq 0x12a294
jmp 0x18caae
movq %r14, %rdx
addq $0x8, %rdx
movl %ebx, %edi
movq %r15, %rsi
movq %r14, %rcx
callq 0x12a248
xorl %r14d, %r14d
jmp 0x18ca5b
leaq 0x40111f(%rip), %rdi    # 0x58dbd9
jmp 0x18cad5
leaq 0x401122(%rip), %rdi    # 0x58dbe5
jmp 0x18cad5
leaq 0x401128(%rip), %rdi    # 0x58dbf4
jmp 0x18cad5
leaq 0x40112a(%rip), %rdi    # 0x58dbff
callq 0x129110
movl $0x1, %ebx
movsd 0x40(%rsp), %xmm0
movaps %xmm0, 0x40(%rsp)
movsd 0x30(%rsp), %xmm0
movaps %xmm0, 0x30(%rsp)
movq 0x28(%rsp), %r14
movl 0x8(%rsp), %ebp
movaps 0x10(%rsp), %xmm0
movq 0x60(%rsp), %r15
jmp 0x18c920
leaq 0x4010f7(%rip), %rdi    # 0x58dc0b
callq 0x129110
movl $0x2, %ebx
movq %r12, %r15
movsd 0x40(%rsp), %xmm0
movaps %xmm0, 0x40(%rsp)
movsd 0x30(%rsp), %xmm0
movaps %xmm0, 0x30(%rsp)
jmp 0x18ca75