// File: /workspace/github_c_makefile_star2_O1/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 %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movq 0x18(%rdi), %r15
movl (%rsi), %eax
cmpl $0x7, %eax
ja 0xad01
movl $0xb9, %ecx
btl %eax, %ecx
jae 0xad01
movq %rbx, %rdi
movq %r14, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x4fa2
cmpl $0x1, %eax
jne 0xad17
movl 0x30(%r14), %ecx
leaq 0x128b7(%rip), %rdx     # 0x1d5c8
cmpb $0x0, (%rcx,%rdx)
jne 0xad23
cmpl $0x2, %eax
jne 0xad39
cmpl $0x9, 0x30(%r14)
jne 0xad39
movq %rbx, %rdi
movq %r14, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x91d5
cmpl $0x1, %eax
jne 0xae27
movl 0x30(%r14), %ecx
leaq 0x12913(%rip), %rdx     # 0x1d660
cmpb $0x0, (%rcx,%rdx)
je 0xad7d
leaq 0x28(%r15), %rdi
callq 0x7fa7
movq 0x18(%rbx), %rsi
addq $0x28, %rsi
movl $0x8, %edi
callq 0x7ef9
movq 0x18(%rbx), %rax
movl $0x8, (%rax)
jmp 0xae5f
cmpl $0x1, %eax
jne 0xae27
cmpl $0x62, 0x30(%r14)
jne 0xadb7
leaq 0x28(%r15), %rdi
callq 0x7fa7
movq 0x18(%rbx), %rsi
addq $0x28, %rsi
movl $0xb, %edi
callq 0x7ef9
movq 0x18(%rbx), %rax
movl $0xb, (%rax)
jmp 0xae5f
cmpl $0x1, %eax
jne 0xae27
cmpl $0x66, 0x30(%r14)
jne 0xadea
leaq 0x28(%r15), %rdi
callq 0x7fa7
movq 0x18(%rbx), %rsi
addq $0x28, %rsi
movl $0xc, %edi
callq 0x7ef9
movq 0x18(%rbx), %rax
movl $0xc, (%rax)
jmp 0xae5f
cmpl $0x1, %eax
jne 0xae27
movl 0x30(%r14), %ecx
leaq 0x121d6(%rip), %rdx     # 0x1cfd0
cmpb $0x0, (%rcx,%rdx)
je 0xae27
leaq 0x28(%r15), %rdi
callq 0x7fa7
movq 0x18(%rbx), %rsi
addq $0x28, %rsi
movl $0xd, %edi
callq 0x7ef9
movq 0x18(%rbx), %rax
movl $0xd, (%rax)
jmp 0xae5f
cmpl $0x8, %eax
je 0xae9e
cmpl $0x2, %eax
je 0xae6b
cmpl $0x1, %eax
jne 0xaf36
leaq 0x28(%r15), %rdi
callq 0x7fa7
movq 0x18(%rbx), %rsi
addq $0x28, %rsi
movl $0x6, %edi
callq 0x7ef9
movq 0x18(%rbx), %rax
movl $0x6, (%rax)
movb $0x1, 0x50(%r15)
movb $0x1, %al
jmp 0xaf2a
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 0xaf28
xorps %xmm0, %xmm0
movups %xmm0, 0x38(%rbx)
jmp 0xaf28
leaq 0x4(%rsp), %rdx
movl $0x9, (%rdx)
leaq 0x10bf0(%rip), %r8      # 0x1baa0
movq %rbx, %rdi
movl $0x1, %esi
xorl %ecx, %ecx
callq 0xbc6a
movl %eax, %ecx
movb $0x1, %al
testb %cl, %cl
je 0xaf2a
movq %rbx, %rdi
movq %r14, %rsi
callq 0x8171
movq %rbx, %rdi
callq 0xb8b5
movq %rax, %rdi
xorl %esi, %esi
movl $0x9, %edx
callq 0x8b69
testb %al, %al
je 0xaed2
movq 0x18(%rbx), %r14
addq $0x18, %r14
leaq 0x10b0c(%rip), %r12     # 0x1ba08
movq %r14, %rdi
callq 0x7fa7
testq %rax, %rax
je 0xaf0e
cmpq %r12, %rax
jne 0xaefc
movq 0x18(%rbx), %rdi
addq $0x28, %rdi
callq 0x7fa7
movq %rbx, %rdi
callq 0x84ef
movb $0x1, 0x50(%r15)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
leaq 0x143e8(%rip), %rdi     # 0x1f325
leaq 0x128cc(%rip), %rsi     # 0x1d810
leaq 0x14480(%rip), %rcx     # 0x1f3cb
movl $0xf6d, %edx            # imm = 0xF6D
callq 0x4100