#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 *chl_next_arg(char *args) {
  static char *pt;
  char *arg;
  char delim;
  if (args != NULL)
    pt = args;
  while (((*pt != '"') && (*pt != '\'')) && (*pt != '\0'))
    pt++;
  delim = *pt;
  if (*pt == '\0')
    return 0;
  arg = ++pt;
  while ((*pt != delim) && (*pt != '\0'))
    pt++;
  if (*pt == '\0')
    return 0;
  *(pt++) = '\0';
  return arg;
}


x86 assembly (clang, -O0):
<chl_next_arg>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     111e <chl_next_arg+0x1e>
mov    -0x10(%rbp),%rax
mov    %rax,0x2f0a(%rip)
jmp    1123 <chl_next_arg+0x23>
mov    0x2efe(%rip),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x22,%ecx
mov    %al,-0x1a(%rbp)
je     1166 <chl_next_arg+0x66>
mov    0x2ee6(%rip),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x27,%ecx
mov    %al,-0x1a(%rbp)
je     1166 <chl_next_arg+0x66>
mov    0x2ece(%rip),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x1a(%rbp)
mov    -0x1a(%rbp),%al
test   $0x1,%al
jne    1176 <chl_next_arg+0x76>
jmp    118d <chl_next_arg+0x8d>
mov    0x2eab(%rip),%rax
add    $0x1,%rax
mov    %rax,0x2ea0(%rip)
jmp    1123 <chl_next_arg+0x23>
mov    0x2e94(%rip),%rax
mov    (%rax),%al
mov    %al,-0x19(%rbp)
mov    0x2e88(%rip),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    11b9 <chl_next_arg+0xb9>
movq   $0x0,-0x8(%rbp)
jmp    1264 <chl_next_arg+0x164>
mov    0x2e68(%rip),%rax
add    $0x1,%rax
mov    %rax,0x2e5d(%rip)
mov    %rax,-0x18(%rbp)
mov    0x2e52(%rip),%rax
movsbl (%rax),%ecx
movsbl -0x19(%rbp),%edx
xor    %eax,%eax
cmp    %edx,%ecx
mov    %al,-0x1b(%rbp)
je     11fd <chl_next_arg+0xfd>
mov    0x2e37(%rip),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x1b(%rbp)
mov    -0x1b(%rbp),%al
test   $0x1,%al
jne    120d <chl_next_arg+0x10d>
jmp    1224 <chl_next_arg+0x124>
mov    0x2e14(%rip),%rax
add    $0x1,%rax
mov    %rax,0x2e09(%rip)
jmp    11cf <chl_next_arg+0xcf>
mov    0x2dfd(%rip),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    1244 <chl_next_arg+0x144>
movq   $0x0,-0x8(%rbp)
jmp    1264 <chl_next_arg+0x164>
mov    0x2ddd(%rip),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,0x2dcf(%rip)
movb   $0x0,(%rax)
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<chl_next_arg>:
test   %rdi,%rdi
je     110a <chl_next_arg+0xa>
mov    %rdi,%rax
jmp    1113 <chl_next_arg+0x13>
mov    0x2f17(%rip),%rax
jmp    111a <chl_next_arg+0x1a>
mov    %rax,0x2f0e(%rip)
add    $0x1,%rax
mov    -0x1(%rax),%sil
test   %sil,%sil
je     116b <chl_next_arg+0x6b>
cmp    $0x22,%sil
je     1133 <chl_next_arg+0x33>
cmp    $0x27,%sil
jne    1113 <chl_next_arg+0x13>
mov    %rax,%rdx
cs nopw 0x0(%rax,%rax,1)
movzbl (%rdx),%ecx
add    $0x1,%rdx
cmp    %sil,%cl
je     1150 <chl_next_arg+0x50>
test   %cl,%cl
jne    1140 <chl_next_arg+0x40>
lea    -0x1(%rdx),%rsi
mov    %rsi,0x2ecd(%rip)
test   %cl,%cl
je     116b <chl_next_arg+0x6b>
mov    %rdx,0x2ec2(%rip)
movb   $0x0,-0x1(%rdx)
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
@chl_next_arg.pt = internal global i8* null
define i8* @chl_next_arg(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8
store i8* %0, i8** %3
%6 = load i8*, i8** %3
%7 = icmp ne i8* %6, null
br i1 %7, label %8, label %10
8: ; preds = %1
%9 = load i8*, i8** %3
store i8* %9, i8** @chl_next_arg.pt
br label %10
10: ; preds = %8, %1
br label %11
11: ; preds = %28, %10
%12 = load i8*, i8** @chl_next_arg.pt
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = icmp ne i32 %14, 34
br i1 %15, label %16, label %26
16: ; preds = %11
%17 = load i8*, i8** @chl_next_arg.pt
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = icmp ne i32 %19, 39
br i1 %20, label %21, label %26
21: ; preds = %16
%22 = load i8*, i8** @chl_next_arg.pt
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
%25 = icmp ne i32 %24, 0
br label %26
26: ; preds = %21, %16, %11
%27 = phi i1 [ false, %16 ], [ false, %11 ], [ %25, %21 ]
br i1 %27, label %28, label %31
28: ; preds = %26
%29 = load i8*, i8** @chl_next_arg.pt
%30 = getelementptr inbounds i8, i8* %29, i32 1
store i8* %30, i8** @chl_next_arg.pt
br label %11
31: ; preds = %26
%32 = load i8*, i8** @chl_next_arg.pt
%33 = load i8, i8* %32
store i8 %33, i8* %5
%34 = load i8*, i8** @chl_next_arg.pt
%35 = load i8, i8* %34
%36 = sext i8 %35 to i32
%37 = icmp eq i32 %36, 0
br i1 %37, label %38, label %39
38: ; preds = %31
store i8* null, i8** %2
br label %69
39: ; preds = %31
%40 = load i8*, i8** @chl_next_arg.pt
%41 = getelementptr inbounds i8, i8* %40, i32 1
store i8* %41, i8** @chl_next_arg.pt
store i8* %41, i8** %4
br label %42
42: ; preds = %56, %39
%43 = load i8*, i8** @chl_next_arg.pt
%44 = load i8, i8* %43
%45 = sext i8 %44 to i32
%46 = load i8, i8* %5
%47 = sext i8 %46 to i32
%48 = icmp ne i32 %45, %47
br i1 %48, label %49, label %54
49: ; preds = %42
%50 = load i8*, i8** @chl_next_arg.pt
%51 = load i8, i8* %50
%52 = sext i8 %51 to i32
%53 = icmp ne i32 %52, 0
br label %54
54: ; preds = %49, %42
%55 = phi i1 [ false, %42 ], [ %53, %49 ]
br i1 %55, label %56, label %59
56: ; preds = %54
%57 = load i8*, i8** @chl_next_arg.pt
%58 = getelementptr inbounds i8, i8* %57, i32 1
store i8* %58, i8** @chl_next_arg.pt
br label %42
59: ; preds = %54
%60 = load i8*, i8** @chl_next_arg.pt
%61 = load i8, i8* %60
%62 = sext i8 %61 to i32
%63 = icmp eq i32 %62, 0
br i1 %63, label %64, label %65
64: ; preds = %59
store i8* null, i8** %2
br label %69
65: ; preds = %59
%66 = load i8*, i8** @chl_next_arg.pt
%67 = getelementptr inbounds i8, i8* %66, i32 1
store i8* %67, i8** @chl_next_arg.pt
store i8 0, i8* %66
%68 = load i8*, i8** %4
store i8* %68, i8** %2
br label %69
69: ; preds = %65, %64, %38
%70 = load i8*, i8** %2
ret i8* %70
}

LLVM IR (-O2):
@chl_next_arg.pt = internal unnamed_addr global i8* null
define i8* @chl_next_arg(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = load i8*, i8** @chl_next_arg.pt
br label %6
5: ; preds = %1
store i8* %0, i8** @chl_next_arg.pt
br label %6
6: ; preds = %3, %5
%7 = phi i8* [ %0, %5 ], [ %4, %3 ]
br label %8
8: ; preds = %6, %11
%9 = phi i8* [ %12, %11 ], [ %7, %6 ]
%10 = load i8, i8* %9
switch i8 %10, label %11 [
i8 0, label %24
i8 34, label %13
i8 39, label %13
]
11: ; preds = %8
%12 = getelementptr inbounds i8, i8* %9, i64 1
store i8* %12, i8** @chl_next_arg.pt
br label %8
13: ; preds = %8, %8
%14 = getelementptr inbounds i8, i8* %9, i64 1
br label %15
15: ; preds = %15, %13
%16 = phi i8* [ %14, %13 ], [ %21, %15 ]
%17 = load i8, i8* %16
%18 = icmp eq i8 %17, %10
%19 = icmp eq i8 %17, 0
%20 = or i1 %18, %19
%21 = getelementptr inbounds i8, i8* %16, i64 1
br i1 %20, label %22, label %15
22: ; preds = %15
store i8* %16, i8** @chl_next_arg.pt
br i1 %19, label %24, label %23
23: ; preds = %22
store i8* %21, i8** @chl_next_arg.pt
store i8 0, i8* %16
br label %24
24: ; preds = %8, %22, %23
%25 = phi i8* [ %14, %23 ], [ null, %22 ], [ null, %8 ]
ret i8* %25
}