#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*/ skipNextComma(char **);
int /*<<< orphan*/ skipWhiteSpace(char **);
char *strsep(char **, char *);
char *nextTok(char **p_cur) {
  char *ret = NULL;
  skipWhiteSpace(p_cur);
  if (*p_cur == NULL) {
    ret = NULL;
  } else if (**p_cur == '"') {
    (*p_cur)++;
    ret = strsep(p_cur, "\"");
    skipNextComma(p_cur);
  } else {
    ret = strsep(p_cur, ",");
  }
  return ret;
}


x86 assembly (clang, -O0):
<nextTok>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <skipWhiteSpace@plt>
mov    -0x8(%rbp),%rax
cmpq   $0x0,(%rax)
jne    1168 <nextTok+0x38>
movq   $0x0,-0x10(%rbp)
jmp    11c4 <nextTok+0x94>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%eax
cmp    $0x22,%eax
jne    11ab <nextTok+0x7b>
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
add    $0x1,%rcx
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rdi
lea    0xe6c(%rip),%rsi
call   1040 <strsep@plt>
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <skipNextComma@plt>
jmp    11bf <nextTok+0x8f>
mov    -0x8(%rbp),%rdi
lea    0xe4c(%rip),%rsi
call   1040 <strsep@plt>
mov    %rax,-0x10(%rbp)
jmp    11c4 <nextTok+0x94>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nextTok>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1030 <skipWhiteSpace@plt>
mov    (%rbx),%rax
test   %rax,%rax
je     116f <nextTok+0x3f>
cmpb   $0x22,(%rax)
jne    1179 <nextTok+0x49>
add    $0x1,%rax
mov    %rax,(%rbx)
lea    0xea9(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strsep@plt>
mov    %rax,%r14
mov    %rbx,%rdi
call   1050 <skipNextComma@plt>
mov    %r14,%rax
jmp    1171 <nextTok+0x41>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
lea    0xe82(%rip),%rsi
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <strsep@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"\22\00"
@.str.1 = [2 x i8] c",\00"
define i8* @nextTok(i8** %0) {
%2 = alloca i8**
%3 = alloca i8*
store i8** %0, i8*** %2
store i8* null, i8** %3
%4 = load i8**, i8*** %2
%5 = call i32 @skipWhiteSpace(i8** %4)
%6 = load i8**, i8*** %2
%7 = load i8*, i8** %6
%8 = icmp eq i8* %7, null
br i1 %8, label %9, label %10
9: ; preds = %1
store i8* null, i8** %3
br label %28
10: ; preds = %1
%11 = load i8**, i8*** %2
%12 = load i8*, i8** %11
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = icmp eq i32 %14, 34
br i1 %15, label %16, label %24
16: ; preds = %10
%17 = load i8**, i8*** %2
%18 = load i8*, i8** %17
%19 = getelementptr inbounds i8, i8* %18, i32 1
store i8* %19, i8** %17
%20 = load i8**, i8*** %2
%21 = call i8* @strsep(i8** %20, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i8* %21, i8** %3
%22 = load i8**, i8*** %2
%23 = call i32 @skipNextComma(i8** %22)
br label %27
24: ; preds = %10
%25 = load i8**, i8*** %2
%26 = call i8* @strsep(i8** %25, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i8* %26, i8** %3
br label %27
27: ; preds = %24, %16
br label %28
28: ; preds = %27, %9
%29 = load i8*, i8** %3
ret i8* %29
}

LLVM IR (-O2):
@.str = [2 x i8] c"\22\00"
@.str.1 = [2 x i8] c",\00"
define i8* @nextTok(i8** %0) {
%2 = tail call i32 @skipWhiteSpace(i8** %0)
%3 = load i8*, i8** %0
%4 = icmp eq i8* %3, null
br i1 %4, label %14, label %5
5: ; preds = %1
%6 = load i8, i8* %3
%7 = icmp eq i8 %6, 34
br i1 %7, label %8, label %12
8: ; preds = %5
%9 = getelementptr inbounds i8, i8* %3, i64 1
store i8* %9, i8** %0
%10 = tail call i8* @strsep(i8** %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%11 = tail call i32 @skipNextComma(i8** %0)
br label %14
12: ; preds = %5
%13 = tail call i8* @strsep(i8** %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %14
14: ; preds = %1, %8, %12
%15 = phi i8* [ %10, %8 ], [ %13, %12 ], [ null, %1 ]
ret i8* %15
}