#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_4x4() {
  int dim = 4;
  double a[4][4] = {
      {2, -6, 4, -2}, {1, -3, 4, 3}, {4, 3, -2, 3}, {1, -4, 3, 3}};
  double b[4][1] = {{8}, {6}, {3}, {9}};
  double x[4][1] = {{1}, {-2}, {-1}, {1}};
  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_4x4>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf0,%rsp
movl   $0x4,-0x4(%rbp)
lea    -0x90(%rbp),%rdi
lea    0xe90(%rip),%rsi
mov    $0x80,%edx
call   1060 <memcpy@plt>
mov    0xeff(%rip),%rax
mov    %rax,-0xb0(%rbp)
mov    0xef9(%rip),%rax
mov    %rax,-0xa8(%rbp)
mov    0xef3(%rip),%rax
mov    %rax,-0xa0(%rbp)
mov    0xeed(%rip),%rax
mov    %rax,-0x98(%rbp)
mov    0xee7(%rip),%rax
mov    %rax,-0xd0(%rbp)
mov    0xee1(%rip),%rax
mov    %rax,-0xc8(%rbp)
mov    0xedb(%rip),%rax
mov    %rax,-0xc0(%rbp)
mov    0xed5(%rip),%rax
mov    %rax,-0xb8(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x90(%rbp),%rsi
call   1050 <matriz_valores_quadrada@plt>
mov    %rax,-0xd8(%rbp)
mov    -0x4(%rbp),%edi
lea    -0xb0(%rbp),%rdx
mov    $0x1,%esi
call   1040 <matriz_valores@plt>
mov    %rax,-0xe0(%rbp)
mov    -0x4(%rbp),%edi
lea    -0xd0(%rbp),%rdx
mov    $0x1,%esi
call   1040 <matriz_valores@plt>
mov    %rax,-0xe8(%rbp)
mov    -0xd8(%rbp),%rdi
mov    -0xe0(%rbp),%rsi
mov    -0xe8(%rbp),%rdx
mov    -0x4(%rbp),%ecx
call   1070 <imprime_teste_solucao_linear@plt>
mov    -0xd8(%rbp),%rdi
call   1030 <free@plt>
movq   $0x0,-0xd8(%rbp)
mov    -0xe0(%rbp),%rdi
call   1030 <free@plt>
movq   $0x0,-0xe0(%rbp)
mov    -0xe8(%rbp),%rdi
call   1030 <free@plt>
movq   $0x0,-0xe8(%rbp)
add    $0xf0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<teste_solucao_linear_4x4>:
push   %r15
push   %r14
push   %rbx
sub    $0xc0,%rsp
movaps 0xf1d(%rip),%xmm0
movaps %xmm0,0xb0(%rsp)
movaps 0xefe(%rip),%xmm0
movaps %xmm0,0xa0(%rsp)
movaps 0xedf(%rip),%xmm0
movaps %xmm0,0x90(%rsp)
movaps 0xec0(%rip),%xmm0
movaps %xmm0,0x80(%rsp)
movaps 0xea1(%rip),%xmm0
movaps %xmm0,0x70(%rsp)
movaps 0xe85(%rip),%xmm0
movaps %xmm0,0x60(%rsp)
movaps 0xe69(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
movaps 0xe4d(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0xed1(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xeb5(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xed9(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xebd(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0x40(%rsp),%rsi
mov    $0x4,%edi
call   1050 <matriz_valores_quadrada@plt>
mov    %rax,%r14
lea    0x20(%rsp),%rdx
mov    $0x4,%edi
mov    $0x1,%esi
call   1040 <matriz_valores@plt>
mov    %rax,%r15
mov    %rsp,%rdx
mov    $0x4,%edi
mov    $0x1,%esi
call   1040 <matriz_valores@plt>
mov    %rax,%rbx
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rax,%rdx
mov    $0x4,%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    $0xc0,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.teste_solucao_linear_4x4.a = [4 x [4 x double]] [[4 x double] [double 2.000000e+00, double -6.000000e+00, double 4.000000e+00, double -2.000000e+00], [4 x double] [double 1.000000e+00, double -3.000000e+00, double 4.000000e+00, double 3.000000e+00], [4 x double] [double 4.000000e+00, double 3.000000e+00, double -2.000000e+00, double 3.000000e+00], [4 x double] [double 1.000000e+00, double -4.000000e+00, double 3.000000e+00, double 3.000000e+00]]
@__const.teste_solucao_linear_4x4.b = [4 x [1 x double]] [[1 x double] [double 8.000000e+00], [1 x double] [double 6.000000e+00], [1 x double] [double 3.000000e+00], [1 x double] [double 9.000000e+00]]
@__const.teste_solucao_linear_4x4.x = [4 x [1 x double]] [[1 x double] [double 1.000000e+00], [1 x double] [double -2.000000e+00], [1 x double] [double -1.000000e+00], [1 x double] [double 1.000000e+00]]
define void @teste_solucao_linear_4x4() {
%1 = alloca i32
%2 = alloca [4 x [4 x double]]
%3 = alloca [4 x [1 x double]]
%4 = alloca [4 x [1 x double]]
%5 = alloca double**
%6 = alloca double**
%7 = alloca double**
store i32 4, i32* %1
%8 = bitcast [4 x [4 x double]]* %2 to i8*
%9 = bitcast [4 x [1 x double]]* %3 to i8*
%10 = bitcast [4 x [1 x double]]* %4 to i8*
%11 = load i32, i32* %1
%12 = getelementptr inbounds [4 x [4 x double]], [4 x [4 x double]]* %2, i64 0, i64 0
%13 = getelementptr inbounds [4 x double], [4 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 [4 x [1 x double]], [4 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 [4 x [1 x double]], [4 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_4x4.a = [4 x [4 x double]] [[4 x double] [double 2.000000e+00, double -6.000000e+00, double 4.000000e+00, double -2.000000e+00], [4 x double] [double 1.000000e+00, double -3.000000e+00, double 4.000000e+00, double 3.000000e+00], [4 x double] [double 4.000000e+00, double 3.000000e+00, double -2.000000e+00, double 3.000000e+00], [4 x double] [double 1.000000e+00, double -4.000000e+00, double 3.000000e+00, double 3.000000e+00]]
@__const.teste_solucao_linear_4x4.b = [4 x [1 x double]] [[1 x double] [double 8.000000e+00], [1 x double] [double 6.000000e+00], [1 x double] [double 3.000000e+00], [1 x double] [double 9.000000e+00]]
@__const.teste_solucao_linear_4x4.x = [4 x [1 x double]] [[1 x double] [double 1.000000e+00], [1 x double] [double -2.000000e+00], [1 x double] [double -1.000000e+00], [1 x double] [double 1.000000e+00]]
define void @teste_solucao_linear_4x4() {
%1 = alloca [4 x [4 x double]]
%2 = alloca [4 x [1 x double]]
%3 = alloca [4 x [1 x double]]
%4 = bitcast [4 x [4 x double]]* %1 to i8*
%5 = bitcast [4 x [1 x double]]* %2 to i8*
%6 = bitcast [4 x [1 x double]]* %3 to i8*
%7 = getelementptr inbounds [4 x [4 x double]], [4 x [4 x double]]* %1, i64 0, i64 0, i64 0
%8 = call double** @matriz_valores_quadrada(i32 4, double* %7)
%9 = getelementptr inbounds [4 x [1 x double]], [4 x [1 x double]]* %2, i64 0, i64 0, i64 0
%10 = call double** @matriz_valores(i32 4, i32 1, double* %9)
%11 = getelementptr inbounds [4 x [1 x double]], [4 x [1 x double]]* %3, i64 0, i64 0, i64 0
%12 = call double** @matriz_valores(i32 4, i32 1, double* %11)
%13 = call i32 @imprime_teste_solucao_linear(double** %8, double** %10, double** %12, i32 4)
%14 = call i32 @free(double** %8)
%15 = call i32 @free(double** %10)
%16 = call i32 @free(double** %12)
ret void
}