#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 sin(float);
float lanczos(float x) {
  if (x == 0.0f)
    return 1.0f;
  else {
    float xpi = x * 3.141593f;
    return 2 * sin(xpi) * sin(xpi / 2) / (xpi * xpi);
  }
}


x86 assembly (clang, -O0):
<lanczos>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    1146 <lanczos+0x36>
jp     1146 <lanczos+0x36>
movss  0xecc(%rip),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    119d <lanczos+0x8d>
movss  0xeb6(%rip),%xmm0
mulss  -0x8(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
call   1030 <sin@plt>
shl    $0x1,%eax
mov    %eax,-0x10(%rbp)
movss  -0xc(%rbp),%xmm0
movss  0xe8b(%rip),%xmm1
divss  %xmm1,%xmm0
call   1030 <sin@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%eax
imul   %ecx,%eax
cvtsi2ss %eax,%xmm0
movss  -0xc(%rbp),%xmm1
mulss  -0xc(%rbp),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lanczos>:
push   %rbx
sub    $0x10,%rsp
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    1129 <lanczos+0x19>
jp     1129 <lanczos+0x19>
movss  0xed9(%rip),%xmm0
jmp    116b <lanczos+0x5b>
mulss  0xed3(%rip),%xmm0
movss  %xmm0,0xc(%rsp)
call   1030 <sin@plt>
mov    %eax,%ebx
movss  0xec2(%rip),%xmm0
mulss  0xc(%rsp),%xmm0
call   1030 <sin@plt>
imul   %ebx,%eax
add    %eax,%eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
movss  0xc(%rsp),%xmm1
mulss  %xmm1,%xmm1
divss  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define float @lanczos(float %0) {
%2 = alloca float
%3 = alloca float
%4 = alloca float
store float %0, float* %3
%5 = load float, float* %3
%6 = fcmp oeq float %5, 0.000000e+00
br i1 %6, label %7, label %8
7: ; preds = %1
store float 1.000000e+00, float* %2
br label %23
8: ; preds = %1
%9 = load float, float* %3
%10 = fmul float %9, 0x400921FB80000000
store float %10, float* %4
%11 = load float, float* %4
%12 = call i32 @sin(float %11)
%13 = mul nsw i32 2, %12
%14 = load float, float* %4
%15 = fdiv float %14, 2.000000e+00
%16 = call i32 @sin(float %15)
%17 = mul nsw i32 %13, %16
%18 = sitofp i32 %17 to float
%19 = load float, float* %4
%20 = load float, float* %4
%21 = fmul float %19, %20
%22 = fdiv float %18, %21
store float %22, float* %2
br label %23
23: ; preds = %8, %7
%24 = load float, float* %2
ret float %24
}

LLVM IR (-O2):
define float @lanczos(float %0) {
%2 = fcmp oeq float %0, 0.000000e+00
br i1 %2, label %13, label %3
3: ; preds = %1
%4 = fmul float %0, 0x400921FB80000000
%5 = tail call i32 @sin(float %4)
%6 = shl nsw i32 %5, 1
%7 = fmul float %4, 5.000000e-01
%8 = tail call i32 @sin(float %7)
%9 = mul nsw i32 %6, %8
%10 = sitofp i32 %9 to float
%11 = fmul float %4, %4
%12 = fdiv float %10, %11
br label %13
13: ; preds = %1, %3
%14 = phi float [ %12, %3 ], [ 1.000000e+00, %1 ]
ret float %14
}