#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*/ EXIT_SUCCESS;
scalar_t__ _unsetenv(char *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ exitErr(char *);
int /*<<< orphan*/ printValue(char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ usage(char *);
int main(int argc, char **argv) {
  if (argc < 2)
    usage(argv[0]);
  printValue(argv[1]);
  if (_unsetenv(argv[1]) < 0)
    exitErr("unsetenv");
  printf("After unset()\n");
  printValue(argv[1]);
  exit(EXIT_SUCCESS);
}


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)
cmpl   $0x2,-0x8(%rbp)
jge    118c <main+0x2c>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1060 <usage@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <printValue@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1080 <_unsetenv@plt>
cmp    $0x0,%rax
jge    11bc <main+0x5c>
lea    0xe49(%rip),%rdi
call   1030 <exitErr@plt>
lea    0xe46(%rip),%rdi
call   1040 <printf@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <printValue@plt>
mov    0x2e04(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    %rsi,%rbx
cmp    $0x1,%edi
jg     1171 <main+0x11>
mov    (%rbx),%rdi
call   1060 <usage@plt>
mov    0x8(%rbx),%rdi
call   1050 <printValue@plt>
mov    0x8(%rbx),%rdi
call   1080 <_unsetenv@plt>
test   %rax,%rax
jns    1194 <main+0x34>
lea    0xe71(%rip),%rdi
call   1040 <exitErr@plt>
lea    0xe6e(%rip),%rdi
call   1030 <puts@plt>
mov    0x8(%rbx),%rdi
call   1050 <printValue@plt>
mov    0x2e30(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"unsetenv\00"
@.str.1 = [15 x i8] c"After unset()\0A\00"
@EXIT_SUCCESS = global i32 0
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 = load i32, i32* %4
%7 = icmp slt i32 %6, 2
br i1 %7, label %8, label %13
8: ; preds = %2
%9 = load i8**, i8*** %5
%10 = getelementptr inbounds i8*, i8** %9, i64 0
%11 = load i8*, i8** %10
%12 = call i32 @usage(i8* %11)
br label %13
13: ; preds = %8, %2
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
%17 = call i32 @printValue(i8* %16)
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 1
%20 = load i8*, i8** %19
%21 = call i64 @_unsetenv(i8* %20)
%22 = icmp slt i64 %21, 0
br i1 %22, label %23, label %25
23: ; preds = %13
%24 = call i32 @exitErr(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
br label %25
25: ; preds = %23, %13
%26 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%27 = load i8**, i8*** %5
%28 = getelementptr inbounds i8*, i8** %27, i64 1
%29 = load i8*, i8** %28
%30 = call i32 @printValue(i8* %29)
%31 = load i32, i32* @EXIT_SUCCESS
%32 = call i32 @exit(i32 %31)
unreachable
}

LLVM IR (-O2):
@.str = [9 x i8] c"unsetenv\00"
@EXIT_SUCCESS = global i32 0
@str = [14 x i8] c"After unset()\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %4, label %7
4: ; preds = %2
%5 = load i8*, i8** %1
%6 = tail call i32 @usage(i8* %5)
br label %7
7: ; preds = %4, %2
%8 = getelementptr inbounds i8*, i8** %1, i64 1
%9 = load i8*, i8** %8
%10 = tail call i32 @printValue(i8* %9)
%11 = load i8*, i8** %8
%12 = tail call i64 @_unsetenv(i8* %11)
%13 = icmp slt i64 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %7
%15 = tail call i32 @exitErr(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
br label %16
16: ; preds = %14, %7
%17 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
%18 = load i8*, i8** %8
%19 = tail call i32 @printValue(i8* %18)
%20 = load i32, i32* @EXIT_SUCCESS
%21 = tail call i32 @exit(i32 %20)
unreachable
}