// File: /workspace/github_c_makefile_star2_O1/DReichLab[P]adna/trim.c
// Function: bseq_read
bseq1_t *bseq_read(kseq_t *ks, int chunk_size, int *n_)
{
	int size = 0, m, n;
	bseq1_t *seqs;
	m = n = 0; seqs = 0;
	while (kseq_read(ks) >= 0) {
		bseq1_t *s;
		if (n >= m) {
			m = m? m<<1 : 256;
			seqs = realloc(seqs, m * sizeof(bseq1_t));
		}
		s = &seqs[n];
		s->name = strdup(ks->name.s);
		s->seq = strdup(ks->seq.s);
		s->qual = ks->qual.l? strdup(ks->qual.s) : 0;
		s->bc = 0;
		s->l_seq = ks->seq.l;
		s->dbl_bind = 0;
		s->type = AD_UNKNOWN;
		size += seqs[n++].l_seq;
		if (size >= chunk_size && (n&1) == 0) break;
	}
	*n_ = n;
	return seqs;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdx, 0x18(%rsp)
movl %esi, 0x4(%rsp)
movq %rdi, %r14
leaq 0x30(%rdi), %rax
movq %rax, 0x10(%rsp)
leaq 0x20(%rdi), %r12
leaq 0x10(%rdi), %rax
movq %rax, 0x20(%rsp)
xorl %ebp, %ebp
movq $0x0, 0x8(%rsp)
xorl %r15d, %r15d
xorl %r13d, %r13d
movq 0x48(%r14), %rbx
cmpl $0x0, 0x40(%r14)
jne 0x31ec
jmp 0x3176
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x31d2
movl 0x8(%rbx), %edx
testb $0x3, %dl
je 0x318a
movl (%rbx), %ecx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpl 0x4(%rbx), %ecx
jge 0x31d2
movl (%rbx), %eax
cmpl 0x4(%rbx), %eax
jl 0x31c2
movl $0x0, (%rbx)
movq 0x10(%rbx), %rdi
movq 0x18(%rbx), %rsi
sarl $0x2, %edx
callq 0x2140
movl %eax, 0x4(%rbx)
movl 0x8(%rbx), %ecx
movl %ecx, %edx
sarl $0x2, %edx
cmpl %edx, %eax
jge 0x31be
andl $-0x4, %ecx
incl %ecx
movl %ecx, 0x8(%rbx)
testl %eax, %eax
je 0x316f
movq 0x18(%rbx), %rax
movslq (%rbx), %rcx
leal 0x1(%rcx), %edx
movl %edx, (%rbx)
movzbl (%rax,%rcx), %eax
movl %eax, (%rsp)
cmpl $-0x1, %eax
je 0x3446
cmpl $0x40, %eax
je 0x31e8
cmpl $0x3e, %eax
jne 0x3176
movl %eax, 0x40(%r14)
xorl %eax, %eax
movl %eax, 0x30(%r14)
movl %eax, 0x20(%r14)
movl %eax, 0x10(%r14)
movq %rbx, %rdi
xorl %esi, %esi
movq %r14, %rdx
movq %rsp, %rcx
xorl %r8d, %r8d
callq 0x5337
testl %eax, %eax
js 0x3304
cmpl $0xa, (%rsp)
je 0x3232
movq %rbx, %rdi
movl $0x2, %esi
movq 0x20(%rsp), %rdx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x5337
cmpq $0x0, 0x28(%r14)
jne 0x324f
movl $0x100, 0x24(%r14)      # imm = 0x100
movl $0x100, %edi            # imm = 0x100
callq 0x21c0
movq %rax, 0x28(%r14)
movl 0x8(%rbx), %edx
testb $0x3, %dl
je 0x3263
movl (%rbx), %ecx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpl 0x4(%rbx), %ecx
jge 0x32ab
movl (%rbx), %eax
cmpl 0x4(%rbx), %eax
jl 0x329b
movl $0x0, (%rbx)
movq 0x10(%rbx), %rdi
movq 0x18(%rbx), %rsi
sarl $0x2, %edx
callq 0x2140
movl %eax, 0x4(%rbx)
movl 0x8(%rbx), %ecx
movl %ecx, %edx
sarl $0x2, %edx
cmpl %edx, %eax
jge 0x3297
andl $-0x4, %ecx
incl %ecx
movl %ecx, 0x8(%rbx)
testl %eax, %eax
je 0x32fd
movq 0x18(%rbx), %rax
movslq (%rbx), %rcx
leal 0x1(%rcx), %edx
movl %edx, (%rbx)
movzbl (%rax,%rcx), %eax
movl %eax, (%rsp)
cmpl $0x2a, %eax
jg 0x32bf
cmpl $0xa, %eax
je 0x324f
cmpl $-0x1, %eax
jne 0x32ce
jmp 0x3312
cmpl $0x2b, %eax
je 0x3312
cmpl $0x3e, %eax
je 0x330e
cmpl $0x40, %eax
je 0x330e
movq 0x28(%r14), %rcx
movl 0x20(%r14), %edx
leal 0x1(%rdx), %esi
movl %esi, 0x20(%r14)
movb %al, (%rcx,%rdx)
movq %rbx, %rdi
movl $0x2, %esi
movq %r12, %rdx
xorl %ecx, %ecx
movl $0x1, %r8d
callq 0x5337
jmp 0x324f
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x32ab
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x3446
movl %eax, 0x40(%r14)
movl 0x20(%r14), %eax
incl %eax
cmpl 0x24(%r14), %eax
jb 0x3353
movl %eax, %ecx
shrl %ecx
orl %eax, %ecx
movl %ecx, %eax
shrl $0x2, %eax
orl %ecx, %eax
movl %eax, %ecx
shrl $0x4, %ecx
orl %eax, %ecx
movl %ecx, %eax
shrl $0x8, %eax
orl %ecx, %eax
movl %eax, %esi
shrl $0x10, %esi
orl %eax, %esi
incl %esi
movl %esi, 0x24(%r14)
movq 0x28(%r14), %rdi
callq 0x21e0
movq %rax, 0x28(%r14)
movq 0x28(%r14), %rax
movl 0x20(%r14), %ecx
movb $0x0, (%rax,%rcx)
cmpl $0x2b, (%rsp)
jne 0x343b
movl 0x24(%r14), %esi
cmpl %esi, 0x34(%r14)
jae 0x338d
movl %esi, 0x34(%r14)
movq 0x38(%r14), %rdi
callq 0x21e0
movq %rax, 0x38(%r14)
jmp 0x338d
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x33e9
movl 0x8(%rbx), %edx
testb $0x3, %dl
je 0x33a1
movl (%rbx), %ecx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpl 0x4(%rbx), %ecx
jge 0x33e9
movl (%rbx), %eax
cmpl 0x4(%rbx), %eax
jl 0x33d9
movl $0x0, (%rbx)
movq 0x10(%rbx), %rdi
movq 0x18(%rbx), %rsi
sarl $0x2, %edx
callq 0x2140
movl %eax, 0x4(%rbx)
movl 0x8(%rbx), %ecx
movl %ecx, %edx
sarl $0x2, %edx
cmpl %edx, %eax
jge 0x33d5
andl $-0x4, %ecx
incl %ecx
movl %ecx, 0x8(%rbx)
testl %eax, %eax
je 0x3386
movq 0x18(%rbx), %rax
movslq (%rbx), %rcx
leal 0x1(%rcx), %edx
movl %edx, (%rbx)
movzbl (%rax,%rcx), %eax
movl %eax, (%rsp)
cmpl $-0x1, %eax
je 0x3441
cmpl $0xa, %eax
jne 0x338d
movq 0x10(%rsp), %rdx
movq %rbx, %rdi
movl $0x2, %esi
xorl %ecx, %ecx
movl $0x1, %r8d
callq 0x5337
movq 0x10(%rsp), %rdx
testl %eax, %eax
js 0x3421
movl (%rdx), %eax
cmpl (%r12), %eax
jb 0x33fb
movl $0x0, 0x40(%r14)
movl 0x20(%r14), %eax
cmpl 0x30(%r14), %eax
movl $0xfffffffe, %ecx       # imm = 0xFFFFFFFE
cmovnel %ecx, %eax
jmp 0x3446
movl (%r12), %eax
jmp 0x3446
movl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
movq %r15, %rdi
testl %eax, %eax
js 0x351b
movq 0x8(%rsp), %rcx
movslq %ecx, %rax
cmpq %rax, %rbp
jge 0x3463
movq %rdi, %r15
jmp 0x348a
leal (%rcx,%rcx), %ebx
testl %ecx, %ecx
movl $0x100, %eax            # imm = 0x100
cmovel %eax, %ebx
movslq %ebx, %rax
shlq $0x4, %rax
leaq (%rax,%rax,2), %rsi
callq 0x21e0
movq %rax, %r15
movl %ebx, %eax
movq %rax, 0x8(%rsp)
leaq (,%rbp,2), %rbx
addq %rbp, %rbx
shlq $0x4, %rbx
movq 0x8(%r14), %rdi
callq 0x2270
movq %rax, 0x8(%r15,%rbx)
movq 0x28(%r14), %rdi
callq 0x2270
movq %rax, 0x10(%r15,%rbx)
cmpl $0x0, 0x30(%r14)
movq %r15, %rcx
je 0x34d0
movq 0x38(%r14), %rdi
movq %rcx, %r15
callq 0x2270
movq %r15, %rcx
jmp 0x34d2
xorl %eax, %eax
movq %rcx, %r15
addq %rcx, %rbx
movq %rax, 0x18(%rbx)
movq $0x0, 0x20(%rbx)
movl 0x20(%r14), %ecx
movl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
andl %eax, %ecx
movl %ecx, (%rbx)
movl $0x0, 0x4(%rbx)
leaq 0x1(%rbp), %rax
addl %ecx, %r13d
cmpl 0x4(%rsp), %r13d
setl %cl
testb $0x1, %bpl
sete %dl
orb %cl, %dl
movq %rax, %rbp
jne 0x3162
jmp 0x351e
movq %rbp, %rax
movq 0x18(%rsp), %rcx
movl %eax, (%rcx)
movq %r15, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq