#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 *cstring_skip_white(char *);
int /*<<< orphan*/ cstring_split_at_char(char *, char **, int);
int /*<<< orphan*/ cstring_split_at_white(char *, char **);
char *cstring_split_quoted(char *str, char **next) {
  char *res = cstring_skip_white(str);
  int sep = 0;
  switch (*res) {
  case '(':
    sep = ')';
    break;
  case '[':
    sep = ']';
    break;
  case '{':
    sep = '}';
    break;
  case '<':
    sep = '>';
    break;
  case '"':
    sep = '"';
    break;
  case '\'':
    sep = '\'';
    break;
  }
  if (sep != 0) {
    cstring_split_at_char(++res, next, sep);
  } else {
    cstring_split_at_white(res, next);
  }
  return res;
}


x86 assembly (clang, -O0):
<cstring_split_quoted>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <cstring_skip_white@plt>
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
mov    %eax,-0x20(%rbp)
sub    $0x22,%eax
je     11f1 <cstring_split_quoted+0xc1>
jmp    116c <cstring_split_quoted+0x3c>
mov    -0x20(%rbp),%eax
sub    $0x27,%eax
je     11fd <cstring_split_quoted+0xcd>
jmp    117d <cstring_split_quoted+0x4d>
mov    -0x20(%rbp),%eax
sub    $0x28,%eax
je     11c1 <cstring_split_quoted+0x91>
jmp    118e <cstring_split_quoted+0x5e>
mov    -0x20(%rbp),%eax
sub    $0x3c,%eax
je     11e5 <cstring_split_quoted+0xb5>
jmp    119f <cstring_split_quoted+0x6f>
mov    -0x20(%rbp),%eax
sub    $0x5b,%eax
je     11cd <cstring_split_quoted+0x9d>
jmp    11b0 <cstring_split_quoted+0x80>
mov    -0x20(%rbp),%eax
sub    $0x7b,%eax
je     11d9 <cstring_split_quoted+0xa9>
jmp    1204 <cstring_split_quoted+0xd4>
movl   $0x29,-0x1c(%rbp)
jmp    1204 <cstring_split_quoted+0xd4>
movl   $0x5d,-0x1c(%rbp)
jmp    1204 <cstring_split_quoted+0xd4>
movl   $0x7d,-0x1c(%rbp)
jmp    1204 <cstring_split_quoted+0xd4>
movl   $0x3e,-0x1c(%rbp)
jmp    1204 <cstring_split_quoted+0xd4>
movl   $0x22,-0x1c(%rbp)
jmp    1204 <cstring_split_quoted+0xd4>
movl   $0x27,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
je     122b <cstring_split_quoted+0xfb>
mov    -0x18(%rbp),%rdi
add    $0x1,%rdi
mov    %rdi,-0x18(%rbp)
mov    -0x10(%rbp),%rsi
mov    -0x1c(%rbp),%edx
call   1040 <cstring_split_at_char@plt>
jmp    1238 <cstring_split_quoted+0x108>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1050 <cstring_split_at_white@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cstring_split_quoted>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
call   1030 <cstring_skip_white@plt>
mov    %rax,%rbx
movsbl (%rax),%eax
lea    -0x22(%rax),%ecx
cmp    $0x1a,%ecx
ja     1163 <cstring_split_quoted+0x33>
mov    $0x29,%edx
lea    0xeaa(%rip),%rsi
movslq (%rsi,%rcx,4),%rcx
add    %rsi,%rcx
jmp    *%rcx
mov    %eax,%edx
jmp    118d <cstring_split_quoted+0x5d>
cmp    $0x7b,%eax
je     1188 <cstring_split_quoted+0x58>
cmp    $0x5b,%eax
jne    1174 <cstring_split_quoted+0x44>
mov    $0x5d,%edx
jmp    118d <cstring_split_quoted+0x5d>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <cstring_split_at_white@plt>
jmp    119c <cstring_split_quoted+0x6c>
mov    $0x3e,%edx
jmp    118d <cstring_split_quoted+0x5d>
mov    $0x7d,%edx
add    $0x1,%rbx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <cstring_split_at_char@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @cstring_split_quoted(i8* %0, i8** %1) {
%3 = alloca i8*
%4 = alloca i8**
%5 = alloca i8*
%6 = alloca i32
store i8* %0, i8** %3
store i8** %1, i8*** %4
%7 = load i8*, i8** %3
%8 = call i8* @cstring_skip_white(i8* %7)
store i8* %8, i8** %5
store i32 0, i32* %6
%9 = load i8*, i8** %5
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
switch i32 %11, label %18 [
i32 40, label %12
i32 91, label %13
i32 123, label %14
i32 60, label %15
i32 34, label %16
i32 39, label %17
]
12: ; preds = %2
store i32 41, i32* %6
br label %18
13: ; preds = %2
store i32 93, i32* %6
br label %18
14: ; preds = %2
store i32 125, i32* %6
br label %18
15: ; preds = %2
store i32 62, i32* %6
br label %18
16: ; preds = %2
store i32 34, i32* %6
br label %18
17: ; preds = %2
store i32 39, i32* %6
br label %18
18: ; preds = %2, %17, %16, %15, %14, %13, %12
%19 = load i32, i32* %6
%20 = icmp ne i32 %19, 0
br i1 %20, label %21, label %27
21: ; preds = %18
%22 = load i8*, i8** %5
%23 = getelementptr inbounds i8, i8* %22, i32 1
store i8* %23, i8** %5
%24 = load i8**, i8*** %4
%25 = load i32, i32* %6
%26 = call i32 @cstring_split_at_char(i8* %23, i8** %24, i32 %25)
br label %31
27: ; preds = %18
%28 = load i8*, i8** %5
%29 = load i8**, i8*** %4
%30 = call i32 @cstring_split_at_white(i8* %28, i8** %29)
br label %31
31: ; preds = %27, %21
%32 = load i8*, i8** %5
ret i8* %32
}

LLVM IR (-O2):
define i8* @cstring_split_quoted(i8* %0, i8** %1) {
%3 = tail call i8* @cstring_skip_white(i8* %0)
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
switch i32 %5, label %15 [
i32 40, label %11
i32 91, label %6
i32 123, label %7
i32 60, label %8
i32 34, label %9
i32 39, label %10
]
6: ; preds = %2
br label %11
7: ; preds = %2
br label %11
8: ; preds = %2
br label %11
9: ; preds = %2
br label %11
10: ; preds = %2
br label %11
11: ; preds = %2, %10, %9, %8, %7, %6
%12 = phi i32 [ 93, %6 ], [ 125, %7 ], [ 62, %8 ], [ %5, %9 ], [ %5, %10 ], [ 41, %2 ]
%13 = getelementptr inbounds i8, i8* %3, i64 1
%14 = tail call i32 @cstring_split_at_char(i8* %13, i8** %1, i32 %12)
br label %17
15: ; preds = %2
%16 = tail call i32 @cstring_split_at_white(i8* %3, i8** %1)
br label %17
17: ; preds = %15, %11
%18 = phi i8* [ %13, %11 ], [ %3, %15 ]
ret i8* %18
}