#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__ fRand(double, double);
int /*<<< orphan*/ srand(int);
void initializeArray2D(float *arr, int len, int seed) {
  int i;
  float randNum;
  srand(seed);
  for (i = 0; i < len * len; i++) {
    randNum = (float)fRand((double)(0.0), (double)(100.0));
    arr[i] = randNum;
  }
}


x86 assembly (clang, -O0):
<initializeArray2D>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x10(%rbp),%edi
call   1030 <srand@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0xc(%rbp),%ecx
imul   -0xc(%rbp),%ecx
cmp    %ecx,%eax
jge    118d <initializeArray2D+0x6d>
xorps  %xmm0,%xmm0
movsd  0xea2(%rip),%xmm1
call   1040 <fRand@plt>
cvtsi2ss %rax,%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x18(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1141 <initializeArray2D+0x21>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<initializeArray2D>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%ebp
mov    %rdi,%r14
mov    %edx,%edi
call   1030 <srand@plt>
imul   %ebp,%ebp
test   %ebp,%ebp
je     1167 <initializeArray2D+0x47>
mov    %ebp,%ebp
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
xorps  %xmm0,%xmm0
movsd  0xeb5(%rip),%xmm1
call   1040 <fRand@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %rax,%xmm0
movss  %xmm0,(%r14,%rbx,4)
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1140 <initializeArray2D+0x20>
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @initializeArray2D(float* %0, i32 %1, i32 %2) {
%4 = alloca float*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca float
store float* %0, float** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%9 = load i32, i32* %6
%10 = call i32 @srand(i32 %9)
store i32 0, i32* %7
br label %11
11: ; preds = %25, %3
%12 = load i32, i32* %7
%13 = load i32, i32* %5
%14 = load i32, i32* %5
%15 = mul nsw i32 %13, %14
%16 = icmp slt i32 %12, %15
br i1 %16, label %17, label %28
17: ; preds = %11
%18 = call i64 @fRand(double 0.000000e+00, double 1.000000e+02)
%19 = sitofp i64 %18 to float
store float %19, float* %8
%20 = load float, float* %8
%21 = load float*, float** %4
%22 = load i32, i32* %7
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds float, float* %21, i64 %23
store float %20, float* %24
br label %25
25: ; preds = %17
%26 = load i32, i32* %7
%27 = add nsw i32 %26, 1
store i32 %27, i32* %7
br label %11
28: ; preds = %11
ret void
}

LLVM IR (-O2):
define void @initializeArray2D(float* nocapture writeonly %0, i32 %1, i32 %2) {
%4 = tail call i32 @srand(i32 %2)
%5 = mul i32 %1, %1
%6 = icmp eq i32 %5, 0
br i1 %6, label %16, label %7
7: ; preds = %3
%8 = zext i32 %5 to i64
br label %9
9: ; preds = %7, %9
%10 = phi i64 [ 0, %7 ], [ %14, %9 ]
%11 = tail call i64 @fRand(double 0.000000e+00, double 1.000000e+02)
%12 = sitofp i64 %11 to float
%13 = getelementptr inbounds float, float* %0, i64 %10
store float %12, float* %13
%14 = add nuw nsw i64 %10, 1
%15 = icmp eq i64 %14, %8
br i1 %15, label %16, label %9
16: ; preds = %9, %3
ret void
}