int main(int argc, char **argv) {
  int i;
  int *fp;
  double phase, phsinc = (2. * 3.14159265358979323846) / (1 << 15);
  printf("#define ILOGCOSTABSIZE 15\n");
  printf("#define ICOSTABSIZE (1<<ILOGCOSTABSIZE)\n");
  printf("static t_sample cos_table[] = {");
  for (i = (1 << 15) + 1, phase = 0; i--; phase += phsinc) {
    printf("%d,", ((int)((cos(phase)) * (double)((float)(1 << 18)) + 0.5)));
  }
  printf("0};\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movsd  0xec2(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
lea    0xece(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xedb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xef6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x8001,-0x14(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x14(%rbp)
cmp    $0x0,%eax
je     11d8 <main+0xb8>
movsd  -0x28(%rbp),%xmm0
call   1040 <cos@plt>
movsd  0xe66(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe62(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%esi
lea    0xebf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsd  -0x30(%rbp),%xmm0
addsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
jmp    117c <main+0x5c>
lea    0xea1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
lea    0xf02(%rip),%rdi
call   1030 <puts@plt>
lea    0xf10(%rip),%rdi
call   1030 <puts@plt>
lea    0xec6(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xorpd  %xmm0,%xmm0
mov    $0xffff7fff,%ebp
lea    0xecf(%rip),%rbx
nopl   0x0(%rax)
movsd  %xmm0,(%rsp)
movsd  (%rsp),%xmm0
call   1050 <cos@plt>
mulsd  0xe79(%rip),%xmm0
addsd  0xe79(%rip),%xmm0
cvttsd2si %xmm0,%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movsd  (%rsp),%xmm0
addsd  0xe66(%rip),%xmm0
inc    %ebp
jne    1170 <main+0x40>
lea    0xec9(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [27 x i8] c"#define ILOGCOSTABSIZE 15\0A\00"
@.str.1 = [41 x i8] c"#define ICOSTABSIZE (1<<ILOGCOSTABSIZE)\0A\00"
@.str.2 = [32 x i8] c"static t_sample cos_table[] = {\00"
@.str.3 = [4 x i8] c"%d,\00"
@.str.4 = [5 x i8] c"0};\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32*
%8 = alloca double
%9 = alloca double
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store double 0x3F2921FB54442D18, double* %9
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0))
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0))
store i32 32769, i32* %6
store double 0.000000e+00, double* %8
br label %13
13: ; preds = %23, %2
%14 = load i32, i32* %6
%15 = add nsw i32 %14, -1
store i32 %15, i32* %6
%16 = icmp ne i32 %14, 0
br i1 %16, label %17, label %27
17: ; preds = %13
%18 = load double, double* %8
%19 = call double @cos(double %18)
%20 = call double @llvm.fmuladd.f64(double %19, double 2.621440e+05, double 5.000000e-01)
%21 = fptosi double %20 to i32
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %21)
br label %23
23: ; preds = %17
%24 = load double, double* %9
%25 = load double, double* %8
%26 = fadd double %25, %24
store double %26, double* %8
br label %13
27: ; preds = %13
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%29 = load i32, i32* %3
ret i32 %29
}

LLVM IR (-O2):
@.str.2 = [32 x i8] c"static t_sample cos_table[] = {\00"
@.str.3 = [4 x i8] c"%d,\00"
@str = [26 x i8] c"#define ILOGCOSTABSIZE 15\00"
@str.5 = [40 x i8] c"#define ICOSTABSIZE (1<<ILOGCOSTABSIZE)\00"
@str.6 = [4 x i8] c"0};\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str.5, i64 0, i64 0))
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0))
br label %6
6: ; preds = %2, %6
%7 = phi i32 [ 32769, %2 ], [ %9, %6 ]
%8 = phi double [ 0.000000e+00, %2 ], [ %14, %6 ]
%9 = add nsw i32 %7, -1
%10 = tail call double @cos(double %8)
%11 = tail call double @llvm.fmuladd.f64(double %10, double 2.621440e+05, double 5.000000e-01)
%12 = fptosi double %11 to i32
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %12)
%14 = fadd double %8, 0x3F2921FB54442D18
%15 = icmp eq i32 %9, 0
br i1 %15, label %16, label %6
16: ; preds = %6
%17 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str.6, i64 0, i64 0))
ret i32 0
}