#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*/ check_table1(char *);
int /*<<< orphan*/ check_table2(char *);
int /*<<< orphan*/ check_table3(char *);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ strncpy(char *, char *, int);
char *strtok(char *, char *);
int find_table(char *name, int size, int show_content) {
  char str[255];
  char step0[255];
  char step1[255];
  int num_buf_str = 0;
  int res = 0;
  int step = 0;
  while (!res) {
    if (fgets(str, 255, stdin) != NULL) {
      switch (step) {
      case 0:
        if (check_table1(str)) {
          strncpy(step0, str, 255);
          num_buf_str = 1;
          step++;
        }
        break;
      case 1:
        if (check_table2(str)) {
          char *pch;
          strtok(str, "`");
          pch = strtok(NULL, "`");
          if (pch) {
            strncpy(name, pch, size);
            step++;
            strncpy(step1, str, 255);
            num_buf_str = 2;
          } else
            step = 0;
        } else
          step = 0;
        break;
      case 2:
        if (check_table3(str)) {
          step = 2;
          res = 2;
        } else
          step = 0;
        break;
      default:
        step = 0;
        break;
      }
      if ((!step) && (show_content)) {
        if (num_buf_str == 2)
          printf("%s", step1);
        if (num_buf_str == 1)
          printf("%s", step0);
        num_buf_str = 0;
        printf("%s", str);
      }
    } else {
      if (show_content) {
        if (num_buf_str == 2)
          printf("%s", step1);
        if (num_buf_str == 1)
          printf("%s", step0);
        num_buf_str = 0;
      }
      res = 1;
    }
  }
  return res;
}


x86 assembly (clang, -O0):
<find_table>:
push   %rbp
mov    %rsp,%rbp
sub    $0x330,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
movl   $0x0,-0x314(%rbp)
movl   $0x0,-0x318(%rbp)
movl   $0x0,-0x31c(%rbp)
cmpl   $0x0,-0x318(%rbp)
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    11bc <find_table+0x4c>
jmp    1443 <find_table+0x2d3>
lea    -0x110(%rbp),%rdi
mov    0x2e1e(%rip),%rax
mov    (%rax),%edx
mov    $0xff,%esi
call   1060 <fgets@plt>
cmp    $0x0,%rax
je     13e0 <find_table+0x270>
mov    -0x31c(%rbp),%eax
mov    %eax,-0x32c(%rbp)
test   %eax,%eax
je     1221 <find_table+0xb1>
jmp    11f9 <find_table+0x89>
mov    -0x32c(%rbp),%eax
sub    $0x1,%eax
je     126c <find_table+0xfc>
jmp    120d <find_table+0x9d>
mov    -0x32c(%rbp),%eax
sub    $0x2,%eax
je     1320 <find_table+0x1b0>
jmp    135d <find_table+0x1ed>
lea    -0x110(%rbp),%rdi
call   1080 <check_table1@plt>
cmp    $0x0,%eax
je     1267 <find_table+0xf7>
lea    -0x210(%rbp),%rdi
lea    -0x110(%rbp),%rsi
mov    $0xff,%edx
call   1030 <strncpy@plt>
movl   $0x1,-0x314(%rbp)
mov    -0x31c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x31c(%rbp)
jmp    1367 <find_table+0x1f7>
lea    -0x110(%rbp),%rdi
call   1040 <check_table2@plt>
cmp    $0x0,%eax
je     1311 <find_table+0x1a1>
lea    -0x110(%rbp),%rdi
lea    0xd71(%rip),%rsi
call   1090 <strtok@plt>
xor    %eax,%eax
mov    %eax,%edi
lea    0xd61(%rip),%rsi
call   1090 <strtok@plt>
mov    %rax,-0x328(%rbp)
cmpq   $0x0,-0x328(%rbp)
je     1302 <find_table+0x192>
mov    -0x8(%rbp),%rdi
mov    -0x328(%rbp),%rsi
mov    -0xc(%rbp),%edx
call   1030 <strncpy@plt>
mov    -0x31c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x31c(%rbp)
lea    -0x310(%rbp),%rdi
lea    -0x110(%rbp),%rsi
mov    $0xff,%edx
call   1030 <strncpy@plt>
movl   $0x2,-0x314(%rbp)
jmp    130c <find_table+0x19c>
movl   $0x0,-0x31c(%rbp)
jmp    131b <find_table+0x1ab>
movl   $0x0,-0x31c(%rbp)
jmp    1367 <find_table+0x1f7>
lea    -0x110(%rbp),%rdi
call   1070 <check_table3@plt>
cmp    $0x0,%eax
je     134e <find_table+0x1de>
movl   $0x2,-0x31c(%rbp)
movl   $0x2,-0x318(%rbp)
jmp    1358 <find_table+0x1e8>
movl   $0x0,-0x31c(%rbp)
jmp    1367 <find_table+0x1f7>
movl   $0x0,-0x31c(%rbp)
cmpl   $0x0,-0x31c(%rbp)
jne    13db <find_table+0x26b>
cmpl   $0x0,-0x10(%rbp)
je     13db <find_table+0x26b>
cmpl   $0x2,-0x314(%rbp)
jne    139e <find_table+0x22e>
lea    -0x310(%rbp),%rsi
lea    0xc69(%rip),%rdi
call   1050 <printf@plt>
cmpl   $0x1,-0x314(%rbp)
jne    13be <find_table+0x24e>
lea    -0x210(%rbp),%rsi
lea    0xc49(%rip),%rdi
call   1050 <printf@plt>
movl   $0x0,-0x314(%rbp)
lea    -0x110(%rbp),%rsi
lea    0xc2c(%rip),%rdi
call   1050 <printf@plt>
jmp    143e <find_table+0x2ce>
cmpl   $0x0,-0x10(%rbp)
je     1434 <find_table+0x2c4>
cmpl   $0x2,-0x314(%rbp)
jne    140a <find_table+0x29a>
lea    -0x310(%rbp),%rsi
lea    0xbfd(%rip),%rdi
call   1050 <printf@plt>
cmpl   $0x1,-0x314(%rbp)
jne    142a <find_table+0x2ba>
lea    -0x210(%rbp),%rsi
lea    0xbdd(%rip),%rdi
call   1050 <printf@plt>
movl   $0x0,-0x314(%rbp)
movl   $0x1,-0x318(%rbp)
jmp    11a3 <find_table+0x33>
mov    -0x318(%rbp),%eax
add    $0x330,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<find_table>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x318,%rsp
mov    %edx,%ebp
mov    %esi,0x4(%rsp)
mov    %rdi,0x8(%rsp)
xor    %r12d,%r12d
mov    0x2e52(%rip),%rbx
lea    0x210(%rsp),%r15
xor    %r13d,%r13d
jmp    11bc <find_table+0x4c>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r14d,%r13d
test   %r14d,%r14d
jne    1354 <find_table+0x1e4>
mov    (%rbx),%edx
mov    %r15,%rdi
mov    $0xff,%esi
call   1060 <fgets@plt>
test   %rax,%rax
je     1323 <find_table+0x1b3>
cmp    $0x2,%r13d
je     1230 <find_table+0xc0>
xor    %r14d,%r14d
cmp    $0x1,%r13d
je     1250 <find_table+0xe0>
test   %r13d,%r13d
jne    12d0 <find_table+0x160>
mov    %r15,%rdi
call   1080 <check_table1@plt>
test   %eax,%eax
je     12d0 <find_table+0x160>
lea    0x110(%rsp),%rdi
mov    %r15,%rsi
mov    $0xff,%edx
call   1030 <strncpy@plt>
mov    $0x1,%r13d
xor    %r14d,%r14d
mov    $0x1,%r12d
jmp    11b3 <find_table+0x43>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r15,%rdi
call   1070 <check_table3@plt>
xor    %r14d,%r14d
test   %eax,%eax
setne  %r14b
add    %r14d,%r14d
jmp    12d0 <find_table+0x160>
nopl   0x0(%rax)
mov    %r15,%rdi
call   1040 <check_table2@plt>
test   %eax,%eax
je     12d0 <find_table+0x160>
mov    %r15,%rdi
mov    %ebp,%r13d
mov    %rbx,%rbp
lea    0xd94(%rip),%rbx
mov    %rbx,%rsi
call   1090 <strtok@plt>
xor    %r14d,%r14d
xor    %edi,%edi
mov    %rbx,%rsi
mov    %rbp,%rbx
mov    %r13d,%ebp
call   1090 <strtok@plt>
test   %rax,%rax
je     12d0 <find_table+0x160>
mov    0x8(%rsp),%rdi
mov    %rax,%rsi
mov    0x4(%rsp),%edx
call   1030 <strncpy@plt>
lea    0x10(%rsp),%rdi
mov    %r15,%rsi
mov    $0xff,%edx
call   1030 <strncpy@plt>
mov    $0x2,%r13d
xor    %r14d,%r14d
mov    $0x2,%r12d
jmp    11b3 <find_table+0x43>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
test   %ebp,%ebp
je     11b0 <find_table+0x40>
test   %r14d,%r14d
jne    11b0 <find_table+0x40>
lea    0x10(%rsp),%rsi
cmp    $0x2,%r12d
je     12fa <find_table+0x18a>
cmp    $0x1,%r12d
jne    1306 <find_table+0x196>
lea    0x110(%rsp),%rsi
lea    0xd01(%rip),%rdi
call   1050 <printf@plt>
lea    0xcf5(%rip),%rdi
mov    %r15,%rsi
call   1050 <printf@plt>
xor    %r14d,%r14d
xor    %r13d,%r13d
xor    %r12d,%r12d
jmp    11b3 <find_table+0x43>
mov    $0x1,%r14d
test   %ebp,%ebp
je     1354 <find_table+0x1e4>
cmp    $0x2,%r12d
je     1343 <find_table+0x1d3>
cmp    $0x1,%r12d
jne    1354 <find_table+0x1e4>
lea    0x110(%rsp),%rsi
jmp    1348 <find_table+0x1d8>
lea    0x10(%rsp),%rsi
lea    0xcb3(%rip),%rdi
call   1050 <printf@plt>
mov    %r14d,%eax
add    $0x318,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@stdin = global i32 0
@.str = [2 x i8] c"`\00"
@.str.1 = [3 x i8] c"%s\00"
define i32 @find_table(i8* %0, i32 %1, i32 %2) {
%4 = alloca [255 x i8]
%5 = alloca [255 x i8]
%6 = alloca [255 x i8]
%7 = getelementptr inbounds [255 x i8], [255 x i8]* %4, i64 0, i64 0
%8 = getelementptr inbounds [255 x i8], [255 x i8]* %5, i64 0, i64 0
%9 = getelementptr inbounds [255 x i8], [255 x i8]* %6, i64 0, i64 0
%10 = icmp ne i32 %2, 0
%11 = icmp eq i32 %2, 0
br label %12
12: ; preds = %3, %52
%13 = phi i32 [ 0, %3 ], [ %55, %52 ]
%14 = phi i32 [ 0, %3 ], [ %54, %52 ]
%15 = load i32, i32* @stdin
%16 = call i32* @fgets(i8* %7, i32 255, i32 %15)
%17 = icmp eq i32* %16, null
br i1 %17, label %49, label %18
18: ; preds = %12
switch i32 %14, label %38 [
i32 0, label %19
i32 1, label %24
i32 2, label %34
]
19: ; preds = %18
%20 = call i32 @check_table1(i8* %7)
%21 = icmp eq i32 %20, 0
br i1 %21, label %38, label %22
22: ; preds = %19
%23 = call i32 @strncpy(i8* %8, i8* %7, i32 255)
br label %52
24: ; preds = %18
%25 = call i32 @check_table2(i8* %7)
%26 = icmp eq i32 %25, 0
br i1 %26, label %38, label %27
27: ; preds = %24
%28 = call i8* @strtok(i8* %7, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%29 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%30 = icmp eq i8* %29, null
br i1 %30, label %38, label %31
31: ; preds = %27
%32 = call i32 @strncpy(i8* %0, i8* %29, i32 %1)
%33 = call i32 @strncpy(i8* %9, i8* %7, i32 255)
br label %52
34: ; preds = %18
%35 = call i32 @check_table3(i8* %7)
%36 = icmp eq i32 %35, 0
%37 = select i1 %36, i32 0, i32 2
br label %38
38: ; preds = %18, %34, %24, %27, %19
%39 = phi i32 [ 0, %19 ], [ 0, %27 ], [ 0, %24 ], [ %37, %34 ], [ 0, %18 ]
%40 = icmp eq i32 %39, 0
%41 = and i1 %10, %40
br i1 %41, label %42, label %52
42: ; preds = %38
switch i32 %13, label %47 [
i32 2, label %44
i32 1, label %43
]
43: ; preds = %42
br label %44
44: ; preds = %42, %43
%45 = phi i8* [ %8, %43 ], [ %9, %42 ]
%46 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %45)
br label %47
47: ; preds = %44, %42
%48 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %7)
br label %52
49: ; preds = %12
br i1 %11, label %60, label %50
50: ; preds = %49
switch i32 %13, label %60 [
i32 2, label %57
i32 1, label %51
]
51: ; preds = %50
br label %57
52: ; preds = %31, %22, %38, %47
%53 = phi i32 [ 0, %47 ], [ %39, %38 ], [ 0, %22 ], [ 0, %31 ]
%54 = phi i32 [ 0, %47 ], [ %39, %38 ], [ 1, %22 ], [ 2, %31 ]
%55 = phi i32 [ 0, %47 ], [ %13, %38 ], [ 1, %22 ], [ 2, %31 ]
%56 = icmp eq i32 %53, 0
br i1 %56, label %12, label %60
57: ; preds = %50, %51
%58 = phi i8* [ %8, %51 ], [ %9, %50 ]
%59 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %58)
br label %60
60: ; preds = %52, %57, %49, %50
%61 = phi i32 [ 1, %50 ], [ 1, %49 ], [ 1, %57 ], [ %53, %52 ]
ret i32 %61
}