// File: /workspace/github_cpp_makefile_star2_O1/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, %r9
movq 0x8(%rdi), %r13
movq (%rdi), %rax
movq (%rax), %rcx
movl (%rcx,%rsi,4), %r12d
movl 0x4(%rcx,%rsi,4), %r11d
movq %r12, %r14
shlq $0x3, %r14
movl %r11d, %r10d
subl %r12d, %r10d
addq 0x18(%rax), %r14
movq %rdi, 0x18(%rsp)
cmpq $0x0, 0x30(%rdi)
je 0x1db365
leaq (%r9,%r9,2), %rax
cmpl $0x0, 0xc(%r13,%rax,8)
je 0x1db45a
movq 0x18(%rsp), %rcx
movq 0x10(%rcx), %r8
movq 0x20(%rcx), %rdx
movq %rdx, 0x60(%rsp)
movq 0x28(%rcx), %rdx
movq %rdx, 0x28(%rsp)
movq 0x18(%rcx), %rdx
movq %rdx, 0x48(%rsp)
movq 0x38(%rcx), %rcx
movq %rcx, 0x30(%rsp)
leaq (,%rax,8), %rbx
addq %r13, %rbx
xorl %r13d, %r13d
movq (%rbx), %rax
leaq (,%r13,4), %rcx
addq %r13, %rcx
movq 0x18(%rax,%rcx,8), %rsi
movq %rsi, %rdx
andq $-0x40000000, %rdx      # imm = 0xC0000000
movq %rdx, 0x18(%rax,%rcx,8)
cmpl %r12d, %r11d
je 0x1db1a3
movq 0x30(%rsp), %rdx
movq 0x20(%rdx), %rdx
cmpl $0x0, (%rdx,%r9,8)
js 0x1db1a3
leaq (%rax,%rcx,8), %rbp
movq (%rbp), %r15
movq %r15, %rax
shrq $0x20, %rax
movl 0xc(%rbp), %ecx
cmpq %rcx, %rax
jbe 0x1db1b3
incq %r13
movl 0xc(%rbx), %eax
cmpq %rax, %r13
jb 0x1db155
jmp 0x1db45a
cmpq $0x0, 0x60(%rsp)
je 0x1db1d9
cmpq $0x0, 0x28(%rsp)
setne %dil
testq %rsi, %rsi
setns %sil
cmpb $0x0, 0x20(%rbp)
je 0x1db1a3
andb %sil, %dil
je 0x1db1e6
jmp 0x1db1a3
cmpq $0x0, 0x28(%rsp)
je 0x1db1e6
testq %rsi, %rsi
jns 0x1db1a3
movl 0x8(%rbp), %esi
movq %rsi, 0x20(%rsp)
subl %r15d, %esi
cmpq %rsi, %r8
ja 0x1db1a3
movl 0x14(%rbp), %esi
subl 0x10(%rbp), %esi
cmpq %rsi, %r8
ja 0x1db1a3
cmpl $0x0, (%rdx,%rcx,8)
js 0x1db1a3
movq 0x18(%rsp), %rdx
movq (%rdx), %rdx
movq (%rdx), %rsi
movl (%rsi,%rcx,4), %edi
movl 0x4(%rsi,%rcx,4), %esi
movl %esi, 0xc(%rsp)
movq %rdi, 0x10(%rsp)
subl %edi, %esi
movq %rsi, 0x58(%rsp)
je 0x1db1a3
movq 0x10(%rsp), %rsi
shlq $0x3, %rsi
addq 0x18(%rdx), %rsi
movq %rsi, 0x68(%rsp)
leaq 0xaffe8(%rip), %rdx     # 0x28b230
movq 0x18(%rdx), %rdx
movl (%rdx,%rax,8), %esi
movl (%rdx,%rcx,8), %edx
leaq 0xaf4ff(%rip), %rax     # 0x28a758
movss 0x158(%rax), %xmm0
movq %rbp, %rdi
movq 0x48(%rsp), %rcx
movq %r8, (%rsp)
movq (%rsp), %r8
movq %r9, 0x40(%rsp)
leaq 0x70(%rsp), %r9
movq %r10, 0x38(%rsp)
movl %r11d, 0x8(%rsp)
callq 0x19c0d3
movq (%rsp), %r8
movl 0x8(%rsp), %r11d
movq 0x38(%rsp), %r10
movq 0x40(%rsp), %r9
testl %eax, %eax
js 0x1db1a3
cmpl %r12d, %r11d
je 0x1db1a3
movl %r15d, %eax
movq %rax, 0x50(%rsp)
subq $-0x80, 0x20(%rsp)
xorl %ecx, %ecx
movq (%r14,%rcx,8), %rdx
movq 0x30(%rsp), %rsi
movq 0x20(%rsi), %rsi
movl %edx, %edi
cmpl $0x0, (%rsi,%rdi,8)
jns 0x1db46c
movq %rdx, %rdi
shrq $0x21, %rdi
leal 0x80(%rdi), %esi
cmpl %esi, 0x50(%rsp)
movq 0x58(%rsp), %r15
ja 0x1db34f
movq 0x8(%r14,%rcx,8), %rsi
shrq $0x21, %rsi
cmpq %rsi, 0x20(%rsp)
jb 0x1db34f
movl 0xc(%rsp), %r8d
cmpl 0x10(%rsp), %r8d
je 0x1db34f
xorl %r8d, %r8d
movq 0x68(%rsp), %rax
cmpl %edx, (%rax,%r8,8)
je 0x1db324
addq $0x2, %r8
cmpq %r15, %r8
jb 0x1db30e
jmp 0x1db34f
movq 0x18(%rbp), %rdx
movq %rdx, %r8
movl $0x3fffffff, %r15d      # imm = 0x3FFFFFFF
andq %r15, %r8
subq %rdi, %rsi
addq %r8, %rsi
cmpq %r15, %rsi
cmovaeq %r15, %rsi
andq $-0x40000000, %rdx      # imm = 0xC0000000
orq %rsi, %rdx
movq %rdx, 0x18(%rbp)
addq $0x2, %rcx
cmpq %r10, %rcx
movq (%rsp), %r8
jb 0x1db2be
jmp 0x1db1a3
movq %r9, %rbx
leaq (%r14,%r10,8), %rsi
movq %r14, %rdi
movq %r10, %r15
movl %r11d, %ebp
callq 0x194fef
cmpl %r12d, %ebp
je 0x1db3c5
movq %r15, %r8
cmpq $0x1, %r15
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 0x1db398
leaq (%rbx,%rbx,2), %rax
cmpl $0x0, 0xc(%r13,%rax,8)
je 0x1db45a
leaq (,%rax,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 0x1db44a
testl $0x3fffffff, (%rbp,%r15) # imm = 0x3FFFFFFF
je 0x1db44a
leaq (%rsi,%rsi,2), %rax
leaq (,%rax,8), %rbx
addq %r13, %rbx
movq %rbx, %rdi
callq 0xa04f9
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)
incq %r12
movl 0xc(%r14), %eax
addq $0x28, %r15
cmpq %rax, %r12
jb 0x1db3e9
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x5da5b(%rip), %rdi     # 0x238ece
leaq 0x58511(%rip), %rsi     # 0x23398b
leaq 0x5da6b(%rip), %rcx     # 0x238eec
movl $0x5252, %edx           # imm = 0x5252
callq 0x2110