#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 */
scalar_t__ db_inv(float);
int /*<<< orphan*/ memset(float *, int /*<<< orphan*/, int);
int psd_bark2bin(float *, int, float);
int /*<<< orphan*/ spread_function(float, float *, int, int, int, float *);
int noise_mask_threshold(float *pnm, float *psd_bark, float *spread_effect,
                         float *noise_thres, int psd_len) {
  int k, j;
  float masker_bark;
  float low_bark, high_bark;
  int low_bin, high_bin;
  memset(noise_thres, 0, sizeof(float) * psd_len);
  for (k = 0; k < psd_len; k++) {
    memset(spread_effect, 0, sizeof(float) * psd_len);
    if (pnm[k] > 0) {
      masker_bark = psd_bark[k];
      low_bark = masker_bark - 3;
      high_bark = masker_bark + 8;
      low_bin = psd_bark2bin(psd_bark, psd_len, low_bark);
      high_bin = psd_bark2bin(psd_bark, psd_len, high_bark);
      spread_function(pnm[k], psd_bark, k, low_bin, high_bin, spread_effect);
      for (j = low_bin; j <= high_bin; j++)
        noise_thres[j] +=
            db_inv(pnm[k] - 0.175 * masker_bark + spread_effect[j] - 2.025);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<noise_mask_threshold>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    -0x20(%rbp),%rdi
movslq -0x24(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edx
xor    %esi,%esi
call   1030 <memset@plt>
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    12da <noise_mask_threshold+0x19a>
mov    -0x18(%rbp),%rdi
movslq -0x24(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edx
xor    %esi,%esi
call   1030 <memset@plt>
mov    -0x8(%rbp),%rax
movslq -0x28(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jbe    12c7 <noise_mask_threshold+0x187>
mov    -0x10(%rbp),%rax
movslq -0x28(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
movss  %xmm0,-0x30(%rbp)
movss  -0x30(%rbp),%xmm0
movss  0xe33(%rip),%xmm1
subss  %xmm1,%xmm0
movss  %xmm0,-0x34(%rbp)
movss  0xe1e(%rip),%xmm0
addss  -0x30(%rbp),%xmm0
movss  %xmm0,-0x38(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x24(%rbp),%esi
movss  -0x34(%rbp),%xmm0
call   1040 <psd_bark2bin@plt>
mov    %eax,-0x3c(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x24(%rbp),%esi
movss  -0x38(%rbp),%xmm0
call   1040 <psd_bark2bin@plt>
mov    %eax,-0x40(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x28(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
mov    -0x10(%rbp),%rdi
mov    -0x28(%rbp),%esi
mov    -0x3c(%rbp),%edx
mov    -0x40(%rbp),%ecx
mov    -0x18(%rbp),%r8
call   1050 <spread_function@plt>
mov    -0x3c(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x40(%rbp),%eax
jg     12c2 <noise_mask_threshold+0x182>
mov    -0x8(%rbp),%rax
movslq -0x28(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm1
movss  -0x30(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xda5(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm1
cvtss2sd %xmm1,%xmm1
addsd  %xmm1,%xmm0
movsd  0xd78(%rip),%xmm1
subsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
call   1060 <db_inv@plt>
cvtsi2ss %rax,%xmm0
mov    -0x20(%rbp),%rax
movslq -0x2c(%rbp),%rcx
addss  (%rax,%rcx,4),%xmm0
movss  %xmm0,(%rax,%rcx,4)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    123d <noise_mask_threshold+0xfd>
jmp    12c7 <noise_mask_threshold+0x187>
jmp    12cc <noise_mask_threshold+0x18c>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1178 <noise_mask_threshold+0x38>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<noise_mask_threshold>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %r8d,%ebx
mov    %rdx,(%rsp)
mov    %rsi,0x28(%rsp)
mov    %rdi,%r15
lea    0x0(,%rbx,4),%edx
mov    %rcx,0x20(%rsp)
mov    %rcx,%rdi
xor    %esi,%esi
mov    %edx,0x14(%rsp)
call   1030 <memset@plt>
mov    %rbx,0x18(%rsp)
test   %ebx,%ebx
jle    12e6 <noise_mask_threshold+0x1a6>
mov    0x18(%rsp),%eax
mov    %rax,0x30(%rsp)
xor    %r14d,%r14d
jmp    11af <noise_mask_threshold+0x6f>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x1,%r14
cmp    0x30(%rsp),%r14
je     12e6 <noise_mask_threshold+0x1a6>
mov    (%rsp),%rdi
xor    %esi,%esi
mov    0x14(%rsp),%edx
call   1030 <memset@plt>
movss  (%r15,%r14,4),%xmm0
ucomiss 0xe3d(%rip),%xmm0
jbe    11a0 <noise_mask_threshold+0x60>
mov    0x28(%rsp),%rbx
movss  (%rbx,%r14,4),%xmm1
movaps %xmm1,%xmm0
addss  0xe1d(%rip),%xmm0
movss  %xmm1,0x10(%rsp)
addss  0xe13(%rip),%xmm1
movss  %xmm1,0x8(%rsp)
mov    %rbx,%rdi
mov    0x18(%rsp),%rbp
mov    %ebp,%esi
call   1040 <psd_bark2bin@plt>
mov    %eax,%r12d
mov    %rbx,%rdi
mov    %ebp,%esi
movss  0x8(%rsp),%xmm0
call   1040 <psd_bark2bin@plt>
mov    %eax,%ebp
movss  (%r15,%r14,4),%xmm0
mov    %rbx,%rdi
mov    %r14d,%esi
mov    %r12d,%edx
mov    %eax,%ecx
mov    (%rsp),%r8
call   1050 <spread_function@plt>
movsd  0xddb(%rip),%xmm3
movsd  0xdcb(%rip),%xmm2
cmp    %ebp,%r12d
jg     11a0 <noise_mask_threshold+0x60>
movss  0x10(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,0x8(%rsp)
movslq %r12d,%rax
mov    (%rsp),%rcx
mov    %r12d,%edx
lea    (%rcx,%rax,4),%r12
mov    0x20(%rsp),%rcx
lea    (%rcx,%rax,4),%r13
sub    %edx,%ebp
add    $0x1,%ebp
xor    %ebx,%ebx
nopl   0x0(%rax)
movss  (%r15,%r14,4),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0x8(%rsp),%xmm1
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movss  (%r12,%rbx,4),%xmm0
cvtss2sd %xmm0,%xmm0
addsd  %xmm1,%xmm0
addsd  %xmm3,%xmm0
cvtsd2ss %xmm0,%xmm0
call   1060 <db_inv@plt>
movsd  0xd5d(%rip),%xmm3
movsd  0xd4d(%rip),%xmm2
xorps  %xmm0,%xmm0
cvtsi2ss %rax,%xmm0
addss  0x0(%r13,%rbx,4),%xmm0
movss  %xmm0,0x0(%r13,%rbx,4)
add    $0x1,%rbx
cmp    %ebx,%ebp
jne    1280 <noise_mask_threshold+0x140>
jmp    11a0 <noise_mask_threshold+0x60>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @noise_mask_threshold(float* %0, float* %1, float* %2, float* %3, i32 %4) {
%6 = alloca float*
%7 = alloca float*
%8 = alloca float*
%9 = alloca float*
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca float
%14 = alloca float
%15 = alloca float
%16 = alloca i32
%17 = alloca i32
store float* %0, float** %6
store float* %1, float** %7
store float* %2, float** %8
store float* %3, float** %9
store i32 %4, i32* %10
%18 = load float*, float** %9
%19 = load i32, i32* %10
%20 = sext i32 %19 to i64
%21 = mul i64 4, %20
%22 = trunc i64 %21 to i32
%23 = call i32 @memset(float* %18, i32 0, i32 %22)
store i32 0, i32* %11
br label %24
24: ; preds = %107, %5
%25 = load i32, i32* %11
%26 = load i32, i32* %10
%27 = icmp slt i32 %25, %26
br i1 %27, label %28, label %110
28: ; preds = %24
%29 = load float*, float** %8
%30 = load i32, i32* %10
%31 = sext i32 %30 to i64
%32 = mul i64 4, %31
%33 = trunc i64 %32 to i32
%34 = call i32 @memset(float* %29, i32 0, i32 %33)
%35 = load float*, float** %6
%36 = load i32, i32* %11
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds float, float* %35, i64 %37
%39 = load float, float* %38
%40 = fcmp ogt float %39, 0.000000e+00
br i1 %40, label %41, label %106
41: ; preds = %28
%42 = load float*, float** %7
%43 = load i32, i32* %11
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds float, float* %42, i64 %44
%46 = load float, float* %45
store float %46, float* %13
%47 = load float, float* %13
%48 = fsub float %47, 3.000000e+00
store float %48, float* %14
%49 = load float, float* %13
%50 = fadd float %49, 8.000000e+00
store float %50, float* %15
%51 = load float*, float** %7
%52 = load i32, i32* %10
%53 = load float, float* %14
%54 = call i32 @psd_bark2bin(float* %51, i32 %52, float %53)
store i32 %54, i32* %16
%55 = load float*, float** %7
%56 = load i32, i32* %10
%57 = load float, float* %15
%58 = call i32 @psd_bark2bin(float* %55, i32 %56, float %57)
store i32 %58, i32* %17
%59 = load float*, float** %6
%60 = load i32, i32* %11
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds float, float* %59, i64 %61
%63 = load float, float* %62
%64 = load float*, float** %7
%65 = load i32, i32* %11
%66 = load i32, i32* %16
%67 = load i32, i32* %17
%68 = load float*, float** %8
%69 = call i32 @spread_function(float %63, float* %64, i32 %65, i32 %66, i32 %67, float* %68)
%70 = load i32, i32* %16
store i32 %70, i32* %12
br label %71
71: ; preds = %102, %41
%72 = load i32, i32* %12
%73 = load i32, i32* %17
%74 = icmp sle i32 %72, %73
br i1 %74, label %75, label %105
75: ; preds = %71
%76 = load float*, float** %6
%77 = load i32, i32* %11
%78 = sext i32 %77 to i64
%79 = getelementptr inbounds float, float* %76, i64 %78
%80 = load float, float* %79
%81 = fpext float %80 to double
%82 = load float, float* %13
%83 = fpext float %82 to double
%84 = call double @llvm.fmuladd.f64(double -1.750000e-01, double %83, double %81)
%85 = load float*, float** %8
%86 = load i32, i32* %12
%87 = sext i32 %86 to i64
%88 = getelementptr inbounds float, float* %85, i64 %87
%89 = load float, float* %88
%90 = fpext float %89 to double
%91 = fadd double %84, %90
%92 = fsub double %91, 2.025000e+00
%93 = fptrunc double %92 to float
%94 = call i64 @db_inv(float %93)
%95 = sitofp i64 %94 to float
%96 = load float*, float** %9
%97 = load i32, i32* %12
%98 = sext i32 %97 to i64
%99 = getelementptr inbounds float, float* %96, i64 %98
%100 = load float, float* %99
%101 = fadd float %100, %95
store float %101, float* %99
br label %102
102: ; preds = %75
%103 = load i32, i32* %12
%104 = add nsw i32 %103, 1
store i32 %104, i32* %12
br label %71
105: ; preds = %71
br label %106
106: ; preds = %105, %28
br label %107
107: ; preds = %106
%108 = load i32, i32* %11
%109 = add nsw i32 %108, 1
store i32 %109, i32* %11
br label %24
110: ; preds = %24
ret i32 0
}

LLVM IR (-O2):
define i32 @noise_mask_threshold(float* nocapture %0, float* %1, float* %2, float* %3, i32 %4) {
%6 = shl i32 %4, 2
%7 = tail call i32 @memset(float* %3, i32 0, i32 %6)
%8 = icmp sgt i32 %4, 0
br i1 %8, label %9, label %54
9: ; preds = %5
%10 = zext i32 %4 to i64
br label %11
11: ; preds = %9, %51
%12 = phi i64 [ 0, %9 ], [ %52, %51 ]
%13 = tail call i32 @memset(float* %2, i32 0, i32 %6)
%14 = getelementptr inbounds float, float* %0, i64 %12
%15 = load float, float* %14
%16 = fcmp ogt float %15, 0.000000e+00
br i1 %16, label %17, label %51
17: ; preds = %11
%18 = getelementptr inbounds float, float* %1, i64 %12
%19 = load float, float* %18
%20 = fadd float %19, -3.000000e+00
%21 = fadd float %19, 8.000000e+00
%22 = tail call i32 @psd_bark2bin(float* %1, i32 %4, float %20)
%23 = tail call i32 @psd_bark2bin(float* %1, i32 %4, float %21)
%24 = load float, float* %14
%25 = trunc i64 %12 to i32
%26 = tail call i32 @spread_function(float %24, float* %1, i32 %25, i32 %22, i32 %23, float* %2)
%27 = icmp sgt i32 %22, %23
br i1 %27, label %51, label %28
28: ; preds = %17
%29 = fpext float %19 to double
%30 = sext i32 %22 to i64
%31 = add i32 %23, 1
br label %32
32: ; preds = %28, %32
%33 = phi i64 [ %30, %28 ], [ %48, %32 ]
%34 = load float, float* %14
%35 = fpext float %34 to double
%36 = tail call double @llvm.fmuladd.f64(double %29, double -1.750000e-01, double %35)
%37 = getelementptr inbounds float, float* %2, i64 %33
%38 = load float, float* %37
%39 = fpext float %38 to double
%40 = fadd double %36, %39
%41 = fadd double %40, -2.025000e+00
%42 = fptrunc double %41 to float
%43 = tail call i64 @db_inv(float %42)
%44 = sitofp i64 %43 to float
%45 = getelementptr inbounds float, float* %3, i64 %33
%46 = load float, float* %45
%47 = fadd float %46, %44
store float %47, float* %45
%48 = add nsw i64 %33, 1
%49 = trunc i64 %48 to i32
%50 = icmp eq i32 %31, %49
br i1 %50, label %51, label %32
51: ; preds = %32, %17, %11
%52 = add nuw nsw i64 %12, 1
%53 = icmp eq i64 %52, %10
br i1 %53, label %54, label %11
54: ; preds = %51, %5
ret i32 0
}