void pc_partition(double *a, double *b, double *c, double *d, int *indarr,
                  int ibeg, int iend, double val, int *midind) {
  double ta, tb, tc, td;
  int lower, upper, tind;
  if (ibeg < iend) {
    ta = a[ibeg - 1];
    tb = b[ibeg - 1];
    tc = c[ibeg - 1];
    td = d[ibeg - 1];
    tind = indarr[ibeg - 1];
    a[ibeg - 1] = val;
    upper = ibeg;
    lower = iend;
    while (upper != lower) {
      while ((upper < lower) && (val < a[lower - 1])) {
        lower--;
      }
      if (upper != lower) {
        a[upper - 1] = a[lower - 1];
        b[upper - 1] = b[lower - 1];
        c[upper - 1] = c[lower - 1];
        d[upper - 1] = d[lower - 1];
        indarr[upper - 1] = indarr[lower - 1];
      }
      while ((upper < lower) && (val >= a[upper - 1])) {
        upper++;
      }
      if (upper != lower) {
        a[lower - 1] = a[upper - 1];
        b[lower - 1] = b[upper - 1];
        c[lower - 1] = c[upper - 1];
        d[lower - 1] = d[upper - 1];
        indarr[lower - 1] = indarr[upper - 1];
      }
    }
    *midind = upper;
    if (ta > val)
      *midind = upper - 1;
    a[upper - 1] = ta;
    b[upper - 1] = tb;
    c[upper - 1] = tc;
    d[upper - 1] = td;
    indarr[upper - 1] = tind;
  } else if (ibeg == iend) {
    if (a[ibeg - 1] < val)
      *midind = ibeg;
    else
      *midind = ibeg - 1;
  } else {
    *midind = ibeg - 1;
  }
  return;
}


x86 assembly (clang, -O0):
<pc_partition>:
push   %rbp
mov    %rsp,%rbp
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%eax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9d,-0x2c(%rbp)
movsd  %xmm0,-0x38(%rbp)
mov    -0x2c(%rbp),%eax
cmp    0x10(%rbp),%eax
jge    148e <pc_partition+0x38e>
mov    -0x8(%rbp),%rax
mov    -0x2c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x2c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x2c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x2c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x58(%rbp)
mov    -0x28(%rbp),%rax
mov    -0x2c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x64(%rbp)
movsd  -0x38(%rbp),%xmm0
mov    -0x8(%rbp),%rax
mov    -0x2c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x2c(%rbp),%eax
mov    %eax,-0x60(%rbp)
mov    0x10(%rbp),%eax
mov    %eax,-0x5c(%rbp)
mov    -0x60(%rbp),%eax
cmp    -0x5c(%rbp),%eax
je     13f5 <pc_partition+0x2f5>
jmp    11d7 <pc_partition+0xd7>
mov    -0x60(%rbp),%ecx
xor    %eax,%eax
cmp    -0x5c(%rbp),%ecx
mov    %al,-0x65(%rbp)
jge    1209 <pc_partition+0x109>
movsd  -0x38(%rbp),%xmm1
mov    -0x8(%rbp),%rax
mov    -0x5c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
ucomisd %xmm1,%xmm0
seta   %al
mov    %al,-0x65(%rbp)
mov    -0x65(%rbp),%al
test   $0x1,%al
jne    1219 <pc_partition+0x119>
jmp    1227 <pc_partition+0x127>
mov    -0x5c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x5c(%rbp)
jmp    11d7 <pc_partition+0xd7>
mov    -0x60(%rbp),%eax
cmp    -0x5c(%rbp),%eax
je     12e3 <pc_partition+0x1e3>
mov    -0x8(%rbp),%rax
mov    -0x5c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x8(%rbp),%rax
mov    -0x60(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x10(%rbp),%rax
mov    -0x5c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x60(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x18(%rbp),%rax
mov    -0x5c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
mov    -0x60(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x20(%rbp),%rax
mov    -0x5c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
mov    -0x60(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x28(%rbp),%rax
mov    -0x5c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%edx
mov    -0x28(%rbp),%rax
mov    -0x60(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
jmp    12e8 <pc_partition+0x1e8>
mov    -0x60(%rbp),%ecx
xor    %eax,%eax
cmp    -0x5c(%rbp),%ecx
mov    %al,-0x66(%rbp)
jge    1316 <pc_partition+0x216>
movsd  -0x38(%rbp),%xmm0
mov    -0x8(%rbp),%rax
mov    -0x60(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
ucomisd (%rax,%rcx,8),%xmm0
setae  %al
mov    %al,-0x66(%rbp)
mov    -0x66(%rbp),%al
test   $0x1,%al
jne    1326 <pc_partition+0x226>
jmp    1334 <pc_partition+0x234>
mov    -0x60(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x60(%rbp)
jmp    12e8 <pc_partition+0x1e8>
mov    -0x60(%rbp),%eax
cmp    -0x5c(%rbp),%eax
je     13f0 <pc_partition+0x2f0>
mov    -0x8(%rbp),%rax
mov    -0x60(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x8(%rbp),%rax
mov    -0x5c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x10(%rbp),%rax
mov    -0x60(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x5c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x18(%rbp),%rax
mov    -0x60(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
mov    -0x5c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x20(%rbp),%rax
mov    -0x60(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
mov    -0x5c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x28(%rbp),%rax
mov    -0x60(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%edx
mov    -0x28(%rbp),%rax
mov    -0x5c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
jmp    11c6 <pc_partition+0xc6>
mov    -0x60(%rbp),%ecx
mov    0x18(%rbp),%rax
mov    %ecx,(%rax)
movsd  -0x40(%rbp),%xmm0
ucomisd -0x38(%rbp),%xmm0
jbe    141a <pc_partition+0x31a>
mov    -0x60(%rbp),%ecx
sub    $0x1,%ecx
mov    0x18(%rbp),%rax
mov    %ecx,(%rax)
movsd  -0x40(%rbp),%xmm0
mov    -0x8(%rbp),%rax
mov    -0x60(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x48(%rbp),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x60(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x50(%rbp),%xmm0
mov    -0x18(%rbp),%rax
mov    -0x60(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x58(%rbp),%xmm0
mov    -0x20(%rbp),%rax
mov    -0x60(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x64(%rbp),%edx
mov    -0x28(%rbp),%rax
mov    -0x60(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
jmp    14eb <pc_partition+0x3eb>
mov    -0x2c(%rbp),%eax
cmp    0x10(%rbp),%eax
jne    14da <pc_partition+0x3da>
mov    -0x8(%rbp),%rax
mov    -0x2c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
movsd  -0x38(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    14c9 <pc_partition+0x3c9>
mov    -0x2c(%rbp),%ecx
mov    0x18(%rbp),%rax
mov    %ecx,(%rax)
jmp    14d5 <pc_partition+0x3d5>
mov    -0x2c(%rbp),%ecx
sub    $0x1,%ecx
mov    0x18(%rbp),%rax
mov    %ecx,(%rax)
jmp    14e6 <pc_partition+0x3e6>
mov    -0x2c(%rbp),%ecx
sub    $0x1,%ecx
mov    0x18(%rbp),%rax
mov    %ecx,(%rax)
jmp    14eb <pc_partition+0x3eb>
pop    %rbp
ret

x86 assembly (clang, -O2):
<pc_partition>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    0x40(%rsp),%r10
mov    0x38(%rsp),%eax
cmp    %eax,%r9d
jge    124e <pc_partition+0x14e>
movslq %r9d,%rbx
movsd  -0x8(%rdi,%rbx,8),%xmm1
movsd  -0x8(%rsi,%rbx,8),%xmm2
movsd  -0x8(%rdx,%rbx,8),%xmm3
movsd  -0x8(%rcx,%rbx,8),%xmm4
mov    -0x4(%r8,%rbx,4),%r11d
movsd  %xmm0,-0x8(%rdi,%rbx,8)
lea    -0x8(%rdi),%r14
movslq %eax,%rbx
movslq %r9d,%r12
cmp    %r12d,%ebx
mov    %r9d,%ebp
cmovl  %ebx,%ebp
lea    0x1(%rbx),%eax
nopl   0x0(%rax,%rax,1)
cmp    %r12,%rbx
jle    1180 <pc_partition+0x80>
movsd  -0x8(%rdi,%rbx,8),%xmm5
add    $0xffffffffffffffff,%rbx
add    $0xffffffff,%eax
ucomisd %xmm0,%xmm5
ja     1160 <pc_partition+0x60>
jmp    1182 <pc_partition+0x82>
nopw   0x0(%rax,%rax,1)
mov    %ebp,%eax
movslq %eax,%r15
cmp    %eax,%r9d
je     11cc <pc_partition+0xcc>
movsd  -0x8(%rdi,%r15,8),%xmm5
movsd  %xmm5,-0x8(%rdi,%r12,8)
movsd  -0x8(%rsi,%r15,8),%xmm5
movsd  %xmm5,-0x8(%rsi,%r12,8)
movsd  -0x8(%rdx,%r15,8),%xmm5
movsd  %xmm5,-0x8(%rdx,%r12,8)
movsd  -0x8(%rcx,%r15,8),%xmm5
movsd  %xmm5,-0x8(%rcx,%r12,8)
mov    -0x4(%r8,%r15,4),%ebx
mov    %ebx,-0x4(%r8,%r12,4)
cmp    %eax,%r9d
jge    1203 <pc_partition+0x103>
lea    (%r14,%r12,8),%r13
mov    %r15,%rbx
sub    %r12,%rbx
xor    %ebp,%ebp
nopl   (%rax)
ucomisd 0x0(%r13,%rbp,8),%xmm0
jb     1200 <pc_partition+0x100>
add    $0x1,%rbp
cmp    %rbp,%rbx
jne    11e0 <pc_partition+0xe0>
jmp    1266 <pc_partition+0x166>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    %ebp,%r9d
cmp    %eax,%r9d
je     1266 <pc_partition+0x166>
movslq %r9d,%rbx
movsd  -0x8(%rdi,%rbx,8),%xmm5
movsd  %xmm5,-0x8(%rdi,%r15,8)
movsd  -0x8(%rsi,%rbx,8),%xmm5
movsd  %xmm5,-0x8(%rsi,%r15,8)
movsd  -0x8(%rdx,%rbx,8),%xmm5
movsd  %xmm5,-0x8(%rdx,%r15,8)
movsd  -0x8(%rcx,%rbx,8),%xmm5
movsd  %xmm5,-0x8(%rcx,%r15,8)
mov    -0x4(%r8,%rbx,4),%ebx
mov    %ebx,-0x4(%r8,%r15,4)
jmp    1146 <pc_partition+0x46>
lea    -0x1(%r9),%ecx
cmp    %eax,%r9d
jne    1296 <pc_partition+0x196>
movslq %ecx,%rax
ucomisd (%rdi,%rax,8),%xmm0
jbe    1296 <pc_partition+0x196>
mov    %r9d,(%r10)
jmp    1299 <pc_partition+0x199>
ucomisd %xmm0,%xmm1
lea    -0x1(%rax),%ebp
cmovbe %eax,%ebp
mov    %ebp,(%r10)
movsd  %xmm1,-0x8(%rdi,%r15,8)
movsd  %xmm2,-0x8(%rsi,%r15,8)
movsd  %xmm3,-0x8(%rdx,%r15,8)
movsd  %xmm4,-0x8(%rcx,%r15,8)
mov    %r11d,-0x4(%r8,%r15,4)
jmp    1299 <pc_partition+0x199>
mov    %ecx,(%r10)
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @pc_partition(double* nocapture %0, double* nocapture %1, double* nocapture %2, double* nocapture %3, i32* nocapture %4, i32 %5, i32 %6, double %7, i32* nocapture writeonly %8) {
%10 = icmp slt i32 %5, %6
br i1 %10, label %11, label %111
11: ; preds = %9
%12 = add nsw i32 %5, -1
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds double, double* %0, i64 %13
%15 = load double, double* %14
%16 = getelementptr inbounds double, double* %1, i64 %13
%17 = load double, double* %16
%18 = getelementptr inbounds double, double* %2, i64 %13
%19 = load double, double* %18
%20 = getelementptr inbounds double, double* %3, i64 %13
%21 = load double, double* %20
%22 = getelementptr inbounds i32, i32* %4, i64 %13
%23 = load i32, i32* %22
store double %7, double* %14
br label %24
24: ; preds = %81, %11
%25 = phi i32 [ %6, %11 ], [ %41, %81 ]
%26 = phi i32 [ %5, %11 ], [ %79, %81 ]
%27 = sext i32 %25 to i64
%28 = sext i32 %26 to i64
%29 = call i32 @llvm.smin.i32(i32 %25, i32 %26)
br label %30
30: ; preds = %24, %33
%31 = phi i64 [ %27, %24 ], [ %34, %33 ]
%32 = icmp sgt i64 %31, %28
br i1 %32, label %33, label %40
33: ; preds = %30
%34 = add nsw i64 %31, -1
%35 = getelementptr inbounds double, double* %0, i64 %34
%36 = load double, double* %35
%37 = fcmp ogt double %36, %7
br i1 %37, label %30, label %38
38: ; preds = %33
%39 = trunc i64 %31 to i32
br label %40
40: ; preds = %30, %38
%41 = phi i32 [ %39, %38 ], [ %29, %30 ]
%42 = icmp eq i32 %26, %41
br i1 %42, label %63, label %43
43: ; preds = %40
%44 = add nsw i32 %41, -1
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds double, double* %0, i64 %45
%47 = load double, double* %46
%48 = add nsw i32 %26, -1
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds double, double* %0, i64 %49
store double %47, double* %50
%51 = getelementptr inbounds double, double* %1, i64 %45
%52 = load double, double* %51
%53 = getelementptr inbounds double, double* %1, i64 %49
store double %52, double* %53
%54 = getelementptr inbounds double, double* %2, i64 %45
%55 = load double, double* %54
%56 = getelementptr inbounds double, double* %2, i64 %49
store double %55, double* %56
%57 = getelementptr inbounds double, double* %3, i64 %45
%58 = load double, double* %57
%59 = getelementptr inbounds double, double* %3, i64 %49
store double %58, double* %59
%60 = getelementptr inbounds i32, i32* %4, i64 %45
%61 = load i32, i32* %60
%62 = getelementptr inbounds i32, i32* %4, i64 %49
store i32 %61, i32* %62
br label %63
63: ; preds = %43, %40
%64 = icmp slt i32 %26, %41
br i1 %64, label %65, label %78
65: ; preds = %63
%66 = sext i32 %41 to i64
br label %67
67: ; preds = %65, %73
%68 = phi i64 [ %28, %65 ], [ %74, %73 ]
%69 = add nsw i64 %68, -1
%70 = getelementptr inbounds double, double* %0, i64 %69
%71 = load double, double* %70
%72 = fcmp ugt double %71, %7
br i1 %72, label %76, label %73
73: ; preds = %67
%74 = add nsw i64 %68, 1
%75 = icmp eq i64 %74, %66
br i1 %75, label %101, label %67
76: ; preds = %67
%77 = trunc i64 %68 to i32
br label %78
78: ; preds = %76, %63
%79 = phi i32 [ %26, %63 ], [ %77, %76 ]
%80 = icmp eq i32 %79, %41
br i1 %80, label %101, label %81
81: ; preds = %78
%82 = add nsw i32 %79, -1
%83 = sext i32 %82 to i64
%84 = getelementptr inbounds double, double* %0, i64 %83
%85 = load double, double* %84
%86 = add nsw i32 %41, -1
%87 = sext i32 %86 to i64
%88 = getelementptr inbounds double, double* %0, i64 %87
store double %85, double* %88
%89 = getelementptr inbounds double, double* %1, i64 %83
%90 = load double, double* %89
%91 = getelementptr inbounds double, double* %1, i64 %87
store double %90, double* %91
%92 = getelementptr inbounds double, double* %2, i64 %83
%93 = load double, double* %92
%94 = getelementptr inbounds double, double* %2, i64 %87
store double %93, double* %94
%95 = getelementptr inbounds double, double* %3, i64 %83
%96 = load double, double* %95
%97 = getelementptr inbounds double, double* %3, i64 %87
store double %96, double* %97
%98 = getelementptr inbounds i32, i32* %4, i64 %83
%99 = load i32, i32* %98
%100 = getelementptr inbounds i32, i32* %4, i64 %87
store i32 %99, i32* %100
br label %24
101: ; preds = %78, %73
%102 = fcmp ogt double %15, %7
%103 = add nsw i32 %41, -1
%104 = select i1 %102, i32 %103, i32 %41
store i32 %104, i32* %8
%105 = sext i32 %103 to i64
%106 = getelementptr inbounds double, double* %0, i64 %105
store double %15, double* %106
%107 = getelementptr inbounds double, double* %1, i64 %105
store double %17, double* %107
%108 = getelementptr inbounds double, double* %2, i64 %105
store double %19, double* %108
%109 = getelementptr inbounds double, double* %3, i64 %105
store double %21, double* %109
%110 = getelementptr inbounds i32, i32* %4, i64 %105
store i32 %23, i32* %110
br label %122
111: ; preds = %9
%112 = icmp eq i32 %5, %6
%113 = add nsw i32 %5, -1
br i1 %112, label %114, label %121
114: ; preds = %111
%115 = sext i32 %113 to i64
%116 = getelementptr inbounds double, double* %0, i64 %115
%117 = load double, double* %116
%118 = fcmp olt double %117, %7
br i1 %118, label %119, label %120
119: ; preds = %114
store i32 %5, i32* %8
br label %122
120: ; preds = %114
store i32 %113, i32* %8
br label %122
121: ; preds = %111
store i32 %113, i32* %8
br label %122
122: ; preds = %121, %120, %119, %101
ret void
}