#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 InterpolatedValueZero(float *, long, long, double, double, long);
extern void BatchInterpolatedValue2DZeroWarp(float *Bout, float *Bcoeff,
                                             long Width, long Height, double nx,
                                             double offx, double mx,
                                             float *WarpX, double ny,
                                             double offy, double my,
                                             float *WarpY, long SplineDegree) {
  double x, y;
  long idx;
  long idcoordx, idcoordy;
  idx = 0;
  for (idcoordy = 0; idcoordy < ny; idcoordy++) {
    for (idcoordx = 0; idcoordx < nx; idcoordx++) {
      x = (idcoordx + WarpX[idx] - offx) / mx;
      y = (idcoordy + WarpY[idx] - offy) / my;
      Bout[idx++] =
          InterpolatedValueZero(Bcoeff, Width, Height, x, y, SplineDegree);
    }
  }
}


x86 assembly (clang, -O0):
<BatchInterpolatedValue2DZeroWarp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
movsd  %xmm0,-0x28(%rbp)
movsd  %xmm1,-0x30(%rbp)
movsd  %xmm2,-0x38(%rbp)
mov    %r8,-0x40(%rbp)
movsd  %xmm3,-0x48(%rbp)
movsd  %xmm4,-0x50(%rbp)
movsd  %xmm5,-0x58(%rbp)
mov    %r9,-0x60(%rbp)
movq   $0x0,-0x78(%rbp)
movq   $0x0,-0x88(%rbp)
cvtsi2sdq -0x88(%rbp),%xmm1
ff ff
movsd  -0x48(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1250 <BatchInterpolatedValue2DZeroWarp+0x140>
movq   $0x0,-0x80(%rbp)
cvtsi2sdq -0x80(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1234 <BatchInterpolatedValue2DZeroWarp+0x124>
cvtsi2ssq -0x80(%rbp),%xmm0
mov    -0x40(%rbp),%rax
mov    -0x78(%rbp),%rcx
addss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
subsd  -0x30(%rbp),%xmm0
divsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
cvtsi2ssq -0x88(%rbp),%xmm0
ff ff
mov    -0x60(%rbp),%rax
mov    -0x78(%rbp),%rcx
addss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
subsd  -0x50(%rbp),%xmm0
divsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
movsd  -0x68(%rbp),%xmm0
movsd  -0x70(%rbp),%xmm1
mov    0x10(%rbp),%rcx
call   1030 <InterpolatedValueZero@plt>
mov    -0x8(%rbp),%rax
mov    -0x78(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x78(%rbp)
movss  %xmm0,(%rax,%rcx,4)
mov    -0x80(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x80(%rbp)
jmp    1188 <BatchInterpolatedValue2DZeroWarp+0x78>
jmp    1239 <BatchInterpolatedValue2DZeroWarp+0x129>
mov    -0x88(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x88(%rbp)
jmp    1168 <BatchInterpolatedValue2DZeroWarp+0x58>
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<BatchInterpolatedValue2DZeroWarp>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x78,%rsp
mov    %r9,0x28(%rsp)
mov    %r8,0x20(%rsp)
mov    %rdi,0x18(%rsp)
xorpd  %xmm7,%xmm7
ucomisd %xmm7,%xmm3
jbe    1283 <BatchInterpolatedValue2DZeroWarp+0x173>
movapd %xmm0,%xmm6
mov    %rcx,%r13
mov    %rdx,%rbx
mov    %rsi,%rbp
mov    0xb0(%rsp),%r15
xor    %eax,%eax
xor    %edi,%edi
movsd  %xmm5,0x60(%rsp)
movsd  %xmm4,0x58(%rsp)
movsd  %xmm3,0x10(%rsp)
movsd  %xmm2,0x50(%rsp)
movsd  %xmm1,0x48(%rsp)
movsd  %xmm0,0x40(%rsp)
jmp    1196 <BatchInterpolatedValue2DZeroWarp+0x86>
nopw   0x0(%rax,%rax,1)
add    $0x1,%rax
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
ucomisd %xmm0,%xmm3
jbe    1283 <BatchInterpolatedValue2DZeroWarp+0x173>
ucomisd %xmm7,%xmm6
jbe    1180 <BatchInterpolatedValue2DZeroWarp+0x70>
mov    %rax,0x38(%rsp)
xorps  %xmm0,%xmm0
cvtsi2ss %rax,%xmm0
movss  %xmm0,0xc(%rsp)
mov    0x20(%rsp),%rax
lea    (%rax,%rdi,4),%rax
mov    %rax,0x70(%rsp)
mov    0x28(%rsp),%rax
lea    (%rax,%rdi,4),%rax
mov    %rax,0x68(%rsp)
mov    0x18(%rsp),%rax
mov    %rdi,0x30(%rsp)
lea    (%rax,%rdi,4),%r12
xor    %r14d,%r14d
nopl   0x0(%rax)
xorps  %xmm0,%xmm0
cvtsi2ss %r14,%xmm0
mov    0x70(%rsp),%rax
addss  (%rax,%r14,4),%xmm0
cvtss2sd %xmm0,%xmm0
subsd  %xmm1,%xmm0
divsd  %xmm2,%xmm0
mov    0x68(%rsp),%rax
movss  (%rax,%r14,4),%xmm1
addss  0xc(%rsp),%xmm1
cvtss2sd %xmm1,%xmm1
subsd  %xmm4,%xmm1
divsd  %xmm5,%xmm1
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    %r13,%rdx
mov    %r15,%rcx
call   1030 <InterpolatedValueZero@plt>
movsd  0x40(%rsp),%xmm6
movsd  0x48(%rsp),%xmm1
movsd  0x50(%rsp),%xmm2
movsd  0x58(%rsp),%xmm4
movsd  0x60(%rsp),%xmm5
movss  %xmm0,(%r12,%r14,4)
add    $0x1,%r14
xorps  %xmm0,%xmm0
cvtsi2sd %r14,%xmm0
ucomisd %xmm0,%xmm6
ja     11e0 <BatchInterpolatedValue2DZeroWarp+0xd0>
mov    0x30(%rsp),%rdi
add    %r14,%rdi
movsd  0x10(%rsp),%xmm3
xorpd  %xmm7,%xmm7
mov    0x38(%rsp),%rax
jmp    1180 <BatchInterpolatedValue2DZeroWarp+0x70>
add    $0x78,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @BatchInterpolatedValue2DZeroWarp(float* nocapture writeonly %0, float* %1, i64 %2, i64 %3, double %4, double %5, double %6, float* nocapture %7, double %8, double %9, double %10, float* nocapture %11, i64 %12) {
%14 = fcmp ogt double %8, 0.000000e+00
br i1 %14, label %15, label %49
15: ; preds = %13
%16 = fcmp ogt double %4, 0.000000e+00
br label %17
17: ; preds = %15, %44
%18 = phi i64 [ 0, %15 ], [ %46, %44 ]
%19 = phi i64 [ 0, %15 ], [ %45, %44 ]
br i1 %16, label %20, label %44
20: ; preds = %17
%21 = sitofp i64 %18 to float
br label %22
22: ; preds = %20, %22
%23 = phi i64 [ 0, %20 ], [ %41, %22 ]
%24 = phi i64 [ %19, %20 ], [ %39, %22 ]
%25 = sitofp i64 %23 to float
%26 = getelementptr inbounds float, float* %7, i64 %24
%27 = load float, float* %26
%28 = fadd float %27, %25
%29 = fpext float %28 to double
%30 = fsub double %29, %5
%31 = fdiv double %30, %6
%32 = getelementptr inbounds float, float* %11, i64 %24
%33 = load float, float* %32
%34 = fadd float %33, %21
%35 = fpext float %34 to double
%36 = fsub double %35, %9
%37 = fdiv double %36, %10
%38 = tail call float @InterpolatedValueZero(float* %1, i64 %2, i64 %3, double %31, double %37, i64 %12)
%39 = add nsw i64 %24, 1
%40 = getelementptr inbounds float, float* %0, i64 %24
store float %38, float* %40
%41 = add nuw nsw i64 %23, 1
%42 = sitofp i64 %41 to double
%43 = fcmp olt double %42, %4
br i1 %43, label %22, label %44
44: ; preds = %22, %17
%45 = phi i64 [ %19, %17 ], [ %39, %22 ]
%46 = add nuw nsw i64 %18, 1
%47 = sitofp i64 %46 to double
%48 = fcmp olt double %47, %8
br i1 %48, label %17, label %49
49: ; preds = %44, %13
ret void
}