void identmatrix(float (*a)[4]) {
  float *p;
  for (p = (float *)a; p != (float *)a + 16; p++)
    *p = 0;
  a[0][0] = a[1][1] = a[2][2] = a[3][3] = 1;
}


x86 assembly (clang, -O0):
<identmatrix>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rcx
add    $0x40,%rcx
cmp    %rcx,%rax
je     1141 <identmatrix+0x41>
mov    -0x10(%rbp),%rax
xorps  %xmm0,%xmm0
movss  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x10(%rbp)
jmp    1110 <identmatrix+0x10>
mov    -0x8(%rbp),%rax
movss  0xeb3(%rip),%xmm0
movss  %xmm0,0x3c(%rax)
mov    -0x8(%rbp),%rax
movss  0xea2(%rip),%xmm0
movss  %xmm0,0x28(%rax)
mov    -0x8(%rbp),%rax
movss  0xe91(%rip),%xmm0
movss  %xmm0,0x14(%rax)
mov    -0x8(%rbp),%rax
movss  0xe80(%rip),%xmm0
movss  %xmm0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<identmatrix>:
xorps  %xmm0,%xmm0
movups %xmm0,0x24(%rdi)
movups %xmm0,0x14(%rdi)
movups %xmm0,0x4(%rdi)
movq   $0x0,0x34(%rdi)
movl   $0x3f800000,0x3c(%rdi)
movl   $0x3f800000,0x28(%rdi)
movl   $0x3f800000,0x14(%rdi)
movl   $0x3f800000,(%rdi)
ret

LLVM IR (-O0):
define void @identmatrix([4 x float]* %0) {
%2 = alloca [4 x float]*
%3 = alloca float*
store [4 x float]* %0, [4 x float]** %2
%4 = load [4 x float]*, [4 x float]** %2
%5 = bitcast [4 x float]* %4 to float*
store float* %5, float** %3
br label %6
6: ; preds = %14, %1
%7 = load float*, float** %3
%8 = load [4 x float]*, [4 x float]** %2
%9 = bitcast [4 x float]* %8 to float*
%10 = getelementptr inbounds float, float* %9, i64 16
%11 = icmp ne float* %7, %10
br i1 %11, label %12, label %17
12: ; preds = %6
%13 = load float*, float** %3
store float 0.000000e+00, float* %13
br label %14
14: ; preds = %12
%15 = load float*, float** %3
%16 = getelementptr inbounds float, float* %15, i32 1
store float* %16, float** %3
br label %6
17: ; preds = %6
%18 = load [4 x float]*, [4 x float]** %2
%19 = getelementptr inbounds [4 x float], [4 x float]* %18, i64 3
%20 = getelementptr inbounds [4 x float], [4 x float]* %19, i64 0, i64 3
store float 1.000000e+00, float* %20
%21 = load [4 x float]*, [4 x float]** %2
%22 = getelementptr inbounds [4 x float], [4 x float]* %21, i64 2
%23 = getelementptr inbounds [4 x float], [4 x float]* %22, i64 0, i64 2
store float 1.000000e+00, float* %23
%24 = load [4 x float]*, [4 x float]** %2
%25 = getelementptr inbounds [4 x float], [4 x float]* %24, i64 1
%26 = getelementptr inbounds [4 x float], [4 x float]* %25, i64 0, i64 1
store float 1.000000e+00, float* %26
%27 = load [4 x float]*, [4 x float]** %2
%28 = getelementptr inbounds [4 x float], [4 x float]* %27, i64 0
%29 = getelementptr inbounds [4 x float], [4 x float]* %28, i64 0, i64 0
store float 1.000000e+00, float* %29
ret void
}

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