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

/* Variables and functions */
double INT16_MAX;
int M_PI;
scalar_t__ fwrite(scalar_t__ *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ pclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ *popen(char *, char *);
double sin(int);
int main(int ARGC, char *ARGV[]) {
  int i, j, k;
  int phy_offset[2] = {0, 0};
  double amp[2] = {0.2, 0.2};
  double wave[2][48000 / 375];
  for (i = 0; i < 48000 / 375; i++) {
    wave[0][i] = sin(2 * M_PI * 6000 * i / 48000);
    wave[1][i] = sin(2 * M_PI * 6000 * i / 48000 + M_PI / 2);
  }
  char code[2][31] = {{0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0, 1,
                       1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 0, 0, 1, 0},
                      {0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 0,
                       0, 0, 1, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1}};
  double data[2][(48000 * 31 / 375)];
  for (i = 0; i < 31; i++) {
    for (j = 0; j < 48000 / 375; j++) {
      for (k = 0; k < 2; k++) {
        int symbol = code[k][i] ^ 1;
        data[k][i * 48000 / 375 + j] = wave[symbol][j];
      }
    }
  }
  int16_t buf[(48000 * 31 / 375)];
  for (i = 0; i < (48000 * 31 / 375); i++) {
    buf[i] = 0;
    for (j = 0; j < 2; j++) {
      int idx = ((48000 * 31 / 375) + i - phy_offset[j]) % (48000 * 31 / 375);
      buf[i] += (int16_t)(INT16_MAX * amp[j] * data[j][idx]);
    }
  }
  FILE *play;
  char cmd[] = "play -t raw -b 16 -c 1 -e s -r 48000 -";
  if ((play = popen(cmd, "w")) == NULL) {
    perror("play");
  }
  int n;
  while (1) {
    n = 0;
    while (1) {
      n += fwrite(buf + n, sizeof(int16_t), (48000 * 31 / 375) - n, play);
      if (n >= (48000 * 31 / 375)) {
        break;
      }
    }
  }
  pclose(play);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x17ce0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x24(%rbp),%rdi
xor    %esi,%esi
mov    $0x8,%edx
call   1030 <memset@plt>
mov    0xe70(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0xe6d(%rip),%rax
mov    %rax,-0x38(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x80,-0x14(%rbp)
jge    1238 <main+0xd8>
mov    0x2e2e(%rip),%rax
mov    (%rax),%eax
shl    $0x1,%eax
imul   $0x1770,%eax,%eax
imul   -0x14(%rbp),%eax
mov    $0xbb80,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
call   1040 <sin@plt>
movslq -0x14(%rbp),%rax
movsd  %xmm0,-0x840(%rbp,%rax,8)
ff ff
mov    0x2dfc(%rip),%rax
mov    (%rax),%eax
shl    $0x1,%eax
imul   $0x1770,%eax,%eax
imul   -0x14(%rbp),%eax
mov    $0xbb80,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
mov    0x2ddc(%rip),%rax
mov    (%rax),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
add    %eax,%edi
call   1040 <sin@plt>
movslq -0x14(%rbp),%rax
movsd  %xmm0,-0x440(%rbp,%rax,8)
ff ff
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11a6 <main+0x46>
lea    -0x880(%rbp),%rdi
lea    0xdca(%rip),%rsi
mov    $0x3e,%edx
call   1050 <memcpy@plt>
movl   $0x0,-0x14(%rbp)
cmpl   $0x1f,-0x14(%rbp)
jge    133a <main+0x1da>
movl   $0x0,-0x18(%rbp)
cmpl   $0x80,-0x18(%rbp)
jge    1327 <main+0x1c7>
movl   $0x0,-0x1c(%rbp)
cmpl   $0x2,-0x1c(%rbp)
jge    1314 <main+0x1b4>
movslq -0x1c(%rbp),%rcx
lea    -0x880(%rbp),%rax
imul   $0x1f,%rcx,%rcx
add    %rcx,%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
xor    $0x1,%eax
mov    %eax,-0x10084(%rbp)
movslq -0x10084(%rbp),%rcx
lea    -0x840(%rbp),%rax
shl    $0xa,%rcx
add    %rcx,%rax
movslq -0x18(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movslq -0x1c(%rbp),%rcx
lea    -0x10080(%rbp),%rax
imul   $0x7c00,%rcx,%rcx
add    %rcx,%rax
mov    %rax,-0x17ce0(%rbp)
imul   $0xbb80,-0x14(%rbp),%eax
mov    $0x177,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x17ce0(%rbp),%rax
add    -0x18(%rbp),%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    127c <main+0x11c>
jmp    1319 <main+0x1b9>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1268 <main+0x108>
jmp    132c <main+0x1cc>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1257 <main+0xf7>
movl   $0x0,-0x14(%rbp)
cmpl   $0xf80,-0x14(%rbp)
jge    13fd <main+0x29d>
movslq -0x14(%rbp),%rax
movq   $0x0,-0x17c90(%rbp,%rax,8)
movl   $0x0,-0x18(%rbp)
cmpl   $0x2,-0x18(%rbp)
jge    13ea <main+0x28a>
mov    -0x14(%rbp),%eax
add    $0xf80,%eax
movslq -0x18(%rbp),%rcx
sub    -0x24(%rbp,%rcx,4),%eax
mov    $0xf80,%ecx
cltd
idiv   %ecx
mov    %edx,-0x17c94(%rbp)
mov    0x2c44(%rip),%rax
movsd  (%rax),%xmm0
movslq -0x18(%rbp),%rax
mulsd  -0x40(%rbp,%rax,8),%xmm0
movslq -0x18(%rbp),%rcx
lea    -0x10080(%rbp),%rax
imul   $0x7c00,%rcx,%rcx
add    %rcx,%rax
movslq -0x17c94(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
cvttsd2si %xmm0,%rcx
movslq -0x14(%rbp),%rax
add    -0x17c90(%rbp,%rax,8),%rcx
ff
mov    %rcx,-0x17c90(%rbp,%rax,8)
ff
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1365 <main+0x205>
jmp    13ef <main+0x28f>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1341 <main+0x1e1>
lea    -0x17cd0(%rbp),%rdi
lea    0xc45(%rip),%rsi
mov    $0x27,%edx
call   1050 <memcpy@plt>
lea    -0x17cd0(%rbp),%rdi
lea    0xc54(%rip),%rsi
call   1060 <popen@plt>
mov    %rax,-0x17ca0(%rbp)
cmp    $0x0,%rax
jne    1445 <main+0x2e5>
lea    0xc39(%rip),%rdi
call   1070 <perror@plt>
jmp    144a <main+0x2ea>
movl   $0x0,-0x17cd4(%rbp)
lea    -0x17c90(%rbp),%rdi
movslq -0x17cd4(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdi
mov    $0xf80,%edx
sub    -0x17cd4(%rbp),%edx
mov    -0x17ca0(%rbp),%rcx
mov    $0x8,%esi
call   1080 <fwrite@plt>
mov    %rax,%rcx
movslq -0x17cd4(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x17cd4(%rbp)
cmpl   $0xf80,-0x17cd4(%rbp)
jl     14ad <main+0x34d>
jmp    14b2 <main+0x352>
jmp    1454 <main+0x2f4>
jmp    144a <main+0x2ea>

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x17c30,%rsp
lea    0x430(%rsp),%r14
xor    %ebx,%ebx
mov    0x2e8b(%rip),%r15
nopl   (%rax)
mov    (%r15),%eax
imul   %ebx,%eax
cltq
imul   $0x57619f1,%rax,%rdi
mov    %rdi,%rax
shr    $0x3f,%rax
sar    $0x2a,%rdi
add    %eax,%edi
call   1030 <sin@plt>
movsd  %xmm0,-0x400(%r14)
ff ff
mov    (%r15),%eax
mov    %ebx,%ecx
imul   %eax,%ecx
movslq %ecx,%rcx
imul   $0x57619f1,%rcx,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x2a,%rcx
add    %edx,%ecx
mov    %eax,%edi
shr    $0x1f,%edi
add    %eax,%edi
sar    %edi
add    %ecx,%edi
call   1030 <sin@plt>
movsd  %xmm0,(%r14)
add    $0x2ee0,%rbx
add    $0x8,%r14
cmp    $0x177000,%rbx
jne    1160 <main+0x20>
lea    0x10040(%rsp),%rax
lea    0x40(%rsp),%r8
xor    %edx,%edx
lea    0xe28(%rip),%rsi
nopl   0x0(%rax,%rax,1)
movsbq (%rdx,%rsi,1),%rdi
movsbq 0x1f(%rdx,%rsi,1),%rbx
xor    $0x1,%rdi
xor    $0x1,%rbx
shl    $0xa,%rdi
add    %r8,%rdi
shl    $0xa,%rbx
add    %r8,%rbx
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movaps -0x10(%rdi,%rcx,8),%xmm0
movaps %xmm0,-0x7c10(%rax,%rcx,8)
ff
movaps -0x10(%rbx,%rcx,8),%xmm0
movaps %xmm0,-0x10(%rax,%rcx,8)
movaps (%rdi,%rcx,8),%xmm0
movaps %xmm0,-0x7c00(%rax,%rcx,8)
ff
movaps (%rbx,%rcx,8),%xmm0
movaps %xmm0,(%rax,%rcx,8)
add    $0x4,%rcx
cmp    $0x80,%rcx
jne    1220 <main+0xe0>
add    $0x1,%rdx
add    $0x400,%rax
cmp    $0x1f,%rdx
jne    11f0 <main+0xb0>
mov    0x2d69(%rip),%rax
movsd  (%rax),%xmm0
mulsd  0xd85(%rip),%xmm0
xor    %eax,%eax
nopl   (%rax)
lea    0xf80(%rax),%rcx
movslq %ecx,%rcx
imul   $0xffffffff84210843,%rcx,%rdx
shr    $0x20,%rdx
add    %ecx,%edx
mov    %edx,%esi
shr    $0x1f,%esi
sar    $0xb,%edx
add    %esi,%edx
imul   $0xf80,%edx,%edx
sub    %edx,%ecx
movslq %ecx,%rcx
movsd  0x8430(%rsp,%rcx,8),%xmm1
mulsd  %xmm0,%xmm1
cvttsd2si %xmm1,%rdx
movsd  0x10030(%rsp,%rcx,8),%xmm1
mulsd  %xmm0,%xmm1
cvttsd2si %xmm1,%rcx
add    %rdx,%rcx
mov    %rcx,0x830(%rsp,%rax,8)
add    $0x1,%rax
cmp    $0xf80,%rax
jne    1280 <main+0x140>
movaps 0xd72(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xd56(%rip),%xmm0
movaps %xmm0,(%rsp)
movabs $0x2d203030303834,%rax
mov    %rax,0x1f(%rsp)
lea    0xd63(%rip),%rsi
mov    %rsp,%rdi
call   1040 <popen@plt>
mov    %rax,%r14
test   %rax,%rax
je     136d <main+0x22d>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movslq %eax,%rbx
lea    (%rsp,%rbx,8),%rdi
add    $0x830,%rdi
mov    $0xf80,%edx
sub    %ebx,%edx
mov    $0x8,%esi
mov    %r14,%rcx
call   1060 <fwrite@plt>
add    %ebx,%eax
cmp    $0xf7f,%eax
jle    1340 <main+0x200>
jmp    1330 <main+0x1f0>
lea    0xd05(%rip),%rdi
call   1050 <perror@plt>
jmp    1330 <main+0x1f0>

LLVM IR (-O0):
@__const.main.amp = [2 x double] [double 2.000000e-01, double 2.000000e-01]
@M_PI = global i32 0
@__const.main.code = [2 x [31 x i8]] [[31 x i8] c"\00\00\00\00\00\00\00\01\01\01\01\00\01\01\00\01\01\01\01\01\00\01\01\01\00\01\00\00\00\01\00", [31 x i8] c"\00\00\00\00\01\00\01\00\01\00\01\01\01\01\00\00\00\00\01\00\01\00\00\00\00\01\01\00\00\00\01"]
@INT16_MAX = global double 0.000000e+00
@__const.main.cmd = [39 x i8] c"play -t raw -b 16 -c 1 -e s -r 48000 -\00"
@.str = [2 x i8] c"w\00"
@.str.1 = [5 x i8] c"play\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 i32
%9 = alloca [2 x i32]
%10 = alloca [2 x double]
%11 = alloca [2 x [128 x double]]
%12 = alloca [2 x [31 x i8]]
%13 = alloca [2 x [3968 x double]]
%14 = alloca i32
%15 = alloca [3968 x i64]
%16 = alloca i32
%17 = alloca i32*
%18 = alloca [39 x i8]
%19 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%20 = bitcast [2 x i32]* %9 to i8*
%21 = bitcast [2 x double]* %10 to i8*
store i32 0, i32* %6
br label %22
22: ; preds = %51, %2
%23 = load i32, i32* %6
%24 = icmp slt i32 %23, 128
br i1 %24, label %25, label %54
25: ; preds = %22
%26 = load i32, i32* @M_PI
%27 = mul nsw i32 2, %26
%28 = mul nsw i32 %27, 6000
%29 = load i32, i32* %6
%30 = mul nsw i32 %28, %29
%31 = sdiv i32 %30, 48000
%32 = call double @sin(i32 %31)
%33 = getelementptr inbounds [2 x [128 x double]], [2 x [128 x double]]* %11, i64 0, i64 0
%34 = load i32, i32* %6
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds [128 x double], [128 x double]* %33, i64 0, i64 %35
store double %32, double* %36
%37 = load i32, i32* @M_PI
%38 = mul nsw i32 2, %37
%39 = mul nsw i32 %38, 6000
%40 = load i32, i32* %6
%41 = mul nsw i32 %39, %40
%42 = sdiv i32 %41, 48000
%43 = load i32, i32* @M_PI
%44 = sdiv i32 %43, 2
%45 = add nsw i32 %42, %44
%46 = call double @sin(i32 %45)
%47 = getelementptr inbounds [2 x [128 x double]], [2 x [128 x double]]* %11, i64 0, i64 1
%48 = load i32, i32* %6
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds [128 x double], [128 x double]* %47, i64 0, i64 %49
store double %46, double* %50
br label %51
51: ; preds = %25
%52 = load i32, i32* %6
%53 = add nsw i32 %52, 1
store i32 %53, i32* %6
br label %22
54: ; preds = %22
%55 = bitcast [2 x [31 x i8]]* %12 to i8*
store i32 0, i32* %6
br label %56
56: ; preds = %102, %54
%57 = load i32, i32* %6
%58 = icmp slt i32 %57, 31
br i1 %58, label %59, label %105
59: ; preds = %56
store i32 0, i32* %7
br label %60
60: ; preds = %98, %59
%61 = load i32, i32* %7
%62 = icmp slt i32 %61, 128
br i1 %62, label %63, label %101
63: ; preds = %60
store i32 0, i32* %8
br label %64
64: ; preds = %94, %63
%65 = load i32, i32* %8
%66 = icmp slt i32 %65, 2
br i1 %66, label %67, label %97
67: ; preds = %64
%68 = load i32, i32* %8
%69 = sext i32 %68 to i64
%70 = getelementptr inbounds [2 x [31 x i8]], [2 x [31 x i8]]* %12, i64 0, i64 %69
%71 = load i32, i32* %6
%72 = sext i32 %71 to i64
%73 = getelementptr inbounds [31 x i8], [31 x i8]* %70, i64 0, i64 %72
%74 = load i8, i8* %73
%75 = sext i8 %74 to i32
%76 = xor i32 %75, 1
store i32 %76, i32* %14
%77 = load i32, i32* %14
%78 = sext i32 %77 to i64
%79 = getelementptr inbounds [2 x [128 x double]], [2 x [128 x double]]* %11, i64 0, i64 %78
%80 = load i32, i32* %7
%81 = sext i32 %80 to i64
%82 = getelementptr inbounds [128 x double], [128 x double]* %79, i64 0, i64 %81
%83 = load double, double* %82
%84 = load i32, i32* %8
%85 = sext i32 %84 to i64
%86 = getelementptr inbounds [2 x [3968 x double]], [2 x [3968 x double]]* %13, i64 0, i64 %85
%87 = load i32, i32* %6
%88 = mul nsw i32 %87, 48000
%89 = sdiv i32 %88, 375
%90 = load i32, i32* %7
%91 = add nsw i32 %89, %90
%92 = sext i32 %91 to i64
%93 = getelementptr inbounds [3968 x double], [3968 x double]* %86, i64 0, i64 %92
store double %83, double* %93
br label %94
94: ; preds = %67
%95 = load i32, i32* %8
%96 = add nsw i32 %95, 1
store i32 %96, i32* %8
br label %64
97: ; preds = %64
br label %98
98: ; preds = %97
%99 = load i32, i32* %7
%100 = add nsw i32 %99, 1
store i32 %100, i32* %7
br label %60
101: ; preds = %60
br label %102
102: ; preds = %101
%103 = load i32, i32* %6
%104 = add nsw i32 %103, 1
store i32 %104, i32* %6
br label %56
105: ; preds = %56
store i32 0, i32* %6
br label %106
106: ; preds = %149, %105
%107 = load i32, i32* %6
%108 = icmp slt i32 %107, 3968
br i1 %108, label %109, label %152
109: ; preds = %106
%110 = load i32, i32* %6
%111 = sext i32 %110 to i64
%112 = getelementptr inbounds [3968 x i64], [3968 x i64]* %15, i64 0, i64 %111
store i64 0, i64* %112
store i32 0, i32* %7
br label %113
113: ; preds = %145, %109
%114 = load i32, i32* %7
%115 = icmp slt i32 %114, 2
br i1 %115, label %116, label %148
116: ; preds = %113
%117 = load i32, i32* %6
%118 = add nsw i32 3968, %117
%119 = load i32, i32* %7
%120 = sext i32 %119 to i64
%121 = getelementptr inbounds [2 x i32], [2 x i32]* %9, i64 0, i64 %120
%122 = load i32, i32* %121
%123 = sub nsw i32 %118, %122
%124 = srem i32 %123, 3968
store i32 %124, i32* %16
%125 = load double, double* @INT16_MAX
%126 = load i32, i32* %7
%127 = sext i32 %126 to i64
%128 = getelementptr inbounds [2 x double], [2 x double]* %10, i64 0, i64 %127
%129 = load double, double* %128
%130 = fmul double %125, %129
%131 = load i32, i32* %7
%132 = sext i32 %131 to i64
%133 = getelementptr inbounds [2 x [3968 x double]], [2 x [3968 x double]]* %13, i64 0, i64 %132
%134 = load i32, i32* %16
%135 = sext i32 %134 to i64
%136 = getelementptr inbounds [3968 x double], [3968 x double]* %133, i64 0, i64 %135
%137 = load double, double* %136
%138 = fmul double %130, %137
%139 = fptosi double %138 to i64
%140 = load i32, i32* %6
%141 = sext i32 %140 to i64
%142 = getelementptr inbounds [3968 x i64], [3968 x i64]* %15, i64 0, i64 %141
%143 = load i64, i64* %142
%144 = add nsw i64 %143, %139
store i64 %144, i64* %142
br label %145
145: ; preds = %116
%146 = load i32, i32* %7
%147 = add nsw i32 %146, 1
store i32 %147, i32* %7
br label %113
148: ; preds = %113
br label %149
149: ; preds = %148
%150 = load i32, i32* %6
%151 = add nsw i32 %150, 1
store i32 %151, i32* %6
br label %106
152: ; preds = %106
%153 = bitcast [39 x i8]* %18 to i8*
%154 = getelementptr inbounds [39 x i8], [39 x i8]* %18, i64 0, i64 0
%155 = call i32* @popen(i8* %154, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %155, i32** %17
%156 = icmp eq i32* %155, null
br i1 %156, label %157, label %159
157: ; preds = %152
%158 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
br label %159
159: ; preds = %157, %152
br label %160
160: ; preds = %159, %178
store i32 0, i32* %19
br label %161
161: ; preds = %160, %177
%162 = getelementptr inbounds [3968 x i64], [3968 x i64]* %15, i64 0, i64 0
%163 = load i32, i32* %19
%164 = sext i32 %163 to i64
%165 = getelementptr inbounds i64, i64* %162, i64 %164
%166 = load i32, i32* %19
%167 = sub nsw i32 3968, %166
%168 = load i32*, i32** %17
%169 = call i64 @fwrite(i64* %165, i32 8, i32 %167, i32* %168)
%170 = load i32, i32* %19
%171 = sext i32 %170 to i64
%172 = add nsw i64 %171, %169
%173 = trunc i64 %172 to i32
store i32 %173, i32* %19
%174 = load i32, i32* %19
%175 = icmp sge i32 %174, 3968
br i1 %175, label %176, label %177
176: ; preds = %161
br label %178
177: ; preds = %161
br label %161
178: ; preds = %176
br label %160
}

LLVM IR (-O2):
@M_PI = global i32 0
@__const.main.code = [2 x [31 x i8]] [[31 x i8] c"\00\00\00\00\00\00\00\01\01\01\01\00\01\01\00\01\01\01\01\01\00\01\01\01\00\01\00\00\00\01\00", [31 x i8] c"\00\00\00\00\01\00\01\00\01\00\01\01\01\01\00\00\00\00\01\00\01\00\00\00\00\01\01\00\00\00\01"]
@INT16_MAX = global double 0.000000e+00
@__const.main.cmd = [39 x i8] c"play -t raw -b 16 -c 1 -e s -r 48000 -\00"
@.str = [2 x i8] c"w\00"
@.str.1 = [5 x i8] c"play\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [2 x [128 x double]]
%4 = alloca [2 x [3968 x double]]
%5 = alloca [3968 x i64]
%6 = alloca [39 x i8]
%7 = bitcast [2 x [128 x double]]* %3 to i8*
br label %8
8: ; preds = %2, %8
%9 = phi i64 [ 0, %2 ], [ %24, %8 ]
%10 = load i32, i32* @M_PI
%11 = trunc i64 %9 to i32
%12 = mul i32 %11, 12000
%13 = mul i32 %12, %10
%14 = sdiv i32 %13, 48000
%15 = tail call double @sin(i32 %14)
%16 = getelementptr inbounds [2 x [128 x double]], [2 x [128 x double]]* %3, i64 0, i64 0, i64 %9
store double %15, double* %16
%17 = load i32, i32* @M_PI
%18 = mul i32 %12, %17
%19 = sdiv i32 %18, 48000
%20 = sdiv i32 %17, 2
%21 = add nsw i32 %19, %20
%22 = tail call double @sin(i32 %21)
%23 = getelementptr inbounds [2 x [128 x double]], [2 x [128 x double]]* %3, i64 0, i64 1, i64 %9
store double %22, double* %23
%24 = add nuw nsw i64 %9, 1
%25 = icmp eq i64 %24, 128
br i1 %25, label %26, label %8
26: ; preds = %8
%27 = bitcast [2 x [3968 x double]]* %4 to i8*
br label %28
28: ; preds = %26, %66
%29 = phi i64 [ 0, %26 ], [ %67, %66 ]
%30 = shl nsw i64 %29, 7
%31 = getelementptr inbounds [2 x [31 x i8]], [2 x [31 x i8]]* @__const.main.code, i64 0, i64 0, i64 %29
%32 = load i8, i8* %31
%33 = getelementptr inbounds [2 x [31 x i8]], [2 x [31 x i8]]* @__const.main.code, i64 0, i64 1, i64 %29
%34 = load i8, i8* %33
%35 = xor i8 %32, 1
%36 = sext i8 %35 to i64
%37 = xor i8 %34, 1
%38 = sext i8 %37 to i64
br label %39
39: ; preds = %39, %28
%40 = phi i64 [ 0, %28 ], [ %64, %39 ]
%41 = add nuw nsw i64 %40, %30
%42 = getelementptr inbounds [2 x [128 x double]], [2 x [128 x double]]* %3, i64 0, i64 %36, i64 %40
%43 = bitcast double* %42 to <2 x double>*
%44 = load <2 x double>, <2 x double>* %43
%45 = getelementptr inbounds [2 x [3968 x double]], [2 x [3968 x double]]* %4, i64 0, i64 0, i64 %41
%46 = bitcast double* %45 to <2 x double>*
store <2 x double> %44, <2 x double>* %46
%47 = getelementptr inbounds [2 x [128 x double]], [2 x [128 x double]]* %3, i64 0, i64 %38, i64 %40
%48 = bitcast double* %47 to <2 x double>*
%49 = load <2 x double>, <2 x double>* %48
%50 = getelementptr inbounds [2 x [3968 x double]], [2 x [3968 x double]]* %4, i64 0, i64 1, i64 %41
%51 = bitcast double* %50 to <2 x double>*
store <2 x double> %49, <2 x double>* %51
%52 = or i64 %40, 2
%53 = add nuw nsw i64 %52, %30
%54 = getelementptr inbounds [2 x [128 x double]], [2 x [128 x double]]* %3, i64 0, i64 %36, i64 %52
%55 = bitcast double* %54 to <2 x double>*
%56 = load <2 x double>, <2 x double>* %55
%57 = getelementptr inbounds [2 x [3968 x double]], [2 x [3968 x double]]* %4, i64 0, i64 0, i64 %53
%58 = bitcast double* %57 to <2 x double>*
store <2 x double> %56, <2 x double>* %58
%59 = getelementptr inbounds [2 x [128 x double]], [2 x [128 x double]]* %3, i64 0, i64 %38, i64 %52
%60 = bitcast double* %59 to <2 x double>*
%61 = load <2 x double>, <2 x double>* %60
%62 = getelementptr inbounds [2 x [3968 x double]], [2 x [3968 x double]]* %4, i64 0, i64 1, i64 %53
%63 = bitcast double* %62 to <2 x double>*
store <2 x double> %61, <2 x double>* %63
%64 = add nuw nsw i64 %40, 4
%65 = icmp eq i64 %64, 128
br i1 %65, label %66, label %39
66: ; preds = %39
%67 = add nuw nsw i64 %29, 1
%68 = icmp eq i64 %67, 31
br i1 %68, label %69, label %28
69: ; preds = %66
%70 = bitcast [3968 x i64]* %5 to i8*
%71 = load double, double* @INT16_MAX
%72 = fmul double %71, 2.000000e-01
br label %73
73: ; preds = %69, %73
%74 = phi i64 [ 0, %69 ], [ %89, %73 ]
%75 = getelementptr inbounds [3968 x i64], [3968 x i64]* %5, i64 0, i64 %74
%76 = trunc i64 %74 to i32
%77 = add i32 %76, 3968
%78 = srem i32 %77, 3968
%79 = sext i32 %78 to i64
%80 = getelementptr inbounds [2 x [3968 x double]], [2 x [3968 x double]]* %4, i64 0, i64 0, i64 %79
%81 = load double, double* %80
%82 = fmul double %72, %81
%83 = fptosi double %82 to i64
%84 = getelementptr inbounds [2 x [3968 x double]], [2 x [3968 x double]]* %4, i64 0, i64 1, i64 %79
%85 = load double, double* %84
%86 = fmul double %72, %85
%87 = fptosi double %86 to i64
%88 = add nsw i64 %83, %87
store i64 %88, i64* %75
%89 = add nuw nsw i64 %74, 1
%90 = icmp eq i64 %89, 3968
br i1 %90, label %91, label %73
91: ; preds = %73
%92 = getelementptr inbounds [39 x i8], [39 x i8]* %6, i64 0, i64 0
%93 = call i32* @popen(i8* %92, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%94 = icmp eq i32* %93, null
br i1 %94, label %95, label %97
95: ; preds = %91
%96 = tail call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
br label %97
97: ; preds = %95, %91
br label %98
98: ; preds = %99, %97
br label %99
99: ; preds = %99, %98
%100 = phi i32 [ 0, %98 ], [ %106, %99 ]
%101 = sext i32 %100 to i64
%102 = getelementptr inbounds [3968 x i64], [3968 x i64]* %5, i64 0, i64 %101
%103 = sub nsw i32 3968, %100
%104 = call i64 @fwrite(i64* %102, i32 8, i32 %103, i32* %93)
%105 = trunc i64 %104 to i32
%106 = add i32 %100, %105
%107 = icmp sgt i32 %106, 3967
br i1 %107, label %98, label %99
}