#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 */
typedef int uint32_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
double cos(double);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fwrite(int *, int, int, int /*<<< orphan*/ *);
double pow(double, double);
double sin(double);
int main(int argc, char **argv) {
  int samples = 128;
  uint32_t waves[2 * samples];
  double step1 = (2.0 * 3.14159265359) / (512.0 / 8.0);
  double step2 = (2.0 * 3.14159265359) / (512.0 / 12.0);
  double ampl = pow(2.0, 22.5);
  for (int i = 0; i < samples; i++) {
    waves[2 * i] = ((uint32_t)(ampl * sin(step1 * (float)i))) & 0xFFFFFF;
    waves[2 * i + 1] = ((uint32_t)(ampl * cos(step2 * (float)i))) & 0xFFFFFF;
    waves[2 * i + 1] |= 0x01000000;
  }
  FILE *fo = fopen("waves_8_12.bin", "wb");
  fwrite(waves, samples, 8, fo);
  fclose(fo);
  step1 = (2.0 * 3.14159265359) / (512.0 / 11.0);
  step2 = (2.0 * 3.14159265359) / (512.0 / 7.0);
  samples = 512;
  uint32_t waves2[2 * samples];
  for (int i = 0; i < samples; i++) {
    waves2[2 * i] = ((uint32_t)(ampl * sin(step1 * (float)i))) & 0xFFFFFF;
    waves2[2 * i + 1] = ((uint32_t)(ampl * cos(step2 * (float)i))) & 0xFFFFFF;
    waves2[2 * i + 1] |= 0x01000000;
  }
  fo = fopen("waves_11_7.bin", "wb");
  fwrite(waves2, samples, 8, fo);
  fclose(fo);
  samples = 256;
  uint32_t mono[samples];
  double stepmono = (2.0 * 3.14159265359) / 51.2;
  double amplmono = pow(2.0, 21.8);
  for (int i = 0; i < samples; i++) {
    waves[i] = ((uint32_t)(amplmono * sin(stepmono * (float)i))) & 0xFFFFFF;
    waves[i] |= 0x02000000;
  }
  fo = fopen("wave_10.bin", "wb");
  fwrite(waves, samples, 4, fo);
  fclose(fo);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x80,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    %eax,%eax
mov    %rsp,%rcx
mov    %rcx,-0x20(%rbp)
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x88(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x28(%rbp)
movsd  0xe64(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xe4f(%rip),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  0xe32(%rip),%xmm0
movsd  0xe32(%rip),%xmm1
call   1070 <pow@plt>
movsd  %xmm0,-0x40(%rbp)
movl   $0x0,-0x44(%rbp)
mov    -0x44(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    12bc <main+0x15c>
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
movsd  -0x30(%rbp),%xmm0
cvtsi2ssl -0x44(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  %xmm1,%xmm0
call   1040 <sin@plt>
mov    -0x88(%rbp),%rax
movaps %xmm0,%xmm1
movsd  -0x98(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edx
and    $0xffffff,%edx
mov    -0x44(%rbp),%ecx
shl    $0x1,%ecx
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x38(%rbp),%xmm0
cvtsi2ssl -0x44(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  %xmm1,%xmm0
call   1050 <cos@plt>
mov    -0x88(%rbp),%rax
movaps %xmm0,%xmm1
movsd  -0x90(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edx
and    $0xffffff,%edx
mov    -0x44(%rbp),%ecx
shl    $0x1,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x44(%rbp),%ecx
shl    $0x1,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%edx
or     $0x1000000,%edx
mov    %edx,(%rax,%rcx,4)
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    11e7 <main+0x87>
lea    0xd6d(%rip),%rdi
lea    0xd75(%rip),%rsi
call   1060 <fopen@plt>
mov    -0x88(%rbp),%rdi
mov    %rax,-0x50(%rbp)
mov    -0x14(%rbp),%esi
mov    -0x50(%rbp),%rcx
mov    $0x8,%edx
call   1080 <fwrite@plt>
mov    -0x50(%rbp),%rdi
call   1030 <fclose@plt>
movabs $0x3fc1475cc9eee041,%rax
47 c1 3f
mov    %rax,-0x30(%rbp)
movabs $0x3fb5fdbbe9bba90d,%rax
fd b5 3f
mov    %rax,-0x38(%rbp)
movl   $0x200,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    %eax,%eax
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0xa0(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x58(%rbp)
movl   $0x0,-0x5c(%rbp)
mov    -0x5c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1418 <main+0x2b8>
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0xb0(%rbp)
ff
movsd  -0x30(%rbp),%xmm0
cvtsi2ssl -0x5c(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  %xmm1,%xmm0
call   1040 <sin@plt>
mov    -0xa0(%rbp),%rax
movaps %xmm0,%xmm1
movsd  -0xb0(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edx
and    $0xffffff,%edx
mov    -0x5c(%rbp),%ecx
shl    $0x1,%ecx
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
movsd  -0x38(%rbp),%xmm0
cvtsi2ssl -0x5c(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  %xmm1,%xmm0
call   1050 <cos@plt>
mov    -0xa0(%rbp),%rax
movaps %xmm0,%xmm1
movsd  -0xa8(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edx
and    $0xffffff,%edx
mov    -0x5c(%rbp),%ecx
shl    $0x1,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x5c(%rbp),%ecx
shl    $0x1,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%edx
or     $0x1000000,%edx
mov    %edx,(%rax,%rcx,4)
mov    -0x5c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x5c(%rbp)
jmp    1343 <main+0x1e3>
lea    0xc23(%rip),%rdi
lea    0xc19(%rip),%rsi
call   1060 <fopen@plt>
mov    -0xa0(%rbp),%rdi
mov    %rax,-0x50(%rbp)
mov    -0x14(%rbp),%esi
mov    -0x50(%rbp),%rcx
mov    $0x8,%edx
call   1080 <fwrite@plt>
mov    -0x50(%rbp),%rdi
call   1030 <fclose@plt>
movl   $0x100,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %rax,-0x68(%rbp)
movsd  0xbc2(%rip),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  0xb8d(%rip),%xmm0
movsd  0xba5(%rip),%xmm1
call   1070 <pow@plt>
movsd  %xmm0,-0x78(%rbp)
movl   $0x0,-0x7c(%rbp)
mov    -0x7c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1501 <main+0x3a1>
movsd  -0x78(%rbp),%xmm0
movsd  %xmm0,-0xb8(%rbp)
ff
movsd  -0x70(%rbp),%xmm0
cvtsi2ssl -0x7c(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  %xmm1,%xmm0
call   1040 <sin@plt>
mov    -0x88(%rbp),%rax
movaps %xmm0,%xmm1
movsd  -0xb8(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edx
and    $0xffffff,%edx
movslq -0x7c(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
movslq -0x7c(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
or     $0x2000000,%edx
mov    %edx,(%rax,%rcx,4)
mov    -0x7c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x7c(%rbp)
jmp    148c <main+0x32c>
lea    0xb49(%rip),%rdi
lea    0xb30(%rip),%rsi
call   1060 <fopen@plt>
mov    -0x88(%rbp),%rdi
mov    %rax,-0x50(%rbp)
mov    -0x14(%rbp),%esi
mov    -0x50(%rbp),%rcx
mov    $0x4,%edx
call   1080 <fwrite@plt>
mov    -0x50(%rbp),%rdi
call   1030 <fclose@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %rbx
sub    $0x408,%rsp
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xorps  %xmm0,%xmm0
cvtsi2ss %ebx,%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
mulsd  0xe78(%rip),%xmm0
call   1040 <sin@plt>
movsd  0xe73(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
and    $0xffffff,%eax
mov    %eax,-0x420(%rbp,%rbx,8)
movsd  -0x20(%rbp),%xmm0
mulsd  0xe5a(%rip),%xmm0
call   1050 <cos@plt>
mulsd  0xe45(%rip),%xmm0
cvttsd2si %xmm0,%eax
and    $0xffffff,%eax
or     $0x1000000,%eax
mov    %eax,-0x41c(%rbp,%rbx,8)
add    $0x1,%rbx
cmp    $0x80,%rbx
jne    1170 <main+0x20>
lea    0xe4c(%rip),%rdi
lea    0xe54(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,%rbx
lea    -0x420(%rbp),%rdi
mov    $0x80,%esi
mov    $0x8,%edx
mov    %rax,%rcx
call   1070 <fwrite@plt>
mov    %rbx,%rdi
call   1030 <fclose@plt>
mov    %rsp,%r15
add    $0xfffffffffffff000,%r15
mov    %r15,%rsp
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
xorps  %xmm0,%xmm0
cvtsi2ss %ebx,%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
mulsd  0xdd0(%rip),%xmm0
call   1040 <sin@plt>
movsd  0xdb3(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
and    $0xffffff,%eax
mov    %eax,(%r15,%rbx,8)
movsd  -0x20(%rbp),%xmm0
mulsd  0xdad(%rip),%xmm0
call   1050 <cos@plt>
mulsd  0xd88(%rip),%xmm0
cvttsd2si %xmm0,%eax
and    $0xffffff,%eax
or     $0x1000000,%eax
mov    %eax,0x4(%r15,%rbx,8)
add    $0x1,%rbx
cmp    $0x200,%rbx
jne    1230 <main+0xe0>
lea    0xda3(%rip),%rdi
lea    0xd99(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,%r14
mov    %r15,%rdi
mov    $0x200,%esi
mov    $0x8,%edx
mov    %rax,%rcx
call   1070 <fwrite@plt>
mov    %r14,%rdi
call   1030 <fclose@plt>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nop
xorps  %xmm0,%xmm0
cvtsi2ss %ebx,%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xd35(%rip),%xmm1
mulsd  %xmm1,%xmm0
call   1040 <sin@plt>
movsd  0xd2c(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
lea    0x1(%rbx),%ecx
xorps  %xmm0,%xmm0
cvtsi2ss %ecx,%xmm0
and    $0xffffff,%eax
or     $0x2000000,%eax
mov    %eax,-0x420(%rbp,%rbx,4)
cvtss2sd %xmm0,%xmm0
mulsd  0xcf5(%rip),%xmm0
call   1040 <sin@plt>
mulsd  0xcf0(%rip),%xmm0
cvttsd2si %xmm0,%eax
and    $0xffffff,%eax
or     $0x2000000,%eax
mov    %eax,-0x41c(%rbp,%rbx,4)
add    $0x2,%rbx
cmp    $0x100,%rbx
jne    12e0 <main+0x190>
lea    0xcec(%rip),%rdi
lea    0xcd3(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,%rbx
lea    -0x420(%rbp),%rdi
mov    $0x100,%esi
mov    $0x4,%edx
mov    %rax,%rcx
call   1070 <fwrite@plt>
mov    %rbx,%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
lea    -0x18(%rbp),%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [15 x i8] c"waves_8_12.bin\00"
@.str.1 = [3 x i8] c"wb\00"
@.str.2 = [15 x i8] c"waves_11_7.bin\00"
@.str.3 = [12 x i8] c"wave_10.bin\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i64
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca i32
%13 = alloca i32*
%14 = alloca i64
%15 = alloca i32
%16 = alloca i64
%17 = alloca double
%18 = alloca double
%19 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 128, i32* %6
%20 = load i32, i32* %6
%21 = mul nsw i32 2, %20
%22 = zext i32 %21 to i64
%23 = call i8* @llvm.stacksave()
store i8* %23, i8** %7
%24 = alloca i32, i64 %22
store i64 %22, i64* %8
store double 0x3FB921FB54442EEA, double* %9
store double 0x3FC2D97C7F332330, double* %10
%25 = call double @pow(double 2.000000e+00, double 2.250000e+01)
store double %25, double* %11
store i32 0, i32* %12
br label %26
26: ; preds = %67, %2
%27 = load i32, i32* %12
%28 = load i32, i32* %6
%29 = icmp slt i32 %27, %28
br i1 %29, label %30, label %70
30: ; preds = %26
%31 = load double, double* %11
%32 = load double, double* %9
%33 = load i32, i32* %12
%34 = sitofp i32 %33 to float
%35 = fpext float %34 to double
%36 = fmul double %32, %35
%37 = call double @sin(double %36)
%38 = fmul double %31, %37
%39 = fptosi double %38 to i32
%40 = and i32 %39, 16777215
%41 = load i32, i32* %12
%42 = mul nsw i32 2, %41
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds i32, i32* %24, i64 %43
store i32 %40, i32* %44
%45 = load double, double* %11
%46 = load double, double* %10
%47 = load i32, i32* %12
%48 = sitofp i32 %47 to float
%49 = fpext float %48 to double
%50 = fmul double %46, %49
%51 = call double @cos(double %50)
%52 = fmul double %45, %51
%53 = fptosi double %52 to i32
%54 = and i32 %53, 16777215
%55 = load i32, i32* %12
%56 = mul nsw i32 2, %55
%57 = add nsw i32 %56, 1
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds i32, i32* %24, i64 %58
store i32 %54, i32* %59
%60 = load i32, i32* %12
%61 = mul nsw i32 2, %60
%62 = add nsw i32 %61, 1
%63 = sext i32 %62 to i64
%64 = getelementptr inbounds i32, i32* %24, i64 %63
%65 = load i32, i32* %64
%66 = or i32 %65, 16777216
store i32 %66, i32* %64
br label %67
67: ; preds = %30
%68 = load i32, i32* %12
%69 = add nsw i32 %68, 1
store i32 %69, i32* %12
br label %26
70: ; preds = %26
%71 = call i32* @fopen(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %71, i32** %13
%72 = load i32, i32* %6
%73 = load i32*, i32** %13
%74 = call i32 @fwrite(i32* %24, i32 %72, i32 8, i32* %73)
%75 = load i32*, i32** %13
%76 = call i32 @fclose(i32* %75)
store double 0x3FC1475CC9EEE041, double* %9
store double 0x3FB5FDBBE9BBA90D, double* %10
store i32 512, i32* %6
%77 = load i32, i32* %6
%78 = mul nsw i32 2, %77
%79 = zext i32 %78 to i64
%80 = alloca i32, i64 %79
store i64 %79, i64* %14
store i32 0, i32* %15
br label %81
81: ; preds = %122, %70
%82 = load i32, i32* %15
%83 = load i32, i32* %6
%84 = icmp slt i32 %82, %83
br i1 %84, label %85, label %125
85: ; preds = %81
%86 = load double, double* %11
%87 = load double, double* %9
%88 = load i32, i32* %15
%89 = sitofp i32 %88 to float
%90 = fpext float %89 to double
%91 = fmul double %87, %90
%92 = call double @sin(double %91)
%93 = fmul double %86, %92
%94 = fptosi double %93 to i32
%95 = and i32 %94, 16777215
%96 = load i32, i32* %15
%97 = mul nsw i32 2, %96
%98 = sext i32 %97 to i64
%99 = getelementptr inbounds i32, i32* %80, i64 %98
store i32 %95, i32* %99
%100 = load double, double* %11
%101 = load double, double* %10
%102 = load i32, i32* %15
%103 = sitofp i32 %102 to float
%104 = fpext float %103 to double
%105 = fmul double %101, %104
%106 = call double @cos(double %105)
%107 = fmul double %100, %106
%108 = fptosi double %107 to i32
%109 = and i32 %108, 16777215
%110 = load i32, i32* %15
%111 = mul nsw i32 2, %110
%112 = add nsw i32 %111, 1
%113 = sext i32 %112 to i64
%114 = getelementptr inbounds i32, i32* %80, i64 %113
store i32 %109, i32* %114
%115 = load i32, i32* %15
%116 = mul nsw i32 2, %115
%117 = add nsw i32 %116, 1
%118 = sext i32 %117 to i64
%119 = getelementptr inbounds i32, i32* %80, i64 %118
%120 = load i32, i32* %119
%121 = or i32 %120, 16777216
store i32 %121, i32* %119
br label %122
122: ; preds = %85
%123 = load i32, i32* %15
%124 = add nsw i32 %123, 1
store i32 %124, i32* %15
br label %81
125: ; preds = %81
%126 = call i32* @fopen(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %126, i32** %13
%127 = load i32, i32* %6
%128 = load i32*, i32** %13
%129 = call i32 @fwrite(i32* %80, i32 %127, i32 8, i32* %128)
%130 = load i32*, i32** %13
%131 = call i32 @fclose(i32* %130)
store i32 256, i32* %6
%132 = load i32, i32* %6
%133 = zext i32 %132 to i64
%134 = alloca i32, i64 %133
store i64 %133, i64* %16
store double 0x3FBF6A7A29553AA4, double* %17
%135 = call double @pow(double 2.000000e+00, double 2.180000e+01)
store double %135, double* %18
store i32 0, i32* %19
br label %136
136: ; preds = %159, %125
%137 = load i32, i32* %19
%138 = load i32, i32* %6
%139 = icmp slt i32 %137, %138
br i1 %139, label %140, label %162
140: ; preds = %136
%141 = load double, double* %18
%142 = load double, double* %17
%143 = load i32, i32* %19
%144 = sitofp i32 %143 to float
%145 = fpext float %144 to double
%146 = fmul double %142, %145
%147 = call double @sin(double %146)
%148 = fmul double %141, %147
%149 = fptosi double %148 to i32
%150 = and i32 %149, 16777215
%151 = load i32, i32* %19
%152 = sext i32 %151 to i64
%153 = getelementptr inbounds i32, i32* %24, i64 %152
store i32 %150, i32* %153
%154 = load i32, i32* %19
%155 = sext i32 %154 to i64
%156 = getelementptr inbounds i32, i32* %24, i64 %155
%157 = load i32, i32* %156
%158 = or i32 %157, 33554432
store i32 %158, i32* %156
br label %159
159: ; preds = %140
%160 = load i32, i32* %19
%161 = add nsw i32 %160, 1
store i32 %161, i32* %19
br label %136
162: ; preds = %136
%163 = call i32* @fopen(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %163, i32** %13
%164 = load i32, i32* %6
%165 = load i32*, i32** %13
%166 = call i32 @fwrite(i32* %24, i32 %164, i32 4, i32* %165)
%167 = load i32*, i32** %13
%168 = call i32 @fclose(i32* %167)
store i32 0, i32* %3
%169 = load i8*, i8** %7
%170 = load i32, i32* %3
ret i32 %170
}

LLVM IR (-O2):
@.str = [15 x i8] c"waves_8_12.bin\00"
@.str.1 = [3 x i8] c"wb\00"
@.str.2 = [15 x i8] c"waves_11_7.bin\00"
@.str.3 = [12 x i8] c"wave_10.bin\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [256 x i32]
br label %10
4: ; preds = %10
%5 = getelementptr inbounds [256 x i32], [256 x i32]* %3, i64 0, i64 0
%6 = tail call i32* @fopen(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 @fwrite(i32* %5, i32 128, i32 8, i32* %6)
%8 = tail call i32 @fclose(i32* %6)
%9 = alloca [1024 x i32]
br label %37
10: ; preds = %2, %10
%11 = phi i64 [ 0, %2 ], [ %30, %10 ]
%12 = trunc i64 %11 to i32
%13 = sitofp i32 %12 to float
%14 = fpext float %13 to double
%15 = fmul double %14, 0x3FB921FB54442EEA
%16 = tail call double @sin(double %15)
%17 = fmul double %16, 0x4156A09E667F3BCD
%18 = fptosi double %17 to i32
%19 = and i32 %18, 16777215
%20 = shl nuw nsw i64 %11, 1
%21 = getelementptr inbounds [256 x i32], [256 x i32]* %3, i64 0, i64 %20
store i32 %19, i32* %21
%22 = fmul double %14, 0x3FC2D97C7F332330
%23 = tail call double @cos(double %22)
%24 = fmul double %23, 0x4156A09E667F3BCD
%25 = fptosi double %24 to i32
%26 = and i32 %25, 16777215
%27 = or i64 %20, 1
%28 = getelementptr inbounds [256 x i32], [256 x i32]* %3, i64 0, i64 %27
%29 = or i32 %26, 16777216
store i32 %29, i32* %28
%30 = add nuw nsw i64 %11, 1
%31 = icmp eq i64 %30, 128
br i1 %31, label %4, label %10
32: ; preds = %37
%33 = getelementptr inbounds [1024 x i32], [1024 x i32]* %9, i64 0, i64 0
%34 = tail call i32* @fopen(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%35 = call i32 @fwrite(i32* %33, i32 512, i32 8, i32* %34)
%36 = tail call i32 @fclose(i32* %34)
br label %63
37: ; preds = %4, %37
%38 = phi i64 [ 0, %4 ], [ %57, %37 ]
%39 = trunc i64 %38 to i32
%40 = sitofp i32 %39 to float
%41 = fpext float %40 to double
%42 = fmul double %41, 0x3FC1475CC9EEE041
%43 = tail call double @sin(double %42)
%44 = fmul double %43, 0x4156A09E667F3BCD
%45 = fptosi double %44 to i32
%46 = and i32 %45, 16777215
%47 = shl nuw nsw i64 %38, 1
%48 = getelementptr inbounds [1024 x i32], [1024 x i32]* %9, i64 0, i64 %47
store i32 %46, i32* %48
%49 = fmul double %41, 0x3FB5FDBBE9BBA90D
%50 = tail call double @cos(double %49)
%51 = fmul double %50, 0x4156A09E667F3BCD
%52 = fptosi double %51 to i32
%53 = and i32 %52, 16777215
%54 = or i64 %47, 1
%55 = getelementptr inbounds [1024 x i32], [1024 x i32]* %9, i64 0, i64 %54
%56 = or i32 %53, 16777216
store i32 %56, i32* %55
%57 = add nuw nsw i64 %38, 1
%58 = icmp eq i64 %57, 512
br i1 %58, label %32, label %37
59: ; preds = %63
%60 = tail call i32* @fopen(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%61 = call i32 @fwrite(i32* %5, i32 256, i32 4, i32* %60)
%62 = tail call i32 @fclose(i32* %60)
ret i32 0
63: ; preds = %63, %32
%64 = phi i64 [ 0, %32 ], [ %86, %63 ]
%65 = trunc i64 %64 to i32
%66 = sitofp i32 %65 to float
%67 = fpext float %66 to double
%68 = fmul double %67, 0x3FBF6A7A29553AA4
%69 = tail call double @sin(double %68)
%70 = fmul double %69, 0x414BDB8CDADBE124
%71 = fptosi double %70 to i32
%72 = and i32 %71, 16777215
%73 = getelementptr inbounds [256 x i32], [256 x i32]* %3, i64 0, i64 %64
%74 = or i32 %72, 33554432
store i32 %74, i32* %73
%75 = or i64 %64, 1
%76 = trunc i64 %75 to i32
%77 = sitofp i32 %76 to float
%78 = fpext float %77 to double
%79 = fmul double %78, 0x3FBF6A7A29553AA4
%80 = tail call double @sin(double %79)
%81 = fmul double %80, 0x414BDB8CDADBE124
%82 = fptosi double %81 to i32
%83 = and i32 %82, 16777215
%84 = getelementptr inbounds [256 x i32], [256 x i32]* %3, i64 0, i64 %75
%85 = or i32 %83, 33554432
store i32 %85, i32* %84
%86 = add nuw nsw i64 %64, 2
%87 = icmp eq i64 %86, 256
br i1 %87, label %59, label %63
}