#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 const *, char *, int);
int bcc_mapping_is_file_backed(const char *mapname) {
  return mapname[0] && strncmp(mapname, "//anon", sizeof("//anon") - 1) &&
         strncmp(mapname, "/dev/zero", sizeof("/dev/zero") - 1) &&
         strncmp(mapname, "/anon_hugepage", sizeof("/anon_hugepage") - 1) &&
         strncmp(mapname, "[stack", sizeof("[stack") - 1) &&
         strncmp(mapname, "/SYSV", sizeof("/SYSV") - 1) &&
         strncmp(mapname, "[heap]", sizeof("[heap]") - 1);
}


x86 assembly (clang, -O0):
<bcc_mapping_is_file_backed>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x9(%rbp)
je     1213 <bcc_mapping_is_file_backed+0x103>
mov    -0x8(%rbp),%rdi
lea    0xec4(%rip),%rsi
mov    $0x6,%edx
call   1030 <strncmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x9(%rbp)
je     1213 <bcc_mapping_is_file_backed+0x103>
mov    -0x8(%rbp),%rdi
lea    0xea4(%rip),%rsi
mov    $0x9,%edx
call   1030 <strncmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x9(%rbp)
je     1213 <bcc_mapping_is_file_backed+0x103>
mov    -0x8(%rbp),%rdi
lea    0xe87(%rip),%rsi
mov    $0xe,%edx
call   1030 <strncmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x9(%rbp)
je     1213 <bcc_mapping_is_file_backed+0x103>
mov    -0x8(%rbp),%rdi
lea    0xe6f(%rip),%rsi
mov    $0x6,%edx
call   1030 <strncmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x9(%rbp)
je     1213 <bcc_mapping_is_file_backed+0x103>
mov    -0x8(%rbp),%rdi
lea    0xe4f(%rip),%rsi
mov    $0x5,%edx
call   1030 <strncmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x9(%rbp)
je     1213 <bcc_mapping_is_file_backed+0x103>
mov    -0x8(%rbp),%rdi
lea    0xe2e(%rip),%rsi
mov    $0x6,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bcc_mapping_is_file_backed>:
push   %rbp
push   %rbx
push   %rax
xor    %ebp,%ebp
cmpb   $0x0,(%rdi)
je     11bc <bcc_mapping_is_file_backed+0xac>
mov    %rdi,%rbx
lea    0xed8(%rip),%rsi
mov    $0x6,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     11bc <bcc_mapping_is_file_backed+0xac>
lea    0xec5(%rip),%rsi
mov    %rbx,%rdi
mov    $0x9,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     11bc <bcc_mapping_is_file_backed+0xac>
lea    0xeb6(%rip),%rsi
mov    %rbx,%rdi
mov    $0xe,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     11bc <bcc_mapping_is_file_backed+0xac>
lea    0xeac(%rip),%rsi
mov    %rbx,%rdi
mov    $0x6,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     11bc <bcc_mapping_is_file_backed+0xac>
lea    0xe9a(%rip),%rsi
mov    %rbx,%rdi
mov    $0x5,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     11bc <bcc_mapping_is_file_backed+0xac>
lea    0xe87(%rip),%rsi
mov    %rbx,%rdi
mov    $0x6,%edx
call   1030 <strncmp@plt>
xor    %ebp,%ebp
test   %rax,%rax
setne  %bpl
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [7 x i8] c"//anon\00"
@.str.1 = [10 x i8] c"/dev/zero\00"
@.str.2 = [15 x i8] c"/anon_hugepage\00"
@.str.3 = [7 x i8] c"[stack\00"
@.str.4 = [6 x i8] c"/SYSV\00"
@.str.5 = [7 x i8] c"[heap]\00"
define i32 @bcc_mapping_is_file_backed(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = getelementptr inbounds i8, i8* %3, i64 0
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %32
8: ; preds = %1
%9 = load i8*, i8** %2
%10 = call i64 @strncmp(i8* %9, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 6)
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %32
12: ; preds = %8
%13 = load i8*, i8** %2
%14 = call i64 @strncmp(i8* %13, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 9)
%15 = icmp ne i64 %14, 0
br i1 %15, label %16, label %32
16: ; preds = %12
%17 = load i8*, i8** %2
%18 = call i64 @strncmp(i8* %17, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i32 14)
%19 = icmp ne i64 %18, 0
br i1 %19, label %20, label %32
20: ; preds = %16
%21 = load i8*, i8** %2
%22 = call i64 @strncmp(i8* %21, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 6)
%23 = icmp ne i64 %22, 0
br i1 %23, label %24, label %32
24: ; preds = %20
%25 = load i8*, i8** %2
%26 = call i64 @strncmp(i8* %25, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i32 5)
%27 = icmp ne i64 %26, 0
br i1 %27, label %28, label %32
28: ; preds = %24
%29 = load i8*, i8** %2
%30 = call i64 @strncmp(i8* %29, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i32 6)
%31 = icmp ne i64 %30, 0
br label %32
32: ; preds = %28, %24, %20, %16, %12, %8, %1
%33 = phi i1 [ false, %24 ], [ false, %20 ], [ false, %16 ], [ false, %12 ], [ false, %8 ], [ false, %1 ], [ %31, %28 ]
%34 = zext i1 %33 to i32
ret i32 %34
}

LLVM IR (-O2):
@.str = [7 x i8] c"//anon\00"
@.str.1 = [10 x i8] c"/dev/zero\00"
@.str.2 = [15 x i8] c"/anon_hugepage\00"
@.str.3 = [7 x i8] c"[stack\00"
@.str.4 = [6 x i8] c"/SYSV\00"
@.str.5 = [7 x i8] c"[heap]\00"
define i32 @bcc_mapping_is_file_backed(i8* %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %23, label %4
4: ; preds = %1
%5 = tail call i64 @strncmp(i8* %0, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 6)
%6 = icmp eq i64 %5, 0
br i1 %6, label %23, label %7
7: ; preds = %4
%8 = tail call i64 @strncmp(i8* %0, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 9)
%9 = icmp eq i64 %8, 0
br i1 %9, label %23, label %10
10: ; preds = %7
%11 = tail call i64 @strncmp(i8* %0, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i32 14)
%12 = icmp eq i64 %11, 0
br i1 %12, label %23, label %13
13: ; preds = %10
%14 = tail call i64 @strncmp(i8* %0, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 6)
%15 = icmp eq i64 %14, 0
br i1 %15, label %23, label %16
16: ; preds = %13
%17 = tail call i64 @strncmp(i8* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i32 5)
%18 = icmp eq i64 %17, 0
br i1 %18, label %23, label %19
19: ; preds = %16
%20 = tail call i64 @strncmp(i8* %0, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i32 6)
%21 = icmp ne i64 %20, 0
%22 = zext i1 %21 to i32
br label %23
23: ; preds = %19, %16, %13, %10, %7, %4, %1
%24 = phi i32 [ 0, %16 ], [ 0, %13 ], [ 0, %10 ], [ 0, %7 ], [ 0, %4 ], [ 0, %1 ], [ %22, %19 ]
ret i32 %24
}