#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 quick_rand32();
double quick_rand_range(double s, double e) {
  double rand_double1;
  do {
    rand_double1 = quick_rand32() * 2.32830643708079737531e-10;
    rand_double1 = (rand_double1 + quick_rand32()) * 2.32830643708079737531e-10;
  } while (rand_double1 > 1);
  return s + rand_double1 * (e - s);
}


x86 assembly (clang, -O0):
<quick_rand_range>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
mov    $0x0,%al
call   1030 <quick_rand32@plt>
movsd  0xecf(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    $0x0,%al
call   1030 <quick_rand32@plt>
movaps %xmm0,%xmm1
movsd  -0x20(%rbp),%xmm0
addsd  %xmm1,%xmm0
movsd  0xea1(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  0xe93(%rip),%xmm1
ucomisd %xmm1,%xmm0
ja     1122 <quick_rand_range+0x12>
movsd  -0x8(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm2
subsd  -0x8(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<quick_rand_range>:
sub    $0x18,%rsp
movsd  %xmm1,(%rsp)
movsd  %xmm0,0x8(%rsp)
nop
xor    %eax,%eax
call   1030 <quick_rand32@plt>
movapd %xmm0,%xmm1
movsd  0xecd(%rip),%xmm0
mulsd  %xmm0,%xmm1
movsd  %xmm1,0x10(%rsp)
xor    %eax,%eax
call   1030 <quick_rand32@plt>
addsd  0x10(%rsp),%xmm0
mulsd  0xeae(%rip),%xmm0
ucomisd 0xeae(%rip),%xmm0
ja     1120 <quick_rand_range+0x10>
movsd  0x8(%rsp),%xmm1
movsd  (%rsp),%xmm2
subsd  %xmm1,%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @quick_rand_range(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
store double %0, double* %3
store double %1, double* %4
br label %6
6: ; preds = %13, %2
%7 = call double (...) @quick_rand32()
%8 = fmul double %7, 0x3DF0000000100000
store double %8, double* %5
%9 = load double, double* %5
%10 = call double (...) @quick_rand32()
%11 = fadd double %9, %10
%12 = fmul double %11, 0x3DF0000000100000
store double %12, double* %5
br label %13
13: ; preds = %6
%14 = load double, double* %5
%15 = fcmp ogt double %14, 1.000000e+00
br i1 %15, label %6, label %16
16: ; preds = %13
%17 = load double, double* %3
%18 = load double, double* %5
%19 = load double, double* %4
%20 = load double, double* %3
%21 = fsub double %19, %20
%22 = call double @llvm.fmuladd.f64(double %18, double %21, double %17)
ret double %22
}

LLVM IR (-O2):
define double @quick_rand_range(double %0, double %1) {
br label %3
3: ; preds = %3, %2
%4 = tail call double (...) @quick_rand32()
%5 = fmul double %4, 0x3DF0000000100000
%6 = tail call double (...) @quick_rand32()
%7 = fadd double %5, %6
%8 = fmul double %7, 0x3DF0000000100000
%9 = fcmp ogt double %8, 1.000000e+00
br i1 %9, label %3, label %10
10: ; preds = %3
%11 = fsub double %1, %0
%12 = tail call double @llvm.fmuladd.f64(double %8, double %11, double %0)
ret double %12
}