#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 *strchr(char const *, char);
int strlen(char *);
char *get_multiple_arg_token_next(const char *arg) {
  char *tok;
  if (!arg)
    return 0;
  tok = strchr(arg, ',');
  while (tok) {
    if (*(tok - 1) == '\\') {
      tok = strchr(tok + 1, ',');
    } else
      break;
  }
  if (!tok || strlen(tok) == 1)
    return 0;
  return tok + 1;
}


x86 assembly (clang, -O0):
<get_multiple_arg_token_next>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1144 <get_multiple_arg_token_next+0x24>
movq   $0x0,-0x8(%rbp)
jmp    11cd <get_multiple_arg_token_next+0xad>
mov    -0x10(%rbp),%rdi
mov    $0x2c,%esi
call   1040 <strchr@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1197 <get_multiple_arg_token_next+0x77>
mov    -0x18(%rbp),%rax
movsbl -0x1(%rax),%eax
cmp    $0x5c,%eax
jne    118d <get_multiple_arg_token_next+0x6d>
mov    -0x18(%rbp),%rdi
add    $0x1,%rdi
mov    $0x2c,%esi
call   1040 <strchr@plt>
mov    %rax,-0x18(%rbp)
jmp    1192 <get_multiple_arg_token_next+0x72>
jmp    1197 <get_multiple_arg_token_next+0x77>
jmp    1156 <get_multiple_arg_token_next+0x36>
cmpq   $0x0,-0x18(%rbp)
je     11b4 <get_multiple_arg_token_next+0x94>
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x1,%eax
jne    11c1 <get_multiple_arg_token_next+0xa1>
movq   $0x0,-0x8(%rbp)
jmp    11cd <get_multiple_arg_token_next+0xad>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_multiple_arg_token_next>:
push   %r14
push   %rbx
push   %rax
test   %rdi,%rdi
je     1161 <get_multiple_arg_token_next+0x41>
mov    $0x2c,%esi
call   1040 <strchr@plt>
test   %rax,%rax
je     1161 <get_multiple_arg_token_next+0x41>
mov    %rax,%rbx
xor    %r14d,%r14d
xchg   %ax,%ax
cmpb   $0x5c,-0x1(%rbx)
jne    1166 <get_multiple_arg_token_next+0x46>
add    $0x1,%rbx
mov    %rbx,%rdi
mov    $0x2c,%esi
call   1040 <strchr@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1140 <get_multiple_arg_token_next+0x20>
jmp    117c <get_multiple_arg_token_next+0x5c>
xor    %r14d,%r14d
jmp    117c <get_multiple_arg_token_next+0x5c>
mov    %rbx,%rdi
call   1030 <strlen@plt>
add    $0x1,%rbx
xor    %r14d,%r14d
cmp    $0x1,%eax
cmovne %rbx,%r14
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @get_multiple_arg_token_next(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = icmp ne i8* %5, null
br i1 %6, label %8, label %7
7: ; preds = %1
store i8* null, i8** %2
br label %37
8: ; preds = %1
%9 = load i8*, i8** %3
%10 = call i8* @strchr(i8* %9, i8 signext 44)
store i8* %10, i8** %4
br label %11
11: ; preds = %25, %8
%12 = load i8*, i8** %4
%13 = icmp ne i8* %12, null
br i1 %13, label %14, label %26
14: ; preds = %11
%15 = load i8*, i8** %4
%16 = getelementptr inbounds i8, i8* %15, i64 -1
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = icmp eq i32 %18, 92
br i1 %19, label %20, label %24
20: ; preds = %14
%21 = load i8*, i8** %4
%22 = getelementptr inbounds i8, i8* %21, i64 1
%23 = call i8* @strchr(i8* %22, i8 signext 44)
store i8* %23, i8** %4
br label %25
24: ; preds = %14
br label %26
25: ; preds = %20
br label %11
26: ; preds = %24, %11
%27 = load i8*, i8** %4
%28 = icmp ne i8* %27, null
br i1 %28, label %29, label %33
29: ; preds = %26
%30 = load i8*, i8** %4
%31 = call i32 @strlen(i8* %30)
%32 = icmp eq i32 %31, 1
br i1 %32, label %33, label %34
33: ; preds = %29, %26
store i8* null, i8** %2
br label %37
34: ; preds = %29
%35 = load i8*, i8** %4
%36 = getelementptr inbounds i8, i8* %35, i64 1
store i8* %36, i8** %2
br label %37
37: ; preds = %34, %33, %7
%38 = load i8*, i8** %2
ret i8* %38
}

LLVM IR (-O2):
define i8* @get_multiple_arg_token_next(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %20, label %3
3: ; preds = %1
%4 = tail call i8* @strchr(i8* %0, i8 signext 44)
%5 = icmp eq i8* %4, null
br i1 %5, label %20, label %6
6: ; preds = %3, %11
%7 = phi i8* [ %13, %11 ], [ %4, %3 ]
%8 = getelementptr inbounds i8, i8* %7, i64 -1
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 92
br i1 %10, label %11, label %15
11: ; preds = %6
%12 = getelementptr inbounds i8, i8* %7, i64 1
%13 = tail call i8* @strchr(i8* %12, i8 signext 44)
%14 = icmp eq i8* %13, null
br i1 %14, label %20, label %6
15: ; preds = %6
%16 = tail call i32 @strlen(i8* %7)
%17 = icmp eq i32 %16, 1
%18 = getelementptr inbounds i8, i8* %7, i64 1
%19 = select i1 %17, i8* null, i8* %18
br label %20
20: ; preds = %11, %3, %15, %1
%21 = phi i8* [ null, %1 ], [ %19, %15 ], [ null, %3 ], [ null, %11 ]
ret i8* %21
}