#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*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, double, double, double, double, double,
                          double, double, double, double, double, double);
int /*<<< orphan*/ stdout;
double simulation_time_interpol(double fieldcloser, double fieldclose,
                                double fieldfar, double fieldfarer,
                                double distcloser, double distclose,
                                double distfar, double distfarer, double dist) {
  double pg, g, p, c, d, dfdxc, dfdxf;
  g = distfar - distclose;
  p = (dist - distclose);
  if ((p < 0) || (p > g)) {
#pragma omp critical
    {
      printf("Error, out of range interpolation!\nWanted:	%le	"
             "(%le	%le)\nBoundary:	%le	%le	%le	"
             "%le\nField:	%le	%le	%le	%le\n",
             dist, p, g, distcloser, distclose, distfar, distfarer, fieldcloser,
             fieldclose, fieldfar, fieldfarer);
      fflush(stdout);
      exit(0);
    }
  }
  if (fieldfarer == fieldfar)
    dfdxf = (fieldfar - fieldclose) / g;
  else {
    c = g / (distfarer - distfar);
    dfdxf = (fieldclose - fieldfar - (fieldfarer - fieldfar) * c * c) /
            (-g * (1.0 + c));
  }
  if (fieldcloser == fieldclose)
    dfdxc = (fieldfar - fieldclose) / g;
  else {
    c = (distcloser - distclose) / g;
    dfdxc = (fieldcloser - fieldclose - (fieldfar - fieldclose) * c * c) /
            ((distcloser - distclose) * (1.0 - c));
  }
  pg = p / g;
  c = (3 * (fieldfar - fieldclose) - dfdxf * g - 2. * dfdxc * g);
  d = (dfdxf * g + dfdxc * g - 2 * (fieldfar - fieldclose));
  return fieldclose + dfdxc * p + c * pg * pg + d * pg * pg * pg;
}


x86 assembly (clang, -O0):
<simulation_time_interpol>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movsd  0x10(%rbp),%xmm8
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movsd  %xmm4,-0x28(%rbp)
movsd  %xmm5,-0x30(%rbp)
movsd  %xmm6,-0x38(%rbp)
movsd  %xmm7,-0x40(%rbp)
movsd  -0x38(%rbp),%xmm0
subsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  0x10(%rbp),%xmm0
subsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x58(%rbp),%xmm0
ja     11a5 <simulation_time_interpol+0x75>
movsd  -0x58(%rbp),%xmm0
ucomisd -0x50(%rbp),%xmm0
jbe    1214 <simulation_time_interpol+0xe4>
movsd  0x10(%rbp),%xmm0
movsd  -0x58(%rbp),%xmm1
movsd  -0x50(%rbp),%xmm2
movsd  -0x28(%rbp),%xmm3
movsd  -0x30(%rbp),%xmm4
movsd  -0x38(%rbp),%xmm5
movsd  -0x40(%rbp),%xmm6
movsd  -0x8(%rbp),%xmm7
movsd  -0x10(%rbp),%xmm10
movsd  -0x18(%rbp),%xmm9
movsd  -0x20(%rbp),%xmm8
lea    0xe32(%rip),%rdi
movsd  %xmm10,(%rsp)
movsd  %xmm9,0x8(%rsp)
movsd  %xmm8,0x10(%rsp)
call   1030 <printf@plt>
mov    0x2dda(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
xor    %edi,%edi
call   1050 <exit@plt>
movsd  -0x20(%rbp),%xmm0
ucomisd -0x18(%rbp),%xmm0
jne    1243 <simulation_time_interpol+0x113>
jp     1243 <simulation_time_interpol+0x113>
movsd  -0x18(%rbp),%xmm0
subsd  -0x10(%rbp),%xmm0
divsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
jmp    12ce <simulation_time_interpol+0x19e>
movsd  -0x50(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm1
subsd  -0x38(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x10(%rbp),%xmm1
subsd  -0x18(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm0
subsd  -0x18(%rbp),%xmm0
mulsd  -0x60(%rbp),%xmm0
movsd  -0x60(%rbp),%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  -0x50(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
movsd  0xd44(%rip),%xmm2
addsd  -0x60(%rbp),%xmm2
mulsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x8(%rbp),%xmm0
ucomisd -0x10(%rbp),%xmm0
jne    12fd <simulation_time_interpol+0x1cd>
jp     12fd <simulation_time_interpol+0x1cd>
movsd  -0x18(%rbp),%xmm0
subsd  -0x10(%rbp),%xmm0
divsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
jmp    1372 <simulation_time_interpol+0x242>
movsd  -0x28(%rbp),%xmm0
subsd  -0x30(%rbp),%xmm0
divsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x8(%rbp),%xmm1
subsd  -0x10(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm0
subsd  -0x10(%rbp),%xmm0
mulsd  -0x60(%rbp),%xmm0
movsd  -0x60(%rbp),%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  -0x28(%rbp),%xmm1
subsd  -0x30(%rbp),%xmm1
movsd  0xca0(%rip),%xmm2
subsd  -0x60(%rbp),%xmm2
mulsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x58(%rbp),%xmm0
divsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x18(%rbp),%xmm1
subsd  -0x10(%rbp),%xmm1
movsd  -0x78(%rbp),%xmm0
mulsd  -0x50(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  0xc5c(%rip),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  0xc44(%rip),%xmm0
mulsd  -0x70(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x78(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm2
movsd  -0x70(%rbp),%xmm1
mulsd  -0x50(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  -0x18(%rbp),%xmm1
subsd  -0x10(%rbp),%xmm1
addsd  %xmm1,%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x10(%rbp),%xmm1
movsd  -0x70(%rbp),%xmm0
movsd  -0x58(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  -0x60(%rbp),%xmm1
mulsd  -0x48(%rbp),%xmm1
movsd  -0x48(%rbp),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x68(%rbp),%xmm0
mulsd  -0x48(%rbp),%xmm0
mulsd  -0x48(%rbp),%xmm0
movsd  -0x48(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<simulation_time_interpol>:
sub    $0x18,%rsp
movapd %xmm0,%xmm8
movsd  0x20(%rsp),%xmm0
movapd %xmm6,%xmm10
subsd  %xmm5,%xmm10
movapd %xmm0,%xmm9
subsd  %xmm5,%xmm9
xorpd  %xmm11,%xmm11
ucomisd %xmm9,%xmm11
ja     1299 <simulation_time_interpol+0x169>
ucomisd %xmm10,%xmm9
ja     1299 <simulation_time_interpol+0x169>
ucomisd %xmm2,%xmm3
jne    1185 <simulation_time_interpol+0x55>
jp     1185 <simulation_time_interpol+0x55>
movapd %xmm2,%xmm0
subsd  %xmm1,%xmm0
divsd  %xmm10,%xmm0
jmp    11c7 <simulation_time_interpol+0x97>
subsd  %xmm6,%xmm7
movapd %xmm10,%xmm6
divsd  %xmm7,%xmm6
movapd %xmm1,%xmm0
subsd  %xmm2,%xmm0
subsd  %xmm2,%xmm3
mulsd  %xmm6,%xmm3
mulsd  %xmm6,%xmm3
subsd  %xmm3,%xmm0
movapd 0xe4e(%rip),%xmm3
xorpd  %xmm10,%xmm3
addsd  0xe51(%rip),%xmm6
mulsd  %xmm3,%xmm6
divsd  %xmm6,%xmm0
ucomisd %xmm1,%xmm8
jne    11e0 <simulation_time_interpol+0xb0>
jp     11e0 <simulation_time_interpol+0xb0>
subsd  %xmm1,%xmm2
movapd %xmm2,%xmm8
divsd  %xmm10,%xmm8
jmp    121c <simulation_time_interpol+0xec>
subsd  %xmm5,%xmm4
movapd %xmm4,%xmm3
divsd  %xmm10,%xmm3
subsd  %xmm1,%xmm8
subsd  %xmm1,%xmm2
movapd %xmm3,%xmm5
mulsd  %xmm2,%xmm5
mulsd  %xmm3,%xmm5
subsd  %xmm5,%xmm8
movsd  0xe01(%rip),%xmm5
subsd  %xmm3,%xmm5
mulsd  %xmm4,%xmm5
divsd  %xmm5,%xmm8
movapd %xmm9,%xmm3
divsd  %xmm10,%xmm3
movsd  0xdea(%rip),%xmm4
mulsd  %xmm2,%xmm4
mulsd  %xmm10,%xmm0
subsd  %xmm0,%xmm4
movsd  0xddd(%rip),%xmm5
mulsd  %xmm8,%xmm5
mulsd  %xmm10,%xmm5
addsd  %xmm4,%xmm5
mulsd  %xmm8,%xmm10
addsd  %xmm0,%xmm10
addsd  %xmm2,%xmm2
subsd  %xmm2,%xmm10
mulsd  %xmm9,%xmm8
addsd  %xmm1,%xmm8
mulsd  %xmm3,%xmm5
mulsd  %xmm3,%xmm5
addsd  %xmm8,%xmm5
mulsd  %xmm3,%xmm10
mulsd  %xmm3,%xmm10
mulsd  %xmm3,%xmm10
addsd  %xmm5,%xmm10
movapd %xmm10,%xmm0
add    $0x18,%rsp
ret
movsd  %xmm3,0x10(%rsp)
movsd  %xmm2,0x8(%rsp)
movsd  %xmm1,(%rsp)
lea    0xd77(%rip),%rdi
movapd %xmm9,%xmm1
movapd %xmm10,%xmm2
movaps %xmm4,%xmm3
movapd %xmm5,%xmm4
movapd %xmm6,%xmm5
movaps %xmm7,%xmm6
movapd %xmm8,%xmm7
call   1030 <printf@plt>
mov    0x2d06(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
xor    %edi,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [107 x i8] c"Error, out of range interpolation!\0AWanted:\09%le\09(%le\09%le)\0ABoundary:\09%le\09%le\09%le\09%le\0AField:\09%le\09%le\09%le\09%le\0A\00"
@stdout = global i32 0
define double @simulation_time_interpol(double %0, double %1, double %2, double %3, double %4, double %5, double %6, double %7, double %8) {
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca double
%16 = alloca double
%17 = alloca double
%18 = alloca double
%19 = alloca double
%20 = alloca double
%21 = alloca double
%22 = alloca double
%23 = alloca double
%24 = alloca double
%25 = alloca double
store double %0, double* %10
store double %1, double* %11
store double %2, double* %12
store double %3, double* %13
store double %4, double* %14
store double %5, double* %15
store double %6, double* %16
store double %7, double* %17
store double %8, double* %18
%26 = load double, double* %16
%27 = load double, double* %15
%28 = fsub double %26, %27
store double %28, double* %20
%29 = load double, double* %18
%30 = load double, double* %15
%31 = fsub double %29, %30
store double %31, double* %21
%32 = load double, double* %21
%33 = fcmp olt double %32, 0.000000e+00
br i1 %33, label %38, label %34
34: ; preds = %9
%35 = load double, double* %21
%36 = load double, double* %20
%37 = fcmp ogt double %35, %36
br i1 %37, label %38, label %54
38: ; preds = %34, %9
%39 = load double, double* %18
%40 = load double, double* %21
%41 = load double, double* %20
%42 = load double, double* %14
%43 = load double, double* %15
%44 = load double, double* %16
%45 = load double, double* %17
%46 = load double, double* %10
%47 = load double, double* %11
%48 = load double, double* %12
%49 = load double, double* %13
%50 = call i32 @printf(i8* getelementptr inbounds ([107 x i8], [107 x i8]* @.str, i64 0, i64 0), double %39, double %40, double %41, double %42, double %43, double %44, double %45, double %46, double %47, double %48, double %49)
%51 = load i32, i32* @stdout
%52 = call i32 @fflush(i32 %51)
%53 = call i32 @exit(i32 0)
unreachable
54: ; preds = %34
%55 = load double, double* %13
%56 = load double, double* %12
%57 = fcmp oeq double %55, %56
br i1 %57, label %58, label %64
58: ; preds = %54
%59 = load double, double* %12
%60 = load double, double* %11
%61 = fsub double %59, %60
%62 = load double, double* %20
%63 = fdiv double %61, %62
store double %63, double* %25
br label %87
64: ; preds = %54
%65 = load double, double* %20
%66 = load double, double* %17
%67 = load double, double* %16
%68 = fsub double %66, %67
%69 = fdiv double %65, %68
store double %69, double* %22
%70 = load double, double* %11
%71 = load double, double* %12
%72 = fsub double %70, %71
%73 = load double, double* %13
%74 = load double, double* %12
%75 = fsub double %73, %74
%76 = load double, double* %22
%77 = fmul double %75, %76
%78 = load double, double* %22
%79 = fneg double %77
%80 = call double @llvm.fmuladd.f64(double %79, double %78, double %72)
%81 = load double, double* %20
%82 = fneg double %81
%83 = load double, double* %22
%84 = fadd double 1.000000e+00, %83
%85 = fmul double %82, %84
%86 = fdiv double %80, %85
store double %86, double* %25
br label %87
87: ; preds = %64, %58
%88 = load double, double* %10
%89 = load double, double* %11
%90 = fcmp oeq double %88, %89
br i1 %90, label %91, label %97
91: ; preds = %87
%92 = load double, double* %12
%93 = load double, double* %11
%94 = fsub double %92, %93
%95 = load double, double* %20
%96 = fdiv double %94, %95
store double %96, double* %24
br label %121
97: ; preds = %87
%98 = load double, double* %14
%99 = load double, double* %15
%100 = fsub double %98, %99
%101 = load double, double* %20
%102 = fdiv double %100, %101
store double %102, double* %22
%103 = load double, double* %10
%104 = load double, double* %11
%105 = fsub double %103, %104
%106 = load double, double* %12
%107 = load double, double* %11
%108 = fsub double %106, %107
%109 = load double, double* %22
%110 = fmul double %108, %109
%111 = load double, double* %22
%112 = fneg double %110
%113 = call double @llvm.fmuladd.f64(double %112, double %111, double %105)
%114 = load double, double* %14
%115 = load double, double* %15
%116 = fsub double %114, %115
%117 = load double, double* %22
%118 = fsub double 1.000000e+00, %117
%119 = fmul double %116, %118
%120 = fdiv double %113, %119
store double %120, double* %24
br label %121
121: ; preds = %97, %91
%122 = load double, double* %21
%123 = load double, double* %20
%124 = fdiv double %122, %123
store double %124, double* %19
%125 = load double, double* %12
%126 = load double, double* %11
%127 = fsub double %125, %126
%128 = load double, double* %25
%129 = load double, double* %20
%130 = fmul double %128, %129
%131 = fneg double %130
%132 = call double @llvm.fmuladd.f64(double 3.000000e+00, double %127, double %131)
%133 = load double, double* %24
%134 = fmul double 2.000000e+00, %133
%135 = load double, double* %20
%136 = fneg double %134
%137 = call double @llvm.fmuladd.f64(double %136, double %135, double %132)
store double %137, double* %22
%138 = load double, double* %25
%139 = load double, double* %20
%140 = load double, double* %24
%141 = load double, double* %20
%142 = fmul double %140, %141
%143 = call double @llvm.fmuladd.f64(double %138, double %139, double %142)
%144 = load double, double* %12
%145 = load double, double* %11
%146 = fsub double %144, %145
%147 = call double @llvm.fmuladd.f64(double -2.000000e+00, double %146, double %143)
store double %147, double* %23
%148 = load double, double* %11
%149 = load double, double* %24
%150 = load double, double* %21
%151 = call double @llvm.fmuladd.f64(double %149, double %150, double %148)
%152 = load double, double* %22
%153 = load double, double* %19
%154 = fmul double %152, %153
%155 = load double, double* %19
%156 = call double @llvm.fmuladd.f64(double %154, double %155, double %151)
%157 = load double, double* %23
%158 = load double, double* %19
%159 = fmul double %157, %158
%160 = load double, double* %19
%161 = fmul double %159, %160
%162 = load double, double* %19
%163 = call double @llvm.fmuladd.f64(double %161, double %162, double %156)
ret double %163
}

LLVM IR (-O2):
@.str = [107 x i8] c"Error, out of range interpolation!\0AWanted:\09%le\09(%le\09%le)\0ABoundary:\09%le\09%le\09%le\09%le\0AField:\09%le\09%le\09%le\09%le\0A\00"
@stdout = global i32 0
define double @simulation_time_interpol(double %0, double %1, double %2, double %3, double %4, double %5, double %6, double %7, double %8) {
%10 = fsub double %6, %5
%11 = fsub double %8, %5
%12 = fcmp olt double %11, 0.000000e+00
%13 = fcmp ogt double %11, %10
%14 = or i1 %12, %13
br i1 %14, label %15, label %20
15: ; preds = %9
%16 = tail call i32 @printf(i8* getelementptr inbounds ([107 x i8], [107 x i8]* @.str, i64 0, i64 0), double %8, double %11, double %10, double %4, double %5, double %6, double %7, double %0, double %1, double %2, double %3)
%17 = load i32, i32* @stdout
%18 = tail call i32 @fflush(i32 %17)
%19 = tail call i32 @exit(i32 0)
unreachable
20: ; preds = %9
%21 = fcmp oeq double %3, %2
br i1 %21, label %22, label %25
22: ; preds = %20
%23 = fsub double %2, %1
%24 = fdiv double %23, %10
br label %37
25: ; preds = %20
%26 = fsub double %7, %6
%27 = fdiv double %10, %26
%28 = fsub double %1, %2
%29 = fsub double %3, %2
%30 = fneg double %29
%31 = fmul double %27, %30
%32 = tail call double @llvm.fmuladd.f64(double %31, double %27, double %28)
%33 = fneg double %10
%34 = fadd double %27, 1.000000e+00
%35 = fmul double %34, %33
%36 = fdiv double %32, %35
br label %37
37: ; preds = %25, %22
%38 = phi double [ %24, %22 ], [ %36, %25 ]
%39 = fcmp oeq double %0, %1
br i1 %39, label %40, label %43
40: ; preds = %37
%41 = fsub double %2, %1
%42 = fdiv double %41, %10
br label %54
43: ; preds = %37
%44 = fsub double %4, %5
%45 = fdiv double %44, %10
%46 = fsub double %0, %1
%47 = fsub double %2, %1
%48 = fneg double %47
%49 = fmul double %45, %48
%50 = tail call double @llvm.fmuladd.f64(double %49, double %45, double %46)
%51 = fsub double 1.000000e+00, %45
%52 = fmul double %44, %51
%53 = fdiv double %50, %52
br label %54
54: ; preds = %43, %40
%55 = phi double [ %47, %43 ], [ %41, %40 ]
%56 = phi double [ %53, %43 ], [ %42, %40 ]
%57 = fdiv double %11, %10
%58 = fneg double %38
%59 = fmul double %10, %58
%60 = tail call double @llvm.fmuladd.f64(double %55, double 3.000000e+00, double %59)
%61 = fmul double %56, -2.000000e+00
%62 = tail call double @llvm.fmuladd.f64(double %61, double %10, double %60)
%63 = fmul double %10, %56
%64 = tail call double @llvm.fmuladd.f64(double %38, double %10, double %63)
%65 = tail call double @llvm.fmuladd.f64(double %55, double -2.000000e+00, double %64)
%66 = tail call double @llvm.fmuladd.f64(double %56, double %11, double %1)
%67 = fmul double %57, %62
%68 = tail call double @llvm.fmuladd.f64(double %67, double %57, double %66)
%69 = fmul double %57, %65
%70 = fmul double %57, %69
%71 = tail call double @llvm.fmuladd.f64(double %70, double %57, double %68)
ret double %71
}