#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 VerifNumDifer(int *);
int VerifSomaLados(int *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int Dado[6], N, Cont, Cont2, Bolean;
  scanf("%d", &N);
  for (Cont = 0; Cont < N; Cont++) {
    for (Cont2 = 0; Cont2 < 6; Cont2++)
      scanf("%d", &Dado[Cont2]);
    Bolean = VerifSomaLados(Dado);
    if (Bolean == 0)
      Bolean = VerifNumDifer(Dado);
    if (Bolean == 0)
      printf("SIM\n");
    else
      printf("NAO\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
lea    -0x24(%rbp),%rsi
call   1060 <scanf@plt>
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    1208 <main+0xc8>
movl   $0x0,-0x2c(%rbp)
cmpl   $0x6,-0x2c(%rbp)
jge    11ac <main+0x6c>
movslq -0x2c(%rbp),%rax
lea    -0x20(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe67(%rip),%rdi
call   1060 <scanf@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1179 <main+0x39>
lea    -0x20(%rbp),%rdi
call   1050 <VerifSomaLados@plt>
mov    %eax,-0x30(%rbp)
cmpl   $0x0,-0x30(%rbp)
jne    11ce <main+0x8e>
lea    -0x20(%rbp),%rdi
call   1040 <VerifNumDifer@plt>
mov    %eax,-0x30(%rbp)
cmpl   $0x0,-0x30(%rbp)
jne    11e9 <main+0xa9>
lea    0xe24(%rip),%rdi
call   1030 <printf@plt>
jmp    11f5 <main+0xb5>
lea    0xe18(%rip),%rdi
call   1030 <printf@plt>
jmp    11fa <main+0xba>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1166 <main+0x26>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
lea    0xeab(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1060 <scanf@plt>
cmpl   $0x0,0xc(%rsp)
jle    120e <main+0xce>
lea    0x1c(%rsp),%r12
lea    0x20(%rsp),%r13
xor    %r15d,%r15d
lea    0x24(%rsp),%rbx
lea    0xe7d(%rip),%rbp
lea    0x10(%rsp),%r14
jmp    11a7 <main+0x67>
nopw   0x0(%rax,%rax,1)
lea    0xe6c(%rip),%rdi
call   1030 <puts@plt>
add    $0x1,%r15d
cmp    0xc(%rsp),%r15d
jge    120e <main+0xce>
mov    %rbp,%rdi
mov    %r14,%rsi
call   1060 <scanf@plt>
mov    %rbp,%rdi
lea    0x14(%rsp),%rsi
call   1060 <scanf@plt>
mov    %rbp,%rdi
lea    0x18(%rsp),%rsi
call   1060 <scanf@plt>
mov    %rbp,%rdi
mov    %r12,%rsi
call   1060 <scanf@plt>
mov    %rbp,%rdi
mov    %r13,%rsi
call   1060 <scanf@plt>
mov    %rbp,%rdi
mov    %rbx,%rsi
call   1060 <scanf@plt>
mov    %r14,%rdi
call   1050 <VerifSomaLados@plt>
test   %eax,%eax
jne    1190 <main+0x50>
mov    %r14,%rdi
call   1040 <VerifNumDifer@plt>
lea    0xdff(%rip),%rdi
test   %eax,%eax
jne    1190 <main+0x50>
jmp    1197 <main+0x57>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [5 x i8] c"SIM\0A\00"
@.str.2 = [5 x i8] c"NAO\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [6 x i32]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
store i32 0, i32* %4
br label %8
8: ; preds = %40, %0
%9 = load i32, i32* %4
%10 = load i32, i32* %3
%11 = icmp slt i32 %9, %10
br i1 %11, label %12, label %43
12: ; preds = %8
store i32 0, i32* %5
br label %13
13: ; preds = %21, %12
%14 = load i32, i32* %5
%15 = icmp slt i32 %14, 6
br i1 %15, label %16, label %24
16: ; preds = %13
%17 = load i32, i32* %5
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [6 x i32], [6 x i32]* %2, i64 0, i64 %18
%20 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %19)
br label %21
21: ; preds = %16
%22 = load i32, i32* %5
%23 = add nsw i32 %22, 1
store i32 %23, i32* %5
br label %13
24: ; preds = %13
%25 = getelementptr inbounds [6 x i32], [6 x i32]* %2, i64 0, i64 0
%26 = call i32 @VerifSomaLados(i32* %25)
store i32 %26, i32* %6
%27 = load i32, i32* %6
%28 = icmp eq i32 %27, 0
br i1 %28, label %29, label %32
29: ; preds = %24
%30 = getelementptr inbounds [6 x i32], [6 x i32]* %2, i64 0, i64 0
%31 = call i32 @VerifNumDifer(i32* %30)
store i32 %31, i32* %6
br label %32
32: ; preds = %29, %24
%33 = load i32, i32* %6
%34 = icmp eq i32 %33, 0
br i1 %34, label %35, label %37
35: ; preds = %32
%36 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
br label %39
37: ; preds = %32
%38 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %39
39: ; preds = %37, %35
br label %40
40: ; preds = %39
%41 = load i32, i32* %4
%42 = add nsw i32 %41, 1
store i32 %42, i32* %4
br label %8
43: ; preds = %8
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@str = [4 x i8] c"NAO\00"
@str.3 = [4 x i8] c"SIM\00"
define i32 @main() {
%1 = alloca [6 x i32]
%2 = alloca i32
%3 = bitcast [6 x i32]* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%6 = load i32, i32* %2
%7 = icmp sgt i32 %6, 0
br i1 %7, label %8, label %35
8: ; preds = %0
%9 = getelementptr inbounds [6 x i32], [6 x i32]* %1, i64 0, i64 0
%10 = getelementptr inbounds [6 x i32], [6 x i32]* %1, i64 0, i64 1
%11 = getelementptr inbounds [6 x i32], [6 x i32]* %1, i64 0, i64 2
%12 = getelementptr inbounds [6 x i32], [6 x i32]* %1, i64 0, i64 3
%13 = getelementptr inbounds [6 x i32], [6 x i32]* %1, i64 0, i64 4
%14 = getelementptr inbounds [6 x i32], [6 x i32]* %1, i64 0, i64 5
br label %15
15: ; preds = %8, %29
%16 = phi i32 [ 0, %8 ], [ %32, %29 ]
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %9)
%18 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %10)
%19 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %11)
%20 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %12)
%21 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %13)
%22 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %14)
%23 = call i32 @VerifSomaLados(i32* %9)
%24 = icmp eq i32 %23, 0
br i1 %24, label %25, label %28
25: ; preds = %15
%26 = call i32 @VerifNumDifer(i32* %9)
%27 = icmp eq i32 %26, 0
br i1 %27, label %29, label %28
28: ; preds = %15, %25
br label %29
29: ; preds = %25, %28
%30 = phi i8* [ getelementptr inbounds ([4 x i8], [4 x i8]* @str, i64 0, i64 0), %28 ], [ getelementptr inbounds ([4 x i8], [4 x i8]* @str.3, i64 0, i64 0), %25 ]
%31 = call i32 @puts(i8* dereferenceable(1) %30)
%32 = add nuw nsw i32 %16, 1
%33 = load i32, i32* %2
%34 = icmp slt i32 %32, %33
br i1 %34, label %15, label %35
35: ; preds = %29, %0
ret i32 0
}