#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*/ DiscreteGamma(double *, double *, double, double, int,
                                 int /*<<< orphan*/);
int /*<<< orphan*/ MultiNomialAlias(int, int, double *, int *, int *);
int /*<<< orphan*/ MultiNomialAliasSetTable(int, double *, double *, int *,
                                            double *);
int /*<<< orphan*/ abyx(int, double *, int);
double rndgamma(double);
int Rates4Sites(double rates[], double alpha, int ncatG, int ls, int cdf,
                double space[]) {
  int h, ir, j, K = ncatG, *Lalias = (int *)(space + 3 * K),
                *counts = (int *)(space + 4 * K);
  double *rK = space, *freqK = space + K, *Falias = space + 2 * K;
  if (alpha == 0) {
    if (rates)
      for (h = 0; h < ls; h++)
        rates[h] = 1;
  } else {
    if (K > 1) {
      DiscreteGamma(freqK, rK, alpha, alpha, K, 0);
      MultiNomialAliasSetTable(K, freqK, Falias, Lalias, space + 5 * K);
      MultiNomialAlias(ls, K, Falias, Lalias, counts);
      for (ir = 0, h = 0; ir < K; ir++)
        for (j = 0; j < counts[ir]; j++)
          rates[h++] = rK[ir];
    } else
      for (h = 0; h < ls; h++)
        rates[h] = rndgamma(alpha) / alpha;
    if (cdf) {
      for (h = 1; h < ls; h++)
        rates[h] += rates[h - 1];
      abyx(1 / rates[ls - 1], rates, ls);
    }
  }
  return (0);
}


x86 assembly (clang, -O0):
<Rates4Sites>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x38(%rbp)
mov    -0x28(%rbp),%rax
imul   $0x3,-0x38(%rbp),%ecx
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x40(%rbp)
mov    -0x28(%rbp),%rax
mov    -0x38(%rbp),%ecx
shl    $0x2,%ecx
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x48(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    -0x28(%rbp),%rax
movslq -0x38(%rbp),%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x58(%rbp)
mov    -0x28(%rbp),%rax
mov    -0x38(%rbp),%ecx
shl    $0x1,%ecx
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x60(%rbp)
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1238 <Rates4Sites+0xe8>
jp     1238 <Rates4Sites+0xe8>
cmpq   $0x0,-0x8(%rbp)
je     1233 <Rates4Sites+0xe3>
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    122e <Rates4Sites+0xde>
mov    -0x8(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  0xde5(%rip),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    11ff <Rates4Sites+0xaf>
jmp    1233 <Rates4Sites+0xe3>
jmp    13d9 <Rates4Sites+0x289>
cmpl   $0x1,-0x38(%rbp)
jle    1319 <Rates4Sites+0x1c9>
mov    -0x58(%rbp),%rdi
mov    -0x50(%rbp),%rsi
movsd  -0x10(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
mov    -0x38(%rbp),%edx
xor    %ecx,%ecx
call   1050 <DiscreteGamma@plt>
mov    -0x38(%rbp),%edi
mov    -0x58(%rbp),%rsi
mov    -0x60(%rbp),%rdx
mov    -0x40(%rbp),%rcx
mov    -0x28(%rbp),%r8
imul   $0x5,-0x38(%rbp),%eax
cltq
shl    $0x3,%rax
add    %rax,%r8
call   1030 <MultiNomialAliasSetTable@plt>
mov    -0x18(%rbp),%edi
mov    -0x38(%rbp),%esi
mov    -0x60(%rbp),%rdx
mov    -0x40(%rbp),%rcx
mov    -0x48(%rbp),%r8
call   1060 <MultiNomialAlias@plt>
movl   $0x0,-0x30(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0x38(%rbp),%eax
jge    1314 <Rates4Sites+0x1c4>
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
mov    -0x48(%rbp),%rcx
movslq -0x30(%rbp),%rdx
cmp    (%rcx,%rdx,4),%eax
jge    1301 <Rates4Sites+0x1b1>
mov    -0x50(%rbp),%rax
movslq -0x30(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x8(%rbp),%rax
mov    -0x2c(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x2c(%rbp)
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    12bb <Rates4Sites+0x16b>
jmp    1306 <Rates4Sites+0x1b6>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    12a8 <Rates4Sites+0x158>
jmp    135b <Rates4Sites+0x20b>
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    1356 <Rates4Sites+0x206>
movsd  -0x10(%rbp),%xmm0
call   1040 <rndgamma@plt>
divsd  -0x10(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1320 <Rates4Sites+0x1d0>
jmp    135b <Rates4Sites+0x20b>
cmpl   $0x0,-0x1c(%rbp)
je     13d4 <Rates4Sites+0x284>
movl   $0x1,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    13aa <Rates4Sites+0x25a>
mov    -0x8(%rbp),%rax
mov    -0x2c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x8(%rbp),%rax
movslq -0x2c(%rbp),%rcx
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    136c <Rates4Sites+0x21c>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  0xc41(%rip),%xmm0
divsd  (%rax,%rcx,8),%xmm0
cvttsd2si %xmm0,%edi
mov    -0x8(%rbp),%rsi
mov    -0x18(%rbp),%edx
call   1070 <abyx@plt>
jmp    13d9 <Rates4Sites+0x289>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Rates4Sites>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %r8,%rbp
mov    %edx,%r8d
movapd %xmm0,%xmm1
mov    %rdi,%rbx
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm1
jne    119d <Rates4Sites+0x4d>
jp     119d <Rates4Sites+0x4d>
test   %rbx,%rbx
je     162d <Rates4Sites+0x4dd>
test   %r8d,%r8d
jle    162d <Rates4Sites+0x4dd>
mov    %r8d,%eax
cmp    $0x4,%r8d
jae    1515 <Rates4Sites+0x3c5>
xor    %ecx,%ecx
jmp    1609 <Rates4Sites+0x4b9>
mov    %esi,%r13d
cmp    $0x1,%esi
mov    %r8d,0xc(%rsp)
mov    %ecx,0x1c(%rsp)
jle    1412 <Rates4Sites+0x2c2>
lea    0x0(%r13,%r13,2),%eax
cltq
lea    0x0(,%rax,8),%rax
add    %rbp,%rax
mov    %rax,0x30(%rsp)
lea    0x0(,%r13,4),%eax
cltq
lea    0x0(%rbp,%rax,8),%r12
movslq %r13d,%rax
lea    0x0(,%rax,8),%rdi
add    %rbp,%rdi
mov    %rdi,0x28(%rsp)
add    %eax,%eax
cltq
lea    0x0(,%rax,8),%r15
add    %rbp,%r15
mov    %r15,0x20(%rsp)
xor    %r14d,%r14d
mov    %rbp,%rsi
movapd %xmm1,%xmm0
mov    %r13d,%edx
xor    %ecx,%ecx
call   1050 <DiscreteGamma@plt>
lea    0x0(%r13,%r13,4),%eax
cltq
lea    0x0(,%rax,8),%r8
add    %rbp,%r8
mov    %r13d,%edi
mov    0x28(%rsp),%rsi
mov    %r15,%rdx
mov    0x30(%rsp),%r15
mov    %r15,%rcx
call   1030 <MultiNomialAliasSetTable@plt>
mov    0xc(%rsp),%edi
mov    %r13d,%esi
mov    0x20(%rsp),%rdx
mov    %r15,%rcx
mov    %r12,%r8
call   1060 <MultiNomialAlias@plt>
mov    %r13d,%r10d
lea    0x8(%rbx),%r9
lea    0x30(%rbx),%rax
mov    %rax,0x10(%rsp)
movabs $0x7ffffffffffffff8,%r8
ff ff 7f
add    $0x6,%r8
xor    %esi,%esi
jmp    128d <Rates4Sites+0x13d>
cs nopw 0x0(%rax,%rax,1)
add    $0x1,%r14
cmp    %r10,%r14
je     1451 <Rates4Sites+0x301>
mov    (%r12,%r14,4),%edi
test   %edi,%edi
jle    1280 <Rates4Sites+0x130>
movslq %esi,%rsi
lea    -0x1(%rdi),%r15d
xor    %r13d,%r13d
cmp    $0x3,%r15d
jb     1370 <Rates4Sites+0x220>
lea    0x8(,%r14,8),%rax
add    %rbp,%rax
lea    (%rbx,%rsi,8),%rcx
cmp    %rax,%rcx
jae    12d9 <Rates4Sites+0x189>
lea    0x0(,%r14,8),%rax
add    %rbp,%rax
lea    (%rsi,%r15,1),%rcx
lea    (%r9,%rcx,8),%rcx
cmp    %rcx,%rax
jb     1370 <Rates4Sites+0x220>
add    $0x1,%r15
mov    %r15,%r13
and    $0xfffffffffffffffc,%r13
lea    -0x4(%r13),%rax
mov    %rax,%r11
shr    $0x2,%r11
add    $0x1,%r11
test   %rax,%rax
je     1401 <Rates4Sites+0x2b1>
mov    %r11,%rcx
and    %r8,%rcx
movsd  0x0(%rbp,%r14,8),%xmm0
unpcklpd %xmm0,%xmm0
mov    0x10(%rsp),%rax
lea    (%rax,%rsi,8),%rdx
xor    %eax,%eax
nopl   0x0(%rax,%rax,1)
movupd %xmm0,-0x30(%rdx,%rax,8)
movupd %xmm0,-0x20(%rdx,%rax,8)
movupd %xmm0,-0x10(%rdx,%rax,8)
movupd %xmm0,(%rdx,%rax,8)
add    $0x8,%rax
add    $0xfffffffffffffffe,%rcx
jne    1320 <Rates4Sites+0x1d0>
test   $0x1,%r11b
je     1360 <Rates4Sites+0x210>
add    %rsi,%rax
movsd  0x0(%rbp,%r14,8),%xmm0
unpcklpd %xmm0,%xmm0
movupd %xmm0,(%rbx,%rax,8)
movupd %xmm0,0x10(%rbx,%rax,8)
add    %r13,%rsi
cmp    %r13,%r15
je     1280 <Rates4Sites+0x130>
nopl   0x0(%rax)
mov    %edi,%eax
sub    %r13d,%eax
mov    %r13d,%r11d
not    %r11d
add    %edi,%r11d
and    $0x3,%eax
je     13ad <Rates4Sites+0x25d>
lea    (%rbx,%rsi,8),%rcx
neg    %eax
xor    %edx,%edx
nopl   0x0(%rax,%rax,1)
movsd  0x0(%rbp,%r14,8),%xmm0
movsd  %xmm0,(%rcx)
add    $0x8,%rcx
add    $0xffffffffffffffff,%rdx
cmp    %edx,%eax
jne    1390 <Rates4Sites+0x240>
sub    %rdx,%rsi
sub    %edx,%r13d
cmp    $0x3,%r11d
jb     1280 <Rates4Sites+0x130>
sub    %r13d,%edi
nopw   0x0(%rax,%rax,1)
movsd  0x0(%rbp,%r14,8),%xmm0
movsd  %xmm0,(%rbx,%rsi,8)
movsd  0x0(%rbp,%r14,8),%xmm0
movsd  %xmm0,0x8(%rbx,%rsi,8)
movsd  0x0(%rbp,%r14,8),%xmm0
movsd  %xmm0,0x10(%rbx,%rsi,8)
movsd  0x0(%rbp,%r14,8),%xmm0
movsd  %xmm0,0x18(%rbx,%rsi,8)
add    $0x4,%rsi
add    $0xfffffffc,%edi
jne    13c0 <Rates4Sites+0x270>
jmp    1280 <Rates4Sites+0x130>
xor    %eax,%eax
test   $0x1,%r11b
jne    1347 <Rates4Sites+0x1f7>
jmp    1360 <Rates4Sites+0x210>
test   %r8d,%r8d
jle    1451 <Rates4Sites+0x301>
mov    0xc(%rsp),%r14d
xor    %ebp,%ebp
movsd  %xmm1,0x10(%rsp)
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movapd %xmm1,%xmm0
call   1040 <rndgamma@plt>
movsd  0x10(%rsp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,(%rbx,%rbp,8)
add    $0x1,%rbp
cmp    %rbp,%r14
jne    1430 <Rates4Sites+0x2e0>
cmpl   $0x0,0x1c(%rsp)
mov    0xc(%rsp),%edx
je     162d <Rates4Sites+0x4dd>
cmp    $0x2,%edx
jl     14f3 <Rates4Sites+0x3a3>
mov    %edx,%esi
movsd  (%rbx),%xmm0
lea    -0x1(%rsi),%rdi
add    $0xfffffffffffffffe,%rsi
mov    %edi,%eax
and    $0x3,%eax
mov    $0x1,%ecx
cmp    $0x3,%rsi
jb     14cd <Rates4Sites+0x37d>
and    $0xfffffffffffffffc,%rdi
xor    %ecx,%ecx
nopl   (%rax)
addsd  0x8(%rbx,%rcx,8),%xmm0
movsd  %xmm0,0x8(%rbx,%rcx,8)
addsd  0x10(%rbx,%rcx,8),%xmm0
movsd  %xmm0,0x10(%rbx,%rcx,8)
addsd  0x18(%rbx,%rcx,8),%xmm0
movsd  %xmm0,0x18(%rbx,%rcx,8)
addsd  0x20(%rbx,%rcx,8),%xmm0
movsd  %xmm0,0x20(%rbx,%rcx,8)
add    $0x4,%rcx
cmp    %rcx,%rdi
jne    1490 <Rates4Sites+0x340>
add    $0x1,%rcx
test   %rax,%rax
je     14f3 <Rates4Sites+0x3a3>
lea    (%rbx,%rcx,8),%rcx
xor    %esi,%esi
nopl   0x0(%rax,%rax,1)
addsd  (%rcx,%rsi,8),%xmm0
movsd  %xmm0,(%rcx,%rsi,8)
add    $0x1,%rsi
cmp    %rsi,%rax
jne    14e0 <Rates4Sites+0x390>
movslq %edx,%rax
movsd  0xb02(%rip),%xmm0
divsd  -0x8(%rbx,%rax,8),%xmm0
cvttsd2si %xmm0,%edi
mov    %rbx,%rsi
call   1070 <abyx@plt>
jmp    162d <Rates4Sites+0x4dd>
mov    %eax,%ecx
and    $0xfffffffc,%ecx
lea    -0x4(%rcx),%rdi
mov    %rdi,%rsi
shr    $0x2,%rsi
add    $0x1,%rsi
mov    %esi,%edx
and    $0x7,%edx
cmp    $0x1c,%rdi
jae    153b <Rates4Sites+0x3eb>
xor    %edi,%edi
jmp    15d5 <Rates4Sites+0x485>
and    $0xfffffffffffffff8,%rsi
xor    %edi,%edi
movapd 0xac7(%rip),%xmm0
nopl   0x0(%rax)
movupd %xmm0,(%rbx,%rdi,8)
movupd %xmm0,0x10(%rbx,%rdi,8)
movupd %xmm0,0x20(%rbx,%rdi,8)
movupd %xmm0,0x30(%rbx,%rdi,8)
movupd %xmm0,0x40(%rbx,%rdi,8)
movupd %xmm0,0x50(%rbx,%rdi,8)
movupd %xmm0,0x60(%rbx,%rdi,8)
movupd %xmm0,0x70(%rbx,%rdi,8)
movupd %xmm0,0x80(%rbx,%rdi,8)
movupd %xmm0,0x90(%rbx,%rdi,8)
movupd %xmm0,0xa0(%rbx,%rdi,8)
movupd %xmm0,0xb0(%rbx,%rdi,8)
movupd %xmm0,0xc0(%rbx,%rdi,8)
movupd %xmm0,0xd0(%rbx,%rdi,8)
movupd %xmm0,0xe0(%rbx,%rdi,8)
movupd %xmm0,0xf0(%rbx,%rdi,8)
add    $0x20,%rdi
add    $0xfffffffffffffff8,%rsi
jne    1550 <Rates4Sites+0x400>
test   %rdx,%rdx
je     1604 <Rates4Sites+0x4b4>
lea    (%rbx,%rdi,8),%rsi
add    $0x10,%rsi
shl    $0x5,%rdx
xor    %edi,%edi
movapd 0xa20(%rip),%xmm0
movupd %xmm0,-0x10(%rsi,%rdi,1)
movupd %xmm0,(%rsi,%rdi,1)
add    $0x20,%rdi
cmp    %rdi,%rdx
jne    15f0 <Rates4Sites+0x4a0>
cmp    %rax,%rcx
je     162d <Rates4Sites+0x4dd>
movabs $0x3ff0000000000000,%rdx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %rdx,(%rbx,%rcx,8)
add    $0x1,%rcx
cmp    %rcx,%rax
jne    1620 <Rates4Sites+0x4d0>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @Rates4Sites(double* %0, double %1, i32 %2, i32 %3, i32 %4, double* %5) {
%7 = alloca double*
%8 = alloca double
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca double*
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32*
%18 = alloca i32*
%19 = alloca double*
%20 = alloca double*
%21 = alloca double*
store double* %0, double** %7
store double %1, double* %8
store i32 %2, i32* %9
store i32 %3, i32* %10
store i32 %4, i32* %11
store double* %5, double** %12
%22 = load i32, i32* %9
store i32 %22, i32* %16
%23 = load double*, double** %12
%24 = load i32, i32* %16
%25 = mul nsw i32 3, %24
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds double, double* %23, i64 %26
%28 = bitcast double* %27 to i32*
store i32* %28, i32** %17
%29 = load double*, double** %12
%30 = load i32, i32* %16
%31 = mul nsw i32 4, %30
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds double, double* %29, i64 %32
%34 = bitcast double* %33 to i32*
store i32* %34, i32** %18
%35 = load double*, double** %12
store double* %35, double** %19
%36 = load double*, double** %12
%37 = load i32, i32* %16
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds double, double* %36, i64 %38
store double* %39, double** %20
%40 = load double*, double** %12
%41 = load i32, i32* %16
%42 = mul nsw i32 2, %41
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds double, double* %40, i64 %43
store double* %44, double** %21
%45 = load double, double* %8
%46 = fcmp oeq double %45, 0.000000e+00
br i1 %46, label %47, label %65
47: ; preds = %6
%48 = load double*, double** %7
%49 = icmp ne double* %48, null
br i1 %49, label %50, label %64
50: ; preds = %47
store i32 0, i32* %13
br label %51
51: ; preds = %60, %50
%52 = load i32, i32* %13
%53 = load i32, i32* %10
%54 = icmp slt i32 %52, %53
br i1 %54, label %55, label %63
55: ; preds = %51
%56 = load double*, double** %7
%57 = load i32, i32* %13
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds double, double* %56, i64 %58
store double 1.000000e+00, double* %59
br label %60
60: ; preds = %55
%61 = load i32, i32* %13
%62 = add nsw i32 %61, 1
store i32 %62, i32* %13
br label %51
63: ; preds = %51
br label %64
64: ; preds = %63, %47
br label %178
65: ; preds = %6
%66 = load i32, i32* %16
%67 = icmp sgt i32 %66, 1
br i1 %67, label %68, label %123
68: ; preds = %65
%69 = load double*, double** %20
%70 = load double*, double** %19
%71 = load double, double* %8
%72 = load double, double* %8
%73 = load i32, i32* %16
%74 = call i32 @DiscreteGamma(double* %69, double* %70, double %71, double %72, i32 %73, i32 0)
%75 = load i32, i32* %16
%76 = load double*, double** %20
%77 = load double*, double** %21
%78 = load i32*, i32** %17
%79 = load double*, double** %12
%80 = load i32, i32* %16
%81 = mul nsw i32 5, %80
%82 = sext i32 %81 to i64
%83 = getelementptr inbounds double, double* %79, i64 %82
%84 = call i32 @MultiNomialAliasSetTable(i32 %75, double* %76, double* %77, i32* %78, double* %83)
%85 = load i32, i32* %10
%86 = load i32, i32* %16
%87 = load double*, double** %21
%88 = load i32*, i32** %17
%89 = load i32*, i32** %18
%90 = call i32 @MultiNomialAlias(i32 %85, i32 %86, double* %87, i32* %88, i32* %89)
store i32 0, i32* %14
store i32 0, i32* %13
br label %91
91: ; preds = %119, %68
%92 = load i32, i32* %14
%93 = load i32, i32* %16
%94 = icmp slt i32 %92, %93
br i1 %94, label %95, label %122
95: ; preds = %91
store i32 0, i32* %15
br label %96
96: ; preds = %115, %95
%97 = load i32, i32* %15
%98 = load i32*, i32** %18
%99 = load i32, i32* %14
%100 = sext i32 %99 to i64
%101 = getelementptr inbounds i32, i32* %98, i64 %100
%102 = load i32, i32* %101
%103 = icmp slt i32 %97, %102
br i1 %103, label %104, label %118
104: ; preds = %96
%105 = load double*, double** %19
%106 = load i32, i32* %14
%107 = sext i32 %106 to i64
%108 = getelementptr inbounds double, double* %105, i64 %107
%109 = load double, double* %108
%110 = load double*, double** %7
%111 = load i32, i32* %13
%112 = add nsw i32 %111, 1
store i32 %112, i32* %13
%113 = sext i32 %111 to i64
%114 = getelementptr inbounds double, double* %110, i64 %113
store double %109, double* %114
br label %115
115: ; preds = %104
%116 = load i32, i32* %15
%117 = add nsw i32 %116, 1
store i32 %117, i32* %15
br label %96
118: ; preds = %96
br label %119
119: ; preds = %118
%120 = load i32, i32* %14
%121 = add nsw i32 %120, 1
store i32 %121, i32* %14
br label %91
122: ; preds = %91
br label %141
123: ; preds = %65
store i32 0, i32* %13
br label %124
124: ; preds = %137, %123
%125 = load i32, i32* %13
%126 = load i32, i32* %10
%127 = icmp slt i32 %125, %126
br i1 %127, label %128, label %140
128: ; preds = %124
%129 = load double, double* %8
%130 = call double @rndgamma(double %129)
%131 = load double, double* %8
%132 = fdiv double %130, %131
%133 = load double*, double** %7
%134 = load i32, i32* %13
%135 = sext i32 %134 to i64
%136 = getelementptr inbounds double, double* %133, i64 %135
store double %132, double* %136
br label %137
137: ; preds = %128
%138 = load i32, i32* %13
%139 = add nsw i32 %138, 1
store i32 %139, i32* %13
br label %124
140: ; preds = %124
br label %141
141: ; preds = %140, %122
%142 = load i32, i32* %11
%143 = icmp ne i32 %142, 0
br i1 %143, label %144, label %177
144: ; preds = %141
store i32 1, i32* %13
br label %145
145: ; preds = %162, %144
%146 = load i32, i32* %13
%147 = load i32, i32* %10
%148 = icmp slt i32 %146, %147
br i1 %148, label %149, label %165
149: ; preds = %145
%150 = load double*, double** %7
%151 = load i32, i32* %13
%152 = sub nsw i32 %151, 1
%153 = sext i32 %152 to i64
%154 = getelementptr inbounds double, double* %150, i64 %153
%155 = load double, double* %154
%156 = load double*, double** %7
%157 = load i32, i32* %13
%158 = sext i32 %157 to i64
%159 = getelementptr inbounds double, double* %156, i64 %158
%160 = load double, double* %159
%161 = fadd double %160, %155
store double %161, double* %159
br label %162
162: ; preds = %149
%163 = load i32, i32* %13
%164 = add nsw i32 %163, 1
store i32 %164, i32* %13
br label %145
165: ; preds = %145
%166 = load double*, double** %7
%167 = load i32, i32* %10
%168 = sub nsw i32 %167, 1
%169 = sext i32 %168 to i64
%170 = getelementptr inbounds double, double* %166, i64 %169
%171 = load double, double* %170
%172 = fdiv double 1.000000e+00, %171
%173 = fptosi double %172 to i32
%174 = load double*, double** %7
%175 = load i32, i32* %10
%176 = call i32 @abyx(i32 %173, double* %174, i32 %175)
br label %177
177: ; preds = %165, %141
br label %178
178: ; preds = %177, %64
ret i32 0
}

LLVM IR (-O2):
define i32 @Rates4Sites(double* %0, double %1, i32 %2, i32 %3, i32 %4, double* %5) {
%7 = mul nsw i32 %2, 3
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds double, double* %5, i64 %8
%10 = bitcast double* %9 to i32*
%11 = shl nsw i32 %2, 2
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds double, double* %5, i64 %12
%14 = bitcast double* %13 to i32*
%15 = sext i32 %2 to i64
%16 = getelementptr inbounds double, double* %5, i64 %15
%17 = shl nsw i32 %2, 1
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds double, double* %5, i64 %18
%20 = fcmp oeq double %1, 0.000000e+00
br i1 %20, label %21, label %104
21: ; preds = %6
%22 = icmp ne double* %0, null
%23 = icmp sgt i32 %3, 0
%24 = and i1 %22, %23
br i1 %24, label %25, label %309
25: ; preds = %21
%26 = zext i32 %3 to i64
%27 = icmp ult i32 %3, 4
br i1 %27, label %97, label %28
28: ; preds = %25
%29 = and i64 %26, 4294967292
%30 = add nsw i64 %29, -4
%31 = lshr exact i64 %30, 2
%32 = add nuw nsw i64 %31, 1
%33 = and i64 %32, 7
%34 = icmp ult i64 %30, 28
br i1 %34, label %82, label %35
35: ; preds = %28
%36 = and i64 %32, 9223372036854775800
br label %37
37: ; preds = %37, %35
%38 = phi i64 [ 0, %35 ], [ %79, %37 ]
%39 = phi i64 [ 0, %35 ], [ %80, %37 ]
%40 = getelementptr inbounds double, double* %0, i64 %38
%41 = bitcast double* %40 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %41
%42 = getelementptr inbounds double, double* %40, i64 2
%43 = bitcast double* %42 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %43
%44 = or i64 %38, 4
%45 = getelementptr inbounds double, double* %0, i64 %44
%46 = bitcast double* %45 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %46
%47 = getelementptr inbounds double, double* %45, i64 2
%48 = bitcast double* %47 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %48
%49 = or i64 %38, 8
%50 = getelementptr inbounds double, double* %0, i64 %49
%51 = bitcast double* %50 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %51
%52 = getelementptr inbounds double, double* %50, i64 2
%53 = bitcast double* %52 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %53
%54 = or i64 %38, 12
%55 = getelementptr inbounds double, double* %0, i64 %54
%56 = bitcast double* %55 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %56
%57 = getelementptr inbounds double, double* %55, i64 2
%58 = bitcast double* %57 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %58
%59 = or i64 %38, 16
%60 = getelementptr inbounds double, double* %0, i64 %59
%61 = bitcast double* %60 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %61
%62 = getelementptr inbounds double, double* %60, i64 2
%63 = bitcast double* %62 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %63
%64 = or i64 %38, 20
%65 = getelementptr inbounds double, double* %0, i64 %64
%66 = bitcast double* %65 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %66
%67 = getelementptr inbounds double, double* %65, i64 2
%68 = bitcast double* %67 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %68
%69 = or i64 %38, 24
%70 = getelementptr inbounds double, double* %0, i64 %69
%71 = bitcast double* %70 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %71
%72 = getelementptr inbounds double, double* %70, i64 2
%73 = bitcast double* %72 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %73
%74 = or i64 %38, 28
%75 = getelementptr inbounds double, double* %0, i64 %74
%76 = bitcast double* %75 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %76
%77 = getelementptr inbounds double, double* %75, i64 2
%78 = bitcast double* %77 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %78
%79 = add nuw i64 %38, 32
%80 = add i64 %39, 8
%81 = icmp eq i64 %80, %36
br i1 %81, label %82, label %37
82: ; preds = %37, %28
%83 = phi i64 [ 0, %28 ], [ %79, %37 ]
%84 = icmp eq i64 %33, 0
br i1 %84, label %95, label %85
85: ; preds = %82, %85
%86 = phi i64 [ %92, %85 ], [ %83, %82 ]
%87 = phi i64 [ %93, %85 ], [ 0, %82 ]
%88 = getelementptr inbounds double, double* %0, i64 %86
%89 = bitcast double* %88 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %89
%90 = getelementptr inbounds double, double* %88, i64 2
%91 = bitcast double* %90 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %91
%92 = add nuw i64 %86, 4
%93 = add i64 %87, 1
%94 = icmp eq i64 %93, %33
br i1 %94, label %95, label %85
95: ; preds = %85, %82
%96 = icmp eq i64 %29, %26
br i1 %96, label %309, label %97
97: ; preds = %25, %95
%98 = phi i64 [ 0, %25 ], [ %29, %95 ]
br label %99
99: ; preds = %97, %99
%100 = phi i64 [ %102, %99 ], [ %98, %97 ]
%101 = getelementptr inbounds double, double* %0, i64 %100
store double 1.000000e+00, double* %101
%102 = add nuw nsw i64 %100, 1
%103 = icmp eq i64 %102, %26
br i1 %103, label %309, label %99
104: ; preds = %6
%105 = icmp sgt i32 %2, 1
br i1 %105, label %110, label %106
106: ; preds = %104
%107 = icmp sgt i32 %3, 0
br i1 %107, label %108, label %252
108: ; preds = %106
%109 = zext i32 %3 to i64
br label %245
110: ; preds = %104
%111 = tail call i32 @DiscreteGamma(double* %16, double* %5, double %1, double %1, i32 %2, i32 0)
%112 = mul nsw i32 %2, 5
%113 = sext i32 %112 to i64
%114 = getelementptr inbounds double, double* %5, i64 %113
%115 = tail call i32 @MultiNomialAliasSetTable(i32 %2, double* %16, double* %19, i32* %10, double* %114)
%116 = tail call i32 @MultiNomialAlias(i32 %3, i32 %2, double* %19, i32* %10, i32* %14)
%117 = zext i32 %2 to i64
%118 = getelementptr double, double* %0, i64 1
br label %119
119: ; preds = %110, %241
%120 = phi i64 [ 0, %110 ], [ %243, %241 ]
%121 = phi i32 [ 0, %110 ], [ %242, %241 ]
%122 = getelementptr double, double* %5, i64 %120
%123 = add nuw i64 %120, 1
%124 = getelementptr double, double* %5, i64 %123
%125 = getelementptr inbounds i32, i32* %14, i64 %120
%126 = load i32, i32* %125
%127 = icmp sgt i32 %126, 0
br i1 %127, label %128, label %241
128: ; preds = %119
%129 = getelementptr inbounds double, double* %5, i64 %120
%130 = sext i32 %121 to i64
%131 = add i32 %126, -1
%132 = zext i32 %131 to i64
%133 = add nuw nsw i64 %132, 1
%134 = icmp ult i32 %131, 3
br i1 %134, label %198, label %135
135: ; preds = %128
%136 = getelementptr double, double* %0, i64 %130
%137 = add i32 %126, -1
%138 = zext i32 %137 to i64
%139 = add nsw i64 %130, %138
%140 = getelementptr double, double* %118, i64 %139
%141 = icmp ult double* %136, %124
%142 = icmp ult double* %122, %140
%143 = and i1 %141, %142
br i1 %143, label %198, label %144
144: ; preds = %135
%145 = and i64 %133, 8589934588
%146 = add nsw i64 %145, %130
%147 = trunc i64 %145 to i32
%148 = add nsw i64 %145, -4
%149 = lshr exact i64 %148, 2
%150 = add nuw nsw i64 %149, 1
%151 = and i64 %150, 1
%152 = icmp eq i64 %148, 0
br i1 %152, label %182, label %153
153: ; preds = %144
%154 = and i64 %150, 9223372036854775806
%155 = load double, double* %129
%156 = insertelement <2 x double> poison, double %155, i64 0
%157 = shufflevector <2 x double> %156, <2 x double> poison, <2 x i32> zeroinitializer
%158 = insertelement <2 x double> poison, double %155, i64 0
%159 = shufflevector <2 x double> %158, <2 x double> poison, <2 x i32> zeroinitializer
%160 = load double, double* %129
%161 = insertelement <2 x double> poison, double %160, i64 0
%162 = shufflevector <2 x double> %161, <2 x double> poison, <2 x i32> zeroinitializer
%163 = insertelement <2 x double> poison, double %160, i64 0
%164 = shufflevector <2 x double> %163, <2 x double> poison, <2 x i32> zeroinitializer
br label %165
165: ; preds = %165, %153
%166 = phi i64 [ 0, %153 ], [ %179, %165 ]
%167 = phi i64 [ 0, %153 ], [ %180, %165 ]
%168 = add i64 %166, %130
%169 = getelementptr inbounds double, double* %0, i64 %168
%170 = bitcast double* %169 to <2 x double>*
store <2 x double> %157, <2 x double>* %170
%171 = getelementptr inbounds double, double* %169, i64 2
%172 = bitcast double* %171 to <2 x double>*
store <2 x double> %159, <2 x double>* %172
%173 = or i64 %166, 4
%174 = add i64 %173, %130
%175 = getelementptr inbounds double, double* %0, i64 %174
%176 = bitcast double* %175 to <2 x double>*
store <2 x double> %162, <2 x double>* %176
%177 = getelementptr inbounds double, double* %175, i64 2
%178 = bitcast double* %177 to <2 x double>*
store <2 x double> %164, <2 x double>* %178
%179 = add nuw i64 %166, 8
%180 = add i64 %167, 2
%181 = icmp eq i64 %180, %154
br i1 %181, label %182, label %165
182: ; preds = %165, %144
%183 = phi i64 [ 0, %144 ], [ %179, %165 ]
%184 = icmp eq i64 %151, 0
br i1 %184, label %196, label %185
185: ; preds = %182
%186 = add i64 %183, %130
%187 = load double, double* %129
%188 = insertelement <2 x double> poison, double %187, i64 0
%189 = shufflevector <2 x double> %188, <2 x double> poison, <2 x i32> zeroinitializer
%190 = insertelement <2 x double> poison, double %187, i64 0
%191 = shufflevector <2 x double> %190, <2 x double> poison, <2 x i32> zeroinitializer
%192 = getelementptr inbounds double, double* %0, i64 %186
%193 = bitcast double* %192 to <2 x double>*
store <2 x double> %189, <2 x double>* %193
%194 = getelementptr inbounds double, double* %192, i64 2
%195 = bitcast double* %194 to <2 x double>*
store <2 x double> %191, <2 x double>* %195
br label %196
196: ; preds = %182, %185
%197 = icmp eq i64 %133, %145
br i1 %197, label %238, label %198
198: ; preds = %135, %128, %196
%199 = phi i64 [ %130, %135 ], [ %130, %128 ], [ %146, %196 ]
%200 = phi i32 [ 0, %135 ], [ 0, %128 ], [ %147, %196 ]
%201 = sub i32 %126, %200
%202 = xor i32 %200, -1
%203 = add i32 %126, %202
%204 = and i32 %201, 3
%205 = icmp eq i32 %204, 0
br i1 %205, label %216, label %206
206: ; preds = %198, %206
%207 = phi i64 [ %211, %206 ], [ %199, %198 ]
%208 = phi i32 [ %213, %206 ], [ %200, %198 ]
%209 = phi i32 [ %214, %206 ], [ 0, %198 ]
%210 = load double, double* %129
%211 = add nsw i64 %207, 1
%212 = getelementptr inbounds double, double* %0, i64 %207
store double %210, double* %212
%213 = add nuw nsw i32 %208, 1
%214 = add i32 %209, 1
%215 = icmp eq i32 %214, %204
br i1 %215, label %216, label %206
216: ; preds = %206, %198
%217 = phi i64 [ undef, %198 ], [ %211, %206 ]
%218 = phi i64 [ %199, %198 ], [ %211, %206 ]
%219 = phi i32 [ %200, %198 ], [ %213, %206 ]
%220 = icmp ult i32 %203, 3
br i1 %220, label %238, label %221
221: ; preds = %216, %221
%222 = phi i64 [ %234, %221 ], [ %218, %216 ]
%223 = phi i32 [ %236, %221 ], [ %219, %216 ]
%224 = load double, double* %129
%225 = add nsw i64 %222, 1
%226 = getelementptr inbounds double, double* %0, i64 %222
store double %224, double* %226
%227 = load double, double* %129
%228 = add nsw i64 %222, 2
%229 = getelementptr inbounds double, double* %0, i64 %225
store double %227, double* %229
%230 = load double, double* %129
%231 = add nsw i64 %222, 3
%232 = getelementptr inbounds double, double* %0, i64 %228
store double %230, double* %232
%233 = load double, double* %129
%234 = add nsw i64 %222, 4
%235 = getelementptr inbounds double, double* %0, i64 %231
store double %233, double* %235
%236 = add nuw nsw i32 %223, 4
%237 = icmp eq i32 %236, %126
br i1 %237, label %238, label %221
238: ; preds = %216, %221, %196
%239 = phi i64 [ %146, %196 ], [ %217, %216 ], [ %234, %221 ]
%240 = trunc i64 %239 to i32
br label %241
241: ; preds = %238, %119
%242 = phi i32 [ %121, %119 ], [ %240, %238 ]
%243 = add nuw nsw i64 %120, 1
%244 = icmp eq i64 %243, %117
br i1 %244, label %252, label %119
245: ; preds = %108, %245
%246 = phi i64 [ 0, %108 ], [ %250, %245 ]
%247 = tail call double @rndgamma(double %1)
%248 = fdiv double %247, %1
%249 = getelementptr inbounds double, double* %0, i64 %246
store double %248, double* %249
%250 = add nuw nsw i64 %246, 1
%251 = icmp eq i64 %250, %109
br i1 %251, label %252, label %245
252: ; preds = %245, %241, %106
%253 = icmp eq i32 %4, 0
br i1 %253, label %309, label %254
254: ; preds = %252
%255 = icmp sgt i32 %3, 1
br i1 %255, label %256, label %301
256: ; preds = %254
%257 = zext i32 %3 to i64
%258 = load double, double* %0
%259 = add nsw i64 %257, -1
%260 = add nsw i64 %257, -2
%261 = and i64 %259, 3
%262 = icmp ult i64 %260, 3
br i1 %262, label %287, label %263
263: ; preds = %256
%264 = and i64 %259, -4
br label %265
265: ; preds = %265, %263
%266 = phi double [ %258, %263 ], [ %283, %265 ]
%267 = phi i64 [ 1, %263 ], [ %284, %265 ]
%268 = phi i64 [ 0, %263 ], [ %285, %265 ]
%269 = getelementptr inbounds double, double* %0, i64 %267
%270 = load double, double* %269
%271 = fadd double %266, %270
store double %271, double* %269
%272 = add nuw nsw i64 %267, 1
%273 = getelementptr inbounds double, double* %0, i64 %272
%274 = load double, double* %273
%275 = fadd double %271, %274
store double %275, double* %273
%276 = add nuw nsw i64 %267, 2
%277 = getelementptr inbounds double, double* %0, i64 %276
%278 = load double, double* %277
%279 = fadd double %275, %278
store double %279, double* %277
%280 = add nuw nsw i64 %267, 3
%281 = getelementptr inbounds double, double* %0, i64 %280
%282 = load double, double* %281
%283 = fadd double %279, %282
store double %283, double* %281
%284 = add nuw nsw i64 %267, 4
%285 = add i64 %268, 4
%286 = icmp eq i64 %285, %264
br i1 %286, label %287, label %265
287: ; preds = %265, %256
%288 = phi double [ %258, %256 ], [ %283, %265 ]
%289 = phi i64 [ 1, %256 ], [ %284, %265 ]
%290 = icmp eq i64 %261, 0
br i1 %290, label %301, label %291
291: ; preds = %287, %291
%292 = phi double [ %297, %291 ], [ %288, %287 ]
%293 = phi i64 [ %298, %291 ], [ %289, %287 ]
%294 = phi i64 [ %299, %291 ], [ 0, %287 ]
%295 = getelementptr inbounds double, double* %0, i64 %293
%296 = load double, double* %295
%297 = fadd double %292, %296
store double %297, double* %295
%298 = add nuw nsw i64 %293, 1
%299 = add i64 %294, 1
%300 = icmp eq i64 %299, %261
br i1 %300, label %301, label %291
301: ; preds = %287, %291, %254
%302 = add nsw i32 %3, -1
%303 = sext i32 %302 to i64
%304 = getelementptr inbounds double, double* %0, i64 %303
%305 = load double, double* %304
%306 = fdiv double 1.000000e+00, %305
%307 = fptosi double %306 to i32
%308 = tail call i32 @abyx(i32 %307, double* %0, i32 %3)
br label %309
309: ; preds = %99, %95, %252, %301, %21
ret i32 0
}