#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*/ free(double *);
scalar_t__ malloc(int);
int _compute_transition_counts(double *transition_counts, const double *A,
                               const double *pobs, const double *alpha,
                               const double *beta, int N, int T) {
  int i, j, t;
  double sum, *tmp;
  for (i = 0; i < N; i++)
    for (j = 0; j < N; j++)
      transition_counts[i * N + j] = 0.0;
  tmp = (double *)malloc(N * N * sizeof(double));
  if (!tmp) {
    return 2;
  }
  for (t = 0; t < T - 1; t++) {
    sum = 0.0;
    for (i = 0; i < N; i++)
      for (j = 0; j < N; j++) {
        tmp[i * N + j] = alpha[t * N + i] * A[i * N + j] *
                         pobs[(t + 1) * N + j] * beta[(t + 1) * N + j];
        sum += tmp[i * N + j];
      }
    for (i = 0; i < N; i++)
      for (j = 0; j < N; j++)
        transition_counts[i * N + j] += tmp[i * N + j] / sum;
  }
  free(tmp);
  return 0;
}


x86 assembly (clang, -O0):
<_compute_transition_counts>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    0x10(%rbp),%eax
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
mov    %r9d,-0x34(%rbp)
movl   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%eax
cmp    -0x34(%rbp),%eax
jge    11a3 <_compute_transition_counts+0x83>
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
cmp    -0x34(%rbp),%eax
jge    1190 <_compute_transition_counts+0x70>
mov    -0x10(%rbp),%rax
mov    -0x38(%rbp),%ecx
imul   -0x34(%rbp),%ecx
add    -0x3c(%rbp),%ecx
movslq %ecx,%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    115d <_compute_transition_counts+0x3d>
jmp    1195 <_compute_transition_counts+0x75>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    114a <_compute_transition_counts+0x2a>
mov    -0x34(%rbp),%eax
imul   -0x34(%rbp),%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   1040 <malloc@plt>
mov    %rax,-0x50(%rbp)
cmpq   $0x0,-0x50(%rbp)
jne    11d2 <_compute_transition_counts+0xb2>
movl   $0x2,-0x4(%rbp)
jmp    136d <_compute_transition_counts+0x24d>
movl   $0x0,-0x40(%rbp)
mov    -0x40(%rbp),%eax
mov    0x10(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    135d <_compute_transition_counts+0x23d>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x48(%rbp)
movl   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%eax
cmp    -0x34(%rbp),%eax
jge    12cd <_compute_transition_counts+0x1ad>
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
cmp    -0x34(%rbp),%eax
jge    12ba <_compute_transition_counts+0x19a>
mov    -0x28(%rbp),%rax
mov    -0x40(%rbp),%ecx
imul   -0x34(%rbp),%ecx
add    -0x38(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
mov    -0x38(%rbp),%ecx
imul   -0x34(%rbp),%ecx
add    -0x3c(%rbp),%ecx
movslq %ecx,%rcx
mulsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
mov    -0x40(%rbp),%ecx
add    $0x1,%ecx
imul   -0x34(%rbp),%ecx
add    -0x3c(%rbp),%ecx
movslq %ecx,%rcx
mulsd  (%rax,%rcx,8),%xmm0
mov    -0x30(%rbp),%rax
mov    -0x40(%rbp),%ecx
add    $0x1,%ecx
imul   -0x34(%rbp),%ecx
add    -0x3c(%rbp),%ecx
movslq %ecx,%rcx
mulsd  (%rax,%rcx,8),%xmm0
mov    -0x50(%rbp),%rax
mov    -0x38(%rbp),%ecx
imul   -0x34(%rbp),%ecx
add    -0x3c(%rbp),%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x50(%rbp),%rax
mov    -0x38(%rbp),%ecx
imul   -0x34(%rbp),%ecx
add    -0x3c(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
addsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    120c <_compute_transition_counts+0xec>
jmp    12bf <_compute_transition_counts+0x19f>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    11f9 <_compute_transition_counts+0xd9>
movl   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%eax
cmp    -0x34(%rbp),%eax
jge    134a <_compute_transition_counts+0x22a>
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
cmp    -0x34(%rbp),%eax
jge    1337 <_compute_transition_counts+0x217>
mov    -0x50(%rbp),%rax
mov    -0x38(%rbp),%ecx
imul   -0x34(%rbp),%ecx
add    -0x3c(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
divsd  -0x48(%rbp),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x38(%rbp),%ecx
imul   -0x34(%rbp),%ecx
add    -0x3c(%rbp),%ecx
movslq %ecx,%rcx
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    12e7 <_compute_transition_counts+0x1c7>
jmp    133c <_compute_transition_counts+0x21c>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    12d4 <_compute_transition_counts+0x1b4>
jmp    134f <_compute_transition_counts+0x22f>
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
jmp    11d9 <_compute_transition_counts+0xb9>
mov    -0x50(%rbp),%rdi
call   1030 <free@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_compute_transition_counts>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xa8,%rsp
mov    %r9d,%r13d
mov    %r8,0x48(%rsp)
mov    %rcx,%rbx
mov    %rdx,0x60(%rsp)
mov    %rsi,0x58(%rsp)
mov    %rdi,0x28(%rsp)
test   %r9d,%r9d
mov    %r13,0x18(%rsp)
jle    126a <_compute_transition_counts+0x13a>
mov    %r13d,%r12d
lea    0x0(,%r12,8),%r14
lea    -0x1(%r12),%rax
mov    %r12,0x10(%rsp)
and    $0x3,%r12d
mov    %r13,%rcx
xor    %r13d,%r13d
cmp    $0x3,%rax
jae    119a <_compute_transition_counts+0x6a>
xor    %ebp,%ebp
mov    0x28(%rsp),%r15
jmp    1239 <_compute_transition_counts+0x109>
mov    0x10(%rsp),%rax
and    $0xfffffffc,%eax
mov    %rax,0x10(%rsp)
lea    (%rcx,%rcx,1),%eax
mov    %rax,0x20(%rsp)
lea    0x0(,%rcx,4),%eax
mov    %eax,0x8(%rsp)
lea    (%rcx,%rcx,2),%eax
mov    %rax,0x40(%rsp)
xor    %ebp,%ebp
mov    0x28(%rsp),%r15
nopl   0x0(%rax)
movslq %r13d,%r13
lea    (%r15,%r13,8),%rdi
xor    %esi,%esi
mov    %r14,%rdx
call   1040 <memset@plt>
mov    0x18(%rsp),%rax
add    %r13d,%eax
cltq
lea    (%r15,%rax,8),%rdi
xor    %esi,%esi
mov    %r14,%rdx
call   1040 <memset@plt>
mov    0x20(%rsp),%rax
add    %r13d,%eax
cltq
lea    (%r15,%rax,8),%rdi
xor    %esi,%esi
mov    %r14,%rdx
call   1040 <memset@plt>
mov    0x40(%rsp),%rax
add    %r13d,%eax
cltq
lea    (%r15,%rax,8),%rdi
xor    %esi,%esi
mov    %r14,%rdx
call   1040 <memset@plt>
add    $0x4,%rbp
add    0x8(%rsp),%r13d
cmp    %rbp,0x10(%rsp)
jne    11d0 <_compute_transition_counts+0xa0>
test   %r12,%r12
mov    0x18(%rsp),%r13
je     126a <_compute_transition_counts+0x13a>
imul   %r13d,%ebp
nopw   0x0(%rax,%rax,1)
movslq %ebp,%rbp
lea    (%r15,%rbp,8),%rdi
xor    %esi,%esi
mov    %r14,%rdx
call   1040 <memset@plt>
add    %r13d,%ebp
add    $0xffffffffffffffff,%r12
jne    1250 <_compute_transition_counts+0x120>
mov    %r13d,%edi
imul   %r13d,%edi
shl    $0x3,%edi
call   1050 <malloc@plt>
test   %rax,%rax
je     1688 <_compute_transition_counts+0x558>
mov    0xe0(%rsp),%ecx
mov    %rcx,0x30(%rsp)
cmp    $0x2,%ecx
mov    0x28(%rsp),%rcx
jl     167c <_compute_transition_counts+0x54c>
mov    0x30(%rsp),%rdx
add    $0xffffffff,%edx
mov    %rdx,0x30(%rsp)
movslq %r13d,%rdx
mov    %r13d,%r14d
mov    %r14d,%r15d
and    $0xfffffffe,%r15d
lea    -0x2(%r15),%rsi
mov    %rsi,0x98(%rsp)
mov    %rsi,%rdi
shr    %rdi
add    $0x1,%rdi
mov    %rdi,%rsi
mov    %rdi,0x90(%rsp)
and    $0xfffffffffffffffe,%rdi
mov    %rdi,0x88(%rsp)
mov    %r14,%rsi
neg    %rsi
mov    %rsi,0xa0(%rsp)
lea    0x8(%rax),%rsi
mov    %rsi,0x50(%rsp)
lea    0x0(,%rdx,8),%rsi
mov    %rsi,0x10(%rsp)
mov    %rax,0x8(%rsp)
mov    0x58(%rsp),%rax
add    $0x8,%rax
mov    %rax,0x80(%rsp)
mov    0x48(%rsp),%rax
lea    0x8(%rax,%rdx,8),%r8
mov    0x60(%rsp),%rax
mov    %rdx,0x20(%rsp)
lea    0x8(%rax,%rdx,8),%r10
mov    0x8(%rsp),%rax
lea    0x10(%rcx),%rdx
mov    %rdx,0x78(%rsp)
lea    0x10(%rax),%rdx
mov    %rdx,0x70(%rsp)
add    $0x8,%rcx
mov    %rcx,0x68(%rsp)
xor    %ecx,%ecx
mov    %rcx,0x38(%rsp)
jmp    138c <_compute_transition_counts+0x25c>
nop
mov    0x38(%rsp),%rdx
add    $0x1,%rdx
mov    0x10(%rsp),%rcx
add    %rcx,%r8
add    %rcx,%r10
mov    %rdx,%rcx
mov    %rdx,0x38(%rsp)
cmp    0x30(%rsp),%rdx
mov    0x18(%rsp),%r13
je     167c <_compute_transition_counts+0x54c>
test   %r13d,%r13d
jle    1360 <_compute_transition_counts+0x230>
mov    0x38(%rsp),%rcx
mov    %rcx,%r11
mov    0x20(%rsp),%rax
imul   %rax,%r11
lea    0x1(%rcx),%r9
imul   %rax,%r9
xorpd  %xmm0,%xmm0
mov    0x80(%rsp),%rdx
mov    0x50(%rsp),%rbp
xor    %eax,%eax
mov    0x18(%rsp),%r12
mov    0x48(%rsp),%r13
jmp    13e8 <_compute_transition_counts+0x2b8>
nopl   0x0(%rax)
add    $0x1,%rax
mov    0x10(%rsp),%rcx
add    %rcx,%rbp
add    %rcx,%rdx
cmp    %r14,%rax
je     14a0 <_compute_transition_counts+0x370>
lea    (%rax,%r11,1),%rdi
xor    %esi,%esi
cmp    $0x1,%r12d
je     144c <_compute_transition_counts+0x31c>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movsd  (%rbx,%rdi,8),%xmm1
mulsd  -0x8(%rdx,%rsi,8),%xmm1
mulsd  -0x8(%r10,%rsi,8),%xmm1
mulsd  -0x8(%r8,%rsi,8),%xmm1
movsd  %xmm1,-0x8(%rbp,%rsi,8)
addsd  %xmm0,%xmm1
movsd  (%rbx,%rdi,8),%xmm0
mulsd  (%rdx,%rsi,8),%xmm0
mulsd  (%r10,%rsi,8),%xmm0
mulsd  (%r8,%rsi,8),%xmm0
movsd  %xmm0,0x0(%rbp,%rsi,8)
addsd  %xmm1,%xmm0
add    $0x2,%rsi
cmp    %rsi,%r15
jne    1400 <_compute_transition_counts+0x2d0>
test   $0x1,%r14b
je     13d0 <_compute_transition_counts+0x2a0>
mov    %rax,%rcx
imul   0x20(%rsp),%rcx
movsd  (%rbx,%rdi,8),%xmm1
add    %rsi,%rcx
mov    0x58(%rsp),%rdi
mulsd  (%rdi,%rcx,8),%xmm1
add    %r9,%rsi
mov    0x60(%rsp),%rdi
mulsd  (%rdi,%rsi,8),%xmm1
mulsd  0x0(%r13,%rsi,8),%xmm1
mov    0x8(%rsp),%rsi
movsd  %xmm1,(%rsi,%rcx,8)
addsd  %xmm1,%xmm0
jmp    13d0 <_compute_transition_counts+0x2a0>
nopl   0x0(%rax,%rax,1)
test   %r12d,%r12d
mov    0x28(%rsp),%rbp
mov    0x8(%rsp),%rax
jle    1360 <_compute_transition_counts+0x230>
movapd %xmm0,%xmm1
unpcklpd %xmm0,%xmm1
mov    0x68(%rsp),%r11
mov    0x50(%rsp),%r12
mov    0x70(%rsp),%r13
mov    0x78(%rsp),%r9
xor    %ecx,%ecx
jmp    14fe <_compute_transition_counts+0x3ce>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0x1,%rcx
mov    0x10(%rsp),%rdx
add    %rdx,%r9
add    %rdx,%r13
add    %rdx,%r12
add    %rdx,%r11
cmp    %r14,%rcx
je     1360 <_compute_transition_counts+0x230>
mov    %rcx,%rdx
imul   0x20(%rsp),%rdx
cmpl   $0x2,0x18(%rsp)
jb     1549 <_compute_transition_counts+0x419>
lea    (%rdx,%r14,1),%rsi
lea    (%rax,%rsi,8),%rdi
mov    %rdi,0x40(%rsp)
lea    0x0(,%rdx,8),%rdi
add    %rbp,%rdi
cmp    0x40(%rsp),%rdi
jae    15d0 <_compute_transition_counts+0x4a0>
lea    (%rax,%rdx,8),%rdi
lea    0x0(,%rsi,8),%rsi
add    %rbp,%rsi
cmp    %rsi,%rdi
jae    15d0 <_compute_transition_counts+0x4a0>
xor    %edi,%edi
mov    %rdi,%rsi
test   $0x1,%r14b
je     1573 <_compute_transition_counts+0x443>
add    %rdi,%rdx
movsd  (%rax,%rdx,8),%xmm2
divsd  %xmm0,%xmm2
addsd  0x0(%rbp,%rdx,8),%xmm2
movsd  %xmm2,0x0(%rbp,%rdx,8)
mov    %rdi,%rsi
or     $0x1,%rsi
not    %rdi
cmp    0xa0(%rsp),%rdi
je     14e0 <_compute_transition_counts+0x3b0>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movsd  -0x8(%r12,%rsi,8),%xmm2
divsd  %xmm0,%xmm2
addsd  -0x8(%r11,%rsi,8),%xmm2
movsd  %xmm2,-0x8(%r11,%rsi,8)
movsd  (%r12,%rsi,8),%xmm2
divsd  %xmm0,%xmm2
addsd  (%r11,%rsi,8),%xmm2
movsd  %xmm2,(%r11,%rsi,8)
add    $0x2,%rsi
cmp    %rsi,%r14
jne    1590 <_compute_transition_counts+0x460>
jmp    14e0 <_compute_transition_counts+0x3b0>
nopl   (%rax)
cmpq   $0x0,0x98(%rsp)
je     1669 <_compute_transition_counts+0x539>
mov    0x88(%rsp),%rdi
xor    %esi,%esi
mov    0x8(%rsp),%rax
xchg   %ax,%ax
movupd -0x10(%r13,%rsi,8),%xmm2
divpd  %xmm1,%xmm2
movupd -0x10(%r9,%rsi,8),%xmm3
addpd  %xmm2,%xmm3
movupd (%r9,%rsi,8),%xmm2
movupd %xmm3,-0x10(%r9,%rsi,8)
movupd 0x0(%r13,%rsi,8),%xmm3
divpd  %xmm1,%xmm3
addpd  %xmm2,%xmm3
movupd %xmm3,(%r9,%rsi,8)
add    $0x4,%rsi
add    $0xfffffffffffffffe,%rdi
jne    15f0 <_compute_transition_counts+0x4c0>
testb  $0x1,0x90(%rsp)
01
je     1658 <_compute_transition_counts+0x528>
add    %rdx,%rsi
movupd (%rax,%rsi,8),%xmm2
divpd  %xmm1,%xmm2
movupd 0x0(%rbp,%rsi,8),%xmm3
addpd  %xmm2,%xmm3
movupd %xmm3,0x0(%rbp,%rsi,8)
mov    %r15,%rdi
cmp    %r14,%r15
je     14e0 <_compute_transition_counts+0x3b0>
jmp    154b <_compute_transition_counts+0x41b>
xor    %esi,%esi
mov    0x8(%rsp),%rax
testb  $0x1,0x90(%rsp)
01
jne    163c <_compute_transition_counts+0x50c>
jmp    1658 <_compute_transition_counts+0x528>
mov    %rax,%rdi
call   1030 <free@plt>
xor    %eax,%eax
jmp    168d <_compute_transition_counts+0x55d>
mov    $0x2,%eax
add    $0xa8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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