// File: /workspace/github_c_makefile_star2_O2/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 0x217410(%rip), %rdx    # 0x333d68
pushq $0x1
popq %rsi
callq 0x1dea4f
movq (%rax), %rdi
callq 0xdc2f0
movq %rax, %r12
testq %rax, %rax
jne 0x11c982
leaq 0x217481(%rip), %rdx    # 0x333df8
pushq $0x1
popq %rsi
movq %rbx, %rdi
callq 0x1de6f4
pushq $0x2
popq %rsi
movq %rbx, %rdi
xorl %edx, %edx
callq 0x1de9c6
movq %rax, %rdi
callq 0xaed4b
movq %rax, %r14
leaq 0x31c807(%rip), %rsi    # 0x4391a8
movq %rbx, %rdi
callq 0x1dc4ec
movq %rbx, %rdi
movl $0xffffd8f0, %esi       # imm = 0xFFFFD8F0
callq 0x1dc524
pushq $-0x1
popq %rsi
movq %rbx, %rdi
callq 0x1dbd9e
movq 0x28(%rax), %rdi
testq %rdi, %rdi
je 0x11ca8b
movq %rax, %r15
movq %r14, %rsi
callq 0x12a6ec
testb %al, %al
jne 0x11c9ef
leaq 0x21747b(%rip), %rdx    # 0x333e5f
pushq $0x2
popq %rsi
movq %rbx, %rdi
callq 0x1de6f4
movq %r12, %rdi
callq 0xdc6f0
movq %rax, %r12
movq %rax, %rdi
callq 0xdc92e
testq %rax, %rax
je 0x11cac6
xorl %ebp, %ebp
testb $0x1, %bpl
jne 0x11ca62
movq %r12, %rdi
callq 0xdc92e
testq %rax, %rax
je 0x11ca62
movq 0x28(%r15), %rbp
movq %rax, %rdi
callq 0xda338
movq %rax, %r13
testq %rbp, %rbp
je 0x11ca59
movq 0x28(%r15), %rdi
movq %r13, %rsi
callq 0x12a6ec
xorl %ebp, %ebp
testb %al, %al
je 0x11ca0d
movq 0x28(%r15), %rdi
movq %r14, %rsi
movq %r13, %rdx
callq 0x12a7e3
movl %eax, %ebp
jmp 0x11ca0d
cmpq %r14, %r13
sete %bpl
jmp 0x11ca0d
movq %r12, %rdi
callq 0xdc9f1
movzbl %bpl, %esi
andl $0x1, %esi
movq %rbx, %rdi
callq 0x1dc4d2
pushq $0x1
popq %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
pushq $0x1
popq %rsi
movq %rbx, %rdi
callq 0x1de895
leaq 0x21744a(%rip), %rsi    # 0x333ee7
movq %rbx, %rdi
callq 0x1dc009
pushq $0x2
popq %rsi
movq %rbx, %rdi
callq 0x1dd50a
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1dd306
movq 0x31b49b(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x1c853c(%rip), %rsi    # 0x2e5013
leaq 0x217456(%rip), %rdx    # 0x333f34
leaq 0x217453(%rip), %rcx    # 0x333f38
leaq 0x2170fa(%rip), %r8     # 0x333be6
movl $0x2d8, %r9d            # imm = 0x2D8
xorl %eax, %eax
callq 0x17a50
callq 0x17390