#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*/ F_OK;
int access(char *, int /*<<< orphan*/);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
char *getenv(char *);
int /*<<< orphan*/ sprintf(char *, char *, char *);
void has_background_wp(char *arg1) {
  char *appdata = getenv("APPDATA");
  if (!appdata) {
    0;
  }
  char buffer[1024];
  sprintf(buffer, "%s\\Microsoft\\Windows\\Themes\\TranscodedWallpaper",
          appdata);
  0;
  0;
  if (access(buffer, F_OK) != -1) {
    0;
  } else {
    exit(0);
  }
}


x86 assembly (clang, -O0):
<has_background_wp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x410,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xeaa(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    116f <has_background_wp+0x2f>
jmp    116f <has_background_wp+0x2f>
lea    -0x410(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xe87(%rip),%rsi
call   1050 <sprintf@plt>
lea    -0x410(%rbp),%rdi
mov    0x2e44(%rip),%rax
mov    (%rax),%esi
call   1040 <access@plt>
cmp    $0xffffffff,%eax
je     11a9 <has_background_wp+0x69>
jmp    11b0 <has_background_wp+0x70>
xor    %edi,%edi
call   1060 <exit@plt>
add    $0x410,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<has_background_wp>:
push   %rbx
sub    $0x400,%rsp
lea    0xeb1(%rip),%rdi
call   1030 <getenv@plt>
lea    0xead(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    %rax,%rdx
call   1050 <sprintf@plt>
mov    0x2e68(%rip),%rax
mov    (%rax),%esi
mov    %rbx,%rdi
call   1040 <access@plt>
cmp    $0xffffffff,%eax
je     1188 <has_background_wp+0x48>
add    $0x400,%rsp
pop    %rbx
ret
xor    %edi,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"APPDATA\00"
@.str.1 = [48 x i8] c"%s\\Microsoft\\Windows\\Themes\\TranscodedWallpaper\00"
@F_OK = global i32 0
define void @has_background_wp(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca [1024 x i8]
store i8* %0, i8** %2
%5 = call i8* @getenv(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = icmp ne i8* %6, null
br i1 %7, label %9, label %8
8: ; preds = %1
br label %9
9: ; preds = %8, %1
%10 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%11 = load i8*, i8** %3
%12 = call i32 @sprintf(i8* %10, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.1, i64 0, i64 0), i8* %11)
%13 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%14 = load i32, i32* @F_OK
%15 = call i32 @access(i8* %13, i32 %14)
%16 = icmp ne i32 %15, -1
br i1 %16, label %17, label %18
17: ; preds = %9
br label %20
18: ; preds = %9
%19 = call i32 @exit(i32 0)
unreachable
20: ; preds = %17
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"APPDATA\00"
@.str.1 = [48 x i8] c"%s\\Microsoft\\Windows\\Themes\\TranscodedWallpaper\00"
@F_OK = global i32 0
define void @has_background_wp(i8* nocapture readnone %0) {
%2 = alloca [1024 x i8]
%3 = tail call i8* @getenv(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%4 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%5 = call i32 @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @.str.1, i64 0, i64 0), i8* %3)
%6 = load i32, i32* @F_OK
%7 = call i32 @access(i8* %4, i32 %6)
%8 = icmp eq i32 %7, -1
br i1 %8, label %9, label %11
9: ; preds = %1
%10 = tail call i32 @exit(i32 0)
unreachable
11: ; preds = %1
ret void
}