#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*/ fatalx(char *, double);
double randev0(double);
double randev1(double);
double ranexp();
double rangam(double a) {
  if (a <= 0.0) {
    fatalx("rangam called with bad param.  a:  %9.3f\n", a);
  }
  if (a < 1.0) {
    return (randev0(a));
  }
  if (a == 1.0) {
    return (ranexp());
  }
  return (randev1(a));
}


x86 assembly (clang, -O0):
<rangam>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x10(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
jb     116c <rangam+0x2c>
movsd  -0x10(%rbp),%xmm0
lea    0xea1(%rip),%rdi
call   1030 <fatalx@plt>
movsd  0xe8c(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    1193 <rangam+0x53>
movsd  -0x10(%rbp),%xmm0
call   1040 <randev0@plt>
movsd  %xmm0,-0x8(%rbp)
jmp    11d0 <rangam+0x90>
movsd  -0x10(%rbp),%xmm0
movsd  0xe60(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    11c1 <rangam+0x81>
jp     11c1 <rangam+0x81>
mov    $0x0,%al
call   1050 <ranexp@plt>
movsd  %xmm0,-0x8(%rbp)
jmp    11d0 <rangam+0x90>
movsd  -0x10(%rbp),%xmm0
call   1060 <randev1@plt>
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rangam>:
push   %rax
xorpd  %xmm1,%xmm1
ucomisd %xmm0,%xmm1
jb     1161 <rangam+0x21>
lea    0xeb6(%rip),%rdi
movsd  %xmm0,(%rsp)
call   1030 <fatalx@plt>
movsd  (%rsp),%xmm0
movsd  0xe97(%rip),%xmm1
ucomisd %xmm0,%xmm1
jbe    1175 <rangam+0x35>
pop    %rax
jmp    1040 <randev0@plt>
ucomisd 0xe83(%rip),%xmm0
jne    1189 <rangam+0x49>
jp     1189 <rangam+0x49>
xor    %eax,%eax
pop    %rcx
jmp    1050 <ranexp@plt>
pop    %rax
jmp    1060 <randev1@plt>

LLVM IR (-O0):
@.str = [42 x i8] c"rangam called with bad param. a: %9.3f\0A\00"
define double @rangam(double %0) {
%2 = alloca double
%3 = alloca double
store double %0, double* %3
%4 = load double, double* %3
%5 = fcmp ole double %4, 0.000000e+00
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = load double, double* %3
%8 = call i32 @fatalx(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), double %7)
br label %9
9: ; preds = %6, %1
%10 = load double, double* %3
%11 = fcmp olt double %10, 1.000000e+00
br i1 %11, label %12, label %15
12: ; preds = %9
%13 = load double, double* %3
%14 = call double @randev0(double %13)
store double %14, double* %2
br label %23
15: ; preds = %9
%16 = load double, double* %3
%17 = fcmp oeq double %16, 1.000000e+00
br i1 %17, label %18, label %20
18: ; preds = %15
%19 = call double (...) @ranexp()
store double %19, double* %2
br label %23
20: ; preds = %15
%21 = load double, double* %3
%22 = call double @randev1(double %21)
store double %22, double* %2
br label %23
23: ; preds = %20, %18, %12
%24 = load double, double* %2
ret double %24
}

LLVM IR (-O2):
@.str = [42 x i8] c"rangam called with bad param. a: %9.3f\0A\00"
define double @rangam(double %0) {
%2 = fcmp ugt double %0, 0.000000e+00
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @fatalx(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), double %0)
br label %5
5: ; preds = %3, %1
%6 = fcmp olt double %0, 1.000000e+00
br i1 %6, label %7, label %9
7: ; preds = %5
%8 = tail call double @randev0(double %0)
br label %15
9: ; preds = %5
%10 = fcmp oeq double %0, 1.000000e+00
br i1 %10, label %11, label %13
11: ; preds = %9
%12 = tail call double (...) @ranexp()
br label %15
13: ; preds = %9
%14 = tail call double @randev1(double %0)
br label %15
15: ; preds = %13, %11, %7
%16 = phi double [ %8, %7 ], [ %12, %11 ], [ %14, %13 ]
ret double %16
}