// File: /workspace/github_c_makefile_star2_O3/genometools[P]genometools/src/extended/spec_visitor.c
// Function: spec_feature_node_lua_has_child_of_supertype
static int spec_feature_node_lua_has_child_of_supertype(lua_State *L)
{
  GtGenomeNode **gn;
  GtFeatureNode *fn, GT_UNUSED *fn2 = NULL;
  GtFeatureNodeIterator *it;
  GtSpecVisitor *sv;
  bool found = false;
  const char *type;

  gn = check_genome_node(L, 1);
  /* make sure we get a feature node */
  fn = gt_feature_node_try_cast(*gn);
  luaL_argcheck(L, fn, 1, "not a feature node");
  type = gt_symbol(luaL_checkstring(L, 2));

  lua_pushlightuserdata(L, (void *) &spec_defuserdata);
  lua_gettable(L, LUA_REGISTRYINDEX);
  sv = lua_touserdata(L, -1);

  if (!sv->type_checker) {
    luaL_where(L, 1);
    lua_pushstring(L, "'feature_node.has_child_of_supertype()' requires a type "
                      "checker (-typecheck)");
    lua_concat(L, 2);
    return lua_error(L);
  }

  luaL_argcheck(L, gt_type_checker_is_valid(sv->type_checker, type),
                2, "not a valid SO type");

  it = gt_feature_node_iterator_new(fn);
  /* skip parent node itself */
  fn2 = gt_feature_node_iterator_next(it);
  gt_assert(fn2);
  while (!found && (fn2 = gt_feature_node_iterator_next(it))) {
    if (sv->type_checker) {
        const char *fn2t = gt_feature_node_get_type(fn2);
        if (gt_type_checker_is_valid(sv->type_checker, fn2t))
          found = gt_type_checker_is_a(sv->type_checker, type, fn2t);
        else
          found = false;
      } else
        found = (gt_feature_node_get_type(fn2) == type);
  }
  gt_feature_node_iterator_delete(it);
  lua_pushboolean(L, found);
  return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x21bda2(%rip), %rdx    # 0x3939f9
movl $0x1, %esi
callq 0x22712c
movq (%rax), %rdi
callq 0x143cab
movq %rax, %r12
testq %rax, %rax
jne 0x177c85
leaq 0x21be11(%rip), %rdx    # 0x393a89
movq %rbx, %rdi
movl $0x1, %esi
callq 0x226d91
movq %rbx, %rdi
movl $0x2, %esi
xorl %edx, %edx
callq 0x22708d
movq %rax, %rdi
callq 0x11c5ff
movq %rax, %r14
leaq 0x342552(%rip), %rsi    # 0x4ba1f8
movq %rbx, %rdi
callq 0x2248bd
movq %rbx, %rdi
movl $0xffffd8f0, %esi       # imm = 0xFFFFD8F0
callq 0x2248f5
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x224118
movq 0x28(%rax), %rdi
testq %rdi, %rdi
je 0x177d93
movq %rax, %r15
movq %r14, %rsi
callq 0x1830f1
testb %al, %al
jne 0x177cf8
leaq 0x21be05(%rip), %rdx    # 0x393af0
movq %rbx, %rdi
movl $0x2, %esi
callq 0x226d91
movq %r12, %rdi
callq 0x143f54
movq %rax, %r12
movq %rax, %rdi
callq 0x1440ea
testq %rax, %rax
je 0x177dd2
movq %rbx, (%rsp)
movq %r12, %rdi
callq 0x1440ea
testq %rax, %rax
setne %bpl
je 0x177d67
movq 0x28(%r15), %rbx
movq %rax, %rdi
callq 0x142988
movq %rax, %r13
testq %rbx, %rbx
je 0x177d62
movq 0x28(%r15), %rdi
movq %r13, %rsi
callq 0x1830f1
testb %al, %al
je 0x177d18
movq 0x28(%r15), %rdi
movq %r14, %rsi
movq %r13, %rdx
callq 0x183155
testb %al, %al
je 0x177d18
jmp 0x177d67
cmpq %r14, %r13
jne 0x177d18
movq %r12, %rdi
callq 0x14417c
movzbl %bpl, %esi
andl $0x1, %esi
movq (%rsp), %rdi
callq 0x2248a3
movl $0x1, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rbx, %rdi
movl $0x1, %esi
callq 0x226f4a
leaq 0x21bdd1(%rip), %rsi    # 0x393b78
movq %rbx, %rdi
callq 0x2243ba
movq %rbx, %rdi
movl $0x2, %esi
callq 0x225a4f
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x225800
callq 0x554c3