#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*/ error(char *);
double unifcdf(double x, double a, double b) {
  if (b < a)
    error("Parameter b is smaller than a.");
  if (x < a)
    return 0.0;
  if (x > b)
    return 1.0;
  return (x - a) / (b - a);
}


x86 assembly (clang, -O0):
<unifcdf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1147 <unifcdf+0x37>
lea    0xec6(%rip),%rdi
call   1030 <error@plt>
movsd  -0x10(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1168 <unifcdf+0x58>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11a7 <unifcdf+0x97>
movsd  -0x10(%rbp),%xmm0
ucomisd -0x20(%rbp),%xmm0
jbe    118a <unifcdf+0x7a>
movsd  0xe80(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11a7 <unifcdf+0x97>
movsd  -0x10(%rbp),%xmm0
subsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
subsd  -0x18(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<unifcdf>:
sub    $0x18,%rsp
movapd %xmm0,%xmm3
ucomisd %xmm2,%xmm1
jbe    114c <unifcdf+0x3c>
lea    0xee3(%rip),%rdi
movsd  %xmm2,0x10(%rsp)
movsd  %xmm3,0x8(%rsp)
movsd  %xmm1,(%rsp)
call   1030 <error@plt>
movsd  (%rsp),%xmm1
movsd  0x8(%rsp),%xmm3
movsd  0x10(%rsp),%xmm2
xorpd  %xmm0,%xmm0
ucomisd %xmm3,%xmm1
ja     1179 <unifcdf+0x69>
ucomisd %xmm2,%xmm3
jbe    1169 <unifcdf+0x59>
movsd  0xe9c(%rip),%xmm0
add    $0x18,%rsp
ret
subsd  %xmm1,%xmm3
subsd  %xmm1,%xmm2
divsd  %xmm2,%xmm3
movapd %xmm3,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [31 x i8] c"Parameter b is smaller than a.\00"
define double @unifcdf(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
store double %0, double* %5
store double %1, double* %6
store double %2, double* %7
%8 = load double, double* %7
%9 = load double, double* %6
%10 = fcmp olt double %8, %9
br i1 %10, label %11, label %13
11: ; preds = %3
%12 = call i32 @error(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
br label %13
13: ; preds = %11, %3
%14 = load double, double* %5
%15 = load double, double* %6
%16 = fcmp olt double %14, %15
br i1 %16, label %17, label %18
17: ; preds = %13
store double 0.000000e+00, double* %4
br label %31
18: ; preds = %13
%19 = load double, double* %5
%20 = load double, double* %7
%21 = fcmp ogt double %19, %20
br i1 %21, label %22, label %23
22: ; preds = %18
store double 1.000000e+00, double* %4
br label %31
23: ; preds = %18
%24 = load double, double* %5
%25 = load double, double* %6
%26 = fsub double %24, %25
%27 = load double, double* %7
%28 = load double, double* %6
%29 = fsub double %27, %28
%30 = fdiv double %26, %29
store double %30, double* %4
br label %31
31: ; preds = %23, %22, %17
%32 = load double, double* %4
ret double %32
}

LLVM IR (-O2):
@.str = [31 x i8] c"Parameter b is smaller than a.\00"
define double @unifcdf(double %0, double %1, double %2) {
%4 = fcmp olt double %2, %1
br i1 %4, label %5, label %7
5: ; preds = %3
%6 = tail call i32 @error(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %5, %3
%8 = fcmp olt double %0, %1
br i1 %8, label %15, label %9
9: ; preds = %7
%10 = fcmp ogt double %0, %2
br i1 %10, label %15, label %11
11: ; preds = %9
%12 = fsub double %0, %1
%13 = fsub double %2, %1
%14 = fdiv double %12, %13
br label %15
15: ; preds = %9, %7, %11
%16 = phi double [ %14, %11 ], [ 0.000000e+00, %7 ], [ 1.000000e+00, %9 ]
ret double %16
}