#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 */
struct BasePRNGObject {
  int dummy;
};
typedef int int32_t;

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ printf(char *, double);
int /*<<< orphan*/ stderr;
struct BasePRNGObject *stdlib_base_random_randu_allocate(int /*<<< orphan*/);
int /*<<< orphan*/ stdlib_base_random_randu_free(struct BasePRNGObject *);
double stdlib_base_random_uniform(struct BasePRNGObject *, double, double);
int main() {
  int32_t i;
  double d;
  struct BasePRNGObject *randu = stdlib_base_random_randu_allocate(0);
  if (randu == NULL) {
    fprintf(stderr, "Error allocating PRNG.\n");
    exit(1);
  }
  for (i = 0; i < 10; i++) {
    d = stdlib_base_random_uniform(randu, -10.0, 10.0);
    printf("%0.16f\n", d);
  }
  stdlib_base_random_randu_free(randu);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
xor    %edi,%edi
call   1060 <stdlib_base_random_randu_allocate@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    11a4 <main+0x44>
mov    0x2e54(%rip),%rax
mov    (%rax),%edi
lea    0xe7b(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jge    11f2 <main+0x92>
mov    -0x18(%rbp),%rdi
movsd  0xe3f(%rip),%xmm0
movsd  0xe3f(%rip),%xmm1
call   1050 <stdlib_base_random_uniform@plt>
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
lea    0xe49(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11ab <main+0x4b>
mov    -0x18(%rbp),%rdi
call   1080 <stdlib_base_random_randu_free@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
xor    %edi,%edi
call   1060 <stdlib_base_random_randu_allocate@plt>
test   %rax,%rax
je     12d0 <main+0x170>
mov    %rax,%rbx
movsd  0xe81(%rip),%xmm0
movsd  0xe81(%rip),%xmm1
mov    %rax,%rdi
call   1050 <stdlib_base_random_uniform@plt>
lea    0xe92(%rip),%r14
mov    %r14,%rdi
call   1030 <printf@plt>
mov    %rbx,%rdi
movsd  0xe57(%rip),%xmm0
movsd  0xe57(%rip),%xmm1
call   1050 <stdlib_base_random_uniform@plt>
mov    %r14,%rdi
call   1030 <printf@plt>
mov    %rbx,%rdi
movsd  0xe37(%rip),%xmm0
movsd  0xe37(%rip),%xmm1
call   1050 <stdlib_base_random_uniform@plt>
mov    %r14,%rdi
call   1030 <printf@plt>
mov    %rbx,%rdi
movsd  0xe17(%rip),%xmm0
movsd  0xe17(%rip),%xmm1
call   1050 <stdlib_base_random_uniform@plt>
mov    %r14,%rdi
call   1030 <printf@plt>
mov    %rbx,%rdi
movsd  0xdf7(%rip),%xmm0
movsd  0xdf7(%rip),%xmm1
call   1050 <stdlib_base_random_uniform@plt>
mov    %r14,%rdi
call   1030 <printf@plt>
mov    %rbx,%rdi
movsd  0xdd7(%rip),%xmm0
movsd  0xdd7(%rip),%xmm1
call   1050 <stdlib_base_random_uniform@plt>
mov    %r14,%rdi
call   1030 <printf@plt>
mov    %rbx,%rdi
movsd  0xdb7(%rip),%xmm0
movsd  0xdb7(%rip),%xmm1
call   1050 <stdlib_base_random_uniform@plt>
mov    %r14,%rdi
call   1030 <printf@plt>
mov    %rbx,%rdi
movsd  0xd97(%rip),%xmm0
movsd  0xd97(%rip),%xmm1
call   1050 <stdlib_base_random_uniform@plt>
mov    %r14,%rdi
call   1030 <printf@plt>
mov    %rbx,%rdi
movsd  0xd77(%rip),%xmm0
movsd  0xd77(%rip),%xmm1
call   1050 <stdlib_base_random_uniform@plt>
mov    %r14,%rdi
call   1030 <printf@plt>
mov    %rbx,%rdi
movsd  0xd57(%rip),%xmm0
movsd  0xd57(%rip),%xmm1
call   1050 <stdlib_base_random_uniform@plt>
mov    %r14,%rdi
call   1030 <printf@plt>
mov    %rbx,%rdi
call   1080 <stdlib_base_random_randu_free@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
mov    0x2d09(%rip),%rax
mov    (%rax),%edi
lea    0xd30(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
%struct.BasePRNGObject = type { i32 }
@stderr = global i32 0
@.str = [24 x i8] c"Error allocating PRNG.\0A\00"
@.str.1 = [8 x i8] c"%0.16f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca double
%4 = alloca %struct.BasePRNGObject*
store i32 0, i32* %1
%5 = call %struct.BasePRNGObject* @stdlib_base_random_randu_allocate(i32 0)
store %struct.BasePRNGObject* %5, %struct.BasePRNGObject** %4
%6 = load %struct.BasePRNGObject*, %struct.BasePRNGObject** %4
%7 = icmp eq %struct.BasePRNGObject* %6, null
br i1 %7, label %8, label %12
8: ; preds = %0
%9 = load i32, i32* @stderr
%10 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%11 = call i32 @exit(i32 1)
unreachable
12: ; preds = %0
store i32 0, i32* %2
br label %13
13: ; preds = %21, %12
%14 = load i32, i32* %2
%15 = icmp slt i32 %14, 10
br i1 %15, label %16, label %24
16: ; preds = %13
%17 = load %struct.BasePRNGObject*, %struct.BasePRNGObject** %4
%18 = call double @stdlib_base_random_uniform(%struct.BasePRNGObject* %17, double -1.000000e+01, double 1.000000e+01)
store double %18, double* %3
%19 = load double, double* %3
%20 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), double %19)
br label %21
21: ; preds = %16
%22 = load i32, i32* %2
%23 = add nsw i32 %22, 1
store i32 %23, i32* %2
br label %13
24: ; preds = %13
%25 = load %struct.BasePRNGObject*, %struct.BasePRNGObject** %4
%26 = call i32 @stdlib_base_random_randu_free(%struct.BasePRNGObject* %25)
%27 = load i32, i32* %1
ret i32 %27
}

LLVM IR (-O2):
%struct.BasePRNGObject = type { i32 }
@stderr = global i32 0
@.str = [24 x i8] c"Error allocating PRNG.\0A\00"
@.str.1 = [8 x i8] c"%0.16f\0A\00"
define i32 @main() {
%1 = tail call %struct.BasePRNGObject* @stdlib_base_random_randu_allocate(i32 0)
%2 = icmp eq %struct.BasePRNGObject* %1, null
br i1 %2, label %25, label %3
3: ; preds = %0
%4 = tail call double @stdlib_base_random_uniform(%struct.BasePRNGObject* %1, double -1.000000e+01, double 1.000000e+01)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), double %4)
%6 = tail call double @stdlib_base_random_uniform(%struct.BasePRNGObject* %1, double -1.000000e+01, double 1.000000e+01)
%7 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), double %6)
%8 = tail call double @stdlib_base_random_uniform(%struct.BasePRNGObject* %1, double -1.000000e+01, double 1.000000e+01)
%9 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), double %8)
%10 = tail call double @stdlib_base_random_uniform(%struct.BasePRNGObject* %1, double -1.000000e+01, double 1.000000e+01)
%11 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), double %10)
%12 = tail call double @stdlib_base_random_uniform(%struct.BasePRNGObject* %1, double -1.000000e+01, double 1.000000e+01)
%13 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), double %12)
%14 = tail call double @stdlib_base_random_uniform(%struct.BasePRNGObject* %1, double -1.000000e+01, double 1.000000e+01)
%15 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), double %14)
%16 = tail call double @stdlib_base_random_uniform(%struct.BasePRNGObject* %1, double -1.000000e+01, double 1.000000e+01)
%17 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), double %16)
%18 = tail call double @stdlib_base_random_uniform(%struct.BasePRNGObject* %1, double -1.000000e+01, double 1.000000e+01)
%19 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), double %18)
%20 = tail call double @stdlib_base_random_uniform(%struct.BasePRNGObject* %1, double -1.000000e+01, double 1.000000e+01)
%21 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), double %20)
%22 = tail call double @stdlib_base_random_uniform(%struct.BasePRNGObject* %1, double -1.000000e+01, double 1.000000e+01)
%23 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), double %22)
%24 = tail call i32 @stdlib_base_random_randu_free(%struct.BasePRNGObject* %1)
ret i32 0
25: ; preds = %0
%26 = load i32, i32* @stderr
%27 = tail call i32 @fprintf(i32 %26, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%28 = tail call i32 @exit(i32 1)
unreachable
}