#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*/ memmove(char *, char *, int /*<<< orphan*/);
int /*<<< orphan*/ strlen(char *);
char *strpbrk(char *, char *);
scalar_t__ strspn(char *, char *);
char *strdelim(char **s) {
  char *old;
  int wspace = 0;
  if (*s == NULL)
    return NULL;
  old = *s;
  *s = strpbrk(*s, " \t\r\n"
                   "\""
                   "=");
  if (*s == NULL)
    return (old);
  if (*s[0] == '\"') {
    memmove(*s, *s + 1, strlen(*s));
    if ((*s = strpbrk(*s, "\"")) == NULL) {
      return (NULL);
    } else {
      *s[0] = '\0';
      return (old);
    }
  }
  if (*s[0] == '=')
    wspace = 1;
  *s[0] = '\0';
  *s += strspn(*s + 1, " \t\r\n") + 1;
  if (*s[0] == '=' && !wspace)
    *s += strspn(*s + 1, " \t\r\n") + 1;
  return (old);
}


x86 assembly (clang, -O0):
<strdelim>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
cmpq   $0x0,(%rax)
jne    116e <strdelim+0x2e>
movq   $0x0,-0x8(%rbp)
jmp    12da <strdelim+0x19a>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xe79(%rip),%rsi
call   1050 <strpbrk@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x10(%rbp),%rax
cmpq   $0x0,(%rax)
jne    11b1 <strdelim+0x71>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    12da <strdelim+0x19a>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%eax
cmp    $0x22,%eax
jne    1241 <strdelim+0x101>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1030 <strlen@plt>
mov    -0x30(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    %eax,%edx
call   1060 <memmove@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xe00(%rip),%rsi
call   1050 <strpbrk@plt>
mov    -0x10(%rbp),%rcx
mov    %rax,(%rcx)
cmp    $0x0,%rax
jne    122a <strdelim+0xea>
movq   $0x0,-0x8(%rbp)
jmp    12da <strdelim+0x19a>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movb   $0x0,(%rax)
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    12da <strdelim+0x19a>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%eax
cmp    $0x3d,%eax
jne    125b <strdelim+0x11b>
movl   $0x1,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movb   $0x0,(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
add    $0x1,%rdi
lea    0xd92(%rip),%rsi
call   1040 <strspn@plt>
mov    %rax,%rcx
add    $0x1,%rcx
mov    -0x10(%rbp),%rax
add    (%rax),%rcx
mov    %rcx,(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%eax
cmp    $0x3d,%eax
jne    12d2 <strdelim+0x192>
cmpl   $0x0,-0x1c(%rbp)
jne    12d2 <strdelim+0x192>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
add    $0x1,%rdi
lea    0xd4d(%rip),%rsi
call   1040 <strspn@plt>
mov    %rax,%rcx
add    $0x1,%rcx
mov    -0x10(%rbp),%rax
add    (%rax),%rcx
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strdelim>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    (%rdi),%r14
test   %r14,%r14
je     11bc <strdelim+0x6c>
mov    %rdi,%r15
lea    0xe96(%rip),%rsi
mov    %r14,%rdi
call   1060 <strpbrk@plt>
mov    %rax,(%r15)
test   %rax,%rax
je     11bf <strdelim+0x6f>
mov    %rax,%rbx
mov    (%rax),%bpl
cmp    $0x22,%bpl
jne    11cb <strdelim+0x7b>
mov    %rbx,%r12
add    $0x1,%r12
mov    %rbx,%rdi
call   1030 <strlen@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
mov    %eax,%edx
call   1070 <memmove@plt>
mov    (%r15),%rdi
mov    $0x22,%esi
call   1040 <strchr@plt>
mov    %rax,(%r15)
test   %rax,%rax
je     11bc <strdelim+0x6c>
movb   $0x0,(%rax)
jmp    11bf <strdelim+0x6f>
xor    %r14d,%r14d
mov    %r14,%rax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
movb   $0x0,(%rbx)
mov    (%r15),%rbx
lea    0x1(%rbx),%rdi
lea    0xe2b(%rip),%rsi
call   1050 <strspn@plt>
lea    (%rax,%rbx,1),%r12
add    $0x1,%r12
mov    %r12,(%r15)
cmpb   $0x3d,0x1(%rax,%rbx,1)
jne    11bf <strdelim+0x6f>
cmp    $0x3d,%bpl
je     11bf <strdelim+0x6f>
lea    0x1(%r12),%rdi
lea    0xe02(%rip),%rsi
call   1050 <strspn@plt>
add    %r12,%rax
add    $0x1,%rax
mov    %rax,(%r15)
jmp    11bf <strdelim+0x6f>

LLVM IR (-O0):
@.str = [7 x i8] c" \09\0D\0A\22=\00"
@.str.1 = [2 x i8] c"\22\00"
@.str.2 = [5 x i8] c" \09\0D\0A\00"
define i8* @strdelim(i8** %0) {
%2 = alloca i8*
%3 = alloca i8**
%4 = alloca i8*
%5 = alloca i32
store i8** %0, i8*** %3
store i32 0, i32* %5
%6 = load i8**, i8*** %3
%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** %2
br label %90
10: ; preds = %1
%11 = load i8**, i8*** %3
%12 = load i8*, i8** %11
store i8* %12, i8** %4
%13 = load i8**, i8*** %3
%14 = load i8*, i8** %13
%15 = call i8* @strpbrk(i8* %14, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%16 = load i8**, i8*** %3
store i8* %15, i8** %16
%17 = load i8**, i8*** %3
%18 = load i8*, i8** %17
%19 = icmp eq i8* %18, null
br i1 %19, label %20, label %22
20: ; preds = %10
%21 = load i8*, i8** %4
store i8* %21, i8** %2
br label %90
22: ; preds = %10
%23 = load i8**, i8*** %3
%24 = getelementptr inbounds i8*, i8** %23, i64 0
%25 = load i8*, i8** %24
%26 = load i8, i8* %25
%27 = sext i8 %26 to i32
%28 = icmp eq i32 %27, 34
br i1 %28, label %29, label %50
29: ; preds = %22
%30 = load i8**, i8*** %3
%31 = load i8*, i8** %30
%32 = load i8**, i8*** %3
%33 = load i8*, i8** %32
%34 = getelementptr inbounds i8, i8* %33, i64 1
%35 = load i8**, i8*** %3
%36 = load i8*, i8** %35
%37 = call i32 @strlen(i8* %36)
%38 = call i32 @memmove(i8* %31, i8* %34, i32 %37)
%39 = load i8**, i8*** %3
%40 = load i8*, i8** %39
%41 = call i8* @strpbrk(i8* %40, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%42 = load i8**, i8*** %3
store i8* %41, i8** %42
%43 = icmp eq i8* %41, null
br i1 %43, label %44, label %45
44: ; preds = %29
store i8* null, i8** %2
br label %90
45: ; preds = %29
%46 = load i8**, i8*** %3
%47 = getelementptr inbounds i8*, i8** %46, i64 0
%48 = load i8*, i8** %47
store i8 0, i8* %48
%49 = load i8*, i8** %4
store i8* %49, i8** %2
br label %90
50: ; preds = %22
%51 = load i8**, i8*** %3
%52 = getelementptr inbounds i8*, i8** %51, i64 0
%53 = load i8*, i8** %52
%54 = load i8, i8* %53
%55 = sext i8 %54 to i32
%56 = icmp eq i32 %55, 61
br i1 %56, label %57, label %58
57: ; preds = %50
store i32 1, i32* %5
br label %58
58: ; preds = %57, %50
%59 = load i8**, i8*** %3
%60 = getelementptr inbounds i8*, i8** %59, i64 0
%61 = load i8*, i8** %60
store i8 0, i8* %61
%62 = load i8**, i8*** %3
%63 = load i8*, i8** %62
%64 = getelementptr inbounds i8, i8* %63, i64 1
%65 = call i64 @strspn(i8* %64, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%66 = add nsw i64 %65, 1
%67 = load i8**, i8*** %3
%68 = load i8*, i8** %67
%69 = getelementptr inbounds i8, i8* %68, i64 %66
store i8* %69, i8** %67
%70 = load i8**, i8*** %3
%71 = getelementptr inbounds i8*, i8** %70, i64 0
%72 = load i8*, i8** %71
%73 = load i8, i8* %72
%74 = sext i8 %73 to i32
%75 = icmp eq i32 %74, 61
br i1 %75, label %76, label %88
76: ; preds = %58
%77 = load i32, i32* %5
%78 = icmp ne i32 %77, 0
br i1 %78, label %88, label %79
79: ; preds = %76
%80 = load i8**, i8*** %3
%81 = load i8*, i8** %80
%82 = getelementptr inbounds i8, i8* %81, i64 1
%83 = call i64 @strspn(i8* %82, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%84 = add nsw i64 %83, 1
%85 = load i8**, i8*** %3
%86 = load i8*, i8** %85
%87 = getelementptr inbounds i8, i8* %86, i64 %84
store i8* %87, i8** %85
br label %88
88: ; preds = %79, %76, %58
%89 = load i8*, i8** %4
store i8* %89, i8** %2
br label %90
90: ; preds = %88, %45, %44, %20, %9
%91 = load i8*, i8** %2
ret i8* %91
}

LLVM IR (-O2):
@.str = [7 x i8] c" \09\0D\0A\22=\00"
@.str.2 = [5 x i8] c" \09\0D\0A\00"
define i8* @strdelim(i8** nocapture %0) {
%2 = load i8*, i8** %0
%3 = icmp eq i8* %2, null
br i1 %3, label %33, label %4
4: ; preds = %1
%5 = tail call i8* @strpbrk(i8* %2, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
store i8* %5, i8** %0
%6 = icmp eq i8* %5, null
br i1 %6, label %33, label %7
7: ; preds = %4
%8 = load i8, i8* %5
%9 = icmp eq i8 %8, 34
br i1 %9, label %10, label %18
10: ; preds = %7
%11 = getelementptr inbounds i8, i8* %5, i64 1
%12 = tail call i32 @strlen(i8* %5)
%13 = tail call i32 @memmove(i8* %5, i8* %11, i32 %12)
%14 = load i8*, i8** %0
%15 = tail call i8* @strchr(i8* dereferenceable(1) %14, i32 34)
store i8* %15, i8** %0
%16 = icmp eq i8* %15, null
br i1 %16, label %33, label %17
17: ; preds = %10
store i8 0, i8* %15
br label %33
18: ; preds = %7
%19 = icmp eq i8 %8, 61
store i8 0, i8* %5
%20 = load i8*, i8** %0
%21 = getelementptr inbounds i8, i8* %20, i64 1
%22 = tail call i64 @strspn(i8* %21, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%23 = add nsw i64 %22, 1
%24 = getelementptr inbounds i8, i8* %20, i64 %23
store i8* %24, i8** %0
%25 = load i8, i8* %24
%26 = icmp ne i8 %25, 61
%27 = select i1 %26, i1 true, i1 %19
br i1 %27, label %33, label %28
28: ; preds = %18
%29 = getelementptr inbounds i8, i8* %24, i64 1
%30 = tail call i64 @strspn(i8* %29, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%31 = add nsw i64 %30, 1
%32 = getelementptr inbounds i8, i8* %24, i64 %31
store i8* %32, i8** %0
br label %33
33: ; preds = %18, %28, %10, %4, %1, %17
%34 = phi i8* [ %2, %17 ], [ null, %1 ], [ %2, %4 ], [ null, %10 ], [ %2, %28 ], [ %2, %18 ]
ret i8* %34
}