#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 */
double _logsumexp_pair(double, double);
double _logsumexp_sort_kahan_inplace(double *, int);
extern void
_mbar_get_conf_energies(double *log_therm_state_counts, double *therm_energies,
                        double *bias_energy_sequence, int *conf_state_sequence,
                        int n_therm_states, int n_conf_states, int seq_length,
                        double *scratch_T, double *conf_energies,
                        double *biased_conf_energies) {
  int i, x, L, K;
  double divisor;
  for (x = 0; x < seq_length; ++x) {
    for (L = 0; L < n_therm_states; ++L)
      scratch_T[L] = log_therm_state_counts[L] + therm_energies[L] -
                     bias_energy_sequence[x * n_therm_states + L];
    i = conf_state_sequence[x];
    if (i < 0)
      continue;
    divisor = _logsumexp_sort_kahan_inplace(scratch_T, n_therm_states);
    conf_energies[i] = -_logsumexp_pair(-conf_energies[i], -divisor);
    for (K = 0; K < n_therm_states; ++K)
      biased_conf_energies[K * n_conf_states + i] = -_logsumexp_pair(
          -biased_conf_energies[K * n_conf_states + i],
          -(bias_energy_sequence[x * n_therm_states + K] + divisor));
  }
}


x86 assembly (clang, -O0):
<_mbar_get_conf_energies>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0x28(%rbp),%rax
mov    0x20(%rbp),%rax
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%eax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    %r9d,-0x28(%rbp)
movl   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    0x10(%rbp),%eax
jge    131c <_mbar_get_conf_energies+0x1fc>
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    11c0 <_mbar_get_conf_energies+0xa0>
mov    -0x8(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x34(%rbp),%rcx
addsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
mov    -0x30(%rbp),%ecx
imul   -0x24(%rbp),%ecx
add    -0x34(%rbp),%ecx
movslq %ecx,%rcx
subsd  (%rax,%rcx,8),%xmm0
mov    0x18(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1169 <_mbar_get_conf_energies+0x49>
mov    -0x20(%rbp),%rax
movslq -0x30(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x2c(%rbp)
cmpl   $0x0,-0x2c(%rbp)
jge    11dd <_mbar_get_conf_energies+0xbd>
jmp    130e <_mbar_get_conf_energies+0x1ee>
mov    0x18(%rbp),%rdi
mov    -0x24(%rbp),%esi
call   1030 <_logsumexp_sort_kahan_inplace@plt>
movsd  %xmm0,-0x40(%rbp)
mov    0x20(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  -0x40(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
call   1040 <_logsumexp_pair@plt>
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mov    0x20(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movl   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    1309 <_mbar_get_conf_energies+0x1e9>
mov    0x28(%rbp),%rax
mov    -0x38(%rbp),%ecx
imul   -0x28(%rbp),%ecx
add    -0x2c(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mov    -0x18(%rbp),%rax
mov    -0x30(%rbp),%ecx
imul   -0x24(%rbp),%ecx
add    -0x38(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
addsd  -0x40(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
call   1040 <_logsumexp_pair@plt>
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mov    0x28(%rbp),%rax
mov    -0x38(%rbp),%ecx
imul   -0x28(%rbp),%ecx
add    -0x2c(%rbp),%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    125e <_mbar_get_conf_energies+0x13e>
jmp    130e <_mbar_get_conf_energies+0x1ee>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    1156 <_mbar_get_conf_energies+0x36>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_mbar_get_conf_energies>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x98,%rsp
mov    %r8d,0x4(%rsp)
mov    %rcx,0x58(%rsp)
mov    %rdx,0x8(%rsp)
mov    0xd0(%rsp),%r8d
test   %r8d,%r8d
jle    148b <_mbar_get_conf_energies+0x36b>
mov    0xd8(%rsp),%r15
movslq %r9d,%rbx
movslq 0x4(%rsp),%r11
mov    %r11d,%ebp
lea    (%r15,%rbp,8),%r14
lea    (%rdi,%rbp,8),%rcx
cmp    %r15,%rcx
seta   %r10b
lea    (%rsi,%rbp,8),%r9
cmp    %rdi,%r14
seta   %cl
and    %r10b,%cl
cmp    %r15,%r9
seta   %r9b
mov    %r8d,%edx
mov    %rdx,0x40(%rsp)
mov    %r14,0x20(%rsp)
cmp    %rsi,%r14
seta   %dl
and    %r9b,%dl
or     %cl,%dl
mov    %dl,0x3(%rsp)
mov    %ebp,%ecx
and    $0xfffffffc,%ecx
mov    %rcx,0x18(%rsp)
mov    %rbp,%rcx
neg    %rcx
mov    %rcx,0x28(%rsp)
mov    0x8(%rsp),%rcx
lea    0x10(%rcx),%r10
mov    %r11,0x30(%rsp)
lea    0x0(,%r11,8),%rdx
mov    %rdx,0x38(%rsp)
lea    0x0(,%rbp,8),%rdx
and    $0xffffffffffffffe0,%rdx
mov    %rdx,0x10(%rsp)
lea    0x8(%rcx),%rax
shl    $0x3,%rbx
xor    %r11d,%r11d
mov    %rcx,%rdx
mov    %rsi,0x50(%rsp)
mov    %rdi,0x48(%rsp)
mov    %rbx,0x78(%rsp)
mov    0x78(%rsp),%rbx
jmp    124e <_mbar_get_conf_energies+0x12e>
nopl   0x0(%rax,%rax,1)
mov    0x60(%rsp),%r11
add    $0x1,%r11
mov    0x70(%rsp),%r10
mov    0x38(%rsp),%rcx
add    %rcx,%r10
mov    0x68(%rsp),%rax
add    %rcx,%rax
add    %rcx,%rdx
cmp    0x40(%rsp),%r11
mov    0xd8(%rsp),%r15
mov    0x50(%rsp),%rsi
mov    0x48(%rsp),%rdi
je     148b <_mbar_get_conf_energies+0x36b>
cmpl   $0x0,0x4(%rsp)
jle    1397 <_mbar_get_conf_energies+0x277>
mov    %r11,%r9
imul   0x30(%rsp),%r9
cmpl   $0x4,0x4(%rsp)
jae    1280 <_mbar_get_conf_energies+0x160>
xor    %r8d,%r8d
jmp    1320 <_mbar_get_conf_energies+0x200>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %rdx,%r14
lea    (%r9,%rbp,1),%rcx
mov    0x8(%rsp),%rdx
lea    (%rdx,%r9,8),%r8
lea    (%rdx,%rcx,8),%rcx
cmp    %r15,%rcx
seta   %cl
cmp    0x20(%rsp),%r8
setb   %dl
and    %cl,%dl
or     0x3(%rsp),%dl
je     12b2 <_mbar_get_conf_energies+0x192>
xor    %r8d,%r8d
mov    %r14,%rdx
jmp    1320 <_mbar_get_conf_energies+0x200>
xor    %ecx,%ecx
mov    0x10(%rsp),%rdx
nopl   0x0(%rax)
movupd (%rdi,%rcx,1),%xmm0
movupd 0x10(%rdi,%rcx,1),%xmm1
movupd (%rsi,%rcx,1),%xmm2
addpd  %xmm0,%xmm2
movupd 0x10(%rsi,%rcx,1),%xmm0
addpd  %xmm1,%xmm0
movupd -0x10(%r10,%rcx,1),%xmm1
subpd  %xmm1,%xmm2
movupd (%r10,%rcx,1),%xmm1
subpd  %xmm1,%xmm0
movupd %xmm2,(%r15,%rcx,1)
movupd %xmm0,0x10(%r15,%rcx,1)
add    $0x20,%rcx
cmp    %rcx,%rdx
jne    12c0 <_mbar_get_conf_energies+0x1a0>
mov    0x18(%rsp),%rcx
mov    %rcx,%r8
cmp    %rbp,%rcx
mov    %r14,%rdx
je     1397 <_mbar_get_conf_energies+0x277>
nopl   0x0(%rax)
mov    %r8,%rcx
test   $0x1,%bpl
je     1350 <_mbar_get_conf_energies+0x230>
movsd  (%rdi,%r8,8),%xmm0
addsd  (%rsi,%r8,8),%xmm0
add    %r8,%r9
mov    0x8(%rsp),%rcx
subsd  (%rcx,%r9,8),%xmm0
movsd  %xmm0,(%r15,%r8,8)
mov    %r8,%rcx
or     $0x1,%rcx
not    %r8
cmp    0x28(%rsp),%r8
je     1397 <_mbar_get_conf_energies+0x277>
nopw   0x0(%rax,%rax,1)
movsd  (%rdi,%rcx,8),%xmm0
addsd  (%rsi,%rcx,8),%xmm0
subsd  -0x8(%rax,%rcx,8),%xmm0
movsd  %xmm0,(%r15,%rcx,8)
movsd  0x8(%rdi,%rcx,8),%xmm0
addsd  0x8(%rsi,%rcx,8),%xmm0
subsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,0x8(%r15,%rcx,8)
add    $0x2,%rcx
cmp    %rcx,%rbp
jne    1360 <_mbar_get_conf_energies+0x240>
mov    %rax,0x68(%rsp)
mov    %r10,0x70(%rsp)
mov    0x58(%rsp),%rax
mov    %r11,0x60(%rsp)
mov    (%rax,%r11,4),%r12d
test   %r12d,%r12d
js     1210 <_mbar_get_conf_energies+0xf0>
mov    0xd8(%rsp),%rdi
mov    0x4(%rsp),%r13d
mov    %r13d,%esi
mov    %rbp,%r14
mov    %rdx,%r15
call   1030 <_logsumexp_sort_kahan_inplace@plt>
movapd %xmm0,%xmm1
mov    0xe0(%rsp),%rax
movsd  (%rax,%r12,8),%xmm0
xorpd  0xc13(%rip),%xmm0
movapd %xmm1,0x80(%rsp)
xorpd  0xc02(%rip),%xmm1
call   1040 <_logsumexp_pair@plt>
mov    %r15,%rdx
movapd 0xbf2(%rip),%xmm2
xorpd  %xmm2,%xmm0
mov    0xe0(%rsp),%rax
movlpd %xmm0,(%rax,%r12,8)
test   %r13d,%r13d
jle    1210 <_mbar_get_conf_energies+0xf0>
mov    0xe8(%rsp),%rax
lea    (%rax,%r12,8),%r12
xor    %r13d,%r13d
nopl   0x0(%rax,%rax,1)
movsd  (%r12),%xmm0
xorpd  %xmm2,%xmm0
movsd  (%rdx,%r13,8),%xmm1
addsd  0x80(%rsp),%xmm1
xorpd  %xmm2,%xmm1
call   1040 <_logsumexp_pair@plt>
mov    %r15,%rdx
movapd 0xb93(%rip),%xmm2
mov    %r14,%rbp
xorpd  %xmm2,%xmm0
movlpd %xmm0,(%r12)
add    $0x1,%r13
add    %rbx,%r12
cmp    %r13,%r14
jne    1440 <_mbar_get_conf_energies+0x320>
jmp    1210 <_mbar_get_conf_energies+0xf0>
add    $0x98,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @_mbar_get_conf_energies(double* %0, double* %1, double* %2, i32* %3, i32 %4, i32 %5, i32 %6, double* %7, double* %8, double* %9) {
%11 = alloca double*
%12 = alloca double*
%13 = alloca double*
%14 = alloca i32*
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca double*
%19 = alloca double*
%20 = alloca double*
%21 = alloca i32
%22 = alloca i32
%23 = alloca i32
%24 = alloca i32
%25 = alloca double
store double* %0, double** %11
store double* %1, double** %12
store double* %2, double** %13
store i32* %3, i32** %14
store i32 %4, i32* %15
store i32 %5, i32* %16
store i32 %6, i32* %17
store double* %7, double** %18
store double* %8, double** %19
store double* %9, double** %20
store i32 0, i32* %22
br label %26
26: ; preds = %132, %10
%27 = load i32, i32* %22
%28 = load i32, i32* %17
%29 = icmp slt i32 %27, %28
br i1 %29, label %30, label %135
30: ; preds = %26
store i32 0, i32* %23
br label %31
31: ; preds = %61, %30
%32 = load i32, i32* %23
%33 = load i32, i32* %15
%34 = icmp slt i32 %32, %33
br i1 %34, label %35, label %64
35: ; preds = %31
%36 = load double*, double** %11
%37 = load i32, i32* %23
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds double, double* %36, i64 %38
%40 = load double, double* %39
%41 = load double*, double** %12
%42 = load i32, i32* %23
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds double, double* %41, i64 %43
%45 = load double, double* %44
%46 = fadd double %40, %45
%47 = load double*, double** %13
%48 = load i32, i32* %22
%49 = load i32, i32* %15
%50 = mul nsw i32 %48, %49
%51 = load i32, i32* %23
%52 = add nsw i32 %50, %51
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds double, double* %47, i64 %53
%55 = load double, double* %54
%56 = fsub double %46, %55
%57 = load double*, double** %18
%58 = load i32, i32* %23
%59 = sext i32 %58 to i64
%60 = getelementptr inbounds double, double* %57, i64 %59
store double %56, double* %60
br label %61
61: ; preds = %35
%62 = load i32, i32* %23
%63 = add nsw i32 %62, 1
store i32 %63, i32* %23
br label %31
64: ; preds = %31
%65 = load i32*, i32** %14
%66 = load i32, i32* %22
%67 = sext i32 %66 to i64
%68 = getelementptr inbounds i32, i32* %65, i64 %67
%69 = load i32, i32* %68
store i32 %69, i32* %21
%70 = load i32, i32* %21
%71 = icmp slt i32 %70, 0
br i1 %71, label %72, label %73
72: ; preds = %64
br label %132
73: ; preds = %64
%74 = load double*, double** %18
%75 = load i32, i32* %15
%76 = call double @_logsumexp_sort_kahan_inplace(double* %74, i32 %75)
store double %76, double* %25
%77 = load double*, double** %19
%78 = load i32, i32* %21
%79 = sext i32 %78 to i64
%80 = getelementptr inbounds double, double* %77, i64 %79
%81 = load double, double* %80
%82 = fneg double %81
%83 = load double, double* %25
%84 = fneg double %83
%85 = call double @_logsumexp_pair(double %82, double %84)
%86 = fneg double %85
%87 = load double*, double** %19
%88 = load i32, i32* %21
%89 = sext i32 %88 to i64
%90 = getelementptr inbounds double, double* %87, i64 %89
store double %86, double* %90
store i32 0, i32* %24
br label %91
91: ; preds = %128, %73
%92 = load i32, i32* %24
%93 = load i32, i32* %15
%94 = icmp slt i32 %92, %93
br i1 %94, label %95, label %131
95: ; preds = %91
%96 = load double*, double** %20
%97 = load i32, i32* %24
%98 = load i32, i32* %16
%99 = mul nsw i32 %97, %98
%100 = load i32, i32* %21
%101 = add nsw i32 %99, %100
%102 = sext i32 %101 to i64
%103 = getelementptr inbounds double, double* %96, i64 %102
%104 = load double, double* %103
%105 = fneg double %104
%106 = load double*, double** %13
%107 = load i32, i32* %22
%108 = load i32, i32* %15
%109 = mul nsw i32 %107, %108
%110 = load i32, i32* %24
%111 = add nsw i32 %109, %110
%112 = sext i32 %111 to i64
%113 = getelementptr inbounds double, double* %106, i64 %112
%114 = load double, double* %113
%115 = load double, double* %25
%116 = fadd double %114, %115
%117 = fneg double %116
%118 = call double @_logsumexp_pair(double %105, double %117)
%119 = fneg double %118
%120 = load double*, double** %20
%121 = load i32, i32* %24
%122 = load i32, i32* %16
%123 = mul nsw i32 %121, %122
%124 = load i32, i32* %21
%125 = add nsw i32 %123, %124
%126 = sext i32 %125 to i64
%127 = getelementptr inbounds double, double* %120, i64 %126
store double %119, double* %127
br label %128
128: ; preds = %95
%129 = load i32, i32* %24
%130 = add nsw i32 %129, 1
store i32 %130, i32* %24
br label %91
131: ; preds = %91
br label %132
132: ; preds = %131, %72
%133 = load i32, i32* %22
%134 = add nsw i32 %133, 1
store i32 %134, i32* %22
br label %26
135: ; preds = %26
ret void
}

LLVM IR (-O2):
define void @_mbar_get_conf_energies(double* nocapture %0, double* nocapture %1, double* nocapture %2, i32* nocapture %3, i32 %4, i32 %5, i32 %6, double* %7, double* nocapture %8, double* nocapture %9) {
%11 = icmp sgt i32 %6, 0
br i1 %11, label %12, label %158
12: ; preds = %10
%13 = icmp sgt i32 %4, 0
%14 = sext i32 %5 to i64
%15 = sext i32 %4 to i64
%16 = zext i32 %6 to i64
%17 = zext i32 %4 to i64
%18 = zext i32 %4 to i64
%19 = getelementptr double, double* %7, i64 %17
%20 = getelementptr double, double* %0, i64 %17
%21 = getelementptr double, double* %1, i64 %17
%22 = icmp ult i32 %4, 4
%23 = icmp ugt double* %20, %7
%24 = icmp ugt double* %19, %0
%25 = and i1 %23, %24
%26 = icmp ugt double* %21, %7
%27 = icmp ugt double* %19, %1
%28 = and i1 %26, %27
%29 = or i1 %25, %28
%30 = and i64 %17, 4294967292
%31 = icmp eq i64 %30, %17
%32 = and i64 %17, 1
%33 = icmp eq i64 %32, 0
%34 = sub nsw i64 0, %17
br label %35
35: ; preds = %12, %155
%36 = phi i64 [ 0, %12 ], [ %156, %155 ]
%37 = mul i64 %36, %15
%38 = getelementptr double, double* %2, i64 %37
%39 = add i64 %37, %17
%40 = getelementptr double, double* %2, i64 %39
br i1 %13, label %41, label %123
41: ; preds = %35
%42 = mul nsw i64 %36, %15
br i1 %22, label %80, label %43
43: ; preds = %41
%44 = icmp ugt double* %40, %7
%45 = icmp ult double* %38, %19
%46 = and i1 %44, %45
%47 = or i1 %29, %46
br i1 %47, label %80, label %48
48: ; preds = %43, %48
%49 = phi i64 [ %77, %48 ], [ 0, %43 ]
%50 = getelementptr inbounds double, double* %0, i64 %49
%51 = bitcast double* %50 to <2 x double>*
%52 = load <2 x double>, <2 x double>* %51
%53 = getelementptr inbounds double, double* %50, i64 2
%54 = bitcast double* %53 to <2 x double>*
%55 = load <2 x double>, <2 x double>* %54
%56 = getelementptr inbounds double, double* %1, i64 %49
%57 = bitcast double* %56 to <2 x double>*
%58 = load <2 x double>, <2 x double>* %57
%59 = getelementptr inbounds double, double* %56, i64 2
%60 = bitcast double* %59 to <2 x double>*
%61 = load <2 x double>, <2 x double>* %60
%62 = fadd <2 x double> %52, %58
%63 = fadd <2 x double> %55, %61
%64 = add nsw i64 %49, %42
%65 = getelementptr inbounds double, double* %2, i64 %64
%66 = bitcast double* %65 to <2 x double>*
%67 = load <2 x double>, <2 x double>* %66
%68 = getelementptr inbounds double, double* %65, i64 2
%69 = bitcast double* %68 to <2 x double>*
%70 = load <2 x double>, <2 x double>* %69
%71 = fsub <2 x double> %62, %67
%72 = fsub <2 x double> %63, %70
%73 = getelementptr inbounds double, double* %7, i64 %49
%74 = bitcast double* %73 to <2 x double>*
store <2 x double> %71, <2 x double>* %74
%75 = getelementptr inbounds double, double* %73, i64 2
%76 = bitcast double* %75 to <2 x double>*
store <2 x double> %72, <2 x double>* %76
%77 = add nuw i64 %49, 4
%78 = icmp eq i64 %77, %30
br i1 %78, label %79, label %48
79: ; preds = %48
br i1 %31, label %123, label %80
80: ; preds = %43, %41, %79
%81 = phi i64 [ 0, %43 ], [ 0, %41 ], [ %30, %79 ]
%82 = xor i64 %81, -1
br i1 %33, label %95, label %83
83: ; preds = %80
%84 = getelementptr inbounds double, double* %0, i64 %81
%85 = load double, double* %84
%86 = getelementptr inbounds double, double* %1, i64 %81
%87 = load double, double* %86
%88 = fadd double %85, %87
%89 = add nsw i64 %81, %42
%90 = getelementptr inbounds double, double* %2, i64 %89
%91 = load double, double* %90
%92 = fsub double %88, %91
%93 = getelementptr inbounds double, double* %7, i64 %81
store double %92, double* %93
%94 = or i64 %81, 1
br label %95
95: ; preds = %83, %80
%96 = phi i64 [ %81, %80 ], [ %94, %83 ]
%97 = icmp eq i64 %82, %34
br i1 %97, label %123, label %98
98: ; preds = %95, %98
%99 = phi i64 [ %121, %98 ], [ %96, %95 ]
%100 = getelementptr inbounds double, double* %0, i64 %99
%101 = load double, double* %100
%102 = getelementptr inbounds double, double* %1, i64 %99
%103 = load double, double* %102
%104 = fadd double %101, %103
%105 = add nsw i64 %99, %42
%106 = getelementptr inbounds double, double* %2, i64 %105
%107 = load double, double* %106
%108 = fsub double %104, %107
%109 = getelementptr inbounds double, double* %7, i64 %99
store double %108, double* %109
%110 = add nuw nsw i64 %99, 1
%111 = getelementptr inbounds double, double* %0, i64 %110
%112 = load double, double* %111
%113 = getelementptr inbounds double, double* %1, i64 %110
%114 = load double, double* %113
%115 = fadd double %112, %114
%116 = add nsw i64 %110, %42
%117 = getelementptr inbounds double, double* %2, i64 %116
%118 = load double, double* %117
%119 = fsub double %115, %118
%120 = getelementptr inbounds double, double* %7, i64 %110
store double %119, double* %120
%121 = add nuw nsw i64 %99, 2
%122 = icmp eq i64 %121, %17
br i1 %122, label %123, label %98
123: ; preds = %95, %98, %79, %35
%124 = getelementptr inbounds i32, i32* %3, i64 %36
%125 = load i32, i32* %124
%126 = icmp slt i32 %125, 0
br i1 %126, label %155, label %127
127: ; preds = %123
%128 = tail call double @_logsumexp_sort_kahan_inplace(double* %7, i32 %4)
%129 = zext i32 %125 to i64
%130 = getelementptr inbounds double, double* %8, i64 %129
%131 = load double, double* %130
%132 = fneg double %131
%133 = fneg double %128
%134 = tail call double @_logsumexp_pair(double %132, double %133)
%135 = fneg double %134
store double %135, double* %130
br i1 %13, label %136, label %155
136: ; preds = %127
%137 = mul nsw i64 %36, %15
%138 = zext i32 %125 to i64
br label %139
139: ; preds = %136, %139
%140 = phi i64 [ 0, %136 ], [ %153, %139 ]
%141 = mul nsw i64 %140, %14
%142 = add nsw i64 %141, %138
%143 = getelementptr inbounds double, double* %9, i64 %142
%144 = load double, double* %143
%145 = fneg double %144
%146 = add nsw i64 %140, %137
%147 = getelementptr inbounds double, double* %2, i64 %146
%148 = load double, double* %147
%149 = fadd double %128, %148
%150 = fneg double %149
%151 = tail call double @_logsumexp_pair(double %145, double %150)
%152 = fneg double %151
store double %152, double* %143
%153 = add nuw nsw i64 %140, 1
%154 = icmp eq i64 %153, %18
br i1 %154, label %155, label %139
155: ; preds = %139, %127, %123
%156 = add nuw nsw i64 %36, 1
%157 = icmp eq i64 %156, %16
br i1 %157, label %158, label %35
158: ; preds = %155, %10
ret void
}