#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 */
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ quicksort(int *, int /*<<< orphan*/, int);
int main() {
  int *values = (int *)malloc(6 * sizeof(int));
  values[0] = 1;
  values[1] = 2;
  values[2] = 9;
  values[3] = 0;
  values[4] = 7;
  values[5] = 5;
  int n = 6;
  quicksort(values, 0, n);
  for (int i = 0; i < n; i++)
    printf("%d ", values[i]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x18,%edi
call   1050 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x10(%rbp),%rax
movl   $0x2,0x4(%rax)
mov    -0x10(%rbp),%rax
movl   $0x9,0x8(%rax)
mov    -0x10(%rbp),%rax
movl   $0x0,0xc(%rax)
mov    -0x10(%rbp),%rax
movl   $0x7,0x10(%rax)
mov    -0x10(%rbp),%rax
movl   $0x5,0x14(%rax)
movl   $0x6,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%edx
xor    %esi,%esi
call   1030 <quicksort@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11db <main+0xab>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe38(%rip),%rdi
call   1040 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11aa <main+0x7a>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    $0x18,%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
movaps 0xeb8(%rip),%xmm0
movups %xmm0,(%rax)
movabs $0x500000007,%rax
mov    %rax,0x10(%rbx)
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x6,%edx
call   1030 <quicksort@plt>
mov    (%rbx),%esi
lea    0xe9f(%rip),%r14
mov    %r14,%rdi
call   1040 <printf@plt>
mov    0x4(%rbx),%esi
mov    %r14,%rdi
call   1040 <printf@plt>
mov    0x8(%rbx),%esi
mov    %r14,%rdi
call   1040 <printf@plt>
mov    0xc(%rbx),%esi
mov    %r14,%rdi
call   1040 <printf@plt>
mov    0x10(%rbx),%esi
mov    %r14,%rdi
call   1040 <printf@plt>
mov    0x14(%rbx),%esi
mov    %r14,%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = call i64 @malloc(i32 24)
%6 = inttoptr i64 %5 to i32*
store i32* %6, i32** %2
%7 = load i32*, i32** %2
%8 = getelementptr inbounds i32, i32* %7, i64 0
store i32 1, i32* %8
%9 = load i32*, i32** %2
%10 = getelementptr inbounds i32, i32* %9, i64 1
store i32 2, i32* %10
%11 = load i32*, i32** %2
%12 = getelementptr inbounds i32, i32* %11, i64 2
store i32 9, i32* %12
%13 = load i32*, i32** %2
%14 = getelementptr inbounds i32, i32* %13, i64 3
store i32 0, i32* %14
%15 = load i32*, i32** %2
%16 = getelementptr inbounds i32, i32* %15, i64 4
store i32 7, i32* %16
%17 = load i32*, i32** %2
%18 = getelementptr inbounds i32, i32* %17, i64 5
store i32 5, i32* %18
store i32 6, i32* %3
%19 = load i32*, i32** %2
%20 = load i32, i32* %3
%21 = call i32 @quicksort(i32* %19, i32 0, i32 %20)
store i32 0, i32* %4
br label %22
22: ; preds = %33, %0
%23 = load i32, i32* %4
%24 = load i32, i32* %3
%25 = icmp slt i32 %23, %24
br i1 %25, label %26, label %36
26: ; preds = %22
%27 = load i32*, i32** %2
%28 = load i32, i32* %4
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds i32, i32* %27, i64 %29
%31 = load i32, i32* %30
%32 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %31)
br label %33
33: ; preds = %26
%34 = load i32, i32* %4
%35 = add nsw i32 %34, 1
store i32 %35, i32* %4
br label %22
36: ; preds = %22
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d \00"
define i32 @main() {
%1 = tail call i64 @malloc(i32 24)
%2 = inttoptr i64 %1 to i32*
%3 = getelementptr inbounds i32, i32* %2, i64 1
%4 = getelementptr inbounds i32, i32* %2, i64 2
%5 = getelementptr inbounds i32, i32* %2, i64 3
%6 = inttoptr i64 %1 to <4 x i32>*
store <4 x i32> <i32 1, i32 2, i32 9, i32 0>, <4 x i32>* %6
%7 = getelementptr inbounds i32, i32* %2, i64 4
store i32 7, i32* %7
%8 = getelementptr inbounds i32, i32* %2, i64 5
store i32 5, i32* %8
%9 = tail call i32 @quicksort(i32* %2, i32 0, i32 6)
%10 = load i32, i32* %2
%11 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = load i32, i32* %3
%13 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %12)
%14 = load i32, i32* %4
%15 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %14)
%16 = load i32, i32* %5
%17 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %16)
%18 = load i32, i32* %7
%19 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %18)
%20 = load i32, i32* %8
%21 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %20)
ret i32 0
}