#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 /*<<< orphan*/ display(int *, int /*<<< orphan*/, int);
int positionHome(int *, int, int);
void qSort(int *ptr, int lo, int hi) {
  int base;
  if (lo < hi) {
    base = positionHome(ptr, lo, hi);
    display(ptr, 0, 11);
    qSort(ptr, lo, base - 1);
    qSort(ptr, base + 1, hi);
  }
}


x86 assembly (clang, -O0):
<qSort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1194 <qSort+0x64>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1050 <positionHome@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
xor    %esi,%esi
mov    $0xb,%edx
call   1040 <display@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x14(%rbp),%edx
sub    $0x1,%edx
call   1030 <qSort@plt>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
add    $0x1,%esi
mov    -0x10(%rbp),%edx
call   1030 <qSort@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<qSort>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
cmp    %edx,%esi
jge    1185 <qSort+0x55>
mov    %edx,%r14d
mov    %esi,%ebp
mov    %rdi,%r15
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r15,%rdi
mov    %ebp,%esi
mov    %r14d,%edx
call   1050 <positionHome@plt>
mov    %eax,%ebx
mov    %r15,%rdi
xor    %esi,%esi
mov    $0xb,%edx
call   1040 <display@plt>
lea    -0x1(%rbx),%edx
mov    %r15,%rdi
mov    %ebp,%esi
call   1030 <qSort@plt>
add    $0x1,%ebx
mov    %ebx,%ebp
cmp    %r14d,%ebx
jl     1150 <qSort+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

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