#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 */
typedef int /*<<< orphan*/ keywords;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int searchKeyTable(char **, int, char *, int *);
int /*<<< orphan*/ system(char *);
int main() {
  char *keywords[] = {"while", "case", "static", "do"};
  int pos = 0;
  int ret = searchKeyTable(keywords, (sizeof(keywords) / sizeof(*keywords)),
                           "while", &pos);
  if (ret != 0) {
    return ret;
  }
  printf("pos == %d\n", pos);
  printf("\n");
  system("pause");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2cba(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0x2cb7(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0x2cb4(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0x2cb1(%rip),%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x34(%rbp)
lea    -0x30(%rbp),%rdi
mov    $0x4,%esi
lea    0xe7e(%rip),%rdx
lea    -0x34(%rbp),%rcx
call   1030 <searchKeyTable@plt>
mov    %eax,-0x38(%rbp)
cmpl   $0x0,-0x38(%rbp)
je     11a3 <main+0x73>
mov    -0x38(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    11d5 <main+0xa5>
mov    -0x34(%rbp),%esi
lea    0xe68(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe63(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe57(%rip),%rdi
call   1040 <system@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x30,%rsp
movaps 0x2cc4(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0x2ca8(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movl   $0x0,0xc(%rsp)
lea    0xe94(%rip),%rdx
lea    0x10(%rsp),%rdi
lea    0xc(%rsp),%rcx
mov    $0x4,%esi
call   1040 <searchKeyTable@plt>
mov    %eax,%ebx
test   %eax,%eax
jne    11ae <main+0x6e>
mov    0xc(%rsp),%esi
lea    0xe84(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xe77(%rip),%rdi
call   1050 <system@plt>
mov    %ebx,%eax
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [6 x i8] c"while\00"
@.str.1 = [5 x i8] c"case\00"
@.str.2 = [7 x i8] c"static\00"
@.str.3 = [3 x i8] c"do\00"
@__const.main.keywords = [4 x i8*] [i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i32 0, i32 0)]
@.str.4 = [11 x i8] c"pos == %d\0A\00"
@.str.5 = [2 x i8] c"\0A\00"
@.str.6 = [6 x i8] c"pause\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [4 x i8*]
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = bitcast [4 x i8*]* %2 to i8*
store i32 0, i32* %3
%6 = getelementptr inbounds [4 x i8*], [4 x i8*]* %2, i64 0, i64 0
%7 = call i32 @searchKeyTable(i8** %6, i32 4, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %3)
store i32 %7, i32* %4
%8 = load i32, i32* %4
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %0
%11 = load i32, i32* %4
store i32 %11, i32* %1
br label %17
12: ; preds = %0
%13 = load i32, i32* %3
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i32 %13)
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%16 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0))
store i32 0, i32* %1
br label %17
17: ; preds = %12, %10
%18 = load i32, i32* %1
ret i32 %18
}

LLVM IR (-O2):
@.str = [6 x i8] c"while\00"
@.str.1 = [5 x i8] c"case\00"
@.str.2 = [7 x i8] c"static\00"
@.str.3 = [3 x i8] c"do\00"
@__const.main.keywords = [4 x i8*] [i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i32 0, i32 0)]
@.str.4 = [11 x i8] c"pos == %d\0A\00"
@.str.6 = [6 x i8] c"pause\00"
define i32 @main() {
%1 = alloca [4 x i8*]
%2 = alloca i32
%3 = bitcast [4 x i8*]* %1 to i8*
%4 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%5 = getelementptr inbounds [4 x i8*], [4 x i8*]* %1, i64 0, i64 0
%6 = call i32 @searchKeyTable(i8** %5, i32 4, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %2)
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %13
8: ; preds = %0
%9 = load i32, i32* %2
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i32 %9)
%11 = call i32 @putchar(i32 10)
%12 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0))
br label %13
13: ; preds = %0, %8
ret i32 %6
}