#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 */
double my_random_double2();
int /*<<< orphan*/ printf(char *, double);
int /*<<< orphan*/ srandom(int);
main(int argc, char *argv[]) {
  int i;
  float f;
  double d;
  double t0, t1;
  int iters = 1000;
  int seed = 17;
  srandom(seed);
  for (i = 0; i < iters; i++) {
    d = my_random_double2();
    printf("%G\n", d);
  }
}


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)
movl   $0x3e8,-0x34(%rbp)
movl   $0x11,-0x38(%rbp)
mov    -0x38(%rbp),%edi
call   1030 <srandom@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x34(%rbp),%eax
jge    119a <main+0x6a>
mov    $0x0,%al
call   1050 <my_random_double2@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
lea    0xe79(%rip),%rdi
call   1040 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1163 <main+0x33>
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    $0x11,%edi
call   1030 <srandom@plt>
mov    $0x3e8,%ebp
lea    0xeb7(%rip),%rbx
nopl   0x0(%rax)
xor    %eax,%eax
call   1050 <my_random_double2@plt>
mov    %rbx,%rdi
call   1040 <printf@plt>
add    $0xffffffff,%ebp
jne    1150 <main+0x20>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%G\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca float
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca i32
%12 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 1000, i32* %11
store i32 17, i32* %12
%13 = load i32, i32* %12
%14 = call i32 @srandom(i32 %13)
store i32 0, i32* %6
br label %15
15: ; preds = %23, %2
%16 = load i32, i32* %6
%17 = load i32, i32* %11
%18 = icmp slt i32 %16, %17
br i1 %18, label %19, label %26
19: ; preds = %15
%20 = call double (...) @my_random_double2()
store double %20, double* %8
%21 = load double, double* %8
%22 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %21)
br label %23
23: ; preds = %19
%24 = load i32, i32* %6
%25 = add nsw i32 %24, 1
store i32 %25, i32* %6
br label %15
26: ; preds = %15
%27 = load i32, i32* %3
ret i32 %27
}

LLVM IR (-O2):
@.str = [4 x i8] c"%G\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @srandom(i32 17)
br label %4
4: ; preds = %2, %4
%5 = phi i32 [ 0, %2 ], [ %8, %4 ]
%6 = tail call double (...) @my_random_double2()
%7 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %6)
%8 = add nuw nsw i32 %5, 1
%9 = icmp eq i32 %8, 1000
br i1 %9, label %10, label %4
10: ; preds = %4
ret i32 0
}