#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__ match(char *, char *);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ scanf(char *, ...);
int main(void) {
  int N, M;
  scanf("%d %d", &N, &M);
  static char pats[100000][7];
  int i;
  for (i = 0; i < N; i++) {
    scanf("%s", pats[i]);
  }
  for (i = 0; i < M; i++) {
    char text[21];
    scanf("%s", text);
    int j;
    int any = 0;
    for (j = 0; j < N; j++) {
      if (match(text, pats[j])) {
        printf("%d ", j);
        any = 1;
      }
    }
    if (any) {
      puts("");
    } else {
      puts("Not match");
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
mov    $0x0,%al
call   1060 <scanf@plt>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11a6 <main+0x66>
movslq -0x10(%rbp),%rax
lea    0x2ecd(%rip),%rsi
imul   $0x7,%rax,%rax
add    %rax,%rsi
lea    0xe75(%rip),%rdi
mov    $0x0,%al
call   1060 <scanf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    116c <main+0x2c>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    126d <main+0x12d>
lea    -0x30(%rbp),%rsi
lea    0xe42(%rip),%rdi
mov    $0x0,%al
call   1060 <scanf@plt>
movl   $0x0,-0x38(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1233 <main+0xf3>
lea    -0x30(%rbp),%rdi
movslq -0x34(%rbp),%rax
lea    0x2e5c(%rip),%rsi
imul   $0x7,%rax,%rax
add    %rax,%rsi
call   1050 <match@plt>
cmp    $0x0,%rax
je     1220 <main+0xe0>
mov    -0x34(%rbp),%esi
lea    0xdf5(%rip),%rdi
call   1040 <printf@plt>
movl   $0x1,-0x38(%rbp)
jmp    1225 <main+0xe5>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    11d9 <main+0x99>
cmpl   $0x0,-0x38(%rbp)
je     124e <main+0x10e>
lea    0xdc8(%rip),%rdi
call   1030 <puts@plt>
jmp    125a <main+0x11a>
lea    0xdb8(%rip),%rdi
call   1030 <puts@plt>
jmp    125f <main+0x11f>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11ad <main+0x6d>
xor    %eax,%eax
add    $0x40,%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    0xe9b(%rip),%rdi
lea    0x8(%rsp),%rsi
lea    0xc(%rsp),%rdx
xor    %eax,%eax
call   1070 <scanf@plt>
cmpl   $0x0,0x8(%rsp)
jle    11af <main+0x5f>
lea    0x2edc(%rip),%rbx
lea    0xe7b(%rip),%r14
xor    %ebp,%ebp
nopl   (%rax)
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1070 <scanf@plt>
add    $0x1,%rbp
movslq 0x8(%rsp),%rax
add    $0x7,%rbx
cmp    %rax,%rbp
jl     1190 <main+0x40>
cmpl   $0x0,0xc(%rsp)
jle    1278 <main+0x128>
lea    0x10(%rsp),%r13
lea    0xe43(%rip),%r15
xor    %r12d,%r12d
jmp    11eb <main+0x9b>
nopl   0x0(%rax,%rax,1)
lea    0xe36(%rip),%rdi
call   1040 <puts@plt>
add    $0x1,%r12d
cmp    0xc(%rsp),%r12d
jge    1278 <main+0x128>
lea    0xe14(%rip),%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1070 <scanf@plt>
cmpl   $0x0,0x8(%rsp)
jle    11d0 <main+0x80>
xor    %ebx,%ebx
lea    0x2e54(%rip),%rbp
xor    %r14d,%r14d
jmp    1232 <main+0xe2>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0x1,%rbx
movslq 0x8(%rsp),%rax
add    $0x7,%rbp
cmp    %rax,%rbx
jge    1260 <main+0x110>
mov    %r13,%rdi
mov    %rbp,%rsi
call   1060 <match@plt>
test   %rax,%rax
je     1220 <main+0xd0>
mov    %r15,%rdi
mov    %ebx,%esi
call   1050 <printf@plt>
mov    $0x1,%r14d
jmp    1220 <main+0xd0>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
test   %r14d,%r14d
je     11d0 <main+0x80>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    11dc <main+0x8c>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [6 x i8] c"%d %d\00"
@main.pats = internal global [100000 x [7 x i8]] zeroinitializer
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [4 x i8] c"%d \00"
@.str.4 = [10 x i8] c"Not match\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [21 x i8]
%4 = bitcast i32* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2)
%7 = load i32, i32* %1
%8 = icmp sgt i32 %7, 0
br i1 %8, label %14, label %9
9: ; preds = %14, %0
%10 = load i32, i32* %2
%11 = icmp sgt i32 %10, 0
br i1 %11, label %12, label %52
12: ; preds = %9
%13 = getelementptr inbounds [21 x i8], [21 x i8]* %3, i64 0, i64 0
br label %22
14: ; preds = %0, %14
%15 = phi i64 [ %18, %14 ], [ 0, %0 ]
%16 = getelementptr inbounds [100000 x [7 x i8]], [100000 x [7 x i8]]* @main.pats, i64 0, i64 %15, 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 = add nuw nsw i64 %15, 1
%19 = load i32, i32* %1
%20 = sext i32 %19 to i64
%21 = icmp slt i64 %18, %20
br i1 %21, label %14, label %9
22: ; preds = %12, %48
%23 = phi i32 [ 0, %12 ], [ %49, %48 ]
%24 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %13)
%25 = load i32, i32* %1
%26 = icmp sgt i32 %25, 0
br i1 %26, label %27, label %46
27: ; preds = %22, %36
%28 = phi i64 [ %38, %36 ], [ 0, %22 ]
%29 = phi i32 [ %37, %36 ], [ 0, %22 ]
%30 = getelementptr inbounds [100000 x [7 x i8]], [100000 x [7 x i8]]* @main.pats, i64 0, i64 %28, i64 0
%31 = call i64 @match(i8* %13, i8* %30)
%32 = icmp eq i64 %31, 0
br i1 %32, label %36, label %33
33: ; preds = %27
%34 = trunc i64 %28 to i32
%35 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %34)
br label %36
36: ; preds = %27, %33
%37 = phi i32 [ 1, %33 ], [ %29, %27 ]
%38 = add nuw nsw i64 %28, 1
%39 = load i32, i32* %1
%40 = sext i32 %39 to i64
%41 = icmp slt i64 %38, %40
br i1 %41, label %27, label %42
42: ; preds = %36
%43 = icmp eq i32 %37, 0
br i1 %43, label %46, label %44
44: ; preds = %42
%45 = call i32 @putchar(i32 10)
br label %48
46: ; preds = %22, %42
%47 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
br label %48
48: ; preds = %46, %44
%49 = add nuw nsw i32 %23, 1
%50 = load i32, i32* %2
%51 = icmp slt i32 %49, %50
br i1 %51, label %22, label %52
52: ; preds = %48, %9
ret i32 0
}