// File: /workspace/github_c_makefile_star2_O2/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 $0x48, %rsp
movq %rdx, 0x28(%rsp)
movl %esi, 0x14(%rsp)
movq %rdi, 0x20(%rsp)
movq 0x10(%rdi), %r12
leaq 0x30(%r12), %r13
leaq 0x20(%r12), %rax
movq %rax, 0x40(%rsp)
leaq 0x10(%r12), %rax
movq %rax, 0x30(%rsp)
movq $0x0, 0x8(%rsp)
xorl %r14d, %r14d
movq $0x0, 0x18(%rsp)
xorl %ebx, %ebx
movq %r13, 0x38(%rsp)
movl %ebx, 0x10(%rsp)
movq 0x48(%r12), %r15
cmpl $0x0, 0x40(%r12)
movq 0x40(%rsp), %rbx
jne 0x32eb
movq %r15, %rdi
callq 0x353a
cmpl $-0x1, %eax
je 0x3508
cmpl $0x40, %eax
je 0x32e2
cmpl $0x3e, %eax
jne 0x32c7
movl %eax, 0x4(%rsp)
movl %eax, 0x40(%r12)
andl $0x0, 0x30(%r12)
andl $0x0, 0x20(%r12)
andl $0x0, 0x10(%r12)
movq %r15, %rdi
xorl %esi, %esi
movq %r12, %rdx
leaq 0x4(%rsp), %rcx
callq 0x35ad
testl %eax, %eax
js 0x3508
cmpl $0xa, 0x4(%rsp)
je 0x3330
movq %r15, %rdi
pushq $0x2
popq %rsi
movq 0x30(%rsp), %rdx
xorl %ecx, %ecx
callq 0x35ad
cmpq $0x0, 0x28(%r12)
jne 0x3350
movl $0x100, 0x24(%r12)      # imm = 0x100
movl $0x100, %edi            # imm = 0x100
callq 0x21e0
movq %rax, 0x28(%r12)
movq %r15, %rdi
callq 0x353a
movl %eax, 0x4(%rsp)
cmpl $0xa, %eax
je 0x3350
cmpl $-0x1, %eax
je 0x33a5
cmpl $0x2b, %eax
je 0x33a5
cmpl $0x3e, %eax
je 0x33a0
cmpl $0x40, %eax
je 0x33a0
movq 0x28(%r12), %rcx
movl 0x20(%r12), %edx
leal 0x1(%rdx), %esi
movl %esi, 0x20(%r12)
movb %al, (%rcx,%rdx)
movq %r15, %rdi
pushq $0x2
popq %rsi
movq %rbx, %rdx
xorl %ecx, %ecx
pushq $0x1
popq %r8
callq 0x35b2
jmp 0x3350
movl %eax, 0x40(%r12)
movl 0x20(%r12), %ecx
leal 0x1(%rcx), %edx
movq 0x28(%r12), %rax
cmpl 0x24(%r12), %edx
jb 0x33f4
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, 0x4(%rsp)
jne 0x346c
movl 0x24(%r12), %esi
cmpl %esi, 0x34(%r12)
jae 0x3421
movl %esi, 0x34(%r12)
movq 0x38(%r12), %rdi
callq 0x2200
movq %rax, 0x38(%r12)
movq %r15, %rdi
callq 0x353a
movl %eax, 0x4(%rsp)
cmpl $-0x1, %eax
je 0x3508
cmpl $0xa, %eax
jne 0x3421
movq %r15, %rdi
pushq $0x2
popq %rsi
movq %r13, %rdx
xorl %ecx, %ecx
pushq $0x1
popq %r8
callq 0x35b2
movl (%rbx), %ebp
movl (%r13), %ecx
testl %eax, %eax
js 0x345d
cmpl %ebp, %ecx
jb 0x343b
andl $0x0, 0x40(%r12)
cmpl %ecx, %ebp
je 0x346e
jmp 0x3508
movl (%rbx), %ebp
testl %ebp, %ebp
js 0x3508
movq 0x18(%rsp), %rcx
movslq %ecx, %rax
cmpq %rax, 0x8(%rsp)
jge 0x348a
movq %r14, %r13
jmp 0x34b5
leal (%rcx,%rcx), %r15d
testl %ecx, %ecx
movl $0x100, %eax            # imm = 0x100
cmovel %eax, %r15d
movslq %r15d, %rax
imulq $0x18, %rax, %rsi
movq %r14, %rdi
callq 0x2200
movq %rax, %r13
movl (%rbx), %ebp
movl %r15d, %eax
movq %rax, 0x18(%rsp)
movl 0x10(%rsp), %ebx
movq 0x8(%rsp), %r14
imulq $0x18, %r14, %r15
movq 0x8(%r12), %rdi
callq 0x22c0
movq %rax, 0x8(%r13,%r15)
movq 0x28(%r12), %rdi
callq 0x22c0
movq %rax, 0x10(%r13,%r15)
movl %ebp, (%r13,%r15)
incq %r14
movq %r14, 0x8(%rsp)
addl %ebp, %ebx
cmpl 0x14(%rsp), %ebx
movq %r13, %r14
movq 0x38(%rsp), %r13
jl 0x32b1
movq 0x8(%rsp), %rcx
jmp 0x351e
movq 0x8(%rsp), %rcx
testl %ecx, %ecx
jne 0x351e
movq 0x20(%rsp), %rax
movl $0x1, (%rax)
xorl %ecx, %ecx
movq 0x28(%rsp), %rax
movl %ecx, (%rax)
movq %r14, %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq