#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 */
scalar_t__ avaliarExpressao(char *, int /*<<< orphan*/);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ stdin;
int main(void) {
  int casos;
  char str[1024];
  scanf("%d\n", &casos);
  while (fgets(str, 1024, stdin) != NULL) {
    printf("%s\n", avaliarExpressao(str, 0) ? "correct" : "incorrect");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x410,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xea7(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
lea    -0x410(%rbp),%rdi
mov    0x2e78(%rip),%rax
mov    (%rax),%edx
mov    $0x400,%esi
call   1040 <fgets@plt>
cmp    $0x0,%rax
je     11be <main+0x7e>
lea    -0x410(%rbp),%rdi
xor    %esi,%esi
call   1060 <avaliarExpressao@plt>
mov    %rax,%rcx
lea    0xe6a(%rip),%rsi
lea    0xe65(%rip),%rax
cmp    $0x0,%rcx
cmovne %rax,%rsi
lea    0xe50(%rip),%rdi
call   1030 <printf@plt>
jmp    1162 <main+0x22>
xor    %eax,%eax
add    $0x410,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x410,%rsp
lea    0xea9(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x2e80(%rip),%r15
mov    (%r15),%edx
lea    0x10(%rsp),%rdi
mov    $0x400,%esi
call   1040 <fgets@plt>
test   %rax,%rax
je     11d1 <main+0x91>
lea    0x10(%rsp),%rbx
lea    0xe7d(%rip),%r12
lea    0xe78(%rip),%r13
lea    0xe6b(%rip),%r14
nopl   0x0(%rax)
mov    %rbx,%rdi
xor    %esi,%esi
call   1060 <avaliarExpressao@plt>
test   %rax,%rax
mov    %r13,%rsi
cmove  %r12,%rsi
mov    %r14,%rdi
call   1030 <printf@plt>
mov    (%r15),%edx
mov    %rbx,%rdi
mov    $0x400,%esi
call   1040 <fgets@plt>
test   %rax,%rax
jne    11a0 <main+0x60>
xor    %eax,%eax
add    $0x410,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
@stdin = global i32 0
@.str.1 = [4 x i8] c"%s\0A\00"
@.str.2 = [8 x i8] c"correct\00"
@.str.3 = [10 x i8] c"incorrect\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [1024 x i8]
store i32 0, i32* %1
%4 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %2)
br label %5
5: ; preds = %10, %0
%6 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%7 = load i32, i32* @stdin
%8 = call i32* @fgets(i8* %6, i32 1024, i32 %7)
%9 = icmp ne i32* %8, null
br i1 %9, label %10, label %17
10: ; preds = %5
%11 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%12 = call i64 @avaliarExpressao(i8* %11, i32 0)
%13 = icmp ne i64 %12, 0
%14 = zext i1 %13 to i64
%15 = select i1 %13, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0)
%16 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %15)
br label %5
17: ; preds = %5
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
@stdin = global i32 0
@.str.1 = [4 x i8] c"%s\0A\00"
@.str.2 = [8 x i8] c"correct\00"
@.str.3 = [10 x i8] c"incorrect\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [1024 x i8]
%3 = bitcast i32* %1 to i8*
%4 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%5 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %1)
%6 = load i32, i32* @stdin
%7 = call i32* @fgets(i8* %4, i32 1024, i32 %6)
%8 = icmp eq i32* %7, null
br i1 %8, label %17, label %9
9: ; preds = %0, %9
%10 = call i64 @avaliarExpressao(i8* %4, i32 0)
%11 = icmp eq i64 %10, 0
%12 = select i1 %11, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0)
%13 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %12)
%14 = load i32, i32* @stdin
%15 = call i32* @fgets(i8* %4, i32 1024, i32 %14)
%16 = icmp eq i32* %15, null
br i1 %16, label %17, label %9
17: ; preds = %9, %0
ret i32 0
}