#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 M_PI;
float sin(int);
float waveshaper_quadruple_sine(float signal, float curve) {
  signal =
      (0.5f * sin(2 * M_PI * curve * signal) * sin(4 * M_PI * curve * signal) *
           sin(6 * M_PI * curve * signal) * sin(8 * M_PI * curve * signal) +
       0.5f) *
      signal;
  return signal;
}


x86 assembly (clang, -O0):
<waveshaper_quadruple_sine>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
mov    0x2ebf(%rip),%rax
mov    (%rax),%eax
shl    $0x1,%eax
cvtsi2ss %eax,%xmm0
mulss  -0x8(%rbp),%xmm0
mulss  -0x4(%rbp),%xmm0
cvttss2si %xmm0,%edi
call   1030 <sin@plt>
movaps %xmm0,%xmm1
movss  0xeb0(%rip),%xmm0
mulss  %xmm1,%xmm0
movss  %xmm0,-0x14(%rbp)
mov    0x2e88(%rip),%rax
mov    (%rax),%eax
shl    $0x2,%eax
cvtsi2ss %eax,%xmm0
mulss  -0x8(%rbp),%xmm0
mulss  -0x4(%rbp),%xmm0
cvttss2si %xmm0,%edi
call   1030 <sin@plt>
movaps %xmm0,%xmm1
movss  -0x14(%rbp),%xmm0
mulss  %xmm1,%xmm0
movss  %xmm0,-0x10(%rbp)
mov    0x2e54(%rip),%rax
imul   $0x6,(%rax),%eax
cvtsi2ss %eax,%xmm0
mulss  -0x8(%rbp),%xmm0
mulss  -0x4(%rbp),%xmm0
cvttss2si %xmm0,%edi
call   1030 <sin@plt>
movaps %xmm0,%xmm1
movss  -0x10(%rbp),%xmm0
mulss  %xmm1,%xmm0
movss  %xmm0,-0xc(%rbp)
mov    0x2e22(%rip),%rax
mov    (%rax),%eax
shl    $0x3,%eax
cvtsi2ss %eax,%xmm0
mulss  -0x8(%rbp),%xmm0
mulss  -0x4(%rbp),%xmm0
cvttss2si %xmm0,%edi
call   1030 <sin@plt>
movaps %xmm0,%xmm1
movss  -0xc(%rbp),%xmm0
mulss  %xmm1,%xmm0
movss  0xe0a(%rip),%xmm1
addss  %xmm1,%xmm0
mulss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<waveshaper_quadruple_sine>:
push   %rbx
sub    $0x10,%rsp
movss  %xmm1,0xc(%rsp)
movss  %xmm0,0x8(%rsp)
mov    0x2ec0(%rip),%rbx
mov    (%rbx),%eax
add    %eax,%eax
cvtsi2ss %eax,%xmm2
mulss  %xmm1,%xmm2
mulss  %xmm0,%xmm2
cvttss2si %xmm2,%edi
call   1030 <sin@plt>
mulss  0xeb7(%rip),%xmm0
movss  %xmm0,0x4(%rsp)
mov    (%rbx),%eax
shl    $0x2,%eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
mulss  0xc(%rsp),%xmm0
mulss  0x8(%rsp),%xmm0
cvttss2si %xmm0,%edi
call   1030 <sin@plt>
mulss  0x4(%rsp),%xmm0
movss  %xmm0,0x4(%rsp)
mov    (%rbx),%eax
add    %eax,%eax
lea    (%rax,%rax,2),%eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
mulss  0xc(%rsp),%xmm0
mulss  0x8(%rsp),%xmm0
cvttss2si %xmm0,%edi
call   1030 <sin@plt>
mulss  0x4(%rsp),%xmm0
movss  %xmm0,0x4(%rsp)
mov    (%rbx),%eax
shl    $0x3,%eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
mulss  0xc(%rsp),%xmm0
mulss  0x8(%rsp),%xmm0
cvttss2si %xmm0,%edi
call   1030 <sin@plt>
mulss  0x4(%rsp),%xmm0
addss  0xe26(%rip),%xmm0
mulss  0x8(%rsp),%xmm0
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@M_PI = global i32 0
define float @waveshaper_quadruple_sine(float %0, float %1) {
%3 = alloca float
%4 = alloca float
store float %0, float* %3
store float %1, float* %4
%5 = load i32, i32* @M_PI
%6 = mul nsw i32 2, %5
%7 = sitofp i32 %6 to float
%8 = load float, float* %4
%9 = fmul float %7, %8
%10 = load float, float* %3
%11 = fmul float %9, %10
%12 = fptosi float %11 to i32
%13 = call float @sin(i32 %12)
%14 = fmul float 5.000000e-01, %13
%15 = load i32, i32* @M_PI
%16 = mul nsw i32 4, %15
%17 = sitofp i32 %16 to float
%18 = load float, float* %4
%19 = fmul float %17, %18
%20 = load float, float* %3
%21 = fmul float %19, %20
%22 = fptosi float %21 to i32
%23 = call float @sin(i32 %22)
%24 = fmul float %14, %23
%25 = load i32, i32* @M_PI
%26 = mul nsw i32 6, %25
%27 = sitofp i32 %26 to float
%28 = load float, float* %4
%29 = fmul float %27, %28
%30 = load float, float* %3
%31 = fmul float %29, %30
%32 = fptosi float %31 to i32
%33 = call float @sin(i32 %32)
%34 = fmul float %24, %33
%35 = load i32, i32* @M_PI
%36 = mul nsw i32 8, %35
%37 = sitofp i32 %36 to float
%38 = load float, float* %4
%39 = fmul float %37, %38
%40 = load float, float* %3
%41 = fmul float %39, %40
%42 = fptosi float %41 to i32
%43 = call float @sin(i32 %42)
%44 = call float @llvm.fmuladd.f32(float %34, float %43, float 5.000000e-01)
%45 = load float, float* %3
%46 = fmul float %44, %45
store float %46, float* %3
%47 = load float, float* %3
ret float %47
}

LLVM IR (-O2):
@M_PI = global i32 0
define float @waveshaper_quadruple_sine(float %0, float %1) {
%3 = load i32, i32* @M_PI
%4 = shl nsw i32 %3, 1
%5 = sitofp i32 %4 to float
%6 = fmul float %5, %1
%7 = fmul float %6, %0
%8 = fptosi float %7 to i32
%9 = tail call float @sin(i32 %8)
%10 = fmul float %9, 5.000000e-01
%11 = load i32, i32* @M_PI
%12 = shl nsw i32 %11, 2
%13 = sitofp i32 %12 to float
%14 = fmul float %13, %1
%15 = fmul float %14, %0
%16 = fptosi float %15 to i32
%17 = tail call float @sin(i32 %16)
%18 = fmul float %10, %17
%19 = load i32, i32* @M_PI
%20 = mul nsw i32 %19, 6
%21 = sitofp i32 %20 to float
%22 = fmul float %21, %1
%23 = fmul float %22, %0
%24 = fptosi float %23 to i32
%25 = tail call float @sin(i32 %24)
%26 = fmul float %18, %25
%27 = load i32, i32* @M_PI
%28 = shl nsw i32 %27, 3
%29 = sitofp i32 %28 to float
%30 = fmul float %29, %1
%31 = fmul float %30, %0
%32 = fptosi float %31 to i32
%33 = tail call float @sin(i32 %32)
%34 = tail call float @llvm.fmuladd.f32(float %26, float %33, float 5.000000e-01)
%35 = fmul float %34, %0
ret float %35
}