// File: /workspace/github_c_makefile_star2_O1/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 $0x58, %rsp
movl %r8d, 0x2c(%rsp)
movl %ecx, 0xc(%rsp)
movl %edx, 0x8(%rsp)
movq %rsi, 0x30(%rsp)
movq 0x8(%rdi), %r13
movl $0x0, (%r9)
leaq 0x10(%rdi), %r15
movq %rdi, 0x50(%rsp)
cmpq $0x0, 0x20(%rdi)
movq %r9, 0x40(%rsp)
je 0x131af
movl $0x2800, %edx           # imm = 0x2800
xorl %edi, %edi
xorl %esi, %esi
callq 0x127ec
movq %rax, %r12
movups (%r15), %xmm0
movups 0x10(%r15), %xmm1
movups %xmm1, 0x10(%rax)
movq 0x20(%r15), %rax
movq %rax, 0x20(%r12)
movups %xmm0, (%r12)
movslq (%r15), %rax
movq %rax, 0x10(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%r15)
movups %xmm0, (%r15)
movq $0x0, 0x20(%r15)
movl $0x100, %eax            # imm = 0x100
movq %rax, (%rsp)
movl $0x1, %r14d
jmp 0x131c6
xorl %r14d, %r14d
movq $0x0, (%rsp)
xorl %r12d, %r12d
movq $0x0, 0x10(%rsp)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $-0x7fffffff, %rax      # imm = 0x80000001
movq %rax, 0x48(%rsp)
movq %r13, 0x18(%rsp)
movq %r15, 0x38(%rsp)
movq %r13, %rdi
callq 0x12d45
movl %eax, %ebx
testl %eax, %eax
js 0x1340c
movq 0x48(%rsp), %rax
cmpq %rax, 0x30(%r13)
jae 0x13463
movq (%rsp), %rax
testq %rax, %rax
jne 0x13221
movl $0x2800, %edx           # imm = 0x2800
xorl %edi, %edi
movq %r12, %rsi
callq 0x127ec
movq %rax, %r12
movl $0x100, %eax            # imm = 0x100
cmpq %rax, %r14
jne 0x13245
leaq (%rax,%rax), %r15
shlq $0x4, %rax
leaq (%rax,%rax,4), %rdx
xorl %edi, %edi
movq %r12, %rsi
callq 0x127ec
movq %rax, %r12
movq %r15, (%rsp)
jmp 0x13249
movq %rax, (%rsp)
leaq 0x1(%r14), %rbp
leaq (%r14,%r14,4), %rax
leaq (%r12,%rax,8), %r15
movq %r13, %rdi
movq %r15, %rsi
movl 0x8(%rsp), %edx
movl 0xc(%rsp), %ecx
callq 0x13482
movslq (%r15), %rax
movq 0x10(%rsp), %rdx
addq %rax, %rdx
movq %rdx, 0x10(%rsp)
cmpq 0x30(%rsp), %rdx
jl 0x133f7
cmpl $0x0, 0x2c(%rsp)
movq 0x38(%rsp), %r15
je 0x133f7
cmpl $0xf423f, %eax          # imm = 0xF423F
jg 0x133f7
movq %r13, %rdi
callq 0x12d45
movl %eax, %ebx
testl %eax, %eax
js 0x133f7
shlq $0x3, %r14
leaq (%r14,%r14,4), %r14
movq %r13, %rdi
movq %r15, %rsi
movl 0x8(%rsp), %edx
movl 0xc(%rsp), %ecx
callq 0x13482
movq 0x50(%rsp), %rax
movq 0x18(%rax), %r15
movq %r12, 0x20(%rsp)
movq 0x8(%r12,%r14), %r12
movq %r15, %rdi
callq 0x2130
cmpl $0x3, %eax
jl 0x1330b
movl %eax, %ecx
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
addl %edx, %ecx
movb (%r15,%rcx), %cl
addb $-0x30, %cl
cmpb $0x9, %cl
ja 0x1330b
leal -0x2(%rax), %r13d
cmpb $0x2f, (%r15,%r13)
je 0x1330e
movl %eax, %r13d
movq %r12, %rdi
callq 0x2130
cmpl $0x3, %eax
jl 0x1333a
movl %eax, %ecx
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
addl %edx, %ecx
movb (%r12,%rcx), %cl
addb $-0x30, %cl
cmpb $0x9, %cl
ja 0x1333a
leal -0x2(%rax), %ecx
cmpb $0x2f, (%r12,%rcx)
je 0x1333c
movl %eax, %ecx
cmpl %ecx, %r13d
jne 0x133ed
movslq %r13d, %rdx
movq %r15, %rdi
movq %r12, %rsi
callq 0x2080
testl %eax, %eax
jne 0x133ed
movq (%rsp), %rax
cmpq %rax, %rbp
movq 0x20(%rsp), %r12
movq 0x18(%rsp), %r13
movq 0x38(%rsp), %r15
jne 0x133a0
leaq (%rax,%rax), %rbx
testq %rax, %rax
movl $0x2, %eax
cmoveq %rax, %rbx
leaq (,%rbx,8), %rax
leaq (%rax,%rax,4), %rdx
xorl %edi, %edi
movq %r12, %rsi
callq 0x127ec
movq %rax, %r12
movq %rbx, (%rsp)
incq %rbp
movq 0x20(%r15), %rax
movq %rax, 0x48(%r14,%r12)
movups (%r15), %xmm0
movups 0x10(%r15), %xmm1
movups %xmm1, 0x38(%r14,%r12)
movups %xmm0, 0x28(%r14,%r12)
xorps %xmm0, %xmm0
movups %xmm0, (%r15)
movups %xmm0, 0x10(%r15)
movq $0x0, 0x20(%r15)
movq %r13, %rdi
callq 0x12d45
movl %eax, %ebx
addq $0x28, %r14
testl %eax, %eax
jns 0x132b8
jmp 0x133f7
movq 0x20(%rsp), %r12
movq 0x18(%rsp), %r13
movq %rbp, %r14
movq 0x10(%rsp), %rax
cmpq 0x30(%rsp), %rax
jl 0x131e0
jmp 0x1340f
movq %r14, %rbp
cmpl $-0x2, %ebx
movq 0x40(%rsp), %rbx
jle 0x1342d
movl %ebp, (%rbx)
movq %r12, %rax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x21bc4(%rip), %rax     # 0x34ff8
movq (%rax), %rdi
testq %rbp, %rbp
jne 0x13443
callq 0x321d
jmp 0x13419
leaq (,%rbp,4), %rax
addq %rbp, %rax
movq -0x20(%r12,%rax,8), %rdx
leaq 0x19d80(%rip), %rsi     # 0x2d1da
xorl %eax, %eax
callq 0x2260
jmp 0x13419
leaq 0x19d07(%rip), %rdi     # 0x2d171
leaq 0x19d17(%rip), %rsi     # 0x2d188
leaq 0x19d17(%rip), %rcx     # 0x2d18f
movl $0x5f, %edx
callq 0x21a0