#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 */
char *getenv(char *);
int /*<<< orphan*/ setenv(char *, char *, int);
void set_up_environment(void) {
  setenv("ASAN_OPTIONS",
         "abort_on_error=1:"
         "detect_leaks=0:"
         "symbolize=0:"
         "allocator_may_return_null=1",
         0);
  setenv("MSAN_OPTIONS",
         "exit_code="
         "86"
         ":"
         "symbolize=0:"
         "abort_on_error=1:"
         "allocator_may_return_null=1:"
         "msan_track_origins=0",
         0);
  if (getenv("AFL_PRELOAD")) {
    setenv("LD_PRELOAD", getenv("AFL_PRELOAD"), 1);
    setenv("DYLD_INSERT_LIBRARIES", getenv("AFL_PRELOAD"), 1);
  }
}


x86 assembly (clang, -O0):
<set_up_environment>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
lea    0xedb(%rip),%rsi
xor    %edx,%edx
call   1040 <setenv@plt>
lea    0xf15(%rip),%rdi
lea    0xf1b(%rip),%rsi
xor    %edx,%edx
call   1040 <setenv@plt>
lea    0xf68(%rip),%rdi
call   1030 <getenv@plt>
cmp    $0x0,%rax
je     11a4 <set_up_environment+0x84>
lea    0xf52(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,%rsi
lea    0xf4f(%rip),%rdi
mov    $0x1,%edx
call   1040 <setenv@plt>
lea    0xf32(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,%rsi
lea    0xf3a(%rip),%rdi
mov    $0x1,%edx
call   1040 <setenv@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_up_environment>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0xede(%rip),%rsi
xor    %edx,%edx
call   1040 <setenv@plt>
lea    0xf18(%rip),%rdi
lea    0xf1e(%rip),%rsi
xor    %edx,%edx
call   1040 <setenv@plt>
lea    0xf6b(%rip),%rdi
call   1030 <getenv@plt>
test   %rax,%rax
je     1191 <set_up_environment+0x71>
lea    0xf66(%rip),%rdi
mov    %rax,%rsi
mov    $0x1,%edx
call   1040 <setenv@plt>
lea    0xf46(%rip),%rdi
call   1030 <getenv@plt>
lea    0xf51(%rip),%rdi
mov    %rax,%rsi
mov    $0x1,%edx
pop    %rax
jmp    1040 <setenv@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [13 x i8] c"ASAN_OPTIONS\00"
@.str.1 = [72 x i8] c"abort_on_error=1:detect_leaks=0:symbolize=0:allocator_may_return_null=1\00"
@.str.2 = [13 x i8] c"MSAN_OPTIONS\00"
@.str.3 = [91 x i8] c"exit_code=86:symbolize=0:abort_on_error=1:allocator_may_return_null=1:msan_track_origins=0\00"
@.str.4 = [12 x i8] c"AFL_PRELOAD\00"
@.str.5 = [11 x i8] c"LD_PRELOAD\00"
@.str.6 = [22 x i8] c"DYLD_INSERT_LIBRARIES\00"
define void @set_up_environment() {
%1 = call i32 @setenv(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str.1, i64 0, i64 0), i32 0)
%2 = call i32 @setenv(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([91 x i8], [91 x i8]* @.str.3, i64 0, i64 0), i32 0)
%3 = call i8* @getenv(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0))
%4 = icmp ne i8* %3, null
br i1 %4, label %5, label %10
5: ; preds = %0
%6 = call i8* @getenv(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0))
%7 = call i32 @setenv(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0), i8* %6, i32 1)
%8 = call i8* @getenv(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0))
%9 = call i32 @setenv(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.6, i64 0, i64 0), i8* %8, i32 1)
br label %10
10: ; preds = %5, %0
ret void
}

LLVM IR (-O2):
@.str = [13 x i8] c"ASAN_OPTIONS\00"
@.str.1 = [72 x i8] c"abort_on_error=1:detect_leaks=0:symbolize=0:allocator_may_return_null=1\00"
@.str.2 = [13 x i8] c"MSAN_OPTIONS\00"
@.str.3 = [91 x i8] c"exit_code=86:symbolize=0:abort_on_error=1:allocator_may_return_null=1:msan_track_origins=0\00"
@.str.4 = [12 x i8] c"AFL_PRELOAD\00"
@.str.5 = [11 x i8] c"LD_PRELOAD\00"
@.str.6 = [22 x i8] c"DYLD_INSERT_LIBRARIES\00"
define void @set_up_environment() {
%1 = tail call i32 @setenv(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str.1, i64 0, i64 0), i32 0)
%2 = tail call i32 @setenv(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([91 x i8], [91 x i8]* @.str.3, i64 0, i64 0), i32 0)
%3 = tail call i8* @getenv(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0))
%4 = icmp eq i8* %3, null
br i1 %4, label %9, label %5
5: ; preds = %0
%6 = tail call i32 @setenv(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0), i8* %3, i32 1)
%7 = tail call i8* @getenv(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0))
%8 = tail call i32 @setenv(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.6, i64 0, i64 0), i8* %7, i32 1)
br label %9
9: ; preds = %5, %0
ret void
}