#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 M_PI;
float sinf(float);
float lanczos(float r, float x) {
  float t;
  if (x == 0.0f)
    return (1.0f);
  if (x <= -r || x >= r)
    return (0.0f);
  t = x * M_PI;
  return (r * sinf(t) * sinf(t / r) / (t * t));
}


x86 assembly (clang, -O0):
<lanczos>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x8(%rbp)
movss  %xmm1,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    114b <lanczos+0x3b>
jp     114b <lanczos+0x3b>
movss  0xebf(%rip),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    11ef <lanczos+0xdf>
movss  -0xc(%rbp),%xmm1
movss  -0x8(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
ucomiss %xmm1,%xmm0
jae    117a <lanczos+0x6a>
movss  -0xc(%rbp),%xmm0
ucomiss -0x8(%rbp),%xmm0
jb     1187 <lanczos+0x77>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    11ef <lanczos+0xdf>
movss  -0xc(%rbp),%xmm0
mov    0x2e55(%rip),%rax
mulss  (%rax),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x10(%rbp),%xmm0
call   1030 <sinf@plt>
movaps %xmm0,%xmm1
movss  -0x18(%rbp),%xmm0
mulss  %xmm1,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x10(%rbp),%xmm0
divss  -0x8(%rbp),%xmm0
call   1030 <sinf@plt>
movaps %xmm0,%xmm1
movss  -0x14(%rbp),%xmm0
mulss  %xmm1,%xmm0
movss  -0x10(%rbp),%xmm1
mulss  -0x10(%rbp),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lanczos>:
sub    $0x28,%rsp
movaps %xmm0,%xmm3
xorps  %xmm0,%xmm0
ucomiss %xmm0,%xmm1
jne    112e <lanczos+0x1e>
jp     112e <lanczos+0x1e>
movss  0xed7(%rip),%xmm0
add    $0x28,%rsp
ret
movaps 0xedb(%rip),%xmm2
xorps  %xmm3,%xmm2
ucomiss %xmm1,%xmm2
jae    1192 <lanczos+0x82>
ucomiss %xmm3,%xmm1
jae    1192 <lanczos+0x82>
mov    0x2e9f(%rip),%rax
mulss  (%rax),%xmm1
movss  %xmm1,0x8(%rsp)
movaps %xmm1,%xmm0
movaps %xmm3,0x10(%rsp)
call   1030 <sinf@plt>
movaps 0x10(%rsp),%xmm1
mulss  %xmm1,%xmm0
movss  %xmm0,0xc(%rsp)
movss  0x8(%rsp),%xmm0
divss  %xmm1,%xmm0
call   1030 <sinf@plt>
mulss  0xc(%rsp),%xmm0
movss  0x8(%rsp),%xmm1
mulss  %xmm1,%xmm1
divss  %xmm1,%xmm0
add    $0x28,%rsp
ret

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

LLVM IR (-O2):
@M_PI = global float 0.000000e+00
define float @lanczos(float %0, float %1) {
%3 = fcmp oeq float %1, 0.000000e+00
br i1 %3, label %19, label %4
4: ; preds = %2
%5 = fneg float %0
%6 = fcmp ult float %5, %1
%7 = fcmp ult float %1, %0
%8 = and i1 %6, %7
br i1 %8, label %9, label %19
9: ; preds = %4
%10 = load float, float* @M_PI
%11 = fmul float %10, %1
%12 = tail call float @sinf(float %11)
%13 = fmul float %12, %0
%14 = fdiv float %11, %0
%15 = tail call float @sinf(float %14)
%16 = fmul float %13, %15
%17 = fmul float %11, %11
%18 = fdiv float %16, %17
br label %19
19: ; preds = %4, %2, %9
%20 = phi float [ %18, %9 ], [ 1.000000e+00, %2 ], [ 0.000000e+00, %4 ]
ret float %20
}