// File: /workspace/github_c_makefile_star2_O3/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 %rsi, %r14
movq 0x28(%rdi), %rax
movl (%rax,%rsi,4), %esi
cmpl $0x100, %esi            # imm = 0x100
jge 0xe28f
movl %edx, %r12d
movq %rdi, %r13
movq (%rdi), %rax
movq 0x20(%rdi), %rcx
movslq (%rcx,%r14,4), %rbp
movq 0x18(%rax), %rax
movl 0xb8(%rax), %r15d
movq 0x48(%rdi), %rax
movslq %edx, %rcx
movq (%rax,%rcx,8), %rax
movq %rax, 0x10(%rsp)
leaq 0x28bc9(%rip), %rax     # 0x36928
xorpd %xmm0, %xmm0
testb $0x2, (%rax)
jne 0xe205
testl %esi, %esi
movq %r14, 0x18(%rsp)
movq %rbp, 0x20(%rsp)
movl %r15d, 0xc(%rsp)
jle 0xdebc
xorl %eax, %eax
leaq (,%rbp,4), %rcx
addq %rbp, %rcx
leaq 0x28979(%rip), %rdx     # 0x36710
cmpl $0x2, %esi
jne 0xde86
testb $0x1, %r15b
sete %sil
testb $0x2, %r15b
sete %dil
testq %rax, %rax
setne %r8b
orb %dil, %r8b
cmpq $0x1, %rax
setne %dil
cmpb $0x1, %r8b
jne 0xddd1
orb %sil, %dil
jne 0xde86
leaq (%rax,%rax,4), %rsi
shlq $0x3, %rsi
addq 0x10(%r13), %rsi
leaq (%rsi,%rcx,8), %rsi
movl (%rsi), %edi
movl %edi, %r9d
sarl %r9d
movl %r9d, %r8d
testl %r9d, %r9d
jle 0xde28
leal -0x1(%rdi), %r10d
xorl %r11d, %r11d
movq 0x10(%rsi), %rbx
movslq %r10d, %r10
movsbq (%rbx,%r10), %r14
movzbl (%rbx,%r11), %r15d
movb (%rdx,%r15), %bpl
movb %bpl, (%rbx,%r10)
movb (%rdx,%r14), %bl
movq 0x10(%rsi), %r14
movb %bl, (%r14,%r11)
incq %r11
decl %r10d
cmpq %r11, %r8
jne 0xddf8
testb $0x1, %dil
je 0xde41
movq 0x10(%rsi), %r10
movslq %r9d, %r11
movzbl (%r10,%r11), %ebx
movb (%rdx,%rbx), %bl
movb %bl, (%r10,%r11)
testl %r9d, %r9d
movq 0x18(%rsp), %r14
movq 0x20(%rsp), %rbp
movl 0xc(%rsp), %r15d
jle 0xde86
cmpq $0x0, 0x18(%rsi)
je 0xde86
decl %edi
xorl %r9d, %r9d
movq 0x18(%rsi), %r10
movslq %edi, %rdi
movb (%r10,%rdi), %r11b
movb (%r10,%r9), %bl
movb %bl, (%r10,%rdi)
movq 0x18(%rsi), %r10
movb %r11b, (%r10,%r9)
incq %r9
decl %edi
cmpq %r9, %r8
jne 0xde61
movq 0x10(%r13), %rsi
leaq (%rax,%rbp), %rdi
leaq (%rdi,%rdi,4), %rdi
movl (%rsi,%rdi,8), %r8d
movl %r8d, 0x40(%rsp,%rax,4)
movq 0x10(%rsi,%rdi,8), %rsi
movq %rsi, 0x440(%rsp,%rax,8)
incq %rax
movq 0x28(%r13), %rsi
movslq (%rsi,%r14,4), %rsi
cmpq %rsi, %rax
jl 0xdd97
movq (%r13), %rcx
movq 0x18(%rcx), %rax
testb $0x2, 0x2(%rax)
movsd %xmm0, 0x30(%rsp)
jne 0xdf64
movq 0x28(%rcx), %rdi
leaq (,%rbp,4), %rbx
movq 0x18(%r13), %r8
addq %rbx, %r8
leaq (,%rbp,8), %r9
addq 0x40(%r13), %r9
movq 0x10(%r13), %r10
leaq (,%rbp,4), %r11
addq %rbp, %r11
subq $0x8, %rsp
leaq 0x48(%rsp), %rdx
leaq 0x448(%rsp), %rcx
pushq 0x8(%r10,%r11,8)
pushq %rax
pushq 0x28(%rsp)
callq 0xc9de
addq $0x20, %rsp
movq 0x28(%r13), %rax
cmpl $0x0, (%rax,%r14,4)
jle 0xe1e7
movq 0x30(%r13), %rcx
addq %rbx, %rcx
addq 0x38(%r13), %rbx
xorl %esi, %esi
movq 0x10(%rsp), %rdi
movl 0x8(%rdi), %edx
movl %edx, (%rcx,%rsi,4)
movl 0xc(%rdi), %edx
movl %edx, (%rbx,%rsi,4)
incq %rsi
movslq (%rax,%r14,4), %rdx
cmpq %rdx, %rsi
jl 0xdf47
jmp 0xe041
testl %esi, %esi
jle 0xe1e7
movl %r12d, 0x2c(%rsp)
leaq (,%rbp,4), %rbx
leaq (,%rbp,8), %rcx
leaq 0x1(%rbp,%rbp,4), %rbp
leaq 0x440(%rsp), %r12
movq %r13, %r15
leaq 0x40(%rsp), %r13
xorl %r14d, %r14d
movq 0x10(%rsp), %r11
movq %rcx, 0x38(%rsp)
movq (%r15), %rax
movq 0x10(%r15), %r10
movq 0x28(%rax), %rdi
movq 0x18(%r15), %r8
addq %rbx, %r8
movq 0x40(%r15), %r9
addq %rcx, %r9
subq $0x8, %rsp
movl $0x1, %esi
movq %r13, %rdx
movq %r12, %rcx
pushq (%r10,%rbp,8)
pushq 0x18(%rax)
pushq %r11
callq 0xaf2a
movq 0x30(%rsp), %r11
addq $0x20, %rsp
movl 0x8(%r11), %eax
movq 0x30(%r15), %rcx
movl %eax, (%rcx,%rbx)
movl 0xc(%r11), %eax
movq 0x38(%r15), %rcx
movl %eax, (%rcx,%rbx)
movq 0x38(%rsp), %rcx
incq %r14
movq 0x28(%r15), %rax
movq 0x18(%rsp), %rdx
movslq (%rax,%rdx,4), %rdx
addq $0x4, %rbx
addq $0x8, %rcx
addq $0x5, %rbp
addq $0x8, %r12
addq $0x4, %r13
cmpq %rdx, %r14
jl 0xdf9e
movl 0x2c(%rsp), %r12d
movq %r15, %r13
movq 0x18(%rsp), %r14
movq 0x20(%rsp), %rbp
movl 0xc(%rsp), %r15d
testl %edx, %edx
jle 0xe1e7
xorl %eax, %eax
leaq 0x286be(%rip), %rcx     # 0x36710
cmpl $0x2, %edx
jne 0xe1d3
testb $0x1, %r15b
sete %dl
testb $0x2, %r15b
sete %sil
testq %rax, %rax
setne %dil
orb %sil, %dil
cmpq $0x1, %rax
setne %sil
cmpb $0x1, %dil
jne 0xe08b
orb %dl, %sil
jne 0xe1d3
movq 0x10(%r13), %rsi
leaq (%rax,%rbp), %rdx
leaq (%rdx,%rdx,4), %rdi
leaq (%rsi,%rdi,8), %rsi
movl (%rsi), %edi
movl %edi, %r9d
sarl %r9d
movl %r9d, %r8d
testl %r9d, %r9d
jle 0xe0e2
leal -0x1(%rdi), %r10d
xorl %r11d, %r11d
movq 0x10(%rsi), %rbx
movslq %r10d, %r10
movsbq (%rbx,%r10), %r14
movzbl (%rbx,%r11), %r15d
movb (%rcx,%r15), %bpl
movb %bpl, (%rbx,%r10)
movb (%rcx,%r14), %bl
movq 0x10(%rsi), %r14
movb %bl, (%r14,%r11)
incq %r11
decl %r10d
cmpq %r11, %r8
jne 0xe0b2
testb $0x1, %dil
je 0xe0fb
movq 0x10(%rsi), %r10
movslq %r9d, %r11
movzbl (%r10,%r11), %ebx
movb (%rcx,%rbx), %bl
movb %bl, (%r10,%r11)
testl %r9d, %r9d
movq 0x18(%rsp), %r14
movl 0xc(%rsp), %r15d
jle 0xe13b
cmpq $0x0, 0x18(%rsi)
je 0xe13b
decl %edi
xorl %r9d, %r9d
movq 0x18(%rsi), %r10
movslq %edi, %rdi
movb (%r10,%rdi), %r11b
movb (%r10,%r9), %bl
movb %bl, (%r10,%rdi)
movq 0x18(%rsi), %r10
movb %r11b, (%r10,%r9)
incq %r9
decl %edi
cmpq %r9, %r8
jne 0xe116
movq 0x18(%r13), %rsi
cmpl $0x0, (%rsi,%rdx,4)
movq 0x20(%rsp), %rbp
jle 0xe1d3
movl $0x10, %esi
xorl %edi, %edi
movq 0x40(%r13), %r8
movq (%r8,%rdx,8), %r8
movl 0x40(%rsp,%rax,4), %r9d
subl 0x4(%r8,%rsi), %r9d
movl (%r8,%rsi), %r10d
movl %r9d, (%r8,%rsi)
movl 0x40(%rsp,%rax,4), %r9d
subl %r10d, %r9d
movl %r9d, 0x4(%r8,%rsi)
xorb $0x4, 0x2d(%r8,%rsi)
movq 0x38(%r8,%rsi), %r8
testq %r8, %r8
je 0xe1bf
movl 0x14(%r8), %r9d
movl %r9d, %r10d
shrl $0x1e, %r10d
cmpl $0x1, %r10d
je 0xe1ab
cmpl $0x2, %r10d
jne 0xe1bf
movl $0x40000000, %r10d      # imm = 0x40000000
jmp 0xe1b1
movl $0x80000000, %r10d      # imm = 0x80000000
andl $0x3fffffff, %r9d       # imm = 0x3FFFFFFF
orl %r10d, %r9d
movl %r9d, 0x14(%r8)
incq %rdi
movq 0x18(%r13), %r8
movslq (%r8,%rdx,4), %r8
addq $0x50, %rsi
cmpq %r8, %rdi
jl 0xe155
incq %rax
movq 0x28(%r13), %rdx
movslq (%rdx,%r14,4), %rdx
cmpq %rdx, %rax
jl 0xe052
leaq 0x2873a(%rip), %rax     # 0x36928
testb $0x2, (%rax)
jne 0xe24a
addq $0xc38, %rsp            # imm = 0xC38
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x27dec(%rip), %rax     # 0x35ff8
movq (%rax), %rdi
movq 0x10(%r13), %rax
leaq (,%rbp,4), %rcx
addq %rbp, %rcx
movq 0x8(%rax,%rcx,8), %rdx
movl (%rax,%rcx,8), %r8d
leaq 0x1f780(%rip), %rsi     # 0x2d9ae
movl %r12d, %ecx
xorl %eax, %eax
callq 0x2260
callq 0x57d5
movq 0x28(%r13), %rax
movl (%rax,%r14,4), %esi
jmp 0xdd6c
movq 0x27da7(%rip), %rax     # 0x35ff8
movq (%rax), %r15
movq 0x10(%r13), %rax
leaq (,%rbp,4), %rcx
addq %rbp, %rcx
movq 0x8(%rax,%rcx,8), %r14
callq 0x57d5
subsd 0x30(%rsp), %xmm0
leaq 0x1f741(%rip), %rsi     # 0x2d9bb
movq %r15, %rdi
movq %r14, %rdx
movl %r12d, %ecx
movb $0x1, %al
callq 0x2260
jmp 0xe1f3
leaq 0x1f6db(%rip), %rdi     # 0x2d971
leaq 0x1f56e(%rip), %rsi     # 0x2d80b
leaq 0x1f6e7(%rip), %rcx     # 0x2d98b
movl $0x1b0, %edx            # imm = 0x1B0
callq 0x21a0
nop