#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 InterpolatedAll3DZero(double *, double *, double *, float *, long, long,
                            long, double, double, double, long);
extern void BatchInterpolatedAll3DZeroWarp(
    float *Bo, float *Bogx, float *Bogy, float *Bogz, float *Bcoeff, long Width,
    long Height, long Slice, double nx, double offx, double mx, float *WarpX,
    double ny, double offy, double my, float *WarpY, double nz, double offz,
    double mz, float *WarpZ, long SplineDegree) {
  double x, y, z, gradx, grady, gradz;
  long idx;
  long idcoordx, idcoordy, idcoordz;
  idx = 0;
  for (idcoordz = 0; idcoordz < nz; idcoordz++) {
    for (idcoordy = 0; idcoordy < ny; idcoordy++) {
      for (idcoordx = 0; idcoordx < nx; idcoordx++) {
        x = (idcoordx + WarpX[idx] - offx) / mx;
        y = (idcoordy + WarpY[idx] - offy) / my;
        z = (idcoordz + WarpZ[idx] - offz) / mz;
        Bo[idx] = InterpolatedAll3DZero(&gradx, &grady, &gradz, Bcoeff, Width,
                                        Height, Slice, x, y, z, SplineDegree);
        Bogx[idx] = gradx / mx;
        Bogy[idx] = grady / my;
        Bogz[idx++] = gradz / mz;
      }
    }
  }
}


x86 assembly (clang, -O0):
<BatchInterpolatedAll3DZeroWarp>:
push   %rbp
mov    %rsp,%rbp
sub    $0xd0,%rsp
mov    0x40(%rbp),%rax
mov    0x38(%rbp),%rax
movsd  0x30(%rbp),%xmm8
mov    0x28(%rbp),%rax
mov    0x20(%rbp),%rax
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
movsd  %xmm0,-0x38(%rbp)
movsd  %xmm1,-0x40(%rbp)
movsd  %xmm2,-0x48(%rbp)
movsd  %xmm3,-0x50(%rbp)
movsd  %xmm4,-0x58(%rbp)
movsd  %xmm5,-0x60(%rbp)
movsd  %xmm6,-0x68(%rbp)
movsd  %xmm7,-0x70(%rbp)
movq   $0x0,-0xa8(%rbp)
movq   $0x0,-0xc0(%rbp)
cvtsi2sdq -0xc0(%rbp),%xmm1
ff ff
movsd  -0x68(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    138d <BatchInterpolatedAll3DZeroWarp+0x27d>
movq   $0x0,-0xb8(%rbp)
cvtsi2sdq -0xb8(%rbp),%xmm1
ff ff
movsd  -0x50(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1371 <BatchInterpolatedAll3DZeroWarp+0x261>
movq   $0x0,-0xb0(%rbp)
cvtsi2sdq -0xb0(%rbp),%xmm1
ff ff
movsd  -0x38(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1355 <BatchInterpolatedAll3DZeroWarp+0x245>
cvtsi2ssq -0xb0(%rbp),%xmm0
ff ff
mov    0x20(%rbp),%rax
mov    -0xa8(%rbp),%rcx
addss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
subsd  -0x40(%rbp),%xmm0
divsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
cvtsi2ssq -0xb8(%rbp),%xmm0
ff ff
mov    0x28(%rbp),%rax
mov    -0xa8(%rbp),%rcx
addss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
subsd  -0x58(%rbp),%xmm0
divsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x80(%rbp)
cvtsi2ssq -0xc0(%rbp),%xmm0
ff ff
mov    0x38(%rbp),%rax
mov    -0xa8(%rbp),%rcx
addss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
subsd  -0x70(%rbp),%xmm0
divsd  0x30(%rbp),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
mov    -0x28(%rbp),%rcx
mov    -0x30(%rbp),%r8
mov    0x10(%rbp),%r9
mov    0x18(%rbp),%r10
movsd  -0x78(%rbp),%xmm0
movsd  -0x80(%rbp),%xmm1
movsd  -0x88(%rbp),%xmm2
ff
mov    0x40(%rbp),%rax
lea    -0x90(%rbp),%rdi
lea    -0x98(%rbp),%rsi
lea    -0xa0(%rbp),%rdx
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
call   1030 <InterpolatedAll3DZero@plt>
mov    -0x8(%rbp),%rax
mov    -0xa8(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
movsd  -0x90(%rbp),%xmm0
ff
divsd  -0x48(%rbp),%xmm0
cvtsd2ss %xmm0,%xmm0
mov    -0x10(%rbp),%rax
mov    -0xa8(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
movsd  -0x98(%rbp),%xmm0
ff
divsd  -0x60(%rbp),%xmm0
cvtsd2ss %xmm0,%xmm0
mov    -0x18(%rbp),%rax
mov    -0xa8(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
movsd  -0xa0(%rbp),%xmm0
ff
divsd  0x30(%rbp),%xmm0
cvtsd2ss %xmm0,%xmm0
mov    -0x20(%rbp),%rax
mov    -0xa8(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0xa8(%rbp)
movss  %xmm0,(%rax,%rcx,4)
mov    -0xb0(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0xb0(%rbp)
jmp    11d5 <BatchInterpolatedAll3DZeroWarp+0xc5>
jmp    135a <BatchInterpolatedAll3DZeroWarp+0x24a>
mov    -0xb8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0xb8(%rbp)
jmp    11b2 <BatchInterpolatedAll3DZeroWarp+0xa2>
jmp    1376 <BatchInterpolatedAll3DZeroWarp+0x266>
mov    -0xc0(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0xc0(%rbp)
jmp    118f <BatchInterpolatedAll3DZeroWarp+0x7f>
add    $0xd0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<BatchInterpolatedAll3DZeroWarp>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xe8,%rsp
mov    %rcx,0x40(%rsp)
mov    %rdx,0x38(%rsp)
mov    %rsi,0x30(%rsp)
mov    %rdi,0x28(%rsp)
xorpd  %xmm10,%xmm10
movsd  %xmm6,0x18(%rsp)
ucomisd %xmm10,%xmm6
jbe    1463 <BatchInterpolatedAll3DZeroWarp+0x353>
movapd %xmm1,%xmm8
movapd %xmm0,%xmm9
mov    %r9,%r11
mov    0x150(%rsp),%rbx
movsd  0x140(%rsp),%xmm6
mov    0x128(%rsp),%r14
mov    0x120(%rsp),%r9
xor    %eax,%eax
mov    %rax,0x8(%rsp)
lea    0xe0(%rsp),%r15
lea    0xd8(%rsp),%r13
lea    0xd0(%rsp),%rbp
xor    %edx,%edx
movsd  %xmm7,0x90(%rsp)
movsd  %xmm5,0x88(%rsp)
movsd  %xmm4,0x80(%rsp)
movsd  %xmm3,0x20(%rsp)
movsd  %xmm2,0x78(%rsp)
movsd  %xmm1,0x70(%rsp)
movsd  %xmm0,0x68(%rsp)
mov    %r8,0x60(%rsp)
mov    %r11,0x58(%rsp)
jmp    1209 <BatchInterpolatedAll3DZeroWarp+0xf9>
nopl   0x0(%rax)
mov    0x8(%rsp),%rcx
add    $0x1,%rcx
mov    %rcx,%rax
mov    %rcx,0x8(%rsp)
xorps  %xmm0,%xmm0
cvtsi2sd %rcx,%xmm0
movsd  0x18(%rsp),%xmm1
ucomisd %xmm0,%xmm1
jbe    1463 <BatchInterpolatedAll3DZeroWarp+0x353>
ucomisd %xmm10,%xmm3
jbe    11e0 <BatchInterpolatedAll3DZeroWarp+0xd0>
xorps  %xmm11,%xmm11
cvtsi2ssq 0x8(%rsp),%xmm11
xor    %eax,%eax
movss  %xmm11,0x10(%rsp)
jmp    1242 <BatchInterpolatedAll3DZeroWarp+0x132>
cs nopw 0x0(%rax,%rax,1)
add    $0x1,%rax
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
ucomisd %xmm0,%xmm3
jbe    11e0 <BatchInterpolatedAll3DZeroWarp+0xd0>
ucomisd %xmm10,%xmm9
jbe    1230 <BatchInterpolatedAll3DZeroWarp+0x120>
mov    %rax,0x48(%rsp)
xorps  %xmm0,%xmm0
cvtsi2ss %rax,%xmm0
movss  %xmm0,0x14(%rsp)
mov    0x130(%rsp),%rax
lea    (%rax,%rdx,4),%rax
mov    %rax,0xc8(%rsp)
mov    0x138(%rsp),%rax
lea    (%rax,%rdx,4),%rax
mov    %rax,0xc0(%rsp)
mov    0x148(%rsp),%rax
lea    (%rax,%rdx,4),%rax
mov    %rax,0xb8(%rsp)
mov    0x28(%rsp),%rax
lea    (%rax,%rdx,4),%rax
mov    %rax,0xb0(%rsp)
mov    0x30(%rsp),%rax
lea    (%rax,%rdx,4),%rax
mov    %rax,0xa8(%rsp)
mov    0x38(%rsp),%rax
lea    (%rax,%rdx,4),%rax
mov    %rax,0xa0(%rsp)
mov    0x40(%rsp),%rax
mov    %rdx,0x50(%rsp)
lea    (%rax,%rdx,4),%rax
mov    %rax,0x98(%rsp)
xor    %r12d,%r12d
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
xorps  %xmm0,%xmm0
cvtsi2ss %r12,%xmm0
mov    0xc8(%rsp),%rax
addss  (%rax,%r12,4),%xmm0
cvtss2sd %xmm0,%xmm0
subsd  %xmm8,%xmm0
divsd  %xmm2,%xmm0
mov    0xc0(%rsp),%rax
movss  (%rax,%r12,4),%xmm1
addss  0x14(%rsp),%xmm1
cvtss2sd %xmm1,%xmm1
subsd  %xmm4,%xmm1
divsd  %xmm5,%xmm1
mov    0xb8(%rsp),%rax
movss  (%rax,%r12,4),%xmm2
addss  %xmm11,%xmm2
cvtss2sd %xmm2,%xmm2
subsd  %xmm7,%xmm2
divsd  %xmm6,%xmm2
mov    %r15,%rdi
mov    %r13,%rsi
mov    %rbp,%rdx
mov    %r8,%rcx
mov    %r11,%r8
push   %rbx
push   %r14
call   1030 <InterpolatedAll3DZero@plt>
movss  0x20(%rsp),%xmm11
mov    0x130(%rsp),%r9
movsd  0x150(%rsp),%xmm6
mov    0x70(%rsp),%r8
mov    0x68(%rsp),%r11
movsd  0x78(%rsp),%xmm9
movsd  0x80(%rsp),%xmm8
movsd  0x88(%rsp),%xmm2
movsd  0x90(%rsp),%xmm4
movsd  0x98(%rsp),%xmm5
movsd  0xa0(%rsp),%xmm7
add    $0x10,%rsp
mov    0xb0(%rsp),%rax
movss  %xmm0,(%rax,%r12,4)
movsd  0xe0(%rsp),%xmm0
divsd  %xmm2,%xmm0
cvtsd2ss %xmm0,%xmm0
mov    0xa8(%rsp),%rax
movss  %xmm0,(%rax,%r12,4)
movsd  0xd8(%rsp),%xmm0
divsd  %xmm5,%xmm0
cvtsd2ss %xmm0,%xmm0
mov    0xa0(%rsp),%rax
movss  %xmm0,(%rax,%r12,4)
movsd  0xd0(%rsp),%xmm0
divsd  %xmm6,%xmm0
cvtsd2ss %xmm0,%xmm0
mov    0x98(%rsp),%rax
movss  %xmm0,(%rax,%r12,4)
add    $0x1,%r12
xorps  %xmm0,%xmm0
cvtsi2sd %r12,%xmm0
ucomisd %xmm0,%xmm9
ja     12f0 <BatchInterpolatedAll3DZeroWarp+0x1e0>
mov    0x50(%rsp),%rdx
add    %r12,%rdx
movsd  0x20(%rsp),%xmm3
xorpd  %xmm10,%xmm10
mov    0x48(%rsp),%rax
jmp    1230 <BatchInterpolatedAll3DZeroWarp+0x120>
add    $0xe8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @BatchInterpolatedAll3DZeroWarp(float* %0, float* %1, float* %2, float* %3, float* %4, i64 %5, i64 %6, i64 %7, double %8, double %9, double %10, float* %11, double %12, double %13, double %14, float* %15, double %16, double %17, double %18, float* %19, i64 %20) {
%22 = alloca float*
%23 = alloca float*
%24 = alloca float*
%25 = alloca float*
%26 = alloca float*
%27 = alloca i64
%28 = alloca i64
%29 = alloca i64
%30 = alloca double
%31 = alloca double
%32 = alloca double
%33 = alloca float*
%34 = alloca double
%35 = alloca double
%36 = alloca double
%37 = alloca float*
%38 = alloca double
%39 = alloca double
%40 = alloca double
%41 = alloca float*
%42 = alloca i64
%43 = alloca double
%44 = alloca double
%45 = alloca double
%46 = alloca double
%47 = alloca double
%48 = alloca double
%49 = alloca i64
%50 = alloca i64
%51 = alloca i64
%52 = alloca i64
store float* %0, float** %22
store float* %1, float** %23
store float* %2, float** %24
store float* %3, float** %25
store float* %4, float** %26
store i64 %5, i64* %27
store i64 %6, i64* %28
store i64 %7, i64* %29
store double %8, double* %30
store double %9, double* %31
store double %10, double* %32
store float* %11, float** %33
store double %12, double* %34
store double %13, double* %35
store double %14, double* %36
store float* %15, float** %37
store double %16, double* %38
store double %17, double* %39
store double %18, double* %40
store float* %19, float** %41
store i64 %20, i64* %42
store i64 0, i64* %49
store i64 0, i64* %52
br label %53
53: ; preds = %149, %21
%54 = load i64, i64* %52
%55 = sitofp i64 %54 to double
%56 = load double, double* %38
%57 = fcmp olt double %55, %56
br i1 %57, label %58, label %152
58: ; preds = %53
store i64 0, i64* %51
br label %59
59: ; preds = %145, %58
%60 = load i64, i64* %51
%61 = sitofp i64 %60 to double
%62 = load double, double* %34
%63 = fcmp olt double %61, %62
br i1 %63, label %64, label %148
64: ; preds = %59
store i64 0, i64* %50
br label %65
65: ; preds = %141, %64
%66 = load i64, i64* %50
%67 = sitofp i64 %66 to double
%68 = load double, double* %30
%69 = fcmp olt double %67, %68
br i1 %69, label %70, label %144
70: ; preds = %65
%71 = load i64, i64* %50
%72 = sitofp i64 %71 to float
%73 = load float*, float** %33
%74 = load i64, i64* %49
%75 = getelementptr inbounds float, float* %73, i64 %74
%76 = load float, float* %75
%77 = fadd float %72, %76
%78 = fpext float %77 to double
%79 = load double, double* %31
%80 = fsub double %78, %79
%81 = load double, double* %32
%82 = fdiv double %80, %81
store double %82, double* %43
%83 = load i64, i64* %51
%84 = sitofp i64 %83 to float
%85 = load float*, float** %37
%86 = load i64, i64* %49
%87 = getelementptr inbounds float, float* %85, i64 %86
%88 = load float, float* %87
%89 = fadd float %84, %88
%90 = fpext float %89 to double
%91 = load double, double* %35
%92 = fsub double %90, %91
%93 = load double, double* %36
%94 = fdiv double %92, %93
store double %94, double* %44
%95 = load i64, i64* %52
%96 = sitofp i64 %95 to float
%97 = load float*, float** %41
%98 = load i64, i64* %49
%99 = getelementptr inbounds float, float* %97, i64 %98
%100 = load float, float* %99
%101 = fadd float %96, %100
%102 = fpext float %101 to double
%103 = load double, double* %39
%104 = fsub double %102, %103
%105 = load double, double* %40
%106 = fdiv double %104, %105
store double %106, double* %45
%107 = load float*, float** %26
%108 = load i64, i64* %27
%109 = load i64, i64* %28
%110 = load i64, i64* %29
%111 = load double, double* %43
%112 = load double, double* %44
%113 = load double, double* %45
%114 = load i64, i64* %42
%115 = call float @InterpolatedAll3DZero(double* %46, double* %47, double* %48, float* %107, i64 %108, i64 %109, i64 %110, double %111, double %112, double %113, i64 %114)
%116 = load float*, float** %22
%117 = load i64, i64* %49
%118 = getelementptr inbounds float, float* %116, i64 %117
store float %115, float* %118
%119 = load double, double* %46
%120 = load double, double* %32
%121 = fdiv double %119, %120
%122 = fptrunc double %121 to float
%123 = load float*, float** %23
%124 = load i64, i64* %49
%125 = getelementptr inbounds float, float* %123, i64 %124
store float %122, float* %125
%126 = load double, double* %47
%127 = load double, double* %36
%128 = fdiv double %126, %127
%129 = fptrunc double %128 to float
%130 = load float*, float** %24
%131 = load i64, i64* %49
%132 = getelementptr inbounds float, float* %130, i64 %131
store float %129, float* %132
%133 = load double, double* %48
%134 = load double, double* %40
%135 = fdiv double %133, %134
%136 = fptrunc double %135 to float
%137 = load float*, float** %25
%138 = load i64, i64* %49
%139 = add nsw i64 %138, 1
store i64 %139, i64* %49
%140 = getelementptr inbounds float, float* %137, i64 %138
store float %136, float* %140
br label %141
141: ; preds = %70
%142 = load i64, i64* %50
%143 = add nsw i64 %142, 1
store i64 %143, i64* %50
br label %65
144: ; preds = %65
br label %145
145: ; preds = %144
%146 = load i64, i64* %51
%147 = add nsw i64 %146, 1
store i64 %147, i64* %51
br label %59
148: ; preds = %59
br label %149
149: ; preds = %148
%150 = load i64, i64* %52
%151 = add nsw i64 %150, 1
store i64 %151, i64* %52
br label %53
152: ; preds = %53
ret void
}

LLVM IR (-O2):
define void @BatchInterpolatedAll3DZeroWarp(float* nocapture writeonly %0, float* nocapture writeonly %1, float* nocapture writeonly %2, float* nocapture writeonly %3, float* %4, i64 %5, i64 %6, i64 %7, double %8, double %9, double %10, float* nocapture %11, double %12, double %13, double %14, float* nocapture %15, double %16, double %17, double %18, float* nocapture %19, i64 %20) {
%22 = alloca double
%23 = alloca double
%24 = alloca double
%25 = bitcast double* %22 to i8*
%26 = bitcast double* %23 to i8*
%27 = bitcast double* %24 to i8*
%28 = fcmp ogt double %16, 0.000000e+00
br i1 %28, label %29, label %92
29: ; preds = %21
%30 = fcmp ogt double %12, 0.000000e+00
%31 = fcmp ogt double %8, 0.000000e+00
br label %32
32: ; preds = %29, %87
%33 = phi i64 [ 0, %29 ], [ %89, %87 ]
%34 = phi i64 [ 0, %29 ], [ %88, %87 ]
br i1 %30, label %35, label %87
35: ; preds = %32
%36 = sitofp i64 %33 to float
br label %37
37: ; preds = %35, %82
%38 = phi i64 [ 0, %35 ], [ %84, %82 ]
%39 = phi i64 [ %34, %35 ], [ %83, %82 ]
br i1 %31, label %40, label %82
40: ; preds = %37
%41 = sitofp i64 %38 to float
br label %42
42: ; preds = %40, %42
%43 = phi i64 [ 0, %40 ], [ %79, %42 ]
%44 = phi i64 [ %39, %40 ], [ %77, %42 ]
%45 = sitofp i64 %43 to float
%46 = getelementptr inbounds float, float* %11, i64 %44
%47 = load float, float* %46
%48 = fadd float %47, %45
%49 = fpext float %48 to double
%50 = fsub double %49, %9
%51 = fdiv double %50, %10
%52 = getelementptr inbounds float, float* %15, i64 %44
%53 = load float, float* %52
%54 = fadd float %53, %41
%55 = fpext float %54 to double
%56 = fsub double %55, %13
%57 = fdiv double %56, %14
%58 = getelementptr inbounds float, float* %19, i64 %44
%59 = load float, float* %58
%60 = fadd float %59, %36
%61 = fpext float %60 to double
%62 = fsub double %61, %17
%63 = fdiv double %62, %18
%64 = call float @InterpolatedAll3DZero(double* %22, double* %23, double* %24, float* %4, i64 %5, i64 %6, i64 %7, double %51, double %57, double %63, i64 %20)
%65 = getelementptr inbounds float, float* %0, i64 %44
store float %64, float* %65
%66 = load double, double* %22
%67 = fdiv double %66, %10
%68 = fptrunc double %67 to float
%69 = getelementptr inbounds float, float* %1, i64 %44
store float %68, float* %69
%70 = load double, double* %23
%71 = fdiv double %70, %14
%72 = fptrunc double %71 to float
%73 = getelementptr inbounds float, float* %2, i64 %44
store float %72, float* %73
%74 = load double, double* %24
%75 = fdiv double %74, %18
%76 = fptrunc double %75 to float
%77 = add nsw i64 %44, 1
%78 = getelementptr inbounds float, float* %3, i64 %44
store float %76, float* %78
%79 = add nuw nsw i64 %43, 1
%80 = sitofp i64 %79 to double
%81 = fcmp olt double %80, %8
br i1 %81, label %42, label %82
82: ; preds = %42, %37
%83 = phi i64 [ %39, %37 ], [ %77, %42 ]
%84 = add nuw nsw i64 %38, 1
%85 = sitofp i64 %84 to double
%86 = fcmp olt double %85, %12
br i1 %86, label %37, label %87
87: ; preds = %82, %32
%88 = phi i64 [ %34, %32 ], [ %83, %82 ]
%89 = add nuw nsw i64 %33, 1
%90 = sitofp i64 %89 to double
%91 = fcmp olt double %90, %16
br i1 %91, label %32, label %92
92: ; preds = %87, %21
ret void
}