#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*/ build_upsample_pixelprop_table(float *, float *, int const);
int /*<<< orphan*/ memcpy(unsigned char *, unsigned char *, int);
int return_downscaled_array_len(int, int const, int const);
int /*<<< orphan*/ upsample_component_line_linear(unsigned char *,
                                                  unsigned char *, int,
                                                  int const, int const, int,
                                                  float *, float *);
void upsample_component_linear(unsigned char *carray, int width, int height,
                               const int xpos, const int ypos, const int xstep,
                               const int ystep) {
  float x_pixel_percent1[xstep];
  float x_pixel_percent2[xstep];
  unsigned char x_out_buff[width + xpos + xstep];
  unsigned char x_in_buff[width + 1];
  unsigned char y_out_buff[height + ypos + ystep];
  unsigned char y_in_buff[height + 1];
  float y_pixel_percent1[ystep];
  float y_pixel_percent2[ystep];
  int compressed_width;
  int compressed_height;
  int linecount;
  unsigned char *datastart;
  int i;
  compressed_width = return_downscaled_array_len(width, xpos, xstep);
  compressed_height = return_downscaled_array_len(height, ypos, ystep);
  build_upsample_pixelprop_table(x_pixel_percent1, x_pixel_percent2, xstep);
  build_upsample_pixelprop_table(y_pixel_percent1, y_pixel_percent2, ystep);
  if ((xstep != 1) || (xpos != 0)) {
    for (linecount = 0; linecount < compressed_height; linecount++) {
      datastart = carray + (linecount * width);
      memcpy(x_in_buff, datastart, compressed_width);
      x_in_buff[compressed_width] = x_in_buff[compressed_width - 1];
      upsample_component_line_linear(x_in_buff, x_out_buff, width, xpos, xstep,
                                     compressed_width, x_pixel_percent1,
                                     x_pixel_percent2);
      memcpy(datastart, x_out_buff, width);
    }
  }
  if ((ystep != 1) || (ypos != 0)) {
    for (linecount = 0; linecount < width; linecount++) {
      datastart = carray + linecount;
      for (i = 0; i < compressed_height; i++)
        *(y_in_buff + i) = *(datastart + (width * i));
      y_in_buff[compressed_height] = y_in_buff[compressed_height - 1];
      upsample_component_line_linear(y_in_buff, y_out_buff, height, ypos, ystep,
                                     compressed_height, y_pixel_percent1,
                                     y_pixel_percent2);
      for (i = 0; i < height; i++)
        *(datastart + (width * i)) = *(y_out_buff + i);
    }
  }
}


x86 assembly (clang, -O0):
<upsample_component_linear>:
push   %rbp
mov    %rsp,%rbp
sub    $0xd0,%rsp
mov    0x10(%rbp),%eax
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8d,-0x18(%rbp)
mov    %r9d,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x28(%rbp)
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0xa8(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x30(%rbp)
mov    -0x1c(%rbp),%eax
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0xa0(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x38(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x14(%rbp),%ecx
add    %ecx,%eax
mov    -0x1c(%rbp),%ecx
add    %ecx,%eax
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0xc8(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x40(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0xc0(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x48(%rbp)
mov    -0x10(%rbp),%eax
mov    -0x18(%rbp),%ecx
add    %ecx,%eax
mov    0x10(%rbp),%ecx
add    %ecx,%eax
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0xb8(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x50(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0xb0(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x58(%rbp)
mov    0x10(%rbp),%eax
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x98(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x60(%rbp)
mov    0x10(%rbp),%eax
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x90(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x68(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x14(%rbp),%esi
mov    -0x1c(%rbp),%edx
call   1030 <return_downscaled_array_len@plt>
mov    %eax,-0x6c(%rbp)
mov    -0x10(%rbp),%edi
mov    -0x18(%rbp),%esi
mov    0x10(%rbp),%edx
call   1030 <return_downscaled_array_len@plt>
mov    -0xa8(%rbp),%rdi
mov    -0xa0(%rbp),%rsi
mov    %eax,-0x70(%rbp)
mov    -0x1c(%rbp),%edx
call   1050 <build_upsample_pixelprop_table@plt>
mov    -0x98(%rbp),%rdi
mov    -0x90(%rbp),%rsi
mov    0x10(%rbp),%edx
call   1050 <build_upsample_pixelprop_table@plt>
cmpl   $0x1,-0x1c(%rbp)
jne    12fa <upsample_component_linear+0x1ba>
cmpl   $0x0,-0x14(%rbp)
je     13ae <upsample_component_linear+0x26e>
movl   $0x0,-0x74(%rbp)
mov    -0x74(%rbp),%eax
cmp    -0x70(%rbp),%eax
jge    13a9 <upsample_component_linear+0x269>
mov    -0xc0(%rbp),%rdi
mov    -0x8(%rbp),%rax
mov    -0x74(%rbp),%ecx
imul   -0xc(%rbp),%ecx
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x80(%rbp)
mov    -0x80(%rbp),%rsi
mov    -0x6c(%rbp),%edx
call   1060 <memcpy@plt>
mov    -0xc0(%rbp),%rdi
mov    -0xa8(%rbp),%r10
mov    -0xc8(%rbp),%rsi
mov    -0xa0(%rbp),%rax
mov    -0x6c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rdi,%rcx,1),%dl
movslq -0x6c(%rbp),%rcx
mov    %dl,(%rdi,%rcx,1)
mov    -0xc(%rbp),%edx
mov    -0x14(%rbp),%ecx
mov    -0x1c(%rbp),%r8d
mov    -0x6c(%rbp),%r9d
sub    $0x10,%rsp
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
call   1040 <upsample_component_line_linear@plt>
mov    -0xc8(%rbp),%rsi
add    $0x10,%rsp
mov    -0x80(%rbp),%rdi
mov    -0xc(%rbp),%edx
call   1060 <memcpy@plt>
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
jmp    1301 <upsample_component_linear+0x1c1>
jmp    13ae <upsample_component_linear+0x26e>
cmpl   $0x1,0x10(%rbp)
jne    13c2 <upsample_component_linear+0x282>
cmpl   $0x0,-0x18(%rbp)
je     14f3 <upsample_component_linear+0x3b3>
movl   $0x0,-0x74(%rbp)
mov    -0x74(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    14ee <upsample_component_linear+0x3ae>
mov    -0x8(%rbp),%rax
movslq -0x74(%rbp),%rcx
add    %rcx,%rax
mov    %rax,-0x80(%rbp)
movl   $0x0,-0x84(%rbp)
mov    -0x84(%rbp),%eax
cmp    -0x70(%rbp),%eax
jge    1436 <upsample_component_linear+0x2f6>
mov    -0xb0(%rbp),%rax
mov    -0x80(%rbp),%rcx
mov    -0xc(%rbp),%edx
imul   -0x84(%rbp),%edx
movslq %edx,%rdx
mov    (%rcx,%rdx,1),%dl
movslq -0x84(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x84(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x84(%rbp)
jmp    13ee <upsample_component_linear+0x2ae>
mov    -0x90(%rbp),%rax
mov    -0x98(%rbp),%r10
mov    -0xb8(%rbp),%rsi
mov    -0xb0(%rbp),%rdi
mov    -0x70(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rdi,%rcx,1),%dl
movslq -0x70(%rbp),%rcx
mov    %dl,(%rdi,%rcx,1)
mov    -0x10(%rbp),%edx
mov    -0x18(%rbp),%ecx
mov    0x10(%rbp),%r8d
mov    -0x70(%rbp),%r9d
sub    $0x10,%rsp
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
call   1040 <upsample_component_line_linear@plt>
add    $0x10,%rsp
movl   $0x0,-0x84(%rbp)
mov    -0x84(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    14db <upsample_component_linear+0x39b>
mov    -0xb8(%rbp),%rax
movslq -0x84(%rbp),%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x80(%rbp),%rax
mov    -0xc(%rbp),%ecx
imul   -0x84(%rbp),%ecx
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x84(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x84(%rbp)
jmp    1493 <upsample_component_linear+0x353>
jmp    14e0 <upsample_component_linear+0x3a0>
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
jmp    13c9 <upsample_component_linear+0x289>
jmp    14f3 <upsample_component_linear+0x3b3>
mov    -0x28(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<upsample_component_linear>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x88,%rsp
mov    %r8,-0x90(%rbp)
mov    %edx,%r10d
mov    %esi,%ebx
mov    %rdi,-0x70(%rbp)
mov    0x10(%rbp),%edx
mov    %r9d,%eax
mov    %rsp,%rsi
lea    0xf(,%rax,4),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rsi
mov    %rsi,-0x50(%rbp)
mov    %rsi,%rsp
mov    %rsp,%rsi
sub    %rax,%rsi
mov    %rsi,-0x48(%rbp)
mov    %rsi,%rsp
lea    (%rcx,%rbx,1),%eax
mov    %rcx,%rsi
mov    %rcx,-0x58(%rbp)
add    %r9d,%eax
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
mov    %rsp,%rcx
sub    %rax,%rcx
mov    %rcx,-0x68(%rbp)
mov    %rcx,%rsp
lea    0x1(%rbx),%eax
mov    %rsp,%rcx
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rcx
mov    %rcx,-0x78(%rbp)
mov    %rcx,%rsp
mov    %r10,-0x88(%rbp)
lea    (%r8,%r10,1),%eax
add    %edx,%eax
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
mov    %rsp,%r15
sub    %rax,%r15
mov    %r15,%rsp
lea    0x1(%r10),%eax
mov    %rsp,%r12
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r12
mov    %r12,%rsp
mov    %rsp,%r13
lea    0xf(,%rdx,4),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r13
mov    %r13,%rsp
mov    %rsp,%r14
sub    %rax,%r14
mov    %r14,%rsp
mov    %rbx,-0x38(%rbp)
mov    %ebx,%edi
mov    %r9d,%edx
mov    %r9d,%ebx
call   1030 <return_downscaled_array_len@plt>
mov    %eax,-0x40(%rbp)
mov    -0x88(%rbp),%rdi
mov    -0x90(%rbp),%rsi
mov    0x10(%rbp),%edx
call   1030 <return_downscaled_array_len@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x50(%rbp),%rdi
mov    -0x48(%rbp),%rsi
mov    %ebx,%edx
call   1050 <build_upsample_pixelprop_table@plt>
mov    %r13,-0xb0(%rbp)
mov    %r13,%rdi
mov    %r14,-0xa8(%rbp)
mov    %r14,%rsi
mov    0x10(%rbp),%edx
call   1050 <build_upsample_pixelprop_table@plt>
mov    %ebx,-0x80(%rbp)
xor    $0x1,%ebx
or     -0x58(%rbp),%ebx
mov    -0x2c(%rbp),%eax
mov    %rax,-0x60(%rbp)
je     1324 <upsample_component_linear+0x1e4>
cmpl   $0x0,-0x2c(%rbp)
jle    1324 <upsample_component_linear+0x1e4>
movslq -0x40(%rbp),%rax
mov    %rax,-0xa0(%rbp)
movslq -0x38(%rbp),%rax
mov    %rax,-0x98(%rbp)
mov    -0x60(%rbp),%r14
mov    -0x70(%rbp),%r13
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    -0x78(%rbp),%rbx
mov    %rbx,%rdi
mov    %r13,%rsi
mov    -0x40(%rbp),%edx
call   1060 <memcpy@plt>
mov    -0xa0(%rbp),%rcx
movzbl -0x1(%rbx,%rcx,1),%eax
mov    %al,(%rbx,%rcx,1)
mov    %rbx,%rdi
mov    -0x68(%rbp),%rsi
mov    -0x38(%rbp),%rbx
mov    %ebx,%edx
mov    -0x58(%rbp),%rcx
mov    -0x80(%rbp),%r8d
mov    -0x40(%rbp),%r9d
push   -0x48(%rbp)
push   -0x50(%rbp)
call   1040 <upsample_component_line_linear@plt>
add    $0x10,%rsp
mov    %r13,%rdi
mov    -0x68(%rbp),%rsi
mov    %ebx,%edx
call   1060 <memcpy@plt>
add    -0x98(%rbp),%r13
add    $0xffffffffffffffff,%r14
jne    12c0 <upsample_component_linear+0x180>
mov    0x10(%rbp),%eax
xor    $0x1,%eax
or     -0x90(%rbp),%eax
mov    -0x70(%rbp),%r9
mov    -0x60(%rbp),%r8
mov    -0x38(%rbp),%rax
je     1547 <upsample_component_linear+0x407>
test   %eax,%eax
jle    1547 <upsample_component_linear+0x407>
movslq -0x2c(%rbp),%rcx
mov    %rcx,-0x68(%rbp)
mov    %eax,%r14d
mov    -0x88(%rbp),%edi
lea    -0x1(%r8),%rax
mov    %rax,-0x80(%rbp)
lea    -0x1(%rdi),%rax
mov    %rax,-0x78(%rbp)
mov    %r8d,%ebx
and    $0x3,%ebx
and    $0xfffffffc,%r8d
mov    %edi,%esi
and    $0x3,%esi
and    $0xfffffffc,%edi
lea    0x0(,%r14,4),%r10
lea    (%r14,%r14,2),%r13
xor    %eax,%eax
mov    %r8,-0x60(%rbp)
mov    %rdi,-0x38(%rbp)
mov    %rbx,-0x58(%rbp)
mov    %rsi,-0x50(%rbp)
mov    %r10,-0x48(%rbp)
jmp    13c9 <upsample_component_linear+0x289>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    -0x40(%rbp),%rax
add    $0x1,%rax
add    $0x1,%r9
cmp    %r14,%rax
mov    -0x58(%rbp),%rbx
je     1547 <upsample_component_linear+0x407>
mov    %rax,-0x40(%rbp)
cmpl   $0x0,-0x2c(%rbp)
jle    1462 <upsample_component_linear+0x322>
cmpq   $0x3,-0x80(%rbp)
jae    13f0 <upsample_component_linear+0x2b0>
xor    %eax,%eax
jmp    1431 <upsample_component_linear+0x2f1>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r9,%rcx
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
nop
movzbl (%rcx),%edx
mov    %dl,(%r12,%rax,1)
movzbl (%rcx,%r14,1),%edx
mov    %dl,0x1(%r12,%rax,1)
movzbl (%rcx,%r14,2),%edx
mov    %dl,0x2(%r12,%rax,1)
movzbl (%rcx,%r13,1),%edx
mov    %dl,0x3(%r12,%rax,1)
add    $0x4,%rax
add    %r10,%rcx
cmp    %rax,%r8
jne    1400 <upsample_component_linear+0x2c0>
test   %rbx,%rbx
je     1462 <upsample_component_linear+0x322>
lea    (%r12,%rax,1),%rsi
imul   %r14,%rax
add    %r9,%rax
xor    %edx,%edx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movzbl (%rax),%ecx
mov    %cl,(%rsi,%rdx,1)
add    $0x1,%rdx
add    %r14,%rax
cmp    %rdx,%rbx
jne    1450 <upsample_component_linear+0x310>
mov    -0x68(%rbp),%rcx
mov    -0x1(%r12,%rcx,1),%al
mov    %al,(%r12,%rcx,1)
mov    %r9,-0x70(%rbp)
mov    %r12,%rdi
mov    %r15,%rsi
mov    -0x88(%rbp),%rbx
mov    %ebx,%edx
mov    -0x90(%rbp),%rcx
mov    0x10(%rbp),%r8d
mov    -0x2c(%rbp),%r9d
push   -0xa8(%rbp)
push   -0xb0(%rbp)
call   1040 <upsample_component_line_linear@plt>
mov    -0x48(%rbp),%r10
mov    -0x60(%rbp),%r8
mov    -0x70(%rbp),%r9
add    $0x10,%rsp
test   %ebx,%ebx
mov    -0x38(%rbp),%rdi
mov    -0x50(%rbp),%rsi
jle    13b0 <upsample_component_linear+0x270>
cmpq   $0x3,-0x78(%rbp)
jae    14d0 <upsample_component_linear+0x390>
xor    %eax,%eax
jmp    1511 <upsample_component_linear+0x3d1>
nopl   (%rax)
mov    %r9,%rcx
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
nop
movzbl (%r15,%rax,1),%edx
mov    %dl,(%rcx)
movzbl 0x1(%r15,%rax,1),%edx
mov    %dl,(%rcx,%r14,1)
movzbl 0x2(%r15,%rax,1),%edx
mov    %dl,(%rcx,%r14,2)
movzbl 0x3(%r15,%rax,1),%edx
mov    %dl,(%rcx,%r13,1)
add    $0x4,%rax
add    %r10,%rcx
cmp    %rax,%rdi
jne    14e0 <upsample_component_linear+0x3a0>
test   %rsi,%rsi
je     13b0 <upsample_component_linear+0x270>
mov    %r14,%rcx
imul   %rax,%rcx
add    %r9,%rcx
add    %r15,%rax
xor    %edx,%edx
nopl   0x0(%rax)
movzbl (%rax,%rdx,1),%ebx
mov    %bl,(%rcx)
add    $0x1,%rdx
add    %r14,%rcx
cmp    %rdx,%rsi
jne    1530 <upsample_component_linear+0x3f0>
jmp    13b0 <upsample_component_linear+0x270>
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @upsample_component_linear(i8* %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6) {
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i8*
%16 = alloca i64
%17 = alloca i64
%18 = alloca i64
%19 = alloca i64
%20 = alloca i64
%21 = alloca i64
%22 = alloca i64
%23 = alloca i64
%24 = alloca i32
%25 = alloca i32
%26 = alloca i32
%27 = alloca i8*
%28 = alloca i32
store i8* %0, i8** %8
store i32 %1, i32* %9
store i32 %2, i32* %10
store i32 %3, i32* %11
store i32 %4, i32* %12
store i32 %5, i32* %13
store i32 %6, i32* %14
%29 = load i32, i32* %13
%30 = zext i32 %29 to i64
%31 = call i8* @llvm.stacksave()
store i8* %31, i8** %15
%32 = alloca float, i64 %30
store i64 %30, i64* %16
%33 = load i32, i32* %13
%34 = zext i32 %33 to i64
%35 = alloca float, i64 %34
store i64 %34, i64* %17
%36 = load i32, i32* %9
%37 = load i32, i32* %11
%38 = add nsw i32 %36, %37
%39 = load i32, i32* %13
%40 = add nsw i32 %38, %39
%41 = zext i32 %40 to i64
%42 = alloca i8, i64 %41
store i64 %41, i64* %18
%43 = load i32, i32* %9
%44 = add nsw i32 %43, 1
%45 = zext i32 %44 to i64
%46 = alloca i8, i64 %45
store i64 %45, i64* %19
%47 = load i32, i32* %10
%48 = load i32, i32* %12
%49 = add nsw i32 %47, %48
%50 = load i32, i32* %14
%51 = add nsw i32 %49, %50
%52 = zext i32 %51 to i64
%53 = alloca i8, i64 %52
store i64 %52, i64* %20
%54 = load i32, i32* %10
%55 = add nsw i32 %54, 1
%56 = zext i32 %55 to i64
%57 = alloca i8, i64 %56
store i64 %56, i64* %21
%58 = load i32, i32* %14
%59 = zext i32 %58 to i64
%60 = alloca float, i64 %59
store i64 %59, i64* %22
%61 = load i32, i32* %14
%62 = zext i32 %61 to i64
%63 = alloca float, i64 %62
store i64 %62, i64* %23
%64 = load i32, i32* %9
%65 = load i32, i32* %11
%66 = load i32, i32* %13
%67 = call i32 @return_downscaled_array_len(i32 %64, i32 %65, i32 %66)
store i32 %67, i32* %24
%68 = load i32, i32* %10
%69 = load i32, i32* %12
%70 = load i32, i32* %14
%71 = call i32 @return_downscaled_array_len(i32 %68, i32 %69, i32 %70)
store i32 %71, i32* %25
%72 = load i32, i32* %13
%73 = call i32 @build_upsample_pixelprop_table(float* %32, float* %35, i32 %72)
%74 = load i32, i32* %14
%75 = call i32 @build_upsample_pixelprop_table(float* %60, float* %63, i32 %74)
%76 = load i32, i32* %13
%77 = icmp ne i32 %76, 1
br i1 %77, label %81, label %78
78: ; preds = %7
%79 = load i32, i32* %11
%80 = icmp ne i32 %79, 0
br i1 %80, label %81, label %116
81: ; preds = %78, %7
store i32 0, i32* %26
br label %82
82: ; preds = %112, %81
%83 = load i32, i32* %26
%84 = load i32, i32* %25
%85 = icmp slt i32 %83, %84
br i1 %85, label %86, label %115
86: ; preds = %82
%87 = load i8*, i8** %8
%88 = load i32, i32* %26
%89 = load i32, i32* %9
%90 = mul nsw i32 %88, %89
%91 = sext i32 %90 to i64
%92 = getelementptr inbounds i8, i8* %87, i64 %91
store i8* %92, i8** %27
%93 = load i8*, i8** %27
%94 = load i32, i32* %24
%95 = call i32 @memcpy(i8* %46, i8* %93, i32 %94)
%96 = load i32, i32* %24
%97 = sub nsw i32 %96, 1
%98 = sext i32 %97 to i64
%99 = getelementptr inbounds i8, i8* %46, i64 %98
%100 = load i8, i8* %99
%101 = load i32, i32* %24
%102 = sext i32 %101 to i64
%103 = getelementptr inbounds i8, i8* %46, i64 %102
store i8 %100, i8* %103
%104 = load i32, i32* %9
%105 = load i32, i32* %11
%106 = load i32, i32* %13
%107 = load i32, i32* %24
%108 = call i32 @upsample_component_line_linear(i8* %46, i8* %42, i32 %104, i32 %105, i32 %106, i32 %107, float* %32, float* %35)
%109 = load i8*, i8** %27
%110 = load i32, i32* %9
%111 = call i32 @memcpy(i8* %109, i8* %42, i32 %110)
br label %112
112: ; preds = %86
%113 = load i32, i32* %26
%114 = add nsw i32 %113, 1
store i32 %114, i32* %26
br label %82
115: ; preds = %82
br label %116
116: ; preds = %115, %78
%117 = load i32, i32* %14
%118 = icmp ne i32 %117, 1
br i1 %118, label %122, label %119
119: ; preds = %116
%120 = load i32, i32* %12
%121 = icmp ne i32 %120, 0
br i1 %121, label %122, label %187
122: ; preds = %119, %116
store i32 0, i32* %26
br label %123
123: ; preds = %183, %122
%124 = load i32, i32* %26
%125 = load i32, i32* %9
%126 = icmp slt i32 %124, %125
br i1 %126, label %127, label %186
127: ; preds = %123
%128 = load i8*, i8** %8
%129 = load i32, i32* %26
%130 = sext i32 %129 to i64
%131 = getelementptr inbounds i8, i8* %128, i64 %130
store i8* %131, i8** %27
store i32 0, i32* %28
br label %132
132: ; preds = %147, %127
%133 = load i32, i32* %28
%134 = load i32, i32* %25
%135 = icmp slt i32 %133, %134
br i1 %135, label %136, label %150
136: ; preds = %132
%137 = load i8*, i8** %27
%138 = load i32, i32* %9
%139 = load i32, i32* %28
%140 = mul nsw i32 %138, %139
%141 = sext i32 %140 to i64
%142 = getelementptr inbounds i8, i8* %137, i64 %141
%143 = load i8, i8* %142
%144 = load i32, i32* %28
%145 = sext i32 %144 to i64
%146 = getelementptr inbounds i8, i8* %57, i64 %145
store i8 %143, i8* %146
br label %147
147: ; preds = %136
%148 = load i32, i32* %28
%149 = add nsw i32 %148, 1
store i32 %149, i32* %28
br label %132
150: ; preds = %132
%151 = load i32, i32* %25
%152 = sub nsw i32 %151, 1
%153 = sext i32 %152 to i64
%154 = getelementptr inbounds i8, i8* %57, i64 %153
%155 = load i8, i8* %154
%156 = load i32, i32* %25
%157 = sext i32 %156 to i64
%158 = getelementptr inbounds i8, i8* %57, i64 %157
store i8 %155, i8* %158
%159 = load i32, i32* %10
%160 = load i32, i32* %12
%161 = load i32, i32* %14
%162 = load i32, i32* %25
%163 = call i32 @upsample_component_line_linear(i8* %57, i8* %53, i32 %159, i32 %160, i32 %161, i32 %162, float* %60, float* %63)
store i32 0, i32* %28
br label %164
164: ; preds = %179, %150
%165 = load i32, i32* %28
%166 = load i32, i32* %10
%167 = icmp slt i32 %165, %166
br i1 %167, label %168, label %182
168: ; preds = %164
%169 = load i32, i32* %28
%170 = sext i32 %169 to i64
%171 = getelementptr inbounds i8, i8* %53, i64 %170
%172 = load i8, i8* %171
%173 = load i8*, i8** %27
%174 = load i32, i32* %9
%175 = load i32, i32* %28
%176 = mul nsw i32 %174, %175
%177 = sext i32 %176 to i64
%178 = getelementptr inbounds i8, i8* %173, i64 %177
store i8 %172, i8* %178
br label %179
179: ; preds = %168
%180 = load i32, i32* %28
%181 = add nsw i32 %180, 1
store i32 %181, i32* %28
br label %164
182: ; preds = %164
br label %183
183: ; preds = %182
%184 = load i32, i32* %26
%185 = add nsw i32 %184, 1
store i32 %185, i32* %26
br label %123
186: ; preds = %123
br label %187
187: ; preds = %186, %119
%188 = load i8*, i8** %15
ret void
}

LLVM IR (-O2):
define void @upsample_component_linear(i8* %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6) {
%8 = zext i32 %5 to i64
%9 = alloca float, i64 %8
%10 = alloca float, i64 %8
%11 = add nsw i32 %3, %1
%12 = add nsw i32 %11, %5
%13 = zext i32 %12 to i64
%14 = alloca i8, i64 %13
%15 = add nsw i32 %1, 1
%16 = zext i32 %15 to i64
%17 = alloca i8, i64 %16
%18 = add nsw i32 %4, %2
%19 = add nsw i32 %18, %6
%20 = zext i32 %19 to i64
%21 = alloca i8, i64 %20
%22 = add nsw i32 %2, 1
%23 = zext i32 %22 to i64
%24 = alloca i8, i64 %23
%25 = zext i32 %6 to i64
%26 = alloca float, i64 %25
%27 = alloca float, i64 %25
%28 = tail call i32 @return_downscaled_array_len(i32 %1, i32 %3, i32 %5)
%29 = tail call i32 @return_downscaled_array_len(i32 %2, i32 %4, i32 %6)
%30 = call i32 @build_upsample_pixelprop_table(float* %9, float* %10, i32 %5)
%31 = call i32 @build_upsample_pixelprop_table(float* %26, float* %27, i32 %6)
%32 = icmp ne i32 %5, 1
%33 = icmp ne i32 %3, 0
%34 = or i1 %33, %32
%35 = icmp sgt i32 %29, 0
%36 = select i1 %34, i1 %35, i1 false
br i1 %36, label %37, label %55
37: ; preds = %7
%38 = add nsw i32 %28, -1
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds i8, i8* %17, i64 %39
%41 = sext i32 %28 to i64
%42 = getelementptr inbounds i8, i8* %17, i64 %41
%43 = sext i32 %1 to i64
%44 = zext i32 %29 to i64
br label %45
45: ; preds = %37, %45
%46 = phi i64 [ 0, %37 ], [ %53, %45 ]
%47 = mul nsw i64 %46, %43
%48 = getelementptr inbounds i8, i8* %0, i64 %47
%49 = call i32 @memcpy(i8* %17, i8* %48, i32 %28)
%50 = load i8, i8* %40
store i8 %50, i8* %42
%51 = call i32 @upsample_component_line_linear(i8* %17, i8* %14, i32 %1, i32 %3, i32 %5, i32 %28, float* %9, float* %10)
%52 = call i32 @memcpy(i8* %48, i8* %14, i32 %1)
%53 = add nuw nsw i64 %46, 1
%54 = icmp eq i64 %53, %44
br i1 %54, label %55, label %45
55: ; preds = %45, %7
%56 = icmp ne i32 %6, 1
%57 = icmp ne i32 %4, 0
%58 = or i1 %57, %56
%59 = icmp sgt i32 %1, 0
%60 = and i1 %58, %59
br i1 %60, label %61, label %167
61: ; preds = %55
%62 = add nsw i32 %29, -1
%63 = sext i32 %62 to i64
%64 = getelementptr inbounds i8, i8* %24, i64 %63
%65 = sext i32 %29 to i64
%66 = getelementptr inbounds i8, i8* %24, i64 %65
%67 = icmp sgt i32 %2, 0
%68 = zext i32 %1 to i64
%69 = zext i32 %1 to i64
%70 = zext i32 %29 to i64
%71 = zext i32 %2 to i64
%72 = add nsw i64 %70, -1
%73 = add nsw i64 %71, -1
%74 = and i64 %70, 3
%75 = icmp ult i64 %72, 3
%76 = and i64 %70, 4294967292
%77 = icmp eq i64 %74, 0
%78 = and i64 %71, 3
%79 = icmp ult i64 %73, 3
%80 = and i64 %71, 4294967292
%81 = icmp eq i64 %78, 0
br label %82
82: ; preds = %61, %164
%83 = phi i64 [ 0, %61 ], [ %165, %164 ]
%84 = getelementptr inbounds i8, i8* %0, i64 %83
br i1 %35, label %85, label %123
85: ; preds = %82
br i1 %75, label %111, label %86
86: ; preds = %85, %86
%87 = phi i64 [ %108, %86 ], [ 0, %85 ]
%88 = phi i64 [ %109, %86 ], [ 0, %85 ]
%89 = mul nsw i64 %87, %68
%90 = getelementptr inbounds i8, i8* %84, i64 %89
%91 = load i8, i8* %90
%92 = getelementptr inbounds i8, i8* %24, i64 %87
store i8 %91, i8* %92
%93 = or i64 %87, 1
%94 = mul nsw i64 %93, %68
%95 = getelementptr inbounds i8, i8* %84, i64 %94
%96 = load i8, i8* %95
%97 = getelementptr inbounds i8, i8* %24, i64 %93
store i8 %96, i8* %97
%98 = or i64 %87, 2
%99 = mul nsw i64 %98, %68
%100 = getelementptr inbounds i8, i8* %84, i64 %99
%101 = load i8, i8* %100
%102 = getelementptr inbounds i8, i8* %24, i64 %98
store i8 %101, i8* %102
%103 = or i64 %87, 3
%104 = mul nsw i64 %103, %68
%105 = getelementptr inbounds i8, i8* %84, i64 %104
%106 = load i8, i8* %105
%107 = getelementptr inbounds i8, i8* %24, i64 %103
store i8 %106, i8* %107
%108 = add nuw nsw i64 %87, 4
%109 = add i64 %88, 4
%110 = icmp eq i64 %109, %76
br i1 %110, label %111, label %86
111: ; preds = %86, %85
%112 = phi i64 [ 0, %85 ], [ %108, %86 ]
br i1 %77, label %123, label %113
113: ; preds = %111, %113
%114 = phi i64 [ %120, %113 ], [ %112, %111 ]
%115 = phi i64 [ %121, %113 ], [ 0, %111 ]
%116 = mul nsw i64 %114, %68
%117 = getelementptr inbounds i8, i8* %84, i64 %116
%118 = load i8, i8* %117
%119 = getelementptr inbounds i8, i8* %24, i64 %114
store i8 %118, i8* %119
%120 = add nuw nsw i64 %114, 1
%121 = add i64 %115, 1
%122 = icmp eq i64 %121, %74
br i1 %122, label %123, label %113
123: ; preds = %111, %113, %82
%124 = load i8, i8* %64
store i8 %124, i8* %66
%125 = call i32 @upsample_component_line_linear(i8* %24, i8* %21, i32 %2, i32 %4, i32 %6, i32 %29, float* %26, float* %27)
br i1 %67, label %126, label %164
126: ; preds = %123
br i1 %79, label %152, label %127
127: ; preds = %126, %127
%128 = phi i64 [ %149, %127 ], [ 0, %126 ]
%129 = phi i64 [ %150, %127 ], [ 0, %126 ]
%130 = getelementptr inbounds i8, i8* %21, i64 %128
%131 = load i8, i8* %130
%132 = mul nsw i64 %128, %68
%133 = getelementptr inbounds i8, i8* %84, i64 %132
store i8 %131, i8* %133
%134 = or i64 %128, 1
%135 = getelementptr inbounds i8, i8* %21, i64 %134
%136 = load i8, i8* %135
%137 = mul nsw i64 %134, %68
%138 = getelementptr inbounds i8, i8* %84, i64 %137
store i8 %136, i8* %138
%139 = or i64 %128, 2
%140 = getelementptr inbounds i8, i8* %21, i64 %139
%141 = load i8, i8* %140
%142 = mul nsw i64 %139, %68
%143 = getelementptr inbounds i8, i8* %84, i64 %142
store i8 %141, i8* %143
%144 = or i64 %128, 3
%145 = getelementptr inbounds i8, i8* %21, i64 %144
%146 = load i8, i8* %145
%147 = mul nsw i64 %144, %68
%148 = getelementptr inbounds i8, i8* %84, i64 %147
store i8 %146, i8* %148
%149 = add nuw nsw i64 %128, 4
%150 = add i64 %129, 4
%151 = icmp eq i64 %150, %80
br i1 %151, label %152, label %127
152: ; preds = %127, %126
%153 = phi i64 [ 0, %126 ], [ %149, %127 ]
br i1 %81, label %164, label %154
154: ; preds = %152, %154
%155 = phi i64 [ %161, %154 ], [ %153, %152 ]
%156 = phi i64 [ %162, %154 ], [ 0, %152 ]
%157 = getelementptr inbounds i8, i8* %21, i64 %155
%158 = load i8, i8* %157
%159 = mul nsw i64 %155, %68
%160 = getelementptr inbounds i8, i8* %84, i64 %159
store i8 %158, i8* %160
%161 = add nuw nsw i64 %155, 1
%162 = add i64 %156, 1
%163 = icmp eq i64 %162, %78
br i1 %163, label %164, label %154
164: ; preds = %152, %154, %123
%165 = add nuw nsw i64 %83, 1
%166 = icmp eq i64 %165, %69
br i1 %166, label %167, label %82
167: ; preds = %164, %55
ret void
}