#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 */
char *strpbrk(char *, char *);
char *xstrdup(char *);
int /*<<< orphan*/ xstrncpy(char *, char *, int);
char *parse_crawler(char *str, char *match, char *type) {
  char *ptr = NULL;
  int found = 0;
  while (match != str) {
    match--;
    if (*match == ' ' || *match == '+') {
      found = 1;
      break;
    }
  }
  if (match == str)
    return NULL;
  if (found)
    match++;
  if ((ptr = strpbrk(match, "; ")))
    *ptr = '\0';
  if (*match == '\0')
    return NULL;
  xstrncpy(type, "Crawlers", 13);
  return xstrdup(match);
}


x86 assembly (clang, -O0):
<parse_crawler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
je     119e <parse_crawler+0x6e>
mov    -0x18(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x20,%eax
je     118d <parse_crawler+0x5d>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2b,%eax
jne    1199 <parse_crawler+0x69>
movl   $0x1,-0x2c(%rbp)
jmp    119e <parse_crawler+0x6e>
jmp    1153 <parse_crawler+0x23>
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
jne    11b9 <parse_crawler+0x89>
movq   $0x0,-0x8(%rbp)
jmp    1233 <parse_crawler+0x103>
cmpl   $0x0,-0x2c(%rbp)
je     11cf <parse_crawler+0x9f>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xe26(%rip),%rsi
call   1050 <strpbrk@plt>
mov    %rax,-0x28(%rbp)
cmp    $0x0,%rax
je     11f4 <parse_crawler+0xc4>
mov    -0x28(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    1211 <parse_crawler+0xe1>
movq   $0x0,-0x8(%rbp)
jmp    1233 <parse_crawler+0x103>
mov    -0x20(%rbp),%rdi
lea    0xde7(%rip),%rsi
mov    $0xd,%edx
call   1030 <xstrncpy@plt>
mov    -0x18(%rbp),%rdi
call   1040 <xstrdup@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_crawler>:
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%rbx
xor    %eax,%eax
nopl   0x0(%rax)
cmp    %rdi,%rbx
je     1163 <parse_crawler+0x33>
movzbl -0x1(%rbx),%ecx
add    $0xffffffffffffffff,%rbx
cmp    $0x2b,%cl
je     1157 <parse_crawler+0x27>
cmp    $0x20,%cl
jne    1140 <parse_crawler+0x10>
mov    $0x1,%eax
cmp    %rdi,%rbx
jne    116b <parse_crawler+0x3b>
jmp    11ad <parse_crawler+0x7d>
mov    %rdi,%rbx
cmp    %rdi,%rbx
je     11ad <parse_crawler+0x7d>
add    %rax,%rbx
lea    0xe8b(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strpbrk@plt>
test   %rax,%rax
je     1185 <parse_crawler+0x55>
movb   $0x0,(%rax)
cmpb   $0x0,(%rbx)
je     11ad <parse_crawler+0x7d>
lea    0xe72(%rip),%rsi
mov    %r14,%rdi
mov    $0xd,%edx
call   1030 <xstrncpy@plt>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <xstrdup@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [3 x i8] c"; \00"
@.str.1 = [9 x i8] c"Crawlers\00"
define i8* @parse_crawler(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i32
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i8* null, i8** %8
store i32 0, i32* %9
br label %10
10: ; preds = %27, %3
%11 = load i8*, i8** %6
%12 = load i8*, i8** %5
%13 = icmp ne i8* %11, %12
br i1 %13, label %14, label %28
14: ; preds = %10
%15 = load i8*, i8** %6
%16 = getelementptr inbounds i8, i8* %15, i32 -1
store i8* %16, i8** %6
%17 = load i8*, i8** %6
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = icmp eq i32 %19, 32
br i1 %20, label %26, label %21
21: ; preds = %14
%22 = load i8*, i8** %6
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
%25 = icmp eq i32 %24, 43
br i1 %25, label %26, label %27
26: ; preds = %21, %14
store i32 1, i32* %9
br label %28
27: ; preds = %21
br label %10
28: ; preds = %26, %10
%29 = load i8*, i8** %6
%30 = load i8*, i8** %5
%31 = icmp eq i8* %29, %30
br i1 %31, label %32, label %33
32: ; preds = %28
store i8* null, i8** %4
br label %56
33: ; preds = %28
%34 = load i32, i32* %9
%35 = icmp ne i32 %34, 0
br i1 %35, label %36, label %39
36: ; preds = %33
%37 = load i8*, i8** %6
%38 = getelementptr inbounds i8, i8* %37, i32 1
store i8* %38, i8** %6
br label %39
39: ; preds = %36, %33
%40 = load i8*, i8** %6
%41 = call i8* @strpbrk(i8* %40, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i8* %41, i8** %8
%42 = icmp ne i8* %41, null
br i1 %42, label %43, label %45
43: ; preds = %39
%44 = load i8*, i8** %8
store i8 0, i8* %44
br label %45
45: ; preds = %43, %39
%46 = load i8*, i8** %6
%47 = load i8, i8* %46
%48 = sext i8 %47 to i32
%49 = icmp eq i32 %48, 0
br i1 %49, label %50, label %51
50: ; preds = %45
store i8* null, i8** %4
br label %56
51: ; preds = %45
%52 = load i8*, i8** %7
%53 = call i32 @xstrncpy(i8* %52, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 13)
%54 = load i8*, i8** %6
%55 = call i8* @xstrdup(i8* %54)
store i8* %55, i8** %4
br label %56
56: ; preds = %51, %50, %32
%57 = load i8*, i8** %4
ret i8* %57
}

LLVM IR (-O2):
@.str = [3 x i8] c"; \00"
@.str.1 = [9 x i8] c"Crawlers\00"
define i8* @parse_crawler(i8* readnone %0, i8* %1, i8* %2) {
%4 = ptrtoint i8* %1 to i64
%5 = ptrtoint i8* %0 to i64
%6 = sub i64 %5, %4
%7 = getelementptr i8, i8* %1, i64 %6
br label %8
8: ; preds = %11, %3
%9 = phi i8* [ %1, %3 ], [ %12, %11 ]
%10 = icmp eq i8* %9, %0
br i1 %10, label %14, label %11
11: ; preds = %8
%12 = getelementptr inbounds i8, i8* %9, i64 -1
%13 = load i8, i8* %12
switch i8 %13, label %8 [
i8 32, label %14
i8 43, label %14
]
14: ; preds = %11, %11, %8
%15 = phi i64 [ 1, %11 ], [ 1, %11 ], [ 0, %8 ]
%16 = phi i8* [ %12, %11 ], [ %12, %11 ], [ %7, %8 ]
%17 = icmp eq i8* %16, %0
br i1 %17, label %29, label %18
18: ; preds = %14
%19 = getelementptr i8, i8* %16, i64 %15
%20 = tail call i8* @strpbrk(i8* %19, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%21 = icmp eq i8* %20, null
br i1 %21, label %23, label %22
22: ; preds = %18
store i8 0, i8* %20
br label %23
23: ; preds = %22, %18
%24 = load i8, i8* %19
%25 = icmp eq i8 %24, 0
br i1 %25, label %29, label %26
26: ; preds = %23
%27 = tail call i32 @xstrncpy(i8* %2, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 13)
%28 = tail call i8* @xstrdup(i8* %19)
br label %29
29: ; preds = %23, %14, %26
%30 = phi i8* [ %28, %26 ], [ null, %14 ], [ null, %23 ]
ret i8* %30
}