// File: /workspace/github_c_makefile_star2_O0/nh13[P]ksw/src/parasail/src/io.c
// Function: parasail_pack_fastq_buffer
char * parasail_pack_fastq_buffer(const char *T, off_t size, long * packed_size)
{
    char *P = NULL;
    int first = 1;
    off_t i = 0;
    off_t w = 0;
    unsigned long line = 0;
    parasail_file_stat_t *pfs = NULL;

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

    if (NULL == packed_size) {
        fprintf(stderr, "parasail_pack_fastq_buffer: NULL size pointer\n");
        return NULL;
    }

    pfs = parasail_stat_fastq_buffer(T, size);
    if (NULL == pfs) {
        fprintf(stderr, "parasail_stat_fastq_buffer: fastq stat failed\n");
        return NULL;
    }

    P = (char*)malloc(sizeof(char) * (pfs->characters+pfs->sequences+1));
    if (NULL == P) {
        perror("malloc");
        fprintf(stderr, "parasail_pack_fastq_buffer: malloc failed\n");
        free(pfs);
        return NULL;
    }
    free(pfs);

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

        /* encountered a new sequence */
        if (first) {
            first = 0;
        }
        else {
            P[w++] = '$';
        }

        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') {
            P[w++] = T[i];
            ++i;
        }

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

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

        if (T[i] != '+') {
            fprintf(stderr, "parasail_pack_fastq_buffer: "
                    "poorly formatted FASTQ file, line %lu\n", line);
            free(P);
            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;
    }

    P[w++] = '$';
    P[w] = '\0';
    *packed_size = w;
    return P;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq $0x0, -0x28(%rbp)
movl $0x1, -0x2c(%rbp)
movq $0x0, -0x38(%rbp)
movq $0x0, -0x40(%rbp)
movq $0x0, -0x48(%rbp)
movq $0x0, -0x50(%rbp)
xorl %eax, %eax
cmpq -0x10(%rbp), %rax
jne 0x1f5aa0
movq 0xc2c556(%rip), %rax    # 0xe21fd8
movq (%rax), %rdi
leaq 0xb0c870(%rip), %rsi    # 0xd022fc
movb $0x0, %al
callq 0x1f01f0
movq $0x0, -0x8(%rbp)
jmp 0x1f5d9f
xorl %eax, %eax
cmpq -0x20(%rbp), %rax
jne 0x1f5acd
movq 0xc2c529(%rip), %rax    # 0xe21fd8
movq (%rax), %rdi
leaq 0xb0c86d(%rip), %rsi    # 0xd02326
movb $0x0, %al
callq 0x1f01f0
movq $0x0, -0x8(%rbp)
jmp 0x1f5d9f
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x1f4bf0
movq %rax, -0x50(%rbp)
xorl %eax, %eax
cmpq -0x50(%rbp), %rax
jne 0x1f5b0b
movq 0xc2c4eb(%rip), %rax    # 0xe21fd8
movq (%rax), %rdi
leaq 0xb0c85e(%rip), %rsi    # 0xd02355
movb $0x0, %al
callq 0x1f01f0
movq $0x0, -0x8(%rbp)
jmp 0x1f5d9f
movq -0x50(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x50(%rbp), %rax
addq (%rax), %rdi
addq $0x1, %rdi
shlq $0x0, %rdi
callq 0x1f01c0
movq %rax, -0x28(%rbp)
xorl %eax, %eax
cmpq -0x28(%rbp), %rax
jne 0x1f5b6d
leaq 0xb0c035(%rip), %rdi    # 0xd01b6f
callq 0x1f0120
movq 0xc2c492(%rip), %rax    # 0xe21fd8
movq (%rax), %rdi
leaq 0xb0c834(%rip), %rsi    # 0xd02384
movb $0x0, %al
callq 0x1f01f0
movq -0x50(%rbp), %rdi
callq 0x1f01a0
movq $0x0, -0x8(%rbp)
jmp 0x1f5d9f
movq -0x50(%rbp), %rdi
callq 0x1f01a0
movq -0x38(%rbp), %rax
cmpq -0x18(%rbp), %rax
jge 0x1f5d69
movq -0x10(%rbp), %rax
movq -0x38(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x40, %eax
je 0x1f5bc7
movq 0xc2c43c(%rip), %rax    # 0xe21fd8
movq (%rax), %rdi
movq -0x48(%rbp), %rdx
leaq 0xb0c805(%rip), %rsi    # 0xd023af
movb $0x0, %al
callq 0x1f01f0
movq -0x28(%rbp), %rdi
callq 0x1f01a0
movq $0x0, -0x8(%rbp)
jmp 0x1f5d9f
cmpl $0x0, -0x2c(%rbp)
je 0x1f5bd6
movl $0x0, -0x2c(%rbp)
jmp 0x1f5bed
movq -0x28(%rbp), %rax
movq -0x40(%rbp), %rcx
movq %rcx, %rdx
addq $0x1, %rdx
movq %rdx, -0x40(%rbp)
movb $0x24, (%rax,%rcx)
movq -0x10(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x1f5000
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
movq -0x48(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x48(%rbp)
movq -0x10(%rbp), %rax
movq -0x38(%rbp), %rcx
movsbl (%rax,%rcx), %ecx
xorl %eax, %eax
cmpl $0xa, %ecx
movb %al, -0x51(%rbp)
je 0x1f5c41
movq -0x10(%rbp), %rax
movq -0x38(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0xd, %eax
setne %al
movb %al, -0x51(%rbp)
movb -0x51(%rbp), %al
testb $0x1, %al
jne 0x1f5c4a
jmp 0x1f5c79
movq -0x10(%rbp), %rax
movq -0x38(%rbp), %rcx
movb (%rax,%rcx), %dl
movq -0x28(%rbp), %rax
movq -0x40(%rbp), %rcx
movq %rcx, %rsi
addq $0x1, %rsi
movq %rsi, -0x40(%rbp)
movb %dl, (%rax,%rcx)
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
jmp 0x1f5c16
movq -0x38(%rbp), %rax
addq $0x1, %rax
cmpq -0x18(%rbp), %rax
jge 0x1f5cb7
movq -0x10(%rbp), %rax
movq -0x38(%rbp), %rcx
movsbl 0x1(%rax,%rcx), %eax
cmpl $0xa, %eax
je 0x1f5cab
movq -0x10(%rbp), %rax
movq -0x38(%rbp), %rcx
movsbl 0x1(%rax,%rcx), %eax
cmpl $0xd, %eax
jne 0x1f5cb7
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
movq -0x48(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x48(%rbp)
movq -0x10(%rbp), %rax
movq -0x38(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x2b, %eax
je 0x1f5d12
movq 0xc2c2f1(%rip), %rax    # 0xe21fd8
movq (%rax), %rdi
movq -0x48(%rbp), %rdx
leaq 0xb0c6ba(%rip), %rsi    # 0xd023af
movb $0x0, %al
callq 0x1f01f0
movq -0x28(%rbp), %rdi
callq 0x1f01a0
movq $0x0, -0x8(%rbp)
jmp 0x1f5d9f
movq -0x10(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x1f5000
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
movq -0x48(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x48(%rbp)
movq -0x10(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x1f5000
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
movq -0x48(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x48(%rbp)
jmp 0x1f5b76
movq -0x28(%rbp), %rax
movq -0x40(%rbp), %rcx
movq %rcx, %rdx
addq $0x1, %rdx
movq %rdx, -0x40(%rbp)
movb $0x24, (%rax,%rcx)
movq -0x28(%rbp), %rax
movq -0x40(%rbp), %rcx
movb $0x0, (%rax,%rcx)
movq -0x40(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
movq -0x28(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x60, %rsp
popq %rbp
retq
nopl (%rax)