#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*/ QuickSort(int *, int, int);
int /*<<< orphan*/ printf(char *, int);
int main() {
  int i;
  int arr[] = {3, 6, 13, 7, 78, 9, 1, 0, 3, 67, 2, 8, 3, 11};
  int p = 0;
  int r = (sizeof arr / sizeof arr[0]) - 1;
  QuickSort(arr, p, r);
  for (i = p; i <= r; ++i)
    (i == p)   ? printf("%d", arr[i])
    : (i == r) ? printf(", %d\n", arr[i])
               : printf(", %d", arr[i]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x40(%rbp),%rdi
lea    0xeb6(%rip),%rsi
mov    $0x38,%edx
call   1040 <memcpy@plt>
movl   $0x0,-0x44(%rbp)
movl   $0xd,-0x48(%rbp)
lea    -0x40(%rbp),%rdi
mov    -0x44(%rbp),%esi
mov    -0x48(%rbp),%edx
call   1050 <QuickSort@plt>
mov    -0x44(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x48(%rbp),%eax
jg     11f8 <main+0xc8>
mov    -0x8(%rbp),%eax
cmp    -0x44(%rbp),%eax
jne    11a8 <main+0x78>
movslq -0x8(%rbp),%rax
mov    -0x40(%rbp,%rax,4),%esi
lea    0xea2(%rip),%rdi
call   1030 <printf@plt>
jmp    11ea <main+0xba>
mov    -0x8(%rbp),%eax
cmp    -0x48(%rbp),%eax
jne    11d0 <main+0xa0>
movslq -0x8(%rbp),%rax
mov    -0x40(%rbp,%rax,4),%esi
lea    0xe75(%rip),%rdi
call   1030 <printf@plt>
mov    %eax,-0x4c(%rbp)
jmp    11e7 <main+0xb7>
movslq -0x8(%rbp),%rax
mov    -0x40(%rbp,%rax,4),%esi
lea    0xe5f(%rip),%rdi
call   1030 <printf@plt>
mov    %eax,-0x4c(%rbp)
mov    -0x4c(%rbp),%eax
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1177 <main+0x47>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    0xefe(%rip),%rax
mov    %rax,0x30(%rsp)
movaps 0xee2(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xec6(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xeaa(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
xor    %ebx,%ebx
xor    %esi,%esi
mov    $0xd,%edx
call   1040 <QuickSort@plt>
lea    0xec6(%rip),%r14
lea    0xec7(%rip),%r15
lea    0xebe(%rip),%r12
jmp    11a5 <main+0x85>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    (%rsp,%rbx,4),%esi
mov    %r12,%rdi
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    $0xe,%rbx
je     11c9 <main+0xa9>
cmp    $0xd,%ebx
je     11c0 <main+0xa0>
test   %ebx,%ebx
jne    1190 <main+0x70>
mov    (%rsp),%esi
mov    %r15,%rdi
jmp    1196 <main+0x76>
cs nopw 0x0(%rax,%rax,1)
mov    0x34(%rsp),%esi
mov    %r14,%rdi
jmp    1196 <main+0x76>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.main.arr = [14 x i32] [i32 3, i32 6, i32 13, i32 7, i32 78, i32 9, i32 1, i32 0, i32 3, i32 67, i32 2, i32 8, i32 3, i32 11]
@.str = [3 x i8] c"%d\00"
@.str.1 = [6 x i8] c", %d\0A\00"
@.str.2 = [5 x i8] c", %d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [14 x i32]
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = bitcast [14 x i32]* %3 to i8*
store i32 0, i32* %4
store i32 13, i32* %5
%7 = getelementptr inbounds [14 x i32], [14 x i32]* %3, i64 0, i64 0
%8 = load i32, i32* %4
%9 = load i32, i32* %5
%10 = call i32 @QuickSort(i32* %7, i32 %8, i32 %9)
%11 = load i32, i32* %4
store i32 %11, i32* %2
br label %12
12: ; preds = %46, %0
%13 = load i32, i32* %2
%14 = load i32, i32* %5
%15 = icmp sle i32 %13, %14
br i1 %15, label %16, label %49
16: ; preds = %12
%17 = load i32, i32* %2
%18 = load i32, i32* %4
%19 = icmp eq i32 %17, %18
br i1 %19, label %20, label %26
20: ; preds = %16
%21 = load i32, i32* %2
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [14 x i32], [14 x i32]* %3, i64 0, i64 %22
%24 = load i32, i32* %23
%25 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %24)
br label %44
26: ; preds = %16
%27 = load i32, i32* %2
%28 = load i32, i32* %5
%29 = icmp eq i32 %27, %28
br i1 %29, label %30, label %36
30: ; preds = %26
%31 = load i32, i32* %2
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds [14 x i32], [14 x i32]* %3, i64 0, i64 %32
%34 = load i32, i32* %33
%35 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %34)
br label %42
36: ; preds = %26
%37 = load i32, i32* %2
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds [14 x i32], [14 x i32]* %3, i64 0, i64 %38
%40 = load i32, i32* %39
%41 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %40)
br label %42
42: ; preds = %36, %30
%43 = phi i32 [ %35, %30 ], [ %41, %36 ]
br label %44
44: ; preds = %42, %20
%45 = phi i32 [ %25, %20 ], [ %43, %42 ]
br label %46
46: ; preds = %44
%47 = load i32, i32* %2
%48 = add nsw i32 %47, 1
store i32 %48, i32* %2
br label %12
49: ; preds = %12
ret i32 0
}

LLVM IR (-O2):
@__const.main.arr = [14 x i32] [i32 3, i32 6, i32 13, i32 7, i32 78, i32 9, i32 1, i32 0, i32 3, i32 67, i32 2, i32 8, i32 3, i32 11]
@.str = [3 x i8] c"%d\00"
@.str.1 = [6 x i8] c", %d\0A\00"
@.str.2 = [5 x i8] c", %d\00"
define i32 @main() {
%1 = alloca [14 x i32]
%2 = bitcast [14 x i32]* %1 to i8*
%3 = getelementptr inbounds [14 x i32], [14 x i32]* %1, i64 0, i64 0
%4 = call i32 @QuickSort(i32* %3, i32 0, i32 13)
%5 = getelementptr inbounds [14 x i32], [14 x i32]* %1, i64 0, i64 13
br label %6
6: ; preds = %0, %19
%7 = phi i64 [ 0, %0 ], [ %20, %19 ]
%8 = trunc i64 %7 to i32
switch i32 %8, label %15 [
i32 0, label %9
i32 13, label %12
]
9: ; preds = %6
%10 = load i32, i32* %3
%11 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %10)
br label %19
12: ; preds = %6
%13 = load i32, i32* %5
%14 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %13)
br label %19
15: ; preds = %6
%16 = getelementptr inbounds [14 x i32], [14 x i32]* %1, i64 0, i64 %7
%17 = load i32, i32* %16
%18 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %17)
br label %19
19: ; preds = %9, %15, %12
%20 = add nuw nsw i64 %7, 1
%21 = icmp eq i64 %20, 14
br i1 %21, label %22, label %6
22: ; preds = %19
ret i32 0
}