#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*/ GHMM_LOG_PRINTF(int, char *, char *);
double ighmm_rand_uniform_cdf(double x, double max, double min) {
  if (max <= min) {
    GHMM_LOG_PRINTF(
        2,
        "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
        "2022-01-22/02-19-57/repos/lukefrasera/fatigueBSN/refs/heads/master/"
        "scripts/include/ghmm-0.9-rc3/ghmm/randvar.c"
        ":"
        "ighmm_rand_uniform_cdf"
        "("
        "729"
        "): ",
        "max <= min not allowed\n");
    goto STOP;
  }
  if (x < min) {
    return 0.0;
  }
  if (x >= max) {
    return 1.0;
  }
  return (x - min) / (max - min);
STOP:
  return (-1.0);
}


x86 assembly (clang, -O0):
<ighmm_rand_uniform_cdf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     1158 <ighmm_rand_uniform_cdf+0x48>
mov    $0x2,%edi
lea    0xec9(%rip),%rsi
lea    0xf8f(%rip),%rdx
call   1030 <GHMM_LOG_PRINTF@plt>
jmp    11bd <ighmm_rand_uniform_cdf+0xad>
movsd  -0x10(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1179 <ighmm_rand_uniform_cdf+0x69>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11ca <ighmm_rand_uniform_cdf+0xba>
movsd  -0x10(%rbp),%xmm0
ucomisd -0x18(%rbp),%xmm0
jb     119b <ighmm_rand_uniform_cdf+0x8b>
movsd  0xe6f(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11ca <ighmm_rand_uniform_cdf+0xba>
movsd  -0x10(%rbp),%xmm0
subsd  -0x20(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
subsd  -0x20(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11ca <ighmm_rand_uniform_cdf+0xba>
movsd  0xe43(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ighmm_rand_uniform_cdf>:
push   %rax
ucomisd %xmm1,%xmm2
jae    1139 <ighmm_rand_uniform_cdf+0x29>
xorpd  %xmm3,%xmm3
ucomisd %xmm0,%xmm2
ja     1163 <ighmm_rand_uniform_cdf+0x53>
ucomisd %xmm1,%xmm0
jae    115b <ighmm_rand_uniform_cdf+0x4b>
subsd  %xmm2,%xmm0
subsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movapd %xmm0,%xmm3
jmp    1163 <ighmm_rand_uniform_cdf+0x53>
lea    0xed0(%rip),%rsi
lea    0xf96(%rip),%rdx
mov    $0x2,%edi
call   1030 <GHMM_LOG_PRINTF@plt>
movsd  0xea7(%rip),%xmm3
jmp    1163 <ighmm_rand_uniform_cdf+0x53>
movsd  0xea5(%rip),%xmm3
movapd %xmm3,%xmm0
pop    %rax
ret

LLVM IR (-O0):
@.str = [205 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/lukefrasera/fatigueBSN/refs/heads/master/scripts/include/ghmm-0.9-rc3/ghmm/randvar.c:ighmm_rand_uniform_cdf(729): \00"
@.str.1 = [24 x i8] c"max <= min not allowed\0A\00"
define double @ighmm_rand_uniform_cdf(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* %6
%9 = load double, double* %7
%10 = fcmp ole double %8, %9
br i1 %10, label %11, label %13
11: ; preds = %3
%12 = call i32 @GHMM_LOG_PRINTF(i32 2, i8* getelementptr inbounds ([205 x i8], [205 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
br label %31
13: ; preds = %3
%14 = load double, double* %5
%15 = load double, double* %7
%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 %32
18: ; preds = %13
%19 = load double, double* %5
%20 = load double, double* %6
%21 = fcmp oge double %19, %20
br i1 %21, label %22, label %23
22: ; preds = %18
store double 1.000000e+00, double* %4
br label %32
23: ; preds = %18
%24 = load double, double* %5
%25 = load double, double* %7
%26 = fsub double %24, %25
%27 = load double, double* %6
%28 = load double, double* %7
%29 = fsub double %27, %28
%30 = fdiv double %26, %29
store double %30, double* %4
br label %32
31: ; preds = %11
store double -1.000000e+00, double* %4
br label %32
32: ; preds = %31, %23, %22, %17
%33 = load double, double* %4
ret double %33
}

LLVM IR (-O2):
@.str = [205 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/lukefrasera/fatigueBSN/refs/heads/master/scripts/include/ghmm-0.9-rc3/ghmm/randvar.c:ighmm_rand_uniform_cdf(729): \00"
@.str.1 = [24 x i8] c"max <= min not allowed\0A\00"
define double @ighmm_rand_uniform_cdf(double %0, double %1, double %2) {
%4 = fcmp ugt double %1, %2
br i1 %4, label %7, label %5
5: ; preds = %3
%6 = tail call i32 @GHMM_LOG_PRINTF(i32 2, i8* getelementptr inbounds ([205 x i8], [205 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
br label %15
7: ; preds = %3
%8 = fcmp olt double %0, %2
br i1 %8, label %15, label %9
9: ; preds = %7
%10 = fcmp ult double %0, %1
br i1 %10, label %11, label %15
11: ; preds = %9
%12 = fsub double %0, %2
%13 = fsub double %1, %2
%14 = fdiv double %12, %13
br label %15
15: ; preds = %9, %7, %5, %11
%16 = phi double [ -1.000000e+00, %5 ], [ %14, %11 ], [ 0.000000e+00, %7 ], [ 1.000000e+00, %9 ]
ret double %16
}