#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 */
struct slName {
  int dummy;
};

/* Variables and functions */
char *cloneString(char *);
int /*<<< orphan*/ errAbort(char *, char, char *);
int /*<<< orphan*/ freeMem(char *);
struct slName *newSlName(char *);
int /*<<< orphan*/ parseQuotedString(char *, char *, char **);
char *skipLeadingSpaces(char *);
char *skipToSpaces(char *);
int /*<<< orphan*/ slAddHead(struct slName **, struct slName *);
int /*<<< orphan*/ slReverse(struct slName **);
struct slName *stringToSlNames(char *string) {
  struct slName *list = NULL, *name;
  char *dupe = cloneString(string);
  char c, *s = dupe, *e;
  for (;;) {
    if ((s = skipLeadingSpaces(s)) == NULL)
      break;
    if ((c = *s) == 0)
      break;
    if (c == '\'' || c == '"') {
      if (!parseQuotedString(s, s, &e))
        errAbort("missing closing %c in %s", c, string);
    } else {
      e = skipToSpaces(s);
      if (e != NULL)
        *e++ = 0;
    }
    name = newSlName(s);
    slAddHead(&list, name);
    s = e;
  }
  freeMem(dupe);
  slReverse(&list);
  return list;
}


x86 assembly (clang, -O0):
<stringToSlNames>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1080 <cloneString@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdi
call   1060 <skipLeadingSpaces@plt>
mov    %rax,-0x30(%rbp)
cmp    $0x0,%rax
jne    11d5 <stringToSlNames+0x45>
jmp    1294 <stringToSlNames+0x104>
mov    -0x30(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x21(%rbp)
movsbl %al,%eax
cmp    $0x0,%eax
jne    11ef <stringToSlNames+0x5f>
jmp    1294 <stringToSlNames+0x104>
movsbl -0x21(%rbp),%eax
cmp    $0x27,%eax
je     1209 <stringToSlNames+0x79>
movsbl -0x21(%rbp),%eax
cmp    $0x22,%eax
jne    123e <stringToSlNames+0xae>
mov    -0x30(%rbp),%rdi
mov    -0x30(%rbp),%rsi
lea    -0x38(%rbp),%rdx
call   10a0 <parseQuotedString@plt>
cmp    $0x0,%eax
jne    1239 <stringToSlNames+0xa9>
mov    -0x21(%rbp),%al
mov    -0x8(%rbp),%rdx
lea    0xdcf(%rip),%rdi
movsbl %al,%esi
call   1050 <errAbort@plt>
jmp    126d <stringToSlNames+0xdd>
mov    -0x30(%rbp),%rdi
call   10b0 <skipToSpaces@plt>
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x38(%rbp)
je     1268 <stringToSlNames+0xd8>
mov    -0x38(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x38(%rbp)
movb   $0x0,(%rax)
jmp    126d <stringToSlNames+0xdd>
mov    -0x30(%rbp),%rdi
call   1090 <newSlName@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
lea    -0x10(%rbp),%rdi
call   1040 <slAddHead@plt>
mov    -0x38(%rbp),%rax
mov    %rax,-0x30(%rbp)
jmp    11b9 <stringToSlNames+0x29>
mov    -0x20(%rbp),%rdi
call   1030 <freeMem@plt>
lea    -0x10(%rbp),%rdi
call   1070 <slReverse@plt>
mov    -0x10(%rbp),%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stringToSlNames>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rdi,%r15
movq   $0x0,0x10(%rsp)
call   1080 <cloneString@plt>
mov    %rax,%r14
mov    %rax,%rdi
call   1060 <skipLeadingSpaces@plt>
test   %rax,%rax
je     1265 <stringToSlNames+0xd5>
mov    %rax,%rbp
lea    0x8(%rsp),%r13
lea    0x10(%rsp),%rbx
jmp    1217 <stringToSlNames+0x87>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %rbp,%rdi
mov    %rbp,%rsi
mov    %r13,%rdx
call   10a0 <parseQuotedString@plt>
test   %eax,%eax
je     1250 <stringToSlNames+0xc0>
mov    %rbp,%rdi
call   1090 <newSlName@plt>
mov    %rbx,%rdi
mov    %rax,%rsi
call   1040 <slAddHead@plt>
mov    0x8(%rsp),%rdi
call   1060 <skipLeadingSpaces@plt>
mov    %rax,%rbp
test   %rax,%rax
je     1265 <stringToSlNames+0xd5>
movzbl 0x0(%rbp),%r12d
cmp    $0x22,%r12b
je     11e0 <stringToSlNames+0x50>
cmp    $0x27,%r12b
je     11e0 <stringToSlNames+0x50>
test   %r12b,%r12b
je     1265 <stringToSlNames+0xd5>
mov    %rbp,%rdi
call   10b0 <skipToSpaces@plt>
mov    %rax,0x8(%rsp)
test   %rax,%rax
je     11f2 <stringToSlNames+0x62>
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,0x8(%rsp)
movb   $0x0,(%rax)
jmp    11f2 <stringToSlNames+0x62>
movsbl %r12b,%esi
lea    0xda5(%rip),%rdi
mov    %r15,%rdx
call   1050 <errAbort@plt>
jmp    11f2 <stringToSlNames+0x62>
mov    %r14,%rdi
call   1030 <freeMem@plt>
lea    0x10(%rsp),%rdi
call   1070 <slReverse@plt>
mov    0x10(%rsp),%rax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.slName = type { i32 }
@.str = [25 x i8] c"missing closing %c in %s\00"
define %struct.slName* @stringToSlNames(i8* %0) {
%2 = alloca i8*
%3 = alloca %struct.slName*
%4 = alloca %struct.slName*
%5 = alloca i8*
%6 = alloca i8
%7 = alloca i8*
%8 = alloca i8*
store i8* %0, i8** %2
store %struct.slName* null, %struct.slName** %3
%9 = load i8*, i8** %2
%10 = call i8* @cloneString(i8* %9)
store i8* %10, i8** %5
%11 = load i8*, i8** %5
store i8* %11, i8** %7
br label %12
12: ; preds = %50, %1
%13 = load i8*, i8** %7
%14 = call i8* @skipLeadingSpaces(i8* %13)
store i8* %14, i8** %7
%15 = icmp eq i8* %14, null
br i1 %15, label %16, label %17
16: ; preds = %12
br label %56
17: ; preds = %12
%18 = load i8*, i8** %7
%19 = load i8, i8* %18
store i8 %19, i8* %6
%20 = sext i8 %19 to i32
%21 = icmp eq i32 %20, 0
br i1 %21, label %22, label %23
22: ; preds = %17
br label %56
23: ; preds = %17
%24 = load i8, i8* %6
%25 = sext i8 %24 to i32
%26 = icmp eq i32 %25, 39
br i1 %26, label %31, label %27
27: ; preds = %23
%28 = load i8, i8* %6
%29 = sext i8 %28 to i32
%30 = icmp eq i32 %29, 34
br i1 %30, label %31, label %41
31: ; preds = %27, %23
%32 = load i8*, i8** %7
%33 = load i8*, i8** %7
%34 = call i32 @parseQuotedString(i8* %32, i8* %33, i8** %8)
%35 = icmp ne i32 %34, 0
br i1 %35, label %40, label %36
36: ; preds = %31
%37 = load i8, i8* %6
%38 = load i8*, i8** %2
%39 = call i32 @errAbort(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8 signext %37, i8* %38)
br label %40
40: ; preds = %36, %31
br label %50
41: ; preds = %27
%42 = load i8*, i8** %7
%43 = call i8* @skipToSpaces(i8* %42)
store i8* %43, i8** %8
%44 = load i8*, i8** %8
%45 = icmp ne i8* %44, null
br i1 %45, label %46, label %49
46: ; preds = %41
%47 = load i8*, i8** %8
%48 = getelementptr inbounds i8, i8* %47, i32 1
store i8* %48, i8** %8
store i8 0, i8* %47
br label %49
49: ; preds = %46, %41
br label %50
50: ; preds = %49, %40
%51 = load i8*, i8** %7
%52 = call %struct.slName* @newSlName(i8* %51)
store %struct.slName* %52, %struct.slName** %4
%53 = load %struct.slName*, %struct.slName** %4
%54 = call i32 @slAddHead(%struct.slName** %3, %struct.slName* %53)
%55 = load i8*, i8** %8
store i8* %55, i8** %7
br label %12
56: ; preds = %22, %16
%57 = load i8*, i8** %5
%58 = call i32 @freeMem(i8* %57)
%59 = call i32 @slReverse(%struct.slName** %3)
%60 = load %struct.slName*, %struct.slName** %3
ret %struct.slName* %60
}

LLVM IR (-O2):
%struct.slName = type { i32 }
@.str = [25 x i8] c"missing closing %c in %s\00"
define %struct.slName* @stringToSlNames(i8* %0) {
%2 = alloca %struct.slName*
%3 = alloca i8*
%4 = bitcast %struct.slName** %2 to i8*
store %struct.slName* null, %struct.slName** %2
%5 = tail call i8* @cloneString(i8* %0)
%6 = bitcast i8** %3 to i8*
%7 = call i8* @skipLeadingSpaces(i8* %5)
%8 = icmp eq i8* %7, null
br i1 %8, label %28, label %9
9: ; preds = %1, %22
%10 = phi i8* [ %26, %22 ], [ %7, %1 ]
%11 = load i8, i8* %10
switch i8 %11, label %17 [
i8 0, label %28
i8 39, label %12
i8 34, label %12
]
12: ; preds = %9, %9
%13 = call i32 @parseQuotedString(i8* %10, i8* %10, i8** %3)
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %22
15: ; preds = %12
%16 = call i32 @errAbort(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8 signext %11, i8* %0)
br label %22
17: ; preds = %9
%18 = call i8* @skipToSpaces(i8* %10)
store i8* %18, i8** %3
%19 = icmp eq i8* %18, null
br i1 %19, label %22, label %20
20: ; preds = %17
%21 = getelementptr inbounds i8, i8* %18, i64 1
store i8* %21, i8** %3
store i8 0, i8* %18
br label %22
22: ; preds = %17, %20, %12, %15
%23 = call %struct.slName* @newSlName(i8* %10)
%24 = call i32 @slAddHead(%struct.slName** %2, %struct.slName* %23)
%25 = load i8*, i8** %3
%26 = call i8* @skipLeadingSpaces(i8* %25)
%27 = icmp eq i8* %26, null
br i1 %27, label %28, label %9
28: ; preds = %22, %9, %1
%29 = call i32 @freeMem(i8* %5)
%30 = call i32 @slReverse(%struct.slName** %2)
%31 = load %struct.slName*, %struct.slName** %2
ret %struct.slName* %31
}