#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 exp(double);
double floor(double);
double gammln(double);
double log(double);
double ran1(int *);
double sqrt(double);
double tan(double);
double poidev(double xm, int *idum) {
  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 *= ran1(idum);
    } 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(3.141592654 * ran1(idum));
        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 (ran1(idum) > t);
  }
  return em;
}


x86 assembly (clang, -O0):
<poidev>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
movsd  0xe77(%rip),%xmm0
ucomisd -0x8(%rbp),%xmm0
jbe    123f <poidev+0xcf>
movsd  -0x8(%rbp),%xmm0
ucomisd 0x2eb7(%rip),%xmm0
jne    11b2 <poidev+0x42>
jp     11b2 <poidev+0x42>
jmp    11e8 <poidev+0x78>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,0x2e99(%rip)
movsd  -0x8(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
call   1030 <exp@plt>
movsd  %xmm0,0x2e90(%rip)
movsd  0xe38(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xe0b(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xdfe(%rip),%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <ran1@plt>
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
ucomisd 0x2e44(%rip),%xmm0
ja     1202 <poidev+0x92>
jmp    1412 <poidev+0x2a2>
movsd  -0x8(%rbp),%xmm0
ucomisd 0x2e0c(%rip),%xmm0
jne    125d <poidev+0xed>
jp     125d <poidev+0xed>
jmp    12f3 <poidev+0x183>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,0x2dee(%rip)
movsd  0xd9e(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
call   1070 <sqrt@plt>
movsd  %xmm0,0x2de4(%rip)
movsd  -0x8(%rbp),%xmm0
call   1060 <log@plt>
movsd  %xmm0,0x2dda(%rip)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0x2dc8(%rip),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  0xd53(%rip),%xmm0
addsd  -0x8(%rbp),%xmm0
call   1080 <gammln@plt>
movsd  -0x38(%rbp),%xmm2
movaps %xmm0,%xmm1
movsd  -0x30(%rbp),%xmm0
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,0x2d85(%rip)
jmp    12f8 <poidev+0x188>
jmp    12fd <poidev+0x18d>
mov    -0x10(%rbp),%rdi
call   1050 <ran1@plt>
movaps %xmm0,%xmm1
movsd  0xd07(%rip),%xmm0
mulsd  %xmm1,%xmm0
call   1040 <tan@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  0x2d41(%rip),%xmm0
movsd  -0x28(%rbp),%xmm2
movsd  -0x8(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x18(%rbp),%xmm0
ja     12fd <poidev+0x18d>
movsd  -0x18(%rbp),%xmm0
call   1090 <floor@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x28(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm0
mulsd  %xmm0,%xmm1
movsd  0xc97(%rip),%xmm0
addsd  %xmm0,%xmm1
movsd  0xca3(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  0x2cd8(%rip),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  0xc63(%rip),%xmm0
addsd  -0x18(%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  0x2c95(%rip),%xmm0
call   1030 <exp@plt>
movaps %xmm0,%xmm1
movsd  -0x40(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <ran1@plt>
ucomisd -0x20(%rbp),%xmm0
ja     12f8 <poidev+0x188>
jmp    1412 <poidev+0x2a2>
movsd  -0x18(%rbp),%xmm0
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<poidev>:
push   %rbx
sub    $0x30,%rsp
mov    %rdi,%rbx
movapd %xmm0,%xmm2
movsd  0xe7c(%rip),%xmm0
ucomisd %xmm2,%xmm0
movsd  0x2ec8(%rip),%xmm0
jbe    1209 <poidev+0x99>
ucomisd %xmm2,%xmm0
jne    119a <poidev+0x2a>
jnp    11bb <poidev+0x4b>
movsd  %xmm2,0x2eb6(%rip)
xorpd  0xe86(%rip),%xmm2
movapd %xmm2,%xmm0
call   1030 <exp@plt>
movsd  %xmm0,0x2ebd(%rip)
movsd  0xe5d(%rip),%xmm0
movsd  0xe3d(%rip),%xmm1
nopl   0x0(%rax,%rax,1)
movsd  %xmm1,(%rsp)
addsd  0xe2b(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
mov    %rbx,%rdi
call   1050 <ran1@plt>
movsd  (%rsp),%xmm1
mulsd  %xmm0,%xmm1
movsd  0x8(%rsp),%xmm0
ucomisd 0x2e76(%rip),%xmm1
ja     11d0 <poidev+0x60>
jmp    1354 <poidev+0x1e4>
ucomisd %xmm2,%xmm0
movapd %xmm2,0x10(%rsp)
jne    1217 <poidev+0xa7>
jnp    1290 <poidev+0x120>
movsd  %xmm2,0x2e39(%rip)
movapd %xmm2,%xmm0
addsd  %xmm2,%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1237 <poidev+0xc7>
sqrtsd %xmm0,%xmm0
jmp    1242 <poidev+0xd2>
call   1070 <sqrt@plt>
movapd 0x10(%rsp),%xmm2
movsd  %xmm0,0x2e1e(%rip)
movapd %xmm2,%xmm0
call   1060 <log@plt>
movsd  %xmm0,(%rsp)
movsd  %xmm0,0x2e10(%rip)
movsd  0xda0(%rip),%xmm0
addsd  0x10(%rsp),%xmm0
call   1080 <gammln@plt>
movsd  (%rsp),%xmm1
mulsd  0x10(%rsp),%xmm1
subsd  %xmm0,%xmm1
movsd  %xmm1,0x2dee(%rip)
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1050 <ran1@plt>
mulsd  0xd70(%rip),%xmm0
call   1040 <tan@plt>
movapd %xmm0,%xmm2
movsd  0x2db7(%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  0xd24(%rip),%xmm1
addsd  %xmm1,%xmm3
mulsd  0xd28(%rip),%xmm3
movsd  %xmm3,(%rsp)
addsd  %xmm1,%xmm0
movsd  0x2d6f(%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  0x2d50(%rip),%xmm1
movapd %xmm1,%xmm0
call   1030 <exp@plt>
mulsd  (%rsp),%xmm0
movsd  %xmm0,(%rsp)
mov    %rbx,%rdi
call   1050 <ran1@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
define double @poidev(double %0, i32* %1) {
%3 = alloca double
%4 = alloca i32*
%5 = alloca double
%6 = alloca double
%7 = alloca double
store double %0, double* %3
store i32* %1, i32** %4
%8 = load double, double* %3
%9 = fcmp olt double %8, 1.200000e+01
br i1 %9, label %10, label %32
10: ; preds = %2
%11 = load double, double* %3
%12 = load double, double* @poidev.oldm
%13 = fcmp une double %11, %12
br i1 %13, label %14, label %19
14: ; preds = %10
%15 = load double, double* %3
store double %15, double* @poidev.oldm
%16 = load double, double* %3
%17 = fneg double %16
%18 = call double @exp(double %17)
store double %18, double* @poidev.g
br label %19
19: ; preds = %14, %10
store double -1.000000e+00, double* %5
store double 1.000000e+00, double* %6
br label %20
20: ; preds = %27, %19
%21 = load double, double* %5
%22 = fadd double %21, 1.000000e+00
store double %22, double* %5
%23 = load i32*, i32** %4
%24 = call double @ran1(i32* %23)
%25 = load double, double* %6
%26 = fmul double %25, %24
store double %26, double* %6
br label %27
27: ; preds = %20
%28 = load double, double* %6
%29 = load double, double* @poidev.g
%30 = fcmp ogt double %28, %29
br i1 %30, label %20, label %31
31: ; preds = %27
br label %88
32: ; preds = %2
%33 = load double, double* %3
%34 = load double, double* @poidev.oldm
%35 = fcmp une double %33, %34
br i1 %35, label %36, label %50
36: ; preds = %32
%37 = load double, double* %3
store double %37, double* @poidev.oldm
%38 = load double, double* %3
%39 = fmul double 2.000000e+00, %38
%40 = call double @sqrt(double %39)
store double %40, double* @poidev.sq
%41 = load double, double* %3
%42 = call double @log(double %41)
store double %42, double* @poidev.alxm
%43 = load double, double* %3
%44 = load double, double* @poidev.alxm
%45 = load double, double* %3
%46 = fadd double %45, 1.000000e+00
%47 = call double @gammln(double %46)
%48 = fneg double %47
%49 = call double @llvm.fmuladd.f64(double %43, double %44, double %48)
store double %49, double* @poidev.g
br label %50
50: ; preds = %36, %32
br label %51
51: ; preds = %82, %50
br label %52
52: ; preds = %61, %51
%53 = load i32*, i32** %4
%54 = call double @ran1(i32* %53)
%55 = fmul double 0x400921FB54524550, %54
%56 = call double @tan(double %55)
store double %56, double* %7
%57 = load double, double* @poidev.sq
%58 = load double, double* %7
%59 = load double, double* %3
%60 = call double @llvm.fmuladd.f64(double %57, double %58, double %59)
store double %60, double* %5
br label %61
61: ; preds = %52
%62 = load double, double* %5
%63 = fcmp olt double %62, 0.000000e+00
br i1 %63, label %52, label %64
64: ; preds = %61
%65 = load double, double* %5
%66 = call double @llvm.floor.f64(double %65)
store double %66, double* %5
%67 = load double, double* %7
%68 = load double, double* %7
%69 = call double @llvm.fmuladd.f64(double %67, double %68, double 1.000000e+00)
%70 = fmul double 9.000000e-01, %69
%71 = load double, double* %5
%72 = load double, double* @poidev.alxm
%73 = load double, double* %5
%74 = fadd double %73, 1.000000e+00
%75 = call double @gammln(double %74)
%76 = fneg double %75
%77 = call double @llvm.fmuladd.f64(double %71, double %72, double %76)
%78 = load double, double* @poidev.g
%79 = fsub double %77, %78
%80 = call double @exp(double %79)
%81 = fmul double %70, %80
store double %81, double* %6
br label %82
82: ; preds = %64
%83 = load i32*, i32** %4
%84 = call double @ran1(i32* %83)
%85 = load double, double* %6
%86 = fcmp ogt double %84, %85
br i1 %86, label %51, label %87
87: ; preds = %82
br label %88
88: ; preds = %87, %31
%89 = load double, double* %5
ret double %89
}

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
define double @poidev(double %0, i32* %1) {
%3 = fcmp olt double %0, 1.200000e+01
%4 = load double, double* @poidev.oldm
%5 = fcmp une double %4, %0
br i1 %3, label %6, label %19
6: ; preds = %2
br i1 %5, label %7, label %10
7: ; preds = %6
store double %0, double* @poidev.oldm
%8 = fneg double %0
%9 = tail call double @exp(double %8)
store double %9, double* @poidev.g
br label %10
10: ; preds = %7, %6
br label %11
11: ; preds = %10, %11
%12 = phi double [ %16, %11 ], [ 1.000000e+00, %10 ]
%13 = phi double [ %14, %11 ], [ -1.000000e+00, %10 ]
%14 = fadd double %13, 1.000000e+00
%15 = tail call double @ran1(i32* %1)
%16 = fmul double %12, %15
%17 = load double, double* @poidev.g
%18 = fcmp ogt double %16, %17
br i1 %18, label %11, label %52
19: ; preds = %2
br i1 %5, label %20, label %28
20: ; preds = %19
store double %0, double* @poidev.oldm
%21 = fmul double %0, 2.000000e+00
%22 = tail call double @sqrt(double %21)
store double %22, double* @poidev.sq
%23 = tail call double @log(double %0)
store double %23, double* @poidev.alxm
%24 = fadd double %0, 1.000000e+00
%25 = tail call double @gammln(double %24)
%26 = fneg double %25
%27 = tail call double @llvm.fmuladd.f64(double %0, double %23, double %26)
store double %27, double* @poidev.g
br label %28
28: ; preds = %19, %20
br label %29
29: ; preds = %36, %28
%30 = tail call double @ran1(i32* %1)
%31 = fmul double %30, 0x400921FB54524550
%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 = %29, %37
br label %29
37: ; preds = %29
%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 @ran1(i32* %1)
%51 = fcmp ogt double %50, %49
br i1 %51, label %36, label %52
52: ; preds = %37, %11
%53 = phi double [ %14, %11 ], [ %38, %37 ]
ret double %53
}