#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 CheckIPFile(char *, char const *, char const *, char const *, char const *);
int /*<<< orphan*/ Destroy(char *);
char *GetTok(char const *, char *, char **);
char *MCatStr(char *, char *, char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ StripLeadingWhitespace(char *);
int /*<<< orphan*/ StripTrailingWhitespace(char *);
int CheckIPLists(const char *FileList, const char *Rhost, const char *IP,
                 const char *MAC, const char *Region, char **MatchingLists) {
  char *Path = NULL;
  const char *ptr;
  int result = 0;
  ptr = GetTok(FileList, ",", &Path);
  while (ptr) {
    StripLeadingWhitespace(Path);
    StripTrailingWhitespace(Path);
    result = CheckIPFile(Path, Rhost, IP, MAC, Region);
    if (result) {
      *MatchingLists = MCatStr(*MatchingLists, Path, " ", NULL);
      break;
    }
    ptr = GetTok(ptr, ",", &Path);
  }
  Destroy(Path);
  return (result);
}


x86 assembly (clang, -O0):
<CheckIPLists>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
movq   $0x0,-0x38(%rbp)
movl   $0x0,-0x44(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe66(%rip),%rsi
lea    -0x38(%rbp),%rdx
call   1030 <GetTok@plt>
mov    %rax,-0x40(%rbp)
cmpq   $0x0,-0x40(%rbp)
je     1231 <CheckIPLists+0xd1>
mov    -0x38(%rbp),%rdi
call   1070 <StripLeadingWhitespace@plt>
mov    -0x38(%rbp),%rdi
call   1080 <StripTrailingWhitespace@plt>
mov    -0x38(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%r8
call   1060 <CheckIPFile@plt>
mov    %eax,-0x44(%rbp)
cmpl   $0x0,-0x44(%rbp)
je     1214 <CheckIPLists+0xb4>
mov    -0x30(%rbp),%rax
mov    (%rax),%rdi
mov    -0x38(%rbp),%rsi
lea    0xe06(%rip),%rdx
xor    %eax,%eax
mov    %eax,%ecx
call   1040 <MCatStr@plt>
mov    %rax,%rcx
mov    -0x30(%rbp),%rax
mov    %rcx,(%rax)
jmp    1231 <CheckIPLists+0xd1>
mov    -0x40(%rbp),%rdi
lea    0xde1(%rip),%rsi
lea    -0x38(%rbp),%rdx
call   1030 <GetTok@plt>
mov    %rax,-0x40(%rbp)
jmp    11a7 <CheckIPLists+0x47>
mov    -0x38(%rbp),%rdi
call   1050 <Destroy@plt>
mov    -0x44(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CheckIPLists>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r9,%r12
mov    %r8,%r15
mov    %rcx,%r13
mov    %rdx,%rbp
mov    %rsi,%rbx
movq   $0x0,0x8(%rsp)
lea    0xe73(%rip),%rsi
lea    0x8(%rsp),%rdx
call   1030 <GetTok@plt>
test   %rax,%rax
je     11fa <CheckIPLists+0x9a>
mov    %rax,%r14
mov    %r12,0x10(%rsp)
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    0x8(%rsp),%rdi
call   1070 <StripLeadingWhitespace@plt>
mov    0x8(%rsp),%rdi
call   1080 <StripTrailingWhitespace@plt>
mov    0x8(%rsp),%rdi
mov    %rbx,%rsi
mov    %rbp,%rdx
mov    %r13,%rcx
mov    %r15,%r8
call   1060 <CheckIPFile@plt>
test   %eax,%eax
jne    11ff <CheckIPLists+0x9f>
mov    %r14,%rdi
lea    0xe18(%rip),%rsi
lea    0x8(%rsp),%rdx
call   1030 <GetTok@plt>
mov    %rax,%r14
test   %rax,%rax
jne    11b0 <CheckIPLists+0x50>
xor    %r12d,%r12d
jmp    1220 <CheckIPLists+0xc0>
mov    %eax,%r12d
mov    0x10(%rsp),%rbx
mov    (%rbx),%rdi
mov    0x8(%rsp),%rsi
lea    0xdec(%rip),%rdx
xor    %ecx,%ecx
call   1040 <MCatStr@plt>
mov    %rax,(%rbx)
mov    0x8(%rsp),%rdi
call   1050 <Destroy@plt>
mov    %r12d,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c",\00"
@.str.1 = [2 x i8] c" \00"
define i32 @CheckIPLists(i8* %0, i8* %1, i8* %2, i8* %3, i8* %4, i8** %5) {
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca i8**
%13 = alloca i8*
%14 = alloca i8*
%15 = alloca i32
store i8* %0, i8** %7
store i8* %1, i8** %8
store i8* %2, i8** %9
store i8* %3, i8** %10
store i8* %4, i8** %11
store i8** %5, i8*** %12
store i8* null, i8** %13
store i32 0, i32* %15
%16 = load i8*, i8** %7
%17 = call i8* @GetTok(i8* %16, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8** %13)
store i8* %17, i8** %14
br label %18
18: ; preds = %40, %6
%19 = load i8*, i8** %14
%20 = icmp ne i8* %19, null
br i1 %20, label %21, label %43
21: ; preds = %18
%22 = load i8*, i8** %13
%23 = call i32 @StripLeadingWhitespace(i8* %22)
%24 = load i8*, i8** %13
%25 = call i32 @StripTrailingWhitespace(i8* %24)
%26 = load i8*, i8** %13
%27 = load i8*, i8** %8
%28 = load i8*, i8** %9
%29 = load i8*, i8** %10
%30 = load i8*, i8** %11
%31 = call i32 @CheckIPFile(i8* %26, i8* %27, i8* %28, i8* %29, i8* %30)
store i32 %31, i32* %15
%32 = load i32, i32* %15
%33 = icmp ne i32 %32, 0
br i1 %33, label %34, label %40
34: ; preds = %21
%35 = load i8**, i8*** %12
%36 = load i8*, i8** %35
%37 = load i8*, i8** %13
%38 = call i8* @MCatStr(i8* %36, i8* %37, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32* null)
%39 = load i8**, i8*** %12
store i8* %38, i8** %39
br label %43
40: ; preds = %21
%41 = load i8*, i8** %14
%42 = call i8* @GetTok(i8* %41, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8** %13)
store i8* %42, i8** %14
br label %18
43: ; preds = %34, %18
%44 = load i8*, i8** %13
%45 = call i32 @Destroy(i8* %44)
%46 = load i32, i32* %15
ret i32 %46
}

LLVM IR (-O2):
@.str = [2 x i8] c",\00"
@.str.1 = [2 x i8] c" \00"
define i32 @CheckIPLists(i8* %0, i8* %1, i8* %2, i8* %3, i8* %4, i8** nocapture %5) {
%7 = alloca i8*
%8 = bitcast i8** %7 to i8*
store i8* null, i8** %7
%9 = call i8* @GetTok(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8** %7)
%10 = icmp eq i8* %9, null
br i1 %10, label %27, label %11
11: ; preds = %6, %24
%12 = phi i8* [ %25, %24 ], [ %9, %6 ]
%13 = load i8*, i8** %7
%14 = call i32 @StripLeadingWhitespace(i8* %13)
%15 = load i8*, i8** %7
%16 = call i32 @StripTrailingWhitespace(i8* %15)
%17 = load i8*, i8** %7
%18 = call i32 @CheckIPFile(i8* %17, i8* %1, i8* %2, i8* %3, i8* %4)
%19 = icmp eq i32 %18, 0
br i1 %19, label %24, label %20
20: ; preds = %11
%21 = load i8*, i8** %5
%22 = load i8*, i8** %7
%23 = call i8* @MCatStr(i8* %21, i8* %22, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32* null)
store i8* %23, i8** %5
br label %27
24: ; preds = %11
%25 = call i8* @GetTok(i8* %12, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8** %7)
%26 = icmp eq i8* %25, null
br i1 %26, label %27, label %11
27: ; preds = %24, %6, %20
%28 = phi i32 [ %18, %20 ], [ 0, %6 ], [ 0, %24 ]
%29 = load i8*, i8** %7
%30 = call i32 @Destroy(i8* %29)
ret i32 %28
}