#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 drand(double *);
int /*<<< orphan*/ printf(char *, int, double, double);
int main(void) {
  double seed, s, d;
  int i;
  seed = 91648253;
  for (i = 0; i < 10000000; i++) {
    s = seed;
    d = drand(&seed);
    printf("round %d: seed = %10.0f, dprng = %0.40f\n", i, s, d);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movsd  0xec9(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movl   $0x0,-0x24(%rbp)
cmpl   $0x989680,-0x24(%rbp)
jge    118f <main+0x6f>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
lea    -0x10(%rbp),%rdi
call   1030 <drand@plt>
movsd  %xmm0,-0x20(%rbp)
mov    -0x24(%rbp),%esi
movsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
lea    0xe8c(%rip),%rdi
call   1040 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1143 <main+0x23>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
movabs $0x4195d9c3f4000000,%rax
d9 95 41
mov    %rax,(%rsp)
mov    %rsp,%r14
mov    %r14,%rdi
call   1030 <drand@plt>
movaps %xmm0,%xmm1
lea    0xebd(%rip),%rbx
movsd  0xead(%rip),%xmm0
mov    %rbx,%rdi
xor    %esi,%esi
call   1040 <printf@plt>
mov    $0x1,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsd  (%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
mov    %r14,%rdi
call   1030 <drand@plt>
movaps %xmm0,%xmm1
mov    %rbx,%rdi
mov    %ebp,%esi
movsd  0x8(%rsp),%xmm0
call   1040 <printf@plt>
add    $0x1,%ebp
cmp    $0x989680,%ebp
jne    1170 <main+0x50>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [41 x i8] c"round %d: seed = %10.0f, dprng = %0.40f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca i32
store i32 0, i32* %1
store double 0x4195D9C3F4000000, double* %2
store i32 0, i32* %5
br label %6
6: ; preds = %16, %0
%7 = load i32, i32* %5
%8 = icmp slt i32 %7, 10000000
br i1 %8, label %9, label %19
9: ; preds = %6
%10 = load double, double* %2
store double %10, double* %3
%11 = call double @drand(double* %2)
store double %11, double* %4
%12 = load i32, i32* %5
%13 = load double, double* %3
%14 = load double, double* %4
%15 = call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i32 %12, double %13, double %14)
br label %16
16: ; preds = %9
%17 = load i32, i32* %5
%18 = add nsw i32 %17, 1
store i32 %18, i32* %5
br label %6
19: ; preds = %6
ret i32 0
}

LLVM IR (-O2):
@.str = [41 x i8] c"round %d: seed = %10.0f, dprng = %0.40f\0A\00"
define i32 @main() {
%1 = alloca double
%2 = bitcast double* %1 to i8*
store double 0x4195D9C3F4000000, double* %1
%3 = call double @drand(double* %1)
%4 = call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i32 0, double 0x4195D9C3F4000000, double %3)
br label %5
5: ; preds = %0, %5
%6 = phi i32 [ 1, %0 ], [ %10, %5 ]
%7 = load double, double* %1
%8 = call double @drand(double* %1)
%9 = call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i32 %6, double %7, double %8)
%10 = add nuw nsw i32 %6, 1
%11 = icmp eq i32 %10, 10000000
br i1 %11, label %12, label %5
12: ; preds = %5
ret i32 0
}