#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 stat {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ capitalize(char *);
int /*<<< orphan*/ new_str_cmp(char *, char *, char *, int);
int /*<<< orphan*/ snprintf(char *, int, char *, char *, char *,
                            int /*<<< orphan*/);
int stat(char *, struct stat *);
char *tolower(char);
unsigned char exists_player(char *name) {
  struct stat fst;
  char buf[8192];
  if (!name ||
      !new_str_cmp((name), (""),
                   "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                   "outputs/2022-01-22/02-19-57/repos/jpavonabian/6Dragones/"
                   "refs/heads/master/src/new_auth.c",
                   217))
    return 0;
  snprintf(buf, 8192, "%s%c/%s", "player/", tolower(name[0]), capitalize(name));
  if (stat(buf, &fst) != -1)
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<exists_player>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2030,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     118f <exists_player+0x3f>
mov    -0x10(%rbp),%rdi
lea    0xf2b(%rip),%rsi
lea    0xe84(%rip),%rdx
mov    $0xd9,%ecx
call   1060 <new_str_cmp@plt>
cmp    $0x0,%eax
jne    1198 <exists_player+0x48>
movb   $0x0,-0x1(%rbp)
jmp    1211 <exists_player+0xc1>
lea    -0x2020(%rbp),%rax
mov    %rax,-0x2030(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1050 <tolower@plt>
mov    %rax,-0x2028(%rbp)
mov    -0x10(%rbp),%rdi
call   1070 <capitalize@plt>
mov    -0x2030(%rbp),%rdi
mov    -0x2028(%rbp),%r8
mov    %eax,%r9d
mov    $0x2000,%esi
lea    0xeb2(%rip),%rdx
lea    0xeb3(%rip),%rcx
call   1030 <snprintf@plt>
lea    -0x2020(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <stat@plt>
cmp    $0xffffffff,%eax
je     120d <exists_player+0xbd>
movb   $0x1,-0x1(%rbp)
jmp    1211 <exists_player+0xc1>
movb   $0x0,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
add    $0x2030,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<exists_player>:
push   %r14
push   %rbx
sub    $0x2018,%rsp
test   %rdi,%rdi
je     11cc <exists_player+0x7c>
mov    %rdi,%rbx
lea    0xf37(%rip),%rsi
lea    0xe90(%rip),%rdx
mov    $0xd9,%ecx
call   1060 <new_str_cmp@plt>
test   %eax,%eax
je     11cc <exists_player+0x7c>
movsbl (%rbx),%edi
call   1050 <tolower@plt>
mov    %rax,%r14
mov    %rbx,%rdi
call   1070 <capitalize@plt>
lea    0xef9(%rip),%rdx
lea    0xefa(%rip),%rcx
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x2000,%esi
mov    %r14,%r8
mov    %eax,%r9d
call   1030 <snprintf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <stat@plt>
cmp    $0xffffffff,%eax
setne  %al
jmp    11ce <exists_player+0x7e>
xor    %eax,%eax
add    $0x2018,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.stat = type { i32 }
@.str = [1 x i8] zeroinitializer
@.str.1 = [145 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/jpavonabian/6Dragones/refs/heads/master/src/new_auth.c\00"
@.str.2 = [8 x i8] c"%s%c/%s\00"
@.str.3 = [8 x i8] c"player/\00"
define zeroext i8 @exists_player(i8* %0) {
%2 = alloca i8
%3 = alloca i8*
%4 = alloca %struct.stat
%5 = alloca [8192 x i8]
store i8* %0, i8** %3
%6 = load i8*, i8** %3
%7 = icmp ne i8* %6, null
br i1 %7, label %8, label %12
8: ; preds = %1
%9 = load i8*, i8** %3
%10 = call i32 @new_str_cmp(i8* %9, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([145 x i8], [145 x i8]* @.str.1, i64 0, i64 0), i32 217)
%11 = icmp ne i32 %10, 0
br i1 %11, label %13, label %12
12: ; preds = %8, %1
store i8 0, i8* %2
br label %27
13: ; preds = %8
%14 = getelementptr inbounds [8192 x i8], [8192 x i8]* %5, i64 0, i64 0
%15 = load i8*, i8** %3
%16 = getelementptr inbounds i8, i8* %15, i64 0
%17 = load i8, i8* %16
%18 = call i8* @tolower(i8 signext %17)
%19 = load i8*, i8** %3
%20 = call i32 @capitalize(i8* %19)
%21 = call i32 @snprintf(i8* %14, i32 8192, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8* %18, i32 %20)
%22 = getelementptr inbounds [8192 x i8], [8192 x i8]* %5, i64 0, i64 0
%23 = call i32 @stat(i8* %22, %struct.stat* %4)
%24 = icmp ne i32 %23, -1
br i1 %24, label %25, label %26
25: ; preds = %13
store i8 1, i8* %2
br label %27
26: ; preds = %13
store i8 0, i8* %2
br label %27
27: ; preds = %26, %25, %12
%28 = load i8, i8* %2
ret i8 %28
}

LLVM IR (-O2):
%struct.stat = type { i32 }
@.str = [1 x i8] zeroinitializer
@.str.1 = [145 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/jpavonabian/6Dragones/refs/heads/master/src/new_auth.c\00"
@.str.2 = [8 x i8] c"%s%c/%s\00"
@.str.3 = [8 x i8] c"player/\00"
define zeroext i8 @exists_player(i8* %0) {
%2 = alloca %struct.stat
%3 = alloca [8192 x i8]
%4 = bitcast %struct.stat* %2 to i8*
%5 = getelementptr inbounds [8192 x i8], [8192 x i8]* %3, i64 0, i64 0
%6 = icmp eq i8* %0, null
br i1 %6, label %18, label %7
7: ; preds = %1
%8 = tail call i32 @new_str_cmp(i8* %0, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([145 x i8], [145 x i8]* @.str.1, i64 0, i64 0), i32 217)
%9 = icmp eq i32 %8, 0
br i1 %9, label %18, label %10
10: ; preds = %7
%11 = load i8, i8* %0
%12 = tail call i8* @tolower(i8 signext %11)
%13 = tail call i32 @capitalize(i8* %0)
%14 = call i32 @snprintf(i8* %5, i32 8192, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8* %12, i32 %13)
%15 = call i32 @stat(i8* %5, %struct.stat* %2)
%16 = icmp ne i32 %15, -1
%17 = zext i1 %16 to i8
br label %18
18: ; preds = %10, %1, %7
%19 = phi i8 [ 0, %7 ], [ 0, %1 ], [ %17, %10 ]
ret i8 %19
}