#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 erf(double);
double sqrt(double);
double ighmm_rand_normal_cdf(double x, double mean, double u) {
  if (u <= 0.0) {
    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_normal_cdf"
        "("
        "680"
        "): ",
        "u <= 0.0 not allowed\n");
    goto STOP;
  }
  return (erf((x - mean) / sqrt(u * 2.0)) + 1.0) / 2.0;
STOP:
  return (-1.0);
}


x86 assembly (clang, -O0):
<ighmm_rand_normal_cdf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x20(%rbp),%xmm0
jb     1172 <ighmm_rand_normal_cdf+0x42>
mov    $0x2,%edi
lea    0xeb7(%rip),%rsi
lea    0xf7c(%rip),%rdx
call   1030 <GHMM_LOG_PRINTF@plt>
jmp    11c6 <ighmm_rand_normal_cdf+0x96>
movsd  -0x10(%rbp),%xmm0
subsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xe77(%rip),%xmm0
mulsd  -0x20(%rbp),%xmm0
call   1040 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0x28(%rbp),%xmm0
divsd  %xmm1,%xmm0
call   1050 <erf@plt>
movsd  0xe5c(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  0xe48(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11d3 <ighmm_rand_normal_cdf+0xa3>
movsd  0xe42(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ighmm_rand_normal_cdf>:
push   %rax
movapd %xmm0,%xmm3
xorpd  %xmm0,%xmm0
ucomisd %xmm2,%xmm0
jae    1156 <ighmm_rand_normal_cdf+0x26>
subsd  %xmm1,%xmm3
addsd  %xmm2,%xmm2
ucomisd %xmm0,%xmm2
jb     1178 <ighmm_rand_normal_cdf+0x48>
xorps  %xmm0,%xmm0
sqrtsd %xmm2,%xmm0
jmp    118b <ighmm_rand_normal_cdf+0x5b>
lea    0xebb(%rip),%rsi
lea    0xf80(%rip),%rdx
mov    $0x2,%edi
call   1030 <GHMM_LOG_PRINTF@plt>
movsd  0xe8a(%rip),%xmm0
pop    %rax
ret
movapd %xmm2,%xmm0
movsd  %xmm3,(%rsp)
call   1040 <sqrt@plt>
movsd  (%rsp),%xmm3
divsd  %xmm0,%xmm3
movapd %xmm3,%xmm0
call   1050 <erf@plt>
addsd  0xe68(%rip),%xmm0
mulsd  0xe68(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
@.str = [204 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_normal_cdf(680): \00"
@.str.1 = [22 x i8] c"u <= 0.0 not allowed\0A\00"
define double @ighmm_rand_normal_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* %7
%9 = fcmp ole double %8, 0.000000e+00
br i1 %9, label %10, label %12
10: ; preds = %3
%11 = call i32 @GHMM_LOG_PRINTF(i32 2, i8* getelementptr inbounds ([204 x i8], [204 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
br label %23
12: ; preds = %3
%13 = load double, double* %5
%14 = load double, double* %6
%15 = fsub double %13, %14
%16 = load double, double* %7
%17 = fmul double %16, 2.000000e+00
%18 = call double @sqrt(double %17)
%19 = fdiv double %15, %18
%20 = call double @erf(double %19)
%21 = fadd double %20, 1.000000e+00
%22 = fdiv double %21, 2.000000e+00
store double %22, double* %4
br label %24
23: ; preds = %10
store double -1.000000e+00, double* %4
br label %24
24: ; preds = %23, %12
%25 = load double, double* %4
ret double %25
}

LLVM IR (-O2):
@.str = [204 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_normal_cdf(680): \00"
@.str.1 = [22 x i8] c"u <= 0.0 not allowed\0A\00"
define double @ighmm_rand_normal_cdf(double %0, double %1, double %2) {
%4 = fcmp ugt double %2, 0.000000e+00
br i1 %4, label %7, label %5
5: ; preds = %3
%6 = tail call i32 @GHMM_LOG_PRINTF(i32 2, i8* getelementptr inbounds ([204 x i8], [204 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
br label %15
7: ; preds = %3
%8 = fsub double %0, %1
%9 = fmul double %2, 2.000000e+00
%10 = tail call double @sqrt(double %9)
%11 = fdiv double %8, %10
%12 = tail call double @erf(double %11)
%13 = fadd double %12, 1.000000e+00
%14 = fmul double %13, 5.000000e-01
br label %15
15: ; preds = %5, %7
%16 = phi double [ -1.000000e+00, %5 ], [ %14, %7 ]
ret double %16
}