#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 */
struct SMACK {
  int dummy;
};

/* Variables and functions */
int fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ smack_add_pattern(struct SMACK *, char const *, unsigned int,
                                     unsigned int, int /*<<< orphan*/);
int /*<<< orphan*/ smack_compile(struct SMACK *);
struct SMACK *smack_create(char *, int);
int /*<<< orphan*/ smack_destroy(struct SMACK *);
size_t smack_search_next(struct SMACK *, unsigned int *, char const *,
                         unsigned int *, unsigned int);
int /*<<< orphan*/ stderr;
scalar_t__ strlen(char const *);
int smack_selftest(void) {
  struct SMACK *s;
  {
    const char *patterns[] = {
        "GET",      "PUT",        "POST",    "OPTIONS",
        "HEAD",     "DELETE",     "TRACE",   "CONNECT",
        "PROPFIND", "PROPPATCH",  "MKCOL",   "MKWORKSPACE",
        "MOVE",     "LOCK",       "UNLOCK",  "VERSION-CONTROL",
        "REPORT",   "CHECKOUT",   "CHECKIN", "UNCHECKOUT",
        "COPY",     "UPDATE",     "LABEL",   "BASELINE-CONTROL",
        "MERGE",    "SEARCH",     "ACL",     "ORDERPATCH",
        "PATCH",    "MKACTIVITY", 0};
    unsigned i;
    const char *text =
        "ahpropfinddf;orderpatchposearchmoversion-controlockasldhf";
    unsigned text_length = (unsigned)strlen(text);
    size_t id;
    unsigned state = 0;
    s = smack_create("test1", 1);
    for (i = 0; patterns[i]; i++)
      smack_add_pattern(s, patterns[i], (unsigned)strlen(patterns[i]), i, 0);
    smack_compile(s);
    i = 0;
    id = smack_search_next(s, &state, text, &i, text_length);
    if (8 != id || 10 != i)
      return 1 + fprintf(stderr, "smack: fail %s\n", "PROPFIND");
    id = smack_search_next(s, &state, text, &i, text_length);
    if (28 != id || 23 != i)
      return 1 + fprintf(stderr, "smack: fail %s\n", "PATCH");
    id = smack_search_next(s, &state, text, &i, text_length);
    if (27 != id || 23 != i)
      return 1 + fprintf(stderr, "smack: fail %s\n", "ORDERPATCH");
    id = smack_search_next(s, &state, text, &i, text_length);
    if (25 != id || 31 != i)
      return 1 + fprintf(stderr, "smack: fail %s\n", "SEARCH");
    id = smack_search_next(s, &state, text, &i, text_length);
    if (12 != id || 35 != i)
      return 1 + fprintf(stderr, "smack: fail %s\n", "MOVE");
    id = smack_search_next(s, &state, text, &i, text_length);
    if (15 != id || 48 != i)
      return 1 + fprintf(stderr, "smack: fail %s\n", "VERSION-CONTROL");
    id = smack_search_next(s, &state, text, &i, text_length);
    if (13 != id || 51 != i)
      return 1 + fprintf(stderr, "smack: fail %s\n", "LOCK");
    smack_destroy(s);
  }
  return 0;
}


x86 assembly (clang, -O0):
<smack_selftest>:
push   %rbp
mov    %rsp,%rbp
sub    $0x150,%rsp
lea    -0x110(%rbp),%rdi
lea    0x2b87(%rip),%rsi
mov    $0xf8,%edx
call   1080 <memcpy@plt>
lea    0xf2a(%rip),%rax
mov    %rax,-0x120(%rbp)
mov    -0x120(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x124(%rbp)
movl   $0x0,-0x134(%rbp)
lea    0xf3a(%rip),%rdi
mov    $0x1,%esi
call   1030 <smack_create@plt>
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x114(%rbp)
mov    -0x114(%rbp),%eax
cmpq   $0x0,-0x110(%rbp,%rax,8)
je     1266 <smack_selftest+0xe6>
mov    -0x10(%rbp),%rax
mov    %rax,-0x148(%rbp)
mov    -0x114(%rbp),%eax
mov    -0x110(%rbp,%rax,8),%rax
ff
mov    %rax,-0x140(%rbp)
mov    -0x114(%rbp),%eax
mov    -0x110(%rbp,%rax,8),%rdi
ff
call   1040 <strlen@plt>
mov    -0x148(%rbp),%rdi
mov    -0x140(%rbp),%rsi
mov    %eax,%edx
mov    -0x114(%rbp),%ecx
xor    %r8d,%r8d
call   1090 <smack_add_pattern@plt>
mov    -0x114(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x114(%rbp)
jmp    11ec <smack_selftest+0x6c>
mov    -0x10(%rbp),%rdi
call   1050 <smack_compile@plt>
movl   $0x0,-0x114(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x120(%rbp),%rdx
mov    -0x124(%rbp),%r8d
lea    -0x134(%rbp),%rsi
lea    -0x114(%rbp),%rcx
call   10a0 <smack_search_next@plt>
mov    %rax,-0x130(%rbp)
mov    $0x8,%eax
cmp    -0x130(%rbp),%rax
jne    12c8 <smack_selftest+0x148>
mov    $0xa,%eax
cmp    -0x114(%rbp),%eax
je     12ef <smack_selftest+0x16f>
mov    0x2d11(%rip),%rax
mov    (%rax),%edi
lea    0xe3c(%rip),%rsi
lea    0xd50(%rip),%rdx
call   1070 <fprintf@plt>
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    15c3 <smack_selftest+0x443>
mov    -0x10(%rbp),%rdi
mov    -0x120(%rbp),%rdx
mov    -0x124(%rbp),%r8d
lea    -0x134(%rbp),%rsi
lea    -0x114(%rbp),%rcx
call   10a0 <smack_search_next@plt>
mov    %rax,-0x130(%rbp)
mov    $0x1c,%eax
cmp    -0x130(%rbp),%rax
jne    133e <smack_selftest+0x1be>
mov    $0x17,%eax
cmp    -0x114(%rbp),%eax
je     1365 <smack_selftest+0x1e5>
mov    0x2c9b(%rip),%rax
mov    (%rax),%edi
lea    0xdc6(%rip),%rsi
lea    0xce7(%rip),%rdx
call   1070 <fprintf@plt>
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    15c3 <smack_selftest+0x443>
mov    -0x10(%rbp),%rdi
mov    -0x120(%rbp),%rdx
mov    -0x124(%rbp),%r8d
lea    -0x134(%rbp),%rsi
lea    -0x114(%rbp),%rcx
call   10a0 <smack_search_next@plt>
mov    %rax,-0x130(%rbp)
mov    $0x1b,%eax
cmp    -0x130(%rbp),%rax
jne    13b4 <smack_selftest+0x234>
mov    $0x17,%eax
cmp    -0x114(%rbp),%eax
je     13db <smack_selftest+0x25b>
mov    0x2c25(%rip),%rax
mov    (%rax),%edi
lea    0xd50(%rip),%rsi
lea    0xcf3(%rip),%rdx
call   1070 <fprintf@plt>
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    15c3 <smack_selftest+0x443>
mov    -0x10(%rbp),%rdi
mov    -0x120(%rbp),%rdx
mov    -0x124(%rbp),%r8d
lea    -0x134(%rbp),%rsi
lea    -0x114(%rbp),%rcx
call   10a0 <smack_search_next@plt>
mov    %rax,-0x130(%rbp)
mov    $0x19,%eax
cmp    -0x130(%rbp),%rax
jne    142a <smack_selftest+0x2aa>
mov    $0x1f,%eax
cmp    -0x114(%rbp),%eax
je     1451 <smack_selftest+0x2d1>
mov    0x2baf(%rip),%rax
mov    (%rax),%edi
lea    0xcda(%rip),%rsi
lea    0xc72(%rip),%rdx
call   1070 <fprintf@plt>
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    15c3 <smack_selftest+0x443>
mov    -0x10(%rbp),%rdi
mov    -0x120(%rbp),%rdx
mov    -0x124(%rbp),%r8d
lea    -0x134(%rbp),%rsi
lea    -0x114(%rbp),%rcx
call   10a0 <smack_search_next@plt>
mov    %rax,-0x130(%rbp)
mov    $0xc,%eax
cmp    -0x130(%rbp),%rax
jne    14a0 <smack_selftest+0x320>
mov    $0x23,%eax
cmp    -0x114(%rbp),%eax
je     14c7 <smack_selftest+0x347>
mov    0x2b39(%rip),%rax
mov    (%rax),%edi
lea    0xc64(%rip),%rsi
lea    0xb9d(%rip),%rdx
call   1070 <fprintf@plt>
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    15c3 <smack_selftest+0x443>
mov    -0x10(%rbp),%rdi
mov    -0x120(%rbp),%rdx
mov    -0x124(%rbp),%r8d
lea    -0x134(%rbp),%rsi
lea    -0x114(%rbp),%rcx
call   10a0 <smack_search_next@plt>
mov    %rax,-0x130(%rbp)
mov    $0xf,%eax
cmp    -0x130(%rbp),%rax
jne    1516 <smack_selftest+0x396>
mov    $0x30,%eax
cmp    -0x114(%rbp),%eax
je     153d <smack_selftest+0x3bd>
mov    0x2ac3(%rip),%rax
mov    (%rax),%edi
lea    0xbee(%rip),%rsi
lea    0xb33(%rip),%rdx
call   1070 <fprintf@plt>
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    15c3 <smack_selftest+0x443>
mov    -0x10(%rbp),%rdi
mov    -0x120(%rbp),%rdx
mov    -0x124(%rbp),%r8d
lea    -0x134(%rbp),%rsi
lea    -0x114(%rbp),%rcx
call   10a0 <smack_search_next@plt>
mov    %rax,-0x130(%rbp)
mov    $0xd,%eax
cmp    -0x130(%rbp),%rax
jne    158c <smack_selftest+0x40c>
mov    $0x33,%eax
cmp    -0x114(%rbp),%eax
je     15b3 <smack_selftest+0x433>
mov    0x2a4d(%rip),%rax
mov    (%rax),%edi
lea    0xb78(%rip),%rsi
lea    0xab8(%rip),%rdx
call   1070 <fprintf@plt>
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    15c3 <smack_selftest+0x443>
mov    -0x10(%rbp),%rdi
call   1060 <smack_destroy@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x150,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<smack_selftest>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
movl   $0x0,0x4(%rsp)
lea    0xf87(%rip),%rdi
mov    $0x1,%esi
call   1030 <smack_create@plt>
mov    %rax,%r14
lea    0xe65(%rip),%r15
xor    %ebx,%ebx
lea    0x2b7c(%rip),%r12
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r15,%rdi
call   1040 <strlen@plt>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %eax,%edx
mov    %ebx,%ecx
xor    %r8d,%r8d
call   1080 <smack_add_pattern@plt>
mov    0x8(%r12,%rbx,8),%r15
add    $0x1,%rbx
cmp    $0x1e,%rbx
jne    11b0 <smack_selftest+0x40>
mov    %r14,%rdi
call   1050 <smack_compile@plt>
movl   $0x0,(%rsp)
lea    0xee5(%rip),%rdx
lea    0x4(%rsp),%rsi
mov    %rsp,%rcx
mov    %r14,%rdi
mov    $0x39,%r8d
call   1090 <smack_search_next@plt>
lea    0xe23(%rip),%rdx
cmp    $0x8,%rax
jne    1364 <smack_selftest+0x1f4>
cmpl   $0xa,(%rsp)
jne    1364 <smack_selftest+0x1f4>
lea    0xead(%rip),%rdx
lea    0x4(%rsp),%rsi
mov    %rsp,%rcx
mov    %r14,%rdi
mov    $0x39,%r8d
call   1090 <smack_search_next@plt>
lea    0xdf8(%rip),%rdx
cmp    $0x1c,%rax
jne    1364 <smack_selftest+0x1f4>
cmpl   $0x17,(%rsp)
jne    1364 <smack_selftest+0x1f4>
lea    0xe75(%rip),%rdx
lea    0x4(%rsp),%rsi
mov    %rsp,%rcx
mov    %r14,%rdi
mov    $0x39,%r8d
call   1090 <smack_search_next@plt>
lea    0xe42(%rip),%rdx
cmp    $0x1b,%rax
jne    1364 <smack_selftest+0x1f4>
cmpl   $0x17,(%rsp)
jne    1364 <smack_selftest+0x1f4>
lea    0xe3d(%rip),%rdx
lea    0x4(%rsp),%rsi
mov    %rsp,%rcx
mov    %r14,%rdi
mov    $0x39,%r8d
call   1090 <smack_search_next@plt>
lea    0xdff(%rip),%rdx
cmp    $0x19,%rax
jne    1364 <smack_selftest+0x1f4>
cmpl   $0x1f,(%rsp)
jne    1364 <smack_selftest+0x1f4>
lea    0xe05(%rip),%rdx
lea    0x4(%rsp),%rsi
mov    %rsp,%rcx
mov    %r14,%rdi
mov    $0x39,%r8d
call   1090 <smack_search_next@plt>
lea    0xd68(%rip),%rdx
cmp    $0xc,%rax
jne    1364 <smack_selftest+0x1f4>
cmpl   $0x23,(%rsp)
jne    1364 <smack_selftest+0x1f4>
lea    0xdd5(%rip),%rdx
lea    0x4(%rsp),%rsi
mov    %rsp,%rcx
mov    %r14,%rdi
mov    $0x39,%r8d
call   1090 <smack_search_next@plt>
lea    0xd44(%rip),%rdx
cmp    $0xf,%rax
jne    1364 <smack_selftest+0x1f4>
cmpl   $0x30,(%rsp)
jne    1364 <smack_selftest+0x1f4>
lea    0xda5(%rip),%rdx
lea    0x4(%rsp),%rsi
mov    %rsp,%rcx
mov    %r14,%rdi
mov    $0x39,%r8d
call   1090 <smack_search_next@plt>
lea    0xd0f(%rip),%rdx
cmp    $0xd,%rax
jne    1364 <smack_selftest+0x1f4>
cmpl   $0x33,(%rsp)
jne    1364 <smack_selftest+0x1f4>
mov    %r14,%rdi
call   1060 <smack_destroy@plt>
xor    %eax,%eax
jmp    137c <smack_selftest+0x20c>
mov    0x2c75(%rip),%rax
mov    (%rax),%edi
lea    0xda0(%rip),%rsi
call   1070 <fprintf@plt>
add    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.SMACK = type { i32 }
@.str = [4 x i8] c"GET\00"
@.str.1 = [4 x i8] c"PUT\00"
@.str.2 = [5 x i8] c"POST\00"
@.str.3 = [8 x i8] c"OPTIONS\00"
@.str.4 = [5 x i8] c"HEAD\00"
@.str.5 = [7 x i8] c"DELETE\00"
@.str.6 = [6 x i8] c"TRACE\00"
@.str.7 = [8 x i8] c"CONNECT\00"
@.str.8 = [9 x i8] c"PROPFIND\00"
@.str.9 = [10 x i8] c"PROPPATCH\00"
@.str.10 = [6 x i8] c"MKCOL\00"
@.str.11 = [12 x i8] c"MKWORKSPACE\00"
@.str.12 = [5 x i8] c"MOVE\00"
@.str.13 = [5 x i8] c"LOCK\00"
@.str.14 = [7 x i8] c"UNLOCK\00"
@.str.15 = [16 x i8] c"VERSION-CONTROL\00"
@.str.16 = [7 x i8] c"REPORT\00"
@.str.17 = [9 x i8] c"CHECKOUT\00"
@.str.18 = [8 x i8] c"CHECKIN\00"
@.str.19 = [11 x i8] c"UNCHECKOUT\00"
@.str.20 = [5 x i8] c"COPY\00"
@.str.21 = [7 x i8] c"UPDATE\00"
@.str.22 = [6 x i8] c"LABEL\00"
@.str.23 = [17 x i8] c"BASELINE-CONTROL\00"
@.str.24 = [6 x i8] c"MERGE\00"
@.str.25 = [7 x i8] c"SEARCH\00"
@.str.26 = [4 x i8] c"ACL\00"
@.str.27 = [11 x i8] c"ORDERPATCH\00"
@.str.28 = [6 x i8] c"PATCH\00"
@.str.29 = [11 x i8] c"MKACTIVITY\00"
@__const.smack_selftest.patterns = [31 x i8*] [i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.8, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.10, i32 0, i32 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.11, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.12, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.13, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.14, i32 0, i32 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.15, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.16, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.17, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.18, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.19, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.20, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.21, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.22, i32 0, i32 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.23, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.24, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.25, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.26, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.27, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.28, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.29, i32 0, i32 0), i8* null]
@.str.30 = [58 x i8] c"ahpropfinddf;orderpatchposearchmoversion-controlockasldhf\00"
@.str.31 = [6 x i8] c"test1\00"
@stderr = global i32 0
@.str.32 = [16 x i8] c"smack: fail %s\0A\00"
define i32 @smack_selftest() {
%1 = alloca i32
%2 = alloca %struct.SMACK*
%3 = alloca [31 x i8*]
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i64
%8 = alloca i32
%9 = bitcast [31 x i8*]* %3 to i8*
store i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.30, i64 0, i64 0), i8** %5
%10 = load i8*, i8** %5
%11 = call i64 @strlen(i8* %10)
%12 = trunc i64 %11 to i32
store i32 %12, i32* %6
store i32 0, i32* %8
%13 = call %struct.SMACK* @smack_create(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.31, i64 0, i64 0), i32 1)
store %struct.SMACK* %13, %struct.SMACK** %2
store i32 0, i32* %4
br label %14
14: ; preds = %34, %0
%15 = load i32, i32* %4
%16 = zext i32 %15 to i64
%17 = getelementptr inbounds [31 x i8*], [31 x i8*]* %3, i64 0, i64 %16
%18 = load i8*, i8** %17
%19 = icmp ne i8* %18, null
br i1 %19, label %20, label %37
20: ; preds = %14
%21 = load %struct.SMACK*, %struct.SMACK** %2
%22 = load i32, i32* %4
%23 = zext i32 %22 to i64
%24 = getelementptr inbounds [31 x i8*], [31 x i8*]* %3, i64 0, i64 %23
%25 = load i8*, i8** %24
%26 = load i32, i32* %4
%27 = zext i32 %26 to i64
%28 = getelementptr inbounds [31 x i8*], [31 x i8*]* %3, i64 0, i64 %27
%29 = load i8*, i8** %28
%30 = call i64 @strlen(i8* %29)
%31 = trunc i64 %30 to i32
%32 = load i32, i32* %4
%33 = call i32 @smack_add_pattern(%struct.SMACK* %21, i8* %25, i32 %31, i32 %32, i32 0)
br label %34
34: ; preds = %20
%35 = load i32, i32* %4
%36 = add i32 %35, 1
store i32 %36, i32* %4
br label %14
37: ; preds = %14
%38 = load %struct.SMACK*, %struct.SMACK** %2
%39 = call i32 @smack_compile(%struct.SMACK* %38)
store i32 0, i32* %4
%40 = load %struct.SMACK*, %struct.SMACK** %2
%41 = load i8*, i8** %5
%42 = load i32, i32* %6
%43 = call i64 @smack_search_next(%struct.SMACK* %40, i32* %8, i8* %41, i32* %4, i32 %42)
store i64 %43, i64* %7
%44 = load i64, i64* %7
%45 = icmp ne i64 8, %44
br i1 %45, label %49, label %46
46: ; preds = %37
%47 = load i32, i32* %4
%48 = icmp ne i32 10, %47
br i1 %48, label %49, label %53
49: ; preds = %46, %37
%50 = load i32, i32* @stderr
%51 = call i32 @fprintf(i32 %50, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.32, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.8, i64 0, i64 0))
%52 = add nsw i32 1, %51
store i32 %52, i32* %1
br label %140
53: ; preds = %46
%54 = load %struct.SMACK*, %struct.SMACK** %2
%55 = load i8*, i8** %5
%56 = load i32, i32* %6
%57 = call i64 @smack_search_next(%struct.SMACK* %54, i32* %8, i8* %55, i32* %4, i32 %56)
store i64 %57, i64* %7
%58 = load i64, i64* %7
%59 = icmp ne i64 28, %58
br i1 %59, label %63, label %60
60: ; preds = %53
%61 = load i32, i32* %4
%62 = icmp ne i32 23, %61
br i1 %62, label %63, label %67
63: ; preds = %60, %53
%64 = load i32, i32* @stderr
%65 = call i32 @fprintf(i32 %64, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.32, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.28, i64 0, i64 0))
%66 = add nsw i32 1, %65
store i32 %66, i32* %1
br label %140
67: ; preds = %60
%68 = load %struct.SMACK*, %struct.SMACK** %2
%69 = load i8*, i8** %5
%70 = load i32, i32* %6
%71 = call i64 @smack_search_next(%struct.SMACK* %68, i32* %8, i8* %69, i32* %4, i32 %70)
store i64 %71, i64* %7
%72 = load i64, i64* %7
%73 = icmp ne i64 27, %72
br i1 %73, label %77, label %74
74: ; preds = %67
%75 = load i32, i32* %4
%76 = icmp ne i32 23, %75
br i1 %76, label %77, label %81
77: ; preds = %74, %67
%78 = load i32, i32* @stderr
%79 = call i32 @fprintf(i32 %78, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.32, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.27, i64 0, i64 0))
%80 = add nsw i32 1, %79
store i32 %80, i32* %1
br label %140
81: ; preds = %74
%82 = load %struct.SMACK*, %struct.SMACK** %2
%83 = load i8*, i8** %5
%84 = load i32, i32* %6
%85 = call i64 @smack_search_next(%struct.SMACK* %82, i32* %8, i8* %83, i32* %4, i32 %84)
store i64 %85, i64* %7
%86 = load i64, i64* %7
%87 = icmp ne i64 25, %86
br i1 %87, label %91, label %88
88: ; preds = %81
%89 = load i32, i32* %4
%90 = icmp ne i32 31, %89
br i1 %90, label %91, label %95
91: ; preds = %88, %81
%92 = load i32, i32* @stderr
%93 = call i32 @fprintf(i32 %92, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.32, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.25, i64 0, i64 0))
%94 = add nsw i32 1, %93
store i32 %94, i32* %1
br label %140
95: ; preds = %88
%96 = load %struct.SMACK*, %struct.SMACK** %2
%97 = load i8*, i8** %5
%98 = load i32, i32* %6
%99 = call i64 @smack_search_next(%struct.SMACK* %96, i32* %8, i8* %97, i32* %4, i32 %98)
store i64 %99, i64* %7
%100 = load i64, i64* %7
%101 = icmp ne i64 12, %100
br i1 %101, label %105, label %102
102: ; preds = %95
%103 = load i32, i32* %4
%104 = icmp ne i32 35, %103
br i1 %104, label %105, label %109
105: ; preds = %102, %95
%106 = load i32, i32* @stderr
%107 = call i32 @fprintf(i32 %106, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.32, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.12, i64 0, i64 0))
%108 = add nsw i32 1, %107
store i32 %108, i32* %1
br label %140
109: ; preds = %102
%110 = load %struct.SMACK*, %struct.SMACK** %2
%111 = load i8*, i8** %5
%112 = load i32, i32* %6
%113 = call i64 @smack_search_next(%struct.SMACK* %110, i32* %8, i8* %111, i32* %4, i32 %112)
store i64 %113, i64* %7
%114 = load i64, i64* %7
%115 = icmp ne i64 15, %114
br i1 %115, label %119, label %116
116: ; preds = %109
%117 = load i32, i32* %4
%118 = icmp ne i32 48, %117
br i1 %118, label %119, label %123
119: ; preds = %116, %109
%120 = load i32, i32* @stderr
%121 = call i32 @fprintf(i32 %120, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.32, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.15, i64 0, i64 0))
%122 = add nsw i32 1, %121
store i32 %122, i32* %1
br label %140
123: ; preds = %116
%124 = load %struct.SMACK*, %struct.SMACK** %2
%125 = load i8*, i8** %5
%126 = load i32, i32* %6
%127 = call i64 @smack_search_next(%struct.SMACK* %124, i32* %8, i8* %125, i32* %4, i32 %126)
store i64 %127, i64* %7
%128 = load i64, i64* %7
%129 = icmp ne i64 13, %128
br i1 %129, label %133, label %130
130: ; preds = %123
%131 = load i32, i32* %4
%132 = icmp ne i32 51, %131
br i1 %132, label %133, label %137
133: ; preds = %130, %123
%134 = load i32, i32* @stderr
%135 = call i32 @fprintf(i32 %134, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.32, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.13, i64 0, i64 0))
%136 = add nsw i32 1, %135
store i32 %136, i32* %1
br label %140
137: ; preds = %130
%138 = load %struct.SMACK*, %struct.SMACK** %2
%139 = call i32 @smack_destroy(%struct.SMACK* %138)
store i32 0, i32* %1
br label %140
140: ; preds = %137, %133, %119, %105, %91, %77, %63, %49
%141 = load i32, i32* %1
ret i32 %141
}

LLVM IR (-O2):
%struct.SMACK = type { i32 }
@.str = [4 x i8] c"GET\00"
@.str.1 = [4 x i8] c"PUT\00"
@.str.2 = [5 x i8] c"POST\00"
@.str.3 = [8 x i8] c"OPTIONS\00"
@.str.4 = [5 x i8] c"HEAD\00"
@.str.5 = [7 x i8] c"DELETE\00"
@.str.6 = [6 x i8] c"TRACE\00"
@.str.7 = [8 x i8] c"CONNECT\00"
@.str.8 = [9 x i8] c"PROPFIND\00"
@.str.9 = [10 x i8] c"PROPPATCH\00"
@.str.10 = [6 x i8] c"MKCOL\00"
@.str.11 = [12 x i8] c"MKWORKSPACE\00"
@.str.12 = [5 x i8] c"MOVE\00"
@.str.13 = [5 x i8] c"LOCK\00"
@.str.14 = [7 x i8] c"UNLOCK\00"
@.str.15 = [16 x i8] c"VERSION-CONTROL\00"
@.str.16 = [7 x i8] c"REPORT\00"
@.str.17 = [9 x i8] c"CHECKOUT\00"
@.str.18 = [8 x i8] c"CHECKIN\00"
@.str.19 = [11 x i8] c"UNCHECKOUT\00"
@.str.20 = [5 x i8] c"COPY\00"
@.str.21 = [7 x i8] c"UPDATE\00"
@.str.22 = [6 x i8] c"LABEL\00"
@.str.23 = [17 x i8] c"BASELINE-CONTROL\00"
@.str.24 = [6 x i8] c"MERGE\00"
@.str.25 = [7 x i8] c"SEARCH\00"
@.str.26 = [4 x i8] c"ACL\00"
@.str.27 = [11 x i8] c"ORDERPATCH\00"
@.str.28 = [6 x i8] c"PATCH\00"
@.str.29 = [11 x i8] c"MKACTIVITY\00"
@__const.smack_selftest.patterns = [31 x i8*] [i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.8, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.10, i32 0, i32 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.11, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.12, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.13, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.14, i32 0, i32 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.15, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.16, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.17, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.18, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.19, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.20, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.21, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.22, i32 0, i32 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.23, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.24, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.25, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.26, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.27, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.28, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.29, i32 0, i32 0), i8* null]
@.str.30 = [58 x i8] c"ahpropfinddf;orderpatchposearchmoversion-controlockasldhf\00"
@.str.31 = [6 x i8] c"test1\00"
@stderr = global i32 0
@.str.32 = [16 x i8] c"smack: fail %s\0A\00"
define i32 @smack_selftest() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%5 = tail call %struct.SMACK* @smack_create(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.31, i64 0, i64 0), i32 1)
br label %6
6: ; preds = %0, %6
%7 = phi i64 [ 0, %0 ], [ %13, %6 ]
%8 = phi i8* [ getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), %0 ], [ %15, %6 ]
%9 = tail call i64 @strlen(i8* dereferenceable(1) %8)
%10 = trunc i64 %9 to i32
%11 = trunc i64 %7 to i32
%12 = tail call i32 @smack_add_pattern(%struct.SMACK* %5, i8* %8, i32 %10, i32 %11, i32 0)
%13 = add nuw nsw i64 %7, 1
%14 = getelementptr inbounds [31 x i8*], [31 x i8*]* @__const.smack_selftest.patterns, i64 0, i64 %13
%15 = load i8*, i8** %14
%16 = icmp eq i64 %13, 30
br i1 %16, label %17, label %6
17: ; preds = %6
%18 = tail call i32 @smack_compile(%struct.SMACK* %5)
store i32 0, i32* %1
%19 = call i64 @smack_search_next(%struct.SMACK* %5, i32* %2, i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.30, i64 0, i64 0), i32* %1, i32 57)
%20 = icmp ne i64 %19, 8
%21 = load i32, i32* %1
%22 = icmp ne i32 %21, 10
%23 = select i1 %20, i1 true, i1 %22
br i1 %23, label %60, label %24
24: ; preds = %17
%25 = call i64 @smack_search_next(%struct.SMACK* %5, i32* %2, i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.30, i64 0, i64 0), i32* %1, i32 57)
%26 = icmp ne i64 %25, 28
%27 = load i32, i32* %1
%28 = icmp ne i32 %27, 23
%29 = select i1 %26, i1 true, i1 %28
br i1 %29, label %60, label %30
30: ; preds = %24
%31 = call i64 @smack_search_next(%struct.SMACK* %5, i32* %2, i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.30, i64 0, i64 0), i32* %1, i32 57)
%32 = icmp ne i64 %31, 27
%33 = load i32, i32* %1
%34 = icmp ne i32 %33, 23
%35 = select i1 %32, i1 true, i1 %34
br i1 %35, label %60, label %36
36: ; preds = %30
%37 = call i64 @smack_search_next(%struct.SMACK* %5, i32* %2, i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.30, i64 0, i64 0), i32* %1, i32 57)
%38 = icmp ne i64 %37, 25
%39 = load i32, i32* %1
%40 = icmp ne i32 %39, 31
%41 = select i1 %38, i1 true, i1 %40
br i1 %41, label %60, label %42
42: ; preds = %36
%43 = call i64 @smack_search_next(%struct.SMACK* %5, i32* %2, i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.30, i64 0, i64 0), i32* %1, i32 57)
%44 = icmp ne i64 %43, 12
%45 = load i32, i32* %1
%46 = icmp ne i32 %45, 35
%47 = select i1 %44, i1 true, i1 %46
br i1 %47, label %60, label %48
48: ; preds = %42
%49 = call i64 @smack_search_next(%struct.SMACK* %5, i32* %2, i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.30, i64 0, i64 0), i32* %1, i32 57)
%50 = icmp ne i64 %49, 15
%51 = load i32, i32* %1
%52 = icmp ne i32 %51, 48
%53 = select i1 %50, i1 true, i1 %52
br i1 %53, label %60, label %54
54: ; preds = %48
%55 = call i64 @smack_search_next(%struct.SMACK* %5, i32* %2, i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.30, i64 0, i64 0), i32* %1, i32 57)
%56 = icmp ne i64 %55, 13
%57 = load i32, i32* %1
%58 = icmp ne i32 %57, 51
%59 = select i1 %56, i1 true, i1 %58
br i1 %59, label %60, label %65
60: ; preds = %54, %48, %42, %36, %30, %24, %17
%61 = phi i8* [ getelementptr inbounds ([9 x i8], [9 x i8]* @.str.8, i64 0, i64 0), %17 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.28, i64 0, i64 0), %24 ], [ getelementptr inbounds ([11 x i8], [11 x i8]* @.str.27, i64 0, i64 0), %30 ], [ getelementptr inbounds ([7 x i8], [7 x i8]* @.str.25, i64 0, i64 0), %36 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.12, i64 0, i64 0), %42 ], [ getelementptr inbounds ([16 x i8], [16 x i8]* @.str.15, i64 0, i64 0), %48 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.13, i64 0, i64 0), %54 ]
%62 = load i32, i32* @stderr
%63 = call i32 @fprintf(i32 %62, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.32, i64 0, i64 0), i8* %61)
%64 = add nsw i32 %63, 1
br label %67
65: ; preds = %54
%66 = call i32 @smack_destroy(%struct.SMACK* %5)
br label %67
67: ; preds = %60, %65
%68 = phi i32 [ 0, %65 ], [ %64, %60 ]
ret i32 %68
}