#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*/ R_OK;
scalar_t__ access(char *, int /*<<< orphan*/);
char *getenv(char *);
int /*<<< orphan*/
snoopy_configuration_preinit_enableAltConfigFileParsing(char *);
void snoopy_configuration_preinit_setConfigFilePathFromEnv() {
  char *valuePtr;
  valuePtr = getenv("SNOOPY_INI");
  if (NULL == valuePtr) {
    return;
  }
  if (0 != access(valuePtr, R_OK)) {
    return;
  }
  snoopy_configuration_preinit_enableAltConfigFileParsing(valuePtr);
}


x86 assembly (clang, -O0):
<snoopy_configuration_preinit_setConfigFilePathFromEnv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x8(%rbp)
xor    %eax,%eax
cmp    -0x8(%rbp),%rax
jne    1159 <snoopy_configuration_preinit_setConfigFilePathFromEnv+0x29>
jmp    1187 <snoopy_configuration_preinit_setConfigFilePathFromEnv+0x57>
mov    -0x8(%rbp),%rdi
mov    0x2e7c(%rip),%rax
mov    (%rax),%esi
call   1050 <access@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
je     117e <snoopy_configuration_preinit_setConfigFilePathFromEnv+0x4e>
jmp    1187 <snoopy_configuration_preinit_setConfigFilePathFromEnv+0x57>
mov    -0x8(%rbp),%rdi
call   1040 <snoopy_configuration_preinit_enableAltConfigFileParsing@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<snoopy_configuration_preinit_setConfigFilePathFromEnv>:
push   %rbx
lea    0xec8(%rip),%rdi
call   1030 <getenv@plt>
test   %rax,%rax
je     115b <snoopy_configuration_preinit_setConfigFilePathFromEnv+0x2b>
mov    %rax,%rbx
mov    0x2e94(%rip),%rax
mov    (%rax),%esi
mov    %rbx,%rdi
call   1050 <access@plt>
test   %rax,%rax
je     115d <snoopy_configuration_preinit_setConfigFilePathFromEnv+0x2d>
pop    %rbx
ret
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <snoopy_configuration_preinit_enableAltConfigFileParsing@plt>

LLVM IR (-O0):
@.str = [11 x i8] c"SNOOPY_INI\00"
@R_OK = global i32 0
define void @snoopy_configuration_preinit_setConfigFilePathFromEnv() {
%1 = alloca i8*
%2 = call i8* @getenv(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
store i8* %2, i8** %1
%3 = load i8*, i8** %1
%4 = icmp eq i8* null, %3
br i1 %4, label %5, label %6
5: ; preds = %0
br label %15
6: ; preds = %0
%7 = load i8*, i8** %1
%8 = load i32, i32* @R_OK
%9 = call i64 @access(i8* %7, i32 %8)
%10 = icmp ne i64 0, %9
br i1 %10, label %11, label %12
11: ; preds = %6
br label %15
12: ; preds = %6
%13 = load i8*, i8** %1
%14 = call i32 @snoopy_configuration_preinit_enableAltConfigFileParsing(i8* %13)
br label %15
15: ; preds = %12, %11, %5
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"SNOOPY_INI\00"
@R_OK = global i32 0
define void @snoopy_configuration_preinit_setConfigFilePathFromEnv() {
%1 = tail call i8* @getenv(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%2 = icmp eq i8* %1, null
br i1 %2, label %9, label %3
3: ; preds = %0
%4 = load i32, i32* @R_OK
%5 = tail call i64 @access(i8* %1, i32 %4)
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %3
%8 = tail call i32 @snoopy_configuration_preinit_enableAltConfigFileParsing(i8* %1)
br label %9
9: ; preds = %3, %0, %7
ret void
}