#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(int *, int, int, int);
void quick_Sort(int *Array, int first, int last, int pivot) {
  int p;
  if (last - first < 1)
    return;
  p = partition(Array, first, last, pivot);
  quick_Sort(Array, first, p - 1, first);
  quick_Sort(Array, p + 1, last, p + 1);
}


x86 assembly (clang, -O0):
<quick_Sort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    -0x10(%rbp),%eax
sub    -0xc(%rbp),%eax
cmp    $0x1,%eax
jge    1149 <quick_Sort+0x29>
jmp    118b <quick_Sort+0x6b>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x14(%rbp),%ecx
call   1040 <partition@plt>
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%edx
sub    $0x1,%edx
mov    -0xc(%rbp),%ecx
call   1030 <quick_Sort@plt>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%esi
add    $0x1,%esi
mov    -0x10(%rbp),%edx
mov    -0x18(%rbp),%ecx
add    $0x1,%ecx
call   1030 <quick_Sort@plt>
add    $0x20,%rsp
pop    %rbp
ret

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

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

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