#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*/ linker_env_unset(char const *const);
void linker_env_secure(void) {
  static const char *const unsec_vars[] = {"GCONV_PATH",
                                           "GETCONF_DIR",
                                           "HOSTALIASES",
                                           "LD_AUDIT",
                                           "LD_DEBUG",
                                           "LD_DEBUG_OUTPUT",
                                           "LD_DYNAMIC_WEAK",
                                           "LD_LIBRARY_PATH",
                                           "LD_ORIGIN_PATH",
                                           "LD_PRELOAD",
                                           "LD_PROFILE",
                                           "LD_SHOW_AUXV",
                                           "LD_USE_LOAD_BIAS",
                                           "LOCALDOMAIN",
                                           "LOCPATH",
                                           "MALLOC_TRACE",
                                           "MALLOC_CHECK_",
                                           "NIS_PATH",
                                           "NLSPATH",
                                           "RESOLV_HOST_CONF",
                                           "RES_OPTIONS",
                                           "TMPDIR",
                                           "TZDIR",
                                           "LD_AOUT_LIBRARY_PATH",
                                           "LD_AOUT_PRELOAD",
                                           NULL};
  int count;
  for (count = 0; unsec_vars[count] != NULL; count++) {
    linker_env_unset(unsec_vars[count]);
  }
}


x86 assembly (clang, -O0):
<linker_env_secure>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movslq -0x4(%rbp),%rcx
lea    0x2c26(%rip),%rax
cmpq   $0x0,(%rax,%rcx,8)
je     1157 <linker_env_secure+0x47>
movslq -0x4(%rbp),%rcx
lea    0x2c10(%rip),%rax
mov    (%rax,%rcx,8),%rdi
call   1030 <linker_env_unset@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    111f <linker_env_secure+0xf>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<linker_env_secure>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <linker_env_unset@plt>
lea    0xee7(%rip),%rdi
call   1030 <linker_env_unset@plt>
lea    0xee7(%rip),%rdi
call   1030 <linker_env_unset@plt>
lea    0xee7(%rip),%rdi
call   1030 <linker_env_unset@plt>
lea    0xee4(%rip),%rdi
call   1030 <linker_env_unset@plt>
lea    0xee1(%rip),%rdi
call   1030 <linker_env_unset@plt>
lea    0xee5(%rip),%rdi
call   1030 <linker_env_unset@plt>
lea    0xee9(%rip),%rdi
call   1030 <linker_env_unset@plt>
lea    0xeed(%rip),%rdi
call   1030 <linker_env_unset@plt>
lea    0xef0(%rip),%rdi
call   1030 <linker_env_unset@plt>
lea    0xeef(%rip),%rdi
call   1030 <linker_env_unset@plt>
lea    0xeee(%rip),%rdi
call   1030 <linker_env_unset@plt>
lea    0xeef(%rip),%rdi
call   1030 <linker_env_unset@plt>
lea    0xef4(%rip),%rdi
call   1030 <linker_env_unset@plt>
lea    0xef4(%rip),%rdi
call   1030 <linker_env_unset@plt>
lea    0xef0(%rip),%rdi
call   1030 <linker_env_unset@plt>
lea    0xef1(%rip),%rdi
call   1030 <linker_env_unset@plt>
lea    0xef3(%rip),%rdi
call   1030 <linker_env_unset@plt>
lea    0xef0(%rip),%rdi
call   1030 <linker_env_unset@plt>
lea    0xeec(%rip),%rdi
call   1030 <linker_env_unset@plt>
lea    0xef1(%rip),%rdi
call   1030 <linker_env_unset@plt>
lea    0xef1(%rip),%rdi
call   1030 <linker_env_unset@plt>
lea    0xeec(%rip),%rdi
call   1030 <linker_env_unset@plt>
lea    0xee6(%rip),%rdi
call   1030 <linker_env_unset@plt>
lea    0xeef(%rip),%rdi
pop    %rax
jmp    1030 <linker_env_unset@plt>

LLVM IR (-O0):
@linker_env_secure.unsec_vars = internal constant [26 x i8*] [i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.8, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.9, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.10, i32 0, i32 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.11, i32 0, i32 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.12, i32 0, i32 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.13, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.14, i32 0, i32 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.15, i32 0, i32 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.16, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.17, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.18, i32 0, i32 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.19, i32 0, i32 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.20, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.21, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.22, i32 0, i32 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.23, i32 0, i32 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.24, i32 0, i32 0), i8* null]
@.str = [11 x i8] c"GCONV_PATH\00"
@.str.1 = [12 x i8] c"GETCONF_DIR\00"
@.str.2 = [12 x i8] c"HOSTALIASES\00"
@.str.3 = [9 x i8] c"LD_AUDIT\00"
@.str.4 = [9 x i8] c"LD_DEBUG\00"
@.str.5 = [16 x i8] c"LD_DEBUG_OUTPUT\00"
@.str.6 = [16 x i8] c"LD_DYNAMIC_WEAK\00"
@.str.7 = [16 x i8] c"LD_LIBRARY_PATH\00"
@.str.8 = [15 x i8] c"LD_ORIGIN_PATH\00"
@.str.9 = [11 x i8] c"LD_PRELOAD\00"
@.str.10 = [11 x i8] c"LD_PROFILE\00"
@.str.11 = [13 x i8] c"LD_SHOW_AUXV\00"
@.str.12 = [17 x i8] c"LD_USE_LOAD_BIAS\00"
@.str.13 = [12 x i8] c"LOCALDOMAIN\00"
@.str.14 = [8 x i8] c"LOCPATH\00"
@.str.15 = [13 x i8] c"MALLOC_TRACE\00"
@.str.16 = [14 x i8] c"MALLOC_CHECK_\00"
@.str.17 = [9 x i8] c"NIS_PATH\00"
@.str.18 = [8 x i8] c"NLSPATH\00"
@.str.19 = [17 x i8] c"RESOLV_HOST_CONF\00"
@.str.20 = [12 x i8] c"RES_OPTIONS\00"
@.str.21 = [7 x i8] c"TMPDIR\00"
@.str.22 = [6 x i8] c"TZDIR\00"
@.str.23 = [21 x i8] c"LD_AOUT_LIBRARY_PATH\00"
@.str.24 = [16 x i8] c"LD_AOUT_PRELOAD\00"
define void @linker_env_secure() {
%1 = alloca i32
store i32 0, i32* %1
br label %2
2: ; preds = %14, %0
%3 = load i32, i32* %1
%4 = sext i32 %3 to i64
%5 = getelementptr inbounds [26 x i8*], [26 x i8*]* @linker_env_secure.unsec_vars, i64 0, i64 %4
%6 = load i8*, i8** %5
%7 = icmp ne i8* %6, null
br i1 %7, label %8, label %17
8: ; preds = %2
%9 = load i32, i32* %1
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds [26 x i8*], [26 x i8*]* @linker_env_secure.unsec_vars, i64 0, i64 %10
%12 = load i8*, i8** %11
%13 = call i32 @linker_env_unset(i8* %12)
br label %14
14: ; preds = %8
%15 = load i32, i32* %1
%16 = add nsw i32 %15, 1
store i32 %16, i32* %1
br label %2
17: ; preds = %2
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"GCONV_PATH\00"
@.str.1 = [12 x i8] c"GETCONF_DIR\00"
@.str.2 = [12 x i8] c"HOSTALIASES\00"
@.str.3 = [9 x i8] c"LD_AUDIT\00"
@.str.4 = [9 x i8] c"LD_DEBUG\00"
@.str.5 = [16 x i8] c"LD_DEBUG_OUTPUT\00"
@.str.6 = [16 x i8] c"LD_DYNAMIC_WEAK\00"
@.str.7 = [16 x i8] c"LD_LIBRARY_PATH\00"
@.str.8 = [15 x i8] c"LD_ORIGIN_PATH\00"
@.str.9 = [11 x i8] c"LD_PRELOAD\00"
@.str.10 = [11 x i8] c"LD_PROFILE\00"
@.str.11 = [13 x i8] c"LD_SHOW_AUXV\00"
@.str.12 = [17 x i8] c"LD_USE_LOAD_BIAS\00"
@.str.13 = [12 x i8] c"LOCALDOMAIN\00"
@.str.14 = [8 x i8] c"LOCPATH\00"
@.str.15 = [13 x i8] c"MALLOC_TRACE\00"
@.str.16 = [14 x i8] c"MALLOC_CHECK_\00"
@.str.17 = [9 x i8] c"NIS_PATH\00"
@.str.18 = [8 x i8] c"NLSPATH\00"
@.str.19 = [17 x i8] c"RESOLV_HOST_CONF\00"
@.str.20 = [12 x i8] c"RES_OPTIONS\00"
@.str.21 = [7 x i8] c"TMPDIR\00"
@.str.22 = [6 x i8] c"TZDIR\00"
@.str.23 = [21 x i8] c"LD_AOUT_LIBRARY_PATH\00"
@.str.24 = [16 x i8] c"LD_AOUT_PRELOAD\00"
define void @linker_env_secure() {
%1 = tail call i32 @linker_env_unset(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @linker_env_unset(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 @linker_env_unset(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%4 = tail call i32 @linker_env_unset(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
%5 = tail call i32 @linker_env_unset(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
%6 = tail call i32 @linker_env_unset(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0))
%7 = tail call i32 @linker_env_unset(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0))
%8 = tail call i32 @linker_env_unset(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.7, i64 0, i64 0))
%9 = tail call i32 @linker_env_unset(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.8, i64 0, i64 0))
%10 = tail call i32 @linker_env_unset(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.9, i64 0, i64 0))
%11 = tail call i32 @linker_env_unset(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.10, i64 0, i64 0))
%12 = tail call i32 @linker_env_unset(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.11, i64 0, i64 0))
%13 = tail call i32 @linker_env_unset(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.12, i64 0, i64 0))
%14 = tail call i32 @linker_env_unset(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.13, i64 0, i64 0))
%15 = tail call i32 @linker_env_unset(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.14, i64 0, i64 0))
%16 = tail call i32 @linker_env_unset(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.15, i64 0, i64 0))
%17 = tail call i32 @linker_env_unset(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.16, i64 0, i64 0))
%18 = tail call i32 @linker_env_unset(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.17, i64 0, i64 0))
%19 = tail call i32 @linker_env_unset(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.18, i64 0, i64 0))
%20 = tail call i32 @linker_env_unset(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.19, i64 0, i64 0))
%21 = tail call i32 @linker_env_unset(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.20, i64 0, i64 0))
%22 = tail call i32 @linker_env_unset(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.21, i64 0, i64 0))
%23 = tail call i32 @linker_env_unset(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.22, i64 0, i64 0))
%24 = tail call i32 @linker_env_unset(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.23, i64 0, i64 0))
%25 = tail call i32 @linker_env_unset(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.24, i64 0, i64 0))
ret void
}