// File: /workspace/github_c_makefile_star2_O2/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 0xf66a(%rip), %rsi      # 0x16294
movq %rbx, %rdi
xorl %eax, %eax
callq 0x6dd6
movl (%r14), %eax
cmpq $0x7, %rax
ja 0x6c5d
leaq 0xf60c(%rip), %rcx      # 0x16250
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl 0x28(%r14), %edx
leaq 0xf647(%rip), %rsi      # 0x1629f
jmp 0x6d29
leal -0x28(%rax), %ecx
cmpl $0x2, %ecx
jb 0x6c7f
cmpl $0x18, %eax
je 0x6cc6
cmpl $0x1b, %eax
jne 0x6d50
leaq 0xf82b(%rip), %rsi      # 0x164a5
jmp 0x6d9d
cmpl $0x0, 0x30(%r14)
movl 0x28(%r14), %eax
je 0x6d59
cmpl $0x8, %eax
ja 0x6da7
addq $0x28, %r14
movl %eax, %eax
leaq 0xf5cc(%rip), %rcx      # 0x16270
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0xf911(%rip), %rsi      # 0x165c5
jmp 0x6d9d
movl 0x28(%r14), %edx
leaq 0xf68e(%rip), %rsi      # 0x16352
jmp 0x6d29
movq 0x28(%r14), %rdx
movl 0x30(%r14), %ecx
movl 0x34(%r14), %r8d
leaq 0xf791(%rip), %rsi      # 0x1646a
movq %rbx, %rdi
xorl %eax, %eax
callq 0x6dd6
jmp 0x6da7
leaq 0xf603(%rip), %rsi      # 0x162f2
jmp 0x6d9d
leaq 0xf625(%rip), %rsi      # 0x16320
jmp 0x6d9d
movl 0x30(%r14), %edx
movq 0x28(%r14), %rcx
leaq 0xf71b(%rip), %rsi      # 0x1642a
jmp 0x6d44
movl 0x28(%r14), %edx
leaq 0xf59f(%rip), %rsi      # 0x162bb
jmp 0x6d29
movl 0x28(%r14), %edx
leaq 0xf670(%rip), %rsi      # 0x16399
movq %rbx, %rdi
xorl %eax, %eax
callq 0x6dd6
jmp 0x6da7
movl 0x30(%r14), %edx
movq 0x28(%r14), %rcx
leaq 0xf6a0(%rip), %rsi      # 0x163e4
movq %rbx, %rdi
xorl %eax, %eax
callq 0x6dd6
jmp 0x6da7
leaq 0xf791(%rip), %rsi      # 0x164e8
jmp 0x6d9d
testl %eax, %eax
je 0x6d66
leaq 0xf7bd(%rip), %rsi      # 0x16521
jmp 0x6d9d
leaq 0xf7e8(%rip), %rsi      # 0x16555
jmp 0x6d9d
leaq 0xf8ac(%rip), %rsi      # 0x16622
jmp 0x6d7f
leaq 0xf88d(%rip), %rsi      # 0x1660c
movq %rbx, %rdi
xorl %eax, %eax
callq 0x6dd6
movq %r14, %rdi
movq %rbx, %rsi
callq 0x7072
jmp 0x6da7
leaq 0xf84b(%rip), %rsi      # 0x165e8
movq %rbx, %rdi
xorl %eax, %eax
callq 0x6dd6
pushq $0x2e
popq %rdi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x42a0
leaq 0x145f5(%rip), %rdi     # 0x1b3b5
leaq 0xf7aa(%rip), %rsi      # 0x16571
leaq 0xf7af(%rip), %rcx      # 0x1657d
pushq $0x51
popq %rdx
callq 0x4100