// File: /workspace/github_c_makefile_star2_O0/cktan[P]tomlc99/toml.c
// Function: scan_string
static int scan_string(context_t *ctx, char *p, int lineno, int dotisspecial) {
  char *orig = p;
  if (0 == strncmp(p, "'''", 3)) {
    char *q = p + 3;

    while (1) {
      q = strstr(q, "'''");
      if (0 == q) {
        return e_syntax(ctx, lineno, "unterminated triple-s-quote");
      }
      while (q[3] == '\'')
        q++;
      break;
    }

    set_token(ctx, STRING, lineno, orig, q + 3 - orig);
    return 0;
  }

  if (0 == strncmp(p, "\"\"\"", 3)) {
    char *q = p + 3;

    while (1) {
      q = strstr(q, "\"\"\"");
      if (0 == q) {
        return e_syntax(ctx, lineno, "unterminated triple-d-quote");
      }
      if (q[-1] == '\\') {
        q++;
        continue;
      }
      while (q[3] == '\"')
        q++;
      break;
    }

    // the string is [p+3, q-1]

    int hexreq = 0; /* #hex required */
    int escape = 0;
    for (p += 3; p < q; p++) {
      if (escape) {
        escape = 0;
        if (strchr("btnfr\"\\", *p))
          continue;
        if (*p == 'u') {
          hexreq = 4;
          continue;
        }
        if (*p == 'U') {
          hexreq = 8;
          continue;
        }
        if (p[strspn(p, " \t\r")] == '\n')
          continue; /* allow for line ending backslash */
        return e_syntax(ctx, lineno, "bad escape char");
      }
      if (hexreq) {
        hexreq--;
        if (strchr("0123456789ABCDEF", *p))
          continue;
        return e_syntax(ctx, lineno, "expect hex char");
      }
      if (*p == '\\') {
        escape = 1;
        continue;
      }
    }
    if (escape)
      return e_syntax(ctx, lineno, "expect an escape char");
    if (hexreq)
      return e_syntax(ctx, lineno, "expected more hex char");

    set_token(ctx, STRING, lineno, orig, q + 3 - orig);
    return 0;
  }

  if ('\'' == *p) {
    for (p++; *p && *p != '\n' && *p != '\''; p++)
      ;
    if (*p != '\'') {
      return e_syntax(ctx, lineno, "unterminated s-quote");
    }

    set_token(ctx, STRING, lineno, orig, p + 1 - orig);
    return 0;
  }

  if ('\"' == *p) {
    int hexreq = 0; /* #hex required */
    int escape = 0;
    for (p++; *p; p++) {
      if (escape) {
        escape = 0;
        if (strchr("btnfr\"\\", *p))
          continue;
        if (*p == 'u') {
          hexreq = 4;
          continue;
        }
        if (*p == 'U') {
          hexreq = 8;
          continue;
        }
        return e_syntax(ctx, lineno, "bad escape char");
      }
      if (hexreq) {
        hexreq--;
        if (strchr("0123456789ABCDEF", *p))
          continue;
        return e_syntax(ctx, lineno, "expect hex char");
      }
      if (*p == '\\') {
        escape = 1;
        continue;
      }
      if (*p == '\'') {
        if (p[1] == '\'' && p[2] == '\'') {
          return e_syntax(ctx, lineno, "triple-s-quote inside string lit");
        }
        continue;
      }
      if (*p == '\n')
        break;
      if (*p == '"')
        break;
    }
    if (*p != '"') {
      return e_syntax(ctx, lineno, "unterminated quote");
    }

    set_token(ctx, STRING, lineno, orig, p + 1 - orig);
    return 0;
  }

  /* check for timestamp without quotes */
  if (0 == scan_date(p, 0, 0, 0) || 0 == scan_time(p, 0, 0, 0)) {
    // forward thru the timestamp
    p += strspn(p, "0123456789.:+-Tt Zz");
    // squeeze out any spaces at end of string
    for (; p[-1] == ' '; p--)
      ;
    // tokenize
    set_token(ctx, STRING, lineno, orig, p - orig);
    return 0;
  }

  /* literals */
  for (; *p && *p != '\n'; p++) {
    int ch = *p;
    if (ch == '.' && dotisspecial)
      break;
    if ('A' <= ch && ch <= 'Z')
      continue;
    if ('a' <= ch && ch <= 'z')
      continue;
    if (strchr("0123456789+-_.", ch))
      continue;
    break;
  }

  set_token(ctx, STRING, lineno, orig, p - orig);
  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movl %ecx, -0x20(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x18(%rbp), %rdi
leaq 0x12e1(%rip), %rsi      # 0x863a
movl $0x3, %edx
callq 0x1060
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jne 0x7404
movq -0x18(%rbp), %rax
addq $0x3, %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rdi
leaq 0x12b4(%rip), %rsi      # 0x863a
callq 0x11c0
movq %rax, -0x30(%rbp)
xorl %eax, %eax
cmpq -0x30(%rbp), %rax
jne 0x73b2
movq -0x10(%rbp), %rdi
movl -0x1c(%rbp), %esi
leaq 0x1299(%rip), %rdx      # 0x863e
callq 0x3010
movl %eax, -0x4(%rbp)
jmp 0x7a45
jmp 0x73b4
movq -0x30(%rbp), %rax
movsbl 0x3(%rax), %eax
cmpl $0x27, %eax
jne 0x73cf
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x73b4
jmp 0x73d1
movq -0x10(%rbp), %rdi
movl -0x1c(%rbp), %edx
movq -0x28(%rbp), %rcx
movq -0x30(%rbp), %rax
addq $0x3, %rax
movq -0x28(%rbp), %rsi
subq %rsi, %rax
movl %eax, %r8d
movl $0x9, %esi
callq 0x72d0
movl $0x0, -0x4(%rbp)
jmp 0x7a45
movq -0x18(%rbp), %rdi
leaq 0x124b(%rip), %rsi      # 0x865a
movl $0x3, %edx
callq 0x1060
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jne 0x7650
movq -0x18(%rbp), %rax
addq $0x3, %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rdi
leaq 0x121e(%rip), %rsi      # 0x865a
callq 0x11c0
movq %rax, -0x38(%rbp)
xorl %eax, %eax
cmpq -0x38(%rbp), %rax
jne 0x7468
movq -0x10(%rbp), %rdi
movl -0x1c(%rbp), %esi
leaq 0x1203(%rip), %rdx      # 0x865e
callq 0x3010
movl %eax, -0x4(%rbp)
jmp 0x7a45
movq -0x38(%rbp), %rax
movsbl -0x1(%rax), %eax
cmpl $0x5c, %eax
jne 0x7483
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
jmp 0x7431
jmp 0x7485
movq -0x38(%rbp), %rax
movsbl 0x3(%rax), %eax
cmpl $0x22, %eax
jne 0x74a0
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
jmp 0x7485
jmp 0x74a2
movl $0x0, -0x3c(%rbp)
movl $0x0, -0x40(%rbp)
movq -0x18(%rbp), %rax
addq $0x3, %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
cmpq -0x38(%rbp), %rax
jae 0x75db
cmpl $0x0, -0x40(%rbp)
je 0x756e
movl $0x0, -0x40(%rbp)
movq -0x18(%rbp), %rax
movsbl (%rax), %esi
leaq 0x1191(%rip), %rdi      # 0x867a
callq 0x10c0
cmpq $0x0, %rax
je 0x74f9
jmp 0x75ca
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x75, %eax
jne 0x7511
movl $0x4, -0x3c(%rbp)
jmp 0x75ca
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x55, %eax
jne 0x7529
movl $0x8, -0x3c(%rbp)
jmp 0x75ca
movq -0x18(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x18(%rbp), %rdi
leaq 0x1146(%rip), %rsi      # 0x8682
callq 0x1120
movq %rax, %rcx
movq -0x58(%rbp), %rax
movsbl (%rax,%rcx), %eax
cmpl $0xa, %eax
jne 0x7553
jmp 0x75ca
movq -0x10(%rbp), %rdi
movl -0x1c(%rbp), %esi
leaq 0x1125(%rip), %rdx      # 0x8686
callq 0x3010
movl %eax, -0x4(%rbp)
jmp 0x7a45
cmpl $0x0, -0x3c(%rbp)
je 0x75b3
movl -0x3c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x3c(%rbp)
movq -0x18(%rbp), %rax
movsbl (%rax), %esi
leaq 0x110b(%rip), %rdi      # 0x8696
callq 0x10c0
cmpq $0x0, %rax
je 0x7598
jmp 0x75ca
movq -0x10(%rbp), %rdi
movl -0x1c(%rbp), %esi
leaq 0x1101(%rip), %rdx      # 0x86a7
callq 0x3010
movl %eax, -0x4(%rbp)
jmp 0x7a45
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x5c, %eax
jne 0x75c8
movl $0x1, -0x40(%rbp)
jmp 0x75ca
jmp 0x75ca
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
jmp 0x74bc
cmpl $0x0, -0x40(%rbp)
je 0x75fc
movq -0x10(%rbp), %rdi
movl -0x1c(%rbp), %esi
leaq 0x10c8(%rip), %rdx      # 0x86b7
callq 0x3010
movl %eax, -0x4(%rbp)
jmp 0x7a45
cmpl $0x0, -0x3c(%rbp)
je 0x761d
movq -0x10(%rbp), %rdi
movl -0x1c(%rbp), %esi
leaq 0x10bd(%rip), %rdx      # 0x86cd
callq 0x3010
movl %eax, -0x4(%rbp)
jmp 0x7a45
movq -0x10(%rbp), %rdi
movl -0x1c(%rbp), %edx
movq -0x28(%rbp), %rcx
movq -0x38(%rbp), %rax
addq $0x3, %rax
movq -0x28(%rbp), %rsi
subq %rsi, %rax
movl %eax, %r8d
movl $0x9, %esi
callq 0x72d0
movl $0x0, -0x4(%rbp)
jmp 0x7a45
movq -0x18(%rbp), %rax
movsbl (%rax), %ecx
movl $0x27, %eax
cmpl %ecx, %eax
jne 0x7715
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x59(%rbp)
je 0x76a2
movq -0x18(%rbp), %rax
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl $0xa, %ecx
movb %al, -0x59(%rbp)
je 0x76a2
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x27, %eax
setne %al
movb %al, -0x59(%rbp)
movb -0x59(%rbp), %al
testb $0x1, %al
jne 0x76ab
jmp 0x76bb
jmp 0x76ad
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
jmp 0x7670
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x27, %eax
je 0x76e2
movq -0x10(%rbp), %rdi
movl -0x1c(%rbp), %esi
leaq 0x100f(%rip), %rdx      # 0x86e4
callq 0x3010
movl %eax, -0x4(%rbp)
jmp 0x7a45
movq -0x10(%rbp), %rdi
movl -0x1c(%rbp), %edx
movq -0x28(%rbp), %rcx
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq -0x28(%rbp), %rsi
subq %rsi, %rax
movl %eax, %r8d
movl $0x9, %esi
callq 0x72d0
movl $0x0, -0x4(%rbp)
jmp 0x7a45
movq -0x18(%rbp), %rax
movsbl (%rax), %ecx
movl $0x22, %eax
cmpl %ecx, %eax
jne 0x78ef
movl $0x0, -0x44(%rbp)
movl $0x0, -0x48(%rbp)
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
cmpb $0x0, (%rax)
je 0x7895
cmpl $0x0, -0x48(%rbp)
je 0x77c6
movl $0x0, -0x48(%rbp)
movq -0x18(%rbp), %rax
movsbl (%rax), %esi
leaq 0xf0f(%rip), %rdi       # 0x867a
callq 0x10c0
cmpq $0x0, %rax
je 0x777b
jmp 0x7884
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x75, %eax
jne 0x7793
movl $0x4, -0x44(%rbp)
jmp 0x7884
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x55, %eax
jne 0x77ab
movl $0x8, -0x44(%rbp)
jmp 0x7884
movq -0x10(%rbp), %rdi
movl -0x1c(%rbp), %esi
leaq 0xecd(%rip), %rdx       # 0x8686
callq 0x3010
movl %eax, -0x4(%rbp)
jmp 0x7a45
cmpl $0x0, -0x44(%rbp)
je 0x780e
movl -0x44(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x44(%rbp)
movq -0x18(%rbp), %rax
movsbl (%rax), %esi
leaq 0xeb3(%rip), %rdi       # 0x8696
callq 0x10c0
cmpq $0x0, %rax
je 0x77f3
jmp 0x7884
movq -0x10(%rbp), %rdi
movl -0x1c(%rbp), %esi
leaq 0xea6(%rip), %rdx       # 0x86a7
callq 0x3010
movl %eax, -0x4(%rbp)
jmp 0x7a45
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x5c, %eax
jne 0x7823
movl $0x1, -0x48(%rbp)
jmp 0x7884
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x27, %eax
jne 0x7866
movq -0x18(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x27, %eax
jne 0x7864
movq -0x18(%rbp), %rax
movsbl 0x2(%rax), %eax
cmpl $0x27, %eax
jne 0x7864
movq -0x10(%rbp), %rdi
movl -0x1c(%rbp), %esi
leaq 0xea2(%rip), %rdx       # 0x86f9
callq 0x3010
movl %eax, -0x4(%rbp)
jmp 0x7a45
jmp 0x7884
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
cmpl $0xa, %eax
jne 0x7874
jmp 0x7895
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x22, %eax
jne 0x7882
jmp 0x7895
jmp 0x7884
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
jmp 0x7743
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x22, %eax
je 0x78bc
movq -0x10(%rbp), %rdi
movl -0x1c(%rbp), %esi
leaq 0xe6b(%rip), %rdx       # 0x871a
callq 0x3010
movl %eax, -0x4(%rbp)
jmp 0x7a45
movq -0x10(%rbp), %rdi
movl -0x1c(%rbp), %edx
movq -0x28(%rbp), %rcx
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq -0x28(%rbp), %rsi
subq %rsi, %rax
movl %eax, %r8d
movl $0x9, %esi
callq 0x72d0
movl $0x0, -0x4(%rbp)
jmp 0x7a45
movq -0x18(%rbp), %rdi
xorl %eax, %eax
movl %eax, %ecx
movq %rcx, %rsi
movq %rcx, %rdx
callq 0x4240
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
je 0x7925
movq -0x18(%rbp), %rdi
xorl %eax, %eax
movl %eax, %ecx
movq %rcx, %rsi
movq %rcx, %rdx
callq 0x4350
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jne 0x7989
movq -0x18(%rbp), %rdi
leaq 0xdfd(%rip), %rsi       # 0x872d
callq 0x1120
addq -0x18(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movsbl -0x1(%rax), %eax
cmpl $0x20, %eax
jne 0x795a
jmp 0x794c
movq -0x18(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x18(%rbp)
jmp 0x793d
movq -0x10(%rbp), %rdi
movl -0x1c(%rbp), %edx
movq -0x28(%rbp), %rcx
movq -0x18(%rbp), %rax
movq -0x28(%rbp), %rsi
subq %rsi, %rax
movl %eax, %r8d
movl $0x9, %esi
callq 0x72d0
movl $0x0, -0x4(%rbp)
jmp 0x7a45
jmp 0x798b
movq -0x18(%rbp), %rax
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x5a(%rbp)
je 0x79ac
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
cmpl $0xa, %eax
setne %al
movb %al, -0x5a(%rbp)
movb -0x5a(%rbp), %al
testb $0x1, %al
jne 0x79b5
jmp 0x7a1b
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
movl %eax, -0x4c(%rbp)
cmpl $0x2e, -0x4c(%rbp)
jne 0x79cd
cmpl $0x0, -0x20(%rbp)
je 0x79cd
jmp 0x7a1b
movl $0x41, %eax
cmpl -0x4c(%rbp), %eax
jg 0x79df
cmpl $0x5a, -0x4c(%rbp)
jg 0x79df
jmp 0x7a0a
movl $0x61, %eax
cmpl -0x4c(%rbp), %eax
jg 0x79f1
cmpl $0x7a, -0x4c(%rbp)
jg 0x79f1
jmp 0x7a0a
movl -0x4c(%rbp), %esi
leaq 0xd46(%rip), %rdi       # 0x8741
callq 0x10c0
cmpq $0x0, %rax
je 0x7a08
jmp 0x7a0a
jmp 0x7a1b
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
jmp 0x798b
movq -0x10(%rbp), %rdi
movl -0x1c(%rbp), %edx
movq -0x28(%rbp), %rcx
movq -0x18(%rbp), %rax
movq -0x28(%rbp), %rsi
subq %rsi, %rax
movl %eax, %r8d
movl $0x9, %esi
callq 0x72d0
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x60, %rsp
popq %rbp
retq
nop