#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*/ free(char *);
char *strchr(char *, char);
char **strv_env_clean(char **l) {
  char **r, **ret;
  for (r = ret = l; *l; l++) {
    const char *equal;
    equal = strchr(*l, '=');
    if (equal && equal[1] == 0) {
      free(*l);
      continue;
    }
    *(r++) = *l;
  }
  *r = NULL;
  return ret;
}


x86 assembly (clang, -O0):
<strv_env_clean>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmpq   $0x0,(%rax)
je     11b2 <strv_env_clean+0x92>
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
mov    $0x3d,%esi
call   1040 <strchr@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     1188 <strv_env_clean+0x68>
mov    -0x20(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x0,%eax
jne    1188 <strv_env_clean+0x68>
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
call   1030 <free@plt>
jmp    11a1 <strv_env_clean+0x81>
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
mov    -0x10(%rbp),%rax
mov    %rax,%rdx
add    $0x8,%rdx
mov    %rdx,-0x10(%rbp)
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x8(%rbp)
jmp    1138 <strv_env_clean+0x18>
mov    -0x10(%rbp),%rax
movq   $0x0,(%rax)
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strv_env_clean>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdi,%r14
mov    (%rdi),%r12
mov    %rdi,%r15
test   %r12,%r12
je     1175 <strv_env_clean+0x55>
lea    0x8(%r14),%rbx
mov    %r14,%r15
jmp    1153 <strv_env_clean+0x33>
nop
mov    %r12,(%r15)
add    $0x8,%r15
mov    (%rbx),%r12
add    $0x8,%rbx
test   %r12,%r12
je     1175 <strv_env_clean+0x55>
mov    %r12,%rdi
mov    $0x3d,%esi
call   1040 <strchr@plt>
test   %rax,%rax
je     1140 <strv_env_clean+0x20>
cmpb   $0x0,0x1(%rax)
jne    1140 <strv_env_clean+0x20>
mov    %r12,%rdi
call   1030 <free@plt>
jmp    1147 <strv_env_clean+0x27>
movq   $0x0,(%r15)
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8** @strv_env_clean(i8** %0) {
%2 = alloca i8**
%3 = alloca i8**
%4 = alloca i8**
%5 = alloca i8*
store i8** %0, i8*** %2
%6 = load i8**, i8*** %2
store i8** %6, i8*** %4
store i8** %6, i8*** %3
br label %7
7: ; preds = %32, %1
%8 = load i8**, i8*** %2
%9 = load i8*, i8** %8
%10 = icmp ne i8* %9, null
br i1 %10, label %11, label %35
11: ; preds = %7
%12 = load i8**, i8*** %2
%13 = load i8*, i8** %12
%14 = call i8* @strchr(i8* %13, i8 signext 61)
store i8* %14, i8** %5
%15 = load i8*, i8** %5
%16 = icmp ne i8* %15, null
br i1 %16, label %17, label %27
17: ; preds = %11
%18 = load i8*, i8** %5
%19 = getelementptr inbounds i8, i8* %18, i64 1
%20 = load i8, i8* %19
%21 = sext i8 %20 to i32
%22 = icmp eq i32 %21, 0
br i1 %22, label %23, label %27
23: ; preds = %17
%24 = load i8**, i8*** %2
%25 = load i8*, i8** %24
%26 = call i32 @free(i8* %25)
br label %32
27: ; preds = %17, %11
%28 = load i8**, i8*** %2
%29 = load i8*, i8** %28
%30 = load i8**, i8*** %3
%31 = getelementptr inbounds i8*, i8** %30, i32 1
store i8** %31, i8*** %3
store i8* %29, i8** %30
br label %32
32: ; preds = %27, %23
%33 = load i8**, i8*** %2
%34 = getelementptr inbounds i8*, i8** %33, i32 1
store i8** %34, i8*** %2
br label %7
35: ; preds = %7
%36 = load i8**, i8*** %3
store i8* null, i8** %36
%37 = load i8**, i8*** %4
ret i8** %37
}

LLVM IR (-O2):
define i8** @strv_env_clean(i8** returned %0) {
%2 = load i8*, i8** %0
%3 = icmp eq i8* %2, null
br i1 %3, label %23, label %4
4: ; preds = %1, %18
%5 = phi i8* [ %21, %18 ], [ %2, %1 ]
%6 = phi i8** [ %20, %18 ], [ %0, %1 ]
%7 = phi i8** [ %19, %18 ], [ %0, %1 ]
%8 = tail call i8* @strchr(i8* %5, i8 signext 61)
%9 = icmp eq i8* %8, null
br i1 %9, label %16, label %10
10: ; preds = %4
%11 = getelementptr inbounds i8, i8* %8, i64 1
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %10
%15 = tail call i32 @free(i8* %5)
br label %18
16: ; preds = %10, %4
%17 = getelementptr inbounds i8*, i8** %7, i64 1
store i8* %5, i8** %7
br label %18
18: ; preds = %16, %14
%19 = phi i8** [ %7, %14 ], [ %17, %16 ]
%20 = getelementptr inbounds i8*, i8** %6, i64 1
%21 = load i8*, i8** %20
%22 = icmp eq i8* %21, null
br i1 %22, label %23, label %4
23: ; preds = %18, %1
%24 = phi i8** [ %0, %1 ], [ %19, %18 ]
store i8* null, i8** %24
ret i8** %0
}