#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 */
char *getenv(char *);
int /*<<< orphan*/ strcasecmp(char *, char *);
int strlen(char *);
char *strstr(char *, char *);
int libau_test_func(char *sym) {
  int ret, l;
  char *e;
  ret = 0;
  e = getenv("LIBAU");
  if (!e)
    goto out;
  do {
  } while (0);
  ret = !*e || !strcasecmp(e, "all");
  if (ret)
    goto out;
  l = strlen(sym);
  while (!ret && (e = strstr(e, sym))) {
    do {
    } while (0);
    ret = (!e[l] || e[l] == ':');
    e++;
  }
out:
  do {
  } while (0);
  return ret;
}


x86 assembly (clang, -O0):
<libau_test_func>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
lea    0xea6(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1173 <libau_test_func+0x33>
jmp    1261 <libau_test_func+0x121>
jmp    1178 <libau_test_func+0x38>
jmp    117d <libau_test_func+0x3d>
mov    -0x18(%rbp),%rcx
mov    $0x1,%al
cmpb   $0x0,(%rcx)
mov    %al,-0x19(%rbp)
je     11aa <libau_test_func+0x6a>
mov    -0x18(%rbp),%rdi
lea    0xe6c(%rip),%rsi
call   1040 <strcasecmp@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     11c4 <libau_test_func+0x84>
jmp    1261 <libau_test_func+0x121>
mov    -0x8(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,-0x10(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0xc(%rbp)
mov    %al,-0x1a(%rbp)
jne    11fa <libau_test_func+0xba>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1060 <strstr@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
setne  %al
mov    %al,-0x1a(%rbp)
mov    -0x1a(%rbp),%al
test   $0x1,%al
jne    120a <libau_test_func+0xca>
jmp    125c <libau_test_func+0x11c>
jmp    120f <libau_test_func+0xcf>
jmp    1214 <libau_test_func+0xd4>
mov    -0x18(%rbp),%rcx
movslq -0x10(%rbp),%rdx
mov    $0x1,%al
cmpb   $0x0,(%rcx,%rdx,1)
mov    %al,-0x1b(%rbp)
je     1240 <libau_test_func+0x100>
mov    -0x18(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x3a,%eax
sete   %al
mov    %al,-0x1b(%rbp)
mov    -0x1b(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0xc(%rbp)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    11d0 <libau_test_func+0x90>
jmp    1261 <libau_test_func+0x121>
jmp    1266 <libau_test_func+0x126>
jmp    126b <libau_test_func+0x12b>
mov    -0xc(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<libau_test_func>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r15
lea    0xeaf(%rip),%rdi
call   1030 <getenv@plt>
xor    %r14d,%r14d
test   %rax,%rax
je     11b9 <libau_test_func+0x79>
mov    %rax,%rbp
cmpb   $0x0,(%rax)
je     11b3 <libau_test_func+0x73>
lea    0xe99(%rip),%rsi
mov    %rbp,%rdi
call   1040 <strcasecmp@plt>
test   %eax,%eax
je     11b3 <libau_test_func+0x73>
mov    %r15,%rdi
call   1050 <strlen@plt>
movslq %eax,%rbx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %rbp,%rdi
mov    %r15,%rsi
call   1060 <strstr@plt>
test   %rax,%rax
je     11b9 <libau_test_func+0x79>
mov    %rax,%rbp
movzbl (%rax,%rbx,1),%eax
cmp    $0x3a,%al
je     11b3 <libau_test_func+0x73>
add    $0x1,%rbp
test   %al,%al
jne    1190 <libau_test_func+0x50>
mov    $0x1,%r14d
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [6 x i8] c"LIBAU\00"
@.str.1 = [4 x i8] c"all\00"
define i32 @libau_test_func(i8* %0) {
%2 = tail call i8* @getenv(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i8* %2, null
br i1 %3, label %21, label %4
4: ; preds = %1
%5 = load i8, i8* %2
%6 = icmp eq i8 %5, 0
br i1 %6, label %21, label %7
7: ; preds = %4
%8 = tail call i32 @strcasecmp(i8* %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%9 = icmp eq i32 %8, 0
br i1 %9, label %21, label %10
10: ; preds = %7
%11 = tail call i32 @strlen(i8* %0)
%12 = sext i32 %11 to i64
br label %13
13: ; preds = %17, %10
%14 = phi i8* [ %2, %10 ], [ %20, %17 ]
%15 = tail call i8* @strstr(i8* %14, i8* dereferenceable(1) %0)
%16 = icmp eq i8* %15, null
br i1 %16, label %21, label %17
17: ; preds = %13
%18 = getelementptr inbounds i8, i8* %15, i64 %12
%19 = load i8, i8* %18
%20 = getelementptr inbounds i8, i8* %15, i64 1
switch i8 %19, label %13 [
i8 58, label %21
i8 0, label %21
]
21: ; preds = %13, %17, %17, %4, %1, %7
%22 = phi i32 [ 1, %7 ], [ 0, %1 ], [ 1, %4 ], [ 0, %13 ], [ 1, %17 ], [ 1, %17 ]
ret i32 %22
}