#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*/ free(double **);
int /*<<< orphan*/ imprime_teste_solucao_linear(double **, double **, double **,
                                                int);
double **matriz_valores(int, int, double *);
double **matriz_valores_quadrada(int, double *);
void teste_solucao_linear_2x2() {
  int dim = 2;
  double a[2][2] = {{1, 1}, {4, -1}};
  double b[2][1] = {{7}, {3}};
  double x[2][1] = {{2}, {5}};
  double **A, **B;
  double **X_correto;
  A = matriz_valores_quadrada(dim, &a[0][0]);
  B = matriz_valores(dim, 1, &b[0][0]);
  X_correto = matriz_valores(dim, 1, &x[0][0]);
  imprime_teste_solucao_linear(A, B, X_correto, dim);
  free(A);
  A = NULL;
  free(B);
  B = NULL;
  free(X_correto);
  X_correto = NULL;
}


x86 assembly (clang, -O0):
<teste_solucao_linear_2x2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x2,-0x4(%rbp)
mov    0xeaa(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xea7(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xea4(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xea1(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xe9e(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0xe9b(%rip),%rax
mov    %rax,-0x38(%rbp)
mov    0xe98(%rip),%rax
mov    %rax,-0x50(%rbp)
mov    0xe95(%rip),%rax
mov    %rax,-0x48(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x30(%rbp),%rsi
call   1050 <matriz_valores_quadrada@plt>
mov    %rax,-0x58(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x40(%rbp),%rdx
mov    $0x1,%esi
call   1040 <matriz_valores@plt>
mov    %rax,-0x60(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x50(%rbp),%rdx
mov    $0x1,%esi
call   1040 <matriz_valores@plt>
mov    %rax,-0x68(%rbp)
mov    -0x58(%rbp),%rdi
mov    -0x60(%rbp),%rsi
mov    -0x68(%rbp),%rdx
mov    -0x4(%rbp),%ecx
call   1060 <imprime_teste_solucao_linear@plt>
mov    -0x58(%rbp),%rdi
call   1030 <free@plt>
movq   $0x0,-0x58(%rbp)
mov    -0x60(%rbp),%rdi
call   1030 <free@plt>
movq   $0x0,-0x60(%rbp)
mov    -0x68(%rbp),%rdi
call   1030 <free@plt>
movq   $0x0,-0x68(%rbp)
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<teste_solucao_linear_2x2>:
push   %r15
push   %r14
push   %rbx
sub    $0x40,%rsp
movaps 0xec0(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xea4(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xeb8(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xebc(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0x20(%rsp),%rsi
mov    $0x2,%edi
call   1050 <matriz_valores_quadrada@plt>
mov    %rax,%r14
lea    0x10(%rsp),%rdx
mov    $0x2,%edi
mov    $0x1,%esi
call   1040 <matriz_valores@plt>
mov    %rax,%r15
mov    %rsp,%rdx
mov    $0x2,%edi
mov    $0x1,%esi
call   1040 <matriz_valores@plt>
mov    %rax,%rbx
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rax,%rdx
mov    $0x2,%ecx
call   1060 <imprime_teste_solucao_linear@plt>
mov    %r14,%rdi
call   1030 <free@plt>
mov    %r15,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
add    $0x40,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.teste_solucao_linear_2x2.a = [2 x [2 x double]] [[2 x double] [double 1.000000e+00, double 1.000000e+00], [2 x double] [double 4.000000e+00, double -1.000000e+00]]
@__const.teste_solucao_linear_2x2.b = [2 x [1 x double]] [[1 x double] [double 7.000000e+00], [1 x double] [double 3.000000e+00]]
@__const.teste_solucao_linear_2x2.x = [2 x [1 x double]] [[1 x double] [double 2.000000e+00], [1 x double] [double 5.000000e+00]]
define void @teste_solucao_linear_2x2() {
%1 = alloca i32
%2 = alloca [2 x [2 x double]]
%3 = alloca [2 x [1 x double]]
%4 = alloca [2 x [1 x double]]
%5 = alloca double**
%6 = alloca double**
%7 = alloca double**
store i32 2, i32* %1
%8 = bitcast [2 x [2 x double]]* %2 to i8*
%9 = bitcast [2 x [1 x double]]* %3 to i8*
%10 = bitcast [2 x [1 x double]]* %4 to i8*
%11 = load i32, i32* %1
%12 = getelementptr inbounds [2 x [2 x double]], [2 x [2 x double]]* %2, i64 0, i64 0
%13 = getelementptr inbounds [2 x double], [2 x double]* %12, i64 0, i64 0
%14 = call double** @matriz_valores_quadrada(i32 %11, double* %13)
store double** %14, double*** %5
%15 = load i32, i32* %1
%16 = getelementptr inbounds [2 x [1 x double]], [2 x [1 x double]]* %3, i64 0, i64 0
%17 = getelementptr inbounds [1 x double], [1 x double]* %16, i64 0, i64 0
%18 = call double** @matriz_valores(i32 %15, i32 1, double* %17)
store double** %18, double*** %6
%19 = load i32, i32* %1
%20 = getelementptr inbounds [2 x [1 x double]], [2 x [1 x double]]* %4, i64 0, i64 0
%21 = getelementptr inbounds [1 x double], [1 x double]* %20, i64 0, i64 0
%22 = call double** @matriz_valores(i32 %19, i32 1, double* %21)
store double** %22, double*** %7
%23 = load double**, double*** %5
%24 = load double**, double*** %6
%25 = load double**, double*** %7
%26 = load i32, i32* %1
%27 = call i32 @imprime_teste_solucao_linear(double** %23, double** %24, double** %25, i32 %26)
%28 = load double**, double*** %5
%29 = call i32 @free(double** %28)
store double** null, double*** %5
%30 = load double**, double*** %6
%31 = call i32 @free(double** %30)
store double** null, double*** %6
%32 = load double**, double*** %7
%33 = call i32 @free(double** %32)
store double** null, double*** %7
ret void
}

LLVM IR (-O2):
@__const.teste_solucao_linear_2x2.a = [2 x [2 x double]] [[2 x double] [double 1.000000e+00, double 1.000000e+00], [2 x double] [double 4.000000e+00, double -1.000000e+00]]
@__const.teste_solucao_linear_2x2.b = [2 x [1 x double]] [[1 x double] [double 7.000000e+00], [1 x double] [double 3.000000e+00]]
@__const.teste_solucao_linear_2x2.x = [2 x [1 x double]] [[1 x double] [double 2.000000e+00], [1 x double] [double 5.000000e+00]]
define void @teste_solucao_linear_2x2() {
%1 = alloca [2 x [2 x double]]
%2 = alloca [2 x [1 x double]]
%3 = alloca [2 x [1 x double]]
%4 = bitcast [2 x [2 x double]]* %1 to i8*
%5 = bitcast [2 x [1 x double]]* %2 to i8*
%6 = bitcast [2 x [1 x double]]* %3 to i8*
%7 = getelementptr inbounds [2 x [2 x double]], [2 x [2 x double]]* %1, i64 0, i64 0, i64 0
%8 = call double** @matriz_valores_quadrada(i32 2, double* %7)
%9 = getelementptr inbounds [2 x [1 x double]], [2 x [1 x double]]* %2, i64 0, i64 0, i64 0
%10 = call double** @matriz_valores(i32 2, i32 1, double* %9)
%11 = getelementptr inbounds [2 x [1 x double]], [2 x [1 x double]]* %3, i64 0, i64 0, i64 0
%12 = call double** @matriz_valores(i32 2, i32 1, double* %11)
%13 = call i32 @imprime_teste_solucao_linear(double** %8, double** %10, double** %12, i32 2)
%14 = call i32 @free(double** %8)
%15 = call i32 @free(double** %10)
%16 = call i32 @free(double** %12)
ret void
}