#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 /*<<< orphan*/ assert(int);
int find_xb(double, double const *, int, int);
int index_3D_to_1D(int, int, int, int, int, int);
double lagrange_interp_3D(double, double, double, double *, int, double *, int,
                          double *, int, double *);
double lagrange_interp_3Dfo(double x, double y, double z, int order_x,
                            int order_y, int order_z, const double x_values[],
                            int num_x, const double y_values[], int num_y,
                            const double z_values[], int num_z,
                            const double f_values[]) {
  assert(order_x % 2 == 0);
  assert(order_y % 2 == 0);
  assert(order_z % 2 == 0);
  assert(num_x > order_x);
  assert(num_y > order_y);
  assert(num_z > order_z);
  double mx[order_x + 1];
  double my[order_y + 1];
  double mz[order_z + 1];
  double mf[(order_x + 1) * (order_y + 1) * (order_z + 1)];
  int ix = find_xb(x, x_values, num_x, order_x / 2);
  int iy = find_xb(y, y_values, num_y, order_y / 2);
  int iz = find_xb(z, z_values, num_z, order_z / 2);
  int if_small, if_big;
  for (int i = 0; i < order_x + 1; i++) {
    mx[i] = x_values[ix + i - order_x / 2];
    for (int j = 0; j < order_y + 1; j++) {
      my[j] = y_values[iy + j - order_y / 2];
      for (int k = 0; k < order_z + 1; k++) {
        mz[j] = z_values[iz + k - order_z / 2];
        if_small =
            index_3D_to_1D(i, order_x + 1, j, order_y + 1, k, order_z + 1);
        if_big =
            index_3D_to_1D(ix + i - order_x / 2, num_x, iy + j - order_y / 2,
                           num_y, iz + k - order_z / 2, num_z);
        mf[if_small] = f_values[if_big];
      }
    }
  }
  return lagrange_interp_3D(x, y, z, mx, order_x + 1, my, order_y + 1, mz,
                            order_z + 1, mf);
}


x86 assembly (clang, -O0):
<lagrange_interp_3Dfo>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
mov    0x28(%rbp),%rax
mov    0x20(%rbp),%eax
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%eax
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
mov    %edi,-0x1c(%rbp)
mov    %esi,-0x20(%rbp)
mov    %edx,-0x24(%rbp)
mov    %rcx,-0x30(%rbp)
mov    %r8d,-0x34(%rbp)
mov    %r9,-0x40(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,%edx
shr    $0x1f,%edx
mov    %eax,%ecx
add    %edx,%ecx
and    $0xfffffffe,%ecx
sub    %ecx,%eax
sete   %al
movzbl %al,%edi
call   1060 <assert@plt>
mov    -0x20(%rbp),%eax
mov    %eax,%edx
shr    $0x1f,%edx
mov    %eax,%ecx
add    %edx,%ecx
and    $0xfffffffe,%ecx
sub    %ecx,%eax
sete   %al
movzbl %al,%edi
call   1060 <assert@plt>
mov    -0x24(%rbp),%eax
mov    %eax,%edx
shr    $0x1f,%edx
mov    %eax,%ecx
add    %edx,%ecx
and    $0xfffffffe,%ecx
sub    %ecx,%eax
sete   %al
movzbl %al,%edi
call   1060 <assert@plt>
mov    -0x34(%rbp),%eax
mov    -0x1c(%rbp),%ecx
sub    %ecx,%eax
setg   %al
movzbl %al,%edi
call   1060 <assert@plt>
mov    0x10(%rbp),%eax
mov    -0x20(%rbp),%ecx
sub    %ecx,%eax
setg   %al
movzbl %al,%edi
call   1060 <assert@plt>
mov    0x20(%rbp),%eax
mov    -0x24(%rbp),%ecx
sub    %ecx,%eax
setg   %al
movzbl %al,%edi
call   1060 <assert@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %rsp,%rcx
mov    %rcx,-0x48(%rbp)
lea    0xf(,%rax,8),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0xa8(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x50(%rbp)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
lea    0xf(,%rax,8),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0xa0(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x58(%rbp)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
lea    0xf(,%rax,8),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x98(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x60(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    -0x20(%rbp),%ecx
add    $0x1,%ecx
imul   %ecx,%eax
mov    -0x24(%rbp),%ecx
add    $0x1,%ecx
imul   %ecx,%eax
lea    0xf(,%rax,8),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x90(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x68(%rbp)
movsd  -0x8(%rbp),%xmm0
mov    -0x30(%rbp),%rdi
mov    -0x34(%rbp),%esi
mov    -0x1c(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%edx
call   1040 <find_xb@plt>
mov    %eax,-0x6c(%rbp)
movsd  -0x10(%rbp),%xmm0
mov    -0x40(%rbp),%rdi
mov    0x10(%rbp),%esi
mov    -0x20(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%edx
call   1040 <find_xb@plt>
mov    %eax,-0x70(%rbp)
movsd  -0x18(%rbp),%xmm0
mov    0x18(%rbp),%rdi
mov    0x20(%rbp),%esi
mov    -0x24(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%edx
call   1040 <find_xb@plt>
mov    %eax,-0x74(%rbp)
movl   $0x0,-0x80(%rbp)
mov    -0x80(%rbp),%eax
mov    -0x1c(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jge    1530 <lagrange_interp_3Dfo+0x3f0>
mov    -0x30(%rbp),%rcx
mov    -0x6c(%rbp),%eax
add    -0x80(%rbp),%eax
mov    %eax,-0xac(%rbp)
mov    -0x1c(%rbp),%eax
mov    $0x2,%esi
cltd
idiv   %esi
mov    -0xac(%rbp),%edx
mov    %eax,%esi
mov    -0xa8(%rbp),%rax
sub    %esi,%edx
movslq %edx,%rdx
movsd  (%rcx,%rdx,8),%xmm0
movslq -0x80(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movl   $0x0,-0x84(%rbp)
mov    -0x84(%rbp),%eax
mov    -0x20(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jge    151d <lagrange_interp_3Dfo+0x3dd>
mov    -0x40(%rbp),%rcx
mov    -0x70(%rbp),%eax
add    -0x84(%rbp),%eax
mov    %eax,-0xb0(%rbp)
mov    -0x20(%rbp),%eax
mov    $0x2,%esi
cltd
idiv   %esi
mov    -0xb0(%rbp),%edx
mov    %eax,%esi
mov    -0xa0(%rbp),%rax
sub    %esi,%edx
movslq %edx,%rdx
movsd  (%rcx,%rdx,8),%xmm0
movslq -0x84(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movl   $0x0,-0x88(%rbp)
mov    -0x88(%rbp),%eax
mov    -0x24(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jge    1504 <lagrange_interp_3Dfo+0x3c4>
mov    0x18(%rbp),%rcx
mov    -0x74(%rbp),%eax
add    -0x88(%rbp),%eax
mov    %eax,-0xbc(%rbp)
mov    -0x24(%rbp),%eax
mov    $0x2,%esi
cltd
idiv   %esi
mov    -0xbc(%rbp),%edx
mov    %eax,%esi
mov    -0x98(%rbp),%rax
sub    %esi,%edx
movslq %edx,%rdx
movsd  (%rcx,%rdx,8),%xmm0
movslq -0x84(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x80(%rbp),%edi
mov    -0x1c(%rbp),%esi
add    $0x1,%esi
mov    -0x84(%rbp),%edx
mov    -0x20(%rbp),%ecx
add    $0x1,%ecx
mov    -0x88(%rbp),%r8d
mov    -0x24(%rbp),%r9d
add    $0x1,%r9d
call   1050 <index_3D_to_1D@plt>
mov    %eax,-0x78(%rbp)
mov    -0x6c(%rbp),%edi
add    -0x80(%rbp),%edi
mov    -0x1c(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
sub    %eax,%edi
mov    -0x34(%rbp),%esi
mov    -0x70(%rbp),%eax
add    -0x84(%rbp),%eax
mov    %eax,-0xb8(%rbp)
mov    -0x20(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0xb8(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0xb4(%rbp)
mov    0x10(%rbp),%ecx
mov    -0x74(%rbp),%r8d
add    -0x88(%rbp),%r8d
mov    -0x24(%rbp),%eax
mov    $0x2,%r9d
cltd
idiv   %r9d
mov    -0xb4(%rbp),%edx
sub    %eax,%r8d
mov    0x20(%rbp),%r9d
call   1050 <index_3D_to_1D@plt>
mov    %eax,%ecx
mov    -0x90(%rbp),%rax
mov    %ecx,-0x7c(%rbp)
mov    0x28(%rbp),%rcx
movslq -0x7c(%rbp),%rdx
movsd  (%rcx,%rdx,8),%xmm0
movslq -0x78(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x88(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x88(%rbp)
jmp    13de <lagrange_interp_3Dfo+0x29e>
jmp    1509 <lagrange_interp_3Dfo+0x3c9>
mov    -0x84(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x84(%rbp)
jmp    137d <lagrange_interp_3Dfo+0x23d>
jmp    1522 <lagrange_interp_3Dfo+0x3e2>
mov    -0x80(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x80(%rbp)
jmp    1325 <lagrange_interp_3Dfo+0x1e5>
mov    -0x90(%rbp),%rax
mov    -0x98(%rbp),%r8
mov    -0xa0(%rbp),%rdx
mov    -0xa8(%rbp),%rdi
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm2
mov    -0x1c(%rbp),%esi
add    $0x1,%esi
mov    -0x20(%rbp),%ecx
add    $0x1,%ecx
mov    -0x24(%rbp),%r9d
add    $0x1,%r9d
sub    $0x10,%rsp
mov    %rax,(%rsp)
call   1030 <lagrange_interp_3D@plt>
add    $0x10,%rsp
mov    -0x48(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lagrange_interp_3Dfo>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xb8,%rsp
mov    %r9,-0x98(%rbp)
mov    %r8d,%r13d
mov    %rcx,-0x80(%rbp)
mov    %rdx,-0x40(%rbp)
mov    %esi,%r12d
mov    %edi,%r15d
movsd  %xmm2,-0x70(%rbp)
movsd  %xmm1,-0x68(%rbp)
movsd  %xmm0,-0x60(%rbp)
mov    %edx,%r14d
not    %r14d
mov    %esi,%ebx
not    %ebx
not    %edi
and    $0x1,%edi
call   1060 <assert@plt>
and    $0x1,%ebx
mov    %ebx,%edi
call   1060 <assert@plt>
and    $0x1,%r14d
mov    %r14d,%edi
call   1060 <assert@plt>
xor    %edi,%edi
cmp    %r15d,%r13d
setg   %dil
call   1060 <assert@plt>
xor    %edi,%edi
cmp    %r12d,0x10(%rbp)
setg   %dil
call   1060 <assert@plt>
xor    %edi,%edi
mov    -0x40(%rbp),%rbx
cmp    %ebx,0x20(%rbp)
setg   %dil
call   1060 <assert@plt>
lea    0x1(%r15),%edx
mov    %rsp,%rcx
lea    0xf(,%rdx,8),%rax
mov    %rdx,-0xb8(%rbp)
and    $0xfffffffffffffff0,%rax
sub    %rax,%rcx
mov    %rcx,-0x78(%rbp)
mov    %rcx,%rsp
lea    0x1(%r12),%esi
mov    %rsp,%rcx
lea    0xf(,%rsi,8),%rax
mov    %rsi,-0xa0(%rbp)
and    $0xfffffffffffffff0,%rax
sub    %rax,%rcx
mov    %rcx,-0x90(%rbp)
mov    %rcx,%rsp
lea    0x1(%rbx),%edi
mov    %rdi,-0xb0(%rbp)
mov    %rsp,%rcx
lea    0xf(,%rdi,8),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rcx
mov    %rcx,-0x88(%rbp)
mov    %rcx,%rsp
mov    %esi,%eax
imul   %edx,%eax
imul   %edi,%eax
lea    0xf(,%rax,8),%rax
and    $0xfffffffffffffff0,%rax
mov    %rsp,%rcx
sub    %rax,%rcx
mov    %rcx,-0xa8(%rbp)
mov    %rcx,%rsp
mov    %r15,-0x48(%rbp)
mov    %r15d,%r14d
shr    $0x1f,%r14d
add    %r15d,%r14d
sar    %r14d
movsd  -0x60(%rbp),%xmm0
mov    -0x80(%rbp),%rdi
mov    %r13d,%esi
mov    %r14d,%edx
call   1040 <find_xb@plt>
mov    %rax,-0x30(%rbp)
mov    %r12d,%r15d
shr    $0x1f,%r15d
mov    %r12,-0xc0(%rbp)
add    %r12d,%r15d
mov    0x20(%rbp),%ebx
sar    %r15d
movsd  -0x68(%rbp),%xmm0
mov    -0x98(%rbp),%rdi
mov    0x10(%rbp),%esi
mov    %r15d,%edx
call   1040 <find_xb@plt>
mov    %rax,-0x38(%rbp)
mov    -0x40(%rbp),%rax
mov    %eax,%r12d
shr    $0x1f,%r12d
add    %eax,%r12d
sar    %r12d
movsd  -0x70(%rbp),%xmm0
mov    0x18(%rbp),%rdi
mov    %ebx,%esi
mov    %r12d,%edx
call   1040 <find_xb@plt>
mov    -0xb0(%rbp),%r9
mov    -0xa0(%rbp),%r8
mov    -0xb8(%rbp),%rsi
cmpl   $0x0,-0x48(%rbp)
js     1464 <lagrange_interp_3Dfo+0x324>
mov    %eax,%edi
mov    -0x30(%rbp),%rax
sub    %r14d,%eax
mov    %rax,-0x30(%rbp)
mov    -0x38(%rbp),%rax
sub    %r15d,%eax
mov    %rax,-0x38(%rbp)
sub    %r12d,%edi
xor    %r15d,%r15d
mov    %rdi,-0xc8(%rbp)
mov    %r13d,-0x4c(%rbp)
jmp    134d <lagrange_interp_3Dfo+0x20d>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0x1,%r15
cmp    %rsi,%r15
je     1464 <lagrange_interp_3Dfo+0x324>
mov    -0x30(%rbp),%rax
lea    (%rax,%r15,1),%r10d
movslq %r10d,%rax
mov    -0x80(%rbp),%rcx
movsd  (%rcx,%rax,8),%xmm0
mov    -0x78(%rbp),%rax
movsd  %xmm0,(%rax,%r15,8)
cmpl   $0x0,-0xc0(%rbp)
js     1340 <lagrange_interp_3Dfo+0x200>
xor    %edx,%edx
mov    %r10d,-0x50(%rbp)
jmp    1389 <lagrange_interp_3Dfo+0x249>
nopl   0x0(%rax)
add    $0x1,%rdx
cmp    %r8,%rdx
je     1340 <lagrange_interp_3Dfo+0x200>
mov    -0x38(%rbp),%rax
lea    (%rax,%rdx,1),%r11d
movslq %r11d,%rax
mov    -0x98(%rbp),%rcx
movsd  (%rcx,%rax,8),%xmm0
mov    -0x90(%rbp),%rax
movsd  %xmm0,(%rax,%rdx,8)
cmpl   $0x0,-0x40(%rbp)
js     1380 <lagrange_interp_3Dfo+0x240>
xor    %ebx,%ebx
mov    %r11d,-0x54(%rbp)
mov    %rdx,-0xd8(%rbp)
nop
lea    (%rdi,%rbx,1),%rax
movslq %eax,%r13
mov    0x18(%rbp),%rax
movsd  (%rax,%r13,8),%xmm0
movsd  %xmm0,-0xd0(%rbp)
ff
mov    %r15d,%edi
mov    %rsi,%r14
mov    %r8d,%ecx
mov    %ebx,%r8d
mov    %r9,%r12
call   1050 <index_3D_to_1D@plt>
mov    %eax,-0x48(%rbp)
mov    -0x50(%rbp),%edi
mov    -0x4c(%rbp),%esi
mov    -0x54(%rbp),%edx
mov    0x10(%rbp),%ecx
mov    %r13d,%r8d
mov    0x20(%rbp),%r9d
call   1050 <index_3D_to_1D@plt>
mov    -0xd8(%rbp),%rdx
mov    0x28(%rbp),%rcx
mov    -0xc8(%rbp),%rdi
mov    %r12,%r9
mov    -0xa0(%rbp),%r8
mov    %r14,%rsi
cltq
movsd  (%rcx,%rax,8),%xmm0
movslq -0x48(%rbp),%rax
mov    -0xa8(%rbp),%rcx
movsd  %xmm0,(%rcx,%rax,8)
add    $0x1,%rbx
cmp    %rbx,%r12
jne    13c0 <lagrange_interp_3Dfo+0x280>
mov    -0x88(%rbp),%rax
movsd  -0xd0(%rbp),%xmm0
ff
movsd  %xmm0,(%rax,%rdx,8)
jmp    1380 <lagrange_interp_3Dfo+0x240>
sub    $0x8,%rsp
movsd  -0x60(%rbp),%xmm0
movsd  -0x68(%rbp),%xmm1
movsd  -0x70(%rbp),%xmm2
mov    -0x78(%rbp),%rdi
mov    -0x90(%rbp),%rdx
mov    %r8d,%ecx
mov    -0x88(%rbp),%r8
push   -0xa8(%rbp)
call   1030 <lagrange_interp_3D@plt>
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define double @lagrange_interp_3Dfo(double %0, double %1, double %2, i32 %3, i32 %4, i32 %5, double* %6, i32 %7, double* %8, i32 %9, double* %10, i32 %11, double* %12) {
%14 = alloca double
%15 = alloca double
%16 = alloca double
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
%20 = alloca double*
%21 = alloca i32
%22 = alloca double*
%23 = alloca i32
%24 = alloca double*
%25 = alloca i32
%26 = alloca double*
%27 = alloca i8*
%28 = alloca i64
%29 = alloca i64
%30 = alloca i64
%31 = alloca i64
%32 = alloca i32
%33 = alloca i32
%34 = alloca i32
%35 = alloca i32
%36 = alloca i32
%37 = alloca i32
%38 = alloca i32
%39 = alloca i32
store double %0, double* %14
store double %1, double* %15
store double %2, double* %16
store i32 %3, i32* %17
store i32 %4, i32* %18
store i32 %5, i32* %19
store double* %6, double** %20
store i32 %7, i32* %21
store double* %8, double** %22
store i32 %9, i32* %23
store double* %10, double** %24
store i32 %11, i32* %25
store double* %12, double** %26
%40 = load i32, i32* %17
%41 = srem i32 %40, 2
%42 = icmp eq i32 %41, 0
%43 = zext i1 %42 to i32
%44 = call i32 @assert(i32 %43)
%45 = load i32, i32* %18
%46 = srem i32 %45, 2
%47 = icmp eq i32 %46, 0
%48 = zext i1 %47 to i32
%49 = call i32 @assert(i32 %48)
%50 = load i32, i32* %19
%51 = srem i32 %50, 2
%52 = icmp eq i32 %51, 0
%53 = zext i1 %52 to i32
%54 = call i32 @assert(i32 %53)
%55 = load i32, i32* %21
%56 = load i32, i32* %17
%57 = icmp sgt i32 %55, %56
%58 = zext i1 %57 to i32
%59 = call i32 @assert(i32 %58)
%60 = load i32, i32* %23
%61 = load i32, i32* %18
%62 = icmp sgt i32 %60, %61
%63 = zext i1 %62 to i32
%64 = call i32 @assert(i32 %63)
%65 = load i32, i32* %25
%66 = load i32, i32* %19
%67 = icmp sgt i32 %65, %66
%68 = zext i1 %67 to i32
%69 = call i32 @assert(i32 %68)
%70 = load i32, i32* %17
%71 = add nsw i32 %70, 1
%72 = zext i32 %71 to i64
%73 = call i8* @llvm.stacksave()
store i8* %73, i8** %27
%74 = alloca double, i64 %72
store i64 %72, i64* %28
%75 = load i32, i32* %18
%76 = add nsw i32 %75, 1
%77 = zext i32 %76 to i64
%78 = alloca double, i64 %77
store i64 %77, i64* %29
%79 = load i32, i32* %19
%80 = add nsw i32 %79, 1
%81 = zext i32 %80 to i64
%82 = alloca double, i64 %81
store i64 %81, i64* %30
%83 = load i32, i32* %17
%84 = add nsw i32 %83, 1
%85 = load i32, i32* %18
%86 = add nsw i32 %85, 1
%87 = mul nsw i32 %84, %86
%88 = load i32, i32* %19
%89 = add nsw i32 %88, 1
%90 = mul nsw i32 %87, %89
%91 = zext i32 %90 to i64
%92 = alloca double, i64 %91
store i64 %91, i64* %31
%93 = load double, double* %14
%94 = load double*, double** %20
%95 = load i32, i32* %21
%96 = load i32, i32* %17
%97 = sdiv i32 %96, 2
%98 = call i32 @find_xb(double %93, double* %94, i32 %95, i32 %97)
store i32 %98, i32* %32
%99 = load double, double* %15
%100 = load double*, double** %22
%101 = load i32, i32* %23
%102 = load i32, i32* %18
%103 = sdiv i32 %102, 2
%104 = call i32 @find_xb(double %99, double* %100, i32 %101, i32 %103)
store i32 %104, i32* %33
%105 = load double, double* %16
%106 = load double*, double** %24
%107 = load i32, i32* %25
%108 = load i32, i32* %19
%109 = sdiv i32 %108, 2
%110 = call i32 @find_xb(double %105, double* %106, i32 %107, i32 %109)
store i32 %110, i32* %34
store i32 0, i32* %37
br label %111
111: ; preds = %216, %13
%112 = load i32, i32* %37
%113 = load i32, i32* %17
%114 = add nsw i32 %113, 1
%115 = icmp slt i32 %112, %114
br i1 %115, label %116, label %219
116: ; preds = %111
%117 = load double*, double** %20
%118 = load i32, i32* %32
%119 = load i32, i32* %37
%120 = add nsw i32 %118, %119
%121 = load i32, i32* %17
%122 = sdiv i32 %121, 2
%123 = sub nsw i32 %120, %122
%124 = sext i32 %123 to i64
%125 = getelementptr inbounds double, double* %117, i64 %124
%126 = load double, double* %125
%127 = load i32, i32* %37
%128 = sext i32 %127 to i64
%129 = getelementptr inbounds double, double* %74, i64 %128
store double %126, double* %129
store i32 0, i32* %38
br label %130
130: ; preds = %212, %116
%131 = load i32, i32* %38
%132 = load i32, i32* %18
%133 = add nsw i32 %132, 1
%134 = icmp slt i32 %131, %133
br i1 %134, label %135, label %215
135: ; preds = %130
%136 = load double*, double** %22
%137 = load i32, i32* %33
%138 = load i32, i32* %38
%139 = add nsw i32 %137, %138
%140 = load i32, i32* %18
%141 = sdiv i32 %140, 2
%142 = sub nsw i32 %139, %141
%143 = sext i32 %142 to i64
%144 = getelementptr inbounds double, double* %136, i64 %143
%145 = load double, double* %144
%146 = load i32, i32* %38
%147 = sext i32 %146 to i64
%148 = getelementptr inbounds double, double* %78, i64 %147
store double %145, double* %148
store i32 0, i32* %39
br label %149
149: ; preds = %208, %135
%150 = load i32, i32* %39
%151 = load i32, i32* %19
%152 = add nsw i32 %151, 1
%153 = icmp slt i32 %150, %152
br i1 %153, label %154, label %211
154: ; preds = %149
%155 = load double*, double** %24
%156 = load i32, i32* %34
%157 = load i32, i32* %39
%158 = add nsw i32 %156, %157
%159 = load i32, i32* %19
%160 = sdiv i32 %159, 2
%161 = sub nsw i32 %158, %160
%162 = sext i32 %161 to i64
%163 = getelementptr inbounds double, double* %155, i64 %162
%164 = load double, double* %163
%165 = load i32, i32* %38
%166 = sext i32 %165 to i64
%167 = getelementptr inbounds double, double* %82, i64 %166
store double %164, double* %167
%168 = load i32, i32* %37
%169 = load i32, i32* %17
%170 = add nsw i32 %169, 1
%171 = load i32, i32* %38
%172 = load i32, i32* %18
%173 = add nsw i32 %172, 1
%174 = load i32, i32* %39
%175 = load i32, i32* %19
%176 = add nsw i32 %175, 1
%177 = call i32 @index_3D_to_1D(i32 %168, i32 %170, i32 %171, i32 %173, i32 %174, i32 %176)
store i32 %177, i32* %35
%178 = load i32, i32* %32
%179 = load i32, i32* %37
%180 = add nsw i32 %178, %179
%181 = load i32, i32* %17
%182 = sdiv i32 %181, 2
%183 = sub nsw i32 %180, %182
%184 = load i32, i32* %21
%185 = load i32, i32* %33
%186 = load i32, i32* %38
%187 = add nsw i32 %185, %186
%188 = load i32, i32* %18
%189 = sdiv i32 %188, 2
%190 = sub nsw i32 %187, %189
%191 = load i32, i32* %23
%192 = load i32, i32* %34
%193 = load i32, i32* %39
%194 = add nsw i32 %192, %193
%195 = load i32, i32* %19
%196 = sdiv i32 %195, 2
%197 = sub nsw i32 %194, %196
%198 = load i32, i32* %25
%199 = call i32 @index_3D_to_1D(i32 %183, i32 %184, i32 %190, i32 %191, i32 %197, i32 %198)
store i32 %199, i32* %36
%200 = load double*, double** %26
%201 = load i32, i32* %36
%202 = sext i32 %201 to i64
%203 = getelementptr inbounds double, double* %200, i64 %202
%204 = load double, double* %203
%205 = load i32, i32* %35
%206 = sext i32 %205 to i64
%207 = getelementptr inbounds double, double* %92, i64 %206
store double %204, double* %207
br label %208
208: ; preds = %154
%209 = load i32, i32* %39
%210 = add nsw i32 %209, 1
store i32 %210, i32* %39
br label %149
211: ; preds = %149
br label %212
212: ; preds = %211
%213 = load i32, i32* %38
%214 = add nsw i32 %213, 1
store i32 %214, i32* %38
br label %130
215: ; preds = %130
br label %216
216: ; preds = %215
%217 = load i32, i32* %37
%218 = add nsw i32 %217, 1
store i32 %218, i32* %37
br label %111
219: ; preds = %111
%220 = load double, double* %14
%221 = load double, double* %15
%222 = load double, double* %16
%223 = load i32, i32* %17
%224 = add nsw i32 %223, 1
%225 = load i32, i32* %18
%226 = add nsw i32 %225, 1
%227 = load i32, i32* %19
%228 = add nsw i32 %227, 1
%229 = call double @lagrange_interp_3D(double %220, double %221, double %222, double* %74, i32 %224, double* %78, i32 %226, double* %82, i32 %228, double* %92)
%230 = load i8*, i8** %27
ret double %229
}

LLVM IR (-O2):
define double @lagrange_interp_3Dfo(double %0, double %1, double %2, i32 %3, i32 %4, i32 %5, double* %6, i32 %7, double* %8, i32 %9, double* %10, i32 %11, double* nocapture %12) {
%14 = and i32 %3, 1
%15 = xor i32 %14, 1
%16 = tail call i32 @assert(i32 %15)
%17 = and i32 %4, 1
%18 = xor i32 %17, 1
%19 = tail call i32 @assert(i32 %18)
%20 = and i32 %5, 1
%21 = xor i32 %20, 1
%22 = tail call i32 @assert(i32 %21)
%23 = icmp sgt i32 %7, %3
%24 = zext i1 %23 to i32
%25 = tail call i32 @assert(i32 %24)
%26 = icmp sgt i32 %9, %4
%27 = zext i1 %26 to i32
%28 = tail call i32 @assert(i32 %27)
%29 = icmp sgt i32 %11, %5
%30 = zext i1 %29 to i32
%31 = tail call i32 @assert(i32 %30)
%32 = add i32 %3, 1
%33 = zext i32 %32 to i64
%34 = alloca double, i64 %33
%35 = add i32 %4, 1
%36 = zext i32 %35 to i64
%37 = alloca double, i64 %36
%38 = add i32 %5, 1
%39 = zext i32 %38 to i64
%40 = alloca double, i64 %39
%41 = mul nsw i32 %35, %32
%42 = mul nsw i32 %41, %38
%43 = zext i32 %42 to i64
%44 = alloca double, i64 %43
%45 = sdiv i32 %3, 2
%46 = tail call i32 @find_xb(double %0, double* %6, i32 %7, i32 %45)
%47 = sdiv i32 %4, 2
%48 = tail call i32 @find_xb(double %1, double* %8, i32 %9, i32 %47)
%49 = sdiv i32 %5, 2
%50 = tail call i32 @find_xb(double %2, double* %10, i32 %11, i32 %49)
%51 = icmp slt i32 %3, 0
br i1 %51, label %58, label %52
52: ; preds = %13
%53 = sub i32 %46, %45
%54 = icmp slt i32 %4, 0
%55 = sub i32 %48, %47
%56 = icmp slt i32 %5, 0
%57 = sub i32 %50, %49
br label %60
58: ; preds = %68, %13
%59 = call double @lagrange_interp_3D(double %0, double %1, double %2, double* %34, i32 %32, double* %37, i32 %35, double* %40, i32 %38, double* %44)
ret double %59
60: ; preds = %52, %68
%61 = phi i64 [ 0, %52 ], [ %69, %68 ]
%62 = trunc i64 %61 to i32
%63 = add i32 %53, %62
%64 = sext i32 %63 to i64
%65 = getelementptr inbounds double, double* %6, i64 %64
%66 = load double, double* %65
%67 = getelementptr inbounds double, double* %34, i64 %61
store double %66, double* %67
br i1 %54, label %68, label %71
68: ; preds = %81, %60
%69 = add nuw nsw i64 %61, 1
%70 = icmp eq i64 %69, %33
br i1 %70, label %58, label %60
71: ; preds = %60, %81
%72 = phi i64 [ %82, %81 ], [ 0, %60 ]
%73 = trunc i64 %72 to i32
%74 = add i32 %55, %73
%75 = sext i32 %74 to i64
%76 = getelementptr inbounds double, double* %8, i64 %75
%77 = load double, double* %76
%78 = getelementptr inbounds double, double* %37, i64 %72
store double %77, double* %78
br i1 %56, label %81, label %84
79: ; preds = %84
%80 = getelementptr inbounds double, double* %40, i64 %72
store double %90, double* %80
br label %81
81: ; preds = %79, %71
%82 = add nuw nsw i64 %72, 1
%83 = icmp eq i64 %82, %36
br i1 %83, label %68, label %71
84: ; preds = %71, %84
%85 = phi i64 [ %98, %84 ], [ 0, %71 ]
%86 = trunc i64 %85 to i32
%87 = add i32 %57, %86
%88 = sext i32 %87 to i64
%89 = getelementptr inbounds double, double* %10, i64 %88
%90 = load double, double* %89
%91 = tail call i32 @index_3D_to_1D(i32 %62, i32 %32, i32 %73, i32 %35, i32 %86, i32 %38)
%92 = tail call i32 @index_3D_to_1D(i32 %63, i32 %7, i32 %74, i32 %9, i32 %87, i32 %11)
%93 = sext i32 %92 to i64
%94 = getelementptr inbounds double, double* %12, i64 %93
%95 = load double, double* %94
%96 = sext i32 %91 to i64
%97 = getelementptr inbounds double, double* %44, i64 %96
store double %95, double* %97
%98 = add nuw nsw i64 %85, 1
%99 = icmp eq i64 %98, %39
br i1 %99, label %79, label %84
}