#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int blerp(int, int, int);
int gamma_correct(int, float);
void scale_image_bilinear(unsigned char *dst, int dw, int dh,
                          unsigned char *src, int sw, int sh, int bpp, int gc,
                          float gamma) {
  int x, y, n, ix, iy, wx, wy, v, v0, v1;
  int dstride = dw * bpp;
  unsigned char *s;
  float invgamma;
  if (gc) {
    invgamma = 1.0 / gamma;
    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;
        s = src + (iy * sw + ix) * bpp;
        for (n = 0; n < bpp; ++n) {
          v0 = blerp(gamma_correct(s[0], gamma), gamma_correct(s[bpp], gamma),
                     wx);
          v1 = blerp(gamma_correct(s[sw * bpp], gamma),
                     gamma_correct(s[(sw + 1) * bpp], gamma), wx);
          v = blerp(v0, v1, wy);
          dst[(y * dstride) + (x * bpp) + n] = gamma_correct(v, invgamma);
          ++s;
        }
      }
    }
  } else {
    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;
        s = src + (iy * sw + ix) * bpp;
        for (n = 0; n < bpp; ++n) {
          v0 = blerp(s[0], s[bpp], wx);
          v1 = blerp(s[sw * bpp], s[(sw + 1) * bpp], wx);
          v = blerp(v0, v1, wy);
          if (v < 0)
            v = 0;
          if (v > 255)
            v = 255;
          dst[(y * dstride) + (x * bpp) + n] = v;
          ++s;
        }
      }
    }
  }
}


x86 assembly (clang, -O0):
<scale_image_bilinear>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%eax
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
mov    %r9d,-0x20(%rbp)
movss  %xmm0,-0x24(%rbp)
mov    -0xc(%rbp),%eax
imul   0x10(%rbp),%eax
mov    %eax,-0x50(%rbp)
cmpl   $0x0,0x18(%rbp)
je     13a2 <scale_image_bilinear+0x282>
movss  -0x24(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe92(%rip),%xmm0
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x5c(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    139d <scale_image_bilinear+0x27d>
cmpl   $0x1,-0x10(%rbp)
jle    11e4 <scale_image_bilinear+0xc4>
mov    -0x20(%rbp),%eax
sub    $0x1,%eax
imul   -0x2c(%rbp),%eax
shl    $0x8,%eax
mov    -0x10(%rbp),%ecx
sub    $0x1,%ecx
cltd
idiv   %ecx
mov    %eax,-0x38(%rbp)
mov    -0x2c(%rbp),%eax
mov    -0x10(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jne    11cb <scale_image_bilinear+0xab>
mov    -0x38(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x38(%rbp)
mov    -0x38(%rbp),%eax
and    $0xff,%eax
mov    %eax,-0x40(%rbp)
mov    -0x38(%rbp),%eax
sar    $0x8,%eax
mov    %eax,-0x38(%rbp)
jmp    11f2 <scale_image_bilinear+0xd2>
movl   $0x0,-0x40(%rbp)
movl   $0x0,-0x38(%rbp)
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    138a <scale_image_bilinear+0x26a>
cmpl   $0x1,-0xc(%rbp)
jle    125b <scale_image_bilinear+0x13b>
mov    -0x1c(%rbp),%eax
sub    $0x1,%eax
imul   -0x28(%rbp),%eax
shl    $0x8,%eax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
cltd
idiv   %ecx
mov    %eax,-0x34(%rbp)
mov    -0x28(%rbp),%eax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jne    1242 <scale_image_bilinear+0x122>
mov    -0x34(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%eax
and    $0xff,%eax
mov    %eax,-0x3c(%rbp)
mov    -0x34(%rbp),%eax
sar    $0x8,%eax
mov    %eax,-0x34(%rbp)
jmp    1269 <scale_image_bilinear+0x149>
movl   $0x0,-0x3c(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x38(%rbp),%ecx
imul   -0x1c(%rbp),%ecx
add    -0x34(%rbp),%ecx
imul   0x10(%rbp),%ecx
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x58(%rbp)
movl   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    0x10(%rbp),%eax
jge    1377 <scale_image_bilinear+0x257>
mov    -0x58(%rbp),%rax
movzbl (%rax),%edi
movss  -0x24(%rbp),%xmm0
call   1030 <gamma_correct@plt>
mov    %eax,-0x64(%rbp)
mov    -0x58(%rbp),%rax
movslq 0x10(%rbp),%rcx
movzbl (%rax,%rcx,1),%edi
movss  -0x24(%rbp),%xmm0
call   1030 <gamma_correct@plt>
mov    -0x64(%rbp),%edi
mov    %eax,%esi
mov    -0x3c(%rbp),%edx
call   1040 <blerp@plt>
mov    %eax,-0x48(%rbp)
mov    -0x58(%rbp),%rax
mov    -0x1c(%rbp),%ecx
imul   0x10(%rbp),%ecx
movslq %ecx,%rcx
movzbl (%rax,%rcx,1),%edi
movss  -0x24(%rbp),%xmm0
call   1030 <gamma_correct@plt>
mov    %eax,-0x60(%rbp)
mov    -0x58(%rbp),%rax
mov    -0x1c(%rbp),%ecx
add    $0x1,%ecx
imul   0x10(%rbp),%ecx
movslq %ecx,%rcx
movzbl (%rax,%rcx,1),%edi
movss  -0x24(%rbp),%xmm0
call   1030 <gamma_correct@plt>
mov    -0x60(%rbp),%edi
mov    %eax,%esi
mov    -0x3c(%rbp),%edx
call   1040 <blerp@plt>
mov    %eax,-0x4c(%rbp)
mov    -0x48(%rbp),%edi
mov    -0x4c(%rbp),%esi
mov    -0x40(%rbp),%edx
call   1040 <blerp@plt>
mov    %eax,-0x44(%rbp)
mov    -0x44(%rbp),%edi
movss  -0x5c(%rbp),%xmm0
call   1030 <gamma_correct@plt>
mov    %al,%dl
mov    -0x8(%rbp),%rax
mov    -0x2c(%rbp),%ecx
imul   -0x50(%rbp),%ecx
mov    -0x28(%rbp),%esi
imul   0x10(%rbp),%esi
add    %esi,%ecx
add    -0x30(%rbp),%ecx
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x58(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x58(%rbp)
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    128c <scale_image_bilinear+0x16c>
jmp    137c <scale_image_bilinear+0x25c>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    11f9 <scale_image_bilinear+0xd9>
jmp    138f <scale_image_bilinear+0x26f>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1182 <scale_image_bilinear+0x62>
jmp    15ac <scale_image_bilinear+0x48c>
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    15a7 <scale_image_bilinear+0x487>
cmpl   $0x1,-0x10(%rbp)
jle    140b <scale_image_bilinear+0x2eb>
mov    -0x20(%rbp),%eax
sub    $0x1,%eax
imul   -0x2c(%rbp),%eax
shl    $0x8,%eax
mov    -0x10(%rbp),%ecx
sub    $0x1,%ecx
cltd
idiv   %ecx
mov    %eax,-0x38(%rbp)
mov    -0x2c(%rbp),%eax
mov    -0x10(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jne    13f2 <scale_image_bilinear+0x2d2>
mov    -0x38(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x38(%rbp)
mov    -0x38(%rbp),%eax
and    $0xff,%eax
mov    %eax,-0x40(%rbp)
mov    -0x38(%rbp),%eax
sar    $0x8,%eax
mov    %eax,-0x38(%rbp)
jmp    1419 <scale_image_bilinear+0x2f9>
movl   $0x0,-0x40(%rbp)
movl   $0x0,-0x38(%rbp)
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1594 <scale_image_bilinear+0x474>
cmpl   $0x1,-0xc(%rbp)
jle    1482 <scale_image_bilinear+0x362>
mov    -0x1c(%rbp),%eax
sub    $0x1,%eax
imul   -0x28(%rbp),%eax
shl    $0x8,%eax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
cltd
idiv   %ecx
mov    %eax,-0x34(%rbp)
mov    -0x28(%rbp),%eax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jne    1469 <scale_image_bilinear+0x349>
mov    -0x34(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%eax
and    $0xff,%eax
mov    %eax,-0x3c(%rbp)
mov    -0x34(%rbp),%eax
sar    $0x8,%eax
mov    %eax,-0x34(%rbp)
jmp    1490 <scale_image_bilinear+0x370>
movl   $0x0,-0x3c(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x38(%rbp),%ecx
imul   -0x1c(%rbp),%ecx
add    -0x34(%rbp),%ecx
imul   0x10(%rbp),%ecx
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x58(%rbp)
movl   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    0x10(%rbp),%eax
jge    1581 <scale_image_bilinear+0x461>
mov    -0x58(%rbp),%rax
movzbl (%rax),%edi
mov    -0x58(%rbp),%rax
movslq 0x10(%rbp),%rcx
movzbl (%rax,%rcx,1),%esi
mov    -0x3c(%rbp),%edx
call   1040 <blerp@plt>
mov    %eax,-0x48(%rbp)
mov    -0x58(%rbp),%rax
mov    -0x1c(%rbp),%ecx
imul   0x10(%rbp),%ecx
movslq %ecx,%rcx
movzbl (%rax,%rcx,1),%edi
mov    -0x58(%rbp),%rax
mov    -0x1c(%rbp),%ecx
add    $0x1,%ecx
imul   0x10(%rbp),%ecx
movslq %ecx,%rcx
movzbl (%rax,%rcx,1),%esi
mov    -0x3c(%rbp),%edx
call   1040 <blerp@plt>
mov    %eax,-0x4c(%rbp)
mov    -0x48(%rbp),%edi
mov    -0x4c(%rbp),%esi
mov    -0x40(%rbp),%edx
call   1040 <blerp@plt>
mov    %eax,-0x44(%rbp)
cmpl   $0x0,-0x44(%rbp)
jge    1531 <scale_image_bilinear+0x411>
movl   $0x0,-0x44(%rbp)
cmpl   $0xff,-0x44(%rbp)
jle    1545 <scale_image_bilinear+0x425>
movl   $0xff,-0x44(%rbp)
mov    -0x44(%rbp),%eax
mov    %al,%dl
mov    -0x8(%rbp),%rax
mov    -0x2c(%rbp),%ecx
imul   -0x50(%rbp),%ecx
mov    -0x28(%rbp),%esi
imul   0x10(%rbp),%esi
add    %esi,%ecx
add    -0x30(%rbp),%ecx
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x58(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x58(%rbp)
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    14b3 <scale_image_bilinear+0x393>
jmp    1586 <scale_image_bilinear+0x466>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1420 <scale_image_bilinear+0x300>
jmp    1599 <scale_image_bilinear+0x479>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    13a9 <scale_image_bilinear+0x289>
jmp    15ac <scale_image_bilinear+0x48c>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<scale_image_bilinear>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xd8,%rsp
mov    %r8,0x30(%rsp)
mov    %rcx,0x40(%rsp)
mov    %rdi,0x38(%rsp)
mov    0x110(%rsp),%eax
mov    %rsi,0x20(%rsp)
imul   %esi,%eax
cmpl   $0x0,0x118(%rsp)
mov    %rdx,0xb8(%rsp)
je     1435 <scale_image_bilinear+0x315>
test   %edx,%edx
jle    1698 <scale_image_bilinear+0x578>
movss  0xe8b(%rip),%xmm1
divss  %xmm0,%xmm1
movss  %xmm1,0x98(%rsp)
shl    $0x8,%r9d
add    $0xffffff00,%r9d
mov    %r9d,0x14(%rsp)
lea    -0x1(%rdx),%ecx
mov    %rcx,0xc0(%rsp)
mov    0x30(%rsp),%rsi
mov    %esi,%ecx
shl    $0x8,%ecx
add    $0xffffff00,%ecx
mov    %ecx,0x60(%rsp)
mov    0x20(%rsp),%rdi
lea    -0x1(%rdi),%ecx
mov    %rcx,0x58(%rsp)
mov    0x110(%rsp),%r8d
movslq %r8d,%rbx
mov    %r8d,%ecx
imul   %esi,%ecx
movslq %ecx,%rbp
lea    0x1(%rsi),%ecx
imul   %r8d,%ecx
movslq %ecx,%rcx
cltq
mov    %rax,0xd0(%rsp)
mov    %edx,%eax
mov    %rax,0xc8(%rsp)
mov    %edi,%eax
mov    %rax,0x80(%rsp)
mov    %ebx,%edi
mov    0x40(%rsp),%rax
mov    %rbx,0x88(%rsp)
lea    (%rax,%rbx,1),%rsi
mov    %rsi,0x68(%rsp)
add    %rax,%rbp
mov    %rbp,0x78(%rsp)
add    %rax,%rcx
mov    %rcx,0x70(%rsp)
xor    %esi,%esi
movss  %xmm0,0x8(%rsp)
mov    %rdi,0x90(%rsp)
jmp    126c <scale_image_bilinear+0x14c>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    0x50(%rsp),%rsi
add    $0x1,%rsi
mov    0xd0(%rsp),%rax
add    %rax,0x38(%rsp)
cmp    0xc8(%rsp),%rsi
mov    0xb8(%rsp),%rdx
je     1698 <scale_image_bilinear+0x578>
movl   $0x0,0x18(%rsp)
mov    $0x0,%r13d
cmp    $0x1,%edx
je     12a6 <scale_image_bilinear+0x186>
mov    0x14(%rsp),%eax
imul   %esi,%eax
cltd
mov    0xc0(%rsp),%rcx
idiv   %ecx
xor    %edx,%edx
cmp    %rcx,%rsi
sete   %dl
sub    %edx,%eax
movzbl %al,%r13d
sar    $0x8,%eax
mov    %eax,0x18(%rsp)
mov    %rsi,0x50(%rsp)
cmpl   $0x0,0x20(%rsp)
jle    1240 <scale_image_bilinear+0x120>
mov    0x18(%rsp),%eax
imul   0x30(%rsp),%eax
mov    %eax,0x18(%rsp)
mov    0x38(%rsp),%r15
xor    %ecx,%ecx
jmp    12ef <scale_image_bilinear+0x1cf>
nopl   0x0(%rax,%rax,1)
mov    0x28(%rsp),%rcx
add    $0x1,%rcx
add    0x88(%rsp),%r15
cmp    0x80(%rsp),%rcx
je     1240 <scale_image_bilinear+0x120>
xor    %eax,%eax
mov    $0x0,%ebp
cmpl   $0x2,0x20(%rsp)
jl     131d <scale_image_bilinear+0x1fd>
mov    0x60(%rsp),%eax
imul   %ecx,%eax
cltd
mov    0x58(%rsp),%r8
idiv   %r8d
xor    %edx,%edx
cmp    %r8,%rcx
sete   %dl
sub    %edx,%eax
movzbl %al,%ebp
sar    $0x8,%eax
mov    %rcx,0x28(%rsp)
cmpl   $0x0,0x110(%rsp)
jle    12d0 <scale_image_bilinear+0x1b0>
add    0x18(%rsp),%eax
imul   0x110(%rsp),%eax
movslq %eax,%rcx
mov    0x40(%rsp),%rax
add    %rcx,%rax
mov    %rax,0x48(%rsp)
mov    0x68(%rsp),%rax
add    %rcx,%rax
mov    %rax,0xa8(%rsp)
mov    0x78(%rsp),%rax
add    %rcx,%rax
mov    %rax,0xa0(%rsp)
add    0x70(%rsp),%rcx
mov    %rcx,0xb0(%rsp)
xor    %r14d,%r14d
nopl   0x0(%rax,%rax,1)
mov    0x48(%rsp),%rax
movzbl (%rax,%r14,1),%edi
movss  0x8(%rsp),%xmm0
call   1030 <gamma_correct@plt>
mov    %eax,%ebx
mov    0xa8(%rsp),%rax
movzbl (%rax,%r14,1),%edi
movss  0x8(%rsp),%xmm0
call   1030 <gamma_correct@plt>
mov    %ebx,%edi
mov    %eax,%esi
mov    %ebp,%edx
call   1040 <blerp@plt>
mov    %eax,%ebx
mov    0xa0(%rsp),%rax
movzbl (%rax,%r14,1),%edi
movss  0x8(%rsp),%xmm0
call   1030 <gamma_correct@plt>
mov    %eax,%r12d
mov    0xb0(%rsp),%rax
movzbl (%rax,%r14,1),%edi
movss  0x8(%rsp),%xmm0
call   1030 <gamma_correct@plt>
mov    %r12d,%edi
mov    %eax,%esi
mov    %ebp,%edx
call   1040 <blerp@plt>
mov    %ebx,%edi
mov    %eax,%esi
mov    %r13d,%edx
call   1040 <blerp@plt>
mov    %eax,%edi
movss  0x98(%rsp),%xmm0
call   1030 <gamma_correct@plt>
mov    0x90(%rsp),%rdi
mov    %al,(%r15,%r14,1)
add    $0x1,%r14
cmp    %r14,%rdi
jne    1380 <scale_image_bilinear+0x260>
jmp    12d0 <scale_image_bilinear+0x1b0>
test   %edx,%edx
jle    1698 <scale_image_bilinear+0x578>
shl    $0x8,%r9d
add    $0xffffff00,%r9d
mov    %r9d,0x14(%rsp)
lea    -0x1(%rdx),%ecx
mov    %rcx,0x50(%rsp)
mov    0x30(%rsp),%rsi
mov    %esi,%ecx
shl    $0x8,%ecx
add    $0xffffff00,%ecx
mov    %ecx,0x78(%rsp)
mov    0x20(%rsp),%rdi
lea    -0x1(%rdi),%ecx
mov    %rcx,0x70(%rsp)
mov    0x110(%rsp),%r8d
movslq %r8d,%rbx
mov    %r8d,%ecx
imul   %esi,%ecx
movslq %ecx,%rbp
lea    0x1(%rsi),%ecx
imul   %r8d,%ecx
movslq %ecx,%rcx
cltq
mov    %rax,0x60(%rsp)
mov    %edx,%eax
mov    %rax,0x58(%rsp)
mov    %edi,%eax
mov    %rax,0x90(%rsp)
mov    %r8d,%eax
mov    %rax,0xa8(%rsp)
mov    0x40(%rsp),%rax
mov    %rbx,0x98(%rsp)
lea    (%rax,%rbx,1),%rsi
mov    %rsi,0x18(%rsp)
add    %rax,%rbp
mov    %rbp,0x88(%rsp)
add    %rax,%rcx
mov    %rcx,0x80(%rsp)
xor    %esi,%esi
jmp    1516 <scale_image_bilinear+0x3f6>
nopw   0x0(%rax,%rax,1)
mov    0x68(%rsp),%rsi
add    $0x1,%rsi
mov    0x60(%rsp),%rax
add    %rax,0x38(%rsp)
cmp    0x58(%rsp),%rsi
mov    0xb8(%rsp),%rdx
je     1698 <scale_image_bilinear+0x578>
movl   $0x0,0x28(%rsp)
movl   $0x0,0x48(%rsp)
cmp    $0x1,%edx
je     1552 <scale_image_bilinear+0x432>
mov    0x14(%rsp),%eax
imul   %esi,%eax
cltd
mov    0x50(%rsp),%rcx
idiv   %ecx
xor    %edx,%edx
cmp    %rcx,%rsi
sete   %dl
sub    %edx,%eax
movzbl %al,%ecx
mov    %ecx,0x48(%rsp)
sar    $0x8,%eax
mov    %eax,0x28(%rsp)
mov    %rsi,0x68(%rsp)
cmpl   $0x0,0x20(%rsp)
jle    14f0 <scale_image_bilinear+0x3d0>
mov    0x28(%rsp),%eax
imul   0x30(%rsp),%eax
mov    %eax,0x28(%rsp)
mov    0x38(%rsp),%rax
mov    %rax,0x8(%rsp)
xor    %edi,%edi
jmp    15ac <scale_image_bilinear+0x48c>
nopl   0x0(%rax)
mov    0xa0(%rsp),%rdi
add    $0x1,%rdi
mov    0x8(%rsp),%rax
add    0x98(%rsp),%rax
mov    %rax,0x8(%rsp)
cmp    0x90(%rsp),%rdi
je     14f0 <scale_image_bilinear+0x3d0>
xor    %eax,%eax
mov    $0x0,%ebx
cmpl   $0x2,0x20(%rsp)
jl     15d9 <scale_image_bilinear+0x4b9>
mov    0x78(%rsp),%eax
imul   %edi,%eax
cltd
mov    0x70(%rsp),%rsi
idiv   %esi
xor    %ecx,%ecx
cmp    %rsi,%rdi
sete   %cl
sub    %ecx,%eax
movzbl %al,%ebx
sar    $0x8,%eax
mov    %rdi,0xa0(%rsp)
cmpl   $0x0,0x110(%rsp)
jle    1580 <scale_image_bilinear+0x460>
add    0x28(%rsp),%eax
imul   0x110(%rsp),%eax
movslq %eax,%r14
mov    0x40(%rsp),%rax
add    %r14,%rax
mov    %rax,0xb0(%rsp)
mov    0x18(%rsp),%rax
lea    (%rax,%r14,1),%r15
mov    0x88(%rsp),%rax
lea    (%rax,%r14,1),%r12
add    0x80(%rsp),%r14
xor    %r13d,%r13d
jmp    164b <scale_image_bilinear+0x52b>
nopl   0x0(%rax)
mov    0x8(%rsp),%rcx
mov    %al,(%rcx,%r13,1)
add    $0x1,%r13
cmp    %r13,0xa8(%rsp)
je     1580 <scale_image_bilinear+0x460>
mov    0xb0(%rsp),%rax
movzbl (%rax,%r13,1),%edi
movzbl (%r15,%r13,1),%esi
mov    %ebx,%edx
call   1040 <blerp@plt>
mov    %eax,%ebp
movzbl (%r12,%r13,1),%edi
movzbl (%r14,%r13,1),%esi
mov    %ebx,%edx
call   1040 <blerp@plt>
mov    %ebp,%edi
mov    %eax,%esi
mov    0x48(%rsp),%edx
call   1040 <blerp@plt>
test   %eax,%eax
jns    168a <scale_image_bilinear+0x56a>
xor    %eax,%eax
cmp    $0xff,%eax
jb     1630 <scale_image_bilinear+0x510>
mov    $0xff,%eax
jmp    1630 <scale_image_bilinear+0x510>
add    $0xd8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @scale_image_bilinear(i8* nocapture writeonly %0, i32 %1, i32 %2, i8* nocapture %3, i32 %4, i32 %5, i32 %6, i32 %7, float %8) {
%10 = mul nsw i32 %6, %1
%11 = icmp eq i32 %7, 0
br i1 %11, label %12, label %37
12: ; preds = %9
%13 = icmp sgt i32 %2, 0
br i1 %13, label %14, label %206
14: ; preds = %12
%15 = icmp eq i32 %2, 1
%16 = shl i32 %5, 8
%17 = add i32 %16, -256
%18 = add nsw i32 %2, -1
%19 = icmp sgt i32 %1, 0
%20 = icmp sgt i32 %1, 1
%21 = shl i32 %4, 8
%22 = add i32 %21, -256
%23 = add nsw i32 %1, -1
%24 = icmp sgt i32 %6, 0
%25 = sext i32 %6 to i64
%26 = mul nsw i32 %6, %4
%27 = sext i32 %26 to i64
%28 = add nsw i32 %4, 1
%29 = mul nsw i32 %28, %6
%30 = sext i32 %29 to i64
%31 = zext i32 %23 to i64
%32 = zext i32 %18 to i64
%33 = sext i32 %10 to i64
%34 = zext i32 %2 to i64
%35 = zext i32 %1 to i64
%36 = zext i32 %6 to i64
br label %135
37: ; preds = %9
%38 = fdiv float 1.000000e+00, %8
%39 = icmp sgt i32 %2, 0
br i1 %39, label %40, label %206
40: ; preds = %37
%41 = icmp eq i32 %2, 1
%42 = shl i32 %5, 8
%43 = add i32 %42, -256
%44 = add nsw i32 %2, -1
%45 = icmp sgt i32 %1, 0
%46 = icmp sgt i32 %1, 1
%47 = shl i32 %4, 8
%48 = add i32 %47, -256
%49 = add nsw i32 %1, -1
%50 = icmp sgt i32 %6, 0
%51 = sext i32 %6 to i64
%52 = mul nsw i32 %6, %4
%53 = sext i32 %52 to i64
%54 = add nsw i32 %4, 1
%55 = mul nsw i32 %54, %6
%56 = sext i32 %55 to i64
%57 = zext i32 %49 to i64
%58 = zext i32 %44 to i64
%59 = sext i32 %10 to i64
%60 = zext i32 %2 to i64
%61 = zext i32 %1 to i64
%62 = zext i32 %6 to i64
br label %63
63: ; preds = %40, %132
%64 = phi i64 [ 0, %40 ], [ %133, %132 ]
br i1 %41, label %74, label %65
65: ; preds = %63
%66 = trunc i64 %64 to i32
%67 = mul i32 %43, %66
%68 = sdiv i32 %67, %44
%69 = icmp eq i64 %64, %58
%70 = sext i1 %69 to i32
%71 = add nsw i32 %68, %70
%72 = and i32 %71, 255
%73 = ashr i32 %71, 8
br label %74
74: ; preds = %63, %65
%75 = phi i32 [ %73, %65 ], [ 0, %63 ]
%76 = phi i32 [ %72, %65 ], [ 0, %63 ]
br i1 %45, label %77, label %132
77: ; preds = %74
%78 = mul nsw i32 %75, %4
%79 = mul nsw i64 %64, %59
br label %80
80: ; preds = %77, %129
%81 = phi i64 [ 0, %77 ], [ %130, %129 ]
br i1 %46, label %82, label %91
82: ; preds = %80
%83 = trunc i64 %81 to i32
%84 = mul i32 %48, %83
%85 = sdiv i32 %84, %49
%86 = icmp eq i64 %81, %57
%87 = sext i1 %86 to i32
%88 = add nsw i32 %85, %87
%89 = and i32 %88, 255
%90 = ashr i32 %88, 8
br label %91
91: ; preds = %80, %82
%92 = phi i32 [ %90, %82 ], [ 0, %80 ]
%93 = phi i32 [ %89, %82 ], [ 0, %80 ]
br i1 %50, label %94, label %129
94: ; preds = %91
%95 = add nsw i32 %92, %78
%96 = mul nsw i32 %95, %6
%97 = sext i32 %96 to i64
%98 = getelementptr inbounds i8, i8* %3, i64 %97
%99 = mul nsw i64 %81, %51
%100 = add nsw i64 %99, %79
br label %101
101: ; preds = %94, %101
%102 = phi i64 [ 0, %94 ], [ %127, %101 ]
%103 = phi i8* [ %98, %94 ], [ %126, %101 ]
%104 = load i8, i8* %103
%105 = zext i8 %104 to i32
%106 = tail call i32 @gamma_correct(i32 %105, float %8)
%107 = getelementptr inbounds i8, i8* %103, i64 %51
%108 = load i8, i8* %107
%109 = zext i8 %108 to i32
%110 = tail call i32 @gamma_correct(i32 %109, float %8)
%111 = tail call i32 @blerp(i32 %106, i32 %110, i32 %93)
%112 = getelementptr inbounds i8, i8* %103, i64 %53
%113 = load i8, i8* %112
%114 = zext i8 %113 to i32
%115 = tail call i32 @gamma_correct(i32 %114, float %8)
%116 = getelementptr inbounds i8, i8* %103, i64 %56
%117 = load i8, i8* %116
%118 = zext i8 %117 to i32
%119 = tail call i32 @gamma_correct(i32 %118, float %8)
%120 = tail call i32 @blerp(i32 %115, i32 %119, i32 %93)
%121 = tail call i32 @blerp(i32 %111, i32 %120, i32 %76)
%122 = tail call i32 @gamma_correct(i32 %121, float %38)
%123 = trunc i32 %122 to i8
%124 = add nsw i64 %100, %102
%125 = getelementptr inbounds i8, i8* %0, i64 %124
store i8 %123, i8* %125
%126 = getelementptr inbounds i8, i8* %103, i64 1
%127 = add nuw nsw i64 %102, 1
%128 = icmp eq i64 %127, %62
br i1 %128, label %129, label %101
129: ; preds = %101, %91
%130 = add nuw nsw i64 %81, 1
%131 = icmp eq i64 %130, %61
br i1 %131, label %132, label %80
132: ; preds = %129, %74
%133 = add nuw nsw i64 %64, 1
%134 = icmp eq i64 %133, %60
br i1 %134, label %206, label %63
135: ; preds = %14, %203
%136 = phi i64 [ 0, %14 ], [ %204, %203 ]
br i1 %15, label %146, label %137
137: ; preds = %135
%138 = trunc i64 %136 to i32
%139 = mul i32 %17, %138
%140 = sdiv i32 %139, %18
%141 = icmp eq i64 %136, %32
%142 = sext i1 %141 to i32
%143 = add nsw i32 %140, %142
%144 = and i32 %143, 255
%145 = ashr i32 %143, 8
br label %146
146: ; preds = %135, %137
%147 = phi i32 [ %145, %137 ], [ 0, %135 ]
%148 = phi i32 [ %144, %137 ], [ 0, %135 ]
br i1 %19, label %149, label %203
149: ; preds = %146
%150 = mul nsw i32 %147, %4
%151 = mul nsw i64 %136, %33
br label %152
152: ; preds = %149, %200
%153 = phi i64 [ 0, %149 ], [ %201, %200 ]
br i1 %20, label %154, label %163
154: ; preds = %152
%155 = trunc i64 %153 to i32
%156 = mul i32 %22, %155
%157 = sdiv i32 %156, %23
%158 = icmp eq i64 %153, %31
%159 = sext i1 %158 to i32
%160 = add nsw i32 %157, %159
%161 = and i32 %160, 255
%162 = ashr i32 %160, 8
br label %163
163: ; preds = %152, %154
%164 = phi i32 [ %162, %154 ], [ 0, %152 ]
%165 = phi i32 [ %161, %154 ], [ 0, %152 ]
br i1 %24, label %166, label %200
166: ; preds = %163
%167 = add nsw i32 %164, %150
%168 = mul nsw i32 %167, %6
%169 = sext i32 %168 to i64
%170 = getelementptr inbounds i8, i8* %3, i64 %169
%171 = mul nsw i64 %153, %25
%172 = add nsw i64 %171, %151
br label %173
173: ; preds = %166, %173
%174 = phi i64 [ 0, %166 ], [ %198, %173 ]
%175 = phi i8* [ %170, %166 ], [ %197, %173 ]
%176 = load i8, i8* %175
%177 = zext i8 %176 to i32
%178 = getelementptr inbounds i8, i8* %175, i64 %25
%179 = load i8, i8* %178
%180 = zext i8 %179 to i32
%181 = tail call i32 @blerp(i32 %177, i32 %180, i32 %165)
%182 = getelementptr inbounds i8, i8* %175, i64 %27
%183 = load i8, i8* %182
%184 = zext i8 %183 to i32
%185 = getelementptr inbounds i8, i8* %175, i64 %30
%186 = load i8, i8* %185
%187 = zext i8 %186 to i32
%188 = tail call i32 @blerp(i32 %184, i32 %187, i32 %165)
%189 = tail call i32 @blerp(i32 %181, i32 %188, i32 %148)
%190 = icmp sgt i32 %189, 0
%191 = select i1 %190, i32 %189, i32 0
%192 = icmp ult i32 %191, 255
%193 = select i1 %192, i32 %191, i32 255
%194 = trunc i32 %193 to i8
%195 = add nsw i64 %172, %174
%196 = getelementptr inbounds i8, i8* %0, i64 %195
store i8 %194, i8* %196
%197 = getelementptr inbounds i8, i8* %175, i64 1
%198 = add nuw nsw i64 %174, 1
%199 = icmp eq i64 %198, %36
br i1 %199, label %200, label %173
200: ; preds = %173, %163
%201 = add nuw nsw i64 %153, 1
%202 = icmp eq i64 %201, %35
br i1 %202, label %203, label %152
203: ; preds = %200, %146
%204 = add nuw nsw i64 %136, 1
%205 = icmp eq i64 %204, %34
br i1 %205, label %206, label %135
206: ; preds = %132, %203, %37, %12
ret void
}