// File: /workspace/github_c_makefile_star2_O2/lh3[P]minigraph/bseq.c
// Function: mg_bseq_read
mg_bseq1_t *mg_bseq_read(mg_bseq_file_t *fp, int64_t chunk_size, int with_qual, int with_comment, int frag_mode, int *n_)
{
	int64_t size = 0;
	int ret;
	kvec_t(mg_bseq1_t) a = {0,0,0};
	kseq_t *ks = fp->ks;
	*n_ = 0;
	if (fp->s.seq) {
		kv_resize(mg_bseq1_t, 0, a, 256);
		kv_push(mg_bseq1_t, 0, a, fp->s);
		size = fp->s.l_seq;
		memset(&fp->s, 0, sizeof(mg_bseq1_t));
	}
	while ((ret = kseq_read(ks)) >= 0) {
		mg_bseq1_t *s;
		assert(ks->seq.l <= INT32_MAX);
		if (a.m == 0) kv_resize(mg_bseq1_t, 0, a, 256);
		kv_pushp(mg_bseq1_t, 0, a, &s);
		kseq2bseq(ks, s, with_qual, with_comment);
		size += s->l_seq;
		if (size >= chunk_size) {
			if (frag_mode && a.a[a.n-1].l_seq < CHECK_PAIR_THRES) {
				while (kseq_read(ks) >= 0) {
					kseq2bseq(ks, &fp->s, with_qual, with_comment);
					if (mg_qname_same(fp->s.name, a.a[a.n-1].name)) {
						kv_push(mg_bseq1_t, 0, a, fp->s);
						memset(&fp->s, 0, sizeof(mg_bseq1_t));
					} else break;
				}
			}
			break;
		}
	}
	if (ret < -1)
		fprintf(stderr, "[WARNING]\033[1;31m wrong FASTA/FASTQ record. Continue anyway.\033[0m\n");
	*n_ = a.n;
	return a.a;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movl %r8d, 0x3c(%rsp)
movl %ecx, 0x24(%rsp)
movl %edx, 0x20(%rsp)
movq 0x8(%rdi), %r13
andl $0x0, (%r9)
movq %rsi, 0x50(%rsp)
leaq 0x10(%rdi), %r14
movq %rdi, 0x48(%rsp)
cmpq $0x0, 0x20(%rdi)
movq %r14, 0x30(%rsp)
movq %r9, 0x28(%rsp)
je 0xce9f
movl $0x2800, %edx           # imm = 0x2800
xorl %edi, %edi
xorl %esi, %esi
callq 0x2774
movups (%r14), %xmm0
movups 0x10(%r14), %xmm1
movups %xmm1, 0x10(%rax)
movq 0x20(%r14), %rcx
movq %rcx, 0x20(%rax)
movq %rax, 0x8(%rsp)
movups %xmm0, (%rax)
movslq (%r14), %rbx
xorps %xmm0, %xmm0
andq $0x0, 0x20(%r14)
movups %xmm0, 0x10(%r14)
movups %xmm0, (%r14)
pushq $0x1
popq %rax
movl $0x100, %ecx            # imm = 0x100
movq %rcx, 0x18(%rsp)
jmp 0xceb5
movq $0x0, 0x18(%rsp)
movq $0x0, 0x8(%rsp)
xorl %eax, %eax
xorl %ebx, %ebx
imulq $0x28, %rax, %r14
leal (%rax,%rax), %ebp
movq %rax, (%rsp)
imulq $0x50, %rax, %r15
movq %r13, 0x40(%rsp)
movq %r13, %rdi
callq 0xd112
movl %eax, 0x14(%rsp)
testl %eax, %eax
js 0xd08c
cmpl $0x0, 0x20(%r13)
movq (%rsp), %rax
js 0xd0f5
movq 0x18(%rsp), %rcx
testq %rcx, %rcx
jne 0xcf15
movl $0x2800, %edx           # imm = 0x2800
xorl %edi, %edi
movq 0x8(%rsp), %rsi
callq 0x2774
movq %rax, 0x8(%rsp)
movq (%rsp), %rax
movl $0x100, %ecx            # imm = 0x100
cmpq %rcx, %rax
jne 0xcf37
xorl %edi, %edi
movq 0x8(%rsp), %rsi
movq %r15, %rdx
callq 0x2774
movq %rax, %r12
movq (%rsp), %rax
movq %rbp, 0x18(%rsp)
jmp 0xcf41
movq %rcx, 0x18(%rsp)
movq 0x8(%rsp), %r12
incq %rax
movq %rax, (%rsp)
leaq (%r12,%r14), %rsi
movq 0x40(%rsp), %r13
movq %r13, %rdi
movl 0x20(%rsp), %edx
movl 0x24(%rsp), %ecx
callq 0xd2d8
movq %r12, 0x8(%rsp)
movslq (%r12,%r14), %rax
addq %rax, %rbx
addq $0x28, %r14
addq $0x2, %rbp
addq $0x50, %r15
cmpq 0x50(%rsp), %rbx
jl 0xcec9
cmpl $0x0, 0x3c(%rsp)
je 0xd0d3
cmpl $0xf423f, %eax          # imm = 0xF423F
movq 0x8(%rsp), %r12
jg 0xd0cc
movq 0x30(%rsp), %r15
movq 0x40(%rsp), %rbx
movq %rbx, %rdi
callq 0xd112
testl %eax, %eax
js 0xd096
movq %rbx, %rdi
movq %r15, %rsi
movl 0x20(%rsp), %edx
movl 0x24(%rsp), %ecx
callq 0xd2d8
movq 0x48(%rsp), %rax
movq 0x18(%rax), %r15
movq %r12, %r13
movq -0x20(%r12,%r14), %rbp
movq %r15, %rdi
callq 0xd7f6
movl %eax, %ebx
movq %rbp, %rdi
callq 0xd7f6
cmpl %eax, %ebx
jne 0xd093
movslq %ebx, %rdx
movq %r15, %rdi
movq %rbp, %rsi
callq 0x2070
testl %eax, %eax
jne 0xd093
movq (%rsp), %rax
movq 0x18(%rsp), %rcx
cmpq %rcx, %rax
movq %r13, %r12
jne 0xd044
leaq (%rcx,%rcx), %rbx
testq %rcx, %rcx
pushq $0x2
popq %rax
cmoveq %rax, %rbx
imulq $0x28, %rbx, %rdx
xorl %edi, %edi
movq %r12, %rsi
callq 0x2774
movq %rax, %r12
movq (%rsp), %rax
movq %rbx, %rcx
movq 0x30(%rsp), %r15
movq %rcx, 0x18(%rsp)
incq %rax
movq %rax, (%rsp)
movq 0x20(%r15), %rax
movq %rax, 0x20(%r12,%r14)
movups (%r15), %xmm0
movups 0x10(%r15), %xmm1
movups %xmm1, 0x10(%r12,%r14)
movups %xmm0, (%r12,%r14)
xorps %xmm0, %xmm0
movups %xmm0, (%r15)
movups %xmm0, 0x10(%r15)
andq $0x0, 0x20(%r15)
addq $0x28, %r14
jmp 0xcfa4
movq 0x8(%rsp), %r12
jmp 0xd096
movq %r13, %r12
movq (%rsp), %rax
movl 0x14(%rsp), %ecx
cmpl $-0x2, %ecx
movq 0x28(%rsp), %rbx
jg 0xd0e1
movq %rax, %r14
movq 0x20f46(%rip), %rax     # 0x2dff8
movq (%rax), %rcx
leaq 0x16967(%rip), %rdi     # 0x23a23
pushq $0x40
popq %rsi
pushq $0x1
popq %rdx
callq 0x2340
movq %r14, %rax
jmp 0xd0e1
movq 0x28(%rsp), %rbx
jmp 0xd0dd
movq 0x28(%rsp), %rbx
movq 0x8(%rsp), %r12
movq (%rsp), %rax
movl %eax, (%rbx)
movq %r12, %rax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x168bf(%rip), %rdi     # 0x239bb
leaq 0x168cf(%rip), %rsi     # 0x239d2
leaq 0x168cf(%rip), %rcx     # 0x239d9
pushq $0x4c
popq %rdx
callq 0x2160