#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*/ printf(char *, ...);
int /*<<< orphan*/ quick_sort(int *, int /*<<< orphan*/, int);
int main() {
  int a[100];
  a[0] = 15;
  a[1] = 10;
  a[2] = 8;
  a[3] = 23;
  a[4] = 20;
  a[5] = 16;
  a[6] = 24;
  a[7] = 19;
  a[8] = 10;
  int n = 9;
  quick_sort(a, 0, n - 1);
  printf("\n");
  for (int i = 0; i < n; i++) {
    printf("%d ", a[i]);
  }
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1b0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xf,-0x1a0(%rbp)
movl   $0xa,-0x19c(%rbp)
movl   $0x8,-0x198(%rbp)
movl   $0x17,-0x194(%rbp)
movl   $0x14,-0x190(%rbp)
movl   $0x10,-0x18c(%rbp)
movl   $0x18,-0x188(%rbp)
movl   $0x13,-0x184(%rbp)
movl   $0xa,-0x180(%rbp)
movl   $0x9,-0x1a4(%rbp)
lea    -0x1a0(%rbp),%rdi
mov    -0x1a4(%rbp),%edx
sub    $0x1,%edx
xor    %esi,%esi
call   1040 <quick_sort@plt>
lea    0xe4c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x1a8(%rbp)
mov    -0x1a8(%rbp),%eax
cmp    -0x1a4(%rbp),%eax
jge    1207 <main+0xe7>
movslq -0x1a8(%rbp),%rax
mov    -0x1a0(%rbp,%rax,4),%esi
lea    0xe16(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1a8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1a8(%rbp)
jmp    11c5 <main+0xa5>
lea    0xdf2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x1b0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x190,%rsp
movaps 0xec1(%rip),%xmm0
movaps %xmm0,(%rsp)
movaps 0xec6(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movl   $0xa,0x20(%rsp)
mov    %rsp,%rdi
xor    %esi,%esi
mov    $0x8,%edx
call   1050 <quick_sort@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    (%rsp),%esi
lea    0xea6(%rip),%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x4(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x10(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x14(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x18(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x1c(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x20(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x190,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str.1 = [4 x i8] c"%d \00"
define i32 @main() {
%1 = alloca [100 x i32]
%2 = bitcast [100 x i32]* %1 to i8*
%3 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 0
%4 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 1
%5 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 2
%6 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 3
%7 = bitcast [100 x i32]* %1 to <4 x i32>*
store <4 x i32> <i32 15, i32 10, i32 8, i32 23>, <4 x i32>* %7
%8 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 4
%9 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 5
%10 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 6
%11 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 7
%12 = bitcast i32* %8 to <4 x i32>*
store <4 x i32> <i32 20, i32 16, i32 24, i32 19>, <4 x i32>* %12
%13 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 8
store i32 10, i32* %13
%14 = call i32 @quick_sort(i32* %3, i32 0, i32 8)
%15 = call i32 @putchar(i32 10)
%16 = load i32, i32* %3
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %16)
%18 = load i32, i32* %4
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %18)
%20 = load i32, i32* %5
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %20)
%22 = load i32, i32* %6
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %22)
%24 = load i32, i32* %8
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %24)
%26 = load i32, i32* %9
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %26)
%28 = load i32, i32* %10
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %28)
%30 = load i32, i32* %11
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %30)
%32 = load i32, i32* %13
%33 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %32)
%34 = call i32 @putchar(i32 10)
ret i32 0
}