#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);
float db_pos(float);
int noisemasker_band_fast(float *psd, int *tone_flag, int lowbin, int highbin,
                          int band, float *geomean_table, float *nm,
                          int *nm_pos) {
  int k;
  float tmp;
  *nm = 0;
  tmp = 0;
  for (k = lowbin; k <= highbin; k++) {
    if (!tone_flag[k]) {
      tmp += db_inv(psd[k]);
    }
  }
  *nm = db_pos(tmp);
  *nm_pos = geomean_table[band];
  return 0;
}


x86 assembly (clang, -O0):
<noisemasker_band_fast>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
mov    %r9,-0x28(%rbp)
mov    0x10(%rbp),%rax
xorps  %xmm0,%xmm0
movss  %xmm0,(%rax)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x30(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x18(%rbp),%eax
jg     11b1 <noisemasker_band_fast+0x91>
mov    -0x10(%rbp),%rax
movslq -0x2c(%rbp),%rcx
cmpl   $0x0,(%rax,%rcx,4)
jne    119e <noisemasker_band_fast+0x7e>
mov    -0x8(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
call   1040 <db_inv@plt>
cvtsi2ss %rax,%xmm0
addss  -0x30(%rbp),%xmm0
movss  %xmm0,-0x30(%rbp)
jmp    11a3 <noisemasker_band_fast+0x83>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    115f <noisemasker_band_fast+0x3f>
movss  -0x30(%rbp),%xmm0
call   1030 <db_pos@plt>
mov    0x10(%rbp),%rax
movss  %xmm0,(%rax)
mov    -0x28(%rbp),%rax
movslq -0x1c(%rbp),%rcx
cvttss2si (%rax,%rcx,4),%ecx
mov    0x18(%rbp),%rax
mov    %ecx,(%rax)
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<noisemasker_band_fast>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r9,%r14
mov    %r8d,%r13d
mov    0x40(%rsp),%rax
movl   $0x0,(%rax)
xorps  %xmm0,%xmm0
cmp    %ecx,%edx
jle    1172 <noisemasker_band_fast+0x52>
call   1030 <db_pos@plt>
mov    0x40(%rsp),%rax
movss  %xmm0,(%rax)
movslq %r13d,%rax
cvttss2si (%r14,%rax,4),%eax
mov    0x48(%rsp),%rcx
mov    %eax,(%rcx)
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %ecx,%ebx
movslq %edx,%rax
lea    (%rsi,%rax,4),%rbp
lea    (%rdi,%rax,4),%r15
sub    %edx,%ebx
add    $0x1,%ebx
xorps  %xmm0,%xmm0
xor    %r12d,%r12d
jmp    1199 <noisemasker_band_fast+0x79>
nopl   0x0(%rax)
add    $0x1,%r12
cmp    %r12d,%ebx
je     1143 <noisemasker_band_fast+0x23>
cmpl   $0x0,0x0(%rbp,%r12,4)
jne    1190 <noisemasker_band_fast+0x70>
movss  %xmm0,0x4(%rsp)
movss  (%r15,%r12,4),%xmm0
call   1040 <db_inv@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %rax,%xmm0
movss  0x4(%rsp),%xmm1
addss  %xmm0,%xmm1
movss  %xmm1,0x4(%rsp)
movss  0x4(%rsp),%xmm0
jmp    1190 <noisemasker_band_fast+0x70>

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

LLVM IR (-O2):
define i32 @noisemasker_band_fast(float* nocapture %0, i32* nocapture %1, i32 %2, i32 %3, i32 %4, float* nocapture %5, float* nocapture writeonly %6, i32* nocapture writeonly %7) {
store float 0.000000e+00, float* %6
%9 = icmp sgt i32 %2, %3
br i1 %9, label %30, label %10
10: ; preds = %8
%11 = sext i32 %2 to i64
%12 = add i32 %3, 1
br label %13
13: ; preds = %10, %25
%14 = phi i64 [ %11, %10 ], [ %27, %25 ]
%15 = phi float [ 0.000000e+00, %10 ], [ %26, %25 ]
%16 = getelementptr inbounds i32, i32* %1, i64 %14
%17 = load i32, i32* %16
%18 = icmp eq i32 %17, 0
br i1 %18, label %19, label %25
19: ; preds = %13
%20 = getelementptr inbounds float, float* %0, i64 %14
%21 = load float, float* %20
%22 = tail call i64 @db_inv(float %21)
%23 = sitofp i64 %22 to float
%24 = fadd float %15, %23
br label %25
25: ; preds = %13, %19
%26 = phi float [ %15, %13 ], [ %24, %19 ]
%27 = add nsw i64 %14, 1
%28 = trunc i64 %27 to i32
%29 = icmp eq i32 %12, %28
br i1 %29, label %30, label %13
30: ; preds = %25, %8
%31 = phi float [ 0.000000e+00, %8 ], [ %26, %25 ]
%32 = tail call float @db_pos(float %31)
store float %32, float* %6
%33 = sext i32 %4 to i64
%34 = getelementptr inbounds float, float* %5, i64 %33
%35 = load float, float* %34
%36 = fptosi float %35 to i32
store i32 %36, i32* %7
ret i32 0
}