#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 ath(float);
int floor(float);
float freq2bark(float);
float freqbin2freq(float, int, int);
int /*<<< orphan*/ memset(int *, int /*<<< orphan*/, int);
int nm_pos_geomean(int, int);
int caculate_cb_info(float fs, int psd_len, float *psd_ath, int cb_hopbin[25],
                     float geomean_table[25], float *psd_bark) {
  int i;
  int k;
  float f;
  int band;
  band = 0;
  memset(cb_hopbin, 0, sizeof(int) * 25);
  for (i = 0; i < 25; i++)
    geomean_table[i] = 1;
  for (k = 0; k < psd_len; k++) {
    f = freqbin2freq(fs, psd_len * 2, k);
    psd_ath[k] = ath(f);
    psd_bark[k] = freq2bark(f);
    if ((floor(psd_bark[k]) > band) && (band < 25)) {
      cb_hopbin[band] = k;
      if (band == 0)
        geomean_table[band] = nm_pos_geomean(1, cb_hopbin[band]) - 1;
      else
        geomean_table[band] =
            nm_pos_geomean(cb_hopbin[band - 1], cb_hopbin[band]) - 1;
      band++;
    }
  }
  return band;
}


x86 assembly (clang, -O0):
<caculate_cb_info>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movss  %xmm0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
movl   $0x0,-0x38(%rbp)
mov    -0x18(%rbp),%rdi
xor    %esi,%esi
mov    $0x64,%edx
call   1040 <memset@plt>
movl   $0x0,-0x2c(%rbp)
cmpl   $0x19,-0x2c(%rbp)
jge    11cb <caculate_cb_info+0x6b>
mov    -0x20(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movss  0xe48(%rip),%xmm0
movss  %xmm0,(%rax,%rcx,4)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    119e <caculate_cb_info+0x3e>
movl   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    12df <caculate_cb_info+0x17f>
movss  -0x4(%rbp),%xmm0
mov    -0x8(%rbp),%edi
shl    $0x1,%edi
mov    -0x30(%rbp),%esi
call   1050 <freqbin2freq@plt>
movss  %xmm0,-0x34(%rbp)
movss  -0x34(%rbp),%xmm0
call   1080 <ath@plt>
mov    -0x10(%rbp),%rax
movslq -0x30(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
movss  -0x34(%rbp),%xmm0
call   1030 <freq2bark@plt>
mov    -0x28(%rbp),%rax
movslq -0x30(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x28(%rbp),%rax
movslq -0x30(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
call   1070 <floor@plt>
cmp    -0x38(%rbp),%eax
jle    12cc <caculate_cb_info+0x16c>
cmpl   $0x19,-0x38(%rbp)
jge    12cc <caculate_cb_info+0x16c>
mov    -0x30(%rbp),%edx
mov    -0x18(%rbp),%rax
movslq -0x38(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
cmpl   $0x0,-0x38(%rbp)
jne    128f <caculate_cb_info+0x12f>
mov    -0x18(%rbp),%rax
movslq -0x38(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
mov    $0x1,%edi
call   1060 <nm_pos_geomean@plt>
sub    $0x1,%eax
cvtsi2ss %eax,%xmm0
mov    -0x20(%rbp),%rax
movslq -0x38(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
jmp    12c3 <caculate_cb_info+0x163>
mov    -0x18(%rbp),%rax
mov    -0x38(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%edi
mov    -0x18(%rbp),%rax
movslq -0x38(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
call   1060 <nm_pos_geomean@plt>
sub    $0x1,%eax
cvtsi2ss %eax,%xmm0
mov    -0x20(%rbp),%rax
movslq -0x38(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    12d1 <caculate_cb_info+0x171>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    11d2 <caculate_cb_info+0x72>
mov    -0x38(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<caculate_cb_info>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %r8,%r12
mov    %rcx,%r14
mov    %rsi,%r13
mov    %edi,%r15d
movss  %xmm0,0x8(%rsp)
xor    %ebx,%ebx
mov    %rdx,0x18(%rsp)
mov    %rdx,%rdi
xor    %esi,%esi
mov    $0x64,%edx
call   1040 <memset@plt>
movaps 0xe63(%rip),%xmm0
movups %xmm0,(%r14)
movups %xmm0,0x10(%r14)
movups %xmm0,0x20(%r14)
movups %xmm0,0x30(%r14)
movups %xmm0,0x40(%r14)
movups %xmm0,0x50(%r14)
mov    %r14,0x20(%rsp)
movl   $0x3f800000,0x60(%r14)
3f
test   %r15d,%r15d
jle    1289 <caculate_cb_info+0x129>
mov    %r15d,%ebp
add    %r15d,%r15d
xor    %r14d,%r14d
xor    %ebx,%ebx
mov    %rbp,0x10(%rsp)
jmp    1226 <caculate_cb_info+0xc6>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    -0x4(%rax,%r12,4),%edi
mov    %r14d,%esi
call   1060 <nm_pos_geomean@plt>
add    $0xffffffff,%eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
mov    0x20(%rsp),%rax
movss  %xmm0,(%rax,%r12,4)
add    $0x1,%ebx
mov    %rbp,%r12
mov    0x10(%rsp),%rbp
add    $0x1,%r14
cmp    %r14,%rbp
je     1289 <caculate_cb_info+0x129>
movss  0x8(%rsp),%xmm0
mov    %r15d,%edi
mov    %r14d,%esi
call   1050 <freqbin2freq@plt>
movss  %xmm0,0xc(%rsp)
call   1080 <ath@plt>
movss  %xmm0,0x0(%r13,%r14,4)
movss  0xc(%rsp),%xmm0
call   1030 <freq2bark@plt>
movss  %xmm0,(%r12,%r14,4)
call   1070 <floor@plt>
cmp    $0x18,%ebx
jg     121d <caculate_cb_info+0xbd>
cmp    %ebx,%eax
jle    121d <caculate_cb_info+0xbd>
mov    %r12,%rbp
movslq %ebx,%r12
mov    0x18(%rsp),%rax
mov    %r14d,(%rax,%r12,4)
test   %ebx,%ebx
jne    11f0 <caculate_cb_info+0x90>
mov    $0x1,%edi
jmp    11f5 <caculate_cb_info+0x95>
mov    %ebx,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @caculate_cb_info(float %0, i32 %1, float* nocapture writeonly %2, i32* %3, float* nocapture writeonly %4, float* nocapture writeonly %5) {
%7 = tail call i32 @memset(i32* %3, i32 0, i32 100)
%8 = bitcast float* %4 to <4 x float>*
store <4 x float> <float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00>, <4 x float>* %8
%9 = getelementptr inbounds float, float* %4, i64 4
%10 = bitcast float* %9 to <4 x float>*
store <4 x float> <float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00>, <4 x float>* %10
%11 = getelementptr inbounds float, float* %4, i64 8
%12 = bitcast float* %11 to <4 x float>*
store <4 x float> <float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00>, <4 x float>* %12
%13 = getelementptr inbounds float, float* %4, i64 12
%14 = bitcast float* %13 to <4 x float>*
store <4 x float> <float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00>, <4 x float>* %14
%15 = getelementptr inbounds float, float* %4, i64 16
%16 = bitcast float* %15 to <4 x float>*
store <4 x float> <float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00>, <4 x float>* %16
%17 = getelementptr inbounds float, float* %4, i64 20
%18 = bitcast float* %17 to <4 x float>*
store <4 x float> <float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00>, <4 x float>* %18
%19 = getelementptr inbounds float, float* %4, i64 24
store float 1.000000e+00, float* %19
%20 = icmp sgt i32 %1, 0
br i1 %20, label %21, label %57
21: ; preds = %6
%22 = shl nuw nsw i32 %1, 1
%23 = zext i32 %1 to i64
br label %24
24: ; preds = %21, %53
%25 = phi i64 [ 0, %21 ], [ %55, %53 ]
%26 = phi i32 [ 0, %21 ], [ %54, %53 ]
%27 = trunc i64 %25 to i32
%28 = tail call float @freqbin2freq(float %0, i32 %22, i32 %27)
%29 = tail call float @ath(float %28)
%30 = getelementptr inbounds float, float* %2, i64 %25
store float %29, float* %30
%31 = tail call float @freq2bark(float %28)
%32 = getelementptr inbounds float, float* %5, i64 %25
store float %31, float* %32
%33 = tail call i32 @floor(float %31)
%34 = icmp sgt i32 %33, %26
%35 = icmp slt i32 %26, 25
%36 = and i1 %35, %34
br i1 %36, label %37, label %53
37: ; preds = %24
%38 = sext i32 %26 to i64
%39 = getelementptr inbounds i32, i32* %3, i64 %38
store i32 %27, i32* %39
%40 = icmp eq i32 %26, 0
br i1 %40, label %46, label %41
41: ; preds = %37
%42 = add nsw i32 %26, -1
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds i32, i32* %3, i64 %43
%45 = load i32, i32* %44
br label %46
46: ; preds = %37, %41
%47 = phi i32 [ %45, %41 ], [ 1, %37 ]
%48 = tail call i32 @nm_pos_geomean(i32 %47, i32 %27)
%49 = add nsw i32 %48, -1
%50 = sitofp i32 %49 to float
%51 = getelementptr inbounds float, float* %4, i64 %38
store float %50, float* %51
%52 = add nsw i32 %26, 1
br label %53
53: ; preds = %24, %46
%54 = phi i32 [ %52, %46 ], [ %26, %24 ]
%55 = add nuw nsw i64 %25, 1
%56 = icmp eq i64 %55, %23
br i1 %56, label %57, label %24
57: ; preds = %53, %6
%58 = phi i32 [ 0, %6 ], [ %54, %53 ]
ret i32 %58
}