// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/extended/anno_db_gfflike.c
// Function: gt_feature_index_gfflike_save_chg
static int gt_feature_index_gfflike_save_chg(void *key, GT_UNUSED void *val,
                                             void *data, GtError *err)
{
  GtFeatureNode *fn = (GtFeatureNode*) key, *child;
  GtUword *id;
  ObserverCallbackInfo *oci = (ObserverCallbackInfo*) data;
  GFFlikeAttributeInfo ai;
  GtFeatureNodeIterator *fni;
  int had_err = 0, rval;

  id = node_ul_gt_hashmap_get(oci->fis->cache_node2id, fn);
  gt_assert(id);

  /* update main feature table */
  gt_rdb_stmt_reset(oci->fis->stmts[GT_PSTMT_FEATURE_UPDATE], err);
  gt_rdb_stmt_bind_double(oci->fis->stmts[GT_PSTMT_FEATURE_UPDATE], 0,
                          gt_feature_node_score_is_defined(fn) ?
                         gt_feature_node_get_score(fn) :
                         GT_UNDEF_DOUBLE, err);
  gt_rdb_stmt_bind_int(oci->fis->stmts[GT_PSTMT_FEATURE_UPDATE], 1,
                       gt_feature_node_get_strand(fn), err);
  gt_rdb_stmt_bind_int(oci->fis->stmts[GT_PSTMT_FEATURE_UPDATE], 2,
                       gt_feature_node_get_phase(fn), err);
  gt_rdb_stmt_bind_int(oci->fis->stmts[GT_PSTMT_FEATURE_UPDATE], 3, *id,
                       err);
  rval = gt_rdb_stmt_exec(oci->fis->stmts[GT_PSTMT_FEATURE_UPDATE], err);
  if (rval < 0)
    had_err = -1;

  if (!had_err) {
    /* resave attributes: remove first... */
    gt_rdb_stmt_reset(oci->fis->stmts[GT_PSTMT_NODE_DELETE_ATTRIB_FOR_NODE],
                      err);
    gt_rdb_stmt_bind_int(oci->fis->stmts[GT_PSTMT_NODE_DELETE_ATTRIB_FOR_NODE],
                         0, *id, err);
    rval = gt_rdb_stmt_exec(
                          oci->fis->stmts[GT_PSTMT_NODE_DELETE_ATTRIB_FOR_NODE],
                          err);
    if (rval < 0)
      had_err = -1;
  }

  if (!had_err) {
    /* then insert all attributes again */
    ai.fis = oci->fis;
    ai.id = *id;
    ai.err = err;
    gt_feature_node_foreach_attribute(fn, resave_each_attribute, &ai);
  }

  if (!had_err) {
    gt_rdb_stmt_reset(oci->fis->stmts[GT_PSTMT_NODE_DELETE_AS_PARENT], err);
    gt_rdb_stmt_bind_int(oci->fis->stmts[GT_PSTMT_NODE_DELETE_AS_PARENT],
                         0, *id, err);
    (void) gt_rdb_stmt_exec(oci->fis->stmts[GT_PSTMT_NODE_DELETE_AS_PARENT],
                            err);
    fni = gt_feature_node_iterator_new_direct(fn);
    while ((child = gt_feature_node_iterator_next(fni))) {
      GtUword *child_id;
      if ((child_id = node_ul_gt_hashmap_get(oci->fis->cache_node2id, child))) {
        gt_rdb_stmt_reset(oci->fis->stmts[GT_PSTMT_PARENT_INSERT], err);
        gt_rdb_stmt_bind_int(oci->fis->stmts[GT_PSTMT_PARENT_INSERT],
                             0, *child_id, err);
        gt_rdb_stmt_bind_int(oci->fis->stmts[GT_PSTMT_PARENT_INSERT],
                             1, *id, err);
        (void) gt_rdb_stmt_exec(oci->fis->stmts[GT_PSTMT_PARENT_INSERT],
                                err);
      }
    }
  }

  return (had_err >= 0) ? 0  : -1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rcx, %rbx
movq %rdx, %r14
movq %rdi, %r15
movq 0x8(%rdx), %rax
movq 0x50(%rax), %rdi
leaq 0x10(%rsp), %rsi
movq %r15, (%rsi)
callq 0x10620e
leaq 0x8(%rax), %rbp
testq %rax, %rax
cmoveq %rax, %rbp
je 0x12b455
movq 0x8(%r14), %rax
movq 0xa8(%rax), %rdi
movq %rbx, %rsi
callq 0x174129
movq 0x8(%r14), %rax
movq 0xa8(%rax), %r12
movq %r15, %rdi
callq 0x149bf5
testb %al, %al
je 0x12b24d
movq %r15, %rdi
callq 0x149ef0
cvtss2sd %xmm0, %xmm0
jmp 0x12b255
movsd 0x225abb(%rip), %xmm0   # 0x350d10
xorl %r13d, %r13d
movq %r12, %rdi
xorl %esi, %esi
movq %rbx, %rdx
callq 0x1741ad
movq 0x8(%r14), %rax
movq 0xa8(%rax), %r12
movq %r15, %rdi
callq 0x14970e
movl $0x1, %esi
movq %r12, %rdi
movl %eax, %edx
movq %rbx, %rcx
callq 0x17414a
movq 0x8(%r14), %rax
movq 0xa8(%rax), %r12
movq %r15, %rdi
callq 0x149f67
movl $0x2, %esi
movq %r12, %rdi
movl %eax, %edx
movq %rbx, %rcx
callq 0x17414a
movq 0x8(%r14), %rax
movq 0xa8(%rax), %rdi
movl (%rbp), %edx
movl $0x3, %esi
movq %rbx, %rcx
callq 0x17414a
movq 0x8(%r14), %rax
movq 0xa8(%rax), %rdi
movq %rbx, %rsi
callq 0x1741ce
testl %eax, %eax
js 0x12b325
movq 0x8(%r14), %rax
movq 0x150(%rax), %rdi
movq %rbx, %rsi
callq 0x174129
movq 0x8(%r14), %rax
movq 0x150(%rax), %rdi
movl (%rbp), %edx
xorl %esi, %esi
movq %rbx, %rcx
callq 0x17414a
movq 0x8(%r14), %rax
movq 0x150(%rax), %rdi
movq %rbx, %rsi
callq 0x1741ce
testl %eax, %eax
setns %r13b
movq %r13, (%rsp)
testb %r13b, %r13b
je 0x12b440
movq 0x8(%r14), %rax
leaq 0x10(%rsp), %rdx
movq %rax, (%rdx)
movq (%rbp), %rax
movq %rax, 0x8(%rdx)
movq %rbx, 0x10(%rdx)
leaq 0x109(%rip), %rsi       # 0x12b45a
movq %r15, %rdi
callq 0x14a607
movq 0x8(%r14), %rax
movq 0x120(%rax), %rdi
movq %rbx, %rsi
callq 0x174129
movq 0x8(%r14), %rax
movq 0x120(%rax), %rdi
movl (%rbp), %edx
xorl %esi, %esi
movq %rbx, %rcx
callq 0x17414a
movq 0x8(%r14), %rax
movq 0x120(%rax), %rdi
movq %rbx, %rsi
callq 0x1741ce
movq %r15, %rdi
callq 0x14b295
movq %rax, %r15
movq %rax, %rdi
callq 0x14b33e
testq %rax, %rax
je 0x12b440
leaq 0x8(%rsp), %r12
movq 0x8(%r14), %rcx
movq 0x50(%rcx), %rdi
movq %rax, 0x8(%rsp)
movq %r12, %rsi
callq 0x10620e
testq %rax, %rax
je 0x12b42f
movq %rax, %r13
movq 0x8(%r14), %rax
movq 0x80(%rax), %rdi
movq %rbx, %rsi
callq 0x174129
movq 0x8(%r14), %rax
movq 0x80(%rax), %rdi
movl 0x8(%r13), %edx
xorl %esi, %esi
movq %rbx, %rcx
callq 0x17414a
movq 0x8(%r14), %rax
movq 0x80(%rax), %rdi
movl (%rbp), %edx
movl $0x1, %esi
movq %rbx, %rcx
callq 0x17414a
movq 0x8(%r14), %rax
movq 0x80(%rax), %rdi
movq %rbx, %rsi
callq 0x1741ce
movq %r15, %rdi
callq 0x14b33e
testq %rax, %rax
jne 0x12b3b8
movzbl (%rsp), %eax
decl %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x3b827