#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 pow(int, double);
double note_to_freq(int n) {
  static double n2ftable[127];
  static int first = 1;
  if (first) {
    int i;
    first = 0;
    for (i = 0; i < 127; i++) {
      n2ftable[i] = 220 * pow(2, ((double)(i - 57)) / 12.0);
    }
  }
  return n2ftable[n];
}


x86 assembly (clang, -O0):
<note_to_freq>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,0x2f06(%rip)
je     1190 <note_to_freq+0x80>
movl   $0x0,0x2ef6(%rip)
movl   $0x0,-0x8(%rbp)
cmpl   $0x7f,-0x8(%rbp)
jge    118b <note_to_freq+0x7b>
mov    -0x8(%rbp),%eax
sub    $0x39,%eax
cvtsi2sd %eax,%xmm0
movsd  0xeab(%rip),%xmm1
divsd  %xmm1,%xmm0
mov    $0x2,%edi
call   1030 <pow@plt>
imul   $0xdc,%eax,%eax
cvtsi2sd %eax,%xmm0
movslq -0x8(%rbp),%rcx
lea    0x2ec8(%rip),%rax
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1139 <note_to_freq+0x29>
jmp    1190 <note_to_freq+0x80>
movslq -0x4(%rbp),%rcx
lea    0x2ea5(%rip),%rax
movsd  (%rax,%rcx,8),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<note_to_freq>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edi,%r14d
cmpb   $0x0,0x3317(%rip)
je     113d <note_to_freq+0x2d>
movslq %r14d,%rax
lea    0x2f13(%rip),%rcx
movsd  (%rcx,%rax,8),%xmm0
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
movb   $0x1,0x32f4(%rip)
mov    $0x8,%ebx
mov    $0xffffffc7,%ebp
lea    0x2eeb(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nop
xorps  %xmm0,%xmm0
cvtsi2sd %ebp,%xmm0
divsd  0xe91(%rip),%xmm0
mov    $0x2,%edi
call   1030 <pow@plt>
imul   $0xdc,%eax,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x8(%rbx,%r15,1)
cmp    $0x3f8,%rbx
je     1123 <note_to_freq+0x13>
lea    0x1(%rbp),%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
divsd  0xe58(%rip),%xmm0
mov    $0x2,%edi
call   1030 <pow@plt>
imul   $0xdc,%eax,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  %xmm0,(%rbx,%r15,1)
add    $0x10,%rbx
add    $0x2,%ebp
jmp    1160 <note_to_freq+0x50>

LLVM IR (-O0):
@note_to_freq.n2ftable = internal global [127 x double] zeroinitializer
@note_to_freq.first = internal global i32 1
define double @note_to_freq(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* @note_to_freq.first
%5 = icmp ne i32 %4, 0
br i1 %5, label %6, label %25
6: ; preds = %1
store i32 0, i32* @note_to_freq.first
store i32 0, i32* %3
br label %7
7: ; preds = %21, %6
%8 = load i32, i32* %3
%9 = icmp slt i32 %8, 127
br i1 %9, label %10, label %24
10: ; preds = %7
%11 = load i32, i32* %3
%12 = sub nsw i32 %11, 57
%13 = sitofp i32 %12 to double
%14 = fdiv double %13, 1.200000e+01
%15 = call i32 @pow(i32 2, double %14)
%16 = mul nsw i32 220, %15
%17 = sitofp i32 %16 to double
%18 = load i32, i32* %3
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [127 x double], [127 x double]* @note_to_freq.n2ftable, i64 0, i64 %19
store double %17, double* %20
br label %21
21: ; preds = %10
%22 = load i32, i32* %3
%23 = add nsw i32 %22, 1
store i32 %23, i32* %3
br label %7
24: ; preds = %7
br label %25
25: ; preds = %24, %1
%26 = load i32, i32* %2
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [127 x double], [127 x double]* @note_to_freq.n2ftable, i64 0, i64 %27
%29 = load double, double* %28
ret double %29
}

LLVM IR (-O2):
@note_to_freq.n2ftable = internal unnamed_addr global [127 x double] zeroinitializer
@note_to_freq.first = internal unnamed_addr global i1 false
define double @note_to_freq(i32 %0) {
%2 = load i1, i1* @note_to_freq.first
br i1 %2, label %26, label %3
3: ; preds = %1
store i1 true, i1* @note_to_freq.first
br label %4
4: ; preds = %16, %3
%5 = phi i64 [ 0, %3 ], [ %25, %16 ]
%6 = trunc i64 %5 to i32
%7 = add nsw i32 %6, -57
%8 = sitofp i32 %7 to double
%9 = fdiv double %8, 1.200000e+01
%10 = tail call i32 @pow(i32 2, double %9)
%11 = mul nsw i32 %10, 220
%12 = sitofp i32 %11 to double
%13 = getelementptr inbounds [127 x double], [127 x double]* @note_to_freq.n2ftable, i64 0, i64 %5
store double %12, double* %13
%14 = or i64 %5, 1
%15 = icmp eq i64 %14, 127
br i1 %15, label %26, label %16
16: ; preds = %4
%17 = trunc i64 %14 to i32
%18 = add nsw i32 %17, -57
%19 = sitofp i32 %18 to double
%20 = fdiv double %19, 1.200000e+01
%21 = tail call i32 @pow(i32 2, double %20)
%22 = mul nsw i32 %21, 220
%23 = sitofp i32 %22 to double
%24 = getelementptr inbounds [127 x double], [127 x double]* @note_to_freq.n2ftable, i64 0, i64 %14
store double %23, double* %24
%25 = add nuw nsw i64 %5, 2
br label %4
26: ; preds = %4, %1
%27 = sext i32 %0 to i64
%28 = getelementptr inbounds [127 x double], [127 x double]* @note_to_freq.n2ftable, i64 0, i64 %27
%29 = load double, double* %28
ret double %29
}