#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 */
typedef int /*<<< orphan*/ new_path;

/* Variables and functions */
scalar_t__ strncasecmp(char *, char *, int);
int is_gamefile(const char *path) {
  if (path[0] == '/' && path[1] == '/')
    path = &path[1];
  int len = 0;
  char new_path[16];
  if (path[0] != '/') {
    new_path[0] = '/';
    len++;
  }
  while (*path && len < sizeof(new_path)) {
    new_path[len++] = *path++;
  }
  if (strncasecmp(new_path, "/vol/content", 12) == 0)
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<is_gamefile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2f,%eax
jne    1149 <is_gamefile+0x39>
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x2f,%eax
jne    1149 <is_gamefile+0x39>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2f,%eax
je     116d <is_gamefile+0x5d>
movb   $0x2f,-0x30(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1172 <is_gamefile+0x62>
mov    -0x10(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x31(%rbp)
je     1195 <is_gamefile+0x85>
movslq -0x14(%rbp),%rax
cmp    $0x10,%rax
setb   %al
mov    %al,-0x31(%rbp)
mov    -0x31(%rbp),%al
test   $0x1,%al
jne    11a5 <is_gamefile+0x95>
jmp    11cc <is_gamefile+0xbc>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%cl
mov    -0x14(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0x14(%rbp)
cltq
mov    %cl,-0x30(%rbp,%rax,1)
jmp    1172 <is_gamefile+0x62>
lea    -0x30(%rbp),%rdi
lea    0xe29(%rip),%rsi
mov    $0xc,%edx
call   1030 <strncasecmp@plt>
cmp    $0x0,%rax
jne    11f7 <is_gamefile+0xe7>
movl   $0x1,-0x4(%rbp)
jmp    11fe <is_gamefile+0xee>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_gamefile>:
sub    $0x18,%rsp
mov    (%rdi),%cl
cmp    $0x2f,%cl
jne    113a <is_gamefile+0x2a>
lea    0x1(%rdi),%rax
xor    %ecx,%ecx
cmpb   $0x2f,0x1(%rdi)
sete   %cl
cmovne %rdi,%rax
mov    (%rdi,%rcx,1),%cl
cmp    $0x2f,%cl
jne    113d <is_gamefile+0x2d>
mov    $0x2f,%cl
xor    %edx,%edx
jmp    114a <is_gamefile+0x3a>
mov    %rdi,%rax
movb   $0x2f,(%rsp)
mov    $0x1,%edx
test   %cl,%cl
je     116b <is_gamefile+0x5b>
add    $0x1,%rax
xchg   %ax,%ax
mov    %cl,(%rsp,%rdx,1)
movzbl (%rax),%ecx
test   %cl,%cl
je     116b <is_gamefile+0x5b>
lea    0x1(%rdx),%rsi
add    $0x1,%rax
cmp    $0xf,%rdx
mov    %rsi,%rdx
jb     1150 <is_gamefile+0x40>
lea    0xe8e(%rip),%rsi
mov    %rsp,%rdi
mov    $0xc,%edx
call   1030 <strncasecmp@plt>
xor    %ecx,%ecx
test   %rax,%rax
sete   %cl
mov    %ecx,%eax
add    $0x18,%rsp
ret

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

LLVM IR (-O2):
@.str = [13 x i8] c"/vol/content\00"
define i32 @is_gamefile(i8* nocapture %0) {
%2 = alloca [16 x i8]
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 47
br i1 %4, label %7, label %5
5: ; preds = %1
%6 = getelementptr inbounds [16 x i8], [16 x i8]* %2, i64 0, i64 0
br label %15
7: ; preds = %1
%8 = getelementptr inbounds i8, i8* %0, i64 1
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 47
%11 = select i1 %10, i8* %8, i8* %0
%12 = load i8, i8* %11
%13 = getelementptr inbounds [16 x i8], [16 x i8]* %2, i64 0, i64 0
%14 = icmp eq i8 %12, 47
br i1 %14, label %20, label %15
15: ; preds = %7, %5
%16 = phi i8 [ %3, %5 ], [ %12, %7 ]
%17 = phi i8* [ %0, %5 ], [ %11, %7 ]
%18 = getelementptr inbounds [16 x i8], [16 x i8]* %2, i64 0, i64 0
store i8 47, i8* %18
%19 = icmp eq i8 %16, 0
br i1 %19, label %35, label %20
20: ; preds = %7, %15
%21 = phi i64 [ 0, %7 ], [ 1, %15 ]
%22 = phi i8 [ 47, %7 ], [ %16, %15 ]
%23 = phi i8* [ %11, %7 ], [ %17, %15 ]
br label %24
24: ; preds = %20, %24
%25 = phi i64 [ %29, %24 ], [ %21, %20 ]
%26 = phi i8 [ %31, %24 ], [ %22, %20 ]
%27 = phi i8* [ %28, %24 ], [ %23, %20 ]
%28 = getelementptr inbounds i8, i8* %27, i64 1
%29 = add nuw nsw i64 %25, 1
%30 = getelementptr inbounds [16 x i8], [16 x i8]* %2, i64 0, i64 %25
store i8 %26, i8* %30
%31 = load i8, i8* %28
%32 = icmp ne i8 %31, 0
%33 = icmp ult i64 %25, 15
%34 = select i1 %32, i1 %33, i1 false
br i1 %34, label %24, label %35
35: ; preds = %24, %15
%36 = getelementptr inbounds [16 x i8], [16 x i8]* %2, i64 0, i64 0
%37 = call i64 @strncasecmp(i8* %36, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 12)
%38 = icmp eq i64 %37, 0
%39 = zext i1 %38 to i32
ret i32 %39
}