#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 */
char getchar();
int /*<<< orphan*/ isalpha(int);
int /*<<< orphan*/ isblank(int);
int /*<<< orphan*/ isdigit(int);
int /*<<< orphan*/ printf(char *);
int main() {
  int ch;
  enum State { HEAD, BLANK, INIT, FOLLOW, VALID, ERR, END } state = HEAD;
  printf("Please input a string: ");
  while (state != END) {
    if (state != VALID && state != ERR)
      ch = getchar();
    if (ch == '\n')
      state = ERR;
    switch (state) {
    case HEAD:
      if (!isblank(ch)) {
        if (ch == 'i' && getchar() == 'n') {
          if (getchar() == 't')
            state = BLANK;
          else
            state = ERR;
        } else
          state = ERR;
      }
      break;
    case BLANK:
      if (isblank(ch))
        state = INIT;
      else
        state = ERR;
      break;
    case INIT:
      if (!isblank(ch)) {
        if (ch == '_' || isalpha(ch))
          state = FOLLOW;
        else
          state = ERR;
      }
      break;
    case FOLLOW:
      if (ch == '_' || isalpha(ch) || isdigit(ch))
        break;
      else if (ch == ',')
        state = INIT;
      else if (ch == ';')
        state = VALID;
      else
        state = ERR;
      break;
    case VALID:
      printf("The result is: YES\n");
      state = END;
      break;
    case ERR:
      printf("The result is: NO\n");
      state = END;
      break;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
lea    0xeab(%rip),%rdi
call   1040 <printf@plt>
cmpl   $0x6,-0xc(%rbp)
je     1352 <main+0x202>
cmpl   $0x4,-0xc(%rbp)
je     119d <main+0x4d>
cmpl   $0x5,-0xc(%rbp)
je     119d <main+0x4d>
mov    $0x0,%al
call   1060 <getchar@plt>
movsbl %al,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jne    11ae <main+0x5e>
movl   $0x5,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %rax,-0x18(%rbp)
sub    $0x5,%rax
ja     134d <main+0x1fd>
mov    -0x18(%rbp),%rax
lea    0xe36(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x8(%rbp),%edi
call   1050 <isblank@plt>
cmp    $0x0,%eax
jne    1238 <main+0xe8>
cmpl   $0x69,-0x8(%rbp)
jne    122c <main+0xdc>
mov    $0x0,%al
call   1060 <getchar@plt>
movsbl %al,%eax
cmp    $0x6e,%eax
jne    122c <main+0xdc>
mov    $0x0,%al
call   1060 <getchar@plt>
movsbl %al,%eax
cmp    $0x74,%eax
jne    1220 <main+0xd0>
movl   $0x1,-0xc(%rbp)
jmp    1227 <main+0xd7>
movl   $0x5,-0xc(%rbp)
jmp    1233 <main+0xe3>
movl   $0x5,-0xc(%rbp)
jmp    1238 <main+0xe8>
jmp    134d <main+0x1fd>
mov    -0x8(%rbp),%edi
call   1050 <isblank@plt>
cmp    $0x0,%eax
je     125a <main+0x10a>
movl   $0x2,-0xc(%rbp)
jmp    1261 <main+0x111>
movl   $0x5,-0xc(%rbp)
jmp    134d <main+0x1fd>
mov    -0x8(%rbp),%edi
call   1050 <isblank@plt>
cmp    $0x0,%eax
jne    12aa <main+0x15a>
cmpl   $0x5f,-0x8(%rbp)
je     1292 <main+0x142>
mov    -0x8(%rbp),%edi
call   1070 <isalpha@plt>
cmp    $0x0,%eax
je     129e <main+0x14e>
movl   $0x3,-0xc(%rbp)
jmp    12a5 <main+0x155>
movl   $0x5,-0xc(%rbp)
jmp    12aa <main+0x15a>
jmp    134d <main+0x1fd>
cmpl   $0x5f,-0x8(%rbp)
je     12db <main+0x18b>
mov    -0x8(%rbp),%edi
call   1070 <isalpha@plt>
cmp    $0x0,%eax
jne    12db <main+0x18b>
mov    -0x8(%rbp),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%eax
je     12e0 <main+0x190>
jmp    134d <main+0x1fd>
cmpl   $0x2c,-0x8(%rbp)
jne    12f6 <main+0x1a6>
movl   $0x2,-0xc(%rbp)
jmp    1318 <main+0x1c8>
cmpl   $0x3b,-0x8(%rbp)
jne    130c <main+0x1bc>
movl   $0x4,-0xc(%rbp)
jmp    1313 <main+0x1c3>
movl   $0x5,-0xc(%rbp)
jmp    1318 <main+0x1c8>
jmp    131d <main+0x1cd>
jmp    134d <main+0x1fd>
lea    0xd07(%rip),%rdi
call   1040 <printf@plt>
movl   $0x6,-0xc(%rbp)
jmp    134d <main+0x1fd>
lea    0xd03(%rip),%rdi
call   1040 <printf@plt>
movl   $0x6,-0xc(%rbp)
jmp    1172 <main+0x22>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
lea    0xeb9(%rip),%rdi
call   1040 <printf@plt>
mov    $0x5,%r14d
lea    0xe8f(%rip),%r12
mov    $0x2,%r15d
xor    %ebp,%ebp
jmp    1190 <main+0x40>
mov    %ebx,%edi
call   1050 <isblank@plt>
xor    %ecx,%ecx
test   %eax,%eax
sete   %cl
lea    (%rcx,%rcx,2),%ebp
add    $0x2,%ebp
nop
mov    %ebp,%eax
and    $0xfffffffe,%eax
cmp    $0x4,%eax
je     11a4 <main+0x54>
xor    %eax,%eax
call   1060 <getchar@plt>
movsbl %al,%ebx
cmp    $0xa,%ebx
cmove  %r14d,%ebp
cmp    $0x5,%ebp
ja     1190 <main+0x40>
movslq (%r12,%rbp,4),%rax
add    %r12,%rax
jmp    *%rax
mov    %ebx,%edi
call   1050 <isblank@plt>
mov    $0x0,%ebp
test   %eax,%eax
jne    1190 <main+0x40>
mov    $0x5,%ebp
cmp    $0x69,%ebx
jne    1190 <main+0x40>
xor    %eax,%eax
call   1060 <getchar@plt>
cmp    $0x6e,%al
jne    1190 <main+0x40>
xor    %eax,%eax
call   1060 <getchar@plt>
xor    %ecx,%ecx
cmp    $0x74,%al
setne  %cl
lea    0x1(,%rcx,4),%ebp
jmp    1190 <main+0x40>
mov    %ebx,%edi
call   1050 <isblank@plt>
mov    $0x2,%ebp
test   %eax,%eax
jne    1190 <main+0x40>
mov    $0x3,%ebp
cmp    $0x5f,%ebx
je     1190 <main+0x40>
mov    %ebx,%edi
call   1070 <isalpha@plt>
xor    %ecx,%ecx
test   %eax,%eax
sete   %cl
lea    (%rcx,%rcx,1),%ebp
add    $0x3,%ebp
jmp    1190 <main+0x40>
mov    $0x3,%ebp
cmp    $0x5f,%ebx
je     1190 <main+0x40>
mov    %ebx,%edi
call   1070 <isalpha@plt>
test   %eax,%eax
jne    1190 <main+0x40>
lea    -0x30(%rbx),%eax
cmp    $0xa,%eax
jb     1190 <main+0x40>
xor    %ebp,%ebp
cmp    $0x3b,%ebx
sete   %bpl
xor    $0x5,%ebp
cmp    $0x2c,%ebx
cmove  %r15d,%ebp
jmp    1190 <main+0x40>
lea    0xdd2(%rip),%rdi
jmp    1279 <main+0x129>
lea    0xdb7(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [24 x i8] c"Please input a string: \00"
@.str.1 = [20 x i8] c"The result is: YES\0A\00"
@.str.2 = [19 x i8] c"The result is: NO\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
%4 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
br label %5
5: ; preds = %94, %0
%6 = load i32, i32* %3
%7 = icmp ne i32 %6, 6
br i1 %7, label %8, label %95
8: ; preds = %5
%9 = load i32, i32* %3
%10 = icmp ne i32 %9, 4
br i1 %10, label %11, label %17
11: ; preds = %8
%12 = load i32, i32* %3
%13 = icmp ne i32 %12, 5
br i1 %13, label %14, label %17
14: ; preds = %11
%15 = call signext i8 (...) @getchar()
%16 = sext i8 %15 to i32
store i32 %16, i32* %2
br label %17
17: ; preds = %14, %11, %8
%18 = load i32, i32* %2
%19 = icmp eq i32 %18, 10
br i1 %19, label %20, label %21
20: ; preds = %17
store i32 5, i32* %3
br label %21
21: ; preds = %20, %17
%22 = load i32, i32* %3
switch i32 %22, label %94 [
i32 0, label %23
i32 1, label %44
i32 2, label %51
i32 3, label %66
i32 4, label %90
i32 5, label %92
]
23: ; preds = %21
%24 = load i32, i32* %2
%25 = call i32 @isblank(i32 %24)
%26 = icmp ne i32 %25, 0
br i1 %26, label %43, label %27
27: ; preds = %23
%28 = load i32, i32* %2
%29 = icmp eq i32 %28, 105
br i1 %29, label %30, label %41
30: ; preds = %27
%31 = call signext i8 (...) @getchar()
%32 = sext i8 %31 to i32
%33 = icmp eq i32 %32, 110
br i1 %33, label %34, label %41
34: ; preds = %30
%35 = call signext i8 (...) @getchar()
%36 = sext i8 %35 to i32
%37 = icmp eq i32 %36, 116
br i1 %37, label %38, label %39
38: ; preds = %34
store i32 1, i32* %3
br label %40
39: ; preds = %34
store i32 5, i32* %3
br label %40
40: ; preds = %39, %38
br label %42
41: ; preds = %30, %27
store i32 5, i32* %3
br label %42
42: ; preds = %41, %40
br label %43
43: ; preds = %42, %23
br label %94
44: ; preds = %21
%45 = load i32, i32* %2
%46 = call i32 @isblank(i32 %45)
%47 = icmp ne i32 %46, 0
br i1 %47, label %48, label %49
48: ; preds = %44
store i32 2, i32* %3
br label %50
49: ; preds = %44
store i32 5, i32* %3
br label %50
50: ; preds = %49, %48
br label %94
51: ; preds = %21
%52 = load i32, i32* %2
%53 = call i32 @isblank(i32 %52)
%54 = icmp ne i32 %53, 0
br i1 %54, label %65, label %55
55: ; preds = %51
%56 = load i32, i32* %2
%57 = icmp eq i32 %56, 95
br i1 %57, label %62, label %58
58: ; preds = %55
%59 = load i32, i32* %2
%60 = call i32 @isalpha(i32 %59)
%61 = icmp ne i32 %60, 0
br i1 %61, label %62, label %63
62: ; preds = %58, %55
store i32 3, i32* %3
br label %64
63: ; preds = %58
store i32 5, i32* %3
br label %64
64: ; preds = %63, %62
br label %65
65: ; preds = %64, %51
br label %94
66: ; preds = %21
%67 = load i32, i32* %2
%68 = icmp eq i32 %67, 95
br i1 %68, label %77, label %69
69: ; preds = %66
%70 = load i32, i32* %2
%71 = call i32 @isalpha(i32 %70)
%72 = icmp ne i32 %71, 0
br i1 %72, label %77, label %73
73: ; preds = %69
%74 = load i32, i32* %2
%75 = call i32 @isdigit(i32 %74)
%76 = icmp ne i32 %75, 0
br i1 %76, label %77, label %78
77: ; preds = %73, %69, %66
br label %94
78: ; preds = %73
%79 = load i32, i32* %2
%80 = icmp eq i32 %79, 44
br i1 %80, label %81, label %82
81: ; preds = %78
store i32 2, i32* %3
br label %88
82: ; preds = %78
%83 = load i32, i32* %2
%84 = icmp eq i32 %83, 59
br i1 %84, label %85, label %86
85: ; preds = %82
store i32 4, i32* %3
br label %87
86: ; preds = %82
store i32 5, i32* %3
br label %87
87: ; preds = %86, %85
br label %88
88: ; preds = %87, %81
br label %89
89: ; preds = %88
br label %94
90: ; preds = %21
%91 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
store i32 6, i32* %3
br label %94
92: ; preds = %21
%93 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
store i32 6, i32* %3
br label %94
94: ; preds = %21, %92, %90, %89, %77, %65, %50, %43
br label %5
95: ; preds = %5
ret i32 0
}

LLVM IR (-O2):
@.str = [24 x i8] c"Please input a string: \00"
@str = [18 x i8] c"The result is: NO\00"
@str.3 = [19 x i8] c"The result is: YES\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
br label %2
2: ; preds = %39, %0
%3 = phi i32 [ 0, %0 ], [ %40, %39 ]
%4 = phi i32 [ undef, %0 ], [ %11, %39 ]
%5 = and i32 %3, -2
%6 = icmp eq i32 %5, 4
br i1 %6, label %10, label %7
7: ; preds = %2
%8 = tail call signext i8 (...) @getchar()
%9 = sext i8 %8 to i32
br label %10
10: ; preds = %7, %2
%11 = phi i32 [ %9, %7 ], [ %4, %2 ]
%12 = icmp eq i32 %11, 10
%13 = select i1 %12, i32 5, i32 %3
switch i32 %13, label %39 [
i32 0, label %14
i32 1, label %26
i32 2, label %30
i32 3, label %41
i32 4, label %55
i32 5, label %54
]
14: ; preds = %10
%15 = tail call i32 @isblank(i32 %11)
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %39
17: ; preds = %14
%18 = icmp eq i32 %11, 105
br i1 %18, label %19, label %39
19: ; preds = %17
%20 = tail call signext i8 (...) @getchar()
%21 = icmp eq i8 %20, 110
br i1 %21, label %22, label %39
22: ; preds = %19
%23 = tail call signext i8 (...) @getchar()
%24 = icmp eq i8 %23, 116
%25 = select i1 %24, i32 1, i32 5
br label %39
26: ; preds = %10
%27 = tail call i32 @isblank(i32 %11)
%28 = icmp eq i32 %27, 0
%29 = select i1 %28, i32 5, i32 2
br label %39
30: ; preds = %10
%31 = tail call i32 @isblank(i32 %11)
%32 = icmp eq i32 %31, 0
br i1 %32, label %33, label %39
33: ; preds = %30
%34 = icmp eq i32 %11, 95
br i1 %34, label %39, label %35
35: ; preds = %33
%36 = tail call i32 @isalpha(i32 %11)
%37 = icmp eq i32 %36, 0
%38 = select i1 %37, i32 5, i32 3
br label %39
39: ; preds = %35, %49, %33, %26, %17, %19, %22, %41, %43, %30, %14, %10
%40 = phi i32 [ %13, %10 ], [ 3, %41 ], [ 3, %43 ], [ 2, %30 ], [ 0, %14 ], [ %25, %22 ], [ 5, %19 ], [ 5, %17 ], [ %29, %26 ], [ 3, %33 ], [ %38, %35 ], [ %53, %49 ]
br label %2
41: ; preds = %10
%42 = icmp eq i32 %11, 95
br i1 %42, label %39, label %43
43: ; preds = %41
%44 = tail call i32 @isalpha(i32 %11)
%45 = icmp ne i32 %44, 0
%46 = add i32 %11, -48
%47 = icmp ult i32 %46, 10
%48 = select i1 %45, i1 true, i1 %47
br i1 %48, label %39, label %49
49: ; preds = %43
%50 = icmp eq i32 %11, 59
%51 = select i1 %50, i32 4, i32 5
%52 = icmp eq i32 %11, 44
%53 = select i1 %52, i32 2, i32 %51
br label %39
54: ; preds = %10
br label %55
55: ; preds = %10, %54
%56 = phi i8* [ getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0), %54 ], [ getelementptr inbounds ([19 x i8], [19 x i8]* @str.3, i64 0, i64 0), %10 ]
%57 = tail call i32 @puts(i8* dereferenceable(1) %56)
ret i32 0
}