#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 */
scalar_t__ isalnum(char);
int /*<<< orphan*/ isalpha(char);
int strlen(char *);
int __split_attr(char *s, char **namep, char **valuep) {
  *namep = s;
  if (!isalpha(*s))
    return 0;
  while (isalnum(*s) || *s == '_' || *s == '-')
    ++s;
  if (*s != '=')
    return 0;
  *s++ = '\0';
  if (*s == '"') {
    int len;
    len = strlen(s);
    if (len < 2 || s[len - 1] != '"')
      return 0;
    s[len - 1] = '"';
    *valuep = s + 1;
  } else {
    *valuep = s;
  }
  return 1;
}


x86 assembly (clang, -O0):
<__split_attr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1050 <isalpha@plt>
cmp    $0x0,%eax
jne    1170 <__split_attr+0x40>
movl   $0x0,-0x4(%rbp)
jmp    128a <__split_attr+0x15a>
jmp    1175 <__split_attr+0x45>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1040 <isalnum@plt>
mov    %rax,%rcx
mov    $0x1,%al
cmp    $0x0,%rcx
mov    %al,-0x25(%rbp)
jne    11b8 <__split_attr+0x88>
mov    -0x10(%rbp),%rax
movsbl (%rax),%ecx
mov    $0x1,%al
cmp    $0x5f,%ecx
mov    %al,-0x25(%rbp)
je     11b8 <__split_attr+0x88>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
sete   %al
mov    %al,-0x25(%rbp)
mov    -0x25(%rbp),%al
test   $0x1,%al
jne    11c8 <__split_attr+0x98>
jmp    11d9 <__split_attr+0xa9>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1175 <__split_attr+0x45>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x3d,%eax
je     11f5 <__split_attr+0xc5>
movl   $0x0,-0x4(%rbp)
jmp    128a <__split_attr+0x15a>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x0,(%rax)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x22,%eax
jne    1278 <__split_attr+0x148>
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x2,-0x24(%rbp)
jl     1247 <__split_attr+0x117>
mov    -0x10(%rbp),%rax
mov    -0x24(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x22,%eax
je     1253 <__split_attr+0x123>
movl   $0x0,-0x4(%rbp)
jmp    128a <__split_attr+0x15a>
mov    -0x10(%rbp),%rax
mov    -0x24(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x22,(%rax,%rcx,1)
mov    -0x10(%rbp),%rcx
add    $0x1,%rcx
mov    -0x20(%rbp),%rax
mov    %rcx,(%rax)
jmp    1283 <__split_attr+0x153>
mov    -0x10(%rbp),%rcx
mov    -0x20(%rbp),%rax
mov    %rcx,(%rax)
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__split_attr>:
push   %rbp
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rdi,%rbx
mov    %rdi,(%rsi)
movsbl (%rdi),%edi
call   1050 <isalpha@plt>
xor    %ebp,%ebp
test   %eax,%eax
je     11a1 <__split_attr+0x71>
nopl   0x0(%rax,%rax,1)
add    $0x1,%rbx
movsbl -0x1(%rbx),%edi
call   1040 <isalnum@plt>
test   %rax,%rax
jne    1150 <__split_attr+0x20>
movzbl -0x1(%rbx),%eax
cmp    $0x2d,%al
je     1150 <__split_attr+0x20>
cmp    $0x5f,%al
je     1150 <__split_attr+0x20>
cmp    $0x3d,%al
jne    11a1 <__split_attr+0x71>
movb   $0x0,-0x1(%rbx)
cmpb   $0x22,(%rbx)
jne    1199 <__split_attr+0x69>
mov    %rbx,%rdi
call   1030 <strlen@plt>
cmp    $0x2,%eax
jl     11a1 <__split_attr+0x71>
add    $0xffffffff,%eax
cmpb   $0x22,(%rbx,%rax,1)
jne    11a1 <__split_attr+0x71>
movb   $0x22,(%rbx,%rax,1)
add    $0x1,%rbx
mov    %rbx,(%r14)
mov    $0x1,%ebp
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @__split_attr(i8* %0, i8** %1, i8** %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8**
%7 = alloca i8**
%8 = alloca i32
store i8* %0, i8** %5
store i8** %1, i8*** %6
store i8** %2, i8*** %7
%9 = load i8*, i8** %5
%10 = load i8**, i8*** %6
store i8* %9, i8** %10
%11 = load i8*, i8** %5
%12 = load i8, i8* %11
%13 = call i32 @isalpha(i8 signext %12)
%14 = icmp ne i32 %13, 0
br i1 %14, label %16, label %15
15: ; preds = %3
store i32 0, i32* %4
br label %78
16: ; preds = %3
br label %17
17: ; preds = %34, %16
%18 = load i8*, i8** %5
%19 = load i8, i8* %18
%20 = call i64 @isalnum(i8 signext %19)
%21 = icmp ne i64 %20, 0
br i1 %21, label %32, label %22
22: ; preds = %17
%23 = load i8*, i8** %5
%24 = load i8, i8* %23
%25 = sext i8 %24 to i32
%26 = icmp eq i32 %25, 95
br i1 %26, label %32, label %27
27: ; preds = %22
%28 = load i8*, i8** %5
%29 = load i8, i8* %28
%30 = sext i8 %29 to i32
%31 = icmp eq i32 %30, 45
br label %32
32: ; preds = %27, %22, %17
%33 = phi i1 [ true, %22 ], [ true, %17 ], [ %31, %27 ]
br i1 %33, label %34, label %37
34: ; preds = %32
%35 = load i8*, i8** %5
%36 = getelementptr inbounds i8, i8* %35, i32 1
store i8* %36, i8** %5
br label %17
37: ; preds = %32
%38 = load i8*, i8** %5
%39 = load i8, i8* %38
%40 = sext i8 %39 to i32
%41 = icmp ne i32 %40, 61
br i1 %41, label %42, label %43
42: ; preds = %37
store i32 0, i32* %4
br label %78
43: ; preds = %37
%44 = load i8*, i8** %5
%45 = getelementptr inbounds i8, i8* %44, i32 1
store i8* %45, i8** %5
store i8 0, i8* %44
%46 = load i8*, i8** %5
%47 = load i8, i8* %46
%48 = sext i8 %47 to i32
%49 = icmp eq i32 %48, 34
br i1 %49, label %50, label %74
50: ; preds = %43
%51 = load i8*, i8** %5
%52 = call i32 @strlen(i8* %51)
store i32 %52, i32* %8
%53 = load i32, i32* %8
%54 = icmp slt i32 %53, 2
br i1 %54, label %64, label %55
55: ; preds = %50
%56 = load i8*, i8** %5
%57 = load i32, i32* %8
%58 = sub nsw i32 %57, 1
%59 = sext i32 %58 to i64
%60 = getelementptr inbounds i8, i8* %56, i64 %59
%61 = load i8, i8* %60
%62 = sext i8 %61 to i32
%63 = icmp ne i32 %62, 34
br i1 %63, label %64, label %65
64: ; preds = %55, %50
store i32 0, i32* %4
br label %78
65: ; preds = %55
%66 = load i8*, i8** %5
%67 = load i32, i32* %8
%68 = sub nsw i32 %67, 1
%69 = sext i32 %68 to i64
%70 = getelementptr inbounds i8, i8* %66, i64 %69
store i8 34, i8* %70
%71 = load i8*, i8** %5
%72 = getelementptr inbounds i8, i8* %71, i64 1
%73 = load i8**, i8*** %7
store i8* %72, i8** %73
br label %77
74: ; preds = %43
%75 = load i8*, i8** %5
%76 = load i8**, i8*** %7
store i8* %75, i8** %76
br label %77
77: ; preds = %74, %65
store i32 1, i32* %4
br label %78
78: ; preds = %77, %64, %42, %15
%79 = load i32, i32* %4
ret i32 %79
}

LLVM IR (-O2):
define i32 @__split_attr(i8* %0, i8** nocapture writeonly %1, i8** nocapture writeonly %2) {
store i8* %0, i8** %1
%4 = load i8, i8* %0
%5 = tail call i32 @isalpha(i8 signext %4)
%6 = icmp eq i32 %5, 0
br i1 %6, label %33, label %7
7: ; preds = %3, %14
%8 = phi i8* [ %15, %14 ], [ %0, %3 ]
%9 = load i8, i8* %8
%10 = tail call i64 @isalnum(i8 signext %9)
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %7
%13 = load i8, i8* %8
switch i8 %13, label %33 [
i8 95, label %14
i8 45, label %14
i8 61, label %16
]
14: ; preds = %12, %12, %7
%15 = getelementptr inbounds i8, i8* %8, i64 1
br label %7
16: ; preds = %12
%17 = getelementptr inbounds i8, i8* %8, i64 1
store i8 0, i8* %8
%18 = load i8, i8* %17
%19 = icmp eq i8 %18, 34
br i1 %19, label %20, label %31
20: ; preds = %16
%21 = tail call i32 @strlen(i8* %17)
%22 = icmp slt i32 %21, 2
br i1 %22, label %33, label %23
23: ; preds = %20
%24 = add nsw i32 %21, -1
%25 = zext i32 %24 to i64
%26 = getelementptr inbounds i8, i8* %17, i64 %25
%27 = load i8, i8* %26
%28 = icmp eq i8 %27, 34
br i1 %28, label %29, label %33
29: ; preds = %23
store i8 34, i8* %26
%30 = getelementptr inbounds i8, i8* %8, i64 2
br label %31
31: ; preds = %16, %29
%32 = phi i8* [ %30, %29 ], [ %17, %16 ]
store i8* %32, i8** %2
br label %33
33: ; preds = %12, %31, %20, %23, %3
%34 = phi i32 [ 0, %3 ], [ 0, %23 ], [ 0, %20 ], [ 1, %31 ], [ 0, %12 ]
ret i32 %34
}