#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 */
double Pulse300Hz(float, float);
int sin(int);
void PhonemeJ(float t, float *frame) {
  const float buzz =
      Pulse300Hz(t, 0.4f) *
      (0.0155 +
       (0.1375 - 0.0155) * (1 + sin(2 * 3.14159265358979324 * 8.0 * t)) / 2);
  int c;
  for (c = 0; c < 24; ++c) {
    frame[c] = (c == 0 || c == 1 || c == 20 || c == 21) ? buzz : 0.0f;
  }
}


x86 assembly (clang, -O0):
<PhonemeJ>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movss  %xmm0,-0x4(%rbp)
mov    %rdi,-0x10(%rbp)
movss  -0x4(%rbp),%xmm0
movss  0xee2(%rip),%xmm1
call   1040 <Pulse300Hz@plt>
movsd  %xmm0,-0x20(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xebf(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1030 <sin@plt>
movsd  -0x20(%rbp),%xmm0
add    $0x1,%eax
cvtsi2sd %eax,%xmm1
movsd  0xe96(%rip),%xmm2
mulsd  %xmm1,%xmm2
movsd  0xe82(%rip),%xmm1
divsd  %xmm1,%xmm2
movsd  0xe6e(%rip),%xmm1
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
cmpl   $0x18,-0x18(%rbp)
jge    1218 <PhonemeJ+0xf8>
cmpl   $0x0,-0x18(%rbp)
je     11dc <PhonemeJ+0xbc>
cmpl   $0x1,-0x18(%rbp)
je     11dc <PhonemeJ+0xbc>
cmpl   $0x14,-0x18(%rbp)
je     11dc <PhonemeJ+0xbc>
cmpl   $0x15,-0x18(%rbp)
jne    11eb <PhonemeJ+0xcb>
movss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x24(%rbp)
jmp    11f8 <PhonemeJ+0xd8>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x24(%rbp)
jmp    11f8 <PhonemeJ+0xd8>
movss  -0x24(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11aa <PhonemeJ+0x8a>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PhonemeJ>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
movss  %xmm0,0x4(%rsp)
movss  0xeca(%rip),%xmm1
call   1040 <Pulse300Hz@plt>
movsd  %xmm0,0x8(%rsp)
movss  0x4(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  0xeb5(%rip),%xmm0
cvttsd2si %xmm0,%edi
call   1030 <sin@plt>
add    $0x1,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  0xea2(%rip),%xmm0
mulsd  0xea2(%rip),%xmm0
addsd  0xea2(%rip),%xmm0
mulsd  0x8(%rsp),%xmm0
cvtsd2ss %xmm0,%xmm0
xor    %eax,%eax
jmp    11a0 <PhonemeJ+0x80>
nopl   0x0(%rax)
movss  %xmm1,0x8(%rbx,%rax,4)
add    $0x3,%rax
cmp    $0x18,%rax
je     11ff <PhonemeJ+0xdf>
mov    %eax,%ecx
and    $0x7ffffffe,%ecx
movaps %xmm0,%xmm1
cmp    $0x14,%ecx
je     11b3 <PhonemeJ+0x93>
xorps  %xmm1,%xmm1
movaps %xmm0,%xmm2
cmp    $0x2,%rax
jb     11bf <PhonemeJ+0x9f>
movaps %xmm1,%xmm2
movss  %xmm2,(%rbx,%rax,4)
lea    0x1(%rax),%ecx
and    $0x7ffffffe,%ecx
movaps %xmm0,%xmm1
cmp    $0x14,%ecx
je     11d8 <PhonemeJ+0xb8>
xorps  %xmm1,%xmm1
movaps %xmm0,%xmm2
test   %rax,%rax
je     11e3 <PhonemeJ+0xc3>
movaps %xmm1,%xmm2
movss  %xmm2,0x4(%rbx,%rax,4)
lea    0x2(%rax),%ecx
and    $0x7ffffffe,%ecx
movaps %xmm0,%xmm1
cmp    $0x14,%ecx
je     1190 <PhonemeJ+0x70>
xorps  %xmm1,%xmm1
jmp    1190 <PhonemeJ+0x70>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @PhonemeJ(float %0, float* %1) {
%3 = alloca float
%4 = alloca float*
%5 = alloca float
%6 = alloca i32
store float %0, float* %3
store float* %1, float** %4
%7 = load float, float* %3
%8 = call double @Pulse300Hz(float %7, float 0x3FD99999A0000000)
%9 = load float, float* %3
%10 = fpext float %9 to double
%11 = fmul double 0x404921FB54442D18, %10
%12 = fptosi double %11 to i32
%13 = call i32 @sin(i32 %12)
%14 = add nsw i32 1, %13
%15 = sitofp i32 %14 to double
%16 = fmul double 0x3FBF3B645A1CAC09, %15
%17 = fdiv double %16, 2.000000e+00
%18 = fadd double 1.550000e-02, %17
%19 = fmul double %8, %18
%20 = fptrunc double %19 to float
store float %20, float* %5
store i32 0, i32* %6
br label %21
21: ; preds = %45, %2
%22 = load i32, i32* %6
%23 = icmp slt i32 %22, 24
br i1 %23, label %24, label %48
24: ; preds = %21
%25 = load i32, i32* %6
%26 = icmp eq i32 %25, 0
br i1 %26, label %36, label %27
27: ; preds = %24
%28 = load i32, i32* %6
%29 = icmp eq i32 %28, 1
br i1 %29, label %36, label %30
30: ; preds = %27
%31 = load i32, i32* %6
%32 = icmp eq i32 %31, 20
br i1 %32, label %36, label %33
33: ; preds = %30
%34 = load i32, i32* %6
%35 = icmp eq i32 %34, 21
br i1 %35, label %36, label %38
36: ; preds = %33, %30, %27, %24
%37 = load float, float* %5
br label %39
38: ; preds = %33
br label %39
39: ; preds = %38, %36
%40 = phi float [ %37, %36 ], [ 0.000000e+00, %38 ]
%41 = load float*, float** %4
%42 = load i32, i32* %6
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds float, float* %41, i64 %43
store float %40, float* %44
br label %45
45: ; preds = %39
%46 = load i32, i32* %6
%47 = add nsw i32 %46, 1
store i32 %47, i32* %6
br label %21
48: ; preds = %21
ret void
}

LLVM IR (-O2):
define void @PhonemeJ(float %0, float* nocapture writeonly %1) {
%3 = tail call double @Pulse300Hz(float %0, float 0x3FD99999A0000000)
%4 = fpext float %0 to double
%5 = fmul double %4, 0x404921FB54442D18
%6 = fptosi double %5 to i32
%7 = tail call i32 @sin(i32 %6)
%8 = add nsw i32 %7, 1
%9 = sitofp i32 %8 to double
%10 = fmul double %9, 0x3FBF3B645A1CAC09
%11 = fmul double %10, 5.000000e-01
%12 = fadd double %11, 1.550000e-02
%13 = fmul double %3, %12
%14 = fptrunc double %13 to float
br label %15
15: ; preds = %15, %2
%16 = phi i64 [ 0, %2 ], [ %35, %15 ]
%17 = icmp ult i64 %16, 2
%18 = and i64 %16, 2147483646
%19 = icmp eq i64 %18, 20
%20 = or i1 %17, %19
%21 = select i1 %20, float %14, float 0.000000e+00
%22 = getelementptr inbounds float, float* %1, i64 %16
store float %21, float* %22
%23 = add nuw nsw i64 %16, 1
%24 = icmp eq i64 %16, 0
%25 = and i64 %23, 2147483646
%26 = icmp eq i64 %25, 20
%27 = or i1 %24, %26
%28 = select i1 %27, float %14, float 0.000000e+00
%29 = getelementptr inbounds float, float* %1, i64 %23
store float %28, float* %29
%30 = add nuw nsw i64 %16, 2
%31 = and i64 %30, 2147483646
%32 = icmp eq i64 %31, 20
%33 = select i1 %32, float %14, float 0.000000e+00
%34 = getelementptr inbounds float, float* %1, i64 %30
store float %33, float* %34
%35 = add nuw nsw i64 %16, 3
%36 = icmp eq i64 %35, 24
br i1 %36, label %37, label %15
37: ; preds = %15
ret void
}