// File: /workspace/github_c_makefile_star2_O3/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 0x56ce
cmpl $0x1, %esi
je 0x56b0
testl %esi, %esi
jne 0x58b2
movl $0x1, %edi
movl $0x18, %esi
callq 0x2120
movq %rax, %rbx
movq 0x40(%r14), %rdi
movl 0x4(%r14), %esi
movq %rax, %rdx
callq 0x3368
movq %rax, 0x8(%rbx)
testb $0x1, (%rbx)
jne 0x58c6
movq %r14, 0x10(%rbx)
testq %rax, %rax
jne 0x58b4
jmp 0x58aa
movl (%r14), %edi
movl (%rbx), %eax
sarl %eax
movslq %eax, %rcx
leaq 0x48b(%rip), %rsi       # 0x5b4c
movq %rbx, %rdx
callq 0x242c
jmp 0x58b4
cmpl $0x0, 0x2c(%r14)
movl (%rbx), %eax
je 0x5717
testl %eax, %eax
jle 0x58a1
movl $0x8, %r15d
leaq 0xb97(%rip), %r14       # 0x6283
xorl %ebp, %ebp
movq 0x8(%rbx), %rax
movq (%rax,%r15), %rsi
movl -0x4(%rax,%r15), %edx
movq %r14, %rdi
xorl %eax, %eax
callq 0x20d0
movl (%rbx), %eax
addq $0x50, %r15
addl $0x2, %ebp
cmpl %ebp, %eax
jg 0x56ee
jmp 0x585a
testl %eax, %eax
jle 0x58a1
movl $0xe00008, %ebp         # imm = 0xE00008
movq 0x2895(%rip), %r12      # 0x7fc0
xorl %r15d, %r15d
xorl %r13d, %r13d
movq 0x8(%rbx), %r14
testl $0x7fffffff, (%r14,%r15) # imm = 0x7FFFFFFF
je 0x5847
movl 0x4(%r14,%r15), %eax
cmpl $0x17, %eax
ja 0x5847
btl %eax, %ebp
jae 0x5847
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
movl $0x15, %esi
cmpl $0x15, 0x4(%r14,%r15)
je 0x57b1
movl $0x2f, %edi
callq 0x2060
movl %r13d, %eax
andl $0x1, %eax
leaq 0xae7(%rip), %rcx       # 0x628a
movsbl (%rax,%rcx), %edi
callq 0x2060
movl 0x4(%r14,%r15), %esi
leaq 0xad5(%rip), %rdi       # 0x628d
xorl %eax, %eax
callq 0x20d0
movl 0x4(%r14,%r15), %eax
addl $-0x15, %eax
cmpl $0x2, %eax
ja 0x5815
cmpq $0x0, 0x20(%r14,%r15)
je 0x5800
movq (%r12), %rsi
leaq 0xab7(%rip), %rdi       # 0x6296
callq 0x2100
movq 0x20(%r14,%r15), %rdi
cmpb $0x0, (%rdi)
leaq 0xaaa(%rip), %rax       # 0x629d
cmoveq %rax, %rdi
movq (%r12), %rsi
callq 0x2100
movl (%r14,%r15), %esi
shrl $0x1f, %esi
leaq 0xa91(%rip), %rdi       # 0x629f
xorl %eax, %eax
callq 0x20d0
movl $0xa, %edi
callq 0x2060
movq 0x10(%r14,%r15), %rdi
callq 0x2090
cmpq $0x0, 0x18(%r14,%r15)
je 0x5847
leaq 0xa70(%rip), %rdi       # 0x62a8
callq 0x2090
movq 0x18(%r14,%r15), %rdi
callq 0x2090
incq %r13
movslq (%rbx), %rax
addq $0x28, %r15
cmpq %rax, %r13
jl 0x5731
testl %eax, %eax
jle 0x58a1
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 0x5867
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 0x969(%rip), %rdi       # 0x6236
leaq 0x977(%rip), %rsi       # 0x624b
leaq 0x97d(%rip), %rcx       # 0x6258
movl $0x249, %edx            # imm = 0x249
callq 0x20f0