#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 */
float catmullrom_interp(float const *, size_t, size_t, float, float, size_t);
void neuralops_omp_interpolate2d_catmullrom(size_t in_width, size_t in_height,
                                            size_t chan, size_t out_width,
                                            size_t out_height,
                                            const float *in_pixels,
                                            float *out_pixels) {
  float scale_x = ((float)in_width) / ((float)(out_width));
  float scale_y = ((float)in_height) / ((float)(out_height));
  size_t p_limit = out_width * out_height * chan;
#pragma omp parallel for
  for (size_t p = 0; p < p_limit; p++) {
    size_t x = p % out_width;
    size_t y = (p / out_width) % out_height;
    size_t a = p / (out_width * out_height);
    float u = (float)x * scale_x;
    float v = (float)y * scale_y;
    out_pixels[p] = catmullrom_interp(in_pixels, in_width, in_height, u, v, a);
  }
}


x86 assembly (clang, -O0):
<neuralops_omp_interpolate2d_catmullrom>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rdx
shr    %rdx
mov    %eax,%ecx
and    $0x1,%ecx
or     %rdx,%rcx
cvtsi2ss %rcx,%xmm0
addss  %xmm0,%xmm0
cvtsi2ss %rax,%xmm1
movss  %xmm1,-0x70(%rbp)
test   %rax,%rax
movss  %xmm0,-0x6c(%rbp)
js     1174 <neuralops_omp_interpolate2d_catmullrom+0x64>
movss  -0x70(%rbp),%xmm0
movss  %xmm0,-0x6c(%rbp)
movss  -0x6c(%rbp),%xmm0
movss  %xmm0,-0x7c(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,%rdx
shr    %rdx
mov    %eax,%ecx
and    $0x1,%ecx
or     %rdx,%rcx
cvtsi2ss %rcx,%xmm0
addss  %xmm0,%xmm0
cvtsi2ss %rax,%xmm1
movss  %xmm1,-0x78(%rbp)
test   %rax,%rax
movss  %xmm0,-0x74(%rbp)
js     11bb <neuralops_omp_interpolate2d_catmullrom+0xab>
movss  -0x78(%rbp),%xmm0
movss  %xmm0,-0x74(%rbp)
movss  -0x7c(%rbp),%xmm0
movss  -0x74(%rbp),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x34(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rdx
shr    %rdx
mov    %eax,%ecx
and    $0x1,%ecx
or     %rdx,%rcx
cvtsi2ss %rcx,%xmm0
addss  %xmm0,%xmm0
cvtsi2ss %rax,%xmm1
movss  %xmm1,-0x84(%rbp)
ff
test   %rax,%rax
movss  %xmm0,-0x80(%rbp)
js     1211 <neuralops_omp_interpolate2d_catmullrom+0x101>
movss  -0x84(%rbp),%xmm0
ff
movss  %xmm0,-0x80(%rbp)
movss  -0x80(%rbp),%xmm0
movss  %xmm0,-0x90(%rbp)
ff
mov    -0x28(%rbp),%rax
mov    %rax,%rdx
shr    %rdx
mov    %eax,%ecx
and    $0x1,%ecx
or     %rdx,%rcx
cvtsi2ss %rcx,%xmm0
addss  %xmm0,%xmm0
cvtsi2ss %rax,%xmm1
movss  %xmm1,-0x8c(%rbp)
ff
test   %rax,%rax
movss  %xmm0,-0x88(%rbp)
ff
js     1267 <neuralops_omp_interpolate2d_catmullrom+0x157>
movss  -0x8c(%rbp),%xmm0
ff
movss  %xmm0,-0x88(%rbp)
ff
movss  -0x90(%rbp),%xmm0
ff
movss  -0x88(%rbp),%xmm1
ff
divss  %xmm1,%xmm0
movss  %xmm0,-0x38(%rbp)
mov    -0x20(%rbp),%rax
imul   -0x28(%rbp),%rax
imul   -0x18(%rbp),%rax
mov    %rax,-0x40(%rbp)
movq   $0x0,-0x48(%rbp)
mov    -0x48(%rbp),%rax
cmp    -0x40(%rbp),%rax
jae    13ff <neuralops_omp_interpolate2d_catmullrom+0x2ef>
mov    -0x48(%rbp),%rax
mov    -0x20(%rbp),%rcx
xor    %edx,%edx
mov    %rdx,-0xa0(%rbp)
div    %rcx
mov    %rdx,%rax
mov    -0xa0(%rbp),%rdx
mov    %rax,-0x50(%rbp)
mov    -0x48(%rbp),%rax
mov    -0x20(%rbp),%rcx
div    %rcx
mov    -0xa0(%rbp),%rdx
mov    -0x28(%rbp),%rcx
div    %rcx
mov    %rdx,%rax
mov    -0xa0(%rbp),%rdx
mov    %rax,-0x58(%rbp)
mov    -0x48(%rbp),%rax
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%rsi
imul   %rsi,%rcx
div    %rcx
mov    %rax,-0x60(%rbp)
mov    -0x50(%rbp),%rax
mov    %rax,%rdx
shr    %rdx
mov    %eax,%ecx
and    $0x1,%ecx
or     %rdx,%rcx
cvtsi2ss %rcx,%xmm0
addss  %xmm0,%xmm0
cvtsi2ss %rax,%xmm1
movss  %xmm1,-0x98(%rbp)
ff
test   %rax,%rax
movss  %xmm0,-0x94(%rbp)
ff
js     1351 <neuralops_omp_interpolate2d_catmullrom+0x241>
movss  -0x98(%rbp),%xmm0
ff
movss  %xmm0,-0x94(%rbp)
ff
movss  -0x94(%rbp),%xmm0
ff
movss  -0x34(%rbp),%xmm1
mulss  %xmm1,%xmm0
movss  %xmm0,-0x64(%rbp)
mov    -0x58(%rbp),%rax
mov    %rax,%rdx
shr    %rdx
mov    %eax,%ecx
and    $0x1,%ecx
or     %rdx,%rcx
cvtsi2ss %rcx,%xmm0
addss  %xmm0,%xmm0
cvtsi2ss %rax,%xmm1
movss  %xmm1,-0xa8(%rbp)
ff
test   %rax,%rax
movss  %xmm0,-0xa4(%rbp)
ff
js     13b0 <neuralops_omp_interpolate2d_catmullrom+0x2a0>
movss  -0xa8(%rbp),%xmm0
ff
movss  %xmm0,-0xa4(%rbp)
ff
movss  -0xa4(%rbp),%xmm0
ff
mulss  -0x38(%rbp),%xmm0
movss  %xmm0,-0x68(%rbp)
mov    -0x30(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
movss  -0x64(%rbp),%xmm0
movss  -0x68(%rbp),%xmm1
mov    -0x60(%rbp),%rcx
call   1030 <catmullrom_interp@plt>
mov    0x10(%rbp),%rax
mov    -0x48(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x48(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x48(%rbp)
jmp    129a <neuralops_omp_interpolate2d_catmullrom+0x18a>
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<neuralops_omp_interpolate2d_catmullrom>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r9,0x10(%rsp)
mov    %r8,%r13
mov    %rcx,%rbx
mov    %rdx,%r12
mov    %rsi,%rbp
test   %rdi,%rdi
mov    %rdi,0x8(%rsp)
js     1140 <neuralops_omp_interpolate2d_catmullrom+0x30>
cvtsi2ss %rdi,%xmm0
jmp    1158 <neuralops_omp_interpolate2d_catmullrom+0x48>
mov    %rdi,%rax
shr    %rax
mov    %rdi,%rcx
and    $0x1,%ecx
or     %rax,%rcx
cvtsi2ss %rcx,%xmm0
addss  %xmm0,%xmm0
movss  %xmm0,0x4(%rsp)
test   %rbx,%rbx
js     1189 <neuralops_omp_interpolate2d_catmullrom+0x79>
xorps  %xmm0,%xmm0
cvtsi2ss %rbx,%xmm0
test   %rbp,%rbp
jns    11a8 <neuralops_omp_interpolate2d_catmullrom+0x98>
mov    %rbp,%rax
shr    %rax
mov    %ebp,%ecx
and    $0x1,%ecx
or     %rax,%rcx
cvtsi2ss %rcx,%xmm1
addss  %xmm1,%xmm1
jmp    11ad <neuralops_omp_interpolate2d_catmullrom+0x9d>
mov    %rbx,%rax
shr    %rax
mov    %ebx,%ecx
and    $0x1,%ecx
or     %rax,%rcx
xorps  %xmm0,%xmm0
cvtsi2ss %rcx,%xmm0
addss  %xmm0,%xmm0
test   %rbp,%rbp
js     1170 <neuralops_omp_interpolate2d_catmullrom+0x60>
cvtsi2ss %rbp,%xmm1
movss  %xmm1,(%rsp)
test   %r13,%r13
js     11c1 <neuralops_omp_interpolate2d_catmullrom+0xb1>
xorps  %xmm1,%xmm1
cvtsi2ss %r13,%xmm1
jmp    11dc <neuralops_omp_interpolate2d_catmullrom+0xcc>
mov    %r13,%rax
shr    %rax
mov    %r13d,%ecx
and    $0x1,%ecx
or     %rax,%rcx
xorps  %xmm1,%xmm1
cvtsi2ss %rcx,%xmm1
addss  %xmm1,%xmm1
mov    %r13,%r15
imul   %rbx,%r15
imul   %r15,%r12
test   %r12,%r12
je     131e <neuralops_omp_interpolate2d_catmullrom+0x20e>
movss  0x4(%rsp),%xmm2
divss  %xmm0,%xmm2
movss  %xmm2,0x4(%rsp)
movss  (%rsp),%xmm0
divss  %xmm1,%xmm0
movss  %xmm0,(%rsp)
xor    %r14d,%r14d
jmp    125d <neuralops_omp_interpolate2d_catmullrom+0x14d>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
xorps  %xmm1,%xmm1
cvtsi2ss %rsi,%xmm1
mov    0x8(%rsp),%rsi
mulss  (%rsp),%xmm1
mulss  0x4(%rsp),%xmm0
mov    0x10(%rsp),%rdi
mov    %rax,%rcx
call   1030 <catmullrom_interp@plt>
mov    0x50(%rsp),%rax
movss  %xmm0,(%rax,%r14,4)
add    $0x1,%r14
cmp    %r14,%r12
je     131e <neuralops_omp_interpolate2d_catmullrom+0x20e>
mov    %r14,%rax
or     %rbx,%rax
shr    $0x20,%rax
je     1280 <neuralops_omp_interpolate2d_catmullrom+0x170>
mov    %r14,%rax
xor    %edx,%edx
div    %rbx
mov    %rdx,%rcx
jmp    1289 <neuralops_omp_interpolate2d_catmullrom+0x179>
cs nopw 0x0(%rax,%rax,1)
mov    %r14d,%eax
xor    %edx,%edx
div    %ebx
mov    %edx,%ecx
mov    %rax,%rdx
or     %r13,%rdx
shr    $0x20,%rdx
je     12a0 <neuralops_omp_interpolate2d_catmullrom+0x190>
xor    %edx,%edx
div    %r13
mov    %rdx,%rsi
jmp    12a7 <neuralops_omp_interpolate2d_catmullrom+0x197>
nop
xor    %edx,%edx
div    %r13d
mov    %edx,%esi
mov    %r14,%rax
or     %r15,%rax
shr    $0x20,%rax
je     12d0 <neuralops_omp_interpolate2d_catmullrom+0x1c0>
mov    %r14,%rax
xor    %edx,%edx
div    %r15
test   %rcx,%rcx
js     12dd <neuralops_omp_interpolate2d_catmullrom+0x1cd>
xorps  %xmm0,%xmm0
cvtsi2ss %rcx,%xmm0
jmp    12f5 <neuralops_omp_interpolate2d_catmullrom+0x1e5>
nopw   0x0(%rax,%rax,1)
mov    %r14d,%eax
xor    %edx,%edx
div    %r15d
test   %rcx,%rcx
jns    12c0 <neuralops_omp_interpolate2d_catmullrom+0x1b0>
mov    %rcx,%rdx
shr    %rdx
and    $0x1,%ecx
or     %rdx,%rcx
xorps  %xmm0,%xmm0
cvtsi2ss %rcx,%xmm0
addss  %xmm0,%xmm0
mov    %rbp,%rdx
test   %rsi,%rsi
jns    1220 <neuralops_omp_interpolate2d_catmullrom+0x110>
mov    %rsi,%rcx
shr    %rcx
and    $0x1,%esi
or     %rcx,%rsi
xorps  %xmm1,%xmm1
cvtsi2ss %rsi,%xmm1
addss  %xmm1,%xmm1
jmp    1228 <neuralops_omp_interpolate2d_catmullrom+0x118>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @neuralops_omp_interpolate2d_catmullrom(i64 %0, i64 %1, i64 %2, i64 %3, i64 %4, float* %5, float* %6) {
%8 = alloca i64
%9 = alloca i64
%10 = alloca i64
%11 = alloca i64
%12 = alloca i64
%13 = alloca float*
%14 = alloca float*
%15 = alloca float
%16 = alloca float
%17 = alloca i64
%18 = alloca i64
%19 = alloca i64
%20 = alloca i64
%21 = alloca i64
%22 = alloca float
%23 = alloca float
store i64 %0, i64* %8
store i64 %1, i64* %9
store i64 %2, i64* %10
store i64 %3, i64* %11
store i64 %4, i64* %12
store float* %5, float** %13
store float* %6, float** %14
%24 = load i64, i64* %8
%25 = uitofp i64 %24 to float
%26 = load i64, i64* %11
%27 = uitofp i64 %26 to float
%28 = fdiv float %25, %27
store float %28, float* %15
%29 = load i64, i64* %9
%30 = uitofp i64 %29 to float
%31 = load i64, i64* %12
%32 = uitofp i64 %31 to float
%33 = fdiv float %30, %32
store float %33, float* %16
%34 = load i64, i64* %11
%35 = load i64, i64* %12
%36 = mul i64 %34, %35
%37 = load i64, i64* %10
%38 = mul i64 %36, %37
store i64 %38, i64* %17
store i64 0, i64* %18
br label %39
39: ; preds = %75, %7
%40 = load i64, i64* %18
%41 = load i64, i64* %17
%42 = icmp ult i64 %40, %41
br i1 %42, label %43, label %78
43: ; preds = %39
%44 = load i64, i64* %18
%45 = load i64, i64* %11
%46 = urem i64 %44, %45
store i64 %46, i64* %19
%47 = load i64, i64* %18
%48 = load i64, i64* %11
%49 = udiv i64 %47, %48
%50 = load i64, i64* %12
%51 = urem i64 %49, %50
store i64 %51, i64* %20
%52 = load i64, i64* %18
%53 = load i64, i64* %11
%54 = load i64, i64* %12
%55 = mul i64 %53, %54
%56 = udiv i64 %52, %55
store i64 %56, i64* %21
%57 = load i64, i64* %19
%58 = uitofp i64 %57 to float
%59 = load float, float* %15
%60 = fmul float %58, %59
store float %60, float* %22
%61 = load i64, i64* %20
%62 = uitofp i64 %61 to float
%63 = load float, float* %16
%64 = fmul float %62, %63
store float %64, float* %23
%65 = load float*, float** %13
%66 = load i64, i64* %8
%67 = load i64, i64* %9
%68 = load float, float* %22
%69 = load float, float* %23
%70 = load i64, i64* %21
%71 = call float @catmullrom_interp(float* %65, i64 %66, i64 %67, float %68, float %69, i64 %70)
%72 = load float*, float** %14
%73 = load i64, i64* %18
%74 = getelementptr inbounds float, float* %72, i64 %73
store float %71, float* %74
br label %75
75: ; preds = %43
%76 = load i64, i64* %18
%77 = add i64 %76, 1
store i64 %77, i64* %18
br label %39
78: ; preds = %39
ret void
}

LLVM IR (-O2):
define void @neuralops_omp_interpolate2d_catmullrom(i64 %0, i64 %1, i64 %2, i64 %3, i64 %4, float* %5, float* nocapture writeonly %6) {
%8 = uitofp i64 %0 to float
%9 = uitofp i64 %3 to float
%10 = fdiv float %8, %9
%11 = uitofp i64 %1 to float
%12 = uitofp i64 %4 to float
%13 = fdiv float %11, %12
%14 = mul i64 %4, %3
%15 = mul i64 %14, %2
%16 = icmp eq i64 %15, 0
br i1 %16, label %17, label %18
17: ; preds = %18, %7
ret void
18: ; preds = %7, %18
%19 = phi i64 [ %30, %18 ], [ 0, %7 ]
%20 = urem i64 %19, %3
%21 = udiv i64 %19, %3
%22 = urem i64 %21, %4
%23 = udiv i64 %19, %14
%24 = uitofp i64 %20 to float
%25 = fmul float %10, %24
%26 = uitofp i64 %22 to float
%27 = fmul float %13, %26
%28 = tail call float @catmullrom_interp(float* %5, i64 %0, i64 %1, float %25, float %27, i64 %23)
%29 = getelementptr inbounds float, float* %6, i64 %19
store float %28, float* %29
%30 = add nuw i64 %19, 1
%31 = icmp eq i64 %30, %15
br i1 %31, label %17, label %18
}