#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*/ matrixmult(float **, float **, float **);
void saturatemat(float mat[4][4], float sat) {
  float mmat[4][4];
  float a, b, c, d, e, f, g, h, i;
  float rwgt, gwgt, bwgt;
  rwgt = (0.2126);
  gwgt = (0.7152);
  bwgt = (0.0722);
  a = (1.0 - sat) * rwgt + sat;
  b = (1.0 - sat) * rwgt;
  c = (1.0 - sat) * rwgt;
  d = (1.0 - sat) * gwgt;
  e = (1.0 - sat) * gwgt + sat;
  f = (1.0 - sat) * gwgt;
  g = (1.0 - sat) * bwgt;
  h = (1.0 - sat) * bwgt;
  i = (1.0 - sat) * bwgt + sat;
  mmat[0][0] = a;
  mmat[0][1] = b;
  mmat[0][2] = c;
  mmat[0][3] = 0.0;
  mmat[1][0] = d;
  mmat[1][1] = e;
  mmat[1][2] = f;
  mmat[1][3] = 0.0;
  mmat[2][0] = g;
  mmat[2][1] = h;
  mmat[2][2] = i;
  mmat[2][3] = 0.0;
  mmat[3][0] = 0.0;
  mmat[3][1] = 0.0;
  mmat[3][2] = 0.0;
  mmat[3][3] = 1.0;
  matrixmult(mmat, mat, mat);
}


x86 assembly (clang, -O0):
<saturatemat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %rdi,-0x8(%rbp)
movss  %xmm0,-0xc(%rbp)
movss  0xee0(%rip),%xmm0
movss  %xmm0,-0x78(%rbp)
movss  0xecf(%rip),%xmm0
movss  %xmm0,-0x7c(%rbp)
movss  0xebe(%rip),%xmm0
movss  %xmm0,-0x80(%rbp)
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xeb4(%rip),%xmm0
subsd  %xmm1,%xmm0
movss  -0x78(%rbp),%xmm1
cvtss2sd %xmm1,%xmm2
movss  -0xc(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x54(%rbp)
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe7c(%rip),%xmm0
subsd  %xmm1,%xmm0
movss  -0x78(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x58(%rbp)
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe51(%rip),%xmm0
subsd  %xmm1,%xmm0
movss  -0x78(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x5c(%rbp)
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe26(%rip),%xmm0
subsd  %xmm1,%xmm0
movss  -0x7c(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x60(%rbp)
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xdfb(%rip),%xmm0
subsd  %xmm1,%xmm0
movss  -0x7c(%rbp),%xmm1
cvtss2sd %xmm1,%xmm2
movss  -0xc(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x64(%rbp)
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xdc3(%rip),%xmm0
subsd  %xmm1,%xmm0
movss  -0x7c(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x68(%rbp)
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xd98(%rip),%xmm0
subsd  %xmm1,%xmm0
movss  -0x80(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x6c(%rbp)
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xd6d(%rip),%xmm0
subsd  %xmm1,%xmm0
movss  -0x80(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x70(%rbp)
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xd42(%rip),%xmm0
subsd  %xmm1,%xmm0
movss  -0x80(%rbp),%xmm1
cvtss2sd %xmm1,%xmm2
movss  -0xc(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x74(%rbp)
movss  -0x54(%rbp),%xmm0
movss  %xmm0,-0x50(%rbp)
movss  -0x58(%rbp),%xmm0
movss  %xmm0,-0x4c(%rbp)
movss  -0x5c(%rbp),%xmm0
movss  %xmm0,-0x48(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x44(%rbp)
movss  -0x60(%rbp),%xmm0
movss  %xmm0,-0x40(%rbp)
movss  -0x64(%rbp),%xmm0
movss  %xmm0,-0x3c(%rbp)
movss  -0x68(%rbp),%xmm0
movss  %xmm0,-0x38(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x34(%rbp)
movss  -0x6c(%rbp),%xmm0
movss  %xmm0,-0x30(%rbp)
movss  -0x70(%rbp),%xmm0
movss  %xmm0,-0x2c(%rbp)
movss  -0x74(%rbp),%xmm0
movss  %xmm0,-0x28(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x24(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x20(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x1c(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x18(%rbp)
movss  0xc79(%rip),%xmm0
movss  %xmm0,-0x14(%rbp)
lea    -0x50(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x8(%rbp),%rdx
call   1030 <matrixmult@plt>
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<saturatemat>:
sub    $0x48,%rsp
cvtss2sd %xmm0,%xmm0
movsd  0xee0(%rip),%xmm1
subsd  %xmm0,%xmm1
movsd  0xedc(%rip),%xmm2
mulsd  %xmm1,%xmm2
cvtsd2ss %xmm2,%xmm3
addsd  %xmm0,%xmm2
cvtsd2ss %xmm2,%xmm2
movsd  0xecc(%rip),%xmm4
mulsd  %xmm1,%xmm4
cvtsd2ss %xmm4,%xmm5
addsd  %xmm0,%xmm4
cvtsd2ss %xmm4,%xmm4
mulsd  0xebc(%rip),%xmm1
mov    %rdi,%rdx
cvtsd2ss %xmm1,%xmm6
addsd  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtsd2ss %xmm1,%xmm0
movss  %xmm2,(%rsp)
movss  %xmm3,0x4(%rsp)
movss  %xmm3,0x8(%rsp)
movl   $0x0,0xc(%rsp)
movss  %xmm5,0x10(%rsp)
movss  %xmm4,0x14(%rsp)
movss  %xmm5,0x18(%rsp)
movl   $0x0,0x1c(%rsp)
movss  %xmm6,0x20(%rsp)
movss  %xmm6,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 <matrixmult@plt>
add    $0x48,%rsp
ret

LLVM IR (-O0):
define void @saturatemat([4 x float]* %0, float %1) {
%3 = alloca [4 x float]*
%4 = alloca float
%5 = alloca [4 x [4 x float]]
%6 = alloca 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
store [4 x float]* %0, [4 x float]** %3
store float %1, float* %4
store float 0x3FCB367A00000000, float* %15
store float 0x3FE6E2EB20000000, float* %16
store float 0x3FB27BB300000000, float* %17
%18 = load float, float* %4
%19 = fpext float %18 to double
%20 = fsub double 1.000000e+00, %19
%21 = load float, float* %15
%22 = fpext float %21 to double
%23 = load float, float* %4
%24 = fpext float %23 to double
%25 = call double @llvm.fmuladd.f64(double %20, double %22, double %24)
%26 = fptrunc double %25 to float
store float %26, float* %6
%27 = load float, float* %4
%28 = fpext float %27 to double
%29 = fsub double 1.000000e+00, %28
%30 = load float, float* %15
%31 = fpext float %30 to double
%32 = fmul double %29, %31
%33 = fptrunc double %32 to float
store float %33, float* %7
%34 = load float, float* %4
%35 = fpext float %34 to double
%36 = fsub double 1.000000e+00, %35
%37 = load float, float* %15
%38 = fpext float %37 to double
%39 = fmul double %36, %38
%40 = fptrunc double %39 to float
store float %40, float* %8
%41 = load float, float* %4
%42 = fpext float %41 to double
%43 = fsub double 1.000000e+00, %42
%44 = load float, float* %16
%45 = fpext float %44 to double
%46 = fmul double %43, %45
%47 = fptrunc double %46 to float
store float %47, float* %9
%48 = load float, float* %4
%49 = fpext float %48 to double
%50 = fsub double 1.000000e+00, %49
%51 = load float, float* %16
%52 = fpext float %51 to double
%53 = load float, float* %4
%54 = fpext float %53 to double
%55 = call double @llvm.fmuladd.f64(double %50, double %52, double %54)
%56 = fptrunc double %55 to float
store float %56, float* %10
%57 = load float, float* %4
%58 = fpext float %57 to double
%59 = fsub double 1.000000e+00, %58
%60 = load float, float* %16
%61 = fpext float %60 to double
%62 = fmul double %59, %61
%63 = fptrunc double %62 to float
store float %63, float* %11
%64 = load float, float* %4
%65 = fpext float %64 to double
%66 = fsub double 1.000000e+00, %65
%67 = load float, float* %17
%68 = fpext float %67 to double
%69 = fmul double %66, %68
%70 = fptrunc double %69 to float
store float %70, float* %12
%71 = load float, float* %4
%72 = fpext float %71 to double
%73 = fsub double 1.000000e+00, %72
%74 = load float, float* %17
%75 = fpext float %74 to double
%76 = fmul double %73, %75
%77 = fptrunc double %76 to float
store float %77, float* %13
%78 = load float, float* %4
%79 = fpext float %78 to double
%80 = fsub double 1.000000e+00, %79
%81 = load float, float* %17
%82 = fpext float %81 to double
%83 = load float, float* %4
%84 = fpext float %83 to double
%85 = call double @llvm.fmuladd.f64(double %80, double %82, double %84)
%86 = fptrunc double %85 to float
store float %86, float* %14
%87 = load float, float* %6
%88 = getelementptr inbounds [4 x [4 x float]], [4 x [4 x float]]* %5, i64 0, i64 0
%89 = getelementptr inbounds [4 x float], [4 x float]* %88, i64 0, i64 0
store float %87, float* %89
%90 = load float, float* %7
%91 = getelementptr inbounds [4 x [4 x float]], [4 x [4 x float]]* %5, i64 0, i64 0
%92 = getelementptr inbounds [4 x float], [4 x float]* %91, i64 0, i64 1
store float %90, float* %92
%93 = load float, float* %8
%94 = getelementptr inbounds [4 x [4 x float]], [4 x [4 x float]]* %5, i64 0, i64 0
%95 = getelementptr inbounds [4 x float], [4 x float]* %94, i64 0, i64 2
store float %93, float* %95
%96 = getelementptr inbounds [4 x [4 x float]], [4 x [4 x float]]* %5, i64 0, i64 0
%97 = getelementptr inbounds [4 x float], [4 x float]* %96, i64 0, i64 3
store float 0.000000e+00, float* %97
%98 = load float, float* %9
%99 = getelementptr inbounds [4 x [4 x float]], [4 x [4 x float]]* %5, i64 0, i64 1
%100 = getelementptr inbounds [4 x float], [4 x float]* %99, i64 0, i64 0
store float %98, float* %100
%101 = load float, float* %10
%102 = getelementptr inbounds [4 x [4 x float]], [4 x [4 x float]]* %5, i64 0, i64 1
%103 = getelementptr inbounds [4 x float], [4 x float]* %102, i64 0, i64 1
store float %101, float* %103
%104 = load float, float* %11
%105 = getelementptr inbounds [4 x [4 x float]], [4 x [4 x float]]* %5, i64 0, i64 1
%106 = getelementptr inbounds [4 x float], [4 x float]* %105, i64 0, i64 2
store float %104, float* %106
%107 = getelementptr inbounds [4 x [4 x float]], [4 x [4 x float]]* %5, i64 0, i64 1
%108 = getelementptr inbounds [4 x float], [4 x float]* %107, i64 0, i64 3
store float 0.000000e+00, float* %108
%109 = load float, float* %12
%110 = getelementptr inbounds [4 x [4 x float]], [4 x [4 x float]]* %5, i64 0, i64 2
%111 = getelementptr inbounds [4 x float], [4 x float]* %110, i64 0, i64 0
store float %109, float* %111
%112 = load float, float* %13
%113 = getelementptr inbounds [4 x [4 x float]], [4 x [4 x float]]* %5, i64 0, i64 2
%114 = getelementptr inbounds [4 x float], [4 x float]* %113, i64 0, i64 1
store float %112, float* %114
%115 = load float, float* %14
%116 = getelementptr inbounds [4 x [4 x float]], [4 x [4 x float]]* %5, i64 0, i64 2
%117 = getelementptr inbounds [4 x float], [4 x float]* %116, i64 0, i64 2
store float %115, float* %117
%118 = getelementptr inbounds [4 x [4 x float]], [4 x [4 x float]]* %5, i64 0, i64 2
%119 = getelementptr inbounds [4 x float], [4 x float]* %118, i64 0, i64 3
store float 0.000000e+00, float* %119
%120 = getelementptr inbounds [4 x [4 x float]], [4 x [4 x float]]* %5, i64 0, i64 3
%121 = getelementptr inbounds [4 x float], [4 x float]* %120, i64 0, i64 0
store float 0.000000e+00, float* %121
%122 = getelementptr inbounds [4 x [4 x float]], [4 x [4 x float]]* %5, i64 0, i64 3
%123 = getelementptr inbounds [4 x float], [4 x float]* %122, i64 0, i64 1
store float 0.000000e+00, float* %123
%124 = getelementptr inbounds [4 x [4 x float]], [4 x [4 x float]]* %5, i64 0, i64 3
%125 = getelementptr inbounds [4 x float], [4 x float]* %124, i64 0, i64 2
store float 0.000000e+00, float* %125
%126 = getelementptr inbounds [4 x [4 x float]], [4 x [4 x float]]* %5, i64 0, i64 3
%127 = getelementptr inbounds [4 x float], [4 x float]* %126, i64 0, i64 3
store float 1.000000e+00, float* %127
%128 = getelementptr inbounds [4 x [4 x float]], [4 x [4 x float]]* %5, i64 0, i64 0
%129 = bitcast [4 x float]* %128 to float**
%130 = load [4 x float]*, [4 x float]** %3
%131 = bitcast [4 x float]* %130 to float**
%132 = load [4 x float]*, [4 x float]** %3
%133 = bitcast [4 x float]* %132 to float**
%134 = call i32 @matrixmult(float** %129, float** %131, float** %133)
ret void
}

LLVM IR (-O2):
define void @saturatemat([4 x float]* %0, float %1) {
%3 = alloca [4 x [4 x float]]
%4 = bitcast [4 x [4 x float]]* %3 to i8*
%5 = fpext float %1 to double
%6 = fsub double 1.000000e+00, %5
%7 = tail call double @llvm.fmuladd.f64(double %6, double 0x3FCB367A00000000, double %5)
%8 = fptrunc double %7 to float
%9 = fmul double %6, 0x3FCB367A00000000
%10 = fptrunc double %9 to float
%11 = fmul double %6, 0x3FE6E2EB20000000
%12 = fptrunc double %11 to float
%13 = tail call double @llvm.fmuladd.f64(double %6, double 0x3FE6E2EB20000000, double %5)
%14 = fptrunc double %13 to float
%15 = fmul double %6, 0x3FB27BB300000000
%16 = fptrunc double %15 to float
%17 = tail call double @llvm.fmuladd.f64(double %6, double 0x3FB27BB300000000, double %5)
%18 = fptrunc double %17 to float
%19 = getelementptr inbounds [4 x [4 x float]], [4 x [4 x float]]* %3, i64 0, i64 0, i64 0
store float %8, float* %19
%20 = getelementptr inbounds [4 x [4 x float]], [4 x [4 x float]]* %3, i64 0, i64 0, i64 1
store float %10, float* %20
%21 = getelementptr inbounds [4 x [4 x float]], [4 x [4 x float]]* %3, i64 0, i64 0, i64 2
store float %10, float* %21
%22 = 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* %22
%23 = getelementptr inbounds [4 x [4 x float]], [4 x [4 x float]]* %3, i64 0, i64 1, i64 0
store float %12, float* %23
%24 = getelementptr inbounds [4 x [4 x float]], [4 x [4 x float]]* %3, i64 0, i64 1, i64 1
store float %14, float* %24
%25 = getelementptr inbounds [4 x [4 x float]], [4 x [4 x float]]* %3, i64 0, i64 1, i64 2
store float %12, float* %25
%26 = 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* %26
%27 = getelementptr inbounds [4 x [4 x float]], [4 x [4 x float]]* %3, i64 0, i64 2, i64 0
store float %16, float* %27
%28 = getelementptr inbounds [4 x [4 x float]], [4 x [4 x float]]* %3, i64 0, i64 2, i64 1
store float %16, float* %28
%29 = getelementptr inbounds [4 x [4 x float]], [4 x [4 x float]]* %3, i64 0, i64 2, i64 2
store float %18, float* %29
%30 = getelementptr inbounds [4 x [4 x float]], [4 x [4 x float]]* %3, i64 0, i64 2, i64 3
%31 = getelementptr inbounds [4 x [4 x float]], [4 x [4 x float]]* %3, i64 0, i64 3, i64 3
%32 = bitcast float* %30 to i8*
store float 1.000000e+00, float* %31
%33 = bitcast [4 x [4 x float]]* %3 to float**
%34 = bitcast [4 x float]* %0 to float**
%35 = call i32 @matrixmult(float** %33, float** %34, float** %34)
ret void
}