// File: /workspace/github_cpp_makefile_star2_O3/chhylp123[P]hifiasm/inter.cpp
// Function: worker_for_sysm_trans_ovlp(void*, long, int)
static void worker_for_sysm_trans_ovlp(void *data, long i, int tid) // callback for kt_for()
{
	ug_trans_t *s = (ug_trans_t*)data; 
	uint64_t k; ul_ov_t *z; double w0, w1;
	ha_mzl_t *f = &(s->srt_a.a[i]);
	if(!(f->rev)) return;
	kv_ul_ov_t *bl = &(s->ll[(uint32_t)(f->x)].tk);
	k = f->rid; k <<= 32; k += f->pos;
	// if(!(bl->a[k].qn == (f->x>>32))) {
	// 	fprintf(stderr, "[M::%s::] k::%lu, bl->a[k].qn::%u, (f->x>>32)::%lu, (uint32_t)(f->x)::%u\n", 
	// 				__func__, k, bl->a[k].qn, (f->x>>32), (uint32_t)(f->x));
	// }
    assert(bl->a[k].qn == (f->x>>32));
	for (; (k < bl->n) && (bl->a[k].qn == (f->x>>32)); k++) {
		if(bl->a[k].qn == bl->a[k].tn) {
			bl->a[k].qs = bl->a[k].qe = (uint32_t)-1;
			continue;
		}

		w0 = cal_trans_ov_w(&(bl->a[k]));
		z = get_trans_ul_ov_t(s, bl->a[k].tn, bl->a[k].qn);
		if(!z) {
			if((!(s->keep_unsymm_arc)) || (w0 <= 0)) { 
				bl->a[k].qs = bl->a[k].qe = (uint32_t)-1;
			}
			continue;
		}
		if(bl->a[k].qn > bl->a[k].tn) continue;
		
		w1 = cal_trans_ov_w(z);
		if(w0 <= 0 && w1 <= 0) {
			bl->a[k].qs = bl->a[k].qe = (uint32_t)-1;
			z->qs = z->qe = (uint32_t)-1;
			continue;
		}
		if(w0 > w1) {
			// (*z) = bl->a[k];///cannot copy, this will affect tn&&qn
			z->qs = bl->a[k].ts; z->qe = bl->a[k].te;
			z->ts = bl->a[k].qs; z->te = bl->a[k].qe;
			z->sec = bl->a[k].sec; z->el = bl->a[k].el; z->rev = bl->a[k].rev;
			// z->qn = bl->a[k].tn; z->tn = bl->a[k].qn;
		} else {
			// bl->a[k] = (*z);///cannot copy, this will affect tn&&qn
			bl->a[k].ts = z->qs; bl->a[k].te = z->qe;
			bl->a[k].qs = z->ts; bl->a[k].qe = z->te;
			bl->a[k].sec = z->sec; bl->a[k].el = z->el; bl->a[k].rev = z->rev;
			// bl->a[k].tn = z->qn; bl->a[k].qn = z->tn;
		}
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq 0x98(%rdi), %rcx
leaq (%rsi,%rsi,2), %rdx
movq 0x8(%rcx,%rdx,8), %rax
testl %eax, %eax
jns 0x1e8c10
movq %rdi, %rbx
leaq (%rcx,%rdx,8), %r14
movq 0x20(%rdi), %rcx
movq (%r14), %rsi
movl %esi, %edx
imulq $0x68, %rdx, %rdx
movq %rax, %r15
rolq $0x20, %r15
btrq $0x3f, %r15
movq 0x18(%rcx,%rdx), %rdi
leaq (%r15,%r15,8), %r8
leaq (%r8,%r8,2), %r8
addq %r15, %r8
shrq $0x20, %rsi
cmpl (%rdi,%r8), %esi
jne 0x1e8c1f
leaq (%rcx,%rdx), %r12
addq $0x18, %r12
cmpq 0x8(%r12), %r15
jae 0x1e8c10
movq %rax, %rcx
shrq $0x20, %rcx
movabsq $0x1c00000000, %rdx     # imm = 0x1C00000000
imulq %rax, %rdx
leaq (%rcx,%rcx,8), %rax
leaq (%rax,%rax,2), %r13
addq %rcx, %r13
addq %rdx, %r13
movl $0x3fffffff, %ebp       # imm = 0x3FFFFFFF
movq (%r12), %rax
movl (%rax,%r13), %edx
cmpl %edx, 0x4(%r14)
jne 0x1e8c10
movl 0xc(%rax,%r13), %esi
cmpl %esi, %edx
jne 0x1e89fc
movq $-0x1, 0x4(%rax,%r13)
jmp 0x1e8bfe
movl 0x8(%rax,%r13), %ecx
subl 0x4(%rax,%r13), %ecx
xorps %xmm0, %xmm0
cvtsi2sd %rcx, %xmm0
movl 0x18(%rax,%r13), %ecx
andl %ebp, %ecx
xorps %xmm1, %xmm1
cvtsi2sd %ecx, %xmm1
movl 0x14(%rax,%r13), %ecx
subsd %xmm1, %xmm0
subl 0x10(%rax,%r13), %ecx
xorps %xmm2, %xmm2
cvtsi2sd %rcx, %xmm2
subsd %xmm1, %xmm2
mulsd 0x4d33a(%rip), %xmm1    # 0x235d78
addsd %xmm1, %xmm0
addsd %xmm1, %xmm2
movapd %xmm0, %xmm1
cmplesd %xmm2, %xmm1
andpd %xmm1, %xmm0
andnpd %xmm2, %xmm1
orpd %xmm0, %xmm1
movapd %xmm1, (%rsp)
movq %rbx, %rdi
callq 0x1cd16b
testq %rax, %rax
je 0x1e8b12
movapd (%rsp), %xmm4
movq (%r12), %rcx
movl (%rcx,%r13), %edx
cmpl 0xc(%rcx,%r13), %edx
xorpd %xmm3, %xmm3
ja 0x1e8bfe
movl 0x4(%rax), %edi
movl 0x8(%rax), %esi
movl %esi, %edx
subl %edi, %edx
xorps %xmm1, %xmm1
cvtsi2sd %rdx, %xmm1
movl 0x18(%rax), %edx
movl %edx, %r8d
andl $0x3fffffff, %r8d       # imm = 0x3FFFFFFF
xorps %xmm0, %xmm0
cvtsi2sd %r8d, %xmm0
subsd %xmm0, %xmm1
movl 0x14(%rax), %r8d
subl 0x10(%rax), %r8d
xorps %xmm2, %xmm2
cvtsi2sd %r8, %xmm2
subsd %xmm0, %xmm2
mulsd 0x4d2a4(%rip), %xmm0    # 0x235d78
addsd %xmm0, %xmm1
addsd %xmm0, %xmm2
movapd %xmm1, %xmm0
cmplesd %xmm2, %xmm0
andpd %xmm0, %xmm1
andnpd %xmm2, %xmm0
orpd %xmm1, %xmm0
ucomisd %xmm4, %xmm3
jb 0x1e8b33
ucomisd %xmm0, %xmm3
jb 0x1e8b33
movq $-0x1, %rdx
movq %rdx, 0x4(%rcx,%r13)
movq %rdx, 0x4(%rax)
jmp 0x1e8bfe
xorpd %xmm0, %xmm0
ucomisd (%rsp), %xmm0
jae 0x1e8b2a
cmpl $0x0, 0xc4(%rbx)
jne 0x1e8bfe
movq (%r12), %rax
jmp 0x1e89ee
ucomisd %xmm0, %xmm4
jbe 0x1e8b91
movq 0x10(%rcx,%r13), %rsi
movq %rsi, 0x4(%rax)
movq 0x4(%rcx,%r13), %rsi
movq %rsi, 0x10(%rax)
movl 0x18(%rcx,%r13), %ecx
andl %ebp, %ecx
andl $0xc0000000, %edx       # imm = 0xC0000000
orl %ecx, %edx
movl %edx, 0x18(%rax)
movq (%r12), %rsi
movl 0x18(%rsi,%r13), %esi
movl $0x40000000, %edi       # imm = 0x40000000
andl %edi, %esi
andl $0xbfffffff, %edx       # imm = 0xBFFFFFFF
orl %esi, %edx
movl %edx, 0x18(%rax)
movq (%r12), %rdx
movl 0x18(%rdx,%r13), %edx
movl $0x80000000, %edi       # imm = 0x80000000
andl %edi, %edx
orl %ecx, %edx
orl %esi, %edx
movl %edx, 0x18(%rax)
jmp 0x1e8bfe
movl %edi, 0x10(%rcx,%r13)
movl %esi, 0x14(%rcx,%r13)
movq 0x10(%rax), %rdx
movq %rdx, 0x4(%rcx,%r13)
movl 0x18(%rax), %edx
andl %ebp, %edx
movl 0x18(%rcx,%r13), %esi
movl $0xc0000000, %edi       # imm = 0xC0000000
andl %edi, %esi
orl %edx, %esi
movl %esi, 0x18(%rcx,%r13)
movl 0x18(%rax), %ecx
movl $0x40000000, %edx       # imm = 0x40000000
andl %edx, %ecx
movq (%r12), %rdx
movl 0x18(%rdx,%r13), %esi
movl $0xbfffffff, %edi       # imm = 0xBFFFFFFF
andl %edi, %esi
orl %ecx, %esi
movl %esi, 0x18(%rdx,%r13)
movl 0x18(%rax), %eax
movl $0x80000000, %ecx       # imm = 0x80000000
andl %ecx, %eax
movq (%r12), %rcx
movl 0x18(%rcx,%r13), %edx
movl $0x7fffffff, %esi       # imm = 0x7FFFFFFF
andl %esi, %edx
orl %eax, %edx
movl %edx, 0x18(%rcx,%r13)
incq %r15
addq $0x1c, %r13
cmpq 0x8(%r12), %r15
jb 0x1e89d3
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x5948b(%rip), %rdi     # 0x2420b1
leaq 0x5702e(%rip), %rsi     # 0x23fc5b
leaq 0x5c6b1(%rip), %rcx     # 0x2452e5
movl $0x3128, %edx           # imm = 0x3128
callq 0x2110