#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 /*<<< orphan*/ free(char *);
scalar_t__ strcmp(char *, char *);
char *verify_browser(char *, char *);
char *xstrdup(char const *);
int is_crawler(const char *agent) {
  char type[13];
  char *browser, *a;
  if (agent == NULL || *agent == '\0')
    return 0;
  if ((a = xstrdup(agent), browser = verify_browser(a, type)) != NULL)
    free(browser);
  free(a);
  return strcmp(type, "Crawlers") == 0 ? 1 : 0;
}


x86 assembly (clang, -O0):
<is_crawler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1167 <is_crawler+0x27>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    1173 <is_crawler+0x33>
movl   $0x0,-0x4(%rbp)
jmp    11d1 <is_crawler+0x91>
mov    -0x10(%rbp),%rdi
call   1040 <xstrdup@plt>
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdi
lea    -0x1d(%rbp),%rsi
call   1060 <verify_browser@plt>
mov    %rax,-0x28(%rbp)
cmp    $0x0,%rax
je     11a4 <is_crawler+0x64>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
lea    -0x1d(%rbp),%rdi
lea    0xe48(%rip),%rsi
call   1050 <strcmp@plt>
mov    %rax,%rdx
xor    %eax,%eax
mov    $0x1,%ecx
cmp    $0x0,%rdx
cmove  %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_crawler>:
push   %rbx
sub    $0x10,%rsp
xor    %eax,%eax
test   %rdi,%rdi
je     1197 <is_crawler+0x57>
cmpb   $0x0,(%rdi)
je     1197 <is_crawler+0x57>
call   1040 <xstrdup@plt>
mov    %rax,%rbx
lea    0x3(%rsp),%rsi
mov    %rax,%rdi
call   1060 <verify_browser@plt>
test   %rax,%rax
je     1173 <is_crawler+0x33>
mov    %rax,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
lea    0xe7e(%rip),%rsi
lea    0x3(%rsp),%rdi
call   1050 <strcmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
sete   %al
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [9 x i8] c"Crawlers\00"
define i32 @is_crawler(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca [13 x i8]
%5 = alloca i8*
%6 = alloca i8*
store i8* %0, i8** %3
%7 = load i8*, i8** %3
%8 = icmp eq i8* %7, null
br i1 %8, label %14, label %9
9: ; preds = %1
%10 = load i8*, i8** %3
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %15
14: ; preds = %9, %1
store i32 0, i32* %2
br label %33
15: ; preds = %9
%16 = load i8*, i8** %3
%17 = call i8* @xstrdup(i8* %16)
store i8* %17, i8** %6
%18 = load i8*, i8** %6
%19 = getelementptr inbounds [13 x i8], [13 x i8]* %4, i64 0, i64 0
%20 = call i8* @verify_browser(i8* %18, i8* %19)
store i8* %20, i8** %5
%21 = icmp ne i8* %20, null
br i1 %21, label %22, label %25
22: ; preds = %15
%23 = load i8*, i8** %5
%24 = call i32 @free(i8* %23)
br label %25
25: ; preds = %22, %15
%26 = load i8*, i8** %6
%27 = call i32 @free(i8* %26)
%28 = getelementptr inbounds [13 x i8], [13 x i8]* %4, i64 0, i64 0
%29 = call i64 @strcmp(i8* %28, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%30 = icmp eq i64 %29, 0
%31 = zext i1 %30 to i64
%32 = select i1 %30, i32 1, i32 0
store i32 %32, i32* %2
br label %33
33: ; preds = %25, %14
%34 = load i32, i32* %2
ret i32 %34
}

LLVM IR (-O2):
@.str = [9 x i8] c"Crawlers\00"
define i32 @is_crawler(i8* %0) {
%2 = alloca [13 x i8]
%3 = getelementptr inbounds [13 x i8], [13 x i8]* %2, i64 0, i64 0
%4 = icmp eq i8* %0, null
br i1 %4, label %19, label %5
5: ; preds = %1
%6 = load i8, i8* %0
%7 = icmp eq i8 %6, 0
br i1 %7, label %19, label %8
8: ; preds = %5
%9 = tail call i8* @xstrdup(i8* %0)
%10 = call i8* @verify_browser(i8* %9, i8* %3)
%11 = icmp eq i8* %10, null
br i1 %11, label %14, label %12
12: ; preds = %8
%13 = call i32 @free(i8* %10)
br label %14
14: ; preds = %12, %8
%15 = call i32 @free(i8* %9)
%16 = call i64 @strcmp(i8* %3, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%17 = icmp eq i64 %16, 0
%18 = zext i1 %17 to i32
br label %19
19: ; preds = %1, %5, %14
%20 = phi i32 [ %18, %14 ], [ 0, %5 ], [ 0, %1 ]
ret i32 %20
}