// File: chhylp123[P]hifiasm/inter.cpp
// Function: select_mul_way_nodes(mg_pathv_t*, long, vec_sp_node_t*, float, int, unsigned long*)
int64_t select_mul_way_nodes(mg_pathv_t *a, int64_t a_n, vec_sp_node_t *out, float len_dif, int32_t m_pathn, uint64_t *flag)
{
	int64_t i, k, pd, kd, occ, tt = 0; uint32_t pp; mg_pathv_t *p = NULL;
	if(a_n > 1) radix_sort_mg_pathv_t_d_srt(a, a + a_n);
	for (i = 0; i < a_n; i++) {
		p = &(a[i]); pp = (p->d<<1)>>1; pd = out->a[p->pre]->di>>32; occ = 1;
		
		if(p->d&0x80000000) break;
		for (k = 0; k < a_n; k++) {
			if(k == i) continue; ///same alignment
			if(((a[k].d<<1)>>1) == pp) continue; //same path
			if(a[k].v!=p->v) continue;
			kd = out->a[a[k].pre]->di>>32;
			if(kd >= (pd*(1-len_dif)) && kd <= (pd*(1+len_dif))) occ++;
		}
		if(occ >= m_pathn) {
			flag[p->pre] = 1; tt++;
		}
	}

	return tt;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movss %xmm0, -0x1c(%rbp)
movl %ecx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq $0x0, -0x58(%rbp)
movq $0x0, -0x68(%rbp)
cmpq $0x1, -0x10(%rbp)
jle 0x2d31ac
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rsi
imulq $0xc, -0x10(%rbp), %rax
addq %rax, %rsi
callq 0x27f360
movq $0x0, -0x30(%rbp)
movq -0x30(%rbp), %rax
cmpq -0x10(%rbp), %rax
jge 0x2d333f
movq -0x8(%rbp), %rax
imulq $0xc, -0x30(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x68(%rbp)
movq -0x68(%rbp), %rax
movl 0x4(%rax), %eax
shll %eax
shrl %eax
movl %eax, -0x5c(%rbp)
movq -0x18(%rbp), %rax
movq (%rax), %rax
movq -0x68(%rbp), %rcx
movslq 0x8(%rcx), %rcx
movq (%rax,%rcx,8), %rax
movq (%rax), %rax
shrq $0x20, %rax
movq %rax, -0x40(%rbp)
movq $0x1, -0x50(%rbp)
movq -0x68(%rbp), %rax
movl 0x4(%rax), %eax
andl $0x80000000, %eax       # imm = 0x80000000
cmpl $0x0, %eax
je 0x2d321c
jmp 0x2d333f
movq $0x0, -0x38(%rbp)
movq -0x38(%rbp), %rax
cmpq -0x10(%rbp), %rax
jge 0x2d32ff
movq -0x38(%rbp), %rax
cmpq -0x30(%rbp), %rax
jne 0x2d3241
jmp 0x2d32ee
movq -0x8(%rbp), %rax
imulq $0xc, -0x38(%rbp), %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
shll %eax
shrl %eax
cmpl -0x5c(%rbp), %eax
jne 0x2d325e
jmp 0x2d32ee
movq -0x8(%rbp), %rax
imulq $0xc, -0x38(%rbp), %rcx
addq %rcx, %rax
movl (%rax), %eax
movq -0x68(%rbp), %rcx
cmpl (%rcx), %eax
je 0x2d3276
jmp 0x2d32ee
movq -0x18(%rbp), %rax
movq (%rax), %rax
movq -0x8(%rbp), %rcx
imulq $0xc, -0x38(%rbp), %rdx
addq %rdx, %rcx
movslq 0x8(%rcx), %rcx
movq (%rax,%rcx,8), %rax
movq (%rax), %rax
shrq $0x20, %rax
movq %rax, -0x48(%rbp)
cvtsi2ssq -0x48(%rbp), %xmm0
cvtsi2ssq -0x40(%rbp), %xmm1
movss 0xabddc(%rip), %xmm2    # 0x37f08c
subss -0x1c(%rbp), %xmm2
mulss %xmm2, %xmm1
ucomiss %xmm1, %xmm0
jb 0x2d32ec
cvtsi2ssq -0x48(%rbp), %xmm1
cvtsi2ssq -0x40(%rbp), %xmm0
movss 0xabdba(%rip), %xmm2    # 0x37f08c
addss -0x1c(%rbp), %xmm2
mulss %xmm2, %xmm0
ucomiss %xmm1, %xmm0
jb 0x2d32ec
movq -0x50(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x50(%rbp)
jmp 0x2d32ee
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
jmp 0x2d3224
movq -0x50(%rbp), %rax
movslq -0x20(%rbp), %rcx
cmpq %rcx, %rax
jl 0x2d332c
movq -0x28(%rbp), %rax
movq -0x68(%rbp), %rcx
movslq 0x8(%rcx), %rcx
movq $0x1, (%rax,%rcx,8)
movq -0x58(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x58(%rbp)
jmp 0x2d332e
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x2d31b4
movq -0x58(%rbp), %rax
addq $0x70, %rsp
popq %rbp
retq
nopl (%rax)