#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 (j = 0; j < 700; j++) {
    for (i = 0; i < 400; i++) {
      m[i + j * 400] = drand48();
    }
  }
}


x86 assembly (clang, -O0):
<initialize_matrix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0x2bc,-0x10(%rbp)
jge    1184 <initialize_matrix+0x74>
movl   $0x0,-0xc(%rbp)
cmpl   $0x190,-0xc(%rbp)
jge    1171 <initialize_matrix+0x61>
mov    $0x0,%al
call   1030 <drand48@plt>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
imul   $0x190,-0x10(%rbp),%edx
add    %edx,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1137 <initialize_matrix+0x27>
jmp    1176 <initialize_matrix+0x66>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%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)
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xor    %eax,%eax
call   1030 <drand48@plt>
movsd  %xmm0,(%r15,%rbx,8)
add    $0x1,%rbx
cmp    $0x190,%rbx
jne    1130 <initialize_matrix+0x20>
add    $0x1,%r14
add    $0xc80,%r15
cmp    $0x2bc,%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* %4
br label %5
5: ; preds = %25, %1
%6 = load i32, i32* %4
%7 = icmp slt i32 %6, 700
br i1 %7, label %8, label %28
8: ; preds = %5
store i32 0, i32* %3
br label %9
9: ; preds = %21, %8
%10 = load i32, i32* %3
%11 = icmp slt i32 %10, 400
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, 400
%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* %3
%23 = add nsw i32 %22, 1
store i32 %23, i32* %3
br label %9
24: ; preds = %9
br label %25
25: ; preds = %24
%26 = load i32, i32* %4
%27 = add nsw i32 %26, 1
store i32 %27, i32* %4
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 ]
%4 = mul nuw nsw i64 %3, 400
br label %5
5: ; preds = %2, %5
%6 = phi i64 [ 0, %2 ], [ %10, %5 ]
%7 = tail call double (...) @drand48()
%8 = add nuw nsw i64 %6, %4
%9 = getelementptr inbounds double, double* %0, i64 %8
store double %7, double* %9
%10 = add nuw nsw i64 %6, 1
%11 = icmp eq i64 %10, 400
br i1 %11, label %12, label %5
12: ; preds = %5
%13 = add nuw nsw i64 %3, 1
%14 = icmp eq i64 %13, 700
br i1 %14, label %15, label %2
15: ; preds = %12
ret void
}