#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 */
struct prior_s {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ ProbifyPairEmission(double **, struct prior_s *);
int /*<<< orphan*/ ProbifySingletEmission(double *, int, struct prior_s *);
int dot_score(double *, double *, int);
int /*<<< orphan*/ memcpy(void *, void *, int);
int pair_emissioncost(int *coli, int *colj, float *weights, int nseq,
                      struct prior_s *prior) {
  double matp_count[4][4];
  double matl_count[4];
  double matr_count[4];
  double matp_emit[4][4];
  double matl_emit[4];
  double matr_emit[4];
  int sc;
  int symi, symj;
  int idx;
  for (symi = 0; symi < 4; symi++) {
    matr_count[symi] = 0.0;
    matl_count[symi] = 0.0;
    for (symj = 0; symj < 4; symj++)
      matp_count[symi][symj] = 0.0;
  }
  for (idx = 0; idx < nseq; idx++) {
    if (coli[idx] == -1) {
      if (colj[idx] == -1)
        continue;
      else
        matl_count[colj[idx]] += weights[idx];
    } else if (colj[idx] == -1)
      matr_count[coli[idx]] += weights[idx];
    else
      matp_count[coli[idx]][colj[idx]] += weights[idx];
  }
  memcpy((void *)matl_emit, (void *)matl_count, sizeof(double) * 4);
  memcpy((void *)matr_emit, (void *)matr_count, sizeof(double) * 4);
  memcpy((void *)matp_emit, (void *)matp_count, sizeof(double) * 4 * 4);
  ProbifySingletEmission(matl_emit, (1 << 2), prior);
  ProbifySingletEmission(matr_emit, (1 << 3), prior);
  ProbifyPairEmission(matp_emit, prior);
  for (symi = 0; symi < 4; symi++) {
    matl_emit[symi] *= (double)4;
    matr_emit[symi] *= (double)4;
    for (symj = 0; symj < 4; symj++)
      matp_emit[symi][symj] *= (double)(4 * 4);
  }
  sc = dot_score((double *)matl_count, (double *)matl_emit, 4) +
       dot_score((double *)matr_count, (double *)matr_emit, 4) +
       dot_score((double *)matp_count, (double *)matp_emit, 4 * 4);
  return sc;
}


x86 assembly (clang, -O0):
<pair_emissioncost>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1d0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8,-0x28(%rbp)
movl   $0x0,-0x1b8(%rbp)
cmpl   $0x4,-0x1b8(%rbp)
jge    1203 <pair_emissioncost+0xc3>
movslq -0x1b8(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,-0xf0(%rbp,%rax,8)
ff ff
movslq -0x1b8(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,-0xd0(%rbp,%rax,8)
ff ff
movl   $0x0,-0x1bc(%rbp)
cmpl   $0x4,-0x1bc(%rbp)
jge    11ea <pair_emissioncost+0xaa>
movslq -0x1b8(%rbp),%rcx
lea    -0xb0(%rbp),%rax
shl    $0x5,%rcx
add    %rcx,%rax
movslq -0x1bc(%rbp),%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x1bc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1bc(%rbp)
jmp    11a5 <pair_emissioncost+0x65>
jmp    11ef <pair_emissioncost+0xaf>
mov    -0x1b8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1b8(%rbp)
jmp    1168 <pair_emissioncost+0x28>
movl   $0x0,-0x1c0(%rbp)
mov    -0x1c0(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    133c <pair_emissioncost+0x1fc>
mov    -0x8(%rbp),%rax
movslq -0x1c0(%rbp),%rcx
cmpl   $0xffffffff,(%rax,%rcx,4)
jne    1285 <pair_emissioncost+0x145>
mov    -0x10(%rbp),%rax
movslq -0x1c0(%rbp),%rcx
cmpl   $0xffffffff,(%rax,%rcx,4)
jne    124b <pair_emissioncost+0x10b>
jmp    1328 <pair_emissioncost+0x1e8>
mov    -0x18(%rbp),%rax
movslq -0x1c0(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
mov    -0x10(%rbp),%rax
movslq -0x1c0(%rbp),%rcx
movslq (%rax,%rcx,4),%rax
addsd  -0xd0(%rbp,%rax,8),%xmm0
ff ff
movsd  %xmm0,-0xd0(%rbp,%rax,8)
ff ff
jmp    1323 <pair_emissioncost+0x1e3>
mov    -0x10(%rbp),%rax
movslq -0x1c0(%rbp),%rcx
cmpl   $0xffffffff,(%rax,%rcx,4)
jne    12d4 <pair_emissioncost+0x194>
mov    -0x18(%rbp),%rax
movslq -0x1c0(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
mov    -0x8(%rbp),%rax
movslq -0x1c0(%rbp),%rcx
movslq (%rax,%rcx,4),%rax
addsd  -0xf0(%rbp,%rax,8),%xmm0
ff ff
movsd  %xmm0,-0xf0(%rbp,%rax,8)
ff ff
jmp    131e <pair_emissioncost+0x1de>
mov    -0x18(%rbp),%rax
movslq -0x1c0(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
mov    -0x8(%rbp),%rax
movslq -0x1c0(%rbp),%rcx
movslq (%rax,%rcx,4),%rcx
lea    -0xb0(%rbp),%rax
shl    $0x5,%rcx
add    %rcx,%rax
mov    -0x10(%rbp),%rcx
movslq -0x1c0(%rbp),%rdx
movslq (%rcx,%rdx,4),%rcx
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
jmp    1323 <pair_emissioncost+0x1e3>
jmp    1328 <pair_emissioncost+0x1e8>
mov    -0x1c0(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c0(%rbp)
jmp    120d <pair_emissioncost+0xcd>
lea    -0x190(%rbp),%rdi
lea    -0xd0(%rbp),%rsi
mov    $0x20,%edx
call   1040 <memcpy@plt>
lea    -0x1b0(%rbp),%rdi
lea    -0xf0(%rbp),%rsi
mov    $0x20,%edx
call   1040 <memcpy@plt>
lea    -0x170(%rbp),%rdi
lea    -0xb0(%rbp),%rsi
mov    $0x80,%edx
call   1040 <memcpy@plt>
lea    -0x190(%rbp),%rdi
mov    -0x28(%rbp),%rdx
mov    $0x4,%esi
call   1060 <ProbifySingletEmission@plt>
lea    -0x1b0(%rbp),%rdi
mov    -0x28(%rbp),%rdx
mov    $0x8,%esi
call   1060 <ProbifySingletEmission@plt>
lea    -0x170(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1030 <ProbifyPairEmission@plt>
movl   $0x0,-0x1b8(%rbp)
cmpl   $0x4,-0x1b8(%rbp)
jge    1489 <pair_emissioncost+0x349>
movslq -0x1b8(%rbp),%rax
movsd  0xc1c(%rip),%xmm0
mulsd  -0x190(%rbp,%rax,8),%xmm0
ff ff
movsd  %xmm0,-0x190(%rbp,%rax,8)
ff ff
movslq -0x1b8(%rbp),%rax
movsd  0xbfb(%rip),%xmm0
mulsd  -0x1b0(%rbp,%rax,8),%xmm0
ff ff
movsd  %xmm0,-0x1b0(%rbp,%rax,8)
ff ff
movl   $0x0,-0x1bc(%rbp)
cmpl   $0x4,-0x1bc(%rbp)
jge    1470 <pair_emissioncost+0x330>
movslq -0x1b8(%rbp),%rcx
lea    -0x170(%rbp),%rax
shl    $0x5,%rcx
add    %rcx,%rax
movslq -0x1bc(%rbp),%rcx
movsd  0xbb6(%rip),%xmm0
mulsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x1bc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1bc(%rbp)
jmp    1421 <pair_emissioncost+0x2e1>
jmp    1475 <pair_emissioncost+0x335>
mov    -0x1b8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1b8(%rbp)
jmp    13c8 <pair_emissioncost+0x288>
lea    -0xd0(%rbp),%rdi
lea    -0x190(%rbp),%rsi
mov    $0x4,%edx
call   1050 <dot_score@plt>
mov    %eax,-0x1c8(%rbp)
lea    -0xf0(%rbp),%rdi
lea    -0x1b0(%rbp),%rsi
mov    $0x4,%edx
call   1050 <dot_score@plt>
mov    %eax,%ecx
mov    -0x1c8(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x1c4(%rbp)
lea    -0xb0(%rbp),%rdi
lea    -0x170(%rbp),%rsi
mov    $0x10,%edx
call   1050 <dot_score@plt>
mov    %eax,%ecx
mov    -0x1c4(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x1b4(%rbp)
mov    -0x1b4(%rbp),%eax
add    $0x1d0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pair_emissioncost>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x188,%rsp
mov    %r8,%r12
xorpd  %xmm0,%xmm0
movapd %xmm0,0xc0(%rsp)
movapd %xmm0,0xd0(%rsp)
movapd %xmm0,0xe0(%rsp)
movapd %xmm0,0xf0(%rsp)
movapd %xmm0,0x100(%rsp)
movapd %xmm0,0x110(%rsp)
movapd %xmm0,0x120(%rsp)
movapd %xmm0,0x130(%rsp)
movapd %xmm0,0x140(%rsp)
movapd %xmm0,0x150(%rsp)
movapd %xmm0,0x160(%rsp)
movapd %xmm0,0x170(%rsp)
test   %ecx,%ecx
jle    1237 <pair_emissioncost+0xf7>
mov    %ecx,%eax
xor    %ecx,%ecx
jmp    11f9 <pair_emissioncost+0xb9>
xchg   %ax,%ax
shl    $0x5,%rbx
add    %rsp,%rbx
add    $0x100,%rbx
lea    (%rbx,%rbp,8),%rbp
cvtss2sd %xmm0,%xmm0
addsd  0x0(%rbp),%xmm0
movsd  %xmm0,0x0(%rbp)
add    $0x1,%rcx
cmp    %rcx,%rax
je     1237 <pair_emissioncost+0xf7>
movslq (%rdi,%rcx,4),%rbx
movslq (%rsi,%rcx,4),%rbp
cmp    $0xffffffffffffffff,%rbx
je     1220 <pair_emissioncost+0xe0>
movss  (%rdx,%rcx,4),%xmm0
cmp    $0xffffffff,%ebp
jne    11d0 <pair_emissioncost+0x90>
lea    (%rsp,%rbx,8),%rbp
add    $0xc0,%rbp
jmp    11e2 <pair_emissioncost+0xa2>
xchg   %ax,%ax
cmp    $0xffffffff,%ebp
je     11f0 <pair_emissioncost+0xb0>
movss  (%rdx,%rcx,4),%xmm0
lea    (%rsp,%rbp,8),%rbp
add    $0xe0,%rbp
jmp    11e2 <pair_emissioncost+0xa2>
lea    0x20(%rsp),%r14
lea    0xe0(%rsp),%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0x20,%edx
call   1040 <memcpy@plt>
mov    %rsp,%r13
lea    0xc0(%rsp),%rbp
mov    %r13,%rdi
mov    %rbp,%rsi
mov    $0x20,%edx
call   1040 <memcpy@plt>
lea    0x40(%rsp),%r15
lea    0x100(%rsp),%rsi
mov    %r15,%rdi
mov    $0x80,%edx
call   1040 <memcpy@plt>
mov    %r14,%rdi
mov    $0x4,%esi
mov    %r12,%rdx
call   1060 <ProbifySingletEmission@plt>
mov    %r13,%rdi
mov    $0x8,%esi
mov    %r12,%rdx
call   1060 <ProbifySingletEmission@plt>
mov    %r15,%rdi
mov    %r12,%rsi
call   1030 <ProbifyPairEmission@plt>
movapd 0xd44(%rip),%xmm0
movapd 0x40(%rsp),%xmm1
mulpd  %xmm0,%xmm1
movapd %xmm1,0x40(%rsp)
movapd 0x50(%rsp),%xmm1
mulpd  %xmm0,%xmm1
movapd %xmm1,0x50(%rsp)
movapd 0xd2c(%rip),%xmm1
movapd 0x20(%rsp),%xmm2
mulpd  %xmm1,%xmm2
movapd %xmm2,0x20(%rsp)
movapd (%rsp),%xmm2
mulpd  %xmm1,%xmm2
movapd %xmm2,(%rsp)
movapd 0x60(%rsp),%xmm2
mulpd  %xmm0,%xmm2
movapd %xmm2,0x60(%rsp)
movapd 0x70(%rsp),%xmm2
mulpd  %xmm0,%xmm2
movapd %xmm2,0x70(%rsp)
movapd 0x80(%rsp),%xmm2
mulpd  %xmm0,%xmm2
movapd %xmm2,0x80(%rsp)
movapd 0x90(%rsp),%xmm2
mulpd  %xmm0,%xmm2
movapd %xmm2,0x90(%rsp)
movapd 0x30(%rsp),%xmm2
mulpd  %xmm1,%xmm2
mulpd  0x10(%rsp),%xmm1
movapd %xmm2,0x30(%rsp)
movapd %xmm1,0x10(%rsp)
movapd 0xa0(%rsp),%xmm1
mulpd  %xmm0,%xmm1
movapd %xmm1,0xa0(%rsp)
mulpd  0xb0(%rsp),%xmm0
movapd %xmm0,0xb0(%rsp)
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x4,%edx
call   1050 <dot_score@plt>
mov    %eax,%ebx
mov    %rbp,%rdi
mov    %r13,%rsi
mov    $0x4,%edx
call   1050 <dot_score@plt>
mov    %eax,%ebp
add    %ebx,%ebp
lea    0x100(%rsp),%rdi
mov    %r15,%rsi
mov    $0x10,%edx
call   1050 <dot_score@plt>
add    %ebp,%eax
add    $0x188,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.prior_s = type { i32 }
define i32 @pair_emissioncost(i32* %0, i32* %1, float* %2, i32 %3, %struct.prior_s* %4) {
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca float*
%9 = alloca i32
%10 = alloca %struct.prior_s*
%11 = alloca [4 x [4 x double]]
%12 = alloca [4 x double]
%13 = alloca [4 x double]
%14 = alloca [4 x [4 x double]]
%15 = alloca [4 x double]
%16 = alloca [4 x double]
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
store i32* %0, i32** %6
store i32* %1, i32** %7
store float* %2, float** %8
store i32 %3, i32* %9
store %struct.prior_s* %4, %struct.prior_s** %10
store i32 0, i32* %18
br label %21
21: ; preds = %45, %5
%22 = load i32, i32* %18
%23 = icmp slt i32 %22, 4
br i1 %23, label %24, label %48
24: ; preds = %21
%25 = load i32, i32* %18
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds [4 x double], [4 x double]* %13, i64 0, i64 %26
store double 0.000000e+00, double* %27
%28 = load i32, i32* %18
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds [4 x double], [4 x double]* %12, i64 0, i64 %29
store double 0.000000e+00, double* %30
store i32 0, i32* %19
br label %31
31: ; preds = %41, %24
%32 = load i32, i32* %19
%33 = icmp slt i32 %32, 4
br i1 %33, label %34, label %44
34: ; preds = %31
%35 = load i32, i32* %18
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds [4 x [4 x double]], [4 x [4 x double]]* %11, i64 0, i64 %36
%38 = load i32, i32* %19
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds [4 x double], [4 x double]* %37, i64 0, i64 %39
store double 0.000000e+00, double* %40
br label %41
41: ; preds = %34
%42 = load i32, i32* %19
%43 = add nsw i32 %42, 1
store i32 %43, i32* %19
br label %31
44: ; preds = %31
br label %45
45: ; preds = %44
%46 = load i32, i32* %18
%47 = add nsw i32 %46, 1
store i32 %47, i32* %18
br label %21
48: ; preds = %21
store i32 0, i32* %20
br label %49
49: ; preds = %133, %48
%50 = load i32, i32* %20
%51 = load i32, i32* %9
%52 = icmp slt i32 %50, %51
br i1 %52, label %53, label %136
53: ; preds = %49
%54 = load i32*, i32** %6
%55 = load i32, i32* %20
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds i32, i32* %54, i64 %56
%58 = load i32, i32* %57
%59 = icmp eq i32 %58, -1
br i1 %59, label %60, label %85
60: ; preds = %53
%61 = load i32*, i32** %7
%62 = load i32, i32* %20
%63 = sext i32 %62 to i64
%64 = getelementptr inbounds i32, i32* %61, i64 %63
%65 = load i32, i32* %64
%66 = icmp eq i32 %65, -1
br i1 %66, label %67, label %68
67: ; preds = %60
br label %133
68: ; preds = %60
%69 = load float*, float** %8
%70 = load i32, i32* %20
%71 = sext i32 %70 to i64
%72 = getelementptr inbounds float, float* %69, i64 %71
%73 = load float, float* %72
%74 = fpext float %73 to double
%75 = load i32*, i32** %7
%76 = load i32, i32* %20
%77 = sext i32 %76 to i64
%78 = getelementptr inbounds i32, i32* %75, i64 %77
%79 = load i32, i32* %78
%80 = sext i32 %79 to i64
%81 = getelementptr inbounds [4 x double], [4 x double]* %12, i64 0, i64 %80
%82 = load double, double* %81
%83 = fadd double %82, %74
store double %83, double* %81
br label %84
84: ; preds = %68
br label %132
85: ; preds = %53
%86 = load i32*, i32** %7
%87 = load i32, i32* %20
%88 = sext i32 %87 to i64
%89 = getelementptr inbounds i32, i32* %86, i64 %88
%90 = load i32, i32* %89
%91 = icmp eq i32 %90, -1
br i1 %91, label %92, label %108
92: ; preds = %85
%93 = load float*, float** %8
%94 = load i32, i32* %20
%95 = sext i32 %94 to i64
%96 = getelementptr inbounds float, float* %93, i64 %95
%97 = load float, float* %96
%98 = fpext float %97 to double
%99 = load i32*, i32** %6
%100 = load i32, i32* %20
%101 = sext i32 %100 to i64
%102 = getelementptr inbounds i32, i32* %99, i64 %101
%103 = load i32, i32* %102
%104 = sext i32 %103 to i64
%105 = getelementptr inbounds [4 x double], [4 x double]* %13, i64 0, i64 %104
%106 = load double, double* %105
%107 = fadd double %106, %98
store double %107, double* %105
br label %131
108: ; preds = %85
%109 = load float*, float** %8
%110 = load i32, i32* %20
%111 = sext i32 %110 to i64
%112 = getelementptr inbounds float, float* %109, i64 %111
%113 = load float, float* %112
%114 = fpext float %113 to double
%115 = load i32*, i32** %6
%116 = load i32, i32* %20
%117 = sext i32 %116 to i64
%118 = getelementptr inbounds i32, i32* %115, i64 %117
%119 = load i32, i32* %118
%120 = sext i32 %119 to i64
%121 = getelementptr inbounds [4 x [4 x double]], [4 x [4 x double]]* %11, i64 0, i64 %120
%122 = load i32*, i32** %7
%123 = load i32, i32* %20
%124 = sext i32 %123 to i64
%125 = getelementptr inbounds i32, i32* %122, i64 %124
%126 = load i32, i32* %125
%127 = sext i32 %126 to i64
%128 = getelementptr inbounds [4 x double], [4 x double]* %121, i64 0, i64 %127
%129 = load double, double* %128
%130 = fadd double %129, %114
store double %130, double* %128
br label %131
131: ; preds = %108, %92
br label %132
132: ; preds = %131, %84
br label %133
133: ; preds = %132, %67
%134 = load i32, i32* %20
%135 = add nsw i32 %134, 1
store i32 %135, i32* %20
br label %49
136: ; preds = %49
%137 = getelementptr inbounds [4 x double], [4 x double]* %15, i64 0, i64 0
%138 = bitcast double* %137 to i8*
%139 = getelementptr inbounds [4 x double], [4 x double]* %12, i64 0, i64 0
%140 = bitcast double* %139 to i8*
%141 = call i32 @memcpy(i8* %138, i8* %140, i32 32)
%142 = getelementptr inbounds [4 x double], [4 x double]* %16, i64 0, i64 0
%143 = bitcast double* %142 to i8*
%144 = getelementptr inbounds [4 x double], [4 x double]* %13, i64 0, i64 0
%145 = bitcast double* %144 to i8*
%146 = call i32 @memcpy(i8* %143, i8* %145, i32 32)
%147 = getelementptr inbounds [4 x [4 x double]], [4 x [4 x double]]* %14, i64 0, i64 0
%148 = bitcast [4 x double]* %147 to i8*
%149 = getelementptr inbounds [4 x [4 x double]], [4 x [4 x double]]* %11, i64 0, i64 0
%150 = bitcast [4 x double]* %149 to i8*
%151 = call i32 @memcpy(i8* %148, i8* %150, i32 128)
%152 = getelementptr inbounds [4 x double], [4 x double]* %15, i64 0, i64 0
%153 = load %struct.prior_s*, %struct.prior_s** %10
%154 = call i32 @ProbifySingletEmission(double* %152, i32 4, %struct.prior_s* %153)
%155 = getelementptr inbounds [4 x double], [4 x double]* %16, i64 0, i64 0
%156 = load %struct.prior_s*, %struct.prior_s** %10
%157 = call i32 @ProbifySingletEmission(double* %155, i32 8, %struct.prior_s* %156)
%158 = getelementptr inbounds [4 x [4 x double]], [4 x [4 x double]]* %14, i64 0, i64 0
%159 = bitcast [4 x double]* %158 to double**
%160 = load %struct.prior_s*, %struct.prior_s** %10
%161 = call i32 @ProbifyPairEmission(double** %159, %struct.prior_s* %160)
store i32 0, i32* %18
br label %162
162: ; preds = %192, %136
%163 = load i32, i32* %18
%164 = icmp slt i32 %163, 4
br i1 %164, label %165, label %195
165: ; preds = %162
%166 = load i32, i32* %18
%167 = sext i32 %166 to i64
%168 = getelementptr inbounds [4 x double], [4 x double]* %15, i64 0, i64 %167
%169 = load double, double* %168
%170 = fmul double %169, 4.000000e+00
store double %170, double* %168
%171 = load i32, i32* %18
%172 = sext i32 %171 to i64
%173 = getelementptr inbounds [4 x double], [4 x double]* %16, i64 0, i64 %172
%174 = load double, double* %173
%175 = fmul double %174, 4.000000e+00
store double %175, double* %173
store i32 0, i32* %19
br label %176
176: ; preds = %188, %165
%177 = load i32, i32* %19
%178 = icmp slt i32 %177, 4
br i1 %178, label %179, label %191
179: ; preds = %176
%180 = load i32, i32* %18
%181 = sext i32 %180 to i64
%182 = getelementptr inbounds [4 x [4 x double]], [4 x [4 x double]]* %14, i64 0, i64 %181
%183 = load i32, i32* %19
%184 = sext i32 %183 to i64
%185 = getelementptr inbounds [4 x double], [4 x double]* %182, i64 0, i64 %184
%186 = load double, double* %185
%187 = fmul double %186, 1.600000e+01
store double %187, double* %185
br label %188
188: ; preds = %179
%189 = load i32, i32* %19
%190 = add nsw i32 %189, 1
store i32 %190, i32* %19
br label %176
191: ; preds = %176
br label %192
192: ; preds = %191
%193 = load i32, i32* %18
%194 = add nsw i32 %193, 1
store i32 %194, i32* %18
br label %162
195: ; preds = %162
%196 = getelementptr inbounds [4 x double], [4 x double]* %12, i64 0, i64 0
%197 = getelementptr inbounds [4 x double], [4 x double]* %15, i64 0, i64 0
%198 = call i32 @dot_score(double* %196, double* %197, i32 4)
%199 = getelementptr inbounds [4 x double], [4 x double]* %13, i64 0, i64 0
%200 = getelementptr inbounds [4 x double], [4 x double]* %16, i64 0, i64 0
%201 = call i32 @dot_score(double* %199, double* %200, i32 4)
%202 = add nsw i32 %198, %201
%203 = getelementptr inbounds [4 x [4 x double]], [4 x [4 x double]]* %11, i64 0, i64 0
%204 = bitcast [4 x double]* %203 to double*
%205 = getelementptr inbounds [4 x [4 x double]], [4 x [4 x double]]* %14, i64 0, i64 0
%206 = bitcast [4 x double]* %205 to double*
%207 = call i32 @dot_score(double* %204, double* %206, i32 16)
%208 = add nsw i32 %202, %207
store i32 %208, i32* %17
%209 = load i32, i32* %17
ret i32 %209
}

LLVM IR (-O2):
%struct.prior_s = type { i32 }
define i32 @pair_emissioncost(i32* nocapture %0, i32* nocapture %1, float* nocapture %2, i32 %3, %struct.prior_s* %4) {
%6 = alloca [4 x [4 x double]]
%7 = bitcast [4 x [4 x double]]* %6 to i8*
%8 = alloca [4 x double]
%9 = bitcast [4 x double]* %8 to i8*
%10 = alloca [4 x double]
%11 = bitcast [4 x double]* %10 to i8*
%12 = alloca [4 x [4 x double]]
%13 = alloca [4 x double]
%14 = alloca [4 x double]
%15 = bitcast [4 x [4 x double]]* %12 to i8*
%16 = bitcast [4 x double]* %13 to i8*
%17 = bitcast [4 x double]* %14 to i8*
%18 = icmp sgt i32 %3, 0
br i1 %18, label %19, label %53
19: ; preds = %5
%20 = zext i32 %3 to i64
br label %21
21: ; preds = %19, %50
%22 = phi i64 [ 0, %19 ], [ %51, %50 ]
%23 = getelementptr inbounds i32, i32* %0, i64 %22
%24 = load i32, i32* %23
%25 = icmp eq i32 %24, -1
%26 = getelementptr inbounds i32, i32* %1, i64 %22
%27 = load i32, i32* %26
%28 = icmp eq i32 %27, -1
br i1 %25, label %29, label %35
29: ; preds = %21
br i1 %28, label %50, label %30
30: ; preds = %29
%31 = getelementptr inbounds float, float* %2, i64 %22
%32 = load float, float* %31
%33 = sext i32 %27 to i64
%34 = getelementptr inbounds [4 x double], [4 x double]* %8, i64 0, i64 %33
br label %44
35: ; preds = %21
%36 = getelementptr inbounds float, float* %2, i64 %22
%37 = load float, float* %36
%38 = sext i32 %24 to i64
br i1 %28, label %39, label %41
39: ; preds = %35
%40 = getelementptr inbounds [4 x double], [4 x double]* %10, i64 0, i64 %38
br label %44
41: ; preds = %35
%42 = sext i32 %27 to i64
%43 = getelementptr inbounds [4 x [4 x double]], [4 x [4 x double]]* %6, i64 0, i64 %38, i64 %42
br label %44
44: ; preds = %39, %41, %30
%45 = phi double* [ %34, %30 ], [ %43, %41 ], [ %40, %39 ]
%46 = phi float [ %32, %30 ], [ %37, %41 ], [ %37, %39 ]
%47 = fpext float %46 to double
%48 = load double, double* %45
%49 = fadd double %48, %47
store double %49, double* %45
br label %50
50: ; preds = %44, %29
%51 = add nuw nsw i64 %22, 1
%52 = icmp eq i64 %51, %20
br i1 %52, label %53, label %21
53: ; preds = %50, %5
%54 = getelementptr inbounds [4 x double], [4 x double]* %13, i64 0, i64 0
%55 = call i32 @memcpy(i8* %16, i8* %9, i32 32)
%56 = getelementptr inbounds [4 x double], [4 x double]* %14, i64 0, i64 0
%57 = call i32 @memcpy(i8* %17, i8* %11, i32 32)
%58 = call i32 @memcpy(i8* %15, i8* %7, i32 128)
%59 = call i32 @ProbifySingletEmission(double* %54, i32 4, %struct.prior_s* %4)
%60 = call i32 @ProbifySingletEmission(double* %56, i32 8, %struct.prior_s* %4)
%61 = bitcast [4 x [4 x double]]* %12 to double**
%62 = call i32 @ProbifyPairEmission(double** %61, %struct.prior_s* %4)
%63 = getelementptr inbounds [4 x [4 x double]], [4 x [4 x double]]* %12, i64 0, i64 0, i64 0
%64 = bitcast [4 x [4 x double]]* %12 to <2 x double>*
%65 = load <2 x double>, <2 x double>* %64
%66 = fmul <2 x double> %65, <double 1.600000e+01, double 1.600000e+01>
%67 = bitcast [4 x [4 x double]]* %12 to <2 x double>*
store <2 x double> %66, <2 x double>* %67
%68 = getelementptr inbounds [4 x [4 x double]], [4 x [4 x double]]* %12, i64 0, i64 0, i64 2
%69 = bitcast double* %68 to <2 x double>*
%70 = load <2 x double>, <2 x double>* %69
%71 = fmul <2 x double> %70, <double 1.600000e+01, double 1.600000e+01>
%72 = bitcast double* %68 to <2 x double>*
store <2 x double> %71, <2 x double>* %72
%73 = bitcast [4 x double]* %13 to <2 x double>*
%74 = load <2 x double>, <2 x double>* %73
%75 = fmul <2 x double> %74, <double 4.000000e+00, double 4.000000e+00>
%76 = bitcast [4 x double]* %13 to <2 x double>*
store <2 x double> %75, <2 x double>* %76
%77 = bitcast [4 x double]* %14 to <2 x double>*
%78 = load <2 x double>, <2 x double>* %77
%79 = fmul <2 x double> %78, <double 4.000000e+00, double 4.000000e+00>
%80 = bitcast [4 x double]* %14 to <2 x double>*
store <2 x double> %79, <2 x double>* %80
%81 = getelementptr inbounds [4 x [4 x double]], [4 x [4 x double]]* %12, i64 0, i64 1, i64 0
%82 = bitcast double* %81 to <2 x double>*
%83 = load <2 x double>, <2 x double>* %82
%84 = fmul <2 x double> %83, <double 1.600000e+01, double 1.600000e+01>
%85 = bitcast double* %81 to <2 x double>*
store <2 x double> %84, <2 x double>* %85
%86 = getelementptr inbounds [4 x [4 x double]], [4 x [4 x double]]* %12, i64 0, i64 1, i64 2
%87 = bitcast double* %86 to <2 x double>*
%88 = load <2 x double>, <2 x double>* %87
%89 = fmul <2 x double> %88, <double 1.600000e+01, double 1.600000e+01>
%90 = bitcast double* %86 to <2 x double>*
store <2 x double> %89, <2 x double>* %90
%91 = getelementptr inbounds [4 x double], [4 x double]* %13, i64 0, i64 2
%92 = getelementptr inbounds [4 x double], [4 x double]* %14, i64 0, i64 2
%93 = getelementptr inbounds [4 x [4 x double]], [4 x [4 x double]]* %12, i64 0, i64 2, i64 0
%94 = bitcast double* %93 to <2 x double>*
%95 = load <2 x double>, <2 x double>* %94
%96 = fmul <2 x double> %95, <double 1.600000e+01, double 1.600000e+01>
%97 = bitcast double* %93 to <2 x double>*
store <2 x double> %96, <2 x double>* %97
%98 = getelementptr inbounds [4 x [4 x double]], [4 x [4 x double]]* %12, i64 0, i64 2, i64 2
%99 = bitcast double* %98 to <2 x double>*
%100 = load <2 x double>, <2 x double>* %99
%101 = fmul <2 x double> %100, <double 1.600000e+01, double 1.600000e+01>
%102 = bitcast double* %98 to <2 x double>*
store <2 x double> %101, <2 x double>* %102
%103 = bitcast double* %91 to <2 x double>*
%104 = load <2 x double>, <2 x double>* %103
%105 = fmul <2 x double> %104, <double 4.000000e+00, double 4.000000e+00>
%106 = bitcast double* %91 to <2 x double>*
store <2 x double> %105, <2 x double>* %106
%107 = bitcast double* %92 to <2 x double>*
%108 = load <2 x double>, <2 x double>* %107
%109 = fmul <2 x double> %108, <double 4.000000e+00, double 4.000000e+00>
%110 = bitcast double* %92 to <2 x double>*
store <2 x double> %109, <2 x double>* %110
%111 = getelementptr inbounds [4 x [4 x double]], [4 x [4 x double]]* %12, i64 0, i64 3, i64 0
%112 = bitcast double* %111 to <2 x double>*
%113 = load <2 x double>, <2 x double>* %112
%114 = fmul <2 x double> %113, <double 1.600000e+01, double 1.600000e+01>
%115 = bitcast double* %111 to <2 x double>*
store <2 x double> %114, <2 x double>* %115
%116 = getelementptr inbounds [4 x [4 x double]], [4 x [4 x double]]* %12, i64 0, i64 3, i64 2
%117 = bitcast double* %116 to <2 x double>*
%118 = load <2 x double>, <2 x double>* %117
%119 = fmul <2 x double> %118, <double 1.600000e+01, double 1.600000e+01>
%120 = bitcast double* %116 to <2 x double>*
store <2 x double> %119, <2 x double>* %120
%121 = getelementptr inbounds [4 x double], [4 x double]* %10, i64 0, i64 0
%122 = getelementptr inbounds [4 x double], [4 x double]* %8, i64 0, i64 0
%123 = call i32 @dot_score(double* %122, double* %54, i32 4)
%124 = call i32 @dot_score(double* %121, double* %56, i32 4)
%125 = add nsw i32 %124, %123
%126 = getelementptr inbounds [4 x [4 x double]], [4 x [4 x double]]* %6, i64 0, i64 0, i64 0
%127 = call i32 @dot_score(double* %126, double* %63, i32 16)
%128 = add nsw i32 %125, %127
ret i32 %128
}