#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 find_inenv(char **, char *);
char **strto_wordtab(char *, char *);
char **unset_environ(char *buff, char **environ) {
  static int i = 0;
  char **buffer;
  buffer = strto_wordtab(buff, " ");
  if (!(buffer[1]))
    return (environ);
  i = find_inenv(environ, buffer[1]);
  if (!(i)) {
    return (environ);
  }
  environ[i] = 0;
  return (environ);
}


x86 assembly (clang, -O0):
<unset_environ>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xec5(%rip),%rsi
call   1040 <strto_wordtab@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmpq   $0x0,0x8(%rax)
jne    1160 <unset_environ+0x40>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    11ac <unset_environ+0x8c>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rax
mov    0x8(%rax),%rsi
call   1030 <find_inenv@plt>
mov    %eax,0x2ebd(%rip)
cmpl   $0x0,0x2eb6(%rip)
jne    1191 <unset_environ+0x71>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    11ac <unset_environ+0x8c>
mov    -0x18(%rbp),%rax
movslq 0x2e98(%rip),%rcx
movq   $0x0,(%rax,%rcx,8)
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<unset_environ>:
push   %rbx
mov    %rsi,%rbx
lea    0xed5(%rip),%rsi
call   1040 <strto_wordtab@plt>
mov    0x8(%rax),%rsi
test   %rsi,%rsi
je     114f <unset_environ+0x2f>
mov    %rbx,%rdi
call   1030 <find_inenv@plt>
test   %eax,%eax
je     114f <unset_environ+0x2f>
cltq
movq   $0x0,(%rbx,%rax,8)
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@unset_environ.i = internal global i32 0
@.str = [2 x i8] c" \00"
define i8** @unset_environ(i8* %0, i8** %1) {
%3 = alloca i8**
%4 = alloca i8*
%5 = alloca i8**
%6 = alloca i8**
store i8* %0, i8** %4
store i8** %1, i8*** %5
%7 = load i8*, i8** %4
%8 = call i8** @strto_wordtab(i8* %7, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i8** %8, i8*** %6
%9 = load i8**, i8*** %6
%10 = getelementptr inbounds i8*, i8** %9, i64 1
%11 = load i8*, i8** %10
%12 = icmp ne i8* %11, null
br i1 %12, label %15, label %13
13: ; preds = %2
%14 = load i8**, i8*** %5
store i8** %14, i8*** %3
br label %31
15: ; preds = %2
%16 = load i8**, i8*** %5
%17 = load i8**, i8*** %6
%18 = getelementptr inbounds i8*, i8** %17, i64 1
%19 = load i8*, i8** %18
%20 = call i32 @find_inenv(i8** %16, i8* %19)
store i32 %20, i32* @unset_environ.i
%21 = load i32, i32* @unset_environ.i
%22 = icmp ne i32 %21, 0
br i1 %22, label %25, label %23
23: ; preds = %15
%24 = load i8**, i8*** %5
store i8** %24, i8*** %3
br label %31
25: ; preds = %15
%26 = load i8**, i8*** %5
%27 = load i32, i32* @unset_environ.i
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds i8*, i8** %26, i64 %28
store i8* null, i8** %29
%30 = load i8**, i8*** %5
store i8** %30, i8*** %3
br label %31
31: ; preds = %25, %23, %13
%32 = load i8**, i8*** %3
ret i8** %32
}

LLVM IR (-O2):
@.str = [2 x i8] c" \00"
define i8** @unset_environ(i8* %0, i8** returned %1) {
%3 = tail call i8** @strto_wordtab(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%4 = getelementptr inbounds i8*, i8** %3, i64 1
%5 = load i8*, i8** %4
%6 = icmp eq i8* %5, null
br i1 %6, label %13, label %7
7: ; preds = %2
%8 = tail call i32 @find_inenv(i8** %1, i8* %5)
%9 = icmp eq i32 %8, 0
br i1 %9, label %13, label %10
10: ; preds = %7
%11 = sext i32 %8 to i64
%12 = getelementptr inbounds i8*, i8** %1, i64 %11
store i8* null, i8** %12
br label %13
13: ; preds = %7, %2, %10
ret i8** %1
}