#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 *, double);
double randomDouble(int, int);
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main() {
  srand(time(NULL));
  double d[10];
  for (int i = 0; i < 10; i++)
    d[i] = randomDouble(1000000, 100);
  for (int i = 0; i < 10; i++)
    printf("%f\n", d[i]);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1060 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
movl   $0x0,-0x64(%rbp)
cmpl   $0xa,-0x64(%rbp)
jge    1197 <main+0x57>
mov    $0xf4240,%edi
mov    $0x64,%esi
call   1050 <randomDouble@plt>
movslq -0x64(%rbp),%rax
movsd  %xmm0,-0x60(%rbp,%rax,8)
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
jmp    1166 <main+0x26>
movl   $0x0,-0x68(%rbp)
cmpl   $0xa,-0x68(%rbp)
jge    11cc <main+0x8c>
movslq -0x68(%rbp),%rax
movsd  -0x60(%rbp,%rax,8),%xmm0
lea    0xe47(%rip),%rdi
call   1030 <printf@plt>
mov    -0x68(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x68(%rbp)
jmp    119e <main+0x5e>
mov    -0x4(%rbp),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x50,%rsp
xor    %edi,%edi
call   1060 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
mov    $0xf4240,%edi
mov    $0x64,%esi
call   1050 <randomDouble@plt>
movsd  %xmm0,0x48(%rsp)
mov    $0xf4240,%edi
mov    $0x64,%esi
call   1050 <randomDouble@plt>
movsd  %xmm0,0x40(%rsp)
mov    $0xf4240,%edi
mov    $0x64,%esi
call   1050 <randomDouble@plt>
movsd  %xmm0,0x38(%rsp)
mov    $0xf4240,%edi
mov    $0x64,%esi
call   1050 <randomDouble@plt>
movsd  %xmm0,0x30(%rsp)
mov    $0xf4240,%edi
mov    $0x64,%esi
call   1050 <randomDouble@plt>
movsd  %xmm0,0x28(%rsp)
mov    $0xf4240,%edi
mov    $0x64,%esi
call   1050 <randomDouble@plt>
movsd  %xmm0,0x20(%rsp)
mov    $0xf4240,%edi
mov    $0x64,%esi
call   1050 <randomDouble@plt>
movsd  %xmm0,0x18(%rsp)
mov    $0xf4240,%edi
mov    $0x64,%esi
call   1050 <randomDouble@plt>
movsd  %xmm0,0x10(%rsp)
mov    $0xf4240,%edi
mov    $0x64,%esi
call   1050 <randomDouble@plt>
movsd  %xmm0,0x8(%rsp)
mov    $0xf4240,%edi
mov    $0x64,%esi
call   1050 <randomDouble@plt>
movsd  %xmm0,(%rsp)
lea    0xdd5(%rip),%rbx
mov    %rbx,%rdi
movsd  0x48(%rsp),%xmm0
call   1030 <printf@plt>
mov    %rbx,%rdi
movsd  0x40(%rsp),%xmm0
call   1030 <printf@plt>
mov    %rbx,%rdi
movsd  0x38(%rsp),%xmm0
call   1030 <printf@plt>
mov    %rbx,%rdi
movsd  0x30(%rsp),%xmm0
call   1030 <printf@plt>
mov    %rbx,%rdi
movsd  0x28(%rsp),%xmm0
call   1030 <printf@plt>
mov    %rbx,%rdi
movsd  0x20(%rsp),%xmm0
call   1030 <printf@plt>
mov    %rbx,%rdi
movsd  0x18(%rsp),%xmm0
call   1030 <printf@plt>
mov    %rbx,%rdi
movsd  0x10(%rsp),%xmm0
call   1030 <printf@plt>
mov    %rbx,%rdi
movsd  0x8(%rsp),%xmm0
call   1030 <printf@plt>
mov    %rbx,%rdi
movsd  (%rsp),%xmm0
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%f\0A\00"
define i32 @main() {
%1 = tail call i32 @time(i32* null)
%2 = tail call i32 @srand(i32 %1)
%3 = tail call double @randomDouble(i32 1000000, i32 100)
%4 = tail call double @randomDouble(i32 1000000, i32 100)
%5 = tail call double @randomDouble(i32 1000000, i32 100)
%6 = tail call double @randomDouble(i32 1000000, i32 100)
%7 = tail call double @randomDouble(i32 1000000, i32 100)
%8 = tail call double @randomDouble(i32 1000000, i32 100)
%9 = tail call double @randomDouble(i32 1000000, i32 100)
%10 = tail call double @randomDouble(i32 1000000, i32 100)
%11 = tail call double @randomDouble(i32 1000000, i32 100)
%12 = tail call double @randomDouble(i32 1000000, i32 100)
%13 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %3)
%14 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %4)
%15 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %5)
%16 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %6)
%17 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %7)
%18 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %8)
%19 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %9)
%20 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %10)
%21 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %11)
%22 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %12)
ret i32 0
}