// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x128, %rsp            # imm = 0x128
movq %rdi, 0x118(%rsp)
movq %rsi, 0x110(%rsp)
movq %rdx, 0x108(%rsp)
movq %rcx, 0x100(%rsp)
movl $0x80000000, 0xd4(%rsp) # imm = 0x80000000
movl $0x80000000, 0xd0(%rsp) # imm = 0x80000000
movl $0x80000000, 0xcc(%rsp) # imm = 0x80000000
movl $0x0, 0xc8(%rsp)
movl $0x0, 0xc4(%rsp)
movl $0x0, 0xc0(%rsp)
movl $0x0, 0xbc(%rsp)
movq 0x118(%rsp), %rax
movq 0x50(%rax), %rdi
movq 0x108(%rsp), %rsi
callq 0x131830
movq %rax, 0xd8(%rsp)
cmpq $0x0, 0xd8(%rsp)
je 0x130e59
movq 0xd8(%rsp), %rax
movq (%rax), %rcx
movq 0x110(%rsp), %rax
movq %rcx, (%rax)
movl 0xc4(%rsp), %eax
movl %eax, 0x124(%rsp)
jmp 0x1315fe
movq 0x118(%rsp), %rax
movq 0x170(%rax), %rdi
callq 0x1211d0
movq 0x108(%rsp), %rdi
callq 0x16dae0
testb $0x1, %al
jne 0x130ef0
movq 0x118(%rsp), %rax
movq %rax, 0x78(%rsp)
movq 0x118(%rsp), %rax
movq 0x60(%rax), %rax
movq %rax, 0x80(%rsp)
movq 0x118(%rsp), %rax
movq 0x68(%rax), %rax
movq %rax, 0x88(%rsp)
movq 0x108(%rsp), %rdi
callq 0x16d430
movq 0x78(%rsp), %rdi
movq 0x80(%rsp), %rsi
movq 0x88(%rsp), %rdx
movq %rax, %rcx
leaq 0x403167(%rip), %r8     # 0x534046
xorl %eax, %eax
movl %eax, %r9d
callq 0x131880
movl %eax, 0xd4(%rsp)
movq 0x118(%rsp), %rax
movq %rax, 0x40(%rsp)
movq 0x118(%rsp), %rax
movq 0x70(%rax), %rax
movq %rax, 0x48(%rsp)
movq 0x118(%rsp), %rax
movq 0x78(%rax), %rax
movq %rax, 0x50(%rsp)
movq 0x108(%rsp), %rdi
callq 0x16d800
movq 0x40(%rsp), %rdi
movq 0x48(%rsp), %rsi
movq 0x50(%rsp), %rdx
movq %rax, %rcx
leaq 0x4365b4(%rip), %r8     # 0x5674f9
xorl %eax, %eax
movl %eax, %r9d
callq 0x131880
movl %eax, 0xd0(%rsp)
movq 0x118(%rsp), %rax
movq %rax, 0x58(%rsp)
movq 0x118(%rsp), %rax
movq 0x88(%rax), %rax
movq %rax, 0x60(%rsp)
movq 0x118(%rsp), %rax
movq 0x98(%rax), %rax
movq %rax, 0x68(%rsp)
movq 0x108(%rsp), %rdi
callq 0x171b70
movq %rax, %rdi
callq 0x11dee0
movq 0x58(%rsp), %rdi
movq 0x60(%rsp), %rsi
movq 0x68(%rsp), %rdx
movq %rax, %rcx
leaq 0x417ebb(%rip), %r8     # 0x548e74
xorl %eax, %eax
movl %eax, %r9d
callq 0x131880
movl %eax, 0xcc(%rsp)
movq 0x108(%rsp), %rdi
callq 0x171cc0
movq %rax, 0xa8(%rsp)
movq %rdx, 0xb0(%rsp)
movq 0xa8(%rsp), %rax
movq %rax, 0xf0(%rsp)
movq 0xb0(%rsp), %rax
movq %rax, 0xf8(%rsp)
movq 0x118(%rsp), %rax
movq 0xa0(%rax), %rdi
movq 0x100(%rsp), %rsi
callq 0x1c42f0
movq 0x118(%rsp), %rax
movq 0xa0(%rax), %rdi
movl 0xcc(%rsp), %edx
movq 0x100(%rsp), %rcx
xorl %eax, %eax
movl %eax, %esi
callq 0x1c4390
movq 0x118(%rsp), %rax
movq 0xa0(%rax), %rdi
movl 0xd0(%rsp), %edx
movq 0x100(%rsp), %rcx
movl $0x1, %esi
callq 0x1c4390
movq 0x118(%rsp), %rax
movq 0xa0(%rax), %rdi
movl 0xd4(%rsp), %edx
movq 0x100(%rsp), %rcx
movl $0x2, %esi
callq 0x1c4390
movq 0x118(%rsp), %rax
movq 0xa0(%rax), %rdi
movq 0xf0(%rsp), %rdx
movq 0x100(%rsp), %rcx
movl $0x3, %esi
callq 0x1c4440
movq 0x118(%rsp), %rax
movq 0xa0(%rax), %rdi
movq 0xf8(%rsp), %rdx
movq 0x100(%rsp), %rcx
movl $0x4, %esi
callq 0x1c4440
movq 0x118(%rsp), %rax
movq 0xa0(%rax), %rax
movq %rax, 0x70(%rsp)
movq 0x108(%rsp), %rdi
callq 0x16d510
testb $0x1, %al
jne 0x131113
jmp 0x13112c
movq 0x108(%rsp), %rdi
callq 0x16df90
cvtss2sd %xmm0, %xmm0
movsd %xmm0, 0x38(%rsp)
jmp 0x13113c
movsd 0x3e7c1c(%rip), %xmm0   # 0x518d50
movsd %xmm0, 0x38(%rsp)
jmp 0x13113c
movq 0x70(%rsp), %rdi
movsd 0x38(%rsp), %xmm0
movq 0x100(%rsp), %rdx
movl $0x5, %esi
callq 0x1c45a0
movq 0x118(%rsp), %rax
movq 0xa0(%rax), %rax
movq %rax, 0x28(%rsp)
movq 0x108(%rsp), %rdi
callq 0x16cc70
movq 0x28(%rsp), %rdi
movl %eax, %edx
movq 0x100(%rsp), %rcx
movl $0x6, %esi
callq 0x1c4390
movq 0x118(%rsp), %rax
movq 0xa0(%rax), %rax
movq %rax, 0x30(%rsp)
movq 0x108(%rsp), %rdi
callq 0x16e1c0
movq 0x30(%rsp), %rdi
movl %eax, %edx
movq 0x100(%rsp), %rcx
movl $0x7, %esi
callq 0x1c4390
movq 0x108(%rsp), %rdi
callq 0x16da10
testb $0x1, %al
jne 0x1311e3
jmp 0x131287
movl $0x1, 0xc0(%rsp)
movq 0x108(%rsp), %rdi
callq 0x16dea0
movq %rax, 0xa0(%rsp)
cmpq 0x108(%rsp), %rax
je 0x131285
movq 0x118(%rsp), %rax
movq 0x50(%rax), %rdi
movq 0xa0(%rsp), %rsi
callq 0x131830
movq %rax, 0x98(%rsp)
cmpq $0x0, 0x98(%rsp)
jne 0x131271
movq 0x50ad60(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x3e4dc9(%rip), %rsi    # 0x516013
leaq 0x4173a4(%rip), %rdx    # 0x5485f5
leaq 0x4173aa(%rip), %rcx    # 0x548602
leaq 0x4161ef(%rip), %r8     # 0x54744e
movl $0x353, %r9d            # imm = 0x353
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x131273
movq 0x98(%rsp), %rax
movq (%rax), %rax
movl %eax, 0xbc(%rsp)
jmp 0x131292
movl $0x0, 0xc0(%rsp)
movq 0x118(%rsp), %rax
movq 0xa0(%rax), %rdi
movl 0xc0(%rsp), %edx
movq 0x100(%rsp), %rcx
movl $0x8, %esi
callq 0x1c4390
movq 0x118(%rsp), %rax
movq 0xa0(%rax), %rdi
movl 0xbc(%rsp), %edx
movq 0x100(%rsp), %rcx
movl $0x9, %esi
callq 0x1c4390
movq 0x118(%rsp), %rax
movq 0xa0(%rax), %rax
movq %rax, 0x18(%rsp)
movq 0x108(%rsp), %rdi
callq 0x16dae0
movq 0x18(%rsp), %rdi
andb $0x1, %al
movzbl %al, %edx
movq 0x100(%rsp), %rcx
movl $0xa, %esi
callq 0x1c4390
movq 0x118(%rsp), %rax
movq 0xa0(%rax), %rax
movq %rax, 0x20(%rsp)
movq 0x108(%rsp), %rdi
callq 0x1700e0
movq 0x20(%rsp), %rdi
andb $0x1, %al
movzbl %al, %edx
movq 0x100(%rsp), %rcx
movl $0xb, %esi
callq 0x1c4390
movq 0x118(%rsp), %rax
movq 0xa0(%rax), %rdi
movq 0x100(%rsp), %rsi
callq 0x1c4650
movl %eax, 0xc8(%rsp)
cmpl $0x0, 0xc8(%rsp)
jge 0x1313e5
jmp 0x13138b
cmpq $0x0, 0x100(%rsp)
je 0x1313e1
movq 0x100(%rsp), %rdi
callq 0xd8a60
testb $0x1, %al
jne 0x1313a9
jmp 0x1313e1
movq 0x50abf0(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x3e4c59(%rip), %rsi    # 0x516013
leaq 0x3e4dfe(%rip), %rdx    # 0x5161bf
leaq 0x41723a(%rip), %rcx    # 0x548602
leaq 0x41607f(%rip), %r8     # 0x54744e
movl $0x35f, %r9d            # imm = 0x35F
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x1313e3
jmp 0x1313e5
movq 0x118(%rsp), %rax
movq 0x168(%rax), %rdi
movq 0x100(%rsp), %rdx
leaq 0x3e5bda(%rip), %rsi    # 0x516fdd
callq 0x1c3f40
movq %rax, %rcx
movq 0x110(%rsp), %rax
movq %rcx, (%rax)
movq 0x118(%rsp), %rax
movq 0x50(%rax), %rdi
movq 0x108(%rsp), %rsi
movq 0x110(%rsp), %rax
movq (%rax), %rdx
callq 0x131b10
movq 0x118(%rsp), %rax
movq 0x58(%rax), %rdi
movq 0x110(%rsp), %rax
movq (%rax), %rsi
movq 0x108(%rsp), %rdx
callq 0x131b70
movq 0x108(%rsp), %rdi
callq 0x16c090
movq %rax, 0xe8(%rsp)
movq $0x0, 0xe0(%rsp)
movq 0xe0(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0xe8(%rsp), %rdi
callq 0x11fcc0
movq %rax, %rcx
movq 0x10(%rsp), %rax
cmpq %rcx, %rax
jae 0x1315cf
movq 0x118(%rsp), %rax
movq 0xb8(%rax), %rdi
movq 0x100(%rsp), %rsi
callq 0x1c42f0
movq 0xe8(%rsp), %rdi
movq 0xe0(%rsp), %rsi
callq 0x11f8c0
movq %rax, 0x90(%rsp)
movq 0x118(%rsp), %rax
movq 0xb8(%rax), %rdi
movq 0x110(%rsp), %rax
movq (%rax), %rax
movl %eax, %edx
movq 0x100(%rsp), %rcx
xorl %eax, %eax
movl %eax, %esi
callq 0x1c4390
movq 0x118(%rsp), %rax
movq 0xb8(%rax), %rdi
movq 0x90(%rsp), %rdx
movq 0x100(%rsp), %rcx
movl $0x1, %esi
callq 0x1c44f0
movq 0x118(%rsp), %rax
movq 0xb8(%rax), %rax
movq %rax, 0x8(%rsp)
movq 0x108(%rsp), %rdi
movq 0x90(%rsp), %rsi
callq 0x16c040
movq 0x8(%rsp), %rdi
movq %rax, %rdx
movq 0x100(%rsp), %rcx
movl $0x2, %esi
callq 0x1c44f0
movq 0x118(%rsp), %rax
movq 0xb8(%rax), %rdi
movq 0x100(%rsp), %rsi
callq 0x1c4650
movl %eax, 0xc8(%rsp)
cmpl $0x0, 0xc8(%rsp)
jge 0x1315b4
movl $0xffffffff, 0xc4(%rsp) # imm = 0xFFFFFFFF
jmp 0x1315b6
movq 0xe0(%rsp), %rax
addq $0x1, %rax
movq %rax, 0xe0(%rsp)
jmp 0x13147f
movq 0xe8(%rsp), %rdi
callq 0x11fd20
movq 0x118(%rsp), %rax
movq 0x170(%rax), %rdi
callq 0x121270
movl 0xc4(%rsp), %eax
movl %eax, 0x124(%rsp)
movl 0x124(%rsp), %eax
addq $0x128, %rsp            # imm = 0x128
retq
nopl (%rax)