// File: /workspace/github_c_makefile_star2_O2/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 0x47f6
cmpl $0x1, %esi
je 0x47d8
testl %esi, %esi
jne 0x49ca
pushq $0x1
popq %rdi
pushq $0x18
popq %rsi
callq 0x2120
movq %rax, %rbx
movq 0x40(%r14), %rdi
movl 0x4(%r14), %esi
movq %rax, %rdx
callq 0x326b
movq %rax, 0x8(%rbx)
testb $0x1, (%rbx)
jne 0x49de
movq %r14, 0x10(%rbx)
testq %rax, %rax
jne 0x49cc
jmp 0x49c2
movl (%r14), %edi
movl (%rbx), %eax
sarl %eax
movslq %eax, %rcx
leaq 0x4b9(%rip), %rsi       # 0x4ca2
movq %rbx, %rdx
callq 0x237c
jmp 0x49cc
cmpl $0x0, 0x2c(%r14)
je 0x4838
pushq $0x8
popq %r15
leaq 0xa5b(%rip), %r14       # 0x5263
xorl %r12d, %r12d
movslq (%rbx), %rax
cmpq %rax, %r12
jge 0x4976
movq 0x8(%rbx), %rax
movq (%rax,%r15), %rsi
movl -0x4(%rax,%r15), %edx
movq %r14, %rdi
xorl %eax, %eax
callq 0x20d0
addq $0x2, %r12
addq $0x50, %r15
jmp 0x480b
movl $0xe00008, %r15d        # imm = 0xE00008
movq 0x277b(%rip), %r12      # 0x6fc0
xorl %r13d, %r13d
xorl %r14d, %r14d
movslq (%rbx), %rax
cmpq %rax, %r14
jge 0x4976
movq 0x8(%rbx), %rbp
testl $0x7fffffff, (%rbp,%r13) # imm = 0x7FFFFFFF
je 0x496a
movl 0x4(%rbp,%r13), %eax
cmpl $0x17, %eax
ja 0x496a
btl %eax, %r15d
jae 0x496a
xorl %eax, %eax
cmpq $0x0, 0x18(%rbp,%r13)
setne %al
leal 0x3e(,%rax,2), %edi
callq 0x2060
movq 0x8(%rbp,%r13), %rdi
movq (%r12), %rsi
callq 0x2100
cmpl $0x15, 0x4(%rbp,%r13)
pushq $0x15
popq %rsi
je 0x48d5
pushq $0x2f
popq %rdi
callq 0x2060
movl %r14d, %eax
andl $0x1, %eax
leaq 0x9a3(%rip), %rcx       # 0x526a
movsbl (%rax,%rcx), %edi
callq 0x2060
movl 0x4(%rbp,%r13), %esi
leaq 0x991(%rip), %rdi       # 0x526d
xorl %eax, %eax
callq 0x20d0
movl 0x4(%rbp,%r13), %eax
addl $-0x15, %eax
cmpl $0x2, %eax
ja 0x493a
cmpq $0x0, 0x20(%rbp,%r13)
je 0x4924
movq (%r12), %rsi
leaq 0x973(%rip), %rdi       # 0x5276
callq 0x2100
movq 0x20(%rbp,%r13), %rdi
cmpb $0x0, (%rdi)
leaq 0x966(%rip), %rax       # 0x527d
cmoveq %rax, %rdi
movq (%r12), %rsi
callq 0x2100
movl (%rbp,%r13), %esi
shrl $0x1f, %esi
leaq 0x94c(%rip), %rdi       # 0x527f
xorl %eax, %eax
callq 0x20d0
pushq $0xa
popq %rdi
callq 0x2060
movq 0x10(%rbp,%r13), %rdi
callq 0x2090
cmpq $0x0, 0x18(%rbp,%r13)
je 0x496a
leaq 0x92d(%rip), %rdi       # 0x5288
callq 0x2090
movq 0x18(%rbp,%r13), %rdi
callq 0x2090
incq %r14
addq $0x28, %r13
jmp 0x484b
pushq $0x20
popq %r15
xorl %r12d, %r12d
cltq
movq 0x8(%rbx), %r14
cmpq %rax, %r12
jge 0x49ba
movq (%r14,%r15), %rdi
callq 0x2050
movq -0x10(%r14,%r15), %rdi
callq 0x2050
movq -0x8(%r14,%r15), %rdi
callq 0x2050
movq -0x18(%r14,%r15), %rdi
callq 0x2050
incq %r12
movl (%rbx), %eax
addq $0x28, %r15
jmp 0x497d
movq %r14, %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 0x831(%rip), %rdi       # 0x5216
leaq 0x83f(%rip), %rsi       # 0x522b
leaq 0x845(%rip), %rcx       # 0x5238
movl $0x249, %edx            # imm = 0x249
callq 0x20f0