void project_map_lattice(double **outmap, unsigned ref_extx, unsigned ref_exty,
                         unsigned ref_extz, double ref_origx, double ref_origy,
                         double ref_origz, double ref_widthx, double ref_widthy,
                         double ref_widthz, double *inmap, unsigned in_extx,
                         unsigned in_exty, unsigned in_extz, double in_origx,
                         double in_origy, double in_origz, double in_widthx,
                         double in_widthy, double in_widthz) {
  double deltax, deltay, deltaz;
  unsigned long out_nvox;
  unsigned indx, indy, indz;
  double xpos, ypos, zpos, gx, gy, gz, a, b, c;
  int x0, y0, z0, x1, y1, z1;
  if (ref_extx < 2 || ref_exty < 2 || ref_extz < 2) {
    error_underflow(17010, "lib_vwk");
  }
  deltax = ref_origx - in_origx;
  deltay = ref_origy - in_origy;
  deltaz = ref_origz - in_origz;
  out_nvox = (ref_extx) * (ref_exty) * (ref_extz);
  do_vect(outmap, out_nvox);
  for (indz = 0; indz < ref_extz; indz++)
    for (indy = 0; indy < ref_exty; indy++)
      for (indx = 0; indx < ref_extx; indx++) {
        xpos = deltax + indx * ref_widthx;
        ypos = deltay + indy * ref_widthy;
        zpos = deltaz + indz * ref_widthz;
        gx = (xpos / in_widthx);
        gy = (ypos / in_widthy);
        gz = (zpos / in_widthz);
        x0 = (int)floor(gx);
        y0 = (int)floor(gy);
        z0 = (int)floor(gz);
        x1 = (int)ceil(gx);
        y1 = (int)ceil(gy);
        z1 = (int)ceil(gz);
        if (x0 >= 0 && x1 < (int)in_extx && y0 >= 0 && y1 < (int)in_exty &&
            z0 >= 0 && z1 < (int)in_extz) {
          a = gx - x0;
          b = gy - y0;
          c = gz - z0;
          *(*outmap + gidz_general(indz, indy, indx, ref_exty, ref_extx)) =
              a * b * c *
                  *(inmap + gidz_general(z1, y1, x1, in_exty, in_extx)) +
              (1 - a) * b * c *
                  *(inmap + gidz_general(z1, y1, x0, in_exty, in_extx)) +
              a * (1 - b) * c *
                  *(inmap + gidz_general(z1, y0, x1, in_exty, in_extx)) +
              a * b * (1 - c) *
                  *(inmap + gidz_general(z0, y1, x1, in_exty, in_extx)) +
              a * (1 - b) * (1 - c) *
                  *(inmap + gidz_general(z0, y0, x1, in_exty, in_extx)) +
              (1 - a) * b * (1 - c) *
                  *(inmap + gidz_general(z0, y1, x0, in_exty, in_extx)) +
              (1 - a) * (1 - b) * c *
                  *(inmap + gidz_general(z1, y0, x0, in_exty, in_extx)) +
              (1 - a) * (1 - b) * (1 - c) *
                  *(inmap + gidz_general(z0, y0, x0, in_exty, in_extx));
        }
      }
  if (in_extx != ref_extx || in_exty != ref_exty || in_extz != ref_extz)
    printf("lib_vwk> %d x %d x %d map projected to %d x %d x %d lattice.\n",
           in_extx, in_exty, in_extz, ref_extx, ref_exty, ref_extz);
  if (in_widthx != ref_widthx || in_widthy != ref_widthy ||
      in_widthz != ref_widthz)
    printf("lib_vwk> Voxel spacings interpolated from (%.3f,%.3f,%.3f) to "
           "(%.3f,%.3f,%.3f).\n",
           in_widthx, in_widthy, in_widthz, ref_widthx, ref_widthy, ref_widthz);
  if (deltax != 0.0 || deltay != 0.0 || deltaz != 0.0)
    printf("lib_vwk> New map origin (coord of first voxel): (%.3f,%.3f,%.3f)\n",
           ref_origx, ref_origy, ref_origz);
}


x86 assembly (clang, -O0):
<project_map_lattice>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1d0,%rsp
movsd  0x38(%rbp),%xmm8
movsd  0x30(%rbp),%xmm8
movsd  0x28(%rbp),%xmm8
movsd  0x20(%rbp),%xmm8
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%eax
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
movsd  %xmm0,-0x20(%rbp)
movsd  %xmm1,-0x28(%rbp)
movsd  %xmm2,-0x30(%rbp)
movsd  %xmm3,-0x38(%rbp)
movsd  %xmm4,-0x40(%rbp)
movsd  %xmm5,-0x48(%rbp)
mov    %r8,-0x50(%rbp)
mov    %r9d,-0x54(%rbp)
movsd  %xmm6,-0x60(%rbp)
movsd  %xmm7,-0x68(%rbp)
cmpl   $0x2,-0xc(%rbp)
jb     11e4 <project_map_lattice+0x84>
cmpl   $0x2,-0x10(%rbp)
jb     11e4 <project_map_lattice+0x84>
cmpl   $0x2,-0x14(%rbp)
jae    11f7 <project_map_lattice+0x97>
mov    $0x4272,%edi
lea    0xe18(%rip),%rsi
mov    $0x0,%al
call   1070 <error_underflow@plt>
movsd  -0x20(%rbp),%xmm0
subsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x28(%rbp),%xmm0
subsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x30(%rbp),%xmm0
subsd  0x20(%rbp),%xmm0
movsd  %xmm0,-0x80(%rbp)
mov    -0xc(%rbp),%eax
imul   -0x10(%rbp),%eax
imul   -0x14(%rbp),%eax
mov    %eax,%eax
mov    %rax,-0x88(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x88(%rbp),%rsi
mov    $0x0,%al
call   1060 <do_vect@plt>
movl   $0x0,-0x94(%rbp)
mov    -0x94(%rbp),%eax
cmp    -0x14(%rbp),%eax
jae    1957 <project_map_lattice+0x7f7>
movl   $0x0,-0x90(%rbp)
mov    -0x90(%rbp),%eax
cmp    -0x10(%rbp),%eax
jae    193e <project_map_lattice+0x7de>
movl   $0x0,-0x8c(%rbp)
mov    -0x8c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jae    1925 <project_map_lattice+0x7c5>
movsd  -0x70(%rbp),%xmm1
mov    -0x8c(%rbp),%eax
cvtsi2sd %rax,%xmm0
movsd  -0x38(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  -0x78(%rbp),%xmm1
mov    -0x90(%rbp),%eax
cvtsi2sd %rax,%xmm0
movsd  -0x40(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
movsd  -0x80(%rbp),%xmm1
mov    -0x94(%rbp),%eax
cvtsi2sd %rax,%xmm0
movsd  -0x48(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0xb0(%rbp)
ff
movsd  -0xa0(%rbp),%xmm0
ff
divsd  0x28(%rbp),%xmm0
movsd  %xmm0,-0xb8(%rbp)
ff
movsd  -0xa8(%rbp),%xmm0
ff
divsd  0x30(%rbp),%xmm0
movsd  %xmm0,-0xc0(%rbp)
ff
movsd  -0xb0(%rbp),%xmm0
ff
divsd  0x38(%rbp),%xmm0
movsd  %xmm0,-0xc8(%rbp)
ff
movsd  -0xb8(%rbp),%xmm0
ff
call   1080 <floor@plt>
cvttsd2si %xmm0,%eax
mov    %eax,-0xe4(%rbp)
movsd  -0xc0(%rbp),%xmm0
ff
call   1080 <floor@plt>
cvttsd2si %xmm0,%eax
mov    %eax,-0xe8(%rbp)
movsd  -0xc8(%rbp),%xmm0
ff
call   1080 <floor@plt>
cvttsd2si %xmm0,%eax
mov    %eax,-0xec(%rbp)
movsd  -0xb8(%rbp),%xmm0
ff
call   1030 <ceil@plt>
cvttsd2si %xmm0,%eax
mov    %eax,-0xf0(%rbp)
movsd  -0xc0(%rbp),%xmm0
ff
call   1030 <ceil@plt>
cvttsd2si %xmm0,%eax
mov    %eax,-0xf4(%rbp)
movsd  -0xc8(%rbp),%xmm0
ff
call   1030 <ceil@plt>
cvttsd2si %xmm0,%eax
mov    %eax,-0xf8(%rbp)
cmpl   $0x0,-0xe4(%rbp)
jl     190c <project_map_lattice+0x7ac>
mov    -0xf0(%rbp),%eax
cmp    -0x54(%rbp),%eax
jge    190c <project_map_lattice+0x7ac>
cmpl   $0x0,-0xe8(%rbp)
jl     190c <project_map_lattice+0x7ac>
mov    -0xf4(%rbp),%eax
cmp    0x10(%rbp),%eax
jge    190c <project_map_lattice+0x7ac>
cmpl   $0x0,-0xec(%rbp)
jl     190c <project_map_lattice+0x7ac>
mov    -0xf8(%rbp),%eax
cmp    0x18(%rbp),%eax
jge    190c <project_map_lattice+0x7ac>
movsd  -0xb8(%rbp),%xmm0
ff
cvtsi2sdl -0xe4(%rbp),%xmm1
ff
subsd  %xmm1,%xmm0
movsd  %xmm0,-0xd0(%rbp)
ff
movsd  -0xc0(%rbp),%xmm0
ff
cvtsi2sdl -0xe8(%rbp),%xmm1
ff
subsd  %xmm1,%xmm0
movsd  %xmm0,-0xd8(%rbp)
ff
movsd  -0xc8(%rbp),%xmm0
ff
cvtsi2sdl -0xec(%rbp),%xmm1
ff
subsd  %xmm1,%xmm0
movsd  %xmm0,-0xe0(%rbp)
ff
movsd  -0xd0(%rbp),%xmm0
ff
mulsd  -0xd8(%rbp),%xmm0
ff
mulsd  -0xe0(%rbp),%xmm0
ff
movsd  %xmm0,-0x1b0(%rbp)
ff
mov    -0x50(%rbp),%rax
mov    %rax,-0x1c0(%rbp)
mov    -0xf8(%rbp),%edi
mov    -0xf4(%rbp),%esi
mov    -0xf0(%rbp),%edx
mov    0x10(%rbp),%ecx
mov    -0x54(%rbp),%r8d
mov    $0x0,%al
call   1050 <gidz_general@plt>
mov    %eax,%ecx
mov    -0x1c0(%rbp),%rax
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x1a8(%rbp)
ff
movsd  0xb1f(%rip),%xmm0
subsd  -0xd0(%rbp),%xmm0
ff
mulsd  -0xd8(%rbp),%xmm0
ff
mulsd  -0xe0(%rbp),%xmm0
ff
movsd  %xmm0,-0x1b8(%rbp)
mov    -0x50(%rbp),%rax
mov    %rax,-0x1a0(%rbp)
mov    -0xf8(%rbp),%edi
mov    -0xf4(%rbp),%esi
mov    -0xe4(%rbp),%edx
mov    0x10(%rbp),%ecx
mov    -0x54(%rbp),%r8d
mov    $0x0,%al
call   1050 <gidz_general@plt>
movsd  -0x1b8(%rbp),%xmm1
ff
movsd  -0x1b0(%rbp),%xmm0
ff
movsd  -0x1a8(%rbp),%xmm2
ff
mov    %eax,%ecx
mov    -0x1a0(%rbp),%rax
movslq %ecx,%rcx
mulsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x190(%rbp)
ff
movsd  -0xd0(%rbp),%xmm0
ff
movsd  0xa8b(%rip),%xmm1
subsd  -0xd8(%rbp),%xmm1
ff
mulsd  %xmm1,%xmm0
mulsd  -0xe0(%rbp),%xmm0
ff
movsd  %xmm0,-0x198(%rbp)
ff
mov    -0x50(%rbp),%rax
mov    %rax,-0x188(%rbp)
mov    -0xf8(%rbp),%edi
mov    -0xe8(%rbp),%esi
mov    -0xf0(%rbp),%edx
mov    0x10(%rbp),%ecx
mov    -0x54(%rbp),%r8d
mov    $0x0,%al
call   1050 <gidz_general@plt>
movsd  -0x198(%rbp),%xmm0
ff
movsd  -0x190(%rbp),%xmm1
ff
mov    %eax,%ecx
mov    -0x188(%rbp),%rax
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x178(%rbp)
ff
movsd  -0xd0(%rbp),%xmm0
ff
mulsd  -0xd8(%rbp),%xmm0
ff
movsd  0x9fb(%rip),%xmm1
subsd  -0xe0(%rbp),%xmm1
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x180(%rbp)
ff
mov    -0x50(%rbp),%rax
mov    %rax,-0x170(%rbp)
mov    -0xec(%rbp),%edi
mov    -0xf4(%rbp),%esi
mov    -0xf0(%rbp),%edx
mov    0x10(%rbp),%ecx
mov    -0x54(%rbp),%r8d
mov    $0x0,%al
call   1050 <gidz_general@plt>
movsd  -0x180(%rbp),%xmm0
ff
movsd  -0x178(%rbp),%xmm1
ff
mov    %eax,%ecx
mov    -0x170(%rbp),%rax
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x160(%rbp)
ff
movsd  -0xd0(%rbp),%xmm0
ff
movsd  0x97b(%rip),%xmm1
subsd  -0xd8(%rbp),%xmm1
ff
mulsd  %xmm1,%xmm0
movsd  0x967(%rip),%xmm1
subsd  -0xe0(%rbp),%xmm1
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x168(%rbp)
ff
mov    -0x50(%rbp),%rax
mov    %rax,-0x158(%rbp)
mov    -0xec(%rbp),%edi
mov    -0xe8(%rbp),%esi
mov    -0xf0(%rbp),%edx
mov    0x10(%rbp),%ecx
mov    -0x54(%rbp),%r8d
mov    $0x0,%al
call   1050 <gidz_general@plt>
movsd  -0x168(%rbp),%xmm0
ff
movsd  -0x160(%rbp),%xmm1
ff
mov    %eax,%ecx
mov    -0x158(%rbp),%rax
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x148(%rbp)
ff
movsd  0x8ef(%rip),%xmm0
subsd  -0xd0(%rbp),%xmm0
ff
mulsd  -0xd8(%rbp),%xmm0
ff
movsd  0x8d7(%rip),%xmm1
subsd  -0xe0(%rbp),%xmm1
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x150(%rbp)
ff
mov    -0x50(%rbp),%rax
mov    %rax,-0x140(%rbp)
mov    -0xec(%rbp),%edi
mov    -0xf4(%rbp),%esi
mov    -0xe4(%rbp),%edx
mov    0x10(%rbp),%ecx
mov    -0x54(%rbp),%r8d
mov    $0x0,%al
call   1050 <gidz_general@plt>
movsd  -0x150(%rbp),%xmm0
ff
movsd  -0x148(%rbp),%xmm1
ff
mov    %eax,%ecx
mov    -0x140(%rbp),%rax
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x130(%rbp)
ff
movsd  0x85f(%rip),%xmm0
subsd  -0xd0(%rbp),%xmm0
ff
movsd  0x84f(%rip),%xmm1
subsd  -0xd8(%rbp),%xmm1
ff
mulsd  %xmm1,%xmm0
mulsd  -0xe0(%rbp),%xmm0
ff
movsd  %xmm0,-0x138(%rbp)
ff
mov    -0x50(%rbp),%rax
mov    %rax,-0x128(%rbp)
mov    -0xf8(%rbp),%edi
mov    -0xe8(%rbp),%esi
mov    -0xe4(%rbp),%edx
mov    0x10(%rbp),%ecx
mov    -0x54(%rbp),%r8d
mov    $0x0,%al
call   1050 <gidz_general@plt>
movsd  -0x138(%rbp),%xmm0
ff
movsd  -0x130(%rbp),%xmm1
ff
mov    %eax,%ecx
mov    -0x128(%rbp),%rax
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x118(%rbp)
ff
movsd  0x7cf(%rip),%xmm0
subsd  -0xd0(%rbp),%xmm0
ff
movsd  0x7bf(%rip),%xmm1
subsd  -0xd8(%rbp),%xmm1
ff
mulsd  %xmm1,%xmm0
movsd  0x7ab(%rip),%xmm1
subsd  -0xe0(%rbp),%xmm1
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x120(%rbp)
ff
mov    -0x50(%rbp),%rax
mov    %rax,-0x110(%rbp)
mov    -0xec(%rbp),%edi
mov    -0xe8(%rbp),%esi
mov    -0xe4(%rbp),%edx
mov    0x10(%rbp),%ecx
mov    -0x54(%rbp),%r8d
mov    $0x0,%al
call   1050 <gidz_general@plt>
movsd  -0x120(%rbp),%xmm0
ff
movsd  -0x118(%rbp),%xmm1
ff
mov    %eax,%ecx
mov    -0x110(%rbp),%rax
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x108(%rbp)
ff
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x100(%rbp)
mov    -0x94(%rbp),%edi
mov    -0x90(%rbp),%esi
mov    -0x8c(%rbp),%edx
mov    -0x10(%rbp),%ecx
mov    -0xc(%rbp),%r8d
mov    $0x0,%al
call   1050 <gidz_general@plt>
movsd  -0x108(%rbp),%xmm0
ff
mov    %eax,%ecx
mov    -0x100(%rbp),%rax
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
jmp    1911 <project_map_lattice+0x7b1>
mov    -0x8c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8c(%rbp)
jmp    1286 <project_map_lattice+0x126>
jmp    192a <project_map_lattice+0x7ca>
mov    -0x90(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x90(%rbp)
jmp    126d <project_map_lattice+0x10d>
jmp    1943 <project_map_lattice+0x7e3>
mov    -0x94(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x94(%rbp)
jmp    1254 <project_map_lattice+0xf4>
mov    -0x54(%rbp),%eax
cmp    -0xc(%rbp),%eax
jne    197b <project_map_lattice+0x81b>
mov    0x10(%rbp),%eax
cmp    -0x10(%rbp),%eax
jne    197b <project_map_lattice+0x81b>
mov    0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
je     19a0 <project_map_lattice+0x840>
mov    -0x54(%rbp),%esi
mov    0x10(%rbp),%edx
mov    0x18(%rbp),%ecx
mov    -0xc(%rbp),%r8d
mov    -0x10(%rbp),%r9d
mov    -0x14(%rbp),%eax
lea    0x67a(%rip),%rdi
mov    %eax,(%rsp)
mov    $0x0,%al
call   1040 <printf@plt>
movsd  0x28(%rbp),%xmm0
ucomisd -0x38(%rbp),%xmm0
jne    19e7 <project_map_lattice+0x887>
jp     19e7 <project_map_lattice+0x887>
movsd  0x30(%rbp),%xmm0
ucomisd -0x40(%rbp),%xmm0
jne    19e7 <project_map_lattice+0x887>
jp     19e7 <project_map_lattice+0x887>
movsd  0x38(%rbp),%xmm0
ucomisd -0x48(%rbp),%xmm0
jne    19e7 <project_map_lattice+0x887>
jp     19e7 <project_map_lattice+0x887>
jmp    1a13 <project_map_lattice+0x8b3>
movsd  0x28(%rbp),%xmm0
movsd  0x30(%rbp),%xmm1
movsd  0x38(%rbp),%xmm2
movsd  -0x38(%rbp),%xmm3
movsd  -0x40(%rbp),%xmm4
movsd  -0x48(%rbp),%xmm5
lea    0x642(%rip),%rdi
mov    $0x6,%al
call   1040 <printf@plt>
movsd  -0x70(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1a60 <project_map_lattice+0x900>
jp     1a60 <project_map_lattice+0x900>
movsd  -0x78(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1a60 <project_map_lattice+0x900>
jp     1a60 <project_map_lattice+0x900>
movsd  -0x80(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1a60 <project_map_lattice+0x900>
jp     1a60 <project_map_lattice+0x900>
jmp    1a7d <project_map_lattice+0x91d>
movsd  -0x20(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
movsd  -0x30(%rbp),%xmm2
lea    0x629(%rip),%rdi
mov    $0x3,%al
call   1040 <printf@plt>
add    $0x1d0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<project_map_lattice>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x138,%rsp
mov    %r9d,%r15d
mov    %r8,0xc8(%rsp)
movsd  %xmm5,0xa0(%rsp)
movsd  %xmm4,0xb8(%rsp)
movsd  %xmm3,0xd8(%rsp)
movsd  %xmm2,0x108(%rsp)
movsd  %xmm1,0x100(%rsp)
movsd  %xmm0,0xf8(%rsp)
mov    %ecx,0x1c(%rsp)
mov    %edx,0x14(%rsp)
mov    %rdi,0x120(%rsp)
movsd  0x198(%rsp),%xmm0
movsd  %xmm0,0x98(%rsp)
movsd  0x190(%rsp),%xmm0
movsd  %xmm0,0xb0(%rsp)
movsd  0x188(%rsp),%xmm0
movsd  %xmm0,0xd0(%rsp)
movsd  0x180(%rsp),%xmm1
mov    0x178(%rsp),%eax
mov    %eax,0x60(%rsp)
mov    0x170(%rsp),%eax
mov    %eax,0x40(%rsp)
mov    %esi,0x18(%rsp)
cmp    $0x2,%esi
jb     122e <project_map_lattice+0xce>
cmpl   $0x2,0x14(%rsp)
jb     122e <project_map_lattice+0xce>
cmpl   $0x1,0x1c(%rsp)
ja     126b <project_map_lattice+0x10b>
lea    0xdd3(%rip),%rsi
mov    $0x4272,%edi
xor    %eax,%eax
movsd  %xmm7,0x20(%rsp)
movsd  %xmm6,0x38(%rsp)
movsd  %xmm1,0xe8(%rsp)
call   1070 <error_underflow@plt>
movsd  0xe8(%rsp),%xmm1
movsd  0x38(%rsp),%xmm6
movsd  0x20(%rsp),%xmm7
movsd  0xf8(%rsp),%xmm0
subsd  %xmm6,%xmm0
movsd  %xmm0,0x130(%rsp)
movsd  0x100(%rsp),%xmm0
subsd  %xmm7,%xmm0
movsd  %xmm0,0x118(%rsp)
movsd  0x108(%rsp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,0x110(%rsp)
mov    0x14(%rsp),%eax
mov    %eax,%esi
imul   0x18(%rsp),%esi
mov    0x1c(%rsp),%r14d
imul   %r14d,%esi
mov    0x120(%rsp),%rdi
xor    %eax,%eax
call   1060 <do_vect@plt>
test   %r14d,%r14d
je     183a <project_map_lattice+0x6da>
xorpd  %xmm0,%xmm0
movsd  %xmm0,0xa8(%rsp)
movl   $0x0,0x58(%rsp)
jmp    131f <project_map_lattice+0x1bf>
movsd  0xa8(%rsp),%xmm0
addsd  0xcff(%rip),%xmm0
movsd  %xmm0,0xa8(%rsp)
mov    0x58(%rsp),%eax
add    $0x1,%eax
mov    %eax,0x58(%rsp)
cmp    0x1c(%rsp),%eax
je     183a <project_map_lattice+0x6da>
cmpl   $0x0,0x14(%rsp)
je     12f0 <project_map_lattice+0x190>
movsd  0xa8(%rsp),%xmm0
mulsd  0xa0(%rsp),%xmm0
addsd  0x110(%rsp),%xmm0
divsd  0x98(%rsp),%xmm0
movsd  %xmm0,0x50(%rsp)
call   1080 <floor@plt>
movapd %xmm0,0x20(%rsp)
cvttsd2si %xmm0,%eax
mov    %eax,0x68(%rsp)
movsd  0x50(%rsp),%xmm0
call   1030 <ceil@plt>
cvttsd2si %xmm0,%eax
mov    %eax,0x64(%rsp)
cvttpd2dq 0x20(%rsp),%xmm0
cvtdq2pd %xmm0,%xmm0
movsd  0x50(%rsp),%xmm1
subsd  %xmm0,%xmm1
movsd  0xc6e(%rip),%xmm0
movsd  %xmm1,0x50(%rsp)
subsd  %xmm1,%xmm0
movsd  %xmm0,0x90(%rsp)
movl   $0x0,0x5c(%rsp)
xorpd  %xmm0,%xmm0
movsd  %xmm0,0xc0(%rsp)
jmp    13ef <project_map_lattice+0x28f>
nopl   0x0(%rax)
movsd  0xc0(%rsp),%xmm0
addsd  0xc2f(%rip),%xmm0
movsd  %xmm0,0xc0(%rsp)
mov    0x5c(%rsp),%eax
add    $0x1,%eax
mov    %eax,0x5c(%rsp)
cmp    0x14(%rsp),%eax
je     12f0 <project_map_lattice+0x190>
cmpl   $0x0,0x18(%rsp)
je     13c0 <project_map_lattice+0x260>
movsd  0xc0(%rsp),%xmm0
mulsd  0xb8(%rsp),%xmm0
addsd  0x118(%rsp),%xmm0
divsd  0xb0(%rsp),%xmm0
movsd  %xmm0,0x70(%rsp)
call   1080 <floor@plt>
movapd %xmm0,0x20(%rsp)
cvttsd2si %xmm0,%eax
mov    %eax,0x6c(%rsp)
movsd  0x70(%rsp),%xmm0
call   1030 <ceil@plt>
cvttsd2si %xmm0,%eax
mov    %eax,0x44(%rsp)
cvttpd2dq 0x20(%rsp),%xmm0
cvtdq2pd %xmm0,%xmm0
movsd  0x70(%rsp),%xmm1
subsd  %xmm0,%xmm1
movsd  0xb9e(%rip),%xmm0
movsd  %xmm1,0x70(%rsp)
subsd  %xmm1,%xmm0
movsd  %xmm0,0x128(%rsp)
xor    %r14d,%r14d
xorpd  %xmm0,%xmm0
jmp    14a0 <project_map_lattice+0x340>
xchg   %ax,%ax
movsd  0xe8(%rsp),%xmm0
addsd  0xb6f(%rip),%xmm0
add    $0x1,%r14d
cmp    %r14d,0x18(%rsp)
je     13c0 <project_map_lattice+0x260>
movsd  %xmm0,0xe8(%rsp)
mulsd  0xd8(%rsp),%xmm0
addsd  0x130(%rsp),%xmm0
divsd  0xd0(%rsp),%xmm0
movsd  %xmm0,0x20(%rsp)
call   1080 <floor@plt>
cvttsd2si %xmm0,%ebp
movsd  0x20(%rsp),%xmm0
call   1030 <ceil@plt>
test   %ebp,%ebp
js     1480 <project_map_lattice+0x320>
cvttsd2si %xmm0,%ecx
cmp    %r15d,%ecx
jge    1480 <project_map_lattice+0x320>
cmpl   $0x0,0x6c(%rsp)
js     1480 <project_map_lattice+0x320>
mov    0x40(%rsp),%eax
cmp    %eax,0x44(%rsp)
jge    1480 <project_map_lattice+0x320>
cmpl   $0x0,0x68(%rsp)
js     1480 <project_map_lattice+0x320>
mov    0x64(%rsp),%eax
cmp    0x60(%rsp),%eax
jge    1480 <project_map_lattice+0x320>
xorps  %xmm0,%xmm0
cvtsi2sd %ebp,%xmm0
movsd  0x20(%rsp),%xmm1
subsd  %xmm0,%xmm1
movsd  %xmm1,0x20(%rsp)
movsd  0x70(%rsp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,0x78(%rsp)
movsd  0x50(%rsp),%xmm1
mulsd  %xmm0,%xmm1
movsd  %xmm1,0x48(%rsp)
mov    0x64(%rsp),%r12d
mov    %r12d,%edi
mov    0x44(%rsp),%ebx
mov    %ebx,%esi
mov    %ecx,%edx
mov    %ecx,0x8c(%rsp)
mov    %ebp,0xf4(%rsp)
mov    0x40(%rsp),%r13d
mov    %r13d,%ecx
mov    %r15d,%r8d
xor    %eax,%eax
call   1050 <gidz_general@plt>
cltq
movsd  0xa7a(%rip),%xmm0
subsd  0x20(%rsp),%xmm0
movsd  %xmm0,0x38(%rsp)
movsd  0x70(%rsp),%xmm1
mulsd  %xmm0,%xmm1
movsd  %xmm1,0x80(%rsp)
movsd  0x50(%rsp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,0xe0(%rsp)
movsd  0x48(%rsp),%xmm0
mov    0xc8(%rsp),%rcx
mulsd  (%rcx,%rax,8),%xmm0
movsd  %xmm0,0x48(%rsp)
mov    %r12d,%edi
mov    %ebx,%esi
mov    %ebp,%edx
mov    %r13d,%ecx
mov    %r15d,%r8d
xor    %eax,%eax
call   1050 <gidz_general@plt>
cltq
mov    0xc8(%rsp),%rbp
movsd  0xe0(%rsp),%xmm0
mulsd  0x0(%rbp,%rax,8),%xmm0
addsd  0x48(%rsp),%xmm0
movsd  %xmm0,0xe0(%rsp)
movsd  0x20(%rsp),%xmm0
mulsd  0x128(%rsp),%xmm0
movsd  %xmm0,0x20(%rsp)
movsd  0x50(%rsp),%xmm1
mulsd  %xmm0,%xmm1
movsd  %xmm1,0x48(%rsp)
mov    %r12d,%edi
mov    0x6c(%rsp),%esi
mov    0x8c(%rsp),%ebx
mov    %ebx,%edx
mov    %r13d,%ecx
mov    %r15d,%r8d
xor    %eax,%eax
call   1050 <gidz_general@plt>
cltq
movsd  0x48(%rsp),%xmm0
mulsd  0x0(%rbp,%rax,8),%xmm0
addsd  0xe0(%rsp),%xmm0
movsd  %xmm0,0x48(%rsp)
movsd  0x78(%rsp),%xmm0
mulsd  0x90(%rsp),%xmm0
movsd  %xmm0,0x78(%rsp)
mov    %r13d,%r12d
mov    0x68(%rsp),%ebp
mov    %ebp,%edi
mov    0x44(%rsp),%esi
mov    %ebx,%edx
mov    %r13d,%ecx
mov    %r15d,%r8d
xor    %eax,%eax
call   1050 <gidz_general@plt>
cltq
movsd  0x78(%rsp),%xmm0
mov    0xc8(%rsp),%r13
mulsd  0x0(%r13,%rax,8),%xmm0
addsd  0x48(%rsp),%xmm0
movsd  %xmm0,0x78(%rsp)
movsd  0x20(%rsp),%xmm0
mulsd  0x90(%rsp),%xmm0
movsd  %xmm0,0x20(%rsp)
mov    %ebp,%edi
mov    0x6c(%rsp),%ebx
mov    %ebx,%esi
mov    0x8c(%rsp),%edx
mov    %r12d,%ecx
mov    %r15d,%r8d
xor    %eax,%eax
call   1050 <gidz_general@plt>
cltq
movsd  0x20(%rsp),%xmm0
mulsd  0x0(%r13,%rax,8),%xmm0
addsd  0x78(%rsp),%xmm0
movsd  %xmm0,0x20(%rsp)
movsd  0x80(%rsp),%xmm0
mulsd  0x90(%rsp),%xmm0
movsd  %xmm0,0x80(%rsp)
mov    %ebp,%edi
mov    0x44(%rsp),%esi
mov    0xf4(%rsp),%ebp
mov    %ebp,%edx
mov    %r12d,%ecx
mov    %r15d,%r8d
xor    %eax,%eax
call   1050 <gidz_general@plt>
cltq
movsd  0x80(%rsp),%xmm0
mulsd  0x0(%r13,%rax,8),%xmm0
addsd  0x20(%rsp),%xmm0
movsd  %xmm0,0x80(%rsp)
movsd  0x38(%rsp),%xmm0
mulsd  0x128(%rsp),%xmm0
movsd  %xmm0,0x38(%rsp)
movsd  0x50(%rsp),%xmm1
mulsd  %xmm0,%xmm1
movsd  %xmm1,0x20(%rsp)
mov    0x64(%rsp),%edi
mov    %ebx,%esi
mov    %ebp,%edx
mov    %r12d,%ecx
mov    %r15d,%r8d
xor    %eax,%eax
call   1050 <gidz_general@plt>
cltq
movsd  0x20(%rsp),%xmm0
mulsd  0x0(%r13,%rax,8),%xmm0
addsd  0x80(%rsp),%xmm0
movsd  %xmm0,0x20(%rsp)
movsd  0x38(%rsp),%xmm0
mulsd  0x90(%rsp),%xmm0
movsd  %xmm0,0x38(%rsp)
mov    0x68(%rsp),%edi
mov    %ebx,%esi
mov    %ebp,%edx
mov    %r12d,%ecx
mov    %r15d,%r8d
xor    %eax,%eax
call   1050 <gidz_general@plt>
cltq
movsd  0x38(%rsp),%xmm0
mulsd  0x0(%r13,%rax,8),%xmm0
addsd  0x20(%rsp),%xmm0
movsd  %xmm0,0x38(%rsp)
mov    0x120(%rsp),%rax
mov    (%rax),%rbp
mov    0x58(%rsp),%edi
mov    0x5c(%rsp),%esi
mov    %r14d,%edx
mov    0x14(%rsp),%ecx
mov    0x18(%rsp),%r8d
xor    %eax,%eax
call   1050 <gidz_general@plt>
cltq
movsd  0x38(%rsp),%xmm0
movsd  %xmm0,0x0(%rbp,%rax,8)
jmp    1480 <project_map_lattice+0x320>
cmp    0x18(%rsp),%r15d
jne    1855 <project_map_lattice+0x6f5>
mov    0x40(%rsp),%eax
cmp    0x14(%rsp),%eax
jne    1855 <project_map_lattice+0x6f5>
mov    0x60(%rsp),%eax
cmp    0x1c(%rsp),%eax
je     187f <project_map_lattice+0x71f>
mov    0x1c(%rsp),%eax
mov    %eax,(%rsp)
lea    0x7ad(%rip),%rdi
mov    %r15d,%esi
mov    0x40(%rsp),%edx
mov    0x60(%rsp),%ecx
mov    0x18(%rsp),%r8d
mov    0x14(%rsp),%r9d
xor    %eax,%eax
call   1040 <printf@plt>
movsd  0xd0(%rsp),%xmm0
ucomisd 0xd8(%rsp),%xmm0
jne    18c1 <project_map_lattice+0x761>
jp     18c1 <project_map_lattice+0x761>
movsd  0xb0(%rsp),%xmm0
ucomisd 0xb8(%rsp),%xmm0
jne    18c1 <project_map_lattice+0x761>
jp     18c1 <project_map_lattice+0x761>
movsd  0x98(%rsp),%xmm0
ucomisd 0xa0(%rsp),%xmm0
jne    18c1 <project_map_lattice+0x761>
jnp    1905 <project_map_lattice+0x7a5>
lea    0x786(%rip),%rdi
movsd  0xd0(%rsp),%xmm0
movsd  0xb0(%rsp),%xmm1
movsd  0x98(%rsp),%xmm2
movsd  0xd8(%rsp),%xmm3
movsd  0xb8(%rsp),%xmm4
movsd  0xa0(%rsp),%xmm5
mov    $0x6,%al
call   1040 <printf@plt>
xorpd  %xmm0,%xmm0
movsd  0x130(%rsp),%xmm1
ucomisd %xmm0,%xmm1
jne    1952 <project_map_lattice+0x7f2>
jp     1952 <project_map_lattice+0x7f2>
movsd  0x118(%rsp),%xmm1
ucomisd %xmm0,%xmm1
jne    1952 <project_map_lattice+0x7f2>
jp     1952 <project_map_lattice+0x7f2>
xorpd  %xmm0,%xmm0
movsd  0x110(%rsp),%xmm1
ucomisd %xmm0,%xmm1
jne    1952 <project_map_lattice+0x7f2>
jp     1952 <project_map_lattice+0x7f2>
add    $0x138,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0x746(%rip),%rdi
movsd  0xf8(%rsp),%xmm0
movsd  0x100(%rsp),%xmm1
movsd  0x108(%rsp),%xmm2
mov    $0x3,%al
add    $0x138,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <printf@plt>

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

LLVM IR (-O2):
@.str = [8 x i8] c"lib_vwk\00"
@.str.1 = [62 x i8] c"lib_vwk> %d x %d x %d map projected to %d x %d x %d lattice.\0A\00"
@.str.2 = [81 x i8] c"lib_vwk> Voxel spacings interpolated from (%.3f,%.3f,%.3f) to (%.3f,%.3f,%.3f).\0A\00"
@.str.3 = [66 x i8] c"lib_vwk> New map origin (coord of first voxel): (%.3f,%.3f,%.3f)\0A\00"
define void @project_map_lattice(double** %0, i32 %1, i32 %2, i32 %3, double %4, double %5, double %6, double %7, double %8, double %9, double* nocapture %10, i32 %11, i32 %12, i32 %13, double %14, double %15, double %16, double %17, double %18, double %19) {
%21 = icmp ult i32 %1, 2
%22 = icmp ult i32 %2, 2
%23 = or i1 %21, %22
%24 = icmp ult i32 %3, 2
%25 = or i1 %23, %24
br i1 %25, label %26, label %28
26: ; preds = %20
%27 = tail call i32 (i32, i8*, ...) bitcast (i32 (...)* @error_underflow to i32 (i32, i8*, ...)*)(i32 17010, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
br label %28
28: ; preds = %20, %26
%29 = fsub double %4, %14
%30 = fsub double %5, %15
%31 = fsub double %6, %16
%32 = mul i32 %2, %1
%33 = mul i32 %32, %3
%34 = zext i32 %33 to i64
%35 = tail call i32 (double**, i64, ...) bitcast (i32 (...)* @do_vect to i32 (double**, i64, ...)*)(double** %0, i64 %34)
%36 = icmp eq i32 %3, 0
br i1 %36, label %155, label %37
37: ; preds = %28
%38 = icmp eq i32 %2, 0
%39 = icmp eq i32 %1, 0
br label %40
40: ; preds = %37, %152
%41 = phi i32 [ 0, %37 ], [ %153, %152 ]
br i1 %38, label %152, label %42
42: ; preds = %40
%43 = uitofp i32 %41 to double
%44 = tail call double @llvm.fmuladd.f64(double %43, double %9, double %31)
%45 = fdiv double %44, %19
%46 = tail call double @llvm.floor.f64(double %45)
%47 = fptosi double %46 to i32
%48 = tail call double @llvm.ceil.f64(double %45)
%49 = fptosi double %48 to i32
%50 = icmp slt i32 %47, 0
%51 = icmp sge i32 %49, %13
%52 = sitofp i32 %47 to double
%53 = fsub double %45, %52
%54 = fsub double 1.000000e+00, %53
br label %55
55: ; preds = %42, %149
%56 = phi i32 [ 0, %42 ], [ %150, %149 ]
br i1 %39, label %149, label %57
57: ; preds = %55
%58 = uitofp i32 %56 to double
%59 = tail call double @llvm.fmuladd.f64(double %58, double %8, double %30)
%60 = fdiv double %59, %18
%61 = tail call double @llvm.floor.f64(double %60)
%62 = fptosi double %61 to i32
%63 = tail call double @llvm.ceil.f64(double %60)
%64 = fptosi double %63 to i32
%65 = icmp slt i32 %62, 0
%66 = icmp sge i32 %64, %12
%67 = sitofp i32 %62 to double
%68 = fsub double %60, %67
%69 = fsub double 1.000000e+00, %68
br label %70
70: ; preds = %57, %146
%71 = phi i32 [ 0, %57 ], [ %147, %146 ]
%72 = uitofp i32 %71 to double
%73 = tail call double @llvm.fmuladd.f64(double %72, double %7, double %29)
%74 = fdiv double %73, %17
%75 = tail call double @llvm.floor.f64(double %74)
%76 = fptosi double %75 to i32
%77 = tail call double @llvm.ceil.f64(double %74)
%78 = fptosi double %77 to i32
%79 = icmp sgt i32 %76, -1
br i1 %79, label %80, label %146
80: ; preds = %70
%81 = icmp sge i32 %78, %11
%82 = select i1 %81, i1 true, i1 %65
%83 = select i1 %82, i1 true, i1 %66
%84 = select i1 %83, i1 true, i1 %50
%85 = select i1 %84, i1 true, i1 %51
br i1 %85, label %146, label %86
86: ; preds = %80
%87 = sitofp i32 %76 to double
%88 = fsub double %74, %87
%89 = fmul double %68, %88
%90 = fmul double %53, %89
%91 = tail call i32 (i32, i32, i32, i32, i32, ...) bitcast (i32 (...)* @gidz_general to i32 (i32, i32, i32, i32, i32, ...)*)(i32 %49, i32 %64, i32 %78, i32 %12, i32 %11)
%92 = sext i32 %91 to i64
%93 = getelementptr inbounds double, double* %10, i64 %92
%94 = load double, double* %93
%95 = fsub double 1.000000e+00, %88
%96 = fmul double %68, %95
%97 = fmul double %53, %96
%98 = tail call i32 (i32, i32, i32, i32, i32, ...) bitcast (i32 (...)* @gidz_general to i32 (i32, i32, i32, i32, i32, ...)*)(i32 %49, i32 %64, i32 %76, i32 %12, i32 %11)
%99 = sext i32 %98 to i64
%100 = getelementptr inbounds double, double* %10, i64 %99
%101 = load double, double* %100
%102 = fmul double %97, %101
%103 = tail call double @llvm.fmuladd.f64(double %90, double %94, double %102)
%104 = fmul double %69, %88
%105 = fmul double %53, %104
%106 = tail call i32 (i32, i32, i32, i32, i32, ...) bitcast (i32 (...)* @gidz_general to i32 (i32, i32, i32, i32, i32, ...)*)(i32 %49, i32 %62, i32 %78, i32 %12, i32 %11)
%107 = sext i32 %106 to i64
%108 = getelementptr inbounds double, double* %10, i64 %107
%109 = load double, double* %108
%110 = tail call double @llvm.fmuladd.f64(double %105, double %109, double %103)
%111 = fmul double %54, %89
%112 = tail call i32 (i32, i32, i32, i32, i32, ...) bitcast (i32 (...)* @gidz_general to i32 (i32, i32, i32, i32, i32, ...)*)(i32 %47, i32 %64, i32 %78, i32 %12, i32 %11)
%113 = sext i32 %112 to i64
%114 = getelementptr inbounds double, double* %10, i64 %113
%115 = load double, double* %114
%116 = tail call double @llvm.fmuladd.f64(double %111, double %115, double %110)
%117 = fmul double %54, %104
%118 = tail call i32 (i32, i32, i32, i32, i32, ...) bitcast (i32 (...)* @gidz_general to i32 (i32, i32, i32, i32, i32, ...)*)(i32 %47, i32 %62, i32 %78, i32 %12, i32 %11)
%119 = sext i32 %118 to i64
%120 = getelementptr inbounds double, double* %10, i64 %119
%121 = load double, double* %120
%122 = tail call double @llvm.fmuladd.f64(double %117, double %121, double %116)
%123 = fmul double %54, %96
%124 = tail call i32 (i32, i32, i32, i32, i32, ...) bitcast (i32 (...)* @gidz_general to i32 (i32, i32, i32, i32, i32, ...)*)(i32 %47, i32 %64, i32 %76, i32 %12, i32 %11)
%125 = sext i32 %124 to i64
%126 = getelementptr inbounds double, double* %10, i64 %125
%127 = load double, double* %126
%128 = tail call double @llvm.fmuladd.f64(double %123, double %127, double %122)
%129 = fmul double %69, %95
%130 = fmul double %53, %129
%131 = tail call i32 (i32, i32, i32, i32, i32, ...) bitcast (i32 (...)* @gidz_general to i32 (i32, i32, i32, i32, i32, ...)*)(i32 %49, i32 %62, i32 %76, i32 %12, i32 %11)
%132 = sext i32 %131 to i64
%133 = getelementptr inbounds double, double* %10, i64 %132
%134 = load double, double* %133
%135 = tail call double @llvm.fmuladd.f64(double %130, double %134, double %128)
%136 = fmul double %54, %129
%137 = tail call i32 (i32, i32, i32, i32, i32, ...) bitcast (i32 (...)* @gidz_general to i32 (i32, i32, i32, i32, i32, ...)*)(i32 %47, i32 %62, i32 %76, i32 %12, i32 %11)
%138 = sext i32 %137 to i64
%139 = getelementptr inbounds double, double* %10, i64 %138
%140 = load double, double* %139
%141 = tail call double @llvm.fmuladd.f64(double %136, double %140, double %135)
%142 = load double*, double** %0
%143 = tail call i32 (i32, i32, i32, i32, i32, ...) bitcast (i32 (...)* @gidz_general to i32 (i32, i32, i32, i32, i32, ...)*)(i32 %41, i32 %56, i32 %71, i32 %2, i32 %1)
%144 = sext i32 %143 to i64
%145 = getelementptr inbounds double, double* %142, i64 %144
store double %141, double* %145
br label %146
146: ; preds = %80, %70, %86
%147 = add nuw i32 %71, 1
%148 = icmp eq i32 %147, %1
br i1 %148, label %149, label %70
149: ; preds = %146, %55
%150 = add nuw i32 %56, 1
%151 = icmp eq i32 %150, %2
br i1 %151, label %152, label %55
152: ; preds = %149, %40
%153 = add nuw i32 %41, 1
%154 = icmp eq i32 %153, %3
br i1 %154, label %155, label %40
155: ; preds = %152, %28
%156 = icmp eq i32 %11, %1
%157 = icmp eq i32 %12, %2
%158 = and i1 %156, %157
%159 = icmp eq i32 %13, %3
%160 = and i1 %158, %159
br i1 %160, label %163, label %161
161: ; preds = %155
%162 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([62 x i8], [62 x i8]* @.str.1, i64 0, i64 0), i32 %11, i32 %12, i32 %13, i32 %1, i32 %2, i32 %3)
br label %163
163: ; preds = %155, %161
%164 = fcmp une double %17, %7
%165 = fcmp une double %18, %8
%166 = or i1 %164, %165
%167 = fcmp une double %19, %9
%168 = or i1 %166, %167
br i1 %168, label %169, label %171
169: ; preds = %163
%170 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([81 x i8], [81 x i8]* @.str.2, i64 0, i64 0), double %17, double %18, double %19, double %7, double %8, double %9)
br label %171
171: ; preds = %163, %169
%172 = fcmp une double %29, 0.000000e+00
%173 = fcmp une double %30, 0.000000e+00
%174 = or i1 %172, %173
%175 = fcmp une double %31, 0.000000e+00
%176 = or i1 %174, %175
br i1 %176, label %177, label %179
177: ; preds = %171
%178 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([66 x i8], [66 x i8]* @.str.3, i64 0, i64 0), double %4, double %5, double %6)
br label %179
179: ; preds = %171, %177
ret void
}