#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 */
int partition(double *, double *, int, int);
void quickSortHelper(double numerator[], double denominator[], int minIndex,
                     int maxIndex) {
  if (maxIndex < minIndex) {
    return;
  }
  int pivotIndex = partition(numerator, denominator, minIndex, maxIndex);
  quickSortHelper(numerator, denominator, minIndex, pivotIndex - 1);
  quickSortHelper(numerator, denominator, pivotIndex + 1, maxIndex);
}


x86 assembly (clang, -O0):
<quickSortHelper>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1147 <quickSortHelper+0x27>
jmp    1189 <quickSortHelper+0x69>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
call   1030 <partition@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x1c(%rbp),%ecx
sub    $0x1,%ecx
call   1040 <quickSortHelper@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x1c(%rbp),%edx
add    $0x1,%edx
mov    -0x18(%rbp),%ecx
call   1040 <quickSortHelper@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<quickSortHelper>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
cmp    %edx,%ecx
jl     116a <quickSortHelper+0x4a>
mov    %ecx,%r14d
mov    %edx,%ebx
mov    %rsi,%r15
mov    %rdi,%r12
nopw   0x0(%rax,%rax,1)
mov    %r12,%rdi
mov    %r15,%rsi
mov    %ebx,%edx
mov    %r14d,%ecx
call   1030 <partition@plt>
mov    %eax,%ebp
lea    -0x1(%rbp),%ecx
mov    %r12,%rdi
mov    %r15,%rsi
mov    %ebx,%edx
call   1040 <quickSortHelper@plt>
lea    0x1(%rbp),%ebx
cmp    %r14d,%ebp
jl     1140 <quickSortHelper+0x20>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @quickSortHelper(double* %0, double* %1, i32 %2, i32 %3) {
%5 = alloca double*
%6 = alloca double*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store double* %0, double** %5
store double* %1, double** %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%10 = load i32, i32* %8
%11 = load i32, i32* %7
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %14
13: ; preds = %4
br label %30
14: ; preds = %4
%15 = load double*, double** %5
%16 = load double*, double** %6
%17 = load i32, i32* %7
%18 = load i32, i32* %8
%19 = call i32 @partition(double* %15, double* %16, i32 %17, i32 %18)
store i32 %19, i32* %9
%20 = load double*, double** %5
%21 = load double*, double** %6
%22 = load i32, i32* %7
%23 = load i32, i32* %9
%24 = sub nsw i32 %23, 1
%25 = load double*, double** %5
%26 = load double*, double** %6
%27 = load i32, i32* %9
%28 = add nsw i32 %27, 1
%29 = load i32, i32* %8
br label %30
30: ; preds = %14, %13
ret void
}

LLVM IR (-O2):
define void @quickSortHelper(double* %0, double* %1, i32 %2, i32 %3) {
%5 = icmp slt i32 %3, %2
br i1 %5, label %12, label %6
6: ; preds = %4, %6
%7 = phi i32 [ %10, %6 ], [ %2, %4 ]
%8 = tail call i32 @partition(double* %0, double* %1, i32 %7, i32 %3)
%9 = add nsw i32 %8, -1
tail call void @quickSortHelper(double* %0, double* %1, i32 %7, i32 %9)
%10 = add nsw i32 %8, 1
%11 = icmp slt i32 %8, %3
br i1 %11, label %6, label %12
12: ; preds = %6, %4
ret void
}