#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 *strchr(char *, char);
int authme_arg_split(char *arg, char **cmd, char **var) {
  char *p;
  p = arg;
  while (*p == '\t' || *p == ' ')
    p++;
  if (*p == '\0')
    return 0;
  *cmd = p;
  p = strchr(arg, '=');
  if (p == NULL) {
    return 1;
  }
  *(p++) = '\0';
  while (*p == '\t' || *p == ' ')
    p++;
  *var = p;
  return 2;
}


x86 assembly (clang, -O0):
<authme_arg_split>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
movsbl (%rax),%ecx
mov    $0x1,%al
cmp    $0x9,%ecx
mov    %al,-0x29(%rbp)
je     1151 <authme_arg_split+0x41>
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x20,%eax
sete   %al
mov    %al,-0x29(%rbp)
mov    -0x29(%rbp),%al
test   $0x1,%al
jne    1161 <authme_arg_split+0x51>
jmp    1172 <authme_arg_split+0x62>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    112c <authme_arg_split+0x1c>
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    118e <authme_arg_split+0x7e>
movl   $0x0,-0x4(%rbp)
jmp    122c <authme_arg_split+0x11c>
mov    -0x28(%rbp),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x10(%rbp),%rdi
mov    $0x3d,%esi
call   1030 <strchr@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    11c2 <authme_arg_split+0xb2>
movl   $0x1,-0x4(%rbp)
jmp    122c <authme_arg_split+0x11c>
mov    -0x28(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x28(%rbp)
movb   $0x0,(%rax)
mov    -0x28(%rbp),%rax
movsbl (%rax),%ecx
mov    $0x1,%al
cmp    $0x9,%ecx
mov    %al,-0x2a(%rbp)
je     11f9 <authme_arg_split+0xe9>
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x20,%eax
sete   %al
mov    %al,-0x2a(%rbp)
mov    -0x2a(%rbp),%al
test   $0x1,%al
jne    1209 <authme_arg_split+0xf9>
jmp    121a <authme_arg_split+0x10a>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    11d4 <authme_arg_split+0xc4>
mov    -0x28(%rbp),%rcx
mov    -0x20(%rbp),%rax
mov    %rcx,(%rax)
movl   $0x2,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<authme_arg_split>:
push   %rbx
mov    %rdx,%rbx
mov    %rdi,%rax
jmp    1124 <authme_arg_split+0x14>
nopl   0x0(%rax)
add    $0x1,%rax
movzbl (%rax),%ecx
cmp    $0x9,%cl
je     1120 <authme_arg_split+0x10>
cmp    $0x20,%cl
je     1120 <authme_arg_split+0x10>
test   %cl,%cl
jne    1139 <authme_arg_split+0x29>
xor    %eax,%eax
pop    %rbx
ret
mov    %rax,(%rsi)
mov    $0x3d,%esi
call   1030 <strchr@plt>
test   %rax,%rax
je     116b <authme_arg_split+0x5b>
movb   $0x0,(%rax)
xchg   %ax,%ax
add    $0x1,%rax
movzbl (%rax),%ecx
cmp    $0x20,%cl
je     1150 <authme_arg_split+0x40>
cmp    $0x9,%cl
je     1150 <authme_arg_split+0x40>
mov    %rax,(%rbx)
mov    $0x2,%eax
pop    %rbx
ret
mov    $0x1,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @authme_arg_split(i8* %0, i8** %1, i8** %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8**
%7 = alloca i8**
%8 = alloca i8*
store i8* %0, i8** %5
store i8** %1, i8*** %6
store i8** %2, i8*** %7
%9 = load i8*, i8** %5
store i8* %9, i8** %8
br label %10
10: ; preds = %22, %3
%11 = load i8*, i8** %8
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
%14 = icmp eq i32 %13, 9
br i1 %14, label %20, label %15
15: ; preds = %10
%16 = load i8*, i8** %8
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = icmp eq i32 %18, 32
br label %20
20: ; preds = %15, %10
%21 = phi i1 [ true, %10 ], [ %19, %15 ]
br i1 %21, label %22, label %25
22: ; preds = %20
%23 = load i8*, i8** %8
%24 = getelementptr inbounds i8, i8* %23, i32 1
store i8* %24, i8** %8
br label %10
25: ; preds = %20
%26 = load i8*, i8** %8
%27 = load i8, i8* %26
%28 = sext i8 %27 to i32
%29 = icmp eq i32 %28, 0
br i1 %29, label %30, label %31
30: ; preds = %25
store i32 0, i32* %4
br label %60
31: ; preds = %25
%32 = load i8*, i8** %8
%33 = load i8**, i8*** %6
store i8* %32, i8** %33
%34 = load i8*, i8** %5
%35 = call i8* @strchr(i8* %34, i8 signext 61)
store i8* %35, i8** %8
%36 = load i8*, i8** %8
%37 = icmp eq i8* %36, null
br i1 %37, label %38, label %39
38: ; preds = %31
store i32 1, i32* %4
br label %60
39: ; preds = %31
%40 = load i8*, i8** %8
%41 = getelementptr inbounds i8, i8* %40, i32 1
store i8* %41, i8** %8
store i8 0, i8* %40
br label %42
42: ; preds = %54, %39
%43 = load i8*, i8** %8
%44 = load i8, i8* %43
%45 = sext i8 %44 to i32
%46 = icmp eq i32 %45, 9
br i1 %46, label %52, label %47
47: ; preds = %42
%48 = load i8*, i8** %8
%49 = load i8, i8* %48
%50 = sext i8 %49 to i32
%51 = icmp eq i32 %50, 32
br label %52
52: ; preds = %47, %42
%53 = phi i1 [ true, %42 ], [ %51, %47 ]
br i1 %53, label %54, label %57
54: ; preds = %52
%55 = load i8*, i8** %8
%56 = getelementptr inbounds i8, i8* %55, i32 1
store i8* %56, i8** %8
br label %42
57: ; preds = %52
%58 = load i8*, i8** %8
%59 = load i8**, i8*** %7
store i8* %58, i8** %59
store i32 2, i32* %4
br label %60
60: ; preds = %57, %38, %30
%61 = load i32, i32* %4
ret i32 %61
}

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