#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 */

/* Variables and functions */
int /*<<< orphan*/ multiplyMatricies(float **, float **, float **);
void saturateMatrix(float matrix[4][4], float *saturation) {
  float sat = (*saturation);
  float mmatrix[4][4];
  float a, b, c, d, e, f, g, h, i;
  float rwgt, gwgt, bwgt;
  rwgt = (0.3086f);
  gwgt = (0.6094f);
  bwgt = (0.0820f);
  a = (1.0f - sat) * rwgt + sat;
  b = (1.0f - sat) * rwgt;
  c = (1.0f - sat) * rwgt;
  d = (1.0f - sat) * gwgt;
  e = (1.0f - sat) * gwgt + sat;
  f = (1.0f - sat) * gwgt;
  g = (1.0f - sat) * bwgt;
  h = (1.0f - sat) * bwgt;
  i = (1.0f - sat) * bwgt + sat;
  mmatrix[0][0] = a;
  mmatrix[0][1] = b;
  mmatrix[0][2] = c;
  mmatrix[0][3] = 0.0f;
  mmatrix[1][0] = d;
  mmatrix[1][1] = e;
  mmatrix[1][2] = f;
  mmatrix[1][3] = 0.0f;
  mmatrix[2][0] = g;
  mmatrix[2][1] = h;
  mmatrix[2][2] = i;
  mmatrix[2][3] = 0.0f;
  mmatrix[3][0] = 0.0f;
  mmatrix[3][1] = 0.0f;
  mmatrix[3][2] = 0.0f;
  mmatrix[3][3] = 1.0f;
  multiplyMatricies(mmatrix, matrix, matrix);
}


x86 assembly (clang, -O0):
<saturateMatrix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  0xed4(%rip),%xmm0
movss  %xmm0,-0x88(%rbp)
ff
movss  0xec0(%rip),%xmm0
movss  %xmm0,-0x8c(%rbp)
ff
movss  0xeac(%rip),%xmm0
movss  %xmm0,-0x90(%rbp)
ff
movss  0xe98(%rip),%xmm0
subss  -0x14(%rbp),%xmm0
movss  -0x88(%rbp),%xmm2
ff
movss  -0x14(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x64(%rbp)
movss  0xe71(%rip),%xmm0
subss  -0x14(%rbp),%xmm0
mulss  -0x88(%rbp),%xmm0
ff
movss  %xmm0,-0x68(%rbp)
movss  0xe57(%rip),%xmm0
subss  -0x14(%rbp),%xmm0
mulss  -0x88(%rbp),%xmm0
ff
movss  %xmm0,-0x6c(%rbp)
movss  0xe3d(%rip),%xmm0
subss  -0x14(%rbp),%xmm0
mulss  -0x8c(%rbp),%xmm0
ff
movss  %xmm0,-0x70(%rbp)
movss  0xe23(%rip),%xmm0
subss  -0x14(%rbp),%xmm0
movss  -0x8c(%rbp),%xmm2
ff
movss  -0x14(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x74(%rbp)
movss  0xdfc(%rip),%xmm0
subss  -0x14(%rbp),%xmm0
mulss  -0x8c(%rbp),%xmm0
ff
movss  %xmm0,-0x78(%rbp)
movss  0xde2(%rip),%xmm0
subss  -0x14(%rbp),%xmm0
mulss  -0x90(%rbp),%xmm0
ff
movss  %xmm0,-0x7c(%rbp)
movss  0xdc8(%rip),%xmm0
subss  -0x14(%rbp),%xmm0
mulss  -0x90(%rbp),%xmm0
ff
movss  %xmm0,-0x80(%rbp)
movss  0xdae(%rip),%xmm0
subss  -0x14(%rbp),%xmm0
movss  -0x90(%rbp),%xmm2
ff
movss  -0x14(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x84(%rbp)
ff
movss  -0x64(%rbp),%xmm0
movss  %xmm0,-0x60(%rbp)
movss  -0x68(%rbp),%xmm0
movss  %xmm0,-0x5c(%rbp)
movss  -0x6c(%rbp),%xmm0
movss  %xmm0,-0x58(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x54(%rbp)
movss  -0x70(%rbp),%xmm0
movss  %xmm0,-0x50(%rbp)
movss  -0x74(%rbp),%xmm0
movss  %xmm0,-0x4c(%rbp)
movss  -0x78(%rbp),%xmm0
movss  %xmm0,-0x48(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x44(%rbp)
movss  -0x7c(%rbp),%xmm0
movss  %xmm0,-0x40(%rbp)
movss  -0x80(%rbp),%xmm0
movss  %xmm0,-0x3c(%rbp)
movss  -0x84(%rbp),%xmm0
ff
movss  %xmm0,-0x38(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x34(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x30(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x2c(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x28(%rbp)
movss  0xcf7(%rip),%xmm0
movss  %xmm0,-0x24(%rbp)
lea    -0x60(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x8(%rbp),%rdx
call   1030 <multiplyMatricies@plt>
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<saturateMatrix>:
sub    $0x48,%rsp
mov    %rdi,%rdx
movss  (%rsi),%xmm0
movss  0xedd(%rip),%xmm1
subss  %xmm0,%xmm1
movss  0xed5(%rip),%xmm2
mulss  %xmm1,%xmm2
movaps %xmm2,%xmm3
addss  %xmm0,%xmm3
movss  0xec6(%rip),%xmm4
mulss  %xmm1,%xmm4
movaps %xmm4,%xmm5
mulss  0xebb(%rip),%xmm1
addss  %xmm0,%xmm5
addss  %xmm1,%xmm0
movss  %xmm3,(%rsp)
movss  %xmm2,0x4(%rsp)
movss  %xmm2,0x8(%rsp)
movl   $0x0,0xc(%rsp)
movss  %xmm4,0x10(%rsp)
movss  %xmm5,0x14(%rsp)
movss  %xmm4,0x18(%rsp)
movl   $0x0,0x1c(%rsp)
movss  %xmm1,0x20(%rsp)
movss  %xmm1,0x24(%rsp)
movss  %xmm0,0x28(%rsp)
xorps  %xmm0,%xmm0
movups %xmm0,0x2c(%rsp)
movl   $0x3f800000,0x3c(%rsp)
3f
mov    %rsp,%rdi
mov    %rdx,%rsi
call   1030 <multiplyMatricies@plt>
add    $0x48,%rsp
ret

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

LLVM IR (-O2):
define void @saturateMatrix([4 x float]* %0, float* nocapture %1) {
%3 = alloca [4 x [4 x float]]
%4 = load float, float* %1
%5 = bitcast [4 x [4 x float]]* %3 to i8*
%6 = fsub float 1.000000e+00, %4
%7 = tail call float @llvm.fmuladd.f32(float %6, float 0x3FD3C01A40000000, float %4)
%8 = fmul float %6, 0x3FD3C01A40000000
%9 = fmul float %6, 0x3FE3803460000000
%10 = tail call float @llvm.fmuladd.f32(float %6, float 0x3FE3803460000000, float %4)
%11 = fmul float %6, 0x3FB4FDF3C0000000
%12 = tail call float @llvm.fmuladd.f32(float %6, float 0x3FB4FDF3C0000000, float %4)
%13 = getelementptr inbounds [4 x [4 x float]], [4 x [4 x float]]* %3, i64 0, i64 0, i64 0
store float %7, float* %13
%14 = getelementptr inbounds [4 x [4 x float]], [4 x [4 x float]]* %3, i64 0, i64 0, i64 1
store float %8, float* %14
%15 = getelementptr inbounds [4 x [4 x float]], [4 x [4 x float]]* %3, i64 0, i64 0, i64 2
store float %8, float* %15
%16 = getelementptr inbounds [4 x [4 x float]], [4 x [4 x float]]* %3, i64 0, i64 0, i64 3
store float 0.000000e+00, float* %16
%17 = getelementptr inbounds [4 x [4 x float]], [4 x [4 x float]]* %3, i64 0, i64 1, i64 0
store float %9, float* %17
%18 = getelementptr inbounds [4 x [4 x float]], [4 x [4 x float]]* %3, i64 0, i64 1, i64 1
store float %10, float* %18
%19 = getelementptr inbounds [4 x [4 x float]], [4 x [4 x float]]* %3, i64 0, i64 1, i64 2
store float %9, float* %19
%20 = getelementptr inbounds [4 x [4 x float]], [4 x [4 x float]]* %3, i64 0, i64 1, i64 3
store float 0.000000e+00, float* %20
%21 = getelementptr inbounds [4 x [4 x float]], [4 x [4 x float]]* %3, i64 0, i64 2, i64 0
store float %11, float* %21
%22 = getelementptr inbounds [4 x [4 x float]], [4 x [4 x float]]* %3, i64 0, i64 2, i64 1
store float %11, float* %22
%23 = getelementptr inbounds [4 x [4 x float]], [4 x [4 x float]]* %3, i64 0, i64 2, i64 2
store float %12, float* %23
%24 = getelementptr inbounds [4 x [4 x float]], [4 x [4 x float]]* %3, i64 0, i64 2, i64 3
%25 = getelementptr inbounds [4 x [4 x float]], [4 x [4 x float]]* %3, i64 0, i64 3, i64 3
%26 = bitcast float* %24 to i8*
store float 1.000000e+00, float* %25
%27 = bitcast [4 x [4 x float]]* %3 to float**
%28 = bitcast [4 x float]* %0 to float**
%29 = call i32 @multiplyMatricies(float** %27, float** %28, float** %28)
ret void
}