// File: /workspace/github_c_makefile_star2_O0/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 %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rdx
movq 0x10(%rax), %rcx
leaq 0x2a065(%rip), %rsi     # 0x2f30c
xorl %eax, %eax
callq 0x5450
movq -0x8(%rbp), %rax
movl (%rax), %eax
movq %rax, -0x18(%rbp)
subq $0x29, %rax
ja 0x541d
movq -0x18(%rbp), %rax
leaq 0x29f73(%rip), %rcx     # 0x2f240
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rax
movl 0x28(%rax), %edx
leaq 0x2a02f(%rip), %rsi     # 0x2f317
movb $0x0, %al
callq 0x5450
jmp 0x542f
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rax
movl 0x28(%rax), %edx
leaq 0x2a02d(%rip), %rsi     # 0x2f333
movb $0x0, %al
callq 0x5450
jmp 0x542f
movq -0x10(%rbp), %rdi
leaq 0x2a04d(%rip), %rsi     # 0x2f36a
movb $0x0, %al
callq 0x5450
jmp 0x542f
movq -0x10(%rbp), %rdi
leaq 0x2a064(%rip), %rsi     # 0x2f398
movb $0x0, %al
callq 0x5450
jmp 0x542f
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rax
movl 0x28(%rax), %edx
leaq 0x2a078(%rip), %rsi     # 0x2f3ca
movb $0x0, %al
callq 0x5450
jmp 0x542f
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rax
movl 0x28(%rax), %edx
leaq 0x2a0a1(%rip), %rsi     # 0x2f411
movb $0x0, %al
callq 0x5450
jmp 0x542f
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x30(%rax), %rax
movl %eax, %edx
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rcx
leaq 0x2a0c3(%rip), %rsi     # 0x2f45c
movb $0x0, %al
callq 0x5450
jmp 0x542f
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x30(%rax), %rax
movl %eax, %edx
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rcx
leaq 0x2a0e0(%rip), %rsi     # 0x2f4a2
movb $0x0, %al
callq 0x5450
jmp 0x542f
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rdx
movq -0x8(%rbp), %rax
movl 0x30(%rax), %ecx
movq -0x8(%rbp), %rax
movl 0x34(%rax), %r8d
leaq 0x2a0f5(%rip), %rsi     # 0x2f4e2
movb $0x0, %al
callq 0x5450
jmp 0x542f
movq -0x10(%rbp), %rdi
leaq 0x2a11c(%rip), %rsi     # 0x2f51d
movb $0x0, %al
callq 0x5450
jmp 0x542f
movq -0x8(%rbp), %rdi
addq $0x28, %rdi
movq -0x10(%rbp), %rsi
callq 0x5520
jmp 0x542f
movq -0x10(%rbp), %rdi
leaq 0x2a138(%rip), %rsi     # 0x2f560
movb $0x0, %al
callq 0x5450
movq -0x10(%rbp), %rsi
movl $0x2e, %edi
callq 0x5c00
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)