// File: 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
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq 0x98(%rax), %rax
imulq $0x18, -0x10(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
movq 0x8(%rax), %rax
shrq $0x1f, %rax
andq $0x1, %rax
cmpq $0x0, %rax
jne 0x302f9d
jmp 0x303402
movq -0x20(%rbp), %rax
movq 0x20(%rax), %rax
movq -0x48(%rbp), %rcx
movq (%rcx), %rcx
movl %ecx, %ecx
imulq $0x68, %rcx, %rcx
addq %rcx, %rax
addq $0x18, %rax
movq %rax, -0x50(%rbp)
movq -0x48(%rbp), %rax
movq 0x8(%rax), %rax
andq $0x7fffffff, %rax       # imm = 0x7FFFFFFF
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
shlq $0x20, %rax
movq %rax, -0x28(%rbp)
movq -0x48(%rbp), %rax
movq 0x8(%rax), %rax
shrq $0x20, %rax
addq -0x28(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x50(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0x28(%rbp), %rcx
addq %rcx, %rax
movl (%rax), %eax
movq -0x48(%rbp), %rcx
movq (%rcx), %rcx
shrq $0x20, %rcx
cmpq %rcx, %rax
jne 0x303012
jmp 0x303031
leaq 0x8fc6c(%rip), %rdi     # 0x392c85
leaq 0x8d80f(%rip), %rsi     # 0x39082f
movl $0x3128, %edx           # imm = 0x3128
leaq 0x92e8d(%rip), %rcx     # 0x395eb9
callq 0x2130
jmp 0x303033
movq -0x28(%rbp), %rcx
movq -0x50(%rbp), %rdx
xorl %eax, %eax
cmpq 0x8(%rdx), %rcx
movb %al, -0x51(%rbp)
jae 0x30306b
movq -0x50(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0x28(%rbp), %rcx
addq %rcx, %rax
movl (%rax), %eax
movq -0x48(%rbp), %rcx
movq (%rcx), %rcx
shrq $0x20, %rcx
cmpq %rcx, %rax
sete %al
movb %al, -0x51(%rbp)
movb -0x51(%rbp), %al
testb $0x1, %al
jne 0x303077
jmp 0x303402
movq -0x50(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0x28(%rbp), %rcx
addq %rcx, %rax
movl (%rax), %eax
movq -0x50(%rbp), %rcx
movq (%rcx), %rcx
imulq $0x1c, -0x28(%rbp), %rdx
addq %rdx, %rcx
cmpl 0xc(%rcx), %eax
jne 0x3030cd
movq -0x50(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0x28(%rbp), %rcx
addq %rcx, %rax
movl $0xffffffff, 0x8(%rax)  # imm = 0xFFFFFFFF
movq -0x50(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0x28(%rbp), %rcx
addq %rcx, %rax
movl $0xffffffff, 0x4(%rax)  # imm = 0xFFFFFFFF
jmp 0x3033f1
movq -0x50(%rbp), %rax
movq (%rax), %rdi
imulq $0x1c, -0x28(%rbp), %rax
addq %rax, %rdi
callq 0x30e020
movsd %xmm0, -0x38(%rbp)
movq -0x20(%rbp), %rdi
movq -0x50(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0x28(%rbp), %rcx
addq %rcx, %rax
movl 0xc(%rax), %esi
movq -0x50(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0x28(%rbp), %rcx
addq %rcx, %rax
movl (%rax), %edx
callq 0x2cdc80
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
jne 0x303165
movq -0x20(%rbp), %rax
cmpl $0x0, 0xc4(%rax)
je 0x303134
xorps %xmm0, %xmm0
ucomisd -0x38(%rbp), %xmm0
jb 0x303160
movq -0x50(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0x28(%rbp), %rcx
addq %rcx, %rax
movl $0xffffffff, 0x8(%rax)  # imm = 0xFFFFFFFF
movq -0x50(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0x28(%rbp), %rcx
addq %rcx, %rax
movl $0xffffffff, 0x4(%rax)  # imm = 0xFFFFFFFF
jmp 0x3033f1
movq -0x50(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0x28(%rbp), %rcx
addq %rcx, %rax
movl (%rax), %eax
movq -0x50(%rbp), %rcx
movq (%rcx), %rcx
imulq $0x1c, -0x28(%rbp), %rdx
addq %rdx, %rcx
cmpl 0xc(%rcx), %eax
jbe 0x30318f
jmp 0x3033f1
movq -0x30(%rbp), %rdi
callq 0x30e020
movsd %xmm0, -0x40(%rbp)
xorps %xmm0, %xmm0
ucomisd -0x38(%rbp), %xmm0
jb 0x3031f8
xorps %xmm0, %xmm0
ucomisd -0x40(%rbp), %xmm0
jb 0x3031f8
movq -0x50(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0x28(%rbp), %rcx
addq %rcx, %rax
movl $0xffffffff, 0x8(%rax)  # imm = 0xFFFFFFFF
movq -0x50(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0x28(%rbp), %rcx
addq %rcx, %rax
movl $0xffffffff, 0x4(%rax)  # imm = 0xFFFFFFFF
movq -0x30(%rbp), %rax
movl $0xffffffff, 0x8(%rax)  # imm = 0xFFFFFFFF
movq -0x30(%rbp), %rax
movl $0xffffffff, 0x4(%rax)  # imm = 0xFFFFFFFF
jmp 0x3033f1
movsd -0x38(%rbp), %xmm0
ucomisd -0x40(%rbp), %xmm0
jbe 0x3032fe
movq -0x50(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0x28(%rbp), %rcx
addq %rcx, %rax
movl 0x10(%rax), %ecx
movq -0x30(%rbp), %rax
movl %ecx, 0x4(%rax)
movq -0x50(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0x28(%rbp), %rcx
addq %rcx, %rax
movl 0x14(%rax), %ecx
movq -0x30(%rbp), %rax
movl %ecx, 0x8(%rax)
movq -0x50(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0x28(%rbp), %rcx
addq %rcx, %rax
movl 0x4(%rax), %ecx
movq -0x30(%rbp), %rax
movl %ecx, 0x10(%rax)
movq -0x50(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0x28(%rbp), %rcx
addq %rcx, %rax
movl 0x8(%rax), %ecx
movq -0x30(%rbp), %rax
movl %ecx, 0x14(%rax)
movq -0x50(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0x28(%rbp), %rcx
addq %rcx, %rax
movl 0x18(%rax), %edx
andl $0x3fffffff, %edx       # imm = 0x3FFFFFFF
movq -0x30(%rbp), %rax
movl 0x18(%rax), %ecx
andl $0x3fffffff, %edx       # imm = 0x3FFFFFFF
andl $0xc0000000, %ecx       # imm = 0xC0000000
orl %edx, %ecx
movl %ecx, 0x18(%rax)
movq -0x50(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0x28(%rbp), %rcx
addq %rcx, %rax
movl 0x18(%rax), %edx
shrl $0x1e, %edx
andl $0x1, %edx
movq -0x30(%rbp), %rax
movl 0x18(%rax), %ecx
andl $0x1, %edx
shll $0x1e, %edx
andl $0xbfffffff, %ecx       # imm = 0xBFFFFFFF
orl %edx, %ecx
movl %ecx, 0x18(%rax)
movq -0x50(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0x28(%rbp), %rcx
addq %rcx, %rax
movl 0x18(%rax), %edx
shrl $0x1f, %edx
movq -0x30(%rbp), %rax
movl 0x18(%rax), %ecx
andl $0x1, %edx
shll $0x1f, %edx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
orl %edx, %ecx
movl %ecx, 0x18(%rax)
jmp 0x3033ef
movq -0x30(%rbp), %rax
movl 0x4(%rax), %ecx
movq -0x50(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0x28(%rbp), %rdx
addq %rdx, %rax
movl %ecx, 0x10(%rax)
movq -0x30(%rbp), %rax
movl 0x8(%rax), %ecx
movq -0x50(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0x28(%rbp), %rdx
addq %rdx, %rax
movl %ecx, 0x14(%rax)
movq -0x30(%rbp), %rax
movl 0x10(%rax), %ecx
movq -0x50(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0x28(%rbp), %rdx
addq %rdx, %rax
movl %ecx, 0x4(%rax)
movq -0x30(%rbp), %rax
movl 0x14(%rax), %ecx
movq -0x50(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0x28(%rbp), %rdx
addq %rdx, %rax
movl %ecx, 0x8(%rax)
movq -0x30(%rbp), %rax
movl 0x18(%rax), %edx
andl $0x3fffffff, %edx       # imm = 0x3FFFFFFF
movq -0x50(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0x28(%rbp), %rcx
addq %rcx, %rax
movl 0x18(%rax), %ecx
andl $0x3fffffff, %edx       # imm = 0x3FFFFFFF
andl $0xc0000000, %ecx       # imm = 0xC0000000
orl %edx, %ecx
movl %ecx, 0x18(%rax)
movq -0x30(%rbp), %rax
movl 0x18(%rax), %edx
shrl $0x1e, %edx
andl $0x1, %edx
movq -0x50(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0x28(%rbp), %rcx
addq %rcx, %rax
movl 0x18(%rax), %ecx
andl $0x1, %edx
shll $0x1e, %edx
andl $0xbfffffff, %ecx       # imm = 0xBFFFFFFF
orl %edx, %ecx
movl %ecx, 0x18(%rax)
movq -0x30(%rbp), %rax
movl 0x18(%rax), %edx
shrl $0x1f, %edx
movq -0x50(%rbp), %rax
movq (%rax), %rax
imulq $0x1c, -0x28(%rbp), %rcx
addq %rcx, %rax
movl 0x18(%rax), %ecx
andl $0x1, %edx
shll $0x1f, %edx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
orl %edx, %ecx
movl %ecx, 0x18(%rax)
jmp 0x3033f1
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0x303033
addq $0x60, %rsp
popq %rbp
retq
nopl (%rax,%rax)