// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/extended/spec_visitor.c
// Function: spec_feature_node_lua_appears_as_child_of_type_g
static int spec_feature_node_lua_appears_as_child_of_type_g(lua_State *L,
                                                            bool supertype)
{
  GtGenomeNode **gn;
  GtFeatureNode *fn, *fn2;
  bool found = false;
  GtSpecVisitor *sv;
  const char *type;
  GtUword i;
  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 (supertype) {
    if (!sv->type_checker) {
      luaL_where(L, 1);
      lua_pushstring(L, "'feature_node.appears_as_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");
  }

  gt_assert(sv && sv->graph_context);
  if (gt_array_size(sv->graph_context) > 0) {
    for (i = gt_array_size(sv->graph_context) - 1; i + 1 > 0; i--) {
      fn2 = *(GtFeatureNode**) gt_array_get(sv->graph_context, i);
      if (!fn2) continue;
      if (supertype && 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);
      if (found)
        break;
    }
  }
  lua_pushboolean(L, found);
  return 1;
}

// Assembly:
subq $0x68, %rsp
movb %sil, %al
movq %rdi, 0x58(%rsp)
andb $0x1, %al
movb %al, 0x57(%rsp)
movb $0x0, 0x37(%rsp)
movq 0x58(%rsp), %rdi
movl $0x1, %esi
leaq 0x3876ed(%rip), %rdx    # 0x566365
callq 0x33a790
movq %rax, 0x48(%rsp)
movq 0x48(%rsp), %rax
movq (%rax), %rdi
callq 0x170450
movq %rax, 0x40(%rsp)
movb $0x1, %al
cmpq $0x0, 0x40(%rsp)
movb %al, 0xf(%rsp)
jne 0x1decc2
movq 0x58(%rsp), %rdi
movl $0x1, %esi
leaq 0x387742(%rip), %rdx    # 0x5663f5
callq 0x33a1f0
cmpl $0x0, %eax
setne %al
movb %al, 0xf(%rsp)
movb 0xf(%rsp), %al
movq 0x58(%rsp), %rdi
movl $0x2, %esi
xorl %eax, %eax
movl %eax, %edx
callq 0x33a6b0
movq %rax, %rdi
callq 0x120930
movq %rax, 0x20(%rsp)
movq 0x58(%rsp), %rdi
leaq 0x45edce(%rip), %rsi    # 0x63dac0
callq 0x336160
movq 0x58(%rsp), %rdi
movl $0xffffd8f0, %esi       # imm = 0xFFFFD8F0
callq 0x336210
movq 0x58(%rsp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x335300
movq %rax, 0x28(%rsp)
testb $0x1, 0x57(%rsp)
je 0x1dedb7
movq 0x28(%rsp), %rax
cmpq $0x0, 0x28(%rax)
jne 0x1ded73
movq 0x58(%rsp), %rdi
movl $0x1, %esi
callq 0x33a490
movq 0x58(%rsp), %rdi
leaq 0x3876bc(%rip), %rsi    # 0x566408
callq 0x335740
movq 0x58(%rsp), %rdi
movl $0x2, %esi
callq 0x338280
movq 0x58(%rsp), %rdi
callq 0x337ea0
movl %eax, 0x64(%rsp)
jmp 0x1def26
movq 0x28(%rsp), %rax
movq 0x28(%rax), %rdi
movq 0x20(%rsp), %rsi
callq 0x1f41b0
movb %al, %cl
movb $0x1, %al
testb $0x1, %cl
movb %al, 0xe(%rsp)
jne 0x1dedb3
movq 0x58(%rsp), %rdi
movl $0x2, %esi
leaq 0x3876b8(%rip), %rdx    # 0x56645c
callq 0x33a1f0
cmpl $0x0, %eax
setne %al
movb %al, 0xe(%rsp)
movb 0xe(%rsp), %al
jmp 0x1dedb9
cmpq $0x0, 0x28(%rsp)
je 0x1dedcd
movq 0x28(%rsp), %rax
cmpq $0x0, 0x60(%rax)
jne 0x1dee05
movq 0x45d1cc(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x337235(%rip), %rsi    # 0x516013
leaq 0x38768b(%rip), %rdx    # 0x566470
leaq 0x38769c(%rip), %rcx    # 0x566488
leaq 0x3873de(%rip), %r8     # 0x5661d1
movl $0x282, %r9d            # imm = 0x282
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x1dee07
movq 0x28(%rsp), %rax
movq 0x60(%rax), %rdi
callq 0x81370
cmpq $0x0, %rax
jbe 0x1def0b
movq 0x28(%rsp), %rax
movq 0x60(%rax), %rdi
callq 0x81370
subq $0x1, %rax
movq %rax, 0x18(%rsp)
movq 0x18(%rsp), %rax
addq $0x1, %rax
cmpq $0x0, %rax
jbe 0x1def09
movq 0x28(%rsp), %rax
movq 0x60(%rax), %rdi
movq 0x18(%rsp), %rsi
callq 0x80b60
movq (%rax), %rax
movq %rax, 0x38(%rsp)
cmpq $0x0, 0x38(%rsp)
jne 0x1dee71
jmp 0x1deef6
testb $0x1, 0x57(%rsp)
je 0x1deed3
movq 0x28(%rsp), %rax
cmpq $0x0, 0x28(%rax)
je 0x1deed3
movq 0x38(%rsp), %rdi
callq 0x16d430
movq %rax, 0x10(%rsp)
movq 0x28(%rsp), %rax
movq 0x28(%rax), %rdi
movq 0x10(%rsp), %rsi
callq 0x1f41b0
testb $0x1, %al
jne 0x1deeac
jmp 0x1deecc
movq 0x28(%rsp), %rax
movq 0x28(%rax), %rdi
movq 0x20(%rsp), %rsi
movq 0x10(%rsp), %rdx
callq 0x1f4380
andb $0x1, %al
movb %al, 0x37(%rsp)
jmp 0x1deed1
movb $0x0, 0x37(%rsp)
jmp 0x1deeeb
movq 0x38(%rsp), %rdi
callq 0x16d430
cmpq 0x20(%rsp), %rax
sete %al
andb $0x1, %al
movb %al, 0x37(%rsp)
testb $0x1, 0x37(%rsp)
je 0x1deef4
jmp 0x1def09
jmp 0x1deef6
movq 0x18(%rsp), %rax
addq $-0x1, %rax
movq %rax, 0x18(%rsp)
jmp 0x1dee36
jmp 0x1def0b
movq 0x58(%rsp), %rdi
movb 0x37(%rsp), %al
andb $0x1, %al
movzbl %al, %esi
callq 0x336110
movl $0x1, 0x64(%rsp)
movl 0x64(%rsp), %eax
addq $0x68, %rsp
retq
nop