#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*/ MultiNomial(int, int, 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, *counts = (int *)(space + 2 * ncatG);
  double *rK = space, *freqK = space + ncatG;
  if (alpha == 0) {
    if (rates)
      for (h = 0; h < ls; h++)
        rates[h] = 1;
  } else {
    if (ncatG > 1) {
      DiscreteGamma(freqK, rK, alpha, alpha, ncatG, 0);
      MultiNomial(ls, ncatG, freqK, counts, space + 3 * ncatG);
      for (ir = 0, h = 0; ir < ncatG; 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    $0x50,%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    -0x28(%rbp),%rax
mov    -0x14(%rbp),%ecx
shl    $0x1,%ecx
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x40(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x28(%rbp),%rax
movslq -0x14(%rbp),%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x50(%rbp)
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    11f4 <Rates4Sites+0xb4>
jp     11f4 <Rates4Sites+0xb4>
cmpq   $0x0,-0x8(%rbp)
je     11ef <Rates4Sites+0xaf>
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    11ea <Rates4Sites+0xaa>
mov    -0x8(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  0xe29(%rip),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    11bb <Rates4Sites+0x7b>
jmp    11ef <Rates4Sites+0xaf>
jmp    137d <Rates4Sites+0x23d>
cmpl   $0x1,-0x14(%rbp)
jle    12bd <Rates4Sites+0x17d>
mov    -0x50(%rbp),%rdi
mov    -0x48(%rbp),%rsi
movsd  -0x10(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
mov    -0x14(%rbp),%edx
xor    %ecx,%ecx
call   1050 <DiscreteGamma@plt>
mov    -0x18(%rbp),%edi
mov    -0x14(%rbp),%esi
mov    -0x50(%rbp),%rdx
mov    -0x40(%rbp),%rcx
mov    -0x28(%rbp),%r8
imul   $0x3,-0x14(%rbp),%eax
cltq
shl    $0x3,%rax
add    %rax,%r8
call   1030 <MultiNomial@plt>
movl   $0x0,-0x30(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    12b8 <Rates4Sites+0x178>
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
mov    -0x40(%rbp),%rcx
movslq -0x30(%rbp),%rdx
cmp    (%rcx,%rdx,4),%eax
jge    12a5 <Rates4Sites+0x165>
mov    -0x48(%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    125f <Rates4Sites+0x11f>
jmp    12aa <Rates4Sites+0x16a>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    124c <Rates4Sites+0x10c>
jmp    12ff <Rates4Sites+0x1bf>
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    12fa <Rates4Sites+0x1ba>
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    12c4 <Rates4Sites+0x184>
jmp    12ff <Rates4Sites+0x1bf>
cmpl   $0x0,-0x1c(%rbp)
je     1378 <Rates4Sites+0x238>
movl   $0x1,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    134e <Rates4Sites+0x20e>
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    1310 <Rates4Sites+0x1d0>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  0xc9d(%rip),%xmm0
divsd  (%rax,%rcx,8),%xmm0
cvttsd2si %xmm0,%edi
mov    -0x8(%rbp),%rsi
mov    -0x18(%rbp),%edx
call   1060 <abyx@plt>
jmp    137d <Rates4Sites+0x23d>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Rates4Sites>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %edx,%r14d
movapd %xmm0,%xmm1
mov    %rdi,%rbx
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm1
jne    118a <Rates4Sites+0x4a>
jp     118a <Rates4Sites+0x4a>
test   %rbx,%rbx
je     15cd <Rates4Sites+0x48d>
test   %r14d,%r14d
jle    15cd <Rates4Sites+0x48d>
mov    %r14d,%eax
cmp    $0x4,%r14d
jae    14b5 <Rates4Sites+0x375>
xor    %ecx,%ecx
jmp    15a9 <Rates4Sites+0x469>
mov    %esi,%r13d
cmp    $0x1,%esi
mov    %r14d,0xc(%rsp)
mov    %ecx,0x1c(%rsp)
jle    13b2 <Rates4Sites+0x272>
mov    %r8,%rbp
lea    0x0(%r13,%r13,1),%eax
cltq
lea    (%r8,%rax,8),%r12
movslq %r13d,%rax
lea    (%r8,%rax,8),%rdi
mov    %rdi,0x20(%rsp)
xor    %r15d,%r15d
mov    %r8,%rsi
movapd %xmm1,%xmm0
mov    %r13d,%edx
xor    %ecx,%ecx
call   1050 <DiscreteGamma@plt>
lea    0x0(%r13,%r13,2),%eax
cltq
lea    0x0(,%rax,8),%r8
add    %rbp,%r8
mov    %r14d,%edi
mov    %r13d,%esi
mov    0x20(%rsp),%rdx
mov    %r12,%rcx
call   1030 <MultiNomial@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    122d <Rates4Sites+0xed>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0x1,%r15
cmp    %r10,%r15
je     13f1 <Rates4Sites+0x2b1>
mov    (%r12,%r15,4),%edi
test   %edi,%edi
jle    1220 <Rates4Sites+0xe0>
movslq %esi,%rsi
lea    -0x1(%rdi),%r14d
xor    %r13d,%r13d
cmp    $0x3,%r14d
jb     1310 <Rates4Sites+0x1d0>
lea    0x8(,%r15,8),%rax
add    %rbp,%rax
lea    (%rbx,%rsi,8),%rcx
cmp    %rax,%rcx
jae    1279 <Rates4Sites+0x139>
lea    0x0(,%r15,8),%rax
add    %rbp,%rax
lea    (%rsi,%r14,1),%rcx
lea    (%r9,%rcx,8),%rcx
cmp    %rcx,%rax
jb     1310 <Rates4Sites+0x1d0>
add    $0x1,%r14
mov    %r14,%r13
and    $0xfffffffffffffffc,%r13
lea    -0x4(%r13),%rax
mov    %rax,%r11
shr    $0x2,%r11
add    $0x1,%r11
test   %rax,%rax
je     13a1 <Rates4Sites+0x261>
mov    %r11,%rcx
and    %r8,%rcx
movsd  0x0(%rbp,%r15,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    12c0 <Rates4Sites+0x180>
test   $0x1,%r11b
je     1300 <Rates4Sites+0x1c0>
add    %rsi,%rax
movsd  0x0(%rbp,%r15,8),%xmm0
unpcklpd %xmm0,%xmm0
movupd %xmm0,(%rbx,%rax,8)
movupd %xmm0,0x10(%rbx,%rax,8)
add    %r13,%rsi
cmp    %r13,%r14
je     1220 <Rates4Sites+0xe0>
nopl   0x0(%rax)
mov    %edi,%eax
sub    %r13d,%eax
mov    %r13d,%r11d
not    %r11d
add    %edi,%r11d
and    $0x3,%eax
je     134d <Rates4Sites+0x20d>
lea    (%rbx,%rsi,8),%rcx
neg    %eax
xor    %edx,%edx
nopl   0x0(%rax,%rax,1)
movsd  0x0(%rbp,%r15,8),%xmm0
movsd  %xmm0,(%rcx)
add    $0x8,%rcx
add    $0xffffffffffffffff,%rdx
cmp    %edx,%eax
jne    1330 <Rates4Sites+0x1f0>
sub    %rdx,%rsi
sub    %edx,%r13d
cmp    $0x3,%r11d
jb     1220 <Rates4Sites+0xe0>
sub    %r13d,%edi
nopw   0x0(%rax,%rax,1)
movsd  0x0(%rbp,%r15,8),%xmm0
movsd  %xmm0,(%rbx,%rsi,8)
movsd  0x0(%rbp,%r15,8),%xmm0
movsd  %xmm0,0x8(%rbx,%rsi,8)
movsd  0x0(%rbp,%r15,8),%xmm0
movsd  %xmm0,0x10(%rbx,%rsi,8)
movsd  0x0(%rbp,%r15,8),%xmm0
movsd  %xmm0,0x18(%rbx,%rsi,8)
add    $0x4,%rsi
add    $0xfffffffc,%edi
jne    1360 <Rates4Sites+0x220>
jmp    1220 <Rates4Sites+0xe0>
xor    %eax,%eax
test   $0x1,%r11b
jne    12e7 <Rates4Sites+0x1a7>
jmp    1300 <Rates4Sites+0x1c0>
test   %r14d,%r14d
jle    13f1 <Rates4Sites+0x2b1>
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    13d0 <Rates4Sites+0x290>
cmpl   $0x0,0x1c(%rsp)
mov    0xc(%rsp),%edx
je     15cd <Rates4Sites+0x48d>
cmp    $0x2,%edx
jl     1493 <Rates4Sites+0x353>
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     146d <Rates4Sites+0x32d>
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    1430 <Rates4Sites+0x2f0>
add    $0x1,%rcx
test   %rax,%rax
je     1493 <Rates4Sites+0x353>
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    1480 <Rates4Sites+0x340>
movslq %edx,%rax
movsd  0xb62(%rip),%xmm0
divsd  -0x8(%rbx,%rax,8),%xmm0
cvttsd2si %xmm0,%edi
mov    %rbx,%rsi
call   1060 <abyx@plt>
jmp    15cd <Rates4Sites+0x48d>
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    14db <Rates4Sites+0x39b>
xor    %edi,%edi
jmp    1575 <Rates4Sites+0x435>
and    $0xfffffffffffffff8,%rsi
xor    %edi,%edi
movapd 0xb27(%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    14f0 <Rates4Sites+0x3b0>
test   %rdx,%rdx
je     15a4 <Rates4Sites+0x464>
lea    (%rbx,%rdi,8),%rsi
add    $0x10,%rsi
shl    $0x5,%rdx
xor    %edi,%edi
movapd 0xa80(%rip),%xmm0
movupd %xmm0,-0x10(%rsi,%rdi,1)
movupd %xmm0,(%rsi,%rdi,1)
add    $0x20,%rdi
cmp    %rdi,%rdx
jne    1590 <Rates4Sites+0x450>
cmp    %rax,%rcx
je     15cd <Rates4Sites+0x48d>
movabs $0x3ff0000000000000,%rdx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %rdx,(%rbx,%rcx,8)
add    $0x1,%rcx
cmp    %rcx,%rax
jne    15c0 <Rates4Sites+0x480>
xor    %eax,%eax
add    $0x28,%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 double*
%18 = 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
%19 = load double*, double** %12
%20 = load i32, i32* %9
%21 = mul nsw i32 2, %20
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds double, double* %19, i64 %22
%24 = bitcast double* %23 to i32*
store i32* %24, i32** %16
%25 = load double*, double** %12
store double* %25, double** %17
%26 = load double*, double** %12
%27 = load i32, i32* %9
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds double, double* %26, i64 %28
store double* %29, double** %18
%30 = load double, double* %8
%31 = fcmp oeq double %30, 0.000000e+00
br i1 %31, label %32, label %50
32: ; preds = %6
%33 = load double*, double** %7
%34 = icmp ne double* %33, null
br i1 %34, label %35, label %49
35: ; preds = %32
store i32 0, i32* %13
br label %36
36: ; preds = %45, %35
%37 = load i32, i32* %13
%38 = load i32, i32* %10
%39 = icmp slt i32 %37, %38
br i1 %39, label %40, label %48
40: ; preds = %36
%41 = load double*, double** %7
%42 = load i32, i32* %13
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds double, double* %41, i64 %43
store double 1.000000e+00, double* %44
br label %45
45: ; preds = %40
%46 = load i32, i32* %13
%47 = add nsw i32 %46, 1
store i32 %47, i32* %13
br label %36
48: ; preds = %36
br label %49
49: ; preds = %48, %32
br label %157
50: ; preds = %6
%51 = load i32, i32* %9
%52 = icmp sgt i32 %51, 1
br i1 %52, label %53, label %102
53: ; preds = %50
%54 = load double*, double** %18
%55 = load double*, double** %17
%56 = load double, double* %8
%57 = load double, double* %8
%58 = load i32, i32* %9
%59 = call i32 @DiscreteGamma(double* %54, double* %55, double %56, double %57, i32 %58, i32 0)
%60 = load i32, i32* %10
%61 = load i32, i32* %9
%62 = load double*, double** %18
%63 = load i32*, i32** %16
%64 = load double*, double** %12
%65 = load i32, i32* %9
%66 = mul nsw i32 3, %65
%67 = sext i32 %66 to i64
%68 = getelementptr inbounds double, double* %64, i64 %67
%69 = call i32 @MultiNomial(i32 %60, i32 %61, double* %62, i32* %63, double* %68)
store i32 0, i32* %14
store i32 0, i32* %13
br label %70
70: ; preds = %98, %53
%71 = load i32, i32* %14
%72 = load i32, i32* %9
%73 = icmp slt i32 %71, %72
br i1 %73, label %74, label %101
74: ; preds = %70
store i32 0, i32* %15
br label %75
75: ; preds = %94, %74
%76 = load i32, i32* %15
%77 = load i32*, i32** %16
%78 = load i32, i32* %14
%79 = sext i32 %78 to i64
%80 = getelementptr inbounds i32, i32* %77, i64 %79
%81 = load i32, i32* %80
%82 = icmp slt i32 %76, %81
br i1 %82, label %83, label %97
83: ; preds = %75
%84 = load double*, double** %17
%85 = load i32, i32* %14
%86 = sext i32 %85 to i64
%87 = getelementptr inbounds double, double* %84, i64 %86
%88 = load double, double* %87
%89 = load double*, double** %7
%90 = load i32, i32* %13
%91 = add nsw i32 %90, 1
store i32 %91, i32* %13
%92 = sext i32 %90 to i64
%93 = getelementptr inbounds double, double* %89, i64 %92
store double %88, double* %93
br label %94
94: ; preds = %83
%95 = load i32, i32* %15
%96 = add nsw i32 %95, 1
store i32 %96, i32* %15
br label %75
97: ; preds = %75
br label %98
98: ; preds = %97
%99 = load i32, i32* %14
%100 = add nsw i32 %99, 1
store i32 %100, i32* %14
br label %70
101: ; preds = %70
br label %120
102: ; preds = %50
store i32 0, i32* %13
br label %103
103: ; preds = %116, %102
%104 = load i32, i32* %13
%105 = load i32, i32* %10
%106 = icmp slt i32 %104, %105
br i1 %106, label %107, label %119
107: ; preds = %103
%108 = load double, double* %8
%109 = call double @rndgamma(double %108)
%110 = load double, double* %8
%111 = fdiv double %109, %110
%112 = load double*, double** %7
%113 = load i32, i32* %13
%114 = sext i32 %113 to i64
%115 = getelementptr inbounds double, double* %112, i64 %114
store double %111, double* %115
br label %116
116: ; preds = %107
%117 = load i32, i32* %13
%118 = add nsw i32 %117, 1
store i32 %118, i32* %13
br label %103
119: ; preds = %103
br label %120
120: ; preds = %119, %101
%121 = load i32, i32* %11
%122 = icmp ne i32 %121, 0
br i1 %122, label %123, label %156
123: ; preds = %120
store i32 1, i32* %13
br label %124
124: ; preds = %141, %123
%125 = load i32, i32* %13
%126 = load i32, i32* %10
%127 = icmp slt i32 %125, %126
br i1 %127, label %128, label %144
128: ; preds = %124
%129 = load double*, double** %7
%130 = load i32, i32* %13
%131 = sub nsw i32 %130, 1
%132 = sext i32 %131 to i64
%133 = getelementptr inbounds double, double* %129, i64 %132
%134 = load double, double* %133
%135 = load double*, double** %7
%136 = load i32, i32* %13
%137 = sext i32 %136 to i64
%138 = getelementptr inbounds double, double* %135, i64 %137
%139 = load double, double* %138
%140 = fadd double %139, %134
store double %140, double* %138
br label %141
141: ; preds = %128
%142 = load i32, i32* %13
%143 = add nsw i32 %142, 1
store i32 %143, i32* %13
br label %124
144: ; preds = %124
%145 = load double*, double** %7
%146 = load i32, i32* %10
%147 = sub nsw i32 %146, 1
%148 = sext i32 %147 to i64
%149 = getelementptr inbounds double, double* %145, i64 %148
%150 = load double, double* %149
%151 = fdiv double 1.000000e+00, %150
%152 = fptosi double %151 to i32
%153 = load double*, double** %7
%154 = load i32, i32* %10
%155 = call i32 @abyx(i32 %152, double* %153, i32 %154)
br label %156
156: ; preds = %144, %120
br label %157
157: ; preds = %156, %49
ret i32 0
}

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