#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*/ InterpolatedGradX3DTranMirr(float *, double, double, double,
                                               float, double, double, double,
                                               long);
extern void BatchInterpolatedGradX3DTranMirr(float *Bout, 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;
  long idx;
  long idcoordx, idcoordy, idcoordz;
  for (idx = 0; idx < nx * ny * nz; idx++)
    Bout[idx] = 0;
  idx = 0;
  for (idcoordz = 0; idcoordz < Slice; idcoordz++) {
    for (idcoordy = 0; idcoordy < Height; idcoordy++) {
      for (idcoordx = 0; idcoordx < Width; idcoordx++) {
        x = (idcoordx - offx) / mx;
        y = (idcoordy - offy) / my;
        z = (idcoordz - offz) / mz;
        InterpolatedGradX3DTranMirr(Bout, nx, ny, nz, Bcoeff[idx++], x, y, z,
                                    SplineDegree);
      }
    }
  }
  for (idx = 0; idx < nx * ny * nz; idx++)
    Bout[idx] = Bout[idx] / mx;
}


x86 assembly (clang, -O0):
<BatchInterpolatedGradX3DTranMirr>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
movsd  0x10(%rbp),%xmm8
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
movsd  %xmm0,-0x30(%rbp)
movsd  %xmm1,-0x38(%rbp)
movsd  %xmm2,-0x40(%rbp)
movsd  %xmm3,-0x48(%rbp)
movsd  %xmm4,-0x50(%rbp)
movsd  %xmm5,-0x58(%rbp)
movsd  %xmm6,-0x60(%rbp)
movsd  %xmm7,-0x68(%rbp)
mov    %r9,-0x70(%rbp)
movq   $0x0,-0x90(%rbp)
cvtsi2sdq -0x90(%rbp),%xmm1
ff ff
movsd  -0x30(%rbp),%xmm0
mulsd  -0x48(%rbp),%xmm0
mulsd  -0x60(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    11b8 <BatchInterpolatedGradX3DTranMirr+0xa8>
mov    -0x8(%rbp),%rax
mov    -0x90(%rbp),%rcx
xorps  %xmm0,%xmm0
movss  %xmm0,(%rax,%rcx,4)
mov    -0x90(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x90(%rbp)
jmp    116c <BatchInterpolatedGradX3DTranMirr+0x5c>
movq   $0x0,-0x90(%rbp)
movq   $0x0,-0xa8(%rbp)
mov    -0xa8(%rbp),%rax
cmp    -0x28(%rbp),%rax
jge    12fd <BatchInterpolatedGradX3DTranMirr+0x1ed>
movq   $0x0,-0xa0(%rbp)
mov    -0xa0(%rbp),%rax
cmp    -0x20(%rbp),%rax
jge    12e1 <BatchInterpolatedGradX3DTranMirr+0x1d1>
movq   $0x0,-0x98(%rbp)
mov    -0x98(%rbp),%rax
cmp    -0x18(%rbp),%rax
jge    12c5 <BatchInterpolatedGradX3DTranMirr+0x1b5>
cvtsi2sdq -0x98(%rbp),%xmm0
ff ff
subsd  -0x38(%rbp),%xmm0
divsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
cvtsi2sdq -0xa0(%rbp),%xmm0
ff ff
subsd  -0x50(%rbp),%xmm0
divsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0x80(%rbp)
cvtsi2sdq -0xa8(%rbp),%xmm0
ff ff
subsd  -0x68(%rbp),%xmm0
divsd  0x10(%rbp),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
mov    -0x8(%rbp),%rdi
movsd  -0x30(%rbp),%xmm0
movsd  -0x48(%rbp),%xmm1
movsd  -0x60(%rbp),%xmm2
mov    -0x10(%rbp),%rax
mov    -0x90(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x90(%rbp)
movss  (%rax,%rcx,4),%xmm3
movsd  -0x78(%rbp),%xmm4
movsd  -0x80(%rbp),%xmm5
movsd  -0x88(%rbp),%xmm6
ff
mov    -0x70(%rbp),%rsi
call   1030 <InterpolatedGradX3DTranMirr@plt>
mov    -0x98(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x98(%rbp)
jmp    1206 <BatchInterpolatedGradX3DTranMirr+0xf6>
jmp    12ca <BatchInterpolatedGradX3DTranMirr+0x1ba>
mov    -0xa0(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0xa0(%rbp)
jmp    11ea <BatchInterpolatedGradX3DTranMirr+0xda>
jmp    12e6 <BatchInterpolatedGradX3DTranMirr+0x1d6>
mov    -0xa8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0xa8(%rbp)
jmp    11ce <BatchInterpolatedGradX3DTranMirr+0xbe>
movq   $0x0,-0x90(%rbp)
cvtsi2sdq -0x90(%rbp),%xmm1
ff ff
movsd  -0x30(%rbp),%xmm0
mulsd  -0x48(%rbp),%xmm0
mulsd  -0x60(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    136e <BatchInterpolatedGradX3DTranMirr+0x25e>
mov    -0x8(%rbp),%rax
mov    -0x90(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
divsd  -0x40(%rbp),%xmm0
cvtsd2ss %xmm0,%xmm0
mov    -0x8(%rbp),%rax
mov    -0x90(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x90(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x90(%rbp)
jmp    1308 <BatchInterpolatedGradX3DTranMirr+0x1f8>
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<BatchInterpolatedGradX3DTranMirr>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x88,%rsp
mov    %r9,%r13
movsd  %xmm7,0x20(%rsp)
movapd %xmm6,%xmm7
movsd  %xmm5,0x40(%rsp)
movsd  %xmm4,0x38(%rsp)
movapd %xmm3,%xmm5
movapd %xmm1,%xmm3
mov    %r8,0x10(%rsp)
mov    %rcx,0x18(%rsp)
mov    %rdx,%rbx
mov    %rsi,0x30(%rsp)
mov    %rdi,%r14
movapd %xmm0,%xmm1
mulsd  %xmm5,%xmm1
mulsd  %xmm6,%xmm1
movsd  %xmm1,0x8(%rsp)
xorpd  %xmm4,%xmm4
ucomisd %xmm4,%xmm1
jbe    119b <BatchInterpolatedGradX3DTranMirr+0x8b>
mov    $0x1,%eax
movsd  0x8(%rsp),%xmm1
xchg   %ax,%ax
xorps  %xmm4,%xmm4
cvtsi2sd %rax,%xmm4
movl   $0x0,-0x4(%r14,%rax,4)
add    $0x1,%rax
ucomisd %xmm4,%xmm1
ja     1180 <BatchInterpolatedGradX3DTranMirr+0x70>
cmpq   $0x0,0x10(%rsp)
jle    12cc <BatchInterpolatedGradX3DTranMirr+0x1bc>
xor    %eax,%eax
xor    %ecx,%ecx
movsd  %xmm2,0x70(%rsp)
movsd  %xmm7,0x68(%rsp)
movsd  %xmm5,0x60(%rsp)
movsd  %xmm3,0x58(%rsp)
movsd  %xmm0,0x50(%rsp)
jmp    11e4 <BatchInterpolatedGradX3DTranMirr+0xd4>
nopl   0x0(%rax,%rax,1)
mov    0x28(%rsp),%rax
add    $0x1,%rax
cmp    0x10(%rsp),%rax
je     12cc <BatchInterpolatedGradX3DTranMirr+0x1bc>
cmpq   $0x0,0x18(%rsp)
mov    %rax,0x28(%rsp)
jle    11d0 <BatchInterpolatedGradX3DTranMirr+0xc0>
xorps  %xmm6,%xmm6
cvtsi2sd %rax,%xmm6
subsd  0x20(%rsp),%xmm6
divsd  0xc0(%rsp),%xmm6
xor    %ebp,%ebp
movsd  %xmm6,0x78(%rsp)
jmp    122b <BatchInterpolatedGradX3DTranMirr+0x11b>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x1,%rbp
cmp    0x18(%rsp),%rbp
je     11d0 <BatchInterpolatedGradX3DTranMirr+0xc0>
test   %rbx,%rbx
jle    1220 <BatchInterpolatedGradX3DTranMirr+0x110>
xorps  %xmm1,%xmm1
cvtsi2sd %rbp,%xmm1
subsd  0x38(%rsp),%xmm1
divsd  0x40(%rsp),%xmm1
movsd  %xmm1,0x80(%rsp)
mov    0x30(%rsp),%rax
mov    %rcx,0x48(%rsp)
lea    (%rax,%rcx,4),%r15
xor    %r12d,%r12d
xchg   %ax,%ax
xorps  %xmm4,%xmm4
cvtsi2sd %r12,%xmm4
subsd  %xmm3,%xmm4
divsd  %xmm2,%xmm4
movss  (%r15,%r12,4),%xmm3
mov    %r14,%rdi
movapd %xmm5,%xmm1
movapd %xmm7,%xmm2
movsd  0x80(%rsp),%xmm5
mov    %r13,%rsi
call   1030 <InterpolatedGradX3DTranMirr@plt>
movsd  0x78(%rsp),%xmm6
movsd  0x50(%rsp),%xmm0
movsd  0x58(%rsp),%xmm3
movsd  0x60(%rsp),%xmm5
movsd  0x68(%rsp),%xmm7
movsd  0x70(%rsp),%xmm2
add    $0x1,%r12
cmp    %r12,%rbx
jne    1260 <BatchInterpolatedGradX3DTranMirr+0x150>
mov    0x48(%rsp),%rcx
add    %r12,%rcx
jmp    1220 <BatchInterpolatedGradX3DTranMirr+0x110>
xorpd  %xmm0,%xmm0
movsd  0x8(%rsp),%xmm1
ucomisd %xmm0,%xmm1
jbe    1322 <BatchInterpolatedGradX3DTranMirr+0x212>
mov    $0x1,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movss  -0x4(%r14,%rax,4),%xmm0
cvtss2sd %xmm0,%xmm0
divsd  %xmm2,%xmm0
cvtsd2ss %xmm0,%xmm0
xorps  %xmm1,%xmm1
cvtsi2sd %rax,%xmm1
movss  %xmm0,-0x4(%r14,%rax,4)
add    $0x1,%rax
movsd  0x8(%rsp),%xmm0
ucomisd %xmm1,%xmm0
ja     12f0 <BatchInterpolatedGradX3DTranMirr+0x1e0>
add    $0x88,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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