// File: /workspace/github_c_makefile_star2_O3/craigbarnes[P]lua-gumbo/lib/parser.c
// Function: handle_in_table
static bool handle_in_table(GumboParser* parser, GumboToken* token) {
  GumboParserState* state = parser->_parser_state;
  if (
    token->type == GUMBO_TOKEN_CHARACTER
    || token->type == GUMBO_TOKEN_WHITESPACE
  ) {
    // The "pending table character tokens" list described in the spec is
    // nothing more than the TextNodeBufferState. We accumulate text tokens as
    // normal, except that when we go to flush them in the handle_in_table_text,
    // we set _foster_parent_insertions if there're non-whitespace characters in
    // the buffer.
    assert(state->_text_node._buffer.length == 0);
    state->_original_insertion_mode = state->_insertion_mode;
    state->_reprocess_current_token = true;
    set_insertion_mode(parser, GUMBO_INSERTION_MODE_IN_TABLE_TEXT);
    return true;
  } else if (token->type == GUMBO_TOKEN_DOCTYPE) {
    parser_add_parse_error(parser, token);
    ignore_token(parser);
    return false;
  } else if (token->type == GUMBO_TOKEN_COMMENT) {
    append_comment_node(parser, get_current_node(parser), token);
    return true;
  } else if (tag_is(token, kStartTag, GUMBO_TAG_CAPTION)) {
    clear_stack_to_table_context(parser);
    add_formatting_element(parser, &kActiveFormattingScopeMarker);
    insert_element_from_token(parser, token);
    set_insertion_mode(parser, GUMBO_INSERTION_MODE_IN_CAPTION);
    return true;
  } else if (tag_is(token, kStartTag, GUMBO_TAG_COLGROUP)) {
    clear_stack_to_table_context(parser);
    insert_element_from_token(parser, token);
    set_insertion_mode(parser, GUMBO_INSERTION_MODE_IN_COLUMN_GROUP);
    return true;
  } else if (tag_is(token, kStartTag, GUMBO_TAG_COL)) {
    clear_stack_to_table_context(parser);
    insert_element_of_tag_type (
      parser,
      GUMBO_TAG_COLGROUP,
      GUMBO_INSERTION_IMPLIED
    );
    parser->_parser_state->_reprocess_current_token = true;
    set_insertion_mode(parser, GUMBO_INSERTION_MODE_IN_COLUMN_GROUP);
    return true;
  } else if (
    tag_in(token, kStartTag, &(const TagSet) {
      TAG(TBODY), TAG(TFOOT), TAG(THEAD), TAG(TD), TAG(TH), TAG(TR)
    })
  ) {
    clear_stack_to_table_context(parser);
    set_insertion_mode(parser, GUMBO_INSERTION_MODE_IN_TABLE_BODY);
    if (tag_in(token, kStartTag, &(const TagSet){TAG(TD), TAG(TH), TAG(TR)})) {
      insert_element_of_tag_type (
        parser,
        GUMBO_TAG_TBODY,
        GUMBO_INSERTION_IMPLIED
      );
      state->_reprocess_current_token = true;
    } else {
      insert_element_from_token(parser, token);
    }
    return true;
  } else if (tag_is(token, kStartTag, GUMBO_TAG_TABLE)) {
    parser_add_parse_error(parser, token);
    if (close_table(parser)) {
      parser->_parser_state->_reprocess_current_token = true;
    } else {
      ignore_token(parser);
    }
    return false;
  } else if (tag_is(token, kEndTag, GUMBO_TAG_TABLE)) {
    if (!close_table(parser)) {
      parser_add_parse_error(parser, token);
      return false;
    }
    return true;
  } else if (
    tag_in(token, kEndTag, &(const TagSet) {
      TAG(BODY), TAG(CAPTION), 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 if (
    tag_in(token, kStartTag, &(const TagSet){TAG(STYLE), TAG(SCRIPT), TAG(TEMPLATE)})
    || (tag_is(token, kEndTag, GUMBO_TAG_TEMPLATE))
  ) {
    return handle_in_head(parser, token);
  } else if (
    tag_is(token, kStartTag, GUMBO_TAG_INPUT)
    && attribute_matches(&token->v.start_tag.attributes, "type", "hidden")
  ) {
    parser_add_parse_error(parser, token);
    insert_element_from_token(parser, token);
    pop_current_node(parser);
    return false;
  } else if (tag_is(token, kStartTag, GUMBO_TAG_FORM)) {
    parser_add_parse_error(parser, token);
    if (state->_form_element || has_open_element(parser, GUMBO_TAG_TEMPLATE)) {
      ignore_token(parser);
      return false;
    }
    state->_form_element = insert_element_from_token(parser, token);
    pop_current_node(parser);
    return false;
  } else if (token->type == GUMBO_TOKEN_EOF) {
    return handle_in_body(parser, token);
  } else {
    parser_add_parse_error(parser, token);
    state->_foster_parent_insertions = true;
    bool result = handle_in_body(parser, token);
    state->_foster_parent_insertions = false;
    return result;
  }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa0, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movq 0x18(%rdi), %r12
movl (%rsi), %eax
cmpq $0x5, %rax
ja 0x96d9
leaq 0x101dc(%rip), %rcx     # 0x19634
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
cmpq $0x0, 0x60(%r12)
jne 0x9791
movl (%r12), %eax
movl %eax, 0x4(%r12)
movb $0x1, 0x50(%r12)
movl $0x9, (%r12)
jmp 0x95a5
movl 0x30(%r14), %eax
cmpq $0x5f, %rax
jne 0x9525
movq %rbx, %rdi
callq 0xc526
movl %eax, %ecx
movb $0x1, %al
testb %cl, %cl
jne 0x95a7
movq %rbx, %rdi
movq %r14, %rsi
callq 0x7d9d
jmp 0x9560
movq %rbx, %rdi
callq 0x7d33
movq %rbx, %rdi
movq %rax, %rsi
movq %r14, %rdx
callq 0xac3d
jmp 0x95a5
movl 0x30(%r14), %r13d
cmpq $0x62, %r13
je 0x957d
cmpl $0x61, %r13d
je 0x9564
cmpl $0x60, %r13d
jne 0x95b8
movq %rbx, %rdi
callq 0xc4d9
leaq 0x10625(%rip), %rsi     # 0x19b28
movq %rbx, %rdi
callq 0xb1e4
movq %rbx, %rdi
movq %r14, %rsi
callq 0xade5
movq 0x18(%rbx), %rax
movl $0xa, (%rax)
jmp 0x95a5
leaq 0x11820(%rip), %rcx     # 0x1ad4c
cmpb $0x0, (%rax,%rcx)
je 0x960a
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 0x9560
xorps %xmm0, %xmm0
movups %xmm0, 0x38(%rbx)
xorl %eax, %eax
jmp 0x95a7
movq %rbx, %rdi
callq 0xc4d9
movq %rbx, %rdi
movq %r14, %rsi
callq 0xade5
movq 0x18(%rbx), %rax
jmp 0x959f
movq %rbx, %rdi
callq 0xc4d9
movq %rbx, %rdi
movl $0x61, %esi
movl $0x8, %edx
callq 0x80c5
movq 0x18(%rbx), %rax
movb $0x1, 0x50(%rax)
movl $0xb, (%rax)
movb $0x1, %al
addq $0xa0, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
leaq 0x1165d(%rip), %rax     # 0x1ac1c
cmpb $0x0, (%r13,%rax)
je 0x9621
movq %rbx, %rdi
callq 0xc4d9
movq 0x18(%rbx), %rax
movl $0xc, (%rax)
cmpl $0x1, (%r14)
jne 0x9614
movl 0x30(%r14), %eax
leaq 0x116ca(%rip), %rcx     # 0x1acb4
cmpb $0x0, (%rax,%rcx)
je 0x9614
movq %rbx, %rdi
movl $0x63, %esi
movl $0x8, %edx
callq 0x80c5
movb $0x1, 0x50(%r12)
jmp 0x95a5
cmpl $0x9, %eax
je 0x9673
jmp 0x9732
movq %rbx, %rdi
movq %r14, %rsi
callq 0xade5
jmp 0x95a5
cmpl $0x5f, %r13d
jne 0x964b
movq %rbx, %rdi
movq %r14, %rsi
callq 0x7d9d
movq %rbx, %rdi
callq 0xc526
movq 0x18(%rbx), %rcx
testb %al, %al
je 0x968e
movb $0x1, 0x50(%rcx)
jmp 0x9560
leaq 0x8(%rsp), %r15
movl $0x98, %edx
movq %r15, %rdi
xorl %esi, %esi
callq 0x4120
movw $0x101, 0x6(%r15)       # imm = 0x101
movb $0x1, 0x9(%r15)
cmpb $0x0, 0x8(%rsp,%r13)
je 0x969a
movq %rbx, %rdi
movq %r14, %rsi
addq $0xa0, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x8de1
movq 0x98(%rcx), %rbx
jmp 0x954c
cmpl $0x6d, %r13d
jne 0x96e3
leaq 0x38(%r14), %rdi
leaq 0x437d3(%rip), %rsi     # 0x4ce7e
leaq 0x13782(%rip), %rdx     # 0x1ce34
callq 0x88b7
testb %al, %al
je 0x96d6
movq %rbx, %rdi
movq %r14, %rsi
callq 0x7d9d
movq %rbx, %rdi
movq %r14, %rsi
callq 0xade5
jmp 0x9784
movl (%r14), %eax
cmpl $0x8, %eax
je 0x9759
cmpl $0x1, %eax
jne 0x9732
cmpl $0x69, 0x30(%r14)
jne 0x9732
movq %rbx, %rdi
movq %r14, %rsi
callq 0x7d9d
cmpq $0x0, 0x40(%r12)
movq 0x18(%rbx), %r15
jne 0x9726
leaq 0x4(%rsp), %rdx
movl $0x9, (%rdx)
leaq 0x104ad(%rip), %r8      # 0x19bc0
movq %r15, %rdi
movl $0x1, %esi
xorl %ecx, %ecx
callq 0xb40a
testb %al, %al
je 0x9774
movq 0x98(%r15), %rbx
jmp 0x954c
movq %rbx, %rdi
movq %r14, %rsi
callq 0x7d9d
movb $0x1, 0x54(%r12)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x4ece
movb $0x0, 0x54(%r12)
jmp 0x95a7
movq %rbx, %rdi
movq %r14, %rsi
addq $0xa0, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x4ece
movq %rbx, %rdi
movq %r14, %rsi
callq 0xade5
movq %rax, 0x40(%r12)
movq %rbx, %rdi
callq 0xaffb
jmp 0x9560
leaq 0x13c89(%rip), %rdi     # 0x1d421
leaq 0x12191(%rip), %rsi     # 0x1b930
leaq 0x13ca1(%rip), %rcx     # 0x1d447
movl $0xce8, %edx            # imm = 0xCE8
callq 0x4100