#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 gauss();
double rangam(double);
double sqrt(double);
double rant(double df) {
  static double p = -1, olddf = -1.0;
  static double zkon;
  double y;
  if (df <= -0.0)
    fatalx("(rant) %9.3f\n");
  p = df / 2.0;
  zkon = sqrt(p);
  y = rangam(p);
  if (y == 0.0)
    y = p;
  return gauss() * zkon / sqrt(y);
}


x86 assembly (clang, -O0):
<rant>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  0xeab(%rip),%xmm0
ucomisd -0x8(%rbp),%xmm0
jb     116c <rant+0x2c>
lea    0xea9(%rip),%rdi
call   1030 <fatalx@plt>
movsd  -0x8(%rbp),%xmm0
movsd  0xe8f(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,0x2ebb(%rip)
movsd  0x2eb3(%rip),%xmm0
call   1060 <sqrt@plt>
movsd  %xmm0,0x2ebe(%rip)
movsd  0x2e9e(%rip),%xmm0
call   1050 <rangam@plt>
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    11d1 <rant+0x91>
jp     11d1 <rant+0x91>
movsd  0x2e74(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    $0x0,%al
call   1040 <gauss@plt>
mulsd  0x2e78(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1060 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
divsd  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rant>:
sub    $0x18,%rsp
xorpd  %xmm1,%xmm1
ucomisd %xmm0,%xmm1
jb     1168 <rant+0x28>
lea    0xebb(%rip),%rdi
movsd  %xmm0,(%rsp)
call   1030 <fatalx@plt>
xorpd  %xmm1,%xmm1
movsd  (%rsp),%xmm0
mulsd  0xe90(%rip),%xmm0
movsd  %xmm0,0x2ec8(%rip)
ucomisd %xmm1,%xmm0
jb     1184 <rant+0x44>
sqrtsd %xmm0,%xmm0
jmp    1189 <rant+0x49>
call   1060 <sqrt@plt>
movsd  %xmm0,0x2ebf(%rip)
movsd  0x2ea7(%rip),%xmm0
call   1050 <rangam@plt>
xorpd  %xmm1,%xmm1
movapd %xmm0,%xmm2
cmpeqsd %xmm1,%xmm2
movsd  0x2e8d(%rip),%xmm1
andpd  %xmm2,%xmm1
andnpd %xmm0,%xmm2
orpd   %xmm1,%xmm2
movapd %xmm2,(%rsp)
xor    %eax,%eax
call   1040 <gauss@plt>
movapd %xmm0,%xmm1
movapd (%rsp),%xmm0
mulsd  0x2e74(%rip),%xmm1
ucomisd 0xe24(%rip),%xmm0
jb     11ec <rant+0xac>
sqrtsd %xmm0,%xmm0
jmp    11fb <rant+0xbb>
movsd  %xmm1,(%rsp)
call   1060 <sqrt@plt>
movsd  (%rsp),%xmm1
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
@rant.p = internal global double -1.000000e+00
@rant.olddf = internal global double -1.000000e+00
@rant.zkon = internal global double 0.000000e+00
@.str = [14 x i8] c"(rant) %9.3f\0A\00"
define double @rant(double %0) {
%2 = alloca double
%3 = alloca double
store double %0, double* %2
%4 = load double, double* %2
%5 = fcmp ole double %4, -0.000000e+00
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = call i32 @fatalx(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %6, %1
%9 = load double, double* %2
%10 = fdiv double %9, 2.000000e+00
store double %10, double* @rant.p
%11 = load double, double* @rant.p
%12 = call double @sqrt(double %11)
store double %12, double* @rant.zkon
%13 = load double, double* @rant.p
%14 = call double @rangam(double %13)
store double %14, double* %3
%15 = load double, double* %3
%16 = fcmp oeq double %15, 0.000000e+00
br i1 %16, label %17, label %19
17: ; preds = %8
%18 = load double, double* @rant.p
store double %18, double* %3
br label %19
19: ; preds = %17, %8
%20 = call double (...) @gauss()
%21 = load double, double* @rant.zkon
%22 = fmul double %20, %21
%23 = load double, double* %3
%24 = call double @sqrt(double %23)
%25 = fdiv double %22, %24
ret double %25
}

LLVM IR (-O2):
@rant.p = internal unnamed_addr global double -1.000000e+00
@rant.zkon = internal unnamed_addr global double 0.000000e+00
@.str = [14 x i8] c"(rant) %9.3f\0A\00"
define double @rant(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 ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
br label %5
5: ; preds = %3, %1
%6 = fmul double %0, 5.000000e-01
store double %6, double* @rant.p
%7 = tail call double @sqrt(double %6)
store double %7, double* @rant.zkon
%8 = load double, double* @rant.p
%9 = tail call double @rangam(double %8)
%10 = fcmp oeq double %9, 0.000000e+00
%11 = load double, double* @rant.p
%12 = select i1 %10, double %11, double %9
%13 = tail call double (...) @gauss()
%14 = load double, double* @rant.zkon
%15 = fmul double %13, %14
%16 = tail call double @sqrt(double %12)
%17 = fdiv double %15, %16
ret double %17
}