// File: /workspace/github_c_makefile_star2_O1/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 0x10620e
testq %rax, %rax
je 0x12a73b
movq 0x8(%rax), %rax
movq %rax, (%r15)
xorl %r13d, %r13d
jmp 0x12ab43
movq 0x170(%rbx), %rdi
callq 0x122657
movq %rbp, %rdi
callq 0x149d95
movl $0x80000000, %ecx       # imm = 0x80000000
testb %al, %al
jne 0x12a782
movq 0x60(%rbx), %r14
movq 0x68(%rbx), %r13
movq %rbp, %rdi
callq 0x149bb2
leaq 0x241797(%rip), %r8     # 0x36bf06
movq %rbx, %rdi
movq %r14, %rsi
movq %r13, %rdx
movq %rax, %rcx
callq 0x12ac8f
movl %eax, %ecx
movl %ecx, 0xc(%rsp)
movq 0x70(%rbx), %r14
movq 0x78(%rbx), %r13
movq %rbp, %rdi
callq 0x149ce1
leaq 0x27387e(%rip), %r8     # 0x39e01b
movq %rbx, %rdi
movq %r14, %rsi
movq %r13, %rdx
movq %rax, %rcx
callq 0x12ac8f
movl %eax, 0x10(%rsp)
movq 0x88(%rbx), %r13
movq %rbp, %r14
movq 0x98(%rbx), %rbp
movq %r14, %rdi
movq %r14, 0x20(%rsp)
callq 0x14b89b
movq %rax, %rdi
callq 0x120d23
leaq 0x255682(%rip), %r8     # 0x37fe61
movq %rbx, %rdi
movq %r13, %rsi
movq %rbp, %rdx
movq %rax, %rcx
callq 0x12ac8f
movl %eax, %r13d
movq %r14, %rdi
callq 0x14b8df
movq %rax, %rbp
movq %rdx, %r14
movq 0xa0(%rbx), %rdi
movq %r12, %rsi
callq 0x174129
movq 0xa0(%rbx), %rdi
xorl %esi, %esi
movl %r13d, %edx
movq %r12, %rcx
callq 0x17414a
movq 0xa0(%rbx), %rdi
movl $0x1, %esi
movl 0x10(%rsp), %edx
movq %r12, %rcx
callq 0x17414a
movq 0xa0(%rbx), %rdi
movl $0x2, %esi
movl 0xc(%rsp), %edx
movq %r12, %rcx
callq 0x17414a
movq 0xa0(%rbx), %rdi
movl $0x3, %esi
movq %rbp, %rdx
movq %r12, %rcx
callq 0x17416b
movq 0xa0(%rbx), %rdi
movl $0x4, %esi
movq %r14, %rdx
movq %r12, %rcx
callq 0x17416b
movq 0xa0(%rbx), %r14
movq 0x20(%rsp), %r13
movq %r13, %rdi
callq 0x149bf5
testb %al, %al
je 0x12a8a8
movq %r13, %rdi
callq 0x149ef0
cvtss2sd %xmm0, %xmm0
jmp 0x12a8b0
movsd 0x226460(%rip), %xmm0   # 0x350d10
movl $0x5, %esi
movq %r14, %rdi
movq %r12, %rdx
callq 0x1741ad
movq 0xa0(%rbx), %r14
movq %r13, %rdi
callq 0x14970e
movl $0x6, %esi
movq %r14, %rdi
movl %eax, %edx
movq %r12, %rcx
callq 0x17414a
movq 0xa0(%rbx), %r14
movq %r13, %rdi
callq 0x149f67
movl $0x7, %esi
movq %r14, %rdi
movl %eax, %edx
movq %r12, %rcx
callq 0x17414a
movq %r13, %rdi
callq 0x149d6e
testb %al, %al
je 0x12a946
movq %r13, %rdi
callq 0x149ead
movl $0x1, %ebp
cmpq %r13, %rax
movl $0x0, %r14d
je 0x12a94b
movq 0x50(%rbx), %rdi
leaq 0x28(%rsp), %rsi
movq %rax, (%rsi)
callq 0x10620e
testq %rax, %rax
je 0x12ab5a
movl 0x8(%rax), %r14d
jmp 0x12a94b
xorl %ebp, %ebp
xorl %r14d, %r14d
movq 0xa0(%rbx), %rdi
movl $0x8, %esi
movl %ebp, %edx
movq %r12, %rcx
callq 0x17414a
movq 0xa0(%rbx), %rdi
movl $0x9, %esi
movl %r14d, %edx
movq %r12, %rcx
callq 0x17414a
movq 0xa0(%rbx), %r14
movq %r13, %rdi
callq 0x149d95
movzbl %al, %edx
movl $0xa, %esi
movq %r14, %rdi
movq %r12, %rcx
callq 0x17414a
movq 0xa0(%rbx), %r14
movq %r13, %rdi
callq 0x14ad97
movzbl %al, %edx
movl $0xb, %esi
movq %r14, %rdi
movq %r12, %rcx
callq 0x17414a
movq 0xa0(%rbx), %rdi
movq %r12, %rsi
callq 0x1741ce
testq %r12, %r12
je 0x12a9e4
testl %eax, %eax
jns 0x12a9e4
movq %r12, %rdi
callq 0x101a9a
testb %al, %al
jne 0x12ab55
movq 0x168(%rbx), %rdi
leaq 0x2245d2(%rip), %rsi    # 0x34efc4
movq %r12, %rdx
callq 0x174056
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 0x106536
testl %eax, %eax
jne 0x12aa27
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 0x106536
testl %eax, %eax
jne 0x12aa51
movq 0x18(%rsp), %rax
movq %r13, 0x8(%rax)
movq %r13, %rdi
callq 0x14919c
movq %rax, %rbp
movq %rax, %rdi
callq 0x121e78
testq %rax, %rax
je 0x12ab2c
xorl %r14d, %r14d
xorl %r13d, %r13d
movq %rbp, 0x10(%rsp)
movl %r13d, 0xc(%rsp)
movq 0xb8(%rbx), %rdi
movq %r12, %rsi
callq 0x174129
movq %rbp, %rdi
movq %r14, %rsi
callq 0x121cfa
movq %rax, %rbp
movq 0xb8(%rbx), %rdi
movl (%r15), %edx
xorl %esi, %esi
movq %r12, %rcx
callq 0x17414a
movq 0xb8(%rbx), %rdi
movl $0x1, %esi
movq %rbp, %rdx
movq %r12, %rcx
callq 0x17418c
movq %r15, %r13
movq 0xb8(%rbx), %r15
movq 0x20(%rsp), %rdi
movq %rbp, %rsi
movq 0x10(%rsp), %rbp
callq 0x14918c
movl $0x2, %esi
movq %r15, %rdi
movq %r13, %r15
movl 0xc(%rsp), %r13d
movq %rax, %rdx
movq %r12, %rcx
callq 0x17418c
movq 0xb8(%rbx), %rdi
movq %r12, %rsi
callq 0x1741ce
testl %eax, %eax
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmovsl %eax, %r13d
incq %r14
movq %rbp, %rdi
callq 0x121e78
cmpq %rax, %r14
jb 0x12aa78
jmp 0x12ab2f
xorl %r13d, %r13d
movq %rbp, %rdi
callq 0x121e8b
movq 0x170(%rbx), %rdi
callq 0x122672
movl %r13d, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x3b698
callq 0x3b65f