#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*/ print_envs();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ setenv(char *, char *, int);
int /*<<< orphan*/ unsetenv(char *);
int main(int argc, char *argv[]) {
  print_envs();
  setenv("HOME", "ME", 1);
  printf("\nafter set HOME:\n");
  print_envs();
  setenv("LOGNAME", "this is a very very long user name", 1);
  printf("\nafter set LOGNAME:\n");
  print_envs();
  unsetenv("PATH");
  printf("\nafter unset PATH:\n");
  print_envs();
  setenv("DISAPPEAR", "not exist before", 0);
  printf("\nafter set DISAPPEAR:\n");
  print_envs();
  setenv("ADDISION", "addision adding", 0);
  printf("\nafter set ADDISION:\n");
  print_envs();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1040 <print_envs@plt>
lea    0xe9c(%rip),%rdi
lea    0xeb1(%rip),%rsi
mov    $0x1,%edx
call   1030 <setenv@plt>
lea    0xe89(%rip),%rdi
call   1050 <printf@plt>
mov    $0x0,%al
call   1040 <print_envs@plt>
lea    0xe88(%rip),%rdi
lea    0xe89(%rip),%rsi
mov    $0x1,%edx
call   1030 <setenv@plt>
lea    0xe9b(%rip),%rdi
call   1050 <printf@plt>
mov    $0x0,%al
call   1040 <print_envs@plt>
lea    0xe9d(%rip),%rdi
call   1060 <unsetenv@plt>
lea    0xe96(%rip),%rdi
call   1050 <printf@plt>
mov    $0x0,%al
call   1040 <print_envs@plt>
lea    0xe97(%rip),%rdi
lea    0xe9a(%rip),%rsi
xor    %edx,%edx
call   1030 <setenv@plt>
lea    0xe9d(%rip),%rdi
call   1050 <printf@plt>
mov    $0x0,%al
call   1040 <print_envs@plt>
lea    0xea1(%rip),%rdi
lea    0xea3(%rip),%rsi
xor    %edx,%edx
call   1030 <setenv@plt>
lea    0xea5(%rip),%rdi
call   1050 <printf@plt>
mov    $0x0,%al
call   1040 <print_envs@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1050 <print_envs@plt>
lea    0xeb1(%rip),%rdi
lea    0xeb4(%rip),%rsi
mov    $0x1,%edx
call   1040 <setenv@plt>
lea    0xf02(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1050 <print_envs@plt>
lea    0xe8b(%rip),%rdi
lea    0xe8c(%rip),%rsi
mov    $0x1,%edx
call   1040 <setenv@plt>
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1050 <print_envs@plt>
lea    0xe8b(%rip),%rdi
call   1060 <unsetenv@plt>
lea    0xedd(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1050 <print_envs@plt>
lea    0xe71(%rip),%rdi
lea    0xe74(%rip),%rsi
xor    %edx,%edx
call   1040 <setenv@plt>
lea    0xec8(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1050 <print_envs@plt>
lea    0xe64(%rip),%rdi
lea    0xe66(%rip),%rsi
xor    %edx,%edx
call   1040 <setenv@plt>
lea    0xeb6(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1050 <print_envs@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"HOME\00"
@.str.1 = [3 x i8] c"ME\00"
@.str.2 = [18 x i8] c"\0Aafter set HOME:\0A\00"
@.str.3 = [8 x i8] c"LOGNAME\00"
@.str.4 = [35 x i8] c"this is a very very long user name\00"
@.str.5 = [21 x i8] c"\0Aafter set LOGNAME:\0A\00"
@.str.6 = [5 x i8] c"PATH\00"
@.str.7 = [20 x i8] c"\0Aafter unset PATH:\0A\00"
@.str.8 = [10 x i8] c"DISAPPEAR\00"
@.str.9 = [17 x i8] c"not exist before\00"
@.str.10 = [23 x i8] c"\0Aafter set DISAPPEAR:\0A\00"
@.str.11 = [9 x i8] c"ADDISION\00"
@.str.12 = [16 x i8] c"addision adding\00"
@.str.13 = [22 x i8] c"\0Aafter set ADDISION:\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 (...) @print_envs()
%7 = call i32 @setenv(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 1)
%8 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
%9 = call i32 (...) @print_envs()
%10 = call i32 @setenv(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.4, i64 0, i64 0), i32 1)
%11 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0))
%12 = call i32 (...) @print_envs()
%13 = call i32 @unsetenv(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
%14 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.7, i64 0, i64 0))
%15 = call i32 (...) @print_envs()
%16 = call i32 @setenv(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.9, i64 0, i64 0), i32 0)
%17 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.10, i64 0, i64 0))
%18 = call i32 (...) @print_envs()
%19 = call i32 @setenv(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.12, i64 0, i64 0), i32 0)
%20 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.13, i64 0, i64 0))
%21 = call i32 (...) @print_envs()
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"HOME\00"
@.str.1 = [3 x i8] c"ME\00"
@.str.3 = [8 x i8] c"LOGNAME\00"
@.str.4 = [35 x i8] c"this is a very very long user name\00"
@.str.6 = [5 x i8] c"PATH\00"
@.str.8 = [10 x i8] c"DISAPPEAR\00"
@.str.9 = [17 x i8] c"not exist before\00"
@.str.11 = [9 x i8] c"ADDISION\00"
@.str.12 = [16 x i8] c"addision adding\00"
@str = [17 x i8] c"\0Aafter set HOME:\00"
@str.14 = [20 x i8] c"\0Aafter set LOGNAME:\00"
@str.15 = [19 x i8] c"\0Aafter unset PATH:\00"
@str.16 = [22 x i8] c"\0Aafter set DISAPPEAR:\00"
@str.17 = [21 x i8] c"\0Aafter set ADDISION:\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @print_envs()
%4 = tail call i32 @setenv(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 1)
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0))
%6 = tail call i32 (...) @print_envs()
%7 = tail call i32 @setenv(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.4, i64 0, i64 0), i32 1)
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.14, i64 0, i64 0))
%9 = tail call i32 (...) @print_envs()
%10 = tail call i32 @unsetenv(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.15, i64 0, i64 0))
%12 = tail call i32 (...) @print_envs()
%13 = tail call i32 @setenv(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.9, i64 0, i64 0), i32 0)
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.16, i64 0, i64 0))
%15 = tail call i32 (...) @print_envs()
%16 = tail call i32 @setenv(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.12, i64 0, i64 0), i32 0)
%17 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.17, i64 0, i64 0))
%18 = tail call i32 (...) @print_envs()
ret i32 0
}