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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x44(%rbp)
cmpl   $0xa,-0x44(%rbp)
jge    117f <main+0x4f>
mov    $0x0,%al
call   1050 <rand@plt>
mov    $0x64,%ecx
cltd
idiv   %ecx
add    $0x1,%edx
movslq -0x44(%rbp),%rax
mov    %edx,-0x40(%rbp,%rax,4)
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    114d <main+0x1d>
lea    -0x40(%rbp),%rdi
mov    $0xa,%esi
call   1040 <countingSort@plt>
lea    0xe6c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x44(%rbp)
cmpl   $0xa,-0x44(%rbp)
jge    11d0 <main+0xa0>
movslq -0x44(%rbp),%rax
mov    -0x40(%rbp,%rax,4),%esi
lea    0xe48(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    11a2 <main+0x72>
lea    0xe31(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x30,%rsp
xor    %eax,%eax
call   1060 <rand@plt>
mov    %eax,%r14d
xor    %eax,%eax
call   1060 <rand@plt>
mov    %eax,%ebp
xor    %eax,%eax
call   1060 <rand@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1060 <rand@plt>
movd   %r14d,%xmm0
movd   %ebp,%xmm1
punpckldq %xmm1,%xmm0
movd   %ebx,%xmm1
movd   %eax,%xmm2
punpckldq %xmm2,%xmm1
punpcklqdq %xmm1,%xmm0
movdqa 0xe70(%rip),%xmm3
movdqa %xmm0,%xmm1
pmuludq %xmm3,%xmm1
pshufd $0xed,%xmm1,%xmm1
pshufd $0xf5,%xmm0,%xmm2
pmuludq %xmm3,%xmm2
pshufd $0xed,%xmm2,%xmm2
punpckldq %xmm2,%xmm1
pxor   %xmm2,%xmm2
pcmpgtd %xmm0,%xmm2
pand   %xmm3,%xmm2
psubd  %xmm2,%xmm1
movdqa %xmm1,%xmm2
psrld  $0x1f,%xmm2
psrad  $0x5,%xmm1
paddd  %xmm2,%xmm1
movdqa 0xe37(%rip),%xmm3
pshufd $0xf5,%xmm1,%xmm2
pmuludq %xmm3,%xmm1
pshufd $0xe8,%xmm1,%xmm1
pmuludq %xmm3,%xmm2
pshufd $0xe8,%xmm2,%xmm2
punpckldq %xmm2,%xmm1
psubd  %xmm1,%xmm0
pcmpeqd %xmm1,%xmm1
psubd  %xmm1,%xmm0
movdqa %xmm0,(%rsp)
xor    %eax,%eax
call   1060 <rand@plt>
mov    %eax,%r14d
xor    %eax,%eax
call   1060 <rand@plt>
mov    %eax,%ebp
xor    %eax,%eax
call   1060 <rand@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1060 <rand@plt>
movd   %r14d,%xmm0
movd   %ebp,%xmm1
punpckldq %xmm1,%xmm0
movd   %ebx,%xmm1
movd   %eax,%xmm2
punpckldq %xmm2,%xmm1
punpcklqdq %xmm1,%xmm0
movdqa %xmm0,%xmm1
movdqa 0xdaf(%rip),%xmm3
pmuludq %xmm3,%xmm1
pshufd $0xed,%xmm1,%xmm1
pshufd $0xf5,%xmm0,%xmm2
pmuludq %xmm3,%xmm2
pshufd $0xed,%xmm2,%xmm2
punpckldq %xmm2,%xmm1
pxor   %xmm2,%xmm2
pcmpgtd %xmm0,%xmm2
pand   %xmm3,%xmm2
psubd  %xmm2,%xmm1
movdqa %xmm1,%xmm2
psrld  $0x1f,%xmm2
psrad  $0x5,%xmm1
paddd  %xmm2,%xmm1
pshufd $0xf5,%xmm1,%xmm2
movdqa 0xd75(%rip),%xmm3
pmuludq %xmm3,%xmm1
pshufd $0xe8,%xmm1,%xmm1
pmuludq %xmm3,%xmm2
pshufd $0xe8,%xmm2,%xmm2
punpckldq %xmm2,%xmm1
psubd  %xmm1,%xmm0
psubd  0xd63(%rip),%xmm0
movdqa %xmm0,0x10(%rsp)
xor    %eax,%eax
call   1060 <rand@plt>
cltq
imul   $0x51eb851f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x20,%rcx
sar    $0x5,%ecx
add    %edx,%ecx
imul   $0x64,%ecx,%ecx
neg    %ecx
add    %ecx,%eax
add    $0x1,%eax
mov    %eax,0x20(%rsp)
xor    %eax,%eax
call   1060 <rand@plt>
cltq
imul   $0x51eb851f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x20,%rcx
sar    $0x5,%ecx
add    %edx,%ecx
imul   $0x64,%ecx,%ecx
neg    %ecx
add    %ecx,%eax
add    $0x1,%eax
mov    %eax,0x24(%rsp)
mov    %rsp,%rdi
mov    $0xa,%esi
call   1050 <countingSort@plt>
lea    0xd06(%rip),%rdi
call   1030 <puts@plt>
mov    (%rsp),%esi
lea    0xcee(%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    0x24(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xc64(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
pop    %r14
pop    %rbp
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 [10 x i32]
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %7
br label %8
8: ; preds = %18, %2
%9 = load i32, i32* %7
%10 = icmp slt i32 %9, 10
br i1 %10, label %11, label %21
11: ; preds = %8
%12 = call i32 (...) @rand()
%13 = srem i32 %12, 100
%14 = add nsw i32 %13, 1
%15 = load i32, i32* %7
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [10 x i32], [10 x i32]* %6, i64 0, i64 %16
store i32 %14, i32* %17
br label %18
18: ; preds = %11
%19 = load i32, i32* %7
%20 = add nsw i32 %19, 1
store i32 %20, i32* %7
br label %8
21: ; preds = %8
%22 = getelementptr inbounds [10 x i32], [10 x i32]* %6, i64 0, i64 0
%23 = call i32 @countingSort(i32* %22, i32 10)
%24 = 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 %25
25: ; preds = %34, %21
%26 = load i32, i32* %7
%27 = icmp slt i32 %26, 10
br i1 %27, label %28, label %37
28: ; preds = %25
%29 = load i32, i32* %7
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds [10 x i32], [10 x i32]* %6, i64 0, i64 %30
%32 = load i32, i32* %31
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %32)
br label %34
34: ; preds = %28
%35 = load i32, i32* %7
%36 = add nsw i32 %35, 1
store i32 %36, i32* %7
br label %25
37: ; preds = %25
%38 = 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 [10 x i32]
%4 = bitcast [10 x i32]* %3 to i8*
%5 = tail call i32 (...) @rand()
%6 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 0
%7 = tail call i32 (...) @rand()
%8 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 1
%9 = tail call i32 (...) @rand()
%10 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 2
%11 = tail call i32 (...) @rand()
%12 = insertelement <4 x i32> poison, i32 %5, i64 0
%13 = insertelement <4 x i32> %12, i32 %7, i64 1
%14 = insertelement <4 x i32> %13, i32 %9, i64 2
%15 = insertelement <4 x i32> %14, i32 %11, i64 3
%16 = srem <4 x i32> %15, <i32 100, i32 100, i32 100, i32 100>
%17 = add nsw <4 x i32> %16, <i32 1, i32 1, i32 1, i32 1>
%18 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 3
%19 = bitcast [10 x i32]* %3 to <4 x i32>*
store <4 x i32> %17, <4 x i32>* %19
%20 = tail call i32 (...) @rand()
%21 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 4
%22 = tail call i32 (...) @rand()
%23 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 5
%24 = tail call i32 (...) @rand()
%25 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 6
%26 = tail call i32 (...) @rand()
%27 = insertelement <4 x i32> poison, i32 %20, i64 0
%28 = insertelement <4 x i32> %27, i32 %22, i64 1
%29 = insertelement <4 x i32> %28, i32 %24, i64 2
%30 = insertelement <4 x i32> %29, i32 %26, i64 3
%31 = srem <4 x i32> %30, <i32 100, i32 100, i32 100, i32 100>
%32 = add nsw <4 x i32> %31, <i32 1, i32 1, i32 1, i32 1>
%33 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 7
%34 = bitcast i32* %21 to <4 x i32>*
store <4 x i32> %32, <4 x i32>* %34
%35 = tail call i32 (...) @rand()
%36 = srem i32 %35, 100
%37 = add nsw i32 %36, 1
%38 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 8
store i32 %37, i32* %38
%39 = tail call i32 (...) @rand()
%40 = srem i32 %39, 100
%41 = add nsw i32 %40, 1
%42 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 9
store i32 %41, i32* %42
%43 = call i32 @countingSort(i32* %6, i32 10)
%44 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
%45 = load i32, i32* %6
%46 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %45)
%47 = load i32, i32* %8
%48 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %47)
%49 = load i32, i32* %10
%50 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %49)
%51 = load i32, i32* %18
%52 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %51)
%53 = load i32, i32* %21
%54 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %53)
%55 = load i32, i32* %23
%56 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %55)
%57 = load i32, i32* %25
%58 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %57)
%59 = load i32, i32* %33
%60 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %59)
%61 = load i32, i32* %38
%62 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %61)
%63 = load i32, i32* %42
%64 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %63)
%65 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}