#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 */
double drand48();
void initialize_matrix(double *m) {
  int i, j;
  for (i = 0; i < 8000; i++) {
    for (j = 0; j < 7000; j++) {
      m[i + j * 8000] = drand48();
    }
  }
}


x86 assembly (clang, -O0):
<initialize_matrix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x1f40,-0xc(%rbp)
jge    1184 <initialize_matrix+0x74>
movl   $0x0,-0x10(%rbp)
cmpl   $0x1b58,-0x10(%rbp)
jge    1171 <initialize_matrix+0x61>
mov    $0x0,%al
call   1030 <drand48@plt>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
imul   $0x1f40,-0x10(%rbp),%edx
add    %edx,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1137 <initialize_matrix+0x27>
jmp    1176 <initialize_matrix+0x66>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <initialize_matrix+0x13>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<initialize_matrix>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r15
xor    %r14d,%r14d
nopl   0x0(%rax,%rax,1)
mov    $0xffffffffe54c1000,%rbx
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <drand48@plt>
movsd  %xmm0,0x1ab3f000(%r15,%rbx,1)
f0 b3 1a
add    $0xfa00,%rbx
jne    1130 <initialize_matrix+0x20>
add    $0x1,%r14
add    $0x8,%r15
cmp    $0x1f40,%r14
jne    1120 <initialize_matrix+0x10>
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @initialize_matrix(double* %0) {
%2 = alloca double*
%3 = alloca i32
%4 = alloca i32
store double* %0, double** %2
store i32 0, i32* %3
br label %5
5: ; preds = %25, %1
%6 = load i32, i32* %3
%7 = icmp slt i32 %6, 8000
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, 7000
br i1 %11, label %12, label %24
12: ; preds = %9
%13 = call double (...) @drand48()
%14 = load double*, double** %2
%15 = load i32, i32* %3
%16 = load i32, i32* %4
%17 = mul nsw i32 %16, 8000
%18 = add nsw i32 %15, %17
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds double, double* %14, i64 %19
store double %13, double* %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 @initialize_matrix(double* nocapture writeonly %0) {
br label %2
2: ; preds = %1, %12
%3 = phi i64 [ 0, %1 ], [ %13, %12 ]
br label %4
4: ; preds = %2, %4
%5 = phi i64 [ 0, %2 ], [ %10, %4 ]
%6 = tail call double (...) @drand48()
%7 = mul nuw nsw i64 %5, 8000
%8 = add nuw nsw i64 %7, %3
%9 = getelementptr inbounds double, double* %0, i64 %8
store double %6, double* %9
%10 = add nuw nsw i64 %5, 1
%11 = icmp eq i64 %10, 7000
br i1 %11, label %12, label %4
12: ; preds = %4
%13 = add nuw nsw i64 %3, 1
%14 = icmp eq i64 %13, 8000
br i1 %14, label %15, label %2
15: ; preds = %12
ret void
}