#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 rand_range(int, int);
int /*<<< orphan*/ srand(int);
int main(int argc, char const **argv) {
  srand(4);
  double a1 = rand_range(-1, 1);
  double a2 = rand_range(0, 1);
  double a3 = rand_range(-3, -5);
  double a4 = rand_range(31, 35);
  printf("%.3f\n", a1);
  printf("%.3f\n", a2);
  printf("%.3f\n", a3);
  printf("%.3f\n", a4);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x4,%edi
call   1040 <srand@plt>
mov    $0xffffffff,%edi
mov    $0x1,%esi
call   1050 <rand_range@plt>
movsd  %xmm0,-0x18(%rbp)
xor    %edi,%edi
mov    $0x1,%esi
call   1050 <rand_range@plt>
movsd  %xmm0,-0x20(%rbp)
mov    $0xfffffffd,%edi
mov    $0xfffffffb,%esi
call   1050 <rand_range@plt>
movsd  %xmm0,-0x28(%rbp)
mov    $0x1f,%edi
mov    $0x23,%esi
call   1050 <rand_range@plt>
movsd  %xmm0,-0x30(%rbp)
movsd  -0x18(%rbp),%xmm0
lea    0xe57(%rip),%rdi
call   1030 <printf@plt>
movsd  -0x20(%rbp),%xmm0
lea    0xe46(%rip),%rdi
call   1030 <printf@plt>
movsd  -0x28(%rbp),%xmm0
lea    0xe35(%rip),%rdi
call   1030 <printf@plt>
movsd  -0x30(%rbp),%xmm0
lea    0xe24(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
mov    $0x4,%edi
call   1040 <srand@plt>
mov    $0xffffffff,%edi
mov    $0x1,%esi
call   1050 <rand_range@plt>
movsd  %xmm0,0x18(%rsp)
xor    %edi,%edi
mov    $0x1,%esi
call   1050 <rand_range@plt>
movsd  %xmm0,0x10(%rsp)
mov    $0xfffffffd,%edi
mov    $0xfffffffb,%esi
call   1050 <rand_range@plt>
movsd  %xmm0,0x8(%rsp)
mov    $0x1f,%edi
mov    $0x23,%esi
call   1050 <rand_range@plt>
movsd  %xmm0,(%rsp)
lea    0xe6a(%rip),%rbx
mov    %rbx,%rdi
movsd  0x18(%rsp),%xmm0
call   1030 <printf@plt>
mov    %rbx,%rdi
movsd  0x10(%rsp),%xmm0
call   1030 <printf@plt>
mov    %rbx,%rdi
movsd  0x8(%rsp),%xmm0
call   1030 <printf@plt>
mov    %rbx,%rdi
movsd  (%rsp),%xmm0
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%.3f\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = call i32 @srand(i32 4)
%11 = call double @rand_range(i32 -1, i32 1)
store double %11, double* %6
%12 = call double @rand_range(i32 0, i32 1)
store double %12, double* %7
%13 = call double @rand_range(i32 -3, i32 -5)
store double %13, double* %8
%14 = call double @rand_range(i32 31, i32 35)
store double %14, double* %9
%15 = load double, double* %6
%16 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %15)
%17 = load double, double* %7
%18 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %17)
%19 = load double, double* %8
%20 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %19)
%21 = load double, double* %9
%22 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %21)
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"%.3f\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @srand(i32 4)
%4 = tail call double @rand_range(i32 -1, i32 1)
%5 = tail call double @rand_range(i32 0, i32 1)
%6 = tail call double @rand_range(i32 -3, i32 -5)
%7 = tail call double @rand_range(i32 31, i32 35)
%8 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %4)
%9 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %5)
%10 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %6)
%11 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %7)
ret i32 0
}