// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
movq -0x18(%rbp), %rax
movq $0x0, (%rax)
cmpq $0x0, -0x10(%rbp)
jne 0x4bf5
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x4da2
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
movl %eax, -0x34(%rbp)
movq -0x10(%rbp), %rdi
callq 0x10b0
movl %eax, -0x38(%rbp)
cmpl $0x27, -0x34(%rbp)
je 0x4c23
cmpl $0x22, -0x34(%rbp)
je 0x4c23
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x4da2
movl -0x34(%rbp), %eax
movq -0x10(%rbp), %rcx
movsbl 0x1(%rcx), %ecx
cmpl %ecx, %eax
jne 0x4cee
movl -0x34(%rbp), %eax
movq -0x10(%rbp), %rcx
movsbl 0x2(%rcx), %ecx
cmpl %ecx, %eax
jne 0x4cee
movl $0x1, -0x1c(%rbp)
movq -0x10(%rbp), %rax
addq $0x3, %rax
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rax
movslq -0x38(%rbp), %rcx
addq %rcx, %rax
addq $-0x3, %rax
movq %rax, -0x30(%rbp)
movq -0x28(%rbp), %rax
cmpq -0x30(%rbp), %rax
ja 0x4c9f
movq -0x30(%rbp), %rax
movsbl (%rax), %eax
cmpl -0x34(%rbp), %eax
jne 0x4c9f
movq -0x30(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl -0x34(%rbp), %eax
jne 0x4c9f
movq -0x30(%rbp), %rax
movsbl 0x2(%rax), %eax
cmpl -0x34(%rbp), %eax
je 0x4cab
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x4da2
movq -0x28(%rbp), %rax
movsbl (%rax), %eax
cmpl $0xa, %eax
jne 0x4cc5
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0x4cec
movq -0x28(%rbp), %rax
movsbl (%rax), %eax
cmpl $0xd, %eax
jne 0x4cea
movq -0x28(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl $0xa, %eax
jne 0x4cea
movq -0x28(%rbp), %rax
addq $0x2, %rax
movq %rax, -0x28(%rbp)
jmp 0x4cec
jmp 0x4d2e
movq -0x10(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rax
movslq -0x38(%rbp), %rcx
addq %rcx, %rax
addq $-0x1, %rax
movq %rax, -0x30(%rbp)
movq -0x28(%rbp), %rax
cmpq -0x30(%rbp), %rax
ja 0x4d23
movq -0x30(%rbp), %rax
movsbl (%rax), %eax
cmpl -0x34(%rbp), %eax
je 0x4d2c
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x4da2
jmp 0x4d2e
cmpl $0x27, -0x34(%rbp)
jne 0x4d60
movq -0x28(%rbp), %rdi
movq -0x30(%rbp), %rax
movq -0x28(%rbp), %rcx
subq %rcx, %rax
movl %eax, %esi
movl -0x1c(%rbp), %edx
xorl %eax, %eax
movl %eax, %ecx
xorl %r8d, %r8d
callq 0x4db0
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
jmp 0x4d8a
movq -0x28(%rbp), %rdi
movq -0x30(%rbp), %rax
movq -0x28(%rbp), %rcx
subq %rcx, %rax
movl %eax, %esi
movl -0x1c(%rbp), %edx
xorl %eax, %eax
movl %eax, %ecx
xorl %r8d, %r8d
callq 0x4f30
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
movq -0x18(%rbp), %rax
movq (%rax), %rdx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
xorl %ecx, %ecx
cmpq $0x0, %rdx
cmovnel %ecx, %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax,%rax)