#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, double);
double random_between_double(double, double);
int main() {
  int N = 10;
  for (int i = 0; i < N; i++) {
    double l = i;
    double h = i + 0.1;
    double d = random_between_double(l, h);
    printf("random [%0.3f,%0.3f) : %0.5f\n", l, h, d);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xa,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11a6 <main+0x86>
cvtsi2sdl -0xc(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
cvtsi2sdl -0xc(%rbp),%xmm0
movsd  0xea0(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
call   1040 <random_between_double@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm2
lea    0xe75(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    113d <main+0x1d>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
movsd  0xed7(%rip),%xmm1
xorps  %xmm0,%xmm0
call   1040 <random_between_double@plt>
movaps %xmm0,%xmm2
lea    0xf5d(%rip),%rbx
xorps  %xmm0,%xmm0
mov    %rbx,%rdi
movsd  0xeb7(%rip),%xmm1
call   1030 <printf@plt>
movsd  0xeb2(%rip),%xmm0
movsd  0xeb2(%rip),%xmm1
call   1040 <random_between_double@plt>
movaps %xmm0,%xmm2
mov    %rbx,%rdi
movsd  0xe97(%rip),%xmm0
movsd  0xe97(%rip),%xmm1
call   1030 <printf@plt>
movsd  0xe92(%rip),%xmm0
movsd  0xe92(%rip),%xmm1
call   1040 <random_between_double@plt>
movaps %xmm0,%xmm2
mov    %rbx,%rdi
movsd  0xe77(%rip),%xmm0
movsd  0xe77(%rip),%xmm1
call   1030 <printf@plt>
movsd  0xe72(%rip),%xmm0
movsd  0xe72(%rip),%xmm1
call   1040 <random_between_double@plt>
movaps %xmm0,%xmm2
mov    %rbx,%rdi
movsd  0xe57(%rip),%xmm0
movsd  0xe57(%rip),%xmm1
call   1030 <printf@plt>
movsd  0xe52(%rip),%xmm0
movsd  0xe52(%rip),%xmm1
call   1040 <random_between_double@plt>
movaps %xmm0,%xmm2
mov    %rbx,%rdi
movsd  0xe37(%rip),%xmm0
movsd  0xe37(%rip),%xmm1
call   1030 <printf@plt>
movsd  0xe32(%rip),%xmm0
movsd  0xe32(%rip),%xmm1
call   1040 <random_between_double@plt>
movaps %xmm0,%xmm2
mov    %rbx,%rdi
movsd  0xe17(%rip),%xmm0
movsd  0xe17(%rip),%xmm1
call   1030 <printf@plt>
movsd  0xe12(%rip),%xmm0
movsd  0xe12(%rip),%xmm1
call   1040 <random_between_double@plt>
movaps %xmm0,%xmm2
mov    %rbx,%rdi
movsd  0xdf7(%rip),%xmm0
movsd  0xdf7(%rip),%xmm1
call   1030 <printf@plt>
movsd  0xdf2(%rip),%xmm0
movsd  0xdf2(%rip),%xmm1
call   1040 <random_between_double@plt>
movaps %xmm0,%xmm2
mov    %rbx,%rdi
movsd  0xdd7(%rip),%xmm0
movsd  0xdd7(%rip),%xmm1
call   1030 <printf@plt>
movsd  0xdd2(%rip),%xmm0
movsd  0xdd2(%rip),%xmm1
call   1040 <random_between_double@plt>
movaps %xmm0,%xmm2
mov    %rbx,%rdi
movsd  0xdb7(%rip),%xmm0
movsd  0xdb7(%rip),%xmm1
call   1030 <printf@plt>
movsd  0xdb2(%rip),%xmm0
movsd  0xdb2(%rip),%xmm1
call   1040 <random_between_double@plt>
movaps %xmm0,%xmm2
mov    %rbx,%rdi
movsd  0xd97(%rip),%xmm0
movsd  0xd97(%rip),%xmm1
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [30 x i8] c"random [%0.3f,%0.3f) : %0.5f\0A\00"
define i32 @main() {
%1 = tail call double @random_between_double(double 0.000000e+00, double 1.000000e-01)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), double 0.000000e+00, double 1.000000e-01, double %1)
%3 = tail call double @random_between_double(double 1.000000e+00, double 1.100000e+00)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), double 1.000000e+00, double 1.100000e+00, double %3)
%5 = tail call double @random_between_double(double 2.000000e+00, double 2.100000e+00)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), double 2.000000e+00, double 2.100000e+00, double %5)
%7 = tail call double @random_between_double(double 3.000000e+00, double 3.100000e+00)
%8 = tail call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), double 3.000000e+00, double 3.100000e+00, double %7)
%9 = tail call double @random_between_double(double 4.000000e+00, double 4.100000e+00)
%10 = tail call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), double 4.000000e+00, double 4.100000e+00, double %9)
%11 = tail call double @random_between_double(double 5.000000e+00, double 5.100000e+00)
%12 = tail call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), double 5.000000e+00, double 5.100000e+00, double %11)
%13 = tail call double @random_between_double(double 6.000000e+00, double 6.100000e+00)
%14 = tail call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), double 6.000000e+00, double 6.100000e+00, double %13)
%15 = tail call double @random_between_double(double 7.000000e+00, double 7.100000e+00)
%16 = tail call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), double 7.000000e+00, double 7.100000e+00, double %15)
%17 = tail call double @random_between_double(double 8.000000e+00, double 8.100000e+00)
%18 = tail call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), double 8.000000e+00, double 8.100000e+00, double %17)
%19 = tail call double @random_between_double(double 9.000000e+00, double 9.100000e+00)
%20 = tail call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), double 9.000000e+00, double 9.100000e+00, double %19)
ret i32 0
}