// File: /workspace/github_c_makefile_star2_O0/cktan[P]tomlc99/toml.c
// Function: norm_lit_str
static char *norm_lit_str(const char *src, int srclen, int multiline,
                          char *errbuf, int errbufsz) {
  char *dst = 0; /* will write to dst[] and return it */
  int max = 0;   /* max size of dst[] */
  int off = 0;   /* cur offset in dst[] */
  const char *sp = src;
  const char *sq = src + srclen;
  int ch;

  /* scan forward on src */
  for (;;) {
    if (off >= max - 10) { /* have some slack for misc stuff */
      int newmax = max + 50;
      char *x = expand(dst, max, newmax);
      if (!x) {
        xfree(dst);
        snprintf(errbuf, errbufsz, "out of memory");
        return 0;
      }
      dst = x;
      max = newmax;
    }

    /* finished? */
    if (sp >= sq)
      break;

    ch = *sp++;
    /* control characters other than tab is not allowed */
    if ((0 <= ch && ch <= 0x08) || (0x0a <= ch && ch <= 0x1f) || (ch == 0x7f)) {
      if (!(multiline && (ch == '\r' || ch == '\n'))) {
        xfree(dst);
        snprintf(errbuf, errbufsz, "invalid char U+%04x", ch);
        return 0;
      }
    }

    // a plain copy suffice
    dst[off++] = ch;
  }

  dst[off++] = 0;
  return dst;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl %edx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movl %r8d, -0x24(%rbp)
movq $0x0, -0x30(%rbp)
movl $0x0, -0x34(%rbp)
movl $0x0, -0x38(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x48(%rbp)
movl -0x38(%rbp), %eax
movl -0x34(%rbp), %ecx
subl $0xa, %ecx
cmpl %ecx, %eax
jl 0x4e61
movl -0x34(%rbp), %eax
addl $0x32, %eax
movl %eax, -0x50(%rbp)
movq -0x30(%rbp), %rdi
movl -0x34(%rbp), %esi
movl -0x50(%rbp), %edx
callq 0x3750
movq %rax, -0x58(%rbp)
cmpq $0x0, -0x58(%rbp)
jne 0x4e53
movq -0x30(%rbp), %rdi
callq 0x3500
movq -0x20(%rbp), %rdi
movslq -0x24(%rbp), %rsi
leaq 0x345e(%rip), %rdx      # 0x829d
movb $0x0, %al
callq 0x10e0
movq $0x0, -0x8(%rbp)
jmp 0x4f25
movq -0x58(%rbp), %rax
movq %rax, -0x30(%rbp)
movl -0x50(%rbp), %eax
movl %eax, -0x34(%rbp)
movq -0x40(%rbp), %rax
cmpq -0x48(%rbp), %rax
jb 0x4e70
jmp 0x4f07
movq -0x40(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x40(%rbp)
movsbl (%rax), %eax
movl %eax, -0x4c(%rbp)
xorl %eax, %eax
cmpl -0x4c(%rbp), %eax
jg 0x4e92
cmpl $0x8, -0x4c(%rbp)
jle 0x4ea8
movl $0xa, %eax
cmpl -0x4c(%rbp), %eax
jg 0x4ea2
cmpl $0x1f, -0x4c(%rbp)
jle 0x4ea8
cmpl $0x7f, -0x4c(%rbp)
jne 0x4ee8
cmpl $0x0, -0x18(%rbp)
je 0x4eba
cmpl $0xd, -0x4c(%rbp)
je 0x4ee6
cmpl $0xa, -0x4c(%rbp)
je 0x4ee6
movq -0x30(%rbp), %rdi
callq 0x3500
movq -0x20(%rbp), %rdi
movslq -0x24(%rbp), %rsi
movl -0x4c(%rbp), %ecx
leaq 0x387b(%rip), %rdx      # 0x8750
movb $0x0, %al
callq 0x10e0
movq $0x0, -0x8(%rbp)
jmp 0x4f25
jmp 0x4ee8
movl -0x4c(%rbp), %eax
movb %al, %dl
movq -0x30(%rbp), %rax
movl -0x38(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x38(%rbp)
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
jmp 0x4df7
movq -0x30(%rbp), %rax
movl -0x38(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x38(%rbp)
movslq %ecx, %rcx
movb $0x0, (%rax,%rcx)
movq -0x30(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x60, %rsp
popq %rbp
retq
nop