// File: /workspace/github_cpp_makefile_star2_O1/chhylp123[P]hifiasm/inter.cpp
// Function: rescue_adject_ovlp(asg_t*, unsigned int, kv_u_trans_t*, kv_ul_ov_t*, st_mt_t*)
uint32_t rescue_adject_ovlp(asg_t *g, uint32_t id, kv_u_trans_t *ta, kv_ul_ov_t *out, st_mt_t *buf)
{
	u_trans_t *a, *b; ul_ov_t rr; uint64_t a_n, b_n, k, l, i, z, m; 
	a = u_trans_a((*ta), id); a_n = u_trans_n((*ta), id);
	for (i = out->n = buf->n = 0; i < a_n; i++) {
		b = u_trans_a((*ta), a[i].tn); b_n = u_trans_n((*ta), a[i].tn);
		z = a[i].tn; z <<= 32; kv_push(uint64_t, *buf, z);
		for (k = 0; k < b_n; k++) {
			if(b[k].tn == id) continue;
			if(!tranfor_ovlp(&(a[i]), &(b[k]), g, &rr, 1)) continue;
			z = rr.tn; z <<= 32; z |= out->n; z |= ((uint64_t)0x80000000);
			rr.tn <<= 1; rr.tn |= rr.rev; kv_push(ul_ov_t, *out, rr); 
		}
	}
	if(out->n == 0) return 1;

	radix_sort_gfa64(buf->a, buf->a + buf->n); 
	for (k = 1, l = m = 0; k <= buf->n; k++) {
		if(k == buf->n || (buf->a[l]>>32)!=(buf->a[k]>>32)) {
			if((k - l > 1) && (!(buf->a[l]&((uint64_t)0x80000000)))) {///overlap within bck
				for (z = l; z < k; z++) {
					if(buf->a[z]&((uint64_t)0x80000000)) {
						out->a[(uint32_t)(buf->a[z]-((uint64_t)0x80000000))].tn = (uint32_t)-1;
						m++;
					}
				}
			}
			l = k;
		}
	}

	if(m) {
		for (k = m = 0; k < out->n; k++) {
			if(out->a[k].tn == (uint32_t)-1) continue;
			out->a[m++] = out->a[k];
		}
		out->n = m;
	}
	if(out->n == 0) return 1;

	radix_sort_ul_ov_srt_tn(out->a, out->a+out->n);
	for (k = 0; k < out->n; k++) out->a[k].tn >>= 1;

	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rcx, %rbx
movq 0x28(%rdx), %rax
movl %esi, %ecx
movq (%rax,%rcx,8), %rax
movq %rax, %rcx
shrq $0x20, %rcx
leaq (%rcx,%rcx,2), %rcx
shlq $0x4, %rcx
movq %rdx, 0x28(%rsp)
addq 0x10(%rdx), %rcx
movq %rcx, 0x8(%rsp)
xorl %ecx, %ecx
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movq %r8, (%rsp)
movq %rcx, (%r8)
movq %rcx, 0x8(%rbx)
andq %rax, %rdx
movq %rdx, 0x20(%rsp)
je 0x1bd5a9
movl %esi, %ebp
xorl %edx, %edx
movq %rdi, 0x18(%rsp)
movq 0x28(%rsp), %rcx
movq 0x28(%rcx), %rax
movq %rdx, 0x30(%rsp)
leaq (%rdx,%rdx,2), %r15
shlq $0x4, %r15
movq 0x8(%rsp), %rdx
movl 0x14(%rdx,%r15), %esi
movq (%rax,%rsi,8), %r13
movq %r13, %rax
shrq $0x20, %rax
leaq (%rax,%rax,2), %r14
shlq $0x4, %r14
addq 0x10(%rcx), %r14
movq (%rsp), %r12
movq 0x8(%r12), %rax
cmpq %rax, (%r12)
jne 0x1bd4c8
movq %rsi, 0x10(%rsp)
leaq (%rax,%rax), %rsi
testq %rax, %rax
movl $0x2, %eax
cmoveq %rax, %rsi
movq %rsi, 0x8(%r12)
movq 0x10(%r12), %rdi
shlq $0x3, %rsi
callq 0x2370
movq 0x10(%rsp), %rsi
movq %rax, 0x10(%r12)
movl %r13d, %r13d
shlq $0x20, %rsi
movq (%r12), %rax
movq 0x10(%r12), %rcx
leaq 0x1(%rax), %rdx
movq %rdx, (%r12)
movq %rsi, (%rcx,%rax,8)
testq %r13, %r13
movq 0x18(%rsp), %r12
je 0x1bd596
addq 0x8(%rsp), %r15
cmpl %ebp, 0x14(%r14)
je 0x1bd589
movq %r15, %rdi
movq %r14, %rsi
movq %r12, %rdx
leaq 0x3c(%rsp), %rcx
movl $0x1, %r8d
callq 0x1bd246
testl %eax, %eax
je 0x1bd589
movl 0x54(%rsp), %eax
shldl $0x1, %eax, 0x48(%rsp)
movq 0x10(%rbx), %rax
cmpq %rax, 0x8(%rbx)
jne 0x1bd55c
leaq (%rax,%rax), %rcx
testq %rax, %rax
movl $0x2, %eax
cmoveq %rax, %rcx
movq %rcx, 0x10(%rbx)
movq (%rbx), %rdi
leaq (%rcx,%rcx,8), %rax
leaq (%rax,%rax,2), %rsi
addq %rcx, %rsi
callq 0x2370
movq %rax, (%rbx)
movq (%rbx), %rax
movq 0x8(%rbx), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, 0x8(%rbx)
leaq (%rcx,%rcx,8), %rdx
leaq (%rdx,%rdx,2), %rdx
addq %rcx, %rdx
movups 0x3c(%rsp), %xmm0
movups 0x48(%rsp), %xmm1
movups %xmm1, 0xc(%rax,%rdx)
movups %xmm0, (%rax,%rdx)
addq $0x30, %r14
decq %r13
jne 0x1bd4f7
movq 0x30(%rsp), %rdx
incq %rdx
cmpq 0x20(%rsp), %rdx
jne 0x1bd450
movl $0x1, %ebp
cmpq $0x0, 0x8(%rbx)
je 0x1bd702
movq (%rsp), %r14
movq (%r14), %rax
movq 0x10(%r14), %rdi
leaq (%rdi,%rax,8), %rsi
callq 0x194fef
movq (%r14), %rax
testq %rax, %rax
je 0x1bd6c6
leaq 0x1(%rax), %rdx
cmpq $0x3, %rdx
movl $0x2, %ecx
cmovaeq %rdx, %rcx
movl $0x1, %esi
xorl %edx, %edx
xorl %edi, %edi
cmpq %rax, %rsi
je 0x1bd60a
movq 0x10(%r14), %r8
movq (%r8,%rsi,8), %r9
xorq (%r8,%rdi,8), %r9
shrq $0x20, %r9
je 0x1bd669
movq %rsi, %r8
subq %rdi, %r8
cmpq $0x2, %r8
jb 0x1bd666
movq 0x10(%r14), %r8
testb $-0x80, 0x3(%r8,%rdi,8)
sete %r9b
cmpq %rdi, %rsi
seta %r10b
andb %r9b, %r10b
cmpb $0x1, %r10b
jne 0x1bd666
movq (%r8,%rdi,8), %r9
testl %r9d, %r9d
jns 0x1bd65e
movq (%rbx), %r10
andl $0x7fffffff, %r9d       # imm = 0x7FFFFFFF
leaq (%r9,%r9,8), %r11
leaq (%r11,%r11,2), %r11
addq %r9, %r11
movl $0xffffffff, 0xc(%r10,%r11) # imm = 0xFFFFFFFF
incq %rdx
incq %rdi
cmpq %rdi, %rsi
jne 0x1bd634
movq %rsi, %rdi
incq %rsi
cmpq %rcx, %rsi
jne 0x1bd5f3
testq %rdx, %rdx
je 0x1bd6c6
cmpq $0x0, 0x8(%rbx)
je 0x1bd6c0
xorl %eax, %eax
xorl %ecx, %ecx
xorl %edx, %edx
movq (%rbx), %rsi
cmpl $-0x1, 0xc(%rsi,%rax)
je 0x1bd6b1
leaq (%rsi,%rax), %rdi
leaq (%rcx,%rcx,8), %r8
leaq (%r8,%r8,2), %r8
addq %rcx, %r8
incq %rcx
movups (%rdi), %xmm0
movups 0xc(%rdi), %xmm1
movups %xmm1, 0xc(%rsi,%r8)
movups %xmm0, (%rsi,%r8)
incq %rdx
addq $0x1c, %rax
cmpq 0x8(%rbx), %rdx
jb 0x1bd683
jmp 0x1bd6c2
xorl %ecx, %ecx
movq %rcx, 0x8(%rbx)
movq 0x8(%rbx), %rsi
testq %rsi, %rsi
je 0x1bd702
movq (%rbx), %rdi
leaq (%rsi,%rsi,8), %rax
leaq (%rax,%rax,2), %rax
addq %rdi, %rsi
addq %rax, %rsi
callq 0x195abc
movq 0x8(%rbx), %rax
xorl %ebp, %ebp
testq %rax, %rax
je 0x1bd702
movq (%rbx), %rcx
addq $0xc, %rcx
shrl (%rcx)
addq $0x1c, %rcx
decq %rax
jne 0x1bd6f7
movl %ebp, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq