// File: /workspace/github_c_makefile_star2_O1/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 $0x1d0, %rsp            # imm = 0x1D0
movq 0x18(%rdi), %r12
movl (%rsi), %r13d
leal -0x4(%r13), %eax
cmpl $0x2, %eax
jb 0x99ef
movq %rsi, %r14
movq %rdi, %rbx
testl %r13d, %r13d
je 0x9d20
cmpl $0x3, %r13d
jne 0x9a19
movq %rbx, %rdi
callq 0x8107
movq %rbx, %rdi
movq %rax, %rsi
movq %r14, %rdx
callq 0xb4a3
jmp 0x9a12
cmpq $0x0, 0x60(%r12)
jne 0x9db1
movl (%r12), %eax
movl %eax, 0x4(%r12)
movb $0x1, 0x50(%r12)
movl $0x9, (%r12)
movb $0x1, %al
jmp 0x9d4c
cmpl $0x1, %r13d
jne 0x9ab9
cmpl $0x60, 0x30(%r14)
jne 0x9a58
movq %rbx, %rdi
callq 0xcecd
leaq 0x11fcf(%rip), %rsi     # 0x1ba08
movq %rbx, %rdi
callq 0xba57
movq %rbx, %rdi
movq %r14, %rsi
callq 0xb69f
movq 0x18(%rbx), %rax
movl $0xa, (%rax)
jmp 0x9a12
cmpl $0x1, %r13d
jne 0x9ab9
cmpl $0x61, 0x30(%r14)
jne 0x9a84
movq %rbx, %rdi
callq 0xcecd
movq %rbx, %rdi
movq %r14, %rsi
callq 0xb69f
movq 0x18(%rbx), %rax
movl $0xb, (%rax)
jmp 0x9a12
cmpl $0x1, %r13d
jne 0x9ab9
cmpl $0x62, 0x30(%r14)
jne 0x9b17
movq %rbx, %rdi
callq 0xcecd
movq %rbx, %rdi
movl $0x61, %esi
movl $0x8, %edx
callq 0x84b0
movq 0x18(%rbx), %rax
movb $0x1, 0x50(%rax)
jmp 0x9a7c
leaq 0x1303c(%rip), %rsi     # 0x1cafc
leaq 0xa0(%rsp), %rdi
movl $0x98, %edx
callq 0x4190
cmpl $0x1, %r13d
jne 0x9b92
cmpl $0x5f, 0x30(%r14)
jne 0x9b92
movq %rbx, %rdi
movq %r14, %rsi
callq 0x8171
movq %rbx, %rdi
callq 0xcf1a
movq 0x18(%rbx), %rcx
testb %al, %al
je 0x9b0b
movb $0x1, 0x50(%rcx)
jmp 0x9d4a
movq 0x98(%rcx), %rbx
jmp 0x9d36
leaq 0x12fde(%rip), %rsi     # 0x1cafc
leaq 0xa0(%rsp), %rdi
movl $0x98, %edx
callq 0x4190
cmpl $0x1, %r13d
jne 0x9b92
movl 0x30(%r14), %eax
cmpb $0x0, 0xa0(%rsp,%rax)
je 0x9ad2
movq %rbx, %rdi
callq 0xcecd
movq 0x18(%rbx), %rax
movl $0xc, (%rax)
cmpl $0x1, (%r14)
jne 0x9da1
movl 0x30(%r14), %eax
leaq 0x13029(%rip), %rcx     # 0x1cb94
cmpb $0x0, (%rax,%rcx)
je 0x9da1
movq %rbx, %rdi
movl $0x63, %esi
movl $0x8, %edx
callq 0x84b0
movb $0x1, 0x50(%r12)
jmp 0x9a12
cmpl $0x2, %r13d
jne 0x9bc7
cmpl $0x5f, 0x30(%r14)
jne 0x9cf1
movq %rbx, %rdi
callq 0xcf1a
movl %eax, %ecx
movb $0x1, %al
testb %cl, %cl
jne 0x9d4c
movq %rbx, %rdi
movq %r14, %rsi
callq 0x8171
jmp 0x9d4a
leaq 0x1305e(%rip), %rsi     # 0x1cc2c
leaq 0x8(%rsp), %rdi
movl $0x98, %edx
callq 0x4190
leaq 0x138(%rsp), %r15
movl $0x98, %edx
movq %r15, %rdi
xorl %esi, %esi
callq 0x4120
movw $0x101, 0x6(%r15)       # imm = 0x101
movb $0x1, 0x9(%r15)
cmpl $0x1, %r13d
jne 0x9c14
movl 0x30(%r14), %eax
cmpb $0x0, 0x138(%rsp,%rax)
jne 0x9c21
cmpl $0x2, %r13d
jne 0x9c3c
cmpl $0x9, 0x30(%r14)
jne 0x9c3c
movq %rbx, %rdi
movq %r14, %rsi
addq $0x1d0, %rsp            # imm = 0x1D0
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x91d5
cmpl $0x1, %r13d
jne 0x9c87
cmpl $0x6d, 0x30(%r14)
jne 0x9c87
leaq 0x38(%r14), %rdi
leaq 0x4510a(%rip), %rsi     # 0x4ed5e
leaq 0x150b9(%rip), %rdx     # 0x1ed14
callq 0x8ce7
testb %al, %al
je 0x9c87
movq %rbx, %rdi
movq %r14, %rsi
callq 0x8171
movq %rbx, %rdi
movq %r14, %rsi
callq 0xb69f
movq %rbx, %rdi
callq 0xb8b5
jmp 0x9d4a
movl (%r14), %eax
cmpl $0x8, %eax
je 0x9d62
cmpl $0x1, %eax
jne 0x9d7d
cmpl $0x69, 0x30(%r14)
jne 0x9d5d
movq %rbx, %rdi
movq %r14, %rsi
callq 0x8171
cmpq $0x0, 0x40(%r12)
jne 0x9d2b
leaq 0x4(%rsp), %rdx
movl $0x9, (%rdx)
leaq 0x11dd4(%rip), %r8      # 0x1baa0
movq %rbx, %rdi
movl $0x1, %esi
xorl %ecx, %ecx
callq 0xbc6a
testb %al, %al
jne 0x9d2b
movq %rbx, %rdi
movq %r14, %rsi
callq 0xb69f
movq %rax, 0x40(%r12)
jmp 0x9c7a
leaq 0x12f34(%rip), %rsi     # 0x1cc2c
leaq 0x8(%rsp), %rdi
movl $0x98, %edx
callq 0x4190
cmpl $0x2, %r13d
jne 0x9bdd
movl 0x30(%r14), %eax
cmpb $0x0, 0x8(%rsp,%rax)
je 0x9bdd
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 0x9d4a
xorps %xmm0, %xmm0
movups %xmm0, 0x38(%rbx)
xorl %eax, %eax
addq $0x1d0, %rsp            # imm = 0x1D0
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
cmpl $0x8, %eax
jne 0x9d7d
movq %rbx, %rdi
movq %r14, %rsi
addq $0x1d0, %rsp            # imm = 0x1D0
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x4fa2
movq %rbx, %rdi
movq %r14, %rsi
callq 0x8171
movb $0x1, 0x54(%r12)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x4fa2
movb $0x0, 0x54(%r12)
jmp 0x9d4c
movq %rbx, %rdi
movq %r14, %rsi
callq 0xb69f
jmp 0x9a12
leaq 0x15549(%rip), %rdi     # 0x1f301
leaq 0x13a51(%rip), %rsi     # 0x1d810
leaq 0x15561(%rip), %rcx     # 0x1f327
movl $0xce8, %edx            # imm = 0xCE8
callq 0x4100