#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 */
size_t CodonToQcoord(int, int const);
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ IsStop(int, int const);
int NumberSenseCodonsInGenCode(int const);
double *calloc(int, int);
int /*<<< orphan*/ err(int /*<<< orphan*/, char *, char *, int);
int /*<<< orphan*/ free(double *);
int /*<<< orphan*/ norm_vector(double *, int, double);
double *GetEquilibriumDistCodon(const double *pi, const int codonf,
                                const int gencode) {
  double *eq;
  double b34[12];
  double *tpi;
  int cdn, pos, nuc;
  tpi = calloc(64, sizeof(double));
  if (NULL == tpi) {
    err(EXIT_FAILURE, "Out of memory %s:%d\n",
        "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
        "2022-01-22/02-19-57/repos/timmassingham/SLR/refs/heads/master/src/"
        "codonmodel.c",
        894);
  }
  if (codonf == 1 || codonf == 2) {
    for (pos = 0; pos < 12; pos++) {
      b34[pos] = 0.;
    }
    for (cdn = 0; cdn < 64; cdn++) {
      nuc = cdn & 3;
      b34[8 + nuc] += pi[cdn];
      nuc = (cdn >> 2) & 3;
      b34[4 + nuc] += pi[cdn];
      nuc = (cdn >> 4) & 3;
      b34[nuc] += pi[cdn];
    }
    if (codonf == 2) {
      for (nuc = 0; nuc < 4; nuc++) {
        b34[nuc] += b34[4 + nuc];
      }
      for (nuc = 0; nuc < 4; nuc++) {
        b34[nuc] += b34[8 + nuc];
      }
      for (nuc = 0; nuc < 4; nuc++) {
        b34[nuc] /= 3;
        b34[4 + nuc] = b34[nuc];
        b34[8 + nuc] = b34[nuc];
      }
    }
    for (cdn = 0; cdn < 64; cdn++) {
      tpi[cdn] =
          b34[8 + (cdn & 3)] * b34[4 + ((cdn >> 2) & 3)] * b34[(cdn >> 4) & 3];
    }
  } else {
    for (cdn = 0; cdn < 64; cdn++) {
      tpi[cdn] = pi[cdn];
    }
  }
  eq = calloc(NumberSenseCodonsInGenCode(gencode), sizeof(double));
  if (NULL == eq) {
    err(EXIT_FAILURE, "Out of memory %s:%d\n",
        "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
        "2022-01-22/02-19-57/repos/timmassingham/SLR/refs/heads/master/src/"
        "codonmodel.c",
        935);
  }
  for (cdn = 0; cdn < 64; cdn++) {
    if (!IsStop(cdn, gencode)) {
      eq[CodonToQcoord(cdn, gencode)] = tpi[cdn];
    }
  }
  free(tpi);
  (void)norm_vector(eq, NumberSenseCodonsInGenCode(gencode), 1.0);
  return eq;
}


x86 assembly (clang, -O0):
<GetEquilibriumDistCodon>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    $0x40,%edi
mov    $0x8,%esi
call   1060 <calloc@plt>
mov    %rax,-0x88(%rbp)
xor    %eax,%eax
cmp    -0x88(%rbp),%rax
jne    11cb <GetEquilibriumDistCodon+0x5b>
mov    0x2e2f(%rip),%rax
mov    (%rax),%edi
lea    0xe56(%rip),%rsi
lea    0xe64(%rip),%rdx
mov    $0x37e,%ecx
call   1070 <err@plt>
cmpl   $0x1,-0xc(%rbp)
je     11df <GetEquilibriumDistCodon+0x6f>
cmpl   $0x2,-0xc(%rbp)
jne    149e <GetEquilibriumDistCodon+0x32e>
movl   $0x0,-0x90(%rbp)
cmpl   $0xc,-0x90(%rbp)
jge    121a <GetEquilibriumDistCodon+0xaa>
movslq -0x90(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x80(%rbp,%rax,8)
mov    -0x90(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x90(%rbp)
jmp    11e9 <GetEquilibriumDistCodon+0x79>
movl   $0x0,-0x8c(%rbp)
cmpl   $0x40,-0x8c(%rbp)
jge    12e9 <GetEquilibriumDistCodon+0x179>
mov    -0x8c(%rbp),%eax
and    $0x3,%eax
mov    %eax,-0x94(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x8c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x94(%rbp),%eax
add    $0x8,%eax
cltq
addsd  -0x80(%rbp,%rax,8),%xmm0
movsd  %xmm0,-0x80(%rbp,%rax,8)
mov    -0x8c(%rbp),%eax
sar    $0x2,%eax
and    $0x3,%eax
mov    %eax,-0x94(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x8c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x94(%rbp),%eax
add    $0x4,%eax
cltq
addsd  -0x80(%rbp,%rax,8),%xmm0
movsd  %xmm0,-0x80(%rbp,%rax,8)
mov    -0x8c(%rbp),%eax
sar    $0x4,%eax
and    $0x3,%eax
mov    %eax,-0x94(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x8c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movslq -0x94(%rbp),%rax
addsd  -0x80(%rbp,%rax,8),%xmm0
movsd  %xmm0,-0x80(%rbp,%rax,8)
mov    -0x8c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8c(%rbp)
jmp    1224 <GetEquilibriumDistCodon+0xb4>
cmpl   $0x2,-0xc(%rbp)
jne    141c <GetEquilibriumDistCodon+0x2ac>
movl   $0x0,-0x94(%rbp)
cmpl   $0x4,-0x94(%rbp)
jge    1342 <GetEquilibriumDistCodon+0x1d2>
mov    -0x94(%rbp),%eax
add    $0x4,%eax
cltq
movsd  -0x80(%rbp,%rax,8),%xmm0
movslq -0x94(%rbp),%rax
addsd  -0x80(%rbp,%rax,8),%xmm0
movsd  %xmm0,-0x80(%rbp,%rax,8)
mov    -0x94(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x94(%rbp)
jmp    12fd <GetEquilibriumDistCodon+0x18d>
movl   $0x0,-0x94(%rbp)
cmpl   $0x4,-0x94(%rbp)
jge    1391 <GetEquilibriumDistCodon+0x221>
mov    -0x94(%rbp),%eax
add    $0x8,%eax
cltq
movsd  -0x80(%rbp,%rax,8),%xmm0
movslq -0x94(%rbp),%rax
addsd  -0x80(%rbp,%rax,8),%xmm0
movsd  %xmm0,-0x80(%rbp,%rax,8)
mov    -0x94(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x94(%rbp)
jmp    134c <GetEquilibriumDistCodon+0x1dc>
movl   $0x0,-0x94(%rbp)
cmpl   $0x4,-0x94(%rbp)
jge    1417 <GetEquilibriumDistCodon+0x2a7>
movslq -0x94(%rbp),%rax
movsd  -0x80(%rbp,%rax,8),%xmm0
movsd  0xc4b(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x80(%rbp,%rax,8)
movslq -0x94(%rbp),%rax
movsd  -0x80(%rbp,%rax,8),%xmm0
mov    -0x94(%rbp),%eax
add    $0x4,%eax
cltq
movsd  %xmm0,-0x80(%rbp,%rax,8)
movslq -0x94(%rbp),%rax
movsd  -0x80(%rbp,%rax,8),%xmm0
mov    -0x94(%rbp),%eax
add    $0x8,%eax
cltq
movsd  %xmm0,-0x80(%rbp,%rax,8)
mov    -0x94(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x94(%rbp)
jmp    139b <GetEquilibriumDistCodon+0x22b>
jmp    141c <GetEquilibriumDistCodon+0x2ac>
movl   $0x0,-0x8c(%rbp)
cmpl   $0x40,-0x8c(%rbp)
jge    1499 <GetEquilibriumDistCodon+0x329>
mov    -0x8c(%rbp),%eax
and    $0x3,%eax
add    $0x8,%eax
cltq
movsd  -0x80(%rbp,%rax,8),%xmm0
mov    -0x8c(%rbp),%eax
sar    $0x2,%eax
and    $0x3,%eax
add    $0x4,%eax
cltq
mulsd  -0x80(%rbp,%rax,8),%xmm0
mov    -0x8c(%rbp),%eax
sar    $0x4,%eax
and    $0x3,%eax
cltq
mulsd  -0x80(%rbp,%rax,8),%xmm0
mov    -0x88(%rbp),%rax
movslq -0x8c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x8c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8c(%rbp)
jmp    1426 <GetEquilibriumDistCodon+0x2b6>
jmp    14f1 <GetEquilibriumDistCodon+0x381>
movl   $0x0,-0x8c(%rbp)
cmpl   $0x40,-0x8c(%rbp)
jge    14ec <GetEquilibriumDistCodon+0x37c>
mov    -0x8(%rbp),%rax
movslq -0x8c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x88(%rbp),%rax
movslq -0x8c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x8c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8c(%rbp)
jmp    14a8 <GetEquilibriumDistCodon+0x338>
jmp    14f1 <GetEquilibriumDistCodon+0x381>
mov    -0x10(%rbp),%edi
call   1040 <NumberSenseCodonsInGenCode@plt>
mov    %eax,%edi
mov    $0x8,%esi
call   1060 <calloc@plt>
mov    %rax,-0x18(%rbp)
xor    %eax,%eax
cmp    -0x18(%rbp),%rax
jne    1536 <GetEquilibriumDistCodon+0x3c6>
mov    0x2ac4(%rip),%rax
mov    (%rax),%edi
lea    0xaeb(%rip),%rsi
lea    0xaf9(%rip),%rdx
mov    $0x3a7,%ecx
call   1070 <err@plt>
movl   $0x0,-0x8c(%rbp)
cmpl   $0x40,-0x8c(%rbp)
jge    15c8 <GetEquilibriumDistCodon+0x458>
mov    -0x8c(%rbp),%edi
mov    -0x10(%rbp),%esi
call   1090 <IsStop@plt>
cmp    $0x0,%eax
jne    15af <GetEquilibriumDistCodon+0x43f>
mov    -0x88(%rbp),%rax
movslq -0x8c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
mov    -0x18(%rbp),%rax
mov    %rax,-0xa0(%rbp)
mov    -0x8c(%rbp),%edi
mov    -0x10(%rbp),%esi
call   1080 <CodonToQcoord@plt>
movsd  -0xa8(%rbp),%xmm0
ff
mov    %rax,%rcx
mov    -0xa0(%rbp),%rax
movsd  %xmm0,(%rax,%rcx,8)
jmp    15b4 <GetEquilibriumDistCodon+0x444>
mov    -0x8c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8c(%rbp)
jmp    1540 <GetEquilibriumDistCodon+0x3d0>
mov    -0x88(%rbp),%rdi
call   1030 <free@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0xb0(%rbp)
mov    -0x10(%rbp),%edi
call   1040 <NumberSenseCodonsInGenCode@plt>
mov    -0xb0(%rbp),%rdi
mov    %eax,%esi
movsd  0xa08(%rip),%xmm0
call   1050 <norm_vector@plt>
mov    -0x18(%rbp),%rax
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GetEquilibriumDistCodon>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x70,%rsp
mov    %edx,%ebp
mov    %esi,%r12d
mov    %rdi,%r15
mov    $0x40,%edi
mov    $0x8,%esi
call   1060 <calloc@plt>
mov    %rax,%r14
test   %rax,%rax
jne    11cc <GetEquilibriumDistCodon+0x4c>
mov    0x2e2e(%rip),%rax
mov    (%rax),%edi
lea    0xe5d(%rip),%rsi
lea    0xe6b(%rip),%rdx
mov    $0x37e,%ecx
call   1080 <err@plt>
lea    -0x1(%r12),%eax
cmp    $0x2,%eax
jae    12f9 <GetEquilibriumDistCodon+0x179>
xorpd  %xmm0,%xmm0
movapd %xmm0,0x50(%rsp)
movapd %xmm0,0x40(%rsp)
movapd %xmm0,0x30(%rsp)
movapd %xmm0,0x20(%rsp)
movapd %xmm0,0x10(%rsp)
movapd %xmm0,(%rsp)
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %eax,%ecx
and    $0x3,%ecx
movsd  (%r15,%rax,8),%xmm0
movsd  0x40(%rsp,%rcx,8),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,0x40(%rsp,%rcx,8)
mov    %eax,%ecx
and    $0xc,%ecx
movsd  0x20(%rsp,%rcx,2),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,0x20(%rsp,%rcx,2)
mov    %rax,%rcx
shr    %rcx
and    $0x7ffffff8,%ecx
addsd  (%rsp,%rcx,1),%xmm0
movsd  %xmm0,(%rsp,%rcx,1)
add    $0x1,%rax
cmp    $0x40,%rax
jne    1210 <GetEquilibriumDistCodon+0x90>
cmp    $0x2,%r12d
jne    12bc <GetEquilibriumDistCodon+0x13c>
movapd 0x20(%rsp),%xmm0
movapd 0x30(%rsp),%xmm1
addpd  (%rsp),%xmm0
addpd  0x10(%rsp),%xmm1
addpd  0x40(%rsp),%xmm0
addpd  0x50(%rsp),%xmm1
movapd 0xd6f(%rip),%xmm2
divpd  %xmm2,%xmm0
movapd %xmm0,(%rsp)
movapd %xmm0,0x20(%rsp)
movapd %xmm0,0x40(%rsp)
divpd  %xmm2,%xmm1
movapd %xmm1,0x10(%rsp)
movapd %xmm1,0x30(%rsp)
movapd %xmm1,0x50(%rsp)
xor    %eax,%eax
xchg   %ax,%ax
mov    %eax,%ecx
and    $0x3,%ecx
movsd  0x40(%rsp,%rcx,8),%xmm0
mov    %eax,%ecx
and    $0xc,%ecx
mulsd  0x20(%rsp,%rcx,2),%xmm0
mov    %rax,%rcx
shr    %rcx
and    $0x7ffffff8,%ecx
mulsd  (%rsp,%rcx,1),%xmm0
movsd  %xmm0,(%r14,%rax,8)
add    $0x1,%rax
cmp    $0x40,%rax
jne    12c0 <GetEquilibriumDistCodon+0x140>
jmp    1309 <GetEquilibriumDistCodon+0x189>
mov    $0x200,%edx
mov    %r14,%rdi
mov    %r15,%rsi
call   1070 <memcpy@plt>
mov    %ebp,%edi
call   1040 <NumberSenseCodonsInGenCode@plt>
mov    %eax,%edi
mov    $0x8,%esi
call   1060 <calloc@plt>
mov    %rax,%r15
test   %rax,%rax
jne    1345 <GetEquilibriumDistCodon+0x1c5>
mov    0x2cb5(%rip),%rax
mov    (%rax),%edi
lea    0xce4(%rip),%rsi
lea    0xcf2(%rip),%rdx
mov    $0x3a7,%ecx
call   1080 <err@plt>
xor    %ebx,%ebx
jmp    135a <GetEquilibriumDistCodon+0x1da>
nopl   0x0(%rax)
add    $0x1,%rbx
cmp    $0x40,%rbx
je     138a <GetEquilibriumDistCodon+0x20a>
mov    %ebx,%edi
mov    %ebp,%esi
call   10a0 <IsStop@plt>
test   %eax,%eax
jne    1350 <GetEquilibriumDistCodon+0x1d0>
movsd  (%r14,%rbx,8),%xmm0
movsd  %xmm0,0x68(%rsp)
mov    %ebx,%edi
mov    %ebp,%esi
call   1090 <CodonToQcoord@plt>
movsd  0x68(%rsp),%xmm0
movsd  %xmm0,(%r15,%rax,8)
jmp    1350 <GetEquilibriumDistCodon+0x1d0>
mov    %r14,%rdi
call   1030 <free@plt>
mov    %ebp,%edi
call   1040 <NumberSenseCodonsInGenCode@plt>
movsd  0xc6f(%rip),%xmm0
mov    %r15,%rdi
mov    %eax,%esi
call   1050 <norm_vector@plt>
mov    %r15,%rax
add    $0x70,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@EXIT_FAILURE = global i32 0
@.str = [21 x i8] c"Out of memory %s:%d\0A\00"
@.str.1 = [143 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/timmassingham/SLR/refs/heads/master/src/codonmodel.c\00"
define double* @GetEquilibriumDistCodon(double* %0, i32 %1, i32 %2) {
%4 = alloca double*
%5 = alloca i32
%6 = alloca i32
%7 = alloca double*
%8 = alloca [12 x double]
%9 = alloca double*
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
store double* %0, double** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%13 = call double* @calloc(i32 64, i32 8)
store double* %13, double** %9
%14 = load double*, double** %9
%15 = icmp eq double* null, %14
br i1 %15, label %16, label %19
16: ; preds = %3
%17 = load i32, i32* @EXIT_FAILURE
%18 = call i32 @err(i32 %17, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([143 x i8], [143 x i8]* @.str.1, i64 0, i64 0), i32 894)
br label %19
19: ; preds = %16, %3
%20 = load i32, i32* %5
%21 = icmp eq i32 %20, 1
br i1 %21, label %25, label %22
22: ; preds = %19
%23 = load i32, i32* %5
%24 = icmp eq i32 %23, 2
br i1 %24, label %25, label %187
25: ; preds = %22, %19
store i32 0, i32* %11
br label %26
26: ; preds = %33, %25
%27 = load i32, i32* %11
%28 = icmp slt i32 %27, 12
br i1 %28, label %29, label %36
29: ; preds = %26
%30 = load i32, i32* %11
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [12 x double], [12 x double]* %8, i64 0, i64 %31
store double 0.000000e+00, double* %32
br label %33
33: ; preds = %29
%34 = load i32, i32* %11
%35 = add nsw i32 %34, 1
store i32 %35, i32* %11
br label %26
36: ; preds = %26
store i32 0, i32* %10
br label %37
37: ; preds = %81, %36
%38 = load i32, i32* %10
%39 = icmp slt i32 %38, 64
br i1 %39, label %40, label %84
40: ; preds = %37
%41 = load i32, i32* %10
%42 = and i32 %41, 3
store i32 %42, i32* %12
%43 = load double*, double** %4
%44 = load i32, i32* %10
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds double, double* %43, i64 %45
%47 = load double, double* %46
%48 = load i32, i32* %12
%49 = add nsw i32 8, %48
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds [12 x double], [12 x double]* %8, i64 0, i64 %50
%52 = load double, double* %51
%53 = fadd double %52, %47
store double %53, double* %51
%54 = load i32, i32* %10
%55 = ashr i32 %54, 2
%56 = and i32 %55, 3
store i32 %56, i32* %12
%57 = load double*, double** %4
%58 = load i32, i32* %10
%59 = sext i32 %58 to i64
%60 = getelementptr inbounds double, double* %57, i64 %59
%61 = load double, double* %60
%62 = load i32, i32* %12
%63 = add nsw i32 4, %62
%64 = sext i32 %63 to i64
%65 = getelementptr inbounds [12 x double], [12 x double]* %8, i64 0, i64 %64
%66 = load double, double* %65
%67 = fadd double %66, %61
store double %67, double* %65
%68 = load i32, i32* %10
%69 = ashr i32 %68, 4
%70 = and i32 %69, 3
store i32 %70, i32* %12
%71 = load double*, double** %4
%72 = load i32, i32* %10
%73 = sext i32 %72 to i64
%74 = getelementptr inbounds double, double* %71, i64 %73
%75 = load double, double* %74
%76 = load i32, i32* %12
%77 = sext i32 %76 to i64
%78 = getelementptr inbounds [12 x double], [12 x double]* %8, i64 0, i64 %77
%79 = load double, double* %78
%80 = fadd double %79, %75
store double %80, double* %78
br label %81
81: ; preds = %40
%82 = load i32, i32* %10
%83 = add nsw i32 %82, 1
store i32 %83, i32* %10
br label %37
84: ; preds = %37
%85 = load i32, i32* %5
%86 = icmp eq i32 %85, 2
br i1 %86, label %87, label %153
87: ; preds = %84
store i32 0, i32* %12
br label %88
88: ; preds = %102, %87
%89 = load i32, i32* %12
%90 = icmp slt i32 %89, 4
br i1 %90, label %91, label %105
91: ; preds = %88
%92 = load i32, i32* %12
%93 = add nsw i32 4, %92
%94 = sext i32 %93 to i64
%95 = getelementptr inbounds [12 x double], [12 x double]* %8, i64 0, i64 %94
%96 = load double, double* %95
%97 = load i32, i32* %12
%98 = sext i32 %97 to i64
%99 = getelementptr inbounds [12 x double], [12 x double]* %8, i64 0, i64 %98
%100 = load double, double* %99
%101 = fadd double %100, %96
store double %101, double* %99
br label %102
102: ; preds = %91
%103 = load i32, i32* %12
%104 = add nsw i32 %103, 1
store i32 %104, i32* %12
br label %88
105: ; preds = %88
store i32 0, i32* %12
br label %106
106: ; preds = %120, %105
%107 = load i32, i32* %12
%108 = icmp slt i32 %107, 4
br i1 %108, label %109, label %123
109: ; preds = %106
%110 = load i32, i32* %12
%111 = add nsw i32 8, %110
%112 = sext i32 %111 to i64
%113 = getelementptr inbounds [12 x double], [12 x double]* %8, i64 0, i64 %112
%114 = load double, double* %113
%115 = load i32, i32* %12
%116 = sext i32 %115 to i64
%117 = getelementptr inbounds [12 x double], [12 x double]* %8, i64 0, i64 %116
%118 = load double, double* %117
%119 = fadd double %118, %114
store double %119, double* %117
br label %120
120: ; preds = %109
%121 = load i32, i32* %12
%122 = add nsw i32 %121, 1
store i32 %122, i32* %12
br label %106
123: ; preds = %106
store i32 0, i32* %12
br label %124
124: ; preds = %149, %123
%125 = load i32, i32* %12
%126 = icmp slt i32 %125, 4
br i1 %126, label %127, label %152
127: ; preds = %124
%128 = load i32, i32* %12
%129 = sext i32 %128 to i64
%130 = getelementptr inbounds [12 x double], [12 x double]* %8, i64 0, i64 %129
%131 = load double, double* %130
%132 = fdiv double %131, 3.000000e+00
store double %132, double* %130
%133 = load i32, i32* %12
%134 = sext i32 %133 to i64
%135 = getelementptr inbounds [12 x double], [12 x double]* %8, i64 0, i64 %134
%136 = load double, double* %135
%137 = load i32, i32* %12
%138 = add nsw i32 4, %137
%139 = sext i32 %138 to i64
%140 = getelementptr inbounds [12 x double], [12 x double]* %8, i64 0, i64 %139
store double %136, double* %140
%141 = load i32, i32* %12
%142 = sext i32 %141 to i64
%143 = getelementptr inbounds [12 x double], [12 x double]* %8, i64 0, i64 %142
%144 = load double, double* %143
%145 = load i32, i32* %12
%146 = add nsw i32 8, %145
%147 = sext i32 %146 to i64
%148 = getelementptr inbounds [12 x double], [12 x double]* %8, i64 0, i64 %147
store double %144, double* %148
br label %149
149: ; preds = %127
%150 = load i32, i32* %12
%151 = add nsw i32 %150, 1
store i32 %151, i32* %12
br label %124
152: ; preds = %124
br label %153
153: ; preds = %152, %84
store i32 0, i32* %10
br label %154
154: ; preds = %183, %153
%155 = load i32, i32* %10
%156 = icmp slt i32 %155, 64
br i1 %156, label %157, label %186
157: ; preds = %154
%158 = load i32, i32* %10
%159 = and i32 %158, 3
%160 = add nsw i32 8, %159
%161 = sext i32 %160 to i64
%162 = getelementptr inbounds [12 x double], [12 x double]* %8, i64 0, i64 %161
%163 = load double, double* %162
%164 = load i32, i32* %10
%165 = ashr i32 %164, 2
%166 = and i32 %165, 3
%167 = add nsw i32 4, %166
%168 = sext i32 %167 to i64
%169 = getelementptr inbounds [12 x double], [12 x double]* %8, i64 0, i64 %168
%170 = load double, double* %169
%171 = fmul double %163, %170
%172 = load i32, i32* %10
%173 = ashr i32 %172, 4
%174 = and i32 %173, 3
%175 = sext i32 %174 to i64
%176 = getelementptr inbounds [12 x double], [12 x double]* %8, i64 0, i64 %175
%177 = load double, double* %176
%178 = fmul double %171, %177
%179 = load double*, double** %9
%180 = load i32, i32* %10
%181 = sext i32 %180 to i64
%182 = getelementptr inbounds double, double* %179, i64 %181
store double %178, double* %182
br label %183
183: ; preds = %157
%184 = load i32, i32* %10
%185 = add nsw i32 %184, 1
store i32 %185, i32* %10
br label %154
186: ; preds = %154
br label %205
187: ; preds = %22
store i32 0, i32* %10
br label %188
188: ; preds = %201, %187
%189 = load i32, i32* %10
%190 = icmp slt i32 %189, 64
br i1 %190, label %191, label %204
191: ; preds = %188
%192 = load double*, double** %4
%193 = load i32, i32* %10
%194 = sext i32 %193 to i64
%195 = getelementptr inbounds double, double* %192, i64 %194
%196 = load double, double* %195
%197 = load double*, double** %9
%198 = load i32, i32* %10
%199 = sext i32 %198 to i64
%200 = getelementptr inbounds double, double* %197, i64 %199
store double %196, double* %200
br label %201
201: ; preds = %191
%202 = load i32, i32* %10
%203 = add nsw i32 %202, 1
store i32 %203, i32* %10
br label %188
204: ; preds = %188
br label %205
205: ; preds = %204, %186
%206 = load i32, i32* %6
%207 = call i32 @NumberSenseCodonsInGenCode(i32 %206)
%208 = call double* @calloc(i32 %207, i32 8)
store double* %208, double** %7
%209 = load double*, double** %7
%210 = icmp eq double* null, %209
br i1 %210, label %211, label %214
211: ; preds = %205
%212 = load i32, i32* @EXIT_FAILURE
%213 = call i32 @err(i32 %212, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([143 x i8], [143 x i8]* @.str.1, i64 0, i64 0), i32 935)
br label %214
214: ; preds = %211, %205
store i32 0, i32* %10
br label %215
215: ; preds = %235, %214
%216 = load i32, i32* %10
%217 = icmp slt i32 %216, 64
br i1 %217, label %218, label %238
218: ; preds = %215
%219 = load i32, i32* %10
%220 = load i32, i32* %6
%221 = call i32 @IsStop(i32 %219, i32 %220)
%222 = icmp ne i32 %221, 0
br i1 %222, label %234, label %223
223: ; preds = %218
%224 = load double*, double** %9
%225 = load i32, i32* %10
%226 = sext i32 %225 to i64
%227 = getelementptr inbounds double, double* %224, i64 %226
%228 = load double, double* %227
%229 = load double*, double** %7
%230 = load i32, i32* %10
%231 = load i32, i32* %6
%232 = call i64 @CodonToQcoord(i32 %230, i32 %231)
%233 = getelementptr inbounds double, double* %229, i64 %232
store double %228, double* %233
br label %234
234: ; preds = %223, %218
br label %235
235: ; preds = %234
%236 = load i32, i32* %10
%237 = add nsw i32 %236, 1
store i32 %237, i32* %10
br label %215
238: ; preds = %215
%239 = load double*, double** %9
%240 = call i32 @free(double* %239)
%241 = load double*, double** %7
%242 = load i32, i32* %6
%243 = call i32 @NumberSenseCodonsInGenCode(i32 %242)
%244 = call i32 @norm_vector(double* %241, i32 %243, double 1.000000e+00)
%245 = load double*, double** %7
ret double* %245
}

LLVM IR (-O2):
@EXIT_FAILURE = global i32 0
@.str = [21 x i8] c"Out of memory %s:%d\0A\00"
@.str.1 = [143 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/timmassingham/SLR/refs/heads/master/src/codonmodel.c\00"
define double* @GetEquilibriumDistCodon(double* nocapture %0, i32 %1, i32 %2) {
%4 = bitcast double* %0 to i8*
%5 = alloca [12 x double]
%6 = bitcast [12 x double]* %5 to i8*
%7 = tail call double* @calloc(i32 64, i32 8)
%8 = bitcast double* %7 to i8*
%9 = icmp eq double* %7, null
br i1 %9, label %10, label %13
10: ; preds = %3
%11 = load i32, i32* @EXIT_FAILURE
%12 = tail call i32 @err(i32 %11, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([143 x i8], [143 x i8]* @.str.1, i64 0, i64 0), i32 894)
br label %13
13: ; preds = %10, %3
%14 = icmp eq i32 %1, 2
%15 = add i32 %1, -1
%16 = icmp ult i32 %15, 2
br i1 %16, label %18, label %17
17: ; preds = %13
br label %93
18: ; preds = %13
br label %19
19: ; preds = %18, %19
%20 = phi i64 [ 0, %18 ], [ %39, %19 ]
%21 = and i64 %20, 3
%22 = getelementptr inbounds double, double* %0, i64 %20
%23 = load double, double* %22
%24 = or i64 %21, 8
%25 = getelementptr inbounds [12 x double], [12 x double]* %5, i64 0, i64 %24
%26 = load double, double* %25
%27 = fadd double %23, %26
store double %27, double* %25
%28 = lshr i64 %20, 2
%29 = and i64 %28, 3
%30 = or i64 %29, 4
%31 = getelementptr inbounds [12 x double], [12 x double]* %5, i64 0, i64 %30
%32 = load double, double* %31
%33 = fadd double %23, %32
store double %33, double* %31
%34 = lshr i64 %20, 4
%35 = and i64 %34, 268435455
%36 = getelementptr inbounds [12 x double], [12 x double]* %5, i64 0, i64 %35
%37 = load double, double* %36
%38 = fadd double %23, %37
store double %38, double* %36
%39 = add nuw nsw i64 %20, 1
%40 = icmp eq i64 %39, 64
br i1 %40, label %41, label %19
41: ; preds = %19
br i1 %14, label %42, label %72
42: ; preds = %41
%43 = getelementptr inbounds [12 x double], [12 x double]* %5, i64 0, i64 4
%44 = bitcast double* %43 to <2 x double>*
%45 = load <2 x double>, <2 x double>* %44
%46 = bitcast [12 x double]* %5 to <2 x double>*
%47 = load <2 x double>, <2 x double>* %46
%48 = fadd <2 x double> %45, %47
%49 = getelementptr inbounds [12 x double], [12 x double]* %5, i64 0, i64 6
%50 = getelementptr inbounds [12 x double], [12 x double]* %5, i64 0, i64 2
%51 = bitcast double* %49 to <2 x double>*
%52 = load <2 x double>, <2 x double>* %51
%53 = bitcast double* %50 to <2 x double>*
%54 = load <2 x double>, <2 x double>* %53
%55 = fadd <2 x double> %52, %54
%56 = getelementptr inbounds [12 x double], [12 x double]* %5, i64 0, i64 8
%57 = bitcast double* %56 to <2 x double>*
%58 = load <2 x double>, <2 x double>* %57
%59 = fadd <2 x double> %58, %48
%60 = getelementptr inbounds [12 x double], [12 x double]* %5, i64 0, i64 10
%61 = bitcast double* %60 to <2 x double>*
%62 = load <2 x double>, <2 x double>* %61
%63 = fadd <2 x double> %62, %55
%64 = fdiv <2 x double> %59, <double 3.000000e+00, double 3.000000e+00>
%65 = bitcast [12 x double]* %5 to <2 x double>*
store <2 x double> %64, <2 x double>* %65
%66 = bitcast double* %43 to <2 x double>*
store <2 x double> %64, <2 x double>* %66
%67 = bitcast double* %56 to <2 x double>*
store <2 x double> %64, <2 x double>* %67
%68 = fdiv <2 x double> %63, <double 3.000000e+00, double 3.000000e+00>
%69 = bitcast double* %50 to <2 x double>*
store <2 x double> %68, <2 x double>* %69
%70 = bitcast double* %49 to <2 x double>*
store <2 x double> %68, <2 x double>* %70
%71 = bitcast double* %60 to <2 x double>*
store <2 x double> %68, <2 x double>* %71
br label %72
72: ; preds = %42, %41
br label %73
73: ; preds = %72, %73
%74 = phi i64 [ %91, %73 ], [ 0, %72 ]
%75 = and i64 %74, 3
%76 = or i64 %75, 8
%77 = getelementptr inbounds [12 x double], [12 x double]* %5, i64 0, i64 %76
%78 = load double, double* %77
%79 = lshr i64 %74, 2
%80 = and i64 %79, 3
%81 = or i64 %80, 4
%82 = getelementptr inbounds [12 x double], [12 x double]* %5, i64 0, i64 %81
%83 = load double, double* %82
%84 = fmul double %78, %83
%85 = lshr i64 %74, 4
%86 = and i64 %85, 268435455
%87 = getelementptr inbounds [12 x double], [12 x double]* %5, i64 0, i64 %86
%88 = load double, double* %87
%89 = fmul double %84, %88
%90 = getelementptr inbounds double, double* %7, i64 %74
store double %89, double* %90
%91 = add nuw nsw i64 %74, 1
%92 = icmp eq i64 %91, 64
br i1 %92, label %93, label %73
93: ; preds = %73, %17
%94 = tail call i32 @NumberSenseCodonsInGenCode(i32 %2)
%95 = tail call double* @calloc(i32 %94, i32 8)
%96 = icmp eq double* %95, null
br i1 %96, label %97, label %100
97: ; preds = %93
%98 = load i32, i32* @EXIT_FAILURE
%99 = tail call i32 @err(i32 %98, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([143 x i8], [143 x i8]* @.str.1, i64 0, i64 0), i32 935)
br label %100
100: ; preds = %97, %93
br label %101
101: ; preds = %100, %111
%102 = phi i64 [ %112, %111 ], [ 0, %100 ]
%103 = trunc i64 %102 to i32
%104 = tail call i32 @IsStop(i32 %103, i32 %2)
%105 = icmp eq i32 %104, 0
br i1 %105, label %106, label %111
106: ; preds = %101
%107 = getelementptr inbounds double, double* %7, i64 %102
%108 = load double, double* %107
%109 = tail call i64 @CodonToQcoord(i32 %103, i32 %2)
%110 = getelementptr inbounds double, double* %95, i64 %109
store double %108, double* %110
br label %111
111: ; preds = %101, %106
%112 = add nuw nsw i64 %102, 1
%113 = icmp eq i64 %112, 64
br i1 %113, label %114, label %101
114: ; preds = %111
%115 = tail call i32 @free(double* %7)
%116 = tail call i32 @NumberSenseCodonsInGenCode(i32 %2)
%117 = tail call i32 @norm_vector(double* %95, i32 %116, double 1.000000e+00)
ret double* %95
}