#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 */
typedef int /*<<< orphan*/ unsorted;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, char);
int /*<<< orphan*/ quicksort(int *, int);
int main() {
  int unsorted[] = {72, 6, 57, 88, 60, 42, 83, 73, 48, 85};
  int n = sizeof(unsorted) / sizeof(unsorted[0]);
  for (int i = 0; i < n; i++) {
    printf("%d%c", unsorted[i], i < n - 1 ? ' ' : '\n');
  }
  quicksort(unsorted, n);
  for (int i = 0; i < n; i++) {
    printf("%d%c", unsorted[i], i < n - 1 ? ' ' : '\n');
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
lea    0xeb6(%rip),%rsi
mov    $0x28,%edx
call   1050 <memcpy@plt>
movl   $0xa,-0x34(%rbp)
movl   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%eax
cmp    -0x34(%rbp),%eax
jge    11ab <main+0x7b>
movslq -0x38(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%esi
mov    -0x38(%rbp),%edx
mov    -0x34(%rbp),%edi
sub    $0x1,%edi
mov    $0xa,%eax
mov    $0x20,%ecx
cmp    %edi,%edx
cmovl  %ecx,%eax
lea    0xe93(%rip),%rdi
movsbl %al,%edx
call   1040 <printf@plt>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    1162 <main+0x32>
lea    -0x30(%rbp),%rdi
mov    -0x34(%rbp),%esi
call   1030 <quicksort@plt>
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
cmp    -0x34(%rbp),%eax
jge    1207 <main+0xd7>
movslq -0x3c(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%esi
mov    -0x3c(%rbp),%edx
mov    -0x34(%rbp),%edi
sub    $0x1,%edi
mov    $0xa,%eax
mov    $0x20,%ecx
cmp    %edi,%edx
cmovl  %ecx,%eax
lea    0xe37(%rip),%rdi
movsbl %al,%edx
call   1040 <printf@plt>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    11be <main+0x8e>
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x30,%rsp
mov    0xef4(%rip),%rax
mov    %rax,0x20(%rsp)
movaps 0xed8(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xebc(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0xed9(%rip),%rbx
mov    %rbx,%rdi
mov    $0x48,%esi
mov    $0x20,%edx
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x6,%esi
mov    $0x20,%edx
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x39,%esi
mov    $0x20,%edx
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x58,%esi
mov    $0x20,%edx
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x3c,%esi
mov    $0x20,%edx
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x2a,%esi
mov    $0x20,%edx
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x53,%esi
mov    $0x20,%edx
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x49,%esi
mov    $0x20,%edx
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x30,%esi
mov    $0x20,%edx
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x55,%esi
mov    $0xa,%edx
call   1040 <printf@plt>
mov    %rsp,%rdi
mov    $0xa,%esi
call   1030 <quicksort@plt>
mov    (%rsp),%esi
mov    %rbx,%rdi
mov    $0x20,%edx
call   1040 <printf@plt>
mov    0x4(%rsp),%esi
mov    %rbx,%rdi
mov    $0x20,%edx
call   1040 <printf@plt>
mov    0x8(%rsp),%esi
mov    %rbx,%rdi
mov    $0x20,%edx
call   1040 <printf@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
mov    $0x20,%edx
call   1040 <printf@plt>
mov    0x10(%rsp),%esi
mov    %rbx,%rdi
mov    $0x20,%edx
call   1040 <printf@plt>
mov    0x14(%rsp),%esi
mov    %rbx,%rdi
mov    $0x20,%edx
call   1040 <printf@plt>
mov    0x18(%rsp),%esi
mov    %rbx,%rdi
mov    $0x20,%edx
call   1040 <printf@plt>
mov    0x1c(%rsp),%esi
mov    %rbx,%rdi
mov    $0x20,%edx
call   1040 <printf@plt>
mov    0x20(%rsp),%esi
mov    %rbx,%rdi
mov    $0x20,%edx
call   1040 <printf@plt>
mov    0x24(%rsp),%esi
mov    %rbx,%rdi
mov    $0xa,%edx
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.unsorted = [10 x i32] [i32 72, i32 6, i32 57, i32 88, i32 60, i32 42, i32 83, i32 73, i32 48, i32 85]
@.str = [5 x i8] c"%d%c\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x i32]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = bitcast [10 x i32]* %2 to i8*
store i32 10, i32* %3
store i32 0, i32* %4
br label %7
7: ; preds = %24, %0
%8 = load i32, i32* %4
%9 = load i32, i32* %3
%10 = icmp slt i32 %8, %9
br i1 %10, label %11, label %27
11: ; preds = %7
%12 = load i32, i32* %4
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %13
%15 = load i32, i32* %14
%16 = load i32, i32* %4
%17 = load i32, i32* %3
%18 = sub nsw i32 %17, 1
%19 = icmp slt i32 %16, %18
%20 = zext i1 %19 to i64
%21 = select i1 %19, i32 32, i32 10
%22 = trunc i32 %21 to i8
%23 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %15, i8 signext %22)
br label %24
24: ; preds = %11
%25 = load i32, i32* %4
%26 = add nsw i32 %25, 1
store i32 %26, i32* %4
br label %7
27: ; preds = %7
%28 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%29 = load i32, i32* %3
%30 = call i32 @quicksort(i32* %28, i32 %29)
store i32 0, i32* %5
br label %31
31: ; preds = %48, %27
%32 = load i32, i32* %5
%33 = load i32, i32* %3
%34 = icmp slt i32 %32, %33
br i1 %34, label %35, label %51
35: ; preds = %31
%36 = load i32, i32* %5
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %37
%39 = load i32, i32* %38
%40 = load i32, i32* %5
%41 = load i32, i32* %3
%42 = sub nsw i32 %41, 1
%43 = icmp slt i32 %40, %42
%44 = zext i1 %43 to i64
%45 = select i1 %43, i32 32, i32 10
%46 = trunc i32 %45 to i8
%47 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %39, i8 signext %46)
br label %48
48: ; preds = %35
%49 = load i32, i32* %5
%50 = add nsw i32 %49, 1
store i32 %50, i32* %5
br label %31
51: ; preds = %31
%52 = load i32, i32* %1
ret i32 %52
}

LLVM IR (-O2):
@__const.main.unsorted = [10 x i32] [i32 72, i32 6, i32 57, i32 88, i32 60, i32 42, i32 83, i32 73, i32 48, i32 85]
@.str = [5 x i8] c"%d%c\00"
define i32 @main() {
%1 = alloca [10 x i32]
%2 = bitcast [10 x i32]* %1 to i8*
%3 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%4 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 72, i8 signext 32)
%5 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 1
%6 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 6, i8 signext 32)
%7 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 2
%8 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 57, i8 signext 32)
%9 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 3
%10 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 88, i8 signext 32)
%11 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 4
%12 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 60, i8 signext 32)
%13 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 5
%14 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 42, i8 signext 32)
%15 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 6
%16 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 83, i8 signext 32)
%17 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 7
%18 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 73, i8 signext 32)
%19 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 8
%20 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 48, i8 signext 32)
%21 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 9
%22 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 85, i8 signext 10)
%23 = call i32 @quicksort(i32* %3, i32 10)
%24 = load i32, i32* %3
%25 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %24, i8 signext 32)
%26 = load i32, i32* %5
%27 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %26, i8 signext 32)
%28 = load i32, i32* %7
%29 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %28, i8 signext 32)
%30 = load i32, i32* %9
%31 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %30, i8 signext 32)
%32 = load i32, i32* %11
%33 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %32, i8 signext 32)
%34 = load i32, i32* %13
%35 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %34, i8 signext 32)
%36 = load i32, i32* %15
%37 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %36, i8 signext 32)
%38 = load i32, i32* %17
%39 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %38, i8 signext 32)
%40 = load i32, i32* %19
%41 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %40, i8 signext 32)
%42 = load i32, i32* %21
%43 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %42, i8 signext 10)
ret i32 0
}