#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*/ InterpolatedValueTranMirr(float *, double, double, float,
                                             double, double, long);
extern void BatchInterpolatedValue2DTranMirrWarp(
    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;
      InterpolatedValueTranMirr(Bout, nx, ny, Bcoeff[idx++], x, y,
                                SplineDegree);
    }
  }
}


x86 assembly (clang, -O0):
<BatchInterpolatedValue2DTranMirrWarp>:
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 <BatchInterpolatedValue2DTranMirrWarp+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 <BatchInterpolatedValue2DTranMirrWarp+0x4d>
movq   $0x0,-0x78(%rbp)
movq   $0x0,-0x88(%rbp)
mov    -0x88(%rbp),%rax
cmp    -0x20(%rbp),%rax
jge    1287 <BatchInterpolatedValue2DTranMirrWarp+0x177>
movq   $0x0,-0x80(%rbp)
mov    -0x80(%rbp),%rax
cmp    -0x18(%rbp),%rax
jge    126b <BatchInterpolatedValue2DTranMirrWarp+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 <InterpolatedValueTranMirr@plt>
mov    -0x80(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x80(%rbp)
jmp    11c4 <BatchInterpolatedValue2DTranMirrWarp+0xb4>
jmp    1270 <BatchInterpolatedValue2DTranMirrWarp+0x160>
mov    -0x88(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x88(%rbp)
jmp    11ab <BatchInterpolatedValue2DTranMirrWarp+0x9b>
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<BatchInterpolatedValue2DTranMirrWarp>:
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,0x10(%rsp)
mov    %rdx,%rbp
mov    %rsi,0x18(%rsp)
mov    %rdi,%r12
movapd %xmm0,%xmm4
mulsd  %xmm3,%xmm4
xorpd  %xmm3,%xmm3
ucomisd %xmm3,%xmm4
jbe    117b <BatchInterpolatedValue2DTranMirrWarp+0x6b>
mov    $0x1,%eax
nopw   0x0(%rax,%rax,1)
xorps  %xmm3,%xmm3
cvtsi2sd %rax,%xmm3
movl   $0x0,-0x4(%r12,%rax,4)
add    $0x1,%rax
ucomisd %xmm3,%xmm4
ja     1160 <BatchInterpolatedValue2DTranMirrWarp+0x50>
cmpq   $0x0,0x10(%rsp)
jle    129f <BatchInterpolatedValue2DTranMirrWarp+0x18f>
mov    0xb0(%rsp),%rbx
xor    %eax,%eax
xor    %ecx,%ecx
movsd  %xmm5,0x68(%rsp)
movsd  %xmm6,0x60(%rsp)
movsd  %xmm7,0x58(%rsp)
movsd  %xmm2,0x50(%rsp)
movsd  %xmm1,0x48(%rsp)
movsd  %xmm0,0x40(%rsp)
jmp    11cf <BatchInterpolatedValue2DTranMirrWarp+0xbf>
nopl   0x0(%rax)
add    $0x1,%rax
cmp    0x10(%rsp),%rax
je     129f <BatchInterpolatedValue2DTranMirrWarp+0x18f>
test   %rbp,%rbp
jle    11c0 <BatchInterpolatedValue2DTranMirrWarp+0xb0>
mov    %rax,0x38(%rsp)
xorps  %xmm3,%xmm3
cvtsi2ss %rax,%xmm3
movss  %xmm3,0xc(%rsp)
mov    0x20(%rsp),%rax
lea    (%rax,%rcx,4),%rax
mov    %rax,0x70(%rsp)
mov    0x28(%rsp),%rax
lea    (%rax,%rcx,4),%r13
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(%r13,%r15,4),%xmm1
addss  0xc(%rsp),%xmm1
xorps  %xmm4,%xmm4
cvtss2sd %xmm1,%xmm4
subsd  %xmm6,%xmm4
divsd  %xmm5,%xmm4
movss  (%r14,%r15,4),%xmm2
mov    %r12,%rdi
movapd %xmm7,%xmm1
mov    %rbx,%rsi
call   1030 <InterpolatedValueTranMirr@plt>
movsd  0x40(%rsp),%xmm0
movsd  0x48(%rsp),%xmm1
movsd  0x50(%rsp),%xmm2
movsd  0x58(%rsp),%xmm7
movsd  0x60(%rsp),%xmm6
movsd  0x68(%rsp),%xmm5
add    $0x1,%r15
cmp    %r15,%rbp
jne    1210 <BatchInterpolatedValue2DTranMirrWarp+0x100>
mov    0x30(%rsp),%rcx
add    %r15,%rcx
mov    0x38(%rsp),%rax
jmp    11c0 <BatchInterpolatedValue2DTranMirrWarp+0xb0>
add    $0x78,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @BatchInterpolatedValue2DTranMirrWarp(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 @InterpolatedValueTranMirr(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
ret void
}

LLVM IR (-O2):
define void @BatchInterpolatedValue2DTranMirrWarp(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 %57
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, %53
%27 = phi i64 [ 0, %18 ], [ %55, %53 ]
%28 = phi i64 [ 0, %18 ], [ %54, %53 ]
br i1 %19, label %29, label %53
29: ; preds = %26
%30 = sitofp i64 %27 to float
br label %31
31: ; preds = %29, %31
%32 = phi i64 [ 0, %29 ], [ %51, %31 ]
%33 = phi i64 [ %28, %29 ], [ %47, %31 ]
%34 = sitofp i64 %32 to float
%35 = getelementptr inbounds float, float* %7, i64 %33
%36 = load float, float* %35
%37 = fadd float %36, %34
%38 = fpext float %37 to double
%39 = fsub double %38, %5
%40 = fdiv double %39, %6
%41 = getelementptr inbounds float, float* %11, i64 %33
%42 = load float, float* %41
%43 = fadd float %42, %30
%44 = fpext float %43 to double
%45 = fsub double %44, %9
%46 = fdiv double %45, %10
%47 = add nsw i64 %33, 1
%48 = getelementptr inbounds float, float* %1, i64 %33
%49 = load float, float* %48
%50 = tail call i32 @InterpolatedValueTranMirr(float* %0, double %4, double %8, float %49, double %40, double %46, i64 %12)
%51 = add nuw nsw i64 %32, 1
%52 = icmp eq i64 %51, %2
br i1 %52, label %53, label %31
53: ; preds = %31, %26
%54 = phi i64 [ %28, %26 ], [ %47, %31 ]
%55 = add nuw nsw i64 %27, 1
%56 = icmp eq i64 %55, %3
br i1 %56, label %57, label %26
57: ; preds = %53, %16
ret void
}