#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 ehAntiSimetrica();
int ehEquivalencia();
int ehReflexiva(int **);
int ehSimetrica();
int ehTransitiva();
int /*<<< orphan*/ printf(char *, ...);
void relacao_01() {
  char nome[4] = "R01";
  int conjS[3] = {1, 2, 3};
  int rho[3][2] = {{1, 2}, {3, 2}, {1, 1}};
  int reflexiva = 0;
  int simetrica = 0;
  int transitiva = 1;
  int anti_simetrica = 1;
  int equivalencia = 0;
  printf("\n");
  if (ehReflexiva(rho) != reflexiva) {
    printf("ERRO: [%s] - Problema na propriedade reflexiva!\n", nome);
  }
  if (ehSimetrica() != simetrica) {
    printf("ERRO: [%s] - Problema na propriedade simetrica!\n", nome);
  }
  if (ehTransitiva() != transitiva) {
    printf("ERRO: [%s] - Problema na propriedade transitiva!\n", nome);
  }
  if (ehAntiSimetrica() != anti_simetrica) {
    printf("ERRO: [%s] - Problema na propriedade anti-simetrica!\n", nome);
  }
  if (ehEquivalencia() != equivalencia) {
    printf("ERRO: [%s] - Problema na verifiacao da equivalencia!\n", nome);
  }
}


x86 assembly (clang, -O0):
<relacao_01>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    0xe92(%rip),%eax
mov    %eax,-0x4(%rbp)
mov    0xf98(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xf96(%rip),%eax
mov    %eax,-0x8(%rbp)
mov    0xf94(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xf91(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xf8e(%rip),%rax
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x34(%rbp)
movl   $0x0,-0x38(%rbp)
movl   $0x1,-0x3c(%rbp)
movl   $0x1,-0x40(%rbp)
movl   $0x0,-0x44(%rbp)
lea    0xe94(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x30(%rbp),%rdi
call   1060 <ehReflexiva@plt>
cmp    -0x34(%rbp),%eax
je     11fb <relacao_01+0x9b>
lea    -0x4(%rbp),%rsi
lea    0xe10(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <ehSimetrica@plt>
cmp    -0x38(%rbp),%eax
je     121d <relacao_01+0xbd>
lea    -0x4(%rbp),%rsi
lea    0xe1f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1050 <ehTransitiva@plt>
cmp    -0x3c(%rbp),%eax
je     123f <relacao_01+0xdf>
lea    -0x4(%rbp),%rsi
lea    0xe2e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1070 <ehAntiSimetrica@plt>
cmp    -0x40(%rbp),%eax
je     1261 <relacao_01+0x101>
lea    -0x4(%rbp),%rsi
lea    0xe3e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1080 <ehEquivalencia@plt>
cmp    -0x44(%rbp),%eax
je     1283 <relacao_01+0x123>
lea    -0x4(%rbp),%rsi
lea    0xe52(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<relacao_01>:
sub    $0x28,%rsp
movl   $0x313052,0xc(%rsp)
mov    0xe8d(%rip),%rax
mov    %rax,0x20(%rsp)
movaps 0xe71(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0x10(%rsp),%rdi
call   1070 <ehReflexiva@plt>
test   %eax,%eax
je     11bf <relacao_01+0x4f>
lea    0xe65(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <ehSimetrica@plt>
test   %eax,%eax
je     11dd <relacao_01+0x6d>
lea    0xe78(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1060 <ehTransitiva@plt>
cmp    $0x1,%eax
je     11fc <relacao_01+0x8c>
lea    0xe8a(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1080 <ehAntiSimetrica@plt>
cmp    $0x1,%eax
je     121b <relacao_01+0xab>
lea    0xe9d(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1090 <ehEquivalencia@plt>
test   %eax,%eax
je     1239 <relacao_01+0xc9>
lea    0xeb5(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x28,%rsp
ret

LLVM IR (-O0):
@__const.relacao_01.nome = [4 x i8] c"R01\00"
@__const.relacao_01.conjS = [3 x i32] [i32 1, i32 2, i32 3]
@__const.relacao_01.rho = [3 x [2 x i32]] [[2 x i32] [i32 1, i32 2], [2 x i32] [i32 3, i32 2], [2 x i32] [i32 1, i32 1]]
@.str = [2 x i8] c"\0A\00"
@.str.1 = [49 x i8] c"ERRO: [%s] - Problema na propriedade reflexiva!\0A\00"
@.str.2 = [49 x i8] c"ERRO: [%s] - Problema na propriedade simetrica!\0A\00"
@.str.3 = [50 x i8] c"ERRO: [%s] - Problema na propriedade transitiva!\0A\00"
@.str.4 = [54 x i8] c"ERRO: [%s] - Problema na propriedade anti-simetrica!\0A\00"
@.str.5 = [54 x i8] c"ERRO: [%s] - Problema na verifiacao da equivalencia!\0A\00"
define void @relacao_01() {
%1 = alloca [4 x i8]
%2 = alloca [3 x i32]
%3 = alloca [3 x [2 x i32]]
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = bitcast [4 x i8]* %1 to i8*
%10 = bitcast [3 x i32]* %2 to i8*
%11 = bitcast [3 x [2 x i32]]* %3 to i8*
store i32 0, i32* %4
store i32 0, i32* %5
store i32 1, i32* %6
store i32 1, i32* %7
store i32 0, i32* %8
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%13 = getelementptr inbounds [3 x [2 x i32]], [3 x [2 x i32]]* %3, i64 0, i64 0
%14 = bitcast [2 x i32]* %13 to i32**
%15 = call i32 @ehReflexiva(i32** %14)
%16 = load i32, i32* %4
%17 = icmp ne i32 %15, %16
br i1 %17, label %18, label %21
18: ; preds = %0
%19 = getelementptr inbounds [4 x i8], [4 x i8]* %1, i64 0, i64 0
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.1, i64 0, i64 0), i8* %19)
br label %21
21: ; preds = %18, %0
%22 = call i32 (...) @ehSimetrica()
%23 = load i32, i32* %5
%24 = icmp ne i32 %22, %23
br i1 %24, label %25, label %28
25: ; preds = %21
%26 = getelementptr inbounds [4 x i8], [4 x i8]* %1, i64 0, i64 0
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.2, i64 0, i64 0), i8* %26)
br label %28
28: ; preds = %25, %21
%29 = call i32 (...) @ehTransitiva()
%30 = load i32, i32* %6
%31 = icmp ne i32 %29, %30
br i1 %31, label %32, label %35
32: ; preds = %28
%33 = getelementptr inbounds [4 x i8], [4 x i8]* %1, i64 0, i64 0
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.3, i64 0, i64 0), i8* %33)
br label %35
35: ; preds = %32, %28
%36 = call i32 (...) @ehAntiSimetrica()
%37 = load i32, i32* %7
%38 = icmp ne i32 %36, %37
br i1 %38, label %39, label %42
39: ; preds = %35
%40 = getelementptr inbounds [4 x i8], [4 x i8]* %1, i64 0, i64 0
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.4, i64 0, i64 0), i8* %40)
br label %42
42: ; preds = %39, %35
%43 = call i32 (...) @ehEquivalencia()
%44 = load i32, i32* %8
%45 = icmp ne i32 %43, %44
br i1 %45, label %46, label %49
46: ; preds = %42
%47 = getelementptr inbounds [4 x i8], [4 x i8]* %1, i64 0, i64 0
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.5, i64 0, i64 0), i8* %47)
br label %49
49: ; preds = %46, %42
ret void
}

LLVM IR (-O2):
@__const.relacao_01.rho = [3 x [2 x i32]] [[2 x i32] [i32 1, i32 2], [2 x i32] [i32 3, i32 2], [2 x i32] [i32 1, i32 1]]
@.str.1 = [49 x i8] c"ERRO: [%s] - Problema na propriedade reflexiva!\0A\00"
@.str.2 = [49 x i8] c"ERRO: [%s] - Problema na propriedade simetrica!\0A\00"
@.str.3 = [50 x i8] c"ERRO: [%s] - Problema na propriedade transitiva!\0A\00"
@.str.4 = [54 x i8] c"ERRO: [%s] - Problema na propriedade anti-simetrica!\0A\00"
@.str.5 = [54 x i8] c"ERRO: [%s] - Problema na verifiacao da equivalencia!\0A\00"
define void @relacao_01() {
%1 = alloca i32
%2 = alloca [3 x [2 x i32]]
%3 = bitcast i32* %1 to i8*
store i32 3223634, i32* %1
%4 = bitcast [3 x [2 x i32]]* %2 to i8*
%5 = tail call i32 @putchar(i32 10)
%6 = bitcast [3 x [2 x i32]]* %2 to i32**
%7 = call i32 @ehReflexiva(i32** %6)
%8 = icmp eq i32 %7, 0
br i1 %8, label %11, label %9
9: ; preds = %0
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @.str.1, i64 0, i64 0), i32* %1)
br label %11
11: ; preds = %9, %0
%12 = call i32 (...) @ehSimetrica()
%13 = icmp eq i32 %12, 0
br i1 %13, label %16, label %14
14: ; preds = %11
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @.str.2, i64 0, i64 0), i32* %1)
br label %16
16: ; preds = %14, %11
%17 = call i32 (...) @ehTransitiva()
%18 = icmp eq i32 %17, 1
br i1 %18, label %21, label %19
19: ; preds = %16
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @.str.3, i64 0, i64 0), i32* %1)
br label %21
21: ; preds = %19, %16
%22 = call i32 (...) @ehAntiSimetrica()
%23 = icmp eq i32 %22, 1
br i1 %23, label %26, label %24
24: ; preds = %21
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @.str.4, i64 0, i64 0), i32* %1)
br label %26
26: ; preds = %24, %21
%27 = call i32 (...) @ehEquivalencia()
%28 = icmp eq i32 %27, 0
br i1 %28, label %31, label %29
29: ; preds = %26
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @.str.5, i64 0, i64 0), i32* %1)
br label %31
31: ; preds = %29, %26
ret void
}