#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 bicubic_interpolation_cell(double **, float const, float const);
int neumann_bc(int, int const, int *);
int periodic_bc(int, int const, int *);
int symmetric_bc(int, int const, int *);
float bicubic_interpolation_at(const float *input, const float uu,
                               const float vv, const int nx, const int ny,
                               bool border_out) {
  const int sx = (uu < 0) ? -1 : 1;
  const int sy = (vv < 0) ? -1 : 1;
  int x, y, mx, my, dx, dy, ddx, ddy;
  bool out[1] = {false};
  switch (0) {
  case 0:
    x = neumann_bc((int)uu, nx, out);
    y = neumann_bc((int)vv, ny, out);
    mx = neumann_bc((int)uu - sx, nx, out);
    my = neumann_bc((int)vv - sx, ny, out);
    dx = neumann_bc((int)uu + sx, nx, out);
    dy = neumann_bc((int)vv + sy, ny, out);
    ddx = neumann_bc((int)uu + 2 * sx, nx, out);
    ddy = neumann_bc((int)vv + 2 * sy, ny, out);
    break;
  case 1:
    x = periodic_bc((int)uu, nx, out);
    y = periodic_bc((int)vv, ny, out);
    mx = periodic_bc((int)uu - sx, nx, out);
    my = periodic_bc((int)vv - sx, ny, out);
    dx = periodic_bc((int)uu + sx, nx, out);
    dy = periodic_bc((int)vv + sy, ny, out);
    ddx = periodic_bc((int)uu + 2 * sx, nx, out);
    ddy = periodic_bc((int)vv + 2 * sy, ny, out);
    break;
  case 2:
    x = symmetric_bc((int)uu, nx, out);
    y = symmetric_bc((int)vv, ny, out);
    mx = symmetric_bc((int)uu - sx, nx, out);
    my = symmetric_bc((int)vv - sx, ny, out);
    dx = symmetric_bc((int)uu + sx, nx, out);
    dy = symmetric_bc((int)vv + sy, ny, out);
    ddx = symmetric_bc((int)uu + 2 * sx, nx, out);
    ddy = symmetric_bc((int)vv + 2 * sy, ny, out);
    break;
  default:
    x = neumann_bc((int)uu, nx, out);
    y = neumann_bc((int)vv, ny, out);
    mx = neumann_bc((int)uu - sx, nx, out);
    my = neumann_bc((int)vv - sx, ny, out);
    dx = neumann_bc((int)uu + sx, nx, out);
    dy = neumann_bc((int)vv + sy, ny, out);
    ddx = neumann_bc((int)uu + 2 * sx, nx, out);
    ddy = neumann_bc((int)vv + 2 * sy, ny, out);
    break;
  }
  if (*out && border_out)
    return 0.0;
  else {
    const float p11 = input[mx + nx * my];
    const float p12 = input[x + nx * my];
    const float p13 = input[dx + nx * my];
    const float p14 = input[ddx + nx * my];
    const float p21 = input[mx + nx * y];
    const float p22 = input[x + nx * y];
    const float p23 = input[dx + nx * y];
    const float p24 = input[ddx + nx * y];
    const float p31 = input[mx + nx * dy];
    const float p32 = input[x + nx * dy];
    const float p33 = input[dx + nx * dy];
    const float p34 = input[ddx + nx * dy];
    const float p41 = input[mx + nx * ddy];
    const float p42 = input[x + nx * ddy];
    const float p43 = input[dx + nx * ddy];
    const float p44 = input[ddx + nx * ddy];
    double pol[4][4] = {{p11, p21, p31, p41},
                        {p12, p22, p32, p42},
                        {p13, p23, p33, p43},
                        {p14, p24, p34, p44}};
    return bicubic_interpolation_cell(pol, uu - x, vv - y);
  }
}


x86 assembly (clang, -O0):
<bicubic_interpolation_at>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
mov    %rdi,-0x10(%rbp)
movss  %xmm0,-0x14(%rbp)
movss  %xmm1,-0x18(%rbp)
mov    %esi,-0x1c(%rbp)
mov    %edx,-0x20(%rbp)
mov    %ecx,-0x24(%rbp)
movss  -0x14(%rbp),%xmm1
xorps  %xmm0,%xmm0
mov    $0x1,%eax
mov    $0xffffffff,%ecx
ucomiss %xmm1,%xmm0
cmova  %ecx,%eax
mov    %eax,-0x28(%rbp)
movss  -0x18(%rbp),%xmm1
xorps  %xmm0,%xmm0
mov    $0x1,%eax
mov    $0xffffffff,%ecx
ucomiss %xmm1,%xmm0
cmova  %ecx,%eax
mov    %eax,-0x2c(%rbp)
lea    -0x50(%rbp),%rdi
xor    %esi,%esi
mov    $0x4,%edx
call   1040 <memset@plt>
cvttss2si -0x14(%rbp),%edi
mov    -0x1c(%rbp),%esi
lea    -0x50(%rbp),%rdx
call   1030 <neumann_bc@plt>
mov    %eax,-0x30(%rbp)
cvttss2si -0x18(%rbp),%edi
mov    -0x20(%rbp),%esi
lea    -0x50(%rbp),%rdx
call   1030 <neumann_bc@plt>
mov    %eax,-0x34(%rbp)
cvttss2si -0x14(%rbp),%edi
sub    -0x28(%rbp),%edi
mov    -0x1c(%rbp),%esi
lea    -0x50(%rbp),%rdx
call   1030 <neumann_bc@plt>
mov    %eax,-0x38(%rbp)
cvttss2si -0x18(%rbp),%edi
sub    -0x28(%rbp),%edi
mov    -0x20(%rbp),%esi
lea    -0x50(%rbp),%rdx
call   1030 <neumann_bc@plt>
mov    %eax,-0x3c(%rbp)
cvttss2si -0x14(%rbp),%edi
add    -0x28(%rbp),%edi
mov    -0x1c(%rbp),%esi
lea    -0x50(%rbp),%rdx
call   1030 <neumann_bc@plt>
mov    %eax,-0x40(%rbp)
cvttss2si -0x18(%rbp),%edi
add    -0x2c(%rbp),%edi
mov    -0x20(%rbp),%esi
lea    -0x50(%rbp),%rdx
call   1030 <neumann_bc@plt>
mov    %eax,-0x44(%rbp)
cvttss2si -0x14(%rbp),%edi
mov    -0x28(%rbp),%eax
shl    $0x1,%eax
add    %eax,%edi
mov    -0x1c(%rbp),%esi
lea    -0x50(%rbp),%rdx
call   1030 <neumann_bc@plt>
mov    %eax,-0x48(%rbp)
cvttss2si -0x18(%rbp),%edi
mov    -0x2c(%rbp),%eax
shl    $0x1,%eax
add    %eax,%edi
mov    -0x20(%rbp),%esi
lea    -0x50(%rbp),%rdx
call   1030 <neumann_bc@plt>
mov    %eax,-0x4c(%rbp)
cmpl   $0x0,-0x50(%rbp)
je     1275 <bicubic_interpolation_at+0x145>
cmpl   $0x0,-0x24(%rbp)
je     1275 <bicubic_interpolation_at+0x145>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    159a <bicubic_interpolation_at+0x46a>
mov    -0x10(%rbp),%rax
mov    -0x38(%rbp),%ecx
mov    -0x1c(%rbp),%edx
imul   -0x3c(%rbp),%edx
add    %edx,%ecx
movslq %ecx,%rcx
movss  (%rax,%rcx,4),%xmm0
movss  %xmm0,-0x54(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x30(%rbp),%ecx
mov    -0x1c(%rbp),%edx
imul   -0x3c(%rbp),%edx
add    %edx,%ecx
movslq %ecx,%rcx
movss  (%rax,%rcx,4),%xmm0
movss  %xmm0,-0x58(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x40(%rbp),%ecx
mov    -0x1c(%rbp),%edx
imul   -0x3c(%rbp),%edx
add    %edx,%ecx
movslq %ecx,%rcx
movss  (%rax,%rcx,4),%xmm0
movss  %xmm0,-0x5c(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x48(%rbp),%ecx
mov    -0x1c(%rbp),%edx
imul   -0x3c(%rbp),%edx
add    %edx,%ecx
movslq %ecx,%rcx
movss  (%rax,%rcx,4),%xmm0
movss  %xmm0,-0x60(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x38(%rbp),%ecx
mov    -0x1c(%rbp),%edx
imul   -0x34(%rbp),%edx
add    %edx,%ecx
movslq %ecx,%rcx
movss  (%rax,%rcx,4),%xmm0
movss  %xmm0,-0x64(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x30(%rbp),%ecx
mov    -0x1c(%rbp),%edx
imul   -0x34(%rbp),%edx
add    %edx,%ecx
movslq %ecx,%rcx
movss  (%rax,%rcx,4),%xmm0
movss  %xmm0,-0x68(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x40(%rbp),%ecx
mov    -0x1c(%rbp),%edx
imul   -0x34(%rbp),%edx
add    %edx,%ecx
movslq %ecx,%rcx
movss  (%rax,%rcx,4),%xmm0
movss  %xmm0,-0x6c(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x48(%rbp),%ecx
mov    -0x1c(%rbp),%edx
imul   -0x34(%rbp),%edx
add    %edx,%ecx
movslq %ecx,%rcx
movss  (%rax,%rcx,4),%xmm0
movss  %xmm0,-0x70(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x38(%rbp),%ecx
mov    -0x1c(%rbp),%edx
imul   -0x44(%rbp),%edx
add    %edx,%ecx
movslq %ecx,%rcx
movss  (%rax,%rcx,4),%xmm0
movss  %xmm0,-0x74(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x30(%rbp),%ecx
mov    -0x1c(%rbp),%edx
imul   -0x44(%rbp),%edx
add    %edx,%ecx
movslq %ecx,%rcx
movss  (%rax,%rcx,4),%xmm0
movss  %xmm0,-0x78(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x40(%rbp),%ecx
mov    -0x1c(%rbp),%edx
imul   -0x44(%rbp),%edx
add    %edx,%ecx
movslq %ecx,%rcx
movss  (%rax,%rcx,4),%xmm0
movss  %xmm0,-0x7c(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x48(%rbp),%ecx
mov    -0x1c(%rbp),%edx
imul   -0x44(%rbp),%edx
add    %edx,%ecx
movslq %ecx,%rcx
movss  (%rax,%rcx,4),%xmm0
movss  %xmm0,-0x80(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x38(%rbp),%ecx
mov    -0x1c(%rbp),%edx
imul   -0x4c(%rbp),%edx
add    %edx,%ecx
movslq %ecx,%rcx
movss  (%rax,%rcx,4),%xmm0
movss  %xmm0,-0x84(%rbp)
ff
mov    -0x10(%rbp),%rax
mov    -0x30(%rbp),%ecx
mov    -0x1c(%rbp),%edx
imul   -0x4c(%rbp),%edx
add    %edx,%ecx
movslq %ecx,%rcx
movss  (%rax,%rcx,4),%xmm0
movss  %xmm0,-0x88(%rbp)
ff
mov    -0x10(%rbp),%rax
mov    -0x40(%rbp),%ecx
mov    -0x1c(%rbp),%edx
imul   -0x4c(%rbp),%edx
add    %edx,%ecx
movslq %ecx,%rcx
movss  (%rax,%rcx,4),%xmm0
movss  %xmm0,-0x8c(%rbp)
ff
mov    -0x10(%rbp),%rax
mov    -0x48(%rbp),%ecx
mov    -0x1c(%rbp),%edx
imul   -0x4c(%rbp),%edx
add    %edx,%ecx
movslq %ecx,%rcx
movss  (%rax,%rcx,4),%xmm0
movss  %xmm0,-0x90(%rbp)
ff
movss  -0x54(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x110(%rbp)
ff
movss  -0x64(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x108(%rbp)
ff
movss  -0x74(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x100(%rbp)
ff
movss  -0x84(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0xf8(%rbp)
ff
movss  -0x58(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0xf0(%rbp)
ff
movss  -0x68(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0xe8(%rbp)
ff
movss  -0x78(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0xe0(%rbp)
ff
movss  -0x88(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0xd8(%rbp)
ff
movss  -0x5c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0xd0(%rbp)
ff
movss  -0x6c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0xc8(%rbp)
movss  -0x7c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0xc0(%rbp)
ff
movss  -0x8c(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0xb8(%rbp)
ff
movss  -0x60(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0xb0(%rbp)
ff
movss  -0x70(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
movss  -0x80(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
movss  -0x90(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
lea    -0x110(%rbp),%rdi
movss  -0x14(%rbp),%xmm0
cvtsi2ssl -0x30(%rbp),%xmm1
subss  %xmm1,%xmm0
movss  -0x18(%rbp),%xmm1
cvtsi2ssl -0x34(%rbp),%xmm2
subss  %xmm2,%xmm1
call   1050 <bicubic_interpolation_cell@plt>
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x110,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bicubic_interpolation_at>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xf8,%rsp
xorps  %xmm2,%xmm2
xor    %ebx,%ebx
ucomiss %xmm0,%xmm2
setbe  %bl
mov    %ecx,0x14(%rsp)
mov    %edx,%r13d
movss  %xmm1,0x24(%rsp)
mov    %rdi,0x58(%rsp)
mov    %ebx,%eax
add    %eax,%eax
mov    %rax,0x28(%rsp)
lea    (%rbx,%rbx,1),%eax
add    $0xffffffff,%eax
mov    %eax,0x18(%rsp)
xor    %r12d,%r12d
ucomiss %xmm1,%xmm2
setbe  %r12b
lea    (%r12,%r12,1),%eax
mov    %rax,0x30(%rsp)
movl   $0x0,0xc(%rsp)
movss  %xmm0,0x3c(%rsp)
cvttss2si %xmm0,%edi
lea    0xc(%rsp),%r14
mov    %rdi,%rbp
mov    %esi,%r15d
mov    %esi,0x10(%rsp)
mov    %r14,%rdx
call   1030 <neumann_bc@plt>
mov    %rax,0x50(%rsp)
cvttss2si 0x24(%rsp),%edi
mov    %rdi,0x60(%rsp)
mov    %r13d,%esi
mov    %r14,%rdx
call   1030 <neumann_bc@plt>
mov    %eax,0x20(%rsp)
mov    %ebp,%edi
mov    %rbp,0x68(%rsp)
mov    0x18(%rsp),%r14d
sub    %r14d,%edi
mov    %r15d,%esi
lea    0xc(%rsp),%rdx
call   1030 <neumann_bc@plt>
mov    %rax,0x48(%rsp)
mov    0x60(%rsp),%r15
mov    %r15d,%edi
sub    %r14d,%edi
mov    %r13d,%esi
lea    0xc(%rsp),%r14
mov    %r14,%rdx
call   1030 <neumann_bc@plt>
mov    %rax,0x18(%rsp)
lea    -0x1(%rbp,%rbx,2),%edi
mov    0x10(%rsp),%ebx
mov    %ebx,%esi
mov    %r14,%rdx
mov    %r14,%rbp
call   1030 <neumann_bc@plt>
mov    %rax,0x40(%rsp)
lea    (%r15,%r12,2),%edi
add    $0xffffffff,%edi
mov    %r13d,%r14d
mov    %r13d,%esi
mov    %rbp,%rdx
call   1030 <neumann_bc@plt>
mov    %eax,%r13d
mov    0x28(%rsp),%rax
mov    0x68(%rsp),%rcx
lea    (%rcx,%rax,2),%edi
add    $0xfffffffe,%edi
mov    %ebx,%r12d
mov    %ebx,%esi
mov    %rbp,%rdx
call   1030 <neumann_bc@plt>
mov    %eax,%ebx
mov    0x30(%rsp),%rax
lea    (%r15,%rax,2),%edi
add    $0xfffffffe,%edi
mov    %r14d,%esi
mov    %rbp,%rdx
call   1030 <neumann_bc@plt>
xorps  %xmm0,%xmm0
mov    %eax,%r9d
cmpl   $0x0,0x14(%rsp)
je     127d <bicubic_interpolation_at+0x15d>
cmpl   $0x0,0xc(%rsp)
jne    1446 <bicubic_interpolation_at+0x326>
mov    0x18(%rsp),%r11
imul   %r12d,%r11d
mov    0x48(%rsp),%rax
lea    (%r11,%rax,1),%ecx
mov    %ecx,0x28(%rsp)
mov    0x50(%rsp),%r8
lea    (%r11,%r8,1),%ecx
mov    %ecx,0x30(%rsp)
mov    0x40(%rsp),%r14
lea    (%r14,%r11,1),%ecx
mov    %ecx,0x14(%rsp)
add    %ebx,%r11d
mov    0x20(%rsp),%ecx
mov    %ecx,%edx
imul   %r12d,%edx
lea    (%rax,%rdx,1),%esi
imul   %r12d,%r13d
imul   %r12d,%r9d
lea    (%rdx,%r8,1),%r10d
lea    (%r14,%rdx,1),%ecx
mov    %ecx,0x10(%rsp)
add    %ebx,%edx
lea    (%rax,%r13,1),%ecx
mov    %ebx,%r12d
lea    (%r8,%r13,1),%r15d
lea    (%r14,%r13,1),%ebx
mov    %ebx,0x18(%rsp)
add    %r12d,%r13d
add    %r9d,%eax
add    %r9d,%r14d
lea    (%r9,%r8,1),%ebx
add    %r12d,%r9d
movslq %esi,%rsi
mov    0x58(%rsp),%rbp
movss  0x0(%rbp,%rsi,4),%xmm14
movslq 0x28(%rsp),%rsi
movss  0x0(%rbp,%rsi,4),%xmm0
movslq %eax,%rsi
movss  0x0(%rbp,%rsi,4),%xmm8
movslq %ecx,%rsi
movss  0x0(%rbp,%rsi,4),%xmm1
movslq %r10d,%rcx
movss  0x0(%rbp,%rcx,4),%xmm9
movslq 0x30(%rsp),%rcx
movss  0x0(%rbp,%rcx,4),%xmm2
movslq %ebx,%rcx
movss  0x0(%rbp,%rcx,4),%xmm10
movslq %r15d,%rcx
movss  0x0(%rbp,%rcx,4),%xmm4
movslq 0x10(%rsp),%rcx
movss  0x0(%rbp,%rcx,4),%xmm11
movslq 0x14(%rsp),%rcx
movss  0x0(%rbp,%rcx,4),%xmm6
movslq %r14d,%rcx
movss  0x0(%rbp,%rcx,4),%xmm12
movslq 0x18(%rsp),%rcx
movss  0x0(%rbp,%rcx,4),%xmm3
movslq %edx,%rcx
movss  0x0(%rbp,%rcx,4),%xmm13
movslq %r11d,%rcx
movss  0x0(%rbp,%rcx,4),%xmm7
movslq %r9d,%rax
movss  0x0(%rbp,%rax,4),%xmm15
movslq %r13d,%rax
movss  0x0(%rbp,%rax,4),%xmm5
unpcklps %xmm14,%xmm0
xorps  %xmm14,%xmm14
cvtsi2ss %r8d,%xmm14
unpcklps %xmm8,%xmm1
xorps  %xmm8,%xmm8
cvtsi2ssl 0x20(%rsp),%xmm8
unpcklps %xmm9,%xmm2
unpcklps %xmm10,%xmm4
unpcklps %xmm11,%xmm6
unpcklps %xmm12,%xmm3
unpcklps %xmm13,%xmm7
unpcklps %xmm15,%xmm5
cvtps2pd %xmm0,%xmm0
movaps %xmm0,0x70(%rsp)
cvtps2pd %xmm1,%xmm0
movaps %xmm0,0x80(%rsp)
cvtps2pd %xmm2,%xmm0
cvtps2pd %xmm4,%xmm1
movaps %xmm0,0x90(%rsp)
movaps %xmm1,0xa0(%rsp)
cvtps2pd %xmm6,%xmm0
movaps %xmm0,0xb0(%rsp)
cvtps2pd %xmm3,%xmm0
movaps %xmm0,0xc0(%rsp)
cvtps2pd %xmm7,%xmm0
cvtps2pd %xmm5,%xmm1
movaps %xmm0,0xd0(%rsp)
movaps %xmm1,0xe0(%rsp)
movss  0x3c(%rsp),%xmm0
subss  %xmm14,%xmm0
movss  0x24(%rsp),%xmm1
subss  %xmm8,%xmm1
lea    0x70(%rsp),%rdi
call   1040 <bicubic_interpolation_cell@plt>
add    $0xf8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define float @bicubic_interpolation_at(float* %0, float %1, float %2, i32 %3, i32 %4, i32 %5) {
%7 = alloca float
%8 = alloca float*
%9 = alloca float
%10 = alloca float
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
%21 = alloca i32
%22 = alloca i32
%23 = alloca i32
%24 = alloca [1 x i32]
%25 = alloca float
%26 = alloca float
%27 = alloca float
%28 = alloca float
%29 = alloca float
%30 = alloca float
%31 = alloca float
%32 = alloca float
%33 = alloca float
%34 = alloca float
%35 = alloca float
%36 = alloca float
%37 = alloca float
%38 = alloca float
%39 = alloca float
%40 = alloca float
%41 = alloca [4 x [4 x double]]
store float* %0, float** %8
store float %1, float* %9
store float %2, float* %10
store i32 %3, i32* %11
store i32 %4, i32* %12
store i32 %5, i32* %13
%42 = load float, float* %9
%43 = fcmp olt float %42, 0.000000e+00
%44 = zext i1 %43 to i64
%45 = select i1 %43, i32 -1, i32 1
store i32 %45, i32* %14
%46 = load float, float* %10
%47 = fcmp olt float %46, 0.000000e+00
%48 = zext i1 %47 to i64
%49 = select i1 %47, i32 -1, i32 1
store i32 %49, i32* %15
%50 = bitcast [1 x i32]* %24 to i8*
%51 = load float, float* %9
%52 = fptosi float %51 to i32
%53 = load i32, i32* %11
%54 = getelementptr inbounds [1 x i32], [1 x i32]* %24, i64 0, i64 0
%55 = call i32 @neumann_bc(i32 %52, i32 %53, i32* %54)
store i32 %55, i32* %16
%56 = load float, float* %10
%57 = fptosi float %56 to i32
%58 = load i32, i32* %12
%59 = getelementptr inbounds [1 x i32], [1 x i32]* %24, i64 0, i64 0
%60 = call i32 @neumann_bc(i32 %57, i32 %58, i32* %59)
store i32 %60, i32* %17
%61 = load float, float* %9
%62 = fptosi float %61 to i32
%63 = load i32, i32* %14
%64 = sub nsw i32 %62, %63
%65 = load i32, i32* %11
%66 = getelementptr inbounds [1 x i32], [1 x i32]* %24, i64 0, i64 0
%67 = call i32 @neumann_bc(i32 %64, i32 %65, i32* %66)
store i32 %67, i32* %18
%68 = load float, float* %10
%69 = fptosi float %68 to i32
%70 = load i32, i32* %14
%71 = sub nsw i32 %69, %70
%72 = load i32, i32* %12
%73 = getelementptr inbounds [1 x i32], [1 x i32]* %24, i64 0, i64 0
%74 = call i32 @neumann_bc(i32 %71, i32 %72, i32* %73)
store i32 %74, i32* %19
%75 = load float, float* %9
%76 = fptosi float %75 to i32
%77 = load i32, i32* %14
%78 = add nsw i32 %76, %77
%79 = load i32, i32* %11
%80 = getelementptr inbounds [1 x i32], [1 x i32]* %24, i64 0, i64 0
%81 = call i32 @neumann_bc(i32 %78, i32 %79, i32* %80)
store i32 %81, i32* %20
%82 = load float, float* %10
%83 = fptosi float %82 to i32
%84 = load i32, i32* %15
%85 = add nsw i32 %83, %84
%86 = load i32, i32* %12
%87 = getelementptr inbounds [1 x i32], [1 x i32]* %24, i64 0, i64 0
%88 = call i32 @neumann_bc(i32 %85, i32 %86, i32* %87)
store i32 %88, i32* %21
%89 = load float, float* %9
%90 = fptosi float %89 to i32
%91 = load i32, i32* %14
%92 = mul nsw i32 2, %91
%93 = add nsw i32 %90, %92
%94 = load i32, i32* %11
%95 = getelementptr inbounds [1 x i32], [1 x i32]* %24, i64 0, i64 0
%96 = call i32 @neumann_bc(i32 %93, i32 %94, i32* %95)
store i32 %96, i32* %22
%97 = load float, float* %10
%98 = fptosi float %97 to i32
%99 = load i32, i32* %15
%100 = mul nsw i32 2, %99
%101 = add nsw i32 %98, %100
%102 = load i32, i32* %12
%103 = getelementptr inbounds [1 x i32], [1 x i32]* %24, i64 0, i64 0
%104 = call i32 @neumann_bc(i32 %101, i32 %102, i32* %103)
store i32 %104, i32* %23
%105 = getelementptr inbounds [1 x i32], [1 x i32]* %24, i64 0, i64 0
%106 = load i32, i32* %105
%107 = icmp ne i32 %106, 0
br i1 %107, label %108, label %112
108: ; preds = %6
%109 = load i32, i32* %13
%110 = icmp ne i32 %109, 0
br i1 %110, label %111, label %112
111: ; preds = %108
store float 0.000000e+00, float* %7
br label %320
112: ; preds = %108, %6
%113 = load float*, float** %8
%114 = load i32, i32* %18
%115 = load i32, i32* %11
%116 = load i32, i32* %19
%117 = mul nsw i32 %115, %116
%118 = add nsw i32 %114, %117
%119 = sext i32 %118 to i64
%120 = getelementptr inbounds float, float* %113, i64 %119
%121 = load float, float* %120
store float %121, float* %25
%122 = load float*, float** %8
%123 = load i32, i32* %16
%124 = load i32, i32* %11
%125 = load i32, i32* %19
%126 = mul nsw i32 %124, %125
%127 = add nsw i32 %123, %126
%128 = sext i32 %127 to i64
%129 = getelementptr inbounds float, float* %122, i64 %128
%130 = load float, float* %129
store float %130, float* %26
%131 = load float*, float** %8
%132 = load i32, i32* %20
%133 = load i32, i32* %11
%134 = load i32, i32* %19
%135 = mul nsw i32 %133, %134
%136 = add nsw i32 %132, %135
%137 = sext i32 %136 to i64
%138 = getelementptr inbounds float, float* %131, i64 %137
%139 = load float, float* %138
store float %139, float* %27
%140 = load float*, float** %8
%141 = load i32, i32* %22
%142 = load i32, i32* %11
%143 = load i32, i32* %19
%144 = mul nsw i32 %142, %143
%145 = add nsw i32 %141, %144
%146 = sext i32 %145 to i64
%147 = getelementptr inbounds float, float* %140, i64 %146
%148 = load float, float* %147
store float %148, float* %28
%149 = load float*, float** %8
%150 = load i32, i32* %18
%151 = load i32, i32* %11
%152 = load i32, i32* %17
%153 = mul nsw i32 %151, %152
%154 = add nsw i32 %150, %153
%155 = sext i32 %154 to i64
%156 = getelementptr inbounds float, float* %149, i64 %155
%157 = load float, float* %156
store float %157, float* %29
%158 = load float*, float** %8
%159 = load i32, i32* %16
%160 = load i32, i32* %11
%161 = load i32, i32* %17
%162 = mul nsw i32 %160, %161
%163 = add nsw i32 %159, %162
%164 = sext i32 %163 to i64
%165 = getelementptr inbounds float, float* %158, i64 %164
%166 = load float, float* %165
store float %166, float* %30
%167 = load float*, float** %8
%168 = load i32, i32* %20
%169 = load i32, i32* %11
%170 = load i32, i32* %17
%171 = mul nsw i32 %169, %170
%172 = add nsw i32 %168, %171
%173 = sext i32 %172 to i64
%174 = getelementptr inbounds float, float* %167, i64 %173
%175 = load float, float* %174
store float %175, float* %31
%176 = load float*, float** %8
%177 = load i32, i32* %22
%178 = load i32, i32* %11
%179 = load i32, i32* %17
%180 = mul nsw i32 %178, %179
%181 = add nsw i32 %177, %180
%182 = sext i32 %181 to i64
%183 = getelementptr inbounds float, float* %176, i64 %182
%184 = load float, float* %183
store float %184, float* %32
%185 = load float*, float** %8
%186 = load i32, i32* %18
%187 = load i32, i32* %11
%188 = load i32, i32* %21
%189 = mul nsw i32 %187, %188
%190 = add nsw i32 %186, %189
%191 = sext i32 %190 to i64
%192 = getelementptr inbounds float, float* %185, i64 %191
%193 = load float, float* %192
store float %193, float* %33
%194 = load float*, float** %8
%195 = load i32, i32* %16
%196 = load i32, i32* %11
%197 = load i32, i32* %21
%198 = mul nsw i32 %196, %197
%199 = add nsw i32 %195, %198
%200 = sext i32 %199 to i64
%201 = getelementptr inbounds float, float* %194, i64 %200
%202 = load float, float* %201
store float %202, float* %34
%203 = load float*, float** %8
%204 = load i32, i32* %20
%205 = load i32, i32* %11
%206 = load i32, i32* %21
%207 = mul nsw i32 %205, %206
%208 = add nsw i32 %204, %207
%209 = sext i32 %208 to i64
%210 = getelementptr inbounds float, float* %203, i64 %209
%211 = load float, float* %210
store float %211, float* %35
%212 = load float*, float** %8
%213 = load i32, i32* %22
%214 = load i32, i32* %11
%215 = load i32, i32* %21
%216 = mul nsw i32 %214, %215
%217 = add nsw i32 %213, %216
%218 = sext i32 %217 to i64
%219 = getelementptr inbounds float, float* %212, i64 %218
%220 = load float, float* %219
store float %220, float* %36
%221 = load float*, float** %8
%222 = load i32, i32* %18
%223 = load i32, i32* %11
%224 = load i32, i32* %23
%225 = mul nsw i32 %223, %224
%226 = add nsw i32 %222, %225
%227 = sext i32 %226 to i64
%228 = getelementptr inbounds float, float* %221, i64 %227
%229 = load float, float* %228
store float %229, float* %37
%230 = load float*, float** %8
%231 = load i32, i32* %16
%232 = load i32, i32* %11
%233 = load i32, i32* %23
%234 = mul nsw i32 %232, %233
%235 = add nsw i32 %231, %234
%236 = sext i32 %235 to i64
%237 = getelementptr inbounds float, float* %230, i64 %236
%238 = load float, float* %237
store float %238, float* %38
%239 = load float*, float** %8
%240 = load i32, i32* %20
%241 = load i32, i32* %11
%242 = load i32, i32* %23
%243 = mul nsw i32 %241, %242
%244 = add nsw i32 %240, %243
%245 = sext i32 %244 to i64
%246 = getelementptr inbounds float, float* %239, i64 %245
%247 = load float, float* %246
store float %247, float* %39
%248 = load float*, float** %8
%249 = load i32, i32* %22
%250 = load i32, i32* %11
%251 = load i32, i32* %23
%252 = mul nsw i32 %250, %251
%253 = add nsw i32 %249, %252
%254 = sext i32 %253 to i64
%255 = getelementptr inbounds float, float* %248, i64 %254
%256 = load float, float* %255
store float %256, float* %40
%257 = getelementptr inbounds [4 x [4 x double]], [4 x [4 x double]]* %41, i64 0, i64 0
%258 = getelementptr inbounds [4 x double], [4 x double]* %257, i64 0, i64 0
%259 = load float, float* %25
%260 = fpext float %259 to double
store double %260, double* %258
%261 = getelementptr inbounds double, double* %258, i64 1
%262 = load float, float* %29
%263 = fpext float %262 to double
store double %263, double* %261
%264 = getelementptr inbounds double, double* %261, i64 1
%265 = load float, float* %33
%266 = fpext float %265 to double
store double %266, double* %264
%267 = getelementptr inbounds double, double* %264, i64 1
%268 = load float, float* %37
%269 = fpext float %268 to double
store double %269, double* %267
%270 = getelementptr inbounds [4 x double], [4 x double]* %257, i64 1
%271 = getelementptr inbounds [4 x double], [4 x double]* %270, i64 0, i64 0
%272 = load float, float* %26
%273 = fpext float %272 to double
store double %273, double* %271
%274 = getelementptr inbounds double, double* %271, i64 1
%275 = load float, float* %30
%276 = fpext float %275 to double
store double %276, double* %274
%277 = getelementptr inbounds double, double* %274, i64 1
%278 = load float, float* %34
%279 = fpext float %278 to double
store double %279, double* %277
%280 = getelementptr inbounds double, double* %277, i64 1
%281 = load float, float* %38
%282 = fpext float %281 to double
store double %282, double* %280
%283 = getelementptr inbounds [4 x double], [4 x double]* %270, i64 1
%284 = getelementptr inbounds [4 x double], [4 x double]* %283, i64 0, i64 0
%285 = load float, float* %27
%286 = fpext float %285 to double
store double %286, double* %284
%287 = getelementptr inbounds double, double* %284, i64 1
%288 = load float, float* %31
%289 = fpext float %288 to double
store double %289, double* %287
%290 = getelementptr inbounds double, double* %287, i64 1
%291 = load float, float* %35
%292 = fpext float %291 to double
store double %292, double* %290
%293 = getelementptr inbounds double, double* %290, i64 1
%294 = load float, float* %39
%295 = fpext float %294 to double
store double %295, double* %293
%296 = getelementptr inbounds [4 x double], [4 x double]* %283, i64 1
%297 = getelementptr inbounds [4 x double], [4 x double]* %296, i64 0, i64 0
%298 = load float, float* %28
%299 = fpext float %298 to double
store double %299, double* %297
%300 = getelementptr inbounds double, double* %297, i64 1
%301 = load float, float* %32
%302 = fpext float %301 to double
store double %302, double* %300
%303 = getelementptr inbounds double, double* %300, i64 1
%304 = load float, float* %36
%305 = fpext float %304 to double
store double %305, double* %303
%306 = getelementptr inbounds double, double* %303, i64 1
%307 = load float, float* %40
%308 = fpext float %307 to double
store double %308, double* %306
%309 = getelementptr inbounds [4 x [4 x double]], [4 x [4 x double]]* %41, i64 0, i64 0
%310 = bitcast [4 x double]* %309 to double**
%311 = load float, float* %9
%312 = load i32, i32* %16
%313 = sitofp i32 %312 to float
%314 = fsub float %311, %313
%315 = load float, float* %10
%316 = load i32, i32* %17
%317 = sitofp i32 %316 to float
%318 = fsub float %315, %317
%319 = call float @bicubic_interpolation_cell(double** %310, float %314, float %318)
store float %319, float* %7
br label %320
320: ; preds = %112, %111
%321 = load float, float* %7
ret float %321
}

LLVM IR (-O2):
define float @bicubic_interpolation_at(float* nocapture %0, float %1, float %2, i32 %3, i32 %4, i32 %5) {
%7 = alloca [1 x i32]
%8 = alloca [4 x [4 x double]]
%9 = fcmp olt float %1, 0.000000e+00
%10 = select i1 %9, i32 -1, i32 1
%11 = fcmp olt float %2, 0.000000e+00
%12 = select i1 %11, i32 -1, i32 1
%13 = bitcast [1 x i32]* %7 to i8*
%14 = getelementptr inbounds [1 x i32], [1 x i32]* %7, i64 0, i64 0
store i32 0, i32* %14
%15 = fptosi float %1 to i32
%16 = call i32 @neumann_bc(i32 %15, i32 %3, i32* %14)
%17 = fptosi float %2 to i32
%18 = call i32 @neumann_bc(i32 %17, i32 %4, i32* %14)
%19 = sub nsw i32 %15, %10
%20 = call i32 @neumann_bc(i32 %19, i32 %3, i32* %14)
%21 = sub nsw i32 %17, %10
%22 = call i32 @neumann_bc(i32 %21, i32 %4, i32* %14)
%23 = add nsw i32 %10, %15
%24 = call i32 @neumann_bc(i32 %23, i32 %3, i32* %14)
%25 = add nsw i32 %12, %17
%26 = call i32 @neumann_bc(i32 %25, i32 %4, i32* %14)
%27 = shl nsw i32 %10, 1
%28 = add nsw i32 %27, %15
%29 = call i32 @neumann_bc(i32 %28, i32 %3, i32* %14)
%30 = shl nsw i32 %12, 1
%31 = add nsw i32 %30, %17
%32 = call i32 @neumann_bc(i32 %31, i32 %4, i32* %14)
%33 = load i32, i32* %14
%34 = icmp ne i32 %33, 0
%35 = icmp ne i32 %5, 0
%36 = and i1 %35, %34
br i1 %36, label %152, label %37
37: ; preds = %6
%38 = mul nsw i32 %22, %3
%39 = add nsw i32 %38, %20
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds float, float* %0, i64 %40
%42 = load float, float* %41
%43 = add nsw i32 %38, %16
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds float, float* %0, i64 %44
%46 = load float, float* %45
%47 = add nsw i32 %24, %38
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds float, float* %0, i64 %48
%50 = load float, float* %49
%51 = add nsw i32 %29, %38
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds float, float* %0, i64 %52
%54 = load float, float* %53
%55 = mul nsw i32 %18, %3
%56 = add nsw i32 %20, %55
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds float, float* %0, i64 %57
%59 = load float, float* %58
%60 = add nsw i32 %55, %16
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds float, float* %0, i64 %61
%63 = load float, float* %62
%64 = add nsw i32 %24, %55
%65 = sext i32 %64 to i64
%66 = getelementptr inbounds float, float* %0, i64 %65
%67 = load float, float* %66
%68 = add nsw i32 %29, %55
%69 = sext i32 %68 to i64
%70 = getelementptr inbounds float, float* %0, i64 %69
%71 = load float, float* %70
%72 = mul nsw i32 %26, %3
%73 = add nsw i32 %72, %20
%74 = sext i32 %73 to i64
%75 = getelementptr inbounds float, float* %0, i64 %74
%76 = load float, float* %75
%77 = add nsw i32 %72, %16
%78 = sext i32 %77 to i64
%79 = getelementptr inbounds float, float* %0, i64 %78
%80 = load float, float* %79
%81 = add nsw i32 %72, %24
%82 = sext i32 %81 to i64
%83 = getelementptr inbounds float, float* %0, i64 %82
%84 = load float, float* %83
%85 = add nsw i32 %29, %72
%86 = sext i32 %85 to i64
%87 = getelementptr inbounds float, float* %0, i64 %86
%88 = load float, float* %87
%89 = mul nsw i32 %32, %3
%90 = add nsw i32 %89, %20
%91 = sext i32 %90 to i64
%92 = getelementptr inbounds float, float* %0, i64 %91
%93 = load float, float* %92
%94 = add nsw i32 %89, %16
%95 = sext i32 %94 to i64
%96 = getelementptr inbounds float, float* %0, i64 %95
%97 = load float, float* %96
%98 = add nsw i32 %89, %24
%99 = sext i32 %98 to i64
%100 = getelementptr inbounds float, float* %0, i64 %99
%101 = load float, float* %100
%102 = add nsw i32 %89, %29
%103 = sext i32 %102 to i64
%104 = getelementptr inbounds float, float* %0, i64 %103
%105 = load float, float* %104
%106 = bitcast [4 x [4 x double]]* %8 to i8*
%107 = insertelement <2 x float> poison, float %42, i64 0
%108 = insertelement <2 x float> %107, float %59, i64 1
%109 = fpext <2 x float> %108 to <2 x double>
%110 = bitcast [4 x [4 x double]]* %8 to <2 x double>*
store <2 x double> %109, <2 x double>* %110
%111 = getelementptr inbounds [4 x [4 x double]], [4 x [4 x double]]* %8, i64 0, i64 0, i64 2
%112 = insertelement <2 x float> poison, float %76, i64 0
%113 = insertelement <2 x float> %112, float %93, i64 1
%114 = fpext <2 x float> %113 to <2 x double>
%115 = bitcast double* %111 to <2 x double>*
store <2 x double> %114, <2 x double>* %115
%116 = getelementptr inbounds [4 x [4 x double]], [4 x [4 x double]]* %8, i64 0, i64 1, i64 0
%117 = insertelement <2 x float> poison, float %46, i64 0
%118 = insertelement <2 x float> %117, float %63, i64 1
%119 = fpext <2 x float> %118 to <2 x double>
%120 = bitcast double* %116 to <2 x double>*
store <2 x double> %119, <2 x double>* %120
%121 = getelementptr inbounds [4 x [4 x double]], [4 x [4 x double]]* %8, i64 0, i64 1, i64 2
%122 = insertelement <2 x float> poison, float %80, i64 0
%123 = insertelement <2 x float> %122, float %97, i64 1
%124 = fpext <2 x float> %123 to <2 x double>
%125 = bitcast double* %121 to <2 x double>*
store <2 x double> %124, <2 x double>* %125
%126 = getelementptr inbounds [4 x [4 x double]], [4 x [4 x double]]* %8, i64 0, i64 2, i64 0
%127 = insertelement <2 x float> poison, float %50, i64 0
%128 = insertelement <2 x float> %127, float %67, i64 1
%129 = fpext <2 x float> %128 to <2 x double>
%130 = bitcast double* %126 to <2 x double>*
store <2 x double> %129, <2 x double>* %130
%131 = getelementptr inbounds [4 x [4 x double]], [4 x [4 x double]]* %8, i64 0, i64 2, i64 2
%132 = insertelement <2 x float> poison, float %84, i64 0
%133 = insertelement <2 x float> %132, float %101, i64 1
%134 = fpext <2 x float> %133 to <2 x double>
%135 = bitcast double* %131 to <2 x double>*
store <2 x double> %134, <2 x double>* %135
%136 = getelementptr inbounds [4 x [4 x double]], [4 x [4 x double]]* %8, i64 0, i64 3, i64 0
%137 = insertelement <2 x float> poison, float %54, i64 0
%138 = insertelement <2 x float> %137, float %71, i64 1
%139 = fpext <2 x float> %138 to <2 x double>
%140 = bitcast double* %136 to <2 x double>*
store <2 x double> %139, <2 x double>* %140
%141 = getelementptr inbounds [4 x [4 x double]], [4 x [4 x double]]* %8, i64 0, i64 3, i64 2
%142 = insertelement <2 x float> poison, float %88, i64 0
%143 = insertelement <2 x float> %142, float %105, i64 1
%144 = fpext <2 x float> %143 to <2 x double>
%145 = bitcast double* %141 to <2 x double>*
store <2 x double> %144, <2 x double>* %145
%146 = bitcast [4 x [4 x double]]* %8 to double**
%147 = sitofp i32 %16 to float
%148 = fsub float %1, %147
%149 = sitofp i32 %18 to float
%150 = fsub float %2, %149
%151 = call float @bicubic_interpolation_cell(double** %146, float %148, float %150)
br label %152
152: ; preds = %6, %37
%153 = phi float [ %151, %37 ], [ 0.000000e+00, %6 ]
ret float %153
}