void init_data(int n, int m, double B[n][m]) {
  int i, j;
  for (i = 0; i < n; i++)
    for (j = 0; j < m; j++)
      B[i][j] = 2.0;
}


x86 assembly (clang, -O0):
<init_data>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1184 <init_data+0x84>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1171 <init_data+0x71>
mov    -0x20(%rbp),%rdx
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
imul   %rdx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
movslq -0x18(%rbp),%rcx
movsd  0xea2(%rip),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    112f <init_data+0x2f>
jmp    1176 <init_data+0x76>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    111c <init_data+0x1c>
pop    %rbp
ret

x86 assembly (clang, -O2):
<init_data>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
test   %edi,%edi
jle    1262 <init_data+0x162>
mov    %esi,%eax
mov    %edi,%r14d
mov    %eax,%r11d
and    $0xfffffffc,%r11d
lea    -0x4(%r11),%r8
mov    %r8,%r9
shr    $0x2,%r9
add    $0x1,%r9
mov    %r9d,%r10d
and    $0x7,%r10d
and    $0xfffffffffffffff8,%r9
lea    0xf0(%rdx),%rdi
lea    0x0(,%rax,8),%r15
mov    %r10,%r12
shl    $0x5,%r12
xor    %r13d,%r13d
movabs $0x4000000000000000,%rcx
movaps 0xe9e(%rip),%xmm0
jmp    1183 <init_data+0x83>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0x1,%r13
add    %r15,%rdi
add    %r15,%rdx
cmp    %r14,%r13
je     1262 <init_data+0x162>
test   %esi,%esi
jle    1170 <init_data+0x70>
cmp    $0x4,%esi
jae    11a0 <init_data+0xa0>
xor    %ebx,%ebx
jmp    1250 <init_data+0x150>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
cmp    $0x1c,%r8
jae    11aa <init_data+0xaa>
xor    %ebx,%ebx
jmp    121e <init_data+0x11e>
mov    %r9,%rbp
xor    %ebx,%ebx
nop
movups %xmm0,-0xf0(%rdi,%rbx,8)
ff
movups %xmm0,-0xe0(%rdi,%rbx,8)
ff
movups %xmm0,-0xd0(%rdi,%rbx,8)
ff
movups %xmm0,-0xc0(%rdi,%rbx,8)
ff
movups %xmm0,-0xb0(%rdi,%rbx,8)
ff
movups %xmm0,-0xa0(%rdi,%rbx,8)
ff
movups %xmm0,-0x90(%rdi,%rbx,8)
ff
movups %xmm0,-0x80(%rdi,%rbx,8)
movups %xmm0,-0x70(%rdi,%rbx,8)
movups %xmm0,-0x60(%rdi,%rbx,8)
movups %xmm0,-0x50(%rdi,%rbx,8)
movups %xmm0,-0x40(%rdi,%rbx,8)
movups %xmm0,-0x30(%rdi,%rbx,8)
movups %xmm0,-0x20(%rdi,%rbx,8)
movups %xmm0,-0x10(%rdi,%rbx,8)
movups %xmm0,(%rdi,%rbx,8)
add    $0x20,%rbx
add    $0xfffffffffffffff8,%rbp
jne    11b0 <init_data+0xb0>
test   %r10,%r10
je     1242 <init_data+0x142>
lea    (%rdx,%rbx,8),%rbx
xor    %ebp,%ebp
nopl   0x0(%rax)
movups %xmm0,(%rbx,%rbp,1)
movups %xmm0,0x10(%rbx,%rbp,1)
add    $0x20,%rbp
cmp    %rbp,%r12
jne    1230 <init_data+0x130>
mov    %r11,%rbx
cmp    %rax,%r11
je     1170 <init_data+0x70>
xchg   %ax,%ax
mov    %rcx,(%rdx,%rbx,8)
add    $0x1,%rbx
cmp    %rbx,%rax
jne    1250 <init_data+0x150>
jmp    1170 <init_data+0x70>
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @init_data(i32 %0, i32 %1, double* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca double*
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store double* %2, double** %6
%9 = load i32, i32* %4
%10 = zext i32 %9 to i64
%11 = load i32, i32* %5
%12 = zext i32 %11 to i64
store i32 0, i32* %7
br label %13
13: ; preds = %35, %3
%14 = load i32, i32* %7
%15 = load i32, i32* %4
%16 = icmp slt i32 %14, %15
br i1 %16, label %17, label %38
17: ; preds = %13
store i32 0, i32* %8
br label %18
18: ; preds = %31, %17
%19 = load i32, i32* %8
%20 = load i32, i32* %5
%21 = icmp slt i32 %19, %20
br i1 %21, label %22, label %34
22: ; preds = %18
%23 = load double*, double** %6
%24 = load i32, i32* %7
%25 = sext i32 %24 to i64
%26 = mul nsw i64 %25, %12
%27 = getelementptr inbounds double, double* %23, i64 %26
%28 = load i32, i32* %8
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds double, double* %27, i64 %29
store double 2.000000e+00, double* %30
br label %31
31: ; preds = %22
%32 = load i32, i32* %8
%33 = add nsw i32 %32, 1
store i32 %33, i32* %8
br label %18
34: ; preds = %18
br label %35
35: ; preds = %34
%36 = load i32, i32* %7
%37 = add nsw i32 %36, 1
store i32 %37, i32* %7
br label %13
38: ; preds = %13
ret void
}

LLVM IR (-O2):
define void @init_data(i32 %0, i32 %1, double* nocapture writeonly %2) {
%4 = zext i32 %1 to i64
%5 = icmp sgt i32 %0, 0
br i1 %5, label %6, label %94
6: ; preds = %3
%7 = icmp sgt i32 %1, 0
%8 = zext i32 %0 to i64
%9 = and i64 %4, 4294967292
%10 = add nsw i64 %9, -4
%11 = lshr exact i64 %10, 2
%12 = add nuw nsw i64 %11, 1
%13 = icmp ult i32 %1, 4
%14 = and i64 %4, 4294967292
%15 = and i64 %12, 7
%16 = icmp ult i64 %10, 28
%17 = and i64 %12, 9223372036854775800
%18 = icmp eq i64 %15, 0
%19 = icmp eq i64 %14, %4
br label %20
20: ; preds = %6, %91
%21 = phi i64 [ 0, %6 ], [ %92, %91 ]
br i1 %7, label %22, label %91
22: ; preds = %20
%23 = mul nuw nsw i64 %21, %4
%24 = getelementptr inbounds double, double* %2, i64 %23
br i1 %13, label %84, label %25
25: ; preds = %22
br i1 %16, label %71, label %26
26: ; preds = %25, %26
%27 = phi i64 [ %68, %26 ], [ 0, %25 ]
%28 = phi i64 [ %69, %26 ], [ 0, %25 ]
%29 = getelementptr inbounds double, double* %24, i64 %27
%30 = bitcast double* %29 to <2 x double>*
store <2 x double> <double 2.000000e+00, double 2.000000e+00>, <2 x double>* %30
%31 = getelementptr inbounds double, double* %29, i64 2
%32 = bitcast double* %31 to <2 x double>*
store <2 x double> <double 2.000000e+00, double 2.000000e+00>, <2 x double>* %32
%33 = or i64 %27, 4
%34 = getelementptr inbounds double, double* %24, i64 %33
%35 = bitcast double* %34 to <2 x double>*
store <2 x double> <double 2.000000e+00, double 2.000000e+00>, <2 x double>* %35
%36 = getelementptr inbounds double, double* %34, i64 2
%37 = bitcast double* %36 to <2 x double>*
store <2 x double> <double 2.000000e+00, double 2.000000e+00>, <2 x double>* %37
%38 = or i64 %27, 8
%39 = getelementptr inbounds double, double* %24, i64 %38
%40 = bitcast double* %39 to <2 x double>*
store <2 x double> <double 2.000000e+00, double 2.000000e+00>, <2 x double>* %40
%41 = getelementptr inbounds double, double* %39, i64 2
%42 = bitcast double* %41 to <2 x double>*
store <2 x double> <double 2.000000e+00, double 2.000000e+00>, <2 x double>* %42
%43 = or i64 %27, 12
%44 = getelementptr inbounds double, double* %24, i64 %43
%45 = bitcast double* %44 to <2 x double>*
store <2 x double> <double 2.000000e+00, double 2.000000e+00>, <2 x double>* %45
%46 = getelementptr inbounds double, double* %44, i64 2
%47 = bitcast double* %46 to <2 x double>*
store <2 x double> <double 2.000000e+00, double 2.000000e+00>, <2 x double>* %47
%48 = or i64 %27, 16
%49 = getelementptr inbounds double, double* %24, i64 %48
%50 = bitcast double* %49 to <2 x double>*
store <2 x double> <double 2.000000e+00, double 2.000000e+00>, <2 x double>* %50
%51 = getelementptr inbounds double, double* %49, i64 2
%52 = bitcast double* %51 to <2 x double>*
store <2 x double> <double 2.000000e+00, double 2.000000e+00>, <2 x double>* %52
%53 = or i64 %27, 20
%54 = getelementptr inbounds double, double* %24, i64 %53
%55 = bitcast double* %54 to <2 x double>*
store <2 x double> <double 2.000000e+00, double 2.000000e+00>, <2 x double>* %55
%56 = getelementptr inbounds double, double* %54, i64 2
%57 = bitcast double* %56 to <2 x double>*
store <2 x double> <double 2.000000e+00, double 2.000000e+00>, <2 x double>* %57
%58 = or i64 %27, 24
%59 = getelementptr inbounds double, double* %24, i64 %58
%60 = bitcast double* %59 to <2 x double>*
store <2 x double> <double 2.000000e+00, double 2.000000e+00>, <2 x double>* %60
%61 = getelementptr inbounds double, double* %59, i64 2
%62 = bitcast double* %61 to <2 x double>*
store <2 x double> <double 2.000000e+00, double 2.000000e+00>, <2 x double>* %62
%63 = or i64 %27, 28
%64 = getelementptr inbounds double, double* %24, i64 %63
%65 = bitcast double* %64 to <2 x double>*
store <2 x double> <double 2.000000e+00, double 2.000000e+00>, <2 x double>* %65
%66 = getelementptr inbounds double, double* %64, i64 2
%67 = bitcast double* %66 to <2 x double>*
store <2 x double> <double 2.000000e+00, double 2.000000e+00>, <2 x double>* %67
%68 = add nuw i64 %27, 32
%69 = add i64 %28, 8
%70 = icmp eq i64 %69, %17
br i1 %70, label %71, label %26
71: ; preds = %26, %25
%72 = phi i64 [ 0, %25 ], [ %68, %26 ]
br i1 %18, label %83, label %73
73: ; preds = %71, %73
%74 = phi i64 [ %80, %73 ], [ %72, %71 ]
%75 = phi i64 [ %81, %73 ], [ 0, %71 ]
%76 = getelementptr inbounds double, double* %24, i64 %74
%77 = bitcast double* %76 to <2 x double>*
store <2 x double> <double 2.000000e+00, double 2.000000e+00>, <2 x double>* %77
%78 = getelementptr inbounds double, double* %76, i64 2
%79 = bitcast double* %78 to <2 x double>*
store <2 x double> <double 2.000000e+00, double 2.000000e+00>, <2 x double>* %79
%80 = add nuw i64 %74, 4
%81 = add i64 %75, 1
%82 = icmp eq i64 %81, %15
br i1 %82, label %83, label %73
83: ; preds = %73, %71
br i1 %19, label %91, label %84
84: ; preds = %22, %83
%85 = phi i64 [ 0, %22 ], [ %14, %83 ]
br label %86
86: ; preds = %84, %86
%87 = phi i64 [ %89, %86 ], [ %85, %84 ]
%88 = getelementptr inbounds double, double* %24, i64 %87
store double 2.000000e+00, double* %88
%89 = add nuw nsw i64 %87, 1
%90 = icmp eq i64 %89, %4
br i1 %90, label %91, label %86
91: ; preds = %86, %83, %20
%92 = add nuw nsw i64 %21, 1
%93 = icmp eq i64 %92, %8
br i1 %93, label %94, label %20
94: ; preds = %91, %3
ret void
}