#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 */
long partition(long *, long *, long, long);
void quickSort(long int *a, long int *b, long int left, long int right) {
  long int q = 0;
  if (left < right) {
    q = partition(a, b, left, right);
    quickSort(a, b, left, q);
    quickSort(a, b, q + 1, right);
  }
}


x86 assembly (clang, -O0):
<quickSort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x20(%rbp),%rax
jge    1195 <quickSort+0x75>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
call   1030 <partition@plt>
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x28(%rbp),%rcx
call   1040 <quickSort@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x28(%rbp),%rdx
add    $0x1,%rdx
mov    -0x20(%rbp),%rcx
call   1040 <quickSort@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<quickSort>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
cmp    %rcx,%rdx
jge    1171 <quickSort+0x51>
mov    %rcx,%r14
mov    %rdx,%r13
mov    %rsi,%r15
mov    %rdi,%r12
nopw   0x0(%rax,%rax,1)
mov    %r12,%rdi
mov    %r15,%rsi
mov    %r13,%rdx
mov    %r14,%rcx
call   1030 <partition@plt>
mov    %rax,%rbx
mov    %r12,%rdi
mov    %r15,%rsi
mov    %r13,%rdx
mov    %rax,%rcx
call   1040 <quickSort@plt>
add    $0x1,%rbx
mov    %rbx,%r13
cmp    %r14,%rbx
jl     1140 <quickSort+0x20>
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

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

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