#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 abs(int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, ...);
int main() {
  char a[5];
  int b, i, n, c_value, nice;
  scanf("%d", &n);
  while (n--) {
    scanf("%3s-%d", a, &b);
    c_value = 26 * 26 * (a[0] - 'A') + 26 * (a[1] - 'A') + a[2] - 'A';
    nice = abs(c_value - b);
    if (nice <= 100)
      printf("nice\n");
    else
      printf("not nice\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xebe(%rip),%rdi
lea    -0x18(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
mov    -0x18(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x18(%rbp)
cmp    $0x0,%eax
je     11da <main+0xaa>
lea    -0x9(%rbp),%rsi
lea    0xe90(%rip),%rdi
lea    -0x10(%rbp),%rdx
mov    $0x0,%al
call   1050 <scanf@plt>
movsbl -0x9(%rbp),%eax
sub    $0x41,%eax
imul   $0x2a4,%eax,%eax
movsbl -0x8(%rbp),%ecx
sub    $0x41,%ecx
imul   $0x1a,%ecx,%ecx
add    %ecx,%eax
movsbl -0x7(%rbp),%ecx
add    %ecx,%eax
sub    $0x41,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%edi
sub    -0x10(%rbp),%edi
call   1030 <abs@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x64,-0x20(%rbp)
jg     11c9 <main+0x99>
lea    0xe4c(%rip),%rdi
call   1040 <printf@plt>
jmp    11d5 <main+0xa5>
lea    0xe37(%rip),%rdi
call   1040 <printf@plt>
jmp    1151 <main+0x21>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
lea    0xed0(%rip),%rdi
lea    0x8(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
subl   $0x1,0x8(%rsp)
jae    1157 <main+0x37>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret
lea    0xea2(%rip),%r14
lea    0x3(%rsp),%r15
lea    0xc(%rsp),%r12
lea    0xe9c(%rip),%rbx
lea    0xe91(%rip),%r13
jmp    118c <main+0x6c>
nopl   0x0(%rax,%rax,1)
call   1030 <puts@plt>
subl   $0x1,0x8(%rsp)
jb     1147 <main+0x27>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
xor    %eax,%eax
call   1040 <scanf@plt>
movsbl 0x3(%rsp),%eax
imul   $0x2a4,%eax,%eax
movsbl 0x4(%rsp),%ecx
lea    (%rcx,%rcx,4),%edx
lea    (%rdx,%rdx,4),%edx
add    %ecx,%edx
add    %eax,%edx
movsbl 0x5(%rsp),%eax
add    %edx,%eax
sub    0xc(%rsp),%eax
add    $0xffff4d81,%eax
mov    %eax,%ecx
neg    %ecx
cmovs  %eax,%ecx
mov    %rbx,%rdi
cmp    $0x65,%ecx
jb     1180 <main+0x60>
mov    %r13,%rdi
jmp    1180 <main+0x60>

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [7 x i8] c"%3s-%d\00"
@str = [9 x i8] c"not nice\00"
@str.4 = [5 x i8] c"nice\00"
define i32 @main() {
%1 = alloca [5 x i8]
%2 = alloca i32
%3 = alloca i32
%4 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 0
%5 = bitcast i32* %2 to i8*
%6 = bitcast i32* %3 to i8*
%7 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%8 = load i32, i32* %3
%9 = add nsw i32 %8, -1
store i32 %9, i32* %3
%10 = icmp eq i32 %8, 0
br i1 %10, label %36, label %11
11: ; preds = %0
%12 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 1
%13 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 2
br label %14
14: ; preds = %11, %14
%15 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %4, i32* %2)
%16 = load i8, i8* %4
%17 = sext i8 %16 to i32
%18 = mul nsw i32 %17, 676
%19 = load i8, i8* %12
%20 = sext i8 %19 to i32
%21 = mul nsw i32 %20, 26
%22 = load i8, i8* %13
%23 = sext i8 %22 to i32
%24 = load i32, i32* %2
%25 = add nsw i32 %18, -45695
%26 = add nsw i32 %25, %21
%27 = add nsw i32 %26, %23
%28 = sub i32 %27, %24
%29 = call i32 @llvm.abs.i32(i32 %28, i1 true)
%30 = icmp ult i32 %29, 101
%31 = select i1 %30, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @str.4, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @str, i64 0, i64 0)
%32 = call i32 @puts(i8* dereferenceable(1) %31)
%33 = load i32, i32* %3
%34 = add nsw i32 %33, -1
store i32 %34, i32* %3
%35 = icmp eq i32 %33, 0
br i1 %35, label %36, label %14
36: ; preds = %14, %0
ret i32 0
}