#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(scalar_t__);
double fabs(double);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
scalar_t__ gammln(double);
int /*<<< orphan*/ stderr;
void gaulag(double *x, double *w, int n, double alf) {
  int i, its, j;
  double ai;
  double p1, p2, p3, pp, z1;
  double z = 0;
  double num = -exp(gammln(alf + n) - gammln((double)n));
  for (i = 1; i <= n; i++) {
    if (i == 1) {
      z = (1.0 + alf) * (3.0 + 0.92 * alf) / (1.0 + 2.4 * n + 1.8 * alf);
    } else if (i == 2) {
      z += (15.0 + 6.25 * alf) / (1.0 + 0.9 * alf + 2.5 * n);
    } else {
      ai = i - 2;
      z += ((1.0 + 2.55 * ai) / (1.9 * ai) +
            1.26 * ai * alf / (1.0 + 3.5 * ai)) *
           (z - x[i - 3]) / (1.0 + 0.3 * alf);
    }
    for (its = 1; its <= 10; its++) {
      p1 = 1.0;
      p2 = 0.0;
      for (j = 1; j <= n; j++) {
        p3 = p2;
        p2 = p1;
        p1 = ((2 * j - 1 + alf - z) * p2 - (j - 1 + alf) * p3) / j;
      }
      pp = (n * p1 - (n + alf) * p2) / z;
      z1 = z;
      z = z1 - p1 / pp;
      if (fabs(z - z1) <= 3.0e-14)
        break;
    }
    if (its > 10) {
      fprintf(stderr, "Too many iterations in gaulag\n");
    }
    x[i - 1] = z;
    w[i - 1] = num / (pp * n * p2);
  }
}


x86 assembly (clang, -O0):
<gaulag>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movsd  %xmm0,-0x20(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x20(%rbp),%xmm0
cvtsi2sdl -0x14(%rbp),%xmm1
addsd  %xmm1,%xmm0
call   1050 <gammln@plt>
mov    %rax,-0x78(%rbp)
cvtsi2sdl -0x14(%rbp),%xmm0
call   1050 <gammln@plt>
mov    -0x78(%rbp),%rdi
sub    %rax,%rdi
call   1040 <exp@plt>
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x70(%rbp)
movl   $0x1,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x14(%rbp),%eax
jg     151f <gaulag+0x3ef>
cmpl   $0x1,-0x24(%rbp)
jne    1227 <gaulag+0xf7>
movsd  0xe47(%rip),%xmm0
addsd  -0x20(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
movsd  0xe8d(%rip),%xmm2
mulsd  %xmm2,%xmm1
movsd  0xe89(%rip),%xmm2
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
cvtsi2sdl -0x14(%rbp),%xmm2
movsd  0xe64(%rip),%xmm1
mulsd  %xmm1,%xmm2
movsd  0xe08(%rip),%xmm1
addsd  %xmm1,%xmm2
movsd  -0x20(%rbp),%xmm1
movsd  0xe3f(%rip),%xmm3
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
jmp    1352 <gaulag+0x222>
cmpl   $0x2,-0x24(%rbp)
jne    1293 <gaulag+0x163>
movsd  -0x20(%rbp),%xmm0
movsd  0xe02(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xdfe(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  -0x20(%rbp),%xmm2
movsd  0xddd(%rip),%xmm1
mulsd  %xmm1,%xmm2
movsd  0xda1(%rip),%xmm1
addsd  %xmm1,%xmm2
cvtsi2sdl -0x14(%rbp),%xmm1
movsd  0xdb8(%rip),%xmm3
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
addsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
jmp    134d <gaulag+0x21d>
mov    -0x24(%rbp),%eax
sub    $0x2,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  0xd79(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xd4d(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  0xd59(%rip),%xmm1
mulsd  -0x38(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  0xd40(%rip),%xmm1
mulsd  -0x38(%rbp),%xmm1
mulsd  -0x20(%rbp),%xmm1
movsd  -0x38(%rbp),%xmm2
movsd  0xd21(%rip),%xmm3
mulsd  %xmm3,%xmm2
movsd  0xd0d(%rip),%xmm3
addsd  %xmm3,%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
movsd  -0x68(%rbp),%xmm1
mov    -0x8(%rbp),%rax
mov    -0x24(%rbp),%ecx
sub    $0x3,%ecx
movslq %ecx,%rcx
subsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm1,%xmm0
movsd  -0x20(%rbp),%xmm1
movsd  0xcd1(%rip),%xmm2
mulsd  %xmm2,%xmm1
movsd  0xccd(%rip),%xmm2
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
addsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
jmp    1352 <gaulag+0x222>
movl   $0x1,-0x28(%rbp)
cmpl   $0xa,-0x28(%rbp)
jg     14ad <gaulag+0x37d>
movsd  0xc9d(%rip),%xmm0
movsd  %xmm0,-0x40(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x48(%rbp)
movl   $0x1,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jg     140a <gaulag+0x2da>
movsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x2c(%rbp),%eax
shl    $0x1,%eax
sub    $0x1,%eax
cvtsi2sd %eax,%xmm0
addsd  -0x20(%rbp),%xmm0
subsd  -0x68(%rbp),%xmm0
movsd  -0x48(%rbp),%xmm2
mov    -0x2c(%rbp),%eax
sub    $0x1,%eax
cvtsi2sd %eax,%xmm1
addsd  -0x20(%rbp),%xmm1
mulsd  -0x50(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvtsi2sdl -0x2c(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    137f <gaulag+0x24f>
cvtsi2sdl -0x14(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm2
cvtsi2sdl -0x14(%rbp),%xmm1
addsd  -0x20(%rbp),%xmm1
mulsd  -0x48(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
divsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x60(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm1
divsd  -0x58(%rbp),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x68(%rbp),%xmm1
subsd  -0x60(%rbp),%xmm1
movaps 0xc01(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  0xbe5(%rip),%xmm0
ucomisd %xmm1,%xmm0
jb     149a <gaulag+0x36a>
jmp    14ad <gaulag+0x37d>
jmp    149f <gaulag+0x36f>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1359 <gaulag+0x229>
cmpl   $0xa,-0x28(%rbp)
jle    14cc <gaulag+0x39c>
mov    0x2b22(%rip),%rax
mov    (%rax),%edi
lea    0xbc9(%rip),%rsi
call   1030 <fprintf@plt>
movsd  -0x68(%rbp),%xmm0
mov    -0x8(%rbp),%rax
mov    -0x24(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x70(%rbp),%xmm0
movsd  -0x58(%rbp),%xmm1
cvtsi2sdl -0x14(%rbp),%xmm2
mulsd  %xmm2,%xmm1
mulsd  -0x48(%rbp),%xmm1
divsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
mov    -0x24(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11a3 <gaulag+0x73>
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gaulag>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x68,%rsp
movsd  %xmm0,0x8(%rsp)
mov    %edx,%ebx
mov    %rsi,%r14
mov    %rdi,%r15
cvtsi2sd %edx,%xmm1
movsd  %xmm1,(%rsp)
addsd  %xmm0,%xmm1
movapd %xmm1,0x10(%rsp)
movapd %xmm1,%xmm0
call   1050 <gammln@plt>
mov    %rax,%r12
movsd  (%rsp),%xmm0
call   1050 <gammln@plt>
sub    %rax,%r12
mov    %r12,%rdi
call   1040 <exp@plt>
movapd 0x10(%rsp),%xmm8
movsd  (%rsp),%xmm9
movsd  0x8(%rsp),%xmm7
movapd %xmm0,0x20(%rsp)
test   %ebx,%ebx
jle    148e <gaulag+0x35e>
movaps 0x20(%rsp),%xmm0
xorps  0xe53(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movsd  0xe66(%rip),%xmm2
mulsd  %xmm7,%xmm2
addsd  0xe62(%rip),%xmm2
movsd  0xe62(%rip),%xmm0
mulsd  %xmm7,%xmm0
movsd  0xe5d(%rip),%xmm11
addsd  %xmm11,%xmm0
movsd  0xe58(%rip),%xmm1
mulsd  %xmm9,%xmm1
addsd  %xmm0,%xmm1
divsd  %xmm1,%xmm2
movsd  %xmm2,0x48(%rsp)
movapd %xmm7,%xmm0
addsd  %xmm11,%xmm0
movsd  0xe3c(%rip),%xmm2
mulsd  %xmm7,%xmm2
addsd  0xe38(%rip),%xmm2
mulsd  %xmm0,%xmm2
movsd  0xe34(%rip),%xmm0
mulsd  %xmm9,%xmm0
addsd  %xmm11,%xmm0
movsd  0xe2a(%rip),%xmm1
mulsd  %xmm7,%xmm1
addsd  %xmm0,%xmm1
divsd  %xmm1,%xmm2
movsd  %xmm2,0x40(%rsp)
movsd  0xe18(%rip),%xmm0
mulsd  %xmm7,%xmm0
xorpd  0xda3(%rip),%xmm8
addsd  %xmm11,%xmm0
movsd  %xmm0,0x38(%rsp)
lea    0x1(%rbx),%r13d
xorpd  %xmm2,%xmm2
mov    $0x1,%ebp
movapd 0xd93(%rip),%xmm6
movsd  0xe0b(%rip),%xmm5
lea    0xe0c(%rip),%r12
movapd %xmm8,0x10(%rsp)
jmp    132f <gaulag+0x1ff>
nopl   0x0(%rax,%rax,1)
mov    0x2d39(%rip),%rax
mov    (%rax),%edi
mov    %r12,%rsi
movsd  %xmm2,0x60(%rsp)
movsd  %xmm4,0x58(%rsp)
movsd  %xmm3,0x50(%rsp)
call   1030 <fprintf@plt>
movsd  0x50(%rsp),%xmm3
movsd  0x58(%rsp),%xmm4
movsd  0x60(%rsp),%xmm2
movsd  0xdb3(%rip),%xmm5
movapd 0xd2b(%rip),%xmm6
movsd  0xd4a(%rip),%xmm11
movapd 0x10(%rsp),%xmm8
movsd  (%rsp),%xmm9
movsd  0x8(%rsp),%xmm7
movsd  %xmm2,-0x8(%r15,%rbp,8)
mulsd  %xmm9,%xmm3
mulsd  %xmm4,%xmm3
movapd 0x20(%rsp),%xmm0
divsd  %xmm3,%xmm0
movsd  %xmm0,-0x8(%r14,%rbp,8)
add    $0x1,%rbp
cmp    %r13,%rbp
je     148e <gaulag+0x35e>
cmp    $0x1,%ebp
je     1350 <gaulag+0x220>
cmp    $0x2,%ebp
jne    1360 <gaulag+0x230>
addsd  0x48(%rsp),%xmm2
mov    $0x1,%eax
movapd %xmm2,%xmm0
jmp    13e0 <gaulag+0x2b0>
nopl   (%rax)
movsd  0x40(%rsp),%xmm0
mov    %ebp,%eax
jmp    13e0 <gaulag+0x2b0>
nopl   (%rax)
lea    -0x2(%rbp),%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movapd %xmm0,%xmm1
mulsd  0xcfa(%rip),%xmm1
addsd  %xmm11,%xmm1
movapd %xmm0,%xmm10
mulsd  0xcef(%rip),%xmm10
movapd %xmm0,%xmm3
mulsd  0xceb(%rip),%xmm3
mulsd  %xmm7,%xmm3
unpcklpd %xmm3,%xmm1
mulsd  0xce3(%rip),%xmm0
addsd  %xmm11,%xmm0
unpcklpd %xmm0,%xmm10
divpd  %xmm10,%xmm1
movapd %xmm1,%xmm3
unpckhpd %xmm1,%xmm3
addsd  %xmm1,%xmm3
movapd %xmm2,%xmm0
subsd  -0x18(%r15,%rbp,8),%xmm0
mulsd  %xmm3,%xmm0
divsd  0x38(%rsp),%xmm0
addsd  %xmm2,%xmm0
mov    $0x1,%eax
xchg   %ax,%ax
xorpd  %xmm2,%xmm2
xor    %ecx,%ecx
mov    $0x1,%edx
movapd %xmm11,%xmm1
movapd %xmm1,%xmm4
xorps  %xmm1,%xmm1
cvtsi2sd %edx,%xmm1
addsd  %xmm7,%xmm1
subsd  %xmm0,%xmm1
xorps  %xmm3,%xmm3
cvtsi2sd %ecx,%xmm3
add    $0x1,%ecx
addsd  %xmm7,%xmm3
mulsd  %xmm2,%xmm3
mulsd  %xmm4,%xmm1
xorps  %xmm2,%xmm2
cvtsi2sd %ecx,%xmm2
subsd  %xmm3,%xmm1
divsd  %xmm2,%xmm1
add    $0x2,%edx
movapd %xmm4,%xmm2
cmp    %ecx,%ebx
jne    13f0 <gaulag+0x2c0>
movapd %xmm4,%xmm2
mulsd  %xmm8,%xmm2
movapd %xmm9,%xmm3
mulsd  %xmm1,%xmm3
addsd  %xmm2,%xmm3
divsd  %xmm0,%xmm3
divsd  %xmm3,%xmm1
movapd %xmm0,%xmm2
subsd  %xmm1,%xmm2
movapd %xmm2,%xmm1
subsd  %xmm0,%xmm1
andpd  %xmm6,%xmm1
ucomisd %xmm1,%xmm5
jae    1480 <gaulag+0x350>
add    $0x1,%eax
movapd %xmm2,%xmm0
cmp    $0xb,%eax
jne    13e0 <gaulag+0x2b0>
jmp    12a0 <gaulag+0x170>
cmp    $0xb,%eax
jae    12a0 <gaulag+0x170>
jmp    1301 <gaulag+0x1d1>
add    $0x68,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [31 x i8] c"Too many iterations in gaulag\0A\00"
define void @gaulag(double* %0, double* %1, i32 %2, double %3) {
%5 = alloca double*
%6 = alloca double*
%7 = alloca i32
%8 = alloca double
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca double
%16 = alloca double
%17 = alloca double
%18 = alloca double
%19 = alloca double
store double* %0, double** %5
store double* %1, double** %6
store i32 %2, i32* %7
store double %3, double* %8
store double 0.000000e+00, double* %18
%20 = load double, double* %8
%21 = load i32, i32* %7
%22 = sitofp i32 %21 to double
%23 = fadd double %20, %22
%24 = call i64 @gammln(double %23)
%25 = load i32, i32* %7
%26 = sitofp i32 %25 to double
%27 = call i64 @gammln(double %26)
%28 = sub nsw i64 %24, %27
%29 = call double @exp(i64 %28)
%30 = fneg double %29
store double %30, double* %19
store i32 1, i32* %9
br label %31
31: ; preds = %188, %4
%32 = load i32, i32* %9
%33 = load i32, i32* %7
%34 = icmp sle i32 %32, %33
br i1 %34, label %35, label %191
35: ; preds = %31
%36 = load i32, i32* %9
%37 = icmp eq i32 %36, 1
br i1 %37, label %38, label %50
38: ; preds = %35
%39 = load double, double* %8
%40 = fadd double 1.000000e+00, %39
%41 = load double, double* %8
%42 = call double @llvm.fmuladd.f64(double 9.200000e-01, double %41, double 3.000000e+00)
%43 = fmul double %40, %42
%44 = load i32, i32* %7
%45 = sitofp i32 %44 to double
%46 = call double @llvm.fmuladd.f64(double 2.400000e+00, double %45, double 1.000000e+00)
%47 = load double, double* %8
%48 = call double @llvm.fmuladd.f64(double 1.800000e+00, double %47, double %46)
%49 = fdiv double %43, %48
store double %49, double* %18
br label %96
50: ; preds = %35
%51 = load i32, i32* %9
%52 = icmp eq i32 %51, 2
br i1 %52, label %53, label %64
53: ; preds = %50
%54 = load double, double* %8
%55 = call double @llvm.fmuladd.f64(double 6.250000e+00, double %54, double 1.500000e+01)
%56 = load double, double* %8
%57 = call double @llvm.fmuladd.f64(double 9.000000e-01, double %56, double 1.000000e+00)
%58 = load i32, i32* %7
%59 = sitofp i32 %58 to double
%60 = call double @llvm.fmuladd.f64(double 2.500000e+00, double %59, double %57)
%61 = fdiv double %55, %60
%62 = load double, double* %18
%63 = fadd double %62, %61
store double %63, double* %18
br label %95
64: ; preds = %50
%65 = load i32, i32* %9
%66 = sub nsw i32 %65, 2
%67 = sitofp i32 %66 to double
store double %67, double* %12
%68 = load double, double* %12
%69 = call double @llvm.fmuladd.f64(double 2.550000e+00, double %68, double 1.000000e+00)
%70 = load double, double* %12
%71 = fmul double 1.900000e+00, %70
%72 = fdiv double %69, %71
%73 = load double, double* %12
%74 = fmul double 1.260000e+00, %73
%75 = load double, double* %8
%76 = fmul double %74, %75
%77 = load double, double* %12
%78 = call double @llvm.fmuladd.f64(double 3.500000e+00, double %77, double 1.000000e+00)
%79 = fdiv double %76, %78
%80 = fadd double %72, %79
%81 = load double, double* %18
%82 = load double*, double** %5
%83 = load i32, i32* %9
%84 = sub nsw i32 %83, 3
%85 = sext i32 %84 to i64
%86 = getelementptr inbounds double, double* %82, i64 %85
%87 = load double, double* %86
%88 = fsub double %81, %87
%89 = fmul double %80, %88
%90 = load double, double* %8
%91 = call double @llvm.fmuladd.f64(double 3.000000e-01, double %90, double 1.000000e+00)
%92 = fdiv double %89, %91
%93 = load double, double* %18
%94 = fadd double %93, %92
store double %94, double* %18
br label %95
95: ; preds = %64, %53
br label %96
96: ; preds = %95, %38
store i32 1, i32* %10
br label %97
97: ; preds = %159, %96
%98 = load i32, i32* %10
%99 = icmp sle i32 %98, 10
br i1 %99, label %100, label %162
100: ; preds = %97
store double 1.000000e+00, double* %13
store double 0.000000e+00, double* %14
store i32 1, i32* %11
br label %101
101: ; preds = %129, %100
%102 = load i32, i32* %11
%103 = load i32, i32* %7
%104 = icmp sle i32 %102, %103
br i1 %104, label %105, label %132
105: ; preds = %101
%106 = load double, double* %14
store double %106, double* %15
%107 = load double, double* %13
store double %107, double* %14
%108 = load i32, i32* %11
%109 = mul nsw i32 2, %108
%110 = sub nsw i32 %109, 1
%111 = sitofp i32 %110 to double
%112 = load double, double* %8
%113 = fadd double %111, %112
%114 = load double, double* %18
%115 = fsub double %113, %114
%116 = load double, double* %14
%117 = load i32, i32* %11
%118 = sub nsw i32 %117, 1
%119 = sitofp i32 %118 to double
%120 = load double, double* %8
%121 = fadd double %119, %120
%122 = load double, double* %15
%123 = fmul double %121, %122
%124 = fneg double %123
%125 = call double @llvm.fmuladd.f64(double %115, double %116, double %124)
%126 = load i32, i32* %11
%127 = sitofp i32 %126 to double
%128 = fdiv double %125, %127
store double %128, double* %13
br label %129
129: ; preds = %105
%130 = load i32, i32* %11
%131 = add nsw i32 %130, 1
store i32 %131, i32* %11
br label %101
132: ; preds = %101
%133 = load i32, i32* %7
%134 = sitofp i32 %133 to double
%135 = load double, double* %13
%136 = load i32, i32* %7
%137 = sitofp i32 %136 to double
%138 = load double, double* %8
%139 = fadd double %137, %138
%140 = load double, double* %14
%141 = fmul double %139, %140
%142 = fneg double %141
%143 = call double @llvm.fmuladd.f64(double %134, double %135, double %142)
%144 = load double, double* %18
%145 = fdiv double %143, %144
store double %145, double* %16
%146 = load double, double* %18
store double %146, double* %17
%147 = load double, double* %17
%148 = load double, double* %13
%149 = load double, double* %16
%150 = fdiv double %148, %149
%151 = fsub double %147, %150
store double %151, double* %18
%152 = load double, double* %18
%153 = load double, double* %17
%154 = fsub double %152, %153
%155 = call double @llvm.fabs.f64(double %154)
%156 = fcmp ole double %155, 3.000000e-14
br i1 %156, label %157, label %158
157: ; preds = %132
br label %162
158: ; preds = %132
br label %159
159: ; preds = %158
%160 = load i32, i32* %10
%161 = add nsw i32 %160, 1
store i32 %161, i32* %10
br label %97
162: ; preds = %157, %97
%163 = load i32, i32* %10
%164 = icmp sgt i32 %163, 10
br i1 %164, label %165, label %168
165: ; preds = %162
%166 = load i32, i32* @stderr
%167 = call i32 @fprintf(i32 %166, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
br label %168
168: ; preds = %165, %162
%169 = load double, double* %18
%170 = load double*, double** %5
%171 = load i32, i32* %9
%172 = sub nsw i32 %171, 1
%173 = sext i32 %172 to i64
%174 = getelementptr inbounds double, double* %170, i64 %173
store double %169, double* %174
%175 = load double, double* %19
%176 = load double, double* %16
%177 = load i32, i32* %7
%178 = sitofp i32 %177 to double
%179 = fmul double %176, %178
%180 = load double, double* %14
%181 = fmul double %179, %180
%182 = fdiv double %175, %181
%183 = load double*, double** %6
%184 = load i32, i32* %9
%185 = sub nsw i32 %184, 1
%186 = sext i32 %185 to i64
%187 = getelementptr inbounds double, double* %183, i64 %186
store double %182, double* %187
br label %188
188: ; preds = %168
%189 = load i32, i32* %9
%190 = add nsw i32 %189, 1
store i32 %190, i32* %9
br label %31
191: ; preds = %31
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [31 x i8] c"Too many iterations in gaulag\0A\00"
define void @gaulag(double* nocapture %0, double* nocapture writeonly %1, i32 %2, double %3) {
%5 = sitofp i32 %2 to double
%6 = fadd double %5, %3
%7 = tail call i64 @gammln(double %6)
%8 = tail call i64 @gammln(double %5)
%9 = sub nsw i64 %7, %8
%10 = tail call double @exp(i64 %9)
%11 = fneg double %10
%12 = icmp slt i32 %2, 1
br i1 %12, label %109, label %13
13: ; preds = %4
%14 = tail call double @llvm.fmuladd.f64(double %3, double 6.250000e+00, double 1.500000e+01)
%15 = tail call double @llvm.fmuladd.f64(double %3, double 9.000000e-01, double 1.000000e+00)
%16 = tail call double @llvm.fmuladd.f64(double %5, double 2.500000e+00, double %15)
%17 = fdiv double %14, %16
%18 = fadd double %3, 1.000000e+00
%19 = tail call double @llvm.fmuladd.f64(double %3, double 9.200000e-01, double 3.000000e+00)
%20 = fmul double %18, %19
%21 = tail call double @llvm.fmuladd.f64(double %5, double 2.400000e+00, double 1.000000e+00)
%22 = tail call double @llvm.fmuladd.f64(double %3, double 1.800000e+00, double %21)
%23 = fdiv double %20, %22
%24 = tail call double @llvm.fmuladd.f64(double %3, double 3.000000e-01, double 1.000000e+00)
%25 = fneg double %6
%26 = add nuw i32 %2, 1
%27 = zext i32 %26 to i64
br label %28
28: ; preds = %13, %100
%29 = phi i64 [ 1, %13 ], [ %107, %100 ]
%30 = phi double [ 0.000000e+00, %13 ], [ %88, %100 ]
%31 = trunc i64 %29 to i32
switch i32 %31, label %34 [
i32 1, label %58
i32 2, label %32
]
32: ; preds = %28
%33 = fadd double %17, %30
br label %58
34: ; preds = %28
%35 = trunc i64 %29 to i32
%36 = add i32 %35, -2
%37 = sitofp i32 %36 to double
%38 = tail call double @llvm.fmuladd.f64(double %37, double 2.550000e+00, double 1.000000e+00)
%39 = fmul double %37, 1.900000e+00
%40 = fmul double %37, 1.260000e+00
%41 = fmul double %40, %3
%42 = tail call double @llvm.fmuladd.f64(double %37, double 3.500000e+00, double 1.000000e+00)
%43 = insertelement <2 x double> poison, double %38, i64 0
%44 = insertelement <2 x double> %43, double %41, i64 1
%45 = insertelement <2 x double> poison, double %39, i64 0
%46 = insertelement <2 x double> %45, double %42, i64 1
%47 = fdiv <2 x double> %44, %46
%48 = shufflevector <2 x double> %47, <2 x double> poison, <2 x i32> <i32 1, i32 undef>
%49 = fadd <2 x double> %47, %48
%50 = extractelement <2 x double> %49, i64 0
%51 = add nsw i64 %29, -3
%52 = getelementptr inbounds double, double* %0, i64 %51
%53 = load double, double* %52
%54 = fsub double %30, %53
%55 = fmul double %50, %54
%56 = fdiv double %55, %24
%57 = fadd double %30, %56
br label %58
58: ; preds = %28, %32, %34
%59 = phi double [ %23, %28 ], [ %57, %34 ], [ %33, %32 ]
%60 = phi i32 [ %31, %28 ], [ 1, %34 ], [ 1, %32 ]
br label %61
61: ; preds = %58, %92
%62 = phi double [ %88, %92 ], [ %59, %58 ]
%63 = phi i32 [ %93, %92 ], [ %60, %58 ]
br label %64
64: ; preds = %61, %64
%65 = phi i32 [ %81, %64 ], [ 1, %61 ]
%66 = phi double [ %67, %64 ], [ 0.000000e+00, %61 ]
%67 = phi double [ %80, %64 ], [ 1.000000e+00, %61 ]
%68 = shl nuw nsw i32 %65, 1
%69 = add nsw i32 %68, -1
%70 = sitofp i32 %69 to double
%71 = fadd double %70, %3
%72 = fsub double %71, %62
%73 = add nsw i32 %65, -1
%74 = sitofp i32 %73 to double
%75 = fadd double %74, %3
%76 = fneg double %75
%77 = fmul double %66, %76
%78 = tail call double @llvm.fmuladd.f64(double %72, double %67, double %77)
%79 = sitofp i32 %65 to double
%80 = fdiv double %78, %79
%81 = add nuw i32 %65, 1
%82 = icmp eq i32 %65, %2
br i1 %82, label %83, label %64
83: ; preds = %64
%84 = fmul double %67, %25
%85 = tail call double @llvm.fmuladd.f64(double %5, double %80, double %84)
%86 = fdiv double %85, %62
%87 = fdiv double %80, %86
%88 = fsub double %62, %87
%89 = fsub double %88, %62
%90 = tail call double @llvm.fabs.f64(double %89)
%91 = fcmp ugt double %90, 3.000000e-14
br i1 %91, label %92, label %95
92: ; preds = %83
%93 = add nuw nsw i32 %63, 1
%94 = icmp eq i32 %93, 11
br i1 %94, label %97, label %61
95: ; preds = %83
%96 = icmp ugt i32 %63, 10
br i1 %96, label %97, label %100
97: ; preds = %92, %95
%98 = load i32, i32* @stderr
%99 = tail call i32 @fprintf(i32 %98, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
br label %100
100: ; preds = %97, %95
%101 = add nsw i64 %29, -1
%102 = getelementptr inbounds double, double* %0, i64 %101
store double %88, double* %102
%103 = fmul double %86, %5
%104 = fmul double %103, %67
%105 = fdiv double %11, %104
%106 = getelementptr inbounds double, double* %1, i64 %101
store double %105, double* %106
%107 = add nuw nsw i64 %29, 1
%108 = icmp eq i64 %107, %27
br i1 %108, label %109, label %28
109: ; preds = %100, %4
ret void
}