#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 exp(int);
int pow(double, double);
double relaxationFunction(double phi, double phiStart, double phiEnd) {
  double H;
  double x;
  double Length;
  if (phiStart < phiEnd) {
    Length = phiEnd - phiStart;
    x = (phi - phiStart) / Length;
    H = 1 - (exp(pow(x, 3.5)) - 1.) / (exp(1) - 1.);
  } else {
    Length = -(phiEnd - phiStart);
    x = 1 - (phi - phiStart) / Length;
    H = 1 - (exp(pow(x, 3.5)) - 1.) / (exp(1) - 1.);
  }
  return H;
}


x86 assembly (clang, -O0):
<relaxationFunction>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    11d5 <relaxationFunction+0xb5>
movsd  -0x18(%rbp),%xmm0
subsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x8(%rbp),%xmm0
subsd  -0x10(%rbp),%xmm0
divsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  0xe8d(%rip),%xmm1
call   1040 <pow@plt>
mov    %eax,%edi
call   1030 <exp@plt>
cvtsi2sd %eax,%xmm0
movsd  0xe6d(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    $0x1,%edi
call   1030 <exp@plt>
movsd  -0x38(%rbp),%xmm1
cvtsi2sd %eax,%xmm0
movsd  0xe49(%rip),%xmm2
subsd  %xmm2,%xmm0
divsd  %xmm0,%xmm1
movsd  0xe39(%rip),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    127d <relaxationFunction+0x15d>
movsd  -0x18(%rbp),%xmm0
subsd  -0x10(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x8(%rbp),%xmm1
subsd  -0x10(%rbp),%xmm1
divsd  -0x30(%rbp),%xmm1
movsd  0xdee(%rip),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  0xde0(%rip),%xmm1
call   1040 <pow@plt>
mov    %eax,%edi
call   1030 <exp@plt>
cvtsi2sd %eax,%xmm0
movsd  0xdc0(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    $0x1,%edi
call   1030 <exp@plt>
movsd  -0x40(%rbp),%xmm1
cvtsi2sd %eax,%xmm0
movsd  0xd9c(%rip),%xmm2
subsd  %xmm2,%xmm0
divsd  %xmm0,%xmm1
movsd  0xd8c(%rip),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<relaxationFunction>:
push   %rax
movapd %xmm2,%xmm3
subsd  %xmm1,%xmm3
subsd  %xmm1,%xmm0
divsd  %xmm3,%xmm0
cmpltsd %xmm2,%xmm1
movapd %xmm1,%xmm2
andpd  %xmm0,%xmm2
addsd  0xeba(%rip),%xmm0
andnpd %xmm0,%xmm1
orpd   %xmm1,%xmm2
movsd  0xeb2(%rip),%xmm1
movapd %xmm2,%xmm0
call   1040 <pow@plt>
mov    %eax,%edi
call   1030 <exp@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
addsd  0xe9b(%rip),%xmm0
movsd  %xmm0,(%rsp)
mov    $0x1,%edi
call   1030 <exp@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
addsd  0xe7d(%rip),%xmm0
movsd  (%rsp),%xmm1
divsd  %xmm0,%xmm1
movsd  0xe5c(%rip),%xmm0
subsd  %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @relaxationFunction(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
store double %0, double* %4
store double %1, double* %5
store double %2, double* %6
%10 = load double, double* %5
%11 = load double, double* %6
%12 = fcmp olt double %10, %11
br i1 %12, label %13, label %32
13: ; preds = %3
%14 = load double, double* %6
%15 = load double, double* %5
%16 = fsub double %14, %15
store double %16, double* %9
%17 = load double, double* %4
%18 = load double, double* %5
%19 = fsub double %17, %18
%20 = load double, double* %9
%21 = fdiv double %19, %20
store double %21, double* %8
%22 = load double, double* %8
%23 = call i32 @pow(double %22, double 3.500000e+00)
%24 = call i32 @exp(i32 %23)
%25 = sitofp i32 %24 to double
%26 = fsub double %25, 1.000000e+00
%27 = call i32 @exp(i32 1)
%28 = sitofp i32 %27 to double
%29 = fsub double %28, 1.000000e+00
%30 = fdiv double %26, %29
%31 = fsub double 1.000000e+00, %30
store double %31, double* %7
br label %53
32: ; preds = %3
%33 = load double, double* %6
%34 = load double, double* %5
%35 = fsub double %33, %34
%36 = fneg double %35
store double %36, double* %9
%37 = load double, double* %4
%38 = load double, double* %5
%39 = fsub double %37, %38
%40 = load double, double* %9
%41 = fdiv double %39, %40
%42 = fsub double 1.000000e+00, %41
store double %42, double* %8
%43 = load double, double* %8
%44 = call i32 @pow(double %43, double 3.500000e+00)
%45 = call i32 @exp(i32 %44)
%46 = sitofp i32 %45 to double
%47 = fsub double %46, 1.000000e+00
%48 = call i32 @exp(i32 1)
%49 = sitofp i32 %48 to double
%50 = fsub double %49, 1.000000e+00
%51 = fdiv double %47, %50
%52 = fsub double 1.000000e+00, %51
store double %52, double* %7
br label %53
53: ; preds = %32, %13
%54 = load double, double* %7
ret double %54
}

LLVM IR (-O2):
define double @relaxationFunction(double %0, double %1, double %2) {
%4 = fcmp olt double %1, %2
%5 = fsub double %2, %1
%6 = fsub double %0, %1
%7 = fdiv double %6, %5
%8 = fadd double %7, 1.000000e+00
%9 = select i1 %4, double %7, double %8
%10 = tail call i32 @pow(double %9, double 3.500000e+00)
%11 = tail call i32 @exp(i32 %10)
%12 = sitofp i32 %11 to double
%13 = fadd double %12, -1.000000e+00
%14 = tail call i32 @exp(i32 1)
%15 = sitofp i32 %14 to double
%16 = fadd double %15, -1.000000e+00
%17 = fdiv double %13, %16
%18 = fsub double 1.000000e+00, %17
ret double %18
}