#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 GetCenterFrequency(unsigned int);
double GetMagnitudeFactor(unsigned int filterBand) {
  double magnitudeFactor = 0.0f;
  if (filterBand >= 1 && filterBand <= 14) {
    magnitudeFactor = 0.015;
  } else if (filterBand >= 15 && filterBand <= 48) {
    magnitudeFactor = 2.0f / (GetCenterFrequency(filterBand + 1) -
                              GetCenterFrequency(filterBand - 1));
  }
  return magnitudeFactor;
}


x86 assembly (clang, -O0):
<GetMagnitudeFactor>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x10(%rbp)
cmpl   $0x1,-0x4(%rbp)
jb     1149 <GetMagnitudeFactor+0x39>
cmpl   $0xe,-0x4(%rbp)
ja     1149 <GetMagnitudeFactor+0x39>
movsd  0xec9(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    119b <GetMagnitudeFactor+0x8b>
cmpl   $0xf,-0x4(%rbp)
jb     1196 <GetMagnitudeFactor+0x86>
cmpl   $0x30,-0x4(%rbp)
ja     1196 <GetMagnitudeFactor+0x86>
mov    -0x4(%rbp),%edi
add    $0x1,%edi
call   1030 <GetCenterFrequency@plt>
movss  %xmm0,-0x14(%rbp)
mov    -0x4(%rbp),%edi
sub    $0x1,%edi
call   1030 <GetCenterFrequency@plt>
movss  -0x14(%rbp),%xmm1
subss  %xmm0,%xmm1
movss  0xe77(%rip),%xmm0
divss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    119b <GetMagnitudeFactor+0x8b>
movsd  -0x10(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GetMagnitudeFactor>:
push   %rbx
sub    $0x10,%rsp
lea    -0x1(%rdi),%ebx
cmp    $0xe,%ebx
jae    1127 <GetMagnitudeFactor+0x17>
movsd  0xedb(%rip),%xmm0
jmp    1161 <GetMagnitudeFactor+0x51>
lea    -0xf(%rdi),%eax
xorps  %xmm0,%xmm0
cmp    $0x21,%eax
ja     1161 <GetMagnitudeFactor+0x51>
add    $0x1,%edi
call   1030 <GetCenterFrequency@plt>
movss  %xmm0,0xc(%rsp)
mov    %ebx,%edi
call   1030 <GetCenterFrequency@plt>
movss  0xc(%rsp),%xmm1
subss  %xmm0,%xmm1
movss  0xeaf(%rip),%xmm0
divss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define double @GetMagnitudeFactor(i32 %0) {
%2 = alloca i32
%3 = alloca double
store i32 %0, i32* %2
store double 0.000000e+00, double* %3
%4 = load i32, i32* %2
%5 = icmp uge i32 %4, 1
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load i32, i32* %2
%8 = icmp ule i32 %7, 14
br i1 %8, label %9, label %10
9: ; preds = %6
store double 1.500000e-02, double* %3
br label %27
10: ; preds = %6, %1
%11 = load i32, i32* %2
%12 = icmp uge i32 %11, 15
br i1 %12, label %13, label %26
13: ; preds = %10
%14 = load i32, i32* %2
%15 = icmp ule i32 %14, 48
br i1 %15, label %16, label %26
16: ; preds = %13
%17 = load i32, i32* %2
%18 = add i32 %17, 1
%19 = call float @GetCenterFrequency(i32 %18)
%20 = load i32, i32* %2
%21 = sub i32 %20, 1
%22 = call float @GetCenterFrequency(i32 %21)
%23 = fsub float %19, %22
%24 = fdiv float 2.000000e+00, %23
%25 = fpext float %24 to double
store double %25, double* %3
br label %26
26: ; preds = %16, %13, %10
br label %27
27: ; preds = %26, %9
%28 = load double, double* %3
ret double %28
}

LLVM IR (-O2):
define double @GetMagnitudeFactor(i32 %0) {
%2 = add i32 %0, -1
%3 = icmp ult i32 %2, 14
br i1 %3, label %14, label %4
4: ; preds = %1
%5 = add i32 %0, -15
%6 = icmp ult i32 %5, 34
br i1 %6, label %7, label %14
7: ; preds = %4
%8 = add nuw nsw i32 %0, 1
%9 = tail call float @GetCenterFrequency(i32 %8)
%10 = tail call float @GetCenterFrequency(i32 %2)
%11 = fsub float %9, %10
%12 = fdiv float 2.000000e+00, %11
%13 = fpext float %12 to double
br label %14
14: ; preds = %1, %4, %7
%15 = phi double [ %13, %7 ], [ 0.000000e+00, %4 ], [ 1.500000e-02, %1 ]
ret double %15
}