// File: /workspace/github_c_makefile_star2_O3/lh3[P]minimap/bseq.c
// Function: bseq_read
bseq1_t *bseq_read(bseq_file_t *fp, int chunk_size, int *n_)
{
	int size = 0, m, n;
	bseq1_t *seqs;
	kseq_t *ks = fp->ks;
	m = n = 0; seqs = 0;
	while (kseq_read(ks) >= 0) {
		bseq1_t *s;
		assert(ks->seq.l <= INT32_MAX);
		if (n >= m) {
			m = m? m<<1 : 256;
			seqs = (bseq1_t*)realloc(seqs, m * sizeof(bseq1_t));
		}
		s = &seqs[n];
		s->name = strdup(ks->name.s);
		s->seq = strdup(ks->seq.s);
		s->l_seq = ks->seq.l;
		size += seqs[n++].l_seq;
		if (size >= chunk_size) break;
	}
	if (n == 0) fp->is_eof = 1;
	*n_ = n;
	return seqs;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rdx, 0x20(%rsp)
movl %esi, 0x2c(%rsp)
movq %rdi, 0x48(%rsp)
movq 0x10(%rdi), %r12
leaq 0x30(%r12), %rax
movq %rax, 0x40(%rsp)
leaq 0x20(%r12), %rbx
leaq 0x10(%r12), %rax
movq %rax, 0x50(%rsp)
xorl %r15d, %r15d
xorl %r14d, %r14d
movq $0x0, 0x10(%rsp)
movq $0x0, 0x30(%rsp)
xorl %r13d, %r13d
movq %rbx, 0x38(%rsp)
movl %r13d, 0x1c(%rsp)
movq 0x48(%r12), %rbp
cmpl $0x0, 0x40(%r12)
je 0x354e
movq 0x40(%rsp), %r13
jmp 0x35c9
movl 0x8(%rbp), %edx
movl (%rbp), %ecx
movl 0x4(%rbp), %eax
movq 0x40(%rsp), %r13
testb $0x3, %dl
je 0x3569
cmpl %eax, %ecx
jge 0x38ff
movq 0x18(%rbp), %rsi
cmpl %eax, %ecx
jl 0x35aa
movl $0x0, (%rbp)
movq 0x10(%rbp), %rdi
sarl $0x2, %edx
callq 0x2170
movl %eax, 0x4(%rbp)
movl 0x8(%rbp), %edx
movl %edx, %ecx
sarl $0x2, %ecx
cmpl %ecx, %eax
jge 0x359b
andl $-0x4, %edx
incl %edx
movl %edx, 0x8(%rbp)
testl %eax, %eax
je 0x38ff
movl (%rbp), %ecx
movq 0x18(%rbp), %rsi
movslq %ecx, %rdi
incl %ecx
movl %ecx, (%rbp)
movzbl (%rsi,%rdi), %esi
movl %esi, 0xc(%rsp)
cmpl $0x40, %esi
je 0x35c4
cmpl $0x3e, %esi
jne 0x355c
movl %esi, 0x40(%r12)
movl %r15d, 0x30(%r12)
movl %r15d, 0x20(%r12)
movl %r15d, 0x10(%r12)
movq %rbp, %rdi
xorl %esi, %esi
movq %r12, %rdx
leaq 0xc(%rsp), %rcx
xorl %r8d, %r8d
callq 0x3931
testl %eax, %eax
js 0x38ff
cmpl $0xa, 0xc(%rsp)
je 0x3613
movq %rbp, %rdi
movl $0x2, %esi
movq 0x50(%rsp), %rdx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x3931
cmpq $0x0, 0x28(%r12)
jne 0x3633
movl $0x100, 0x24(%r12)      # imm = 0x100
movl $0x100, %edi            # imm = 0x100
callq 0x21e0
movq %rax, 0x28(%r12)
movl 0x8(%rbp), %edx
testb $0x3, %dl
sete %sil
movl (%rbp), %ecx
movl 0x4(%rbp), %eax
cmpl %eax, %ecx
setl %dil
orb %dil, %sil
testb $0x1, %sil
je 0x371e
movq 0x18(%rbp), %rsi
testb $0x1, %dil
jne 0x3699
movl $0x0, (%rbp)
movq 0x10(%rbp), %rdi
sarl $0x2, %edx
callq 0x2170
movl %eax, 0x4(%rbp)
movl 0x8(%rbp), %edx
movl %edx, %ecx
sarl $0x2, %ecx
cmpl %ecx, %eax
jge 0x368a
andl $-0x4, %edx
incl %edx
movl %edx, 0x8(%rbp)
testl %eax, %eax
je 0x371e
movl (%rbp), %ecx
movq 0x18(%rbp), %rsi
movslq %ecx, %rdi
incl %ecx
movl %ecx, (%rbp)
movb (%rsi,%rdi), %sil
movzbl %sil, %edi
movl %edi, 0xc(%rsp)
cmpl $0x2a, %edi
jg 0x36b9
cmpl $0xa, %edi
je 0x3707
jmp 0x36d0
cmpl $0x2b, %edi
je 0x3726
cmpl $0x3e, %edi
je 0x38f5
cmpl $0x40, %edi
je 0x38f5
movq 0x28(%r12), %rax
movl 0x20(%r12), %ecx
leal 0x1(%rcx), %edx
movl %edx, 0x20(%r12)
movb %sil, (%rax,%rcx)
movq %rbp, %rdi
movl $0x2, %esi
movq %rbx, %rdx
xorl %ecx, %ecx
movl $0x1, %r8d
callq 0x3931
movl 0x8(%rbp), %edx
movl (%rbp), %ecx
movl 0x4(%rbp), %eax
cmpl %eax, %ecx
setl %dil
testb $0x3, %dl
je 0x3656
cmpl %eax, %ecx
jl 0x3656
movl $0xffffffff, 0xc(%rsp)  # imm = 0xFFFFFFFF
movl 0x20(%r12), %ecx
leal 0x1(%rcx), %edx
movq 0x28(%r12), %rax
cmpl 0x24(%r12), %edx
jb 0x3775
movl %edx, %ecx
shrl %ecx
orl %edx, %ecx
movl %ecx, %edx
shrl $0x2, %edx
orl %ecx, %edx
movl %edx, %ecx
shrl $0x4, %ecx
orl %edx, %ecx
movl %ecx, %edx
shrl $0x8, %edx
orl %ecx, %edx
movl %edx, %esi
shrl $0x10, %esi
orl %edx, %esi
incl %esi
movl %esi, 0x24(%r12)
movq %rax, %rdi
callq 0x2200
movq %rax, 0x28(%r12)
movl 0x20(%r12), %ecx
movl %ecx, %ecx
movb $0x0, (%rax,%rcx)
cmpl $0x2b, 0xc(%rsp)
jne 0x384d
movl 0x24(%r12), %esi
cmpl %esi, 0x34(%r12)
jae 0x37a6
movl %esi, 0x34(%r12)
movq 0x38(%r12), %rdi
callq 0x2200
movq %rax, 0x38(%r12)
movl 0x8(%rbp), %edx
movl (%rbp), %ecx
movl 0x4(%rbp), %eax
testb $0x3, %dl
je 0x37bc
cmpl %eax, %ecx
jge 0x38ff
movq 0x18(%rbp), %rsi
cmpl %eax, %ecx
jl 0x37fd
movl $0x0, (%rbp)
movq 0x10(%rbp), %rdi
sarl $0x2, %edx
callq 0x2170
movl %eax, 0x4(%rbp)
movl 0x8(%rbp), %edx
movl %edx, %ecx
sarl $0x2, %ecx
cmpl %ecx, %eax
jge 0x37ee
andl $-0x4, %edx
incl %edx
movl %edx, 0x8(%rbp)
testl %eax, %eax
je 0x38ff
movl (%rbp), %ecx
movq 0x18(%rbp), %rsi
movslq %ecx, %rdi
incl %ecx
movl %ecx, (%rbp)
movzbl (%rsi,%rdi), %esi
movl %esi, 0xc(%rsp)
cmpl $0xa, %esi
jne 0x37af
movq %rbp, %rdi
movl $0x2, %esi
movq %r13, %rdx
xorl %ecx, %ecx
movl $0x1, %r8d
callq 0x3931
movl (%rbx), %r15d
movl (%r13), %ecx
testl %eax, %eax
js 0x383a
cmpl %r15d, %ecx
jb 0x3812
movl $0x0, 0x40(%r12)
cmpl %ecx, %r15d
je 0x3850
jmp 0x38ff
movl (%rbx), %r15d
testl %r15d, %r15d
js 0x38ff
movq 0x30(%rsp), %rcx
movslq %ecx, %rax
movq %r14, %rbx
cmpq %rax, %r14
jge 0x3870
movq 0x10(%rsp), %r14
jmp 0x38a4
leal (%rcx,%rcx), %ebp
testl %ecx, %ecx
movl $0x100, %eax            # imm = 0x100
cmovel %eax, %ebp
movslq %ebp, %rax
shlq $0x3, %rax
leaq (%rax,%rax,2), %rsi
movq 0x10(%rsp), %rdi
callq 0x2200
movq %rax, %r14
movq 0x38(%rsp), %rax
movl (%rax), %r15d
movl %ebp, %eax
movq %rax, 0x30(%rsp)
movl 0x1c(%rsp), %r13d
leaq (%rbx,%rbx,2), %rbp
movq 0x8(%r12), %rdi
callq 0x22c0
movq %rax, 0x8(%r14,%rbp,8)
movq 0x28(%r12), %rdi
callq 0x22c0
movq %rax, 0x10(%r14,%rbp,8)
movq %r14, 0x10(%rsp)
movl %r15d, (%r14,%rbp,8)
movq %rbx, %r14
incq %r14
addl %r15d, %r13d
cmpl 0x2c(%rsp), %r13d
movq 0x38(%rsp), %rbx
movl $0x0, %r15d
jl 0x3535
jmp 0x3912
movl %edi, 0x40(%r12)
jmp 0x3726
testl %r14d, %r14d
jne 0x3912
movq 0x48(%rsp), %rax
movl $0x1, (%rax)
xorl %r14d, %r14d
movq 0x20(%rsp), %rcx
movq 0x10(%rsp), %rax
movl %r14d, (%rcx)
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq