// File: /workspace/github_c_makefile_star2_O2/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 %rbp
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
movl (%rsi), %eax
cmpl $0x2, %eax
jne 0x9342
cmpl $0x60, 0x30(%r14)
jne 0x9342
pushq $0x60
popq %rsi
movq %rbx, %rdi
callq 0xb4f0
testb %al, %al
je 0x93bc
movq %rbx, %rdi
movl $0x97, %esi
callq 0xad93
movq %rbx, %rdi
callq 0x7913
pushq $0x60
popq %rsi
movq %rax, %rdi
callq 0x82b7
testb %al, %al
jne 0x9315
movq %rbx, %rdi
movq %r14, %rsi
callq 0x797d
pushq $0x60
popq %rbp
movq %rbx, %rdi
callq 0xa620
movq %rax, %rdi
movl %ebp, %esi
callq 0x82b7
testb %al, %al
je 0x9318
movq %rbx, %rdi
callq 0xa965
movq 0x18(%rbx), %rax
movl $0x8, (%rax)
jmp 0x9396
cmpl $0x1, %eax
jne 0x939a
movl 0x30(%r14), %ecx
leaq 0x10006(%rip), %rdx     # 0x19358
cmpb $0x0, (%rcx,%rdx)
je 0x93a8
pushq $0x60
popq %rsi
movq %rbx, %rdi
callq 0xb4f0
testb %al, %al
je 0x93bc
pushq $0x60
popq %rbp
movq %rbx, %rdi
callq 0xa620
movq %rax, %rdi
movl %ebp, %esi
callq 0x82b7
testb %al, %al
je 0x936a
movq %rbx, %rdi
callq 0xa965
movq 0x18(%rbx), %rax
movl $0x8, (%rax)
movb $0x1, 0x50(%rax)
movb $0x1, %al
jmp 0x93d1
cmpl $0x2, %eax
jne 0x93d6
movl 0x30(%r14), %ecx
cmpl $0x5f, %ecx
je 0x9358
cmpl $0x2, %eax
jne 0x93d6
movl %ecx, %eax
leaq 0xfa42(%rip), %rcx      # 0x18df8
cmpb $0x0, (%rax,%rcx)
je 0x93d6
movq %rbx, %rdi
movq %r14, %rsi
callq 0x797d
movq %rbx, %rdi
callq 0x83cf
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
retq
movq %rbx, %rdi
movq %r14, %rsi
popq %rbx
popq %r14
popq %rbp
jmp 0x4d63