#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*/ printf(char *, char *);
int /*<<< orphan*/ scanf(char *, ...);
scalar_t__ strcmp(char *, char *);
int main(void) {
  char t[11];
  int n, m, i, j, key = 0;
  char u[256][11];
  scanf("%d\n", &n);
  for (i = 0; i < n; i++)
    scanf(" %s", u[i]);
  scanf(" %d", &m);
  for (i = 0; i < m; i++) {
    scanf(" %s", t);
    for (j = 0; j < n; j++) {
      if (strcmp(t, u[j]) == 0)
        break;
    }
    if (j == n) {
      printf("Unknown %s\n", t);
    } else if (key == 0) {
      key = 1;
      printf("Opened by %s\n", t);
    } else {
      key = 0;
      printf("Closed by %s\n", t);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x24(%rbp)
lea    0xeb0(%rip),%rdi
lea    -0x14(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    119c <main+0x6c>
movslq -0x1c(%rbp),%rax
lea    -0xb30(%rbp),%rsi
imul   $0xb,%rax,%rax
add    %rax,%rsi
lea    0xe7d(%rip),%rdi
mov    $0x0,%al
call   1050 <scanf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1162 <main+0x32>
lea    0xe65(%rip),%rdi
lea    -0x18(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    1299 <main+0x169>
lea    -0xf(%rbp),%rsi
lea    0xe38(%rip),%rdi
mov    $0x0,%al
call   1050 <scanf@plt>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1223 <main+0xf3>
lea    -0xf(%rbp),%rdi
movslq -0x20(%rbp),%rax
lea    -0xb30(%rbp),%rsi
imul   $0xb,%rax,%rax
add    %rax,%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    1210 <main+0xe0>
jmp    1223 <main+0xf3>
jmp    1215 <main+0xe5>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    11da <main+0xaa>
mov    -0x20(%rbp),%eax
cmp    -0x14(%rbp),%eax
jne    1244 <main+0x114>
lea    -0xf(%rbp),%rsi
lea    0xdd2(%rip),%rdi
call   1030 <printf@plt>
jmp    1286 <main+0x156>
cmpl   $0x0,-0x24(%rbp)
jne    126a <main+0x13a>
movl   $0x1,-0x24(%rbp)
lea    -0xf(%rbp),%rsi
lea    0xdb8(%rip),%rdi
call   1030 <printf@plt>
jmp    1281 <main+0x151>
movl   $0x0,-0x24(%rbp)
lea    -0xf(%rbp),%rsi
lea    0xdaa(%rip),%rdi
call   1030 <printf@plt>
jmp    1286 <main+0x156>
jmp    128b <main+0x15b>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11b5 <main+0x85>
xor    %eax,%eax
add    $0xb30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xb28,%rsp
lea    0xeb8(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
cmpl   $0x0,0xc(%rsp)
jle    118f <main+0x5f>
lea    0x20(%rsp),%rbx
lea    0xe9d(%rip),%r14
xor    %ebp,%ebp
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
add    $0x1,%rbp
movslq 0xc(%rsp),%rax
add    $0xb,%rbx
cmp    %rax,%rbp
jl     1170 <main+0x40>
lea    0xe72(%rip),%rdi
xor    %r12d,%r12d
lea    0x10(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
cmpl   $0x0,0x10(%rsp)
jle    1257 <main+0x127>
lea    0x15(%rsp),%r15
lea    0xe6a(%rip),%r13
xor    %ebp,%ebp
jmp    11fd <main+0xcd>
mov    0xc(%rsp),%eax
xor    %ecx,%ecx
test   %r12d,%r12d
sete   %cl
mov    %r13,%rdi
lea    0xe42(%rip),%rdx
cmove  %rdx,%rdi
cmp    %eax,%r14d
lea    0xe28(%rip),%rax
cmove  %rax,%rdi
cmovne %ecx,%r12d
mov    %r15,%rsi
call   1030 <printf@plt>
add    $0x1,%ebp
cmp    0x10(%rsp),%ebp
jge    1257 <main+0x127>
xor    %r14d,%r14d
lea    0xdfd(%rip),%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0xc(%rsp),%eax
test   %eax,%eax
jle    11c4 <main+0x94>
lea    0x20(%rsp),%rbx
xor    %r14d,%r14d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r15,%rdi
mov    %rbx,%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
je     11c0 <main+0x90>
add    $0x1,%r14
movslq 0xc(%rsp),%rax
add    $0xb,%rbx
cmp    %rax,%r14
jl     1230 <main+0x100>
jmp    11c4 <main+0x94>
xor    %eax,%eax
add    $0xb28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
@.str.1 = [4 x i8] c" %s\00"
@.str.2 = [4 x i8] c" %d\00"
@.str.3 = [12 x i8] c"Unknown %s\0A\00"
@.str.4 = [14 x i8] c"Opened by %s\0A\00"
@.str.5 = [14 x i8] c"Closed by %s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [11 x i8]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca [256 x [11 x i8]]
store i32 0, i32* %1
store i32 0, i32* %7
%9 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %3)
store i32 0, i32* %5
br label %10
10: ; preds = %20, %0
%11 = load i32, i32* %5
%12 = load i32, i32* %3
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %23
14: ; preds = %10
%15 = load i32, i32* %5
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [256 x [11 x i8]], [256 x [11 x i8]]* %8, i64 0, i64 %16
%18 = getelementptr inbounds [11 x i8], [11 x i8]* %17, i64 0, i64 0
%19 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %18)
br label %20
20: ; preds = %14
%21 = load i32, i32* %5
%22 = add nsw i32 %21, 1
store i32 %22, i32* %5
br label %10
23: ; preds = %10
%24 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32* %4)
store i32 0, i32* %5
br label %25
25: ; preds = %67, %23
%26 = load i32, i32* %5
%27 = load i32, i32* %4
%28 = icmp slt i32 %26, %27
br i1 %28, label %29, label %70
29: ; preds = %25
%30 = getelementptr inbounds [11 x i8], [11 x i8]* %2, i64 0, i64 0
%31 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %30)
store i32 0, i32* %6
br label %32
32: ; preds = %46, %29
%33 = load i32, i32* %6
%34 = load i32, i32* %3
%35 = icmp slt i32 %33, %34
br i1 %35, label %36, label %49
36: ; preds = %32
%37 = getelementptr inbounds [11 x i8], [11 x i8]* %2, i64 0, i64 0
%38 = load i32, i32* %6
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds [256 x [11 x i8]], [256 x [11 x i8]]* %8, i64 0, i64 %39
%41 = getelementptr inbounds [11 x i8], [11 x i8]* %40, i64 0, i64 0
%42 = call i64 @strcmp(i8* %37, i8* %41)
%43 = icmp eq i64 %42, 0
br i1 %43, label %44, label %45
44: ; preds = %36
br label %49
45: ; preds = %36
br label %46
46: ; preds = %45
%47 = load i32, i32* %6
%48 = add nsw i32 %47, 1
store i32 %48, i32* %6
br label %32
49: ; preds = %44, %32
%50 = load i32, i32* %6
%51 = load i32, i32* %3
%52 = icmp eq i32 %50, %51
br i1 %52, label %53, label %56
53: ; preds = %49
%54 = getelementptr inbounds [11 x i8], [11 x i8]* %2, i64 0, i64 0
%55 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i8* %54)
br label %66
56: ; preds = %49
%57 = load i32, i32* %7
%58 = icmp eq i32 %57, 0
br i1 %58, label %59, label %62
59: ; preds = %56
store i32 1, i32* %7
%60 = getelementptr inbounds [11 x i8], [11 x i8]* %2, i64 0, i64 0
%61 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i8* %60)
br label %65
62: ; preds = %56
store i32 0, i32* %7
%63 = getelementptr inbounds [11 x i8], [11 x i8]* %2, i64 0, i64 0
%64 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0), i8* %63)
br label %65
65: ; preds = %62, %59
br label %66
66: ; preds = %65, %53
br label %67
67: ; preds = %66
%68 = load i32, i32* %5
%69 = add nsw i32 %68, 1
store i32 %69, i32* %5
br label %25
70: ; preds = %25
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
@.str.1 = [4 x i8] c" %s\00"
@.str.2 = [4 x i8] c" %d\00"
@.str.3 = [12 x i8] c"Unknown %s\0A\00"
@.str.4 = [14 x i8] c"Opened by %s\0A\00"
@.str.5 = [14 x i8] c"Closed by %s\0A\00"
define i32 @main() {
%1 = alloca [11 x i8]
%2 = alloca i32
%3 = alloca i32
%4 = alloca [256 x [11 x i8]]
%5 = getelementptr inbounds [11 x i8], [11 x i8]* %1, i64 0, i64 0
%6 = bitcast i32* %2 to i8*
%7 = bitcast i32* %3 to i8*
%8 = getelementptr inbounds [256 x [11 x i8]], [256 x [11 x i8]]* %4, i64 0, i64 0, i64 0
%9 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %2)
%10 = load i32, i32* %2
%11 = icmp sgt i32 %10, 0
br i1 %11, label %12, label %20
12: ; preds = %0, %12
%13 = phi i64 [ %16, %12 ], [ 0, %0 ]
%14 = getelementptr inbounds [256 x [11 x i8]], [256 x [11 x i8]]* %4, i64 0, i64 %13, i64 0
%15 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %14)
%16 = add nuw nsw i64 %13, 1
%17 = load i32, i32* %2
%18 = sext i32 %17 to i64
%19 = icmp slt i64 %16, %18
br i1 %19, label %12, label %20
20: ; preds = %12, %0
%21 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32* %3)
%22 = load i32, i32* %3
%23 = icmp sgt i32 %22, 0
br i1 %23, label %24, label %59
24: ; preds = %20, %46
%25 = phi i32 [ %54, %46 ], [ 0, %20 ]
%26 = phi i32 [ %56, %46 ], [ 0, %20 ]
%27 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %5)
%28 = load i32, i32* %2
%29 = icmp sgt i32 %28, 0
br i1 %29, label %30, label %46
30: ; preds = %24, %37
%31 = phi i64 [ %38, %37 ], [ 0, %24 ]
%32 = getelementptr inbounds [256 x [11 x i8]], [256 x [11 x i8]]* %4, i64 0, i64 %31, i64 0
%33 = call i64 @strcmp(i8* %5, i8* %32)
%34 = icmp eq i64 %33, 0
br i1 %34, label %35, label %37
35: ; preds = %30
%36 = load i32, i32* %2
br label %42
37: ; preds = %30
%38 = add nuw nsw i64 %31, 1
%39 = load i32, i32* %2
%40 = sext i32 %39 to i64
%41 = icmp slt i64 %38, %40
br i1 %41, label %30, label %42
42: ; preds = %37, %35
%43 = phi i32 [ %36, %35 ], [ %39, %37 ]
%44 = phi i64 [ %31, %35 ], [ %38, %37 ]
%45 = trunc i64 %44 to i32
br label %46
46: ; preds = %42, %24
%47 = phi i32 [ %28, %24 ], [ %43, %42 ]
%48 = phi i32 [ 0, %24 ], [ %45, %42 ]
%49 = icmp eq i32 %48, %47
%50 = icmp eq i32 %25, 0
%51 = select i1 %50, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0)
%52 = zext i1 %50 to i32
%53 = select i1 %49, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i8* %51
%54 = select i1 %49, i32 %25, i32 %52
%55 = call i32 @printf(i8* %53, i8* %5)
%56 = add nuw nsw i32 %26, 1
%57 = load i32, i32* %3
%58 = icmp slt i32 %56, %57
br i1 %58, label %24, label %59
59: ; preds = %46, %20
ret i32 0
}