void scale_volume_image_bilinear(unsigned char *dst, int dw, int dh, int dd,
                                 unsigned char *src, int sw, int sh, int sd,
                                 int bpp, int gc, float gamma) {
  int x, y, z, n, ix, iy, iz, wx, wy, wz, v, v0, v1, r0, r1;
  unsigned char *s1, *s2, *d = dst;
  float invgamma;
  if (gc) {
    invgamma = 1.0 / gamma;
    for (z = 0; z < dd; ++z) {
      if (dd > 1) {
        iz = (((sd - 1) * z) << 8) / (dd - 1);
        if (z == dd - 1)
          --iz;
        wz = iz & 0xff;
        iz >>= 8;
      } else
        iz = wz = 0;
      for (y = 0; y < dh; ++y) {
        if (dh > 1) {
          iy = (((sh - 1) * y) << 8) / (dh - 1);
          if (y == dh - 1)
            --iy;
          wy = iy & 0xff;
          iy >>= 8;
        } else
          iy = wy = 0;
        for (x = 0; x < dw; ++x) {
          if (dw > 1) {
            ix = (((sw - 1) * x) << 8) / (dw - 1);
            if (x == dw - 1)
              --ix;
            wx = ix & 0xff;
            ix >>= 8;
          } else
            ix = wx = 0;
          s1 = src + ((iz * (sw * sh)) + (iy * sw) + ix) * bpp;
          s2 = src + (((iz + 1) * (sw * sh)) + (iy * sw) + ix) * bpp;
          for (n = 0; n < bpp; ++n) {
            r0 = blerp(gamma_correct(s1[0], gamma),
                       gamma_correct(s1[bpp], gamma), wx);
            r1 = blerp(gamma_correct(s1[sw * bpp], gamma),
                       gamma_correct(s1[(sw + 1) * bpp], gamma), wx);
            v0 = blerp(r0, r1, wy);
            r0 = blerp(gamma_correct(s2[0], gamma),
                       gamma_correct(s2[bpp], gamma), wx);
            r1 = blerp(gamma_correct(s2[sw * bpp], gamma),
                       gamma_correct(s2[(sw + 1) * bpp], gamma), wx);
            v1 = blerp(r0, r1, wy);
            v = blerp(v0, v1, wz);
            if (v < 0)
              v = 0;
            if (v > 255)
              v = 255;
            *d++ = gamma_correct(v, invgamma);
            ++s1;
            ++s2;
          }
        }
      }
    }
  } else {
    for (z = 0; z < dd; ++z) {
      if (dd > 1) {
        iz = (((sd - 1) * z) << 8) / (dd - 1);
        if (z == dd - 1)
          --iz;
        wz = iz & 0xff;
        iz >>= 8;
      } else
        iz = wz = 0;
      for (y = 0; y < dh; ++y) {
        if (dh > 1) {
          iy = (((sh - 1) * y) << 8) / (dh - 1);
          if (y == dh - 1)
            --iy;
          wy = iy & 0xff;
          iy >>= 8;
        } else
          iy = wy = 0;
        for (x = 0; x < dw; ++x) {
          if (dw > 1) {
            ix = (((sw - 1) * x) << 8) / (dw - 1);
            if (x == dw - 1)
              --ix;
            wx = ix & 0xff;
            ix >>= 8;
          } else
            ix = wx = 0;
          s1 = src + ((iz * (sw * sh)) + (iy * sw) + ix) * bpp;
          s2 = src + (((iz + 1) * (sw * sh)) + (iy * sw) + ix) * bpp;
          for (n = 0; n < bpp; ++n) {
            r0 = blerp(s1[0], s1[bpp], wx);
            r1 = blerp(s1[sw * bpp], s1[(sw + 1) * bpp], wx);
            v0 = blerp(r0, r1, wy);
            r0 = blerp(s2[0], s2[bpp], wx);
            r1 = blerp(s2[sw * bpp], s2[(sw + 1) * bpp], wx);
            v1 = blerp(r0, r1, wy);
            v = blerp(v0, v1, wz);
            if (v < 0)
              v = 0;
            if (v > 255)
              v = 255;
            *d++ = v;
            ++s1;
            ++s2;
          }
        }
      }
    }
  }
}


x86 assembly (clang, -O0):
<scale_volume_image_bilinear>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
mov    0x28(%rbp),%eax
mov    0x20(%rbp),%eax
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%eax
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8,-0x20(%rbp)
mov    %r9d,-0x24(%rbp)
movss  %xmm0,-0x28(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x80(%rbp)
cmpl   $0x0,0x28(%rbp)
je     15a0 <scale_volume_image_bilinear+0x480>
movss  -0x28(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe8c(%rip),%xmm0
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x84(%rbp)
ff
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    159b <scale_volume_image_bilinear+0x47b>
cmpl   $0x1,-0x14(%rbp)
jle    11ed <scale_volume_image_bilinear+0xcd>
mov    0x18(%rbp),%eax
sub    $0x1,%eax
imul   -0x34(%rbp),%eax
shl    $0x8,%eax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
cltd
idiv   %ecx
mov    %eax,-0x44(%rbp)
mov    -0x34(%rbp),%eax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jne    11d4 <scale_volume_image_bilinear+0xb4>
mov    -0x44(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x44(%rbp)
mov    -0x44(%rbp),%eax
and    $0xff,%eax
mov    %eax,-0x50(%rbp)
mov    -0x44(%rbp),%eax
sar    $0x8,%eax
mov    %eax,-0x44(%rbp)
jmp    11fb <scale_volume_image_bilinear+0xdb>
movl   $0x0,-0x50(%rbp)
movl   $0x0,-0x44(%rbp)
movl   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1588 <scale_volume_image_bilinear+0x468>
cmpl   $0x1,-0x10(%rbp)
jle    1264 <scale_volume_image_bilinear+0x144>
mov    0x10(%rbp),%eax
sub    $0x1,%eax
imul   -0x30(%rbp),%eax
shl    $0x8,%eax
mov    -0x10(%rbp),%ecx
sub    $0x1,%ecx
cltd
idiv   %ecx
mov    %eax,-0x40(%rbp)
mov    -0x30(%rbp),%eax
mov    -0x10(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jne    124b <scale_volume_image_bilinear+0x12b>
mov    -0x40(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x40(%rbp)
mov    -0x40(%rbp),%eax
and    $0xff,%eax
mov    %eax,-0x4c(%rbp)
mov    -0x40(%rbp),%eax
sar    $0x8,%eax
mov    %eax,-0x40(%rbp)
jmp    1272 <scale_volume_image_bilinear+0x152>
movl   $0x0,-0x4c(%rbp)
movl   $0x0,-0x40(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1575 <scale_volume_image_bilinear+0x455>
cmpl   $0x1,-0xc(%rbp)
jle    12db <scale_volume_image_bilinear+0x1bb>
mov    -0x24(%rbp),%eax
sub    $0x1,%eax
imul   -0x2c(%rbp),%eax
shl    $0x8,%eax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
cltd
idiv   %ecx
mov    %eax,-0x3c(%rbp)
mov    -0x2c(%rbp),%eax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jne    12c2 <scale_volume_image_bilinear+0x1a2>
mov    -0x3c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
and    $0xff,%eax
mov    %eax,-0x48(%rbp)
mov    -0x3c(%rbp),%eax
sar    $0x8,%eax
mov    %eax,-0x3c(%rbp)
jmp    12e9 <scale_volume_image_bilinear+0x1c9>
movl   $0x0,-0x48(%rbp)
movl   $0x0,-0x3c(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x44(%rbp),%ecx
mov    -0x24(%rbp),%edx
imul   0x10(%rbp),%edx
imul   %edx,%ecx
mov    -0x40(%rbp),%edx
imul   -0x24(%rbp),%edx
add    %edx,%ecx
add    -0x3c(%rbp),%ecx
imul   0x20(%rbp),%ecx
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x70(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x44(%rbp),%ecx
add    $0x1,%ecx
mov    -0x24(%rbp),%edx
imul   0x10(%rbp),%edx
imul   %edx,%ecx
mov    -0x40(%rbp),%edx
imul   -0x24(%rbp),%edx
add    %edx,%ecx
add    -0x3c(%rbp),%ecx
imul   0x20(%rbp),%ecx
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x78(%rbp)
movl   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%eax
cmp    0x20(%rbp),%eax
jge    1562 <scale_volume_image_bilinear+0x442>
mov    -0x70(%rbp),%rax
movzbl (%rax),%edi
movss  -0x28(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    $0x1,%al
call   1030 <gamma_correct@plt>
mov    %eax,-0x94(%rbp)
mov    -0x70(%rbp),%rax
movslq 0x20(%rbp),%rcx
movzbl (%rax,%rcx,1),%edi
movss  -0x28(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    $0x1,%al
call   1030 <gamma_correct@plt>
mov    -0x94(%rbp),%edi
mov    %eax,%esi
mov    -0x48(%rbp),%edx
mov    $0x0,%al
call   1040 <blerp@plt>
mov    %eax,-0x60(%rbp)
mov    -0x70(%rbp),%rax
mov    -0x24(%rbp),%ecx
imul   0x20(%rbp),%ecx
movslq %ecx,%rcx
movzbl (%rax,%rcx,1),%edi
movss  -0x28(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    $0x1,%al
call   1030 <gamma_correct@plt>
mov    %eax,-0x90(%rbp)
mov    -0x70(%rbp),%rax
mov    -0x24(%rbp),%ecx
add    $0x1,%ecx
imul   0x20(%rbp),%ecx
movslq %ecx,%rcx
movzbl (%rax,%rcx,1),%edi
movss  -0x28(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    $0x1,%al
call   1030 <gamma_correct@plt>
mov    -0x90(%rbp),%edi
mov    %eax,%esi
mov    -0x48(%rbp),%edx
mov    $0x0,%al
call   1040 <blerp@plt>
mov    %eax,-0x64(%rbp)
mov    -0x60(%rbp),%edi
mov    -0x64(%rbp),%esi
mov    -0x4c(%rbp),%edx
mov    $0x0,%al
call   1040 <blerp@plt>
mov    %eax,-0x58(%rbp)
mov    -0x78(%rbp),%rax
movzbl (%rax),%edi
movss  -0x28(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    $0x1,%al
call   1030 <gamma_correct@plt>
mov    %eax,-0x8c(%rbp)
mov    -0x78(%rbp),%rax
movslq 0x20(%rbp),%rcx
movzbl (%rax,%rcx,1),%edi
movss  -0x28(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    $0x1,%al
call   1030 <gamma_correct@plt>
mov    -0x8c(%rbp),%edi
mov    %eax,%esi
mov    -0x48(%rbp),%edx
mov    $0x0,%al
call   1040 <blerp@plt>
mov    %eax,-0x60(%rbp)
mov    -0x78(%rbp),%rax
mov    -0x24(%rbp),%ecx
imul   0x20(%rbp),%ecx
movslq %ecx,%rcx
movzbl (%rax,%rcx,1),%edi
movss  -0x28(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    $0x1,%al
call   1030 <gamma_correct@plt>
mov    %eax,-0x88(%rbp)
mov    -0x78(%rbp),%rax
mov    -0x24(%rbp),%ecx
add    $0x1,%ecx
imul   0x20(%rbp),%ecx
movslq %ecx,%rcx
movzbl (%rax,%rcx,1),%edi
movss  -0x28(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    $0x1,%al
call   1030 <gamma_correct@plt>
mov    -0x88(%rbp),%edi
mov    %eax,%esi
mov    -0x48(%rbp),%edx
mov    $0x0,%al
call   1040 <blerp@plt>
mov    %eax,-0x64(%rbp)
mov    -0x60(%rbp),%edi
mov    -0x64(%rbp),%esi
mov    -0x4c(%rbp),%edx
mov    $0x0,%al
call   1040 <blerp@plt>
mov    %eax,-0x5c(%rbp)
mov    -0x58(%rbp),%edi
mov    -0x5c(%rbp),%esi
mov    -0x50(%rbp),%edx
mov    $0x0,%al
call   1040 <blerp@plt>
mov    %eax,-0x54(%rbp)
cmpl   $0x0,-0x54(%rbp)
jge    14ff <scale_volume_image_bilinear+0x3df>
movl   $0x0,-0x54(%rbp)
cmpl   $0xff,-0x54(%rbp)
jle    1513 <scale_volume_image_bilinear+0x3f3>
movl   $0xff,-0x54(%rbp)
mov    -0x54(%rbp),%edi
movss  -0x84(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm0
mov    $0x1,%al
call   1030 <gamma_correct@plt>
mov    %al,%cl
mov    -0x80(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x80(%rbp)
mov    %cl,(%rax)
mov    -0x70(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x70(%rbp)
mov    -0x78(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x78(%rbp)
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    1349 <scale_volume_image_bilinear+0x229>
jmp    1567 <scale_volume_image_bilinear+0x447>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1279 <scale_volume_image_bilinear+0x159>
jmp    157a <scale_volume_image_bilinear+0x45a>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    1202 <scale_volume_image_bilinear+0xe2>
jmp    158d <scale_volume_image_bilinear+0x46d>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    118b <scale_volume_image_bilinear+0x6b>
jmp    18f1 <scale_volume_image_bilinear+0x7d1>
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    18ec <scale_volume_image_bilinear+0x7cc>
cmpl   $0x1,-0x14(%rbp)
jle    1609 <scale_volume_image_bilinear+0x4e9>
mov    0x18(%rbp),%eax
sub    $0x1,%eax
imul   -0x34(%rbp),%eax
shl    $0x8,%eax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
cltd
idiv   %ecx
mov    %eax,-0x44(%rbp)
mov    -0x34(%rbp),%eax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jne    15f0 <scale_volume_image_bilinear+0x4d0>
mov    -0x44(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x44(%rbp)
mov    -0x44(%rbp),%eax
and    $0xff,%eax
mov    %eax,-0x50(%rbp)
mov    -0x44(%rbp),%eax
sar    $0x8,%eax
mov    %eax,-0x44(%rbp)
jmp    1617 <scale_volume_image_bilinear+0x4f7>
movl   $0x0,-0x50(%rbp)
movl   $0x0,-0x44(%rbp)
movl   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    18d9 <scale_volume_image_bilinear+0x7b9>
cmpl   $0x1,-0x10(%rbp)
jle    1680 <scale_volume_image_bilinear+0x560>
mov    0x10(%rbp),%eax
sub    $0x1,%eax
imul   -0x30(%rbp),%eax
shl    $0x8,%eax
mov    -0x10(%rbp),%ecx
sub    $0x1,%ecx
cltd
idiv   %ecx
mov    %eax,-0x40(%rbp)
mov    -0x30(%rbp),%eax
mov    -0x10(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jne    1667 <scale_volume_image_bilinear+0x547>
mov    -0x40(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x40(%rbp)
mov    -0x40(%rbp),%eax
and    $0xff,%eax
mov    %eax,-0x4c(%rbp)
mov    -0x40(%rbp),%eax
sar    $0x8,%eax
mov    %eax,-0x40(%rbp)
jmp    168e <scale_volume_image_bilinear+0x56e>
movl   $0x0,-0x4c(%rbp)
movl   $0x0,-0x40(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    18c6 <scale_volume_image_bilinear+0x7a6>
cmpl   $0x1,-0xc(%rbp)
jle    16f7 <scale_volume_image_bilinear+0x5d7>
mov    -0x24(%rbp),%eax
sub    $0x1,%eax
imul   -0x2c(%rbp),%eax
shl    $0x8,%eax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
cltd
idiv   %ecx
mov    %eax,-0x3c(%rbp)
mov    -0x2c(%rbp),%eax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jne    16de <scale_volume_image_bilinear+0x5be>
mov    -0x3c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
and    $0xff,%eax
mov    %eax,-0x48(%rbp)
mov    -0x3c(%rbp),%eax
sar    $0x8,%eax
mov    %eax,-0x3c(%rbp)
jmp    1705 <scale_volume_image_bilinear+0x5e5>
movl   $0x0,-0x48(%rbp)
movl   $0x0,-0x3c(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x44(%rbp),%ecx
mov    -0x24(%rbp),%edx
imul   0x10(%rbp),%edx
imul   %edx,%ecx
mov    -0x40(%rbp),%edx
imul   -0x24(%rbp),%edx
add    %edx,%ecx
add    -0x3c(%rbp),%ecx
imul   0x20(%rbp),%ecx
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x70(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x44(%rbp),%ecx
add    $0x1,%ecx
mov    -0x24(%rbp),%edx
imul   0x10(%rbp),%edx
imul   %edx,%ecx
mov    -0x40(%rbp),%edx
imul   -0x24(%rbp),%edx
add    %edx,%ecx
add    -0x3c(%rbp),%ecx
imul   0x20(%rbp),%ecx
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x78(%rbp)
movl   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%eax
cmp    0x20(%rbp),%eax
jge    18b3 <scale_volume_image_bilinear+0x793>
mov    -0x70(%rbp),%rax
movzbl (%rax),%edi
mov    -0x70(%rbp),%rax
movslq 0x20(%rbp),%rcx
movzbl (%rax,%rcx,1),%esi
mov    -0x48(%rbp),%edx
mov    $0x0,%al
call   1040 <blerp@plt>
mov    %eax,-0x60(%rbp)
mov    -0x70(%rbp),%rax
mov    -0x24(%rbp),%ecx
imul   0x20(%rbp),%ecx
movslq %ecx,%rcx
movzbl (%rax,%rcx,1),%edi
mov    -0x70(%rbp),%rax
mov    -0x24(%rbp),%ecx
add    $0x1,%ecx
imul   0x20(%rbp),%ecx
movslq %ecx,%rcx
movzbl (%rax,%rcx,1),%esi
mov    -0x48(%rbp),%edx
mov    $0x0,%al
call   1040 <blerp@plt>
mov    %eax,-0x64(%rbp)
mov    -0x60(%rbp),%edi
mov    -0x64(%rbp),%esi
mov    -0x4c(%rbp),%edx
mov    $0x0,%al
call   1040 <blerp@plt>
mov    %eax,-0x58(%rbp)
mov    -0x78(%rbp),%rax
movzbl (%rax),%edi
mov    -0x78(%rbp),%rax
movslq 0x20(%rbp),%rcx
movzbl (%rax,%rcx,1),%esi
mov    -0x48(%rbp),%edx
mov    $0x0,%al
call   1040 <blerp@plt>
mov    %eax,-0x60(%rbp)
mov    -0x78(%rbp),%rax
mov    -0x24(%rbp),%ecx
imul   0x20(%rbp),%ecx
movslq %ecx,%rcx
movzbl (%rax,%rcx,1),%edi
mov    -0x78(%rbp),%rax
mov    -0x24(%rbp),%ecx
add    $0x1,%ecx
imul   0x20(%rbp),%ecx
movslq %ecx,%rcx
movzbl (%rax,%rcx,1),%esi
mov    -0x48(%rbp),%edx
mov    $0x0,%al
call   1040 <blerp@plt>
mov    %eax,-0x64(%rbp)
mov    -0x60(%rbp),%edi
mov    -0x64(%rbp),%esi
mov    -0x4c(%rbp),%edx
mov    $0x0,%al
call   1040 <blerp@plt>
mov    %eax,-0x5c(%rbp)
mov    -0x58(%rbp),%edi
mov    -0x5c(%rbp),%esi
mov    -0x50(%rbp),%edx
mov    $0x0,%al
call   1040 <blerp@plt>
mov    %eax,-0x54(%rbp)
cmpl   $0x0,-0x54(%rbp)
jge    1863 <scale_volume_image_bilinear+0x743>
movl   $0x0,-0x54(%rbp)
cmpl   $0xff,-0x54(%rbp)
jle    1877 <scale_volume_image_bilinear+0x757>
movl   $0xff,-0x54(%rbp)
mov    -0x54(%rbp),%eax
mov    %al,%cl
mov    -0x80(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x80(%rbp)
mov    %cl,(%rax)
mov    -0x70(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x70(%rbp)
mov    -0x78(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x78(%rbp)
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    1765 <scale_volume_image_bilinear+0x645>
jmp    18b8 <scale_volume_image_bilinear+0x798>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1695 <scale_volume_image_bilinear+0x575>
jmp    18cb <scale_volume_image_bilinear+0x7ab>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    161e <scale_volume_image_bilinear+0x4fe>
jmp    18de <scale_volume_image_bilinear+0x7be>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    15a7 <scale_volume_image_bilinear+0x487>
jmp    18f1 <scale_volume_image_bilinear+0x7d1>
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<scale_volume_image_bilinear>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xf8,%rsp
mov    %r9,0x58(%rsp)
mov    %r8,0x60(%rsp)
mov    %edx,%r11d
mov    %rdi,%r12
mov    0x140(%rsp),%r8d
mov    0x138(%rsp),%eax
mov    0x130(%rsp),%edx
cmpl   $0x0,0x148(%rsp)
mov    %rcx,0xe0(%rsp)
mov    %r11,0xe8(%rsp)
mov    %rsi,0xf0(%rsp)
je     15de <scale_volume_image_bilinear+0x4be>
test   %ecx,%ecx
jle    1975 <scale_volume_image_bilinear+0x855>
cvtss2sd %xmm0,%xmm2
movss  0xe6f(%rip),%xmm1
divss  %xmm0,%xmm1
shl    $0x8,%eax
add    $0xffffff00,%eax
mov    %eax,0x1c(%rsp)
lea    -0x1(%rcx),%eax
mov    %eax,0xd8(%rsp)
mov    %edx,%eax
shl    $0x8,%edx
add    $0xffffff00,%edx
mov    %edx,0x28(%rsp)
lea    -0x1(%r11),%edx
mov    %edx,0xdc(%rsp)
mov    0x58(%rsp),%rdx
mov    %edx,%edi
shl    $0x8,%edi
add    $0xffffff00,%edi
mov    %edi,0x30(%rsp)
lea    -0x1(%rsi),%edi
mov    %edi,0x2c(%rsp)
imul   %edx,%eax
mov    %eax,0x20(%rsp)
movslq %r8d,%r9
mov    %r8d,%edi
imul   %edx,%edi
movslq %edi,%r10
add    $0x1,%edx
imul   %r8d,%edx
movslq %edx,%rax
cvtss2sd %xmm1,%xmm0
mov    0x60(%rsp),%rdx
lea    (%rdx,%r9,1),%rdi
mov    %rdi,0x50(%rsp)
add    %rdx,%r10
mov    %r10,0x70(%rsp)
add    %rdx,%rax
mov    %rax,0x68(%rsp)
mov    %r9d,%ebx
movl   $0x0,0x24(%rsp)
movsd  %xmm2,0x10(%rsp)
movsd  %xmm0,0x48(%rsp)
mov    %rbx,0x88(%rsp)
jmp    125b <scale_volume_image_bilinear+0x13b>
mov    0x24(%rsp),%eax
add    $0x1,%eax
mov    0xe0(%rsp),%rcx
mov    %eax,0x24(%rsp)
cmp    %ecx,%eax
je     1975 <scale_volume_image_bilinear+0x855>
mov    $0x0,%eax
mov    $0x0,%r9d
cmp    $0x1,%ecx
je     1290 <scale_volume_image_bilinear+0x170>
mov    0x1c(%rsp),%eax
mov    0x24(%rsp),%edi
imul   %edi,%eax
cltd
mov    0xd8(%rsp),%ecx
idiv   %ecx
xor    %edx,%edx
cmp    %ecx,%edi
sete   %dl
sub    %edx,%eax
movzbl %al,%r9d
sar    $0x8,%eax
test   %r11d,%r11d
jle    1240 <scale_volume_image_bilinear+0x120>
mov    %rax,%rcx
mov    %ecx,%edx
mov    0x20(%rsp),%eax
imul   %eax,%edx
mov    %edx,0x78(%rsp)
add    $0x1,%ecx
imul   %eax,%ecx
mov    %rcx,0x80(%rsp)
movl   $0x0,0xc(%rsp)
mov    %r9d,0x38(%rsp)
jmp    12ec <scale_volume_image_bilinear+0x1cc>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    0xc(%rsp),%eax
add    $0x1,%eax
mov    0xe8(%rsp),%r11
mov    %eax,0xc(%rsp)
cmp    %r11d,%eax
je     1240 <scale_volume_image_bilinear+0x120>
movl   $0x0,0x40(%rsp)
mov    $0x0,%eax
cmp    $0x2,%r11d
jl     1329 <scale_volume_image_bilinear+0x209>
mov    0x28(%rsp),%eax
mov    0xc(%rsp),%edi
imul   %edi,%eax
cltd
mov    0xdc(%rsp),%ecx
idiv   %ecx
xor    %edx,%edx
cmp    %ecx,%edi
sete   %dl
sub    %edx,%eax
movzbl %al,%ecx
sar    $0x8,%eax
mov    %eax,0x40(%rsp)
mov    %ecx,%eax
test   %esi,%esi
jle    12d0 <scale_volume_image_bilinear+0x1b0>
mov    %eax,0x3c(%rsp)
mov    0x40(%rsp),%eax
imul   0x58(%rsp),%eax
mov    %eax,0x40(%rsp)
xor    %ebp,%ebp
jmp    135b <scale_volume_image_bilinear+0x23b>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x1,%ebp
cmp    %esi,%ebp
je     12d0 <scale_volume_image_bilinear+0x1b0>
mov    $0x0,%eax
mov    $0x0,%r13d
cmp    $0x2,%esi
jl     1389 <scale_volume_image_bilinear+0x269>
mov    0x30(%rsp),%eax
imul   %ebp,%eax
cltd
mov    0x2c(%rsp),%edi
idiv   %edi
xor    %ecx,%ecx
cmp    %edi,%ebp
sete   %cl
sub    %ecx,%eax
movzbl %al,%r13d
sar    $0x8,%eax
test   %r8d,%r8d
jle    1350 <scale_volume_image_bilinear+0x230>
mov    %ebp,0x34(%rsp)
add    0x40(%rsp),%eax
mov    0x80(%rsp),%rcx
add    %eax,%ecx
imul   %r8d,%ecx
movslq %ecx,%rsi
mov    0x60(%rsp),%rcx
lea    (%rcx,%rsi,1),%rdx
mov    %rdx,0xc0(%rsp)
add    0x78(%rsp),%eax
imul   %r8d,%eax
movslq %eax,%rdi
lea    (%rcx,%rdi,1),%rax
mov    %rax,0xb0(%rsp)
mov    0x50(%rsp),%rdx
lea    (%rdx,%rsi,1),%rax
mov    %rax,0xa8(%rsp)
mov    0x70(%rsp),%rax
lea    (%rax,%rsi,1),%rcx
mov    %rcx,0xa0(%rsp)
mov    0x68(%rsp),%rcx
add    %rcx,%rsi
mov    %rsi,0xc8(%rsp)
add    %rdi,%rdx
mov    %rdx,0x98(%rsp)
add    %rdi,%rax
mov    %rax,0x90(%rsp)
add    %rcx,%rdi
mov    %rdi,0xb8(%rsp)
xor    %r14d,%r14d
mov    %r12,0xd0(%rsp)
nopl   (%rax)
mov    0xb0(%rsp),%rax
movzbl (%rax,%r14,1),%edi
movaps %xmm2,%xmm0
mov    $0x1,%al
call   1030 <gamma_correct@plt>
mov    %eax,%ebp
mov    0x98(%rsp),%rax
movzbl (%rax,%r14,1),%edi
movsd  0x10(%rsp),%xmm0
mov    $0x1,%al
call   1030 <gamma_correct@plt>
mov    %ebp,%edi
mov    %eax,%esi
mov    %r13d,%edx
xor    %eax,%eax
call   1040 <blerp@plt>
mov    %eax,%ebp
mov    0x90(%rsp),%rax
movzbl (%rax,%r14,1),%edi
movsd  0x10(%rsp),%xmm0
mov    $0x1,%al
call   1030 <gamma_correct@plt>
mov    %eax,%ebx
mov    0xb8(%rsp),%rax
movzbl (%rax,%r14,1),%edi
movsd  0x10(%rsp),%xmm0
mov    $0x1,%al
call   1030 <gamma_correct@plt>
mov    %ebx,%edi
mov    %eax,%esi
mov    %r13d,%edx
xor    %eax,%eax
call   1040 <blerp@plt>
mov    %ebp,%edi
mov    %eax,%esi
mov    0x3c(%rsp),%r15d
mov    %r15d,%edx
xor    %eax,%eax
call   1040 <blerp@plt>
mov    %eax,%r12d
mov    0xc0(%rsp),%rax
movzbl (%rax,%r14,1),%edi
movsd  0x10(%rsp),%xmm0
mov    $0x1,%al
call   1030 <gamma_correct@plt>
mov    %eax,%ebx
mov    0xa8(%rsp),%rax
movzbl (%rax,%r14,1),%edi
movsd  0x10(%rsp),%xmm0
mov    $0x1,%al
call   1030 <gamma_correct@plt>
mov    %ebx,%edi
mov    %eax,%esi
mov    %r13d,%edx
xor    %eax,%eax
call   1040 <blerp@plt>
mov    %eax,%ebx
mov    0xa0(%rsp),%rax
movzbl (%rax,%r14,1),%edi
movsd  0x10(%rsp),%xmm0
mov    $0x1,%al
call   1030 <gamma_correct@plt>
mov    %eax,%ebp
mov    0xc8(%rsp),%rax
movzbl (%rax,%r14,1),%edi
movsd  0x10(%rsp),%xmm0
mov    $0x1,%al
call   1030 <gamma_correct@plt>
mov    %ebp,%edi
mov    %eax,%esi
mov    %r13d,%edx
xor    %eax,%eax
call   1040 <blerp@plt>
mov    %ebx,%edi
mov    %eax,%esi
mov    %r15d,%edx
xor    %eax,%eax
call   1040 <blerp@plt>
mov    %r12d,%edi
mov    %eax,%esi
mov    0x38(%rsp),%edx
xor    %eax,%eax
call   1040 <blerp@plt>
test   %eax,%eax
mov    $0x0,%ecx
cmovs  %ecx,%eax
cmp    $0xff,%eax
mov    $0xff,%ecx
cmovae %ecx,%eax
mov    %eax,%edi
movsd  0x48(%rsp),%xmm0
mov    $0x1,%al
call   1030 <gamma_correct@plt>
mov    0x88(%rsp),%rbx
movsd  0x10(%rsp),%xmm2
mov    0xd0(%rsp),%r12
mov    %al,(%r12,%r14,1)
add    $0x1,%r14
cmp    %r14d,%ebx
jne    1430 <scale_volume_image_bilinear+0x310>
add    %r14,%r12
mov    0xf0(%rsp),%rsi
mov    0x140(%rsp),%r8d
mov    0x34(%rsp),%ebp
jmp    1350 <scale_volume_image_bilinear+0x230>
test   %ecx,%ecx
jle    1975 <scale_volume_image_bilinear+0x855>
shl    $0x8,%eax
add    $0xffffff00,%eax
mov    %eax,0x1c(%rsp)
lea    -0x1(%rcx),%eax
mov    %eax,0x28(%rsp)
mov    %edx,%eax
shl    $0x8,%edx
add    $0xffffff00,%edx
mov    %edx,0x30(%rsp)
lea    -0x1(%r11),%edx
mov    %edx,0x2c(%rsp)
mov    0x58(%rsp),%rdx
mov    %edx,%edi
shl    $0x8,%edi
add    $0xffffff00,%edi
mov    %edi,0x70(%rsp)
lea    -0x1(%rsi),%edi
mov    %edi,0x68(%rsp)
imul   %edx,%eax
mov    %eax,0x20(%rsp)
movslq %r8d,%rdi
mov    %r8d,%eax
imul   %edx,%eax
movslq %eax,%rbx
lea    0x1(%rdx),%eax
imul   %r8d,%eax
movslq %eax,%rdx
mov    0x60(%rsp),%rax
add    %rax,%rdi
mov    %rdi,0x40(%rsp)
add    %rax,%rbx
mov    %rbx,0x80(%rsp)
add    %rax,%rdx
mov    %rdx,0x78(%rsp)
mov    %r8d,%ebx
movl   $0x0,0xc(%rsp)
jmp    1693 <scale_volume_image_bilinear+0x573>
cs nopw 0x0(%rax,%rax,1)
nop
mov    0xc(%rsp),%eax
add    $0x1,%eax
mov    %eax,0xc(%rsp)
cmp    %ecx,%eax
je     1975 <scale_volume_image_bilinear+0x855>
mov    $0x0,%eax
mov    $0x0,%edx
cmp    $0x1,%ecx
je     16c6 <scale_volume_image_bilinear+0x5a6>
mov    0x1c(%rsp),%eax
mov    0xc(%rsp),%r9d
imul   %r9d,%eax
cltd
mov    0x28(%rsp),%edi
idiv   %edi
xor    %edx,%edx
cmp    %edi,%r9d
sete   %dl
sub    %edx,%eax
movzbl %al,%edx
sar    $0x8,%eax
test   %r11d,%r11d
jle    1680 <scale_volume_image_bilinear+0x560>
mov    %edx,0x3c(%rsp)
mov    %rax,%rdx
mov    %edx,%edi
mov    0x20(%rsp),%eax
imul   %eax,%edi
mov    %edi,0x34(%rsp)
add    $0x1,%edx
imul   %eax,%edx
mov    %rdx,0x88(%rsp)
movl   $0x0,0x50(%rsp)
jmp    1714 <scale_volume_image_bilinear+0x5f4>
nopw   0x0(%rax,%rax,1)
mov    0x50(%rsp),%eax
add    $0x1,%eax
mov    %eax,0x50(%rsp)
cmp    %r11d,%eax
je     1680 <scale_volume_image_bilinear+0x560>
movl   $0x0,0x48(%rsp)
mov    $0x0,%eax
cmp    $0x2,%r11d
jl     1751 <scale_volume_image_bilinear+0x631>
mov    0x30(%rsp),%eax
mov    0x50(%rsp),%r9d
imul   %r9d,%eax
cltd
mov    0x2c(%rsp),%edi
idiv   %edi
xor    %edx,%edx
cmp    %edi,%r9d
sete   %dl
sub    %edx,%eax
movzbl %al,%edx
sar    $0x8,%eax
mov    %eax,0x48(%rsp)
mov    %edx,%eax
test   %esi,%esi
jle    1700 <scale_volume_image_bilinear+0x5e0>
mov    %eax,0x90(%rsp)
mov    0x48(%rsp),%eax
imul   0x58(%rsp),%eax
mov    %eax,0x48(%rsp)
xor    %ebp,%ebp
jmp    1777 <scale_volume_image_bilinear+0x657>
nopl   (%rax)
add    $0x1,%ebp
cmp    %esi,%ebp
je     1700 <scale_volume_image_bilinear+0x5e0>
mov    $0x0,%eax
mov    $0x0,%r14d
cmp    $0x2,%esi
jl     17a5 <scale_volume_image_bilinear+0x685>
mov    0x70(%rsp),%eax
imul   %ebp,%eax
cltd
mov    0x68(%rsp),%edi
idiv   %edi
xor    %edx,%edx
cmp    %edi,%ebp
sete   %dl
sub    %edx,%eax
movzbl %al,%r14d
sar    $0x8,%eax
test   %r8d,%r8d
jle    1770 <scale_volume_image_bilinear+0x650>
mov    %ebp,0x38(%rsp)
add    0x48(%rsp),%eax
mov    0x88(%rsp),%rcx
add    %eax,%ecx
imul   %r8d,%ecx
movslq %ecx,%rsi
mov    0x60(%rsp),%rcx
lea    (%rcx,%rsi,1),%rdx
mov    %rdx,0xc8(%rsp)
add    0x34(%rsp),%eax
imul   %r8d,%eax
movslq %eax,%rdi
lea    (%rcx,%rdi,1),%rax
mov    %rax,0xb8(%rsp)
mov    0x40(%rsp),%rax
lea    (%rax,%rsi,1),%rcx
mov    %rcx,0xb0(%rsp)
mov    0x80(%rsp),%rcx
lea    (%rcx,%rsi,1),%rdx
mov    %rdx,0xa8(%rsp)
mov    0x78(%rsp),%rdx
add    %rdx,%rsi
mov    %rsi,0x10(%rsp)
add    %rdi,%rax
mov    %rax,0xa0(%rsp)
lea    (%rcx,%rdi,1),%rax
mov    %rax,0x98(%rsp)
add    %rdx,%rdi
mov    %rdi,0xc0(%rsp)
xor    %r15d,%r15d
mov    %r12,0xd0(%rsp)
nopw   0x0(%rax,%rax,1)
mov    0xb8(%rsp),%rax
movzbl (%rax,%r15,1),%edi
mov    0xa0(%rsp),%rax
movzbl (%rax,%r15,1),%esi
mov    %r14d,%edx
xor    %eax,%eax
mov    %rbx,%r12
call   1040 <blerp@plt>
mov    %eax,%ebp
mov    0x98(%rsp),%rax
movzbl (%rax,%r15,1),%edi
mov    0xc0(%rsp),%rax
movzbl (%rax,%r15,1),%esi
mov    %r14d,%edx
xor    %eax,%eax
call   1040 <blerp@plt>
mov    %ebp,%edi
mov    %eax,%esi
mov    0x90(%rsp),%r13d
mov    %r13d,%edx
xor    %eax,%eax
call   1040 <blerp@plt>
mov    %eax,%ebp
mov    0xc8(%rsp),%rax
movzbl (%rax,%r15,1),%edi
mov    0xb0(%rsp),%rax
movzbl (%rax,%r15,1),%esi
mov    %r14d,%edx
xor    %eax,%eax
call   1040 <blerp@plt>
mov    %eax,%ebx
mov    0xa8(%rsp),%rax
movzbl (%rax,%r15,1),%edi
mov    0x10(%rsp),%rax
movzbl (%rax,%r15,1),%esi
mov    %r14d,%edx
xor    %eax,%eax
call   1040 <blerp@plt>
mov    %ebx,%edi
mov    %eax,%esi
mov    %r13d,%edx
xor    %eax,%eax
call   1040 <blerp@plt>
mov    %ebp,%edi
mov    %eax,%esi
mov    0x3c(%rsp),%edx
xor    %eax,%eax
call   1040 <blerp@plt>
mov    $0xff,%edx
xor    %ecx,%ecx
mov    %r12,%rbx
mov    0xd0(%rsp),%r12
test   %eax,%eax
cmovs  %ecx,%eax
cmp    $0xff,%eax
cmovae %edx,%eax
mov    %al,(%r12,%r15,1)
add    $0x1,%r15
cmp    %r15d,%ebx
jne    1850 <scale_volume_image_bilinear+0x730>
add    %r15,%r12
mov    0xe0(%rsp),%rcx
mov    0xe8(%rsp),%r11
mov    0xf0(%rsp),%rsi
mov    0x140(%rsp),%r8d
mov    0x38(%rsp),%ebp
jmp    1770 <scale_volume_image_bilinear+0x650>
add    $0xf8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @scale_volume_image_bilinear(i8* %0, i32 %1, i32 %2, i32 %3, i8* %4, i32 %5, i32 %6, i32 %7, i32 %8, i32 %9, float %10) {
%12 = alloca i8*
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i8*
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
%21 = alloca i32
%22 = alloca float
%23 = alloca i32
%24 = alloca i32
%25 = alloca i32
%26 = alloca i32
%27 = alloca i32
%28 = alloca i32
%29 = alloca i32
%30 = alloca i32
%31 = alloca i32
%32 = alloca i32
%33 = alloca i32
%34 = alloca i32
%35 = alloca i32
%36 = alloca i32
%37 = alloca i32
%38 = alloca i8*
%39 = alloca i8*
%40 = alloca i8*
%41 = alloca float
store i8* %0, i8** %12
store i32 %1, i32* %13
store i32 %2, i32* %14
store i32 %3, i32* %15
store i8* %4, i8** %16
store i32 %5, i32* %17
store i32 %6, i32* %18
store i32 %7, i32* %19
store i32 %8, i32* %20
store i32 %9, i32* %21
store float %10, float* %22
%42 = load i8*, i8** %12
store i8* %42, i8** %40
%43 = load i32, i32* %21
%44 = icmp ne i32 %43, 0
br i1 %44, label %45, label %311
45: ; preds = %11
%46 = load float, float* %22
%47 = fpext float %46 to double
%48 = fdiv double 1.000000e+00, %47
%49 = fptrunc double %48 to float
store float %49, float* %41
store i32 0, i32* %25
br label %50
50: ; preds = %307, %45
%51 = load i32, i32* %25
%52 = load i32, i32* %15
%53 = icmp slt i32 %51, %52
br i1 %53, label %54, label %310
54: ; preds = %50
%55 = load i32, i32* %15
%56 = icmp sgt i32 %55, 1
br i1 %56, label %57, label %78
57: ; preds = %54
%58 = load i32, i32* %19
%59 = sub nsw i32 %58, 1
%60 = load i32, i32* %25
%61 = mul nsw i32 %59, %60
%62 = shl i32 %61, 8
%63 = load i32, i32* %15
%64 = sub nsw i32 %63, 1
%65 = sdiv i32 %62, %64
store i32 %65, i32* %29
%66 = load i32, i32* %25
%67 = load i32, i32* %15
%68 = sub nsw i32 %67, 1
%69 = icmp eq i32 %66, %68
br i1 %69, label %70, label %73
70: ; preds = %57
%71 = load i32, i32* %29
%72 = add nsw i32 %71, -1
store i32 %72, i32* %29
br label %73
73: ; preds = %70, %57
%74 = load i32, i32* %29
%75 = and i32 %74, 255
store i32 %75, i32* %32
%76 = load i32, i32* %29
%77 = ashr i32 %76, 8
store i32 %77, i32* %29
br label %79
78: ; preds = %54
store i32 0, i32* %32
store i32 0, i32* %29
br label %79
79: ; preds = %78, %73
store i32 0, i32* %24
br label %80
80: ; preds = %303, %79
%81 = load i32, i32* %24
%82 = load i32, i32* %14
%83 = icmp slt i32 %81, %82
br i1 %83, label %84, label %306
84: ; preds = %80
%85 = load i32, i32* %14
%86 = icmp sgt i32 %85, 1
br i1 %86, label %87, label %108
87: ; preds = %84
%88 = load i32, i32* %18
%89 = sub nsw i32 %88, 1
%90 = load i32, i32* %24
%91 = mul nsw i32 %89, %90
%92 = shl i32 %91, 8
%93 = load i32, i32* %14
%94 = sub nsw i32 %93, 1
%95 = sdiv i32 %92, %94
store i32 %95, i32* %28
%96 = load i32, i32* %24
%97 = load i32, i32* %14
%98 = sub nsw i32 %97, 1
%99 = icmp eq i32 %96, %98
br i1 %99, label %100, label %103
100: ; preds = %87
%101 = load i32, i32* %28
%102 = add nsw i32 %101, -1
store i32 %102, i32* %28
br label %103
103: ; preds = %100, %87
%104 = load i32, i32* %28
%105 = and i32 %104, 255
store i32 %105, i32* %31
%106 = load i32, i32* %28
%107 = ashr i32 %106, 8
store i32 %107, i32* %28
br label %109
108: ; preds = %84
store i32 0, i32* %31
store i32 0, i32* %28
br label %109
109: ; preds = %108, %103
store i32 0, i32* %23
br label %110
110: ; preds = %299, %109
%111 = load i32, i32* %23
%112 = load i32, i32* %13
%113 = icmp slt i32 %111, %112
br i1 %113, label %114, label %302
114: ; preds = %110
%115 = load i32, i32* %13
%116 = icmp sgt i32 %115, 1
br i1 %116, label %117, label %138
117: ; preds = %114
%118 = load i32, i32* %17
%119 = sub nsw i32 %118, 1
%120 = load i32, i32* %23
%121 = mul nsw i32 %119, %120
%122 = shl i32 %121, 8
%123 = load i32, i32* %13
%124 = sub nsw i32 %123, 1
%125 = sdiv i32 %122, %124
store i32 %125, i32* %27
%126 = load i32, i32* %23
%127 = load i32, i32* %13
%128 = sub nsw i32 %127, 1
%129 = icmp eq i32 %126, %128
br i1 %129, label %130, label %133
130: ; preds = %117
%131 = load i32, i32* %27
%132 = add nsw i32 %131, -1
store i32 %132, i32* %27
br label %133
133: ; preds = %130, %117
%134 = load i32, i32* %27
%135 = and i32 %134, 255
store i32 %135, i32* %30
%136 = load i32, i32* %27
%137 = ashr i32 %136, 8
store i32 %137, i32* %27
br label %139
138: ; preds = %114
store i32 0, i32* %30
store i32 0, i32* %27
br label %139
139: ; preds = %138, %133
%140 = load i8*, i8** %16
%141 = load i32, i32* %29
%142 = load i32, i32* %17
%143 = load i32, i32* %18
%144 = mul nsw i32 %142, %143
%145 = mul nsw i32 %141, %144
%146 = load i32, i32* %28
%147 = load i32, i32* %17
%148 = mul nsw i32 %146, %147
%149 = add nsw i32 %145, %148
%150 = load i32, i32* %27
%151 = add nsw i32 %149, %150
%152 = load i32, i32* %20
%153 = mul nsw i32 %151, %152
%154 = sext i32 %153 to i64
%155 = getelementptr inbounds i8, i8* %140, i64 %154
store i8* %155, i8** %38
%156 = load i8*, i8** %16
%157 = load i32, i32* %29
%158 = add nsw i32 %157, 1
%159 = load i32, i32* %17
%160 = load i32, i32* %18
%161 = mul nsw i32 %159, %160
%162 = mul nsw i32 %158, %161
%163 = load i32, i32* %28
%164 = load i32, i32* %17
%165 = mul nsw i32 %163, %164
%166 = add nsw i32 %162, %165
%167 = load i32, i32* %27
%168 = add nsw i32 %166, %167
%169 = load i32, i32* %20
%170 = mul nsw i32 %168, %169
%171 = sext i32 %170 to i64
%172 = getelementptr inbounds i8, i8* %156, i64 %171
store i8* %172, i8** %39
store i32 0, i32* %26
br label %173
173: ; preds = %295, %139
%174 = load i32, i32* %26
%175 = load i32, i32* %20
%176 = icmp slt i32 %174, %175
br i1 %176, label %177, label %298
177: ; preds = %173
%178 = load i8*, i8** %38
%179 = getelementptr inbounds i8, i8* %178, i64 0
%180 = load i8, i8* %179
%181 = zext i8 %180 to i32
%182 = load float, float* %22
%183 = fpext float %182 to double
%184 = call i32 (i32, double, ...) bitcast (i32 (...)* @gamma_correct to i32 (i32, double, ...)*)(i32 %181, double %183)
%185 = load i8*, i8** %38
%186 = load i32, i32* %20
%187 = sext i32 %186 to i64
%188 = getelementptr inbounds i8, i8* %185, i64 %187
%189 = load i8, i8* %188
%190 = zext i8 %189 to i32
%191 = load float, float* %22
%192 = fpext float %191 to double
%193 = call i32 (i32, double, ...) bitcast (i32 (...)* @gamma_correct to i32 (i32, double, ...)*)(i32 %190, double %192)
%194 = load i32, i32* %30
%195 = call i32 (i32, i32, i32, ...) bitcast (i32 (...)* @blerp to i32 (i32, i32, i32, ...)*)(i32 %184, i32 %193, i32 %194)
store i32 %195, i32* %36
%196 = load i8*, i8** %38
%197 = load i32, i32* %17
%198 = load i32, i32* %20
%199 = mul nsw i32 %197, %198
%200 = sext i32 %199 to i64
%201 = getelementptr inbounds i8, i8* %196, i64 %200
%202 = load i8, i8* %201
%203 = zext i8 %202 to i32
%204 = load float, float* %22
%205 = fpext float %204 to double
%206 = call i32 (i32, double, ...) bitcast (i32 (...)* @gamma_correct to i32 (i32, double, ...)*)(i32 %203, double %205)
%207 = load i8*, i8** %38
%208 = load i32, i32* %17
%209 = add nsw i32 %208, 1
%210 = load i32, i32* %20
%211 = mul nsw i32 %209, %210
%212 = sext i32 %211 to i64
%213 = getelementptr inbounds i8, i8* %207, i64 %212
%214 = load i8, i8* %213
%215 = zext i8 %214 to i32
%216 = load float, float* %22
%217 = fpext float %216 to double
%218 = call i32 (i32, double, ...) bitcast (i32 (...)* @gamma_correct to i32 (i32, double, ...)*)(i32 %215, double %217)
%219 = load i32, i32* %30
%220 = call i32 (i32, i32, i32, ...) bitcast (i32 (...)* @blerp to i32 (i32, i32, i32, ...)*)(i32 %206, i32 %218, i32 %219)
store i32 %220, i32* %37
%221 = load i32, i32* %36
%222 = load i32, i32* %37
%223 = load i32, i32* %31
%224 = call i32 (i32, i32, i32, ...) bitcast (i32 (...)* @blerp to i32 (i32, i32, i32, ...)*)(i32 %221, i32 %222, i32 %223)
store i32 %224, i32* %34
%225 = load i8*, i8** %39
%226 = getelementptr inbounds i8, i8* %225, i64 0
%227 = load i8, i8* %226
%228 = zext i8 %227 to i32
%229 = load float, float* %22
%230 = fpext float %229 to double
%231 = call i32 (i32, double, ...) bitcast (i32 (...)* @gamma_correct to i32 (i32, double, ...)*)(i32 %228, double %230)
%232 = load i8*, i8** %39
%233 = load i32, i32* %20
%234 = sext i32 %233 to i64
%235 = getelementptr inbounds i8, i8* %232, i64 %234
%236 = load i8, i8* %235
%237 = zext i8 %236 to i32
%238 = load float, float* %22
%239 = fpext float %238 to double
%240 = call i32 (i32, double, ...) bitcast (i32 (...)* @gamma_correct to i32 (i32, double, ...)*)(i32 %237, double %239)
%241 = load i32, i32* %30
%242 = call i32 (i32, i32, i32, ...) bitcast (i32 (...)* @blerp to i32 (i32, i32, i32, ...)*)(i32 %231, i32 %240, i32 %241)
store i32 %242, i32* %36
%243 = load i8*, i8** %39
%244 = load i32, i32* %17
%245 = load i32, i32* %20
%246 = mul nsw i32 %244, %245
%247 = sext i32 %246 to i64
%248 = getelementptr inbounds i8, i8* %243, i64 %247
%249 = load i8, i8* %248
%250 = zext i8 %249 to i32
%251 = load float, float* %22
%252 = fpext float %251 to double
%253 = call i32 (i32, double, ...) bitcast (i32 (...)* @gamma_correct to i32 (i32, double, ...)*)(i32 %250, double %252)
%254 = load i8*, i8** %39
%255 = load i32, i32* %17
%256 = add nsw i32 %255, 1
%257 = load i32, i32* %20
%258 = mul nsw i32 %256, %257
%259 = sext i32 %258 to i64
%260 = getelementptr inbounds i8, i8* %254, i64 %259
%261 = load i8, i8* %260
%262 = zext i8 %261 to i32
%263 = load float, float* %22
%264 = fpext float %263 to double
%265 = call i32 (i32, double, ...) bitcast (i32 (...)* @gamma_correct to i32 (i32, double, ...)*)(i32 %262, double %264)
%266 = load i32, i32* %30
%267 = call i32 (i32, i32, i32, ...) bitcast (i32 (...)* @blerp to i32 (i32, i32, i32, ...)*)(i32 %253, i32 %265, i32 %266)
store i32 %267, i32* %37
%268 = load i32, i32* %36
%269 = load i32, i32* %37
%270 = load i32, i32* %31
%271 = call i32 (i32, i32, i32, ...) bitcast (i32 (...)* @blerp to i32 (i32, i32, i32, ...)*)(i32 %268, i32 %269, i32 %270)
store i32 %271, i32* %35
%272 = load i32, i32* %34
%273 = load i32, i32* %35
%274 = load i32, i32* %32
%275 = call i32 (i32, i32, i32, ...) bitcast (i32 (...)* @blerp to i32 (i32, i32, i32, ...)*)(i32 %272, i32 %273, i32 %274)
store i32 %275, i32* %33
%276 = load i32, i32* %33
%277 = icmp slt i32 %276, 0
br i1 %277, label %278, label %279
278: ; preds = %177
store i32 0, i32* %33
br label %279
279: ; preds = %278, %177
%280 = load i32, i32* %33
%281 = icmp sgt i32 %280, 255
br i1 %281, label %282, label %283
282: ; preds = %279
store i32 255, i32* %33
br label %283
283: ; preds = %282, %279
%284 = load i32, i32* %33
%285 = load float, float* %41
%286 = fpext float %285 to double
%287 = call i32 (i32, double, ...) bitcast (i32 (...)* @gamma_correct to i32 (i32, double, ...)*)(i32 %284, double %286)
%288 = trunc i32 %287 to i8
%289 = load i8*, i8** %40
%290 = getelementptr inbounds i8, i8* %289, i32 1
store i8* %290, i8** %40
store i8 %288, i8* %289
%291 = load i8*, i8** %38
%292 = getelementptr inbounds i8, i8* %291, i32 1
store i8* %292, i8** %38
%293 = load i8*, i8** %39
%294 = getelementptr inbounds i8, i8* %293, i32 1
store i8* %294, i8** %39
br label %295
295: ; preds = %283
%296 = load i32, i32* %26
%297 = add nsw i32 %296, 1
store i32 %297, i32* %26
br label %173
298: ; preds = %173
br label %299
299: ; preds = %298
%300 = load i32, i32* %23
%301 = add nsw i32 %300, 1
store i32 %301, i32* %23
br label %110
302: ; preds = %110
br label %303
303: ; preds = %302
%304 = load i32, i32* %24
%305 = add nsw i32 %304, 1
store i32 %305, i32* %24
br label %80
306: ; preds = %80
br label %307
307: ; preds = %306
%308 = load i32, i32* %25
%309 = add nsw i32 %308, 1
store i32 %309, i32* %25
br label %50
310: ; preds = %50
br label %546
311: ; preds = %11
store i32 0, i32* %25
br label %312
312: ; preds = %542, %311
%313 = load i32, i32* %25
%314 = load i32, i32* %15
%315 = icmp slt i32 %313, %314
br i1 %315, label %316, label %545
316: ; preds = %312
%317 = load i32, i32* %15
%318 = icmp sgt i32 %317, 1
br i1 %318, label %319, label %340
319: ; preds = %316
%320 = load i32, i32* %19
%321 = sub nsw i32 %320, 1
%322 = load i32, i32* %25
%323 = mul nsw i32 %321, %322
%324 = shl i32 %323, 8
%325 = load i32, i32* %15
%326 = sub nsw i32 %325, 1
%327 = sdiv i32 %324, %326
store i32 %327, i32* %29
%328 = load i32, i32* %25
%329 = load i32, i32* %15
%330 = sub nsw i32 %329, 1
%331 = icmp eq i32 %328, %330
br i1 %331, label %332, label %335
332: ; preds = %319
%333 = load i32, i32* %29
%334 = add nsw i32 %333, -1
store i32 %334, i32* %29
br label %335
335: ; preds = %332, %319
%336 = load i32, i32* %29
%337 = and i32 %336, 255
store i32 %337, i32* %32
%338 = load i32, i32* %29
%339 = ashr i32 %338, 8
store i32 %339, i32* %29
br label %341
340: ; preds = %316
store i32 0, i32* %32
store i32 0, i32* %29
br label %341
341: ; preds = %340, %335
store i32 0, i32* %24
br label %342
342: ; preds = %538, %341
%343 = load i32, i32* %24
%344 = load i32, i32* %14
%345 = icmp slt i32 %343, %344
br i1 %345, label %346, label %541
346: ; preds = %342
%347 = load i32, i32* %14
%348 = icmp sgt i32 %347, 1
br i1 %348, label %349, label %370
349: ; preds = %346
%350 = load i32, i32* %18
%351 = sub nsw i32 %350, 1
%352 = load i32, i32* %24
%353 = mul nsw i32 %351, %352
%354 = shl i32 %353, 8
%355 = load i32, i32* %14
%356 = sub nsw i32 %355, 1
%357 = sdiv i32 %354, %356
store i32 %357, i32* %28
%358 = load i32, i32* %24
%359 = load i32, i32* %14
%360 = sub nsw i32 %359, 1
%361 = icmp eq i32 %358, %360
br i1 %361, label %362, label %365
362: ; preds = %349
%363 = load i32, i32* %28
%364 = add nsw i32 %363, -1
store i32 %364, i32* %28
br label %365
365: ; preds = %362, %349
%366 = load i32, i32* %28
%367 = and i32 %366, 255
store i32 %367, i32* %31
%368 = load i32, i32* %28
%369 = ashr i32 %368, 8
store i32 %369, i32* %28
br label %371
370: ; preds = %346
store i32 0, i32* %31
store i32 0, i32* %28
br label %371
371: ; preds = %370, %365
store i32 0, i32* %23
br label %372
372: ; preds = %534, %371
%373 = load i32, i32* %23
%374 = load i32, i32* %13
%375 = icmp slt i32 %373, %374
br i1 %375, label %376, label %537
376: ; preds = %372
%377 = load i32, i32* %13
%378 = icmp sgt i32 %377, 1
br i1 %378, label %379, label %400
379: ; preds = %376
%380 = load i32, i32* %17
%381 = sub nsw i32 %380, 1
%382 = load i32, i32* %23
%383 = mul nsw i32 %381, %382
%384 = shl i32 %383, 8
%385 = load i32, i32* %13
%386 = sub nsw i32 %385, 1
%387 = sdiv i32 %384, %386
store i32 %387, i32* %27
%388 = load i32, i32* %23
%389 = load i32, i32* %13
%390 = sub nsw i32 %389, 1
%391 = icmp eq i32 %388, %390
br i1 %391, label %392, label %395
392: ; preds = %379
%393 = load i32, i32* %27
%394 = add nsw i32 %393, -1
store i32 %394, i32* %27
br label %395
395: ; preds = %392, %379
%396 = load i32, i32* %27
%397 = and i32 %396, 255
store i32 %397, i32* %30
%398 = load i32, i32* %27
%399 = ashr i32 %398, 8
store i32 %399, i32* %27
br label %401
400: ; preds = %376
store i32 0, i32* %30
store i32 0, i32* %27
br label %401
401: ; preds = %400, %395
%402 = load i8*, i8** %16
%403 = load i32, i32* %29
%404 = load i32, i32* %17
%405 = load i32, i32* %18
%406 = mul nsw i32 %404, %405
%407 = mul nsw i32 %403, %406
%408 = load i32, i32* %28
%409 = load i32, i32* %17
%410 = mul nsw i32 %408, %409
%411 = add nsw i32 %407, %410
%412 = load i32, i32* %27
%413 = add nsw i32 %411, %412
%414 = load i32, i32* %20
%415 = mul nsw i32 %413, %414
%416 = sext i32 %415 to i64
%417 = getelementptr inbounds i8, i8* %402, i64 %416
store i8* %417, i8** %38
%418 = load i8*, i8** %16
%419 = load i32, i32* %29
%420 = add nsw i32 %419, 1
%421 = load i32, i32* %17
%422 = load i32, i32* %18
%423 = mul nsw i32 %421, %422
%424 = mul nsw i32 %420, %423
%425 = load i32, i32* %28
%426 = load i32, i32* %17
%427 = mul nsw i32 %425, %426
%428 = add nsw i32 %424, %427
%429 = load i32, i32* %27
%430 = add nsw i32 %428, %429
%431 = load i32, i32* %20
%432 = mul nsw i32 %430, %431
%433 = sext i32 %432 to i64
%434 = getelementptr inbounds i8, i8* %418, i64 %433
store i8* %434, i8** %39
store i32 0, i32* %26
br label %435
435: ; preds = %530, %401
%436 = load i32, i32* %26
%437 = load i32, i32* %20
%438 = icmp slt i32 %436, %437
br i1 %438, label %439, label %533
439: ; preds = %435
%440 = load i8*, i8** %38
%441 = getelementptr inbounds i8, i8* %440, i64 0
%442 = load i8, i8* %441
%443 = zext i8 %442 to i32
%444 = load i8*, i8** %38
%445 = load i32, i32* %20
%446 = sext i32 %445 to i64
%447 = getelementptr inbounds i8, i8* %444, i64 %446
%448 = load i8, i8* %447
%449 = zext i8 %448 to i32
%450 = load i32, i32* %30
%451 = call i32 (i32, i32, i32, ...) bitcast (i32 (...)* @blerp to i32 (i32, i32, i32, ...)*)(i32 %443, i32 %449, i32 %450)
store i32 %451, i32* %36
%452 = load i8*, i8** %38
%453 = load i32, i32* %17
%454 = load i32, i32* %20
%455 = mul nsw i32 %453, %454
%456 = sext i32 %455 to i64
%457 = getelementptr inbounds i8, i8* %452, i64 %456
%458 = load i8, i8* %457
%459 = zext i8 %458 to i32
%460 = load i8*, i8** %38
%461 = load i32, i32* %17
%462 = add nsw i32 %461, 1
%463 = load i32, i32* %20
%464 = mul nsw i32 %462, %463
%465 = sext i32 %464 to i64
%466 = getelementptr inbounds i8, i8* %460, i64 %465
%467 = load i8, i8* %466
%468 = zext i8 %467 to i32
%469 = load i32, i32* %30
%470 = call i32 (i32, i32, i32, ...) bitcast (i32 (...)* @blerp to i32 (i32, i32, i32, ...)*)(i32 %459, i32 %468, i32 %469)
store i32 %470, i32* %37
%471 = load i32, i32* %36
%472 = load i32, i32* %37
%473 = load i32, i32* %31
%474 = call i32 (i32, i32, i32, ...) bitcast (i32 (...)* @blerp to i32 (i32, i32, i32, ...)*)(i32 %471, i32 %472, i32 %473)
store i32 %474, i32* %34
%475 = load i8*, i8** %39
%476 = getelementptr inbounds i8, i8* %475, i64 0
%477 = load i8, i8* %476
%478 = zext i8 %477 to i32
%479 = load i8*, i8** %39
%480 = load i32, i32* %20
%481 = sext i32 %480 to i64
%482 = getelementptr inbounds i8, i8* %479, i64 %481
%483 = load i8, i8* %482
%484 = zext i8 %483 to i32
%485 = load i32, i32* %30
%486 = call i32 (i32, i32, i32, ...) bitcast (i32 (...)* @blerp to i32 (i32, i32, i32, ...)*)(i32 %478, i32 %484, i32 %485)
store i32 %486, i32* %36
%487 = load i8*, i8** %39
%488 = load i32, i32* %17
%489 = load i32, i32* %20
%490 = mul nsw i32 %488, %489
%491 = sext i32 %490 to i64
%492 = getelementptr inbounds i8, i8* %487, i64 %491
%493 = load i8, i8* %492
%494 = zext i8 %493 to i32
%495 = load i8*, i8** %39
%496 = load i32, i32* %17
%497 = add nsw i32 %496, 1
%498 = load i32, i32* %20
%499 = mul nsw i32 %497, %498
%500 = sext i32 %499 to i64
%501 = getelementptr inbounds i8, i8* %495, i64 %500
%502 = load i8, i8* %501
%503 = zext i8 %502 to i32
%504 = load i32, i32* %30
%505 = call i32 (i32, i32, i32, ...) bitcast (i32 (...)* @blerp to i32 (i32, i32, i32, ...)*)(i32 %494, i32 %503, i32 %504)
store i32 %505, i32* %37
%506 = load i32, i32* %36
%507 = load i32, i32* %37
%508 = load i32, i32* %31
%509 = call i32 (i32, i32, i32, ...) bitcast (i32 (...)* @blerp to i32 (i32, i32, i32, ...)*)(i32 %506, i32 %507, i32 %508)
store i32 %509, i32* %35
%510 = load i32, i32* %34
%511 = load i32, i32* %35
%512 = load i32, i32* %32
%513 = call i32 (i32, i32, i32, ...) bitcast (i32 (...)* @blerp to i32 (i32, i32, i32, ...)*)(i32 %510, i32 %511, i32 %512)
store i32 %513, i32* %33
%514 = load i32, i32* %33
%515 = icmp slt i32 %514, 0
br i1 %515, label %516, label %517
516: ; preds = %439
store i32 0, i32* %33
br label %517
517: ; preds = %516, %439
%518 = load i32, i32* %33
%519 = icmp sgt i32 %518, 255
br i1 %519, label %520, label %521
520: ; preds = %517
store i32 255, i32* %33
br label %521
521: ; preds = %520, %517
%522 = load i32, i32* %33
%523 = trunc i32 %522 to i8
%524 = load i8*, i8** %40
%525 = getelementptr inbounds i8, i8* %524, i32 1
store i8* %525, i8** %40
store i8 %523, i8* %524
%526 = load i8*, i8** %38
%527 = getelementptr inbounds i8, i8* %526, i32 1
store i8* %527, i8** %38
%528 = load i8*, i8** %39
%529 = getelementptr inbounds i8, i8* %528, i32 1
store i8* %529, i8** %39
br label %530
530: ; preds = %521
%531 = load i32, i32* %26
%532 = add nsw i32 %531, 1
store i32 %532, i32* %26
br label %435
533: ; preds = %435
br label %534
534: ; preds = %533
%535 = load i32, i32* %23
%536 = add nsw i32 %535, 1
store i32 %536, i32* %23
br label %372
537: ; preds = %372
br label %538
538: ; preds = %537
%539 = load i32, i32* %24
%540 = add nsw i32 %539, 1
store i32 %540, i32* %24
br label %342
541: ; preds = %342
br label %542
542: ; preds = %541
%543 = load i32, i32* %25
%544 = add nsw i32 %543, 1
store i32 %544, i32* %25
br label %312
545: ; preds = %312
br label %546
546: ; preds = %545, %310
ret void
}

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