#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 /*<<< orphan*/ memset(float *, int /*<<< orphan*/, int);
int /*<<< orphan*/ noisemasker_band_fast(float *, int *, int, int, int, float *,
                                         float *, int *);
int psd_noisemasker(float *psd, int psd_len, int *tone_flag, int *cb_hopbin,
                    float *geomean_table, float *pnm) {
  int band;
  int lowbin, highbin;
  float nm;
  int nm_pos;
  lowbin = 0;
  memset(pnm, 0, sizeof(float) * psd_len);
  for (band = 0; band < 25; band++) {
    nm_pos = 0;
    if (cb_hopbin[band] == 0)
      break;
    highbin = cb_hopbin[band] - 1;
    noisemasker_band_fast(psd, tone_flag, lowbin, highbin, band, geomean_table,
                          &nm, &nm_pos);
    lowbin = highbin + 1;
    pnm[nm_pos] = nm;
  }
  return 0;
}


x86 assembly (clang, -O0):
<psd_noisemasker>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
movl   $0x0,-0x38(%rbp)
mov    -0x30(%rbp),%rdi
movslq -0xc(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edx
xor    %esi,%esi
call   1030 <memset@plt>
movl   $0x0,-0x34(%rbp)
cmpl   $0x19,-0x34(%rbp)
jge    11f0 <psd_noisemasker+0xd0>
movl   $0x0,-0x44(%rbp)
mov    -0x20(%rbp),%rax
movslq -0x34(%rbp),%rcx
cmpl   $0x0,(%rax,%rcx,4)
jne    118a <psd_noisemasker+0x6a>
jmp    11f0 <psd_noisemasker+0xd0>
mov    -0x20(%rbp),%rax
movslq -0x34(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
sub    $0x1,%eax
mov    %eax,-0x3c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x38(%rbp),%edx
mov    -0x3c(%rbp),%ecx
mov    -0x34(%rbp),%r8d
mov    -0x28(%rbp),%r9
lea    -0x40(%rbp),%r10
lea    -0x44(%rbp),%rax
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
call   1040 <noisemasker_band_fast@plt>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
movss  -0x40(%rbp),%xmm0
mov    -0x30(%rbp),%rax
movslq -0x44(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1162 <psd_noisemasker+0x42>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<psd_noisemasker>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r9,%r15
mov    %r8,0x10(%rsp)
mov    %rcx,%r13
mov    %rdx,%r12
mov    %rdi,%rbx
lea    0x0(,%rsi,4),%edx
xor    %ebp,%ebp
mov    %r9,%rdi
xor    %esi,%esi
call   1030 <memset@plt>
xor    %edx,%edx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movl   $0x0,0x8(%rsp)
mov    0x0(%r13,%rbp,4),%r14d
test   %r14d,%r14d
je     11b7 <psd_noisemasker+0x97>
lea    -0x1(%r14),%ecx
mov    %rbx,%rdi
mov    %r12,%rsi
mov    %ebp,%r8d
mov    0x10(%rsp),%r9
lea    0x8(%rsp),%rax
push   %rax
lea    0x14(%rsp),%rax
push   %rax
call   1040 <noisemasker_band_fast@plt>
add    $0x10,%rsp
movss  0xc(%rsp),%xmm0
movslq 0x8(%rsp),%rax
movss  %xmm0,(%r15,%rax,4)
add    $0x1,%rbp
mov    %r14d,%edx
cmp    $0x19,%rbp
jne    1160 <psd_noisemasker+0x40>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @psd_noisemasker(float* %0, i32 %1, i32* %2, i32* %3, float* %4, float* %5) {
%7 = alloca float*
%8 = alloca i32
%9 = alloca i32*
%10 = alloca i32*
%11 = alloca float*
%12 = alloca float*
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca float
%17 = alloca i32
store float* %0, float** %7
store i32 %1, i32* %8
store i32* %2, i32** %9
store i32* %3, i32** %10
store float* %4, float** %11
store float* %5, float** %12
store i32 0, i32* %14
%18 = load float*, float** %12
%19 = load i32, i32* %8
%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* %13
br label %24
24: ; preds = %56, %6
%25 = load i32, i32* %13
%26 = icmp slt i32 %25, 25
br i1 %26, label %27, label %59
27: ; preds = %24
store i32 0, i32* %17
%28 = load i32*, i32** %10
%29 = load i32, i32* %13
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i32, i32* %28, i64 %30
%32 = load i32, i32* %31
%33 = icmp eq i32 %32, 0
br i1 %33, label %34, label %35
34: ; preds = %27
br label %59
35: ; preds = %27
%36 = load i32*, i32** %10
%37 = load i32, i32* %13
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds i32, i32* %36, i64 %38
%40 = load i32, i32* %39
%41 = sub nsw i32 %40, 1
store i32 %41, i32* %15
%42 = load float*, float** %7
%43 = load i32*, i32** %9
%44 = load i32, i32* %14
%45 = load i32, i32* %15
%46 = load i32, i32* %13
%47 = load float*, float** %11
%48 = call i32 @noisemasker_band_fast(float* %42, i32* %43, i32 %44, i32 %45, i32 %46, float* %47, float* %16, i32* %17)
%49 = load i32, i32* %15
%50 = add nsw i32 %49, 1
store i32 %50, i32* %14
%51 = load float, float* %16
%52 = load float*, float** %12
%53 = load i32, i32* %17
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds float, float* %52, i64 %54
store float %51, float* %55
br label %56
56: ; preds = %35
%57 = load i32, i32* %13
%58 = add nsw i32 %57, 1
store i32 %58, i32* %13
br label %24
59: ; preds = %34, %24
ret i32 0
}

LLVM IR (-O2):
define i32 @psd_noisemasker(float* %0, i32 %1, i32* %2, i32* nocapture %3, float* %4, float* %5) {
%7 = alloca float
%8 = alloca i32
%9 = bitcast float* %7 to i8*
%10 = bitcast i32* %8 to i8*
%11 = shl i32 %1, 2
%12 = tail call i32 @memset(float* %5, i32 0, i32 %11)
br label %13
13: ; preds = %6, %19
%14 = phi i64 [ 0, %6 ], [ %27, %19 ]
%15 = phi i32 [ 0, %6 ], [ %17, %19 ]
store i32 0, i32* %8
%16 = getelementptr inbounds i32, i32* %3, i64 %14
%17 = load i32, i32* %16
%18 = icmp eq i32 %17, 0
br i1 %18, label %29, label %19
19: ; preds = %13
%20 = add nsw i32 %17, -1
%21 = trunc i64 %14 to i32
%22 = call i32 @noisemasker_band_fast(float* %0, i32* %2, i32 %15, i32 %20, i32 %21, float* %4, float* %7, i32* %8)
%23 = load float, float* %7
%24 = load i32, i32* %8
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds float, float* %5, i64 %25
store float %23, float* %26
%27 = add nuw nsw i64 %14, 1
%28 = icmp eq i64 %27, 25
br i1 %28, label %29, label %13
29: ; preds = %13, %19
ret i32 0
}