#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(unsigned int *, unsigned int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, unsigned int *);
int main(int argc, char const *argv[]) {
  unsigned int size;
  printf("Tamanho: ");
  scanf("%u", &size);
  unsigned int a[size];
  for (int i = 0; i < size; i++)
    scanf("%u", &a[i]);
  printf("Elements of the array:\n");
  for (int i = 0; i < size; i++) {
    for (int j = 0; j < a[i]; j++) {
      printf("*");
    }
    printf("\n");
  }
  QuickSort(a, size);
  for (int i = 0; i < size; i++) {
    printf("%d \n", a[i]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xeb3(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeaf(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x14(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x20(%rbp)
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x40(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jae    11c7 <main+0x97>
mov    -0x40(%rbp),%rsi
movslq -0x2c(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe56(%rip),%rdi
call   1050 <scanf@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1192 <main+0x62>
lea    0xe3f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0x14(%rbp),%eax
jae    123b <main+0x10b>
movl   $0x0,-0x34(%rbp)
mov    -0x40(%rbp),%rcx
mov    -0x34(%rbp),%eax
movslq -0x30(%rbp),%rdx
cmp    (%rcx,%rdx,4),%eax
jae    121f <main+0xef>
lea    0xe1b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    11ef <main+0xbf>
lea    0xe04(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    11dc <main+0xac>
mov    -0x40(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1040 <QuickSort@plt>
movl   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%eax
cmp    -0x14(%rbp),%eax
jae    1281 <main+0x151>
mov    -0x40(%rbp),%rax
movslq -0x38(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xdbb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    124e <main+0x11e>
movl   $0x0,-0x4(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xe98(%rip),%rdi
xor    %r14d,%r14d
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe91(%rip),%rdi
lea    -0x2c(%rbp),%rsi
call   1070 <scanf@plt>
mov    %rsp,-0x38(%rbp)
mov    -0x2c(%rbp),%eax
mov    %rsp,%r12
lea    0xf(,%rax,4),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r12
mov    %r12,%rsp
cmpl   $0x0,-0x2c(%rbp)
je     11db <main+0x8b>
xor    %r13d,%r13d
lea    0xe5c(%rip),%r15
mov    %r12,%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r15,%rdi
mov    %rbx,%rsi
call   1070 <scanf@plt>
add    $0x1,%r13
mov    -0x2c(%rbp),%eax
add    $0x4,%rbx
cmp    %rax,%r13
jb     11c0 <main+0x70>
lea    0xe30(%rip),%rdi
call   1040 <puts@plt>
cmpl   $0x0,-0x2c(%rbp)
je     1235 <main+0xe5>
xor    %r15d,%r15d
jmp    1217 <main+0xc7>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r15
mov    -0x2c(%rbp),%r14d
cmp    %r14,%r15
jae    1235 <main+0xe5>
cmpl   $0x0,(%r12,%r15,4)
je     1200 <main+0xb0>
xor    %ebx,%ebx
mov    $0x2a,%edi
call   1030 <putchar@plt>
add    $0x1,%ebx
cmp    (%r12,%r15,4),%ebx
jb     1220 <main+0xd0>
jmp    1200 <main+0xb0>
mov    %r12,%rdi
mov    %r14d,%esi
call   1060 <QuickSort@plt>
cmpl   $0x0,-0x2c(%rbp)
je     126a <main+0x11a>
lea    0xdc0(%rip),%r14
xor    %ebx,%ebx
nop
mov    (%r12,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%rbx
mov    -0x2c(%rbp),%eax
cmp    %rax,%rbx
jb     1250 <main+0x100>
mov    -0x38(%rbp),%rsp
xor    %eax,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [10 x i8] c"Tamanho: \00"
@.str.1 = [3 x i8] c"%u\00"
@.str.2 = [24 x i8] c"Elements of the array:\0A\00"
@.str.3 = [2 x i8] c"*\00"
@.str.4 = [2 x i8] c"\0A\00"
@.str.5 = [5 x i8] c"%d \0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i64
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %6)
%15 = load i32, i32* %6
%16 = zext i32 %15 to i64
%17 = call i8* @llvm.stacksave()
store i8* %17, i8** %7
%18 = alloca i32, i64 %16
store i64 %16, i64* %8
store i32 0, i32* %9
br label %19
19: ; preds = %28, %2
%20 = load i32, i32* %9
%21 = load i32, i32* %6
%22 = icmp ult i32 %20, %21
br i1 %22, label %23, label %31
23: ; preds = %19
%24 = load i32, i32* %9
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i32, i32* %18, i64 %25
%27 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %26)
br label %28
28: ; preds = %23
%29 = load i32, i32* %9
%30 = add nsw i32 %29, 1
store i32 %30, i32* %9
br label %19
31: ; preds = %19
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %10
br label %33
33: ; preds = %52, %31
%34 = load i32, i32* %10
%35 = load i32, i32* %6
%36 = icmp ult i32 %34, %35
br i1 %36, label %37, label %55
37: ; preds = %33
store i32 0, i32* %11
br label %38
38: ; preds = %47, %37
%39 = load i32, i32* %11
%40 = load i32, i32* %10
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds i32, i32* %18, i64 %41
%43 = load i32, i32* %42
%44 = icmp ult i32 %39, %43
br i1 %44, label %45, label %50
45: ; preds = %38
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %47
47: ; preds = %45
%48 = load i32, i32* %11
%49 = add nsw i32 %48, 1
store i32 %49, i32* %11
br label %38
50: ; preds = %38
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %52
52: ; preds = %50
%53 = load i32, i32* %10
%54 = add nsw i32 %53, 1
store i32 %54, i32* %10
br label %33
55: ; preds = %33
%56 = load i32, i32* %6
%57 = call i32 @QuickSort(i32* %18, i32 %56)
store i32 0, i32* %12
br label %58
58: ; preds = %68, %55
%59 = load i32, i32* %12
%60 = load i32, i32* %6
%61 = icmp ult i32 %59, %60
br i1 %61, label %62, label %71
62: ; preds = %58
%63 = load i32, i32* %12
%64 = sext i32 %63 to i64
%65 = getelementptr inbounds i32, i32* %18, i64 %64
%66 = load i32, i32* %65
%67 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i32 %66)
br label %68
68: ; preds = %62
%69 = load i32, i32* %12
%70 = add nsw i32 %69, 1
store i32 %70, i32* %12
br label %58
71: ; preds = %58
store i32 0, i32* %3
%72 = load i8*, i8** %7
%73 = load i32, i32* %3
ret i32 %73
}

LLVM IR (-O2):
@.str = [10 x i8] c"Tamanho: \00"
@.str.1 = [3 x i8] c"%u\00"
@.str.5 = [5 x i8] c"%d \0A\00"
@str = [23 x i8] c"Elements of the array:\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%7 = load i32, i32* %3
%8 = zext i32 %7 to i64
%9 = call i8* @llvm.stacksave()
%10 = alloca i32, i64 %8
%11 = load i32, i32* %3
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %17
13: ; preds = %17, %2
%14 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str, i64 0, i64 0))
%15 = load i32, i32* %3
%16 = icmp eq i32 %15, 0
br i1 %16, label %30, label %25
17: ; preds = %2, %17
%18 = phi i64 [ %21, %17 ], [ 0, %2 ]
%19 = getelementptr inbounds i32, i32* %10, i64 %18
%20 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %19)
%21 = add nuw nsw i64 %18, 1
%22 = load i32, i32* %3
%23 = zext i32 %22 to i64
%24 = icmp ult i64 %21, %23
br i1 %24, label %17, label %13
25: ; preds = %13, %35
%26 = phi i64 [ %37, %35 ], [ 0, %13 ]
%27 = getelementptr inbounds i32, i32* %10, i64 %26
%28 = load i32, i32* %27
%29 = icmp eq i32 %28, 0
br i1 %29, label %35, label %41
30: ; preds = %35, %13
%31 = phi i32 [ 0, %13 ], [ %38, %35 ]
%32 = call i32 @QuickSort(i32* %10, i32 %31)
%33 = load i32, i32* %3
%34 = icmp eq i32 %33, 0
br i1 %34, label %47, label %48
35: ; preds = %41, %25
%36 = call i32 @putchar(i32 10)
%37 = add nuw nsw i64 %26, 1
%38 = load i32, i32* %3
%39 = zext i32 %38 to i64
%40 = icmp ult i64 %37, %39
br i1 %40, label %25, label %30
41: ; preds = %25, %41
%42 = phi i32 [ %44, %41 ], [ 0, %25 ]
%43 = call i32 @putchar(i32 42)
%44 = add nuw nsw i32 %42, 1
%45 = load i32, i32* %27
%46 = icmp ult i32 %44, %45
br i1 %46, label %41, label %35
47: ; preds = %48, %30
ret i32 0
48: ; preds = %30, %48
%49 = phi i64 [ %53, %48 ], [ 0, %30 ]
%50 = getelementptr inbounds i32, i32* %10, i64 %49
%51 = load i32, i32* %50
%52 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i32 %51)
%53 = add nuw nsw i64 %49, 1
%54 = load i32, i32* %3
%55 = zext i32 %54 to i64
%56 = icmp ult i64 %53, %55
br i1 %56, label %48, label %47
}