#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ SEEK_CUR;
int /*<<< orphan*/ SEEK_END;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
size_t fread(double *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ free(double *);
int fseek(int /*<<< orphan*/ *, int, int /*<<< orphan*/);
double kahan_accum(double, double *, double);
double *malloc(int);
int /*<<< orphan*/ stderr;
int transition_expectations_alldisk(int nstates, const double *trans,
                                    double *expectations, FILE *fi_l,
                                    FILE *fi_f, FILE *fi_b) {
  int i;
  size_t nbytes;
  int result;
  result = fseek(fi_b, -nstates * sizeof(double), SEEK_END);
  if (result) {
    fprintf(stderr, "seek error\n");
    return -1;
  }
  double *compensations = malloc(nstates * nstates * sizeof(double));
  for (i = 0; i < nstates * nstates; ++i) {
    compensations[i] = 0.0;
  }
  double *l_old = malloc(nstates * sizeof(double));
  double *f_old = malloc(nstates * sizeof(double));
  double *b_old = malloc(nstates * sizeof(double));
  double *l_new = malloc(nstates * sizeof(double));
  double *f_new = malloc(nstates * sizeof(double));
  double *b_new = malloc(nstates * sizeof(double));
  double *tmp;
  int source, sink;
  int index;
  double x;
  int count = 0;
  do {
    nbytes = fread(l_new, sizeof(double), nstates, fi_l);
    nbytes = fread(f_new, sizeof(double), nstates, fi_f);
    nbytes = fread(b_new, sizeof(double), nstates, fi_b);
    if (count) {
      for (source = 0; source < nstates; ++source) {
        for (sink = 0; sink < nstates; ++sink) {
          index = source * nstates + sink;
          x = f_old[source] * trans[index] * l_new[sink] * b_new[sink];
          expectations[index] =
              kahan_accum(expectations[index], compensations + index, x);
        }
      }
    }
    tmp = l_old;
    l_old = l_new;
    l_new = tmp;
    tmp = f_old;
    f_old = f_new;
    f_new = tmp;
    tmp = b_old;
    b_old = b_new;
    b_new = tmp;
    ++count;
    result = fseek(fi_b, -2 * nstates * sizeof(double), SEEK_CUR);
  } while (!result);
  free(l_old);
  free(f_old);
  free(b_old);
  free(l_new);
  free(f_new);
  free(b_new);
  free(compensations);
  return 0;
}


x86 assembly (clang, -O0):
<transition_expectations_alldisk>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x30(%rbp),%rdi
xor    %eax,%eax
sub    -0x8(%rbp),%eax
cltq
shl    $0x3,%rax
mov    %eax,%esi
mov    0x2e4e(%rip),%rax
mov    (%rax),%edx
call   1080 <fseek@plt>
mov    %eax,-0x44(%rbp)
cmpl   $0x0,-0x44(%rbp)
je     11cf <transition_expectations_alldisk+0x6f>
mov    0x2e1b(%rip),%rax
mov    (%rax),%edi
lea    0xe42(%rip),%rsi
call   1060 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    14d7 <transition_expectations_alldisk+0x377>
mov    -0x8(%rbp),%eax
imul   -0x8(%rbp),%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   1070 <malloc@plt>
mov    %rax,-0x50(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
mov    -0x8(%rbp),%ecx
imul   -0x8(%rbp),%ecx
cmp    %ecx,%eax
jge    121e <transition_expectations_alldisk+0xbe>
mov    -0x50(%rbp),%rax
movslq -0x34(%rbp),%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    11ee <transition_expectations_alldisk+0x8e>
movslq -0x8(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1070 <malloc@plt>
mov    %rax,-0x58(%rbp)
movslq -0x8(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1070 <malloc@plt>
mov    %rax,-0x60(%rbp)
movslq -0x8(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1070 <malloc@plt>
mov    %rax,-0x68(%rbp)
movslq -0x8(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1070 <malloc@plt>
mov    %rax,-0x70(%rbp)
movslq -0x8(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1070 <malloc@plt>
mov    %rax,-0x78(%rbp)
movslq -0x8(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1070 <malloc@plt>
mov    %rax,-0x80(%rbp)
movl   $0x0,-0xa4(%rbp)
mov    -0x70(%rbp),%rdi
mov    -0x8(%rbp),%edx
mov    -0x20(%rbp),%rcx
mov    $0x8,%esi
call   1040 <fread@plt>
mov    %rax,-0x40(%rbp)
mov    -0x78(%rbp),%rdi
mov    -0x8(%rbp),%edx
mov    -0x28(%rbp),%rcx
mov    $0x8,%esi
call   1040 <fread@plt>
mov    %rax,-0x40(%rbp)
mov    -0x80(%rbp),%rdi
mov    -0x8(%rbp),%edx
mov    -0x30(%rbp),%rcx
mov    $0x8,%esi
call   1040 <fread@plt>
mov    %rax,-0x40(%rbp)
cmpl   $0x0,-0xa4(%rbp)
je     13f3 <transition_expectations_alldisk+0x293>
movl   $0x0,-0x8c(%rbp)
mov    -0x8c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    13ee <transition_expectations_alldisk+0x28e>
movl   $0x0,-0x90(%rbp)
mov    -0x90(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    13d5 <transition_expectations_alldisk+0x275>
mov    -0x8c(%rbp),%eax
imul   -0x8(%rbp),%eax
add    -0x90(%rbp),%eax
mov    %eax,-0x94(%rbp)
mov    -0x60(%rbp),%rax
movslq -0x8c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x94(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
mov    -0x70(%rbp),%rax
movslq -0x90(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
mov    -0x80(%rbp),%rax
movslq -0x90(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
mov    -0x18(%rbp),%rax
movslq -0x94(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x50(%rbp),%rdi
movslq -0x94(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdi
movsd  -0xa0(%rbp),%xmm1
ff
call   1050 <kahan_accum@plt>
mov    -0x18(%rbp),%rax
movslq -0x94(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x90(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x90(%rbp)
jmp    1315 <transition_expectations_alldisk+0x1b5>
jmp    13da <transition_expectations_alldisk+0x27a>
mov    -0x8c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8c(%rbp)
jmp    12fc <transition_expectations_alldisk+0x19c>
jmp    13f3 <transition_expectations_alldisk+0x293>
mov    -0x58(%rbp),%rax
mov    %rax,-0x88(%rbp)
mov    -0x70(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    -0x88(%rbp),%rax
mov    %rax,-0x70(%rbp)
mov    -0x60(%rbp),%rax
mov    %rax,-0x88(%rbp)
mov    -0x78(%rbp),%rax
mov    %rax,-0x60(%rbp)
mov    -0x88(%rbp),%rax
mov    %rax,-0x78(%rbp)
mov    -0x68(%rbp),%rax
mov    %rax,-0x88(%rbp)
mov    -0x80(%rbp),%rax
mov    %rax,-0x68(%rbp)
mov    -0x88(%rbp),%rax
mov    %rax,-0x80(%rbp)
mov    -0xa4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xa4(%rbp)
mov    -0x30(%rbp),%rdi
imul   $0xfffffffe,-0x8(%rbp),%eax
cltq
shl    $0x3,%rax
mov    %eax,%esi
mov    0x2b6a(%rip),%rax
mov    (%rax),%edx
call   1080 <fseek@plt>
mov    %eax,-0x44(%rbp)
cmpl   $0x0,-0x44(%rbp)
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    129a <transition_expectations_alldisk+0x13a>
mov    -0x58(%rbp),%rdi
call   1030 <free@plt>
mov    -0x60(%rbp),%rdi
call   1030 <free@plt>
mov    -0x68(%rbp),%rdi
call   1030 <free@plt>
mov    -0x70(%rbp),%rdi
call   1030 <free@plt>
mov    -0x78(%rbp),%rdi
call   1030 <free@plt>
mov    -0x80(%rbp),%rdi
call   1030 <free@plt>
mov    -0x50(%rbp),%rdi
call   1030 <free@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<transition_expectations_alldisk>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x98,%rsp
mov    %r9,%r12
mov    %r8,%r15
mov    %rcx,%r13
mov    %rdx,0x50(%rsp)
mov    %rsi,%rbp
mov    %edi,%ebx
lea    0x0(,%rbx,8),%r14d
mov    %r14d,%esi
neg    %esi
mov    0x2e40(%rip),%rax
mov    (%rax),%edx
mov    %r9,%rdi
call   1090 <fseek@plt>
test   %eax,%eax
je     11d5 <transition_expectations_alldisk+0x65>
mov    0x2e13(%rip),%rax
mov    (%rax),%edi
lea    0xe3a(%rip),%rsi
call   1070 <fprintf@plt>
mov    $0xffffffff,%eax
jmp    1474 <transition_expectations_alldisk+0x304>
mov    %r13,0x20(%rsp)
mov    %r15,0x28(%rsp)
mov    %rbp,0x48(%rsp)
mov    %rbx,0x38(%rsp)
imul   %ebx,%ebx
lea    0x0(,%rbx,8),%edi
call   1080 <malloc@plt>
mov    %rax,%rbp
test   %ebx,%ebx
je     120f <transition_expectations_alldisk+0x9f>
mov    %ebx,%edx
shl    $0x3,%rdx
mov    %rbp,%rdi
xor    %esi,%esi
call   1060 <memset@plt>
mov    %rbp,0x18(%rsp)
mov    %r14d,%edi
call   1080 <malloc@plt>
mov    %rax,%r15
mov    %r14d,%edi
call   1080 <malloc@plt>
mov    %rax,%rbp
mov    %r14d,%edi
call   1080 <malloc@plt>
mov    %rax,%rbx
mov    %r14d,%edi
call   1080 <malloc@plt>
mov    %rax,%r13
mov    %r14d,%edi
call   1080 <malloc@plt>
mov    %rax,(%rsp)
mov    %r14d,%edi
call   1080 <malloc@plt>
mov    %rbp,%r9
mov    %r15,%r8
mov    %rax,%rbp
mov    0x38(%rsp),%r14
mov    %r14d,%eax
shl    $0x4,%eax
neg    %eax
mov    %eax,0x14(%rsp)
movslq %r14d,%rax
mov    %r14d,%ecx
shl    $0x3,%rax
mov    %rax,0x80(%rsp)
mov    %rcx,0x78(%rsp)
lea    0x0(,%rcx,8),%rax
mov    %rax,0x88(%rsp)
mov    %r13,%rax
xor    %r13d,%r13d
mov    0x28(%rsp),%r15
mov    0x20(%rsp),%rcx
mov    %r12,0x30(%rsp)
jmp    1304 <transition_expectations_alldisk+0x194>
nopl   0x0(%rax)
mov    0x60(%rsp),%r13
add    $0x1,%r13d
mov    0x2d20(%rip),%rax
mov    (%rax),%edx
mov    0x30(%rsp),%rdi
mov    0x14(%rsp),%esi
call   1090 <fseek@plt>
mov    0x8(%rsp),%rdi
mov    %rdi,%r8
mov    0x58(%rsp),%rdx
mov    %rdx,%r9
mov    0x40(%rsp),%rsi
mov    %rsi,%rbx
test   %eax,%eax
mov    0x28(%rsp),%r15
mov    0x20(%rsp),%rcx
mov    0x70(%rsp),%rax
mov    0x68(%rsp),%rbp
jne    1431 <transition_expectations_alldisk+0x2c1>
mov    (%rsp),%r12
mov    %rax,%rdi
mov    %rbx,0x68(%rsp)
mov    %r9,(%rsp)
mov    %r8,0x70(%rsp)
mov    %rax,0x8(%rsp)
mov    $0x8,%esi
mov    %r14d,%edx
call   1040 <fread@plt>
mov    %r12,0x58(%rsp)
mov    %r12,%rdi
mov    $0x8,%esi
mov    %r14d,%edx
mov    %r15,%rcx
call   1040 <fread@plt>
mov    %rbp,0x40(%rsp)
mov    %rbp,%rdi
mov    $0x8,%esi
mov    %r14d,%edx
mov    0x30(%rsp),%rcx
call   1040 <fread@plt>
mov    %r13,0x60(%rsp)
test   %r13d,%r13d
je     12b0 <transition_expectations_alldisk+0x140>
test   %r14d,%r14d
jle    12b0 <transition_expectations_alldisk+0x140>
mov    0x18(%rsp),%r12
mov    0x50(%rsp),%rbx
mov    0x48(%rsp),%r15
xor    %esi,%esi
jmp    13b5 <transition_expectations_alldisk+0x245>
nopw   0x0(%rax,%rax,1)
add    $0x1,%rsi
mov    0x80(%rsp),%rax
add    %rax,%r15
add    %rax,%rbx
add    %rax,%r12
cmp    0x78(%rsp),%rsi
mov    0x38(%rsp),%r14
je     12b0 <transition_expectations_alldisk+0x140>
test   %r14d,%r14d
mov    (%rsp),%rbp
mov    0x40(%rsp),%r13
mov    0x8(%rsp),%rdx
jle    1390 <transition_expectations_alldisk+0x220>
xor    %r14d,%r14d
mov    %rsi,0x90(%rsp)
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsd  0x0(%rbp,%rsi,8),%xmm1
mulsd  (%r15,%r14,1),%xmm1
mulsd  (%rdx,%r14,1),%xmm1
mulsd  0x0(%r13,%r14,1),%xmm1
movsd  (%rbx,%r14,1),%xmm0
lea    (%r12,%r14,1),%rdi
call   1050 <kahan_accum@plt>
mov    0x8(%rsp),%rdx
mov    0x88(%rsp),%rdi
mov    0x90(%rsp),%rsi
movsd  %xmm0,(%rbx,%r14,1)
add    $0x8,%r14
cmp    %r14,%rdi
jne    13e0 <transition_expectations_alldisk+0x270>
jmp    1390 <transition_expectations_alldisk+0x220>
mov    %rsi,%r14
mov    %rdx,%r15
mov    %rax,%rbx
call   1030 <free@plt>
mov    %r15,%rdi
call   1030 <free@plt>
mov    %r14,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    (%rsp),%rdi
call   1030 <free@plt>
mov    %rbp,%rdi
call   1030 <free@plt>
mov    0x18(%rsp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x98,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@SEEK_END = global i32 0
@stderr = global i32 0
@.str = [12 x i8] c"seek error\0A\00"
@SEEK_CUR = global i32 0
define i32 @transition_expectations_alldisk(i32 %0, double* nocapture %1, double* nocapture %2, i32* nocapture %3, i32* nocapture %4, i32* nocapture %5) {
%7 = mul i32 %0, -8
%8 = load i32, i32* @SEEK_END
%9 = tail call i32 @fseek(i32* %5, i32 %7, i32 %8)
%10 = icmp eq i32 %9, 0
br i1 %10, label %14, label %11
11: ; preds = %6
%12 = load i32, i32* @stderr
%13 = tail call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
br label %89
14: ; preds = %6
%15 = mul nsw i32 %0, %0
%16 = shl i32 %15, 3
%17 = tail call double* @malloc(i32 %16)
%18 = icmp eq i32 %15, 0
br i1 %18, label %23, label %19
19: ; preds = %14
%20 = bitcast double* %17 to i8*
%21 = zext i32 %15 to i64
%22 = shl nuw nsw i64 %21, 3
br label %23
23: ; preds = %19, %14
%24 = shl i32 %0, 3
%25 = tail call double* @malloc(i32 %24)
%26 = tail call double* @malloc(i32 %24)
%27 = tail call double* @malloc(i32 %24)
%28 = tail call double* @malloc(i32 %24)
%29 = tail call double* @malloc(i32 %24)
%30 = tail call double* @malloc(i32 %24)
%31 = icmp slt i32 %0, 1
%32 = icmp sgt i32 %0, 0
%33 = mul i32 %0, -16
%34 = sext i32 %0 to i64
%35 = zext i32 %0 to i64
br label %36
36: ; preds = %76, %23
%37 = phi double* [ %25, %23 ], [ %40, %76 ]
%38 = phi double* [ %26, %23 ], [ %41, %76 ]
%39 = phi double* [ %27, %23 ], [ %42, %76 ]
%40 = phi double* [ %28, %23 ], [ %37, %76 ]
%41 = phi double* [ %29, %23 ], [ %38, %76 ]
%42 = phi double* [ %30, %23 ], [ %39, %76 ]
%43 = phi i32 [ 0, %23 ], [ %77, %76 ]
%44 = tail call i64 @fread(double* %40, i32 8, i32 %0, i32* %3)
%45 = tail call i64 @fread(double* %41, i32 8, i32 %0, i32* %4)
%46 = tail call i64 @fread(double* %42, i32 8, i32 %0, i32* %5)
%47 = icmp eq i32 %43, 0
%48 = or i1 %47, %31
br i1 %48, label %76, label %49
49: ; preds = %36, %73
%50 = phi i64 [ %74, %73 ], [ 0, %36 ]
br i1 %32, label %51, label %73
51: ; preds = %49
%52 = mul nsw i64 %50, %34
%53 = getelementptr inbounds double, double* %38, i64 %50
br label %54
54: ; preds = %51, %54
%55 = phi i64 [ 0, %51 ], [ %71, %54 ]
%56 = add nsw i64 %55, %52
%57 = load double, double* %53
%58 = getelementptr inbounds double, double* %1, i64 %56
%59 = load double, double* %58
%60 = fmul double %57, %59
%61 = getelementptr inbounds double, double* %40, i64 %55
%62 = load double, double* %61
%63 = fmul double %60, %62
%64 = getelementptr inbounds double, double* %42, i64 %55
%65 = load double, double* %64
%66 = fmul double %63, %65
%67 = getelementptr inbounds double, double* %2, i64 %56
%68 = load double, double* %67
%69 = getelementptr inbounds double, double* %17, i64 %56
%70 = tail call double @kahan_accum(double %68, double* %69, double %66)
store double %70, double* %67
%71 = add nuw nsw i64 %55, 1
%72 = icmp eq i64 %71, %35
br i1 %72, label %73, label %54
73: ; preds = %54, %49
%74 = add nuw nsw i64 %50, 1
%75 = icmp eq i64 %74, %35
br i1 %75, label %76, label %49
76: ; preds = %73, %36
%77 = add nuw nsw i32 %43, 1
%78 = load i32, i32* @SEEK_CUR
%79 = tail call i32 @fseek(i32* %5, i32 %33, i32 %78)
%80 = icmp eq i32 %79, 0
br i1 %80, label %36, label %81
81: ; preds = %76
%82 = tail call i32 @free(double* %40)
%83 = tail call i32 @free(double* %41)
%84 = tail call i32 @free(double* %42)
%85 = tail call i32 @free(double* %37)
%86 = tail call i32 @free(double* %38)
%87 = tail call i32 @free(double* %39)
%88 = tail call i32 @free(double* %17)
br label %89
89: ; preds = %81, %11
%90 = phi i32 [ -1, %11 ], [ 0, %81 ]
ret i32 %90
}