#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 */
double ath(double);
int floor(double);
double freq2bark(double);
double freqbin2freq(double, int, int);
int /*<<< orphan*/ memset(int *, int /*<<< orphan*/, int);
int nm_pos_geomean(int, int);
int caculate_cb_info(double fs, int psd_len, double *psd_ath, int cb_hopbin[25],
                     double geomean_table[25], double *psd_bark) {
  int i;
  int k;
  double 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    $0x50,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %edi,-0xc(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
movl   $0x0,-0x44(%rbp)
mov    -0x20(%rbp),%rdi
xor    %esi,%esi
mov    $0x64,%edx
call   1040 <memset@plt>
movl   $0x0,-0x34(%rbp)
cmpl   $0x19,-0x34(%rbp)
jge    11cb <caculate_cb_info+0x6b>
mov    -0x28(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  0xe48(%rip),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    119e <caculate_cb_info+0x3e>
movl   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    12df <caculate_cb_info+0x17f>
movsd  -0x8(%rbp),%xmm0
mov    -0xc(%rbp),%edi
shl    $0x1,%edi
mov    -0x38(%rbp),%esi
call   1050 <freqbin2freq@plt>
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm0
call   1080 <ath@plt>
mov    -0x18(%rbp),%rax
movslq -0x38(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x40(%rbp),%xmm0
call   1030 <freq2bark@plt>
mov    -0x30(%rbp),%rax
movslq -0x38(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x30(%rbp),%rax
movslq -0x38(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
call   1070 <floor@plt>
cmp    -0x44(%rbp),%eax
jle    12cc <caculate_cb_info+0x16c>
cmpl   $0x19,-0x44(%rbp)
jge    12cc <caculate_cb_info+0x16c>
mov    -0x38(%rbp),%edx
mov    -0x20(%rbp),%rax
movslq -0x44(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
cmpl   $0x0,-0x44(%rbp)
jne    128f <caculate_cb_info+0x12f>
mov    -0x20(%rbp),%rax
movslq -0x44(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
mov    $0x1,%edi
call   1060 <nm_pos_geomean@plt>
sub    $0x1,%eax
cvtsi2sd %eax,%xmm0
mov    -0x28(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
jmp    12c3 <caculate_cb_info+0x163>
mov    -0x20(%rbp),%rax
mov    -0x44(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%edi
mov    -0x20(%rbp),%rax
movslq -0x44(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
call   1060 <nm_pos_geomean@plt>
sub    $0x1,%eax
cvtsi2sd %eax,%xmm0
mov    -0x28(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    12d1 <caculate_cb_info+0x171>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    11d2 <caculate_cb_info+0x72>
mov    -0x44(%rbp),%eax
add    $0x50,%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,%rbp
mov    %rsi,%r13
mov    %edi,%r14d
movsd  %xmm0,0x18(%rsp)
xor    %ebx,%ebx
mov    %rdx,0x8(%rsp)
mov    %rdx,%rdi
xor    %esi,%esi
mov    $0x64,%edx
call   1040 <memset@plt>
movapd 0xe62(%rip),%xmm0
movupd %xmm0,0x0(%rbp)
movupd %xmm0,0x10(%rbp)
movupd %xmm0,0x20(%rbp)
movupd %xmm0,0x30(%rbp)
movupd %xmm0,0x40(%rbp)
movupd %xmm0,0x50(%rbp)
movupd %xmm0,0x60(%rbp)
movupd %xmm0,0x70(%rbp)
movupd %xmm0,0x80(%rbp)
movupd %xmm0,0x90(%rbp)
movupd %xmm0,0xa0(%rbp)
movupd %xmm0,0xb0(%rbp)
movabs $0x3ff0000000000000,%rax
mov    %rbp,0x10(%rsp)
mov    %rax,0xc0(%rbp)
test   %r14d,%r14d
jle    12b8 <caculate_cb_info+0x158>
mov    %r14d,%ebp
add    %r14d,%r14d
xor    %r15d,%r15d
xor    %ebx,%ebx
mov    %rbp,(%rsp)
jmp    1255 <caculate_cb_info+0xf5>
cs nopw 0x0(%rax,%rax,1)
mov    -0x4(%rax,%r12,4),%edi
mov    %r15d,%esi
call   1060 <nm_pos_geomean@plt>
add    $0xffffffff,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mov    0x10(%rsp),%rax
movsd  %xmm0,(%rax,%r12,8)
add    $0x1,%ebx
mov    %rbp,%r12
mov    (%rsp),%rbp
add    $0x1,%r15
cmp    %r15,%rbp
je     12b8 <caculate_cb_info+0x158>
movsd  0x18(%rsp),%xmm0
mov    %r14d,%edi
mov    %r15d,%esi
call   1050 <freqbin2freq@plt>
movsd  %xmm0,0x20(%rsp)
call   1080 <ath@plt>
movsd  %xmm0,0x0(%r13,%r15,8)
movsd  0x20(%rsp),%xmm0
call   1030 <freq2bark@plt>
movsd  %xmm0,(%r12,%r15,8)
call   1070 <floor@plt>
cmp    $0x18,%ebx
jg     124c <caculate_cb_info+0xec>
cmp    %ebx,%eax
jle    124c <caculate_cb_info+0xec>
mov    %r12,%rbp
movslq %ebx,%r12
mov    0x8(%rsp),%rax
mov    %r15d,(%rax,%r12,4)
test   %ebx,%ebx
jne    1220 <caculate_cb_info+0xc0>
mov    $0x1,%edi
jmp    1225 <caculate_cb_info+0xc5>
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(double %0, i32 %1, double* %2, i32* %3, double* %4, double* %5) {
%7 = alloca double
%8 = alloca i32
%9 = alloca double*
%10 = alloca i32*
%11 = alloca double*
%12 = alloca double*
%13 = alloca i32
%14 = alloca i32
%15 = alloca double
%16 = alloca i32
store double %0, double* %7
store i32 %1, i32* %8
store double* %2, double** %9
store i32* %3, i32** %10
store double* %4, double** %11
store double* %5, double** %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 double*, double** %11
%24 = load i32, i32* %13
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds double, double* %23, i64 %25
store double 1.000000e+00, double* %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 double, double* %7
%37 = load i32, i32* %8
%38 = mul nsw i32 %37, 2
%39 = load i32, i32* %14
%40 = call double @freqbin2freq(double %36, i32 %38, i32 %39)
store double %40, double* %15
%41 = load double, double* %15
%42 = call double @ath(double %41)
%43 = load double*, double** %9
%44 = load i32, i32* %14
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds double, double* %43, i64 %45
store double %42, double* %46
%47 = load double, double* %15
%48 = call double @freq2bark(double %47)
%49 = load double*, double** %12
%50 = load i32, i32* %14
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds double, double* %49, i64 %51
store double %48, double* %52
%53 = load double*, double** %12
%54 = load i32, i32* %14
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds double, double* %53, i64 %55
%57 = load double, double* %56
%58 = call i32 @floor(double %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 double
%81 = load double*, double** %11
%82 = load i32, i32* %16
%83 = sext i32 %82 to i64
%84 = getelementptr inbounds double, double* %81, i64 %83
store double %80, double* %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 double
%100 = load double*, double** %11
%101 = load i32, i32* %16
%102 = sext i32 %101 to i64
%103 = getelementptr inbounds double, double* %100, i64 %102
store double %99, double* %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(double %0, i32 %1, double* nocapture writeonly %2, i32* %3, double* nocapture writeonly %4, double* nocapture writeonly %5) {
%7 = tail call i32 @memset(i32* %3, i32 0, i32 100)
%8 = bitcast double* %4 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %8
%9 = getelementptr inbounds double, double* %4, i64 2
%10 = bitcast double* %9 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %10
%11 = getelementptr inbounds double, double* %4, i64 4
%12 = bitcast double* %11 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %12
%13 = getelementptr inbounds double, double* %4, i64 6
%14 = bitcast double* %13 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %14
%15 = getelementptr inbounds double, double* %4, i64 8
%16 = bitcast double* %15 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %16
%17 = getelementptr inbounds double, double* %4, i64 10
%18 = bitcast double* %17 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %18
%19 = getelementptr inbounds double, double* %4, i64 12
%20 = bitcast double* %19 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %20
%21 = getelementptr inbounds double, double* %4, i64 14
%22 = bitcast double* %21 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %22
%23 = getelementptr inbounds double, double* %4, i64 16
%24 = bitcast double* %23 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %24
%25 = getelementptr inbounds double, double* %4, i64 18
%26 = bitcast double* %25 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %26
%27 = getelementptr inbounds double, double* %4, i64 20
%28 = bitcast double* %27 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %28
%29 = getelementptr inbounds double, double* %4, i64 22
%30 = bitcast double* %29 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %30
%31 = getelementptr inbounds double, double* %4, i64 24
store double 1.000000e+00, double* %31
%32 = icmp sgt i32 %1, 0
br i1 %32, label %33, label %69
33: ; preds = %6
%34 = shl nuw nsw i32 %1, 1
%35 = zext i32 %1 to i64
br label %36
36: ; preds = %33, %65
%37 = phi i64 [ 0, %33 ], [ %67, %65 ]
%38 = phi i32 [ 0, %33 ], [ %66, %65 ]
%39 = trunc i64 %37 to i32
%40 = tail call double @freqbin2freq(double %0, i32 %34, i32 %39)
%41 = tail call double @ath(double %40)
%42 = getelementptr inbounds double, double* %2, i64 %37
store double %41, double* %42
%43 = tail call double @freq2bark(double %40)
%44 = getelementptr inbounds double, double* %5, i64 %37
store double %43, double* %44
%45 = tail call i32 @floor(double %43)
%46 = icmp sgt i32 %45, %38
%47 = icmp slt i32 %38, 25
%48 = and i1 %47, %46
br i1 %48, label %49, label %65
49: ; preds = %36
%50 = sext i32 %38 to i64
%51 = getelementptr inbounds i32, i32* %3, i64 %50
store i32 %39, i32* %51
%52 = icmp eq i32 %38, 0
br i1 %52, label %58, label %53
53: ; preds = %49
%54 = add nsw i32 %38, -1
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds i32, i32* %3, i64 %55
%57 = load i32, i32* %56
br label %58
58: ; preds = %49, %53
%59 = phi i32 [ %57, %53 ], [ 1, %49 ]
%60 = tail call i32 @nm_pos_geomean(i32 %59, i32 %39)
%61 = add nsw i32 %60, -1
%62 = sitofp i32 %61 to double
%63 = getelementptr inbounds double, double* %4, i64 %50
store double %62, double* %63
%64 = add nsw i32 %38, 1
br label %65
65: ; preds = %36, %58
%66 = phi i32 [ %64, %58 ], [ %38, %36 ]
%67 = add nuw nsw i64 %37, 1
%68 = icmp eq i64 %67, %35
br i1 %68, label %69, label %36
69: ; preds = %65, %6
%70 = phi i32 [ 0, %6 ], [ %66, %65 ]
ret i32 %70
}