// File: /workspace/github_c_makefile_star2_O0/ToniWestbrook[P]paladin/bwa.c
// Function: bseq_read
bseq1_t *bseq_read(int chunk_size, int *n_, void *ks1_, void *ks2_)
{
	kseq_t *ks = (kseq_t*)ks1_, *ks2 = (kseq_t*)ks2_;
	int size = 0, m, n;
	bseq1_t *seqs;
	m = n = 0; seqs = 0;
	while (kseq_read(ks) >= 0) {
		if (ks2 && kseq_read(ks2) < 0) { // the 2nd file has fewer reads
			fprintf(stderr, "[W::%s] the 2nd file has fewer sequences.\n", __func__);
			break;
		}
		if (n >= m) {
			m = m? m<<1 : 256;
			seqs = realloc(seqs, m * sizeof(bseq1_t));
		}
		trim_readno(&ks->name);
		kseq2bseq1(ks, &seqs[n]);
		seqs[n].id = n;
		size += seqs[n++].l_seq;
		if (ks2) {
			trim_readno(&ks2->name);
			kseq2bseq1(ks2, &seqs[n]);
			seqs[n].id = n;
			size += seqs[n++].l_seq;
		}
		if (size >= chunk_size && (n&1) == 0) break;
	}
	if (size == 0) { // test if the 2nd file is finished
		if (ks2 && kseq_read(ks2) >= 0)
			fprintf(stderr, "[W::%s] the 1st file has fewer sequences.\n", __func__);
	}
	*n_ = n;
	return seqs;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movl %edi, -0x4(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x30(%rbp)
movl $0x0, -0x34(%rbp)
movl $0x0, -0x3c(%rbp)
movl $0x0, -0x38(%rbp)
movq $0x0, -0x48(%rbp)
movq -0x28(%rbp), %rdi
callq 0x11b70
cmpl $0x0, %eax
jl 0x1897e
cmpq $0x0, -0x30(%rbp)
je 0x1885f
movq -0x30(%rbp), %rdi
callq 0x11b70
cmpl $0x0, %eax
jge 0x1885f
movq 0x27796(%rip), %rax     # 0x3ffd8
movq (%rax), %rdi
leaq 0x21b44(%rip), %rsi     # 0x3a390
leaq 0x21b68(%rip), %rdx     # 0x3a3bb
movb $0x0, %al
callq 0x34e0
jmp 0x1897e
movl -0x3c(%rbp), %eax
cmpl -0x38(%rbp), %eax
jl 0x188af
cmpl $0x0, -0x38(%rbp)
je 0x18877
movl -0x38(%rbp), %eax
shll %eax
movl %eax, -0x4c(%rbp)
jmp 0x18881
movl $0x100, %eax            # imm = 0x100
movl %eax, -0x4c(%rbp)
jmp 0x18881
movl -0x4c(%rbp), %eax
movl %eax, -0x38(%rbp)
movq -0x48(%rbp), %rdi
movslq -0x38(%rbp), %rax
imulq $0x30, %rax, %rsi
leaq 0x21b2b(%rip), %rdx     # 0x3a3c5
movl $0x37, %ecx
leaq 0x21b15(%rip), %r8      # 0x3a3bb
callq 0x31d40
movq %rax, -0x48(%rbp)
movq -0x28(%rbp), %rdi
callq 0x189d0
movq -0x28(%rbp), %rdi
movq -0x48(%rbp), %rsi
movslq -0x3c(%rbp), %rax
imulq $0x30, %rax, %rax
addq %rax, %rsi
callq 0x18a60
movl -0x3c(%rbp), %ecx
movq -0x48(%rbp), %rax
movslq -0x3c(%rbp), %rdx
imulq $0x30, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x4(%rax)
movq -0x48(%rbp), %rax
movl -0x3c(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x3c(%rbp)
movslq %ecx, %rcx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movl (%rax), %eax
addl -0x34(%rbp), %eax
movl %eax, -0x34(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0x18964
movq -0x30(%rbp), %rdi
callq 0x189d0
movq -0x30(%rbp), %rdi
movq -0x48(%rbp), %rsi
movslq -0x3c(%rbp), %rax
imulq $0x30, %rax, %rax
addq %rax, %rsi
callq 0x18a60
movl -0x3c(%rbp), %ecx
movq -0x48(%rbp), %rax
movslq -0x3c(%rbp), %rdx
imulq $0x30, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x4(%rax)
movq -0x48(%rbp), %rax
movl -0x3c(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x3c(%rbp)
movslq %ecx, %rcx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movl (%rax), %eax
addl -0x34(%rbp), %eax
movl %eax, -0x34(%rbp)
movl -0x34(%rbp), %eax
cmpl -0x4(%rbp), %eax
jl 0x18979
movl -0x3c(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
jne 0x18979
jmp 0x1897e
jmp 0x18814
cmpl $0x0, -0x34(%rbp)
jne 0x189ba
cmpq $0x0, -0x30(%rbp)
je 0x189b8
movq -0x30(%rbp), %rdi
callq 0x11b70
cmpl $0x0, %eax
jl 0x189b8
movq 0x27638(%rip), %rax     # 0x3ffd8
movq (%rax), %rdi
leaq 0x21a21(%rip), %rsi     # 0x3a3cb
leaq 0x21a0a(%rip), %rdx     # 0x3a3bb
movb $0x0, %al
callq 0x34e0
jmp 0x189ba
movl -0x3c(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, (%rax)
movq -0x48(%rbp), %rax
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax)