// File: /workspace/github_c_makefile_star2_O1/lh3[P]pre-pe/pre-lianti.c
// Function: worker_pipeline
static void *worker_pipeline(void *shared, int step, void *_data)
{
	int i;
	lt_global_t *g = (lt_global_t*)shared;
	if (step == 0) {
		data_for_t *ret;
		ret = calloc(1, sizeof(data_for_t));
		ret->seqs = bseq_read(g->ks, g->opt.chunk_size, &ret->n_seqs);
		assert((ret->n_seqs&1) == 0);
		ret->g = g;
		if (ret->seqs) return ret;
		else free(ret);
	} else if (step == 1) {
		data_for_t *data = (data_for_t*)_data;
		kt_for(g->opt.n_threads, worker_for, data, data->n_seqs>>1);
		return data;
	} else if (step == 2) {
		data_for_t *data = (data_for_t*)_data;
		if (g->opt.tab_out) { // tabular output
			for (i = 0; i < data->n_seqs; i += 2) {
				bseq1_t *s = &data->seqs[i];
				printf("%s\t%d\n", s->name, s->type);
			}
		} else { // FASTQ output (FASTA not supported yet)
			for (i = 0; i < data->n_seqs; ++i) {
				bseq1_t *s = &data->seqs[i];
				if (s->l_seq > 0 && (s->type == LT_NO_MERGE || s->type == LT_AMBI_MERGE || s->type == LT_MERGED || s->type == LT_NO_BINDING)) {
					putchar(s->qual? '@' : '>'); fputs(s->name, stdout);
					if (s->type != LT_MERGED) {
						putchar('/'); putchar("12"[i&1]);
					}
					printf(" YT:i:%d", s->type);
					if (s->type == LT_NO_MERGE || s->type == LT_AMBI_MERGE || s->type == LT_MERGED) {
						if (s->bc) { fputs("\tBC:Z:", stdout); fputs(s->bc[0] == 0? "*" : s->bc, stdout); }
						printf("\tYD:i:%d", s->dbl_bind);
					}
					putchar('\n');
					puts(s->seq);
					if (s->qual) { puts("+"); puts(s->qual); }
				}
			}
		}
		for (i = 0; i < data->n_seqs; ++i) { // deallocate
			bseq1_t *s = &data->seqs[i];
			free(s->bc); free(s->seq); free(s->qual); free(s->name);
		}
		free(data->seqs); free(data);
	}
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rdi, %r14
cmpl $0x2, %esi
je 0x52a8
cmpl $0x1, %esi
je 0x528a
testl %esi, %esi
jne 0x5486
movl $0x1, %edi
movl $0x18, %esi
callq 0x2120
movq %rax, %rbx
movq 0x40(%r14), %rdi
movl 0x4(%r14), %esi
movq %rax, %rdx
callq 0x31b1
movq %rax, 0x8(%rbx)
testb $0x1, (%rbx)
jne 0x549a
movq %r14, 0x10(%rbx)
testq %rax, %rax
jne 0x5488
jmp 0x547e
movl (%r14), %edi
movl (%rbx), %eax
sarl %eax
movslq %eax, %rcx
leaq 0x64f(%rip), %rsi       # 0x58ea
movq %rbx, %rdx
callq 0x243c
jmp 0x5488
cmpl $0x0, 0x2c(%r14)
movl (%rbx), %eax
je 0x52ef
testl %eax, %eax
jle 0x542d
movl $0x8, %r15d
leaq 0xf8f(%rip), %r14       # 0x6255
xorl %ebp, %ebp
movq 0x8(%rbx), %rax
movq (%rax,%r15), %rsi
movl -0x4(%rax,%r15), %edx
movq %r14, %rdi
xorl %eax, %eax
callq 0x20d0
addq $0x50, %r15
addl $0x2, %ebp
cmpl %ebp, (%rbx)
jg 0x52c8
jmp 0x542d
testl %eax, %eax
jle 0x542d
movl $0xe00008, %ebp         # imm = 0xE00008
movq 0x2cbd(%rip), %r12      # 0x7fc0
xorl %r15d, %r15d
xorl %r13d, %r13d
movq 0x8(%rbx), %r14
testl $0x7fffffff, (%r14,%r15) # imm = 0x7FFFFFFF
je 0x541a
movl 0x4(%r14,%r15), %eax
cmpl $0x17, %eax
ja 0x541a
btl %eax, %ebp
jae 0x541a
xorl %eax, %eax
cmpq $0x0, 0x18(%r14,%r15)
setne %al
leal 0x3e(,%rax,2), %edi
callq 0x2060
movq 0x8(%r14,%r15), %rdi
movq (%r12), %rsi
callq 0x2100
cmpl $0x15, 0x4(%r14,%r15)
je 0x537f
movl $0x2f, %edi
callq 0x2060
movl %r13d, %eax
andl $0x1, %eax
leaq 0xee6(%rip), %rcx       # 0x625c
movsbl (%rax,%rcx), %edi
callq 0x2060
movl 0x4(%r14,%r15), %esi
leaq 0xed4(%rip), %rdi       # 0x625f
xorl %eax, %eax
callq 0x20d0
movl 0x4(%r14,%r15), %eax
addl $-0x15, %eax
cmpl $0x2, %eax
ja 0x53e8
cmpq $0x0, 0x20(%r14,%r15)
je 0x53d3
movq (%r12), %rsi
leaq 0xeb6(%rip), %rdi       # 0x6268
callq 0x2100
movq 0x20(%r14,%r15), %rdi
cmpb $0x0, (%rdi)
leaq 0xea9(%rip), %rax       # 0x626f
cmoveq %rax, %rdi
movq (%r12), %rsi
callq 0x2100
movl (%r14,%r15), %esi
shrl $0x1f, %esi
leaq 0xe90(%rip), %rdi       # 0x6271
xorl %eax, %eax
callq 0x20d0
movl $0xa, %edi
callq 0x2060
movq 0x10(%r14,%r15), %rdi
callq 0x2090
cmpq $0x0, 0x18(%r14,%r15)
je 0x541a
leaq 0xe6f(%rip), %rdi       # 0x627a
callq 0x2090
movq 0x18(%r14,%r15), %rdi
callq 0x2090
incq %r13
movslq (%rbx), %rax
addq $0x28, %r15
cmpq %rax, %r13
jl 0x5309
cmpl $0x0, (%rbx)
jle 0x5475
movl $0x20, %r14d
xorl %r15d, %r15d
movq 0x8(%rbx), %r12
movq (%r12,%r14), %rdi
callq 0x2050
movq -0x10(%r12,%r14), %rdi
callq 0x2050
movq -0x8(%r12,%r14), %rdi
callq 0x2050
movq -0x18(%r12,%r14), %rdi
callq 0x2050
incq %r15
movslq (%rbx), %rax
addq $0x28, %r14
cmpq %rax, %r15
jl 0x543b
movq 0x8(%rbx), %rdi
callq 0x2050
movq %rbx, %rdi
callq 0x2050
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xd67(%rip), %rdi       # 0x6208
leaq 0xd75(%rip), %rsi       # 0x621d
leaq 0xd7b(%rip), %rcx       # 0x622a
movl $0x249, %edx            # imm = 0x249
callq 0x20f0