// File: /workspace/github_c_makefile_star2_O1/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 %r15
pushq %r14
pushq %rbx
subq $0xa8, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movl (%rsi), %ebp
cmpl $0x2, %ebp
jne 0x9f53
cmpl $0x60, 0x30(%r14)
jne 0x9f53
leaq 0xc(%rsp), %rdx
movl $0x60, (%rdx)
leaq 0x12b02(%rip), %r8      # 0x1c9c0
movq %rbx, %rdi
movl $0x1, %esi
xorl %ecx, %ecx
callq 0xbc6a
movq %rbx, %rdi
testb %al, %al
je 0xa04e
movl $0x97, %esi
callq 0xc14f
movq %rbx, %rdi
callq 0x8107
movq %rax, %rdi
xorl %esi, %esi
movl $0x60, %edx
callq 0x8b69
testb %al, %al
jne 0x9f08
movq %rbx, %rdi
movq %r14, %rsi
callq 0x8171
movq %rbx, %rdi
callq 0xb8b5
movq %rax, %rdi
xorl %esi, %esi
movl $0x60, %edx
callq 0x8b69
testb %al, %al
je 0x9f08
movq 0x18(%rbx), %r14
addq $0x18, %r14
leaq 0x11ad6(%rip), %r15     # 0x1ba08
movq %r14, %rdi
callq 0x7fa7
testq %rax, %rax
je 0x9f44
cmpq %r15, %rax
jne 0x9f32
movq 0x18(%rbx), %rax
movl $0x8, (%rax)
jmp 0x9ff0
cmpl $0x1, %ebp
jne 0x9f69
movl 0x30(%r14), %eax
leaq 0x13365(%rip), %rcx     # 0x1d2c8
cmpb $0x0, (%rax,%rcx)
jne 0x9f7d
cmpl $0x2, %ebp
jne 0x9ff7
cmpl $0x5f, 0x30(%r14)
jne 0xa025
leaq 0xc(%rsp), %rdx
movl $0x60, (%rdx)
leaq 0x12a31(%rip), %r8      # 0x1c9c0
movq %rbx, %rdi
movl $0x1, %esi
xorl %ecx, %ecx
callq 0xbc6a
testb %al, %al
je 0xa04b
movq %rbx, %rdi
callq 0xb8b5
movq %rax, %rdi
xorl %esi, %esi
movl $0x60, %edx
callq 0x8b69
testb %al, %al
je 0x9fa6
movq 0x18(%rbx), %r14
addq $0x18, %r14
leaq 0x11a38(%rip), %r15     # 0x1ba08
movq %r14, %rdi
callq 0x7fa7
testq %rax, %rax
je 0x9fe2
cmpq %r15, %rax
jne 0x9fd0
movq 0x18(%rbx), %rax
movl $0x8, (%rax)
movb $0x1, 0x50(%rax)
movb $0x1, %al
jmp 0xa077
leaq 0x12d6a(%rip), %rsi     # 0x1cd68
leaq 0x10(%rsp), %rdi
movl $0x98, %edx
callq 0x4190
movq %rbx, %rdi
movq %r14, %rsi
addq $0xa8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x4fa2
leaq 0x12d3c(%rip), %rsi     # 0x1cd68
leaq 0x10(%rsp), %rdi
movl $0x98, %edx
callq 0x4190
cmpl $0x2, %ebp
jne 0xa00d
movl 0x30(%r14), %eax
cmpb $0x0, 0x10(%rsp,%rax)
je 0xa00d
movq %rbx, %rdi
movq %r14, %rsi
callq 0x8171
movq 0x18(%rbx), %rax
movq 0x98(%rax), %rbx
movq %rbx, %rdi
callq 0xd3c9
cmpl $0x1, (%rbx)
jne 0xa075
xorps %xmm0, %xmm0
movups %xmm0, 0x38(%rbx)
xorl %eax, %eax
addq $0xa8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq