// File: /workspace/github_cpp_makefile_star2_O2/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 $0x78, %rsp
movq %rsi, %r10
movq 0x8(%rdi), %rbp
movq (%rdi), %rax
movq (%rax), %rcx
movl (%rcx,%rsi,4), %r8d
movl 0x4(%rcx,%rsi,4), %ecx
movq %r8, %r11
shlq $0x3, %r11
movl %ecx, 0x1c(%rsp)
movl %ecx, %r15d
subl %r8d, %r15d
addq 0x18(%rax), %r11
cmpq $0x0, 0x30(%rdi)
je 0x19908e
movq %r15, 0x50(%rsp)
movq 0x10(%rdi), %rax
movq %rax, 0x10(%rsp)
movq 0x38(%rdi), %rax
movq %rax, 0x30(%rsp)
movl 0x18(%rdi), %eax
movl %eax, 0x18(%rsp)
movq 0x28(%rdi), %rax
movq %rax, 0x20(%rsp)
movq %rdi, 0x48(%rsp)
movq 0x20(%rdi), %rax
movq %rax, 0x58(%rsp)
imulq $0x18, %r10, %rax
addq %rax, %rbp
xorl %r12d, %r12d
movl 0xc(%rbp), %eax
cmpq %rax, %r12
jae 0x19915b
movq (%rbp), %r13
imulq $0x28, %r12, %rax
movq 0x18(%r13,%rax), %rsi
movq %rsi, %rbx
andq $-0x40000000, %rbx      # imm = 0xC0000000
movq %rbx, 0x18(%r13,%rax)
cmpl %r8d, 0x1c(%rsp)
je 0x198f02
movq 0x30(%rsp), %rcx
movq 0x20(%rcx), %rdx
cmpl $0x0, (%rdx,%r10,8)
js 0x198f02
addq %rax, %r13
movq (%r13), %rax
movq %rax, 0x28(%rsp)
shrq $0x20, %rax
movl 0xc(%r13), %ecx
cmpq %rcx, %rax
jbe 0x198f07
incq %r12
jmp 0x198eaa
cmpq $0x0, 0x58(%rsp)
je 0x198f2e
cmpq $0x0, 0x20(%rsp)
setne %dil
testq %rsi, %rsi
setns %sil
cmpb $0x0, 0x20(%r13)
je 0x198f02
andb %sil, %dil
je 0x198f3b
jmp 0x198f02
cmpq $0x0, 0x20(%rsp)
je 0x198f3b
testq %rsi, %rsi
jns 0x198f02
movl 0x8(%r13), %r9d
movl %r9d, %esi
subl 0x28(%rsp), %esi
cmpq %rsi, 0x10(%rsp)
ja 0x198f02
movl 0x14(%r13), %esi
subl 0x10(%r13), %esi
cmpq %rsi, 0x10(%rsp)
ja 0x198f02
cmpl $0x0, (%rdx,%rcx,8)
js 0x198f02
movq 0x48(%rsp), %rdx
movq (%rdx), %rdx
movq (%rdx), %rsi
movl (%rsi,%rcx,4), %r15d
movl 0x4(%rsi,%rcx,4), %r14d
subl %r15d, %r14d
je 0x198f02
shlq $0x3, %r15
addq 0x18(%rdx), %r15
leaq 0xbb2a6(%rip), %rdx     # 0x254230
movq 0x18(%rdx), %rdx
movl (%rdx,%rax,8), %esi
movl (%rdx,%rcx,8), %edx
leaq 0xba7bd(%rip), %rax     # 0x253758
movss 0x158(%rax), %xmm0
movq %r13, %rdi
movl 0x18(%rsp), %ecx
movq %r8, (%rsp)
movq 0x10(%rsp), %r8
movq %r9, 0x38(%rsp)
leaq 0x60(%rsp), %r9
movq %r10, 0x40(%rsp)
movq %r11, 0x8(%rsp)
callq 0x15d560
movq 0x38(%rsp), %r9
movq (%rsp), %r8
movq 0x8(%rsp), %r11
movq 0x40(%rsp), %r10
testl %eax, %eax
js 0x198f02
movl 0x28(%rsp), %eax
subq $-0x80, %r9
xorl %ecx, %ecx
cmpq 0x50(%rsp), %rcx
jae 0x198f02
movq (%r11,%rcx,8), %rdx
movq 0x30(%rsp), %rsi
movq 0x20(%rsi), %rsi
movl %edx, %edi
cmpl $0x0, (%rsi,%rdi,8)
jns 0x19916a
movq %rdx, %rdi
shrq $0x21, %rdi
leal 0x80(%rdi), %esi
cmpl %esi, %eax
ja 0x199085
movq 0x8(%r11,%rcx,8), %rsi
shrq $0x21, %rsi
cmpq %rsi, %r9
jb 0x199085
movq %rax, %r11
movq %r9, %rax
xorl %r8d, %r8d
cmpq %r14, %r8
jae 0x199076
leaq 0x2(%r8), %r9
cmpl %edx, (%r15,%r8,8)
movq %r9, %r8
jne 0x19903d
movq %rbx, %rdx
movl $0x3fffffff, %r8d       # imm = 0x3FFFFFFF
andq %r8, %rdx
subq %rdi, %rsi
addq %rdx, %rsi
cmpq %r8, %rsi
cmovaeq %r8, %rsi
andq $-0x40000000, %rbx      # imm = 0xC0000000
orq %rsi, %rbx
movq %rbx, 0x18(%r13)
movq (%rsp), %r8
movq %rax, %r9
movq %r11, %rax
movq 0x8(%rsp), %r11
addq $0x2, %rcx
jmp 0x198ff1
leaq (%r11,%r15,8), %rsi
movq %r11, %rdi
movq %r10, %rbx
movq %r11, %r14
callq 0x156b0d
movq %r14, %r9
movq %rbx, %r8
xorl %eax, %eax
movabsq $0x7fffffff00000000, %rcx # imm = 0x7FFFFFFF00000000
xorl %edx, %edx
cmpq %rdx, %r15
je 0x1990e3
movq (%r9,%rdx,8), %rsi
btq $0x20, %rsi
movl $0x0, %edi
sbbq %rdi, %rdi
orq $0x1, %rdi
addq %rdi, %rax
shrq %rsi
andq %rcx, %rsi
addq %rax, %rsi
movq %rsi, (%r9,%rdx,8)
incq %rdx
jmp 0x1990b4
imulq $0x18, %r8, %rbx
addq %rbp, %rbx
pushq $0x18
popq %r14
xorl %r15d, %r15d
movl 0xc(%rbx), %eax
cmpq %rax, %r15
jae 0x19915b
movq (%rbx), %r13
movq -0x18(%r13,%r14), %rdx
shrq $0x20, %rdx
movl -0xc(%r13,%r14), %esi
cmpq %rsi, %rdx
ja 0x199152
testl $0x3fffffff, (%r13,%r14) # imm = 0x3FFFFFFF
je 0x199152
imulq $0x18, %rsi, %r12
leaq (%r12,%rbp), %rdi
callq 0x696ab
movq (%r13,%r14), %rcx
andl $0x3fffffff, %ecx       # imm = 0x3FFFFFFF
movq (%rbp,%r12), %rdx
imulq $0x28, %rax, %rax
movq 0x18(%rdx,%rax), %rsi
movq $-0x40000000, %rdi      # imm = 0xC0000000
andq %rdi, %rsi
orq %rcx, %rsi
movq %rsi, 0x18(%rdx,%rax)
incq %r15
addq $0x28, %r14
jmp 0x1990f1
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x5def5(%rip), %rdi     # 0x1f7066
leaq 0x589ab(%rip), %rsi     # 0x1f1b23
leaq 0x5df05(%rip), %rcx     # 0x1f7084
movl $0x5252, %edx           # imm = 0x5252
callq 0x2110