#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 */
int freq_to_bin(float, float, float);
void compute_auto_thresholds(float *auto_thresholds, float fft_size,
                             float fft_size_2, float samp_rate) {
  int LF = freq_to_bin(1000.f, samp_rate, fft_size);
  int MF = freq_to_bin(3000.f, samp_rate, fft_size);
  for (int k = 0; k <= fft_size_2; k++) {
    if (k <= LF) {
      auto_thresholds[k] = 2.0f;
    }
    if (k > LF && k < MF) {
      auto_thresholds[k] = 2.0f;
    }
    if (k >= MF) {
      auto_thresholds[k] = 7.0f;
    }
  }
}


x86 assembly (clang, -O0):
<compute_auto_thresholds>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movss  %xmm0,-0xc(%rbp)
movss  %xmm1,-0x10(%rbp)
movss  %xmm2,-0x14(%rbp)
movss  -0x14(%rbp),%xmm1
movss  -0xc(%rbp),%xmm2
movss  0xec7(%rip),%xmm0
call   1030 <freq_to_bin@plt>
mov    %eax,-0x18(%rbp)
movss  -0x14(%rbp),%xmm1
movss  -0xc(%rbp),%xmm2
movss  0xea9(%rip),%xmm0
call   1030 <freq_to_bin@plt>
mov    %eax,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
cvtsi2ssl -0x20(%rbp),%xmm1
movss  -0x10(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jb     11fb <compute_auto_thresholds+0xeb>
mov    -0x20(%rbp),%eax
cmp    -0x18(%rbp),%eax
jg     119a <compute_auto_thresholds+0x8a>
mov    -0x8(%rbp),%rax
movslq -0x20(%rbp),%rcx
movss  0xe73(%rip),%xmm0
movss  %xmm0,(%rax,%rcx,4)
mov    -0x20(%rbp),%eax
cmp    -0x18(%rbp),%eax
jle    11c7 <compute_auto_thresholds+0xb7>
mov    -0x20(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    11c7 <compute_auto_thresholds+0xb7>
mov    -0x8(%rbp),%rax
movslq -0x20(%rbp),%rcx
movss  0xe46(%rip),%xmm0
movss  %xmm0,(%rax,%rcx,4)
mov    -0x20(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jl     11e8 <compute_auto_thresholds+0xd8>
mov    -0x8(%rbp),%rax
movslq -0x20(%rbp),%rcx
movss  0xe29(%rip),%xmm0
movss  %xmm0,(%rax,%rcx,4)
jmp    11ed <compute_auto_thresholds+0xdd>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1166 <compute_auto_thresholds+0x56>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<compute_auto_thresholds>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
movss  %xmm2,0x10(%rsp)
movss  %xmm1,0x14(%rsp)
movaps %xmm0,%xmm3
movss  %xmm0,0xc(%rsp)
mov    %rdi,%rbx
movss  0xeca(%rip),%xmm0
movaps %xmm2,%xmm1
movaps %xmm3,%xmm2
call   1030 <freq_to_bin@plt>
mov    %eax,%ebp
movss  0xeb9(%rip),%xmm0
movss  0x10(%rsp),%xmm1
movss  0xc(%rsp),%xmm2
call   1030 <freq_to_bin@plt>
movss  0x14(%rsp),%xmm3
xorps  %xmm0,%xmm0
ucomiss %xmm0,%xmm3
jae    1171 <compute_auto_thresholds+0x61>
add    $0x18,%rsp
pop    %rbx
pop    %rbp
ret
cltq
movslq %ebp,%rcx
xor    %edx,%edx
movss  0xe88(%rip),%xmm0
movss  0xe84(%rip),%xmm1
jmp    11a8 <compute_auto_thresholds+0x98>
nopw   0x0(%rax,%rax,1)
movaps %xmm1,%xmm2
movss  %xmm2,(%rbx,%rdx,4)
add    $0x1,%rdx
xorps  %xmm2,%xmm2
cvtsi2ss %edx,%xmm2
ucomiss %xmm2,%xmm3
jb     116a <compute_auto_thresholds+0x5a>
cmp    %rcx,%rdx
jle    11c0 <compute_auto_thresholds+0xb0>
movaps %xmm0,%xmm2
cmp    %rax,%rdx
jge    1190 <compute_auto_thresholds+0x80>
jmp    1193 <compute_auto_thresholds+0x83>
nopw   0x0(%rax,%rax,1)
movl   $0x40000000,(%rbx,%rdx,4)
cmp    %rax,%rdx
jge    1190 <compute_auto_thresholds+0x80>
jmp    1198 <compute_auto_thresholds+0x88>

LLVM IR (-O0):
define void @compute_auto_thresholds(float* %0, float %1, float %2, float %3) {
%5 = alloca float*
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store float* %0, float** %5
store float %1, float* %6
store float %2, float* %7
store float %3, float* %8
%12 = load float, float* %8
%13 = load float, float* %6
%14 = call i32 @freq_to_bin(float 1.000000e+03, float %12, float %13)
store i32 %14, i32* %9
%15 = load float, float* %8
%16 = load float, float* %6
%17 = call i32 @freq_to_bin(float 3.000000e+03, float %15, float %16)
store i32 %17, i32* %10
store i32 0, i32* %11
br label %18
18: ; preds = %55, %4
%19 = load i32, i32* %11
%20 = sitofp i32 %19 to float
%21 = load float, float* %7
%22 = fcmp ole float %20, %21
br i1 %22, label %23, label %58
23: ; preds = %18
%24 = load i32, i32* %11
%25 = load i32, i32* %9
%26 = icmp sle i32 %24, %25
br i1 %26, label %27, label %32
27: ; preds = %23
%28 = load float*, float** %5
%29 = load i32, i32* %11
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds float, float* %28, i64 %30
store float 2.000000e+00, float* %31
br label %32
32: ; preds = %27, %23
%33 = load i32, i32* %11
%34 = load i32, i32* %9
%35 = icmp sgt i32 %33, %34
br i1 %35, label %36, label %45
36: ; preds = %32
%37 = load i32, i32* %11
%38 = load i32, i32* %10
%39 = icmp slt i32 %37, %38
br i1 %39, label %40, label %45
40: ; preds = %36
%41 = load float*, float** %5
%42 = load i32, i32* %11
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds float, float* %41, i64 %43
store float 2.000000e+00, float* %44
br label %45
45: ; preds = %40, %36, %32
%46 = load i32, i32* %11
%47 = load i32, i32* %10
%48 = icmp sge i32 %46, %47
br i1 %48, label %49, label %54
49: ; preds = %45
%50 = load float*, float** %5
%51 = load i32, i32* %11
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds float, float* %50, i64 %52
store float 7.000000e+00, float* %53
br label %54
54: ; preds = %49, %45
br label %55
55: ; preds = %54
%56 = load i32, i32* %11
%57 = add nsw i32 %56, 1
store i32 %57, i32* %11
br label %18
58: ; preds = %18
ret void
}

LLVM IR (-O2):
define void @compute_auto_thresholds(float* nocapture writeonly %0, float %1, float %2, float %3) {
%5 = tail call i32 @freq_to_bin(float 1.000000e+03, float %3, float %1)
%6 = tail call i32 @freq_to_bin(float 3.000000e+03, float %3, float %1)
%7 = fcmp ult float %2, 0.000000e+00
br i1 %7, label %11, label %8
8: ; preds = %4
%9 = sext i32 %6 to i64
%10 = sext i32 %5 to i64
br label %12
11: ; preds = %24, %4
ret void
12: ; preds = %8, %24
%13 = phi i64 [ 0, %8 ], [ %25, %24 ]
%14 = icmp sgt i64 %13, %10
br i1 %14, label %18, label %15
15: ; preds = %12
%16 = getelementptr inbounds float, float* %0, i64 %13
store float 2.000000e+00, float* %16
%17 = icmp slt i64 %13, %9
br i1 %17, label %24, label %20
18: ; preds = %12
%19 = icmp slt i64 %13, %9
br i1 %19, label %21, label %20
20: ; preds = %18, %15
br label %21
21: ; preds = %18, %20
%22 = phi float [ 7.000000e+00, %20 ], [ 2.000000e+00, %18 ]
%23 = getelementptr inbounds float, float* %0, i64 %13
store float %22, float* %23
br label %24
24: ; preds = %21, %15
%25 = add nuw i64 %13, 1
%26 = trunc i64 %25 to i32
%27 = sitofp i32 %26 to float
%28 = fcmp ugt float %27, %2
br i1 %28, label %11, label %12
}