#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 InterpolatedValue3DMirr(float *, long, long, long, double, double, double,
                              long);
extern void BatchInterpolatedValue3DMirrWarp(
    float *Bout, 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;
  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;
        Bout[idx++] = InterpolatedValue3DMirr(Bcoeff, Width, Height, Slice, x,
                                              y, z, SplineDegree);
      }
    }
  }
}


x86 assembly (clang, -O0):
<BatchInterpolatedValue3DMirrWarp>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
mov    0x28(%rbp),%rax
mov    0x20(%rbp),%rax
movsd  0x18(%rbp),%xmm8
mov    0x10(%rbp),%rax
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)
mov    %r9,-0x48(%rbp)
movsd  %xmm3,-0x50(%rbp)
movsd  %xmm4,-0x58(%rbp)
movsd  %xmm5,-0x60(%rbp)
movsd  %xmm6,-0x68(%rbp)
movsd  %xmm7,-0x70(%rbp)
movq   $0x0,-0x90(%rbp)
movq   $0x0,-0xa8(%rbp)
cvtsi2sdq -0xa8(%rbp),%xmm1
ff ff
movsd  -0x68(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1300 <BatchInterpolatedValue3DMirrWarp+0x1f0>
movq   $0x0,-0xa0(%rbp)
cvtsi2sdq -0xa0(%rbp),%xmm1
ff ff
movsd  -0x50(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    12e4 <BatchInterpolatedValue3DMirrWarp+0x1d4>
movq   $0x0,-0x98(%rbp)
cvtsi2sdq -0x98(%rbp),%xmm1
ff ff
movsd  -0x30(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    12c8 <BatchInterpolatedValue3DMirrWarp+0x1b8>
cvtsi2ssq -0x98(%rbp),%xmm0
ff ff
mov    -0x48(%rbp),%rax
mov    -0x90(%rbp),%rcx
addss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
subsd  -0x38(%rbp),%xmm0
divsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
cvtsi2ssq -0xa0(%rbp),%xmm0
ff ff
mov    0x10(%rbp),%rax
mov    -0x90(%rbp),%rcx
addss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
subsd  -0x58(%rbp),%xmm0
divsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x80(%rbp)
cvtsi2ssq -0xa8(%rbp),%xmm0
ff ff
mov    0x20(%rbp),%rax
mov    -0x90(%rbp),%rcx
addss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
subsd  -0x70(%rbp),%xmm0
divsd  0x18(%rbp),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x28(%rbp),%rcx
movsd  -0x78(%rbp),%xmm0
movsd  -0x80(%rbp),%xmm1
movsd  -0x88(%rbp),%xmm2
ff
mov    0x28(%rbp),%r8
call   1030 <InterpolatedValue3DMirr@plt>
mov    -0x8(%rbp),%rax
mov    -0x90(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x90(%rbp)
movss  %xmm0,(%rax,%rcx,4)
mov    -0x98(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x98(%rbp)
jmp    11c9 <BatchInterpolatedValue3DMirrWarp+0xb9>
jmp    12cd <BatchInterpolatedValue3DMirrWarp+0x1bd>
mov    -0xa0(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0xa0(%rbp)
jmp    11a6 <BatchInterpolatedValue3DMirrWarp+0x96>
jmp    12e9 <BatchInterpolatedValue3DMirrWarp+0x1d9>
mov    -0xa8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0xa8(%rbp)
jmp    1183 <BatchInterpolatedValue3DMirrWarp+0x73>
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<BatchInterpolatedValue3DMirrWarp>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x98,%rsp
mov    %r9,0x30(%rsp)
mov    %rdi,0x28(%rsp)
xorpd  %xmm10,%xmm10
movsd  %xmm6,0x18(%rsp)
ucomisd %xmm10,%xmm6
jbe    1361 <BatchInterpolatedValue3DMirrWarp+0x251>
movapd %xmm1,%xmm8
movapd %xmm0,%xmm9
mov    %r8,%rbx
mov    %rcx,%r14
mov    %rsi,%r15
mov    0xe8(%rsp),%r13
movsd  0xd8(%rsp),%xmm6
xor    %eax,%eax
mov    %rax,0x8(%rsp)
xor    %ebp,%ebp
movsd  %xmm7,0x70(%rsp)
movsd  %xmm5,0x68(%rsp)
movsd  %xmm4,0x60(%rsp)
movsd  %xmm3,0x20(%rsp)
movsd  %xmm2,0x58(%rsp)
movsd  %xmm1,0x50(%rsp)
movsd  %xmm0,0x48(%rsp)
jmp    11c9 <BatchInterpolatedValue3DMirrWarp+0xb9>
nopw   0x0(%rax,%rax,1)
mov    0x8(%rsp),%rdi
add    $0x1,%rdi
mov    %rdi,%rax
mov    %rdi,0x8(%rsp)
xorps  %xmm0,%xmm0
cvtsi2sd %rdi,%xmm0
movsd  0x18(%rsp),%xmm1
ucomisd %xmm0,%xmm1
jbe    1361 <BatchInterpolatedValue3DMirrWarp+0x251>
ucomisd %xmm10,%xmm3
jbe    11a0 <BatchInterpolatedValue3DMirrWarp+0x90>
xorps  %xmm11,%xmm11
cvtsi2ssq 0x8(%rsp),%xmm11
xor    %eax,%eax
movss  %xmm11,0x10(%rsp)
jmp    1202 <BatchInterpolatedValue3DMirrWarp+0xf2>
cs nopw 0x0(%rax,%rax,1)
add    $0x1,%rax
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
ucomisd %xmm0,%xmm3
jbe    11a0 <BatchInterpolatedValue3DMirrWarp+0x90>
ucomisd %xmm10,%xmm9
jbe    11f0 <BatchInterpolatedValue3DMirrWarp+0xe0>
mov    %rax,0x38(%rsp)
xorps  %xmm0,%xmm0
cvtsi2ss %rax,%xmm0
movss  %xmm0,0x14(%rsp)
mov    0x30(%rsp),%rax
lea    (%rax,%rbp,4),%rax
mov    %rax,0x90(%rsp)
mov    0xd0(%rsp),%rax
lea    (%rax,%rbp,4),%rax
mov    %rax,0x88(%rsp)
mov    0xe0(%rsp),%rax
lea    (%rax,%rbp,4),%rax
mov    %rax,0x80(%rsp)
mov    0x28(%rsp),%rax
mov    %rbp,0x40(%rsp)
lea    (%rax,%rbp,4),%rax
mov    %rax,0x78(%rsp)
xor    %r12d,%r12d
nopl   0x0(%rax,%rax,1)
xorps  %xmm0,%xmm0
cvtsi2ss %r12,%xmm0
mov    0x90(%rsp),%rax
addss  (%rax,%r12,4),%xmm0
cvtss2sd %xmm0,%xmm0
subsd  %xmm8,%xmm0
divsd  %xmm2,%xmm0
mov    0x88(%rsp),%rax
movss  (%rax,%r12,4),%xmm1
addss  0x14(%rsp),%xmm1
cvtss2sd %xmm1,%xmm1
subsd  %xmm4,%xmm1
divsd  %xmm5,%xmm1
mov    0x80(%rsp),%rax
movss  (%rax,%r12,4),%xmm2
addss  %xmm11,%xmm2
cvtss2sd %xmm2,%xmm2
subsd  %xmm7,%xmm2
divsd  %xmm6,%xmm2
mov    %r15,%rdi
mov    %rdx,%rsi
mov    %rdx,%rbp
mov    %r14,%rdx
mov    %rbx,%rcx
mov    %r13,%r8
call   1030 <InterpolatedValue3DMirr@plt>
movss  0x10(%rsp),%xmm11
movsd  0xd8(%rsp),%xmm6
mov    %rbp,%rdx
movsd  0x48(%rsp),%xmm9
movsd  0x50(%rsp),%xmm8
movsd  0x58(%rsp),%xmm2
movsd  0x60(%rsp),%xmm4
movsd  0x68(%rsp),%xmm5
movsd  0x70(%rsp),%xmm7
mov    0x78(%rsp),%rax
movss  %xmm0,(%rax,%r12,4)
add    $0x1,%r12
xorps  %xmm0,%xmm0
cvtsi2sd %r12,%xmm0
ucomisd %xmm0,%xmm9
ja     1270 <BatchInterpolatedValue3DMirrWarp+0x160>
mov    0x40(%rsp),%rbp
add    %r12,%rbp
movsd  0x20(%rsp),%xmm3
xorpd  %xmm10,%xmm10
mov    0x38(%rsp),%rax
jmp    11f0 <BatchInterpolatedValue3DMirrWarp+0xe0>
add    $0x98,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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