// File: /workspace/github_c_makefile_star2_O2/lh3[P]minimap2/map.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[MM_MAX_SEG], j, off = s->seg_off[i], pe_ori = s->p->opt->pe_ori;
	const char *qseqs[MM_MAX_SEG];
	double t = 0.0;
	mm_tbuf_t *b = s->buf[tid];
	assert(s->n_seg[i] <= MM_MAX_SEG);
	if (mm_dbg_flag & MM_DBG_PRINT_QNAME) {
		fprintf(stderr, "QR\t%s\t%d\t%d\n", s->seq[off].name, tid, s->seq[off].l_seq);
		t = realtime();
	}
	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))))
			mm_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 & MM_F_INDEPEND_SEG) {
		for (j = 0; j < s->n_seg[i]; ++j) {
			mm_map_frag(s->p->mi, 1, &qlens[j], &qseqs[j], &s->n_reg[off+j], &s->reg[off+j], b, s->p->opt, s->seq[off+j].name);
			s->rep_len[off + j] = b->rep_len;
			s->frag_gap[off + j] = b->frag_gap;
		}
	} else {
		mm_map_frag(s->p->mi, s->n_seg[i], qlens, qseqs, &s->n_reg[off], &s->reg[off], b, s->p->opt, s->seq[off].name);
		for (j = 0; j < s->n_seg[i]; ++j) {
			s->rep_len[off + j] = b->rep_len;
			s->frag_gap[off + j] = b->frag_gap;
		}
	}
	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;
			mm_revcomp_bseq(&s->seq[off + j]);
			for (k = 0; k < s->n_reg[off + j]; ++k) {
				mm_reg1_t *r = &s->reg[off + j][k];
				t = r->qs;
				r->qs = qlens[j] - r->qe;
				r->qe = qlens[j] - t;
				r->rev = !r->rev;
				if (r->p) {
					if (r->p->trans_strand == 1) r->p->trans_strand = 2;
					else if (r->p->trans_strand == 2) r->p->trans_strand = 1;
				}
			}
		}
	if (mm_dbg_flag & MM_DBG_PRINT_QNAME)
		fprintf(stderr, "QT\t%s\t%d\t%.6f\n", s->seq[off].name, tid, realtime() - t);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xc38, %rsp            # imm = 0xC38
movq 0x28(%rdi), %rax
cmpl $0x100, (%rax,%rsi,4)   # imm = 0x100
jge 0xcaa1
movl %edx, %r9d
movq %rsi, %r12
movq %rdi, %r14
movq (%rdi), %rax
movq 0x20(%rdi), %rcx
movslq (%rcx,%rsi,4), %r13
movq 0x18(%rax), %rax
movl 0xb8(%rax), %ebp
movq 0x48(%rdi), %rax
movslq %edx, %rcx
movq (%rax,%rcx,8), %rcx
leaq 0x261eb(%rip), %rax     # 0x32928
testb $0x2, (%rax)
movl %edx, 0x8(%rsp)
movq %rcx, 0x18(%rsp)
jne 0xca2c
xorpd %xmm0, %xmm0
movsd %xmm0, 0x10(%rsp)
imulq $0x28, %r13, %rbx
xorl %r15d, %r15d
movq 0x28(%r14), %rax
movslq (%rax,%r12,4), %rsi
cmpq %rsi, %r15
jge 0xc7c6
cmpl $0x2, %esi
jne 0xc7a4
testb $0x1, %bpl
sete %al
testb $0x2, %bpl
sete %cl
testq %r15, %r15
setne %dl
orb %cl, %dl
cmpq $0x1, %r15
setne %cl
cmpb $0x1, %dl
jne 0xc798
orb %al, %cl
jne 0xc7a4
movq 0x10(%r14), %rdi
addq %rbx, %rdi
callq 0xcaec
movq 0x10(%r14), %rax
movl (%rax,%rbx), %ecx
movl %ecx, 0x40(%rsp,%r15,4)
movq 0x10(%rax,%rbx), %rax
movq %rax, 0x440(%rsp,%r15,8)
incq %r15
addq $0x28, %rbx
jmp 0xc760
movq (%r14), %rcx
movq 0x18(%rcx), %r10
testb $0x2, 0x2(%r10)
movq %r12, 0x20(%rsp)
movq %r13, 0x28(%rsp)
movl %ebp, 0xc(%rsp)
jne 0xc85f
movq 0x28(%rcx), %rdi
leaq (,%r13,4), %r8
addq 0x18(%r14), %r8
leaq (,%r13,8), %r9
addq 0x40(%r14), %r9
movq 0x10(%r14), %rax
imulq $0x28, %r13, %r11
subq $0x8, %rsp
leaq 0x48(%rsp), %rdx
leaq 0x448(%rsp), %rcx
pushq 0x8(%rax,%r11)
pushq %r10
movq 0x30(%rsp), %rbx
pushq %rbx
callq 0xb3d2
addq $0x20, %rsp
movq 0x28(%r14), %rax
xorl %ecx, %ecx
movq %r13, %rdx
movslq (%rax,%r12,4), %rsi
cmpq %rsi, %rcx
jge 0xc926
movl 0x8(%rbx), %esi
movq 0x30(%r14), %rdi
movl %esi, (%rdi,%rdx,4)
movl 0xc(%rbx), %esi
movq 0x38(%r14), %rdi
movl %esi, (%rdi,%rdx,4)
incq %rcx
incq %rdx
jmp 0xc836
leaq (,%r13,4), %r9
leaq (,%r13,8), %r12
imulq $0xa, %r13, %r11
addq $0x2, %r11
leaq 0x440(%rsp), %r15
leaq 0x40(%rsp), %rbx
xorl %edi, %edi
movq 0x18(%rsp), %rbp
movslq %esi, %rcx
cmpq %rcx, %rdi
jge 0xc926
movq (%r14), %rax
movq 0x10(%r14), %r10
movq %rdi, 0x30(%rsp)
movq 0x28(%rax), %rdi
movq 0x18(%r14), %r8
addq %r9, %r8
movq %r9, 0x38(%rsp)
movq 0x40(%r14), %r9
addq %r12, %r9
subq $0x8, %rsp
pushq $0x1
popq %rsi
movq %rbx, %rdx
movq %r15, %rcx
pushq (%r10,%r11,4)
pushq 0x18(%rax)
pushq %rbp
movq %r11, %r13
callq 0xb3d2
movq 0x50(%rsp), %rdi
movq 0x58(%rsp), %r9
movq %r13, %r11
addq $0x20, %rsp
movl 0x8(%rbp), %eax
movq 0x30(%r14), %rcx
movl %eax, (%rcx,%r9)
movl 0xc(%rbp), %eax
movq 0x38(%r14), %rcx
movl %eax, (%rcx,%r9)
incq %rdi
movq 0x28(%r14), %rax
movq 0x20(%rsp), %rcx
movl (%rax,%rcx,4), %esi
addq $0x8, %r15
addq $0x4, %rbx
addq $0x4, %r9
addq $0x8, %r12
addq $0xa, %r11
jmp 0xc88b
xorl %r12d, %r12d
pushq $0x10
popq %r13
movq 0x20(%rsp), %r15
movq 0x28(%rsp), %rbp
movslq (%rax,%r15,4), %rcx
cmpq %rcx, %r12
jge 0xca0e
cmpl $0x2, %ecx
jne 0xca06
movl 0xc(%rsp), %edx
testb $0x1, %dl
sete %cl
testb $0x2, %dl
sete %dl
testq %r12, %r12
setne %sil
orb %dl, %sil
cmpq $0x1, %r12
setne %dl
cmpb $0x1, %sil
jne 0xc97c
orb %cl, %dl
jne 0xca06
leaq (%r12,%rbp), %rbx
imulq $0x28, %rbx, %rdi
addq 0x10(%r14), %rdi
callq 0xcaec
movq %r13, %rax
xorl %ecx, %ecx
movq 0x18(%r14), %rdx
movslq (%rdx,%rbx,4), %rdx
cmpq %rdx, %rcx
jge 0xca02
movq 0x40(%r14), %rdx
movq (%rdx,%rbx,8), %rdx
movl 0x40(%rsp,%r12,4), %esi
subl 0x4(%rdx,%rax), %esi
movl (%rdx,%rax), %edi
movl %esi, (%rdx,%rax)
movl 0x40(%rsp,%r12,4), %esi
subl %edi, %esi
movl %esi, 0x4(%rdx,%rax)
xorb $0x4, 0x2d(%rdx,%rax)
movq 0x38(%rdx,%rax), %rdx
testq %rdx, %rdx
je 0xc9f9
movl 0x14(%rdx), %esi
movl %esi, %edi
shrl $0x1e, %edi
cmpl $0x1, %edi
je 0xc9e9
cmpl $0x2, %edi
jne 0xc9f9
movl $0x40000000, %edi       # imm = 0x40000000
jmp 0xc9ee
movl $0x80000000, %edi       # imm = 0x80000000
andl $0x3fffffff, %esi       # imm = 0x3FFFFFFF
orl %edi, %esi
movl %esi, 0x14(%rdx)
incq %rcx
addq $0x50, %rax
jmp 0xc992
movq 0x28(%r14), %rax
incq %r12
jmp 0xc937
leaq 0x25f13(%rip), %rax     # 0x32928
testb $0x2, (%rax)
jne 0xca62
addq $0xc38, %rsp            # imm = 0xC38
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x255c5(%rip), %rax     # 0x31ff8
movq (%rax), %rdi
movq 0x10(%r14), %rax
imulq $0x28, %r13, %rcx
movq 0x8(%rax,%rcx), %rdx
movl (%rax,%rcx), %r8d
leaq 0x1bf60(%rip), %rsi     # 0x289ae
movl %r9d, %ecx
xorl %eax, %eax
callq 0x2260
callq 0x4521
jmp 0xc753
movq 0x2558f(%rip), %rax     # 0x31ff8
movq (%rax), %r15
movq 0x10(%r14), %rax
imulq $0x28, %rbp, %rcx
movq 0x8(%rax,%rcx), %r14
callq 0x4521
subsd 0x10(%rsp), %xmm0
leaq 0x1bf30(%rip), %rsi     # 0x289bb
movq %r15, %rdi
movq %r14, %rdx
movl 0x8(%rsp), %ecx
movb $0x1, %al
callq 0x2260
jmp 0xca1a
leaq 0x1bec9(%rip), %rdi     # 0x28971
leaq 0x1bd5c(%rip), %rsi     # 0x2880b
leaq 0x1bed5(%rip), %rcx     # 0x2898b
movl $0x1b0, %edx            # imm = 0x1B0
callq 0x21a0