#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 */
typedef scalar_t__ RAND_MAX;

/* Variables and functions */
scalar_t__ rand();
double RandomWithIn(double a, double b) {
  double r;
  r = (double)rand() / ((double)(RAND_MAX) + (double)(1));
  return r * (((a) >= (b) ? (a) : (b)) - ((a) <= (b) ? (a) : (b))) +
         ((a) <= (b) ? (a) : (b));
}


x86 assembly (clang, -O0):
<RandomWithIn>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
mov    $0x0,%al
call   1030 <rand@plt>
cvtsi2sd %rax,%xmm0
movsd  0xeca(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x8(%rbp),%xmm0
ucomisd -0x10(%rbp),%xmm0
jb     1168 <RandomWithIn+0x58>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
jmp    1172 <RandomWithIn+0x62>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x8(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     119f <RandomWithIn+0x8f>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
jmp    11a9 <RandomWithIn+0x99>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x8(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     11df <RandomWithIn+0xcf>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
jmp    11e9 <RandomWithIn+0xd9>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x40(%rbp),%xmm2
movsd  -0x20(%rbp),%xmm0
movsd  -0x48(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<RandomWithIn>:
sub    $0x28,%rsp
movaps %xmm1,(%rsp)
movaps %xmm0,0x10(%rsp)
xor    %eax,%eax
call   1030 <rand@plt>
xorps  %xmm1,%xmm1
cvtsi2sd %rax,%xmm1
movapd (%rsp),%xmm4
movapd %xmm4,%xmm0
movapd 0x10(%rsp),%xmm3
cmplesd %xmm3,%xmm0
movapd %xmm0,%xmm2
andpd  %xmm3,%xmm2
andnpd %xmm4,%xmm0
orpd   %xmm2,%xmm0
movapd %xmm3,%xmm2
cmplesd %xmm4,%xmm2
andpd  %xmm2,%xmm3
andnpd %xmm4,%xmm2
orpd   %xmm3,%xmm2
subsd  %xmm2,%xmm0
mulsd  %xmm1,%xmm0
addsd  %xmm2,%xmm0
add    $0x28,%rsp
ret

LLVM IR (-O0):
define double @RandomWithIn(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
store double %0, double* %3
store double %1, double* %4
%6 = call i64 (...) @rand()
%7 = sitofp i64 %6 to double
%8 = fdiv double %7, 1.000000e+00
store double %8, double* %5
%9 = load double, double* %5
%10 = load double, double* %3
%11 = load double, double* %4
%12 = fcmp oge double %10, %11
br i1 %12, label %13, label %15
13: ; preds = %2
%14 = load double, double* %3
br label %17
15: ; preds = %2
%16 = load double, double* %4
br label %17
17: ; preds = %15, %13
%18 = phi double [ %14, %13 ], [ %16, %15 ]
%19 = load double, double* %3
%20 = load double, double* %4
%21 = fcmp ole double %19, %20
br i1 %21, label %22, label %24
22: ; preds = %17
%23 = load double, double* %3
br label %26
24: ; preds = %17
%25 = load double, double* %4
br label %26
26: ; preds = %24, %22
%27 = phi double [ %23, %22 ], [ %25, %24 ]
%28 = fsub double %18, %27
%29 = load double, double* %3
%30 = load double, double* %4
%31 = fcmp ole double %29, %30
br i1 %31, label %32, label %34
32: ; preds = %26
%33 = load double, double* %3
br label %36
34: ; preds = %26
%35 = load double, double* %4
br label %36
36: ; preds = %34, %32
%37 = phi double [ %33, %32 ], [ %35, %34 ]
%38 = call double @llvm.fmuladd.f64(double %9, double %28, double %37)
ret double %38
}

LLVM IR (-O2):
define double @RandomWithIn(double %0, double %1) {
%3 = tail call i64 (...) @rand()
%4 = sitofp i64 %3 to double
%5 = fcmp oge double %0, %1
%6 = select i1 %5, double %0, double %1
%7 = fcmp ole double %0, %1
%8 = select i1 %7, double %0, double %1
%9 = fsub double %6, %8
%10 = tail call double @llvm.fmuladd.f64(double %4, double %9, double %8)
ret double %10
}