void mat3_eye(double M[3][3]) {
  M[0][0] = 1.;
  M[0][1] = 0.;
  M[0][2] = 0.;
  M[1][0] = 0.;
  M[1][1] = 1.;
  M[1][2] = 0.;
  M[2][0] = 0.;
  M[2][1] = 0.;
  M[2][2] = 1.;
}


x86 assembly (clang, -O0):
<mat3_eye>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsd  0xeec(%rip),%xmm0
movsd  %xmm0,(%rax)
mov    -0x8(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,0x8(%rax)
mov    -0x8(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,0x10(%rax)
mov    -0x8(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,0x18(%rax)
mov    -0x8(%rbp),%rax
movsd  0xeb8(%rip),%xmm0
movsd  %xmm0,0x20(%rax)
mov    -0x8(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,0x28(%rax)
mov    -0x8(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,0x30(%rax)
mov    -0x8(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,0x38(%rax)
mov    -0x8(%rbp),%rax
movsd  0xe83(%rip),%xmm0
movsd  %xmm0,0x40(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<mat3_eye>:
movabs $0x3ff0000000000000,%rax
mov    %rax,(%rdi)
xorps  %xmm0,%xmm0
movups %xmm0,0x8(%rdi)
movq   $0x0,0x18(%rdi)
mov    %rax,0x20(%rdi)
movups %xmm0,0x28(%rdi)
movq   $0x0,0x38(%rdi)
mov    %rax,0x40(%rdi)
ret

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

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