// File: /workspace/github_c_makefile_star2_O2/cktan[P]tomlc99/toml.c
// Function: toml_rtos
int toml_rtos(toml_raw_t src, char **ret) {
  int multiline = 0;
  const char *sp;
  const char *sq;

  *ret = 0;
  if (!src)
    return -1;

  // for strings, first char must be a s-quote or d-quote
  int qchar = src[0];
  int srclen = strlen(src);
  if (!(qchar == '\'' || qchar == '"')) {
    return -1;
  }

  // triple quotes?
  if (qchar == src[1] && qchar == src[2]) {
    multiline = 1;         // triple-quote implies multiline
    sp = src + 3;          // first char after quote
    sq = src + srclen - 3; // first char of ending quote

    if (!(sp <= sq && sq[0] == qchar && sq[1] == qchar && sq[2] == qchar)) {
      // last 3 chars in src must be qchar
      return -1;
    }

    /* skip new line immediate after qchar */
    if (sp[0] == '\n')
      sp++;
    else if (sp[0] == '\r' && sp[1] == '\n')
      sp += 2;

  } else {
    sp = src + 1;          // first char after quote
    sq = src + srclen - 1; // ending quote
    if (!(sp <= sq && *sq == qchar)) {
      /* last char in src must be qchar */
      return -1;
    }
  }

  // at this point:
  //     sp points to first valid char after quote.
  //     sq points to one char beyond last valid char.
  //     string len is (sq - sp).
  if (qchar == '\'') {
    *ret = norm_lit_str(sp, sq - sp, multiline, 0, 0);
  } else {
    *ret = norm_basic_str(sp, sq - sp, multiline, 0, 0);
  }

  return *ret ? 0 : -1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
andq $0x0, (%rsi)
pushq $-0x1
popq %rbp
testq %rdi, %rdi
je 0x3aee
movq %rsi, %rbx
movq %rdi, %r15
movzbl (%rdi), %r12d
callq 0x10b0
cmpl $0x27, %r12d
je 0x3969
cmpl $0x22, %r12d
jne 0x3aee
cmpb 0x1(%r15), %r12b
jne 0x39d3
cmpb 0x2(%r15), %r12b
jne 0x39d3
cltq
cmpq $0x6, %rax
jl 0x3aee
leaq (%r15,%rax), %rsi
addq $-0x3, %rsi
cmpb %r12b, (%rsi)
jne 0x3aee
addq %r15, %rax
cmpb %r12b, -0x2(%rax)
jne 0x3aee
cmpb %r12b, -0x1(%rax)
jne 0x3aee
leaq 0x3(%r15), %rdi
movzbl (%rdi), %eax
pushq $0x1
popq %rdx
cmpl $0xd, %eax
je 0x3aff
cmpl $0xa, %eax
jne 0x3b0c
addq $0x4, %r15
movl $0x0, 0x4(%rsp)
jmp 0x39fc
cltq
cmpq $0x2, %rax
jl 0x3aee
cmpb %r12b, -0x1(%r15,%rax)
jne 0x3aee
leaq (%r15,%rax), %rsi
decq %rsi
incq %r15
xorl %edx, %edx
movb $0x1, %al
movl %eax, 0x4(%rsp)
movq %r15, %rdi
subq %rdi, %rsi
cmpb $0x27, %r12b
jne 0x3a91
movslq %esi, %r13
addq %rdi, %r13
xorl %r14d, %r14d
xorl %esi, %esi
xorl %r12d, %r12d
leal -0xa(%rsi), %eax
cltq
cmpq %rax, %r14
jge 0x3a29
movq %r12, %r15
jmp 0x3a4a
leal 0x32(%rsi), %ebp
movq %rdi, %r15
movq %r12, %rdi
movl %ebp, %edx
callq 0x2fae
movq %r15, %rdi
movq %rax, %r15
movl %ebp, %esi
testq %rax, %rax
je 0x3ad2
leaq (%rdi,%r14), %rax
cmpq %r13, %rax
jae 0x3ac8
movzbl (%rax), %r12d
cmpl $0x9, %r12d
jb 0x3a72
leal -0xa(%r12), %eax
cmpb $0x16, %al
setae %al
cmpb $0x7f, %r12b
setne %cl
testb %al, %cl
jne 0x3a85
cmpb $0x0, 0x4(%rsp)
jne 0x3aa0
cmpl $0xa, %r12d
je 0x3a85
cmpl $0xd, %r12d
jne 0x3aa0
movb %r12b, (%r15,%r14)
incq %r14
movq %r15, %r12
jmp 0x3a1a
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x3b19
movq %rax, %r15
jmp 0x3ae3
testq %r15, %r15
je 0x3aae
movq %r15, %rdi
callq *0x466a(%rip)           # 0x8118
leaq 0x1bc3(%rip), %rdx      # 0x5678
xorl %r15d, %r15d
xorl %edi, %edi
xorl %esi, %esi
movl %r12d, %ecx
xorl %eax, %eax
callq 0x10e0
jmp 0x3ae3
movl %r14d, %eax
movb $0x0, (%r15,%rax)
jmp 0x3ae3
testq %r12, %r12
je 0x3ae0
movq %r12, %rdi
callq *0x4638(%rip)           # 0x8118
xorl %r15d, %r15d
movq %r15, (%rbx)
xorl %ebp, %ebp
cmpq $0x1, %r15
sbbl %ebp, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpb $0xa, 0x4(%r15)
leaq 0x5(%r15), %rax
cmoveq %rax, %rdi
movl $0x0, 0x4(%rsp)
jmp 0x39ff