#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 */
scalar_t__ RAND_MAX;
int /*<<< orphan*/ bucketSort(double *, int);
int /*<<< orphan*/ printf(char *, double);
scalar_t__ rand();
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main(int argc, char const *argv[]) {
  double vetor[10];
  int i;
  srand(time(NULL));
  for (i = 0; i < 10; i++) {
    vetor[i] = (double)rand() / (double)RAND_MAX;
    printf(" %lf,", vetor[i]);
  }
  bucketSort(vetor, 10);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%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,-0x64(%rbp)
cmpl   $0xa,-0x64(%rbp)
jge    11d1 <main+0x81>
mov    $0x0,%al
call   1070 <rand@plt>
cvtsi2sd %rax,%xmm0
mov    0x2e4e(%rip),%rax
cvtsi2sdq (%rax),%xmm1
divsd  %xmm1,%xmm0
movslq -0x64(%rbp),%rax
movsd  %xmm0,-0x60(%rbp,%rax,8)
movslq -0x64(%rbp),%rax
movsd  -0x60(%rbp,%rax,8),%xmm0
lea    0xe42(%rip),%rdi
call   1030 <printf@plt>
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
jmp    117d <main+0x2d>
lea    -0x60(%rbp),%rdi
mov    $0xa,%esi
call   1060 <bucketSort@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x58,%rsp
xor    %edi,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
xor    %eax,%eax
call   1070 <rand@plt>
cvtsi2sd %rax,%xmm0
mov    0x2e70(%rip),%r14
cvtsi2sdq (%r14),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,(%rsp)
lea    0xe73(%rip),%rbx
mov    %rbx,%rdi
call   1030 <printf@plt>
xor    %eax,%eax
call   1070 <rand@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
xorps  %xmm1,%xmm1
cvtsi2sdq (%r14),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,0x8(%rsp)
mov    %rbx,%rdi
call   1030 <printf@plt>
xor    %eax,%eax
call   1070 <rand@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
xorps  %xmm1,%xmm1
cvtsi2sdq (%r14),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,0x10(%rsp)
mov    %rbx,%rdi
call   1030 <printf@plt>
xor    %eax,%eax
call   1070 <rand@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
xorps  %xmm1,%xmm1
cvtsi2sdq (%r14),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,0x18(%rsp)
mov    %rbx,%rdi
call   1030 <printf@plt>
xor    %eax,%eax
call   1070 <rand@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
xorps  %xmm1,%xmm1
cvtsi2sdq (%r14),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,0x20(%rsp)
mov    %rbx,%rdi
call   1030 <printf@plt>
xor    %eax,%eax
call   1070 <rand@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
xorps  %xmm1,%xmm1
cvtsi2sdq (%r14),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,0x28(%rsp)
mov    %rbx,%rdi
call   1030 <printf@plt>
xor    %eax,%eax
call   1070 <rand@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
xorps  %xmm1,%xmm1
cvtsi2sdq (%r14),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,0x30(%rsp)
mov    %rbx,%rdi
call   1030 <printf@plt>
xor    %eax,%eax
call   1070 <rand@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
xorps  %xmm1,%xmm1
cvtsi2sdq (%r14),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,0x38(%rsp)
mov    %rbx,%rdi
call   1030 <printf@plt>
xor    %eax,%eax
call   1070 <rand@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
xorps  %xmm1,%xmm1
cvtsi2sdq (%r14),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,0x40(%rsp)
mov    %rbx,%rdi
call   1030 <printf@plt>
xor    %eax,%eax
call   1070 <rand@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
xorps  %xmm1,%xmm1
cvtsi2sdq (%r14),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,0x48(%rsp)
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    %rsp,%rdi
mov    $0xa,%esi
call   1060 <bucketSort@plt>
xor    %eax,%eax
add    $0x58,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@RAND_MAX = global i64 0
@.str = [6 x i8] c" %lf,\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [10 x double]
%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 = %27, %2
%11 = load i32, i32* %7
%12 = icmp slt i32 %11, 10
br i1 %12, label %13, label %30
13: ; preds = %10
%14 = call i64 (...) @rand()
%15 = sitofp i64 %14 to double
%16 = load i64, i64* @RAND_MAX
%17 = sitofp i64 %16 to double
%18 = fdiv double %15, %17
%19 = load i32, i32* %7
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds [10 x double], [10 x double]* %6, i64 0, i64 %20
store double %18, double* %21
%22 = load i32, i32* %7
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [10 x double], [10 x double]* %6, i64 0, i64 %23
%25 = load double, double* %24
%26 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %25)
br label %27
27: ; preds = %13
%28 = load i32, i32* %7
%29 = add nsw i32 %28, 1
store i32 %29, i32* %7
br label %10
30: ; preds = %10
%31 = getelementptr inbounds [10 x double], [10 x double]* %6, i64 0, i64 0
%32 = call i32 @bucketSort(double* %31, i32 10)
ret i32 0
}

LLVM IR (-O2):
@RAND_MAX = global i64 0
@.str = [6 x i8] c" %lf,\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [10 x double]
%4 = bitcast [10 x double]* %3 to i8*
%5 = tail call i32 @time(i32* null)
%6 = tail call i32 @srand(i32 %5)
%7 = tail call i64 (...) @rand()
%8 = sitofp i64 %7 to double
%9 = load i64, i64* @RAND_MAX
%10 = sitofp i64 %9 to double
%11 = fdiv double %8, %10
%12 = getelementptr inbounds [10 x double], [10 x double]* %3, i64 0, i64 0
store double %11, double* %12
%13 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %11)
%14 = tail call i64 (...) @rand()
%15 = sitofp i64 %14 to double
%16 = load i64, i64* @RAND_MAX
%17 = sitofp i64 %16 to double
%18 = fdiv double %15, %17
%19 = getelementptr inbounds [10 x double], [10 x double]* %3, i64 0, i64 1
store double %18, double* %19
%20 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %18)
%21 = tail call i64 (...) @rand()
%22 = sitofp i64 %21 to double
%23 = load i64, i64* @RAND_MAX
%24 = sitofp i64 %23 to double
%25 = fdiv double %22, %24
%26 = getelementptr inbounds [10 x double], [10 x double]* %3, i64 0, i64 2
store double %25, double* %26
%27 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %25)
%28 = tail call i64 (...) @rand()
%29 = sitofp i64 %28 to double
%30 = load i64, i64* @RAND_MAX
%31 = sitofp i64 %30 to double
%32 = fdiv double %29, %31
%33 = getelementptr inbounds [10 x double], [10 x double]* %3, i64 0, i64 3
store double %32, double* %33
%34 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %32)
%35 = tail call i64 (...) @rand()
%36 = sitofp i64 %35 to double
%37 = load i64, i64* @RAND_MAX
%38 = sitofp i64 %37 to double
%39 = fdiv double %36, %38
%40 = getelementptr inbounds [10 x double], [10 x double]* %3, i64 0, i64 4
store double %39, double* %40
%41 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %39)
%42 = tail call i64 (...) @rand()
%43 = sitofp i64 %42 to double
%44 = load i64, i64* @RAND_MAX
%45 = sitofp i64 %44 to double
%46 = fdiv double %43, %45
%47 = getelementptr inbounds [10 x double], [10 x double]* %3, i64 0, i64 5
store double %46, double* %47
%48 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %46)
%49 = tail call i64 (...) @rand()
%50 = sitofp i64 %49 to double
%51 = load i64, i64* @RAND_MAX
%52 = sitofp i64 %51 to double
%53 = fdiv double %50, %52
%54 = getelementptr inbounds [10 x double], [10 x double]* %3, i64 0, i64 6
store double %53, double* %54
%55 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %53)
%56 = tail call i64 (...) @rand()
%57 = sitofp i64 %56 to double
%58 = load i64, i64* @RAND_MAX
%59 = sitofp i64 %58 to double
%60 = fdiv double %57, %59
%61 = getelementptr inbounds [10 x double], [10 x double]* %3, i64 0, i64 7
store double %60, double* %61
%62 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %60)
%63 = tail call i64 (...) @rand()
%64 = sitofp i64 %63 to double
%65 = load i64, i64* @RAND_MAX
%66 = sitofp i64 %65 to double
%67 = fdiv double %64, %66
%68 = getelementptr inbounds [10 x double], [10 x double]* %3, i64 0, i64 8
store double %67, double* %68
%69 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %67)
%70 = tail call i64 (...) @rand()
%71 = sitofp i64 %70 to double
%72 = load i64, i64* @RAND_MAX
%73 = sitofp i64 %72 to double
%74 = fdiv double %71, %73
%75 = getelementptr inbounds [10 x double], [10 x double]* %3, i64 0, i64 9
store double %74, double* %75
%76 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %74)
%77 = call i32 @bucketSort(double* %12, i32 10)
ret i32 0
}