#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*/ assert(int);
int /*<<< orphan*/ floats_mat33_chol(float const *, int, int, float *, int,
                                     int);
int /*<<< orphan*/ floats_mat33_lower_tri_inv(float *, int, int, float *, int,
                                              int);
void floats_mat33_sym_solve(const float *A, int Arows, int Acols,
                            const float *B, int Brows, int Bcols, float *R,
                            int Rrows, int Rcols) {
  assert(Arows == Acols);
  assert(Acols == 3);
  assert(Brows == 3);
  assert(Bcols == 1);
  assert(Rrows == 3);
  assert(Rcols == 1);
  float L[9];
  floats_mat33_chol(A, 3, 3, L, 3, 3);
  float M[9];
  floats_mat33_lower_tri_inv(L, 3, 3, M, 3, 3);
  double tmp[3];
  tmp[0] = M[0] * B[0];
  tmp[1] = M[3] * B[0] + M[4] * B[1];
  tmp[2] = M[6] * B[0] + M[7] * B[1] + M[8] * B[2];
  R[0] = (float)(M[0] * tmp[0] + M[3] * tmp[1] + M[6] * tmp[2]);
  R[1] = (float)(M[4] * tmp[1] + M[7] * tmp[2]);
  R[2] = (float)(M[8] * tmp[2]);
}


x86 assembly (clang, -O0):
<floats_mat33_sym_solve>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
mov    0x20(%rbp),%eax
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
mov    %r9d,-0x20(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
cmpl   $0x3,-0x10(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
cmpl   $0x3,-0x1c(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
cmpl   $0x1,-0x20(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
cmpl   $0x3,0x18(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
cmpl   $0x1,0x20(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    -0x8(%rbp),%rdi
lea    -0x50(%rbp),%rcx
mov    $0x3,%r9d
mov    %r9d,%esi
mov    %r9d,%edx
mov    %r9d,%r8d
call   1030 <floats_mat33_chol@plt>
lea    -0x50(%rbp),%rdi
lea    -0x80(%rbp),%rcx
mov    $0x3,%r9d
mov    %r9d,%esi
mov    %r9d,%edx
mov    %r9d,%r8d
call   1040 <floats_mat33_lower_tri_inv@plt>
movss  -0x80(%rbp),%xmm0
mov    -0x18(%rbp),%rax
mulss  (%rax),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
movss  -0x74(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movss  (%rax),%xmm2
movss  -0x70(%rbp),%xmm1
mov    -0x18(%rbp),%rax
mulss  0x4(%rax),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
movss  -0x68(%rbp),%xmm1
mov    -0x18(%rbp),%rax
movss  (%rax),%xmm2
movss  -0x64(%rbp),%xmm0
mov    -0x18(%rbp),%rax
mulss  0x4(%rax),%xmm0
mulss  %xmm2,%xmm1
addss  %xmm0,%xmm1
movss  -0x60(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movss  0x8(%rax),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movss  -0x80(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  -0xa0(%rbp),%xmm2
ff
movss  -0x74(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  -0x98(%rbp),%xmm0
ff
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movss  -0x68(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  -0x90(%rbp),%xmm2
ff
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
mov    0x10(%rbp),%rax
movss  %xmm0,(%rax)
movss  -0x70(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  -0x98(%rbp),%xmm2
ff
movss  -0x64(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  -0x90(%rbp),%xmm1
ff
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
mov    0x10(%rbp),%rax
movss  %xmm0,0x4(%rax)
movss  -0x60(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  -0x90(%rbp),%xmm0
ff
cvtsd2ss %xmm0,%xmm0
mov    0x10(%rbp),%rax
movss  %xmm0,0x8(%rax)
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<floats_mat33_sym_solve>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
mov    %r9d,%r12d
mov    %r8d,%ebx
mov    %rcx,%r15
mov    %edx,%ebp
mov    %rdi,%r14
mov    0x98(%rsp),%r13d
xor    %edi,%edi
cmp    %edx,%esi
sete   %dil
call   1050 <assert@plt>
xor    %edi,%edi
cmp    $0x3,%ebp
sete   %dil
call   1050 <assert@plt>
xor    %edi,%edi
cmp    $0x3,%ebx
sete   %dil
call   1050 <assert@plt>
xor    %edi,%edi
cmp    $0x1,%r12d
sete   %dil
call   1050 <assert@plt>
xor    %edi,%edi
cmp    $0x3,%r13d
sete   %dil
call   1050 <assert@plt>
xor    %edi,%edi
cmpl   $0x1,0xa0(%rsp)
01
sete   %dil
call   1050 <assert@plt>
lea    0x30(%rsp),%rbx
mov    %r14,%rdi
mov    $0x3,%esi
mov    $0x3,%edx
mov    %rbx,%rcx
mov    $0x3,%r8d
mov    $0x3,%r9d
call   1030 <floats_mat33_chol@plt>
mov    %rsp,%rcx
mov    %rbx,%rdi
mov    $0x3,%esi
mov    $0x3,%edx
mov    $0x3,%r8d
mov    $0x3,%r9d
call   1040 <floats_mat33_lower_tri_inv@plt>
movss  (%rsp),%xmm3
movss  0xc(%rsp),%xmm2
movss  (%r15),%xmm0
movss  0x4(%r15),%xmm1
cvtss2sd %xmm3,%xmm9
mulss  %xmm0,%xmm3
cvtss2sd %xmm3,%xmm8
movss  0x10(%rsp),%xmm5
cvtss2sd %xmm5,%xmm6
mulss  %xmm1,%xmm5
cvtss2sd %xmm2,%xmm7
mulss  %xmm0,%xmm2
addss  %xmm5,%xmm2
cvtss2sd %xmm2,%xmm2
movss  0x18(%rsp),%xmm5
movss  0x1c(%rsp),%xmm3
mulss  %xmm3,%xmm1
mulss  %xmm5,%xmm0
addss  %xmm1,%xmm0
movss  0x20(%rsp),%xmm1
movss  0x8(%r15),%xmm4
mulss  %xmm1,%xmm4
addss  %xmm0,%xmm4
xorps  %xmm0,%xmm0
cvtss2sd %xmm4,%xmm0
mulsd  %xmm8,%xmm9
mulsd  %xmm2,%xmm7
addsd  %xmm9,%xmm7
cvtss2sd %xmm5,%xmm5
mulsd  %xmm0,%xmm5
addsd  %xmm7,%xmm5
cvtsd2ss %xmm5,%xmm5
cvtss2sd %xmm3,%xmm3
mulsd  %xmm0,%xmm3
mulsd  %xmm2,%xmm6
addsd  %xmm3,%xmm6
xorps  %xmm0,%xmm0
cvtsd2ss %xmm6,%xmm0
mov    0x90(%rsp),%rax
movss  %xmm5,(%rax)
movss  %xmm0,0x4(%rax)
mulss  %xmm1,%xmm4
movss  %xmm4,0x8(%rax)
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @floats_mat33_sym_solve(float* %0, i32 %1, i32 %2, float* nocapture %3, i32 %4, i32 %5, float* nocapture writeonly %6, i32 %7, i32 %8) {
%10 = alloca [9 x float]
%11 = alloca [9 x float]
%12 = icmp eq i32 %1, %2
%13 = zext i1 %12 to i32
%14 = tail call i32 @assert(i32 %13)
%15 = icmp eq i32 %2, 3
%16 = zext i1 %15 to i32
%17 = tail call i32 @assert(i32 %16)
%18 = icmp eq i32 %4, 3
%19 = zext i1 %18 to i32
%20 = tail call i32 @assert(i32 %19)
%21 = icmp eq i32 %5, 1
%22 = zext i1 %21 to i32
%23 = tail call i32 @assert(i32 %22)
%24 = icmp eq i32 %7, 3
%25 = zext i1 %24 to i32
%26 = tail call i32 @assert(i32 %25)
%27 = icmp eq i32 %8, 1
%28 = zext i1 %27 to i32
%29 = tail call i32 @assert(i32 %28)
%30 = bitcast [9 x float]* %10 to i8*
%31 = getelementptr inbounds [9 x float], [9 x float]* %10, i64 0, i64 0
%32 = call i32 @floats_mat33_chol(float* %0, i32 3, i32 3, float* %31, i32 3, i32 3)
%33 = bitcast [9 x float]* %11 to i8*
%34 = getelementptr inbounds [9 x float], [9 x float]* %11, i64 0, i64 0
%35 = call i32 @floats_mat33_lower_tri_inv(float* %31, i32 3, i32 3, float* %34, i32 3, i32 3)
%36 = load float, float* %34
%37 = load float, float* %3
%38 = fmul float %36, %37
%39 = fpext float %38 to double
%40 = getelementptr inbounds [9 x float], [9 x float]* %11, i64 0, i64 3
%41 = load float, float* %40
%42 = getelementptr inbounds [9 x float], [9 x float]* %11, i64 0, i64 4
%43 = load float, float* %42
%44 = getelementptr inbounds float, float* %3, i64 1
%45 = load float, float* %44
%46 = fmul float %43, %45
%47 = call float @llvm.fmuladd.f32(float %41, float %37, float %46)
%48 = fpext float %47 to double
%49 = getelementptr inbounds [9 x float], [9 x float]* %11, i64 0, i64 6
%50 = load float, float* %49
%51 = getelementptr inbounds [9 x float], [9 x float]* %11, i64 0, i64 7
%52 = load float, float* %51
%53 = fmul float %45, %52
%54 = call float @llvm.fmuladd.f32(float %50, float %37, float %53)
%55 = getelementptr inbounds [9 x float], [9 x float]* %11, i64 0, i64 8
%56 = load float, float* %55
%57 = getelementptr inbounds float, float* %3, i64 2
%58 = load float, float* %57
%59 = call float @llvm.fmuladd.f32(float %56, float %58, float %54)
%60 = fpext float %59 to double
%61 = fpext float %36 to double
%62 = fpext float %41 to double
%63 = fmul double %62, %48
%64 = call double @llvm.fmuladd.f64(double %61, double %39, double %63)
%65 = fpext float %50 to double
%66 = call double @llvm.fmuladd.f64(double %65, double %60, double %64)
%67 = fptrunc double %66 to float
store float %67, float* %6
%68 = fpext float %43 to double
%69 = fpext float %52 to double
%70 = fmul double %69, %60
%71 = call double @llvm.fmuladd.f64(double %68, double %48, double %70)
%72 = fptrunc double %71 to float
%73 = getelementptr inbounds float, float* %6, i64 1
store float %72, float* %73
%74 = fmul float %56, %59
%75 = getelementptr inbounds float, float* %6, i64 2
store float %74, float* %75
ret void
}