#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 cos(int);
int fabs(double);
int floor(double);
double sin(double);
void make_lookup_sinc_grad(double coord, int q, int dim, int *d1, double *table,
                           double *dtable, double **ptpend) {
  register int d2, d, fcoord;
  register double *tp, *dtp, *tpend, dtmp0, dtmp1, sdtmp, cdtmp, sm, sm1;
  static int oq = 0, k0, k1;
  coord--;
  if (q != oq) {
    oq = q;
    if (q % 2) {
      k0 = -(q - 1) / 2;
      k1 = (q - 1) / 2;
    } else {
      k0 = -(q - 2) / 2;
      k1 = q / 2;
    }
  }
  fcoord = floor(q % 2 ? coord + 0.5 : coord);
  *d1 = fcoord + k0;
  if (*d1 < 0)
    *d1 = 0;
  d2 = fcoord + k1;
  if (d2 >= dim)
    d2 = dim - 1;
  *ptpend = tpend = table + (d2 - *d1);
  d = *d1, tp = table, dtp = dtable;
  sm1 = 0, sm = 0;
  while (tp <= tpend) {
    dtmp0 = coord - d;
    if (fabs(dtmp0) > 1e-12) {
      dtmp1 = 3.14159265358979323846 * dtmp0;
      sdtmp = sin(dtmp1);
      cdtmp = cos(2 * dtmp1 / q);
      sm += (*(tp++) = sdtmp / dtmp1 * 0.5 * (1.0 + cdtmp));
    } else {
      *(tp++) = 1.0;
      sm += 1.0;
    }
    dtmp0 = coord - (d++) + 0.000001;
    if (fabs(dtmp0) > 1e-12) {
      dtmp1 = 3.14159265358979323846 * dtmp0;
      sdtmp = sin(dtmp1);
      cdtmp = cos(2 * dtmp1 / q);
      sm1 += (*(dtp++) = sdtmp / dtmp1 * 0.5 * (1.0 + cdtmp));
    } else {
      *(dtp++) = 1.0;
      sm1 += 1.0;
    }
  }
  tp = table, dtp = dtable;
  while (tp <= tpend) {
    *tp /= sm;
    *dtp = (*dtp / sm1 - *tp) / 0.000001;
    tp++;
    dtp++;
  }
}


x86 assembly (clang, -O0):
<make_lookup_sinc_grad>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %edi,-0xc(%rbp)
mov    %esi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
movsd  0xe92(%rip),%xmm0
addsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
mov    -0xc(%rbp),%eax
cmp    0x2ec3(%rip),%eax
je     1203 <make_lookup_sinc_grad+0xc3>
mov    -0xc(%rbp),%eax
mov    %eax,0x2eb4(%rip)
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     11d5 <make_lookup_sinc_grad+0x95>
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
xor    %eax,%eax
sub    %ecx,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,0x2e8c(%rip)
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,0x2e7c(%rip)
jmp    11fe <make_lookup_sinc_grad+0xbe>
mov    -0xc(%rbp),%ecx
sub    $0x2,%ecx
xor    %eax,%eax
sub    %ecx,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,0x2e5b(%rip)
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,0x2e4e(%rip)
jmp    1203 <make_lookup_sinc_grad+0xc3>
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     1231 <make_lookup_sinc_grad+0xf1>
movsd  0xde9(%rip),%xmm0
addsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
jmp    123e <make_lookup_sinc_grad+0xfe>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x90(%rbp),%xmm0
ff
call   1060 <floor@plt>
mov    %eax,-0x3c(%rbp)
mov    -0x3c(%rbp),%ecx
add    0x2df1(%rip),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x18(%rbp),%rax
cmpl   $0x0,(%rax)
jge    1274 <make_lookup_sinc_grad+0x134>
mov    -0x18(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x3c(%rbp),%eax
add    0x2dcf(%rip),%eax
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x10(%rbp),%eax
jl     1295 <make_lookup_sinc_grad+0x155>
mov    -0x10(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x34(%rbp)
mov    -0x20(%rbp),%rcx
mov    -0x34(%rbp),%eax
mov    -0x18(%rbp),%rdx
sub    (%rdx),%eax
cltq
shl    $0x3,%rax
add    %rax,%rcx
mov    %rcx,-0x58(%rbp)
mov    -0x30(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x38(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x50(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x80(%rbp)
mov    -0x48(%rbp),%rax
cmp    -0x58(%rbp),%rax
ja     14f3 <make_lookup_sinc_grad+0x3b3>
movsd  -0x8(%rbp),%xmm0
cvtsi2sdl -0x38(%rbp),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x60(%rbp),%xmm0
call   1030 <fabs@plt>
cvtsi2sd %eax,%xmm0
movsd  0xcff(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    13b1 <make_lookup_sinc_grad+0x271>
movsd  0xd05(%rip),%xmm0
mulsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x68(%rbp),%xmm0
call   1040 <sin@plt>
movsd  %xmm0,-0x70(%rbp)
movsd  0xcdc(%rip),%xmm0
mulsd  -0x68(%rbp),%xmm0
cvtsi2sdl -0xc(%rbp),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1050 <cos@plt>
movsd  %xmm0,-0x78(%rbp)
movsd  -0x70(%rbp),%xmm0
divsd  -0x68(%rbp),%xmm0
movsd  0xc8e(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xc9a(%rip),%xmm1
addsd  -0x78(%rbp),%xmm1
mulsd  %xmm1,%xmm0
mov    -0x48(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x48(%rbp)
movsd  %xmm0,(%rax)
addsd  -0x80(%rbp),%xmm0
movsd  %xmm0,-0x80(%rbp)
jmp    13de <make_lookup_sinc_grad+0x29e>
mov    -0x48(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x48(%rbp)
movsd  0xc58(%rip),%xmm0
movsd  %xmm0,(%rax)
movsd  0xc4c(%rip),%xmm0
addsd  -0x80(%rbp),%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x8(%rbp),%xmm0
mov    -0x38(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x38(%rbp)
cvtsi2sd %eax,%xmm1
subsd  %xmm1,%xmm0
movsd  0xc12(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x60(%rbp),%xmm0
call   1030 <fabs@plt>
cvtsi2sd %eax,%xmm0
movsd  0xbfb(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    14bb <make_lookup_sinc_grad+0x37b>
movsd  0xc01(%rip),%xmm0
mulsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x68(%rbp),%xmm0
call   1040 <sin@plt>
movsd  %xmm0,-0x70(%rbp)
movsd  0xbd8(%rip),%xmm0
mulsd  -0x68(%rbp),%xmm0
cvtsi2sdl -0xc(%rbp),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1050 <cos@plt>
movsd  %xmm0,-0x78(%rbp)
movsd  -0x70(%rbp),%xmm0
divsd  -0x68(%rbp),%xmm0
movsd  0xb8a(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xb96(%rip),%xmm1
addsd  -0x78(%rbp),%xmm1
mulsd  %xmm1,%xmm0
mov    -0x50(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x50(%rbp)
movsd  %xmm0,(%rax)
addsd  -0x88(%rbp),%xmm0
ff
movsd  %xmm0,-0x88(%rbp)
ff
jmp    14ee <make_lookup_sinc_grad+0x3ae>
mov    -0x50(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x50(%rbp)
movsd  0xb4e(%rip),%xmm0
movsd  %xmm0,(%rax)
movsd  0xb42(%rip),%xmm0
addsd  -0x88(%rbp),%xmm0
ff
movsd  %xmm0,-0x88(%rbp)
ff
jmp    12e2 <make_lookup_sinc_grad+0x1a2>
mov    -0x20(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    -0x48(%rbp),%rax
cmp    -0x58(%rbp),%rax
ja     156f <make_lookup_sinc_grad+0x42f>
movsd  -0x80(%rbp),%xmm1
mov    -0x48(%rbp),%rax
movsd  (%rax),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,(%rax)
mov    -0x50(%rbp),%rax
movsd  (%rax),%xmm0
divsd  -0x88(%rbp),%xmm0
ff
mov    -0x48(%rbp),%rax
subsd  (%rax),%xmm0
movsd  0xaca(%rip),%xmm1
divsd  %xmm1,%xmm0
mov    -0x50(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x48(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x48(%rbp)
mov    -0x50(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x50(%rbp)
jmp    1503 <make_lookup_sinc_grad+0x3c3>
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<make_lookup_sinc_grad>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
mov    %r8,%r14
mov    %rcx,%r15
mov    %rdx,%r13
mov    %esi,%ebp
mov    %edi,%ebx
addsd  0xe9d(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
cmp    %edi,0x2ed5(%rip)
mov    %r9,(%rsp)
jne    117c <make_lookup_sinc_grad+0x3c>
test   $0x1,%bl
je     11ac <make_lookup_sinc_grad+0x6c>
jmp    11dd <make_lookup_sinc_grad+0x9d>
mov    %ebx,0x2ec2(%rip)
test   $0x1,%bl
jne    11b4 <make_lookup_sinc_grad+0x74>
mov    $0x2,%eax
sub    %ebx,%eax
mov    %eax,%ecx
shr    $0x1f,%ecx
add    %eax,%ecx
sar    %ecx
mov    %ecx,0x2eab(%rip)
mov    %ebx,%eax
shr    $0x1f,%eax
add    %ebx,%eax
sar    %eax
mov    %eax,0x2ea0(%rip)
movsd  0x8(%rsp),%xmm0
jmp    11eb <make_lookup_sinc_grad+0xab>
lea    -0x1(%rbx),%eax
mov    $0x1,%ecx
sub    %ebx,%ecx
mov    %ecx,%edx
shr    $0x1f,%edx
add    %ecx,%edx
sar    %edx
mov    %edx,0x2e7b(%rip)
shr    $0x1f,%eax
add    %ebx,%eax
add    $0xffffffff,%eax
sar    %eax
mov    %eax,0x2e6f(%rip)
movsd  0xe23(%rip),%xmm0
addsd  0x8(%rsp),%xmm0
call   1060 <floor@plt>
xor    %ecx,%ecx
mov    0x2e4f(%rip),%r12d
add    %eax,%r12d
cmovs  %ecx,%r12d
mov    %r12d,0x0(%r13)
add    0x2e42(%rip),%eax
lea    -0x1(%rbp),%ecx
cmp    %ebp,%eax
cmovl  %eax,%ecx
mov    %ecx,%edx
sub    %r12d,%edx
movslq %edx,%rax
lea    (%r15,%rax,8),%r13
mov    (%rsp),%rsi
mov    %r13,(%rsi)
test   %eax,%eax
js     145d <make_lookup_sinc_grad+0x31d>
mov    %edx,0x20(%rsp)
mov    %ecx,0x24(%rsp)
xorps  %xmm0,%xmm0
cvtsi2sd %ebx,%xmm0
movsd  %xmm0,0x28(%rsp)
xorpd  %xmm5,%xmm5
xor    %ebp,%ebp
xorpd  %xmm7,%xmm7
mov    %r12d,%ebx
jmp    1294 <make_lookup_sinc_grad+0x154>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movapd 0x30(%rsp),%xmm7
addsd  0x10(%rsp),%xmm7
movsd  %xmm0,(%r14,%rbp,1)
movapd 0x40(%rsp),%xmm5
addsd  %xmm0,%xmm5
lea    (%r15,%rbp,1),%rax
add    $0x8,%rax
add    $0x8,%rbp
add    $0x1,%ebx
cmp    %r13,%rax
ja     13aa <make_lookup_sinc_grad+0x26a>
movapd %xmm7,0x30(%rsp)
movapd %xmm5,0x40(%rsp)
xorps  %xmm1,%xmm1
cvtsi2sd %ebx,%xmm1
movsd  0x8(%rsp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,(%rsp)
call   1030 <fabs@plt>
movsd  0xd4d(%rip),%xmm0
test   %eax,%eax
jle    131e <make_lookup_sinc_grad+0x1de>
movsd  (%rsp),%xmm0
mulsd  0xd44(%rip),%xmm0
movsd  %xmm0,0x10(%rsp)
call   1040 <sin@plt>
movsd  %xmm0,0x18(%rsp)
movsd  0x10(%rsp),%xmm0
addsd  %xmm0,%xmm0
divsd  0x28(%rsp),%xmm0
cvttsd2si %xmm0,%edi
call   1050 <cos@plt>
movsd  0x18(%rsp),%xmm1
divsd  0x10(%rsp),%xmm1
mulsd  0xcf6(%rip),%xmm1
addsd  0xcf6(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  %xmm0,(%r15,%rbp,1)
movsd  (%rsp),%xmm0
addsd  0xce9(%rip),%xmm0
movsd  %xmm0,(%rsp)
call   1030 <fabs@plt>
movsd  0xcc7(%rip),%xmm0
test   %eax,%eax
jle    1260 <make_lookup_sinc_grad+0x120>
movsd  (%rsp),%xmm0
mulsd  0xcba(%rip),%xmm0
movsd  %xmm0,(%rsp)
call   1040 <sin@plt>
movsd  %xmm0,0x18(%rsp)
movsd  (%rsp),%xmm0
addsd  %xmm0,%xmm0
divsd  0x28(%rsp),%xmm0
cvttsd2si %xmm0,%edi
call   1050 <cos@plt>
movsd  0x18(%rsp),%xmm1
divsd  (%rsp),%xmm1
mulsd  0xc6f(%rip),%xmm1
addsd  0xc6f(%rip),%xmm0
mulsd  %xmm1,%xmm0
jmp    1260 <make_lookup_sinc_grad+0x120>
cmpl   $0x0,0x20(%rsp)
movsd  0xc69(%rip),%xmm6
mov    0x24(%rsp),%eax
js     145d <make_lookup_sinc_grad+0x31d>
cltq
lea    (%r15,%rax,8),%rcx
mov    %r12d,%edx
lea    0x0(,%rdx,8),%rsi
mov    %rcx,%rax
sub    %rsi,%rax
add    $0x1,%rax
lea    0x8(%r15),%rsi
cmp    %rsi,%rax
cmovbe %rsi,%rax
mov    %r15,%rdi
not    %rdi
add    %rdi,%rax
cmp    $0x8,%rax
jb     1428 <make_lookup_sinc_grad+0x2e8>
shl    $0x3,%rdx
sub    %rdx,%rcx
add    $0x1,%rcx
cmp    %rsi,%rcx
cmovbe %rsi,%rcx
add    %rdi,%rcx
and    $0xfffffffffffffff8,%rcx
lea    (%r14,%rcx,1),%rdx
add    $0x8,%rdx
cmp    %r15,%rdx
jbe    146c <make_lookup_sinc_grad+0x32c>
add    %r15,%rcx
add    $0x8,%rcx
cmp    %r14,%rcx
jbe    146c <make_lookup_sinc_grad+0x32c>
mov    %r14,%rcx
mov    %r15,%rdx
xchg   %ax,%ax
movsd  (%rdx),%xmm0
divsd  %xmm7,%xmm0
movsd  %xmm0,(%rdx)
movsd  (%rcx),%xmm1
divsd  %xmm5,%xmm1
subsd  %xmm0,%xmm1
divsd  %xmm6,%xmm1
movsd  %xmm1,(%rcx)
add    $0x8,%rdx
add    $0x8,%rcx
cmp    %r13,%rdx
jbe    1430 <make_lookup_sinc_grad+0x2f0>
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
shr    $0x3,%rax
add    $0x1,%rax
mov    %rax,%rsi
and    $0xfffffffffffffffe,%rsi
lea    (%r14,%rsi,8),%rcx
lea    (%r15,%rsi,8),%rdx
movapd %xmm7,%xmm0
unpcklpd %xmm7,%xmm0
movapd %xmm5,%xmm1
unpcklpd %xmm5,%xmm1
xor    %edi,%edi
movapd 0xb93(%rip),%xmm2
nopl   (%rax)
movupd (%r15,%rdi,8),%xmm3
divpd  %xmm0,%xmm3
movupd %xmm3,(%r15,%rdi,8)
movupd (%r14,%rdi,8),%xmm4
divpd  %xmm1,%xmm4
subpd  %xmm3,%xmm4
divpd  %xmm2,%xmm4
movupd %xmm4,(%r14,%rdi,8)
add    $0x2,%rdi
cmp    %rdi,%rsi
jne    14a0 <make_lookup_sinc_grad+0x360>
cmp    %rsi,%rax
jne    1430 <make_lookup_sinc_grad+0x2f0>
jmp    145d <make_lookup_sinc_grad+0x31d>

LLVM IR (-O0):
@make_lookup_sinc_grad.oq = internal global i32 0
@make_lookup_sinc_grad.k0 = internal global i32 0
@make_lookup_sinc_grad.k1 = internal global i32 0
define void @make_lookup_sinc_grad(double %0, i32 %1, i32 %2, i32* %3, double* %4, double* %5, double** %6) {
%8 = alloca double
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32*
%12 = alloca double*
%13 = alloca double*
%14 = alloca double**
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca double*
%19 = alloca double*
%20 = alloca double*
%21 = alloca double
%22 = alloca double
%23 = alloca double
%24 = alloca double
%25 = alloca double
%26 = alloca double
store double %0, double* %8
store i32 %1, i32* %9
store i32 %2, i32* %10
store i32* %3, i32** %11
store double* %4, double** %12
store double* %5, double** %13
store double** %6, double*** %14
%27 = load double, double* %8
%28 = fadd double %27, -1.000000e+00
store double %28, double* %8
%29 = load i32, i32* %9
%30 = load i32, i32* @make_lookup_sinc_grad.oq
%31 = icmp ne i32 %29, %30
br i1 %31, label %32, label %53
32: ; preds = %7
%33 = load i32, i32* %9
store i32 %33, i32* @make_lookup_sinc_grad.oq
%34 = load i32, i32* %9
%35 = srem i32 %34, 2
%36 = icmp ne i32 %35, 0
br i1 %36, label %37, label %45
37: ; preds = %32
%38 = load i32, i32* %9
%39 = sub nsw i32 %38, 1
%40 = sub nsw i32 0, %39
%41 = sdiv i32 %40, 2
store i32 %41, i32* @make_lookup_sinc_grad.k0
%42 = load i32, i32* %9
%43 = sub nsw i32 %42, 1
%44 = sdiv i32 %43, 2
store i32 %44, i32* @make_lookup_sinc_grad.k1
br label %52
45: ; preds = %32
%46 = load i32, i32* %9
%47 = sub nsw i32 %46, 2
%48 = sub nsw i32 0, %47
%49 = sdiv i32 %48, 2
store i32 %49, i32* @make_lookup_sinc_grad.k0
%50 = load i32, i32* %9
%51 = sdiv i32 %50, 2
store i32 %51, i32* @make_lookup_sinc_grad.k1
br label %52
52: ; preds = %45, %37
br label %53
53: ; preds = %52, %7
%54 = load i32, i32* %9
%55 = srem i32 %54, 2
%56 = icmp ne i32 %55, 0
br i1 %56, label %57, label %60
57: ; preds = %53
%58 = load double, double* %8
%59 = fadd double %58, 5.000000e-01
br label %62
60: ; preds = %53
%61 = load double, double* %8
br label %62
62: ; preds = %60, %57
%63 = phi double [ %59, %57 ], [ %61, %60 ]
%64 = call i32 @floor(double %63)
store i32 %64, i32* %17
%65 = load i32, i32* %17
%66 = load i32, i32* @make_lookup_sinc_grad.k0
%67 = add nsw i32 %65, %66
%68 = load i32*, i32** %11
store i32 %67, i32* %68
%69 = load i32*, i32** %11
%70 = load i32, i32* %69
%71 = icmp slt i32 %70, 0
br i1 %71, label %72, label %74
72: ; preds = %62
%73 = load i32*, i32** %11
store i32 0, i32* %73
br label %74
74: ; preds = %72, %62
%75 = load i32, i32* %17
%76 = load i32, i32* @make_lookup_sinc_grad.k1
%77 = add nsw i32 %75, %76
store i32 %77, i32* %15
%78 = load i32, i32* %15
%79 = load i32, i32* %10
%80 = icmp sge i32 %78, %79
br i1 %80, label %81, label %84
81: ; preds = %74
%82 = load i32, i32* %10
%83 = sub nsw i32 %82, 1
store i32 %83, i32* %15
br label %84
84: ; preds = %81, %74
%85 = load double*, double** %12
%86 = load i32, i32* %15
%87 = load i32*, i32** %11
%88 = load i32, i32* %87
%89 = sub nsw i32 %86, %88
%90 = sext i32 %89 to i64
%91 = getelementptr inbounds double, double* %85, i64 %90
store double* %91, double** %20
%92 = load double**, double*** %14
store double* %91, double** %92
%93 = load i32*, i32** %11
%94 = load i32, i32* %93
store i32 %94, i32* %16
%95 = load double*, double** %12
store double* %95, double** %18
%96 = load double*, double** %13
store double* %96, double** %19
store double 0.000000e+00, double* %26
store double 0.000000e+00, double* %25
br label %97
97: ; preds = %177, %84
%98 = load double*, double** %18
%99 = load double*, double** %20
%100 = icmp ule double* %98, %99
br i1 %100, label %101, label %178
101: ; preds = %97
%102 = load double, double* %8
%103 = load i32, i32* %16
%104 = sitofp i32 %103 to double
%105 = fsub double %102, %104
store double %105, double* %21
%106 = load double, double* %21
%107 = call i32 @fabs(double %106)
%108 = sitofp i32 %107 to double
%109 = fcmp ogt double %108, 0x3D719799812DEA11
br i1 %109, label %110, label %133
110: ; preds = %101
%111 = load double, double* %21
%112 = fmul double 0x400921FB54442D18, %111
store double %112, double* %22
%113 = load double, double* %22
%114 = call double @sin(double %113)
store double %114, double* %23
%115 = load double, double* %22
%116 = fmul double 2.000000e+00, %115
%117 = load i32, i32* %9
%118 = sitofp i32 %117 to double
%119 = fdiv double %116, %118
%120 = fptosi double %119 to i32
%121 = call double @cos(i32 %120)
store double %121, double* %24
%122 = load double, double* %23
%123 = load double, double* %22
%124 = fdiv double %122, %123
%125 = fmul double %124, 5.000000e-01
%126 = load double, double* %24
%127 = fadd double 1.000000e+00, %126
%128 = fmul double %125, %127
%129 = load double*, double** %18
%130 = getelementptr inbounds double, double* %129, i32 1
store double* %130, double** %18
store double %128, double* %129
%131 = load double, double* %25
%132 = fadd double %131, %128
store double %132, double* %25
br label %138
133: ; preds = %101
%134 = load double*, double** %18
%135 = getelementptr inbounds double, double* %134, i32 1
store double* %135, double** %18
store double 1.000000e+00, double* %134
%136 = load double, double* %25
%137 = fadd double %136, 1.000000e+00
store double %137, double* %25
br label %138
138: ; preds = %133, %110
%139 = load double, double* %8
%140 = load i32, i32* %16
%141 = add nsw i32 %140, 1
store i32 %141, i32* %16
%142 = sitofp i32 %140 to double
%143 = fsub double %139, %142
%144 = fadd double %143, 0x3EB0C6F7A0B5ED8D
store double %144, double* %21
%145 = load double, double* %21
%146 = call i32 @fabs(double %145)
%147 = sitofp i32 %146 to double
%148 = fcmp ogt double %147, 0x3D719799812DEA11
br i1 %148, label %149, label %172
149: ; preds = %138
%150 = load double, double* %21
%151 = fmul double 0x400921FB54442D18, %150
store double %151, double* %22
%152 = load double, double* %22
%153 = call double @sin(double %152)
store double %153, double* %23
%154 = load double, double* %22
%155 = fmul double 2.000000e+00, %154
%156 = load i32, i32* %9
%157 = sitofp i32 %156 to double
%158 = fdiv double %155, %157
%159 = fptosi double %158 to i32
%160 = call double @cos(i32 %159)
store double %160, double* %24
%161 = load double, double* %23
%162 = load double, double* %22
%163 = fdiv double %161, %162
%164 = fmul double %163, 5.000000e-01
%165 = load double, double* %24
%166 = fadd double 1.000000e+00, %165
%167 = fmul double %164, %166
%168 = load double*, double** %19
%169 = getelementptr inbounds double, double* %168, i32 1
store double* %169, double** %19
store double %167, double* %168
%170 = load double, double* %26
%171 = fadd double %170, %167
store double %171, double* %26
br label %177
172: ; preds = %138
%173 = load double*, double** %19
%174 = getelementptr inbounds double, double* %173, i32 1
store double* %174, double** %19
store double 1.000000e+00, double* %173
%175 = load double, double* %26
%176 = fadd double %175, 1.000000e+00
store double %176, double* %26
br label %177
177: ; preds = %172, %149
br label %97
178: ; preds = %97
%179 = load double*, double** %12
store double* %179, double** %18
%180 = load double*, double** %13
store double* %180, double** %19
br label %181
181: ; preds = %185, %178
%182 = load double*, double** %18
%183 = load double*, double** %20
%184 = icmp ule double* %182, %183
br i1 %184, label %185, label %203
185: ; preds = %181
%186 = load double, double* %25
%187 = load double*, double** %18
%188 = load double, double* %187
%189 = fdiv double %188, %186
store double %189, double* %187
%190 = load double*, double** %19
%191 = load double, double* %190
%192 = load double, double* %26
%193 = fdiv double %191, %192
%194 = load double*, double** %18
%195 = load double, double* %194
%196 = fsub double %193, %195
%197 = fdiv double %196, 0x3EB0C6F7A0B5ED8D
%198 = load double*, double** %19
store double %197, double* %198
%199 = load double*, double** %18
%200 = getelementptr inbounds double, double* %199, i32 1
store double* %200, double** %18
%201 = load double*, double** %19
%202 = getelementptr inbounds double, double* %201, i32 1
store double* %202, double** %19
br label %181
203: ; preds = %181
ret void
}

LLVM IR (-O2):
@make_lookup_sinc_grad.oq = internal unnamed_addr global i32 0
@make_lookup_sinc_grad.k0 = internal unnamed_addr global i32 0
@make_lookup_sinc_grad.k1 = internal unnamed_addr global i32 0
define void @make_lookup_sinc_grad(double %0, i32 %1, i32 %2, i32* nocapture %3, double* %4, double* nocapture %5, double** nocapture writeonly %6) {
%8 = ptrtoint double* %4 to i64
%9 = fadd double %0, -1.000000e+00
%10 = load i32, i32* @make_lookup_sinc_grad.oq
%11 = icmp eq i32 %10, %1
br i1 %11, label %25, label %12
12: ; preds = %7
store i32 %1, i32* @make_lookup_sinc_grad.oq
%13 = and i32 %1, 1
%14 = icmp eq i32 %13, 0
br i1 %14, label %21, label %15
15: ; preds = %12
%16 = add nsw i32 %1, -1
%17 = sub i32 1, %1
%18 = sdiv i32 %17, 2
store i32 %18, i32* @make_lookup_sinc_grad.k0
%19 = sdiv i32 %16, 2
store i32 %19, i32* @make_lookup_sinc_grad.k1
%20 = fadd double %9, 5.000000e-01
br label %30
21: ; preds = %12
%22 = sub i32 2, %1
%23 = sdiv i32 %22, 2
store i32 %23, i32* @make_lookup_sinc_grad.k0
%24 = sdiv i32 %1, 2
store i32 %24, i32* @make_lookup_sinc_grad.k1
br label %29
25: ; preds = %7
%26 = and i32 %1, 1
%27 = icmp eq i32 %26, 0
%28 = fadd double %9, 5.000000e-01
br i1 %27, label %29, label %30
29: ; preds = %21, %25
br label %30
30: ; preds = %15, %25, %29
%31 = phi double [ %9, %29 ], [ %28, %25 ], [ %20, %15 ]
%32 = tail call i32 @floor(double %31)
%33 = load i32, i32* @make_lookup_sinc_grad.k0
%34 = add nsw i32 %33, %32
%35 = icmp sgt i32 %34, 0
%36 = select i1 %35, i32 %34, i32 0
store i32 %36, i32* %3
%37 = load i32, i32* @make_lookup_sinc_grad.k1
%38 = add nsw i32 %37, %32
%39 = icmp slt i32 %38, %2
%40 = add nsw i32 %2, -1
%41 = select i1 %39, i32 %38, i32 %40
%42 = sub nsw i32 %41, %36
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds double, double* %4, i64 %43
store double* %44, double** %6
%45 = icmp slt i32 %42, 0
br i1 %45, label %169, label %46
46: ; preds = %30
%47 = sitofp i32 %1 to double
br label %112
48: ; preds = %152
br i1 %45, label %169, label %49
49: ; preds = %48
%50 = sext i32 %41 to i64
%51 = shl nsw i64 %50, 3
%52 = add i64 %51, %8
%53 = add i64 %52, 1
%54 = zext i32 %36 to i64
%55 = mul nsw i64 %54, -8
%56 = add i64 %55, %53
%57 = add i64 %8, 8
%58 = call i64 @llvm.umax.i64(i64 %56, i64 %57)
%59 = xor i64 %8, -1
%60 = add i64 %58, %59
%61 = lshr i64 %60, 3
%62 = add nuw nsw i64 %61, 1
%63 = icmp ult i64 %60, 8
br i1 %63, label %109, label %64
64: ; preds = %49
%65 = sext i32 %41 to i64
%66 = shl nsw i64 %65, 3
%67 = add i64 %66, %8
%68 = add i64 %67, 1
%69 = zext i32 %36 to i64
%70 = mul nsw i64 %69, -8
%71 = add i64 %70, %68
%72 = add i64 %8, 8
%73 = call i64 @llvm.umax.i64(i64 %71, i64 %72)
%74 = xor i64 %8, -1
%75 = add i64 %73, %74
%76 = lshr i64 %75, 3
%77 = add nuw nsw i64 %76, 1
%78 = getelementptr double, double* %4, i64 %77
%79 = getelementptr double, double* %5, i64 %77
%80 = icmp ugt double* %79, %4
%81 = icmp ugt double* %78, %5
%82 = and i1 %80, %81
br i1 %82, label %109, label %83
83: ; preds = %64
%84 = and i64 %62, 4611686018427387902
%85 = getelementptr double, double* %5, i64 %84
%86 = getelementptr double, double* %4, i64 %84
%87 = insertelement <2 x double> poison, double %136, i64 0
%88 = shufflevector <2 x double> %87, <2 x double> poison, <2 x i32> zeroinitializer
%89 = insertelement <2 x double> poison, double %155, i64 0
%90 = shufflevector <2 x double> %89, <2 x double> poison, <2 x i32> zeroinitializer
br label %91
91: ; preds = %91, %83
%92 = phi i64 [ 0, %83 ], [ %105, %91 ]
%93 = getelementptr double, double* %5, i64 %92
%94 = getelementptr double, double* %4, i64 %92
%95 = bitcast double* %94 to <2 x double>*
%96 = load <2 x double>, <2 x double>* %95
%97 = fdiv <2 x double> %96, %88
%98 = bitcast double* %94 to <2 x double>*
store <2 x double> %97, <2 x double>* %98
%99 = bitcast double* %93 to <2 x double>*
%100 = load <2 x double>, <2 x double>* %99
%101 = fdiv <2 x double> %100, %90
%102 = fsub <2 x double> %101, %97
%103 = fdiv <2 x double> %102, <double 0x3EB0C6F7A0B5ED8D, double 0x3EB0C6F7A0B5ED8D>
%104 = bitcast double* %93 to <2 x double>*
store <2 x double> %103, <2 x double>* %104
%105 = add nuw i64 %92, 2
%106 = icmp eq i64 %105, %84
br i1 %106, label %107, label %91
107: ; preds = %91
%108 = icmp eq i64 %62, %84
br i1 %108, label %169, label %109
109: ; preds = %64, %49, %107
%110 = phi double* [ %5, %64 ], [ %5, %49 ], [ %85, %107 ]
%111 = phi double* [ %4, %64 ], [ %4, %49 ], [ %86, %107 ]
br label %157
112: ; preds = %46, %152
%113 = phi double [ 0.000000e+00, %46 ], [ %155, %152 ]
%114 = phi double [ 0.000000e+00, %46 ], [ %136, %152 ]
%115 = phi double* [ %5, %46 ], [ %154, %152 ]
%116 = phi double* [ %4, %46 ], [ %135, %152 ]
%117 = phi i32 [ %36, %46 ], [ %137, %152 ]
%118 = sitofp i32 %117 to double
%119 = fsub double %9, %118
%120 = tail call i32 @fabs(double %119)
%121 = icmp sgt i32 %120, 0
br i1 %121, label %122, label %133
122: ; preds = %112
%123 = fmul double %119, 0x400921FB54442D18
%124 = tail call double @sin(double %123)
%125 = fmul double %123, 2.000000e+00
%126 = fdiv double %125, %47
%127 = fptosi double %126 to i32
%128 = tail call double @cos(i32 %127)
%129 = fdiv double %124, %123
%130 = fmul double %129, 5.000000e-01
%131 = fadd double %128, 1.000000e+00
%132 = fmul double %130, %131
br label %133
133: ; preds = %112, %122
%134 = phi double [ %132, %122 ], [ 1.000000e+00, %112 ]
store double %134, double* %116
%135 = getelementptr inbounds double, double* %116, i64 1
%136 = fadd double %114, %134
%137 = add nuw nsw i32 %117, 1
%138 = fadd double %119, 0x3EB0C6F7A0B5ED8D
%139 = tail call i32 @fabs(double %138)
%140 = icmp sgt i32 %139, 0
br i1 %140, label %141, label %152
141: ; preds = %133
%142 = fmul double %138, 0x400921FB54442D18
%143 = tail call double @sin(double %142)
%144 = fmul double %142, 2.000000e+00
%145 = fdiv double %144, %47
%146 = fptosi double %145 to i32
%147 = tail call double @cos(i32 %146)
%148 = fdiv double %143, %142
%149 = fmul double %148, 5.000000e-01
%150 = fadd double %147, 1.000000e+00
%151 = fmul double %149, %150
br label %152
152: ; preds = %133, %141
%153 = phi double [ %151, %141 ], [ 1.000000e+00, %133 ]
store double %153, double* %115
%154 = getelementptr inbounds double, double* %115, i64 1
%155 = fadd double %113, %153
%156 = icmp ugt double* %135, %44
br i1 %156, label %48, label %112
157: ; preds = %109, %157
%158 = phi double* [ %167, %157 ], [ %110, %109 ]
%159 = phi double* [ %166, %157 ], [ %111, %109 ]
%160 = load double, double* %159
%161 = fdiv double %160, %136
store double %161, double* %159
%162 = load double, double* %158
%163 = fdiv double %162, %155
%164 = fsub double %163, %161
%165 = fdiv double %164, 0x3EB0C6F7A0B5ED8D
store double %165, double* %158
%166 = getelementptr inbounds double, double* %159, i64 1
%167 = getelementptr inbounds double, double* %158, i64 1
%168 = icmp ugt double* %166, %44
br i1 %168, label %169, label %157
169: ; preds = %157, %107, %30, %48
ret void
}