#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*/ px_strfreev(char **);
char **px_strsplit(char *, char *);
int /*<<< orphan*/ strcmp(char const *, char *);
int _px_wpad_module_findpos(const char *name) {
  int pos = 0;
  char **orderv =
      px_strsplit("wpad_dhcp,wpad_slp,wpad_dns,wpad_dnsdevolution", ",");
  for (pos = 0; orderv[pos]; pos++)
    if (!strcmp(name, orderv[pos]))
      goto do_return;
do_return:
  px_strfreev(orderv);
  return pos;
}


x86 assembly (clang, -O0):
<_px_wpad_module_findpos>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
lea    0xeb6(%rip),%rdi
lea    0xede(%rip),%rsi
call   1050 <px_strsplit@plt>
mov    %rax,-0x18(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x18(%rbp),%rax
movslq -0xc(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     11aa <_px_wpad_module_findpos+0x7a>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    1197 <_px_wpad_module_findpos+0x67>
jmp    11af <_px_wpad_module_findpos+0x7f>
jmp    119c <_px_wpad_module_findpos+0x6c>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1161 <_px_wpad_module_findpos+0x31>
jmp    11af <_px_wpad_module_findpos+0x7f>
mov    -0x18(%rbp),%rdi
call   1030 <px_strfreev@plt>
mov    -0xc(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_px_wpad_module_findpos>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r15
lea    0xec1(%rip),%rdi
lea    0xee9(%rip),%rsi
call   1050 <px_strsplit@plt>
mov    %rax,%r14
mov    (%rax),%rsi
xor    %ebx,%ebx
test   %rsi,%rsi
je     117a <_px_wpad_module_findpos+0x4a>
nopl   0x0(%rax,%rax,1)
mov    %r15,%rdi
call   1040 <strcmp@plt>
test   %eax,%eax
je     117a <_px_wpad_module_findpos+0x4a>
mov    0x8(%r14,%rbx,8),%rsi
add    $0x1,%rbx
test   %rsi,%rsi
jne    1160 <_px_wpad_module_findpos+0x30>
mov    %r14,%rdi
call   1030 <px_strfreev@plt>
mov    %ebx,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [47 x i8] c"wpad_dhcp,wpad_slp,wpad_dns,wpad_dnsdevolution\00"
@.str.1 = [2 x i8] c",\00"
define i32 @_px_wpad_module_findpos(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i8**
store i8* %0, i8** %2
store i32 0, i32* %3
%5 = call i8** @px_strsplit(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i8** %5, i8*** %4
store i32 0, i32* %3
br label %6
6: ; preds = %24, %1
%7 = load i8**, i8*** %4
%8 = load i32, i32* %3
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds i8*, i8** %7, i64 %9
%11 = load i8*, i8** %10
%12 = icmp ne i8* %11, null
br i1 %12, label %13, label %27
13: ; preds = %6
%14 = load i8*, i8** %2
%15 = load i8**, i8*** %4
%16 = load i32, i32* %3
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i8*, i8** %15, i64 %17
%19 = load i8*, i8** %18
%20 = call i32 @strcmp(i8* %14, i8* %19)
%21 = icmp ne i32 %20, 0
br i1 %21, label %23, label %22
22: ; preds = %13
br label %28
23: ; preds = %13
br label %24
24: ; preds = %23
%25 = load i32, i32* %3
%26 = add nsw i32 %25, 1
store i32 %26, i32* %3
br label %6
27: ; preds = %6
br label %28
28: ; preds = %27, %22
%29 = load i8**, i8*** %4
%30 = call i32 @px_strfreev(i8** %29)
%31 = load i32, i32* %3
ret i32 %31
}

LLVM IR (-O2):
@.str = [47 x i8] c"wpad_dhcp,wpad_slp,wpad_dns,wpad_dnsdevolution\00"
@.str.1 = [2 x i8] c",\00"
define i32 @_px_wpad_module_findpos(i8* nocapture %0) {
%2 = tail call i8** @px_strsplit(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%3 = load i8*, i8** %2
%4 = icmp eq i8* %3, null
br i1 %4, label %18, label %5
5: ; preds = %1, %10
%6 = phi i64 [ %11, %10 ], [ 0, %1 ]
%7 = phi i8* [ %13, %10 ], [ %3, %1 ]
%8 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* %7)
%9 = icmp eq i32 %8, 0
br i1 %9, label %15, label %10
10: ; preds = %5
%11 = add nuw i64 %6, 1
%12 = getelementptr inbounds i8*, i8** %2, i64 %11
%13 = load i8*, i8** %12
%14 = icmp eq i8* %13, null
br i1 %14, label %15, label %5
15: ; preds = %10, %5
%16 = phi i64 [ %6, %5 ], [ %11, %10 ]
%17 = trunc i64 %16 to i32
br label %18
18: ; preds = %15, %1
%19 = phi i32 [ 0, %1 ], [ %17, %15 ]
%20 = tail call i32 @px_strfreev(i8** %2)
ret i32 %19
}