void scale4x_buf(void *void_dst, unsigned dst_slice, void *void_mid,
                 unsigned mid_slice, const void *void_src, unsigned src_slice,
                 unsigned pixel, unsigned width, unsigned height,
                 unsigned opt) {
  unsigned char *dst = (unsigned char *)void_dst;
  const unsigned char *src = (const unsigned char *)void_src;
  unsigned count;
  unsigned char *mid[6];
  assert(height >= 4);
  count = height;
  mid[0] = (unsigned char *)void_mid;
  mid[1] = mid[0] + mid_slice;
  mid[2] = mid[1] + mid_slice;
  mid[3] = mid[2] + mid_slice;
  mid[4] = mid[3] + mid_slice;
  mid[5] = mid[4] + mid_slice;
  stage_scale2x((mid[(-2 + 6)]), (mid[(-1 + 6)]), (src + (0) * src_slice),
                (src + (0) * src_slice), (src + (1) * src_slice), pixel, width,
                opt);
  stage_scale2x((mid[(0)]), (mid[(1)]), (src + (0) * src_slice),
                (src + (1) * src_slice), (src + (2) * src_slice), pixel, width,
                opt);
  stage_scale2x((mid[(2)]), (mid[(3)]), (src + (1) * src_slice),
                (src + (2) * src_slice), (src + (3) * src_slice), pixel, width,
                opt);
  stage_scale4x((dst + (0) * dst_slice), (dst + (1) * dst_slice),
                (dst + (2) * dst_slice), (dst + (3) * dst_slice),
                (mid[(-2 + 6)]), (mid[(-2 + 6)]), (mid[(-1 + 6)]), (mid[(0)]),
                pixel, width, opt);
  dst = (dst + (4) * dst_slice);
  stage_scale4x((dst + (0) * dst_slice), (dst + (1) * dst_slice),
                (dst + (2) * dst_slice), (dst + (3) * dst_slice),
                (mid[(-1 + 6)]), (mid[(0)]), (mid[(1)]), (mid[(2)]), pixel,
                width, opt);
  dst = (dst + (4) * dst_slice);
  count -= 4;
  while (count) {
    unsigned char *tmp;
    stage_scale2x((mid[(4)]), (mid[(5)]), (src + (2) * src_slice),
                  (src + (3) * src_slice), (src + (4) * src_slice), pixel,
                  width, opt);
    stage_scale4x((dst + (0) * dst_slice), (dst + (1) * dst_slice),
                  (dst + (2) * dst_slice), (dst + (3) * dst_slice), (mid[(1)]),
                  (mid[(2)]), (mid[(3)]), (mid[(4)]), pixel, width, opt);
    dst = (dst + (4) * dst_slice);
    src = (src + (1) * src_slice);
    tmp = (mid[(0)]);
    (mid[(0)]) = (mid[(2)]);
    (mid[(2)]) = (mid[(4)]);
    (mid[(4)]) = tmp;
    tmp = (mid[(1)]);
    (mid[(1)]) = (mid[(3)]);
    (mid[(3)]) = (mid[(5)]);
    (mid[(5)]) = tmp;
    --count;
  }
  stage_scale2x((mid[(4)]), (mid[(5)]), (src + (2) * src_slice),
                (src + (3) * src_slice), (src + (3) * src_slice), pixel, width,
                opt);
  stage_scale4x((dst + (0) * dst_slice), (dst + (1) * dst_slice),
                (dst + (2) * dst_slice), (dst + (3) * dst_slice), (mid[(1)]),
                (mid[(2)]), (mid[(3)]), (mid[(4)]), pixel, width, opt);
  dst = (dst + (4) * dst_slice);
  stage_scale4x((dst + (0) * dst_slice), (dst + (1) * dst_slice),
                (dst + (2) * dst_slice), (dst + (3) * dst_slice), (mid[(3)]),
                (mid[(4)]), (mid[(5)]), (mid[(5)]), pixel, width, opt);
}


x86 assembly (clang, -O0):
<scale4x_buf>:
push   %rbp
mov    %rsp,%rbp
push   %r14
push   %rbx
sub    $0xb0,%rsp
mov    0x28(%rbp),%eax
mov    0x20(%rbp),%eax
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%eax
mov    %rdi,-0x18(%rbp)
mov    %esi,-0x1c(%rbp)
mov    %rdx,-0x28(%rbp)
mov    %ecx,-0x2c(%rbp)
mov    %r8,-0x38(%rbp)
mov    %r9d,-0x3c(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x38(%rbp),%rax
mov    %rax,-0x50(%rbp)
cmpl   $0x4,0x20(%rbp)
setae  %al
and    $0x1,%al
movzbl %al,%edi
mov    $0x0,%al
call   1040 <assert@plt>
mov    0x20(%rbp),%eax
mov    %eax,-0x54(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x90(%rbp)
mov    -0x90(%rbp),%rax
mov    -0x2c(%rbp),%ecx
add    %rcx,%rax
mov    %rax,-0x88(%rbp)
mov    -0x88(%rbp),%rax
mov    -0x2c(%rbp),%ecx
add    %rcx,%rax
mov    %rax,-0x80(%rbp)
mov    -0x80(%rbp),%rax
mov    -0x2c(%rbp),%ecx
add    %rcx,%rax
mov    %rax,-0x78(%rbp)
mov    -0x78(%rbp),%rax
mov    -0x2c(%rbp),%ecx
add    %rcx,%rax
mov    %rax,-0x70(%rbp)
mov    -0x70(%rbp),%rax
mov    -0x2c(%rbp),%ecx
add    %rcx,%rax
mov    %rax,-0x68(%rbp)
mov    -0x70(%rbp),%rdi
mov    -0x68(%rbp),%rsi
mov    -0x50(%rbp),%rdx
imul   $0x0,-0x3c(%rbp),%eax
mov    %eax,%eax
add    %rax,%rdx
mov    -0x50(%rbp),%rcx
imul   $0x0,-0x3c(%rbp),%eax
mov    %eax,%eax
add    %rax,%rcx
mov    -0x50(%rbp),%r8
mov    -0x3c(%rbp),%eax
shl    $0x0,%eax
mov    %eax,%eax
add    %rax,%r8
mov    0x10(%rbp),%r9d
mov    0x18(%rbp),%r10d
mov    0x28(%rbp),%eax
mov    %r10d,(%rsp)
mov    %eax,0x8(%rsp)
mov    $0x0,%al
call   1030 <stage_scale2x@plt>
mov    -0x90(%rbp),%rdi
mov    -0x88(%rbp),%rsi
mov    -0x50(%rbp),%rdx
imul   $0x0,-0x3c(%rbp),%eax
mov    %eax,%eax
add    %rax,%rdx
mov    -0x50(%rbp),%rcx
mov    -0x3c(%rbp),%eax
shl    $0x0,%eax
mov    %eax,%eax
add    %rax,%rcx
mov    -0x50(%rbp),%r8
mov    -0x3c(%rbp),%eax
shl    $0x1,%eax
mov    %eax,%eax
add    %rax,%r8
mov    0x10(%rbp),%r9d
mov    0x18(%rbp),%r10d
mov    0x28(%rbp),%eax
mov    %r10d,(%rsp)
mov    %eax,0x8(%rsp)
mov    $0x0,%al
call   1030 <stage_scale2x@plt>
mov    -0x80(%rbp),%rdi
mov    -0x78(%rbp),%rsi
mov    -0x50(%rbp),%rdx
mov    -0x3c(%rbp),%eax
shl    $0x0,%eax
mov    %eax,%eax
add    %rax,%rdx
mov    -0x50(%rbp),%rcx
mov    -0x3c(%rbp),%eax
shl    $0x1,%eax
mov    %eax,%eax
add    %rax,%rcx
mov    -0x50(%rbp),%r8
imul   $0x3,-0x3c(%rbp),%eax
mov    %eax,%eax
add    %rax,%r8
mov    0x10(%rbp),%r9d
mov    0x18(%rbp),%r10d
mov    0x28(%rbp),%eax
mov    %r10d,(%rsp)
mov    %eax,0x8(%rsp)
mov    $0x0,%al
call   1030 <stage_scale2x@plt>
mov    -0x48(%rbp),%rdi
imul   $0x0,-0x1c(%rbp),%eax
mov    %eax,%eax
add    %rax,%rdi
mov    -0x48(%rbp),%rsi
mov    -0x1c(%rbp),%eax
shl    $0x0,%eax
mov    %eax,%eax
add    %rax,%rsi
mov    -0x48(%rbp),%rdx
mov    -0x1c(%rbp),%eax
shl    $0x1,%eax
mov    %eax,%eax
add    %rax,%rdx
mov    -0x48(%rbp),%rcx
imul   $0x3,-0x1c(%rbp),%eax
mov    %eax,%eax
add    %rax,%rcx
mov    -0x70(%rbp),%r8
mov    -0x70(%rbp),%r9
mov    -0x68(%rbp),%r14
mov    -0x90(%rbp),%rbx
mov    0x10(%rbp),%r11d
mov    0x18(%rbp),%r10d
mov    0x28(%rbp),%eax
mov    %r14,(%rsp)
mov    %rbx,0x8(%rsp)
mov    %r11d,0x10(%rsp)
mov    %r10d,0x18(%rsp)
mov    %eax,0x20(%rsp)
mov    $0x0,%al
call   1050 <stage_scale4x@plt>
mov    -0x48(%rbp),%rax
mov    -0x1c(%rbp),%ecx
shl    $0x2,%ecx
mov    %ecx,%ecx
add    %rcx,%rax
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rdi
imul   $0x0,-0x1c(%rbp),%eax
mov    %eax,%eax
add    %rax,%rdi
mov    -0x48(%rbp),%rsi
mov    -0x1c(%rbp),%eax
shl    $0x0,%eax
mov    %eax,%eax
add    %rax,%rsi
mov    -0x48(%rbp),%rdx
mov    -0x1c(%rbp),%eax
shl    $0x1,%eax
mov    %eax,%eax
add    %rax,%rdx
mov    -0x48(%rbp),%rcx
imul   $0x3,-0x1c(%rbp),%eax
mov    %eax,%eax
add    %rax,%rcx
mov    -0x68(%rbp),%r8
mov    -0x90(%rbp),%r9
mov    -0x88(%rbp),%r14
mov    -0x80(%rbp),%rbx
mov    0x10(%rbp),%r11d
mov    0x18(%rbp),%r10d
mov    0x28(%rbp),%eax
mov    %r14,(%rsp)
mov    %rbx,0x8(%rsp)
mov    %r11d,0x10(%rsp)
mov    %r10d,0x18(%rsp)
mov    %eax,0x20(%rsp)
mov    $0x0,%al
call   1050 <stage_scale4x@plt>
mov    -0x48(%rbp),%rax
mov    -0x1c(%rbp),%ecx
shl    $0x2,%ecx
mov    %ecx,%ecx
add    %rcx,%rax
mov    %rax,-0x48(%rbp)
mov    -0x54(%rbp),%eax
sub    $0x4,%eax
mov    %eax,-0x54(%rbp)
cmpl   $0x0,-0x54(%rbp)
je     153f <scale4x_buf+0x40f>
mov    -0x70(%rbp),%rdi
mov    -0x68(%rbp),%rsi
mov    -0x50(%rbp),%rdx
mov    -0x3c(%rbp),%eax
shl    $0x1,%eax
mov    %eax,%eax
add    %rax,%rdx
mov    -0x50(%rbp),%rcx
imul   $0x3,-0x3c(%rbp),%eax
mov    %eax,%eax
add    %rax,%rcx
mov    -0x50(%rbp),%r8
mov    -0x3c(%rbp),%eax
shl    $0x2,%eax
mov    %eax,%eax
add    %rax,%r8
mov    0x10(%rbp),%r9d
mov    0x18(%rbp),%r10d
mov    0x28(%rbp),%eax
mov    %r10d,(%rsp)
mov    %eax,0x8(%rsp)
mov    $0x0,%al
call   1030 <stage_scale2x@plt>
mov    -0x48(%rbp),%rdi
imul   $0x0,-0x1c(%rbp),%eax
mov    %eax,%eax
add    %rax,%rdi
mov    -0x48(%rbp),%rsi
mov    -0x1c(%rbp),%eax
shl    $0x0,%eax
mov    %eax,%eax
add    %rax,%rsi
mov    -0x48(%rbp),%rdx
mov    -0x1c(%rbp),%eax
shl    $0x1,%eax
mov    %eax,%eax
add    %rax,%rdx
mov    -0x48(%rbp),%rcx
imul   $0x3,-0x1c(%rbp),%eax
mov    %eax,%eax
add    %rax,%rcx
mov    -0x88(%rbp),%r8
mov    -0x80(%rbp),%r9
mov    -0x78(%rbp),%r14
mov    -0x70(%rbp),%rbx
mov    0x10(%rbp),%r11d
mov    0x18(%rbp),%r10d
mov    0x28(%rbp),%eax
mov    %r14,(%rsp)
mov    %rbx,0x8(%rsp)
mov    %r11d,0x10(%rsp)
mov    %r10d,0x18(%rsp)
mov    %eax,0x20(%rsp)
mov    $0x0,%al
call   1050 <stage_scale4x@plt>
mov    -0x48(%rbp),%rax
mov    -0x1c(%rbp),%ecx
shl    $0x2,%ecx
mov    %ecx,%ecx
add    %rcx,%rax
mov    %rax,-0x48(%rbp)
mov    -0x50(%rbp),%rax
mov    -0x3c(%rbp),%ecx
shl    $0x0,%ecx
mov    %ecx,%ecx
add    %rcx,%rax
mov    %rax,-0x50(%rbp)
mov    -0x90(%rbp),%rax
mov    %rax,-0x98(%rbp)
mov    -0x80(%rbp),%rax
mov    %rax,-0x90(%rbp)
mov    -0x70(%rbp),%rax
mov    %rax,-0x80(%rbp)
mov    -0x98(%rbp),%rax
mov    %rax,-0x70(%rbp)
mov    -0x88(%rbp),%rax
mov    %rax,-0x98(%rbp)
mov    -0x78(%rbp),%rax
mov    %rax,-0x88(%rbp)
mov    -0x68(%rbp),%rax
mov    %rax,-0x78(%rbp)
mov    -0x98(%rbp),%rax
mov    %rax,-0x68(%rbp)
mov    -0x54(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x54(%rbp)
jmp    13e8 <scale4x_buf+0x2b8>
mov    -0x70(%rbp),%rdi
mov    -0x68(%rbp),%rsi
mov    -0x50(%rbp),%rdx
mov    -0x3c(%rbp),%eax
shl    $0x1,%eax
mov    %eax,%eax
add    %rax,%rdx
mov    -0x50(%rbp),%rcx
imul   $0x3,-0x3c(%rbp),%eax
mov    %eax,%eax
add    %rax,%rcx
mov    -0x50(%rbp),%r8
imul   $0x3,-0x3c(%rbp),%eax
mov    %eax,%eax
add    %rax,%r8
mov    0x10(%rbp),%r9d
mov    0x18(%rbp),%r10d
mov    0x28(%rbp),%eax
mov    %r10d,(%rsp)
mov    %eax,0x8(%rsp)
mov    $0x0,%al
call   1030 <stage_scale2x@plt>
mov    -0x48(%rbp),%rdi
imul   $0x0,-0x1c(%rbp),%eax
mov    %eax,%eax
add    %rax,%rdi
mov    -0x48(%rbp),%rsi
mov    -0x1c(%rbp),%eax
shl    $0x0,%eax
mov    %eax,%eax
add    %rax,%rsi
mov    -0x48(%rbp),%rdx
mov    -0x1c(%rbp),%eax
shl    $0x1,%eax
mov    %eax,%eax
add    %rax,%rdx
mov    -0x48(%rbp),%rcx
imul   $0x3,-0x1c(%rbp),%eax
mov    %eax,%eax
add    %rax,%rcx
mov    -0x88(%rbp),%r8
mov    -0x80(%rbp),%r9
mov    -0x78(%rbp),%r14
mov    -0x70(%rbp),%rbx
mov    0x10(%rbp),%r11d
mov    0x18(%rbp),%r10d
mov    0x28(%rbp),%eax
mov    %r14,(%rsp)
mov    %rbx,0x8(%rsp)
mov    %r11d,0x10(%rsp)
mov    %r10d,0x18(%rsp)
mov    %eax,0x20(%rsp)
mov    $0x0,%al
call   1050 <stage_scale4x@plt>
mov    -0x48(%rbp),%rax
mov    -0x1c(%rbp),%ecx
shl    $0x2,%ecx
mov    %ecx,%ecx
add    %rcx,%rax
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rdi
imul   $0x0,-0x1c(%rbp),%eax
mov    %eax,%eax
add    %rax,%rdi
mov    -0x48(%rbp),%rsi
mov    -0x1c(%rbp),%eax
shl    $0x0,%eax
mov    %eax,%eax
add    %rax,%rsi
mov    -0x48(%rbp),%rdx
mov    -0x1c(%rbp),%eax
shl    $0x1,%eax
mov    %eax,%eax
add    %rax,%rdx
mov    -0x48(%rbp),%rcx
imul   $0x3,-0x1c(%rbp),%eax
mov    %eax,%eax
add    %rax,%rcx
mov    -0x78(%rbp),%r8
mov    -0x70(%rbp),%r9
mov    -0x68(%rbp),%r14
mov    -0x68(%rbp),%rbx
mov    0x10(%rbp),%r11d
mov    0x18(%rbp),%r10d
mov    0x28(%rbp),%eax
mov    %r14,(%rsp)
mov    %rbx,0x8(%rsp)
mov    %r11d,0x10(%rsp)
mov    %r10d,0x18(%rsp)
mov    %eax,0x20(%rsp)
mov    $0x0,%al
call   1050 <stage_scale4x@plt>
add    $0xb0,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

x86 assembly (clang, -O2):
<scale4x_buf>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x78,%rsp
mov    %r9d,%r15d
mov    %r8,%r13
mov    %ecx,%r14d
mov    %rdx,%rbx
mov    %rdx,0x18(%rsp)
mov    %rsi,0x20(%rsp)
mov    %rdi,%rbp
xor    %edi,%edi
cmpl   $0x4,0xc0(%rsp)
04
setae  %dil
xor    %eax,%eax
call   1040 <assert@plt>
mov    %r14d,%r12d
lea    (%rbx,%r12,1),%rax
mov    %rax,0x48(%rsp)
add    %r12,%rax
mov    %rax,0x8(%rsp)
add    %r12,%rax
mov    %rax,0x10(%rsp)
lea    (%rax,%r12,1),%rdi
mov    %rdi,(%rsp)
add    %rdi,%r12
mov    %r15,0x38(%rsp)
mov    %r15d,%eax
mov    %rax,0x70(%rsp)
lea    (%rax,%r13,1),%r14
mov    %r12,%rsi
mov    %r13,%rdx
mov    %r13,%rcx
mov    %r14,%r8
mov    %r14,0x30(%rsp)
mov    0xb0(%rsp),%r9d
xor    %eax,%eax
mov    0xc8(%rsp),%ebx
push   %rbx
mov    0xc0(%rsp),%ebx
push   %rbx
call   1030 <stage_scale2x@plt>
add    $0x10,%rsp
lea    (%r15,%r15,1),%eax
mov    %rax,0x58(%rsp)
lea    (%rax,%r13,1),%r15
mov    0x18(%rsp),%rdi
mov    0x48(%rsp),%rsi
mov    %r13,%rdx
mov    %r14,%rcx
mov    %r15,%r8
mov    0xb0(%rsp),%r9d
xor    %eax,%eax
mov    0xc8(%rsp),%ebx
push   %rbx
mov    0xc0(%rsp),%ebx
push   %rbx
call   1030 <stage_scale2x@plt>
add    $0x10,%rsp
mov    0x38(%rsp),%rax
lea    (%rax,%rax,2),%eax
mov    %rax,0x50(%rsp)
mov    %r13,%r14
lea    0x0(%r13,%rax,1),%r8
mov    0x8(%rsp),%rdi
mov    0x10(%rsp),%rsi
mov    0x30(%rsp),%rdx
mov    %r15,%rcx
mov    0xb0(%rsp),%r9d
xor    %eax,%eax
mov    0xc8(%rsp),%ebx
push   %rbx
mov    0xc0(%rsp),%ebx
push   %rbx
call   1030 <stage_scale2x@plt>
add    $0x10,%rsp
mov    0x20(%rsp),%rax
mov    %eax,%ecx
mov    %rcx,0x40(%rsp)
lea    0x0(%rbp,%rcx,1),%rsi
lea    (%rax,%rax,1),%r15d
lea    (%r15,%rbp,1),%rdx
lea    (%rax,%rax,2),%r13d
mov    %rbp,%rcx
add    %r13,%rcx
sub    $0x8,%rsp
mov    %rbp,%rdi
mov    0x8(%rsp),%r8
mov    %r8,%r9
xor    %eax,%eax
mov    0xd0(%rsp),%ebx
push   %rbx
mov    0xc8(%rsp),%ebx
push   %rbx
mov    0xc8(%rsp),%ebx
push   %rbx
mov    0x38(%rsp),%rbx
push   %rbx
push   %r12
call   1050 <stage_scale4x@plt>
add    $0x30,%rsp
mov    0x20(%rsp),%rax
shl    $0x2,%eax
mov    %rax,0x20(%rsp)
add    %rax,%rbp
mov    0x40(%rsp),%rax
lea    (%rax,%rbp,1),%rsi
mov    %r15,0x68(%rsp)
lea    (%r15,%rbp,1),%rdx
mov    0x8(%rsp),%r15
mov    %r13,0x60(%rsp)
mov    %rbp,%rcx
add    %r13,%rcx
mov    0x48(%rsp),%r10
sub    $0x8,%rsp
mov    %rbp,%rdi
mov    %r12,0x30(%rsp)
mov    %r12,%r8
mov    %rbx,%r9
xor    %eax,%eax
mov    0xd0(%rsp),%ebx
push   %rbx
mov    0xc8(%rsp),%ebx
push   %rbx
mov    0xc8(%rsp),%ebx
push   %rbx
push   %r15
mov    %r10,%r12
push   %r10
call   1050 <stage_scale4x@plt>
mov    0xf0(%rsp),%edx
mov    0x50(%rsp),%rax
add    $0x30,%rsp
add    %rax,%rbp
mov    %rbp,0x30(%rsp)
add    $0xfffffffc,%edx
je     1466 <scale4x_buf+0x336>
mov    0x38(%rsp),%rax
shl    $0x2,%eax
mov    %rax,0x38(%rsp)
mov    0x28(%rsp),%rsi
mov    (%rsp),%rdi
mov    %r15,%r13
mov    0x18(%rsp),%rax
mov    0x10(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r14,0x8(%rsp)
mov    %edx,0x28(%rsp)
mov    %rsi,0x18(%rsp)
mov    %rdi,%r15
mov    %rbx,0x10(%rsp)
mov    %rax,(%rsp)
mov    0x58(%rsp),%rax
lea    (%r14,%rax,1),%rdx
mov    0x50(%rsp),%rax
lea    (%r14,%rax,1),%rcx
mov    0x38(%rsp),%rax
lea    (%r14,%rax,1),%r8
mov    0xb0(%rsp),%eax
mov    %rax,%r9
xor    %eax,%eax
mov    0xc8(%rsp),%ebx
mov    %rbx,%r14
push   %rbx
mov    0x38(%rsp),%rbx
mov    0xc0(%rsp),%ebp
push   %rbp
call   1030 <stage_scale2x@plt>
add    $0x10,%rsp
mov    0x40(%rsp),%rax
lea    (%rbx,%rax,1),%rsi
mov    0x68(%rsp),%rax
lea    (%rbx,%rax,1),%rdx
mov    0x60(%rsp),%rax
lea    (%rbx,%rax,1),%rcx
sub    $0x8,%rsp
mov    %rbx,%rdi
mov    %r12,%r8
mov    %r13,%r9
xor    %eax,%eax
push   %r14
push   %rbp
mov    0x20(%rsp),%r14
mov    0xc8(%rsp),%ebp
push   %rbp
push   %r15
mov    0x38(%rsp),%rbp
push   %rbp
call   1050 <stage_scale4x@plt>
mov    0x30(%rsp),%rdi
mov    %r12,%rsi
mov    0x58(%rsp),%edx
add    $0x30,%rsp
add    0x70(%rsp),%r14
add    0x20(%rsp),%rbx
mov    %rbx,0x30(%rsp)
mov    %r13,%rax
mov    %rbp,%r12
mov    %r15,0x8(%rsp)
mov    %r15,%r13
mov    0x18(%rsp),%rbx
add    $0xffffffff,%edx
jne    1380 <scale4x_buf+0x250>
jmp    1483 <scale4x_buf+0x353>
mov    0x10(%rsp),%rax
mov    %rax,0x18(%rsp)
mov    %r15,0x8(%rsp)
mov    %r12,0x10(%rsp)
mov    0x28(%rsp),%rsi
mov    (%rsp),%rdi
mov    %rdi,(%rsp)
mov    %rsi,0x28(%rsp)
mov    0x58(%rsp),%rdx
add    %r14,%rdx
mov    0x50(%rsp),%rcx
add    %r14,%rcx
mov    %rcx,%r8
mov    0xb0(%rsp),%ebp
mov    %rbp,%r9
xor    %eax,%eax
mov    0xc8(%rsp),%ebx
push   %rbx
mov    0xc0(%rsp),%ebp
push   %rbp
call   1030 <stage_scale2x@plt>
add    $0x10,%rsp
mov    0x40(%rsp),%r13
mov    0x30(%rsp),%r14
lea    (%r14,%r13,1),%rsi
mov    0x68(%rsp),%r15
lea    (%r14,%r15,1),%rdx
mov    0x60(%rsp),%r12
lea    (%r14,%r12,1),%rcx
sub    $0x8,%rsp
mov    %r14,%rdi
mov    0x18(%rsp),%r8
mov    0x10(%rsp),%r9
xor    %eax,%eax
mov    0xd0(%rsp),%ebx
push   %rbx
push   %rbp
mov    0xc8(%rsp),%ebp
push   %rbp
push   0x20(%rsp)
mov    0x40(%rsp),%rbx
push   %rbx
call   1050 <stage_scale4x@plt>
add    $0x30,%rsp
mov    0x20(%rsp),%rdi
add    %r14,%rdi
add    %rdi,%r13
add    %rdi,%r15
add    %rdi,%r12
sub    $0x8,%rsp
mov    %r13,%rsi
mov    %r15,%rdx
mov    %r12,%rcx
mov    %rbx,%r8
mov    0x8(%rsp),%r9
xor    %eax,%eax
mov    0xd0(%rsp),%ebp
push   %rbp
mov    0xc8(%rsp),%ebp
push   %rbp
mov    0xc8(%rsp),%ebp
push   %rbp
mov    0x48(%rsp),%rbp
push   %rbp
push   %rbp
call   1050 <stage_scale4x@plt>
add    $0xa8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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