#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*/ converte_milisegundo(unsigned long long);
int /*<<< orphan*/ imprime_vetor(int, double *);
int lucol(int, double **, int *);
int lurow(int, double **, int *);
int /*<<< orphan*/ printf(char *, ...);
int sscol(int, double **, int *, double *);
int ssrow(int, double **, int *, double *);
unsigned long long tempo_em_microsegundos();
int testa_lu(int n, double A[][800], double b[], int p[], int modo,
             int imprime_solucao, int imprime_tempo) {
  unsigned long long mark0, mark1, mark2;
  mark0 = tempo_em_microsegundos();
  if (modo == 0) {
    if (lurow(n, A, p) == -1)
      return -1;
  } else {
    if (lucol(n, A, p) == -1)
      return -1;
  }
  mark1 = tempo_em_microsegundos();
  if (modo == 0) {
    if (ssrow(n, A, p, b) == -1)
      return -1;
  } else {
    if (sscol(n, A, p, b) == -1)
      return -1;
  }
  mark2 = tempo_em_microsegundos();
  if (imprime_tempo) {
    printf("| %6.2lf |  %.2lf  |\n", converte_milisegundo(mark1 - mark0),
           converte_milisegundo(mark2 - mark1));
  }
  if (imprime_solucao == 1) {
    printf("x eh:\n");
    imprime_vetor(n, b);
  }
  return 0;
}


x86 assembly (clang, -O0):
<testa_lu>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    0x10(%rbp),%eax
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    %r9d,-0x28(%rbp)
mov    $0x0,%al
call   1040 <tempo_em_microsegundos@plt>
mov    %rax,-0x30(%rbp)
cmpl   $0x0,-0x24(%rbp)
jne    11e1 <testa_lu+0x61>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1080 <lurow@plt>
cmp    $0xffffffff,%eax
jne    11dc <testa_lu+0x5c>
movl   $0xffffffff,-0x4(%rbp)
jmp    12ec <testa_lu+0x16c>
jmp    120b <testa_lu+0x8b>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1090 <lucol@plt>
cmp    $0xffffffff,%eax
jne    1206 <testa_lu+0x86>
movl   $0xffffffff,-0x4(%rbp)
jmp    12ec <testa_lu+0x16c>
jmp    120b <testa_lu+0x8b>
mov    $0x0,%al
call   1040 <tempo_em_microsegundos@plt>
mov    %rax,-0x38(%rbp)
cmpl   $0x0,-0x24(%rbp)
jne    124e <testa_lu+0xce>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x18(%rbp),%rcx
call   1030 <ssrow@plt>
cmp    $0xffffffff,%eax
jne    1249 <testa_lu+0xc9>
movl   $0xffffffff,-0x4(%rbp)
jmp    12ec <testa_lu+0x16c>
jmp    127c <testa_lu+0xfc>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x18(%rbp),%rcx
call   10a0 <sscol@plt>
cmp    $0xffffffff,%eax
jne    1277 <testa_lu+0xf7>
movl   $0xffffffff,-0x4(%rbp)
jmp    12ec <testa_lu+0x16c>
jmp    127c <testa_lu+0xfc>
mov    $0x0,%al
call   1040 <tempo_em_microsegundos@plt>
mov    %rax,-0x40(%rbp)
cmpl   $0x0,0x10(%rbp)
je     12c1 <testa_lu+0x141>
mov    -0x38(%rbp),%rdi
sub    -0x30(%rbp),%rdi
call   1060 <converte_milisegundo@plt>
mov    %eax,-0x44(%rbp)
mov    -0x40(%rbp),%rdi
sub    -0x38(%rbp),%rdi
call   1060 <converte_milisegundo@plt>
mov    -0x44(%rbp),%esi
mov    %eax,%edx
lea    0xd46(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
cmpl   $0x1,-0x28(%rbp)
jne    12e5 <testa_lu+0x165>
lea    0xd44(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x8(%rbp),%edi
mov    -0x18(%rbp),%rsi
call   1050 <imprime_vetor@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testa_lu>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r9d,0x4(%rsp)
mov    %r8d,%ebp
mov    %rcx,%rbx
mov    %rdx,%r12
mov    %rsi,%r14
mov    %edi,%r15d
xor    %eax,%eax
call   1050 <tempo_em_microsegundos@plt>
mov    %rax,0x10(%rsp)
mov    %r15d,%edi
mov    %r14,%rsi
mov    %rbx,%rdx
test   %ebp,%ebp
je     1209 <testa_lu+0x79>
call   10a0 <lucol@plt>
mov    $0xffffffff,%r13d
cmp    $0xffffffff,%eax
je     12ae <testa_lu+0x11e>
xor    %eax,%eax
call   1050 <tempo_em_microsegundos@plt>
mov    %rax,0x8(%rsp)
mov    %r15d,%edi
mov    %r14,%rsi
mov    %rbx,%rdx
mov    %r12,%r14
mov    %r12,%rcx
call   10b0 <sscol@plt>
cmp    $0xffffffff,%eax
jne    1242 <testa_lu+0xb2>
jmp    12ae <testa_lu+0x11e>
call   1090 <lurow@plt>
mov    $0xffffffff,%r13d
cmp    $0xffffffff,%eax
je     12ae <testa_lu+0x11e>
xor    %eax,%eax
call   1050 <tempo_em_microsegundos@plt>
mov    %rax,0x8(%rsp)
mov    %r15d,%edi
mov    %r14,%rsi
mov    %rbx,%rdx
mov    %r12,%r14
mov    %r12,%rcx
call   1040 <ssrow@plt>
cmp    $0xffffffff,%eax
je     12ae <testa_lu+0x11e>
mov    0x4(%rsp),%ebp
mov    0x50(%rsp),%r12d
xor    %r13d,%r13d
xor    %eax,%eax
call   1050 <tempo_em_microsegundos@plt>
test   %r12d,%r12d
je     1292 <testa_lu+0x102>
mov    %rax,%rbx
mov    0x8(%rsp),%r12
mov    %r12,%rdi
sub    0x10(%rsp),%rdi
call   1070 <converte_milisegundo@plt>
mov    %eax,0x4(%rsp)
sub    %r12,%rbx
mov    %rbx,%rdi
call   1070 <converte_milisegundo@plt>
lea    0xd7b(%rip),%rdi
mov    0x4(%rsp),%esi
mov    %eax,%edx
xor    %eax,%eax
call   1080 <printf@plt>
cmp    $0x1,%ebp
jne    12ae <testa_lu+0x11e>
lea    0xd78(%rip),%rdi
call   1030 <puts@plt>
mov    %r15d,%edi
mov    %r14,%rsi
call   1060 <imprime_vetor@plt>
mov    %r13d,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [22 x i8] c"| %6.2lf | %.2lf |\0A\00"
@.str.1 = [7 x i8] c"x eh:\0A\00"
define i32 @testa_lu(i32 %0, [800 x double]* %1, double* %2, i32* %3, i32 %4, i32 %5, i32 %6) {
%8 = alloca i32
%9 = alloca i32
%10 = alloca [800 x double]*
%11 = alloca double*
%12 = alloca i32*
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i64
%17 = alloca i64
%18 = alloca i64
store i32 %0, i32* %9
store [800 x double]* %1, [800 x double]** %10
store double* %2, double** %11
store i32* %3, i32** %12
store i32 %4, i32* %13
store i32 %5, i32* %14
store i32 %6, i32* %15
%19 = call i64 (...) @tempo_em_microsegundos()
store i64 %19, i64* %16
%20 = load i32, i32* %13
%21 = icmp eq i32 %20, 0
br i1 %21, label %22, label %31
22: ; preds = %7
%23 = load i32, i32* %9
%24 = load [800 x double]*, [800 x double]** %10
%25 = bitcast [800 x double]* %24 to double**
%26 = load i32*, i32** %12
%27 = call i32 @lurow(i32 %23, double** %25, i32* %26)
%28 = icmp eq i32 %27, -1
br i1 %28, label %29, label %30
29: ; preds = %22
store i32 -1, i32* %8
br label %87
30: ; preds = %22
br label %40
31: ; preds = %7
%32 = load i32, i32* %9
%33 = load [800 x double]*, [800 x double]** %10
%34 = bitcast [800 x double]* %33 to double**
%35 = load i32*, i32** %12
%36 = call i32 @lucol(i32 %32, double** %34, i32* %35)
%37 = icmp eq i32 %36, -1
br i1 %37, label %38, label %39
38: ; preds = %31
store i32 -1, i32* %8
br label %87
39: ; preds = %31
br label %40
40: ; preds = %39, %30
%41 = call i64 (...) @tempo_em_microsegundos()
store i64 %41, i64* %17
%42 = load i32, i32* %13
%43 = icmp eq i32 %42, 0
br i1 %43, label %44, label %54
44: ; preds = %40
%45 = load i32, i32* %9
%46 = load [800 x double]*, [800 x double]** %10
%47 = bitcast [800 x double]* %46 to double**
%48 = load i32*, i32** %12
%49 = load double*, double** %11
%50 = call i32 @ssrow(i32 %45, double** %47, i32* %48, double* %49)
%51 = icmp eq i32 %50, -1
br i1 %51, label %52, label %53
52: ; preds = %44
store i32 -1, i32* %8
br label %87
53: ; preds = %44
br label %64
54: ; preds = %40
%55 = load i32, i32* %9
%56 = load [800 x double]*, [800 x double]** %10
%57 = bitcast [800 x double]* %56 to double**
%58 = load i32*, i32** %12
%59 = load double*, double** %11
%60 = call i32 @sscol(i32 %55, double** %57, i32* %58, double* %59)
%61 = icmp eq i32 %60, -1
br i1 %61, label %62, label %63
62: ; preds = %54
store i32 -1, i32* %8
br label %87
63: ; preds = %54
br label %64
64: ; preds = %63, %53
%65 = call i64 (...) @tempo_em_microsegundos()
store i64 %65, i64* %18
%66 = load i32, i32* %15
%67 = icmp ne i32 %66, 0
br i1 %67, label %68, label %78
68: ; preds = %64
%69 = load i64, i64* %17
%70 = load i64, i64* %16
%71 = sub i64 %69, %70
%72 = call i32 @converte_milisegundo(i64 %71)
%73 = load i64, i64* %18
%74 = load i64, i64* %17
%75 = sub i64 %73, %74
%76 = call i32 @converte_milisegundo(i64 %75)
%77 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %72, i32 %76)
br label %78
78: ; preds = %68, %64
%79 = load i32, i32* %14
%80 = icmp eq i32 %79, 1
br i1 %80, label %81, label %86
81: ; preds = %78
%82 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%83 = load i32, i32* %9
%84 = load double*, double** %11
%85 = call i32 @imprime_vetor(i32 %83, double* %84)
br label %86
86: ; preds = %81, %78
store i32 0, i32* %8
br label %87
87: ; preds = %86, %62, %52, %38, %29
%88 = load i32, i32* %8
ret i32 %88
}

LLVM IR (-O2):
@.str = [22 x i8] c"| %6.2lf | %.2lf |\0A\00"
@str = [6 x i8] c"x eh:\00"
define i32 @testa_lu(i32 %0, [800 x double]* %1, double* %2, i32* %3, i32 %4, i32 %5, i32 %6) {
%8 = tail call i64 (...) @tempo_em_microsegundos()
%9 = icmp eq i32 %4, 0
%10 = bitcast [800 x double]* %1 to double**
br i1 %9, label %11, label %14
11: ; preds = %7
%12 = tail call i32 @lurow(i32 %0, double** %10, i32* %3)
%13 = icmp eq i32 %12, -1
br i1 %13, label %40, label %17
14: ; preds = %7
%15 = tail call i32 @lucol(i32 %0, double** %10, i32* %3)
%16 = icmp eq i32 %15, -1
br i1 %16, label %40, label %21
17: ; preds = %11
%18 = tail call i64 (...) @tempo_em_microsegundos()
%19 = tail call i32 @ssrow(i32 %0, double** %10, i32* %3, double* %2)
%20 = icmp eq i32 %19, -1
br i1 %20, label %40, label %25
21: ; preds = %14
%22 = tail call i64 (...) @tempo_em_microsegundos()
%23 = tail call i32 @sscol(i32 %0, double** %10, i32* %3, double* %2)
%24 = icmp eq i32 %23, -1
br i1 %24, label %40, label %25
25: ; preds = %21, %17
%26 = phi i64 [ %22, %21 ], [ %18, %17 ]
%27 = tail call i64 (...) @tempo_em_microsegundos()
%28 = icmp eq i32 %6, 0
br i1 %28, label %35, label %29
29: ; preds = %25
%30 = sub i64 %26, %8
%31 = tail call i32 @converte_milisegundo(i64 %30)
%32 = sub i64 %27, %26
%33 = tail call i32 @converte_milisegundo(i64 %32)
%34 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %31, i32 %33)
br label %35
35: ; preds = %29, %25
%36 = icmp eq i32 %5, 1
br i1 %36, label %37, label %40
37: ; preds = %35
%38 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
%39 = tail call i32 @imprime_vetor(i32 %0, double* %2)
br label %40
40: ; preds = %35, %37, %21, %17, %14, %11
%41 = phi i32 [ -1, %11 ], [ -1, %14 ], [ -1, %17 ], [ -1, %21 ], [ 0, %37 ], [ 0, %35 ]
ret i32 %41
}