#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 BatchInterpolatedValue3DMirr(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;
  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;
        Bout[idx++] = InterpolatedValue3DMirr(Bcoeff, Width, Height, Slice, x,
                                              y, z, SplineDegree);
      }
    }
  }
}


x86 assembly (clang, -O0):
<BatchInterpolatedValue3DMirr>:
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)
movq   $0x0,-0xa8(%rbp)
cvtsi2sdq -0xa8(%rbp),%xmm1
ff ff
movsd  -0x60(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    12b8 <BatchInterpolatedValue3DMirr+0x1a8>
movq   $0x0,-0xa0(%rbp)
cvtsi2sdq -0xa0(%rbp),%xmm1
ff ff
movsd  -0x48(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    129c <BatchInterpolatedValue3DMirr+0x18c>
movq   $0x0,-0x98(%rbp)
cvtsi2sdq -0x98(%rbp),%xmm1
ff ff
movsd  -0x30(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1280 <BatchInterpolatedValue3DMirr+0x170>
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    -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    -0x70(%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    11bd <BatchInterpolatedValue3DMirr+0xad>
jmp    1285 <BatchInterpolatedValue3DMirr+0x175>
mov    -0xa0(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0xa0(%rbp)
jmp    119a <BatchInterpolatedValue3DMirr+0x8a>
jmp    12a1 <BatchInterpolatedValue3DMirr+0x191>
mov    -0xa8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0xa8(%rbp)
jmp    1177 <BatchInterpolatedValue3DMirr+0x67>
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<BatchInterpolatedValue3DMirr>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x78,%rsp
movsd  %xmm7,0x8(%rsp)
movsd  %xmm5,0x30(%rsp)
movsd  %xmm4,0x28(%rsp)
mov    %rdi,0x20(%rsp)
xorpd  %xmm5,%xmm5
movsd  %xmm6,0x10(%rsp)
ucomisd %xmm5,%xmm6
jbe    12a1 <BatchInterpolatedValue3DMirr+0x191>
mov    %r9,%r15
movapd %xmm0,%xmm4
mov    %r8,%r12
mov    %rcx,%r13
mov    %rdx,%rbx
xor    %eax,%eax
mov    %rax,(%rsp)
xorpd  %xmm6,%xmm6
xor    %ebp,%ebp
movsd  %xmm3,0x18(%rsp)
movsd  %xmm2,0x58(%rsp)
movsd  %xmm1,0x50(%rsp)
movsd  %xmm0,0x48(%rsp)
jmp    11a7 <BatchInterpolatedValue3DMirr+0x97>
nop
mov    (%rsp),%rdi
add    $0x1,%rdi
mov    %rdi,%rax
mov    %rdi,(%rsp)
xorps  %xmm6,%xmm6
cvtsi2sd %rdi,%xmm6
movsd  0x10(%rsp),%xmm0
ucomisd %xmm6,%xmm0
jbe    12a1 <BatchInterpolatedValue3DMirr+0x191>
ucomisd %xmm5,%xmm3
jbe    1180 <BatchInterpolatedValue3DMirr+0x70>
subsd  0x8(%rsp),%xmm6
divsd  0xb0(%rsp),%xmm6
xorpd  %xmm7,%xmm7
xor    %eax,%eax
movsd  %xmm6,0x60(%rsp)
jmp    11e2 <BatchInterpolatedValue3DMirr+0xd2>
nopw   0x0(%rax,%rax,1)
add    $0x1,%rax
xorps  %xmm7,%xmm7
cvtsi2sd %rax,%xmm7
ucomisd %xmm7,%xmm3
jbe    1180 <BatchInterpolatedValue3DMirr+0x70>
ucomisd %xmm5,%xmm4
jbe    11d0 <BatchInterpolatedValue3DMirr+0xc0>
mov    %rax,0x38(%rsp)
subsd  0x28(%rsp),%xmm7
divsd  0x30(%rsp),%xmm7
mov    0x20(%rsp),%rax
mov    %rbp,0x40(%rsp)
lea    (%rax,%rbp,4),%rax
mov    %rax,0x68(%rsp)
xorpd  %xmm0,%xmm0
xor    %r14d,%r14d
movsd  %xmm7,0x70(%rsp)
nopl   0x0(%rax)
subsd  %xmm1,%xmm0
divsd  %xmm2,%xmm0
mov    %rsi,%rdi
mov    %rsi,%rbp
mov    %rbx,%rsi
mov    %r13,%rdx
mov    %r12,%rcx
movapd %xmm7,%xmm1
movapd %xmm6,%xmm2
mov    %r15,%r8
call   1030 <InterpolatedValue3DMirr@plt>
movsd  0x70(%rsp),%xmm7
movsd  0x60(%rsp),%xmm6
mov    %rbp,%rsi
movsd  0x48(%rsp),%xmm4
movsd  0x50(%rsp),%xmm1
movsd  0x58(%rsp),%xmm2
mov    0x68(%rsp),%rax
movss  %xmm0,(%rax,%r14,4)
add    $0x1,%r14
xorps  %xmm0,%xmm0
cvtsi2sd %r14,%xmm0
ucomisd %xmm0,%xmm4
ja     1220 <BatchInterpolatedValue3DMirr+0x110>
mov    0x40(%rsp),%rbp
add    %r14,%rbp
movsd  0x18(%rsp),%xmm3
xorpd  %xmm5,%xmm5
mov    0x38(%rsp),%rax
jmp    11d0 <BatchInterpolatedValue3DMirr+0xc0>
add    $0x78,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @BatchInterpolatedValue3DMirr(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
store i64 0, i64* %37
br label %38
38: ; preds = %95, %15
%39 = load i64, i64* %37
%40 = sitofp i64 %39 to double
%41 = load double, double* %27
%42 = fcmp olt double %40, %41
br i1 %42, label %43, label %98
43: ; preds = %38
store i64 0, i64* %36
br label %44
44: ; preds = %91, %43
%45 = load i64, i64* %36
%46 = sitofp i64 %45 to double
%47 = load double, double* %24
%48 = fcmp olt double %46, %47
br i1 %48, label %49, label %94
49: ; preds = %44
store i64 0, i64* %35
br label %50
50: ; preds = %87, %49
%51 = load i64, i64* %35
%52 = sitofp i64 %51 to double
%53 = load double, double* %21
%54 = fcmp olt double %52, %53
br i1 %54, label %55, label %90
55: ; preds = %50
%56 = load i64, i64* %35
%57 = sitofp i64 %56 to double
%58 = load double, double* %22
%59 = fsub double %57, %58
%60 = load double, double* %23
%61 = fdiv double %59, %60
store double %61, double* %31
%62 = load i64, i64* %36
%63 = sitofp i64 %62 to double
%64 = load double, double* %25
%65 = fsub double %63, %64
%66 = load double, double* %26
%67 = fdiv double %65, %66
store double %67, double* %32
%68 = load i64, i64* %37
%69 = sitofp i64 %68 to double
%70 = load double, double* %28
%71 = fsub double %69, %70
%72 = load double, double* %29
%73 = fdiv double %71, %72
store double %73, double* %33
%74 = load float*, float** %17
%75 = load i64, i64* %18
%76 = load i64, i64* %19
%77 = load i64, i64* %20
%78 = load double, double* %31
%79 = load double, double* %32
%80 = load double, double* %33
%81 = load i64, i64* %30
%82 = call float @InterpolatedValue3DMirr(float* %74, i64 %75, i64 %76, i64 %77, double %78, double %79, double %80, i64 %81)
%83 = load float*, float** %16
%84 = load i64, i64* %34
%85 = add nsw i64 %84, 1
store i64 %85, i64* %34
%86 = getelementptr inbounds float, float* %83, i64 %84
store float %82, float* %86
br label %87
87: ; preds = %55
%88 = load i64, i64* %35
%89 = add nsw i64 %88, 1
store i64 %89, i64* %35
br label %50
90: ; preds = %50
br label %91
91: ; preds = %90
%92 = load i64, i64* %36
%93 = add nsw i64 %92, 1
store i64 %93, i64* %36
br label %44
94: ; preds = %44
br label %95
95: ; preds = %94
%96 = load i64, i64* %37
%97 = add nsw i64 %96, 1
store i64 %97, i64* %37
br label %38
98: ; preds = %38
ret void
}

LLVM IR (-O2):
define void @BatchInterpolatedValue3DMirr(float* nocapture writeonly %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 = fcmp ogt double %11, 0.000000e+00
br i1 %16, label %17, label %56
17: ; preds = %15
%18 = fcmp ogt double %8, 0.000000e+00
%19 = fcmp ogt double %5, 0.000000e+00
br label %20
20: ; preds = %17, %51
%21 = phi double [ 0.000000e+00, %17 ], [ %54, %51 ]
%22 = phi i64 [ 0, %17 ], [ %53, %51 ]
%23 = phi i64 [ 0, %17 ], [ %52, %51 ]
br i1 %18, label %24, label %51
24: ; preds = %20
%25 = fsub double %21, %12
%26 = fdiv double %25, %13
br label %27
27: ; preds = %24, %46
%28 = phi double [ 0.000000e+00, %24 ], [ %49, %46 ]
%29 = phi i64 [ 0, %24 ], [ %48, %46 ]
%30 = phi i64 [ %23, %24 ], [ %47, %46 ]
br i1 %19, label %31, label %46
31: ; preds = %27
%32 = fsub double %28, %9
%33 = fdiv double %32, %10
br label %34
34: ; preds = %31, %34
%35 = phi double [ 0.000000e+00, %31 ], [ %44, %34 ]
%36 = phi i64 [ 0, %31 ], [ %43, %34 ]
%37 = phi i64 [ %30, %31 ], [ %41, %34 ]
%38 = fsub double %35, %6
%39 = fdiv double %38, %7
%40 = tail call float @InterpolatedValue3DMirr(float* %1, i64 %2, i64 %3, i64 %4, double %39, double %33, double %26, i64 %14)
%41 = add nsw i64 %37, 1
%42 = getelementptr inbounds float, float* %0, i64 %37
store float %40, float* %42
%43 = add nuw nsw i64 %36, 1
%44 = sitofp i64 %43 to double
%45 = fcmp olt double %44, %5
br i1 %45, label %34, label %46
46: ; preds = %34, %27
%47 = phi i64 [ %30, %27 ], [ %41, %34 ]
%48 = add nuw nsw i64 %29, 1
%49 = sitofp i64 %48 to double
%50 = fcmp olt double %49, %8
br i1 %50, label %27, label %51
51: ; preds = %46, %20
%52 = phi i64 [ %23, %20 ], [ %47, %46 ]
%53 = add nuw nsw i64 %22, 1
%54 = sitofp i64 %53 to double
%55 = fcmp olt double %54, %11
br i1 %55, label %20, label %56
56: ; preds = %51, %15
ret void
}