// File: /workspace/github_c_makefile_star2_O3/genometools[P]genometools/src/extended/anno_db_gfflike.c
// Function: insert_single_node
static int insert_single_node(GtFeatureIndexGFFlike *fi,
                              GtUword *id,
                              GtFeatureNode *fn,
                              GtError *err)
{
  GtRange rng;
  GtStrArray *attribs;
  GtUword i, *myid;
  int type_id           = GT_UNDEF_INT,
      source_id         = GT_UNDEF_INT,
      sequenceregion_id = GT_UNDEF_INT,
      rval = 0,
      had_err = 0,
      multi = 0,
      multi_rep = 0;

  /* do we have the id in the cache already */
  myid = node_ul_gt_hashmap_get(fi->cache_node2id, fn);
  if (myid) {
    *id = *myid;
    return had_err;
  }

  gt_mutex_lock(fi->dblock);

  /* insert details */
  if (!gt_feature_node_is_pseudo(fn)) {
    /* pseudo-features do not have a type */
    type_id =
      gt_feature_index_gfflike_insert_helper(fi,
                                         fi->stmts[GT_PSTMT_TYPE_SELECT],
                                         fi->stmts[GT_PSTMT_TYPE_INSERT],
                                         gt_feature_node_get_type(fn),
                                         "types",
                                         NULL);
  }

  source_id =
    gt_feature_index_gfflike_insert_helper(fi,
                                           fi->stmts[GT_PSTMT_SOURCE_SELECT],
                                           fi->stmts[GT_PSTMT_SOURCE_INSERT],
                                           gt_feature_node_get_source(fn),
                                           "sources",
                                           NULL);

  sequenceregion_id =
    gt_feature_index_gfflike_insert_helper(fi,
                    fi->stmts[GT_PSTMT_SEQUENCEREGION_SELECT],
                    fi->stmts[GT_PSTMT_SEQUENCEREGION_INSERT],
                    gt_str_get(gt_genome_node_get_seqid((GtGenomeNode*) fn)),
                    "sequenceregions",
                    NULL);

  /* insert feature */
  rng = gt_genome_node_get_range((GtGenomeNode*) fn);
  gt_rdb_stmt_reset(fi->stmts[GT_PSTMT_FEATURE_INSERT], err);
  gt_rdb_stmt_bind_int(fi->stmts[GT_PSTMT_FEATURE_INSERT], 0,
                       sequenceregion_id, err);
  gt_rdb_stmt_bind_int(fi->stmts[GT_PSTMT_FEATURE_INSERT], 1, source_id, err);
  gt_rdb_stmt_bind_int(fi->stmts[GT_PSTMT_FEATURE_INSERT], 2, type_id, err);
  gt_rdb_stmt_bind_ulong(fi->stmts[GT_PSTMT_FEATURE_INSERT], 3, rng.start,
                         err);
  gt_rdb_stmt_bind_ulong(fi->stmts[GT_PSTMT_FEATURE_INSERT], 4, rng.end, err);
  gt_rdb_stmt_bind_double(fi->stmts[GT_PSTMT_FEATURE_INSERT], 5,
                          gt_feature_node_score_is_defined(fn) ?
                            gt_feature_node_get_score(fn) :
                            GT_UNDEF_DOUBLE,
                          err);
  gt_rdb_stmt_bind_int(fi->stmts[GT_PSTMT_FEATURE_INSERT], 6,
                       gt_feature_node_get_strand(fn), err);
  gt_rdb_stmt_bind_int(fi->stmts[GT_PSTMT_FEATURE_INSERT], 7,
                       gt_feature_node_get_phase(fn), err);

  /* store multi-feature information */
  if (gt_feature_node_is_multi(fn)) {
    GtFeatureNode *rep;
    multi = 1;
    if ((rep = gt_feature_node_get_multi_representative(fn)) != fn) {
      GtUword *multi_rep_id;
      multi_rep_id = node_ul_gt_hashmap_get(fi->cache_node2id, rep);
      gt_assert(multi_rep_id);
      multi_rep = *multi_rep_id;
    }
  } else multi = 0;

  gt_rdb_stmt_bind_int(fi->stmts[GT_PSTMT_FEATURE_INSERT], 8, multi, err);
  gt_rdb_stmt_bind_int(fi->stmts[GT_PSTMT_FEATURE_INSERT], 9, multi_rep, err);
  gt_rdb_stmt_bind_int(fi->stmts[GT_PSTMT_FEATURE_INSERT], 10,
                       gt_feature_node_is_pseudo(fn), err);
  gt_rdb_stmt_bind_int(fi->stmts[GT_PSTMT_FEATURE_INSERT], 11,
                       gt_feature_node_is_marked(fn), err);
  rval = gt_rdb_stmt_exec(fi->stmts[GT_PSTMT_FEATURE_INSERT], err);
  if (rval < 0) gt_error_check(err);

  *id = gt_rdb_last_inserted_id(fi->db, "features", err);
  /* cache DB keys to avoid redundant saving of nodes with
     multiple parents */
  node_ul_gt_hashmap_add(fi->cache_node2id, fn, *id);
  ul_node_gt_hashmap_add(fi->cache_id2node, *id, fn);

  /* insert attributes */
  attribs = gt_feature_node_get_attribute_list(fn);
  for (i=0;i<gt_str_array_size(attribs);i++) {
    const char *attr;
    gt_rdb_stmt_reset(fi->stmts[GT_PSTMT_ATTRIBUTE_INSERT], err);
    attr = gt_str_array_get(attribs, i);
    gt_rdb_stmt_bind_int(fi->stmts[GT_PSTMT_ATTRIBUTE_INSERT], 0, *id, err);
    gt_rdb_stmt_bind_string(fi->stmts[GT_PSTMT_ATTRIBUTE_INSERT], 1, attr,
                            err);
    gt_rdb_stmt_bind_string(fi->stmts[GT_PSTMT_ATTRIBUTE_INSERT], 2,
                            gt_feature_node_get_attribute(fn, attr), err);
    rval = gt_rdb_stmt_exec(fi->stmts[GT_PSTMT_ATTRIBUTE_INSERT], err);
    if (rval < 0)
      had_err = -1;
  }
  gt_str_array_delete(attribs);
  gt_mutex_unlock(fi->dblock);
  return had_err;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rcx, %r12
movq %rdx, %rbp
movq %rsi, %r15
movq %rdi, %rbx
movq 0x50(%rdi), %rdi
leaq 0x28(%rsp), %rsi
movq %rdx, (%rsi)
callq 0x1012ee
testq %rax, %rax
je 0x1248d9
movq 0x8(%rax), %rax
movq %rax, (%r15)
xorl %r13d, %r13d
jmp 0x124ce1
movq 0x170(%rbx), %rdi
callq 0x11c907
movq %rbp, %rdi
callq 0x142b68
movl $0x80000000, %ecx       # imm = 0x80000000
testb %al, %al
jne 0x124920
movq 0x60(%rbx), %r14
movq 0x68(%rbx), %r13
movq %rbp, %rdi
callq 0x142988
leaq 0x23e4e9(%rip), %r8     # 0x362df6
movq %rbx, %rdi
movq %r14, %rsi
movq %r13, %rdx
movq %rax, %rcx
callq 0x124e2d
movl %eax, %ecx
movl %ecx, 0xc(%rsp)
movq 0x70(%rbx), %r14
movq 0x78(%rbx), %r13
movq %rbp, %rdi
callq 0x142ab4
leaq 0x270239(%rip), %r8     # 0x394b74
movq %rbx, %rdi
movq %r14, %rsi
movq %r13, %rdx
movq %rax, %rcx
callq 0x124e2d
movl %eax, 0x10(%rsp)
movq 0x88(%rbx), %r13
movq %rbp, %r14
movq 0x98(%rbx), %rbp
movq %r14, %rdi
movq %r14, 0x20(%rsp)
callq 0x144635
movq %rax, %rdi
callq 0x11b0a1
leaq 0x252252(%rip), %r8     # 0x376bcf
movq %rbx, %rdi
movq %r13, %rsi
movq %rbp, %rdx
movq %rax, %rcx
callq 0x124e2d
movl %eax, %r13d
movq %r14, %rdi
callq 0x144679
movq %rax, %rbp
movq %rdx, %r14
movq 0xa0(%rbx), %rdi
movq %r12, %rsi
callq 0x16bf19
movq 0xa0(%rbx), %rdi
xorl %esi, %esi
movl %r13d, %edx
movq %r12, %rcx
callq 0x16bf3a
movq 0xa0(%rbx), %rdi
movl $0x1, %esi
movl 0x10(%rsp), %edx
movq %r12, %rcx
callq 0x16bf3a
movq 0xa0(%rbx), %rdi
movl $0x2, %esi
movl 0xc(%rsp), %edx
movq %r12, %rcx
callq 0x16bf3a
movq 0xa0(%rbx), %rdi
movl $0x3, %esi
movq %rbp, %rdx
movq %r12, %rcx
callq 0x16bf5b
movq 0xa0(%rbx), %rdi
movl $0x4, %esi
movq %r14, %rdx
movq %r12, %rcx
callq 0x16bf5b
movq 0xa0(%rbx), %r14
movq 0x20(%rsp), %r13
movq %r13, %rdi
callq 0x1429c8
testb %al, %al
je 0x124a46
movq %r13, %rdi
callq 0x142cc3
cvtss2sd %xmm0, %xmm0
jmp 0x124a4e
movsd 0x2232c2(%rip), %xmm0   # 0x347d10
movl $0x5, %esi
movq %r14, %rdi
movq %r12, %rdx
callq 0x16bf9d
movq 0xa0(%rbx), %r14
movq %r13, %rdi
callq 0x1424d6
movl $0x6, %esi
movq %r14, %rdi
movl %eax, %edx
movq %r12, %rcx
callq 0x16bf3a
movq 0xa0(%rbx), %r14
movq %r13, %rdi
callq 0x142d3a
movl $0x7, %esi
movq %r14, %rdi
movl %eax, %edx
movq %r12, %rcx
callq 0x16bf3a
movq %r13, %rdi
callq 0x142b41
testb %al, %al
je 0x124ae4
movq %r13, %rdi
callq 0x142c80
movl $0x1, %ebp
cmpq %r13, %rax
movl $0x0, %r14d
je 0x124ae9
movq 0x50(%rbx), %rdi
leaq 0x28(%rsp), %rsi
movq %rax, (%rsi)
callq 0x1012ee
testq %rax, %rax
je 0x124cf8
movl 0x8(%rax), %r14d
jmp 0x124ae9
xorl %ebp, %ebp
xorl %r14d, %r14d
movq 0xa0(%rbx), %rdi
movl $0x8, %esi
movl %ebp, %edx
movq %r12, %rcx
callq 0x16bf3a
movq 0xa0(%rbx), %rdi
movl $0x9, %esi
movl %r14d, %edx
movq %r12, %rcx
callq 0x16bf3a
movq 0xa0(%rbx), %r14
movq %r13, %rdi
callq 0x142b68
movzbl %al, %edx
movl $0xa, %esi
movq %r14, %rdi
movq %r12, %rcx
callq 0x16bf3a
movq 0xa0(%rbx), %r14
movq %r13, %rdi
callq 0x143b46
movzbl %al, %edx
movl $0xb, %esi
movq %r14, %rdi
movq %r12, %rcx
callq 0x16bf3a
movq 0xa0(%rbx), %rdi
movq %r12, %rsi
callq 0x16bfbe
testq %r12, %r12
je 0x124b82
testl %eax, %eax
jns 0x124b82
movq %r12, %rdi
callq 0xfcc32
testb %al, %al
jne 0x124cf3
movq 0x168(%rbx), %rdi
leaq 0x221434(%rip), %rsi    # 0x345fc4
movq %r12, %rdx
callq 0x16be46
movq %rax, %r14
movq %rax, (%r15)
movq 0x50(%rbx), %rdi
leaq 0x28(%rsp), %rsi
movq %r13, (%rsi)
movq %rax, 0x8(%rsi)
leaq 0x18(%rsp), %rdx
callq 0x1015ee
testl %eax, %eax
jne 0x124bc5
movq 0x18(%rsp), %rax
movq %r14, 0x8(%rax)
movq 0x58(%rbx), %rdi
movq (%r15), %rax
leaq 0x28(%rsp), %rsi
movq %rax, (%rsi)
movq %r13, 0x8(%rsi)
leaq 0x18(%rsp), %rdx
callq 0x1015ee
testl %eax, %eax
jne 0x124bef
movq 0x18(%rsp), %rax
movq %r13, 0x8(%rax)
movq %r13, %rdi
callq 0x141f60
movq %rax, %rbp
movq %rax, %rdi
callq 0x11c131
testq %rax, %rax
je 0x124cca
xorl %r14d, %r14d
xorl %r13d, %r13d
movq %rbp, 0x10(%rsp)
movl %r13d, 0xc(%rsp)
movq 0xb8(%rbx), %rdi
movq %r12, %rsi
callq 0x16bf19
movq %rbp, %rdi
movq %r14, %rsi
callq 0x11bfb3
movq %rax, %rbp
movq 0xb8(%rbx), %rdi
movl (%r15), %edx
xorl %esi, %esi
movq %r12, %rcx
callq 0x16bf3a
movq 0xb8(%rbx), %rdi
movl $0x1, %esi
movq %rbp, %rdx
movq %r12, %rcx
callq 0x16bf7c
movq %r15, %r13
movq 0xb8(%rbx), %r15
movq 0x20(%rsp), %rdi
movq %rbp, %rsi
movq 0x10(%rsp), %rbp
callq 0x141f50
movl $0x2, %esi
movq %r15, %rdi
movq %r13, %r15
movl 0xc(%rsp), %r13d
movq %rax, %rdx
movq %r12, %rcx
callq 0x16bf7c
movq 0xb8(%rbx), %rdi
movq %r12, %rsi
callq 0x16bfbe
testl %eax, %eax
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmovsl %eax, %r13d
incq %r14
movq %rbp, %rdi
callq 0x11c131
cmpq %rax, %r14
jb 0x124c16
jmp 0x124ccd
xorl %r13d, %r13d
movq %rbp, %rdi
callq 0x11c144
movq 0x170(%rbx), %rdi
callq 0x11c922
movl %r13d, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x3ac8a
callq 0x3ac51