// File: /workspace/github_c_makefile_star2_O2/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 $0x28, %rsp
movq %rcx, %r14
movq %rdx, %r15
movq %rsi, %r12
movq %rdi, %rbx
movq 0x50(%rdi), %rdi
movq %rdx, %rsi
callq 0xb9ac3
testq %rax, %rax
je 0xb955e
movq (%rax), %rax
movq %rax, (%r12)
xorl %r13d, %r13d
jmp 0xb98fb
movq %r12, 0x20(%rsp)
movq %r14, 0x8(%rsp)
movq 0x170(%rbx), %rdi
callq 0xaf370
movq %r15, %rdi
callq 0xda769
movl $0x80000000, %ecx       # imm = 0x80000000
testb %al, %al
jne 0xb95af
movq 0x60(%rbx), %r14
movq 0x68(%rbx), %r12
movq %r15, %rdi
callq 0xda338
leaq 0x24978a(%rip), %r8     # 0x302d26
movq %rbx, %rdi
movq %r14, %rsi
movq %r12, %rdx
movq %rax, %rcx
callq 0xb9adf
movl %eax, %ecx
movl %ecx, 0x14(%rsp)
movq 0x70(%rbx), %r14
movq 0x78(%rbx), %r12
movq %r15, %rdi
callq 0xda5c1
leaq 0x27b919(%rip), %r8     # 0x334ee3
movq %rbx, %rdi
movq %r14, %rsi
movq %r12, %rdx
movq %rax, %rcx
callq 0xb9adf
movl %eax, %r14d
movq 0x88(%rbx), %r12
movq 0x98(%rbx), %r13
movq %r15, %rdi
callq 0xdd14a
movq %rax, %rdi
callq 0xad1fa
leaq 0x25d8dc(%rip), %r8     # 0x316edf
movq %rbx, %rdi
movq %r12, %rsi
movq %r13, %rdx
movq %rax, %rcx
callq 0xb9adf
movl %eax, %ebp
movq %r15, %rdi
callq 0xdd1f4
movq %rax, %r13
movq %r15, 0x18(%rsp)
movq %rdx, %r15
movq 0xa0(%rbx), %rdi
movq 0x8(%rsp), %r12
movq %r12, %rsi
callq 0x10d4e4
movq 0xa0(%rbx), %rdi
xorl %esi, %esi
movl %ebp, %edx
movq %r12, %rcx
callq 0x10d538
movq 0xa0(%rbx), %rdi
pushq $0x1
popq %rsi
movl %r14d, %edx
movq %r12, %rcx
callq 0x10d538
movq 0xa0(%rbx), %rdi
pushq $0x2
popq %rsi
movl 0x14(%rsp), %edx
movq %r12, %rcx
callq 0x10d538
movq 0xa0(%rbx), %rdi
pushq $0x3
popq %rsi
movq %r13, %rdx
movq %r12, %rcx
callq 0x10d58c
movq 0xa0(%rbx), %rdi
pushq $0x4
popq %rsi
movq %r15, %rdx
movq 0x18(%rsp), %r15
movq %r12, %rcx
callq 0x10d58c
movq 0xa0(%rbx), %r14
movq %r15, %rdi
callq 0xda3de
testb %al, %al
je 0xb96cb
movq %r15, %rdi
callq 0xdaa3e
cvtss2sd %xmm0, %xmm0
jmp 0xb96d3
movsd 0x22e63d(%rip), %xmm0   # 0x2e7d10
pushq $0x5
popq %rsi
movq %r14, %rdi
movq %r12, %rdx
callq 0x10d634
movq 0xa0(%rbx), %r14
movq %r15, %rdi
callq 0xd9d99
pushq $0x6
popq %rsi
movq %r14, %rdi
movl %eax, %edx
movq %r12, %rcx
callq 0x10d538
movq 0xa0(%rbx), %r14
movq %r15, %rdi
callq 0xdaba0
pushq $0x7
popq %rsi
movq %r14, %rdi
movl %eax, %edx
movq %r12, %rcx
callq 0x10d538
movq %r15, %rdi
callq 0xda6e7
testb %al, %al
je 0xb975b
movq %r15, %rdi
callq 0xda99f
pushq $0x1
popq %rbp
cmpq %r15, %rax
movl $0x0, %r14d
je 0xb9760
movq 0x50(%rbx), %rdi
movq %rax, %rsi
callq 0xb9ac3
testq %rax, %rax
je 0xb993b
movl (%rax), %r14d
jmp 0xb9760
xorl %ebp, %ebp
xorl %r14d, %r14d
movq 0xa0(%rbx), %rdi
pushq $0x8
popq %rsi
movl %ebp, %edx
movq %r12, %rcx
callq 0x10d538
movq 0xa0(%rbx), %rdi
pushq $0x9
popq %rsi
movl %r14d, %edx
movq %r12, %rcx
callq 0x10d538
movq 0xa0(%rbx), %r14
movq %r15, %rdi
callq 0xda769
movzbl %al, %edx
pushq $0xa
popq %rsi
movq %r14, %rdi
movq %r12, %rcx
callq 0x10d538
movq 0xa0(%rbx), %r14
movq %r15, %rdi
callq 0xdc083
movzbl %al, %edx
pushq $0xb
popq %rsi
movq %r14, %rdi
movq %r12, %rcx
callq 0x10d538
movq 0xa0(%rbx), %rdi
movq %r12, %rsi
callq 0x10d688
testq %r12, %r12
je 0xb97f1
testl %eax, %eax
jns 0xb97f1
movq %r12, %rdi
callq 0x89eb7
testb %al, %al
jne 0xb990d
movq 0x168(%rbx), %rdi
leaq 0x22c7c5(%rip), %rsi    # 0x2e5fc4
movq %r12, %rdx
callq 0x10d2e5
movq 0x20(%rsp), %r14
movq %rax, (%r14)
movq 0x50(%rbx), %rdi
movq %r15, %rsi
movq %rax, %rdx
callq 0xb9ca4
movq 0x58(%rbx), %rdi
movq (%r14), %rsi
movq %r15, %rdx
callq 0xb9cd8
movq %r15, %rdi
callq 0xd9638
movq %rax, %rbp
xorl %r13d, %r13d
xorl %r14d, %r14d
movq %rbp, %rdi
callq 0xae61c
cmpq %rax, %r14
jae 0xb98e7
movq 0xb8(%rbx), %rdi
movq %r12, %rsi
callq 0x10d4e4
movq %rbp, %rdi
movq %r14, %rsi
callq 0xae386
movq %rax, %r12
movq 0xb8(%rbx), %rdi
movq 0x20(%rsp), %rax
movl (%rax), %edx
xorl %esi, %esi
movq 0x8(%rsp), %rcx
callq 0x10d538
movq 0xb8(%rbx), %rdi
pushq $0x1
popq %rsi
movq %r12, %rdx
movq 0x8(%rsp), %rcx
callq 0x10d5e0
movq 0xb8(%rbx), %r15
movq 0x18(%rsp), %rdi
movq %r12, %rsi
movq 0x8(%rsp), %r12
callq 0xd9628
movq %r15, %rdi
pushq $0x2
popq %rsi
movq %rax, %rdx
movq %r12, %rcx
callq 0x10d5e0
movq 0xb8(%rbx), %rdi
movq %r12, %rsi
callq 0x10d688
testl %eax, %eax
pushq $-0x1
popq %rax
cmovsl %eax, %r13d
incq %r14
jmp 0xb983e
movq %rbp, %rdi
callq 0xae662
movq 0x170(%rbx), %rdi
callq 0xaf3e7
movl %r13d, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x37e654(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x22b6f5(%rip), %rsi    # 0x2e5013
leaq 0x22b89a(%rip), %rdx    # 0x2e51bf
leaq 0x25cd53(%rip), %rcx    # 0x31667f
leaq 0x25bbe3(%rip), %r8     # 0x315516
movl $0x35f, %r9d            # imm = 0x35F
jmp 0xb9967
movq 0x37e626(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x22b6c7(%rip), %rsi    # 0x2e5013
leaq 0x25cd1f(%rip), %rdx    # 0x316672
leaq 0x25cd25(%rip), %rcx    # 0x31667f
leaq 0x25bbb5(%rip), %r8     # 0x315516
movl $0x353, %r9d            # imm = 0x353
xorl %eax, %eax
callq 0x17a50
callq 0x17390