void _matrix_3x3_mul_constant(float m[3][3], float a) {
  int i;
  for (i = 0; i < 3; ++i) {
    int j;
    for (j = 0; j < 3; ++j) {
      m[i][j] = a * m[i][j];
    }
  }
}


x86 assembly (clang, -O0):
<_matrix_3x3_mul_constant>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movss  %xmm0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0x3,-0x10(%rbp)
jge    1185 <_matrix_3x3_mul_constant+0x85>
movl   $0x0,-0x14(%rbp)
cmpl   $0x3,-0x14(%rbp)
jge    1172 <_matrix_3x3_mul_constant+0x72>
movss  -0xc(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
movslq -0x14(%rbp),%rcx
mulss  (%rax,%rcx,4),%xmm0
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
movslq -0x14(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1125 <_matrix_3x3_mul_constant+0x25>
jmp    1177 <_matrix_3x3_mul_constant+0x77>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1114 <_matrix_3x3_mul_constant+0x14>
pop    %rbp
ret

x86 assembly (clang, -O2):
<_matrix_3x3_mul_constant>:
movaps %xmm0,%xmm1
shufps $0x0,%xmm0,%xmm1
movups (%rdi),%xmm2
movups 0x10(%rdi),%xmm3
mulps  %xmm1,%xmm2
movups %xmm2,(%rdi)
mulps  %xmm1,%xmm3
movups %xmm3,0x10(%rdi)
mulss  0x20(%rdi),%xmm0
movss  %xmm0,0x20(%rdi)
ret

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

LLVM IR (-O2):
define void @_matrix_3x3_mul_constant([3 x float]* nocapture %0, float %1) {
%3 = bitcast [3 x float]* %0 to <4 x float>*
%4 = load <4 x float>, <4 x float>* %3
%5 = insertelement <4 x float> poison, float %1, i64 0
%6 = shufflevector <4 x float> %5, <4 x float> poison, <4 x i32> zeroinitializer
%7 = fmul <4 x float> %4, %6
%8 = bitcast [3 x float]* %0 to <4 x float>*
store <4 x float> %7, <4 x float>* %8
%9 = getelementptr inbounds [3 x float], [3 x float]* %0, i64 1, i64 1
%10 = bitcast float* %9 to <4 x float>*
%11 = load <4 x float>, <4 x float>* %10
%12 = fmul <4 x float> %11, %6
%13 = bitcast float* %9 to <4 x float>*
store <4 x float> %12, <4 x float>* %13
%14 = getelementptr inbounds [3 x float], [3 x float]* %0, i64 2, i64 2
%15 = load float, float* %14
%16 = fmul float %15, %1
store float %16, float* %14
ret void
}