// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/extended/feature_index.c
// Function: gt_feature_index_unit_test
int gt_feature_index_unit_test(GtFeatureIndex *fi, GtError *err)
{
  int had_err = 0, i, rval;
  GtFeatureIndexTestShared sh;
  GtStrArray *seqids;
  GtStr *seqid;
  GtRange check_range;
  GtRegionNode *rn;
  bool has_seqid;
  gt_error_check(err);

  sh.mutex = gt_mutex_new();
  sh.nodes = gt_array_new(sizeof (GtFeatureNode*));
  sh.error_count = 0;
  sh.next_node_idx = 0;
  sh.fi = fi;
  sh.err = gt_error_new();

  /* create region */
  seqid = gt_str_new_cstr(GT_FI_TEST_SEQID);
  rn = (GtRegionNode*) gt_region_node_new(seqid, GT_FI_TEST_START,
                                          GT_FI_TEST_END);

  /* test seqid is not supposed to exist */
  gt_ensure(gt_feature_index_has_seqid(sh.fi, &has_seqid,
                                                 GT_FI_TEST_SEQID, err) == 0);
  gt_ensure(!has_seqid);

  /* add a sequence region directly and check if it has been added */
  rval = gt_feature_index_add_region_node(sh.fi, rn, err);
  gt_ensure(rval == 0);
  gt_genome_node_delete((GtGenomeNode*) rn);
  gt_ensure(gt_feature_index_has_seqid(sh.fi, &has_seqid,
                                                GT_FI_TEST_SEQID, err) == 0);
  gt_ensure(has_seqid);

  gt_feature_index_get_range_for_seqid(sh.fi, &check_range, GT_FI_TEST_SEQID,
                                       err);
  gt_ensure(check_range.start == GT_FI_TEST_START
                    && check_range.end == GT_FI_TEST_END);

  /* set up nodes to store */
  for (i=0;i<GT_FI_TEST_FEATURES_PER_THREAD*gt_jobs;i++) {
    GtUword start, end;
    GtFeatureNode *fn;
    start = random() % (GT_FI_TEST_END - GT_FI_TEST_FEATURE_WIDTH);
    end = start + random() % (GT_FI_TEST_FEATURE_WIDTH);
    fn = gt_feature_node_cast(gt_feature_node_new(seqid, "gene", start, end,
                                                  GT_STRAND_FORWARD));
    gt_array_add(sh.nodes, fn);
  }
  /* test parallel addition */
  gt_multithread(gt_feature_index_unit_test_add, &sh, err);
  seqids = gt_feature_index_get_seqids(fi, err);
  gt_ensure(seqids);
  gt_ensure(gt_feature_index_has_seqid(fi, &has_seqid,GT_FI_TEST_SEQID,
                                                err) == 0);
  gt_ensure(has_seqid);
  gt_ensure(gt_str_array_size(seqids) == 1);

  /* test parallel query */
  if (!had_err)
    gt_multithread(gt_feature_index_unit_test_query, &sh, err);
  gt_ensure(sh.error_count == 0);

  gt_mutex_delete(sh.mutex);
  gt_error_delete(sh.err);
  gt_str_array_delete(seqids);
  gt_array_delete(sh.nodes);
  gt_str_delete(seqid);
  return had_err;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rsi, %rbx
movq %rdi, %r12
testq %rsi, %rsi
je 0x1734a
movq %rbx, %rdi
callq 0xc103
testb %al, %al
jne 0x177ec
callq 0x15f7b
movq %rax, 0x50(%rsp)
pushq $0x8
popq %rdi
callq 0x4b380
movq %rax, 0x28(%rsp)
movq %rax, 0x48(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, 0x58(%rsp)
movq %r12, 0x38(%rsp)
callq 0xbff0
movq %rax, 0x40(%rsp)
movq %rbx, 0x10(%rsp)
leaq 0xb62b7(%rip), %r15     # 0xcd640
movq %r15, %rdi
callq 0x13da9
pushq $0x1
popq %rsi
movl $0x989680, %edx         # imm = 0x989680
movq %rax, 0x20(%rsp)
movq %rax, %rdi
callq 0x26a40
movq %rax, %r13
leaq 0x7(%rsp), %rsi
movq %r12, %rdi
movq %r15, %rdx
movq 0x10(%rsp), %r15
movq %r15, %rcx
callq 0x17240
pushq $-0x1
popq %rbx
testl %eax, %eax
je 0x173ef
leaq 0xb4d8a(%rip), %rsi     # 0xcc159
leaq 0xb6274(%rip), %rdx     # 0xcd64a
leaq 0xb6248(%rip), %rcx     # 0xcd625
leaq 0xb5e41(%rip), %r8      # 0xcd225
movq %r15, %rdi
movl $0x1c5, %r9d            # imm = 0x1C5
jmp 0x17423
xorl %r14d, %r14d
cmpb $0x1, 0x7(%rsp)
movl $0x0, %ebp
jne 0x1742f
leaq 0xb4d54(%rip), %rsi     # 0xcc159
leaq 0xb6288(%rip), %rdx     # 0xcd694
leaq 0xb6212(%rip), %rcx     # 0xcd625
leaq 0xb5e0b(%rip), %r8      # 0xcd225
movq %r15, %rdi
movl $0x1c6, %r9d            # imm = 0x1C6
xorl %eax, %eax
callq 0xc007
movb $0x1, %r14b
movl %ebx, %ebp
movq %r12, %rdi
movq %r13, %rsi
movq %r15, %rdx
callq 0x16a3d
testb %r14b, %r14b
jne 0x17475
testl %eax, %eax
je 0x17475
leaq 0xb4d0c(%rip), %rsi     # 0xcc159
leaq 0xb624b(%rip), %rdx     # 0xcd69f
leaq 0xb61ca(%rip), %rcx     # 0xcd625
leaq 0xb5dc3(%rip), %r8      # 0xcd225
movq %r15, %rdi
movl $0x1ca, %r9d            # imm = 0x1CA
xorl %eax, %eax
callq 0xc007
pushq $-0x1
popq %rbp
movq %r13, %rdi
callq 0x1d1e3
testl %ebp, %ebp
movq %r12, 0x18(%rsp)
jne 0x17542
leaq 0xb61af(%rip), %rdx     # 0xcd640
leaq 0x7(%rsp), %rsi
movq %r12, %rdi
movq %r15, %rcx
callq 0x17240
testl %eax, %eax
je 0x174cc
leaq 0xb4cad(%rip), %rsi     # 0xcc159
leaq 0xb6197(%rip), %rdx     # 0xcd64a
leaq 0xb616b(%rip), %rcx     # 0xcd625
leaq 0xb5d64(%rip), %r8      # 0xcd225
movq %r15, %rdi
movl $0x1cd, %r9d            # imm = 0x1CD
jmp 0x1753b
cmpb $0x0, 0x7(%rsp)
je 0x17516
leaq 0xb6166(%rip), %rdx     # 0xcd640
movq %r15, %rcx
leaq 0x68(%rsp), %r15
movq %r12, %rdi
movq %r15, %rsi
callq 0x1710c
cmpq $0x1, (%r15)
jne 0x1773a
cmpq $0x989680, 0x70(%rsp)   # imm = 0x989680
jne 0x1773a
movl $0x0, 0xc(%rsp)
movb $0x1, %al
movl %eax, 0x8(%rsp)
jmp 0x17567
leaq 0xb4c3c(%rip), %rsi     # 0xcc159
leaq 0xb6171(%rip), %rdx     # 0xcd695
leaq 0xb60fa(%rip), %rcx     # 0xcd625
leaq 0xb5cf3(%rip), %r8      # 0xcd225
movq %r15, %rdi
movl $0x1ce, %r9d            # imm = 0x1CE
xorl %eax, %eax
callq 0xc007
leaq 0xb60f7(%rip), %rdx     # 0xcd640
leaq 0x68(%rsp), %rsi
movq %r12, %rdi
movq %r15, %rcx
callq 0x1710c
movb $0x1, %al
movl %eax, 0xc(%rsp)
movl $0x0, 0x8(%rsp)
xorl %ebx, %ebx
movl $0x7fffffff, %r12d      # imm = 0x7FFFFFFF
leaq 0xde3da(%rip), %r13     # 0xf5950
leaq 0x30(%rsp), %rbp
pushq $0x8
popq %r15
leaq 0x11714e(%rip), %rax    # 0x12e6d4
imull $0x3e8, (%rax), %eax    # imm = 0x3E8
cmpl %eax, %ebx
jae 0x175ee
callq 0x166a8
andl %r12d, %eax
xorl %edx, %edx
movl $0x988eb0, %ecx         # imm = 0x988EB0
divl %ecx
movl %edx, %r14d
callq 0x166a8
andl %r12d, %eax
xorl %edx, %edx
movl $0x7d0, %ecx            # imm = 0x7D0
divl %ecx
movl %r14d, %ecx
addl %edx, %ecx
movq 0x20(%rsp), %rdi
movq %r13, %rsi
movq %r14, %rdx
xorl %r8d, %r8d
callq 0x18cbb
movq %rax, %rdi
callq 0x18df7
movq %rax, 0x30(%rsp)
movq 0x28(%rsp), %rdi
movq %rbp, %rsi
movq %r15, %rdx
callq 0x4b801
incl %ebx
jmp 0x1757f
leaq 0x22f(%rip), %rdi       # 0x17824
leaq 0x38(%rsp), %rsi
movq 0x10(%rsp), %rbx
movq %rbx, %rdx
callq 0xdba8
movq 0x18(%rsp), %rdi
movq %rbx, %rsi
callq 0x1708b
movq %rax, %r12
testq %rax, %rax
setne %al
movl 0xc(%rsp), %ecx
orb %al, %cl
je 0x1767a
pushq $-0x1
popq %rbp
cmpb $0x0, 0x8(%rsp)
je 0x177a7
leaq 0xb6006(%rip), %rdx     # 0xcd640
leaq 0x7(%rsp), %rsi
movq 0x18(%rsp), %rdi
movq %rbx, %rcx
callq 0x17240
testl %eax, %eax
je 0x176ae
leaq 0xb4b02(%rip), %rsi     # 0xcc159
leaq 0xb6096(%rip), %rdx     # 0xcd6f4
leaq 0xb5fc0(%rip), %rcx     # 0xcd625
leaq 0xb5bb9(%rip), %r8      # 0xcd225
movq %rbx, %rdi
movl $0x1e4, %r9d            # imm = 0x1E4
jmp 0x177a0
leaq 0xb4ad8(%rip), %rsi     # 0xcc159
leaq 0xc3848(%rip), %rdx     # 0xdaed0
leaq 0xb5f96(%rip), %rcx     # 0xcd625
leaq 0xb5b8f(%rip), %r8      # 0xcd225
movq %rbx, %rdi
movl $0x1e2, %r9d            # imm = 0x1E2
xorl %eax, %eax
callq 0xc007
pushq $-0x1
popq %rbp
jmp 0x177a7
cmpb $0x0, 0x7(%rsp)
je 0x17713
movq %r12, %rdi
callq 0x157f4
cmpq $0x1, %rax
jne 0x1777b
leaq 0x20f(%rip), %rdi       # 0x178dd
leaq 0x38(%rsp), %r14
movq %r14, %rsi
movq %rbx, %rdx
callq 0xdba8
cmpq $0x0, 0x28(%r14)
je 0x177e8
leaq 0xb4a69(%rip), %rsi     # 0xcc159
leaq 0xb6062(%rip), %rdx     # 0xcd759
leaq 0xb5f27(%rip), %rcx     # 0xcd625
leaq 0xb5b20(%rip), %r8      # 0xcd225
movq %rbx, %rdi
movl $0x1eb, %r9d            # imm = 0x1EB
jmp 0x177a0
leaq 0xb4a3f(%rip), %rsi     # 0xcc159
leaq 0xb5f74(%rip), %rdx     # 0xcd695
leaq 0xb5efd(%rip), %rcx     # 0xcd625
leaq 0xb5af6(%rip), %r8      # 0xcd225
movq %rbx, %rdi
movl $0x1e5, %r9d            # imm = 0x1E5
jmp 0x177a0
leaq 0xb4a18(%rip), %rsi     # 0xcc159
leaq 0xb5f61(%rip), %rdx     # 0xcd6a9
leaq 0xb5ed6(%rip), %rcx     # 0xcd625
leaq 0xb5acf(%rip), %r8      # 0xcd225
movl $0x0, 0x8(%rsp)
movq 0x10(%rsp), %rdi
movl $0x1d3, %r9d            # imm = 0x1D3
xorl %eax, %eax
callq 0xc007
movb $0x1, %al
movl %eax, 0xc(%rsp)
jmp 0x17567
leaq 0xb49d7(%rip), %rsi     # 0xcc159
leaq 0xb5fb1(%rip), %rdx     # 0xcd73a
leaq 0xb5e95(%rip), %rcx     # 0xcd625
leaq 0xb5a8e(%rip), %r8      # 0xcd225
movq %rbx, %rdi
movl $0x1e6, %r9d            # imm = 0x1E6
xorl %eax, %eax
callq 0xc007
movq 0x50(%rsp), %rdi
callq 0x15fd3
movq 0x40(%rsp), %rdi
callq 0xc291
movq %r12, %rdi
callq 0x1583a
movq 0x48(%rsp), %rdi
callq 0x4c19d
movq 0x20(%rsp), %rdi
callq 0x152db
movl %ebp, %eax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %ebp, %ebp
jmp 0x177a7
movq 0x1167c5(%rip), %rax    # 0x12dfb8
movq (%rax), %rdi
leaq 0xb2869(%rip), %rsi     # 0xca066
leaq 0xb2e55(%rip), %rdx     # 0xca659
leaq 0xb5e1a(%rip), %rcx     # 0xcd625
leaq 0xb5a13(%rip), %r8      # 0xcd225
movl $0x1b5, %r9d            # imm = 0x1B5
xorl %eax, %eax
callq 0xb8c0
callq 0xb300