void rotation_matrix_init(float r[][3]) {
  int i, j;
  for (i = 0; i < 3; ++i) {
    for (j = 0; j < 3; ++j) {
      if (i == j)
        r[i][i] = 1;
      else
        r[i][j] = 0;
    }
  }
}


x86 assembly (clang, -O0):
<rotation_matrix_init>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x3,-0xc(%rbp)
jge    119c <rotation_matrix_init+0x9c>
movl   $0x0,-0x10(%rbp)
cmpl   $0x3,-0x10(%rbp)
jge    1189 <rotation_matrix_init+0x89>
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jne    115b <rotation_matrix_init+0x5b>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
movslq -0xc(%rbp),%rcx
movss  0xeaf(%rip),%xmm0
movss  %xmm0,(%rax,%rcx,4)
jmp    1176 <rotation_matrix_init+0x76>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
movslq -0x10(%rbp),%rcx
xorps  %xmm0,%xmm0
movss  %xmm0,(%rax,%rcx,4)
jmp    117b <rotation_matrix_init+0x7b>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1120 <rotation_matrix_init+0x20>
jmp    118e <rotation_matrix_init+0x8e>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <rotation_matrix_init+0xf>
pop    %rbp
ret

x86 assembly (clang, -O2):
<rotation_matrix_init>:
movss  0xef8(%rip),%xmm0
movups %xmm0,(%rdi)
movups %xmm0,0x10(%rdi)
movl   $0x3f800000,0x20(%rdi)
ret

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

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