// File: /workspace/github_c_makefile_star2_O3/craigbarnes[P]lua-gumbo/lib/parser.c
// Function: handle_in_caption
static bool handle_in_caption(GumboParser* parser, GumboToken* token) {
  if (tag_is(token, kEndTag, GUMBO_TAG_CAPTION)) {
    if (!has_an_element_in_table_scope(parser, GUMBO_TAG_CAPTION)) {
      parser_add_parse_error(parser, token);
      ignore_token(parser);
      return false;
    } else {
      generate_implied_end_tags(parser, GUMBO_TAG_LAST);
      bool result = true;
      if (!node_html_tag_is(get_current_node(parser), GUMBO_TAG_CAPTION)) {
        parser_add_parse_error(parser, token);
      }
      while (!node_html_tag_is(pop_current_node(parser), GUMBO_TAG_CAPTION)) {
        ;
      }
      clear_active_formatting_elements(parser);
      set_insertion_mode(parser, GUMBO_INSERTION_MODE_IN_TABLE);
      return result;
    }
  } else if (
    tag_in(token, kStartTag, &(const TagSet) {
      TAG(CAPTION), TAG(COL), TAG(COLGROUP), TAG(TBODY), TAG(TD),
      TAG(TFOOT), TAG(TH), TAG(THEAD), TAG(TR)
    })
    || (tag_is(token, kEndTag, GUMBO_TAG_TABLE))
  ) {
    if (!has_an_element_in_table_scope(parser, GUMBO_TAG_CAPTION)) {
      parser_add_parse_error(parser, token);
      ignore_token(parser);
      return false;
    }
    while (!node_html_tag_is(pop_current_node(parser), GUMBO_TAG_CAPTION)) {
      ;
    }
    clear_active_formatting_elements(parser);
    set_insertion_mode(parser, GUMBO_INSERTION_MODE_IN_TABLE);
    parser->_parser_state->_reprocess_current_token = true;
    return true;
  } else if (
    tag_in(token, kEndTag, &(const TagSet) {
      TAG(BODY), TAG(COL), TAG(COLGROUP), TAG(HTML), TAG(TBODY), TAG(TD),
      TAG(TFOOT), TAG(TH), TAG(THEAD), TAG(TR)
    })
  ) {
    parser_add_parse_error(parser, token);
    ignore_token(parser);
    return false;
  } else {
    return handle_in_body(parser, token);
  }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movl (%rsi), %eax
cmpl $0x1, %eax
je 0x9945
cmpl $0x2, %eax
jne 0x9a11
movl 0x30(%r14), %eax
cmpq $0x5f, %rax
je 0x995a
cmpl $0x60, %eax
jne 0x99ce
movq 0x18(%rbx), %rdi
leaq 0x8(%rsp), %rdx
movl $0x60, (%rdx)
leaq 0x1122d(%rip), %r8      # 0x1aae0
movl $0x1, %esi
xorl %ecx, %ecx
callq 0xb40a
movq %rbx, %rdi
testb %al, %al
je 0x99de
movl $0x97, %esi
callq 0xb86c
movq %rbx, %rdi
callq 0x7d33
movq %rax, %rdi
xorl %esi, %esi
movl $0x60, %edx
callq 0x8739
testb %al, %al
jne 0x98fa
movq %rbx, %rdi
movq %r14, %rsi
callq 0x7d9d
movq %rbx, %rdi
callq 0xaffb
movq %rax, %rdi
xorl %esi, %esi
movl $0x60, %edx
callq 0x8739
testb %al, %al
je 0x98fa
movq 0x18(%rbx), %r14
addq $0x18, %r14
leaq 0x10204(%rip), %r15     # 0x19b28
movq %r14, %rdi
callq 0x7bd3
testq %rax, %rax
je 0x9936
cmpq %r15, %rax
jne 0x9924
movq 0x18(%rbx), %rax
movl $0x8, (%rax)
jmp 0x99ca
movl 0x30(%r14), %eax
leaq 0x11a98(%rip), %rcx     # 0x1b3e8
cmpb $0x0, (%rax,%rcx)
je 0x9a11
movq 0x18(%rbx), %rdi
leaq 0xc(%rsp), %rdx
movl $0x60, (%rdx)
leaq 0x11170(%rip), %r8      # 0x1aae0
movl $0x1, %esi
xorl %ecx, %ecx
callq 0xb40a
testb %al, %al
je 0x99db
movq %rbx, %rdi
callq 0xaffb
movq %rax, %rdi
xorl %esi, %esi
movl $0x60, %edx
callq 0x8739
testb %al, %al
je 0x9980
movq 0x18(%rbx), %r14
addq $0x18, %r14
leaq 0x1017e(%rip), %r15     # 0x19b28
movq %r14, %rdi
callq 0x7bd3
testq %rax, %rax
je 0x99bc
cmpq %r15, %rax
jne 0x99aa
movq 0x18(%rbx), %rax
movl $0x8, (%rax)
movb $0x1, 0x50(%rax)
movb $0x1, %al
jmp 0x9a07
leaq 0x114b3(%rip), %rcx     # 0x1ae88
cmpb $0x0, (%rax,%rcx)
je 0x9a11
movq %rbx, %rdi
movq %r14, %rsi
callq 0x7d9d
movq 0x18(%rbx), %rax
movq 0x98(%rax), %rbx
movq %rbx, %rdi
callq 0xc990
cmpl $0x1, (%rbx)
jne 0x9a05
xorps %xmm0, %xmm0
movups %xmm0, 0x38(%rbx)
xorl %eax, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
movq %rbx, %rdi
movq %r14, %rsi
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
jmp 0x4ece