// File: /workspace/github_c_makefile_star2_O2/craigbarnes[P]lua-gumbo/lib/parser.c
// Function: handle_in_select
static bool handle_in_select(GumboParser* parser, GumboToken* token) {
  if (token->type == GUMBO_TOKEN_NULL) {
    parser_add_parse_error(parser, token);
    ignore_token(parser);
    return false;
  } else if (
    token->type == GUMBO_TOKEN_CHARACTER
    || 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_is(token, kStartTag, GUMBO_TAG_OPTION)) {
    if (node_html_tag_is(get_current_node(parser), GUMBO_TAG_OPTION)) {
      pop_current_node(parser);
    }
    insert_element_from_token(parser, token);
    return true;
  } else if (tag_is(token, kStartTag, GUMBO_TAG_OPTGROUP)) {
    if (node_html_tag_is(get_current_node(parser), GUMBO_TAG_OPTION)) {
      pop_current_node(parser);
    }
    if (node_html_tag_is(get_current_node(parser), GUMBO_TAG_OPTGROUP)) {
      pop_current_node(parser);
    }
    insert_element_from_token(parser, token);
    return true;
  } else if (tag_is(token, kEndTag, GUMBO_TAG_OPTGROUP)) {
    GumboVector* open_elements = &parser->_parser_state->_open_elements;
    if (
      node_html_tag_is(get_current_node(parser), GUMBO_TAG_OPTION)
      && node_html_tag_is (
        open_elements->data[open_elements->length - 2],
        GUMBO_TAG_OPTGROUP
      )
    ) {
      pop_current_node(parser);
    }
    if (node_html_tag_is(get_current_node(parser), GUMBO_TAG_OPTGROUP)) {
      pop_current_node(parser);
      return true;
    } else {
      parser_add_parse_error(parser, token);
      ignore_token(parser);
      return false;
    }
  } else if (tag_is(token, kEndTag, GUMBO_TAG_OPTION)) {
    if (node_html_tag_is(get_current_node(parser), GUMBO_TAG_OPTION)) {
      pop_current_node(parser);
      return true;
    } else {
      parser_add_parse_error(parser, token);
      ignore_token(parser);
      return false;
    }
  } else if (tag_is(token, kEndTag, GUMBO_TAG_SELECT)) {
    if (!has_an_element_in_select_scope(parser, GUMBO_TAG_SELECT)) {
      parser_add_parse_error(parser, token);
      ignore_token(parser);
      return false;
    }
    close_current_select(parser);
    return true;
  } else if (tag_is(token, kStartTag, GUMBO_TAG_SELECT)) {
    parser_add_parse_error(parser, token);
    ignore_token(parser);
    if (has_an_element_in_select_scope(parser, GUMBO_TAG_SELECT)) {
      close_current_select(parser);
    }
    return false;
  } else if (
    tag_in(token, kStartTag, &(const TagSet) {TAG(INPUT), TAG(KEYGEN), TAG(TEXTAREA)})
  ) {
    parser_add_parse_error(parser, token);
    if (!has_an_element_in_select_scope(parser, GUMBO_TAG_SELECT)) {
      ignore_token(parser);
    } else {
      close_current_select(parser);
      parser->_parser_state->_reprocess_current_token = true;
    }
    return false;
  } else if (
    tag_in(token, kStartTag, &(const TagSet){TAG(SCRIPT), TAG(TEMPLATE)})
    || tag_is(token, kEndTag, GUMBO_TAG_TEMPLATE)
  ) {
    return handle_in_head(parser, token);
  } else if (token->type == GUMBO_TOKEN_EOF) {
    return handle_in_body(parser, token);
  } else {
    parser_add_parse_error(parser, token);
    ignore_token(parser);
    return false;
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movl (%rsi), %r12d
cmpq $0x7, %r12
ja 0x993a
leaq 0xdcdc(%rip), %rax      # 0x17600
movslq (%rax,%r12,4), %rcx
addq %rax, %rcx
jmpq *%rcx
movq %rbx, %rdi
movq %r14, %rsi
callq 0xa59b
jmp 0x9982
cmpl $0x1, %r12d
jne 0x9989
movl 0x30(%r14), %eax
cmpl $0x72, %eax
je 0x9aa8
cmpl $0x6f, %eax
je 0x9a4d
cmpl $0x71, %eax
je 0x9a7d
testl %eax, %eax
je 0x9b28
jmp 0x99fa
movq %rbx, %rdi
callq 0x7913
movq %rbx, %rdi
movq %rax, %rsi
movq %r14, %rdx
callq 0xa2ca
movb $0x1, %al
jmp 0x9b96
cmpl $0x2, %r12d
jne 0x99fa
movl 0x30(%r14), %eax
cmpl $0x6f, %eax
je 0x9b68
cmpl $0x72, %eax
je 0x9b44
movb $0x1, %bpl
cmpl $0x71, %eax
jne 0x99fc
movq 0x18(%rbx), %r15
movq %rbx, %rdi
callq 0x7913
pushq $0x72
popq %rsi
movq %rax, %rdi
callq 0x82b7
testb %al, %al
je 0x99eb
movq 0x8(%r15), %rax
movl 0x10(%r15), %ecx
addl $-0x2, %ecx
movq (%rax,%rcx,8), %rdi
pushq $0x71
popq %rsi
callq 0x82b7
testb %al, %al
je 0x99eb
movq %rbx, %rdi
callq 0xa620
movq %rbx, %rdi
callq 0x7913
pushq $0x71
jmp 0x9b4e
xorl %ebp, %ebp
cmpl $0x1, %r12d
jne 0x9afa
movl 0x30(%r14), %r13d
leaq 0xfb0f(%rip), %rax      # 0x19520
cmpb $0x0, (%r13,%rax)
je 0x9ad7
movq %rbx, %rdi
movq %r14, %rsi
callq 0x797d
movq %rbx, %rdi
callq 0xbb66
testb %al, %al
je 0x9b8c
movq %rbx, %rdi
callq 0xbb85
movq 0x18(%rbx), %rax
movb $0x1, 0x50(%rax)
jmp 0x9b94
movq %rbx, %rdi
movq %r14, %rsi
callq 0x797d
movq %rbx, %rdi
callq 0x83cf
movq %rbx, %rdi
callq 0xbb66
testb %al, %al
je 0x9b94
movq %rbx, %rdi
callq 0xbb85
jmp 0x9b94
movq %rbx, %rdi
callq 0x7913
pushq $0x72
popq %rsi
movq %rax, %rdi
callq 0x82b7
testb %al, %al
je 0x9a9c
movq %rbx, %rdi
callq 0xa620
movq %rbx, %rdi
callq 0x7913
pushq $0x71
jmp 0x9ab2
movq %rbx, %rdi
callq 0x7913
pushq $0x72
popq %rsi
movq %rax, %rdi
callq 0x82b7
testb %al, %al
je 0x9ac7
movq %rbx, %rdi
callq 0xa620
movq %rbx, %rdi
movq %r14, %rsi
callq 0xa439
jmp 0x9982
movq %rsp, %r15
movl $0x98, %edx
movq %r15, %rdi
xorl %esi, %esi
callq 0x4120
movb $0x1, %al
movb %al, 0x7(%r15)
movb %al, 0x9(%r15)
cmpb $0x0, (%rsp,%r13)
jne 0x9b06
testb %bpl, %bpl
je 0x9b22
cmpl $0x9, 0x30(%r14)
jne 0x9b22
movq %rbx, %rdi
movq %r14, %rsi
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x8893
cmpl $0x8, %r12d
jne 0x9b81
movq %rbx, %rdi
movq %r14, %rsi
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x4d63
movq %rbx, %rdi
callq 0x7913
pushq $0x72
popq %rsi
movq %rax, %rdi
callq 0x82b7
testb %al, %al
je 0x9b81
movq %rbx, %rdi
callq 0xa620
jmp 0x9982
movq %rbx, %rdi
callq 0xbb66
testb %al, %al
je 0x9b81
movq %rbx, %rdi
callq 0xbb85
jmp 0x9982
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