// File: /workspace/github_c_makefile_star2_O2/craigbarnes[P]lua-gumbo/lib/parser.c
// Function: handle_in_template
static bool handle_in_template(GumboParser* parser, GumboToken* token) {
  GumboParserState* state = parser->_parser_state;
  switch (token->type) {
    case GUMBO_TOKEN_WHITESPACE:
    case GUMBO_TOKEN_CHARACTER:
    case GUMBO_TOKEN_COMMENT:
    case GUMBO_TOKEN_NULL:
    case GUMBO_TOKEN_DOCTYPE:
      return handle_in_body(parser, token);
    default:
      break;
  }
  if (
    tag_in(token, kStartTag, &(const TagSet) {
      TAG(BASE), TAG(BASEFONT), TAG(BGSOUND), TAG(LINK), TAG(META),
      TAG(NOFRAMES), TAG(SCRIPT), TAG(STYLE), TAG(TEMPLATE), TAG(TITLE)
    })
    || tag_is(token, kEndTag, GUMBO_TAG_TEMPLATE)
  ) {
    return handle_in_head(parser, token);
  } else if (
    tag_in(token, kStartTag, &(const TagSet) {
      TAG(CAPTION), TAG(COLGROUP), TAG(TBODY), TAG(TFOOT), TAG(THEAD)
    })
  ) {
    pop_template_insertion_mode(parser);
    push_template_insertion_mode(parser, GUMBO_INSERTION_MODE_IN_TABLE);
    set_insertion_mode(parser, GUMBO_INSERTION_MODE_IN_TABLE);
    state->_reprocess_current_token = true;
    return true;
  } else if (tag_is(token, kStartTag, GUMBO_TAG_COL)) {
    pop_template_insertion_mode(parser);
    push_template_insertion_mode(parser, GUMBO_INSERTION_MODE_IN_COLUMN_GROUP);
    set_insertion_mode(parser, GUMBO_INSERTION_MODE_IN_COLUMN_GROUP);
    state->_reprocess_current_token = true;
    return true;
  } else if (tag_is(token, kStartTag, GUMBO_TAG_TR)) {
    pop_template_insertion_mode(parser);
    push_template_insertion_mode(parser, GUMBO_INSERTION_MODE_IN_TABLE_BODY);
    set_insertion_mode(parser, GUMBO_INSERTION_MODE_IN_TABLE_BODY);
    state->_reprocess_current_token = true;
    return true;
  } else if (tag_in(token, kStartTag, &td_th_tags)) {
    pop_template_insertion_mode(parser);
    push_template_insertion_mode(parser, GUMBO_INSERTION_MODE_IN_ROW);
    set_insertion_mode(parser, GUMBO_INSERTION_MODE_IN_ROW);
    state->_reprocess_current_token = true;
    return true;
  } else if (token->type == GUMBO_TOKEN_START_TAG) {
    pop_template_insertion_mode(parser);
    push_template_insertion_mode(parser, GUMBO_INSERTION_MODE_IN_BODY);
    set_insertion_mode(parser, GUMBO_INSERTION_MODE_IN_BODY);
    state->_reprocess_current_token = true;
    return true;
  } else if (token->type == GUMBO_TOKEN_END_TAG) {
    parser_add_parse_error(parser, token);
    ignore_token(parser);
    return false;
  } else if (token->type == GUMBO_TOKEN_EOF) {
    if (!has_open_element(parser, GUMBO_TAG_TEMPLATE)) {
      // Stop parsing.
      return true;
    }
    parser_add_parse_error(parser, token);
    while (!node_html_tag_is(pop_current_node(parser), GUMBO_TAG_TEMPLATE)) {
      ;
    }
    clear_active_formatting_elements(parser);
    pop_template_insertion_mode(parser);
    reset_insertion_mode_appropriately(parser);
    state->_reprocess_current_token = true;
    return false;
  } else {
    assert(0);
    return false;
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movq 0x18(%rdi), %r15
movl (%rsi), %eax
cmpl $0x7, %eax
ja 0x9c75
movl $0xb9, %ecx
btl %eax, %ecx
jae 0x9c75
movq %rbx, %rdi
movq %r14, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x4d63
cmpl $0x1, %eax
jne 0x9c8d
movl 0x30(%r14), %ecx
leaq 0xf9d3(%rip), %rdx      # 0x19658
cmpb $0x0, (%rcx,%rdx)
jne 0x9c99
jmp 0x9cae
cmpl $0x2, %eax
jne 0x9cae
cmpl $0x9, 0x30(%r14)
jne 0x9cae
movq %rbx, %rdi
movq %r14, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x8893
cmpl $0x1, %eax
jne 0x9ce6
movl 0x30(%r14), %eax
leaq 0xfa32(%rip), %rcx      # 0x196f0
cmpb $0x0, (%rax,%rcx)
je 0x9d1b
movq %rbx, %rdi
callq 0xa992
pushq $0x8
popq %rsi
movq %rbx, %rdi
callq 0x7cd8
movq 0x18(%rbx), %rax
movl $0x8, (%rax)
jmp 0x9e0b
cmpl $0x8, %eax
je 0x9d65
cmpl $0x2, %eax
je 0x9d50
cmpl $0x1, %eax
jne 0x9e1d
movq %rbx, %rdi
callq 0xa992
pushq $0x6
popq %rsi
movq %rbx, %rdi
callq 0x7cd8
movq 0x18(%rbx), %rax
movl $0x6, (%rax)
jmp 0x9e0b
cmpq $0x66, %rax
je 0x9dbe
cmpl $0x62, %eax
jne 0x9ddd
movq %rbx, %rdi
callq 0xa992
pushq $0xb
popq %rsi
movq %rbx, %rdi
callq 0x7cd8
movq 0x18(%rbx), %rax
movl $0xb, (%rax)
jmp 0x9e0b
movq %rbx, %rdi
movq %r14, %rsi
callq 0x797d
movq %rbx, %rdi
callq 0x83cf
jmp 0x9dba
movq %rbx, %rdi
callq 0xa946
movl %eax, %ecx
movb $0x1, %al
testb %cl, %cl
je 0x9e12
movq %rbx, %rdi
movq %r14, %rsi
callq 0x797d
pushq $0x9
popq %rbp
movq %rbx, %rdi
callq 0xa620
movq %rax, %rdi
movl %ebp, %esi
callq 0x82b7
testb %al, %al
je 0x9d87
movq %rbx, %rdi
callq 0xa965
movq %rbx, %rdi
callq 0xa992
movq %rbx, %rdi
callq 0x7cea
movb $0x1, 0x50(%r15)
xorl %eax, %eax
jmp 0x9e12
movq %rbx, %rdi
callq 0xa992
pushq $0xc
popq %rsi
movq %rbx, %rdi
callq 0x7cd8
movq 0x18(%rbx), %rax
movl $0xc, (%rax)
jmp 0x9e0b
leaq 0xf27c(%rip), %rcx      # 0x19060
cmpb $0x0, (%rax,%rcx)
je 0x9cf9
movq %rbx, %rdi
callq 0xa992
pushq $0xd
popq %rsi
movq %rbx, %rdi
callq 0x7cd8
movq 0x18(%rbx), %rax
movl $0xd, (%rax)
movb $0x1, 0x50(%r15)
movb $0x1, %al
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0x11591(%rip), %rdi     # 0x1b3b5
leaq 0xfa75(%rip), %rsi      # 0x198a0
leaq 0x11629(%rip), %rcx     # 0x1b45b
movl $0xf6d, %edx            # imm = 0xF6D
callq 0x4100