// File: chhylp123[P]hifiasm/inter.cpp
// Function: check_trans_rate(ul_ov_t*, long, float)
uint32_t check_trans_rate(ul_ov_t *a, int64_t a_n, float trans_thres)
{
	uint32_t sp = (uint32_t)-1, ep = (uint32_t)-1, tts = (uint32_t)-1, tte = 0, el = 0, iel = 0; 
	int64_t k;
	for (k = a_n-1; k >= 0; k--) {
		if(a[k].qs < tts) tts = a[k].qs;
		if(a[k].qe > tte) tte = a[k].qe;
		if(!(a[k].el)) continue;
		if(sp == (uint32_t)-1 || a[k].qe <= sp) {
			if(sp != (uint32_t)-1) el += ep - sp;
            sp = a[k].qs;
            ep = a[k].qe;
		} else {
			sp = MIN(sp, a[k].qs);
		}
	}
	if(sp != (uint32_t)-1) el += ep - sp;
	iel = (tte - tts) - el;
	// fprintf(stderr, "[M::%s] el:%u, iel:%u\n", __func__, el, iel);
	if((iel == 0) || (iel <= ((tte - tts)*trans_thres))) return 1;
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movss %xmm0, -0x1c(%rbp)
movl $0xffffffff, -0x20(%rbp) # imm = 0xFFFFFFFF
movl $0xffffffff, -0x24(%rbp) # imm = 0xFFFFFFFF
movl $0xffffffff, -0x28(%rbp) # imm = 0xFFFFFFFF
movl $0x0, -0x2c(%rbp)
movl $0x0, -0x30(%rbp)
movl $0x0, -0x34(%rbp)
movq -0x18(%rbp), %rax
subq $0x1, %rax
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
jl 0x294836
movq -0x10(%rbp), %rax
imulq $0x1c, -0x40(%rbp), %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
cmpl -0x28(%rbp), %eax
jae 0x294758
movq -0x10(%rbp), %rax
imulq $0x1c, -0x40(%rbp), %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
movl %eax, -0x28(%rbp)
movq -0x10(%rbp), %rax
imulq $0x1c, -0x40(%rbp), %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
cmpl -0x2c(%rbp), %eax
jbe 0x29477e
movq -0x10(%rbp), %rax
imulq $0x1c, -0x40(%rbp), %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
movl %eax, -0x2c(%rbp)
movq -0x10(%rbp), %rax
imulq $0x1c, -0x40(%rbp), %rcx
addq %rcx, %rax
movl 0x18(%rax), %eax
shrl $0x1e, %eax
andl $0x1, %eax
cmpl $0x0, %eax
jne 0x29479d
jmp 0x294825
cmpl $-0x1, -0x20(%rbp)
je 0x2947b7
movq -0x10(%rbp), %rax
imulq $0x1c, -0x40(%rbp), %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
cmpl -0x20(%rbp), %eax
ja 0x2947ef
cmpl $-0x1, -0x20(%rbp)
je 0x2947c9
movl -0x24(%rbp), %eax
subl -0x20(%rbp), %eax
addl -0x30(%rbp), %eax
movl %eax, -0x30(%rbp)
movq -0x10(%rbp), %rax
imulq $0x1c, -0x40(%rbp), %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
movl %eax, -0x20(%rbp)
movq -0x10(%rbp), %rax
imulq $0x1c, -0x40(%rbp), %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
movl %eax, -0x24(%rbp)
jmp 0x294823
movl -0x20(%rbp), %eax
movq -0x10(%rbp), %rcx
imulq $0x1c, -0x40(%rbp), %rdx
addq %rdx, %rcx
cmpl 0x4(%rcx), %eax
ja 0x29480b
movl -0x20(%rbp), %eax
movl %eax, -0x44(%rbp)
jmp 0x29481d
movq -0x10(%rbp), %rax
imulq $0x1c, -0x40(%rbp), %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
movl %eax, -0x44(%rbp)
movl -0x44(%rbp), %eax
movl %eax, -0x20(%rbp)
jmp 0x294825
movq -0x40(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x40(%rbp)
jmp 0x294727
cmpl $-0x1, -0x20(%rbp)
je 0x294848
movl -0x24(%rbp), %eax
subl -0x20(%rbp), %eax
addl -0x30(%rbp), %eax
movl %eax, -0x30(%rbp)
movl -0x2c(%rbp), %eax
subl -0x28(%rbp), %eax
subl -0x30(%rbp), %eax
movl %eax, -0x34(%rbp)
cmpl $0x0, -0x34(%rbp)
je 0x294879
movl -0x34(%rbp), %eax
cvtsi2ss %rax, %xmm1
movl -0x2c(%rbp), %eax
movl -0x28(%rbp), %ecx
subl %ecx, %eax
cvtsi2ss %rax, %xmm0
mulss -0x1c(%rbp), %xmm0
ucomiss %xmm1, %xmm0
jb 0x294882
movl $0x1, -0x4(%rbp)
jmp 0x294889
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
popq %rbp
retq
nop