void Identity44(double a[4][4]) {
  int i, j;
  for (i = 0; i < 4; i++)
    for (j = 0; j < 4; j++)
      a[i][j] = (double)(i == j);
}


x86 assembly (clang, -O0):
<Identity44>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x4,-0xc(%rbp)
jge    1175 <Identity44+0x75>
movl   $0x0,-0x10(%rbp)
cmpl   $0x4,-0x10(%rbp)
jge    1162 <Identity44+0x62>
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
cvtsi2sd %eax,%xmm0
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
shl    $0x5,%rcx
add    %rcx,%rax
movslq -0x10(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1120 <Identity44+0x20>
jmp    1167 <Identity44+0x67>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <Identity44+0xf>
pop    %rbp
ret

x86 assembly (clang, -O2):
<Identity44>:
movabs $0x3ff0000000000000,%rax
mov    %rax,(%rdi)
xorps  %xmm0,%xmm0
movups %xmm0,0x8(%rdi)
movups %xmm0,0x18(%rdi)
mov    %rax,0x28(%rdi)
movups %xmm0,0x30(%rdi)
movups %xmm0,0x40(%rdi)
mov    %rax,0x50(%rdi)
movups %xmm0,0x58(%rdi)
movups %xmm0,0x68(%rdi)
mov    %rax,0x78(%rdi)
ret

LLVM IR (-O0):
define void @Identity44([4 x double]* %0) {
%2 = alloca [4 x double]*
%3 = alloca i32
%4 = alloca i32
store [4 x double]* %0, [4 x double]** %2
store i32 0, i32* %3
br label %5
5: ; preds = %29, %1
%6 = load i32, i32* %3
%7 = icmp slt i32 %6, 4
br i1 %7, label %8, label %32
8: ; preds = %5
store i32 0, i32* %4
br label %9
9: ; preds = %25, %8
%10 = load i32, i32* %4
%11 = icmp slt i32 %10, 4
br i1 %11, label %12, label %28
12: ; preds = %9
%13 = load i32, i32* %3
%14 = load i32, i32* %4
%15 = icmp eq i32 %13, %14
%16 = zext i1 %15 to i32
%17 = sitofp i32 %16 to double
%18 = load [4 x double]*, [4 x double]** %2
%19 = load i32, i32* %3
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds [4 x double], [4 x double]* %18, i64 %20
%22 = load i32, i32* %4
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [4 x double], [4 x double]* %21, i64 0, i64 %23
store double %17, double* %24
br label %25
25: ; preds = %12
%26 = load i32, i32* %4
%27 = add nsw i32 %26, 1
store i32 %27, i32* %4
br label %9
28: ; preds = %9
br label %29
29: ; preds = %28
%30 = load i32, i32* %3
%31 = add nsw i32 %30, 1
store i32 %31, i32* %3
br label %5
32: ; preds = %5
ret void
}

LLVM IR (-O2):
define void @Identity44([4 x double]* nocapture writeonly %0) {
%2 = getelementptr inbounds [4 x double], [4 x double]* %0, i64 0, i64 0
store double 1.000000e+00, double* %2
%3 = getelementptr inbounds [4 x double], [4 x double]* %0, i64 0, i64 1
%4 = getelementptr inbounds [4 x double], [4 x double]* %0, i64 1, i64 1
%5 = bitcast double* %3 to i8*
store double 1.000000e+00, double* %4
%6 = getelementptr inbounds [4 x double], [4 x double]* %0, i64 1, i64 2
%7 = getelementptr inbounds [4 x double], [4 x double]* %0, i64 2, i64 2
%8 = bitcast double* %6 to i8*
store double 1.000000e+00, double* %7
%9 = getelementptr inbounds [4 x double], [4 x double]* %0, i64 2, i64 3
%10 = getelementptr inbounds [4 x double], [4 x double]* %0, i64 3, i64 3
%11 = bitcast double* %9 to i8*
store double 1.000000e+00, double* %10
ret void
}