#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 */
double InterpolatedGradYZero(float *, long, long, double, double, long);
extern void BatchInterpolatedGradY2DZero(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++] =
          InterpolatedGradYZero(Bcoeff, Width, Height, x, y, SplineDegree) / my;
    }
  }
}


x86 assembly (clang, -O0):
<BatchInterpolatedGradY2DZero>:
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    1220 <BatchInterpolatedGradY2DZero+0x110>
movq   $0x0,-0x78(%rbp)
cvtsi2sdq -0x78(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    120a <BatchInterpolatedGradY2DZero+0xfa>
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 <InterpolatedGradYZero@plt>
divsd  -0x50(%rbp),%xmm0
cvtsd2ss %xmm0,%xmm0
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 <BatchInterpolatedGradY2DZero+0x6a>
jmp    120f <BatchInterpolatedGradY2DZero+0xff>
mov    -0x80(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x80(%rbp)
jmp    115d <BatchInterpolatedGradY2DZero+0x4d>
add    $0x80,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define void @BatchInterpolatedGradY2DZero(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 = %70, %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 %73
33: ; preds = %28
store i64 0, i64* %26
br label %34
34: ; preds = %66, %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 %69
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 double @InterpolatedGradYZero(float* %52, i64 %53, i64 %54, double %55, double %56, i64 %57)
%59 = load double, double* %21
%60 = fdiv double %58, %59
%61 = fptrunc double %60 to float
%62 = load float*, float** %12
%63 = load i64, i64* %25
%64 = add nsw i64 %63, 1
store i64 %64, i64* %25
%65 = getelementptr inbounds float, float* %62, i64 %63
store float %61, float* %65
br label %66
66: ; preds = %39
%67 = load i64, i64* %26
%68 = add nsw i64 %67, 1
store i64 %68, i64* %26
br label %34
69: ; preds = %34
br label %70
70: ; preds = %69
%71 = load i64, i64* %27
%72 = add nsw i64 %71, 1
store i64 %72, i64* %27
br label %28
73: ; preds = %28
ret void
}

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