// File: /workspace/github_cpp_makefile_star2_O3/chhylp123[P]hifiasm/inter.cpp
// Function: update_gen_r_contain(void*, long, int)
static void update_gen_r_contain(void *data, long i, int tid) // callback for kt_for()
{
	r_contain_aux *s = (r_contain_aux *)data;
	ma_hit_t_alloc *src = s->src; ma_hit_t *t; int32_t r; asg_arc_t x;
	uint64_t *a = s->cr->interval.a + s->cr->idx[i], a_n = s->cr->idx[i+1] - s->cr->idx[i], k, dp, l, z, qn, tn;
	uint64_t is_el = s->is_el, is_del = s->is_del, min_ovlp = s->min_ovlp, max_hang = s->max_hang, qs, qe, cs, ce, sum;
	int64_t ii; asg_t *rg = s->rg; uint64_t *b, b_n, ti;
	// if(a_n == 0 || rg->seq[i].del) return;
	if(s->is_src_cc) {
		for (z = 0; z < src[i].length; z++) {
			t = &(src[i].buffer[z]); t->cc = 0;
			if(a_n == 0 || rg->seq[i].del) continue;
			qn = Get_qn((*t)); tn = Get_tn((*t));
			if(qn > tn) continue;
			if(is_el && (!(t->el))) continue;
			if(is_del && (!(t->del))) continue;
			if((Get_qe((*t)) - Get_qs((*t))) < min_ovlp) continue;
			if((Get_te((*t)) - Get_ts((*t))) < min_ovlp) continue;
			if(rg->seq[tn].del) continue;
			b = s->cr->interval.a + s->cr->idx[tn]; b_n = s->cr->idx[tn+1] - s->cr->idx[tn];
			if(b_n == 0) continue;
			r = ma_hit2arc(t, Get_READ_LENGTH(R_INF, qn), Get_READ_LENGTH(R_INF, tn), max_hang, asm_opt.max_hang_rate, min_ovlp, &x);
			if(r < 0) continue;	
			qs = Get_qs((*t)); qe = Get_qe((*t));
			for (k = 0; k < a_n; k += 2) {
				cs = a[k]>>33; ce = a[k+1]>>33; assert(rg->seq[(uint32_t)(a[k])].del);
				if(qs<=cs+128 && qe+128>=ce) { ///128 is the offset for indel
					for (ti = 0; ti < b_n; ti+=2) {
						if((uint32_t)(b[ti]) == (uint32_t)(a[k])) {
							sum = t->cc; sum += (ce - cs);
							if(sum > 0x3fffffffU) sum = 0x3fffffffU;
							t->cc = sum;
							break;
						}
					}
				}
			}
		}
	} else {
		radix_sort_gfa64(a, a + a_n);
		for (k = 0, dp = 0; k < a_n; ++k) {
			///if a[j] is qe
			if ((a[k]>>32)&1) --dp;
			else ++dp;
			l = a[k]>>33; l <<= 32; l += dp;
			a[k] = l;
		}
		for (z = 0; z < src[i].length; z++) {
			t = &(src[i].buffer[z]); 
			qn = Get_qn((*t)); tn = Get_tn((*t));
			if(qn > tn) continue;
			if(t->cc == 0) continue;
			ii = get_specific_overlap(&(src[tn]), tn, qn);
			src[tn].buffer[ii].cc = t->cc;
		}
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %rsi, %rbx
movq (%rdi), %rax
movq 0x8(%rdi), %r13
movq (%rax), %rcx
movl (%rcx,%rsi,4), %r12d
movl 0x4(%rcx,%rsi,4), %ebp
movq %r12, %r14
shlq $0x3, %r14
movl %ebp, %ecx
subl %r12d, %ecx
movq %rcx, 0x28(%rsp)
addq 0x18(%rax), %r14
movq %rdi, 0x40(%rsp)
cmpq $0x0, 0x30(%rdi)
je 0x1e57d8
movq %rbx, 0x80(%rsp)
leaq (%rbx,%rbx,2), %rax
cmpl $0x0, 0xc(%r13,%rax,8)
je 0x1e58ce
movq 0x40(%rsp), %rcx
movq 0x20(%rcx), %rdx
movq %rdx, 0x78(%rsp)
movq 0x28(%rcx), %rdx
movq %rdx, 0x48(%rsp)
movq 0x10(%rcx), %rdx
movq %rdx, 0x18(%rsp)
movq 0x18(%rcx), %rdx
movq %rdx, 0x38(%rsp)
movq 0x38(%rcx), %rcx
movq %rcx, 0x50(%rsp)
leaq (,%rax,8), %r9
addq %r13, %r9
xorl %r10d, %r10d
movl %ebp, 0x34(%rsp)
movq (%r9), %rax
leaq (%r10,%r10,4), %rdx
movq 0x18(%rax,%rdx,8), %r13
movq %r13, %rcx
andq $-0x40000000, %rcx      # imm = 0xC0000000
movq %rcx, 0x18(%rax,%rdx,8)
cmpl %r12d, %ebp
je 0x1e5543
movq 0x50(%rsp), %rsi
movq 0x20(%rsi), %r8
movq 0x80(%rsp), %rsi
cmpl $0x0, (%r8,%rsi,8)
js 0x1e5543
leaq (%rax,%rdx,8), %r11
movq (%r11), %rax
movq %rax, %rdx
shrq $0x20, %rdx
movl 0xc(%r11), %edi
cmpq %rdi, %rdx
jbe 0x1e5554
incq %r10
movl 0xc(%r9), %eax
cmpq %rax, %r10
jb 0x1e54f4
jmp 0x1e58ce
cmpq $0x0, 0x78(%rsp)
je 0x1e557a
cmpq $0x0, 0x48(%rsp)
setne %sil
testq %r13, %r13
setns %bl
cmpb $0x0, 0x20(%r11)
je 0x1e5543
andb %bl, %sil
je 0x1e5587
jmp 0x1e5543
cmpq $0x0, 0x48(%rsp)
je 0x1e5587
testq %r13, %r13
jns 0x1e5543
movl 0x8(%r11), %ebx
movl %ebx, %esi
subl %eax, %esi
cmpq %rsi, 0x18(%rsp)
ja 0x1e5543
movl 0x10(%r11), %ebp
movl 0x14(%r11), %r15d
movq %rsi, 0x10(%rsp)
movq %rbx, %rsi
movl %r15d, 0x8(%rsp)
movl %r15d, %ebx
movl %ebp, 0xc(%rsp)
subl %ebp, %ebx
movl 0x34(%rsp), %ebp
movq %rbx, 0x70(%rsp)
cmpq %rbx, 0x18(%rsp)
movq %rsi, %rbx
movq 0x10(%rsp), %rsi
ja 0x1e5543
cmpl $0x0, (%r8,%rdi,8)
js 0x1e5543
movq 0x40(%rsp), %r8
movq (%r8), %r8
movq %r8, 0x58(%rsp)
movq (%r8), %r8
movl (%r8,%rdi,4), %r15d
movl 0x4(%r8,%rdi,4), %r8d
movq %r15, 0x60(%rsp)
subl %r15d, %r8d
movq %r8, 0x68(%rsp)
je 0x1e5543
leaq 0xb0c22(%rip), %r8      # 0x296230
movq 0x18(%r8), %r15
movl (%r15,%rdi,8), %edi
subl 0x8(%rsp), %edi
testl %r13d, %r13d
movl 0xc(%rsp), %r13d
movl %r13d, %r8d
cmovnsl %edi, %r8d
cmovnsl %r13d, %edi
cmpl %eax, %edi
movl %eax, %r13d
movl %edi, 0xc(%rsp)
cmovll %edi, %r13d
movl (%r15,%rdx,8), %edx
movl %edx, 0x30(%rsp)
subl %ebx, %edx
cmpl %r8d, %edx
movl %r8d, 0x8(%rsp)
movl %r8d, %edi
cmovll %edx, %edi
cmpl 0x38(%rsp), %r13d
jg 0x1e5543
cmpl 0x38(%rsp), %edi
jg 0x1e5543
movq %rbx, 0x20(%rsp)
movl %esi, %ebx
cvtsi2ss %rbx, %xmm1
addl %r13d, %edi
addl %edi, %esi
cvtsi2ss %rsi, %xmm2
leaq 0xb00d4(%rip), %rbx     # 0x295758
movss 0x158(%rbx), %xmm0
mulss %xmm0, %xmm2
ucomiss %xmm1, %xmm2
ja 0x1e5543
movq 0x70(%rsp), %r8
movl %r8d, %ebx
xorps %xmm1, %xmm1
cvtsi2ss %rbx, %xmm1
addl %r8d, %edi
xorps %xmm2, %xmm2
cvtsi2ss %rdi, %xmm2
mulss %xmm2, %xmm0
ucomiss %xmm1, %xmm0
ja 0x1e5543
cmpl 0x8(%rsp), %edx
setl %dl
setg %bl
cmpl 0xc(%rsp), %eax
setg %r8b
setl %r13b
orb %bl, %r8b
cmpb $0x1, %r8b
jne 0x1e5543
orb %dl, %r13b
je 0x1e5543
cmpl 0x18(%rsp), %esi
jl 0x1e5543
cmpl 0x18(%rsp), %edi
jl 0x1e5543
movl 0x8(%rsp), %edx
addl 0x20(%rsp), %edx
movl 0x30(%rsp), %edi
subl %edx, %edi
movl %eax, %esi
subl 0xc(%rsp), %esi
cmovlel %edi, %esi
testl %esi, %esi
js 0x1e5543
movq 0x60(%rsp), %rbx
shlq $0x3, %rbx
movq 0x58(%rsp), %rdx
addq 0x18(%rdx), %rbx
movl %eax, %r13d
subq $-0x80, 0x20(%rsp)
xorl %edx, %edx
movq %r13, 0x10(%rsp)
movq (%r14,%rdx,8), %rsi
movq 0x50(%rsp), %rdi
movq 0x20(%rdi), %rdi
movl %esi, %r8d
cmpl $0x0, (%rdi,%r8,8)
jns 0x1e58e0
movq %rsi, %r8
shrq $0x21, %r8
leal 0x80(%r8), %edi
cmpl %edi, %r13d
movq 0x68(%rsp), %rax
ja 0x1e57c4
movq 0x8(%r14,%rdx,8), %rdi
shrq $0x21, %rdi
cmpq %rdi, 0x20(%rsp)
jb 0x1e57c4
xorl %r13d, %r13d
cmpl %esi, (%rbx,%r13,8)
je 0x1e5799
addq $0x2, %r13
cmpq %rax, %r13
jb 0x1e5788
jmp 0x1e57bf
movq %rcx, %rsi
movl $0x3fffffff, %eax       # imm = 0x3FFFFFFF
andq %rax, %rsi
subq %r8, %rdi
addq %rsi, %rdi
cmpq %rax, %rdi
cmovaeq %rax, %rdi
andq $-0x40000000, %rcx      # imm = 0xC0000000
orq %rdi, %rcx
movq %rcx, 0x18(%r11)
movq 0x10(%rsp), %r13
addq $0x2, %rdx
cmpq 0x28(%rsp), %rdx
jb 0x1e5742
jmp 0x1e5543
movq 0x28(%rsp), %rax
leaq (%r14,%rax,8), %rsi
movq %r14, %rdi
callq 0x19dd99
cmpl %r12d, %ebp
je 0x1e5836
movq 0x28(%rsp), %r8
cmpq $0x1, %r8
adcq $0x0, %r8
xorl %eax, %eax
movabsq $0x7fffffff00000000, %rcx # imm = 0x7FFFFFFF00000000
xorl %edx, %edx
movq (%r14,%rax,8), %rsi
btq $0x20, %rsi
movl $0x0, %edi
sbbq %rdi, %rdi
orq $0x1, %rdi
addq %rdi, %rdx
shrq %rsi
andq %rcx, %rsi
addq %rdx, %rsi
movq %rsi, (%r14,%rax,8)
incq %rax
cmpq %rax, %r8
jne 0x1e5809
leaq (%rbx,%rbx,2), %rcx
movl 0xc(%r13,%rcx,8), %eax
testl %eax, %eax
je 0x1e58ce
leaq (,%rcx,8), %r14
addq %r13, %r14
movl $0x18, %r15d
xorl %r12d, %r12d
movq (%r14), %rbp
movq -0x18(%rbp,%r15), %rdx
shrq $0x20, %rdx
movl -0xc(%rbp,%r15), %esi
cmpq %rsi, %rdx
ja 0x1e58c0
testl $0x3fffffff, (%rbp,%r15) # imm = 0x3FFFFFFF
je 0x1e58c0
leaq (%rsi,%rsi,2), %rax
leaq (,%rax,8), %rbx
addq %r13, %rbx
movq %rbx, %rdi
callq 0xa0c99
movq (%rbp,%r15), %rcx
andl $0x3fffffff, %ecx       # imm = 0x3FFFFFFF
movq (%rbx), %rdx
leaq (%rax,%rax,4), %rax
movq 0x18(%rdx,%rax,8), %rsi
movq $-0x40000000, %rdi      # imm = 0xC0000000
andq %rdi, %rsi
orq %rcx, %rsi
movq %rsi, 0x18(%rdx,%rax,8)
movl 0xc(%r14), %eax
incq %r12
movl %eax, %ecx
addq $0x28, %r15
cmpq %rcx, %r12
jb 0x1e585b
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x5f8b7(%rip), %rdi     # 0x24519e
leaq 0x5a36d(%rip), %rsi     # 0x23fc5b
leaq 0x5f8c7(%rip), %rcx     # 0x2451bc
movl $0x5252, %edx           # imm = 0x5252
callq 0x2110