// File: /workspace/github_c_makefile_star2_O0/lh3[P]miniprot/map.c
// Function: worker_pipeline
static void *worker_pipeline(void *shared, int step, void *in)
{
	int32_t i;
    pipeline_t *p = (pipeline_t*)shared;
    if (step == 0) { // step 0: read sequences
        step_t *s;
        s = Kcalloc(0, step_t, 1);
		s->seq = mp_bseq_read(p->fp, p->opt->mini_batch_size, 0, &s->n_seq);
		if (s->seq) {
			s->p = p;
			s->buf = Kcalloc(0, mp_tbuf_t*, p->n_threads);
			for (i = 0; i < p->n_threads; ++i)
				s->buf[i] = mp_tbuf_init();
			s->n_reg = Kcalloc(0, int32_t, s->n_seq);
			s->reg = Kcalloc(0, mp_reg1_t*, s->n_seq);
			return s;
		} else free(s);
    } else if (step == 1) { // step 1: map
		kt_for(p->n_threads, worker_for, in, ((step_t*)in)->n_seq);
		return in;
    } else if (step == 2) { // step 2: output
        step_t *s = (step_t*)in;
		for (i = 0; i < p->n_threads; ++i) mp_tbuf_destroy(s->buf[i]);
		free(s->buf);
		for (i = 0; i < s->n_seq; ++i) {
			int32_t best_sc = -1, j, n_out;
			if (s->n_reg[i] > 0)
				best_sc = s->reg[i][0].p? s->reg[i][0].p->dp_max : s->reg[i][0].chn_sc;
			for (j = 0, n_out = 0; j < s->n_reg[i] && j < p->opt->out_n; ++j) {
				const mp_reg1_t *r = &s->reg[i][j];
				int32_t sc = r->p? r->p->dp_max : r->chn_sc;
				if (sc <= 0 || sc < (double)best_sc * p->opt->out_sim) continue;
				if (r->qe - r->qs < (double)s->seq[i].l_seq * p->opt->out_cov) continue;
				mp_write_output(&p->str, 0, p->mi, &s->seq[i], r, p->opt, ++p->id, j + 1);
				fwrite(p->str.s, 1, p->str.l, stdout);
				++n_out;
			}
			if (n_out == 0) {
				mp_write_output(&p->str, 0, p->mi, &s->seq[i], 0, p->opt, 0, 0);
				fwrite(p->str.s, 1, p->str.l, stdout);
			}
			for (j = 0; j < s->n_reg[i]; ++j) {
				free(s->reg[i][j].feat);
				free(s->reg[i][j].p);
			}
			free(s->reg[i]);
			free(s->seq[i].seq); free(s->seq[i].name);
			if (s->seq[i].comment) free(s->seq[i].comment);
		}
		free(s->reg); free(s->n_reg); free(s->seq);
		if (mp_verbose >= 3)
			fprintf(stderr, "[M::%s::%.3f*%.2f] mapped %d sequences\n", __func__, mp_realtime(), mp_cputime() / mp_realtime(), s->n_seq);
		free(s);
	}
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x30(%rbp)
cmpl $0x0, -0x14(%rbp)
jne 0x7d99
xorl %eax, %eax
movl %eax, %edi
movl $0x1, %esi
movl $0x30, %edx
callq 0xab60
movq %rax, -0x38(%rbp)
movq -0x30(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x8(%rax), %rsi
movq -0x38(%rbp), %rcx
addq $0x8, %rcx
xorl %edx, %edx
callq 0x18a40
movq %rax, %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x38(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x7d8b
movq -0x30(%rbp), %rcx
movq -0x38(%rbp), %rax
movq %rcx, (%rax)
movq -0x30(%rbp), %rax
movslq (%rax), %rsi
xorl %eax, %eax
movl %eax, %edi
movl $0x8, %edx
callq 0xab60
movq %rax, %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x28(%rax)
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
movq -0x30(%rbp), %rcx
cmpl (%rcx), %eax
jge 0x7d3c
callq 0x61b0
movq %rax, %rdx
movq -0x38(%rbp), %rax
movq 0x28(%rax), %rax
movslq -0x24(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x7d0e
movq -0x38(%rbp), %rax
movslq 0x8(%rax), %rsi
xorl %eax, %eax
movl %eax, %edi
movl $0x4, %edx
callq 0xab60
movq %rax, %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x38(%rbp), %rax
movslq 0x8(%rax), %rsi
xorl %eax, %eax
movl %eax, %edi
movl $0x8, %edx
callq 0xab60
movq %rax, %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x38(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x8248
movq -0x38(%rbp), %rdi
callq 0x2040
jmp 0x8240
cmpl $0x1, -0x14(%rbp)
jne 0x7dca
movq -0x30(%rbp), %rax
movl (%rax), %edi
movq -0x20(%rbp), %rdx
movq -0x20(%rbp), %rax
movslq 0x8(%rax), %rcx
leaq 0x4a8(%rip), %rsi       # 0x8260
callq 0xb410
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x8248
cmpl $0x2, -0x14(%rbp)
jne 0x823c
movq -0x20(%rbp), %rax
movq %rax, -0x40(%rbp)
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
movq -0x30(%rbp), %rcx
cmpl (%rcx), %eax
jge 0x7e0e
movq -0x40(%rbp), %rax
movq 0x28(%rax), %rax
movslq -0x24(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x6200
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x7de3
movq -0x40(%rbp), %rax
movq 0x28(%rax), %rdi
callq 0x2040
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
movq -0x40(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jge 0x81a8
movl $0xffffffff, -0x44(%rbp) # imm = 0xFFFFFFFF
movq -0x40(%rbp), %rax
movq 0x18(%rax), %rax
movslq -0x24(%rbp), %rcx
cmpl $0x0, (%rax,%rcx,4)
jle 0x7e9a
movq -0x40(%rbp), %rax
movq 0x20(%rax), %rax
movslq -0x24(%rbp), %rcx
movq (%rax,%rcx,8), %rax
cmpq $0x0, 0x60(%rax)
je 0x7e7e
movq -0x40(%rbp), %rax
movq 0x20(%rax), %rax
movslq -0x24(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x60(%rax), %rax
movl 0x4(%rax), %eax
movl %eax, -0x60(%rbp)
jmp 0x7e94
movq -0x40(%rbp), %rax
movq 0x20(%rax), %rax
movslq -0x24(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movl 0x24(%rax), %eax
movl %eax, -0x60(%rbp)
movl -0x60(%rbp), %eax
movl %eax, -0x44(%rbp)
movl $0x0, -0x48(%rbp)
movl $0x0, -0x4c(%rbp)
movl -0x48(%rbp), %ecx
movq -0x40(%rbp), %rax
movq 0x18(%rax), %rdx
movslq -0x24(%rbp), %rsi
xorl %eax, %eax
cmpl (%rdx,%rsi,4), %ecx
movb %al, -0x61(%rbp)
jge 0x7ed5
movl -0x48(%rbp), %eax
movq -0x30(%rbp), %rcx
movq 0x10(%rcx), %rcx
cmpl 0x5c(%rcx), %eax
setl %al
movb %al, -0x61(%rbp)
movb -0x61(%rbp), %al
testb $0x1, %al
jne 0x7ee1
jmp 0x8033
movq -0x40(%rbp), %rax
movq 0x20(%rax), %rax
movslq -0x24(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x48(%rbp), %rcx
imulq $0x68, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rax
cmpq $0x0, 0x60(%rax)
je 0x7f1b
movq -0x58(%rbp), %rax
movq 0x60(%rax), %rax
movl 0x4(%rax), %eax
movl %eax, -0x68(%rbp)
jmp 0x7f25
movq -0x58(%rbp), %rax
movl 0x24(%rax), %eax
movl %eax, -0x68(%rbp)
movl -0x68(%rbp), %eax
movl %eax, -0x5c(%rbp)
cmpl $0x0, -0x5c(%rbp)
jle 0x7f56
cvtsi2sdl -0x5c(%rbp), %xmm1
cvtsi2sdl -0x44(%rbp), %xmm0
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rax
movss 0x50(%rax), %xmm2
cvtss2sd %xmm2, %xmm2
mulsd %xmm2, %xmm0
ucomisd %xmm1, %xmm0
jbe 0x7f5b
jmp 0x8025
movq -0x58(%rbp), %rax
movl 0x38(%rax), %eax
movq -0x58(%rbp), %rcx
subl 0x34(%rcx), %eax
cvtsi2sd %eax, %xmm1
movq -0x40(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x24(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
cvtsi2sdl (%rax), %xmm0
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rax
movss 0x54(%rax), %xmm2
cvtss2sd %xmm2, %xmm2
mulsd %xmm2, %xmm0
ucomisd %xmm1, %xmm0
jbe 0x7fa4
jmp 0x8025
movq -0x30(%rbp), %rdi
addq $0x28, %rdi
movq -0x30(%rbp), %rax
movq 0x20(%rax), %rdx
movq -0x40(%rbp), %rax
movq 0x10(%rax), %rcx
movslq -0x24(%rbp), %rax
shlq $0x5, %rax
addq %rax, %rcx
movq -0x58(%rbp), %r8
movq -0x30(%rbp), %rax
movq 0x10(%rax), %r9
movq -0x30(%rbp), %rax
movq 0x8(%rax), %r10
addq $0x1, %r10
movq %r10, 0x8(%rax)
movl -0x48(%rbp), %eax
addl $0x1, %eax
xorl %esi, %esi
movq %r10, (%rsp)
movl %eax, 0x8(%rsp)
callq 0x1d220
movq -0x30(%rbp), %rax
movq 0x38(%rax), %rdi
movq -0x30(%rbp), %rax
movq 0x28(%rax), %rdx
movq 0x1dfc1(%rip), %rax     # 0x25fd0
movq (%rax), %rcx
movl $0x1, %esi
callq 0x2310
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
movl -0x48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
jmp 0x7ea8
cmpl $0x0, -0x4c(%rbp)
jne 0x80a7
movq -0x30(%rbp), %rdi
addq $0x28, %rdi
movq -0x30(%rbp), %rax
movq 0x20(%rax), %rdx
movq -0x40(%rbp), %rax
movq 0x10(%rax), %rcx
movslq -0x24(%rbp), %rax
shlq $0x5, %rax
addq %rax, %rcx
movq -0x30(%rbp), %rax
movq 0x10(%rax), %r9
xorl %eax, %eax
movl %eax, %r8d
xorl %eax, %eax
movq %r8, %rsi
movq $0x0, (%rsp)
movl $0x0, 0x8(%rsp)
callq 0x1d220
movq -0x30(%rbp), %rax
movq 0x38(%rax), %rdi
movq -0x30(%rbp), %rax
movq 0x28(%rax), %rdx
movq 0x1df36(%rip), %rax     # 0x25fd0
movq (%rax), %rcx
movl $0x1, %esi
callq 0x2310
movl $0x0, -0x48(%rbp)
movl -0x48(%rbp), %eax
movq -0x40(%rbp), %rcx
movq 0x18(%rcx), %rcx
movslq -0x24(%rbp), %rdx
cmpl (%rcx,%rdx,4), %eax
jge 0x8115
movq -0x40(%rbp), %rax
movq 0x20(%rax), %rax
movslq -0x24(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x48(%rbp), %rcx
imulq $0x68, %rcx, %rcx
addq %rcx, %rax
movq 0x58(%rax), %rdi
callq 0x2040
movq -0x40(%rbp), %rax
movq 0x20(%rax), %rax
movslq -0x24(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x48(%rbp), %rcx
imulq $0x68, %rcx, %rcx
addq %rcx, %rax
movq 0x60(%rax), %rdi
callq 0x2040
movl -0x48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
jmp 0x80ae
movq -0x40(%rbp), %rax
movq 0x20(%rax), %rax
movslq -0x24(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x2040
movq -0x40(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x24(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rdi
callq 0x2040
movq -0x40(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x24(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rdi
callq 0x2040
movq -0x40(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x24(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
cmpq $0x0, 0x18(%rax)
je 0x8198
movq -0x40(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x24(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq 0x18(%rax), %rdi
callq 0x2040
jmp 0x819a
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x7e22
movq -0x40(%rbp), %rax
movq 0x20(%rax), %rdi
callq 0x2040
movq -0x40(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0x2040
movq -0x40(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x2040
leaq 0x1e502(%rip), %rax     # 0x266d8
cmpl $0x3, (%rax)
jl 0x8233
movq 0x1de16(%rip), %rax     # 0x25ff8
movq (%rax), %rax
movq %rax, -0x78(%rbp)
callq 0x41a0
movsd %xmm0, -0x70(%rbp)
callq 0x4110
movsd %xmm0, -0x80(%rbp)
callq 0x41a0
movsd -0x80(%rbp), %xmm1
movq -0x78(%rbp), %rdi
movaps %xmm0, %xmm2
movsd -0x70(%rbp), %xmm0
divsd %xmm2, %xmm1
movq -0x40(%rbp), %rax
movl 0x8(%rax), %ecx
leaq 0x1937d(%rip), %rsi     # 0x215a2
leaq 0x1939e(%rip), %rdx     # 0x215ca
movb $0x2, %al
callq 0x21f0
movq -0x40(%rbp), %rdi
callq 0x2040
jmp 0x823e
jmp 0x8240
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x90, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)