#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_sort_kahan_inplace(double *, int);
void _tram_normalize(double *conf_energies, double *biased_conf_energies,
                     double *therm_energies, int n_therm_states,
                     int n_conf_states, double *scratch_M) {
  int i, KM = n_therm_states * n_conf_states;
  double f0;
  for (i = 0; i < n_conf_states; ++i)
    scratch_M[i] = -conf_energies[i];
  f0 = -_logsumexp_sort_kahan_inplace(scratch_M, n_conf_states);
  for (i = 0; i < n_conf_states; ++i)
    conf_energies[i] -= f0;
  for (i = 0; i < KM; ++i)
    biased_conf_energies[i] -= f0;
  for (i = 0; i < n_therm_states; ++i)
    therm_energies[i] -= f0;
}


x86 assembly (clang, -O0):
<_tram_normalize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8d,-0x20(%rbp)
mov    %r9,-0x28(%rbp)
mov    -0x1c(%rbp),%eax
imul   -0x20(%rbp),%eax
mov    %eax,-0x30(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    118b <_tram_normalize+0x7b>
mov    -0x8(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mov    -0x28(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1140 <_tram_normalize+0x30>
mov    -0x28(%rbp),%rdi
mov    -0x20(%rbp),%esi
call   1030 <_logsumexp_sort_kahan_inplace@plt>
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x38(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    11ef <_tram_normalize+0xdf>
movsd  -0x38(%rbp),%xmm1
mov    -0x8(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    11ba <_tram_normalize+0xaa>
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x30(%rbp),%eax
jge    122b <_tram_normalize+0x11b>
movsd  -0x38(%rbp),%xmm1
mov    -0x10(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    11f6 <_tram_normalize+0xe6>
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    1267 <_tram_normalize+0x157>
movsd  -0x38(%rbp),%xmm1
mov    -0x18(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1232 <_tram_normalize+0x122>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_tram_normalize>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r8d,%r12d
mov    %ecx,%r14d
mov    %rdx,%r15
mov    %rsi,%rbp
mov    %r8d,%r13d
imul   %ecx,%r13d
test   %r8d,%r8d
jle    1200 <_tram_normalize+0xf0>
mov    %rdi,%rbx
mov    %r14d,0x4(%rsp)
mov    %r12d,%r14d
cmp    $0x4,%r12d
jb     1162 <_tram_normalize+0x52>
lea    (%rbx,%r14,8),%rax
cmp    %r9,%rax
jbe    1219 <_tram_normalize+0x109>
lea    (%r9,%r14,8),%rax
cmp    %rbx,%rax
jbe    1219 <_tram_normalize+0x109>
xor    %eax,%eax
mov    %rax,%rcx
not    %rcx
add    %r14,%rcx
mov    %r14,%rdx
and    $0x3,%rdx
je     1199 <_tram_normalize+0x89>
movapd 0xe82(%rip),%xmm0
xchg   %ax,%ax
movsd  (%rbx,%rax,8),%xmm1
xorpd  %xmm0,%xmm1
movlpd %xmm1,(%r9,%rax,8)
add    $0x1,%rax
add    $0xffffffffffffffff,%rdx
jne    1180 <_tram_normalize+0x70>
cmp    $0x3,%rcx
jb     12d2 <_tram_normalize+0x1c2>
movapd 0xe55(%rip),%xmm0
nopl   0x0(%rax,%rax,1)
movsd  (%rbx,%rax,8),%xmm1
xorpd  %xmm0,%xmm1
movlpd %xmm1,(%r9,%rax,8)
movsd  0x8(%rbx,%rax,8),%xmm1
xorpd  %xmm0,%xmm1
movlpd %xmm1,0x8(%r9,%rax,8)
movsd  0x10(%rbx,%rax,8),%xmm1
xorpd  %xmm0,%xmm1
movlpd %xmm1,0x10(%r9,%rax,8)
movsd  0x18(%rbx,%rax,8),%xmm1
xorpd  %xmm0,%xmm1
movlpd %xmm1,0x18(%r9,%rax,8)
add    $0x4,%rax
cmp    %rax,%r14
jne    11b0 <_tram_normalize+0xa0>
jmp    12d2 <_tram_normalize+0x1c2>
mov    %r9,%rdi
mov    %r12d,%esi
call   1030 <_logsumexp_sort_kahan_inplace@plt>
test   %r13d,%r13d
jg     13c5 <_tram_normalize+0x2b5>
jmp    14a9 <_tram_normalize+0x399>
mov    %r14d,%eax
and    $0xfffffffc,%eax
lea    -0x4(%rax),%rcx
mov    %rcx,%rdx
shr    $0x2,%rdx
add    $0x1,%rdx
test   %rcx,%rcx
je     15c3 <_tram_normalize+0x4b3>
mov    %rdx,%rsi
and    $0xfffffffffffffffe,%rsi
xor    %ecx,%ecx
movapd 0xdb8(%rip),%xmm0
nopl   0x0(%rax,%rax,1)
movupd (%rbx,%rcx,8),%xmm1
movupd 0x10(%rbx,%rcx,8),%xmm2
xorpd  %xmm0,%xmm1
xorpd  %xmm0,%xmm2
movupd %xmm1,(%r9,%rcx,8)
movupd %xmm2,0x10(%r9,%rcx,8)
movupd 0x20(%rbx,%rcx,8),%xmm1
movupd 0x30(%rbx,%rcx,8),%xmm2
xorpd  %xmm0,%xmm1
xorpd  %xmm0,%xmm2
movupd %xmm1,0x20(%r9,%rcx,8)
movupd %xmm2,0x30(%r9,%rcx,8)
add    $0x8,%rcx
add    $0xfffffffffffffffe,%rsi
jne    1250 <_tram_normalize+0x140>
test   $0x1,%dl
je     12c9 <_tram_normalize+0x1b9>
movupd (%rbx,%rcx,8),%xmm0
movupd 0x10(%rbx,%rcx,8),%xmm1
movapd 0xd4c(%rip),%xmm2
xorpd  %xmm2,%xmm0
xorpd  %xmm2,%xmm1
movupd %xmm0,(%r9,%rcx,8)
movupd %xmm1,0x10(%r9,%rcx,8)
cmp    %r14,%rax
jne    1164 <_tram_normalize+0x54>
mov    %r9,%rdi
mov    %r12d,%esi
call   1030 <_logsumexp_sort_kahan_inplace@plt>
test   %r12d,%r12d
jle    13b7 <_tram_normalize+0x2a7>
cmp    $0x4,%r12d
jae    12f3 <_tram_normalize+0x1e3>
xor    %eax,%eax
jmp    13a0 <_tram_normalize+0x290>
mov    %r14d,%eax
and    $0xfffffffc,%eax
movapd %xmm0,%xmm1
unpcklpd %xmm0,%xmm1
lea    -0x4(%rax),%rcx
mov    %rcx,%rdx
shr    $0x2,%rdx
add    $0x1,%rdx
test   %rcx,%rcx
je     15b3 <_tram_normalize+0x4a3>
mov    %rdx,%rsi
and    $0xfffffffffffffffe,%rsi
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movupd (%rbx,%rcx,8),%xmm2
movupd 0x10(%rbx,%rcx,8),%xmm3
movupd 0x20(%rbx,%rcx,8),%xmm4
movupd 0x30(%rbx,%rcx,8),%xmm5
addpd  %xmm1,%xmm2
addpd  %xmm1,%xmm3
movupd %xmm2,(%rbx,%rcx,8)
movupd %xmm3,0x10(%rbx,%rcx,8)
addpd  %xmm1,%xmm4
addpd  %xmm1,%xmm5
movupd %xmm4,0x20(%rbx,%rcx,8)
movupd %xmm5,0x30(%rbx,%rcx,8)
add    $0x8,%rcx
add    $0xfffffffffffffffe,%rsi
jne    1330 <_tram_normalize+0x220>
test   $0x1,%dl
je     139b <_tram_normalize+0x28b>
movupd (%rbx,%rcx,8),%xmm2
movupd 0x10(%rbx,%rcx,8),%xmm3
addpd  %xmm1,%xmm2
addpd  %xmm1,%xmm3
movupd %xmm2,(%rbx,%rcx,8)
movupd %xmm3,0x10(%rbx,%rcx,8)
cmp    %r14,%rax
je     13b7 <_tram_normalize+0x2a7>
movsd  (%rbx,%rax,8),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,(%rbx,%rax,8)
add    $0x1,%rax
cmp    %rax,%r14
jne    13a0 <_tram_normalize+0x290>
mov    0x4(%rsp),%r14d
test   %r13d,%r13d
jle    14a9 <_tram_normalize+0x399>
mov    %r13d,%eax
cmp    $0x4,%r13d
jae    13d5 <_tram_normalize+0x2c5>
xor    %ecx,%ecx
jmp    1490 <_tram_normalize+0x380>
mov    %eax,%ecx
and    $0xfffffffc,%ecx
movapd %xmm0,%xmm1
unpcklpd %xmm0,%xmm1
lea    -0x4(%rcx),%rdx
mov    %rdx,%rsi
shr    $0x2,%rsi
add    $0x1,%rsi
test   %rdx,%rdx
je     1598 <_tram_normalize+0x488>
mov    %rsi,%rdi
and    $0xfffffffffffffffe,%rdi
xor    %edx,%edx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movupd 0x0(%rbp,%rdx,8),%xmm2
movupd 0x10(%rbp,%rdx,8),%xmm3
movupd 0x20(%rbp,%rdx,8),%xmm4
movupd 0x30(%rbp,%rdx,8),%xmm5
addpd  %xmm1,%xmm2
addpd  %xmm1,%xmm3
movupd %xmm2,0x0(%rbp,%rdx,8)
movupd %xmm3,0x10(%rbp,%rdx,8)
addpd  %xmm1,%xmm4
addpd  %xmm1,%xmm5
movupd %xmm4,0x20(%rbp,%rdx,8)
movupd %xmm5,0x30(%rbp,%rdx,8)
add    $0x8,%rdx
add    $0xfffffffffffffffe,%rdi
jne    1410 <_tram_normalize+0x300>
test   $0x1,%sil
je     1480 <_tram_normalize+0x370>
movupd 0x0(%rbp,%rdx,8),%xmm2
movupd 0x10(%rbp,%rdx,8),%xmm3
addpd  %xmm1,%xmm2
addpd  %xmm1,%xmm3
movupd %xmm2,0x0(%rbp,%rdx,8)
movupd %xmm3,0x10(%rbp,%rdx,8)
cmp    %rax,%rcx
je     14a9 <_tram_normalize+0x399>
cs nopw 0x0(%rax,%rax,1)
nop
movsd  0x0(%rbp,%rcx,8),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,0x0(%rbp,%rcx,8)
add    $0x1,%rcx
cmp    %rcx,%rax
jne    1490 <_tram_normalize+0x380>
test   %r14d,%r14d
jle    1589 <_tram_normalize+0x479>
mov    %r14d,%eax
cmp    $0x4,%r14d
jae    14c2 <_tram_normalize+0x3b2>
xor    %ecx,%ecx
jmp    1570 <_tram_normalize+0x460>
mov    %eax,%ecx
and    $0xfffffffc,%ecx
movapd %xmm0,%xmm1
unpcklpd %xmm0,%xmm1
lea    -0x4(%rcx),%rdx
mov    %rdx,%rsi
shr    $0x2,%rsi
add    $0x1,%rsi
test   %rdx,%rdx
je     15a9 <_tram_normalize+0x499>
mov    %rsi,%rdi
and    $0xfffffffffffffffe,%rdi
xor    %edx,%edx
movupd (%r15,%rdx,8),%xmm2
movupd 0x10(%r15,%rdx,8),%xmm3
movupd 0x20(%r15,%rdx,8),%xmm4
movupd 0x30(%r15,%rdx,8),%xmm5
addpd  %xmm1,%xmm2
addpd  %xmm1,%xmm3
movupd %xmm2,(%r15,%rdx,8)
movupd %xmm3,0x10(%r15,%rdx,8)
addpd  %xmm1,%xmm4
addpd  %xmm1,%xmm5
movupd %xmm4,0x20(%r15,%rdx,8)
movupd %xmm5,0x30(%r15,%rdx,8)
add    $0x8,%rdx
add    $0xfffffffffffffffe,%rdi
jne    14f0 <_tram_normalize+0x3e0>
test   $0x1,%sil
je     1568 <_tram_normalize+0x458>
movupd (%r15,%rdx,8),%xmm2
movupd 0x10(%r15,%rdx,8),%xmm3
addpd  %xmm1,%xmm2
addpd  %xmm1,%xmm3
movupd %xmm2,(%r15,%rdx,8)
movupd %xmm3,0x10(%r15,%rdx,8)
cmp    %rax,%rcx
je     1589 <_tram_normalize+0x479>
nopl   (%rax)
movsd  (%r15,%rcx,8),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,(%r15,%rcx,8)
add    $0x1,%rcx
cmp    %rcx,%rax
jne    1570 <_tram_normalize+0x460>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %edx,%edx
test   $0x1,%sil
jne    1460 <_tram_normalize+0x350>
jmp    1480 <_tram_normalize+0x370>
xor    %edx,%edx
test   $0x1,%sil
jne    1546 <_tram_normalize+0x436>
jmp    1568 <_tram_normalize+0x458>
xor    %ecx,%ecx
test   $0x1,%dl
jne    137d <_tram_normalize+0x26d>
jmp    139b <_tram_normalize+0x28b>
xor    %ecx,%ecx
test   $0x1,%dl
jne    12a1 <_tram_normalize+0x191>
jmp    12c9 <_tram_normalize+0x1b9>

LLVM IR (-O0):
define void @_tram_normalize(double* %0, double* %1, double* %2, i32 %3, i32 %4, double* %5) {
%7 = alloca double*
%8 = alloca double*
%9 = alloca double*
%10 = alloca i32
%11 = alloca i32
%12 = alloca double*
%13 = alloca i32
%14 = alloca i32
%15 = alloca double
store double* %0, double** %7
store double* %1, double** %8
store double* %2, double** %9
store i32 %3, i32* %10
store i32 %4, i32* %11
store double* %5, double** %12
%16 = load i32, i32* %10
%17 = load i32, i32* %11
%18 = mul nsw i32 %16, %17
store i32 %18, i32* %14
store i32 0, i32* %13
br label %19
19: ; preds = %34, %6
%20 = load i32, i32* %13
%21 = load i32, i32* %11
%22 = icmp slt i32 %20, %21
br i1 %22, label %23, label %37
23: ; preds = %19
%24 = load double*, double** %7
%25 = load i32, i32* %13
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds double, double* %24, i64 %26
%28 = load double, double* %27
%29 = fneg double %28
%30 = load double*, double** %12
%31 = load i32, i32* %13
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds double, double* %30, i64 %32
store double %29, double* %33
br label %34
34: ; preds = %23
%35 = load i32, i32* %13
%36 = add nsw i32 %35, 1
store i32 %36, i32* %13
br label %19
37: ; preds = %19
%38 = load double*, double** %12
%39 = load i32, i32* %11
%40 = call double @_logsumexp_sort_kahan_inplace(double* %38, i32 %39)
%41 = fneg double %40
store double %41, double* %15
store i32 0, i32* %13
br label %42
42: ; preds = %54, %37
%43 = load i32, i32* %13
%44 = load i32, i32* %11
%45 = icmp slt i32 %43, %44
br i1 %45, label %46, label %57
46: ; preds = %42
%47 = load double, double* %15
%48 = load double*, double** %7
%49 = load i32, i32* %13
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds double, double* %48, i64 %50
%52 = load double, double* %51
%53 = fsub double %52, %47
store double %53, double* %51
br label %54
54: ; preds = %46
%55 = load i32, i32* %13
%56 = add nsw i32 %55, 1
store i32 %56, i32* %13
br label %42
57: ; preds = %42
store i32 0, i32* %13
br label %58
58: ; preds = %70, %57
%59 = load i32, i32* %13
%60 = load i32, i32* %14
%61 = icmp slt i32 %59, %60
br i1 %61, label %62, label %73
62: ; preds = %58
%63 = load double, double* %15
%64 = load double*, double** %8
%65 = load i32, i32* %13
%66 = sext i32 %65 to i64
%67 = getelementptr inbounds double, double* %64, i64 %66
%68 = load double, double* %67
%69 = fsub double %68, %63
store double %69, double* %67
br label %70
70: ; preds = %62
%71 = load i32, i32* %13
%72 = add nsw i32 %71, 1
store i32 %72, i32* %13
br label %58
73: ; preds = %58
store i32 0, i32* %13
br label %74
74: ; preds = %86, %73
%75 = load i32, i32* %13
%76 = load i32, i32* %10
%77 = icmp slt i32 %75, %76
br i1 %77, label %78, label %89
78: ; preds = %74
%79 = load double, double* %15
%80 = load double*, double** %9
%81 = load i32, i32* %13
%82 = sext i32 %81 to i64
%83 = getelementptr inbounds double, double* %80, i64 %82
%84 = load double, double* %83
%85 = fsub double %84, %79
store double %85, double* %83
br label %86
86: ; preds = %78
%87 = load i32, i32* %13
%88 = add nsw i32 %87, 1
store i32 %88, i32* %13
br label %74
89: ; preds = %74
ret void
}

LLVM IR (-O2):
define void @_tram_normalize(double* nocapture %0, double* nocapture %1, double* nocapture %2, i32 %3, i32 %4, double* %5) {
%7 = mul i32 %4, %3
%8 = icmp sgt i32 %4, 0
br i1 %8, label %11, label %9
9: ; preds = %6
%10 = tail call double @_logsumexp_sort_kahan_inplace(double* %5, i32 %4)
br label %183
11: ; preds = %6
%12 = zext i32 %4 to i64
%13 = icmp ult i32 %4, 4
br i1 %13, label %78, label %14
14: ; preds = %11
%15 = getelementptr double, double* %5, i64 %12
%16 = getelementptr double, double* %0, i64 %12
%17 = icmp ugt double* %16, %5
%18 = icmp ugt double* %15, %0
%19 = and i1 %17, %18
br i1 %19, label %78, label %20
20: ; preds = %14
%21 = and i64 %12, 4294967292
%22 = add nsw i64 %21, -4
%23 = lshr exact i64 %22, 2
%24 = add nuw nsw i64 %23, 1
%25 = and i64 %24, 1
%26 = icmp eq i64 %22, 0
br i1 %26, label %60, label %27
27: ; preds = %20
%28 = and i64 %24, 9223372036854775806
br label %29
29: ; preds = %29, %27
%30 = phi i64 [ 0, %27 ], [ %57, %29 ]
%31 = phi i64 [ 0, %27 ], [ %58, %29 ]
%32 = getelementptr inbounds double, double* %0, i64 %30
%33 = bitcast double* %32 to <2 x double>*
%34 = load <2 x double>, <2 x double>* %33
%35 = getelementptr inbounds double, double* %32, i64 2
%36 = bitcast double* %35 to <2 x double>*
%37 = load <2 x double>, <2 x double>* %36
%38 = fneg <2 x double> %34
%39 = fneg <2 x double> %37
%40 = getelementptr inbounds double, double* %5, i64 %30
%41 = bitcast double* %40 to <2 x double>*
store <2 x double> %38, <2 x double>* %41
%42 = getelementptr inbounds double, double* %40, i64 2
%43 = bitcast double* %42 to <2 x double>*
store <2 x double> %39, <2 x double>* %43
%44 = or i64 %30, 4
%45 = getelementptr inbounds double, double* %0, i64 %44
%46 = bitcast double* %45 to <2 x double>*
%47 = load <2 x double>, <2 x double>* %46
%48 = getelementptr inbounds double, double* %45, i64 2
%49 = bitcast double* %48 to <2 x double>*
%50 = load <2 x double>, <2 x double>* %49
%51 = fneg <2 x double> %47
%52 = fneg <2 x double> %50
%53 = getelementptr inbounds double, double* %5, i64 %44
%54 = bitcast double* %53 to <2 x double>*
store <2 x double> %51, <2 x double>* %54
%55 = getelementptr inbounds double, double* %53, i64 2
%56 = bitcast double* %55 to <2 x double>*
store <2 x double> %52, <2 x double>* %56
%57 = add nuw i64 %30, 8
%58 = add i64 %31, 2
%59 = icmp eq i64 %58, %28
br i1 %59, label %60, label %29
60: ; preds = %29, %20
%61 = phi i64 [ 0, %20 ], [ %57, %29 ]
%62 = icmp eq i64 %25, 0
br i1 %62, label %76, label %63
63: ; preds = %60
%64 = getelementptr inbounds double, double* %0, i64 %61
%65 = bitcast double* %64 to <2 x double>*
%66 = load <2 x double>, <2 x double>* %65
%67 = getelementptr inbounds double, double* %64, i64 2
%68 = bitcast double* %67 to <2 x double>*
%69 = load <2 x double>, <2 x double>* %68
%70 = fneg <2 x double> %66
%71 = fneg <2 x double> %69
%72 = getelementptr inbounds double, double* %5, i64 %61
%73 = bitcast double* %72 to <2 x double>*
store <2 x double> %70, <2 x double>* %73
%74 = getelementptr inbounds double, double* %72, i64 2
%75 = bitcast double* %74 to <2 x double>*
store <2 x double> %71, <2 x double>* %75
br label %76
76: ; preds = %60, %63
%77 = icmp eq i64 %21, %12
br i1 %77, label %120, label %78
78: ; preds = %14, %11, %76
%79 = phi i64 [ 0, %14 ], [ 0, %11 ], [ %21, %76 ]
%80 = xor i64 %79, -1
%81 = add nsw i64 %80, %12
%82 = and i64 %12, 3
%83 = icmp eq i64 %82, 0
br i1 %83, label %94, label %84
84: ; preds = %78, %84
%85 = phi i64 [ %91, %84 ], [ %79, %78 ]
%86 = phi i64 [ %92, %84 ], [ 0, %78 ]
%87 = getelementptr inbounds double, double* %0, i64 %85
%88 = load double, double* %87
%89 = fneg double %88
%90 = getelementptr inbounds double, double* %5, i64 %85
store double %89, double* %90
%91 = add nuw nsw i64 %85, 1
%92 = add i64 %86, 1
%93 = icmp eq i64 %92, %82
br i1 %93, label %94, label %84
94: ; preds = %84, %78
%95 = phi i64 [ %79, %78 ], [ %91, %84 ]
%96 = icmp ult i64 %81, 3
br i1 %96, label %120, label %97
97: ; preds = %94, %97
%98 = phi i64 [ %118, %97 ], [ %95, %94 ]
%99 = getelementptr inbounds double, double* %0, i64 %98
%100 = load double, double* %99
%101 = fneg double %100
%102 = getelementptr inbounds double, double* %5, i64 %98
store double %101, double* %102
%103 = add nuw nsw i64 %98, 1
%104 = getelementptr inbounds double, double* %0, i64 %103
%105 = load double, double* %104
%106 = fneg double %105
%107 = getelementptr inbounds double, double* %5, i64 %103
store double %106, double* %107
%108 = add nuw nsw i64 %98, 2
%109 = getelementptr inbounds double, double* %0, i64 %108
%110 = load double, double* %109
%111 = fneg double %110
%112 = getelementptr inbounds double, double* %5, i64 %108
store double %111, double* %112
%113 = add nuw nsw i64 %98, 3
%114 = getelementptr inbounds double, double* %0, i64 %113
%115 = load double, double* %114
%116 = fneg double %115
%117 = getelementptr inbounds double, double* %5, i64 %113
store double %116, double* %117
%118 = add nuw nsw i64 %98, 4
%119 = icmp eq i64 %118, %12
br i1 %119, label %120, label %97
120: ; preds = %94, %97, %76
%121 = tail call double @_logsumexp_sort_kahan_inplace(double* %5, i32 %4)
br i1 %8, label %122, label %183
122: ; preds = %120
%123 = zext i32 %4 to i64
%124 = icmp ult i32 %4, 4
br i1 %124, label %181, label %125
125: ; preds = %122
%126 = and i64 %12, 4294967292
%127 = insertelement <2 x double> poison, double %121, i64 0
%128 = shufflevector <2 x double> %127, <2 x double> poison, <2 x i32> zeroinitializer
%129 = insertelement <2 x double> poison, double %121, i64 0
%130 = shufflevector <2 x double> %129, <2 x double> poison, <2 x i32> zeroinitializer
%131 = add nsw i64 %126, -4
%132 = lshr exact i64 %131, 2
%133 = add nuw nsw i64 %132, 1
%134 = and i64 %133, 1
%135 = icmp eq i64 %131, 0
br i1 %135, label %165, label %136
136: ; preds = %125
%137 = and i64 %133, 9223372036854775806
br label %138
138: ; preds = %138, %136
%139 = phi i64 [ 0, %136 ], [ %162, %138 ]
%140 = phi i64 [ 0, %136 ], [ %163, %138 ]
%141 = getelementptr inbounds double, double* %0, i64 %139
%142 = bitcast double* %141 to <2 x double>*
%143 = load <2 x double>, <2 x double>* %142
%144 = getelementptr inbounds double, double* %141, i64 2
%145 = bitcast double* %144 to <2 x double>*
%146 = load <2 x double>, <2 x double>* %145
%147 = fadd <2 x double> %128, %143
%148 = fadd <2 x double> %130, %146
%149 = bitcast double* %141 to <2 x double>*
store <2 x double> %147, <2 x double>* %149
%150 = bitcast double* %144 to <2 x double>*
store <2 x double> %148, <2 x double>* %150
%151 = or i64 %139, 4
%152 = getelementptr inbounds double, double* %0, i64 %151
%153 = bitcast double* %152 to <2 x double>*
%154 = load <2 x double>, <2 x double>* %153
%155 = getelementptr inbounds double, double* %152, i64 2
%156 = bitcast double* %155 to <2 x double>*
%157 = load <2 x double>, <2 x double>* %156
%158 = fadd <2 x double> %128, %154
%159 = fadd <2 x double> %130, %157
%160 = bitcast double* %152 to <2 x double>*
store <2 x double> %158, <2 x double>* %160
%161 = bitcast double* %155 to <2 x double>*
store <2 x double> %159, <2 x double>* %161
%162 = add nuw i64 %139, 8
%163 = add i64 %140, 2
%164 = icmp eq i64 %163, %137
br i1 %164, label %165, label %138
165: ; preds = %138, %125
%166 = phi i64 [ 0, %125 ], [ %162, %138 ]
%167 = icmp eq i64 %134, 0
br i1 %167, label %179, label %168
168: ; preds = %165
%169 = getelementptr inbounds double, double* %0, i64 %166
%170 = bitcast double* %169 to <2 x double>*
%171 = load <2 x double>, <2 x double>* %170
%172 = getelementptr inbounds double, double* %169, i64 2
%173 = bitcast double* %172 to <2 x double>*
%174 = load <2 x double>, <2 x double>* %173
%175 = fadd <2 x double> %128, %171
%176 = fadd <2 x double> %130, %174
%177 = bitcast double* %169 to <2 x double>*
store <2 x double> %175, <2 x double>* %177
%178 = bitcast double* %172 to <2 x double>*
store <2 x double> %176, <2 x double>* %178
br label %179
179: ; preds = %165, %168
%180 = icmp eq i64 %126, %12
br i1 %180, label %183, label %181
181: ; preds = %122, %179
%182 = phi i64 [ 0, %122 ], [ %126, %179 ]
br label %247
183: ; preds = %247, %179, %9, %120
%184 = phi double [ %10, %9 ], [ %121, %120 ], [ %121, %179 ], [ %121, %247 ]
%185 = icmp sgt i32 %7, 0
br i1 %185, label %186, label %254
186: ; preds = %183
%187 = zext i32 %7 to i64
%188 = icmp ult i32 %7, 4
br i1 %188, label %245, label %189
189: ; preds = %186
%190 = and i64 %187, 4294967292
%191 = insertelement <2 x double> poison, double %184, i64 0
%192 = shufflevector <2 x double> %191, <2 x double> poison, <2 x i32> zeroinitializer
%193 = insertelement <2 x double> poison, double %184, i64 0
%194 = shufflevector <2 x double> %193, <2 x double> poison, <2 x i32> zeroinitializer
%195 = add nsw i64 %190, -4
%196 = lshr exact i64 %195, 2
%197 = add nuw nsw i64 %196, 1
%198 = and i64 %197, 1
%199 = icmp eq i64 %195, 0
br i1 %199, label %229, label %200
200: ; preds = %189
%201 = and i64 %197, 9223372036854775806
br label %202
202: ; preds = %202, %200
%203 = phi i64 [ 0, %200 ], [ %226, %202 ]
%204 = phi i64 [ 0, %200 ], [ %227, %202 ]
%205 = getelementptr inbounds double, double* %1, i64 %203
%206 = bitcast double* %205 to <2 x double>*
%207 = load <2 x double>, <2 x double>* %206
%208 = getelementptr inbounds double, double* %205, i64 2
%209 = bitcast double* %208 to <2 x double>*
%210 = load <2 x double>, <2 x double>* %209
%211 = fadd <2 x double> %192, %207
%212 = fadd <2 x double> %194, %210
%213 = bitcast double* %205 to <2 x double>*
store <2 x double> %211, <2 x double>* %213
%214 = bitcast double* %208 to <2 x double>*
store <2 x double> %212, <2 x double>* %214
%215 = or i64 %203, 4
%216 = getelementptr inbounds double, double* %1, i64 %215
%217 = bitcast double* %216 to <2 x double>*
%218 = load <2 x double>, <2 x double>* %217
%219 = getelementptr inbounds double, double* %216, i64 2
%220 = bitcast double* %219 to <2 x double>*
%221 = load <2 x double>, <2 x double>* %220
%222 = fadd <2 x double> %192, %218
%223 = fadd <2 x double> %194, %221
%224 = bitcast double* %216 to <2 x double>*
store <2 x double> %222, <2 x double>* %224
%225 = bitcast double* %219 to <2 x double>*
store <2 x double> %223, <2 x double>* %225
%226 = add nuw i64 %203, 8
%227 = add i64 %204, 2
%228 = icmp eq i64 %227, %201
br i1 %228, label %229, label %202
229: ; preds = %202, %189
%230 = phi i64 [ 0, %189 ], [ %226, %202 ]
%231 = icmp eq i64 %198, 0
br i1 %231, label %243, label %232
232: ; preds = %229
%233 = getelementptr inbounds double, double* %1, i64 %230
%234 = bitcast double* %233 to <2 x double>*
%235 = load <2 x double>, <2 x double>* %234
%236 = getelementptr inbounds double, double* %233, i64 2
%237 = bitcast double* %236 to <2 x double>*
%238 = load <2 x double>, <2 x double>* %237
%239 = fadd <2 x double> %192, %235
%240 = fadd <2 x double> %194, %238
%241 = bitcast double* %233 to <2 x double>*
store <2 x double> %239, <2 x double>* %241
%242 = bitcast double* %236 to <2 x double>*
store <2 x double> %240, <2 x double>* %242
br label %243
243: ; preds = %229, %232
%244 = icmp eq i64 %190, %187
br i1 %244, label %254, label %245
245: ; preds = %186, %243
%246 = phi i64 [ 0, %186 ], [ %190, %243 ]
br label %317
247: ; preds = %181, %247
%248 = phi i64 [ %252, %247 ], [ %182, %181 ]
%249 = getelementptr inbounds double, double* %0, i64 %248
%250 = load double, double* %249
%251 = fadd double %121, %250
store double %251, double* %249
%252 = add nuw nsw i64 %248, 1
%253 = icmp eq i64 %252, %123
br i1 %253, label %183, label %247
254: ; preds = %317, %243, %183
%255 = icmp sgt i32 %3, 0
br i1 %255, label %256, label %331
256: ; preds = %254
%257 = zext i32 %3 to i64
%258 = icmp ult i32 %3, 4
br i1 %258, label %315, label %259
259: ; preds = %256
%260 = and i64 %257, 4294967292
%261 = insertelement <2 x double> poison, double %184, i64 0
%262 = shufflevector <2 x double> %261, <2 x double> poison, <2 x i32> zeroinitializer
%263 = insertelement <2 x double> poison, double %184, i64 0
%264 = shufflevector <2 x double> %263, <2 x double> poison, <2 x i32> zeroinitializer
%265 = add nsw i64 %260, -4
%266 = lshr exact i64 %265, 2
%267 = add nuw nsw i64 %266, 1
%268 = and i64 %267, 1
%269 = icmp eq i64 %265, 0
br i1 %269, label %299, label %270
270: ; preds = %259
%271 = and i64 %267, 9223372036854775806
br label %272
272: ; preds = %272, %270
%273 = phi i64 [ 0, %270 ], [ %296, %272 ]
%274 = phi i64 [ 0, %270 ], [ %297, %272 ]
%275 = getelementptr inbounds double, double* %2, i64 %273
%276 = bitcast double* %275 to <2 x double>*
%277 = load <2 x double>, <2 x double>* %276
%278 = getelementptr inbounds double, double* %275, i64 2
%279 = bitcast double* %278 to <2 x double>*
%280 = load <2 x double>, <2 x double>* %279
%281 = fadd <2 x double> %262, %277
%282 = fadd <2 x double> %264, %280
%283 = bitcast double* %275 to <2 x double>*
store <2 x double> %281, <2 x double>* %283
%284 = bitcast double* %278 to <2 x double>*
store <2 x double> %282, <2 x double>* %284
%285 = or i64 %273, 4
%286 = getelementptr inbounds double, double* %2, i64 %285
%287 = bitcast double* %286 to <2 x double>*
%288 = load <2 x double>, <2 x double>* %287
%289 = getelementptr inbounds double, double* %286, i64 2
%290 = bitcast double* %289 to <2 x double>*
%291 = load <2 x double>, <2 x double>* %290
%292 = fadd <2 x double> %262, %288
%293 = fadd <2 x double> %264, %291
%294 = bitcast double* %286 to <2 x double>*
store <2 x double> %292, <2 x double>* %294
%295 = bitcast double* %289 to <2 x double>*
store <2 x double> %293, <2 x double>* %295
%296 = add nuw i64 %273, 8
%297 = add i64 %274, 2
%298 = icmp eq i64 %297, %271
br i1 %298, label %299, label %272
299: ; preds = %272, %259
%300 = phi i64 [ 0, %259 ], [ %296, %272 ]
%301 = icmp eq i64 %268, 0
br i1 %301, label %313, label %302
302: ; preds = %299
%303 = getelementptr inbounds double, double* %2, i64 %300
%304 = bitcast double* %303 to <2 x double>*
%305 = load <2 x double>, <2 x double>* %304
%306 = getelementptr inbounds double, double* %303, i64 2
%307 = bitcast double* %306 to <2 x double>*
%308 = load <2 x double>, <2 x double>* %307
%309 = fadd <2 x double> %262, %305
%310 = fadd <2 x double> %264, %308
%311 = bitcast double* %303 to <2 x double>*
store <2 x double> %309, <2 x double>* %311
%312 = bitcast double* %306 to <2 x double>*
store <2 x double> %310, <2 x double>* %312
br label %313
313: ; preds = %299, %302
%314 = icmp eq i64 %260, %257
br i1 %314, label %331, label %315
315: ; preds = %256, %313
%316 = phi i64 [ 0, %256 ], [ %260, %313 ]
br label %324
317: ; preds = %245, %317
%318 = phi i64 [ %322, %317 ], [ %246, %245 ]
%319 = getelementptr inbounds double, double* %1, i64 %318
%320 = load double, double* %319
%321 = fadd double %184, %320
store double %321, double* %319
%322 = add nuw nsw i64 %318, 1
%323 = icmp eq i64 %322, %187
br i1 %323, label %254, label %317
324: ; preds = %315, %324
%325 = phi i64 [ %329, %324 ], [ %316, %315 ]
%326 = getelementptr inbounds double, double* %2, i64 %325
%327 = load double, double* %326
%328 = fadd double %184, %327
store double %328, double* %326
%329 = add nuw nsw i64 %325, 1
%330 = icmp eq i64 %329, %257
br i1 %330, label %331, label %324
331: ; preds = %324, %313, %254
ret void
}