#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 BatchInterpolatedAll3DZero(float *Bo, float *Bogx, float *Bogy,
                                       float *Bogz, float *Bcoeff, long Width,
                                       long Height, long Slice, double nx,
                                       double offx, double mx, double ny,
                                       double offy, double my, double nz,
                                       double offz, double mz,
                                       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 - offx) / mx;
        y = (idcoordy - offy) / my;
        z = (idcoordz - 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):
<BatchInterpolatedAll3DZero>:
push   %rbp
mov    %rsp,%rbp
sub    $0xd0,%rsp
mov    0x28(%rbp),%rax
movsd  0x20(%rbp),%xmm8
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    1345 <BatchInterpolatedAll3DZero+0x235>
movq   $0x0,-0xb8(%rbp)
cvtsi2sdq -0xb8(%rbp),%xmm1
ff ff
movsd  -0x50(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1329 <BatchInterpolatedAll3DZero+0x219>
movq   $0x0,-0xb0(%rbp)
cvtsi2sdq -0xb0(%rbp),%xmm1
ff ff
movsd  -0x38(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    130d <BatchInterpolatedAll3DZero+0x1fd>
cvtsi2sdq -0xb0(%rbp),%xmm0
ff ff
subsd  -0x40(%rbp),%xmm0
divsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
cvtsi2sdq -0xb8(%rbp),%xmm0
subsd  -0x58(%rbp),%xmm0
divsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x80(%rbp)
cvtsi2sdq -0xc0(%rbp),%xmm0
ff ff
subsd  -0x70(%rbp),%xmm0
divsd  0x20(%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    0x28(%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  0x20(%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    11c9 <BatchInterpolatedAll3DZero+0xb9>
jmp    1312 <BatchInterpolatedAll3DZero+0x202>
mov    -0xb8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0xb8(%rbp)
jmp    11a6 <BatchInterpolatedAll3DZero+0x96>
jmp    132e <BatchInterpolatedAll3DZero+0x21e>
mov    -0xc0(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0xc0(%rbp)
jmp    1183 <BatchInterpolatedAll3DZero+0x73>
add    $0xd0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<BatchInterpolatedAll3DZero>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xd8,%rsp
movsd  %xmm7,0x10(%rsp)
movsd  %xmm4,0x48(%rsp)
mov    %rcx,0x40(%rsp)
mov    %rdx,0x38(%rsp)
mov    %rsi,0x30(%rsp)
mov    %rdi,0x28(%rsp)
xorpd  %xmm8,%xmm8
movsd  %xmm6,0x18(%rsp)
ucomisd %xmm8,%xmm6
jbe    13df <BatchInterpolatedAll3DZero+0x2cf>
movapd %xmm0,%xmm9
mov    %r9,%r11
mov    0x128(%rsp),%rbp
movsd  0x120(%rsp),%xmm6
mov    0x118(%rsp),%r10
mov    0x110(%rsp),%r15
xor    %eax,%eax
mov    %rax,0x8(%rsp)
lea    0xd0(%rsp),%r12
lea    0xc8(%rsp),%r13
lea    0xc0(%rsp),%rbx
xorpd  %xmm7,%xmm7
xor    %edx,%edx
movsd  %xmm5,0x88(%rsp)
movsd  %xmm3,0x20(%rsp)
movsd  %xmm2,0x80(%rsp)
movsd  %xmm1,0x78(%rsp)
movsd  %xmm0,0x70(%rsp)
mov    %r8,0x68(%rsp)
mov    %r9,0x60(%rsp)
jmp    1209 <BatchInterpolatedAll3DZero+0xf9>
cs nopw 0x0(%rax,%rax,1)
nop
mov    0x8(%rsp),%rcx
add    $0x1,%rcx
mov    %rcx,%rax
mov    %rcx,0x8(%rsp)
xorps  %xmm7,%xmm7
cvtsi2sd %rcx,%xmm7
movsd  0x18(%rsp),%xmm0
ucomisd %xmm7,%xmm0
jbe    13df <BatchInterpolatedAll3DZero+0x2cf>
ucomisd %xmm8,%xmm3
jbe    11e0 <BatchInterpolatedAll3DZero+0xd0>
subsd  0x10(%rsp),%xmm7
divsd  %xmm6,%xmm7
xorpd  %xmm4,%xmm4
xor    %eax,%eax
movsd  %xmm7,0x90(%rsp)
jmp    1242 <BatchInterpolatedAll3DZero+0x132>
nopl   0x0(%rax,%rax,1)
add    $0x1,%rax
xorps  %xmm4,%xmm4
cvtsi2sd %rax,%xmm4
ucomisd %xmm4,%xmm3
jbe    11e0 <BatchInterpolatedAll3DZero+0xd0>
ucomisd %xmm8,%xmm9
jbe    1230 <BatchInterpolatedAll3DZero+0x120>
mov    %rax,0x50(%rsp)
subsd  0x48(%rsp),%xmm4
divsd  %xmm5,%xmm4
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,0x58(%rsp)
lea    (%rax,%rdx,4),%rax
mov    %rax,0x98(%rsp)
xorpd  %xmm0,%xmm0
xor    %r14d,%r14d
movsd  %xmm4,0xb8(%rsp)
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
subsd  %xmm1,%xmm0
divsd  %xmm2,%xmm0
mov    %r12,%rdi
mov    %r13,%rsi
mov    %rbx,%rdx
mov    %r8,%rcx
mov    %r11,%r8
mov    %r15,%r9
movapd %xmm4,%xmm1
movapd %xmm7,%xmm2
push   %rbp
push   %r10
call   1030 <InterpolatedAll3DZero@plt>
movsd  0xc8(%rsp),%xmm4
movsd  0xa0(%rsp),%xmm7
mov    0x128(%rsp),%r10
movsd  0x130(%rsp),%xmm6
mov    0x78(%rsp),%r8
mov    0x70(%rsp),%r11
movsd  0x80(%rsp),%xmm9
movsd  0x88(%rsp),%xmm1
movsd  0x90(%rsp),%xmm2
movsd  0x98(%rsp),%xmm5
add    $0x10,%rsp
mov    0xb0(%rsp),%rax
movss  %xmm0,(%rax,%r14,4)
movsd  0xd0(%rsp),%xmm0
divsd  %xmm2,%xmm0
cvtsd2ss %xmm0,%xmm0
mov    0xa8(%rsp),%rax
movss  %xmm0,(%rax,%r14,4)
movsd  0xc8(%rsp),%xmm0
divsd  %xmm5,%xmm0
cvtsd2ss %xmm0,%xmm0
mov    0xa0(%rsp),%rax
movss  %xmm0,(%rax,%r14,4)
movsd  0xc0(%rsp),%xmm0
divsd  %xmm6,%xmm0
cvtsd2ss %xmm0,%xmm0
mov    0x98(%rsp),%rax
movss  %xmm0,(%rax,%r14,4)
add    $0x1,%r14
xorps  %xmm0,%xmm0
cvtsi2sd %r14,%xmm0
ucomisd %xmm0,%xmm9
ja     12c0 <BatchInterpolatedAll3DZero+0x1b0>
mov    0x58(%rsp),%rdx
add    %r14,%rdx
movsd  0x20(%rsp),%xmm3
xorpd  %xmm8,%xmm8
mov    0x50(%rsp),%rax
jmp    1230 <BatchInterpolatedAll3DZero+0x120>
add    $0xd8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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