#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*/ gets(char *);
int /*<<< orphan*/ printf(char *);
int strlen(char *);
void main() {
  int cur, j, flag = 0, i, in, n, nf, f[3], ni, tran[50][50];
  char ip[10], str[20];
  tran[50][50] = -1;
  in = 0;
  n = 11;
  ni = 8;
  f[0] = 2;
  f[1] = 6;
  f[2] = 10;
  ip[0] = 'i';
  ip[1] = 'f';
  ip[2] = 't';
  ip[3] = 'h';
  ip[4] = 'e';
  ip[5] = 'n';
  ip[6] = 'l';
  ip[7] = 's';
  tran[0][0] = 1;
  tran[0][2] = 3;
  tran[0][4] = 7;
  tran[1][1] = 2;
  tran[3][3] = 4;
  tran[4][4] = 5;
  tran[5][5] = 6;
  tran[7][6] = 8;
  tran[8][7] = 9;
  tran[9][4] = 10;
  printf("\nEnter string");
  gets(str);
  cur = in;
  for (i = 0; i < strlen(str); i++) {
    switch (str[i]) {
    case 'i':
      n = 0;
      break;
    case 'f':
      n = 1;
      break;
    case 't':
      n = 2;
      break;
    case 'h':
      n = 3;
      break;
    case 'e':
      n = 4;
      break;
    case 'n':
      n = 5;
      break;
    case 'l':
      n = 6;
      break;
    case 's':
      n = 7;
      break;
    }
    cur = tran[cur][n];
  }
  for (j = 0; j < 3; j++) {
    if (cur == f[j]) {
      flag = 1;
    }
  }
  if (flag == 1)
    printf("\n String accepted");
  else
    printf("\n String rejected");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2770,%rsp
movl   $0x0,-0xc(%rbp)
movl   $0xffffffff,0x98(%rbp)
ff ff ff
movl   $0x0,-0x14(%rbp)
movl   $0xb,-0x18(%rbp)
movl   $0x8,-0x2c(%rbp)
movl   $0x2,-0x28(%rbp)
movl   $0x6,-0x24(%rbp)
movl   $0xa,-0x20(%rbp)
movb   $0x69,-0x274a(%rbp)
movb   $0x66,-0x2749(%rbp)
movb   $0x74,-0x2748(%rbp)
movb   $0x68,-0x2747(%rbp)
movb   $0x65,-0x2746(%rbp)
movb   $0x6e,-0x2745(%rbp)
movb   $0x6c,-0x2744(%rbp)
movb   $0x73,-0x2743(%rbp)
movl   $0x1,-0x2740(%rbp)
movl   $0x3,-0x2738(%rbp)
movl   $0x7,-0x2730(%rbp)
movl   $0x2,-0x2674(%rbp)
movl   $0x4,-0x24dc(%rbp)
movl   $0x5,-0x2410(%rbp)
movl   $0x6,-0x2344(%rbp)
movl   $0x8,-0x21b0(%rbp)
movl   $0x9,-0x20e4(%rbp)
movl   $0xa,-0x2028(%rbp)
lea    0xe27(%rip),%rdi
call   1040 <printf@plt>
lea    -0x2760(%rbp),%rdi
call   1050 <gets@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x2764(%rbp)
lea    -0x2760(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x2764(%rbp),%eax
cmp    %ecx,%eax
jge    131c <main+0x1ec>
movslq -0x10(%rbp),%rax
movsbl -0x2760(%rbp,%rax,1),%eax
ff
add    $0xffffff9b,%eax
mov    %eax,%ecx
mov    %rcx,-0x2770(%rbp)
sub    $0xf,%eax
ja     12ef <main+0x1bf>
mov    -0x2770(%rbp),%rax
lea    0xd75(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x0,-0x18(%rbp)
jmp    12ef <main+0x1bf>
movl   $0x1,-0x18(%rbp)
jmp    12ef <main+0x1bf>
movl   $0x2,-0x18(%rbp)
jmp    12ef <main+0x1bf>
movl   $0x3,-0x18(%rbp)
jmp    12ef <main+0x1bf>
movl   $0x4,-0x18(%rbp)
jmp    12ef <main+0x1bf>
movl   $0x5,-0x18(%rbp)
jmp    12ef <main+0x1bf>
movl   $0x6,-0x18(%rbp)
jmp    12ef <main+0x1bf>
movl   $0x7,-0x18(%rbp)
movslq -0x4(%rbp),%rcx
lea    -0x2740(%rbp),%rax
imul   $0xc8,%rcx,%rcx
add    %rcx,%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x4(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1237 <main+0x107>
movl   $0x0,-0x8(%rbp)
cmpl   $0x3,-0x8(%rbp)
jge    1358 <main+0x228>
mov    -0x4(%rbp),%eax
movslq -0x8(%rbp),%rcx
cmp    -0x28(%rbp,%rcx,4),%eax
jne    1345 <main+0x215>
movl   $0x1,-0xc(%rbp)
jmp    134a <main+0x21a>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1323 <main+0x1f3>
cmpl   $0x1,-0xc(%rbp)
jne    1373 <main+0x243>
lea    0xce5(%rip),%rdi
call   1040 <printf@plt>
jmp    137f <main+0x24f>
lea    0xce6(%rip),%rdi
call   1040 <printf@plt>
add    $0x2770,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x2738,%rsp
movl   $0xffffffff,0x27f8(%rsp)
ff ff ff ff
movl   $0x1,0x20(%rsp)
movl   $0x3,0x28(%rsp)
movl   $0x7,0x30(%rsp)
movl   $0x2,0xec(%rsp)
movl   $0x4,0x284(%rsp)
movl   $0x5,0x350(%rsp)
movl   $0x6,0x41c(%rsp)
movl   $0x8,0x5b0(%rsp)
movl   $0x9,0x67c(%rsp)
movl   $0xa,0x738(%rsp)
lea    0xe48(%rip),%rdi
call   1040 <printf@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1050 <gets@plt>
mov    %rbx,%rdi
call   1030 <strlen@plt>
test   %eax,%eax
jle    1238 <main+0x108>
mov    $0xb,%r12d
xor    %ebx,%ebx
mov    $0xc29b,%r15d
lea    0xe4b(%rip),%r13
mov    %rsp,%r14
xor    %ebp,%ebp
jmp    121a <main+0xea>
movslq %ebp,%rax
mov    %r12d,%ecx
imul   $0xc8,%rax,%rax
add    %rsp,%rax
add    $0x20,%rax
mov    (%rax,%rcx,4),%ebp
add    $0x1,%rbx
mov    %r14,%rdi
call   1030 <strlen@plt>
cltq
cmp    %rax,%rbx
jge    123a <main+0x10a>
movsbl (%rsp,%rbx,1),%eax
lea    -0x65(%rax),%ecx
cmp    $0xf,%ecx
ja     11f0 <main+0xc0>
bt     %ecx,%r15d
jae    11f0 <main+0xc0>
cltq
mov    -0x194(%r13,%rax,4),%r12d
ff
jmp    11f0 <main+0xc0>
xor    %ebp,%ebp
cmp    $0xa,%ebp
ja     1252 <main+0x122>
mov    $0x444,%eax
bt     %ebp,%eax
jae    1252 <main+0x122>
lea    0xdbe(%rip),%rdi
jmp    1259 <main+0x129>
lea    0xdc7(%rip),%rdi
call   1040 <printf@plt>
add    $0x2738,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [14 x i8] c"\0AEnter string\00"
@.str.1 = [18 x i8] c"\0A String accepted\00"
@.str.2 = [18 x i8] c"\0A String rejected\00"
@switch.table.main = [16 x i32] [i32 4, i32 1, i32 0, i32 3, i32 0, i32 0, i32 0, i32 6, i32 0, i32 5, i32 0, i32 0, i32 0, i32 0, i32 7, i32 2]
define void @main() {
%1 = alloca [50 x [50 x i32]]
%2 = alloca [20 x i8]
%3 = bitcast [50 x [50 x i32]]* %1 to i8*
%4 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%5 = getelementptr inbounds [50 x [50 x i32]], [50 x [50 x i32]]* %1, i64 0, i64 50, i64 50
store i32 -1, i32* %5
%6 = getelementptr inbounds [50 x [50 x i32]], [50 x [50 x i32]]* %1, i64 0, i64 0, i64 0
store i32 1, i32* %6
%7 = getelementptr inbounds [50 x [50 x i32]], [50 x [50 x i32]]* %1, i64 0, i64 0, i64 2
store i32 3, i32* %7
%8 = getelementptr inbounds [50 x [50 x i32]], [50 x [50 x i32]]* %1, i64 0, i64 0, i64 4
store i32 7, i32* %8
%9 = getelementptr inbounds [50 x [50 x i32]], [50 x [50 x i32]]* %1, i64 0, i64 1, i64 1
store i32 2, i32* %9
%10 = getelementptr inbounds [50 x [50 x i32]], [50 x [50 x i32]]* %1, i64 0, i64 3, i64 3
store i32 4, i32* %10
%11 = getelementptr inbounds [50 x [50 x i32]], [50 x [50 x i32]]* %1, i64 0, i64 4, i64 4
store i32 5, i32* %11
%12 = getelementptr inbounds [50 x [50 x i32]], [50 x [50 x i32]]* %1, i64 0, i64 5, i64 5
store i32 6, i32* %12
%13 = getelementptr inbounds [50 x [50 x i32]], [50 x [50 x i32]]* %1, i64 0, i64 7, i64 6
store i32 8, i32* %13
%14 = getelementptr inbounds [50 x [50 x i32]], [50 x [50 x i32]]* %1, i64 0, i64 8, i64 7
store i32 9, i32* %14
%15 = getelementptr inbounds [50 x [50 x i32]], [50 x [50 x i32]]* %1, i64 0, i64 9, i64 4
store i32 10, i32* %15
%16 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%17 = call i32 @gets(i8* %4)
%18 = call i32 @strlen(i8* %4)
%19 = icmp sgt i32 %18, 0
br i1 %19, label %22, label %20
20: ; preds = %40, %0
%21 = phi i32 [ 0, %0 ], [ %45, %40 ]
switch i32 %21, label %50 [
i32 10, label %51
i32 6, label %51
i32 2, label %51
]
22: ; preds = %0, %40
%23 = phi i64 [ %46, %40 ], [ 0, %0 ]
%24 = phi i32 [ %45, %40 ], [ 0, %0 ]
%25 = phi i32 [ %41, %40 ], [ 11, %0 ]
%26 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 %23
%27 = load i8, i8* %26
%28 = sext i8 %27 to i32
%29 = add nsw i32 %28, -101
%30 = icmp ult i32 %29, 16
br i1 %30, label %31, label %40
31: ; preds = %22
%32 = trunc i32 %29 to i16
%33 = lshr i16 -15717, %32
%34 = and i16 %33, 1
%35 = icmp eq i16 %34, 0
br i1 %35, label %40, label %36
36: ; preds = %31
%37 = sext i32 %29 to i64
%38 = getelementptr inbounds [16 x i32], [16 x i32]* @switch.table.main, i64 0, i64 %37
%39 = load i32, i32* %38
br label %40
40: ; preds = %36, %31, %22
%41 = phi i32 [ %25, %22 ], [ %25, %31 ], [ %39, %36 ]
%42 = sext i32 %24 to i64
%43 = zext i32 %41 to i64
%44 = getelementptr inbounds [50 x [50 x i32]], [50 x [50 x i32]]* %1, i64 0, i64 %42, i64 %43
%45 = load i32, i32* %44
%46 = add nuw nsw i64 %23, 1
%47 = call i32 @strlen(i8* %4)
%48 = sext i32 %47 to i64
%49 = icmp slt i64 %46, %48
br i1 %49, label %22, label %20
50: ; preds = %20
br label %51
51: ; preds = %20, %20, %20, %50
%52 = phi i8* [ getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), %50 ], [ getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), %20 ], [ getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), %20 ], [ getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), %20 ]
%53 = call i32 @printf(i8* dereferenceable(1) %52)
ret void
}