void RmatIdentity(float (*rmat)[3]) {
  int i;
  int j;
  {
    j = 0;
    while (j < 3) {
      i = 0;
      while (i < 3) {
        if (i == j) {
          (*(rmat + j))[i] = (float)1.0;
        } else {
          (*(rmat + j))[i] = (float)0.0;
        }
        i++;
      }
      j++;
    }
    return;
  }
}


x86 assembly (clang, -O0):
<RmatIdentity>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0x3,-0x10(%rbp)
jge    1192 <RmatIdentity+0x92>
movl   $0x0,-0xc(%rbp)
cmpl   $0x3,-0xc(%rbp)
jge    1184 <RmatIdentity+0x84>
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jne    115b <RmatIdentity+0x5b>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
movslq -0xc(%rbp),%rcx
movss  0xeaf(%rip),%xmm0
movss  %xmm0,(%rax,%rcx,4)
jmp    1176 <RmatIdentity+0x76>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
movslq -0xc(%rbp),%rcx
xorps  %xmm0,%xmm0
movss  %xmm0,(%rax,%rcx,4)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1120 <RmatIdentity+0x20>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    110f <RmatIdentity+0xf>
pop    %rbp
ret

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

LLVM IR (-O0):
define void @RmatIdentity([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* %4
br label %5
5: ; preds = %35, %1
%6 = load i32, i32* %4
%7 = icmp slt i32 %6, 3
br i1 %7, label %8, label %38
8: ; preds = %5
store i32 0, i32* %3
br label %9
9: ; preds = %32, %8
%10 = load i32, i32* %3
%11 = icmp slt i32 %10, 3
br i1 %11, label %12, label %35
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* %4
%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* %4
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [3 x float], [3 x float]* %25, i64 %27
%29 = load i32, i32* %3
%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
%33 = load i32, i32* %3
%34 = add nsw i32 %33, 1
store i32 %34, i32* %3
br label %9
35: ; preds = %9
%36 = load i32, i32* %4
%37 = add nsw i32 %36, 1
store i32 %37, i32* %4
br label %5
38: ; preds = %5
ret void
}

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