// File: /workspace/github_c_makefile_star2_O2/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 %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq 0x18(%rdi), %r12
movl (%rsi), %r13d
leal -0x4(%r13), %eax
cmpl $0x2, %eax
jb 0x8f16
movq %rsi, %r14
movq %rdi, %rbx
testl %r13d, %r13d
je 0x90ab
cmpl $0x3, %r13d
jne 0x8f40
movq %rbx, %rdi
callq 0x7913
movq %rbx, %rdi
movq %rax, %rsi
movq %r14, %rdx
callq 0xa2ca
jmp 0x8f39
cmpq $0x0, 0x60(%r12)
jne 0x9205
movl (%r12), %eax
movl %eax, 0x4(%r12)
movb $0x1, 0x50(%r12)
movl $0x9, (%r12)
movb $0x1, %al
jmp 0x90c0
cmpl $0x1, %r13d
jne 0x8f90
movl 0x30(%r14), %eax
cmpq $0x62, %rax
je 0x8fe5
cmpl $0x61, %eax
je 0x8fcc
cmpl $0x60, %eax
jne 0x900e
movq %rbx, %rdi
callq 0xb982
leaq 0xeb27(%rip), %rsi      # 0x17a98
movq %rbx, %rdi
callq 0xa7e8
movq %rbx, %rdi
movq %r14, %rsi
callq 0xa439
movq 0x18(%rbx), %rax
movl $0xa, (%rax)
jmp 0x8f39
cmpl $0x2, %r13d
jne 0x9093
movb $0x1, %bpl
cmpl $0x5f, 0x30(%r14)
jne 0x9095
movq %rbx, %rdi
callq 0xb9b9
movl %eax, %ecx
movb $0x1, %al
testb %cl, %cl
jne 0x90c0
movq %rbx, %rdi
movq %r14, %rsi
callq 0x797d
jmp 0x90be
movq %rbx, %rdi
callq 0xb982
movq %rbx, %rdi
movq %r14, %rsi
callq 0xa439
movq 0x18(%rbx), %rax
jmp 0x9003
movq %rbx, %rdi
callq 0xb982
pushq $0x61
popq %rsi
pushq $0x8
popq %rdx
movq %rbx, %rdi
callq 0x7c99
movq 0x18(%rbx), %rax
movb $0x1, 0x50(%rax)
movl $0xb, (%rax)
jmp 0x8f39
leaq 0xfb77(%rip), %rcx      # 0x18b8c
cmpb $0x0, (%rax,%rcx)
je 0x906d
movq %rbx, %rdi
callq 0xb982
movq 0x18(%rbx), %rax
movl $0xc, (%rax)
cmpl $0x1, (%r14)
jne 0x905d
movl 0x30(%r14), %eax
leaq 0xfbe6(%rip), %rcx      # 0x18c24
cmpb $0x0, (%rax,%rcx)
je 0x905d
pushq $0x63
popq %rsi
pushq $0x8
popq %rdx
movq %rbx, %rdi
callq 0x7c99
movb $0x1, 0x50(%r12)
jmp 0x8f39
movq %rbx, %rdi
movq %r14, %rsi
callq 0xa439
jmp 0x8f39
cmpl $0x5f, %eax
jne 0x9093
movq %rbx, %rdi
movq %r14, %rsi
callq 0x797d
movq %rbx, %rdi
callq 0xb9b9
testb %al, %al
je 0x90b6
movq 0x18(%rbx), %rax
movb $0x1, 0x50(%rax)
jmp 0x90be
xorl %ebp, %ebp
testb %bpl, %bpl
je 0x90d2
movl 0x30(%r14), %eax
leaq 0xfc17(%rip), %rcx      # 0x18cbc
cmpb $0x0, (%rax,%rcx)
je 0x90d2
movq %rbx, %rdi
movq %r14, %rsi
callq 0x797d
movq %rbx, %rdi
callq 0x83cf
xorl %eax, %eax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %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 0x9100
movl 0x30(%r14), %eax
cmpb $0x0, (%rsp,%rax)
jne 0x910c
testb %bpl, %bpl
je 0x9128
cmpl $0x9, 0x30(%r14)
jne 0x9128
movq %rbx, %rdi
movq %r14, %rsi
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x8893
cmpl $0x1, %r13d
jne 0x916b
cmpl $0x6d, 0x30(%r14)
jne 0x9177
leaq 0x38(%r14), %rdi
leaq 0x41cbe(%rip), %rsi     # 0x4adfe
leaq 0x11c5d(%rip), %rdx     # 0x1ada4
callq 0x8488
testb %al, %al
je 0x9168
movq %rbx, %rdi
movq %r14, %rsi
callq 0x797d
movq %rbx, %rdi
movq %r14, %rsi
callq 0xa439
jmp 0x91b5
movl (%r14), %r13d
cmpl $0x8, %r13d
je 0x91e9
cmpl $0x1, %r13d
jne 0x91c2
cmpl $0x69, 0x30(%r14)
jne 0x91c2
movq %rbx, %rdi
movq %r14, %rsi
callq 0x797d
cmpq $0x0, 0x40(%r12)
jne 0x90b6
movq %rbx, %rdi
callq 0xa946
testb %al, %al
jne 0x90b6
movq %rbx, %rdi
movq %r14, %rsi
callq 0xa439
movq %rax, 0x40(%r12)
movq %rbx, %rdi
callq 0xa620
jmp 0x90be
movq %rbx, %rdi
movq %r14, %rsi
callq 0x797d
movb $0x1, 0x54(%r12)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x4d63
movb $0x0, 0x54(%r12)
jmp 0x90c0
movq %rbx, %rdi
movq %r14, %rsi
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x4d63
leaq 0x12185(%rip), %rdi     # 0x1b391
leaq 0x1068d(%rip), %rsi     # 0x198a0
leaq 0x1219d(%rip), %rcx     # 0x1b3b7
movl $0xce8, %edx            # imm = 0xCE8
callq 0x4100