#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 */
double M_PI;
double cos(double);
double sin(double);
double lanczos(double offset) {
  if (offset) {
    double r = M_PI * offset;
    double ra = r / 5;
    double j = (sin(r) / (r * r) - cos(r) / r) / r;
    double ja = (sin(ra) / (ra * ra) - cos(ra) / ra) / ra;
    return (9 * j * ja);
  } else {
    return 1;
  }
}


x86 assembly (clang, -O0):
<lanczos>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    114a <lanczos+0x2a>
jp     114a <lanczos+0x2a>
jmp    1215 <lanczos+0xf5>
mov    0x2e97(%rip),%rax
movsd  (%rax),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  0xea4(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1030 <sin@plt>
movsd  -0x18(%rbp),%xmm1
mulsd  -0x18(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1040 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0x40(%rbp),%xmm0
divsd  -0x18(%rbp),%xmm1
subsd  %xmm1,%xmm0
divsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1030 <sin@plt>
movsd  -0x20(%rbp),%xmm1
mulsd  -0x20(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1040 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0x38(%rbp),%xmm0
divsd  -0x20(%rbp),%xmm1
subsd  %xmm1,%xmm0
divsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xe07(%rip),%xmm0
mulsd  -0x28(%rbp),%xmm0
mulsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1222 <lanczos+0x102>
movsd  0xde3(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lanczos>:
sub    $0x48,%rsp
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1134 <lanczos+0x14>
jnp    1216 <lanczos+0xf6>
mov    0x2ead(%rip),%rax
mulsd  (%rax),%xmm0
movapd %xmm0,0x10(%rsp)
movapd %xmm0,%xmm1
divsd  0xeb7(%rip),%xmm1
movapd %xmm1,0x20(%rsp)
call   1030 <sin@plt>
movapd %xmm0,(%rsp)
movapd 0x10(%rsp),%xmm0
movapd %xmm0,%xmm1
mulsd  %xmm0,%xmm1
movapd %xmm1,0x30(%rsp)
call   1040 <cos@plt>
movapd (%rsp),%xmm1
unpcklpd %xmm0,%xmm1
movapd 0x30(%rsp),%xmm0
unpcklpd 0x10(%rsp),%xmm0
divpd  %xmm0,%xmm1
movapd %xmm1,%xmm0
unpckhpd %xmm1,%xmm0
subpd  %xmm0,%xmm1
movapd %xmm1,(%rsp)
movapd 0x20(%rsp),%xmm0
call   1030 <sin@plt>
movapd 0x20(%rsp),%xmm2
movapd %xmm2,%xmm1
mulsd  %xmm2,%xmm1
movapd (%rsp),%xmm3
unpcklpd %xmm0,%xmm3
movapd 0x10(%rsp),%xmm0
unpcklpd %xmm1,%xmm0
divpd  %xmm0,%xmm3
movapd %xmm3,(%rsp)
movapd %xmm2,%xmm0
call   1040 <cos@plt>
movapd 0x20(%rsp),%xmm3
divsd  %xmm3,%xmm0
movapd (%rsp),%xmm2
movapd %xmm2,%xmm1
unpckhpd %xmm2,%xmm1
subsd  %xmm0,%xmm1
movapd %xmm2,%xmm0
divsd  %xmm3,%xmm1
mulsd  0xe03(%rip),%xmm0
mulsd  %xmm1,%xmm0
add    $0x48,%rsp
ret
movsd  0xde2(%rip),%xmm0
add    $0x48,%rsp
ret

LLVM IR (-O0):
@M_PI = global double 0.000000e+00
define double @lanczos(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
store double %0, double* %3
%8 = load double, double* %3
%9 = fcmp une double %8, 0.000000e+00
br i1 %9, label %10, label %46
10: ; preds = %1
%11 = load double, double* @M_PI
%12 = load double, double* %3
%13 = fmul double %11, %12
store double %13, double* %4
%14 = load double, double* %4
%15 = fdiv double %14, 5.000000e+00
store double %15, double* %5
%16 = load double, double* %4
%17 = call double @sin(double %16)
%18 = load double, double* %4
%19 = load double, double* %4
%20 = fmul double %18, %19
%21 = fdiv double %17, %20
%22 = load double, double* %4
%23 = call double @cos(double %22)
%24 = load double, double* %4
%25 = fdiv double %23, %24
%26 = fsub double %21, %25
%27 = load double, double* %4
%28 = fdiv double %26, %27
store double %28, double* %6
%29 = load double, double* %5
%30 = call double @sin(double %29)
%31 = load double, double* %5
%32 = load double, double* %5
%33 = fmul double %31, %32
%34 = fdiv double %30, %33
%35 = load double, double* %5
%36 = call double @cos(double %35)
%37 = load double, double* %5
%38 = fdiv double %36, %37
%39 = fsub double %34, %38
%40 = load double, double* %5
%41 = fdiv double %39, %40
store double %41, double* %7
%42 = load double, double* %6
%43 = fmul double 9.000000e+00, %42
%44 = load double, double* %7
%45 = fmul double %43, %44
store double %45, double* %2
br label %47
46: ; preds = %1
store double 1.000000e+00, double* %2
br label %47
47: ; preds = %46, %10
%48 = load double, double* %2
ret double %48
}

LLVM IR (-O2):
@M_PI = global double 0.000000e+00
define double @lanczos(double %0) {
%2 = fcmp une double %0, 0.000000e+00
br i1 %2, label %3, label %31
3: ; preds = %1
%4 = load double, double* @M_PI
%5 = fmul double %4, %0
%6 = fdiv double %5, 5.000000e+00
%7 = tail call double @sin(double %5)
%8 = fmul double %5, %5
%9 = tail call double @cos(double %5)
%10 = insertelement <2 x double> poison, double %7, i64 0
%11 = insertelement <2 x double> %10, double %9, i64 1
%12 = insertelement <2 x double> poison, double %8, i64 0
%13 = insertelement <2 x double> %12, double %5, i64 1
%14 = fdiv <2 x double> %11, %13
%15 = shufflevector <2 x double> %14, <2 x double> poison, <2 x i32> <i32 1, i32 undef>
%16 = fsub <2 x double> %14, %15
%17 = tail call double @sin(double %6)
%18 = fmul double %6, %6
%19 = insertelement <2 x double> %16, double %17, i64 1
%20 = insertelement <2 x double> poison, double %5, i64 0
%21 = insertelement <2 x double> %20, double %18, i64 1
%22 = fdiv <2 x double> %19, %21
%23 = tail call double @cos(double %6)
%24 = fdiv double %23, %6
%25 = extractelement <2 x double> %22, i64 1
%26 = fsub double %25, %24
%27 = fdiv double %26, %6
%28 = extractelement <2 x double> %22, i64 0
%29 = fmul double %28, 9.000000e+00
%30 = fmul double %29, %27
br label %31
31: ; preds = %1, %3
%32 = phi double [ %30, %3 ], [ 1.000000e+00, %1 ]
ret double %32
}