// File: /workspace/github_c_makefile_star2_O2/lh3[P]minimap2/bseq.c
// Function: mm_bseq_read3
mm_bseq1_t *mm_bseq_read3(mm_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(mm_bseq1_t) a = {0,0,0};
	kseq_t *ks = fp->ks;
	*n_ = 0;
	if (fp->s.seq) {
		kv_resize(mm_bseq1_t, 0, a, 256);
		kv_push(mm_bseq1_t, 0, a, fp->s);
		size = fp->s.l_seq;
		memset(&fp->s, 0, sizeof(mm_bseq1_t));
	}
	while ((ret = kseq_read(ks)) >= 0) {
		mm_bseq1_t *s;
		assert(ks->seq.l <= INT32_MAX);
		if (a.m == 0) kv_resize(mm_bseq1_t, 0, a, 256);
		kv_pushp(mm_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 ((ret = kseq_read(ks)) >= 0) {
					kseq2bseq(ks, &fp->s, with_qual, with_comment);
					if (mm_qname_same(fp->s.name, a.a[a.n-1].name)) {
						kv_push(mm_bseq1_t, 0, a, fp->s);
						memset(&fp->s, 0, sizeof(mm_bseq1_t));
					} else break;
				}
			}
			break;
		}
	}
	if (ret < -1) {
		if (a.n) fprintf(stderr, "[WARNING]\033[1;31m failed to parse the FASTA/FASTQ record next to '%s'. Continue anyway.\033[0m\n", a.a[a.n-1].name);
		else fprintf(stderr, "[WARNING]\033[1;31m failed to parse the first 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 $0x48, %rsp
movl %r8d, 0x34(%rsp)
movl %ecx, 0x24(%rsp)
movl %edx, 0x20(%rsp)
movq 0x8(%rdi), %r12
movq %r9, 0x10(%rsp)
andl $0x0, (%r9)
movq %rsi, 0x40(%rsp)
leaq 0x10(%rdi), %rbx
movq %rdi, 0x38(%rsp)
cmpq $0x0, 0x20(%rdi)
movq %rbx, 0x28(%rsp)
je 0x114c5
movl $0x2800, %edx           # imm = 0x2800
xorl %edi, %edi
xorl %esi, %esi
callq 0x10c04
movups (%rbx), %xmm0
movups 0x10(%rbx), %xmm1
movups %xmm1, 0x10(%rax)
movq 0x20(%rbx), %rcx
movq %rcx, 0x20(%rax)
movq %rax, 0x8(%rsp)
movups %xmm0, (%rax)
movslq (%rbx), %r15
xorps %xmm0, %xmm0
andq $0x0, 0x20(%rbx)
movups %xmm0, 0x10(%rbx)
movups %xmm0, (%rbx)
movl $0x100, %eax            # imm = 0x100
movq %rax, 0x18(%rsp)
pushq $0x1
popq %rax
jmp 0x114dc
xorl %eax, %eax
movq $0x0, 0x18(%rsp)
movq $0x0, 0x8(%rsp)
xorl %r15d, %r15d
leal (%rax,%rax), %r13d
imulq $0x28, %rax, %r14
movq %rax, (%rsp)
imulq $0x50, %rax, %rbp
movq %r12, %rdi
callq 0x11156
testl %eax, %eax
js 0x1169b
movq 0x30(%r12), %rax
shrq $0x1f, %rax
movq (%rsp), %rbx
jne 0x11710
movq 0x18(%rsp), %rcx
testq %rcx, %rcx
movq 0x8(%rsp), %rax
jne 0x11532
movl $0x2800, %edx           # imm = 0x2800
xorl %edi, %edi
movq %rax, %rsi
callq 0x10c04
movl $0x100, %ecx            # imm = 0x100
cmpq %rcx, %rbx
jne 0x1154b
xorl %edi, %edi
movq %rax, %rsi
movq %rbp, %rdx
callq 0x10c04
movq %r13, 0x18(%rsp)
jmp 0x11550
movq %rcx, 0x18(%rsp)
incq %rbx
movq %rbx, (%rsp)
leaq (%rax,%r14), %rsi
movq %r12, %rdi
movl 0x20(%rsp), %edx
movl 0x24(%rsp), %ecx
movq %r12, %rbx
movq %rax, %r12
callq 0x1172d
movq %r12, 0x8(%rsp)
movslq (%r12,%r14), %rax
movq %rbx, %r12
addq %rax, %r15
addq $0x28, %r14
addq $0x2, %r13
addq $0x50, %rbp
cmpq 0x40(%rsp), %r15
jl 0x114ec
cmpl $0x0, 0x34(%rsp)
je 0x116ab
cmpl $0xf423f, %eax          # imm = 0xF423F
jg 0x116ab
movq 0x28(%rsp), %rbp
movq %r12, %rdi
callq 0x11156
testl %eax, %eax
js 0x1169b
movq %r12, %rdi
movq %rbp, %rsi
movl 0x20(%rsp), %edx
movl 0x24(%rsp), %ecx
callq 0x1172d
movq 0x38(%rsp), %rax
movq 0x18(%rax), %r12
movq 0x8(%rsp), %rax
movq -0x20(%rax,%r14), %rbp
movq %r12, %rdi
callq 0x119c9
movl %eax, %r15d
movq %rbp, %rdi
callq 0x119c9
cmpl %eax, %r15d
jne 0x116ab
movslq %r15d, %rdx
movq %r12, %rdi
movq %rbp, %rsi
callq 0x2080
testl %eax, %eax
jne 0x116ab
movq (%rsp), %r15
cmpq 0x18(%rsp), %r15
jne 0x11649
testq %r15, %r15
movq %r13, %rax
pushq $0x2
popq %rcx
cmoveq %rcx, %rax
movq %rax, 0x18(%rsp)
imulq $0x28, %rax, %rdx
xorl %edi, %edi
movq 0x8(%rsp), %rsi
callq 0x10c04
jmp 0x1164e
movq 0x8(%rsp), %rax
movq %rbx, %r12
movq 0x28(%rsp), %rbp
incq %r15
movq %r15, (%rsp)
movq 0x20(%rbp), %rcx
movq %rcx, 0x20(%rax,%r14)
movups (%rbp), %xmm0
movups 0x10(%rbp), %xmm1
movups %xmm1, 0x10(%rax,%r14)
movq %rax, 0x8(%rsp)
movups %xmm0, (%rax,%r14)
andq $0x0, 0x20(%rbp)
xorps %xmm0, %xmm0
movups %xmm0, (%rbp)
movups %xmm0, 0x10(%rbp)
addq $0x2, %r13
addq $0x28, %r14
jmp 0x115b2
movq (%rsp), %rbx
cmpl $-0x1, %eax
jne 0x116ca
movq 0x10(%rsp), %rax
jmp 0x116b4
movq 0x10(%rsp), %rax
movq (%rsp), %rbx
movl %ebx, (%rax)
movq 0x8(%rsp), %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x20927(%rip), %rax     # 0x31ff8
movq (%rax), %rcx
testq %rbx, %rbx
jne 0x116ef
leaq 0x17b72(%rip), %rdi     # 0x29252
pushq $0x54
popq %rsi
pushq $0x1
popq %rdx
callq 0x23f0
xorl %ebx, %ebx
jmp 0x116a4
imulq $0x28, %rbx, %rax
movq 0x8(%rsp), %rdx
movq -0x20(%rax,%rdx), %rdx
leaq 0x17af2(%rip), %rsi     # 0x291f6
movq %rcx, %rdi
xorl %eax, %eax
callq 0x2260
jmp 0x116a4
leaq 0x17a76(%rip), %rdi     # 0x2918d
leaq 0x17a86(%rip), %rsi     # 0x291a4
leaq 0x17a86(%rip), %rcx     # 0x291ab
pushq $0x5f
popq %rdx
callq 0x21a0