// File: /workspace/github_c_makefile_star2_O0/lh3[P]minimap/index.c
// Function: worker_pipeline
static void *worker_pipeline(void *shared, int step, void *in)
{
	int i;
    pipeline_t *p = (pipeline_t*)shared;
    if (step == 0) { // step 0: read sequences
        step_t *s;
		if (p->n_read > p->ibatch_size) return 0;
        s = (step_t*)calloc(1, sizeof(step_t));
		s->seq = bseq_read(p->fp, p->tbatch_size, &s->n_seq);
		if (s->seq) {
			uint32_t old_m = p->mi->n, m, n;
			assert((uint64_t)p->n_processed + s->n_seq <= INT32_MAX);
			m = n = p->mi->n + s->n_seq;
			kroundup32(m); kroundup32(old_m);
			if (old_m != m) {
				if (p->keep_name)
					p->mi->name = (char**)realloc(p->mi->name, m * sizeof(char*));
				p->mi->len = (int*)realloc(p->mi->len, m * sizeof(int));
			}
			for (i = 0; i < s->n_seq; ++i) {
				if (p->keep_name) {
					assert(strlen(s->seq[i].name) <= 254);
					p->mi->name[p->mi->n] = strdup(s->seq[i].name);
				}
				p->mi->len[p->mi->n++] = s->seq[i].l_seq;
				s->seq[i].rid = p->n_processed++;
				p->n_read += s->seq[i].l_seq;
			}
			return s;
		} else free(s);
    } else if (step == 1) { // step 1: compute sketch
        step_t *s = (step_t*)in;
		for (i = 0; i < s->n_seq; ++i) {
			bseq1_t *t = &s->seq[i];
			mm_sketch(t->seq, t->l_seq, p->mi->w, p->mi->k, t->rid, &s->a);
			free(t->seq); free(t->name);
		}
		free(s->seq); s->seq = 0;
		return s;
    } else if (step == 2) { // dispatch sketch to buckets
        step_t *s = (step_t*)in;
		mm_idx_add(p->mi, s->a.n, s->a.a);
		free(s->a.a); free(s);
	}
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %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 0x518e
movq -0x30(%rbp), %rax
movq 0x20(%rax), %rax
movq -0x30(%rbp), %rcx
cmpq 0x18(%rcx), %rax
jbe 0x4ea4
movq $0x0, -0x8(%rbp)
jmp 0x5299
movl $0x1, %edi
movl $0x28, %esi
callq 0x2150
movq %rax, -0x38(%rbp)
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x30(%rbp), %rax
movl (%rax), %esi
movq -0x38(%rbp), %rdx
callq 0x3a80
movq %rax, %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x38(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x5180
movq -0x30(%rbp), %rax
movq 0x28(%rax), %rax
movl 0xc(%rax), %eax
movl %eax, -0x3c(%rbp)
movq -0x30(%rbp), %rax
movslq 0x4(%rax), %rax
movq -0x38(%rbp), %rcx
movslq (%rcx), %rcx
addq %rcx, %rax
cmpq $0x7fffffff, %rax       # imm = 0x7FFFFFFF
ja 0x4f12
jmp 0x4f31
leaq 0x7853(%rip), %rdi      # 0xc76c
leaq 0x7826(%rip), %rsi      # 0xc746
movl $0xc3, %edx
leaq 0x7871(%rip), %rcx      # 0xc79d
callq 0x2120
movq -0x30(%rbp), %rax
movq 0x28(%rax), %rax
movl 0xc(%rax), %eax
movq -0x38(%rbp), %rcx
addl (%rcx), %eax
movl %eax, -0x44(%rbp)
movl %eax, -0x40(%rbp)
movl -0x40(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x40(%rbp)
movl -0x40(%rbp), %eax
shrl %eax
orl -0x40(%rbp), %eax
movl %eax, -0x40(%rbp)
movl -0x40(%rbp), %eax
shrl $0x2, %eax
orl -0x40(%rbp), %eax
movl %eax, -0x40(%rbp)
movl -0x40(%rbp), %eax
shrl $0x4, %eax
orl -0x40(%rbp), %eax
movl %eax, -0x40(%rbp)
movl -0x40(%rbp), %eax
shrl $0x8, %eax
orl -0x40(%rbp), %eax
movl %eax, -0x40(%rbp)
movl -0x40(%rbp), %eax
shrl $0x10, %eax
orl -0x40(%rbp), %eax
movl %eax, -0x40(%rbp)
movl -0x40(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
movl -0x3c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
shrl %eax
orl -0x3c(%rbp), %eax
movl %eax, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
shrl $0x2, %eax
orl -0x3c(%rbp), %eax
movl %eax, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
shrl $0x4, %eax
orl -0x3c(%rbp), %eax
movl %eax, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
shrl $0x8, %eax
orl -0x3c(%rbp), %eax
movl %eax, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
shrl $0x10, %eax
orl -0x3c(%rbp), %eax
movl %eax, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
cmpl -0x40(%rbp), %eax
je 0x5046
movq -0x30(%rbp), %rax
cmpl $0x0, 0x8(%rax)
je 0x501d
movq -0x30(%rbp), %rax
movq 0x28(%rax), %rax
movq 0x28(%rax), %rdi
movl -0x40(%rbp), %eax
movl %eax, %esi
shlq $0x3, %rsi
callq 0x2200
movq %rax, %rcx
movq -0x30(%rbp), %rax
movq 0x28(%rax), %rax
movq %rcx, 0x28(%rax)
movq -0x30(%rbp), %rax
movq 0x28(%rax), %rax
movq 0x20(%rax), %rdi
movl -0x40(%rbp), %eax
movl %eax, %esi
shlq $0x2, %rsi
callq 0x2200
movq %rax, %rcx
movq -0x30(%rbp), %rax
movq 0x28(%rax), %rax
movq %rcx, 0x20(%rax)
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
movq -0x38(%rbp), %rcx
cmpl (%rcx), %eax
jge 0x5173
movq -0x30(%rbp), %rax
cmpl $0x0, 0x8(%rax)
je 0x50e5
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x24(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rdi
callq 0x20e0
cmpq $0xfe, %rax
ja 0x508c
jmp 0x50ab
leaq 0x7735(%rip), %rdi      # 0xc7c8
leaq 0x76ac(%rip), %rsi      # 0xc746
movl $0xcd, %edx
leaq 0x76f7(%rip), %rcx      # 0xc79d
callq 0x2120
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x24(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rdi
callq 0x22c0
movq %rax, %rdx
movq -0x30(%rbp), %rax
movq 0x28(%rax), %rax
movq 0x28(%rax), %rax
movq -0x30(%rbp), %rcx
movq 0x28(%rcx), %rcx
movl 0xc(%rcx), %ecx
movq %rdx, (%rax,%rcx,8)
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x24(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl (%rax), %edx
movq -0x30(%rbp), %rax
movq 0x28(%rax), %rax
movq 0x20(%rax), %rax
movq -0x30(%rbp), %rcx
movq 0x28(%rcx), %rsi
movl 0xc(%rsi), %ecx
movl %ecx, %edi
addl $0x1, %edi
movl %edi, 0xc(%rsi)
movl %ecx, %ecx
movl %edx, (%rax,%rcx,4)
movq -0x30(%rbp), %rax
movl 0x4(%rax), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, 0x4(%rax)
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x24(%rbp), %rdx
imulq $0x18, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x4(%rax)
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x24(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movslq (%rax), %rcx
movq -0x30(%rbp), %rax
addq 0x20(%rax), %rcx
movq %rcx, 0x20(%rax)
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x504d
movq -0x38(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x5299
movq -0x38(%rbp), %rdi
callq 0x2040
jmp 0x5291
cmpl $0x1, -0x14(%rbp)
jne 0x524a
movq -0x20(%rbp), %rax
movq %rax, -0x50(%rbp)
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
movq -0x50(%rbp), %rcx
cmpl (%rcx), %eax
jge 0x5227
movq -0x50(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x24(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x58(%rbp), %rax
movl (%rax), %esi
movq -0x30(%rbp), %rax
movq 0x28(%rax), %rax
movl 0x4(%rax), %edx
movq -0x30(%rbp), %rax
movq 0x28(%rax), %rax
movl 0x8(%rax), %ecx
movq -0x58(%rbp), %rax
movl 0x4(%rax), %r8d
movq -0x50(%rbp), %r9
addq $0x10, %r9
callq 0x9bb0
movq -0x58(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x2040
movq -0x58(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x2040
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x51a7
movq -0x50(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x2040
movq -0x50(%rbp), %rax
movq $0x0, 0x8(%rax)
movq -0x50(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x5299
cmpl $0x2, -0x14(%rbp)
jne 0x528d
movq -0x20(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x30(%rbp), %rax
movq 0x28(%rax), %rdi
movq -0x60(%rbp), %rax
movq 0x10(%rax), %rax
movl %eax, %esi
movq -0x60(%rbp), %rax
movq 0x20(%rax), %rdx
callq 0x61b0
movq -0x60(%rbp), %rax
movq 0x20(%rax), %rdi
callq 0x2040
movq -0x60(%rbp), %rdi
callq 0x2040
jmp 0x528f
jmp 0x5291
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)