#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 /*<<< orphan*/ is_safe(char *);
int length(char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, ...);
int main(int argc, const char *argv[]) {
  int i, n, len;
  char psw[60];
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%s", psw);
    len = length(psw);
    if (len < 8 || len > 16 || !is_safe(psw))
      printf("NO\n");
    else
      printf("YES\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xea3(%rip),%rdi
lea    -0x18(%rbp),%rsi
mov    $0x0,%al
call   1060 <scanf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    11ef <main+0xaf>
lea    -0x60(%rbp),%rsi
lea    0xe7d(%rip),%rdi
mov    $0x0,%al
call   1060 <scanf@plt>
lea    -0x60(%rbp),%rdi
call   1030 <length@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x8,-0x1c(%rbp)
jl     11bf <main+0x7f>
cmpl   $0x10,-0x1c(%rbp)
jg     11bf <main+0x7f>
lea    -0x60(%rbp),%rdi
call   1040 <is_safe@plt>
cmp    $0x0,%eax
jne    11d0 <main+0x90>
lea    0xe40(%rip),%rdi
call   1050 <printf@plt>
jmp    11dc <main+0x9c>
lea    0xe33(%rip),%rdi
call   1050 <printf@plt>
jmp    11e1 <main+0xa1>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    116f <main+0x2f>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x50,%rsp
lea    0xead(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
cmpl   $0x0,0xc(%rsp)
jle    11d1 <main+0x91>
lea    0xe96(%rip),%r14
lea    0x10(%rsp),%rbx
lea    0xe8d(%rip),%r15
lea    0xe89(%rip),%r12
xor    %ebp,%ebp
jmp    119e <main+0x5e>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
call   1040 <puts@plt>
add    $0x1,%ebp
cmp    0xc(%rsp),%ebp
jge    11d1 <main+0x91>
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
mov    %rbx,%rdi
call   1030 <length@plt>
add    $0xffffffef,%eax
mov    %r15,%rdi
cmp    $0xfffffff7,%eax
jb     1190 <main+0x50>
mov    %rbx,%rdi
call   1050 <is_safe@plt>
test   %eax,%eax
mov    %r12,%rdi
cmove  %r15,%rdi
jmp    1190 <main+0x50>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [3 x i8] c"%s\00"
@str = [3 x i8] c"NO\00"
@str.4 = [4 x i8] c"YES\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = alloca [60 x i8]
%5 = bitcast i32* %3 to i8*
%6 = getelementptr inbounds [60 x i8], [60 x i8]* %4, i64 0, i64 0
%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 = icmp sgt i32 %8, 0
br i1 %9, label %10, label %26
10: ; preds = %2, %20
%11 = phi i32 [ %23, %20 ], [ 0, %2 ]
%12 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %6)
%13 = call i32 @length(i8* %6)
%14 = add i32 %13, -17
%15 = icmp ult i32 %14, -9
br i1 %15, label %20, label %16
16: ; preds = %10
%17 = call i32 @is_safe(i8* %6)
%18 = icmp eq i32 %17, 0
%19 = select i1 %18, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @str.4, i64 0, i64 0)
br label %20
20: ; preds = %16, %10
%21 = phi i8* [ getelementptr inbounds ([3 x i8], [3 x i8]* @str, i64 0, i64 0), %10 ], [ %19, %16 ]
%22 = call i32 @puts(i8* dereferenceable(1) %21)
%23 = add nuw nsw i32 %11, 1
%24 = load i32, i32* %3
%25 = icmp slt i32 %23, %24
br i1 %25, label %10, label %26
26: ; preds = %20, %2
ret i32 0
}