#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 strlen(char *);
scalar_t__ strncmp(char *, char const *, int);
int processString(char *str, const char **keywords) {
  int len, i;
  if (str == NULL || strlen(str) < 2)
    return 0;
  len = strlen(str);
  for (i = 0; i < 32; i++) {
    if (0 == strncmp(str, keywords[i], len - 1))
      return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<processString>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     114d <processString+0x2d>
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
cmp    $0x2,%eax
jge    1159 <processString+0x39>
movl   $0x0,-0x4(%rbp)
jmp    11c5 <processString+0xa5>
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
cmpl   $0x20,-0x20(%rbp)
jge    11be <processString+0x9e>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
mov    -0x1c(%rbp),%edx
sub    $0x1,%edx
call   1030 <strncmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
jne    11ab <processString+0x8b>
movl   $0x1,-0x4(%rbp)
jmp    11c5 <processString+0xa5>
jmp    11b0 <processString+0x90>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    116c <processString+0x4c>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<processString>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
xor    %ebp,%ebp
test   %rdi,%rdi
je     1176 <processString+0x56>
mov    %rsi,%r14
mov    %rdi,%r15
call   1040 <strlen@plt>
cmp    $0x2,%eax
jl     1176 <processString+0x56>
mov    %r15,%rdi
call   1040 <strlen@plt>
mov    %eax,%ebp
add    $0xffffffff,%ebp
xor    %ebx,%ebx
nopl   (%rax)
mov    (%r14,%rbx,8),%rsi
mov    %r15,%rdi
mov    %ebp,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     1171 <processString+0x51>
add    $0x1,%rbx
cmp    $0x20,%rbx
jne    1150 <processString+0x30>
xor    %ebp,%ebp
jmp    1176 <processString+0x56>
mov    $0x1,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @processString(i8* %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
store i8* %0, i8** %4
store i8** %1, i8*** %5
%8 = load i8*, i8** %4
%9 = icmp eq i8* %8, null
br i1 %9, label %14, label %10
10: ; preds = %2
%11 = load i8*, i8** %4
%12 = call i32 @strlen(i8* %11)
%13 = icmp slt i32 %12, 2
br i1 %13, label %14, label %15
14: ; preds = %10, %2
store i32 0, i32* %3
br label %38
15: ; preds = %10
%16 = load i8*, i8** %4
%17 = call i32 @strlen(i8* %16)
store i32 %17, i32* %6
store i32 0, i32* %7
br label %18
18: ; preds = %34, %15
%19 = load i32, i32* %7
%20 = icmp slt i32 %19, 32
br i1 %20, label %21, label %37
21: ; preds = %18
%22 = load i8*, i8** %4
%23 = load i8**, i8*** %5
%24 = load i32, i32* %7
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i8*, i8** %23, i64 %25
%27 = load i8*, i8** %26
%28 = load i32, i32* %6
%29 = sub nsw i32 %28, 1
%30 = call i64 @strncmp(i8* %22, i8* %27, i32 %29)
%31 = icmp eq i64 0, %30
br i1 %31, label %32, label %33
32: ; preds = %21
store i32 1, i32* %3
br label %38
33: ; preds = %21
br label %34
34: ; preds = %33
%35 = load i32, i32* %7
%36 = add nsw i32 %35, 1
store i32 %36, i32* %7
br label %18
37: ; preds = %18
store i32 0, i32* %3
br label %38
38: ; preds = %37, %32, %14
%39 = load i32, i32* %3
ret i32 %39
}

LLVM IR (-O2):
define i32 @processString(i8* %0, i8** nocapture %1) {
%3 = icmp eq i8* %0, null
br i1 %3, label %19, label %4
4: ; preds = %2
%5 = tail call i32 @strlen(i8* %0)
%6 = icmp slt i32 %5, 2
br i1 %6, label %19, label %7
7: ; preds = %4
%8 = tail call i32 @strlen(i8* %0)
%9 = add nsw i32 %8, -1
br label %13
10: ; preds = %13
%11 = add nuw nsw i64 %14, 1
%12 = icmp eq i64 %11, 32
br i1 %12, label %19, label %13
13: ; preds = %7, %10
%14 = phi i64 [ 0, %7 ], [ %11, %10 ]
%15 = getelementptr inbounds i8*, i8** %1, i64 %14
%16 = load i8*, i8** %15
%17 = tail call i64 @strncmp(i8* %0, i8* %16, i32 %9)
%18 = icmp eq i64 %17, 0
br i1 %18, label %19, label %10
19: ; preds = %10, %13, %2, %4
%20 = phi i32 [ 0, %4 ], [ 0, %2 ], [ 0, %10 ], [ 1, %13 ]
ret i32 %20
}