#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 */
scalar_t__ RAND_MAX;
float random();
int /*<<< orphan*/ srandom(int /*<<< orphan*/);
void Gen_data(float min_meas, float max_meas, float data[], int data_count) {
  int i;
  srandom(0);
  for (i = 0; i < data_count; i++)
    data[i] = min_meas + (max_meas - min_meas) * random() / ((double)RAND_MAX);
}


x86 assembly (clang, -O0):
<Gen_data>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
xor    %edi,%edi
call   1030 <srandom@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11bf <Gen_data+0x9f>
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
movss  -0x8(%rbp),%xmm0
subss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x24(%rbp)
mov    $0x0,%al
call   1040 <random@plt>
movss  -0x24(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x20(%rbp),%xmm0
mulss  %xmm2,%xmm1
cvtss2sd %xmm1,%xmm1
mov    0x2e55(%rip),%rax
cvtsi2sdq (%rax),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1147 <Gen_data+0x27>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Gen_data>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %esi,%ebp
mov    %rdi,%r15
movss  %xmm1,0x8(%rsp)
movss  %xmm0,0xc(%rsp)
xor    %edi,%edi
call   1030 <srandom@plt>
test   %ebp,%ebp
jle    11b6 <Gen_data+0x96>
movss  0xc(%rsp),%xmm1
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
movsd  %xmm0,0x10(%rsp)
movss  0x8(%rsp),%xmm0
subss  %xmm1,%xmm0
movss  %xmm0,0x8(%rsp)
mov    %ebp,%ebp
mov    0x2e76(%rip),%r14
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
xor    %eax,%eax
call   1040 <random@plt>
mulss  0x8(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
xorps  %xmm1,%xmm1
cvtsi2sdq (%r14),%xmm1
divsd  %xmm1,%xmm0
addsd  0x10(%rsp),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,(%r15,%rbx,4)
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1180 <Gen_data+0x60>
add    $0x18,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@RAND_MAX = global i64 0
define void @Gen_data(float %0, float %1, float* %2, i32 %3) {
%5 = alloca float
%6 = alloca float
%7 = alloca float*
%8 = alloca i32
%9 = alloca i32
store float %0, float* %5
store float %1, float* %6
store float* %2, float** %7
store i32 %3, i32* %8
%10 = call i32 @srandom(i32 0)
store i32 0, i32* %9
br label %11
11: ; preds = %33, %4
%12 = load i32, i32* %9
%13 = load i32, i32* %8
%14 = icmp slt i32 %12, %13
br i1 %14, label %15, label %36
15: ; preds = %11
%16 = load float, float* %5
%17 = fpext float %16 to double
%18 = load float, float* %6
%19 = load float, float* %5
%20 = fsub float %18, %19
%21 = call float (...) @random()
%22 = fmul float %20, %21
%23 = fpext float %22 to double
%24 = load i64, i64* @RAND_MAX
%25 = sitofp i64 %24 to double
%26 = fdiv double %23, %25
%27 = fadd double %17, %26
%28 = fptrunc double %27 to float
%29 = load float*, float** %7
%30 = load i32, i32* %9
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds float, float* %29, i64 %31
store float %28, float* %32
br label %33
33: ; preds = %15
%34 = load i32, i32* %9
%35 = add nsw i32 %34, 1
store i32 %35, i32* %9
br label %11
36: ; preds = %11
ret void
}

LLVM IR (-O2):
@RAND_MAX = global i64 0
define void @Gen_data(float %0, float %1, float* nocapture writeonly %2, i32 %3) {
%5 = tail call i32 @srandom(i32 0)
%6 = icmp sgt i32 %3, 0
br i1 %6, label %7, label %24
7: ; preds = %4
%8 = fpext float %0 to double
%9 = fsub float %1, %0
%10 = zext i32 %3 to i64
br label %11
11: ; preds = %7, %11
%12 = phi i64 [ 0, %7 ], [ %22, %11 ]
%13 = tail call float (...) @random()
%14 = fmul float %9, %13
%15 = fpext float %14 to double
%16 = load i64, i64* @RAND_MAX
%17 = sitofp i64 %16 to double
%18 = fdiv double %15, %17
%19 = fadd double %18, %8
%20 = fptrunc double %19 to float
%21 = getelementptr inbounds float, float* %2, i64 %12
store float %20, float* %21
%22 = add nuw nsw i64 %12, 1
%23 = icmp eq i64 %22, %10
br i1 %23, label %24, label %11
24: ; preds = %11, %4
ret void
}