// File: /workspace/github_c_makefile_star2_O1/lh3[P]miniprot/bseq.c
// Function: mp_bseq_read
mp_bseq1_t *mp_bseq_read(mp_bseq_file_t *fp, int64_t chunk_size, int with_comment, int *n_)
{
	int64_t size = 0;
	int ret;
	kvec_t(mp_bseq1_t) a = {0,0,0};
	kseq_t *ks = fp->ks;
	*n_ = 0;
	if (fp->s.seq) {
		kv_resize(mp_bseq1_t, 0, a, 256);
		kv_push(mp_bseq1_t, 0, a, fp->s);
		size = fp->s.l_seq;
		memset(&fp->s, 0, sizeof(mp_bseq1_t));
	}
	while ((ret = kseq_read(ks)) >= 0) {
		mp_bseq1_t *s;
		assert(ks->seq.l <= INT32_MAX);
		if (a.m == 0) kv_resize(mp_bseq1_t, 0, a, 256);
		kv_pushp(mp_bseq1_t, 0, a, &s);
		kseq2bseq(ks, s, with_comment);
		size += s->l_seq;
		if (size >= chunk_size)
			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 $0x38, %rsp
movl %edx, 0x8(%rsp)
movq %rsi, 0x20(%rsp)
movq 0x8(%rdi), %r12
movq %rcx, 0x18(%rsp)
movl $0x0, (%rcx)
cmpq $0x0, 0x20(%rdi)
je 0xd8f7
movq %rdi, %r14
movl $0x2000, %edx           # imm = 0x2000
xorl %edi, %edi
xorl %esi, %esi
callq 0x81a4
movups 0x10(%r14), %xmm0
movups 0x20(%r14), %xmm1
movups %xmm1, 0x10(%rax)
movq %rax, (%rsp)
movups %xmm0, (%rax)
movslq 0x10(%r14), %r15
xorps %xmm0, %xmm0
movups %xmm0, 0x20(%r14)
movups %xmm0, 0x10(%r14)
movl $0x1, %ebx
movl $0x100, %r13d           # imm = 0x100
jmp 0xd907
xorl %r13d, %r13d
movq $0x0, (%rsp)
xorl %ebx, %ebx
xorl %r15d, %r15d
movl %ebx, %r14d
shll $0x5, %r14d
orq $0x18, %r14
movq %r12, %rdi
callq 0xbcef
movl %eax, 0xc(%rsp)
testl %eax, %eax
js 0xda66
movq 0x30(%r12), %rax
shrq $0x1f, %rax
jne 0xdabd
testq %r13, %r13
jne 0xd954
movl $0x2000, %edx           # imm = 0x2000
xorl %edi, %edi
movq (%rsp), %rsi
callq 0x81a4
movq %rax, (%rsp)
movl $0x100, %r13d           # imm = 0x100
cmpq %r13, %rbx
movq %r15, 0x30(%rsp)
jne 0xd97f
leaq (,%r13,2), %r15
shlq $0x6, %r13
xorl %edi, %edi
movq (%rsp), %rsi
movq %r13, %rdx
callq 0x81a4
movq %rax, (%rsp)
movq %r15, %r13
movq %r13, 0x28(%rsp)
movq %rbx, 0x10(%rsp)
cmpq $0x0, (%r12)
je 0xda5c
movq (%r12), %r15
incq %r15
movq %r15, %rdi
callq 0x2220
movq %rax, %rbp
movq 0x10(%r12), %rsi
movq %rax, %rdi
movq %r15, %rdx
callq 0x21e0
movq (%rsp), %rbx
movq %rbp, -0x10(%rbx,%r14)
movq 0x30(%r12), %r13
leaq 0x1(%r13), %r15
movq %r15, %rdi
callq 0x2220
movq %rax, %rbp
movq 0x40(%r12), %rsi
movq %rax, %rdi
movq %r15, %rdx
callq 0x21e0
movq %rbp, -0x8(%rbx,%r14)
cmpl $0x0, 0x8(%rsp)
je 0xda1e
movq 0x18(%r12), %rbp
testq %rbp, %rbp
movq 0x10(%rsp), %rbx
je 0xda28
incq %rbp
movq %rbp, %rdi
callq 0x2220
movq %rax, %r15
movq 0x28(%r12), %rsi
movq %rax, %rdi
movq %rbp, %rdx
callq 0x21e0
jmp 0xda2b
xorl %r15d, %r15d
movq 0x10(%rsp), %rbx
jmp 0xda2b
xorl %r15d, %r15d
movq (%rsp), %rax
movq %r15, (%rax,%r14)
movl %r13d, -0x18(%rax,%r14)
movslq %r13d, %rax
movq 0x30(%rsp), %r15
addq %rax, %r15
addq $0x20, %r14
incq %rbx
cmpq 0x20(%rsp), %r15
movq 0x28(%rsp), %r13
jl 0xd912
jmp 0xda66
callq 0x2d02
jmp 0xd994
cmpl $-0x2, 0xc(%rsp)
jle 0xda87
movq 0x18(%rsp), %rax
movl %ebx, (%rax)
movq (%rsp), %rax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0xa562(%rip), %rax      # 0x17ff0
movq (%rax), %rdi
testq %rbx, %rbx
jne 0xda9d
callq 0x2d1e
jmp 0xda6d
movq %rbx, %rax
shlq $0x5, %rax
movq (%rsp), %rcx
movq -0x18(%rax,%rcx), %rdx
leaq 0x6501(%rip), %rsi      # 0x13fb5
xorl %eax, %eax
callq 0x21d0
jmp 0xda6d
leaq 0x6493(%rip), %rdi      # 0x13f57
leaq 0x64a3(%rip), %rsi      # 0x13f6e
leaq 0x64a3(%rip), %rcx      # 0x13f75
movl $0x44, %edx
callq 0x2150