#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*/ freeArray(char **);
char **myTok(char *, char);
scalar_t__ strcmp(char *, char *);
int enVarExist(char *varName, char **enVars) {
  int exists = 0;
  char **iter = enVars;
  char **toks;
  while (*iter) {
    toks = myTok(*iter, '=');
    if (strcmp(toks[0], varName) == 0) {
      exists = 1;
    }
    freeArray(toks);
    iter++;
  }
  return exists;
}


x86 assembly (clang, -O0):
<enVarExist>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmpq   $0x0,(%rax)
je     11ad <enVarExist+0x7d>
mov    -0x20(%rbp),%rax
mov    (%rax),%rdi
mov    $0x3d,%esi
call   1040 <myTok@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
mov    (%rax),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    1193 <enVarExist+0x63>
movl   $0x1,-0x14(%rbp)
mov    -0x28(%rbp),%rdi
call   1050 <freeArray@plt>
mov    -0x20(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x20(%rbp)
jmp    114f <enVarExist+0x1f>
mov    -0x14(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<enVarExist>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rdi,%r14
mov    (%rsi),%rdi
test   %rdi,%rdi
je     1195 <enVarExist+0x65>
mov    %rsi,%rbx
add    $0x8,%rbx
xor    %ebp,%ebp
mov    $0x1,%r12d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    $0x3d,%esi
call   1040 <myTok@plt>
mov    %rax,%r15
mov    (%rax),%rdi
mov    %r14,%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
cmove  %r12d,%ebp
mov    %r15,%rdi
call   1050 <freeArray@plt>
mov    (%rbx),%rdi
add    $0x8,%rbx
test   %rdi,%rdi
jne    1160 <enVarExist+0x30>
jmp    1197 <enVarExist+0x67>
xor    %ebp,%ebp
mov    %ebp,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @enVarExist(i8* %0, i8** nocapture %1) {
%3 = load i8*, i8** %1
%4 = icmp eq i8* %3, null
br i1 %4, label %18, label %5
5: ; preds = %2, %5
%6 = phi i8* [ %16, %5 ], [ %3, %2 ]
%7 = phi i32 [ %13, %5 ], [ 0, %2 ]
%8 = phi i8** [ %15, %5 ], [ %1, %2 ]
%9 = tail call i8** @myTok(i8* %6, i8 signext 61)
%10 = load i8*, i8** %9
%11 = tail call i64 @strcmp(i8* %10, i8* %0)
%12 = icmp eq i64 %11, 0
%13 = select i1 %12, i32 1, i32 %7
%14 = tail call i32 @freeArray(i8** %9)
%15 = getelementptr inbounds i8*, i8** %8, i64 1
%16 = load i8*, i8** %15
%17 = icmp eq i8* %16, null
br i1 %17, label %18, label %5
18: ; preds = %5, %2
%19 = phi i32 [ 0, %2 ], [ %13, %5 ]
ret i32 %19
}