#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_density(double x, double max, double min) {
  double prob;
  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_density"
        "("
        "366"
        "): ",
        "max <= min not allowed \n");
    goto STOP;
  }
  prob = 1.0 / (max - min);
  if ((x <= max) && (x >= min)) {
    return prob;
  } else {
    return 0.0;
  }
STOP:
  return (-1.0);
}


x86 assembly (clang, -O0):
<ighmm_rand_uniform_density>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%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_density+0x48>
mov    $0x2,%edi
lea    0xec9(%rip),%rsi
lea    0xf93(%rip),%rdx
call   1030 <GHMM_LOG_PRINTF@plt>
jmp    11b3 <ighmm_rand_uniform_density+0xa3>
movsd  -0x18(%rbp),%xmm1
subsd  -0x20(%rbp),%xmm1
movsd  0xe96(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x10(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     11a6 <ighmm_rand_uniform_density+0x96>
movsd  -0x10(%rbp),%xmm0
ucomisd -0x20(%rbp),%xmm0
jb     11a6 <ighmm_rand_uniform_density+0x96>
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11c0 <ighmm_rand_uniform_density+0xb0>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11c0 <ighmm_rand_uniform_density+0xb0>
movsd  0xe4d(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ighmm_rand_uniform_density>:
push   %rax
ucomisd %xmm1,%xmm2
jae    113f <ighmm_rand_uniform_density+0x2f>
movapd %xmm1,%xmm3
subsd  %xmm2,%xmm3
movsd  0xee1(%rip),%xmm4
divsd  %xmm3,%xmm4
cmpnlesd %xmm0,%xmm2
andnpd %xmm4,%xmm2
cmpnlesd %xmm1,%xmm0
andnpd %xmm2,%xmm0
pop    %rax
ret
lea    0xeca(%rip),%rsi
lea    0xf94(%rip),%rdx
mov    $0x2,%edi
call   1030 <GHMM_LOG_PRINTF@plt>
movsd  0xea1(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
@.str = [209 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_density(366): \00"
@.str.1 = [25 x i8] c"max <= min not allowed \0A\00"
define double @ighmm_rand_uniform_density(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
store double %0, double* %5
store double %1, double* %6
store double %2, double* %7
%9 = load double, double* %6
%10 = load double, double* %7
%11 = fcmp ole double %9, %10
br i1 %11, label %12, label %14
12: ; preds = %3
%13 = call i32 @GHMM_LOG_PRINTF(i32 2, i8* getelementptr inbounds ([209 x i8], [209 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
br label %29
14: ; preds = %3
%15 = load double, double* %6
%16 = load double, double* %7
%17 = fsub double %15, %16
%18 = fdiv double 1.000000e+00, %17
store double %18, double* %8
%19 = load double, double* %5
%20 = load double, double* %6
%21 = fcmp ole double %19, %20
br i1 %21, label %22, label %28
22: ; preds = %14
%23 = load double, double* %5
%24 = load double, double* %7
%25 = fcmp oge double %23, %24
br i1 %25, label %26, label %28
26: ; preds = %22
%27 = load double, double* %8
store double %27, double* %4
br label %30
28: ; preds = %22, %14
store double 0.000000e+00, double* %4
br label %30
29: ; preds = %12
store double -1.000000e+00, double* %4
br label %30
30: ; preds = %29, %28, %26
%31 = load double, double* %4
ret double %31
}

LLVM IR (-O2):
@.str = [209 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_density(366): \00"
@.str.1 = [25 x i8] c"max <= min not allowed \0A\00"
define double @ighmm_rand_uniform_density(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 ([209 x i8], [209 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
br label %14
7: ; preds = %3
%8 = fsub double %1, %2
%9 = fdiv double 1.000000e+00, %8
%10 = fcmp ugt double %0, %1
%11 = fcmp ult double %0, %2
%12 = or i1 %10, %11
%13 = select i1 %12, double 0.000000e+00, double %9
br label %14
14: ; preds = %7, %5
%15 = phi double [ -1.000000e+00, %5 ], [ %13, %7 ]
ret double %15
}