#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 /*<<< orphan*/ assert(int);
int /*<<< orphan*/ vcir8_down2_8(unsigned char *, unsigned char const *, int,
                                 int, int, int);
int /*<<< orphan*/ vcir8_hzoom(unsigned char *, int, int, int,
                               unsigned char const *, int, int, int);
int /*<<< orphan*/ vcir8_vzoom2(unsigned char *, int, int, int,
                                unsigned char const *, int, int, int, int, int);
int vclib_get_tmp_buf_size();
int /*<<< orphan*/ vclib_memcpy(unsigned char *, unsigned char const *, int);
unsigned char *vclib_obtain_tmp_buf(int /*<<< orphan*/);
int /*<<< orphan*/ vclib_release_tmp_buf(unsigned char *);
void vc_image_resize_bytes(unsigned char *dest, int destw, int desth,
                           int dest_pitch, const unsigned char *src, int srcw,
                           int srch, int src_pitch, int smooth_flag) {
  if (desth <= 0 || srch <= 0 || destw <= 0 || srcw <= 0)
    return;
  if (destw == srcw && desth == srch) {
    if (dest == src) {
      assert(dest_pitch == src_pitch);
      return;
    }
    if (dest_pitch == destw && src_pitch == srcw) {
      vclib_memcpy(dest, src, destw * desth);
    } else {
      do {
        vclib_memcpy(dest, src, destw);
        dest += dest_pitch;
        src += src_pitch;
      } while (--desth > 0);
    }
  } else if (desth >= srch) {
    unsigned char *ptr = dest + dest_pitch * (desth - srch);
    vcir8_hzoom(ptr, destw, srch, dest_pitch, src, srcw, src_pitch,
                smooth_flag);
    if (desth != srch) {
      vcir8_vzoom2(dest, destw, desth, dest_pitch, ptr, dest_pitch, 0,
                   (srch << 16) / desth, srch - 1, smooth_flag);
    }
  } else if (destw >= srcw) {
    unsigned char *ptr = dest + (destw - srcw);
    vcir8_vzoom2(ptr, srcw, desth, dest_pitch, src, src_pitch, 0,
                 (srch << 16) / desth, srch - 1, smooth_flag);
    if (destw != srcw) {
      vcir8_hzoom(dest, destw, desth, dest_pitch, ptr, srcw, dest_pitch,
                  smooth_flag);
    }
  } else {
    int i, j, step, pos, buf_pitch, buf_size;
    unsigned char *bufptr;
    if (desth * 2 == srch && destw * 2 == srcw &&
        ((destw | srch | dest_pitch | src_pitch | ((int)dest) | ((int)src)) &
         15) == 0) {
      while (desth > 0) {
        vcir8_down2_8(dest, src, destw, dest_pitch, src_pitch, smooth_flag);
        dest += dest_pitch << 3;
        src += src_pitch << 4;
        desth -= 8;
      }
      return;
    }
    bufptr = vclib_obtain_tmp_buf(0);
    buf_size = vclib_get_tmp_buf_size();
    buf_pitch = (srcw + 15) & ~15;
    j = 64;
    if (buf_pitch * j > buf_size) {
      j = 32;
      if (buf_pitch * j > buf_size) {
        j = buf_size / buf_pitch;
        if (j > 16)
          j = 16;
        assert(j > 0);
      }
    }
    pos = 0;
    step = (srch << 16) / desth;
    for (i = 0; i < desth; i += j) {
      if (i + j > desth) {
        j = desth - i;
      }
      vcir8_vzoom2(bufptr, srcw, j, buf_pitch, src, src_pitch, pos, step,
                   srch - 1, smooth_flag);
      vcir8_hzoom(dest, destw, j, dest_pitch, bufptr, srcw, buf_pitch,
                  smooth_flag);
      pos += j * step;
      dest += j * dest_pitch;
    }
    vclib_release_tmp_buf(bufptr);
  }
}


x86 assembly (clang, -O0):
<vc_image_resize_bytes>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
sub    $0x88,%rsp
mov    0x20(%rbp),%eax
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%eax
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9d,-0x2c(%rbp)
cmpl   $0x0,-0x18(%rbp)
jle    11d2 <vc_image_resize_bytes+0x52>
cmpl   $0x0,0x10(%rbp)
jle    11d2 <vc_image_resize_bytes+0x52>
cmpl   $0x0,-0x14(%rbp)
jle    11d2 <vc_image_resize_bytes+0x52>
cmpl   $0x0,-0x2c(%rbp)
jg     11d7 <vc_image_resize_bytes+0x57>
jmp    1600 <vc_image_resize_bytes+0x480>
mov    -0x14(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jne    1299 <vc_image_resize_bytes+0x119>
mov    -0x18(%rbp),%eax
cmp    0x10(%rbp),%eax
jne    1299 <vc_image_resize_bytes+0x119>
mov    -0x10(%rbp),%rax
cmp    -0x28(%rbp),%rax
jne    1215 <vc_image_resize_bytes+0x95>
mov    -0x1c(%rbp),%eax
cmp    0x18(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   10a0 <assert@plt>
jmp    1600 <vc_image_resize_bytes+0x480>
mov    -0x1c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jne    1246 <vc_image_resize_bytes+0xc6>
mov    0x18(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jne    1246 <vc_image_resize_bytes+0xc6>
mov    -0x10(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x14(%rbp),%edx
imul   -0x18(%rbp),%edx
call   1060 <vclib_memcpy@plt>
jmp    1294 <vc_image_resize_bytes+0x114>
jmp    124b <vc_image_resize_bytes+0xcb>
mov    -0x10(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1060 <vclib_memcpy@plt>
mov    -0x1c(%rbp),%ecx
mov    -0x10(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x10(%rbp)
mov    0x18(%rbp),%ecx
mov    -0x28(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x18(%rbp)
cmp    $0x0,%eax
jg     124b <vc_image_resize_bytes+0xcb>
jmp    1294 <vc_image_resize_bytes+0x114>
jmp    1600 <vc_image_resize_bytes+0x480>
mov    -0x18(%rbp),%eax
cmp    0x10(%rbp),%eax
jl     1348 <vc_image_resize_bytes+0x1c8>
mov    -0x10(%rbp),%rax
mov    -0x1c(%rbp),%ecx
mov    -0x18(%rbp),%edx
sub    0x10(%rbp),%edx
imul   %edx,%ecx
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    0x10(%rbp),%edx
mov    -0x1c(%rbp),%ecx
mov    -0x28(%rbp),%r8
mov    -0x2c(%rbp),%r9d
mov    0x18(%rbp),%r10d
mov    0x20(%rbp),%eax
mov    %r10d,(%rsp)
mov    %eax,0x8(%rsp)
call   1070 <vcir8_hzoom@plt>
mov    -0x18(%rbp),%eax
cmp    0x10(%rbp),%eax
je     1343 <vc_image_resize_bytes+0x1c3>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%eax
mov    %eax,-0x64(%rbp)
mov    -0x1c(%rbp),%ecx
mov    -0x38(%rbp),%r8
mov    -0x1c(%rbp),%r9d
mov    0x10(%rbp),%eax
shl    $0x10,%eax
cltd
idivl  -0x18(%rbp)
mov    -0x64(%rbp),%edx
mov    %eax,%r11d
mov    0x10(%rbp),%r10d
sub    $0x1,%r10d
mov    0x20(%rbp),%eax
xor    %ebx,%ebx
movl   $0x0,(%rsp)
mov    %r11d,0x8(%rsp)
mov    %r10d,0x10(%rsp)
mov    %eax,0x18(%rsp)
call   1080 <vcir8_vzoom2@plt>
jmp    15fb <vc_image_resize_bytes+0x47b>
mov    -0x14(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jl     13f1 <vc_image_resize_bytes+0x271>
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
sub    -0x2c(%rbp),%ecx
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rdi
mov    -0x2c(%rbp),%esi
mov    -0x18(%rbp),%eax
mov    %eax,-0x68(%rbp)
mov    -0x1c(%rbp),%ecx
mov    -0x28(%rbp),%r8
mov    0x18(%rbp),%r9d
mov    0x10(%rbp),%eax
shl    $0x10,%eax
cltd
idivl  -0x18(%rbp)
mov    -0x68(%rbp),%edx
mov    %eax,%r11d
mov    0x10(%rbp),%r10d
sub    $0x1,%r10d
mov    0x20(%rbp),%eax
xor    %ebx,%ebx
movl   $0x0,(%rsp)
mov    %r11d,0x8(%rsp)
mov    %r10d,0x10(%rsp)
mov    %eax,0x18(%rsp)
call   1080 <vcir8_vzoom2@plt>
mov    -0x14(%rbp),%eax
cmp    -0x2c(%rbp),%eax
je     13ec <vc_image_resize_bytes+0x26c>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    -0x1c(%rbp),%ecx
mov    -0x40(%rbp),%r8
mov    -0x2c(%rbp),%r9d
mov    -0x1c(%rbp),%r10d
mov    0x20(%rbp),%eax
mov    %r10d,(%rsp)
mov    %eax,0x8(%rsp)
call   1070 <vcir8_hzoom@plt>
jmp    15f6 <vc_image_resize_bytes+0x476>
mov    -0x18(%rbp),%eax
shl    $0x1,%eax
cmp    0x10(%rbp),%eax
jne    1498 <vc_image_resize_bytes+0x318>
mov    -0x14(%rbp),%eax
shl    $0x1,%eax
cmp    -0x2c(%rbp),%eax
jne    1498 <vc_image_resize_bytes+0x318>
mov    -0x14(%rbp),%eax
or     0x10(%rbp),%eax
or     -0x1c(%rbp),%eax
or     0x18(%rbp),%eax
mov    -0x10(%rbp),%rcx
or     %ecx,%eax
mov    -0x28(%rbp),%rcx
or     %ecx,%eax
and    $0xf,%eax
cmp    $0x0,%eax
jne    1498 <vc_image_resize_bytes+0x318>
jmp    1438 <vc_image_resize_bytes+0x2b8>
cmpl   $0x0,-0x18(%rbp)
jle    1493 <vc_image_resize_bytes+0x313>
mov    -0x10(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x1c(%rbp),%ecx
mov    0x18(%rbp),%r8d
mov    0x20(%rbp),%r9d
call   1040 <vcir8_down2_8@plt>
mov    -0x1c(%rbp),%ecx
shl    $0x3,%ecx
mov    -0x10(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x10(%rbp)
mov    0x18(%rbp),%ecx
shl    $0x4,%ecx
mov    -0x28(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%eax
sub    $0x8,%eax
mov    %eax,-0x18(%rbp)
jmp    1438 <vc_image_resize_bytes+0x2b8>
jmp    1600 <vc_image_resize_bytes+0x480>
xor    %edi,%edi
call   1030 <vclib_obtain_tmp_buf@plt>
mov    %rax,-0x60(%rbp)
mov    $0x0,%al
call   1090 <vclib_get_tmp_buf_size@plt>
mov    %eax,-0x58(%rbp)
mov    -0x2c(%rbp),%eax
add    $0xf,%eax
and    $0xfffffff0,%eax
mov    %eax,-0x54(%rbp)
movl   $0x40,-0x48(%rbp)
mov    -0x54(%rbp),%eax
imul   -0x48(%rbp),%eax
cmp    -0x58(%rbp),%eax
jle    1518 <vc_image_resize_bytes+0x398>
movl   $0x20,-0x48(%rbp)
mov    -0x54(%rbp),%eax
imul   -0x48(%rbp),%eax
cmp    -0x58(%rbp),%eax
jle    1513 <vc_image_resize_bytes+0x393>
mov    -0x58(%rbp),%eax
cltd
idivl  -0x54(%rbp)
mov    %eax,-0x48(%rbp)
cmpl   $0x10,-0x48(%rbp)
jle    1502 <vc_image_resize_bytes+0x382>
movl   $0x10,-0x48(%rbp)
cmpl   $0x0,-0x48(%rbp)
setg   %al
and    $0x1,%al
movzbl %al,%edi
call   10a0 <assert@plt>
jmp    1518 <vc_image_resize_bytes+0x398>
movl   $0x0,-0x50(%rbp)
mov    0x10(%rbp),%eax
shl    $0x10,%eax
cltd
idivl  -0x18(%rbp)
mov    %eax,-0x4c(%rbp)
movl   $0x0,-0x44(%rbp)
mov    -0x44(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    15ed <vc_image_resize_bytes+0x46d>
mov    -0x44(%rbp),%eax
add    -0x48(%rbp),%eax
cmp    -0x18(%rbp),%eax
jle    1557 <vc_image_resize_bytes+0x3d7>
mov    -0x18(%rbp),%eax
sub    -0x44(%rbp),%eax
mov    %eax,-0x48(%rbp)
mov    -0x60(%rbp),%rdi
mov    -0x2c(%rbp),%esi
mov    -0x48(%rbp),%edx
mov    -0x54(%rbp),%ecx
mov    -0x28(%rbp),%r8
mov    0x18(%rbp),%r9d
mov    -0x50(%rbp),%ebx
mov    -0x4c(%rbp),%r11d
mov    0x10(%rbp),%r10d
sub    $0x1,%r10d
mov    0x20(%rbp),%eax
mov    %ebx,(%rsp)
mov    %r11d,0x8(%rsp)
mov    %r10d,0x10(%rsp)
mov    %eax,0x18(%rsp)
call   1080 <vcir8_vzoom2@plt>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x48(%rbp),%edx
mov    -0x1c(%rbp),%ecx
mov    -0x60(%rbp),%r8
mov    -0x2c(%rbp),%r9d
mov    -0x54(%rbp),%r10d
mov    0x20(%rbp),%eax
mov    %r10d,(%rsp)
mov    %eax,0x8(%rsp)
call   1070 <vcir8_hzoom@plt>
mov    -0x48(%rbp),%eax
imul   -0x4c(%rbp),%eax
add    -0x50(%rbp),%eax
mov    %eax,-0x50(%rbp)
mov    -0x48(%rbp),%ecx
imul   -0x1c(%rbp),%ecx
mov    -0x10(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x10(%rbp)
mov    -0x48(%rbp),%eax
add    -0x44(%rbp),%eax
mov    %eax,-0x44(%rbp)
jmp    1533 <vc_image_resize_bytes+0x3b3>
mov    -0x60(%rbp),%rdi
call   1050 <vclib_release_tmp_buf@plt>
jmp    15fb <vc_image_resize_bytes+0x47b>
jmp    1600 <vc_image_resize_bytes+0x480>
add    $0x88,%rsp
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<vc_image_resize_bytes>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x68,%rsp
test   %r9d,%r9d
jle    1552 <vc_image_resize_bytes+0x3d2>
mov    %esi,%r12d
test   %esi,%esi
jle    1552 <vc_image_resize_bytes+0x3d2>
mov    %edx,%r15d
test   %edx,%edx
jle    1552 <vc_image_resize_bytes+0x3d2>
mov    0xa0(%rsp),%r11d
test   %r11d,%r11d
jle    1552 <vc_image_resize_bytes+0x3d2>
mov    %r8,%rbx
mov    %rdi,%r13
mov    0xb0(%rsp),%ebp
mov    0xa8(%rsp),%r10d
cmp    %r9d,%r12d
jne    1218 <vc_image_resize_bytes+0x98>
cmp    %r11d,%r15d
jne    1218 <vc_image_resize_bytes+0x98>
cmp    %rbx,%r13
je     143d <vc_image_resize_bytes+0x2bd>
cmp    %r12d,%ecx
jne    1459 <vc_image_resize_bytes+0x2d9>
cmp    %r12d,%r10d
jne    1459 <vc_image_resize_bytes+0x2d9>
imul   %r12d,%r15d
mov    %r13,%rdi
mov    %rbx,%rsi
mov    %r15d,%edx
add    $0x68,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1060 <vclib_memcpy@plt>
mov    %r9,(%rsp)
mov    %r15d,%eax
sub    %r11d,%eax
mov    %rcx,0x8(%rsp)
jae    13d1 <vc_image_resize_bytes+0x251>
mov    %r12d,%eax
mov    (%rsp),%r14
sub    %r14d,%eax
jae    1493 <vc_image_resize_bytes+0x313>
mov    %rbp,0x18(%rsp)
lea    (%r15,%r15,1),%eax
cmp    %r11d,%eax
jne    126c <vc_image_resize_bytes+0xec>
lea    (%r12,%r12,1),%eax
cmp    (%rsp),%eax
jne    126c <vc_image_resize_bytes+0xec>
mov    %r13d,%eax
or     %r12d,%eax
or     %ecx,%eax
or     %r11d,%eax
or     %ebx,%eax
or     %r10d,%eax
test   $0xf,%al
je     14f4 <vc_image_resize_bytes+0x374>
mov    %rbx,0x48(%rsp)
mov    %r11,%rbx
mov    %r10,0x50(%rsp)
mov    %r12,0x40(%rsp)
xor    %edi,%edi
call   1030 <vclib_obtain_tmp_buf@plt>
mov    %rax,0x20(%rsp)
xor    %eax,%eax
call   1090 <vclib_get_tmp_buf_size@plt>
mov    (%rsp),%rcx
lea    0xf(%rcx),%ebp
and    $0xfffffff0,%ebp
mov    %ebp,%ecx
shl    $0x6,%ecx
mov    $0x40,%r14d
cmp    %eax,%ecx
jle    12d6 <vc_image_resize_bytes+0x156>
mov    %ebp,%ecx
shl    $0x5,%ecx
mov    $0x20,%r14d
cmp    %eax,%ecx
jle    12d6 <vc_image_resize_bytes+0x156>
cltd
idiv   %ebp
cmp    $0x10,%eax
mov    $0x10,%r14d
cmovl  %eax,%r14d
xor    %edi,%edi
test   %eax,%eax
setg   %dil
call   10a0 <assert@plt>
mov    %rbx,%r10
mov    %r10d,%eax
shl    $0x10,%eax
cltd
idiv   %r15d
mov    %rax,0x38(%rsp)
add    $0xffffffff,%r10d
mov    %rbp,0x10(%rsp)
xor    %r12d,%r12d
xor    %eax,%eax
mov    %r15,0x30(%rsp)
mov    %r10,0x28(%rsp)
mov    0x20(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
nop
mov    %rax,0x58(%rsp)
mov    %r13,0x60(%rsp)
lea    (%r12,%r14,1),%ecx
mov    %r15d,%ebp
sub    %r12d,%ebp
cmp    %r15d,%ecx
cmovle %r14d,%ebp
mov    %rbx,%rdi
mov    (%rsp),%rsi
mov    %ebp,%edx
mov    0x10(%rsp),%rcx
mov    0x48(%rsp),%r8
mov    0x50(%rsp),%r9
mov    0x18(%rsp),%r15
push   %r15
push   %r10
mov    0x48(%rsp),%r14
push   %r14
push   %rax
call   1080 <vcir8_vzoom2@plt>
add    $0x20,%rsp
mov    %r13,%rdi
mov    0x40(%rsp),%rsi
mov    %ebp,%edx
mov    0x8(%rsp),%r13
mov    %r13d,%ecx
mov    %rbx,%r8
mov    (%rsp),%r9
push   %r15
push   0x18(%rsp)
mov    0x40(%rsp),%r15
call   1070 <vcir8_hzoom@plt>
mov    0x38(%rsp),%r10
add    $0x10,%rsp
mov    %ebp,%eax
imul   %r14d,%eax
add    0x58(%rsp),%eax
mov    %ebp,%ecx
imul   %r13d,%ecx
mov    0x60(%rsp),%r13
movslq %ecx,%rcx
add    %rcx,%r13
add    %ebp,%r12d
mov    %ebp,%r14d
cmp    %r15d,%r12d
jl     1310 <vc_image_resize_bytes+0x190>
mov    0x20(%rsp),%rdi
add    $0x68,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <vclib_release_tmp_buf@plt>
imul   %ecx,%eax
movslq %eax,%r14
add    %r13,%r14
mov    %r14,%rdi
mov    %r12d,%esi
mov    %r11d,%edx
mov    0x8(%rsp),%rcx
mov    %rbx,%r8
mov    (%rsp),%r9
push   %rbp
push   %r10
mov    %r11,%rbx
call   1070 <vcir8_hzoom@plt>
mov    0x18(%rsp),%rcx
add    $0x10,%rsp
cmp    %ebx,%r15d
je     1552 <vc_image_resize_bytes+0x3d2>
mov    %ebx,%eax
shl    $0x10,%eax
cltd
idiv   %r15d
add    $0xffffffff,%ebx
mov    %r13,%rdi
mov    %r12d,%esi
mov    %r15d,%edx
mov    %r14,%r8
mov    %ecx,%r9d
push   %rbp
push   %rbx
push   %rax
push   $0x0
call   1080 <vcir8_vzoom2@plt>
add    $0x88,%rsp
jmp    1556 <vc_image_resize_bytes+0x3d6>
xor    %edi,%edi
cmp    %r10d,%ecx
sete   %dil
add    $0x68,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    10a0 <assert@plt>
movslq %ecx,%r14
movslq %r10d,%rbp
add    $0x1,%r15d
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r13,%rdi
mov    %rbx,%rsi
mov    %r12d,%edx
call   1060 <vclib_memcpy@plt>
add    %r14,%r13
add    %rbp,%rbx
add    $0xffffffff,%r15d
cmp    $0x1,%r15d
ja     1470 <vc_image_resize_bytes+0x2f0>
jmp    1552 <vc_image_resize_bytes+0x3d2>
movslq %eax,%rdi
add    %r13,%rdi
mov    %r11d,%eax
shl    $0x10,%eax
cltd
idiv   %r15d
add    $0xffffffff,%r11d
mov    %rdi,0x10(%rsp)
mov    %r14d,%esi
mov    %r15d,%edx
mov    0x8(%rsp),%rcx
mov    %rbx,%r8
mov    %r10d,%r9d
push   %rbp
push   %r11
push   %rax
push   $0x0
call   1080 <vcir8_vzoom2@plt>
mov    0x28(%rsp),%rcx
add    $0x20,%rsp
cmp    %r14d,%r12d
je     1552 <vc_image_resize_bytes+0x3d2>
mov    %r13,%rdi
mov    %r12d,%esi
mov    %r15d,%edx
mov    0x10(%rsp),%r8
mov    %r14d,%r9d
push   %rbp
push   %rcx
call   1070 <vcir8_hzoom@plt>
add    $0x78,%rsp
jmp    1556 <vc_image_resize_bytes+0x3d6>
lea    0x0(,%rcx,8),%eax
cltq
mov    %rax,(%rsp)
mov    %r10d,%eax
shl    $0x4,%eax
cltq
mov    %rax,0x10(%rsp)
add    $0x8,%r15d
mov    0x18(%rsp),%r14
nopw   0x0(%rax,%rax,1)
mov    %r13,%rdi
mov    %rbx,%rsi
mov    %r12d,%edx
mov    0x8(%rsp),%rcx
mov    %r10d,%r8d
mov    %r14d,%r9d
mov    %r10,%rbp
call   1040 <vcir8_down2_8@plt>
mov    %rbp,%r10
add    (%rsp),%r13
add    0x10(%rsp),%rbx
add    $0xfffffff8,%r15d
cmp    $0x8,%r15d
ja     1520 <vc_image_resize_bytes+0x3a0>
add    $0x68,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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