// File: /workspace/github_c_makefile_star2_O3/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 %rsi, %r12
movq 0x20(%rdi), %rax
movl (%rax,%rsi,4), %esi
cmpl $0x100, %esi            # imm = 0x100
jge 0x21962
movl %edx, %ecx
movq %rdi, %rbx
movq (%rdi), %rax
movq 0x18(%rdi), %rdx
movslq (%rdx,%r12,4), %r14
movq 0x18(%rax), %rax
movl 0x18(%rax), %ebp
movq 0x30(%rdi), %rax
movslq %ecx, %rdx
movq (%rax,%rdx,8), %r15
leaq 0x10f82(%rip), %rax     # 0x32678
testb $0x2, (%rax)
jne 0x2192c
movq %r15, 0x8(%rsp)
leaq (%r14,%r14,4), %r13
testl %esi, %esi
jle 0x2183f
xorl %ecx, %ecx
leaq 0x10ae7(%rip), %rdx     # 0x32200
movl %ebp, 0x4(%rsp)
cmpl $0x2, %esi
jne 0x21809
testb $0x1, %bpl
sete %sil
testb $0x2, %bpl
sete %dil
testq %rcx, %rcx
setne %r8b
orb %dil, %r8b
cmpq $0x1, %rcx
setne %dil
cmpb $0x1, %r8b
jne 0x21757
orb %sil, %dil
jne 0x21809
movq %r12, %rax
leaq (%rcx,%rcx,4), %r8
shlq $0x3, %r8
addq 0x10(%rbx), %r8
movl (%r8,%r13,8), %esi
movq %r13, %rbp
movq 0x10(%r8,%r13,8), %r10
movl %esi, %r9d
sarl %r9d
movl %r9d, %edi
testl %r9d, %r9d
jle 0x217af
leal -0x1(%rsi), %r11d
xorl %r15d, %r15d
movslq %r11d, %r11
movsbq (%r10,%r11), %r12
movzbl (%r10,%r15), %r13d
movb (%rdx,%r13), %r13b
movb %r13b, (%r10,%r11)
movb (%rdx,%r12), %r12b
movb %r12b, (%r10,%r15)
incq %r15
decl %r11d
cmpq %r15, %rdi
jne 0x21787
testb $0x1, %sil
je 0x217c5
movslq %r9d, %r11
movzbl (%r10,%r11), %r15d
movb (%rdx,%r15), %r15b
movb %r15b, (%r10,%r11)
testl %r9d, %r9d
movq %rax, %r12
movq %rbp, %r13
movl 0x4(%rsp), %ebp
jle 0x21809
leaq (%r8,%r13,8), %r8
cmpq $0x0, 0x18(%r8)
je 0x21809
decl %esi
xorl %r9d, %r9d
movq 0x18(%r8), %r10
movslq %esi, %rsi
movb (%r10,%rsi), %r11b
movb (%r10,%r9), %r15b
movb %r15b, (%r10,%rsi)
movq 0x18(%r8), %r10
movb %r11b, (%r10,%r9)
incq %r9
decl %esi
cmpq %r9, %rdi
jne 0x217e4
movq 0x10(%rbx), %rsi
leaq (%rcx,%r14), %rdi
leaq (%rdi,%rdi,4), %rdi
movl (%rsi,%rdi,8), %r8d
movl %r8d, 0x20(%rsp,%rcx,4)
movq 0x10(%rsi,%rdi,8), %rsi
movq %rsi, 0x420(%rsp,%rcx,8)
incq %rcx
movq 0x20(%rbx), %rsi
movslq (%rsi,%r12,4), %rsi
cmpq %rsi, %rcx
jl 0x2171d
movq (%rbx), %rcx
movq 0x18(%rcx), %r10
testb $0x2, 0x2(%r10)
jne 0x21887
movq 0x28(%rcx), %rdi
shlq $0x3, %r14
addq 0x28(%rbx), %r14
movq 0x10(%rbx), %r11
leaq 0x20(%rsp), %rdx
leaq 0x420(%rsp), %rcx
movq %r14, %r8
movq 0x8(%rsp), %r9
pushq 0x8(%r11,%r13,8)
pushq %r10
callq 0x1d0da
addq $0x10, %rsp
jmp 0x2191a
testl %esi, %esi
movq %rbx, %rdx
movq 0x8(%rsp), %rbx
jle 0x2191a
movq %r12, %rcx
shlq $0x3, %r14
leaq 0x2(,%r13,2), %r15
leaq 0x420(%rsp), %r13
leaq 0x20(%rsp), %rbp
xorl %r12d, %r12d
movq %rcx, 0x18(%rsp)
movq %rdx, 0x10(%rsp)
movq (%rdx), %rax
movq 0x10(%rdx), %r10
movq 0x28(%rax), %rdi
movq 0x28(%rdx), %r8
addq %r14, %r8
movl $0x1, %esi
movq %rbp, %rdx
movq %r13, %rcx
movq %rbx, %r9
pushq (%r10,%r15,4)
pushq 0x18(%rax)
callq 0x1d0da
movq 0x20(%rsp), %rdx
movq 0x28(%rsp), %rcx
addq $0x10, %rsp
incq %r12
movq 0x20(%rdx), %rax
movslq (%rax,%rcx,4), %rax
addq $0x8, %r14
addq $0xa, %r15
addq $0x8, %r13
addq $0x4, %rbp
cmpq %rax, %r12
jl 0x218c0
addq $0xc18, %rsp            # imm = 0xC18
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x106c5(%rip), %rax     # 0x31ff8
movq (%rax), %rdi
movq 0x10(%rbx), %rax
leaq (%r14,%r14,4), %rsi
movq 0x8(%rax,%rsi,8), %rdx
movl (%rax,%rsi,8), %r8d
leaq 0x8781(%rip), %rsi      # 0x2a0cf
xorl %eax, %eax
callq 0x2210
movq 0x20(%rbx), %rax
movl (%rax,%r12,4), %esi
jmp 0x216ff
leaq 0x8722(%rip), %rdi      # 0x2a08b
leaq 0x8735(%rip), %rsi      # 0x2a0a5
leaq 0x8735(%rip), %rcx      # 0x2a0ac
movl $0x23, %edx
callq 0x2160
nopl (%rax)