#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*/ home_etc_expand_tilde(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ setenv(char *, char *, int);
int main(int argc, char *argv[]) {
  const char *p;
  setenv("HOME", "/tmp", 1);
  setenv("HOME_ETC", "/tmp/myconfigs", 1);
  home_etc_expand_tilde(1);
  p = _HE("~/.myrc");
  printf("original path: ~/.myrc\n");
  printf("modified 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    0xe93(%rip),%rdi
lea    0xe91(%rip),%rsi
mov    $0x1,%edx
call   1030 <setenv@plt>
lea    0xe85(%rip),%rdi
lea    0xe87(%rip),%rsi
mov    $0x1,%edx
call   1030 <setenv@plt>
mov    $0x1,%edi
call   1040 <home_etc_expand_tilde@plt>
lea    0xe7b(%rip),%rdi
call   1060 <_HE@plt>
mov    %rax,-0x18(%rbp)
lea    0xe73(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x18(%rbp),%rsi
lea    0xe79(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
xor    %edi,%edi
call   1070 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xe98(%rip),%rdi
lea    0xe96(%rip),%rsi
mov    $0x1,%edx
call   1040 <setenv@plt>
lea    0xe8a(%rip),%rdi
lea    0xe8c(%rip),%rsi
mov    $0x1,%edx
call   1040 <setenv@plt>
mov    $0x1,%edi
call   1050 <home_etc_expand_tilde@plt>
lea    0xea2(%rip),%rdi
call   1070 <_HE@plt>
mov    %rax,%rbx
lea    0xe84(%rip),%rdi
call   1030 <puts@plt>
lea    0xe65(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
xor    %edi,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"HOME\00"
@.str.1 = [5 x i8] c"/tmp\00"
@.str.2 = [9 x i8] c"HOME_ETC\00"
@.str.3 = [15 x i8] c"/tmp/myconfigs\00"
@.str.4 = [8 x i8] c"~/.myrc\00"
@.str.5 = [24 x i8] c"original path: ~/.myrc\0A\00"
@.str.6 = [19 x i8] c"modified 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 ([5 x i8], [5 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 ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i32 1)
%9 = call i32 @home_etc_expand_tilde(i32 1)
%10 = call i8* @_HE(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0))
store i8* %10, i8** %6
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0))
%12 = load i8*, i8** %6
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0), i8* %12)
%14 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [5 x i8] c"HOME\00"
@.str.1 = [5 x i8] c"/tmp\00"
@.str.2 = [9 x i8] c"HOME_ETC\00"
@.str.3 = [15 x i8] c"/tmp/myconfigs\00"
@.str.4 = [8 x i8] c"~/.myrc\00"
@.str.6 = [19 x i8] c"modified path: %s\0A\00"
@str = [23 x i8] c"original path: ~/.myrc\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 ([5 x i8], [5 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 ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i32 1)
%5 = tail call i32 @home_etc_expand_tilde(i32 1)
%6 = tail call i8* @_HE(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0))
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str, i64 0, i64 0))
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0), i8* %6)
%9 = tail call i32 @exit(i32 0)
unreachable
}