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


x86 assembly (clang, -O0):
<BatchInterpolatedValue2DTranZero>:
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)
cvtsi2sdq -0x70(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm0
mulsd  -0x40(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1190 <BatchInterpolatedValue2DTranZero+0x80>
mov    -0x8(%rbp),%rax
mov    -0x70(%rbp),%rcx
xorps  %xmm0,%xmm0
movss  %xmm0,(%rax,%rcx,4)
mov    -0x70(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x70(%rbp)
jmp    1155 <BatchInterpolatedValue2DTranZero+0x45>
movq   $0x0,-0x70(%rbp)
movq   $0x0,-0x80(%rbp)
mov    -0x80(%rbp),%rax
cmp    -0x20(%rbp),%rax
jge    124e <BatchInterpolatedValue2DTranZero+0x13e>
movq   $0x0,-0x78(%rbp)
mov    -0x78(%rbp),%rax
cmp    -0x18(%rbp),%rax
jge    1238 <BatchInterpolatedValue2DTranZero+0x128>
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    -0x8(%rbp),%rdi
movsd  -0x28(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm1
mov    -0x10(%rbp),%rax
mov    -0x70(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x70(%rbp)
movss  (%rax,%rcx,4),%xmm2
movsd  -0x60(%rbp),%xmm3
movsd  -0x68(%rbp),%xmm4
mov    -0x58(%rbp),%rsi
call   1030 <InterpolatedValueTranZero@plt>
mov    -0x78(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x78(%rbp)
jmp    11b6 <BatchInterpolatedValue2DTranZero+0xa6>
jmp    123d <BatchInterpolatedValue2DTranZero+0x12d>
mov    -0x80(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x80(%rbp)
jmp    11a0 <BatchInterpolatedValue2DTranZero+0x90>
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<BatchInterpolatedValue2DTranZero>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
mov    %r8,%r15
movsd  %xmm5,0x20(%rsp)
movsd  %xmm4,0x18(%rsp)
movapd %xmm3,%xmm4
mov    %rcx,0x8(%rsp)
mov    %rdx,%r13
mov    %rsi,0x10(%rsp)
mov    %rdi,%rbx
movapd %xmm0,%xmm5
mulsd  %xmm3,%xmm5
xorpd  %xmm3,%xmm3
ucomisd %xmm3,%xmm5
jbe    117a <BatchInterpolatedValue2DTranZero+0x6a>
mov    $0x1,%eax
nopl   0x0(%rax,%rax,1)
xorps  %xmm3,%xmm3
cvtsi2sd %rax,%xmm3
movl   $0x0,-0x4(%rbx,%rax,4)
add    $0x1,%rax
ucomisd %xmm3,%xmm5
ja     1160 <BatchInterpolatedValue2DTranZero+0x50>
cmpq   $0x0,0x8(%rsp)
jle    1249 <BatchInterpolatedValue2DTranZero+0x139>
xor    %ebp,%ebp
xor    %ecx,%ecx
movsd  %xmm4,0x48(%rsp)
movsd  %xmm2,0x40(%rsp)
movsd  %xmm1,0x38(%rsp)
movsd  %xmm0,0x30(%rsp)
jmp    11bf <BatchInterpolatedValue2DTranZero+0xaf>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0x1,%rbp
cmp    0x8(%rsp),%rbp
je     1249 <BatchInterpolatedValue2DTranZero+0x139>
test   %r13,%r13
jle    11b0 <BatchInterpolatedValue2DTranZero+0xa0>
xorps  %xmm3,%xmm3
cvtsi2sd %rbp,%xmm3
subsd  0x18(%rsp),%xmm3
divsd  0x20(%rsp),%xmm3
movsd  %xmm3,0x50(%rsp)
mov    0x10(%rsp),%rax
mov    %rcx,0x28(%rsp)
lea    (%rax,%rcx,4),%r12
xor    %r14d,%r14d
nop
xorps  %xmm3,%xmm3
cvtsi2sd %r14,%xmm3
subsd  %xmm1,%xmm3
divsd  %xmm2,%xmm3
movss  (%r12,%r14,4),%xmm2
mov    %rbx,%rdi
movapd %xmm4,%xmm1
movsd  0x50(%rsp),%xmm4
mov    %r15,%rsi
call   1030 <InterpolatedValueTranZero@plt>
movsd  0x30(%rsp),%xmm0
movsd  0x38(%rsp),%xmm1
movsd  0x40(%rsp),%xmm2
movsd  0x48(%rsp),%xmm4
add    $0x1,%r14
cmp    %r14,%r13
jne    11f0 <BatchInterpolatedValue2DTranZero+0xe0>
mov    0x28(%rsp),%rcx
add    %r14,%rcx
jmp    11b0 <BatchInterpolatedValue2DTranZero+0xa0>
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @BatchInterpolatedValue2DTranZero(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
br label %28
28: ; preds = %39, %11
%29 = load i64, i64* %25
%30 = sitofp i64 %29 to double
%31 = load double, double* %16
%32 = load double, double* %19
%33 = fmul double %31, %32
%34 = fcmp olt double %30, %33
br i1 %34, label %35, label %42
35: ; preds = %28
%36 = load float*, float** %12
%37 = load i64, i64* %25
%38 = getelementptr inbounds float, float* %36, i64 %37
store float 0.000000e+00, float* %38
br label %39
39: ; preds = %35
%40 = load i64, i64* %25
%41 = add nsw i64 %40, 1
store i64 %41, i64* %25
br label %28
42: ; preds = %28
store i64 0, i64* %25
store i64 0, i64* %27
br label %43
43: ; preds = %81, %42
%44 = load i64, i64* %27
%45 = load i64, i64* %15
%46 = icmp slt i64 %44, %45
br i1 %46, label %47, label %84
47: ; preds = %43
store i64 0, i64* %26
br label %48
48: ; preds = %77, %47
%49 = load i64, i64* %26
%50 = load i64, i64* %14
%51 = icmp slt i64 %49, %50
br i1 %51, label %52, label %80
52: ; preds = %48
%53 = load i64, i64* %26
%54 = sitofp i64 %53 to double
%55 = load double, double* %17
%56 = fsub double %54, %55
%57 = load double, double* %18
%58 = fdiv double %56, %57
store double %58, double* %23
%59 = load i64, i64* %27
%60 = sitofp i64 %59 to double
%61 = load double, double* %20
%62 = fsub double %60, %61
%63 = load double, double* %21
%64 = fdiv double %62, %63
store double %64, double* %24
%65 = load float*, float** %12
%66 = load double, double* %16
%67 = load double, double* %19
%68 = load float*, float** %13
%69 = load i64, i64* %25
%70 = add nsw i64 %69, 1
store i64 %70, i64* %25
%71 = getelementptr inbounds float, float* %68, i64 %69
%72 = load float, float* %71
%73 = load double, double* %23
%74 = load double, double* %24
%75 = load i64, i64* %22
%76 = call i32 @InterpolatedValueTranZero(float* %65, double %66, double %67, float %72, double %73, double %74, i64 %75)
br label %77
77: ; preds = %52
%78 = load i64, i64* %26
%79 = add nsw i64 %78, 1
store i64 %79, i64* %26
br label %48
80: ; preds = %48
br label %81
81: ; preds = %80
%82 = load i64, i64* %27
%83 = add nsw i64 %82, 1
store i64 %83, i64* %27
br label %43
84: ; preds = %43
ret void
}

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