#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_3x3() {
  int dim = 3;
  double a[3][3] = {{1, 3, 5}, {2, 4, 7}, {1, 1, 0}};
  double b[3][1] = {{0}, {0}, {0}};
  double x[3][1] = {{0}, {0}, {0}};
  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_3x3>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
movl   $0x3,-0x4(%rbp)
lea    -0x50(%rbp),%rdi
lea    0xe83(%rip),%rsi
mov    $0x48,%edx
call   1070 <memcpy@plt>
lea    -0x70(%rbp),%rdi
xor    %esi,%esi
mov    $0x18,%edx
call   1040 <memset@plt>
lea    -0x90(%rbp),%rdi
xor    %esi,%esi
mov    $0x18,%edx
call   1040 <memset@plt>
mov    -0x4(%rbp),%edi
lea    -0x50(%rbp),%rsi
call   1060 <matriz_valores_quadrada@plt>
mov    %rax,-0x98(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x70(%rbp),%rdx
mov    $0x1,%esi
call   1050 <matriz_valores@plt>
mov    %rax,-0xa0(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x90(%rbp),%rdx
mov    $0x1,%esi
call   1050 <matriz_valores@plt>
mov    %rax,-0xa8(%rbp)
mov    -0x98(%rbp),%rdi
mov    -0xa0(%rbp),%rsi
mov    -0xa8(%rbp),%rdx
mov    -0x4(%rbp),%ecx
call   1080 <imprime_teste_solucao_linear@plt>
mov    -0x98(%rbp),%rdi
call   1030 <free@plt>
movq   $0x0,-0x98(%rbp)
mov    -0xa0(%rbp),%rdi
call   1030 <free@plt>
movq   $0x0,-0xa0(%rbp)
mov    -0xa8(%rbp),%rdi
call   1030 <free@plt>
movq   $0x0,-0xa8(%rbp)
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<teste_solucao_linear_3x3>:
push   %r15
push   %r14
push   %rbx
sub    $0x90,%rsp
mov    0xeed(%rip),%rax
mov    %rax,0x80(%rsp)
movaps 0xece(%rip),%xmm0
movaps %xmm0,0x70(%rsp)
movaps 0xeb2(%rip),%xmm0
movaps %xmm0,0x60(%rsp)
movaps 0xe96(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
movaps 0xe7a(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
xorps  %xmm0,%xmm0
movaps %xmm0,0x20(%rsp)
movq   $0x0,0x30(%rsp)
movaps %xmm0,(%rsp)
movq   $0x0,0x10(%rsp)
lea    0x40(%rsp),%rsi
mov    $0x3,%edi
call   1050 <matriz_valores_quadrada@plt>
mov    %rax,%r14
lea    0x20(%rsp),%rdx
mov    $0x3,%edi
mov    $0x1,%esi
call   1040 <matriz_valores@plt>
mov    %rax,%r15
mov    %rsp,%rdx
mov    $0x3,%edi
mov    $0x1,%esi
call   1040 <matriz_valores@plt>
mov    %rax,%rbx
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rax,%rdx
mov    $0x3,%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    $0x90,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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