// File: /workspace/github_c_makefile_star2_O3/craigbarnes[P]lua-gumbo/lib/error.c
// Function: gumbo_error_to_string
void gumbo_error_to_string (
  const GumboError* error,
  GumboStringBuffer* output
) {
  print_message (
    output,
    "@%zu:%zu: ",
    error->position.line,
    error->position.column
  );
  switch (error->type) {
    case GUMBO_ERR_UTF8_INVALID:
      print_message (
        output,
        "Invalid UTF8 character 0x%" PRIx32,
        error->v.codepoint
      );
      break;
    case GUMBO_ERR_UTF8_TRUNCATED:
      print_message (
        output,
        "Input stream ends with a truncated UTF8 character 0x%" PRIx32,
        error->v.codepoint
      );
      break;
    case GUMBO_ERR_UTF8_NULL:
      print_message (
        output,
        "Unexpected NULL character in the input stream"
      );
      break;
    case GUMBO_ERR_NUMERIC_CHAR_REF_NO_DIGITS:
      print_message (
        output,
        "No digits after &# in numeric character reference"
      );
      break;
    case GUMBO_ERR_NUMERIC_CHAR_REF_WITHOUT_SEMICOLON:
      print_message (
        output,
        "The numeric character reference &#%" PRIu32 " should be followed "
        "by a semicolon",
        error->v.codepoint
      );
      break;
    case GUMBO_ERR_NUMERIC_CHAR_REF_INVALID:
      print_message (
        output,
        "The numeric character reference &#%" PRIu32 "; encodes an invalid "
        "unicode codepoint",
        error->v.codepoint
      );
      break;
    case GUMBO_ERR_NAMED_CHAR_REF_WITHOUT_SEMICOLON:
      // The textual data came from one of the literal strings in the table, and
      // so it'll be null-terminated.
      print_message (
        output,
        "The named character reference &%.*s should be followed by a "
        "semicolon",
        (int) error->v.text.length,
        error->v.text.data
      );
      break;
    case GUMBO_ERR_NAMED_CHAR_REF_INVALID:
      print_message (
        output,
        "The named character reference &%.*s; is not a valid entity name",
        (int) error->v.text.length,
        error->v.text.data
      );
      break;
    case GUMBO_ERR_DUPLICATE_ATTR:
      print_message (
        output,
        "Attribute %s occurs multiple times, at positions %u and %u",
        error->v.duplicate_attr.name,
        error->v.duplicate_attr.original_index,
        error->v.duplicate_attr.new_index
      );
      break;
    case GUMBO_ERR_DASHES_OR_DOCTYPE:
      print_message (
        output,
        "Incorrectly opened comment; expected '--', 'DOCTYPE', or '[CDATA['"
      );
      break;
    case GUMBO_ERR_PARSER:
    case GUMBO_ERR_UNACKNOWLEDGED_SELF_CLOSING_TAG:
      handle_parser_error(&error->v.parser, output);
      break;
    default:
      print_message (
        output,
        "Tokenizer error with an unimplemented error message"
      );
      break;
  }
  gumbo_string_buffer_append_codepoint('.', output);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movq 0x8(%rdi), %rdx
movq 0x10(%rdi), %rcx
leaq 0x11318(%rip), %rsi     # 0x18294
movq %rbx, %rdi
xorl %eax, %eax
callq 0x7135
movl (%r14), %eax
cmpl $0x17, %eax
jg 0x6fb5
cmpl $0x7, %eax
ja 0x7011
movl %eax, %eax
leaq 0x112b4(%rip), %rcx     # 0x18250
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl 0x28(%r14), %edx
leaq 0x112ef(%rip), %rsi     # 0x1829f
jmp 0x708d
leal -0x28(%rax), %ecx
cmpl $0x2, %ecx
jb 0x6fd7
cmpl $0x18, %eax
je 0x7060
cmpl $0x1b, %eax
jne 0x7011
leaq 0x114d3(%rip), %rsi     # 0x184a5
jmp 0x70f8
cmpl $0x0, 0x30(%r14)
movl 0x28(%r14), %eax
je 0x70b4
cmpl $0x8, %eax
ja 0x7102
addq $0x28, %r14
movl %eax, %eax
leaq 0x11274(%rip), %rcx     # 0x18270
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x115b9(%rip), %rsi     # 0x185c5
jmp 0x70f8
leaq 0x114d0(%rip), %rsi     # 0x184e8
jmp 0x70f8
movl 0x28(%r14), %edx
leaq 0x1132a(%rip), %rsi     # 0x18352
jmp 0x708d
leaq 0x112c1(%rip), %rsi     # 0x182f2
jmp 0x70f8
leaq 0x112e3(%rip), %rsi     # 0x18320
jmp 0x70f8
movl 0x30(%r14), %edx
movq 0x28(%r14), %rcx
leaq 0x113d9(%rip), %rsi     # 0x1842a
jmp 0x70a8
movl 0x28(%r14), %edx
leaq 0x1125d(%rip), %rsi     # 0x182bb
jmp 0x708d
movq 0x28(%r14), %rdx
movl 0x30(%r14), %ecx
movl 0x34(%r14), %r8d
leaq 0x113f7(%rip), %rsi     # 0x1846a
movq %rbx, %rdi
xorl %eax, %eax
callq 0x7135
jmp 0x7102
movl 0x28(%r14), %edx
leaq 0x1130c(%rip), %rsi     # 0x18399
movq %rbx, %rdi
xorl %eax, %eax
callq 0x7135
jmp 0x7102
movl 0x30(%r14), %edx
movq 0x28(%r14), %rcx
leaq 0x1133c(%rip), %rsi     # 0x183e4
movq %rbx, %rdi
xorl %eax, %eax
callq 0x7135
jmp 0x7102
testl %eax, %eax
je 0x70c1
leaq 0x11462(%rip), %rsi     # 0x18521
jmp 0x70f8
leaq 0x1148d(%rip), %rsi     # 0x18555
jmp 0x70f8
leaq 0x11551(%rip), %rsi     # 0x18622
jmp 0x70da
leaq 0x11532(%rip), %rsi     # 0x1860c
movq %rbx, %rdi
xorl %eax, %eax
callq 0x7135
movq %r14, %rdi
movq %rbx, %rsi
callq 0x73e7
jmp 0x7102
leaq 0x114f0(%rip), %rsi     # 0x185e8
movq %rbx, %rdi
xorl %eax, %eax
callq 0x7135
movl $0x2e, %edi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x4322
leaq 0x16328(%rip), %rdi     # 0x1d445
leaq 0x1144d(%rip), %rsi     # 0x18571
leaq 0x11452(%rip), %rcx     # 0x1857d
movl $0x51, %edx
callq 0x4100