#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*/ errAbort(char *);
char *findStringEnd(char *, char);
char *strchr(char *, char);
char *sqlGetOptQuoteString(char **pS) {
  char *s = *pS;
  char *e;
  char c = *s;
  if (c == '"' || c == '\'') {
    s += 1;
    e = findStringEnd(s, c);
    *e++ = 0;
    if (*e++ != ',')
      errAbort("Expecting comma after string");
  } else {
    e = strchr(s, ',');
    *e++ = 0;
  }
  *pS = e;
  return s;
}


x86 assembly (clang, -O0):
<sqlGetOptQuoteString>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x19(%rbp)
movsbl -0x19(%rbp),%eax
cmp    $0x22,%eax
je     116a <sqlGetOptQuoteString+0x3a>
movsbl -0x19(%rbp),%eax
cmp    $0x27,%eax
jne    11c5 <sqlGetOptQuoteString+0x95>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
movsbl -0x19(%rbp),%esi
call   1050 <findStringEnd@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x18(%rbp)
movb   $0x0,(%rax)
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x18(%rbp)
movsbl (%rax),%eax
cmp    $0x2c,%eax
je     11c0 <sqlGetOptQuoteString+0x90>
lea    0xe45(%rip),%rdi
call   1040 <errAbort@plt>
jmp    11e9 <sqlGetOptQuoteString+0xb9>
mov    -0x10(%rbp),%rdi
mov    $0x2c,%esi
call   1030 <strchr@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x18(%rbp)
movb   $0x0,(%rax)
mov    -0x18(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sqlGetOptQuoteString>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
mov    (%rdi),%rbx
mov    (%rbx),%al
cmp    $0x27,%al
je     1145 <sqlGetOptQuoteString+0x15>
cmp    $0x22,%al
jne    116f <sqlGetOptQuoteString+0x3f>
add    $0x1,%rbx
movsbl %al,%esi
mov    %rbx,%rdi
call   1050 <findStringEnd@plt>
movb   $0x0,(%rax)
lea    0x2(%rax),%r15
cmpb   $0x2c,0x1(%rax)
je     1186 <sqlGetOptQuoteString+0x56>
lea    0xe98(%rip),%rdi
call   1040 <errAbort@plt>
jmp    1186 <sqlGetOptQuoteString+0x56>
mov    %rbx,%rdi
mov    $0x2c,%esi
call   1030 <strchr@plt>
mov    %rax,%r15
movb   $0x0,(%rax)
add    $0x1,%r15
mov    %r15,(%r14)
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [29 x i8] c"Expecting comma after string\00"
define i8* @sqlGetOptQuoteString(i8** %0) {
%2 = alloca i8**
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8
store i8** %0, i8*** %2
%6 = load i8**, i8*** %2
%7 = load i8*, i8** %6
store i8* %7, i8** %3
%8 = load i8*, i8** %3
%9 = load i8, i8* %8
store i8 %9, i8* %5
%10 = load i8, i8* %5
%11 = sext i8 %10 to i32
%12 = icmp eq i32 %11, 34
br i1 %12, label %17, label %13
13: ; preds = %1
%14 = load i8, i8* %5
%15 = sext i8 %14 to i32
%16 = icmp eq i32 %15, 39
br i1 %16, label %17, label %33
17: ; preds = %13, %1
%18 = load i8*, i8** %3
%19 = getelementptr inbounds i8, i8* %18, i64 1
store i8* %19, i8** %3
%20 = load i8*, i8** %3
%21 = load i8, i8* %5
%22 = call i8* @findStringEnd(i8* %20, i8 signext %21)
store i8* %22, i8** %4
%23 = load i8*, i8** %4
%24 = getelementptr inbounds i8, i8* %23, i32 1
store i8* %24, i8** %4
store i8 0, i8* %23
%25 = load i8*, i8** %4
%26 = getelementptr inbounds i8, i8* %25, i32 1
store i8* %26, i8** %4
%27 = load i8, i8* %25
%28 = sext i8 %27 to i32
%29 = icmp ne i32 %28, 44
br i1 %29, label %30, label %32
30: ; preds = %17
%31 = call i32 @errAbort(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
br label %32
32: ; preds = %30, %17
br label %38
33: ; preds = %13
%34 = load i8*, i8** %3
%35 = call i8* @strchr(i8* %34, i8 signext 44)
store i8* %35, i8** %4
%36 = load i8*, i8** %4
%37 = getelementptr inbounds i8, i8* %36, i32 1
store i8* %37, i8** %4
store i8 0, i8* %36
br label %38
38: ; preds = %33, %32
%39 = load i8*, i8** %4
%40 = load i8**, i8*** %2
store i8* %39, i8** %40
%41 = load i8*, i8** %3
ret i8* %41
}

LLVM IR (-O2):
@.str = [29 x i8] c"Expecting comma after string\00"
define i8* @sqlGetOptQuoteString(i8** nocapture %0) {
%2 = load i8*, i8** %0
%3 = load i8, i8* %2
switch i8 %3, label %13 [
i8 39, label %4
i8 34, label %4
]
4: ; preds = %1, %1
%5 = getelementptr inbounds i8, i8* %2, i64 1
%6 = tail call i8* @findStringEnd(i8* %5, i8 signext %3)
%7 = getelementptr inbounds i8, i8* %6, i64 1
store i8 0, i8* %6
%8 = getelementptr inbounds i8, i8* %6, i64 2
%9 = load i8, i8* %7
%10 = icmp eq i8 %9, 44
br i1 %10, label %16, label %11
11: ; preds = %4
%12 = tail call i32 @errAbort(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
br label %16
13: ; preds = %1
%14 = tail call i8* @strchr(i8* %2, i8 signext 44)
%15 = getelementptr inbounds i8, i8* %14, i64 1
store i8 0, i8* %14
br label %16
16: ; preds = %4, %11, %13
%17 = phi i8* [ %8, %11 ], [ %8, %4 ], [ %15, %13 ]
%18 = phi i8* [ %5, %11 ], [ %5, %4 ], [ %2, %13 ]
store i8* %17, i8** %0
ret i8* %18
}