#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 */
float drand48();
void fillrandom(float *matrix) {
  int i, j;
  for (i = 0; i < 20530; i++) {
    for (j = 0; j < 4000; j++) {
      matrix[i * 4000 + j] = drand48();
    }
  }
}


x86 assembly (clang, -O0):
<fillrandom>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x5032,-0xc(%rbp)
jge    1182 <fillrandom+0x72>
movl   $0x0,-0x10(%rbp)
cmpl   $0xfa0,-0x10(%rbp)
jge    116f <fillrandom+0x5f>
mov    $0x0,%al
call   1030 <drand48@plt>
mov    -0x8(%rbp),%rax
imul   $0xfa0,-0xc(%rbp),%ecx
add    -0x10(%rbp),%ecx
movslq %ecx,%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1137 <fillrandom+0x27>
jmp    1174 <fillrandom+0x64>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <fillrandom+0x13>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fillrandom>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r15
xor    %r14d,%r14d
nopl   0x0(%rax,%rax,1)
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xor    %eax,%eax
call   1030 <drand48@plt>
movss  %xmm0,(%r15,%rbx,4)
add    $0x1,%rbx
cmp    $0xfa0,%rbx
jne    1130 <fillrandom+0x20>
add    $0x1,%r14
add    $0x3e80,%r15
cmp    $0x5032,%r14
jne    1120 <fillrandom+0x10>
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @fillrandom(float* nocapture writeonly %0) {
br label %2
2: ; preds = %1, %12
%3 = phi i64 [ 0, %1 ], [ %13, %12 ]
%4 = mul nuw nsw i64 %3, 4000
br label %5
5: ; preds = %2, %5
%6 = phi i64 [ 0, %2 ], [ %10, %5 ]
%7 = tail call float (...) @drand48()
%8 = add nuw nsw i64 %6, %4
%9 = getelementptr inbounds float, float* %0, i64 %8
store float %7, float* %9
%10 = add nuw nsw i64 %6, 1
%11 = icmp eq i64 %10, 4000
br i1 %11, label %12, label %5
12: ; preds = %5
%13 = add nuw nsw i64 %3, 1
%14 = icmp eq i64 %13, 20530
br i1 %14, label %15, label %2
15: ; preds = %12
ret void
}