#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 DBL_EPSILON;
int /*<<< orphan*/ heap_build_2(int, double *, double *);
int heap_del_max_2(int, double *, double *);
int /*<<< orphan*/ memcpy(void *, void *, int);
double projectW(double xPtr[], double bPtr[], double dPtr[], double dOrg[],
                double tau, int n, double *xNorm) {
  int i, j;
  double csdb, csd2, b, d, bd, s, alpha = 0, soft = 0;
  if (tau < DBL_EPSILON) {
    for (i = 0; i < n; i++)
      xPtr[i] = 0;
    if (xNorm)
      *xNorm = 0;
    return 0;
  }
  for (csdb = 0, i = 0; i < n; i++) {
    d = dPtr[i];
    b = xPtr[i];
    csdb += (d * b);
    xPtr[i] = b / d;
  }
  if (xNorm)
    *xNorm = csdb;
  if (csdb <= tau) {
    memcpy((void *)xPtr, (void *)bPtr, n * sizeof(double));
    return 0;
  }
  heap_build_2(n, xPtr, dPtr);
  csdb = -tau;
  csd2 = 0;
  for (i = n, j = 0; j < n; soft = alpha) {
    bd = xPtr[0];
    j++;
    d = dPtr[0];
    d *= d;
    csd2 += d;
    csdb += bd * d;
    i = heap_del_max_2(i, xPtr, dPtr);
    alpha = csdb / csd2;
    if (alpha >= bd)
      break;
  }
  for (i = 0; i < n; i++) {
    b = bPtr[i];
    s = (b >= 0) ? 1 : -1;
    b *= s;
    alpha = dOrg[i] * soft;
    if (b <= alpha)
      xPtr[i] = 0;
    else
      xPtr[i] = s * (b - alpha);
  }
  return soft;
}


x86 assembly (clang, -O0):
<projectW>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
movsd  %xmm0,-0x30(%rbp)
mov    %r8d,-0x34(%rbp)
mov    %r9,-0x40(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x80(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x30(%rbp),%xmm1
mov    0x2e71(%rip),%rax
movsd  (%rax),%xmm0
ucomisd %xmm1,%xmm0
jbe    11d9 <projectW+0xa9>
movl   $0x0,-0x44(%rbp)
mov    -0x44(%rbp),%eax
cmp    -0x34(%rbp),%eax
jge    11b6 <projectW+0x86>
mov    -0x10(%rbp),%rax
movslq -0x44(%rbp),%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    118c <projectW+0x5c>
cmpq   $0x0,-0x40(%rbp)
je     11cc <projectW+0x9c>
mov    -0x40(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    147f <projectW+0x34f>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x50(%rbp)
movl   $0x0,-0x44(%rbp)
mov    -0x44(%rbp),%eax
cmp    -0x34(%rbp),%eax
jge    1259 <projectW+0x129>
mov    -0x20(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x68(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x68(%rbp),%xmm0
movsd  -0x60(%rbp),%xmm2
movsd  -0x50(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x60(%rbp),%xmm0
divsd  -0x68(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    11e8 <projectW+0xb8>
cmpq   $0x0,-0x40(%rbp)
je     1271 <projectW+0x141>
movsd  -0x50(%rbp),%xmm0
mov    -0x40(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x50(%rbp),%xmm1
movsd  -0x30(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     12a9 <projectW+0x179>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
movslq -0x34(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edx
call   1050 <memcpy@plt>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    147f <projectW+0x34f>
mov    -0x34(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1030 <heap_build_2@plt>
movsd  -0x30(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x50(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x58(%rbp)
mov    -0x34(%rbp),%eax
mov    %eax,-0x44(%rbp)
movl   $0x0,-0x48(%rbp)
mov    -0x48(%rbp),%eax
cmp    -0x34(%rbp),%eax
jge    13a6 <projectW+0x276>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x70(%rbp)
mov    -0x48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x48(%rbp)
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x68(%rbp),%xmm0
mulsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x68(%rbp),%xmm0
addsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x70(%rbp),%xmm0
movsd  -0x68(%rbp),%xmm2
movsd  -0x50(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x44(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1040 <heap_del_max_2@plt>
mov    %eax,-0x44(%rbp)
movsd  -0x50(%rbp),%xmm0
divsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x80(%rbp),%xmm0
ucomisd -0x70(%rbp),%xmm0
jb     138f <projectW+0x25f>
jmp    13a6 <projectW+0x276>
jmp    1394 <projectW+0x264>
movsd  -0x80(%rbp),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
jmp    12ef <projectW+0x1bf>
movl   $0x0,-0x44(%rbp)
mov    -0x44(%rbp),%eax
cmp    -0x34(%rbp),%eax
jge    1472 <projectW+0x342>
mov    -0x18(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x60(%rbp),%xmm0
xorps  %xmm1,%xmm1
mov    $0xffffffff,%eax
mov    $0x1,%ecx
ucomisd %xmm1,%xmm0
cmovae %ecx,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x78(%rbp),%xmm0
mulsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
mov    -0x28(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mulsd  -0x88(%rbp),%xmm0
ff
movsd  %xmm0,-0x80(%rbp)
movsd  -0x60(%rbp),%xmm1
movsd  -0x80(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     143f <projectW+0x30f>
mov    -0x10(%rbp),%rax
movslq -0x44(%rbp),%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
jmp    145f <projectW+0x32f>
movsd  -0x78(%rbp),%xmm0
movsd  -0x60(%rbp),%xmm1
subsd  -0x80(%rbp),%xmm1
mulsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
jmp    1464 <projectW+0x334>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    13ad <projectW+0x27d>
movsd  -0x88(%rbp),%xmm0
ff
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<projectW>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %r9,%r13
mov    %r8d,%r12d
mov    %rdi,%r15
mov    0x2e8a(%rip),%rax
movsd  (%rax),%xmm1
ucomisd %xmm0,%xmm1
jbe    1198 <projectW+0x58>
test   %r12d,%r12d
jle    117e <projectW+0x3e>
mov    %r12d,%edx
shl    $0x3,%rdx
mov    %r15,%rdi
xor    %esi,%esi
call   1050 <memset@plt>
xorpd  %xmm0,%xmm0
test   %r13,%r13
je     1457 <projectW+0x317>
movq   $0x0,0x0(%r13)
jmp    1457 <projectW+0x317>
mov    %rdx,%rbp
mov    %rsi,%r14
test   %r12d,%r12d
jle    11b4 <projectW+0x74>
mov    %r12d,%esi
cmp    $0x1,%r12d
jne    11bd <projectW+0x7d>
xorpd  %xmm5,%xmm5
xor    %eax,%eax
jmp    121f <projectW+0xdf>
xorpd  %xmm5,%xmm5
jmp    1247 <projectW+0x107>
mov    %esi,%edx
and    $0xfffffffe,%edx
xorpd  %xmm5,%xmm5
xor    %eax,%eax
nopl   0x0(%rax,%rax,1)
movsd  0x0(%rbp,%rax,8),%xmm1
movsd  (%r15,%rax,8),%xmm2
movsd  0x8(%r15,%rax,8),%xmm3
movapd %xmm1,%xmm4
mulsd  %xmm2,%xmm4
addsd  %xmm5,%xmm4
divsd  %xmm1,%xmm2
movsd  %xmm2,(%r15,%rax,8)
movsd  0x8(%rbp,%rax,8),%xmm1
movapd %xmm1,%xmm5
mulsd  %xmm3,%xmm5
addsd  %xmm4,%xmm5
divsd  %xmm1,%xmm3
movsd  %xmm3,0x8(%r15,%rax,8)
add    $0x2,%rax
cmp    %rax,%rdx
jne    11d0 <projectW+0x90>
test   $0x1,%sil
je     1247 <projectW+0x107>
movsd  0x0(%rbp,%rax,8),%xmm1
movsd  (%r15,%rax,8),%xmm2
movapd %xmm1,%xmm3
mulsd  %xmm2,%xmm3
addsd  %xmm3,%xmm5
divsd  %xmm1,%xmm2
movsd  %xmm2,(%r15,%rax,8)
test   %r13,%r13
je     1252 <projectW+0x112>
movsd  %xmm5,0x0(%r13)
ucomisd %xmm5,%xmm0
jae    1441 <projectW+0x301>
movapd %xmm0,(%rsp)
mov    %rcx,%r13
mov    %r12d,%edi
mov    %r15,%rsi
mov    %rbp,%rdx
call   1030 <heap_build_2@plt>
test   %r12d,%r12d
jle    1453 <projectW+0x313>
movapd (%rsp),%xmm1
xorpd  0xd78(%rip),%xmm1
xorpd  %xmm2,%xmm2
mov    %r12d,%ebx
mov    %r12d,%eax
xorpd  %xmm3,%xmm3
cs nopw 0x0(%rax,%rax,1)
movapd %xmm2,0x20(%rsp)
movsd  (%r15),%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  0x0(%rbp),%xmm2
mulsd  %xmm2,%xmm2
addsd  %xmm2,%xmm3
movsd  %xmm3,0x18(%rsp)
mulsd  %xmm0,%xmm2
addsd  %xmm1,%xmm2
movapd %xmm2,(%rsp)
mov    %eax,%edi
mov    %r15,%rsi
mov    %rbp,%rdx
call   1040 <heap_del_max_2@plt>
movsd  0x18(%rsp),%xmm3
movapd (%rsp),%xmm1
movaps 0x20(%rsp),%xmm0
movapd %xmm1,%xmm2
divsd  %xmm3,%xmm2
ucomisd 0x10(%rsp),%xmm2
jae    1307 <projectW+0x1c7>
movapd %xmm2,%xmm0
add    $0xffffffff,%ebx
jne    12a0 <projectW+0x160>
test   %r12d,%r12d
jle    1457 <projectW+0x317>
mov    %r12d,%eax
cmp    $0x1,%r12d
jne    1466 <projectW+0x326>
xor    %ecx,%ecx
mov    %r13,%rbp
mov    %rcx,%rdx
not    %rdx
test   $0x1,%al
je     1379 <projectW+0x239>
movsd  (%r14,%rcx,8),%xmm4
xorpd  %xmm1,%xmm1
xor    %esi,%esi
ucomisd %xmm1,%xmm4
setae  %sil
lea    0xce9(%rip),%rdi
movsd  (%rdi,%rsi,8),%xmm1
mulsd  %xmm1,%xmm4
movsd  0x0(%rbp,%rcx,8),%xmm2
mulsd  %xmm0,%xmm2
movapd %xmm4,%xmm3
subsd  %xmm2,%xmm3
mulsd  %xmm1,%xmm3
cmpnlesd %xmm2,%xmm4
andpd  %xmm3,%xmm4
movlpd %xmm4,(%r15,%rcx,8)
or     $0x1,%rcx
add    %rax,%rdx
je     1457 <projectW+0x317>
movsd  0xcb6(%rip),%xmm6
movsd  0xcb6(%rip),%xmm1
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsd  (%r14,%rcx,8),%xmm2
xorpd  %xmm3,%xmm3
cmplesd %xmm2,%xmm3
movapd %xmm3,%xmm4
andpd  %xmm6,%xmm4
andnpd %xmm1,%xmm3
orpd   %xmm4,%xmm3
mulsd  %xmm3,%xmm2
movsd  0x0(%rbp,%rcx,8),%xmm4
mulsd  %xmm0,%xmm4
movapd %xmm2,%xmm5
subsd  %xmm4,%xmm5
mulsd  %xmm3,%xmm5
cmpnlesd %xmm4,%xmm2
andpd  %xmm5,%xmm2
movlpd %xmm2,(%r15,%rcx,8)
movsd  0x8(%r14,%rcx,8),%xmm2
xorpd  %xmm3,%xmm3
cmplesd %xmm2,%xmm3
movapd %xmm3,%xmm4
andpd  %xmm6,%xmm4
andnpd %xmm1,%xmm3
orpd   %xmm4,%xmm3
mulsd  %xmm3,%xmm2
movsd  0x8(%rbp,%rcx,8),%xmm4
mulsd  %xmm0,%xmm4
movapd %xmm2,%xmm5
subsd  %xmm4,%xmm5
mulsd  %xmm3,%xmm5
cmpnlesd %xmm4,%xmm2
andpd  %xmm5,%xmm2
movlpd %xmm2,0x8(%r15,%rcx,8)
add    $0x2,%rcx
cmp    %rcx,%rax
jne    13a0 <projectW+0x260>
jmp    1457 <projectW+0x317>
shl    $0x3,%r12d
mov    %r15,%rdi
mov    %r14,%rsi
mov    %r12d,%edx
call   1060 <memcpy@plt>
xorpd  %xmm0,%xmm0
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    (%r15,%rax,8),%rcx
lea    (%r14,%rax,8),%rdx
cmp    %r15,%rdx
seta   %dil
mov    %r13,%rbp
lea    0x0(,%rax,8),%rdx
add    %r13,%rdx
cmp    %r14,%rcx
seta   %bl
cmp    %r15,%rdx
seta   %dl
cmp    %r13,%rcx
seta   %sil
xor    %ecx,%ecx
test   %bl,%dil
jne    1322 <projectW+0x1e2>
and    %sil,%dl
jne    1322 <projectW+0x1e2>
mov    %eax,%ecx
and    $0xfffffffe,%ecx
movapd %xmm0,%xmm7
unpcklpd %xmm0,%xmm7
lea    -0x2(%rcx),%rdx
mov    %rdx,%rsi
shr    %rsi
add    $0x1,%rsi
test   %rdx,%rdx
je     1592 <projectW+0x452>
mov    %rsi,%rdi
and    $0xfffffffffffffffe,%rdi
xor    %edx,%edx
movapd 0xb31(%rip),%xmm1
movapd 0xb39(%rip),%xmm2
nopw   0x0(%rax,%rax,1)
movupd (%r14,%rdx,8),%xmm3
xorpd  %xmm4,%xmm4
cmplepd %xmm3,%xmm4
movapd %xmm2,%xmm5
andpd  %xmm4,%xmm5
andnpd %xmm1,%xmm4
orpd   %xmm5,%xmm4
mulpd  %xmm4,%xmm3
movupd 0x0(%rbp,%rdx,8),%xmm5
mulpd  %xmm7,%xmm5
movapd %xmm3,%xmm6
cmpnlepd %xmm5,%xmm6
subpd  %xmm5,%xmm3
mulpd  %xmm4,%xmm3
andpd  %xmm6,%xmm3
movupd %xmm3,(%r15,%rdx,8)
movupd 0x10(%r14,%rdx,8),%xmm3
xorpd  %xmm4,%xmm4
cmplepd %xmm3,%xmm4
movapd %xmm2,%xmm5
andpd  %xmm4,%xmm5
andnpd %xmm1,%xmm4
orpd   %xmm5,%xmm4
mulpd  %xmm4,%xmm3
movupd 0x10(%rbp,%rdx,8),%xmm5
mulpd  %xmm7,%xmm5
movapd %xmm3,%xmm6
cmpnlepd %xmm5,%xmm6
subpd  %xmm5,%xmm3
mulpd  %xmm4,%xmm3
andpd  %xmm6,%xmm3
movupd %xmm3,0x10(%r15,%rdx,8)
add    $0x4,%rdx
add    $0xfffffffffffffffe,%rdi
jne    14f0 <projectW+0x3b0>
jmp    1594 <projectW+0x454>
xor    %edx,%edx
test   $0x1,%sil
je     15ea <projectW+0x4aa>
movupd (%r14,%rdx,8),%xmm1
xorpd  %xmm2,%xmm2
cmplepd %xmm1,%xmm2
movapd %xmm2,%xmm3
andnpd 0xa5b(%rip),%xmm3
andpd  0xa63(%rip),%xmm2
orpd   %xmm3,%xmm2
mulpd  %xmm2,%xmm1
movupd 0x0(%rbp,%rdx,8),%xmm3
mulpd  %xmm3,%xmm7
movapd %xmm1,%xmm3
cmpnlepd %xmm7,%xmm3
subpd  %xmm7,%xmm1
mulpd  %xmm2,%xmm1
andpd  %xmm3,%xmm1
movupd %xmm1,(%r15,%rdx,8)
cmp    %rax,%rcx
jne    1322 <projectW+0x1e2>
jmp    1457 <projectW+0x317>

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

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