// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/extended/anno_db_gfflike.c
// Function: remove_node_by_id
static int remove_node_by_id(GtFeatureIndexGFFlike *fis, GtUword id,
                             GtError *err)
{
  GtUword parent_count;
  int had_err = 0;

  if (had_err >= 0) {
    gt_rdb_stmt_reset(fis->stmts[GT_PSTMT_NODE_DELETE_AS_CHILD], err);
    gt_rdb_stmt_bind_int(fis->stmts[GT_PSTMT_NODE_DELETE_AS_CHILD], 0,
                         id, err);
    gt_rdb_stmt_bind_int(fis->stmts[GT_PSTMT_NODE_DELETE_AS_CHILD], 1,
                         id, err);
    had_err = gt_rdb_stmt_exec(fis->stmts[GT_PSTMT_NODE_DELETE_AS_CHILD],
                               err);
  }

  if (had_err >= 0) {
    gt_rdb_stmt_reset(fis->stmts[GT_PSTMT_GET_PARENTS_COUNT], err);
    gt_rdb_stmt_bind_int(fis->stmts[GT_PSTMT_GET_PARENTS_COUNT], 0, id, err);
    had_err = gt_rdb_stmt_exec(fis->stmts[GT_PSTMT_GET_PARENTS_COUNT], err);

    if (had_err >= 0) {
      gt_rdb_stmt_get_ulong(fis->stmts[GT_PSTMT_GET_PARENTS_COUNT],
                            0, &parent_count, err);
      if (parent_count == 0) {
        /* no more references to this node exist, we can delete it */
        /* XXX TODO: error handling */
        if (had_err >= 0) {
          gt_rdb_stmt_reset(fis->stmts[GT_PSTMT_NODE_DELETE_FEATURE],
                            err);
          gt_rdb_stmt_bind_int(fis->stmts[GT_PSTMT_NODE_DELETE_FEATURE],
                               0, id, err);
          had_err = gt_rdb_stmt_exec(fis->stmts[GT_PSTMT_NODE_DELETE_FEATURE],
                                     err);
        }
        if (had_err >= 0) {
          gt_rdb_stmt_reset(fis->stmts[GT_PSTMT_NODE_DELETE_ATTRIB_FOR_NODE],
                            err);
          gt_rdb_stmt_bind_int(fis->stmts[GT_PSTMT_NODE_DELETE_ATTRIB_FOR_NODE],
                                0, id, err);
          had_err = gt_rdb_stmt_exec(
                        fis->stmts[GT_PSTMT_NODE_DELETE_ATTRIB_FOR_NODE], err);
        }
      }
    }
  }
  if (!had_err) {
    GtFeatureNode *fn;
    if ((fn = *(GtFeatureNode**) ul_node_gt_hashmap_get(fis->cache_id2node,
                                                        id))) {
      ul_node_gt_hashmap_remove(fis->cache_id2node, id);
    }
    if (node_ul_gt_hashmap_get(fis->cache_node2id, fn)) {
      node_ul_gt_hashmap_remove(fis->cache_node2id, fn);
    }
    if (gt_hashmap_get(fis->ref_nodes, fn)) {
      gt_hashmap_remove(fis->ref_nodes, fn);
    }
  }
  return had_err;
}

// Assembly:
subq $0x38, %rsp
movq %rdi, 0x30(%rsp)
movq %rsi, 0x28(%rsp)
movq %rdx, 0x20(%rsp)
movl $0x0, 0x14(%rsp)
cmpl $0x0, 0x14(%rsp)
jl 0x1324e5
movq 0x30(%rsp), %rax
movq 0x118(%rax), %rdi
movq 0x20(%rsp), %rsi
callq 0x1c42f0
movq 0x30(%rsp), %rax
movq 0x118(%rax), %rdi
movq 0x28(%rsp), %rax
movl %eax, %edx
movq 0x20(%rsp), %rcx
xorl %eax, %eax
movl %eax, %esi
callq 0x1c4390
movq 0x30(%rsp), %rax
movq 0x118(%rax), %rdi
movq 0x28(%rsp), %rax
movl %eax, %edx
movq 0x20(%rsp), %rcx
movl $0x1, %esi
callq 0x1c4390
movq 0x30(%rsp), %rax
movq 0x118(%rax), %rdi
movq 0x20(%rsp), %rsi
callq 0x1c4650
movl %eax, 0x14(%rsp)
cmpl $0x0, 0x14(%rsp)
jl 0x13262d
movq 0x30(%rsp), %rax
movq 0xe0(%rax), %rdi
movq 0x20(%rsp), %rsi
callq 0x1c42f0
movq 0x30(%rsp), %rax
movq 0xe0(%rax), %rdi
movq 0x28(%rsp), %rax
movl %eax, %edx
movq 0x20(%rsp), %rcx
xorl %eax, %eax
movl %eax, %esi
callq 0x1c4390
movq 0x30(%rsp), %rax
movq 0xe0(%rax), %rdi
movq 0x20(%rsp), %rsi
callq 0x1c4650
movl %eax, 0x14(%rsp)
cmpl $0x0, 0x14(%rsp)
jl 0x13262b
movq 0x30(%rsp), %rax
movq 0xe0(%rax), %rdi
movq 0x20(%rsp), %rcx
xorl %eax, %eax
movl %eax, %esi
leaq 0x18(%rsp), %rdx
callq 0x1c4780
cmpq $0x0, 0x18(%rsp)
jne 0x132629
cmpl $0x0, 0x14(%rsp)
jl 0x1325cf
movq 0x30(%rsp), %rax
movq 0x108(%rax), %rdi
movq 0x20(%rsp), %rsi
callq 0x1c42f0
movq 0x30(%rsp), %rax
movq 0x108(%rax), %rdi
movq 0x28(%rsp), %rax
movl %eax, %edx
movq 0x20(%rsp), %rcx
xorl %eax, %eax
movl %eax, %esi
callq 0x1c4390
movq 0x30(%rsp), %rax
movq 0x108(%rax), %rdi
movq 0x20(%rsp), %rsi
callq 0x1c4650
movl %eax, 0x14(%rsp)
cmpl $0x0, 0x14(%rsp)
jl 0x132627
movq 0x30(%rsp), %rax
movq 0x150(%rax), %rdi
movq 0x20(%rsp), %rsi
callq 0x1c42f0
movq 0x30(%rsp), %rax
movq 0x150(%rax), %rdi
movq 0x28(%rsp), %rax
movl %eax, %edx
movq 0x20(%rsp), %rcx
xorl %eax, %eax
movl %eax, %esi
callq 0x1c4390
movq 0x30(%rsp), %rax
movq 0x150(%rax), %rdi
movq 0x20(%rsp), %rsi
callq 0x1c4650
movl %eax, 0x14(%rsp)
jmp 0x132629
jmp 0x13262b
jmp 0x13262d
cmpl $0x0, 0x14(%rsp)
jne 0x1326c6
movq 0x30(%rsp), %rax
movq 0x58(%rax), %rdi
movq 0x28(%rsp), %rsi
callq 0x131bd0
movq (%rax), %rax
movq %rax, 0x8(%rsp)
cmpq $0x0, %rax
je 0x13266c
movq 0x30(%rsp), %rax
movq 0x58(%rax), %rdi
movq 0x28(%rsp), %rsi
callq 0x1326d0
movq 0x30(%rsp), %rax
movq 0x50(%rax), %rdi
movq 0x8(%rsp), %rsi
callq 0x131830
cmpq $0x0, %rax
je 0x132698
movq 0x30(%rsp), %rax
movq 0x50(%rax), %rdi
movq 0x8(%rsp), %rsi
callq 0x132700
movq 0x30(%rsp), %rax
movq 0x30(%rax), %rdi
movq 0x8(%rsp), %rsi
callq 0xe0f20
cmpq $0x0, %rax
je 0x1326c4
movq 0x30(%rsp), %rax
movq 0x30(%rax), %rdi
movq 0x8(%rsp), %rsi
callq 0xe1030
jmp 0x1326c6
movl 0x14(%rsp), %eax
addq $0x38, %rsp
retq
nop