#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 */
scalar_t__ isspace(unsigned char);
char *strchr(char *, char);
char *strpbrk(char *, char *);
char *next_arg(char **s) {
  char *r = *s;
  if (!r)
    return 0;
  while (isspace((unsigned char)(*r)))
    r++;
  if (!*r)
    return 0;
  if (*r == '"') {
    r++;
    *s = strchr(r, '"');
  } else
    *s = strpbrk(r, " \t\r\n");
  if (*s) {
    *(*s)++ = 0;
    while (isspace((unsigned char)(**s)))
      ++*s;
    if (!**s)
      *s = 0;
  }
  return r;
}


x86 assembly (clang, -O0):
<next_arg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    115f <next_arg+0x2f>
movq   $0x0,-0x8(%rbp)
jmp    126e <next_arg+0x13e>
jmp    1164 <next_arg+0x34>
mov    -0x18(%rbp),%rax
movzbl (%rax),%edi
call   1040 <isspace@plt>
cmp    $0x0,%rax
je     118b <next_arg+0x5b>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1164 <next_arg+0x34>
mov    -0x18(%rbp),%rax
cmpb   $0x0,(%rax)
jne    11a5 <next_arg+0x75>
movq   $0x0,-0x8(%rbp)
jmp    126e <next_arg+0x13e>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x22,%eax
jne    11de <next_arg+0xae>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    $0x22,%esi
call   1030 <strchr@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
jmp    11f8 <next_arg+0xc8>
mov    -0x18(%rbp),%rdi
lea    0xe17(%rip),%rsi
call   1050 <strpbrk@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x10(%rbp),%rax
cmpq   $0x0,(%rax)
je     1266 <next_arg+0x136>
mov    -0x10(%rbp),%rcx
mov    (%rcx),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,(%rcx)
movb   $0x0,(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movzbl (%rax),%edi
call   1040 <isspace@plt>
cmp    $0x0,%rax
je     1246 <next_arg+0x116>
mov    -0x10(%rbp),%rax
mov    (%rax),%rcx
add    $0x1,%rcx
mov    %rcx,(%rax)
jmp    121a <next_arg+0xea>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
cmpb   $0x0,(%rax)
jne    1261 <next_arg+0x131>
mov    -0x10(%rbp),%rax
movq   $0x0,(%rax)
jmp    1266 <next_arg+0x136>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<next_arg>:
push   %r14
push   %rbx
push   %rax
mov    (%rdi),%rbx
test   %rbx,%rbx
je     116b <next_arg+0x3b>
mov    %rdi,%r14
nop
movzbl (%rbx),%edi
call   1040 <isspace@plt>
add    $0x1,%rbx
test   %rax,%rax
jne    1140 <next_arg+0x10>
mov    -0x1(%rbx),%al
test   %al,%al
je     116b <next_arg+0x3b>
cmp    $0x22,%al
jne    116f <next_arg+0x3f>
mov    %rbx,%rdi
mov    $0x22,%esi
call   1030 <strchr@plt>
jmp    1182 <next_arg+0x52>
xor    %ebx,%ebx
jmp    11c9 <next_arg+0x99>
add    $0xffffffffffffffff,%rbx
lea    0xe86(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strpbrk@plt>
mov    %rax,(%r14)
test   %rax,%rax
je     11c9 <next_arg+0x99>
lea    0x1(%rax),%rcx
mov    %rcx,(%r14)
movb   $0x0,(%rax)
mov    (%r14),%rax
movzbl (%rax),%edi
nopw   0x0(%rax,%rax,1)
call   1040 <isspace@plt>
test   %rax,%rax
je     11ba <next_arg+0x8a>
mov    (%r14),%rax
lea    0x1(%rax),%rcx
mov    %rcx,(%r14)
movzbl 0x1(%rax),%edi
jmp    11a0 <next_arg+0x70>
mov    (%r14),%rax
cmpb   $0x0,(%rax)
jne    11c9 <next_arg+0x99>
movq   $0x0,(%r14)
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [5 x i8] c" \09\0D\0A\00"
define i8* @next_arg(i8** nocapture %0) {
%2 = load i8*, i8** %0
%3 = icmp eq i8* %2, null
br i1 %3, label %37, label %4
4: ; preds = %1, %4
%5 = phi i8* [ %9, %4 ], [ %2, %1 ]
%6 = load i8, i8* %5
%7 = tail call i64 @isspace(i8 zeroext %6)
%8 = icmp eq i64 %7, 0
%9 = getelementptr inbounds i8, i8* %5, i64 1
br i1 %8, label %10, label %4
10: ; preds = %4
%11 = load i8, i8* %5
switch i8 %11, label %14 [
i8 0, label %37
i8 34, label %12
]
12: ; preds = %10
%13 = tail call i8* @strchr(i8* %9, i8 signext 34)
br label %16
14: ; preds = %10
%15 = tail call i8* @strpbrk(i8* %5, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
br label %16
16: ; preds = %14, %12
%17 = phi i8* [ %15, %14 ], [ %13, %12 ]
%18 = phi i8* [ %5, %14 ], [ %9, %12 ]
store i8* %17, i8** %0
%19 = icmp eq i8* %17, null
br i1 %19, label %37, label %20
20: ; preds = %16
%21 = getelementptr inbounds i8, i8* %17, i64 1
store i8* %21, i8** %0
store i8 0, i8* %17
%22 = load i8*, i8** %0
%23 = load i8, i8* %22
%24 = tail call i64 @isspace(i8 zeroext %23)
%25 = icmp eq i64 %24, 0
br i1 %25, label %32, label %26
26: ; preds = %20, %26
%27 = load i8*, i8** %0
%28 = getelementptr inbounds i8, i8* %27, i64 1
store i8* %28, i8** %0
%29 = load i8, i8* %28
%30 = tail call i64 @isspace(i8 zeroext %29)
%31 = icmp eq i64 %30, 0
br i1 %31, label %32, label %26
32: ; preds = %26, %20
%33 = load i8*, i8** %0
%34 = load i8, i8* %33
%35 = icmp eq i8 %34, 0
br i1 %35, label %36, label %37
36: ; preds = %32
store i8* null, i8** %0
br label %37
37: ; preds = %16, %36, %32, %10, %1
%38 = phi i8* [ null, %1 ], [ null, %10 ], [ %18, %32 ], [ %18, %36 ], [ %18, %16 ]
ret i8* %38
}