#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 EXIT_FAILURE;
int EXIT_SUCCESS;
scalar_t__ is_valid(char *, int);
int /*<<< orphan*/ printf(char *, ...);
int scanf(char *, ...);
int main(int argc, char *argv[]) {
  int n;
  int len_id = 18;
  if (scanf("%d", &n) != 1)
    return EXIT_FAILURE;
  char temp;
  if (scanf("%c", &temp) != 1)
    return EXIT_FAILURE;
  char ids[n][len_id + 1];
  for (int i = 0; i < n; i++) {
    if (scanf("%s", ids[i]) != 1)
      return EXIT_FAILURE;
  }
  int valid_count = 0;
  for (int i = 0; i < n; i++) {
    if (is_valid(ids[i], len_id) == 0) {
      printf("%s\n", ids[i]);
      valid_count++;
    }
  }
  if (valid_count == 0) {
    printf("All passed");
  }
  return EXIT_SUCCESS;
}


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)
movl   $0x12,-0x18(%rbp)
lea    0xeac(%rip),%rdi
lea    -0x14(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
cmp    $0x1,%eax
je     1179 <main+0x49>
mov    0x2e71(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    12f5 <main+0x1c5>
lea    0xe83(%rip),%rdi
lea    -0x19(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
cmp    $0x1,%eax
je     11a5 <main+0x75>
mov    0x2e45(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    12f5 <main+0x1c5>
mov    -0x14(%rbp),%eax
mov    %eax,%ecx
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %rax,-0x58(%rbp)
mov    %rsp,%rdx
mov    %rdx,-0x28(%rbp)
mov    %rcx,%rsi
imul   %rax,%rsi
add    $0xf,%rsi
and    $0xfffffffffffffff0,%rsi
mov    %rsp,%rdx
sub    %rsi,%rdx
mov    %rdx,-0x50(%rbp)
mov    %rdx,%rsp
mov    %rcx,-0x30(%rbp)
mov    %rax,-0x38(%rbp)
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1247 <main+0x117>
mov    -0x50(%rbp),%rsi
mov    -0x58(%rbp),%rcx
movslq -0x3c(%rbp),%rax
imul   %rcx,%rax
add    %rax,%rsi
lea    0xdfa(%rip),%rdi
mov    $0x0,%al
call   1050 <scanf@plt>
cmp    $0x1,%eax
je     1234 <main+0x104>
mov    0x2dbd(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
movl   $0x1,-0x40(%rbp)
jmp    12ee <main+0x1be>
jmp    1239 <main+0x109>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    11e6 <main+0xb6>
movl   $0x0,-0x44(%rbp)
movl   $0x0,-0x48(%rbp)
mov    -0x48(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    12c3 <main+0x193>
mov    -0x50(%rbp),%rdi
mov    -0x58(%rbp),%rcx
movslq -0x48(%rbp),%rax
imul   %rcx,%rax
add    %rax,%rdi
mov    -0x18(%rbp),%esi
call   1040 <is_valid@plt>
cmp    $0x0,%rax
jne    12b0 <main+0x180>
mov    -0x50(%rbp),%rsi
mov    -0x58(%rbp),%rcx
movslq -0x48(%rbp),%rax
imul   %rcx,%rax
add    %rax,%rsi
lea    0xd69(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    12b5 <main+0x185>
mov    -0x48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x48(%rbp)
jmp    1255 <main+0x125>
cmpl   $0x0,-0x44(%rbp)
jne    12db <main+0x1ab>
lea    0xd39(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2cf6(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
movl   $0x1,-0x40(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xea8(%rip),%rdi
lea    -0x2c(%rbp),%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
cmp    $0x1,%eax
jne    1251 <main+0x111>
lea    0xe90(%rip),%rdi
lea    -0x2d(%rbp),%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
cmp    $0x1,%eax
jne    1251 <main+0x111>
mov    %rsp,%r12
mov    -0x2c(%rbp),%eax
lea    (%rax,%rax,8),%rcx
lea    (%rax,%rcx,2),%rax
add    $0xf,%rax
movabs $0x3ffffffff0,%rcx
and    %rax,%rcx
mov    %rsp,%r15
sub    %rcx,%r15
mov    %r15,%rsp
cmpl   $0x0,-0x2c(%rbp)
jle    1267 <main+0x127>
mov    %r12,-0x38(%rbp)
lea    0xe42(%rip),%r14
mov    0x2e15(%rip),%r13
mov    %r15,%rbx
xor    %r12d,%r12d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
cmp    $0x1,%eax
jne    125c <main+0x11c>
add    $0x1,%r12
movslq -0x2c(%rbp),%rax
add    $0x13,%rbx
cmp    %rax,%r12
jl     11e0 <main+0xa0>
test   %eax,%eax
mov    -0x38(%rbp),%r12
jle    1267 <main+0x127>
xor    %ebx,%ebx
xor    %r14d,%r14d
jmp    1231 <main+0xf1>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x1,%rbx
movslq -0x2c(%rbp),%rax
add    $0x13,%r15
cmp    %rax,%rbx
jge    1262 <main+0x122>
mov    %r15,%rdi
mov    $0x12,%esi
call   1050 <is_valid@plt>
test   %rax,%rax
jne    1220 <main+0xe0>
mov    %r15,%rdi
call   1030 <puts@plt>
add    $0x1,%r14d
jmp    1220 <main+0xe0>
mov    0x2d88(%rip),%rax
mov    (%rax),%eax
jmp    1283 <main+0x143>
mov    -0x38(%rbp),%r12
jmp    127c <main+0x13c>
test   %r14d,%r14d
jne    1275 <main+0x135>
lea    0xd9b(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x2d5c(%rip),%r13
mov    0x0(%r13),%eax
mov    %r12,%rsp
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [3 x i8] c"%c\00"
@.str.2 = [3 x i8] c"%s\00"
@.str.3 = [4 x i8] c"%s\0A\00"
@.str.4 = [11 x i8] c"All passed\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8
%9 = alloca i8*
%10 = alloca i64
%11 = alloca i64
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 18, i32* %7
%16 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %6)
%17 = icmp ne i32 %16, 1
br i1 %17, label %18, label %20
18: ; preds = %2
%19 = load i32, i32* @EXIT_FAILURE
store i32 %19, i32* %3
br label %85
20: ; preds = %2
%21 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %8)
%22 = icmp ne i32 %21, 1
br i1 %22, label %23, label %25
23: ; preds = %20
%24 = load i32, i32* @EXIT_FAILURE
store i32 %24, i32* %3
br label %85
25: ; preds = %20
%26 = load i32, i32* %6
%27 = zext i32 %26 to i64
%28 = load i32, i32* %7
%29 = add nsw i32 %28, 1
%30 = zext i32 %29 to i64
%31 = call i8* @llvm.stacksave()
store i8* %31, i8** %9
%32 = mul nuw i64 %27, %30
%33 = alloca i8, i64 %32
store i64 %27, i64* %10
store i64 %30, i64* %11
store i32 0, i32* %12
br label %34
34: ; preds = %48, %25
%35 = load i32, i32* %12
%36 = load i32, i32* %6
%37 = icmp slt i32 %35, %36
br i1 %37, label %38, label %51
38: ; preds = %34
%39 = load i32, i32* %12
%40 = sext i32 %39 to i64
%41 = mul nsw i64 %40, %30
%42 = getelementptr inbounds i8, i8* %33, i64 %41
%43 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %42)
%44 = icmp ne i32 %43, 1
br i1 %44, label %45, label %47
45: ; preds = %38
%46 = load i32, i32* @EXIT_FAILURE
store i32 %46, i32* %3
store i32 1, i32* %13
br label %83
47: ; preds = %38
br label %48
48: ; preds = %47
%49 = load i32, i32* %12
%50 = add nsw i32 %49, 1
store i32 %50, i32* %12
br label %34
51: ; preds = %34
store i32 0, i32* %14
store i32 0, i32* %15
br label %52
52: ; preds = %73, %51
%53 = load i32, i32* %15
%54 = load i32, i32* %6
%55 = icmp slt i32 %53, %54
br i1 %55, label %56, label %76
56: ; preds = %52
%57 = load i32, i32* %15
%58 = sext i32 %57 to i64
%59 = mul nsw i64 %58, %30
%60 = getelementptr inbounds i8, i8* %33, i64 %59
%61 = load i32, i32* %7
%62 = call i64 @is_valid(i8* %60, i32 %61)
%63 = icmp eq i64 %62, 0
br i1 %63, label %64, label %72
64: ; preds = %56
%65 = load i32, i32* %15
%66 = sext i32 %65 to i64
%67 = mul nsw i64 %66, %30
%68 = getelementptr inbounds i8, i8* %33, i64 %67
%69 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* %68)
%70 = load i32, i32* %14
%71 = add nsw i32 %70, 1
store i32 %71, i32* %14
br label %72
72: ; preds = %64, %56
br label %73
73: ; preds = %72
%74 = load i32, i32* %15
%75 = add nsw i32 %74, 1
store i32 %75, i32* %15
br label %52
76: ; preds = %52
%77 = load i32, i32* %14
%78 = icmp eq i32 %77, 0
br i1 %78, label %79, label %81
79: ; preds = %76
%80 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0))
br label %81
81: ; preds = %79, %76
%82 = load i32, i32* @EXIT_SUCCESS
store i32 %82, i32* %3
store i32 1, i32* %13
br label %83
83: ; preds = %81, %45
%84 = load i8*, i8** %9
br label %85
85: ; preds = %83, %23, %18
%86 = load i32, i32* %3
ret i32 %86
}

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