#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_02() {
  char nome[4] = "R02";
  int conjS[3] = {1, 2, 3};
  int rho[5][2] = {{1, 1}, {1, 2}, {2, 1}, {2, 2}, {3, 3}};
  int reflexiva = 1;
  int simetrica = 1;
  int transitiva = 1;
  int anti_simetrica = 0;
  int equivalencia = 1;
  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_02>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    0xe82(%rip),%eax
mov    %eax,-0x4(%rbp)
mov    0xf88(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xf86(%rip),%eax
mov    %eax,-0x8(%rbp)
lea    -0x40(%rbp),%rdi
lea    0xf80(%rip),%rsi
mov    $0x28,%edx
call   1050 <memcpy@plt>
movl   $0x1,-0x44(%rbp)
movl   $0x1,-0x48(%rbp)
movl   $0x1,-0x4c(%rbp)
movl   $0x0,-0x50(%rbp)
movl   $0x1,-0x54(%rbp)
lea    0xe90(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x40(%rbp),%rdi
call   1070 <ehReflexiva@plt>
cmp    -0x44(%rbp),%eax
je     11ff <relacao_02+0x8f>
lea    -0x4(%rbp),%rsi
lea    0xe0c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <ehSimetrica@plt>
cmp    -0x48(%rbp),%eax
je     1221 <relacao_02+0xb1>
lea    -0x4(%rbp),%rsi
lea    0xe1b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1060 <ehTransitiva@plt>
cmp    -0x4c(%rbp),%eax
je     1243 <relacao_02+0xd3>
lea    -0x4(%rbp),%rsi
lea    0xe2a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1080 <ehAntiSimetrica@plt>
cmp    -0x50(%rbp),%eax
je     1265 <relacao_02+0xf5>
lea    -0x4(%rbp),%rsi
lea    0xe3a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1090 <ehEquivalencia@plt>
cmp    -0x54(%rbp),%eax
je     1287 <relacao_02+0x117>
lea    -0x4(%rbp),%rsi
lea    0xe4e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<relacao_02>:
sub    $0x38,%rsp
movl   $0x323052,0xc(%rsp)
mov    0xe9d(%rip),%rax
mov    %rax,0x30(%rsp)
movaps 0xe81(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xe65(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0x10(%rsp),%rdi
call   1070 <ehReflexiva@plt>
cmp    $0x1,%eax
je     11cc <relacao_02+0x5c>
lea    0xe68(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <ehSimetrica@plt>
cmp    $0x1,%eax
je     11eb <relacao_02+0x7b>
lea    0xe7a(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1060 <ehTransitiva@plt>
cmp    $0x1,%eax
je     120a <relacao_02+0x9a>
lea    0xe8c(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1080 <ehAntiSimetrica@plt>
test   %eax,%eax
je     1228 <relacao_02+0xb8>
lea    0xea0(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1090 <ehEquivalencia@plt>
cmp    $0x1,%eax
je     1247 <relacao_02+0xd7>
lea    0xeb7(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x38,%rsp
ret

LLVM IR (-O0):
@__const.relacao_02.nome = [4 x i8] c"R02\00"
@__const.relacao_02.conjS = [3 x i32] [i32 1, i32 2, i32 3]
@__const.relacao_02.rho = [5 x [2 x i32]] [[2 x i32] [i32 1, i32 1], [2 x i32] [i32 1, i32 2], [2 x i32] [i32 2, i32 1], [2 x i32] [i32 2, i32 2], [2 x i32] [i32 3, i32 3]]
@.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_02() {
%1 = alloca [4 x i8]
%2 = alloca [3 x i32]
%3 = alloca [5 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 [5 x [2 x i32]]* %3 to i8*
store i32 1, i32* %4
store i32 1, i32* %5
store i32 1, i32* %6
store i32 0, i32* %7
store i32 1, i32* %8
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%13 = getelementptr inbounds [5 x [2 x i32]], [5 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_02.rho = [5 x [2 x i32]] [[2 x i32] [i32 1, i32 1], [2 x i32] [i32 1, i32 2], [2 x i32] [i32 2, i32 1], [2 x i32] [i32 2, i32 2], [2 x i32] [i32 3, i32 3]]
@.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_02() {
%1 = alloca i32
%2 = alloca [5 x [2 x i32]]
%3 = bitcast i32* %1 to i8*
store i32 3289170, i32* %1
%4 = bitcast [5 x [2 x i32]]* %2 to i8*
%5 = tail call i32 @putchar(i32 10)
%6 = bitcast [5 x [2 x i32]]* %2 to i32**
%7 = call i32 @ehReflexiva(i32** %6)
%8 = icmp eq i32 %7, 1
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, 1
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, 0
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, 1
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
}