#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*/ clearenv();
char *getenv(char *);
int /*<<< orphan*/ getenv1();
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ putenv(char *);
int /*<<< orphan*/ setenv(char *, char *, int);
int /*<<< orphan*/ uname1();
int /*<<< orphan*/ unsetenv(char *);
int main() {
  getenv1();
  putenv("AAA=123");
  printf("AAA  %s\n", getenv("AAA"));
  setenv("BBB", "boy", 1);
  printf("BBB2 %s\n", getenv("BBB"));
  unsetenv("BBB");
  printf("BBB3 %s\n", getenv("BBB"));
  clearenv();
  uname1();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1080 <getenv1@plt>
lea    0xe63(%rip),%rdi
call   1070 <putenv@plt>
lea    0xe68(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,%rsi
lea    0xe50(%rip),%rdi
call   1060 <printf@plt>
lea    0xe51(%rip),%rdi
lea    0xe4e(%rip),%rsi
mov    $0x1,%edx
call   1040 <setenv@plt>
lea    0xe39(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,%rsi
lea    0xe32(%rip),%rdi
call   1060 <printf@plt>
lea    0xe1e(%rip),%rdi
call   10a0 <unsetenv@plt>
lea    0xe12(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,%rsi
lea    0xe14(%rip),%rdi
call   1060 <printf@plt>
mov    $0x0,%al
call   1050 <clearenv@plt>
mov    $0x0,%al
call   1090 <uname1@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1080 <getenv1@plt>
lea    0xe71(%rip),%rdi
call   1070 <putenv@plt>
lea    0xe76(%rip),%rdi
call   1030 <getenv@plt>
lea    0xe61(%rip),%rdi
mov    %rax,%rsi
call   1060 <printf@plt>
lea    0xe5f(%rip),%rbx
lea    0xe5c(%rip),%rsi
mov    %rbx,%rdi
mov    $0x1,%edx
call   1040 <setenv@plt>
mov    %rbx,%rdi
call   1030 <getenv@plt>
lea    0xe44(%rip),%rdi
mov    %rax,%rsi
call   1060 <printf@plt>
mov    %rbx,%rdi
call   10a0 <unsetenv@plt>
mov    %rbx,%rdi
call   1030 <getenv@plt>
lea    0xe2e(%rip),%rdi
mov    %rax,%rsi
call   1060 <printf@plt>
xor    %eax,%eax
call   1050 <clearenv@plt>
xor    %eax,%eax
call   1090 <uname1@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [8 x i8] c"AAA=123\00"
@.str.1 = [9 x i8] c"AAA %s\0A\00"
@.str.2 = [4 x i8] c"AAA\00"
@.str.3 = [4 x i8] c"BBB\00"
@.str.4 = [4 x i8] c"boy\00"
@.str.5 = [9 x i8] c"BBB2 %s\0A\00"
@.str.6 = [9 x i8] c"BBB3 %s\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @getenv1()
%3 = call i32 @putenv(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%4 = call i8* @getenv(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%6 = call i32 @setenv(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 1)
%7 = call i8* @getenv(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%8 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), i8* %7)
%9 = call i32 @unsetenv(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%10 = call i8* @getenv(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%11 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0), i8* %10)
%12 = call i32 (...) @clearenv()
%13 = call i32 (...) @uname1()
ret i32 0
}

LLVM IR (-O2):
@.str = [8 x i8] c"AAA=123\00"
@.str.1 = [9 x i8] c"AAA %s\0A\00"
@.str.2 = [4 x i8] c"AAA\00"
@.str.3 = [4 x i8] c"BBB\00"
@.str.4 = [4 x i8] c"boy\00"
@.str.5 = [9 x i8] c"BBB2 %s\0A\00"
@.str.6 = [9 x i8] c"BBB3 %s\0A\00"
define i32 @main() {
%1 = tail call i32 (...) @getenv1()
%2 = tail call i32 @putenv(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%3 = tail call i8* @getenv(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%4 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* %3)
%5 = tail call i32 @setenv(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 1)
%6 = tail call i8* @getenv(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%7 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), i8* %6)
%8 = tail call i32 @unsetenv(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%9 = tail call i8* @getenv(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%10 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0), i8* %9)
%11 = tail call i32 (...) @clearenv()
%12 = tail call i32 (...) @uname1()
ret i32 0
}