#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 *);
int /*<<< orphan*/ trim(char *);
char *strdelim(char **s) {
  char *old;
  int wspace = 0;
  if (*s == NULL) {
    return (NULL);
  }
  trim(*s);
  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';
      *s += strspn(*s + 1, " \t\r\n") + 1;
      return (old);
    }
  }
  if (*s[0] == '=') {
    wspace = 1;
  }
  *s[0] = '\0';
  *s += strspn(*s + 1, " \t\r\n") + 1;
  if (*s[0] == '=' && wspace == 0) {
    *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    117e <strdelim+0x2e>
movq   $0x0,-0x8(%rbp)
jmp    131e <strdelim+0x1ce>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1040 <trim@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xe5d(%rip),%rsi
call   1060 <strpbrk@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x10(%rbp),%rax
cmpq   $0x0,(%rax)
jne    11cd <strdelim+0x7d>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    131e <strdelim+0x1ce>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%eax
cmp    $0x22,%eax
jne    1285 <strdelim+0x135>
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   1070 <memmove@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xde4(%rip),%rsi
call   1060 <strpbrk@plt>
mov    -0x10(%rbp),%rcx
mov    %rax,(%rcx)
cmp    $0x0,%rax
jne    1246 <strdelim+0xf6>
movq   $0x0,-0x8(%rbp)
jmp    131e <strdelim+0x1ce>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movb   $0x0,(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
add    $0x1,%rdi
lea    0xda7(%rip),%rsi
call   1050 <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)
jmp    131e <strdelim+0x1ce>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%eax
cmp    $0x3d,%eax
jne    129f <strdelim+0x14f>
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    0xd4e(%rip),%rsi
call   1050 <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    1316 <strdelim+0x1c6>
cmpl   $0x0,-0x1c(%rbp)
jne    1316 <strdelim+0x1c6>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
add    $0x1,%rdi
lea    0xd09(%rip),%rsi
call   1050 <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,%r15
mov    (%rdi),%rdi
test   %rdi,%rdi
je     11db <strdelim+0x7b>
call   1050 <trim@plt>
mov    (%r15),%r14
lea    0xe7e(%rip),%rsi
mov    %r14,%rdi
call   1070 <strpbrk@plt>
mov    %rax,(%r15)
test   %rax,%rax
je     1229 <strdelim+0xc9>
mov    %rax,%rbx
mov    (%rax),%bpl
cmp    $0x22,%bpl
jne    11e0 <strdelim+0x80>
mov    %rbx,%r12
add    $0x1,%r12
mov    %rbx,%rdi
call   1030 <strlen@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
mov    %eax,%edx
call   1080 <memmove@plt>
mov    (%r15),%rdi
mov    $0x22,%esi
call   1040 <strchr@plt>
mov    %rax,(%r15)
test   %rax,%rax
je     11db <strdelim+0x7b>
movb   $0x0,(%rax)
mov    (%r15),%r12
jmp    120e <strdelim+0xae>
xor    %r14d,%r14d
jmp    1229 <strdelim+0xc9>
movb   $0x0,(%rbx)
mov    (%r15),%rbx
lea    0x1(%rbx),%rdi
lea    0xe16(%rip),%rsi
call   1060 <strspn@plt>
lea    (%rax,%rbx,1),%r12
add    $0x1,%r12
mov    %r12,(%r15)
cmpb   $0x3d,0x1(%rax,%rbx,1)
jne    1229 <strdelim+0xc9>
cmp    $0x3d,%bpl
je     1229 <strdelim+0xc9>
lea    0x1(%r12),%rdi
lea    0xded(%rip),%rsi
call   1060 <strspn@plt>
add    %r12,%rax
add    $0x1,%rax
mov    %rax,(%r15)
mov    %r14,%rax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

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 %37, label %4
4: ; preds = %1
%5 = tail call i32 @trim(i8* %2)
%6 = load i8*, i8** %0
%7 = tail call i8* @strpbrk(i8* %6, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
store i8* %7, i8** %0
%8 = icmp eq i8* %7, null
br i1 %8, label %37, label %9
9: ; preds = %4
%10 = load i8, i8* %7
%11 = icmp eq i8 %10, 34
br i1 %11, label %12, label %21
12: ; preds = %9
%13 = getelementptr inbounds i8, i8* %7, i64 1
%14 = tail call i32 @strlen(i8* %7)
%15 = tail call i32 @memmove(i8* %7, i8* %13, i32 %14)
%16 = load i8*, i8** %0
%17 = tail call i8* @strchr(i8* dereferenceable(1) %16, i32 34)
store i8* %17, i8** %0
%18 = icmp eq i8* %17, null
br i1 %18, label %37, label %19
19: ; preds = %12
store i8 0, i8* %17
%20 = load i8*, i8** %0
br label %31
21: ; preds = %9
%22 = icmp ne i8 %10, 61
store i8 0, i8* %7
%23 = load i8*, i8** %0
%24 = getelementptr inbounds i8, i8* %23, i64 1
%25 = tail call i64 @strspn(i8* %24, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%26 = add nsw i64 %25, 1
%27 = getelementptr inbounds i8, i8* %23, i64 %26
store i8* %27, i8** %0
%28 = load i8, i8* %27
%29 = icmp eq i8 %28, 61
%30 = select i1 %29, i1 %22, i1 false
br i1 %30, label %31, label %37
31: ; preds = %21, %19
%32 = phi i8* [ %20, %19 ], [ %27, %21 ]
%33 = getelementptr inbounds i8, i8* %32, i64 1
%34 = tail call i64 @strspn(i8* %33, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%35 = add nsw i64 %34, 1
%36 = getelementptr inbounds i8, i8* %32, i64 %35
store i8* %36, i8** %0
br label %37
37: ; preds = %31, %21, %12, %4, %1
%38 = phi i8* [ null, %1 ], [ %6, %4 ], [ null, %12 ], [ %6, %21 ], [ %6, %31 ]
ret i8* %38
}