// File: /workspace/github_c_makefile_star2_O1/lh3[P]minigraph/gmap.c
// Function: worker_for
static void worker_for(void *_data, long i, int tid) // kt_for() callback
{
    step_t *s = (step_t*)_data;
	int qlens[MG_MAX_SEG], j, off = s->seg_off[i], pe_ori = s->p->opt->pe_ori;
	const char *qseqs[MG_MAX_SEG];
	mg_tbuf_t *b = s->buf[tid];
	assert(s->n_seg[i] <= MG_MAX_SEG);
	if (mg_dbg_flag & MG_DBG_QNAME)
		fprintf(stderr, "QR\t%s\t%d\t%d\n", s->seq[off].name, tid, s->seq[off].l_seq);
	for (j = 0; j < s->n_seg[i]; ++j) {
		if (s->n_seg[i] == 2 && ((j == 0 && (pe_ori>>1&1)) || (j == 1 && (pe_ori&1))))
			mg_revcomp_bseq(&s->seq[off + j]);
		qlens[j] = s->seq[off + j].l_seq;
		qseqs[j] = s->seq[off + j].seq;
	}
	if (s->p->opt->flag & MG_M_INDEPEND_SEG) {
		for (j = 0; j < s->n_seg[i]; ++j)
			mg_map_frag(s->p->gi, 1, &qlens[j], &qseqs[j], &s->gcs[off+j], b, s->p->opt, s->seq[off+j].name);
	} else {
		mg_map_frag(s->p->gi, s->n_seg[i], qlens, qseqs, &s->gcs[off], b, s->p->opt, s->seq[off].name);
	}
#if 0 // for paired-end reads
	for (j = 0; j < s->n_seg[i]; ++j) // flip the query strand and coordinate to the original read strand
		if (s->n_seg[i] == 2 && ((j == 0 && (pe_ori>>1&1)) || (j == 1 && (pe_ori&1)))) {
			int k, t;
			mg_revcomp_bseq(&s->seq[off + j]);
			for (k = 0; k < s->n_reg[off + j]; ++k) {
				mg_lchain_t *r = &s->reg[off + j][k];
				t = r->qs;
				r->qs = qlens[j] - r->qe;
				r->qe = qlens[j] - t;
				r->v ^= 1;
			}
		}
#endif
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xc18, %rsp            # imm = 0xC18
movq 0x20(%rdi), %rax
cmpl $0x100, (%rax,%rsi,4)   # imm = 0x100
jge 0x2195b
movl %edx, %ecx
movq %rsi, %r15
movq %rdi, %rbx
movq (%rdi), %rax
movq 0x18(%rdi), %rdx
movslq (%rdx,%rsi,4), %rbp
movq 0x18(%rax), %rax
movl 0x18(%rax), %r12d
movq 0x30(%rdi), %rax
movslq %ecx, %rdx
movq (%rax,%rdx,8), %r14
leaq 0x10fb1(%rip), %rax     # 0x32678
testb $0x2, (%rax)
jne 0x21926
movq %r14, (%rsp)
movq 0x20(%rbx), %rax
movl (%rax,%r15,4), %esi
testl %esi, %esi
jle 0x2181f
xorl %eax, %eax
leaq (,%rbp,4), %rcx
addq %rbp, %rcx
movq %rcx, 0x8(%rsp)
leaq 0x10b03(%rip), %rdx     # 0x32200
cmpl $0x2, %esi
jne 0x217e9
testb $0x1, %r12b
sete %sil
testb $0x2, %r12b
sete %dil
testq %rax, %rax
setne %r8b
orb %dil, %r8b
cmpq $0x1, %rax
setne %dil
cmpb $0x1, %r8b
jne 0x21737
orb %sil, %dil
jne 0x217e9
movq %r15, %rcx
leaq (%rax,%rax,4), %r8
shlq $0x3, %r8
addq 0x10(%rbx), %r8
movq 0x8(%rsp), %rdi
movl (%r8,%rdi,8), %esi
movq 0x10(%r8,%rdi,8), %r10
movl %esi, %r9d
sarl %r9d
movl %r9d, %edi
testl %r9d, %r9d
jle 0x21791
leal -0x1(%rsi), %r11d
xorl %r14d, %r14d
movslq %r11d, %r11
movsbq (%r10,%r11), %r15
movzbl (%r10,%r14), %r13d
movb (%rdx,%r13), %r13b
movb %r13b, (%r10,%r11)
movb (%rdx,%r15), %r15b
movb %r15b, (%r10,%r14)
incq %r14
decl %r11d
cmpq %r14, %rdi
jne 0x21769
testb $0x1, %sil
je 0x217a7
movslq %r9d, %r11
movzbl (%r10,%r11), %r14d
movb (%rdx,%r14), %r14b
movb %r14b, (%r10,%r11)
testl %r9d, %r9d
movq %rcx, %r15
jle 0x217e9
movq 0x8(%rsp), %rcx
leaq (%r8,%rcx,8), %r8
cmpq $0x0, 0x18(%r8)
je 0x217e9
decl %esi
xorl %r9d, %r9d
movq 0x18(%r8), %r10
movslq %esi, %rsi
movb (%r10,%rsi), %r11b
movb (%r10,%r9), %r14b
movb %r14b, (%r10,%rsi)
movq 0x18(%r8), %r10
movb %r11b, (%r10,%r9)
incq %r9
decl %esi
cmpq %r9, %rdi
jne 0x217c4
movq 0x10(%rbx), %rsi
leaq (%rax,%rbp), %rdi
leaq (%rdi,%rdi,4), %rdi
movl (%rsi,%rdi,8), %r8d
movl %r8d, 0x20(%rsp,%rax,4)
movq 0x10(%rsi,%rdi,8), %rsi
movq %rsi, 0x420(%rsp,%rax,8)
incq %rax
movq 0x20(%rbx), %rsi
movslq (%rsi,%r15,4), %rsi
cmpq %rsi, %rax
jl 0x216fd
movq (%rbx), %rcx
movq 0x18(%rcx), %rax
testb $0x2, 0x2(%rax)
jne 0x21870
movq 0x28(%rcx), %rdi
leaq (,%rbp,8), %r8
addq 0x28(%rbx), %r8
movq 0x10(%rbx), %r10
leaq (,%rbp,4), %r11
addq %rbp, %r11
leaq 0x20(%rsp), %rdx
leaq 0x420(%rsp), %rcx
movq (%rsp), %r9
pushq 0x8(%r10,%r11,8)
pushq %rax
callq 0x1d057
addq $0x10, %rsp
jmp 0x21914
movq 0x20(%rbx), %rax
cmpl $0x0, (%rax,%r15,4)
movq %rbx, %rdx
movq (%rsp), %rbx
jle 0x21914
movq %r15, %rcx
leaq (,%rbp,4), %rax
addq %rbp, %rax
shlq $0x3, %rbp
leaq 0x2(,%rax,2), %r14
leaq 0x420(%rsp), %r12
leaq 0x20(%rsp), %r13
xorl %r15d, %r15d
movq %rcx, 0x18(%rsp)
movq %rdx, 0x10(%rsp)
movq (%rdx), %rax
movq 0x10(%rdx), %r10
movq 0x28(%rax), %rdi
movq 0x28(%rdx), %r8
addq %rbp, %r8
movl $0x1, %esi
movq %r13, %rdx
movq %r12, %rcx
movq %rbx, %r9
pushq (%r10,%r14,4)
pushq 0x18(%rax)
callq 0x1d057
movq 0x20(%rsp), %rdx
movq 0x28(%rsp), %rcx
addq $0x10, %rsp
incq %r15
movq 0x20(%rdx), %rax
movslq (%rax,%rcx,4), %rax
addq $0x8, %rbp
addq $0xa, %r14
addq $0x8, %r12
addq $0x4, %r13
cmpq %rax, %r15
jl 0x218ba
addq $0xc18, %rsp            # imm = 0xC18
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x106cb(%rip), %rax     # 0x31ff8
movq (%rax), %rdi
movq 0x10(%rbx), %rax
leaq (,%rbp,4), %rsi
addq %rbp, %rsi
movq 0x8(%rax,%rsi,8), %rdx
movl (%rax,%rsi,8), %r8d
leaq 0x86e8(%rip), %rsi      # 0x2a037
xorl %eax, %eax
callq 0x2210
jmp 0x216d0
leaq 0x8691(%rip), %rdi      # 0x29ff3
leaq 0x86a4(%rip), %rsi      # 0x2a00d
leaq 0x86a4(%rip), %rcx      # 0x2a014
movl $0x23, %edx
callq 0x2160
nop