// File: /workspace/github_c_makefile_star2_O2/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
movq %rdi, %r12
movq 0x8(%rdi), %rdi
movq %rcx, 0x20(%rsp)
andl $0x0, (%rcx)
movl %edx, 0x1c(%rsp)
movq %rsi, 0x30(%rsp)
cmpq $0x0, 0x20(%r12)
movq %rdi, (%rsp)
je 0xc22d
movl $0x2000, %edx           # imm = 0x2000
xorl %edi, %edi
xorl %esi, %esi
callq 0x7568
movq (%rsp), %rdi
movq %rax, %r14
movups 0x10(%r12), %xmm0
movups 0x20(%r12), %xmm1
movups %xmm1, 0x10(%rax)
movups %xmm0, (%rax)
movslq 0x10(%r12), %rbx
xorps %xmm0, %xmm0
movups %xmm0, 0x20(%r12)
movups %xmm0, 0x10(%r12)
pushq $0x1
popq %r15
movl $0x100, %eax            # imm = 0x100
movq %rax, 0x8(%rsp)
jmp 0xc23e
movq $0x0, 0x8(%rsp)
xorl %r14d, %r14d
xorl %r15d, %r15d
xorl %ebx, %ebx
leaq 0x30(%rdi), %rax
movq %rax, 0x10(%rsp)
leaq 0x18(%rdi), %rax
movq %rax, 0x28(%rsp)
movl %r15d, %r12d
shll $0x5, %r12d
leal (%r15,%r15), %r13d
movl %r15d, %ebp
shll $0x6, %ebp
callq 0xa880
testl %eax, %eax
js 0xc35b
movq 0x10(%rsp), %rax
movq (%rax), %rax
shrq $0x1f, %rax
jne 0xc3b8
movq 0x8(%rsp), %rax
testq %rax, %rax
jne 0xc2a1
movl $0x2000, %edx           # imm = 0x2000
xorl %edi, %edi
movq %r14, %rsi
callq 0x7568
movq %rax, %r14
movl $0x100, %eax            # imm = 0x100
cmpq %rax, %r15
jne 0xc2bd
xorl %edi, %edi
movq %r14, %rsi
movq %rbp, %rdx
callq 0x7568
movq %rax, %r14
movq %r13, 0x8(%rsp)
jmp 0xc2c2
movq %rax, 0x8(%rsp)
movq (%rsp), %rdi
cmpq $0x0, (%rdi)
je 0xc336
callq 0xc3d5
movq %rax, 0x8(%r14,%r12)
movq 0x10(%rsp), %rdi
callq 0xc3d5
movq %rax, 0x10(%r14,%r12)
cmpl $0x0, 0x1c(%rsp)
je 0xc2fe
movq 0x28(%rsp), %rdi
cmpq $0x0, (%rdi)
je 0xc2fe
callq 0xc3d5
jmp 0xc300
xorl %eax, %eax
movq (%rsp), %rdi
movq %rax, 0x18(%r14,%r12)
movq 0x10(%rsp), %rax
movq (%rax), %rax
movl %eax, (%r14,%r12)
cltq
addq %rax, %rbx
addq $0x20, %r12
addq $0x2, %r13
addq $0x40, %rbp
incq %r15
cmpq 0x30(%rsp), %rbx
jl 0xc261
jmp 0xc360
movq 0xbcb3(%rip), %rax      # 0x17ff0
movq (%rax), %rcx
leaq 0x6d6f(%rip), %rdi      # 0x130b6
pushq $0x37
popq %rsi
pushq $0x1
popq %rdx
callq 0x2300
movq (%rsp), %rdi
jmp 0xc2cc
cmpl $-0x1, %eax
jne 0xc37a
movq 0x20(%rsp), %rax
movl %r15d, (%rax)
movq %r14, %rax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0xbc6f(%rip), %rax      # 0x17ff0
movq (%rax), %rcx
testq %r15, %r15
jne 0xc3a0
leaq 0x6cd1(%rip), %rdi      # 0x13061
pushq $0x54
popq %rsi
pushq $0x1
popq %rdx
callq 0x2300
xorl %r15d, %r15d
jmp 0xc360
movq -0x18(%r14,%r12), %rdx
leaq 0x6c59(%rip), %rsi      # 0x13005
movq %rcx, %rdi
xorl %eax, %eax
callq 0x21e0
jmp 0xc360
leaq 0x6be8(%rip), %rdi      # 0x12fa7
leaq 0x6bf8(%rip), %rsi      # 0x12fbe
leaq 0x6bf8(%rip), %rcx      # 0x12fc5
pushq $0x44
popq %rdx
callq 0x2150