#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*/ erro(char *);
double log(double);
double ranf();
double sqrt(double);
double hyperx(double x, double s) {
  double cv, z, p;
  if (s <= x)
    erro("hyperx Argument Error: s not > x");
  cv = s / x;
  z = cv * cv;
  p = 0.5 * (1.0 - sqrt((z - 1.0) / (z + 1.0)));
  z = (ranf() > p) ? (x / (1.0 - p)) : (x / p);
  return (-0.5 * z * log(ranf()));
}


x86 assembly (clang, -O0):
<hyperx>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm1
movsd  -0x8(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     1172 <hyperx+0x32>
lea    0xeab(%rip),%rdi
call   1030 <erro@plt>
movsd  -0x10(%rbp),%xmm0
divsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  0xe6b(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  0xe5f(%rip),%xmm1
addsd  -0x20(%rbp),%xmm1
divsd  %xmm1,%xmm0
call   1060 <sqrt@plt>
movsd  0xe49(%rip),%xmm1
subsd  %xmm0,%xmm1
movsd  0xe35(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    $0x0,%al
call   1040 <ranf@plt>
ucomisd -0x28(%rbp),%xmm0
jbe    1206 <hyperx+0xc6>
movsd  -0x8(%rbp),%xmm0
movsd  0xe15(%rip),%xmm1
subsd  -0x28(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
jmp    1215 <hyperx+0xd5>
movsd  -0x8(%rbp),%xmm0
divsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xde9(%rip),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    $0x0,%al
call   1040 <ranf@plt>
call   1050 <log@plt>
movaps %xmm0,%xmm1
movsd  -0x38(%rbp),%xmm0
mulsd  %xmm1,%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hyperx>:
sub    $0x28,%rsp
movsd  %xmm0,0x8(%rsp)
ucomisd %xmm1,%xmm0
jb     1168 <hyperx+0x28>
lea    0xec9(%rip),%rdi
movsd  %xmm1,0x10(%rsp)
call   1030 <erro@plt>
movsd  0x10(%rsp),%xmm1
divsd  0x8(%rsp),%xmm1
mulsd  %xmm1,%xmm1
movsd  0xe86(%rip),%xmm0
addsd  %xmm1,%xmm0
addsd  0xe82(%rip),%xmm1
divsd  %xmm1,%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     119a <hyperx+0x5a>
sqrtsd %xmm0,%xmm0
jmp    119f <hyperx+0x5f>
call   1060 <sqrt@plt>
movsd  0xe61(%rip),%xmm1
subsd  %xmm0,%xmm1
mulsd  0xe5d(%rip),%xmm1
movapd %xmm1,0x10(%rsp)
xor    %eax,%eax
call   1040 <ranf@plt>
movsd  0xe40(%rip),%xmm2
movapd 0x10(%rsp),%xmm3
subsd  %xmm3,%xmm2
movapd %xmm3,%xmm1
cmpltsd %xmm0,%xmm1
andpd  %xmm1,%xmm2
andnpd %xmm3,%xmm1
orpd   %xmm2,%xmm1
movsd  0x8(%rsp),%xmm0
divsd  %xmm1,%xmm0
mulsd  0xe1f(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
xor    %eax,%eax
call   1040 <ranf@plt>
call   1050 <log@plt>
mulsd  0x8(%rsp),%xmm0
add    $0x28,%rsp
ret

LLVM IR (-O0):
@.str = [33 x i8] c"hyperx Argument Error: s not > x\00"
define double @hyperx(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
store double %0, double* %3
store double %1, double* %4
%8 = load double, double* %4
%9 = load double, double* %3
%10 = fcmp ole double %8, %9
br i1 %10, label %11, label %13
11: ; preds = %2
%12 = call i32 @erro(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
br label %13
13: ; preds = %11, %2
%14 = load double, double* %4
%15 = load double, double* %3
%16 = fdiv double %14, %15
store double %16, double* %5
%17 = load double, double* %5
%18 = load double, double* %5
%19 = fmul double %17, %18
store double %19, double* %6
%20 = load double, double* %6
%21 = fsub double %20, 1.000000e+00
%22 = load double, double* %6
%23 = fadd double %22, 1.000000e+00
%24 = fdiv double %21, %23
%25 = call double @sqrt(double %24)
%26 = fsub double 1.000000e+00, %25
%27 = fmul double 5.000000e-01, %26
store double %27, double* %7
%28 = call double (...) @ranf()
%29 = load double, double* %7
%30 = fcmp ogt double %28, %29
br i1 %30, label %31, label %36
31: ; preds = %13
%32 = load double, double* %3
%33 = load double, double* %7
%34 = fsub double 1.000000e+00, %33
%35 = fdiv double %32, %34
br label %40
36: ; preds = %13
%37 = load double, double* %3
%38 = load double, double* %7
%39 = fdiv double %37, %38
br label %40
40: ; preds = %36, %31
%41 = phi double [ %35, %31 ], [ %39, %36 ]
store double %41, double* %6
%42 = load double, double* %6
%43 = fmul double -5.000000e-01, %42
%44 = call double (...) @ranf()
%45 = call double @log(double %44)
%46 = fmul double %43, %45
ret double %46
}

LLVM IR (-O2):
@.str = [33 x i8] c"hyperx Argument Error: s not > x\00"
define double @hyperx(double %0, double %1) {
%3 = fcmp ugt double %1, %0
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 @erro(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %4, %2
%7 = fdiv double %1, %0
%8 = fmul double %7, %7
%9 = fadd double %8, -1.000000e+00
%10 = fadd double %8, 1.000000e+00
%11 = fdiv double %9, %10
%12 = tail call double @sqrt(double %11)
%13 = fsub double 1.000000e+00, %12
%14 = fmul double %13, 5.000000e-01
%15 = tail call double (...) @ranf()
%16 = fcmp ogt double %15, %14
%17 = fsub double 1.000000e+00, %14
%18 = select i1 %16, double %17, double %14
%19 = fdiv double %0, %18
%20 = fmul double %19, -5.000000e-01
%21 = tail call double (...) @ranf()
%22 = tail call double @log(double %21)
%23 = fmul double %22, %20
ret double %23
}