#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
typedef int /*<<< orphan*/ matB;
typedef int /*<<< orphan*/ matA;

/* Variables and functions */
int /*<<< orphan*/ memcpy(float *, float const *, int);
void babl_matrix_mul_matrixf(const float *matA_, const float *matB_,
                             float *out) {
  int i, j;
  float matA[9];
  float matB[9];
  float t1, t2, t3;
  memcpy(matA, matA_, sizeof(matA));
  memcpy(matB, matB_, sizeof(matB));
  for (i = 0; i < 3; i++) {
    t1 = matA[i * 3 + 0];
    t2 = matA[i * 3 + 1];
    t3 = matA[i * 3 + 2];
    for (j = 0; j < 3; j++) {
      out[i * 3 + j] = t1 * matB[0 * 3 + j];
      out[i * 3 + j] += t2 * matB[1 * 3 + j];
      out[i * 3 + j] += t3 * matB[2 * 3 + j];
    }
  }
}


x86 assembly (clang, -O0):
<babl_matrix_mul_matrixf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
lea    -0x50(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    $0x24,%edx
call   1030 <memcpy@plt>
lea    -0x80(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x24,%edx
call   1030 <memcpy@plt>
movl   $0x0,-0x1c(%rbp)
cmpl   $0x3,-0x1c(%rbp)
jge    1268 <babl_matrix_mul_matrixf+0x158>
imul   $0x3,-0x1c(%rbp),%eax
add    $0x0,%eax
cltq
movss  -0x50(%rbp,%rax,4),%xmm0
movss  %xmm0,-0x84(%rbp)
ff
imul   $0x3,-0x1c(%rbp),%eax
add    $0x1,%eax
cltq
movss  -0x50(%rbp,%rax,4),%xmm0
movss  %xmm0,-0x88(%rbp)
ff
imul   $0x3,-0x1c(%rbp),%eax
add    $0x2,%eax
cltq
movss  -0x50(%rbp,%rax,4),%xmm0
movss  %xmm0,-0x8c(%rbp)
ff
movl   $0x0,-0x20(%rbp)
cmpl   $0x3,-0x20(%rbp)
jge    1255 <babl_matrix_mul_matrixf+0x145>
movss  -0x84(%rbp),%xmm0
ff
mov    -0x20(%rbp),%eax
add    $0x0,%eax
cltq
mulss  -0x80(%rbp,%rax,4),%xmm0
mov    -0x18(%rbp),%rax
imul   $0x3,-0x1c(%rbp),%ecx
add    -0x20(%rbp),%ecx
movslq %ecx,%rcx
movss  %xmm0,(%rax,%rcx,4)
movss  -0x88(%rbp),%xmm0
ff
mov    -0x20(%rbp),%eax
add    $0x3,%eax
cltq
movss  -0x80(%rbp,%rax,4),%xmm2
mov    -0x18(%rbp),%rax
imul   $0x3,-0x1c(%rbp),%ecx
add    -0x20(%rbp),%ecx
movslq %ecx,%rcx
movss  (%rax,%rcx,4),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,(%rax,%rcx,4)
movss  -0x8c(%rbp),%xmm0
ff
mov    -0x20(%rbp),%eax
add    $0x6,%eax
cltq
movss  -0x80(%rbp,%rax,4),%xmm2
mov    -0x18(%rbp),%rax
imul   $0x3,-0x1c(%rbp),%ecx
add    -0x20(%rbp),%ecx
movslq %ecx,%rcx
movss  (%rax,%rcx,4),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,(%rax,%rcx,4)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    11a8 <babl_matrix_mul_matrixf+0x98>
jmp    125a <babl_matrix_mul_matrixf+0x14a>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1152 <babl_matrix_mul_matrixf+0x42>
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<babl_matrix_mul_matrixf>:
push   %r14
push   %rbx
sub    $0x58,%rsp
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %rdi,%rsi
mov    %rsp,%rdi
mov    $0x24,%edx
call   1030 <memcpy@plt>
lea    0x30(%rsp),%rdi
mov    %rbx,%rsi
mov    $0x24,%edx
call   1030 <memcpy@plt>
movsd  0x34(%rsp),%xmm11
movsd  0x40(%rsp),%xmm13
movsd  0x4c(%rsp),%xmm14
movss  0xc(%rsp),%xmm8
movaps %xmm8,%xmm1
unpcklpd (%rsp),%xmm1
shufps $0x2a,%xmm1,%xmm1
movss  0x30(%rsp),%xmm5
movaps %xmm5,%xmm6
movaps %xmm11,%xmm9
movlhps %xmm5,%xmm9
movlhps %xmm11,%xmm5
shufps $0xd4,%xmm11,%xmm6
shufps $0x28,%xmm6,%xmm5
mulps  %xmm1,%xmm5
movss  0x10(%rsp),%xmm12
movaps %xmm12,%xmm6
movhps 0x4(%rsp),%xmm6
shufps $0x2a,%xmm6,%xmm6
movss  0x3c(%rsp),%xmm3
movaps %xmm3,%xmm7
movaps %xmm13,%xmm10
movlhps %xmm3,%xmm10
movlhps %xmm13,%xmm3
shufps $0xd4,%xmm13,%xmm7
shufps $0x28,%xmm7,%xmm3
mulps  %xmm6,%xmm3
addps  %xmm5,%xmm3
movss  0x14(%rsp),%xmm5
movaps %xmm5,%xmm6
movhps 0x8(%rsp),%xmm6
shufps $0x2a,%xmm6,%xmm6
movss  0x48(%rsp),%xmm7
movaps %xmm7,%xmm2
movaps %xmm14,%xmm1
movlhps %xmm7,%xmm1
movlhps %xmm14,%xmm7
shufps $0xd4,%xmm14,%xmm2
shufps $0x28,%xmm2,%xmm7
mulps  %xmm6,%xmm7
addps  %xmm3,%xmm7
movups %xmm7,(%r14)
movss  0x18(%rsp),%xmm2
movss  0x1c(%rsp),%xmm3
movss  0x20(%rsp),%xmm6
shufps $0x0,%xmm2,%xmm8
movaps %xmm11,%xmm7
shufps $0x55,%xmm11,%xmm7
shufps $0x24,%xmm9,%xmm11
mulps  %xmm8,%xmm11
shufps $0x0,%xmm3,%xmm12
movaps %xmm13,%xmm0
shufps $0x55,%xmm13,%xmm0
shufps $0x24,%xmm10,%xmm13
mulps  %xmm12,%xmm13
addps  %xmm11,%xmm13
shufps $0x0,%xmm6,%xmm5
movaps %xmm14,%xmm4
shufps $0x55,%xmm14,%xmm4
shufps $0x24,%xmm1,%xmm14
mulps  %xmm5,%xmm14
addps  %xmm13,%xmm14
movups %xmm14,0x10(%r14)
mulss  %xmm2,%xmm7
mulss  %xmm3,%xmm0
addss  %xmm7,%xmm0
mulss  %xmm6,%xmm4
addss  %xmm0,%xmm4
movss  %xmm4,0x20(%r14)
add    $0x58,%rsp
pop    %rbx
pop    %r14
ret

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

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