#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
float find_sq_eng(short *, int, int);
float get_threshold_no_phone(int x_start, int length, short *speech,
                             float global_rms) {
  float eng, threshold;
  eng = (find_sq_eng(speech, x_start, length) / global_rms);
  if (eng >= 0.4)
    threshold = 0.75;
  if ((eng < 0.4) && (eng >= 0.25))
    threshold = 0.80;
  if ((eng < 0.25) && (eng >= 0.1))
    threshold = 0.90;
  if (eng < 0.1)
    threshold = 0.96;
  return (threshold);
}


x86 assembly (clang, -O0):
<get_threshold_no_phone>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
movss  %xmm0,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
call   1030 <find_sq_eng@plt>
divss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x18(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xeaf(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     1168 <get_threshold_no_phone+0x58>
movss  0xeb5(%rip),%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x18(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe87(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    11ab <get_threshold_no_phone+0x9b>
movss  -0x18(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe74(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     11ab <get_threshold_no_phone+0x9b>
movss  0xe76(%rip),%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x18(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe4c(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    11ee <get_threshold_no_phone+0xde>
movss  -0x18(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe39(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     11ee <get_threshold_no_phone+0xde>
movss  0xe37(%rip),%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x18(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe11(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    1216 <get_threshold_no_phone+0x106>
movss  0xe13(%rip),%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x1c(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_threshold_no_phone>:
push   %rax
movss  %xmm0,0x4(%rsp)
mov    %rdx,%rax
mov    %esi,%edx
mov    %edi,%esi
mov    %rax,%rdi
call   1030 <find_sq_eng@plt>
divss  0x4(%rsp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xec8(%rip),%xmm2
xor    %eax,%eax
ucomisd %xmm1,%xmm2
setbe  %al
lea    0xec0(%rip),%rcx
movss  (%rcx,%rax,4),%xmm4
movss  0xec3(%rip),%xmm3
movaps %xmm3,%xmm5
cmpnless %xmm0,%xmm5
movss  0xeb7(%rip),%xmm2
andps  %xmm5,%xmm2
andnps %xmm4,%xmm5
orps   %xmm5,%xmm2
movsd  0xe9a(%rip),%xmm5
ucomisd %xmm5,%xmm1
movaps %xmm2,%xmm4
jb     1187 <get_threshold_no_phone+0x77>
movss  0xe99(%rip),%xmm4
ucomisd %xmm1,%xmm5
ja     119d <get_threshold_no_phone+0x8d>
cmpnltss %xmm3,%xmm0
andps  %xmm0,%xmm2
andnps %xmm4,%xmm0
orps   %xmm2,%xmm0
pop    %rax
ret
movss  0xe7f(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @get_threshold_no_phone(i32 %0, i32 %1, i16* %2, float %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i16*
%8 = alloca float
%9 = alloca float
%10 = alloca float
store i32 %0, i32* %5
store i32 %1, i32* %6
store i16* %2, i16** %7
store float %3, float* %8
%11 = load i16*, i16** %7
%12 = load i32, i32* %5
%13 = load i32, i32* %6
%14 = call float @find_sq_eng(i16* %11, i32 %12, i32 %13)
%15 = load float, float* %8
%16 = fdiv float %14, %15
store float %16, float* %9
%17 = load float, float* %9
%18 = fpext float %17 to double
%19 = fcmp oge double %18, 4.000000e-01
br i1 %19, label %20, label %21
20: ; preds = %4
store float 7.500000e-01, float* %10
br label %21
21: ; preds = %20, %4
%22 = load float, float* %9
%23 = fpext float %22 to double
%24 = fcmp olt double %23, 4.000000e-01
br i1 %24, label %25, label %30
25: ; preds = %21
%26 = load float, float* %9
%27 = fpext float %26 to double
%28 = fcmp oge double %27, 2.500000e-01
br i1 %28, label %29, label %30
29: ; preds = %25
store float 0x3FE99999A0000000, float* %10
br label %30
30: ; preds = %29, %25, %21
%31 = load float, float* %9
%32 = fpext float %31 to double
%33 = fcmp olt double %32, 2.500000e-01
br i1 %33, label %34, label %39
34: ; preds = %30
%35 = load float, float* %9
%36 = fpext float %35 to double
%37 = fcmp oge double %36, 1.000000e-01
br i1 %37, label %38, label %39
38: ; preds = %34
store float 0x3FECCCCCC0000000, float* %10
br label %39
39: ; preds = %38, %34, %30
%40 = load float, float* %9
%41 = fpext float %40 to double
%42 = fcmp olt double %41, 1.000000e-01
br i1 %42, label %43, label %44
43: ; preds = %39
store float 0x3FEEB851E0000000, float* %10
br label %44
44: ; preds = %43, %39
%45 = load float, float* %10
ret float %45
}

LLVM IR (-O2):
define float @get_threshold_no_phone(i32 %0, i32 %1, i16* %2, float %3) {
%5 = tail call float @find_sq_eng(i16* %2, i32 %0, i32 %1)
%6 = fdiv float %5, %3
%7 = fpext float %6 to double
%8 = fcmp uge double %7, 4.000000e-01
%9 = fcmp ult float %6, 2.500000e-01
%10 = or i1 %9, %8
%11 = select i1 %10, float 7.500000e-01, float 0x3FE99999A0000000
%12 = fcmp uge float %6, 2.500000e-01
%13 = fcmp ult double %7, 1.000000e-01
%14 = or i1 %12, %13
%15 = select i1 %14, float %11, float 0x3FECCCCCC0000000
%16 = fcmp olt double %7, 1.000000e-01
%17 = select i1 %16, float 0x3FEEB851E0000000, float %15
ret float %17
}