// File: /workspace/github_c_makefile_star2_O1/craigbarnes[P]lua-gumbo/lib/parser.c
// Function: handle_in_head
static bool handle_in_head(GumboParser* parser, GumboToken* token) {
  if (token->type == GUMBO_TOKEN_WHITESPACE) {
    insert_text_token(parser, token);
    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_HTML)) {
    return handle_in_body(parser, token);
  } else if (
    tag_in(token, kStartTag, &(const TagSet) {
      TAG(BASE), TAG(BASEFONT), TAG(BGSOUND), TAG(LINK)
    })
  ) {
    insert_element_from_token(parser, token);
    pop_current_node(parser);
    acknowledge_self_closing_tag(parser);
    return true;
  } else if (tag_is(token, kStartTag, GUMBO_TAG_META)) {
    insert_element_from_token(parser, token);
    pop_current_node(parser);
    acknowledge_self_closing_tag(parser);
    // NOTE(jdtang): Gumbo handles only UTF-8, so the encoding clause of the
    // spec doesn't apply. If clients want to handle meta-tag re-encoding, they
    // should specifically look for that string in the document and re-encode it
    // before passing to Gumbo.
    return true;
  } else if (tag_is(token, kStartTag, GUMBO_TAG_TITLE)) {
    run_generic_parsing_algorithm(parser, token, GUMBO_LEX_RCDATA);
    return true;
  } else if (
    tag_in(token, kStartTag, &(const TagSet){TAG(NOFRAMES), TAG(STYLE)})
  ) {
    run_generic_parsing_algorithm(parser, token, GUMBO_LEX_RAWTEXT);
    return true;
  } else if (tag_is(token, kStartTag, GUMBO_TAG_NOSCRIPT)) {
    insert_element_from_token(parser, token);
    set_insertion_mode(parser, GUMBO_INSERTION_MODE_IN_HEAD_NOSCRIPT);
    return true;
  } else if (tag_is(token, kStartTag, GUMBO_TAG_SCRIPT)) {
    run_generic_parsing_algorithm(parser, token, GUMBO_LEX_SCRIPT);
    return true;
  } else if (tag_is(token, kEndTag, GUMBO_TAG_HEAD)) {
    GumboNode* head = pop_current_node(parser);
    UNUSED_IF_NDEBUG(head);
    assert(node_html_tag_is(head, GUMBO_TAG_HEAD));
    set_insertion_mode(parser, GUMBO_INSERTION_MODE_AFTER_HEAD);
    return true;
  } else if (
    tag_in(token, kEndTag, &(const TagSet){TAG(BODY), TAG(HTML), TAG(BR)})
  ) {
    pop_current_node(parser);
    set_insertion_mode(parser, GUMBO_INSERTION_MODE_AFTER_HEAD);
    parser->_parser_state->_reprocess_current_token = true;
    return true;
  } else if (tag_is(token, kStartTag, GUMBO_TAG_TEMPLATE)) {
    insert_element_from_token(parser, token);
    add_formatting_element(parser, &kActiveFormattingScopeMarker);
    parser->_parser_state->_frameset_ok = false;
    set_insertion_mode(parser, GUMBO_INSERTION_MODE_IN_TEMPLATE);
    push_template_insertion_mode(parser, GUMBO_INSERTION_MODE_IN_TEMPLATE);
    return true;
  } else if (tag_is(token, kEndTag, GUMBO_TAG_TEMPLATE)) {
    if (!has_open_element(parser, GUMBO_TAG_TEMPLATE)) {
      parser_add_parse_error(parser, token);
      ignore_token(parser);
      return false;
    }
    generate_all_implied_end_tags_thoroughly(parser);
    bool success = true;
    if (!node_html_tag_is(get_current_node(parser), GUMBO_TAG_TEMPLATE)) {
      parser_add_parse_error(parser, token);
      success = false;
    }
    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);
    return success;
  } else if (
    tag_is(token, kStartTag, GUMBO_TAG_HEAD)
    || (token->type == GUMBO_TOKEN_END_TAG)
  ) {
    parser_add_parse_error(parser, token);
    ignore_token(parser);
    return false;
  } else {
    pop_current_node(parser);
    set_insertion_mode(parser, GUMBO_INSERTION_MODE_AFTER_HEAD);
    parser->_parser_state->_reprocess_current_token = true;
    return true;
  }
  return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x1d8, %rsp            # imm = 0x1D8
movq %rsi, %r14
movq %rdi, %rbx
movl (%rsi), %ebp
testl %ebp, %ebp
je 0x9519
cmpl $0x3, %ebp
je 0x9209
cmpl $0x4, %ebp
jne 0x9227
movq %rbx, %rdi
movq %r14, %rsi
callq 0xb82b
jmp 0x921f
movq %rbx, %rdi
callq 0x8107
movq %rbx, %rdi
movq %rax, %rsi
movq %r14, %rdx
callq 0xb4a3
movb $0x1, %bpl
jmp 0x9545
cmpl $0x1, %ebp
jne 0x9265
cmpl $0x0, 0x30(%r14)
je 0x92aa
leaq 0x1269e(%rip), %rsi     # 0x1b8d8
leaq 0x140(%rsp), %rdi
movl $0x98, %edx
callq 0x4190
cmpl $0x1, %ebp
jne 0x92de
movl 0x30(%r14), %eax
cmpb $0x0, 0x140(%rsp,%rax)
jne 0x928a
jmp 0x927e
leaq 0x1266c(%rip), %rsi     # 0x1b8d8
leaq 0x140(%rsp), %rdi
movl $0x98, %edx
callq 0x4190
cmpl $0x1, %ebp
jne 0x92de
cmpl $0x5, 0x30(%r14)
jne 0x92c2
movq %rbx, %rdi
movq %r14, %rsi
callq 0xb69f
movq %rbx, %rdi
callq 0xb8b5
movq 0x18(%rbx), %rax
movb $0x1, 0x51(%rax)
jmp 0x921f
movq %rbx, %rdi
movq %r14, %rsi
addq $0x1d8, %rsp            # imm = 0x1D8
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x4fa2
cmpl $0x1, %ebp
jne 0x92de
cmpl $0x2, 0x30(%r14)
jne 0x9336
movq %rbx, %rdi
movq %r14, %rsi
movl $0x2, %edx
jmp 0x936d
leaq 0x1268b(%rip), %rsi     # 0x1b970
leaq 0xa8(%rsp), %rdi
movl $0x98, %edx
callq 0x4190
cmpl $0x1, %ebp
jne 0x9377
cmpl $0x8, 0x30(%r14)
jne 0x931d
movq %rbx, %rdi
movq %r14, %rsi
callq 0xb69f
movq 0x18(%rbx), %rax
movl $0x4, (%rax)
jmp 0x921f
cmpl $0x1, %ebp
jne 0x9377
cmpl $0x7, 0x30(%r14)
jne 0x9377
movq %rbx, %rdi
movq %r14, %rsi
movl $0x5, %edx
jmp 0x936d
leaq 0x12633(%rip), %rsi     # 0x1b970
leaq 0xa8(%rsp), %rdi
movl $0x98, %edx
callq 0x4190
cmpl $0x1, %ebp
jne 0x9377
movl 0x30(%r14), %eax
cmpb $0x0, 0xa8(%rsp,%rax)
je 0x92f7
movq %rbx, %rdi
movq %r14, %rsi
movl $0x4, %edx
callq 0xba28
jmp 0x921f
cmpl $0x2, %ebp
jne 0x93b5
cmpl $0x1, 0x30(%r14)
jne 0x94e5
movq %rbx, %rdi
callq 0xb8b5
movq %rax, %rdi
xorl %esi, %esi
movl $0x1, %edx
callq 0x8b69
testb %al, %al
je 0x9570
movq 0x18(%rbx), %rax
movl $0x5, (%rax)
jmp 0x921f
leaq 0x128b4(%rip), %rsi     # 0x1bc70
leaq 0x10(%rsp), %rdi
movl $0x98, %edx
callq 0x4190
cmpl $0x1, %ebp
jne 0x9412
cmpl $0x9, 0x30(%r14)
jne 0x9412
movq %rbx, %rdi
movq %r14, %rsi
callq 0xb69f
leaq 0x1261f(%rip), %rsi     # 0x1ba08
movq %rbx, %rdi
callq 0xba57
movq 0x18(%rbx), %rsi
movb $0x0, 0x52(%rsi)
movl $0x11, (%rsi)
addq $0x28, %rsi
movl $0x11, %edi
callq 0x7ef9
jmp 0x921f
cmpl $0x2, %ebp
jne 0x94d2
cmpl $0x9, 0x30(%r14)
jne 0x94d2
leaq 0xc(%rsp), %rdx
movl $0x9, (%rdx)
leaq 0x12668(%rip), %r8      # 0x1baa0
movq %rbx, %rdi
movl $0x1, %esi
xorl %ecx, %ecx
callq 0xbc6a
movq %rbx, %rdi
testb %al, %al
je 0x951c
callq 0xbbf8
movq %rbx, %rdi
callq 0x8107
movq %rax, %rdi
xorl %esi, %esi
movl $0x9, %edx
callq 0x8b69
movl %eax, %ebp
testb %al, %al
jne 0x947f
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 0x947f
movq 0x18(%rbx), %r14
addq $0x18, %r14
leaq 0x1255f(%rip), %r15     # 0x1ba08
movq %r14, %rdi
callq 0x7fa7
testq %rax, %rax
je 0x94bb
cmpq %r15, %rax
jne 0x94a9
movq 0x18(%rbx), %rdi
addq $0x28, %rdi
callq 0x7fa7
movq %rbx, %rdi
callq 0x84ef
jmp 0x9545
cmpl $0x1, %ebp
jne 0x9514
cmpl $0x2, %ebp
je 0x9519
cmpl $0x1, 0x30(%r14)
jne 0x9555
jmp 0x9519
leaq 0x12784(%rip), %rsi     # 0x1bc70
leaq 0x10(%rsp), %rdi
movl $0x98, %edx
callq 0x4190
cmpl $0x2, %ebp
jne 0x93cb
movl 0x30(%r14), %eax
cmpb $0x0, 0x10(%rsp,%rax)
jne 0x9555
jmp 0x93cb
cmpl $0x2, %ebp
jne 0x9555
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 0x9543
xorps %xmm0, %xmm0
movups %xmm0, 0x38(%rbx)
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x1d8, %rsp            # imm = 0x1D8
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rbx, %rdi
callq 0xb8b5
movq 0x18(%rbx), %rax
movl $0x5, (%rax)
movb $0x1, 0x50(%rax)
jmp 0x921f
leaq 0x15349(%rip), %rdi     # 0x1e8c0
leaq 0x14292(%rip), %rsi     # 0x1d810
leaq 0x15362(%rip), %rcx     # 0x1e8e7
movl $0x9b0, %edx            # imm = 0x9B0
callq 0x4100