#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 */
double M_PI;
double exp(double);
double floor(double);
double gammln(double);
double log(double);
double ranMT();
double sqrt(double);
double tan(double);
double poidev(double xm) {
  static double sq, alxm, g, oldm = (-1.0);
  double em, t, y;
  if (xm < 12.0) {
    if (xm != oldm) {
      oldm = xm;
      g = exp(-xm);
    }
    em = -1;
    t = 1.0;
    do {
      em += 1.0;
      t *= ranMT();
    } while (t > g);
  } else {
    if (xm != oldm) {
      oldm = xm;
      sq = sqrt(2.0 * xm);
      alxm = log(xm);
      g = xm * alxm - gammln(xm + 1.0);
    }
    do {
      do {
        y = tan(M_PI * ranMT());
        em = sq * y + xm;
      } while (em < 0.0);
      em = floor(em);
      t = 0.9 * (1.0 + y * y) * exp(em * alxm - gammln(em + 1.0) - g);
    } while (ranMT() > t);
  }
  return em;
}


x86 assembly (clang, -O0):
<poidev>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  0xe7b(%rip),%xmm0
ucomisd -0x8(%rbp),%xmm0
jbe    1239 <poidev+0xc9>
movsd  -0x8(%rbp),%xmm0
ucomisd 0x2ebb(%rip),%xmm0
jne    11ae <poidev+0x3e>
jp     11ae <poidev+0x3e>
jmp    11e4 <poidev+0x74>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,0x2e9d(%rip)
movsd  -0x8(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
call   1040 <exp@plt>
movsd  %xmm0,0x2e94(%rip)
movsd  0xe34(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xe0f(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xe02(%rip),%xmm0
addsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    $0x0,%al
call   1030 <ranMT@plt>
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
ucomisd 0x2e4a(%rip),%xmm0
ja     11fe <poidev+0x8e>
jmp    1415 <poidev+0x2a5>
movsd  -0x8(%rbp),%xmm0
ucomisd 0x2e12(%rip),%xmm0
jne    1257 <poidev+0xe7>
jp     1257 <poidev+0xe7>
jmp    12ed <poidev+0x17d>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,0x2df4(%rip)
movsd  0xda4(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
call   1070 <sqrt@plt>
movsd  %xmm0,0x2dea(%rip)
movsd  -0x8(%rbp),%xmm0
call   1060 <log@plt>
movsd  %xmm0,0x2de0(%rip)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0x2dce(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xd59(%rip),%xmm0
addsd  -0x8(%rbp),%xmm0
call   1080 <gammln@plt>
movsd  -0x30(%rbp),%xmm2
movaps %xmm0,%xmm1
movsd  -0x28(%rbp),%xmm0
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,0x2d8b(%rip)
jmp    12f2 <poidev+0x182>
jmp    12f7 <poidev+0x187>
mov    0x2cea(%rip),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    $0x0,%al
call   1030 <ranMT@plt>
movaps %xmm0,%xmm1
movsd  -0x38(%rbp),%xmm0
mulsd  %xmm1,%xmm0
call   1050 <tan@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  0x2d3c(%rip),%xmm0
movsd  -0x20(%rbp),%xmm2
movsd  -0x8(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
ja     12f7 <poidev+0x187>
movsd  -0x10(%rbp),%xmm0
call   1090 <floor@plt>
movsd  %xmm0,-0x10(%rbp)
movsd  -0x20(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm0
mulsd  %xmm0,%xmm1
movsd  0xc92(%rip),%xmm0
addsd  %xmm0,%xmm1
movsd  0xc96(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  0x2cd3(%rip),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  0xc5e(%rip),%xmm0
addsd  -0x10(%rbp),%xmm0
call   1080 <gammln@plt>
movsd  -0x50(%rbp),%xmm2
movaps %xmm0,%xmm1
movsd  -0x48(%rbp),%xmm0
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
subsd  0x2c90(%rip),%xmm0
call   1040 <exp@plt>
movaps %xmm0,%xmm1
movsd  -0x40(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    $0x0,%al
call   1030 <ranMT@plt>
ucomisd -0x18(%rbp),%xmm0
ja     12f2 <poidev+0x182>
jmp    1415 <poidev+0x2a5>
movsd  -0x10(%rbp),%xmm0
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<poidev>:
push   %rbx
sub    $0x30,%rsp
movapd %xmm0,%xmm2
movsd  0xe7f(%rip),%xmm0
ucomisd %xmm2,%xmm0
movsd  0x2ecb(%rip),%xmm0
jbe    1208 <poidev+0x98>
ucomisd %xmm2,%xmm0
jne    1197 <poidev+0x27>
jnp    11b8 <poidev+0x48>
movsd  %xmm2,0x2eb9(%rip)
xorpd  0xe89(%rip),%xmm2
movapd %xmm2,%xmm0
call   1040 <exp@plt>
movsd  %xmm0,0x2ec0(%rip)
movsd  0xe58(%rip),%xmm0
movsd  0xe40(%rip),%xmm1
nopl   0x0(%rax,%rax,1)
movsd  %xmm1,(%rsp)
addsd  0xe2b(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
xor    %eax,%eax
call   1030 <ranMT@plt>
movsd  (%rsp),%xmm1
mulsd  %xmm0,%xmm1
movsd  0x8(%rsp),%xmm0
ucomisd 0x2e77(%rip),%xmm1
ja     11d0 <poidev+0x60>
jmp    1358 <poidev+0x1e8>
ucomisd %xmm2,%xmm0
movapd %xmm2,0x10(%rsp)
jne    1216 <poidev+0xa6>
jnp    1289 <poidev+0x119>
movsd  %xmm2,0x2e3a(%rip)
movapd %xmm2,%xmm0
addsd  %xmm2,%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1236 <poidev+0xc6>
sqrtsd %xmm0,%xmm0
jmp    1241 <poidev+0xd1>
call   1070 <sqrt@plt>
movapd 0x10(%rsp),%xmm2
movsd  %xmm0,0x2e1f(%rip)
movapd %xmm2,%xmm0
call   1060 <log@plt>
movsd  %xmm0,(%rsp)
movsd  %xmm0,0x2e11(%rip)
movsd  0xda1(%rip),%xmm0
addsd  0x10(%rsp),%xmm0
call   1080 <gammln@plt>
movsd  (%rsp),%xmm1
mulsd  0x10(%rsp),%xmm1
subsd  %xmm0,%xmm1
movsd  %xmm1,0x2def(%rip)
mov    0x2d58(%rip),%rbx
movsd  (%rbx),%xmm0
movsd  %xmm0,(%rsp)
xor    %eax,%eax
call   1030 <ranMT@plt>
mulsd  (%rsp),%xmm0
call   1050 <tan@plt>
movapd %xmm0,%xmm2
movsd  0x2db2(%rip),%xmm0
mulsd  %xmm2,%xmm0
addsd  0x10(%rsp),%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm0,%xmm1
ja     1290 <poidev+0x120>
movsd  %xmm2,(%rsp)
call   1090 <floor@plt>
movapd %xmm0,%xmm2
movsd  (%rsp),%xmm3
mulsd  %xmm3,%xmm3
movsd  0xd1f(%rip),%xmm1
addsd  %xmm1,%xmm3
mulsd  0xd1b(%rip),%xmm3
movsd  %xmm3,(%rsp)
addsd  %xmm1,%xmm0
movsd  0x2d6a(%rip),%xmm1
movsd  %xmm2,0x8(%rsp)
mulsd  %xmm2,%xmm1
movsd  %xmm1,0x28(%rsp)
call   1080 <gammln@plt>
movsd  0x28(%rsp),%xmm1
subsd  %xmm0,%xmm1
subsd  0x2d4b(%rip),%xmm1
movapd %xmm1,%xmm0
call   1040 <exp@plt>
mulsd  (%rsp),%xmm0
movsd  %xmm0,(%rsp)
xor    %eax,%eax
call   1030 <ranMT@plt>
ucomisd (%rsp),%xmm0
ja     1290 <poidev+0x120>
movsd  0x8(%rsp),%xmm0
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@poidev.sq = internal global double 0.000000e+00
@poidev.alxm = internal global double 0.000000e+00
@poidev.g = internal global double 0.000000e+00
@poidev.oldm = internal global double -1.000000e+00
@M_PI = global double 0.000000e+00
define double @poidev(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
store double %0, double* %2
%6 = load double, double* %2
%7 = fcmp olt double %6, 1.200000e+01
br i1 %7, label %8, label %29
8: ; preds = %1
%9 = load double, double* %2
%10 = load double, double* @poidev.oldm
%11 = fcmp une double %9, %10
br i1 %11, label %12, label %17
12: ; preds = %8
%13 = load double, double* %2
store double %13, double* @poidev.oldm
%14 = load double, double* %2
%15 = fneg double %14
%16 = call double @exp(double %15)
store double %16, double* @poidev.g
br label %17
17: ; preds = %12, %8
store double -1.000000e+00, double* %3
store double 1.000000e+00, double* %4
br label %18
18: ; preds = %24, %17
%19 = load double, double* %3
%20 = fadd double %19, 1.000000e+00
store double %20, double* %3
%21 = call double (...) @ranMT()
%22 = load double, double* %4
%23 = fmul double %22, %21
store double %23, double* %4
br label %24
24: ; preds = %18
%25 = load double, double* %4
%26 = load double, double* @poidev.g
%27 = fcmp ogt double %25, %26
br i1 %27, label %18, label %28
28: ; preds = %24
br label %84
29: ; preds = %1
%30 = load double, double* %2
%31 = load double, double* @poidev.oldm
%32 = fcmp une double %30, %31
br i1 %32, label %33, label %47
33: ; preds = %29
%34 = load double, double* %2
store double %34, double* @poidev.oldm
%35 = load double, double* %2
%36 = fmul double 2.000000e+00, %35
%37 = call double @sqrt(double %36)
store double %37, double* @poidev.sq
%38 = load double, double* %2
%39 = call double @log(double %38)
store double %39, double* @poidev.alxm
%40 = load double, double* %2
%41 = load double, double* @poidev.alxm
%42 = load double, double* %2
%43 = fadd double %42, 1.000000e+00
%44 = call double @gammln(double %43)
%45 = fneg double %44
%46 = call double @llvm.fmuladd.f64(double %40, double %41, double %45)
store double %46, double* @poidev.g
br label %47
47: ; preds = %33, %29
br label %48
48: ; preds = %79, %47
br label %49
49: ; preds = %58, %48
%50 = load double, double* @M_PI
%51 = call double (...) @ranMT()
%52 = fmul double %50, %51
%53 = call double @tan(double %52)
store double %53, double* %5
%54 = load double, double* @poidev.sq
%55 = load double, double* %5
%56 = load double, double* %2
%57 = call double @llvm.fmuladd.f64(double %54, double %55, double %56)
store double %57, double* %3
br label %58
58: ; preds = %49
%59 = load double, double* %3
%60 = fcmp olt double %59, 0.000000e+00
br i1 %60, label %49, label %61
61: ; preds = %58
%62 = load double, double* %3
%63 = call double @llvm.floor.f64(double %62)
store double %63, double* %3
%64 = load double, double* %5
%65 = load double, double* %5
%66 = call double @llvm.fmuladd.f64(double %64, double %65, double 1.000000e+00)
%67 = fmul double 9.000000e-01, %66
%68 = load double, double* %3
%69 = load double, double* @poidev.alxm
%70 = load double, double* %3
%71 = fadd double %70, 1.000000e+00
%72 = call double @gammln(double %71)
%73 = fneg double %72
%74 = call double @llvm.fmuladd.f64(double %68, double %69, double %73)
%75 = load double, double* @poidev.g
%76 = fsub double %74, %75
%77 = call double @exp(double %76)
%78 = fmul double %67, %77
store double %78, double* %4
br label %79
79: ; preds = %61
%80 = call double (...) @ranMT()
%81 = load double, double* %4
%82 = fcmp ogt double %80, %81
br i1 %82, label %48, label %83
83: ; preds = %79
br label %84
84: ; preds = %83, %28
%85 = load double, double* %3
ret double %85
}

LLVM IR (-O2):
@poidev.sq = internal unnamed_addr global double 0.000000e+00
@poidev.alxm = internal unnamed_addr global double 0.000000e+00
@poidev.g = internal unnamed_addr global double 0.000000e+00
@poidev.oldm = internal unnamed_addr global double -1.000000e+00
@M_PI = global double 0.000000e+00
define double @poidev(double %0) {
%2 = fcmp olt double %0, 1.200000e+01
%3 = load double, double* @poidev.oldm
%4 = fcmp une double %3, %0
br i1 %2, label %5, label %18
5: ; preds = %1
br i1 %4, label %6, label %9
6: ; preds = %5
store double %0, double* @poidev.oldm
%7 = fneg double %0
%8 = tail call double @exp(double %7)
store double %8, double* @poidev.g
br label %9
9: ; preds = %6, %5
br label %10
10: ; preds = %9, %10
%11 = phi double [ %15, %10 ], [ 1.000000e+00, %9 ]
%12 = phi double [ %13, %10 ], [ -1.000000e+00, %9 ]
%13 = fadd double %12, 1.000000e+00
%14 = tail call double (...) @ranMT()
%15 = fmul double %11, %14
%16 = load double, double* @poidev.g
%17 = fcmp ogt double %15, %16
br i1 %17, label %10, label %52
18: ; preds = %1
br i1 %4, label %19, label %27
19: ; preds = %18
store double %0, double* @poidev.oldm
%20 = fmul double %0, 2.000000e+00
%21 = tail call double @sqrt(double %20)
store double %21, double* @poidev.sq
%22 = tail call double @log(double %0)
store double %22, double* @poidev.alxm
%23 = fadd double %0, 1.000000e+00
%24 = tail call double @gammln(double %23)
%25 = fneg double %24
%26 = tail call double @llvm.fmuladd.f64(double %0, double %22, double %25)
store double %26, double* @poidev.g
br label %27
27: ; preds = %18, %19
br label %28
28: ; preds = %36, %27
%29 = load double, double* @M_PI
%30 = tail call double (...) @ranMT()
%31 = fmul double %29, %30
%32 = tail call double @tan(double %31)
%33 = load double, double* @poidev.sq
%34 = tail call double @llvm.fmuladd.f64(double %33, double %32, double %0)
%35 = fcmp olt double %34, 0.000000e+00
br i1 %35, label %36, label %37
36: ; preds = %28, %37
br label %28
37: ; preds = %28
%38 = tail call double @llvm.floor.f64(double %34)
%39 = tail call double @llvm.fmuladd.f64(double %32, double %32, double 1.000000e+00)
%40 = fmul double %39, 9.000000e-01
%41 = load double, double* @poidev.alxm
%42 = fadd double %38, 1.000000e+00
%43 = tail call double @gammln(double %42)
%44 = fneg double %43
%45 = tail call double @llvm.fmuladd.f64(double %38, double %41, double %44)
%46 = load double, double* @poidev.g
%47 = fsub double %45, %46
%48 = tail call double @exp(double %47)
%49 = fmul double %40, %48
%50 = tail call double (...) @ranMT()
%51 = fcmp ogt double %50, %49
br i1 %51, label %36, label %52
52: ; preds = %37, %10
%53 = phi double [ %13, %10 ], [ %38, %37 ]
ret double %53
}