// File: /workspace/github_c_makefile_star2_O1/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 $0x48, %rsp
movl %r8d, 0x28(%rsp)
movl %ecx, 0x1c(%rsp)
movl %edx, 0x18(%rsp)
movq %rsi, %r12
movq 0x8(%rdi), %r14
movl $0x0, (%r9)
leaq 0x10(%rdi), %rbp
movq %rdi, 0x40(%rsp)
cmpq $0x0, 0x20(%rdi)
movq %r9, 0x30(%rsp)
je 0xf23e
movl $0x2800, %edx           # imm = 0x2800
xorl %edi, %edi
xorl %esi, %esi
callq 0x32c4
movups (%rbp), %xmm0
movups 0x10(%rbp), %xmm1
movups %xmm1, 0x10(%rax)
movq 0x20(%rbp), %rcx
movq %rcx, 0x20(%rax)
movq %rax, %r13
movups %xmm0, (%rax)
movslq (%rbp), %rax
movq %rax, 0x20(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rbp)
movups %xmm0, (%rbp)
movq $0x0, 0x20(%rbp)
movl $0x1, %r15d
movl $0x100, %eax            # imm = 0x100
movq %rax, 0x10(%rsp)
jmp 0xf256
movq $0x0, 0x10(%rsp)
xorl %r13d, %r13d
xorl %r15d, %r15d
movq $0x0, 0x20(%rsp)
movq %r12, 0x38(%rsp)
movq %r14, 0x8(%rsp)
movq %r14, %rdi
callq 0xf4dc
testl %eax, %eax
movl %eax, 0x2c(%rsp)
js 0xf493
cmpl $0x0, 0x20(%r14)
js 0xf4bd
movq 0x10(%rsp), %rax
testq %rax, %rax
jne 0xf2a0
movl $0x2800, %edx           # imm = 0x2800
xorl %edi, %edi
movq %r13, %rsi
callq 0x32c4
movq %rax, %r13
movl $0x100, %eax            # imm = 0x100
cmpq %rax, %r15
jne 0xf2c5
leaq (%rax,%rax), %rbx
shlq $0x4, %rax
leaq (%rax,%rax,4), %rdx
xorl %edi, %edi
movq %r13, %rsi
callq 0x32c4
movq %rax, %r13
movq %rbx, 0x10(%rsp)
jmp 0xf2ca
movq %rax, 0x10(%rsp)
leaq 0x1(%r15), %rbx
leaq (%r15,%r15,4), %rax
movq %r13, (%rsp)
leaq (,%rax,8), %r14
addq %r13, %r14
movq 0x8(%rsp), %rdi
movq %r14, %rsi
movl 0x18(%rsp), %edx
movl 0x1c(%rsp), %ecx
callq 0xf7fa
movslq (%r14), %rax
movq 0x20(%rsp), %rdx
addq %rax, %rdx
movq %rdx, 0x20(%rsp)
cmpq %r12, %rdx
jl 0xf472
cmpl $0x0, 0x28(%rsp)
je 0xf472
cmpl $0xf423f, %eax          # imm = 0xF423F
movq 0x8(%rsp), %r14
jg 0xf477
movq %r14, %rdi
callq 0xf4dc
testl %eax, %eax
js 0xf477
shlq $0x3, %r15
leaq (%r15,%r15,4), %r13
movq (%rsp), %r15
movq %r14, %rdi
movq %rbp, %rsi
movl 0x18(%rsp), %edx
movl 0x1c(%rsp), %ecx
callq 0xf7fa
movq 0x40(%rsp), %rax
movq 0x18(%rax), %r14
movq %r15, (%rsp)
movq 0x8(%r15,%r13), %r15
movq %r14, %rdi
callq 0x2110
cmpl $0x3, %eax
jl 0xf398
movl %eax, %ecx
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
addl %edx, %ecx
movb (%r14,%rcx), %cl
addb $-0x30, %cl
cmpb $0x9, %cl
ja 0xf398
leal -0x2(%rax), %r12d
cmpb $0x2f, (%r14,%r12)
je 0xf39b
movl %eax, %r12d
movq %r15, %rdi
callq 0x2110
cmpl $0x3, %eax
jl 0xf3c7
movl %eax, %ecx
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
addl %edx, %ecx
movb (%r15,%rcx), %cl
addb $-0x30, %cl
cmpb $0x9, %cl
ja 0xf3c7
leal -0x2(%rax), %ecx
cmpb $0x2f, (%r15,%rcx)
je 0xf3c9
movl %eax, %ecx
cmpl %ecx, %r12d
jne 0xf472
movslq %r12d, %rdx
movq %r14, %rdi
movq %r15, %rsi
callq 0x2070
testl %eax, %eax
jne 0xf472
movq 0x10(%rsp), %rax
cmpq %rax, %rbx
movq (%rsp), %r15
jne 0xf424
leaq (%rax,%rax), %r14
testq %rax, %rax
movl $0x2, %eax
cmoveq %rax, %r14
leaq (,%r14,8), %rax
leaq (%rax,%rax,4), %rdx
xorl %edi, %edi
movq %r15, %rsi
callq 0x32c4
movq %rax, %r15
movq %r14, 0x10(%rsp)
movq 0x8(%rsp), %r14
incq %rbx
movq 0x20(%rbp), %rax
movq %rax, 0x48(%r13,%r15)
movups (%rbp), %xmm0
movups 0x10(%rbp), %xmm1
movups %xmm1, 0x38(%r13,%r15)
movups %xmm0, 0x28(%r13,%r15)
xorps %xmm0, %xmm0
movups %xmm0, (%rbp)
movups %xmm0, 0x10(%rbp)
movq $0x0, 0x20(%rbp)
movq %r14, %rdi
callq 0xf4dc
addq $0x28, %r13
testl %eax, %eax
jns 0xf346
jmp 0xf47b
movq 0x8(%rsp), %r14
movq (%rsp), %r15
movq %r15, %r13
movq %rbx, %r15
movq 0x38(%rsp), %r12
cmpq %r12, 0x20(%rsp)
jl 0xf260
jmp 0xf496
movq %r15, %rbx
cmpl $-0x2, 0x2c(%rsp)
jle 0xf4b6
movq 0x30(%rsp), %rax
movl %ebx, (%rax)
movq %r13, %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x2690
jmp 0xf49d
leaq 0x194cf(%rip), %rdi     # 0x28993
leaq 0x194df(%rip), %rsi     # 0x289aa
leaq 0x194df(%rip), %rcx     # 0x289b1
movl $0x4c, %edx
callq 0x2160