#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*/ quickSort(int *, int /*<<< orphan*/, int);
int rand();
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main(int argc, char const *argv[]) {
  int vetor[10000];
  int i;
  srand(time(NULL));
  for (i = 0; i < 10000; i++)
    vetor[i] = (rand() % 10000) + 1;
  quickSort(vetor, 0, 10000 - 1);
  printf("\n\n");
  for (i = 0; i < 10000; i++) {
    printf(" %d,", vetor[i]);
  }
  printf("\n\n ");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x9c60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
movl   $0x0,-0x9c54(%rbp)
cmpl   $0x2710,-0x9c54(%rbp)
jge    11c7 <main+0x77>
mov    $0x0,%al
call   1070 <rand@plt>
mov    $0x2710,%ecx
cltd
idiv   %ecx
add    $0x1,%edx
movslq -0x9c54(%rbp),%rax
mov    %edx,-0x9c50(%rbp,%rax,4)
mov    -0x9c54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x9c54(%rbp)
jmp    1183 <main+0x33>
lea    -0x9c50(%rbp),%rdi
xor    %esi,%esi
mov    $0x270f,%edx
call   1060 <quickSort@plt>
lea    0xe1f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x9c54(%rbp)
cmpl   $0x2710,-0x9c54(%rbp)
jge    1232 <main+0xe2>
movslq -0x9c54(%rbp),%rax
mov    -0x9c50(%rbp,%rax,4),%esi
lea    0xdec(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x9c54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x9c54(%rbp)
jmp    11f2 <main+0xa2>
lea    0xdcf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x9c60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x9c48,%rsp
xor    %edi,%edi
call   1060 <time@plt>
mov    %eax,%edi
call   1050 <srand@plt>
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1080 <rand@plt>
cltq
imul   $0x68db8bad,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x2c,%rcx
add    %edx,%ecx
imul   $0x2710,%ecx,%ecx
neg    %ecx
add    %ecx,%eax
add    $0x1,%eax
mov    %eax,(%rsp,%rbx,4)
add    $0x1,%rbx
cmp    $0x2710,%rbx
jne    1180 <main+0x20>
mov    %rsp,%rdi
xor    %esi,%esi
mov    $0x270f,%edx
call   1070 <quickSort@plt>
lea    0xe39(%rip),%rdi
call   1030 <puts@plt>
lea    0xe24(%rip),%r14
xor    %ebx,%ebx
xchg   %ax,%ax
mov    (%rsp,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    $0x2710,%rbx
jne    11e0 <main+0x80>
lea    0xe04(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x9c48,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str.1 = [5 x i8] c" %d,\00"
@.str.2 = [4 x i8] c"\0A\0A \00"
@str = [2 x i8] c"\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [10000 x i32]
%4 = bitcast [10000 x i32]* %3 to i8*
%5 = tail call i32 @time(i32* null)
%6 = tail call i32 @srand(i32 %5)
br label %7
7: ; preds = %2, %7
%8 = phi i64 [ 0, %2 ], [ %13, %7 ]
%9 = tail call i32 (...) @rand()
%10 = srem i32 %9, 10000
%11 = add nsw i32 %10, 1
%12 = getelementptr inbounds [10000 x i32], [10000 x i32]* %3, i64 0, i64 %8
store i32 %11, i32* %12
%13 = add nuw nsw i64 %8, 1
%14 = icmp eq i64 %13, 10000
br i1 %14, label %15, label %7
15: ; preds = %7
%16 = getelementptr inbounds [10000 x i32], [10000 x i32]* %3, i64 0, i64 0
%17 = call i32 @quickSort(i32* %16, i32 0, i32 9999)
%18 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
br label %19
19: ; preds = %15, %19
%20 = phi i64 [ 0, %15 ], [ %24, %19 ]
%21 = getelementptr inbounds [10000 x i32], [10000 x i32]* %3, i64 0, i64 %20
%22 = load i32, i32* %21
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %22)
%24 = add nuw nsw i64 %20, 1
%25 = icmp eq i64 %24, 10000
br i1 %25, label %26, label %19
26: ; preds = %19
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}