#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 */
struct hash {
  int dummy;
};

/* Variables and functions */
char *cloneString(char *);
int /*<<< orphan*/ errAbort(char *, int, ...);
int /*<<< orphan*/ freez(char **);
int /*<<< orphan*/ hashAdd(struct hash *, char *, char *);
int /*<<< orphan*/ isalpha(char);
struct hash *newHashExt(int, int);
int /*<<< orphan*/ parseQuotedString(char *, char *, char **);
char *skipLeadingSpaces(char *);
char *skipToSpaces(char *);
char *strchr(char *, char);
struct hash *hashThisEqThatLine(char *line, int lineIx,
                                int firstStartsWithLetter) {
  char *dupe = cloneString(line);
  char *s = dupe, c;
  char *var, *val;
  struct hash *hash = newHashExt(8, 1);
  for (;;) {
    if ((var = skipLeadingSpaces(s)) == NULL)
      break;
    if ((c = *var) == 0)
      break;
    if (firstStartsWithLetter && !isalpha(c))
      errAbort(
          "line %d of custom input: variable needs to start with letter '%s'",
          lineIx, var);
    val = strchr(var, '=');
    if (val == NULL) {
      errAbort(
          "line %d of var %s in custom input: %s \n missing = in var/val pair",
          lineIx, var, line);
    }
    *val++ = 0;
    c = *val;
    if (c == '\'' || c == '"') {
      if (!parseQuotedString(val, val, &s))
        errAbort("line %d of input: missing closing %c", lineIx, c);
    } else {
      s = skipToSpaces(val);
      if (s != NULL)
        *s++ = 0;
    }
    hashAdd(hash, var, cloneString(val));
  }
  freez(&dupe);
  return hash;
}


x86 assembly (clang, -O0):
<hashThisEqThatLine>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1070 <cloneString@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    $0x8,%edi
mov    $0x1,%esi
call   1030 <newHashExt@plt>
mov    %rax,-0x40(%rbp)
mov    -0x20(%rbp),%rdi
call   1060 <skipLeadingSpaces@plt>
mov    %rax,-0x30(%rbp)
cmp    $0x0,%rax
jne    11f6 <hashThisEqThatLine+0x56>
jmp    133d <hashThisEqThatLine+0x19d>
mov    -0x30(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x21(%rbp)
movsbl %al,%eax
cmp    $0x0,%eax
jne    1210 <hashThisEqThatLine+0x70>
jmp    133d <hashThisEqThatLine+0x19d>
cmpl   $0x0,-0x10(%rbp)
je     1241 <hashThisEqThatLine+0xa1>
movsbl -0x21(%rbp),%edi
call   10b0 <isalpha@plt>
cmp    $0x0,%eax
jne    1241 <hashThisEqThatLine+0xa1>
mov    -0xc(%rbp),%esi
mov    -0x30(%rbp),%rdx
lea    0xdc6(%rip),%rdi
mov    $0x0,%al
call   1050 <errAbort@plt>
mov    -0x30(%rbp),%rdi
mov    $0x3d,%esi
call   1040 <strchr@plt>
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x38(%rbp)
jne    1277 <hashThisEqThatLine+0xd7>
mov    -0xc(%rbp),%esi
mov    -0x30(%rbp),%rdx
mov    -0x8(%rbp),%rcx
lea    0xdd2(%rip),%rdi
mov    $0x0,%al
call   1050 <errAbort@plt>
mov    -0x38(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x38(%rbp)
movb   $0x0,(%rax)
mov    -0x38(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x21(%rbp)
movsbl -0x21(%rbp),%eax
cmp    $0x27,%eax
je     12ac <hashThisEqThatLine+0x10c>
movsbl -0x21(%rbp),%eax
cmp    $0x22,%eax
jne    12e0 <hashThisEqThatLine+0x140>
mov    -0x38(%rbp),%rdi
mov    -0x38(%rbp),%rsi
lea    -0x20(%rbp),%rdx
call   1090 <parseQuotedString@plt>
cmp    $0x0,%eax
jne    12db <hashThisEqThatLine+0x13b>
mov    -0xc(%rbp),%esi
movsbl -0x21(%rbp),%edx
lea    0xdb0(%rip),%rdi
mov    $0x0,%al
call   1050 <errAbort@plt>
jmp    130f <hashThisEqThatLine+0x16f>
mov    -0x38(%rbp),%rdi
call   10c0 <skipToSpaces@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     130a <hashThisEqThatLine+0x16a>
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x20(%rbp)
movb   $0x0,(%rax)
jmp    130f <hashThisEqThatLine+0x16f>
mov    -0x40(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x38(%rbp),%rdi
call   1070 <cloneString@plt>
mov    -0x50(%rbp),%rdi
mov    -0x48(%rbp),%rsi
mov    %rax,%rdx
call   10a0 <hashAdd@plt>
jmp    11da <hashThisEqThatLine+0x3a>
lea    -0x18(%rbp),%rdi
call   1080 <freez@plt>
mov    -0x40(%rbp),%rax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hashThisEqThatLine>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %edx,%r15d
mov    %esi,%r14d
mov    %rdi,0x8(%rsp)
call   1070 <cloneString@plt>
mov    %rax,%rbx
mov    %rax,0x10(%rsp)
mov    %rax,(%rsp)
mov    $0x8,%edi
mov    $0x1,%esi
call   1030 <newHashExt@plt>
mov    %rax,%rbp
mov    %rbx,%rdi
mov    %r14d,%ebx
call   1060 <skipLeadingSpaces@plt>
test   %rax,%rax
je     1308 <hashThisEqThatLine+0x168>
mov    %rax,%r12
jmp    1241 <hashThisEqThatLine+0xa1>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r13,%rdi
mov    %r13,%rsi
mov    %rsp,%rdx
call   1090 <parseQuotedString@plt>
test   %eax,%eax
je     12f0 <hashThisEqThatLine+0x150>
mov    %r13,%rdi
call   1070 <cloneString@plt>
mov    %rbp,%rdi
mov    %r12,%rsi
mov    %rax,%rdx
call   10a0 <hashAdd@plt>
mov    (%rsp),%rdi
call   1060 <skipLeadingSpaces@plt>
mov    %rax,%r12
test   %rax,%rax
je     1308 <hashThisEqThatLine+0x168>
movzbl (%r12),%eax
test   %al,%al
je     1308 <hashThisEqThatLine+0x168>
test   %r15d,%r15d
je     1272 <hashThisEqThatLine+0xd2>
movsbl %al,%edi
call   10b0 <isalpha@plt>
test   %eax,%eax
jne    1272 <hashThisEqThatLine+0xd2>
lea    0xd9a(%rip),%rdi
mov    %ebx,%esi
mov    %r12,%rdx
xor    %eax,%eax
call   1050 <errAbort@plt>
mov    %r12,%rdi
mov    $0x3d,%esi
call   1040 <strchr@plt>
mov    %rax,%r13
test   %rax,%rax
jne    129f <hashThisEqThatLine+0xff>
lea    0xdb4(%rip),%rdi
mov    %ebx,%esi
mov    %r12,%rdx
mov    0x8(%rsp),%rcx
xor    %eax,%eax
call   1050 <errAbort@plt>
mov    %r13,%rax
add    $0x1,%r13
movb   $0x0,(%rax)
movsbl 0x1(%rax),%r14d
cmp    $0x27,%r14d
je     1200 <hashThisEqThatLine+0x60>
cmp    $0x22,%r14b
je     1200 <hashThisEqThatLine+0x60>
mov    %r13,%rdi
call   10c0 <skipToSpaces@plt>
mov    %rax,(%rsp)
test   %rax,%rax
je     1216 <hashThisEqThatLine+0x76>
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,(%rsp)
movb   $0x0,(%rax)
jmp    1216 <hashThisEqThatLine+0x76>
nopw   0x0(%rax,%rax,1)
lea    0xd8d(%rip),%rdi
mov    %ebx,%esi
mov    %r14d,%edx
xor    %eax,%eax
call   1050 <errAbort@plt>
jmp    1216 <hashThisEqThatLine+0x76>
lea    0x10(%rsp),%rdi
call   1080 <freez@plt>
mov    %rbp,%rax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.hash = type { i32 }
@.str = [66 x i8] c"line %d of custom input: variable needs to start with letter '%s'\00"
@.str.1 = [66 x i8] c"line %d of var %s in custom input: %s \0A missing = in var/val pair\00"
@.str.2 = [37 x i8] c"line %d of input: missing closing %c\00"
define %struct.hash* @hashThisEqThatLine(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca %struct.hash*
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%13 = load i8*, i8** %4
%14 = call i8* @cloneString(i8* %13)
store i8* %14, i8** %7
%15 = load i8*, i8** %7
store i8* %15, i8** %8
%16 = call %struct.hash* @newHashExt(i32 8, i32 1)
store %struct.hash* %16, %struct.hash** %12
br label %17
17: ; preds = %81, %3
%18 = load i8*, i8** %8
%19 = call i8* @skipLeadingSpaces(i8* %18)
store i8* %19, i8** %10
%20 = icmp eq i8* %19, null
br i1 %20, label %21, label %22
21: ; preds = %17
br label %87
22: ; preds = %17
%23 = load i8*, i8** %10
%24 = load i8, i8* %23
store i8 %24, i8* %9
%25 = sext i8 %24 to i32
%26 = icmp eq i32 %25, 0
br i1 %26, label %27, label %28
27: ; preds = %22
br label %87
28: ; preds = %22
%29 = load i32, i32* %6
%30 = icmp ne i32 %29, 0
br i1 %30, label %31, label %39
31: ; preds = %28
%32 = load i8, i8* %9
%33 = call i32 @isalpha(i8 signext %32)
%34 = icmp ne i32 %33, 0
br i1 %34, label %39, label %35
35: ; preds = %31
%36 = load i32, i32* %5
%37 = load i8*, i8** %10
%38 = call i32 (i8*, i32, ...) @errAbort(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str, i64 0, i64 0), i32 %36, i8* %37)
br label %39
39: ; preds = %35, %31, %28
%40 = load i8*, i8** %10
%41 = call i8* @strchr(i8* %40, i8 signext 61)
store i8* %41, i8** %11
%42 = load i8*, i8** %11
%43 = icmp eq i8* %42, null
br i1 %43, label %44, label %49
44: ; preds = %39
%45 = load i32, i32* %5
%46 = load i8*, i8** %10
%47 = load i8*, i8** %4
%48 = call i32 (i8*, i32, ...) @errAbort(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.1, i64 0, i64 0), i32 %45, i8* %46, i8* %47)
br label %49
49: ; preds = %44, %39
%50 = load i8*, i8** %11
%51 = getelementptr inbounds i8, i8* %50, i32 1
store i8* %51, i8** %11
store i8 0, i8* %50
%52 = load i8*, i8** %11
%53 = load i8, i8* %52
store i8 %53, i8* %9
%54 = load i8, i8* %9
%55 = sext i8 %54 to i32
%56 = icmp eq i32 %55, 39
br i1 %56, label %61, label %57
57: ; preds = %49
%58 = load i8, i8* %9
%59 = sext i8 %58 to i32
%60 = icmp eq i32 %59, 34
br i1 %60, label %61, label %72
61: ; preds = %57, %49
%62 = load i8*, i8** %11
%63 = load i8*, i8** %11
%64 = call i32 @parseQuotedString(i8* %62, i8* %63, i8** %8)
%65 = icmp ne i32 %64, 0
br i1 %65, label %71, label %66
66: ; preds = %61
%67 = load i32, i32* %5
%68 = load i8, i8* %9
%69 = sext i8 %68 to i32
%70 = call i32 (i8*, i32, ...) @errAbort(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0), i32 %67, i32 %69)
br label %71
71: ; preds = %66, %61
br label %81
72: ; preds = %57
%73 = load i8*, i8** %11
%74 = call i8* @skipToSpaces(i8* %73)
store i8* %74, i8** %8
%75 = load i8*, i8** %8
%76 = icmp ne i8* %75, null
br i1 %76, label %77, label %80
77: ; preds = %72
%78 = load i8*, i8** %8
%79 = getelementptr inbounds i8, i8* %78, i32 1
store i8* %79, i8** %8
store i8 0, i8* %78
br label %80
80: ; preds = %77, %72
br label %81
81: ; preds = %80, %71
%82 = load %struct.hash*, %struct.hash** %12
%83 = load i8*, i8** %10
%84 = load i8*, i8** %11
%85 = call i8* @cloneString(i8* %84)
%86 = call i32 @hashAdd(%struct.hash* %82, i8* %83, i8* %85)
br label %17
87: ; preds = %27, %21
%88 = call i32 @freez(i8** %7)
%89 = load %struct.hash*, %struct.hash** %12
ret %struct.hash* %89
}

LLVM IR (-O2):
%struct.hash = type { i32 }
@.str = [66 x i8] c"line %d of custom input: variable needs to start with letter '%s'\00"
@.str.1 = [66 x i8] c"line %d of var %s in custom input: %s \0A missing = in var/val pair\00"
@.str.2 = [37 x i8] c"line %d of input: missing closing %c\00"
define %struct.hash* @hashThisEqThatLine(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = bitcast i8** %4 to i8*
%7 = tail call i8* @cloneString(i8* %0)
store i8* %7, i8** %4
%8 = bitcast i8** %5 to i8*
store i8* %7, i8** %5
%9 = tail call %struct.hash* @newHashExt(i32 8, i32 1)
%10 = call i8* @skipLeadingSpaces(i8* %7)
%11 = icmp eq i8* %10, null
br i1 %11, label %49, label %12
12: ; preds = %3
%13 = icmp eq i32 %2, 0
br label %14
14: ; preds = %12, %43
%15 = phi i8* [ %10, %12 ], [ %47, %43 ]
%16 = load i8, i8* %15
%17 = icmp eq i8 %16, 0
br i1 %17, label %49, label %18
18: ; preds = %14
br i1 %13, label %24, label %19
19: ; preds = %18
%20 = call i32 @isalpha(i8 signext %16)
%21 = icmp eq i32 %20, 0
br i1 %21, label %22, label %24
22: ; preds = %19
%23 = call i32 (i8*, i32, ...) @errAbort(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str, i64 0, i64 0), i32 %1, i8* %15)
br label %24
24: ; preds = %22, %19, %18
%25 = call i8* @strchr(i8* %15, i8 signext 61)
%26 = icmp eq i8* %25, null
br i1 %26, label %27, label %29
27: ; preds = %24
%28 = call i32 (i8*, i32, ...) @errAbort(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.1, i64 0, i64 0), i32 %1, i8* %15, i8* %0)
br label %29
29: ; preds = %27, %24
%30 = getelementptr inbounds i8, i8* %25, i64 1
store i8 0, i8* %25
%31 = load i8, i8* %30
%32 = sext i8 %31 to i32
switch i8 %31, label %38 [
i8 39, label %33
i8 34, label %33
]
33: ; preds = %29, %29
%34 = call i32 @parseQuotedString(i8* %30, i8* %30, i8** %5)
%35 = icmp eq i32 %34, 0
br i1 %35, label %36, label %43
36: ; preds = %33
%37 = call i32 (i8*, i32, ...) @errAbort(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0), i32 %1, i32 %32)
br label %43
38: ; preds = %29
%39 = call i8* @skipToSpaces(i8* %30)
store i8* %39, i8** %5
%40 = icmp eq i8* %39, null
br i1 %40, label %43, label %41
41: ; preds = %38
%42 = getelementptr inbounds i8, i8* %39, i64 1
store i8* %42, i8** %5
store i8 0, i8* %39
br label %43
43: ; preds = %38, %41, %33, %36
%44 = call i8* @cloneString(i8* %30)
%45 = call i32 @hashAdd(%struct.hash* %9, i8* %15, i8* %44)
%46 = load i8*, i8** %5
%47 = call i8* @skipLeadingSpaces(i8* %46)
%48 = icmp eq i8* %47, null
br i1 %48, label %49, label %14
49: ; preds = %43, %14, %3
%50 = call i32 @freez(i8** %4)
ret %struct.hash* %9
}