void reg_ev(double val[], double x0[], double x1[], double x2[], double f[],
            double fx0[], double fx1[], double fx2[], int ix0, int ix1, int ix2,
            int ix) {
  int i, iter = -1, loc;
  double dx0gap, dx1gap, dx2gap, temp, a[64], fin[64];
  double *dx0 = malloc(ix * sizeof(double));
  double *dx1 = malloc(ix * sizeof(double));
  double *dx2 = malloc(ix * sizeof(double));
  double *tempx0 = malloc(ix * sizeof(double));
  double *tempx1 = malloc(ix * sizeof(double));
  double *tempx2 = malloc(ix * sizeof(double));
  int *pos = malloc(ix * sizeof(int));
  int *indx = malloc(ix * sizeof(int));
  dx0gap = fx0[1] - fx0[0];
  dx1gap = fx1[1] - fx1[0];
  dx2gap = fx2[1] - fx2[0];
  for (i = 0; i < ix; i++) {
    temp = (x0[i] - fx0[0]) / dx0gap;
    dx0[i] = modf(temp, &tempx0[i]);
    tempx0[i] = (double)clip((int)tempx0[i], ix0);
    dx0[i] = temp - tempx0[i];
    temp = (x1[i] - fx1[0]) / dx1gap;
    dx1[i] = modf(temp, &tempx1[i]);
    tempx1[i] = (double)clip((int)tempx1[i], ix1);
    dx1[i] = temp - tempx1[i];
    temp = (x2[i] - fx2[0]) / dx2gap;
    dx2[i] = modf(temp, &tempx2[i]);
    tempx2[i] = (double)clip((int)tempx2[i], ix2);
    dx2[i] = temp - tempx2[i];
    pos[i] = (int)tempx0[i] + ix0 * ((int)tempx1[i] + ix1 * ((int)tempx2[i]));
  }
  int_argsort(indx, pos, ix);
  for (i = 0; i < ix; i++) {
    loc = indx[i];
    if (iter != pos[loc]) {
      iter = pos[loc];
      voxel(fin, f, (int)tempx0[i], (int)tempx1[i], (int)tempx2[i], ix0, ix1,
            ix2);
      tricubic_get_coeff_stacked(a, fin);
    }
    val[loc] = tricubic_eval(a, dx0[loc], dx1[loc], dx2[loc]);
  }
  free(dx0);
  free(dx1);
  free(dx2);
  free(pos);
  free(indx);
  free(tempx0);
  free(tempx1);
  free(tempx2);
}


x86 assembly (clang, -O0):
<reg_ev>:
push   %rbp
mov    %rsp,%rbp
sub    $0x4b0,%rsp
mov    0x38(%rbp),%eax
mov    0x30(%rbp),%eax
mov    0x28(%rbp),%eax
mov    0x20(%rbp),%eax
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
movl   $0xffffffff,-0x38(%rbp)
movslq 0x38(%rbp),%rdi
shl    $0x3,%rdi
call   1090 <malloc@plt>
mov    %rax,-0x468(%rbp)
movslq 0x38(%rbp),%rdi
shl    $0x3,%rdi
call   1090 <malloc@plt>
mov    %rax,-0x470(%rbp)
movslq 0x38(%rbp),%rdi
shl    $0x3,%rdi
call   1090 <malloc@plt>
mov    %rax,-0x478(%rbp)
movslq 0x38(%rbp),%rdi
shl    $0x3,%rdi
call   1090 <malloc@plt>
mov    %rax,-0x480(%rbp)
movslq 0x38(%rbp),%rdi
shl    $0x3,%rdi
call   1090 <malloc@plt>
mov    %rax,-0x488(%rbp)
movslq 0x38(%rbp),%rdi
shl    $0x3,%rdi
call   1090 <malloc@plt>
mov    %rax,-0x490(%rbp)
movslq 0x38(%rbp),%rdi
shl    $0x2,%rdi
call   1090 <malloc@plt>
mov    %rax,-0x498(%rbp)
movslq 0x38(%rbp),%rdi
shl    $0x2,%rdi
call   1090 <malloc@plt>
mov    %rax,-0x4a0(%rbp)
mov    -0x30(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x30(%rbp),%rax
subsd  (%rax),%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    0x10(%rbp),%rax
subsd  (%rax),%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    0x18(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    0x18(%rbp),%rax
subsd  (%rax),%xmm0
movsd  %xmm0,-0x58(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    0x38(%rbp),%eax
jge    14ea <reg_ev+0x36a>
mov    -0x10(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x30(%rbp),%rax
subsd  (%rax),%xmm0
divsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x60(%rbp),%xmm0
mov    -0x480(%rbp),%rdi
movslq -0x34(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdi
call   1080 <modf@plt>
mov    -0x468(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x480(%rbp),%rax
movslq -0x34(%rbp),%rcx
cvttsd2si (%rax,%rcx,8),%edi
mov    0x20(%rbp),%esi
mov    $0x0,%al
call   1040 <clip@plt>
cvtsi2sd %eax,%xmm0
mov    -0x480(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x60(%rbp),%xmm0
mov    -0x480(%rbp),%rax
movslq -0x34(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm0
mov    -0x468(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x18(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    0x10(%rbp),%rax
subsd  (%rax),%xmm0
divsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x60(%rbp),%xmm0
mov    -0x488(%rbp),%rdi
movslq -0x34(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdi
call   1080 <modf@plt>
mov    -0x470(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x488(%rbp),%rax
movslq -0x34(%rbp),%rcx
cvttsd2si (%rax,%rcx,8),%edi
mov    0x28(%rbp),%esi
mov    $0x0,%al
call   1040 <clip@plt>
cvtsi2sd %eax,%xmm0
mov    -0x488(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x60(%rbp),%xmm0
mov    -0x488(%rbp),%rax
movslq -0x34(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm0
mov    -0x470(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x20(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    0x18(%rbp),%rax
subsd  (%rax),%xmm0
divsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x60(%rbp),%xmm0
mov    -0x490(%rbp),%rdi
movslq -0x34(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdi
call   1080 <modf@plt>
mov    -0x478(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x490(%rbp),%rax
movslq -0x34(%rbp),%rcx
cvttsd2si (%rax,%rcx,8),%edi
mov    0x30(%rbp),%esi
mov    $0x0,%al
call   1040 <clip@plt>
cvtsi2sd %eax,%xmm0
mov    -0x490(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x60(%rbp),%xmm0
mov    -0x490(%rbp),%rax
movslq -0x34(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm0
mov    -0x478(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x480(%rbp),%rax
movslq -0x34(%rbp),%rcx
cvttsd2si (%rax,%rcx,8),%edx
mov    0x20(%rbp),%eax
mov    -0x488(%rbp),%rcx
movslq -0x34(%rbp),%rsi
cvttsd2si (%rcx,%rsi,8),%ecx
mov    0x28(%rbp),%esi
mov    -0x490(%rbp),%rdi
movslq -0x34(%rbp),%r8
cvttsd2si (%rdi,%r8,8),%edi
imul   %edi,%esi
add    %esi,%ecx
imul   %ecx,%eax
add    %eax,%edx
mov    -0x498(%rbp),%rax
movslq -0x34(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    12a7 <reg_ev+0x127>
mov    -0x4a0(%rbp),%rdi
mov    -0x498(%rbp),%rsi
mov    0x38(%rbp),%edx
mov    $0x0,%al
call   10a0 <int_argsort@plt>
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    0x38(%rbp),%eax
jge    1616 <reg_ev+0x496>
mov    -0x4a0(%rbp),%rax
movslq -0x34(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x38(%rbp),%eax
mov    -0x498(%rbp),%rcx
movslq -0x3c(%rbp),%rdx
cmp    (%rcx,%rdx,4),%eax
je     15b9 <reg_ev+0x439>
mov    -0x498(%rbp),%rax
movslq -0x3c(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x38(%rbp)
lea    -0x460(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x480(%rbp),%rax
movslq -0x34(%rbp),%rcx
cvttsd2si (%rax,%rcx,8),%edx
mov    -0x488(%rbp),%rax
movslq -0x34(%rbp),%rcx
cvttsd2si (%rax,%rcx,8),%ecx
mov    -0x490(%rbp),%rax
movslq -0x34(%rbp),%r8
cvttsd2si (%rax,%r8,8),%r8d
mov    0x20(%rbp),%r9d
mov    0x28(%rbp),%r10d
mov    0x30(%rbp),%eax
mov    %r10d,(%rsp)
mov    %eax,0x8(%rsp)
mov    $0x0,%al
call   1050 <voxel@plt>
lea    -0x260(%rbp),%rdi
lea    -0x460(%rbp),%rsi
mov    $0x0,%al
call   1070 <tricubic_get_coeff_stacked@plt>
lea    -0x260(%rbp),%rdi
mov    -0x468(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x470(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x478(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    $0x3,%al
call   1060 <tricubic_eval@plt>
cvtsi2sd %eax,%xmm0
mov    -0x8(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1509 <reg_ev+0x389>
mov    -0x468(%rbp),%rdi
call   1030 <free@plt>
mov    -0x470(%rbp),%rdi
call   1030 <free@plt>
mov    -0x478(%rbp),%rdi
call   1030 <free@plt>
mov    -0x498(%rbp),%rdi
call   1030 <free@plt>
mov    -0x4a0(%rbp),%rdi
call   1030 <free@plt>
mov    -0x480(%rbp),%rdi
call   1030 <free@plt>
mov    -0x488(%rbp),%rdi
call   1030 <free@plt>
mov    -0x490(%rbp),%rdi
call   1030 <free@plt>
add    $0x4b0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<reg_ev>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x4b8,%rsp
mov    %r9,%r14
mov    %r8,0x60(%rsp)
mov    %rcx,0xa8(%rsp)
mov    %rdx,0xa0(%rsp)
mov    %rsi,0x98(%rsp)
mov    %rdi,%r13
movslq 0x518(%rsp),%rbp
lea    0x0(,%rbp,8),%rbx
mov    %rbx,%rdi
call   1090 <malloc@plt>
mov    %rax,0x38(%rsp)
mov    %rbx,%rdi
call   1090 <malloc@plt>
mov    %rax,0x30(%rsp)
mov    %rbx,%rdi
call   1090 <malloc@plt>
mov    %rax,0x28(%rsp)
mov    %rbx,%rdi
call   1090 <malloc@plt>
mov    %rax,0x20(%rsp)
mov    %rbx,%rdi
call   1090 <malloc@plt>
mov    %rax,0x18(%rsp)
mov    %rbx,%rdi
call   1090 <malloc@plt>
mov    %rax,0x10(%rsp)
lea    0x0(,%rbp,4),%r12
mov    %r12,%rdi
call   1090 <malloc@plt>
mov    %rax,%r15
mov    %r12,%rdi
call   1090 <malloc@plt>
mov    %rax,%rbx
test   %rbp,%rbp
mov    %r15,0x8(%rsp)
jle    1540 <reg_ev+0x3c0>
mov    %rbx,0x40(%rsp)
mov    %r13,0x58(%rsp)
mov    0x4f8(%rsp),%rax
mov    0x4f0(%rsp),%rcx
movsd  (%r14),%xmm3
movsd  0x8(%rcx),%xmm1
subsd  (%rcx),%xmm1
movsd  %xmm1,0x90(%rsp)
mov    %r14,0x70(%rsp)
movsd  0x8(%r14),%xmm1
movsd  0x8(%rax),%xmm2
subsd  (%rax),%xmm2
movsd  %xmm2,0x80(%rsp)
subsd  %xmm3,%xmm1
movsd  %xmm1,0x88(%rsp)
mov    %rbp,0x50(%rsp)
mov    %ebp,%eax
mov    %rax,0x68(%rsp)
lea    -0x8(,%rax,8),%rax
ff
mov    %rax,0x78(%rsp)
xor    %ebp,%ebp
mov    %r15,0x48(%rsp)
mov    0x18(%rsp),%r15
xchg   %ax,%ax
mov    0x98(%rsp),%rax
movsd  (%rax,%rbp,1),%xmm0
subsd  %xmm3,%xmm0
divsd  0x88(%rsp),%xmm0
movsd  %xmm0,(%rsp)
mov    0x20(%rsp),%rbx
lea    (%rbx,%rbp,1),%rdi
call   1080 <modf@plt>
cvttsd2si (%rbx,%rbp,1),%edi
mov    0x500(%rsp),%esi
xor    %eax,%eax
call   1040 <clip@plt>
mov    %eax,%r12d
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  %xmm0,(%rbx,%rbp,1)
movsd  (%rsp),%xmm1
subsd  %xmm0,%xmm1
mov    0x38(%rsp),%rax
movsd  %xmm1,(%rax,%rbp,1)
mov    0xa0(%rsp),%rax
movsd  (%rax,%rbp,1),%xmm0
mov    0x4f0(%rsp),%rax
subsd  (%rax),%xmm0
divsd  0x90(%rsp),%xmm0
movsd  %xmm0,(%rsp)
lea    (%r15,%rbp,1),%rdi
call   1080 <modf@plt>
cvttsd2si (%r15,%rbp,1),%edi
mov    0x508(%rsp),%r14d
mov    %r14d,%esi
xor    %eax,%eax
call   1040 <clip@plt>
mov    %eax,%r13d
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  %xmm0,(%r15,%rbp,1)
movsd  (%rsp),%xmm1
subsd  %xmm0,%xmm1
mov    0x30(%rsp),%rax
movsd  %xmm1,(%rax,%rbp,1)
mov    0xa8(%rsp),%rax
movsd  (%rax,%rbp,1),%xmm0
mov    0x4f8(%rsp),%rax
subsd  (%rax),%xmm0
divsd  0x80(%rsp),%xmm0
movsd  %xmm0,(%rsp)
mov    0x10(%rsp),%rbx
lea    (%rbx,%rbp,1),%rdi
call   1080 <modf@plt>
cvttsd2si (%rbx,%rbp,1),%edi
mov    0x510(%rsp),%esi
xor    %eax,%eax
call   1040 <clip@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  %xmm0,(%rbx,%rbp,1)
movsd  (%rsp),%xmm1
subsd  %xmm0,%xmm1
mov    0x28(%rsp),%rcx
movsd  %xmm1,(%rcx,%rbp,1)
imul   %r14d,%eax
add    %r13d,%eax
imul   0x500(%rsp),%eax
add    %r12d,%eax
mov    0x48(%rsp),%rcx
mov    %eax,(%rcx)
cmp    %rbp,0x78(%rsp)
je     142f <reg_ev+0x2af>
mov    0x70(%rsp),%rax
movsd  (%rax),%xmm3
add    $0x4,%rcx
mov    %rcx,0x48(%rsp)
add    $0x8,%rbp
jmp    12c0 <reg_ev+0x140>
mov    0x40(%rsp),%rbx
mov    %rbx,%rdi
mov    0x8(%rsp),%rsi
mov    0x50(%rsp),%rbp
mov    %ebp,%edx
xor    %eax,%eax
call   10a0 <int_argsort@plt>
test   %ebp,%ebp
mov    0x58(%rsp),%r13
jle    154f <reg_ev+0x3cf>
mov    $0xffffffff,%r14d
xor    %ebp,%ebp
jmp    14c2 <reg_ev+0x342>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    0x38(%rsp),%rax
movsd  (%rax,%r15,8),%xmm0
mov    0x30(%rsp),%rax
movsd  (%rax,%r15,8),%xmm1
mov    0x28(%rsp),%rax
movsd  (%rax,%r15,8),%xmm2
lea    0xb0(%rsp),%rdi
mov    $0x3,%al
call   1060 <tricubic_eval@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  %xmm0,0x0(%r13,%r15,8)
add    $0x1,%rbp
cmp    %rbp,0x68(%rsp)
mov    0x40(%rsp),%rbx
je     154f <reg_ev+0x3cf>
movslq (%rbx,%rbp,4),%r15
mov    0x8(%rsp),%rax
mov    (%rax,%r15,4),%r12d
cmp    %r12d,%r14d
je     1470 <reg_ev+0x2f0>
mov    0x20(%rsp),%rax
cvttsd2si (%rax,%rbp,8),%edx
mov    0x18(%rsp),%rax
cvttsd2si (%rax,%rbp,8),%ecx
mov    0x10(%rsp),%rax
cvttsd2si (%rax,%rbp,8),%r8d
lea    0x2b0(%rsp),%r14
mov    %r14,%rdi
mov    0x60(%rsp),%rsi
mov    0x500(%rsp),%r9d
xor    %eax,%eax
mov    0x510(%rsp),%ebx
push   %rbx
mov    0x510(%rsp),%ebx
push   %rbx
call   1050 <voxel@plt>
add    $0x10,%rsp
lea    0xb0(%rsp),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1070 <tricubic_get_coeff_stacked@plt>
mov    %r12d,%r14d
jmp    1470 <reg_ev+0x2f0>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %ebp,%edx
xor    %eax,%eax
call   10a0 <int_argsort@plt>
mov    0x38(%rsp),%rdi
call   1030 <free@plt>
mov    0x30(%rsp),%rdi
call   1030 <free@plt>
mov    0x28(%rsp),%rdi
call   1030 <free@plt>
mov    0x8(%rsp),%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    0x20(%rsp),%rdi
call   1030 <free@plt>
mov    0x18(%rsp),%rdi
call   1030 <free@plt>
mov    0x10(%rsp),%rdi
call   1030 <free@plt>
add    $0x4b8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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