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


x86 assembly (clang, -O0):
<BatchInterpolatedGradX2DTranZeroWarp>:
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)
cvtsi2sdq -0x78(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm0
mulsd  -0x48(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1198 <BatchInterpolatedGradX2DTranZeroWarp+0x88>
mov    -0x8(%rbp),%rax
mov    -0x78(%rbp),%rcx
xorps  %xmm0,%xmm0
movss  %xmm0,(%rax,%rcx,4)
mov    -0x78(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x78(%rbp)
jmp    115d <BatchInterpolatedGradX2DTranZeroWarp+0x4d>
movq   $0x0,-0x78(%rbp)
movq   $0x0,-0x88(%rbp)
mov    -0x88(%rbp),%rax
cmp    -0x20(%rbp),%rax
jge    1287 <BatchInterpolatedGradX2DTranZeroWarp+0x177>
movq   $0x0,-0x80(%rbp)
mov    -0x80(%rbp),%rax
cmp    -0x18(%rbp),%rax
jge    126b <BatchInterpolatedGradX2DTranZeroWarp+0x15b>
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    -0x8(%rbp),%rdi
movsd  -0x28(%rbp),%xmm0
movsd  -0x48(%rbp),%xmm1
mov    -0x10(%rbp),%rax
mov    -0x78(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x78(%rbp)
movss  (%rax,%rcx,4),%xmm2
movsd  -0x68(%rbp),%xmm3
movsd  -0x70(%rbp),%xmm4
mov    0x10(%rbp),%rsi
call   1030 <InterpolatedGradXTranZero@plt>
mov    -0x80(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x80(%rbp)
jmp    11c4 <BatchInterpolatedGradX2DTranZeroWarp+0xb4>
jmp    1270 <BatchInterpolatedGradX2DTranZeroWarp+0x160>
mov    -0x88(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x88(%rbp)
jmp    11ab <BatchInterpolatedGradX2DTranZeroWarp+0x9b>
movq   $0x0,-0x78(%rbp)
cvtsi2sdq -0x78(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm0
mulsd  -0x48(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    12e1 <BatchInterpolatedGradX2DTranZeroWarp+0x1d1>
mov    -0x8(%rbp),%rax
mov    -0x78(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
divsd  -0x38(%rbp),%xmm0
cvtsd2ss %xmm0,%xmm0
mov    -0x8(%rbp),%rax
mov    -0x78(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x78(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x78(%rbp)
jmp    128f <BatchInterpolatedGradX2DTranZeroWarp+0x17f>
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<BatchInterpolatedGradX2DTranZeroWarp>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x78,%rsp
mov    %r9,0x28(%rsp)
movapd %xmm4,%xmm6
movapd %xmm3,%xmm7
mov    %r8,0x20(%rsp)
mov    %rcx,0x8(%rsp)
mov    %rdx,%r12
mov    %rsi,0x18(%rsp)
mov    %rdi,%rbx
movapd %xmm0,%xmm3
mulsd  %xmm7,%xmm3
xorpd  %xmm4,%xmm4
ucomisd %xmm4,%xmm3
jbe    117a <BatchInterpolatedGradX2DTranZeroWarp+0x6a>
mov    $0x1,%eax
nopw   0x0(%rax,%rax,1)
xorps  %xmm4,%xmm4
cvtsi2sd %rax,%xmm4
movl   $0x0,-0x4(%rbx,%rax,4)
add    $0x1,%rax
ucomisd %xmm4,%xmm3
ja     1160 <BatchInterpolatedGradX2DTranZeroWarp+0x50>
cmpq   $0x0,0x8(%rsp)
jle    12a5 <BatchInterpolatedGradX2DTranZeroWarp+0x195>
mov    0xb0(%rsp),%r13
xor    %eax,%eax
xor    %ecx,%ecx
movsd  %xmm2,0x68(%rsp)
movsd  %xmm3,0x10(%rsp)
movsd  %xmm5,0x60(%rsp)
movsd  %xmm6,0x58(%rsp)
movsd  %xmm7,0x50(%rsp)
movsd  %xmm1,0x48(%rsp)
movsd  %xmm0,0x40(%rsp)
jmp    11cf <BatchInterpolatedGradX2DTranZeroWarp+0xbf>
xchg   %ax,%ax
add    $0x1,%rax
cmp    0x8(%rsp),%rax
je     12a5 <BatchInterpolatedGradX2DTranZeroWarp+0x195>
test   %r12,%r12
jle    11c0 <BatchInterpolatedGradX2DTranZeroWarp+0xb0>
mov    %rax,0x38(%rsp)
xorps  %xmm3,%xmm3
cvtsi2ss %rax,%xmm3
movss  %xmm3,0x4(%rsp)
mov    0x20(%rsp),%rax
lea    (%rax,%rcx,4),%rax
mov    %rax,0x70(%rsp)
mov    0x28(%rsp),%rax
lea    (%rax,%rcx,4),%rbp
mov    0x18(%rsp),%rax
mov    %rcx,0x30(%rsp)
lea    (%rax,%rcx,4),%r14
xor    %r15d,%r15d
nop
xorps  %xmm3,%xmm3
cvtsi2ss %r15,%xmm3
mov    0x70(%rsp),%rax
addss  (%rax,%r15,4),%xmm3
cvtss2sd %xmm3,%xmm3
subsd  %xmm1,%xmm3
divsd  %xmm2,%xmm3
movss  0x0(%rbp,%r15,4),%xmm1
addss  0x4(%rsp),%xmm1
xorps  %xmm4,%xmm4
cvtss2sd %xmm1,%xmm4
subsd  %xmm6,%xmm4
divsd  %xmm5,%xmm4
movss  (%r14,%r15,4),%xmm2
mov    %rbx,%rdi
movapd %xmm7,%xmm1
mov    %r13,%rsi
call   1030 <InterpolatedGradXTranZero@plt>
movsd  0x40(%rsp),%xmm0
movsd  0x48(%rsp),%xmm1
movsd  0x50(%rsp),%xmm7
movsd  0x58(%rsp),%xmm6
movsd  0x60(%rsp),%xmm5
movsd  0x68(%rsp),%xmm2
add    $0x1,%r15
cmp    %r15,%r12
jne    1210 <BatchInterpolatedGradX2DTranZeroWarp+0x100>
mov    0x30(%rsp),%rcx
add    %r15,%rcx
movsd  0x10(%rsp),%xmm3
mov    0x38(%rsp),%rax
jmp    11c0 <BatchInterpolatedGradX2DTranZeroWarp+0xb0>
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm3
jbe    12ea <BatchInterpolatedGradX2DTranZeroWarp+0x1da>
mov    $0x1,%eax
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movss  -0x4(%rbx,%rax,4),%xmm0
cvtss2sd %xmm0,%xmm0
divsd  %xmm2,%xmm0
cvtsd2ss %xmm0,%xmm0
xorps  %xmm1,%xmm1
cvtsi2sd %rax,%xmm1
movss  %xmm0,-0x4(%rbx,%rax,4)
add    $0x1,%rax
ucomisd %xmm1,%xmm3
ja     12c0 <BatchInterpolatedGradX2DTranZeroWarp+0x1b0>
add    $0x78,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @BatchInterpolatedGradX2DTranZeroWarp(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
br label %32
32: ; preds = %43, %13
%33 = load i64, i64* %29
%34 = sitofp i64 %33 to double
%35 = load double, double* %18
%36 = load double, double* %22
%37 = fmul double %35, %36
%38 = fcmp olt double %34, %37
br i1 %38, label %39, label %46
39: ; preds = %32
%40 = load float*, float** %14
%41 = load i64, i64* %29
%42 = getelementptr inbounds float, float* %40, i64 %41
store float 0.000000e+00, float* %42
br label %43
43: ; preds = %39
%44 = load i64, i64* %29
%45 = add nsw i64 %44, 1
store i64 %45, i64* %29
br label %32
46: ; preds = %32
store i64 0, i64* %29
store i64 0, i64* %31
br label %47
47: ; preds = %97, %46
%48 = load i64, i64* %31
%49 = load i64, i64* %17
%50 = icmp slt i64 %48, %49
br i1 %50, label %51, label %100
51: ; preds = %47
store i64 0, i64* %30
br label %52
52: ; preds = %93, %51
%53 = load i64, i64* %30
%54 = load i64, i64* %16
%55 = icmp slt i64 %53, %54
br i1 %55, label %56, label %96
56: ; preds = %52
%57 = load i64, i64* %30
%58 = sitofp i64 %57 to float
%59 = load float*, float** %21
%60 = load i64, i64* %29
%61 = getelementptr inbounds float, float* %59, i64 %60
%62 = load float, float* %61
%63 = fadd float %58, %62
%64 = fpext float %63 to double
%65 = load double, double* %19
%66 = fsub double %64, %65
%67 = load double, double* %20
%68 = fdiv double %66, %67
store double %68, double* %27
%69 = load i64, i64* %31
%70 = sitofp i64 %69 to float
%71 = load float*, float** %25
%72 = load i64, i64* %29
%73 = getelementptr inbounds float, float* %71, i64 %72
%74 = load float, float* %73
%75 = fadd float %70, %74
%76 = fpext float %75 to double
%77 = load double, double* %23
%78 = fsub double %76, %77
%79 = load double, double* %24
%80 = fdiv double %78, %79
store double %80, double* %28
%81 = load float*, float** %14
%82 = load double, double* %18
%83 = load double, double* %22
%84 = load float*, float** %15
%85 = load i64, i64* %29
%86 = add nsw i64 %85, 1
store i64 %86, i64* %29
%87 = getelementptr inbounds float, float* %84, i64 %85
%88 = load float, float* %87
%89 = load double, double* %27
%90 = load double, double* %28
%91 = load i64, i64* %26
%92 = call i32 @InterpolatedGradXTranZero(float* %81, double %82, double %83, float %88, double %89, double %90, i64 %91)
br label %93
93: ; preds = %56
%94 = load i64, i64* %30
%95 = add nsw i64 %94, 1
store i64 %95, i64* %30
br label %52
96: ; preds = %52
br label %97
97: ; preds = %96
%98 = load i64, i64* %31
%99 = add nsw i64 %98, 1
store i64 %99, i64* %31
br label %47
100: ; preds = %47
store i64 0, i64* %29
br label %101
101: ; preds = %120, %100
%102 = load i64, i64* %29
%103 = sitofp i64 %102 to double
%104 = load double, double* %18
%105 = load double, double* %22
%106 = fmul double %104, %105
%107 = fcmp olt double %103, %106
br i1 %107, label %108, label %123
108: ; preds = %101
%109 = load float*, float** %14
%110 = load i64, i64* %29
%111 = getelementptr inbounds float, float* %109, i64 %110
%112 = load float, float* %111
%113 = fpext float %112 to double
%114 = load double, double* %20
%115 = fdiv double %113, %114
%116 = fptrunc double %115 to float
%117 = load float*, float** %14
%118 = load i64, i64* %29
%119 = getelementptr inbounds float, float* %117, i64 %118
store float %116, float* %119
br label %120
120: ; preds = %108
%121 = load i64, i64* %29
%122 = add nsw i64 %121, 1
store i64 %122, i64* %29
br label %101
123: ; preds = %101
ret void
}

LLVM IR (-O2):
define void @BatchInterpolatedGradX2DTranZeroWarp(float* %0, float* nocapture %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 = fmul double %4, %8
%15 = fcmp ogt double %14, 0.000000e+00
br i1 %15, label %20, label %16
16: ; preds = %20, %13
%17 = icmp sgt i64 %3, 0
br i1 %17, label %18, label %31
18: ; preds = %16
%19 = icmp sgt i64 %2, 0
br label %26
20: ; preds = %13, %20
%21 = phi i64 [ %23, %20 ], [ 0, %13 ]
%22 = getelementptr inbounds float, float* %0, i64 %21
store float 0.000000e+00, float* %22
%23 = add nuw nsw i64 %21, 1
%24 = sitofp i64 %23 to double
%25 = fcmp ogt double %14, %24
br i1 %25, label %20, label %16
26: ; preds = %18, %54
%27 = phi i64 [ 0, %18 ], [ %56, %54 ]
%28 = phi i64 [ 0, %18 ], [ %55, %54 ]
br i1 %19, label %29, label %54
29: ; preds = %26
%30 = sitofp i64 %27 to float
br label %32
31: ; preds = %54, %16
br i1 %15, label %58, label %68
32: ; preds = %29, %32
%33 = phi i64 [ 0, %29 ], [ %52, %32 ]
%34 = phi i64 [ %28, %29 ], [ %48, %32 ]
%35 = sitofp i64 %33 to float
%36 = getelementptr inbounds float, float* %7, i64 %34
%37 = load float, float* %36
%38 = fadd float %37, %35
%39 = fpext float %38 to double
%40 = fsub double %39, %5
%41 = fdiv double %40, %6
%42 = getelementptr inbounds float, float* %11, i64 %34
%43 = load float, float* %42
%44 = fadd float %43, %30
%45 = fpext float %44 to double
%46 = fsub double %45, %9
%47 = fdiv double %46, %10
%48 = add nsw i64 %34, 1
%49 = getelementptr inbounds float, float* %1, i64 %34
%50 = load float, float* %49
%51 = tail call i32 @InterpolatedGradXTranZero(float* %0, double %4, double %8, float %50, double %41, double %47, i64 %12)
%52 = add nuw nsw i64 %33, 1
%53 = icmp eq i64 %52, %2
br i1 %53, label %54, label %32
54: ; preds = %32, %26
%55 = phi i64 [ %28, %26 ], [ %48, %32 ]
%56 = add nuw nsw i64 %27, 1
%57 = icmp eq i64 %56, %3
br i1 %57, label %31, label %26
58: ; preds = %31, %58
%59 = phi i64 [ %65, %58 ], [ 0, %31 ]
%60 = getelementptr inbounds float, float* %0, i64 %59
%61 = load float, float* %60
%62 = fpext float %61 to double
%63 = fdiv double %62, %6
%64 = fptrunc double %63 to float
store float %64, float* %60
%65 = add nuw nsw i64 %59, 1
%66 = sitofp i64 %65 to double
%67 = fcmp ogt double %14, %66
br i1 %67, label %58, label %68
68: ; preds = %58, %31
ret void
}