#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 */
float const fabsf(float);
float fast_sin(float x) {
  volatile float z = (x + 25165824.0f);
  x = x - (z - 25165824.0f);
  {
    float y = x - x * fabsf(x);
    const float Q = 3.1f;
    const float P = 3.6f;
    return y * (Q + P * fabsf(y));
  }
}


x86 assembly (clang, -O0):
<fast_sin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x4(%rbp)
movss  0xee3(%rip),%xmm0
addss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
movss  0xec7(%rip),%xmm2
subss  %xmm2,%xmm1
subss  %xmm1,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x4(%rbp),%xmm0
call   1030 <fabsf@plt>
movss  -0x20(%rbp),%xmm1
movaps %xmm0,%xmm2
movss  -0x1c(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  0xe69(%rip),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  0xe58(%rip),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0xc(%rbp),%xmm0
call   1030 <fabsf@plt>
movaps %xmm0,%xmm1
movss  -0x18(%rbp),%xmm0
movss  0xe2f(%rip),%xmm2
mulss  %xmm2,%xmm1
movss  0xe27(%rip),%xmm2
addss  %xmm2,%xmm1
mulss  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fast_sin>:
movss  0xef8(%rip),%xmm1
addss  %xmm0,%xmm1
movss  %xmm1,-0x4(%rsp)
movss  -0x4(%rsp),%xmm1
addss  0xee4(%rip),%xmm1
subss  %xmm1,%xmm0
movaps 0xee5(%rip),%xmm1
movaps %xmm0,%xmm2
andps  %xmm1,%xmm2
mulss  %xmm0,%xmm2
subss  %xmm2,%xmm0
andps  %xmm0,%xmm1
mulss  0xec4(%rip),%xmm1
addss  0xec0(%rip),%xmm1
mulss  %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @fast_sin(float %0) {
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca float
store float %0, float* %2
%7 = load float, float* %2
%8 = fadd float %7, 0x4178000000000000
store volatile float %8, float* %3
%9 = load float, float* %2
%10 = load volatile float, float* %3
%11 = fsub float %10, 0x4178000000000000
%12 = fsub float %9, %11
store float %12, float* %2
%13 = load float, float* %2
%14 = load float, float* %2
%15 = load float, float* %2
%16 = call float @fabsf(float %15)
%17 = fneg float %14
%18 = call float @llvm.fmuladd.f32(float %17, float %16, float %13)
store float %18, float* %4
store float 0x4008CCCCC0000000, float* %5
store float 0x400CCCCCC0000000, float* %6
%19 = load float, float* %4
%20 = load float, float* %4
%21 = call float @fabsf(float %20)
%22 = call float @llvm.fmuladd.f32(float 0x400CCCCCC0000000, float %21, float 0x4008CCCCC0000000)
%23 = fmul float %19, %22
ret float %23
}

LLVM IR (-O2):
define float @fast_sin(float %0) {
%2 = alloca float
%3 = bitcast float* %2 to i8*
%4 = fadd float %0, 0x4178000000000000
store volatile float %4, float* %2
%5 = load volatile float, float* %2
%6 = fadd float %5, 0xC178000000000000
%7 = fsub float %0, %6
%8 = tail call float @llvm.fabs.f32(float %7)
%9 = fneg float %7
%10 = tail call float @llvm.fmuladd.f32(float %9, float %8, float %7)
%11 = tail call float @llvm.fabs.f32(float %10)
%12 = tail call float @llvm.fmuladd.f32(float %11, float 0x400CCCCCC0000000, float 0x4008CCCCC0000000)
%13 = fmul float %10, %12
ret float %13
}