#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 *_HE(char *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char const *);
int /*<<< orphan*/ setenv(char *, char *, int);
int main(int argc, char *argv[]) {
  const char *p;
  setenv("HOME", "/root", 1);
  setenv("HOME_ETC", "/root/myconfigs", 1);
  p = _HE("/root/.myrc");
  printf("path: %s\n", p);
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xea3(%rip),%rdi
lea    0xea1(%rip),%rsi
mov    $0x1,%edx
call   1030 <setenv@plt>
lea    0xe96(%rip),%rdi
lea    0xe98(%rip),%rsi
mov    $0x1,%edx
call   1030 <setenv@plt>
lea    0xe97(%rip),%rdi
call   1050 <_HE@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
lea    0xe8f(%rip),%rdi
call   1040 <printf@plt>
xor    %edi,%edi
call   1060 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xeb8(%rip),%rdi
lea    0xeb6(%rip),%rsi
mov    $0x1,%edx
call   1030 <setenv@plt>
lea    0xeab(%rip),%rdi
lea    0xead(%rip),%rsi
mov    $0x1,%edx
call   1030 <setenv@plt>
lea    0xeac(%rip),%rdi
call   1050 <_HE@plt>
lea    0xeac(%rip),%rdi
mov    %rax,%rsi
call   1040 <printf@plt>
xor    %edi,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"HOME\00"
@.str.1 = [6 x i8] c"/root\00"
@.str.2 = [9 x i8] c"HOME_ETC\00"
@.str.3 = [16 x i8] c"/root/myconfigs\00"
@.str.4 = [12 x i8] c"/root/.myrc\00"
@.str.5 = [10 x i8] c"path: %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i32 @setenv(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 1)
%8 = call i32 @setenv(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i32 1)
%9 = call i8* @_HE(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0))
store i8* %9, i8** %6
%10 = load i8*, i8** %6
%11 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), i8* %10)
%12 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [5 x i8] c"HOME\00"
@.str.1 = [6 x i8] c"/root\00"
@.str.2 = [9 x i8] c"HOME_ETC\00"
@.str.3 = [16 x i8] c"/root/myconfigs\00"
@.str.4 = [12 x i8] c"/root/.myrc\00"
@.str.5 = [10 x i8] c"path: %s\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @setenv(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 1)
%4 = tail call i32 @setenv(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i32 1)
%5 = tail call i8* @_HE(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0))
%6 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), i8* %5)
%7 = tail call i32 @exit(i32 0)
unreachable
}