#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 BatchInterpolatedValue2DZero(float *Bout, float *Bcoeff, long Width,
                                         long Height, double nx, double offx,
                                         double mx, double ny, double offy,
                                         double my, 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 - offx) / mx;
      y = (idcoordy - offy) / my;
      Bout[idx++] =
          InterpolatedValueZero(Bcoeff, Width, Height, x, y, SplineDegree);
    }
  }
}


x86 assembly (clang, -O0):
<BatchInterpolatedValue2DZero>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
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)
movsd  %xmm3,-0x40(%rbp)
movsd  %xmm4,-0x48(%rbp)
movsd  %xmm5,-0x50(%rbp)
mov    %r8,-0x58(%rbp)
movq   $0x0,-0x70(%rbp)
movq   $0x0,-0x80(%rbp)
cvtsi2sdq -0x80(%rbp),%xmm1
movsd  -0x40(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1217 <BatchInterpolatedValue2DZero+0x107>
movq   $0x0,-0x78(%rbp)
cvtsi2sdq -0x78(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1201 <BatchInterpolatedValue2DZero+0xf1>
cvtsi2sdq -0x78(%rbp),%xmm0
subsd  -0x30(%rbp),%xmm0
divsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
cvtsi2sdq -0x80(%rbp),%xmm0
subsd  -0x48(%rbp),%xmm0
divsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
movsd  -0x60(%rbp),%xmm0
movsd  -0x68(%rbp),%xmm1
mov    -0x58(%rbp),%rcx
call   1030 <InterpolatedValueZero@plt>
mov    -0x8(%rbp),%rax
mov    -0x70(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x70(%rbp)
movss  %xmm0,(%rax,%rcx,4)
mov    -0x78(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x78(%rbp)
jmp    117a <BatchInterpolatedValue2DZero+0x6a>
jmp    1206 <BatchInterpolatedValue2DZero+0xf6>
mov    -0x80(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x80(%rbp)
jmp    115d <BatchInterpolatedValue2DZero+0x4d>
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<BatchInterpolatedValue2DZero>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
movsd  %xmm5,0x20(%rsp)
movsd  %xmm4,0x18(%rsp)
movapd %xmm0,%xmm4
mov    %rdi,0x10(%rsp)
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm3
jbe    122a <BatchInterpolatedValue2DZero+0x11a>
mov    %r8,%r14
mov    %rcx,%r15
mov    %rdx,%r12
mov    %rsi,%rbx
xor    %eax,%eax
xorpd  %xmm5,%xmm5
xor    %ecx,%ecx
movsd  %xmm3,0x8(%rsp)
movsd  %xmm2,0x48(%rsp)
movsd  %xmm1,0x40(%rsp)
movsd  %xmm4,0x38(%rsp)
jmp    1186 <BatchInterpolatedValue2DZero+0x76>
nop
add    $0x1,%rax
xorps  %xmm5,%xmm5
cvtsi2sd %rax,%xmm5
ucomisd %xmm5,%xmm3
jbe    122a <BatchInterpolatedValue2DZero+0x11a>
ucomisd %xmm0,%xmm4
jbe    1170 <BatchInterpolatedValue2DZero+0x60>
mov    %rax,0x30(%rsp)
subsd  0x18(%rsp),%xmm5
divsd  0x20(%rsp),%xmm5
mov    0x10(%rsp),%rax
mov    %rcx,0x28(%rsp)
lea    (%rax,%rcx,4),%r13
xorpd  %xmm0,%xmm0
xor    %ebp,%ebp
movsd  %xmm5,0x50(%rsp)
nopw   0x0(%rax,%rax,1)
subsd  %xmm1,%xmm0
divsd  %xmm2,%xmm0
mov    %rbx,%rdi
mov    %r12,%rsi
mov    %r15,%rdx
movapd %xmm5,%xmm1
mov    %r14,%rcx
call   1030 <InterpolatedValueZero@plt>
movsd  0x50(%rsp),%xmm5
movsd  0x38(%rsp),%xmm4
movsd  0x40(%rsp),%xmm1
movsd  0x48(%rsp),%xmm2
movss  %xmm0,0x0(%r13,%rbp,4)
add    $0x1,%rbp
xorps  %xmm0,%xmm0
cvtsi2sd %rbp,%xmm0
ucomisd %xmm0,%xmm4
ja     11c0 <BatchInterpolatedValue2DZero+0xb0>
mov    0x28(%rsp),%rcx
add    %rbp,%rcx
movsd  0x8(%rsp),%xmm3
xorpd  %xmm0,%xmm0
mov    0x30(%rsp),%rax
jmp    1170 <BatchInterpolatedValue2DZero+0x60>
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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