void dualityGap(double *gap, double *z, double *g, double *s, double *Av,
                double lambda, int nn) {
  int i, m;
  double temp;
  g[0] = z[0] + z[0] - z[1] - Av[0];
  for (i = 1; i < nn - 1; i++) {
    g[i] = -z[i - 1] + z[i] + z[i] - z[i + 1] - Av[i];
  }
  g[nn - 1] = -z[nn - 2] + z[nn - 1] + z[nn - 1] - Av[nn - 1];
  for (i = 0; i < nn; i++)
    if (g[i] > 0)
      s[i] = lambda + z[i];
    else
      s[i] = -lambda + z[i];
  temp = 0;
  m = nn % 5;
  if (m != 0) {
    for (i = 0; i < m; i++)
      temp += s[i] * g[i];
  }
  for (i = m; i < nn; i += 5)
    temp = temp + s[i] * g[i] + s[i + 1] * g[i + 1] + s[i + 2] * g[i + 2] +
           s[i + 3] * g[i + 3] + s[i + 4] * g[i + 4];
  *gap = temp;
}


x86 assembly (clang, -O0):
<dualityGap>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
movsd  %xmm0,-0x30(%rbp)
mov    %r9d,-0x34(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
addsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
subsd  0x8(%rax),%xmm0
mov    -0x28(%rbp),%rax
subsd  (%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
movl   $0x1,-0x38(%rbp)
mov    -0x38(%rbp),%eax
mov    -0x34(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    11df <dualityGap+0xdf>
mov    -0x10(%rbp),%rax
mov    -0x38(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mov    -0x10(%rbp),%rax
movslq -0x38(%rbp),%rcx
addsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x38(%rbp),%rcx
addsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x38(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
subsd  (%rax,%rcx,8),%xmm0
mov    -0x28(%rbp),%rax
movslq -0x38(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
movslq -0x38(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    1151 <dualityGap+0x51>
mov    -0x10(%rbp),%rax
mov    -0x34(%rbp),%ecx
sub    $0x2,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mov    -0x10(%rbp),%rax
mov    -0x34(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
addsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x34(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
addsd  (%rax,%rcx,8),%xmm0
mov    -0x28(%rbp),%rax
mov    -0x34(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
subsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
mov    -0x34(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
movl   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%eax
cmp    -0x34(%rbp),%eax
jge    12ea <dualityGap+0x1ea>
mov    -0x18(%rbp),%rax
movslq -0x38(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    12a1 <dualityGap+0x1a1>
movsd  -0x30(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x38(%rbp),%rcx
addsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x38(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
jmp    12d7 <dualityGap+0x1d7>
movsd  -0x30(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mov    -0x10(%rbp),%rax
movslq -0x38(%rbp),%rcx
addsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x38(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
jmp    12dc <dualityGap+0x1dc>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    1257 <dualityGap+0x157>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x34(%rbp),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
mov    %edx,-0x3c(%rbp)
cmpl   $0x0,-0x3c(%rbp)
je     135c <dualityGap+0x25c>
movl   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%eax
cmp    -0x3c(%rbp),%eax
jge    1357 <dualityGap+0x257>
mov    -0x20(%rbp),%rax
movslq -0x38(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
movslq -0x38(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
movsd  -0x48(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    1311 <dualityGap+0x211>
jmp    135c <dualityGap+0x25c>
mov    -0x3c(%rbp),%eax
mov    %eax,-0x38(%rbp)
mov    -0x38(%rbp),%eax
cmp    -0x34(%rbp),%eax
jge    1458 <dualityGap+0x358>
movsd  -0x48(%rbp),%xmm1
mov    -0x20(%rbp),%rax
movslq -0x38(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
movslq -0x38(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
mov    -0x38(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x18(%rbp),%rax
mov    -0x38(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
mov    -0x20(%rbp),%rax
mov    -0x38(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
mov    -0x38(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
mov    -0x38(%rbp),%ecx
add    $0x3,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x18(%rbp),%rax
mov    -0x38(%rbp),%ecx
add    $0x3,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
mov    -0x20(%rbp),%rax
mov    -0x38(%rbp),%ecx
add    $0x4,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
mov    -0x38(%rbp),%ecx
add    $0x4,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x38(%rbp),%eax
add    $0x5,%eax
mov    %eax,-0x38(%rbp)
jmp    1362 <dualityGap+0x262>
movsd  -0x48(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<dualityGap>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
movsd  (%rsi),%xmm1
addsd  %xmm1,%xmm1
subsd  0x8(%rsi),%xmm1
subsd  (%r8),%xmm1
movsd  %xmm1,(%rdx)
lea    -0x1(%r9),%r11d
cmp    $0x3,%r9d
jl     12c1 <dualityGap+0x1c1>
mov    %r11d,%r10d
lea    -0x1(%r10),%rbx
mov    $0x1,%eax
cmp    $0x4,%rbx
jae    11eb <dualityGap+0xeb>
mov    %rax,%rbx
not    %rbx
test   $0x1,%r10b
jne    1178 <dualityGap+0x78>
movsd  (%rsi,%rax,8),%xmm1
movapd %xmm1,%xmm2
subsd  -0x8(%rsi,%rax,8),%xmm2
addsd  %xmm1,%xmm2
subsd  0x8(%rsi,%rax,8),%xmm2
subsd  (%r8,%rax,8),%xmm2
movsd  %xmm2,(%rdx,%rax,8)
add    $0x1,%rax
add    %r10,%rbx
je     12c1 <dualityGap+0x1c1>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsd  (%rsi,%rax,8),%xmm1
movapd %xmm1,%xmm2
subsd  -0x8(%rsi,%rax,8),%xmm2
addsd  %xmm1,%xmm2
subsd  0x8(%rsi,%rax,8),%xmm2
subsd  (%r8,%rax,8),%xmm2
movsd  %xmm2,(%rdx,%rax,8)
movsd  0x8(%rsi,%rax,8),%xmm1
movapd %xmm1,%xmm2
subsd  (%rsi,%rax,8),%xmm2
addsd  %xmm1,%xmm2
subsd  0x10(%rsi,%rax,8),%xmm2
subsd  0x8(%r8,%rax,8),%xmm2
movsd  %xmm2,0x8(%rdx,%rax,8)
lea    0x2(%rax),%rbx
mov    %rbx,%rax
cmp    %rbx,%r10
jne    1190 <dualityGap+0x90>
jmp    12c1 <dualityGap+0x1c1>
mov    %rbx,-0x8(%rsp)
lea    0x8(%rdx),%rbx
lea    (%rdx,%r10,8),%rbp
lea    (%rsi,%r10,8),%r15
add    $0x8,%r15
lea    0x8(%r8),%r12
lea    (%r8,%r10,8),%r13
cmp    %r15,%rbx
setb   %r15b
cmp    %rsi,%rbp
seta   %r14b
cmp    %r13,%rbx
setb   %bl
cmp    %rbp,%r12
setb   %bpl
test   %r14b,%r15b
jne    1144 <dualityGap+0x44>
and    %bpl,%bl
jne    1144 <dualityGap+0x44>
mov    -0x8(%rsp),%rbp
mov    %rbp,%r15
and    $0xfffffffffffffffc,%r15
lea    0x1(%r15),%rax
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
movupd (%rsi,%rbx,8),%xmm1
movupd 0x8(%rsi,%rbx,8),%xmm2
movupd 0x10(%rsi,%rbx,8),%xmm3
movupd 0x18(%rsi,%rbx,8),%xmm4
movapd %xmm2,%xmm5
subpd  %xmm1,%xmm5
movapd %xmm4,%xmm1
subpd  %xmm3,%xmm1
addpd  %xmm2,%xmm5
addpd  %xmm4,%xmm1
movupd 0x20(%rsi,%rbx,8),%xmm2
subpd  %xmm2,%xmm1
subpd  %xmm3,%xmm5
movupd 0x8(%r8,%rbx,8),%xmm2
subpd  %xmm2,%xmm5
movupd 0x18(%r8,%rbx,8),%xmm2
subpd  %xmm2,%xmm1
movupd %xmm5,0x8(%rdx,%rbx,8)
movupd %xmm1,0x18(%rdx,%rbx,8)
add    $0x4,%rbx
cmp    %rbx,%r15
jne    1250 <dualityGap+0x150>
cmp    %r15,%rbp
jne    1144 <dualityGap+0x44>
movslq %r9d,%r10
movslq %r11d,%rax
movsd  (%rsi,%rax,8),%xmm1
movapd %xmm1,%xmm2
subsd  -0x10(%rsi,%r10,8),%xmm2
addsd  %xmm1,%xmm2
subsd  (%r8,%rax,8),%xmm2
movsd  %xmm2,(%rdx,%rax,8)
test   %r9d,%r9d
jle    148d <dualityGap+0x38d>
mov    %r9d,%r8d
cmp    $0x4,%r9d
jae    13b9 <dualityGap+0x2b9>
xor    %eax,%eax
mov    %rax,%rbx
not    %rbx
test   $0x1,%r8b
je     133e <dualityGap+0x23e>
movapd 0xcee(%rip),%xmm1
xorpd  %xmm2,%xmm2
cmpltsd (%rdx,%rax,8),%xmm2
xorpd  %xmm0,%xmm1
movapd %xmm2,%xmm3
andpd  %xmm0,%xmm3
andnpd %xmm1,%xmm2
orpd   %xmm3,%xmm2
addsd  (%rsi,%rax,8),%xmm2
movsd  %xmm2,(%rcx,%rax,8)
or     $0x1,%rax
add    %r8,%rbx
je     148d <dualityGap+0x38d>
movapd 0xcb1(%rip),%xmm1
xorpd  %xmm0,%xmm1
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
xorpd  %xmm2,%xmm2
cmpltsd (%rdx,%rax,8),%xmm2
movapd %xmm2,%xmm3
andpd  %xmm0,%xmm3
andnpd %xmm1,%xmm2
orpd   %xmm3,%xmm2
addsd  (%rsi,%rax,8),%xmm2
movsd  %xmm2,(%rcx,%rax,8)
xorpd  %xmm2,%xmm2
cmpltsd 0x8(%rdx,%rax,8),%xmm2
movapd %xmm2,%xmm3
andpd  %xmm0,%xmm3
andnpd %xmm1,%xmm2
orpd   %xmm3,%xmm2
addsd  0x8(%rsi,%rax,8),%xmm2
movsd  %xmm2,0x8(%rcx,%rax,8)
add    $0x2,%rax
cmp    %rax,%r8
jne    1360 <dualityGap+0x260>
jmp    148d <dualityGap+0x38d>
lea    (%rcx,%r8,8),%rax
lea    (%rdx,%r8,8),%rbp
cmp    %rcx,%rbp
seta   %r15b
lea    (%rsi,%r8,8),%rbp
cmp    %rdx,%rax
seta   %r14b
cmp    %rcx,%rbp
seta   %bl
cmp    %rsi,%rax
seta   %r11b
xor    %eax,%eax
test   %r14b,%r15b
jne    12fe <dualityGap+0x1fe>
and    %r11b,%bl
jne    12fe <dualityGap+0x1fe>
mov    %r8d,%eax
and    $0xfffffffc,%eax
movapd %xmm0,%xmm1
unpcklpd %xmm0,%xmm1
movapd 0xbf6(%rip),%xmm2
xorpd  %xmm1,%xmm2
lea    0x0(,%r8,8),%r11
and    $0xffffffffffffffe0,%r11
xor    %ebx,%ebx
nopl   0x0(%rax)
movupd (%rdx,%rbx,1),%xmm3
movupd 0x10(%rdx,%rbx,1),%xmm4
xorpd  %xmm5,%xmm5
cmpltpd %xmm3,%xmm5
xorpd  %xmm3,%xmm3
cmpltpd %xmm4,%xmm3
movupd (%rsi,%rbx,1),%xmm4
movupd 0x10(%rsi,%rbx,1),%xmm6
movapd %xmm1,%xmm7
andpd  %xmm5,%xmm7
andnpd %xmm2,%xmm5
orpd   %xmm7,%xmm5
addpd  %xmm4,%xmm5
movapd %xmm1,%xmm4
andpd  %xmm3,%xmm4
andnpd %xmm2,%xmm3
orpd   %xmm4,%xmm3
addpd  %xmm6,%xmm3
movupd %xmm5,(%rcx,%rbx,1)
movupd %xmm3,0x10(%rcx,%rbx,1)
add    $0x20,%rbx
cmp    %rbx,%r11
jne    1420 <dualityGap+0x320>
cmp    %r8,%rax
jne    12fe <dualityGap+0x1fe>
imul   $0x66666667,%r10,%rax
mov    %rax,%rsi
shr    $0x3f,%rsi
sar    $0x21,%rax
add    %esi,%eax
lea    (%rax,%rax,4),%esi
mov    %r9d,%eax
sub    %esi,%eax
test   %eax,%eax
jle    1527 <dualityGap+0x427>
movsd  (%rcx),%xmm1
mulsd  (%rdx),%xmm1
xorpd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
cmp    $0x1,%eax
je     152b <dualityGap+0x42b>
movsd  0x8(%rcx),%xmm1
mulsd  0x8(%rdx),%xmm1
addsd  %xmm1,%xmm0
cmp    $0x2,%eax
je     152b <dualityGap+0x42b>
movsd  0x10(%rcx),%xmm1
mulsd  0x10(%rdx),%xmm1
addsd  %xmm1,%xmm0
cmp    $0x3,%eax
je     152b <dualityGap+0x42b>
movsd  0x18(%rcx),%xmm1
mulsd  0x18(%rdx),%xmm1
addsd  %xmm1,%xmm0
cmp    $0x4,%eax
je     152b <dualityGap+0x42b>
movsd  0x20(%rcx),%xmm1
movsd  0x28(%rcx),%xmm2
mulsd  0x20(%rdx),%xmm1
addsd  %xmm0,%xmm1
mulsd  0x28(%rdx),%xmm2
addsd  %xmm1,%xmm2
movsd  0x30(%rcx),%xmm0
mulsd  0x30(%rdx),%xmm0
addsd  %xmm2,%xmm0
jmp    152b <dualityGap+0x42b>
xorpd  %xmm0,%xmm0
cmp    %r9d,%eax
jge    1597 <dualityGap+0x497>
cltq
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsd  (%rcx,%rax,8),%xmm1
movsd  0x8(%rcx,%rax,8),%xmm2
mulsd  (%rdx,%rax,8),%xmm1
mulsd  0x8(%rdx,%rax,8),%xmm2
addsd  %xmm0,%xmm1
movsd  0x10(%rcx,%rax,8),%xmm3
mulsd  0x10(%rdx,%rax,8),%xmm3
addsd  %xmm1,%xmm2
movsd  0x18(%rcx,%rax,8),%xmm1
mulsd  0x18(%rdx,%rax,8),%xmm1
addsd  %xmm2,%xmm3
movsd  0x20(%rcx,%rax,8),%xmm0
mulsd  0x20(%rdx,%rax,8),%xmm0
addsd  %xmm3,%xmm1
addsd  %xmm1,%xmm0
add    $0x5,%rax
cmp    %r10,%rax
jl     1540 <dualityGap+0x440>
movsd  %xmm0,(%rdi)
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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