#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*/ abort();
double exp(double);
double sqrt(double);
double DiscreteAdjustedBarrier(double S, double H, double v, double dt) {
  double result;
  if (H > S)
    result = H * exp(0.5826 * v * sqrt(dt));
  else if (H < S)
    result = H * exp(-0.5826 * v * sqrt(dt));
  else
    abort();
  return result;
}


x86 assembly (clang, -O0):
<DiscreteAdjustedBarrier>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm0
ucomisd -0x8(%rbp),%xmm0
jbe    11a9 <DiscreteAdjustedBarrier+0x79>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xe9a(%rip),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1050 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0x38(%rbp),%xmm0
mulsd  %xmm1,%xmm0
call   1040 <exp@plt>
movaps %xmm0,%xmm1
movsd  -0x30(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
jmp    1216 <DiscreteAdjustedBarrier+0xe6>
movsd  -0x10(%rbp),%xmm1
movsd  -0x8(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    120a <DiscreteAdjustedBarrier+0xda>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  0xe31(%rip),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1050 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0x48(%rbp),%xmm0
mulsd  %xmm1,%xmm0
call   1040 <exp@plt>
movaps %xmm0,%xmm1
movsd  -0x40(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
jmp    1211 <DiscreteAdjustedBarrier+0xe1>
mov    $0x0,%al
call   1030 <abort@plt>
jmp    1216 <DiscreteAdjustedBarrier+0xe6>
movsd  -0x28(%rbp),%xmm0
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<DiscreteAdjustedBarrier>:
sub    $0x18,%rsp
ucomisd %xmm0,%xmm1
jbe    1144 <DiscreteAdjustedBarrier+0x14>
movsd  0xebe(%rip),%xmm4
jmp    1152 <DiscreteAdjustedBarrier+0x22>
ucomisd %xmm1,%xmm0
jbe    119c <DiscreteAdjustedBarrier+0x6c>
movsd  0xeb6(%rip),%xmm4
movsd  %xmm1,0x10(%rsp)
mulsd  %xmm2,%xmm4
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm3
jb     116f <DiscreteAdjustedBarrier+0x3f>
xorps  %xmm0,%xmm0
sqrtsd %xmm3,%xmm0
jmp    1184 <DiscreteAdjustedBarrier+0x54>
movapd %xmm3,%xmm0
movsd  %xmm4,0x8(%rsp)
call   1050 <sqrt@plt>
movsd  0x8(%rsp),%xmm4
mulsd  %xmm0,%xmm4
movapd %xmm4,%xmm0
call   1040 <exp@plt>
mulsd  0x10(%rsp),%xmm0
add    $0x18,%rsp
ret
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define double @DiscreteAdjustedBarrier(double %0, double %1, double %2, double %3) {
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
store double %0, double* %5
store double %1, double* %6
store double %2, double* %7
store double %3, double* %8
%10 = load double, double* %6
%11 = load double, double* %5
%12 = fcmp ogt double %10, %11
br i1 %12, label %13, label %22
13: ; preds = %4
%14 = load double, double* %6
%15 = load double, double* %7
%16 = fmul double 5.826000e-01, %15
%17 = load double, double* %8
%18 = call double @sqrt(double %17)
%19 = fmul double %16, %18
%20 = call double @exp(double %19)
%21 = fmul double %14, %20
store double %21, double* %9
br label %38
22: ; preds = %4
%23 = load double, double* %6
%24 = load double, double* %5
%25 = fcmp olt double %23, %24
br i1 %25, label %26, label %35
26: ; preds = %22
%27 = load double, double* %6
%28 = load double, double* %7
%29 = fmul double -5.826000e-01, %28
%30 = load double, double* %8
%31 = call double @sqrt(double %30)
%32 = fmul double %29, %31
%33 = call double @exp(double %32)
%34 = fmul double %27, %33
store double %34, double* %9
br label %37
35: ; preds = %22
%36 = call i32 (...) @abort()
unreachable
37: ; preds = %26
br label %38
38: ; preds = %37, %13
%39 = load double, double* %9
ret double %39
}

LLVM IR (-O2):
define double @DiscreteAdjustedBarrier(double %0, double %1, double %2, double %3) {
%5 = fcmp ogt double %1, %0
br i1 %5, label %10, label %6
6: ; preds = %4
%7 = fcmp olt double %1, %0
br i1 %7, label %10, label %8
8: ; preds = %6
%9 = tail call i32 (...) @abort()
unreachable
10: ; preds = %6, %4
%11 = phi double [ 5.826000e-01, %4 ], [ -5.826000e-01, %6 ]
%12 = fmul double %11, %2
%13 = tail call double @sqrt(double %3)
%14 = fmul double %12, %13
%15 = tail call double @exp(double %14)
%16 = fmul double %15, %1
ret double %16
}