// File: /workspace/github_c_makefile_star2_O3/craigbarnes[P]lua-gumbo/lib/tokenizer.c
// Function: handle_char_ref_in_attr_value_state
static StateResult handle_char_ref_in_attr_value_state (
  GumboParser* parser,
  GumboTokenizerState* tokenizer,
  int UNUSED_ARG(c),
  GumboToken* UNUSED_ARG(output)
) {
  OneOrTwoCodepoints char_ref;
  int allowed_char;
  bool is_unquoted = false;
  switch (tokenizer->_tag_state._attr_value_state) {
    case GUMBO_LEX_ATTR_VALUE_DOUBLE_QUOTED:
      allowed_char = '"';
      break;
    case GUMBO_LEX_ATTR_VALUE_SINGLE_QUOTED:
      allowed_char = '\'';
      break;
    case GUMBO_LEX_ATTR_VALUE_UNQUOTED:
      allowed_char = '>';
      is_unquoted = true;
      break;
    default:
      // -Wmaybe-uninitialized is a little overzealous here, and doesn't
      // get that the assert(0) means this codepath will never happen.
      allowed_char = ' ';
      assert(0);
  }

  // Ignore the status, since we don't have a convenient way of signalling that
  // a parser error has occurred when the error occurs in the middle of a
  // multi-state token. We'd need a flag inside the TokenizerState to do this,
  // but that's a low priority fix.
  gumbo_consume_char_ref (
    parser,
    &tokenizer->_input,
    allowed_char,
    true,
    &char_ref
  );
  if (char_ref.first != kGumboNoChar) {
    tokenizer->_reconsume_current_input = true;
    append_char_to_tag_buffer(parser, char_ref.first, is_unquoted);
    if (char_ref.second != kGumboNoChar) {
      append_char_to_tag_buffer(parser, char_ref.second, is_unquoted);
    }
  } else {
    append_char_to_tag_buffer(parser, '&', is_unquoted);
  }
  gumbo_tokenizer_set_state(parser, tokenizer->_tag_state._attr_value_state);
  return NEXT_CHAR;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movl 0xbc(%rsi), %eax
cmpl $0x25, %eax
je 0xeb60
cmpl $0x27, %eax
je 0xeb56
cmpl $0x26, %eax
jne 0xec6f
movl $0x27, %edx
jmp 0xeb65
movb $0x1, %bpl
movl $0x3e, %edx
jmp 0xeb67
movl $0x22, %edx
xorl %ebp, %ebp
leaq 0xe8(%r14), %rsi
movq %rsp, %r15
movq %rbx, %rdi
movl $0x1, %ecx
movq %r15, %r8
callq 0x1142c
movl (%r15), %edi
leaq 0x11db5(%rip), %rax     # 0x20940
movl (%rax), %r15d
cmpl %r15d, %edi
jne 0xebe2
movq 0x10(%rbx), %rsi
cmpq $0x0, 0x70(%rsi)
setne %al
xorb $0x1, %bpl
movl $0x26, %edi
orb %al, %bpl
jne 0xebd7
movq 0x120(%rsi), %rax
movq %rax, 0xa0(%rsi)
movups 0x110(%rsi), %xmm0
movups %xmm0, 0x90(%rsi)
movq 0xe8(%rsi), %rax
movq %rax, 0x80(%rsi)
addq $0x68, %rsi
callq 0x4322
jmp 0xec38
movb $0x1, 0x4(%r14)
movq 0x10(%rbx), %rsi
cmpq $0x0, 0x70(%rsi)
setne %al
movl %ebp, %ecx
xorb $0x1, %cl
orb %al, %cl
jne 0xec26
movq 0x120(%rsi), %rax
movq %rax, 0xa0(%rsi)
movups 0x110(%rsi), %xmm0
movups %xmm0, 0x90(%rsi)
movq 0xe8(%rsi), %rax
movq %rax, 0x80(%rsi)
addq $0x68, %rsi
callq 0x4322
movl 0x4(%rsp), %edi
cmpl %r15d, %edi
jne 0xec55
movl 0xbc(%r14), %eax
movq 0x10(%rbx), %rcx
movl %eax, (%rcx)
movl $0x2, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq 0x10(%rbx), %rsi
cmpq $0x0, 0x70(%rsi)
sete %al
testb %al, %bpl
jne 0xebad
jmp 0xebd7
leaq 0xe7cf(%rip), %rdi      # 0x1d445
leaq 0xebe7(%rip), %rsi      # 0x1d864
leaq 0xf5e2(%rip), %rcx      # 0x1e266
movl $0x849, %edx            # imm = 0x849
callq 0x4100