#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 floor(float);
float fmod(float, double);
double sin(double);
float sinc(float x) {
  float xm, val;
  xm = .0;
  if (x == 0.0)
    val = 1.0;
  else {
    val = sin(3.14159265358979323846 * xm) / (3.14159265358979323846 * x);
    xm = fmod(x, 2.0);
    if (x == floor(x))
      val = 0.0;
    else
      val = sin(3.14159265358979323846 * xm) / (3.14159265358979323846 * x);
  }
  return val;
}


x86 assembly (clang, -O0):
<sinc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1173 <sinc+0x43>
jp     1173 <sinc+0x43>
movss  0xea7(%rip),%xmm0
movss  %xmm0,-0xc(%rbp)
jmp    123f <sinc+0x10f>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe84(%rip),%xmm0
mulsd  %xmm1,%xmm0
call   1040 <sin@plt>
movss  -0x4(%rbp),%xmm1
cvtss2sd %xmm1,%xmm2
movsd  0xe6a(%rip),%xmm1
mulsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0x4(%rbp),%xmm0
movsd  0xe44(%rip),%xmm1
call   1030 <fmod@plt>
movss  %xmm0,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x4(%rbp),%xmm0
call   1050 <floor@plt>
movaps %xmm0,%xmm1
movss  -0x10(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jne    11fe <sinc+0xce>
jp     11fe <sinc+0xce>
xorps  %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
jmp    123a <sinc+0x10a>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xdf9(%rip),%xmm0
mulsd  %xmm1,%xmm0
call   1040 <sin@plt>
movss  -0x4(%rbp),%xmm1
cvtss2sd %xmm1,%xmm2
movsd  0xddf(%rip),%xmm1
mulsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
jmp    123f <sinc+0x10f>
movss  -0xc(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sinc>:
sub    $0x18,%rsp
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    114b <sinc+0x1b>
jp     114b <sinc+0x1b>
movss  0xeba(%rip),%xmm0
add    $0x18,%rsp
ret
movsd  0xeb5(%rip),%xmm1
movss  %xmm0,0x8(%rsp)
call   1030 <fmod@plt>
movss  %xmm0,0x14(%rsp)
movss  0x8(%rsp),%xmm0
call   1040 <floorf@plt>
movss  0x8(%rsp),%xmm1
ucomiss %xmm1,%xmm0
xorps  %xmm0,%xmm0
jne    1184 <sinc+0x54>
jp     1184 <sinc+0x54>
add    $0x18,%rsp
ret
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
movsd  0xe7d(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,0x8(%rsp)
movss  0x14(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  %xmm1,%xmm0
call   1050 <sin@plt>
divsd  0x8(%rsp),%xmm0
cvtsd2ss %xmm0,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define float @sinc(float %0) {
%2 = alloca float
%3 = alloca float
%4 = alloca float
store float %0, float* %2
store float 0.000000e+00, float* %3
%5 = load float, float* %2
%6 = fpext float %5 to double
%7 = fcmp oeq double %6, 0.000000e+00
br i1 %7, label %8, label %9
8: ; preds = %1
store float 1.000000e+00, float* %4
br label %37
9: ; preds = %1
%10 = load float, float* %3
%11 = fpext float %10 to double
%12 = fmul double 0x400921FB54442D18, %11
%13 = call double @sin(double %12)
%14 = load float, float* %2
%15 = fpext float %14 to double
%16 = fmul double 0x400921FB54442D18, %15
%17 = fdiv double %13, %16
%18 = fptrunc double %17 to float
store float %18, float* %4
%19 = load float, float* %2
%20 = call float @fmod(float %19, double 2.000000e+00)
store float %20, float* %3
%21 = load float, float* %2
%22 = load float, float* %2
%23 = call float @floor(float %22)
%24 = fcmp oeq float %21, %23
br i1 %24, label %25, label %26
25: ; preds = %9
store float 0.000000e+00, float* %4
br label %36
26: ; preds = %9
%27 = load float, float* %3
%28 = fpext float %27 to double
%29 = fmul double 0x400921FB54442D18, %28
%30 = call double @sin(double %29)
%31 = load float, float* %2
%32 = fpext float %31 to double
%33 = fmul double 0x400921FB54442D18, %32
%34 = fdiv double %30, %33
%35 = fptrunc double %34 to float
store float %35, float* %4
br label %36
36: ; preds = %26, %25
br label %37
37: ; preds = %36, %8
%38 = load float, float* %4
ret float %38
}

LLVM IR (-O2):
define float @sinc(float %0) {
%2 = fcmp oeq float %0, 0.000000e+00
br i1 %2, label %15, label %3
3: ; preds = %1
%4 = tail call float @fmod(float %0, double 2.000000e+00)
%5 = tail call float @llvm.floor.f32(float %0)
%6 = fcmp oeq float %5, %0
br i1 %6, label %15, label %7
7: ; preds = %3
%8 = fpext float %0 to double
%9 = fmul double %8, 0x400921FB54442D18
%10 = fpext float %4 to double
%11 = fmul double %10, 0x400921FB54442D18
%12 = tail call double @sin(double %11)
%13 = fdiv double %12, %9
%14 = fptrunc double %13 to float
br label %15
15: ; preds = %3, %1, %7
%16 = phi float [ %14, %7 ], [ 1.000000e+00, %1 ], [ 0.000000e+00, %3 ]
ret float %16
}