#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 *append3(char *, char *, char const *);
int /*<<< orphan*/ check_retval(int, char *);
char *getenv(char *);
int setenv(char *, char *, int const);
int /*<<< orphan*/ unsetenv(char *);
void update_environment(char *base_path) {
  int r;
  int gcc_major = 0, gcc_minor = 0;
  const int overwrite = 1;
  char *pin_ld_library_path = 0;
  char *new_ld_library_path = 0;
  const char *pin_runtime_dir = "runtime";
  const char *glibc_lib_dir = "glibc";
  const char *cpp_lib_dir = "cpplibs";
  char *ld_library_path = 0;
  char *ld_assume_kernel = 0;
  char *base_pathmic = 0;
  char *pin_runtime_libsmic = 0;
  char *pin_glibc_libsmic = 0;
  char *pin_cpp_libsmic = 0;
  char *incoming_ld_preload = 0;
  char *incoming_ld_bind_now = 0;
  base_pathmic = append3(base_path, "/", "mic");
  pin_runtime_libsmic = append3(base_pathmic, "/", pin_runtime_dir);
  pin_glibc_libsmic = append3(pin_runtime_libsmic, "/", glibc_lib_dir);
  pin_cpp_libsmic = append3(pin_runtime_libsmic, "/", cpp_lib_dir);
  ;
  pin_ld_library_path = ld_library_path;
  pin_ld_library_path = append3(pin_glibc_libsmic, ":", pin_ld_library_path);
  pin_ld_library_path = append3(pin_cpp_libsmic, ":", pin_ld_library_path);
  pin_ld_library_path = append3(pin_runtime_libsmic, ":", pin_ld_library_path);
  new_ld_library_path = ld_library_path;
  new_ld_library_path = append3(pin_cpp_libsmic, ":", new_ld_library_path);
  new_ld_library_path = append3(pin_runtime_libsmic, ":", new_ld_library_path);
  r = setenv("PIN_LD_RESTORE_REQUIRED", "t", overwrite);
  check_retval(r, "setenv PIN_LD_RESTORE_REQUIRED");
  r = setenv("PIN_VM_LD_LIBRARY_PATH", pin_ld_library_path, overwrite);
  check_retval(r, "setenv PIN_VM_LD_LIBRARY_PATH");
  if (ld_library_path) {
    r = setenv("PIN_APP_LD_LIBRARY_PATH", ld_library_path, overwrite);
    check_retval(r, "setenv PIN_APP_LD_LIBRARY_PATH");
  }
  r = setenv("LD_LIBRARY_PATH", new_ld_library_path, overwrite);
  check_retval(r, "setenv LD_LIBRARY_PATH");
  ld_assume_kernel = getenv("LD_ASSUME_KERNEL");
  if (ld_assume_kernel) {
    r = setenv("PIN_APP_LD_ASSUME_KERNEL", ld_assume_kernel, overwrite);
    check_retval(r, "setenv PIN_APP_LD_ASSUME_KERNEL");
    unsetenv("LD_ASSUME_KERNEL");
  }
  incoming_ld_bind_now = getenv("LD_BIND_NOW");
  if (incoming_ld_bind_now) {
    r = setenv("PIN_APP_LD_BIND_NOW", incoming_ld_bind_now, overwrite);
    check_retval(r, "setenv PIN_APP_LD_BIND_NOW");
    unsetenv("LD_BIND_NOW");
  }
  incoming_ld_preload = getenv("LD_PRELOAD");
  if (incoming_ld_preload) {
    r = setenv("PIN_APP_LD_PRELOAD", incoming_ld_preload, overwrite);
    check_retval(r, "setenv PIN_APP_LD_PRELOAD");
    unsetenv("LD_PRELOAD");
  }
}


x86 assembly (clang, -O0):
<update_environment>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x1,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
lea    0xe75(%rip),%rax
mov    %rax,-0x30(%rbp)
lea    0xe72(%rip),%rax
mov    %rax,-0x38(%rbp)
lea    0xe6d(%rip),%rax
mov    %rax,-0x40(%rbp)
movq   $0x0,-0x48(%rbp)
movq   $0x0,-0x50(%rbp)
movq   $0x0,-0x58(%rbp)
movq   $0x0,-0x60(%rbp)
movq   $0x0,-0x68(%rbp)
movq   $0x0,-0x70(%rbp)
movq   $0x0,-0x78(%rbp)
movq   $0x0,-0x80(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe26(%rip),%rsi
lea    0xe21(%rip),%rdx
call   1050 <append3@plt>
mov    %rax,-0x58(%rbp)
mov    -0x58(%rbp),%rdi
mov    -0x30(%rbp),%rdx
lea    0xe07(%rip),%rsi
call   1050 <append3@plt>
mov    %rax,-0x60(%rbp)
mov    -0x60(%rbp),%rdi
mov    -0x38(%rbp),%rdx
lea    0xdef(%rip),%rsi
call   1050 <append3@plt>
mov    %rax,-0x68(%rbp)
mov    -0x60(%rbp),%rdi
mov    -0x40(%rbp),%rdx
lea    0xdd7(%rip),%rsi
call   1050 <append3@plt>
mov    %rax,-0x70(%rbp)
mov    -0x48(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x68(%rbp),%rdi
mov    -0x20(%rbp),%rdx
lea    0xdbd(%rip),%rsi
call   1050 <append3@plt>
mov    %rax,-0x20(%rbp)
mov    -0x70(%rbp),%rdi
mov    -0x20(%rbp),%rdx
lea    0xda5(%rip),%rsi
call   1050 <append3@plt>
mov    %rax,-0x20(%rbp)
mov    -0x60(%rbp),%rdi
mov    -0x20(%rbp),%rdx
lea    0xd8d(%rip),%rsi
call   1050 <append3@plt>
mov    %rax,-0x20(%rbp)
mov    -0x48(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x70(%rbp),%rdi
mov    -0x28(%rbp),%rdx
lea    0xd6d(%rip),%rsi
call   1050 <append3@plt>
mov    %rax,-0x28(%rbp)
mov    -0x60(%rbp),%rdi
mov    -0x28(%rbp),%rdx
lea    0xd55(%rip),%rsi
call   1050 <append3@plt>
mov    %rax,-0x28(%rbp)
lea    0xd50(%rip),%rdi
lea    0xd40(%rip),%rsi
mov    $0x1,%edx
call   1040 <setenv@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
lea    0xd2b(%rip),%rsi
call   1060 <check_retval@plt>
mov    -0x20(%rbp),%rsi
lea    0xd41(%rip),%rdi
mov    $0x1,%edx
call   1040 <setenv@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
lea    0xd23(%rip),%rsi
call   1060 <check_retval@plt>
cmpq   $0x0,-0x48(%rbp)
je     1353 <update_environment+0x203>
mov    -0x48(%rbp),%rsi
lea    0xd2d(%rip),%rdi
mov    $0x1,%edx
call   1040 <setenv@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
lea    0xd0f(%rip),%rsi
call   1060 <check_retval@plt>
mov    -0x28(%rbp),%rsi
lea    0xd25(%rip),%rdi
mov    $0x1,%edx
call   1040 <setenv@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
lea    0xd07(%rip),%rsi
call   1060 <check_retval@plt>
lea    0xd21(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x50(%rbp)
cmpq   $0x0,-0x50(%rbp)
je     13c8 <update_environment+0x278>
mov    -0x50(%rbp),%rsi
lea    0xcfa(%rip),%rdi
mov    $0x1,%edx
call   1040 <setenv@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
lea    0xcdc(%rip),%rsi
call   1060 <check_retval@plt>
lea    0xcdf(%rip),%rdi
call   1070 <unsetenv@plt>
lea    0xcf3(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x80(%rbp)
cmpq   $0x0,-0x80(%rbp)
je     1416 <update_environment+0x2c6>
mov    -0x80(%rbp),%rsi
lea    0xccc(%rip),%rdi
mov    $0x1,%edx
call   1040 <setenv@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
lea    0xcae(%rip),%rsi
call   1060 <check_retval@plt>
lea    0xcb1(%rip),%rdi
call   1070 <unsetenv@plt>
lea    0xcc0(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x78(%rbp)
cmpq   $0x0,-0x78(%rbp)
je     1464 <update_environment+0x314>
mov    -0x78(%rbp),%rsi
lea    0xc99(%rip),%rdi
mov    $0x1,%edx
call   1040 <setenv@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
lea    0xc7b(%rip),%rsi
call   1060 <check_retval@plt>
lea    0xc7e(%rip),%rdi
call   1070 <unsetenv@plt>
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<update_environment>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
lea    0xeb6(%rip),%r14
lea    0xeb1(%rip),%rdx
mov    %r14,%rsi
call   1050 <append3@plt>
lea    0xe8a(%rip),%rdx
mov    %rax,%rdi
mov    %r14,%rsi
call   1050 <append3@plt>
mov    %rax,%rbx
lea    0xe7d(%rip),%rdx
mov    %rax,%rdi
mov    %r14,%rsi
call   1050 <append3@plt>
mov    %rax,%r12
lea    0xe6e(%rip),%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <append3@plt>
mov    %rax,%r13
lea    0xe67(%rip),%r15
mov    %r12,%rdi
mov    %r15,%rsi
xor    %edx,%edx
call   1050 <append3@plt>
mov    %r13,%rdi
mov    %r15,%rsi
mov    %rax,%rdx
call   1050 <append3@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %rax,%rdx
call   1050 <append3@plt>
mov    %rax,%r14
mov    %r13,%rdi
mov    %r15,%rsi
xor    %edx,%edx
call   1050 <append3@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %rax,%rdx
call   1050 <append3@plt>
mov    %rax,%rbx
lea    0xe21(%rip),%rdi
lea    0xe11(%rip),%rsi
mov    $0x1,%edx
call   1040 <setenv@plt>
lea    0xe02(%rip),%rsi
mov    %eax,%edi
call   1060 <check_retval@plt>
lea    0xe1a(%rip),%rdi
mov    %r14,%rsi
mov    $0x1,%edx
call   1040 <setenv@plt>
lea    0xdff(%rip),%rsi
mov    %eax,%edi
call   1060 <check_retval@plt>
lea    0xe16(%rip),%rdi
mov    %rbx,%rsi
mov    $0x1,%edx
call   1040 <setenv@plt>
lea    0xdfb(%rip),%rsi
mov    %eax,%edi
call   1060 <check_retval@plt>
lea    0xe13(%rip),%rdi
call   1030 <getenv@plt>
test   %rax,%rax
je     12a8 <update_environment+0x158>
lea    0xdfa(%rip),%rdi
mov    %rax,%rsi
mov    $0x1,%edx
call   1040 <setenv@plt>
lea    0xddf(%rip),%rsi
mov    %eax,%edi
call   1060 <check_retval@plt>
lea    0xde0(%rip),%rdi
call   1070 <unsetenv@plt>
lea    0xdf4(%rip),%rdi
call   1030 <getenv@plt>
test   %rax,%rax
je     12e7 <update_environment+0x197>
lea    0xddb(%rip),%rdi
mov    %rax,%rsi
mov    $0x1,%edx
call   1040 <setenv@plt>
lea    0xdc0(%rip),%rsi
mov    %eax,%edi
call   1060 <check_retval@plt>
lea    0xdc1(%rip),%rdi
call   1070 <unsetenv@plt>
lea    0xdd0(%rip),%rdi
call   1030 <getenv@plt>
test   %rax,%rax
je     132f <update_environment+0x1df>
lea    0xdb7(%rip),%rdi
mov    %rax,%rsi
mov    $0x1,%edx
call   1040 <setenv@plt>
lea    0xd9c(%rip),%rsi
mov    %eax,%edi
call   1060 <check_retval@plt>
lea    0xd9d(%rip),%rdi
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
jmp    1070 <unsetenv@plt>
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [8 x i8] c"runtime\00"
@.str.1 = [6 x i8] c"glibc\00"
@.str.2 = [8 x i8] c"cpplibs\00"
@.str.3 = [2 x i8] c"/\00"
@.str.4 = [4 x i8] c"mic\00"
@.str.5 = [2 x i8] c":\00"
@.str.6 = [24 x i8] c"PIN_LD_RESTORE_REQUIRED\00"
@.str.7 = [2 x i8] c"t\00"
@.str.8 = [31 x i8] c"setenv PIN_LD_RESTORE_REQUIRED\00"
@.str.9 = [23 x i8] c"PIN_VM_LD_LIBRARY_PATH\00"
@.str.10 = [30 x i8] c"setenv PIN_VM_LD_LIBRARY_PATH\00"
@.str.11 = [24 x i8] c"PIN_APP_LD_LIBRARY_PATH\00"
@.str.12 = [31 x i8] c"setenv PIN_APP_LD_LIBRARY_PATH\00"
@.str.13 = [16 x i8] c"LD_LIBRARY_PATH\00"
@.str.14 = [23 x i8] c"setenv LD_LIBRARY_PATH\00"
@.str.15 = [17 x i8] c"LD_ASSUME_KERNEL\00"
@.str.16 = [25 x i8] c"PIN_APP_LD_ASSUME_KERNEL\00"
@.str.17 = [32 x i8] c"setenv PIN_APP_LD_ASSUME_KERNEL\00"
@.str.18 = [12 x i8] c"LD_BIND_NOW\00"
@.str.19 = [20 x i8] c"PIN_APP_LD_BIND_NOW\00"
@.str.20 = [27 x i8] c"setenv PIN_APP_LD_BIND_NOW\00"
@.str.21 = [11 x i8] c"LD_PRELOAD\00"
@.str.22 = [19 x i8] c"PIN_APP_LD_PRELOAD\00"
@.str.23 = [26 x i8] c"setenv PIN_APP_LD_PRELOAD\00"
define void @update_environment(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca i8*
%13 = alloca i8*
%14 = alloca i8*
%15 = alloca i8*
%16 = alloca i8*
%17 = alloca i8*
%18 = alloca i8*
%19 = alloca i8*
store i8* %0, i8** %2
store i32 0, i32* %4
store i32 0, i32* %5
store i32 1, i32* %6
store i8* null, i8** %7
store i8* null, i8** %8
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8** %9
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8** %10
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8** %11
store i8* null, i8** %12
store i8* null, i8** %13
store i8* null, i8** %14
store i8* null, i8** %15
store i8* null, i8** %16
store i8* null, i8** %17
store i8* null, i8** %18
store i8* null, i8** %19
%20 = load i8*, i8** %2
%21 = call i8* @append3(i8* %20, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
store i8* %21, i8** %14
%22 = load i8*, i8** %14
%23 = load i8*, i8** %9
%24 = call i8* @append3(i8* %22, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i8* %23)
store i8* %24, i8** %15
%25 = load i8*, i8** %15
%26 = load i8*, i8** %10
%27 = call i8* @append3(i8* %25, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i8* %26)
store i8* %27, i8** %16
%28 = load i8*, i8** %15
%29 = load i8*, i8** %11
%30 = call i8* @append3(i8* %28, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i8* %29)
store i8* %30, i8** %17
%31 = load i8*, i8** %12
store i8* %31, i8** %7
%32 = load i8*, i8** %16
%33 = load i8*, i8** %7
%34 = call i8* @append3(i8* %32, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0), i8* %33)
store i8* %34, i8** %7
%35 = load i8*, i8** %17
%36 = load i8*, i8** %7
%37 = call i8* @append3(i8* %35, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0), i8* %36)
store i8* %37, i8** %7
%38 = load i8*, i8** %15
%39 = load i8*, i8** %7
%40 = call i8* @append3(i8* %38, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0), i8* %39)
store i8* %40, i8** %7
%41 = load i8*, i8** %12
store i8* %41, i8** %8
%42 = load i8*, i8** %17
%43 = load i8*, i8** %8
%44 = call i8* @append3(i8* %42, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0), i8* %43)
store i8* %44, i8** %8
%45 = load i8*, i8** %15
%46 = load i8*, i8** %8
%47 = call i8* @append3(i8* %45, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0), i8* %46)
store i8* %47, i8** %8
%48 = call i32 @setenv(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0), i32 1)
store i32 %48, i32* %3
%49 = load i32, i32* %3
%50 = call i32 @check_retval(i32 %49, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.8, i64 0, i64 0))
%51 = load i8*, i8** %7
%52 = call i32 @setenv(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.9, i64 0, i64 0), i8* %51, i32 1)
store i32 %52, i32* %3
%53 = load i32, i32* %3
%54 = call i32 @check_retval(i32 %53, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.10, i64 0, i64 0))
%55 = load i8*, i8** %12
%56 = icmp ne i8* %55, null
br i1 %56, label %57, label %62
57: ; preds = %1
%58 = load i8*, i8** %12
%59 = call i32 @setenv(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.11, i64 0, i64 0), i8* %58, i32 1)
store i32 %59, i32* %3
%60 = load i32, i32* %3
%61 = call i32 @check_retval(i32 %60, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.12, i64 0, i64 0))
br label %62
62: ; preds = %57, %1
%63 = load i8*, i8** %8
%64 = call i32 @setenv(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.13, i64 0, i64 0), i8* %63, i32 1)
store i32 %64, i32* %3
%65 = load i32, i32* %3
%66 = call i32 @check_retval(i32 %65, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.14, i64 0, i64 0))
%67 = call i8* @getenv(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.15, i64 0, i64 0))
store i8* %67, i8** %13
%68 = load i8*, i8** %13
%69 = icmp ne i8* %68, null
br i1 %69, label %70, label %76
70: ; preds = %62
%71 = load i8*, i8** %13
%72 = call i32 @setenv(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.16, i64 0, i64 0), i8* %71, i32 1)
store i32 %72, i32* %3
%73 = load i32, i32* %3
%74 = call i32 @check_retval(i32 %73, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.17, i64 0, i64 0))
%75 = call i32 @unsetenv(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.15, i64 0, i64 0))
br label %76
76: ; preds = %70, %62
%77 = call i8* @getenv(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.18, i64 0, i64 0))
store i8* %77, i8** %19
%78 = load i8*, i8** %19
%79 = icmp ne i8* %78, null
br i1 %79, label %80, label %86
80: ; preds = %76
%81 = load i8*, i8** %19
%82 = call i32 @setenv(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.19, i64 0, i64 0), i8* %81, i32 1)
store i32 %82, i32* %3
%83 = load i32, i32* %3
%84 = call i32 @check_retval(i32 %83, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.20, i64 0, i64 0))
%85 = call i32 @unsetenv(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.18, i64 0, i64 0))
br label %86
86: ; preds = %80, %76
%87 = call i8* @getenv(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.21, i64 0, i64 0))
store i8* %87, i8** %18
%88 = load i8*, i8** %18
%89 = icmp ne i8* %88, null
br i1 %89, label %90, label %96
90: ; preds = %86
%91 = load i8*, i8** %18
%92 = call i32 @setenv(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.22, i64 0, i64 0), i8* %91, i32 1)
store i32 %92, i32* %3
%93 = load i32, i32* %3
%94 = call i32 @check_retval(i32 %93, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.23, i64 0, i64 0))
%95 = call i32 @unsetenv(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.21, i64 0, i64 0))
br label %96
96: ; preds = %90, %86
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"runtime\00"
@.str.1 = [6 x i8] c"glibc\00"
@.str.2 = [8 x i8] c"cpplibs\00"
@.str.3 = [2 x i8] c"/\00"
@.str.4 = [4 x i8] c"mic\00"
@.str.5 = [2 x i8] c":\00"
@.str.6 = [24 x i8] c"PIN_LD_RESTORE_REQUIRED\00"
@.str.7 = [2 x i8] c"t\00"
@.str.8 = [31 x i8] c"setenv PIN_LD_RESTORE_REQUIRED\00"
@.str.9 = [23 x i8] c"PIN_VM_LD_LIBRARY_PATH\00"
@.str.10 = [30 x i8] c"setenv PIN_VM_LD_LIBRARY_PATH\00"
@.str.13 = [16 x i8] c"LD_LIBRARY_PATH\00"
@.str.14 = [23 x i8] c"setenv LD_LIBRARY_PATH\00"
@.str.15 = [17 x i8] c"LD_ASSUME_KERNEL\00"
@.str.16 = [25 x i8] c"PIN_APP_LD_ASSUME_KERNEL\00"
@.str.17 = [32 x i8] c"setenv PIN_APP_LD_ASSUME_KERNEL\00"
@.str.18 = [12 x i8] c"LD_BIND_NOW\00"
@.str.19 = [20 x i8] c"PIN_APP_LD_BIND_NOW\00"
@.str.20 = [27 x i8] c"setenv PIN_APP_LD_BIND_NOW\00"
@.str.21 = [11 x i8] c"LD_PRELOAD\00"
@.str.22 = [19 x i8] c"PIN_APP_LD_PRELOAD\00"
@.str.23 = [26 x i8] c"setenv PIN_APP_LD_PRELOAD\00"
define void @update_environment(i8* %0) {
%2 = tail call i8* @append3(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%3 = tail call i8* @append3(i8* %2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%4 = tail call i8* @append3(i8* %3, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%5 = tail call i8* @append3(i8* %3, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%6 = tail call i8* @append3(i8* %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0), i8* null)
%7 = tail call i8* @append3(i8* %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0), i8* %6)
%8 = tail call i8* @append3(i8* %3, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0), i8* %7)
%9 = tail call i8* @append3(i8* %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0), i8* null)
%10 = tail call i8* @append3(i8* %3, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0), i8* %9)
%11 = tail call i32 @setenv(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0), i32 1)
%12 = tail call i32 @check_retval(i32 %11, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.8, i64 0, i64 0))
%13 = tail call i32 @setenv(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.9, i64 0, i64 0), i8* %8, i32 1)
%14 = tail call i32 @check_retval(i32 %13, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.10, i64 0, i64 0))
%15 = tail call i32 @setenv(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.13, i64 0, i64 0), i8* %10, i32 1)
%16 = tail call i32 @check_retval(i32 %15, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.14, i64 0, i64 0))
%17 = tail call i8* @getenv(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.15, i64 0, i64 0))
%18 = icmp eq i8* %17, null
br i1 %18, label %23, label %19
19: ; preds = %1
%20 = tail call i32 @setenv(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.16, i64 0, i64 0), i8* %17, i32 1)
%21 = tail call i32 @check_retval(i32 %20, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.17, i64 0, i64 0))
%22 = tail call i32 @unsetenv(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.15, i64 0, i64 0))
br label %23
23: ; preds = %19, %1
%24 = tail call i8* @getenv(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.18, i64 0, i64 0))
%25 = icmp eq i8* %24, null
br i1 %25, label %30, label %26
26: ; preds = %23
%27 = tail call i32 @setenv(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.19, i64 0, i64 0), i8* %24, i32 1)
%28 = tail call i32 @check_retval(i32 %27, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.20, i64 0, i64 0))
%29 = tail call i32 @unsetenv(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.18, i64 0, i64 0))
br label %30
30: ; preds = %26, %23
%31 = tail call i8* @getenv(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.21, i64 0, i64 0))
%32 = icmp eq i8* %31, null
br i1 %32, label %37, label %33
33: ; preds = %30
%34 = tail call i32 @setenv(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.22, i64 0, i64 0), i8* %31, i32 1)
%35 = tail call i32 @check_retval(i32 %34, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.23, i64 0, i64 0))
%36 = tail call i32 @unsetenv(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.21, i64 0, i64 0))
br label %37
37: ; preds = %33, %30
ret void
}