#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);
int /*<<< orphan*/ puts(char *);
double randDouble(double, double);
int /*<<< orphan*/ srand(int);
void test2() {
  int i;
  puts("Test2: Random double between -1.5 and 2.3");
  srand(1245);
  for (i = 0; i < 5; i++)
    printf("%.4f\n", randDouble(-1.5, 2.3));
}


x86 assembly (clang, -O0):
<test2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
call   1030 <puts@plt>
mov    $0x4dd,%edi
call   1060 <srand@plt>
movl   $0x0,-0x4(%rbp)
cmpl   $0x5,-0x4(%rbp)
jge    119e <test2+0x5e>
movsd  0xe89(%rip),%xmm0
movsd  0xe89(%rip),%xmm1
call   1050 <randDouble@plt>
lea    0xeaf(%rip),%rdi
call   1040 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1165 <test2+0x25>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test2>:
push   %rbx
lea    0xec8(%rip),%rdi
call   1030 <puts@plt>
mov    $0x4dd,%edi
call   1060 <srand@plt>
movsd  0xea1(%rip),%xmm0
movsd  0xea1(%rip),%xmm1
call   1050 <randDouble@plt>
lea    0xec7(%rip),%rbx
mov    %rbx,%rdi
call   1040 <printf@plt>
movsd  0xe7d(%rip),%xmm0
movsd  0xe7d(%rip),%xmm1
call   1050 <randDouble@plt>
mov    %rbx,%rdi
call   1040 <printf@plt>
movsd  0xe60(%rip),%xmm0
movsd  0xe60(%rip),%xmm1
call   1050 <randDouble@plt>
mov    %rbx,%rdi
call   1040 <printf@plt>
movsd  0xe43(%rip),%xmm0
movsd  0xe43(%rip),%xmm1
call   1050 <randDouble@plt>
mov    %rbx,%rdi
call   1040 <printf@plt>
movsd  0xe26(%rip),%xmm0
movsd  0xe26(%rip),%xmm1
call   1050 <randDouble@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [42 x i8] c"Test2: Random double between -1.5 and 2.3\00"
@.str.1 = [6 x i8] c"%.4f\0A\00"
define void @test2() {
%1 = alloca i32
%2 = call i32 @puts(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @srand(i32 1245)
store i32 0, i32* %1
br label %4
4: ; preds = %10, %0
%5 = load i32, i32* %1
%6 = icmp slt i32 %5, 5
br i1 %6, label %7, label %13
7: ; preds = %4
%8 = call double @randDouble(double -1.500000e+00, double 2.300000e+00)
%9 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), double %8)
br label %10
10: ; preds = %7
%11 = load i32, i32* %1
%12 = add nsw i32 %11, 1
store i32 %12, i32* %1
br label %4
13: ; preds = %4
ret void
}

LLVM IR (-O2):
@.str = [42 x i8] c"Test2: Random double between -1.5 and 2.3\00"
@.str.1 = [6 x i8] c"%.4f\0A\00"
define void @test2() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @srand(i32 1245)
%3 = tail call double @randDouble(double -1.500000e+00, double 2.300000e+00)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), double %3)
%5 = tail call double @randDouble(double -1.500000e+00, double 2.300000e+00)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), double %5)
%7 = tail call double @randDouble(double -1.500000e+00, double 2.300000e+00)
%8 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), double %7)
%9 = tail call double @randDouble(double -1.500000e+00, double 2.300000e+00)
%10 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), double %9)
%11 = tail call double @randDouble(double -1.500000e+00, double 2.300000e+00)
%12 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), double %11)
ret void
}