#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();
int /*<<< orphan*/ srand48(int);
void initialize_matrix(float *m) {
  int i, j;
  srand48(1);
  for (j = 0; j < 2000; j++) {
    for (i = 0; i < 800; i++) {
      m[i + j * 800] = drand48();
    }
  }
}


x86 assembly (clang, -O0):
<initialize_matrix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x1,%edi
call   1030 <srand48@plt>
movl   $0x0,-0x10(%rbp)
cmpl   $0x7d0,-0x10(%rbp)
jge    119e <initialize_matrix+0x7e>
movl   $0x0,-0xc(%rbp)
cmpl   $0x320,-0xc(%rbp)
jge    118b <initialize_matrix+0x6b>
mov    $0x0,%al
call   1040 <drand48@plt>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
imul   $0x320,-0x10(%rbp),%edx
add    %edx,%ecx
movslq %ecx,%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1151 <initialize_matrix+0x31>
jmp    1190 <initialize_matrix+0x70>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    113d <initialize_matrix+0x1d>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<initialize_matrix>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r15
mov    $0x1,%edi
call   1030 <srand48@plt>
xor    %r14d,%r14d
cs nopw 0x0(%rax,%rax,1)
nop
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xor    %eax,%eax
call   1040 <drand48@plt>
movss  %xmm0,(%r15,%rbx,4)
add    $0x1,%rbx
cmp    $0x320,%rbx
jne    1150 <initialize_matrix+0x30>
add    $0x1,%r14
add    $0xc80,%r15
cmp    $0x7d0,%r14
jne    1140 <initialize_matrix+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

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

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