#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 */
scalar_t__ strncmp(char *, char *, int);
bool parseKeyword(char *word, int *keyword) {
  return ((strncmp(word, "sample", 6) == 0) && (*keyword = 0x02)) ||
         ((strncmp(word, "when", 4) == 0) && (*keyword = 0x03)) ||
         ((strncmp(word, "write", 5) == 0) && (*keyword = 0x04)) ||
         ((strncmp(word, "clear", 5) == 0) && (*keyword = 0x05)) ||
         ((strncmp(word, "timeout", 7) == 0) && (*keyword = 0x01)) ||
         ((strncmp(word, "screen", 6) == 0) && (*keyword = 0x07)) ||
         ((strncmp(word, "control", 7) == 0) && (*keyword = 0x08));
}


x86 assembly (clang, -O0):
<parseKeyword>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xed5(%rip),%rsi
mov    $0x6,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    1156 <parseKeyword+0x46>
mov    -0x10(%rbp),%rax
movl   $0x2,(%rax)
mov    $0x1,%al
test   $0x1,%al
mov    %al,-0x11(%rbp)
jne    12a0 <parseKeyword+0x190>
mov    -0x8(%rbp),%rdi
lea    0xea6(%rip),%rsi
mov    $0x4,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    118c <parseKeyword+0x7c>
mov    -0x10(%rbp),%rax
movl   $0x3,(%rax)
mov    $0x1,%al
test   $0x1,%al
mov    %al,-0x11(%rbp)
jne    12a0 <parseKeyword+0x190>
mov    -0x8(%rbp),%rdi
lea    0xe75(%rip),%rsi
mov    $0x5,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    11c2 <parseKeyword+0xb2>
mov    -0x10(%rbp),%rax
movl   $0x4,(%rax)
mov    $0x1,%al
test   $0x1,%al
mov    %al,-0x11(%rbp)
jne    12a0 <parseKeyword+0x190>
mov    -0x8(%rbp),%rdi
lea    0xe45(%rip),%rsi
mov    $0x5,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    11f8 <parseKeyword+0xe8>
mov    -0x10(%rbp),%rax
movl   $0x5,(%rax)
mov    $0x1,%al
test   $0x1,%al
mov    %al,-0x11(%rbp)
jne    12a0 <parseKeyword+0x190>
mov    -0x8(%rbp),%rdi
lea    0xe15(%rip),%rsi
mov    $0x7,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    122e <parseKeyword+0x11e>
mov    -0x10(%rbp),%rax
movl   $0x1,(%rax)
mov    $0x1,%al
test   $0x1,%al
mov    %al,-0x11(%rbp)
jne    12a0 <parseKeyword+0x190>
mov    -0x8(%rbp),%rdi
lea    0xde7(%rip),%rsi
mov    $0x6,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    1264 <parseKeyword+0x154>
mov    -0x10(%rbp),%rax
movl   $0x7,(%rax)
mov    $0x1,%al
test   $0x1,%al
mov    %al,-0x11(%rbp)
jne    12a0 <parseKeyword+0x190>
mov    -0x8(%rbp),%rdi
lea    0xdb8(%rip),%rsi
mov    $0x7,%edx
call   1030 <strncmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x12(%rbp)
jne    129a <parseKeyword+0x18a>
mov    -0x10(%rbp),%rax
movl   $0x8,(%rax)
mov    $0x1,%al
mov    %al,-0x12(%rbp)
mov    -0x12(%rbp),%al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parseKeyword>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0xedf(%rip),%rsi
mov    $0x6,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     11ed <parseKeyword+0xdd>
lea    0xecc(%rip),%rsi
mov    $0x4,%ebp
mov    %rbx,%rdi
mov    $0x4,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     11f4 <parseKeyword+0xe4>
lea    0xeaf(%rip),%rsi
mov    %rbx,%rdi
mov    $0x5,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     11f9 <parseKeyword+0xe9>
lea    0xe98(%rip),%rsi
mov    %rbx,%rdi
mov    $0x5,%edx
call   1030 <strncmp@plt>
mov    $0x5,%ebp
test   %rax,%rax
je     11f9 <parseKeyword+0xe9>
lea    0xe80(%rip),%rsi
mov    $0x7,%ebp
mov    %rbx,%rdi
mov    $0x7,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     1206 <parseKeyword+0xf6>
lea    0xe6a(%rip),%rsi
mov    %rbx,%rdi
mov    $0x6,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     11f9 <parseKeyword+0xe9>
lea    0xe58(%rip),%rsi
mov    %rbx,%rdi
mov    $0x7,%edx
call   1030 <strncmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
jne    1201 <parseKeyword+0xf1>
mov    $0x8,%ebp
jmp    11f9 <parseKeyword+0xe9>
mov    $0x2,%ebp
jmp    11f9 <parseKeyword+0xe9>
mov    $0x3,%ebp
mov    %ebp,(%r14)
mov    $0x1,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret
mov    $0x1,%ebp
jmp    11f9 <parseKeyword+0xe9>

LLVM IR (-O0):
@.str = [7 x i8] c"sample\00"
@.str.1 = [5 x i8] c"when\00"
@.str.2 = [6 x i8] c"write\00"
@.str.3 = [6 x i8] c"clear\00"
@.str.4 = [8 x i8] c"timeout\00"
@.str.5 = [7 x i8] c"screen\00"
@.str.6 = [8 x i8] c"control\00"
define i32 @parseKeyword(i8* %0, i32* %1) {
%3 = alloca i8*
%4 = alloca i32*
store i8* %0, i8** %3
store i32* %1, i32** %4
%5 = load i8*, i8** %3
%6 = call i64 @strncmp(i8* %5, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 6)
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = load i32*, i32** %4
store i32 2, i32* %9
br i1 true, label %48, label %10
10: ; preds = %8, %2
%11 = load i8*, i8** %3
%12 = call i64 @strncmp(i8* %11, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 4)
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %10
%15 = load i32*, i32** %4
store i32 3, i32* %15
br i1 true, label %48, label %16
16: ; preds = %14, %10
%17 = load i8*, i8** %3
%18 = call i64 @strncmp(i8* %17, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 5)
%19 = icmp eq i64 %18, 0
br i1 %19, label %20, label %22
20: ; preds = %16
%21 = load i32*, i32** %4
store i32 4, i32* %21
br i1 true, label %48, label %22
22: ; preds = %20, %16
%23 = load i8*, i8** %3
%24 = call i64 @strncmp(i8* %23, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32 5)
%25 = icmp eq i64 %24, 0
br i1 %25, label %26, label %28
26: ; preds = %22
%27 = load i32*, i32** %4
store i32 5, i32* %27
br i1 true, label %48, label %28
28: ; preds = %26, %22
%29 = load i8*, i8** %3
%30 = call i64 @strncmp(i8* %29, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i32 7)
%31 = icmp eq i64 %30, 0
br i1 %31, label %32, label %34
32: ; preds = %28
%33 = load i32*, i32** %4
store i32 1, i32* %33
br i1 true, label %48, label %34
34: ; preds = %32, %28
%35 = load i8*, i8** %3
%36 = call i64 @strncmp(i8* %35, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i32 6)
%37 = icmp eq i64 %36, 0
br i1 %37, label %38, label %40
38: ; preds = %34
%39 = load i32*, i32** %4
store i32 7, i32* %39
br i1 true, label %48, label %40
40: ; preds = %38, %34
%41 = load i8*, i8** %3
%42 = call i64 @strncmp(i8* %41, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0), i32 7)
%43 = icmp eq i64 %42, 0
br i1 %43, label %44, label %46
44: ; preds = %40
%45 = load i32*, i32** %4
store i32 8, i32* %45
br label %46
46: ; preds = %44, %40
%47 = phi i1 [ false, %40 ], [ true, %44 ]
br label %48
48: ; preds = %46, %38, %32, %26, %20, %14, %8
%49 = phi i1 [ true, %38 ], [ true, %32 ], [ true, %26 ], [ true, %20 ], [ true, %14 ], [ true, %8 ], [ %47, %46 ]
%50 = zext i1 %49 to i32
ret i32 %50
}

LLVM IR (-O2):
@.str = [7 x i8] c"sample\00"
@.str.1 = [5 x i8] c"when\00"
@.str.2 = [6 x i8] c"write\00"
@.str.3 = [6 x i8] c"clear\00"
@.str.4 = [8 x i8] c"timeout\00"
@.str.5 = [7 x i8] c"screen\00"
@.str.6 = [8 x i8] c"control\00"
define i32 @parseKeyword(i8* %0, i32* nocapture writeonly %1) {
%3 = tail call i64 @strncmp(i8* %0, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 6)
%4 = icmp eq i64 %3, 0
br i1 %4, label %23, label %5
5: ; preds = %2
%6 = tail call i64 @strncmp(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 4)
%7 = icmp eq i64 %6, 0
br i1 %7, label %23, label %8
8: ; preds = %5
%9 = tail call i64 @strncmp(i8* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 5)
%10 = icmp eq i64 %9, 0
br i1 %10, label %23, label %11
11: ; preds = %8
%12 = tail call i64 @strncmp(i8* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32 5)
%13 = icmp eq i64 %12, 0
br i1 %13, label %23, label %14
14: ; preds = %11
%15 = tail call i64 @strncmp(i8* %0, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i32 7)
%16 = icmp eq i64 %15, 0
br i1 %16, label %23, label %17
17: ; preds = %14
%18 = tail call i64 @strncmp(i8* %0, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i32 6)
%19 = icmp eq i64 %18, 0
br i1 %19, label %23, label %20
20: ; preds = %17
%21 = tail call i64 @strncmp(i8* %0, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0), i32 7)
%22 = icmp eq i64 %21, 0
br i1 %22, label %23, label %25
23: ; preds = %20, %17, %14, %11, %8, %5, %2
%24 = phi i32 [ 2, %2 ], [ 3, %5 ], [ 4, %8 ], [ 5, %11 ], [ 1, %14 ], [ 7, %17 ], [ 8, %20 ]
store i32 %24, i32* %1
br label %25
25: ; preds = %23, %20
%26 = phi i32 [ 0, %20 ], [ 1, %23 ]
ret i32 %26
}