void multMatrix(float dst[16], const float src1[16], const float src2[16]) {
  float tmp[16];
  int i, j;
  for (i = 0; i < 4; i++) {
    for (j = 0; j < 4; j++) {
      tmp[i * 4 + j] = src1[i * 4 + 0] * src2[0 * 4 + j] +
                       src1[i * 4 + 1] * src2[1 * 4 + j] +
                       src1[i * 4 + 2] * src2[2 * 4 + j] +
                       src1[i * 4 + 3] * src2[3 * 4 + j];
    }
  }
  for (i = 0; i < 16; i++)
    dst[i] = tmp[i];
}


x86 assembly (clang, -O0):
<multMatrix>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x64(%rbp)
cmpl   $0x4,-0x64(%rbp)
jge    1218 <multMatrix+0x118>
movl   $0x0,-0x68(%rbp)
cmpl   $0x4,-0x68(%rbp)
jge    1205 <multMatrix+0x105>
mov    -0x10(%rbp),%rax
mov    -0x64(%rbp),%ecx
shl    $0x2,%ecx
add    $0x0,%ecx
movslq %ecx,%rcx
movss  (%rax,%rcx,4),%xmm0
mov    -0x18(%rbp),%rax
mov    -0x68(%rbp),%ecx
add    $0x0,%ecx
movslq %ecx,%rcx
movss  (%rax,%rcx,4),%xmm2
mov    -0x10(%rbp),%rax
mov    -0x64(%rbp),%ecx
shl    $0x2,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movss  (%rax,%rcx,4),%xmm1
mov    -0x18(%rbp),%rax
mov    -0x68(%rbp),%ecx
add    $0x4,%ecx
movslq %ecx,%rcx
mulss  (%rax,%rcx,4),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
mov    -0x64(%rbp),%ecx
shl    $0x2,%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movss  (%rax,%rcx,4),%xmm1
mov    -0x18(%rbp),%rax
mov    -0x68(%rbp),%ecx
add    $0x8,%ecx
movslq %ecx,%rcx
movss  (%rax,%rcx,4),%xmm2
mulss  %xmm2,%xmm1
addss  %xmm0,%xmm1
mov    -0x10(%rbp),%rax
mov    -0x64(%rbp),%ecx
shl    $0x2,%ecx
add    $0x3,%ecx
movslq %ecx,%rcx
movss  (%rax,%rcx,4),%xmm0
mov    -0x18(%rbp),%rax
mov    -0x68(%rbp),%ecx
add    $0xc,%ecx
movslq %ecx,%rcx
movss  (%rax,%rcx,4),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
mov    -0x64(%rbp),%eax
shl    $0x2,%eax
add    -0x68(%rbp),%eax
cltq
movss  %xmm0,-0x60(%rbp,%rax,4)
mov    -0x68(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x68(%rbp)
jmp    1128 <multMatrix+0x28>
jmp    120a <multMatrix+0x10a>
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
jmp    1117 <multMatrix+0x17>
movl   $0x0,-0x64(%rbp)
cmpl   $0x10,-0x64(%rbp)
jge    124e <multMatrix+0x14e>
movslq -0x64(%rbp),%rax
movss  -0x60(%rbp,%rax,4),%xmm0
mov    -0x8(%rbp),%rax
movslq -0x64(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
jmp    121f <multMatrix+0x11f>
pop    %rbp
ret

x86 assembly (clang, -O2):
<multMatrix>:
movups (%rsi),%xmm8
movups 0x10(%rsi),%xmm0
movups 0x20(%rsi),%xmm5
movups 0x30(%rsi),%xmm6
movaps %xmm6,%xmm3
movlhps %xmm5,%xmm3
movaps %xmm8,%xmm1
unpcklps %xmm0,%xmm1
shufps $0x24,%xmm3,%xmm1
movaps %xmm5,%xmm3
unpcklps %xmm6,%xmm3
movaps %xmm0,%xmm4
shufps $0x11,%xmm8,%xmm4
shufps $0xe2,%xmm3,%xmm4
movaps %xmm6,%xmm7
unpckhpd %xmm5,%xmm7
movaps %xmm8,%xmm3
unpckhps %xmm0,%xmm3
shufps $0x24,%xmm7,%xmm3
movss  (%rdx),%xmm7
unpckhps %xmm6,%xmm5
movss  0x4(%rdx),%xmm2
shufps $0x33,%xmm8,%xmm0
movss  0x8(%rdx),%xmm6
shufps $0x0,%xmm6,%xmm6
shufps $0x0,%xmm2,%xmm2
shufps $0x0,%xmm7,%xmm7
shufps $0xe2,%xmm5,%xmm0
movss  0x10(%rdx),%xmm5
shufps $0x0,%xmm5,%xmm5
mulps  %xmm4,%xmm5
mulps  %xmm1,%xmm7
addps  %xmm5,%xmm7
movss  0x20(%rdx),%xmm5
shufps $0x0,%xmm5,%xmm5
mulps  %xmm3,%xmm5
addps  %xmm7,%xmm5
movss  0x30(%rdx),%xmm8
shufps $0x0,%xmm8,%xmm8
mulps  %xmm0,%xmm8
addps  %xmm5,%xmm8
movss  0x14(%rdx),%xmm5
shufps $0x0,%xmm5,%xmm5
mulps  %xmm4,%xmm5
mulps  %xmm1,%xmm2
addps  %xmm5,%xmm2
movss  0x24(%rdx),%xmm7
shufps $0x0,%xmm7,%xmm7
mulps  %xmm3,%xmm7
addps  %xmm2,%xmm7
movss  0x34(%rdx),%xmm5
shufps $0x0,%xmm5,%xmm5
mulps  %xmm0,%xmm5
addps  %xmm7,%xmm5
movss  0x18(%rdx),%xmm2
shufps $0x0,%xmm2,%xmm2
mulps  %xmm4,%xmm2
mulps  %xmm1,%xmm6
addps  %xmm2,%xmm6
movss  0x28(%rdx),%xmm2
shufps $0x0,%xmm2,%xmm2
mulps  %xmm3,%xmm2
addps  %xmm6,%xmm2
movss  0x38(%rdx),%xmm6
shufps $0x0,%xmm6,%xmm6
mulps  %xmm0,%xmm6
addps  %xmm2,%xmm6
movss  0x1c(%rdx),%xmm2
shufps $0x0,%xmm2,%xmm2
mulps  %xmm2,%xmm4
movss  0xc(%rdx),%xmm2
shufps $0x0,%xmm2,%xmm2
mulps  %xmm2,%xmm1
movss  0x3c(%rdx),%xmm2
shufps $0x0,%xmm2,%xmm2
addps  %xmm4,%xmm1
movss  0x2c(%rdx),%xmm4
shufps $0x0,%xmm4,%xmm4
mulps  %xmm4,%xmm3
addps  %xmm1,%xmm3
mulps  %xmm2,%xmm0
addps  %xmm3,%xmm0
movaps %xmm0,%xmm1
movlhps %xmm6,%xmm1
movaps %xmm8,%xmm2
unpcklps %xmm5,%xmm2
shufps $0x24,%xmm1,%xmm2
movaps %xmm6,%xmm1
unpcklps %xmm0,%xmm1
movaps %xmm5,%xmm3
shufps $0x11,%xmm8,%xmm3
shufps $0xe2,%xmm1,%xmm3
movaps %xmm0,%xmm1
unpckhpd %xmm6,%xmm1
movaps %xmm8,%xmm4
unpckhps %xmm5,%xmm4
shufps $0x24,%xmm1,%xmm4
unpckhps %xmm0,%xmm6
shufps $0x33,%xmm8,%xmm5
shufps $0xe2,%xmm6,%xmm5
movaps %xmm5,-0x18(%rsp)
movaps %xmm4,-0x28(%rsp)
movaps %xmm3,-0x38(%rsp)
movaps %xmm2,-0x48(%rsp)
movaps -0x18(%rsp),%xmm0
movups %xmm0,0x30(%rdi)
movaps -0x28(%rsp),%xmm0
movups %xmm0,0x20(%rdi)
movaps -0x38(%rsp),%xmm0
movups %xmm0,0x10(%rdi)
movaps -0x48(%rsp),%xmm0
movups %xmm0,(%rdi)
ret

LLVM IR (-O0):
define void @multMatrix(float* %0, float* %1, float* %2) {
%4 = alloca float*
%5 = alloca float*
%6 = alloca float*
%7 = alloca [16 x float]
%8 = alloca i32
%9 = alloca i32
store float* %0, float** %4
store float* %1, float** %5
store float* %2, float** %6
store i32 0, i32* %8
br label %10
10: ; preds = %84, %3
%11 = load i32, i32* %8
%12 = icmp slt i32 %11, 4
br i1 %12, label %13, label %87
13: ; preds = %10
store i32 0, i32* %9
br label %14
14: ; preds = %80, %13
%15 = load i32, i32* %9
%16 = icmp slt i32 %15, 4
br i1 %16, label %17, label %83
17: ; preds = %14
%18 = load float*, float** %5
%19 = load i32, i32* %8
%20 = mul nsw i32 %19, 4
%21 = add nsw i32 %20, 0
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds float, float* %18, i64 %22
%24 = load float, float* %23
%25 = load float*, float** %6
%26 = load i32, i32* %9
%27 = add nsw i32 0, %26
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds float, float* %25, i64 %28
%30 = load float, float* %29
%31 = load float*, float** %5
%32 = load i32, i32* %8
%33 = mul nsw i32 %32, 4
%34 = add nsw i32 %33, 1
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds float, float* %31, i64 %35
%37 = load float, float* %36
%38 = load float*, float** %6
%39 = load i32, i32* %9
%40 = add nsw i32 4, %39
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds float, float* %38, i64 %41
%43 = load float, float* %42
%44 = fmul float %37, %43
%45 = call float @llvm.fmuladd.f32(float %24, float %30, float %44)
%46 = load float*, float** %5
%47 = load i32, i32* %8
%48 = mul nsw i32 %47, 4
%49 = add nsw i32 %48, 2
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds float, float* %46, i64 %50
%52 = load float, float* %51
%53 = load float*, float** %6
%54 = load i32, i32* %9
%55 = add nsw i32 8, %54
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds float, float* %53, i64 %56
%58 = load float, float* %57
%59 = call float @llvm.fmuladd.f32(float %52, float %58, float %45)
%60 = load float*, float** %5
%61 = load i32, i32* %8
%62 = mul nsw i32 %61, 4
%63 = add nsw i32 %62, 3
%64 = sext i32 %63 to i64
%65 = getelementptr inbounds float, float* %60, i64 %64
%66 = load float, float* %65
%67 = load float*, float** %6
%68 = load i32, i32* %9
%69 = add nsw i32 12, %68
%70 = sext i32 %69 to i64
%71 = getelementptr inbounds float, float* %67, i64 %70
%72 = load float, float* %71
%73 = call float @llvm.fmuladd.f32(float %66, float %72, float %59)
%74 = load i32, i32* %8
%75 = mul nsw i32 %74, 4
%76 = load i32, i32* %9
%77 = add nsw i32 %75, %76
%78 = sext i32 %77 to i64
%79 = getelementptr inbounds [16 x float], [16 x float]* %7, i64 0, i64 %78
store float %73, float* %79
br label %80
80: ; preds = %17
%81 = load i32, i32* %9
%82 = add nsw i32 %81, 1
store i32 %82, i32* %9
br label %14
83: ; preds = %14
br label %84
84: ; preds = %83
%85 = load i32, i32* %8
%86 = add nsw i32 %85, 1
store i32 %86, i32* %8
br label %10
87: ; preds = %10
store i32 0, i32* %8
br label %88
88: ; preds = %100, %87
%89 = load i32, i32* %8
%90 = icmp slt i32 %89, 16
br i1 %90, label %91, label %103
91: ; preds = %88
%92 = load i32, i32* %8
%93 = sext i32 %92 to i64
%94 = getelementptr inbounds [16 x float], [16 x float]* %7, i64 0, i64 %93
%95 = load float, float* %94
%96 = load float*, float** %4
%97 = load i32, i32* %8
%98 = sext i32 %97 to i64
%99 = getelementptr inbounds float, float* %96, i64 %98
store float %95, float* %99
br label %100
100: ; preds = %91
%101 = load i32, i32* %8
%102 = add nsw i32 %101, 1
store i32 %102, i32* %8
br label %88
103: ; preds = %88
ret void
}

LLVM IR (-O2):
define void @multMatrix(float* nocapture writeonly %0, float* nocapture %1, float* nocapture %2) {
%4 = alloca <16 x float>
%5 = bitcast <16 x float>* %4 to i8*
%6 = getelementptr inbounds float, float* %2, i64 15
%7 = load float, float* %6
%8 = insertelement <4 x float> poison, float %7, i64 0
%9 = shufflevector <4 x float> %8, <4 x float> poison, <4 x i32> zeroinitializer
%10 = getelementptr inbounds float, float* %2, i64 11
%11 = load float, float* %10
%12 = insertelement <4 x float> poison, float %11, i64 0
%13 = shufflevector <4 x float> %12, <4 x float> poison, <4 x i32> zeroinitializer
%14 = getelementptr inbounds float, float* %2, i64 3
%15 = load float, float* %14
%16 = insertelement <4 x float> poison, float %15, i64 0
%17 = shufflevector <4 x float> %16, <4 x float> poison, <4 x i32> zeroinitializer
%18 = getelementptr inbounds float, float* %2, i64 7
%19 = load float, float* %18
%20 = insertelement <4 x float> poison, float %19, i64 0
%21 = shufflevector <4 x float> %20, <4 x float> poison, <4 x i32> zeroinitializer
%22 = getelementptr inbounds float, float* %2, i64 14
%23 = load float, float* %22
%24 = insertelement <4 x float> poison, float %23, i64 0
%25 = shufflevector <4 x float> %24, <4 x float> poison, <4 x i32> zeroinitializer
%26 = getelementptr inbounds float, float* %2, i64 10
%27 = load float, float* %26
%28 = insertelement <4 x float> poison, float %27, i64 0
%29 = shufflevector <4 x float> %28, <4 x float> poison, <4 x i32> zeroinitializer
%30 = getelementptr inbounds float, float* %2, i64 2
%31 = load float, float* %30
%32 = insertelement <4 x float> poison, float %31, i64 0
%33 = shufflevector <4 x float> %32, <4 x float> poison, <4 x i32> zeroinitializer
%34 = getelementptr inbounds float, float* %2, i64 6
%35 = load float, float* %34
%36 = insertelement <4 x float> poison, float %35, i64 0
%37 = shufflevector <4 x float> %36, <4 x float> poison, <4 x i32> zeroinitializer
%38 = getelementptr inbounds float, float* %2, i64 13
%39 = load float, float* %38
%40 = insertelement <4 x float> poison, float %39, i64 0
%41 = shufflevector <4 x float> %40, <4 x float> poison, <4 x i32> zeroinitializer
%42 = getelementptr inbounds float, float* %2, i64 9
%43 = load float, float* %42
%44 = insertelement <4 x float> poison, float %43, i64 0
%45 = shufflevector <4 x float> %44, <4 x float> poison, <4 x i32> zeroinitializer
%46 = getelementptr inbounds float, float* %2, i64 1
%47 = load float, float* %46
%48 = insertelement <4 x float> poison, float %47, i64 0
%49 = shufflevector <4 x float> %48, <4 x float> poison, <4 x i32> zeroinitializer
%50 = getelementptr inbounds float, float* %2, i64 5
%51 = load float, float* %50
%52 = insertelement <4 x float> poison, float %51, i64 0
%53 = shufflevector <4 x float> %52, <4 x float> poison, <4 x i32> zeroinitializer
%54 = getelementptr inbounds float, float* %2, i64 12
%55 = load float, float* %54
%56 = insertelement <4 x float> poison, float %55, i64 0
%57 = shufflevector <4 x float> %56, <4 x float> poison, <4 x i32> zeroinitializer
%58 = getelementptr inbounds float, float* %2, i64 8
%59 = load float, float* %58
%60 = insertelement <4 x float> poison, float %59, i64 0
%61 = shufflevector <4 x float> %60, <4 x float> poison, <4 x i32> zeroinitializer
%62 = load float, float* %2
%63 = insertelement <4 x float> poison, float %62, i64 0
%64 = shufflevector <4 x float> %63, <4 x float> poison, <4 x i32> zeroinitializer
%65 = getelementptr inbounds float, float* %2, i64 4
%66 = load float, float* %65
%67 = insertelement <4 x float> poison, float %66, i64 0
%68 = shufflevector <4 x float> %67, <4 x float> poison, <4 x i32> zeroinitializer
%69 = bitcast float* %1 to <16 x float>*
%70 = load <16 x float>, <16 x float>* %69
%71 = shufflevector <16 x float> %70, <16 x float> poison, <4 x i32> <i32 0, i32 4, i32 8, i32 12>
%72 = shufflevector <16 x float> %70, <16 x float> poison, <4 x i32> <i32 1, i32 5, i32 9, i32 13>
%73 = shufflevector <16 x float> %70, <16 x float> poison, <4 x i32> <i32 2, i32 6, i32 10, i32 14>
%74 = shufflevector <16 x float> %70, <16 x float> poison, <4 x i32> <i32 3, i32 7, i32 11, i32 15>
%75 = fmul <4 x float> %72, %68
%76 = call <4 x float> @llvm.fmuladd.v4f32(<4 x float> %71, <4 x float> %64, <4 x float> %75)
%77 = call <4 x float> @llvm.fmuladd.v4f32(<4 x float> %73, <4 x float> %61, <4 x float> %76)
%78 = call <4 x float> @llvm.fmuladd.v4f32(<4 x float> %74, <4 x float> %57, <4 x float> %77)
%79 = fmul <4 x float> %72, %53
%80 = call <4 x float> @llvm.fmuladd.v4f32(<4 x float> %71, <4 x float> %49, <4 x float> %79)
%81 = call <4 x float> @llvm.fmuladd.v4f32(<4 x float> %73, <4 x float> %45, <4 x float> %80)
%82 = call <4 x float> @llvm.fmuladd.v4f32(<4 x float> %74, <4 x float> %41, <4 x float> %81)
%83 = fmul <4 x float> %72, %37
%84 = call <4 x float> @llvm.fmuladd.v4f32(<4 x float> %71, <4 x float> %33, <4 x float> %83)
%85 = call <4 x float> @llvm.fmuladd.v4f32(<4 x float> %73, <4 x float> %29, <4 x float> %84)
%86 = call <4 x float> @llvm.fmuladd.v4f32(<4 x float> %74, <4 x float> %25, <4 x float> %85)
%87 = fmul <4 x float> %72, %21
%88 = call <4 x float> @llvm.fmuladd.v4f32(<4 x float> %71, <4 x float> %17, <4 x float> %87)
%89 = call <4 x float> @llvm.fmuladd.v4f32(<4 x float> %73, <4 x float> %13, <4 x float> %88)
%90 = call <4 x float> @llvm.fmuladd.v4f32(<4 x float> %74, <4 x float> %9, <4 x float> %89)
%91 = shufflevector <4 x float> %78, <4 x float> %82, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
%92 = shufflevector <4 x float> %86, <4 x float> %90, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
%93 = shufflevector <8 x float> %91, <8 x float> %92, <16 x i32> <i32 0, i32 4, i32 8, i32 12, i32 1, i32 5, i32 9, i32 13, i32 2, i32 6, i32 10, i32 14, i32 3, i32 7, i32 11, i32 15>
store <16 x float> %93, <16 x float>* %4
%94 = bitcast float* %0 to i8*
ret void
}