// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/ltr/ltrdigest_pbs_visitor.c
// Function: pbs_attach_results_to_gff3
static void pbs_attach_results_to_gff3(GtLTRdigestPBSVisitor *lv,
                                       GtPBSResults *results,
                                       GtFeatureNode *mainnode,
                                       GtStrand *canonical_strand)
{
  GtRange pbs_range;
  GtUword i = 0;
  GtGenomeNode *gf;
  char buffer[BUFSIZ];
  GtPBSHit* hit = gt_pbs_results_get_ranked_hit(results, i++);

  gt_log_log("attaching to %p: canonical %c this is %c", mainnode,
           GT_STRAND_CHARS[*canonical_strand], GT_STRAND_CHARS[hit->strand]);
  if (*canonical_strand == GT_STRAND_UNKNOWN)
    *canonical_strand = hit->strand;
  else {
    /* find best-scoring PBS on the given canonical strand */
    while (hit->strand != *canonical_strand
             && i < gt_pbs_results_get_number_of_hits(results)) {
      const char *msg = gt_feature_node_get_attribute(mainnode, "ID");
      gt_log_log("dropping PBS because of nonconsistent strand: %s\n",
                 msg == NULL ? "undefined" : msg);
      hit = gt_pbs_results_get_ranked_hit(results, i++);
    }
    /* if there is none, do not report a PBS */
    if (hit->strand != *canonical_strand)
      return;
  }
  gt_log_log("final strand %c", GT_STRAND_CHARS[hit->strand]);
  pbs_range = gt_pbs_hit_get_coords(lv, hit);
  pbs_range.start++; pbs_range.end++;  /* GFF3 is 1-based */
  gf = gt_feature_node_new(gt_genome_node_get_seqid((GtGenomeNode*) mainnode),
                           gt_ft_primer_binding_site,
                           pbs_range.start,
                           pbs_range.end,
                           hit->strand);
  gt_feature_node_set_source((GtFeatureNode*) gf, lv->tag);
  gt_feature_node_set_score((GtFeatureNode*) gf,
                            (float) gt_pbs_hit_get_score(hit));
  if (gt_pbs_hit_get_trna(hit) != NULL) {
    gt_feature_node_add_attribute((GtFeatureNode*) gf, "trna",
                                   gt_pbs_hit_get_trna(hit));
  }
  gt_feature_node_set_strand(mainnode, gt_pbs_hit_get_strand(hit));
  (void) snprintf(buffer, BUFSIZ-1, ""GT_WU"", gt_pbs_hit_get_tstart(hit));
  gt_feature_node_add_attribute((GtFeatureNode*) gf, "trnaoffset", buffer);
  (void) snprintf(buffer, BUFSIZ-1, ""GT_WU"", gt_pbs_hit_get_offset(hit));
  gt_feature_node_add_attribute((GtFeatureNode*) gf, "pbsoffset", buffer);
  (void) snprintf(buffer, BUFSIZ-1, ""GT_WU"", gt_pbs_hit_get_edist(hit));
  gt_feature_node_add_attribute((GtFeatureNode*) gf, "edist", buffer);

  gt_feature_node_add_child(mainnode, (GtFeatureNode*) gf);
}

// Assembly:
subq $0x20b8, %rsp           # imm = 0x20B8
movq %rdi, 0x20b0(%rsp)
movq %rsi, 0x20a8(%rsp)
movq %rdx, 0x20a0(%rsp)
movq %rcx, 0x2098(%rsp)
movq $0x0, 0x2080(%rsp)
movq 0x20a8(%rsp), %rdi
movq 0x2080(%rsp), %rsi
movq %rsi, %rax
addq $0x1, %rax
movq %rax, 0x2080(%rsp)
callq 0x3072d0
movq %rax, 0x68(%rsp)
movq 0x20a0(%rsp), %rsi
movq 0x2098(%rsp), %rax
movl (%rax), %eax
movl %eax, %ecx
leaq 0x239045(%rip), %rax    # 0x53f73c
movsbl (%rax,%rcx), %edx
movq 0x68(%rsp), %rax
movl 0x30(%rax), %eax
movl %eax, %ecx
leaq 0x239030(%rip), %rax    # 0x53f73c
movsbl (%rax,%rcx), %ecx
leaq 0x28cc4e(%rip), %rdi    # 0x593365
movb $0x0, %al
callq 0xe7740
movq 0x2098(%rsp), %rax
cmpl $0x3, (%rax)
jne 0x306742
movq 0x68(%rsp), %rax
movl 0x30(%rax), %ecx
movq 0x2098(%rsp), %rax
movl %ecx, (%rax)
jmp 0x306829
jmp 0x306744
movq 0x68(%rsp), %rax
movl 0x30(%rax), %ecx
movq 0x2098(%rsp), %rdx
xorl %eax, %eax
cmpl (%rdx), %ecx
movb %al, 0x4f(%rsp)
je 0x30678a
movq 0x2080(%rsp), %rax
movq %rax, 0x40(%rsp)
movq 0x20a8(%rsp), %rdi
callq 0x306620
movq %rax, %rcx
movq 0x40(%rsp), %rax
cmpq %rcx, %rax
setb %al
movb %al, 0x4f(%rsp)
movb 0x4f(%rsp), %al
testb $0x1, %al
jne 0x306794
jmp 0x30680e
movq 0x20a0(%rsp), %rdi
leaq 0x2a930a(%rip), %rsi    # 0x5afaad
callq 0x16c040
movq %rax, 0x60(%rsp)
cmpq $0x0, 0x60(%rsp)
jne 0x3067c3
leaq 0x227489(%rip), %rax    # 0x52dc45
movq %rax, 0x38(%rsp)
jmp 0x3067cd
movq 0x60(%rsp), %rax
movq %rax, 0x38(%rsp)
movq 0x38(%rsp), %rsi
leaq 0x28cbb5(%rip), %rdi    # 0x59338e
movb $0x0, %al
callq 0xe7740
movq 0x20a8(%rsp), %rdi
movq 0x2080(%rsp), %rsi
movq %rsi, %rax
addq $0x1, %rax
movq %rax, 0x2080(%rsp)
callq 0x3072d0
movq %rax, 0x68(%rsp)
jmp 0x306744
movq 0x68(%rsp), %rax
movl 0x30(%rax), %eax
movq 0x2098(%rsp), %rcx
cmpl (%rcx), %eax
je 0x306827
jmp 0x306a70
jmp 0x306829
movq 0x68(%rsp), %rax
movl 0x30(%rax), %eax
movl %eax, %ecx
leaq 0x238f02(%rip), %rax    # 0x53f73c
movsbl (%rax,%rcx), %esi
leaq 0x28cb7b(%rip), %rdi    # 0x5933c0
movb $0x0, %al
callq 0xe7740
movq 0x20b0(%rsp), %rdi
movq 0x68(%rsp), %rsi
callq 0x307340
movq %rax, 0x50(%rsp)
movq %rdx, 0x58(%rsp)
movq 0x50(%rsp), %rax
movq %rax, 0x2088(%rsp)
movq 0x58(%rsp), %rax
movq %rax, 0x2090(%rsp)
movq 0x2088(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x2088(%rsp)
movq 0x2090(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x2090(%rsp)
movq 0x20a0(%rsp), %rdi
callq 0x171b70
movq %rax, %rdi
movq 0x2088(%rsp), %rdx
movq 0x2090(%rsp), %rcx
movq 0x68(%rsp), %rax
movl 0x30(%rax), %r8d
leaq 0x28c295(%rip), %rsi    # 0x592b6f
callq 0x16c7e0
movq %rax, 0x2078(%rsp)
movq 0x2078(%rsp), %rdi
movq 0x20b0(%rsp), %rax
movq 0x18(%rax), %rsi
callq 0x16c170
movq 0x2078(%rsp), %rax
movq %rax, 0x30(%rsp)
movq 0x68(%rsp), %rdi
callq 0x3074d0
movq 0x30(%rsp), %rdi
cvtsd2ss %xmm0, %xmm0
callq 0x16d590
movq 0x68(%rsp), %rdi
callq 0x307530
cmpq $0x0, %rax
je 0x306960
movq 0x2078(%rsp), %rax
movq %rax, 0x28(%rsp)
movq 0x68(%rsp), %rdi
callq 0x307530
movq 0x28(%rsp), %rdi
movq %rax, %rdx
leaq 0x28cb16(%rip), %rsi    # 0x593471
callq 0x16edb0
movq 0x20a0(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x68(%rsp), %rdi
callq 0x307580
movq 0x8(%rsp), %rdi
movl %eax, %esi
callq 0x16e0f0
leaq 0x70(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0x68(%rsp), %rdi
callq 0x3075d0
movq 0x10(%rsp), %rdi
movq %rax, %rcx
movl $0x1fff, %esi           # imm = 0x1FFF
leaq 0x28865e(%rip), %rdx    # 0x58f009
movb $0x0, %al
callq 0x19b90
movq 0x2078(%rsp), %rdi
leaq 0x70(%rsp), %rdx
leaq 0x28b0b9(%rip), %rsi    # 0x591a7f
callq 0x16edb0
leaq 0x70(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0x68(%rsp), %rdi
callq 0x307620
movq 0x18(%rsp), %rdi
movq %rax, %rcx
movl $0x1fff, %esi           # imm = 0x1FFF
leaq 0x288616(%rip), %rdx    # 0x58f009
movb $0x0, %al
callq 0x19b90
movq 0x2078(%rsp), %rdi
leaq 0x70(%rsp), %rdx
leaq 0x28b039(%rip), %rsi    # 0x591a47
callq 0x16edb0
leaq 0x70(%rsp), %rax
movq %rax, 0x20(%rsp)
movq 0x68(%rsp), %rdi
callq 0x307670
movq 0x20(%rsp), %rdi
movq %rax, %rcx
movl $0x1fff, %esi           # imm = 0x1FFF
leaq 0x2885ce(%rip), %rdx    # 0x58f009
movb $0x0, %al
callq 0x19b90
movq 0x2078(%rsp), %rdi
leaq 0x70(%rsp), %rdx
leaq 0x28c622(%rip), %rsi    # 0x593078
callq 0x16edb0
movq 0x20a0(%rsp), %rdi
movq 0x2078(%rsp), %rsi
callq 0x16d010
addq $0x20b8, %rsp           # imm = 0x20B8
retq
nopl (%rax,%rax)