// File: /workspace/github_c_makefile_star2_O1/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 0xf52f
cmpl $0x27, %eax
je 0xf525
cmpl $0x26, %eax
jne 0xf63e
movl $0x27, %edx
jmp 0xf534
movb $0x1, %bpl
movl $0x3e, %edx
jmp 0xf536
movl $0x22, %edx
xorl %ebp, %ebp
leaq 0xe8(%r14), %rsi
movq %rsp, %r15
movq %rbx, %rdi
movl $0x1, %ecx
movq %r15, %r8
callq 0x11eb0
movl (%r15), %edi
leaq 0x132c6(%rip), %rax     # 0x22820
movl (%rax), %r15d
cmpl %r15d, %edi
jne 0xf5b1
movq 0x10(%rbx), %rsi
cmpq $0x0, 0x70(%rsi)
setne %al
xorb $0x1, %bpl
movl $0x26, %edi
orb %al, %bpl
jne 0xf5a6
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 0xf607
movb $0x1, 0x4(%r14)
movq 0x10(%rbx), %rsi
cmpq $0x0, 0x70(%rsi)
setne %al
movl %ebp, %ecx
xorb $0x1, %cl
orb %al, %cl
jne 0xf5f5
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 0xf624
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 0xf57c
jmp 0xf5a6
leaq 0xfce0(%rip), %rdi      # 0x1f325
leaq 0x100f8(%rip), %rsi     # 0x1f744
leaq 0x10af3(%rip), %rcx     # 0x20146
movl $0x849, %edx            # imm = 0x849
callq 0x4100