#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*/ my_free_wordtab(char **);
scalar_t__ my_str_isalnum(char *);
int /*<<< orphan*/ my_strcmp(char *, char *);
int my_tablen(char **);
char **str_to_wordtab_delim(char *, char *);
int is_envvar(char *s) {
  int ret;
  char **w1;
  char **w2;
  ret = 0;
  w1 = str_to_wordtab_delim(s, " \t");
  w2 = NULL;
  if (my_tablen(w1) >= 2 && !my_strcmp(w1[0], "export")) {
    s += 6;
    while ((*s == ' ' || *s == '\t') && s++)
      ;
    my_free_wordtab(w1);
    w1 = str_to_wordtab_delim(s, "=");
    if (my_tablen(w1) >= 2 && my_str_isalnum(w1[0])) {
      w2 = str_to_wordtab_delim(w1[1], " \t");
      if (my_tablen(w2) >= 1)
        ret = 1;
    }
  }
  my_free_wordtab(w1);
  my_free_wordtab(w2);
  return (ret);
}


x86 assembly (clang, -O0):
<is_envvar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe92(%rip),%rsi
call   1060 <str_to_wordtab_delim@plt>
mov    %rax,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <my_tablen@plt>
cmp    $0x2,%eax
jl     128c <is_envvar+0x13c>
mov    -0x18(%rbp),%rax
mov    (%rax),%rdi
lea    0xe64(%rip),%rsi
call   1030 <my_strcmp@plt>
cmp    $0x0,%eax
jne    128c <is_envvar+0x13c>
mov    -0x8(%rbp),%rax
add    $0x6,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x20,%eax
je     11de <is_envvar+0x8e>
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x9,%ecx
mov    %al,-0x21(%rbp)
jne    11f7 <is_envvar+0xa7>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
cmp    $0x0,%rax
setne  %al
mov    %al,-0x21(%rbp)
mov    -0x21(%rbp),%al
test   $0x1,%al
jne    1207 <is_envvar+0xb7>
jmp    120c <is_envvar+0xbc>
jmp    11b9 <is_envvar+0x69>
mov    -0x18(%rbp),%rdi
call   1070 <my_free_wordtab@plt>
mov    -0x8(%rbp),%rdi
lea    0xdea(%rip),%rsi
call   1060 <str_to_wordtab_delim@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <my_tablen@plt>
cmp    $0x2,%eax
jl     1287 <is_envvar+0x137>
mov    -0x18(%rbp),%rax
mov    (%rax),%rdi
call   1050 <my_str_isalnum@plt>
cmp    $0x0,%rax
je     1287 <is_envvar+0x137>
mov    -0x18(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xda0(%rip),%rsi
call   1060 <str_to_wordtab_delim@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
call   1040 <my_tablen@plt>
cmp    $0x1,%eax
jl     1282 <is_envvar+0x132>
movl   $0x1,-0xc(%rbp)
jmp    1287 <is_envvar+0x137>
jmp    128c <is_envvar+0x13c>
mov    -0x18(%rbp),%rdi
call   1070 <my_free_wordtab@plt>
mov    -0x20(%rbp),%rdi
call   1070 <my_free_wordtab@plt>
mov    -0xc(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_envvar>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%rbx
lea    0xea1(%rip),%rsi
call   1060 <str_to_wordtab_delim@plt>
mov    %rax,%r14
mov    %rax,%rdi
call   1040 <my_tablen@plt>
cmp    $0x2,%eax
jl     1209 <is_envvar+0xb9>
mov    (%r14),%rdi
lea    0xe81(%rip),%rsi
call   1030 <my_strcmp@plt>
test   %eax,%eax
jne    1209 <is_envvar+0xb9>
add    $0x6,%rbx
jmp    11a4 <is_envvar+0x54>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0x1,%rbx
movzbl (%rbx),%eax
cmp    $0x20,%al
je     11a0 <is_envvar+0x50>
cmp    $0x9,%al
je     11a0 <is_envvar+0x50>
mov    %r14,%rdi
call   1070 <my_free_wordtab@plt>
lea    0xe4c(%rip),%rsi
mov    %rbx,%rdi
call   1060 <str_to_wordtab_delim@plt>
mov    %rax,%r14
mov    %rax,%rdi
call   1040 <my_tablen@plt>
cmp    $0x2,%eax
jl     1209 <is_envvar+0xb9>
mov    (%r14),%rdi
call   1050 <my_str_isalnum@plt>
test   %rax,%rax
je     1209 <is_envvar+0xb9>
mov    0x8(%r14),%rdi
lea    0xe12(%rip),%rsi
call   1060 <str_to_wordtab_delim@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1040 <my_tablen@plt>
xor    %r15d,%r15d
test   %eax,%eax
setg   %r15b
jmp    120e <is_envvar+0xbe>
xor    %r15d,%r15d
xor    %ebx,%ebx
mov    %r14,%rdi
call   1070 <my_free_wordtab@plt>
mov    %rbx,%rdi
call   1070 <my_free_wordtab@plt>
mov    %r15d,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c" \09\00"
@.str.1 = [7 x i8] c"export\00"
@.str.2 = [2 x i8] c"=\00"
define i32 @is_envvar(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i8**
store i8* %0, i8** %2
store i32 0, i32* %3
%6 = load i8*, i8** %2
%7 = call i8** @str_to_wordtab_delim(i8* %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i8** %7, i8*** %4
store i8** null, i8*** %5
%8 = load i8**, i8*** %4
%9 = call i32 @my_tablen(i8** %8)
%10 = icmp sge i32 %9, 2
br i1 %10, label %11, label %62
11: ; preds = %1
%12 = load i8**, i8*** %4
%13 = getelementptr inbounds i8*, i8** %12, i64 0
%14 = load i8*, i8** %13
%15 = call i32 @my_strcmp(i8* %14, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%16 = icmp ne i32 %15, 0
br i1 %16, label %62, label %17
17: ; preds = %11
%18 = load i8*, i8** %2
%19 = getelementptr inbounds i8, i8* %18, i64 6
store i8* %19, i8** %2
br label %20
20: ; preds = %36, %17
%21 = load i8*, i8** %2
%22 = load i8, i8* %21
%23 = sext i8 %22 to i32
%24 = icmp eq i32 %23, 32
br i1 %24, label %30, label %25
25: ; preds = %20
%26 = load i8*, i8** %2
%27 = load i8, i8* %26
%28 = sext i8 %27 to i32
%29 = icmp eq i32 %28, 9
br i1 %29, label %30, label %34
30: ; preds = %25, %20
%31 = load i8*, i8** %2
%32 = getelementptr inbounds i8, i8* %31, i32 1
store i8* %32, i8** %2
%33 = icmp ne i8* %31, null
br label %34
34: ; preds = %30, %25
%35 = phi i1 [ false, %25 ], [ %33, %30 ]
br i1 %35, label %36, label %37
36: ; preds = %34
br label %20
37: ; preds = %34
%38 = load i8**, i8*** %4
%39 = call i32 @my_free_wordtab(i8** %38)
%40 = load i8*, i8** %2
%41 = call i8** @str_to_wordtab_delim(i8* %40, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i8** %41, i8*** %4
%42 = load i8**, i8*** %4
%43 = call i32 @my_tablen(i8** %42)
%44 = icmp sge i32 %43, 2
br i1 %44, label %45, label %61
45: ; preds = %37
%46 = load i8**, i8*** %4
%47 = getelementptr inbounds i8*, i8** %46, i64 0
%48 = load i8*, i8** %47
%49 = call i64 @my_str_isalnum(i8* %48)
%50 = icmp ne i64 %49, 0
br i1 %50, label %51, label %61
51: ; preds = %45
%52 = load i8**, i8*** %4
%53 = getelementptr inbounds i8*, i8** %52, i64 1
%54 = load i8*, i8** %53
%55 = call i8** @str_to_wordtab_delim(i8* %54, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i8** %55, i8*** %5
%56 = load i8**, i8*** %5
%57 = call i32 @my_tablen(i8** %56)
%58 = icmp sge i32 %57, 1
br i1 %58, label %59, label %60
59: ; preds = %51
store i32 1, i32* %3
br label %60
60: ; preds = %59, %51
br label %61
61: ; preds = %60, %45, %37
br label %62
62: ; preds = %61, %11, %1
%63 = load i8**, i8*** %4
%64 = call i32 @my_free_wordtab(i8** %63)
%65 = load i8**, i8*** %5
%66 = call i32 @my_free_wordtab(i8** %65)
%67 = load i32, i32* %3
ret i32 %67
}

LLVM IR (-O2):
@.str = [3 x i8] c" \09\00"
@.str.1 = [7 x i8] c"export\00"
@.str.2 = [2 x i8] c"=\00"
define i32 @is_envvar(i8* %0) {
%2 = tail call i8** @str_to_wordtab_delim(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @my_tablen(i8** %2)
%4 = icmp sgt i32 %3, 1
br i1 %4, label %5, label %32
5: ; preds = %1
%6 = load i8*, i8** %2
%7 = tail call i32 @my_strcmp(i8* %6, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %32
9: ; preds = %5
%10 = getelementptr inbounds i8, i8* %0, i64 6
br label %11
11: ; preds = %14, %9
%12 = phi i8* [ %10, %9 ], [ %15, %14 ]
%13 = load i8, i8* %12
switch i8 %13, label %16 [
i8 32, label %14
i8 9, label %14
]
14: ; preds = %11, %11
%15 = getelementptr inbounds i8, i8* %12, i64 1
br label %11
16: ; preds = %11
%17 = tail call i32 @my_free_wordtab(i8** %2)
%18 = tail call i8** @str_to_wordtab_delim(i8* %12, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%19 = tail call i32 @my_tablen(i8** %18)
%20 = icmp sgt i32 %19, 1
br i1 %20, label %21, label %32
21: ; preds = %16
%22 = load i8*, i8** %18
%23 = tail call i64 @my_str_isalnum(i8* %22)
%24 = icmp eq i64 %23, 0
br i1 %24, label %32, label %25
25: ; preds = %21
%26 = getelementptr inbounds i8*, i8** %18, i64 1
%27 = load i8*, i8** %26
%28 = tail call i8** @str_to_wordtab_delim(i8* %27, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%29 = tail call i32 @my_tablen(i8** %28)
%30 = icmp sgt i32 %29, 0
%31 = zext i1 %30 to i32
br label %32
32: ; preds = %25, %16, %21, %5, %1
%33 = phi i32 [ 0, %5 ], [ 0, %21 ], [ 0, %16 ], [ 0, %1 ], [ %31, %25 ]
%34 = phi i8** [ %2, %5 ], [ %18, %21 ], [ %18, %16 ], [ %2, %1 ], [ %18, %25 ]
%35 = phi i8** [ null, %5 ], [ null, %21 ], [ null, %16 ], [ null, %1 ], [ %28, %25 ]
%36 = tail call i32 @my_free_wordtab(i8** %34)
%37 = tail call i32 @my_free_wordtab(i8** %35)
ret i32 %33
}