// File: /workspace/github_cpp_makefile_star2_O2/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
pushq %rax
movq 0x98(%rdi), %r15
imulq $0x18, %rsi, %rcx
movq 0x8(%r15,%rcx), %rax
testl %eax, %eax
js 0x19dc91
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rdi, %rbx
addq %rcx, %r15
movq 0x20(%rdi), %rcx
movq (%r15), %rsi
movl %esi, %edx
imulq $0x68, %rdx, %rdx
movq %rax, %r12
rolq $0x20, %r12
btrq $0x3f, %r12
movq 0x18(%rcx,%rdx), %rdi
imulq $0x1c, %r12, %r8
shrq $0x20, %rsi
cmpl (%rdi,%r8), %esi
jne 0x19de8a
leaq (%rcx,%rdx), %r13
addq $0x18, %r13
movq %rax, %rcx
shrq $0x20, %rcx
movabsq $0x1c00000000, %rdx     # imm = 0x1C00000000
imulq %rax, %rdx
imulq $0x1c, %rcx, %rbp
addq %rdx, %rbp
cmpq 0x8(%r13), %r12
jae 0x19dc82
movq (%r13), %rdi
movl (%rdi,%rbp), %eax
cmpl %eax, 0x4(%r15)
jne 0x19dc82
cmpl 0xc(%rdi,%rbp), %eax
jne 0x19dd0f
orq $-0x1, 0x4(%rdi,%rbp)
jmp 0x19de7e
addq %rbp, %rdi
callq 0x1a37c3
movsd %xmm0, (%rsp)
movq (%r13), %rax
movl (%rax,%rbp), %edx
movl 0xc(%rax,%rbp), %esi
movq %rbx, %rdi
callq 0x181564
testq %rax, %rax
je 0x19dd79
movq %rax, %r14
movq (%r13), %rax
movl (%rax,%rbp), %ecx
cmpl 0xc(%rax,%rbp), %ecx
ja 0x19de7e
movq %r14, %rdi
callq 0x1a37c3
xorpd %xmm1, %xmm1
movsd (%rsp), %xmm2
ucomisd %xmm2, %xmm1
jb 0x19dda0
ucomisd %xmm0, %xmm1
jb 0x19dda0
movq (%r13), %rax
orq $-0x1, 0x4(%rax,%rbp)
orq $-0x1, 0x4(%r14)
jmp 0x19de7e
xorpd %xmm0, %xmm0
ucomisd (%rsp), %xmm0
jae 0x19dd91
cmpl $0x0, 0xc4(%rbx)
jne 0x19de7e
movq (%r13), %rax
orq $-0x1, 0x4(%rax,%rbp)
jmp 0x19de7e
ucomisd %xmm0, %xmm2
jbe 0x19de0c
movq (%r13), %rax
movq 0x10(%rax,%rbp), %rcx
movq %rcx, 0x4(%r14)
movq 0x4(%rax,%rbp), %rcx
movq %rcx, 0x10(%r14)
movl 0x18(%rax,%rbp), %eax
movl $0x3fffffff, %ecx       # imm = 0x3FFFFFFF
andl %ecx, %eax
movl 0x18(%r14), %ecx
movl $0xc0000000, %edx       # imm = 0xC0000000
andl %edx, %ecx
orl %eax, %ecx
movl %ecx, 0x18(%r14)
movq (%r13), %rdx
movl 0x18(%rdx,%rbp), %edx
movl $0x40000000, %esi       # imm = 0x40000000
andl %esi, %edx
andl $0xbfffffff, %ecx       # imm = 0xBFFFFFFF
orl %edx, %ecx
movl %ecx, 0x18(%r14)
movq (%r13), %rcx
movl 0x18(%rcx,%rbp), %ecx
movl $0x80000000, %esi       # imm = 0x80000000
andl %esi, %ecx
orl %eax, %ecx
orl %edx, %ecx
movl %ecx, 0x18(%r14)
jmp 0x19de7e
movq (%r13), %rax
movq 0x4(%r14), %rcx
movq %rcx, 0x10(%rax,%rbp)
movq 0x10(%r14), %rcx
movq %rcx, 0x4(%rax,%rbp)
movl 0x18(%r14), %ecx
movl $0x3fffffff, %edx       # imm = 0x3FFFFFFF
andl %edx, %ecx
movl 0x18(%rax,%rbp), %edx
movl $0xc0000000, %esi       # imm = 0xC0000000
andl %esi, %edx
orl %ecx, %edx
movl %edx, 0x18(%rax,%rbp)
movl 0x18(%r14), %eax
movl $0x40000000, %ecx       # imm = 0x40000000
andl %ecx, %eax
movq (%r13), %rcx
movl 0x18(%rcx,%rbp), %edx
movl $0xbfffffff, %esi       # imm = 0xBFFFFFFF
andl %esi, %edx
orl %eax, %edx
movl %edx, 0x18(%rcx,%rbp)
movl 0x18(%r14), %eax
movl $0x80000000, %ecx       # imm = 0x80000000
andl %ecx, %eax
movq (%r13), %rcx
movl 0x18(%rcx,%rbp), %edx
movl $0x7fffffff, %esi       # imm = 0x7FFFFFFF
andl %esi, %edx
orl %eax, %edx
movl %edx, 0x18(%rcx,%rbp)
incq %r12
addq $0x1c, %rbp
jmp 0x19dceb
leaq 0x560e8(%rip), %rdi     # 0x1f3f79
leaq 0x53c8b(%rip), %rsi     # 0x1f1b23
leaq 0x5930e(%rip), %rcx     # 0x1f71ad
movl $0x3128, %edx           # imm = 0x3128
callq 0x2110