// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/ltr/ltr_refseq_match_stream.c
// Function: gt_ltr_refseq_match_stream_add_match_to_fn
static void gt_ltr_refseq_match_stream_add_match_to_fn(
                                                    GtLTRRefseqMatchStream *rms,
                                                    GtMatch *match,
                                                    GT_UNUSED GtError *err)
{
  GtStr *seq;
  GtFeatureNode *fn;
  GtGenomeNode *new_node;
  GtMatchDirection dir;
  GtStrand str;
  GtRange fn_range, match_range1, match_range2;
  char target[BUFSIZ], *tmp, *tmp2, buf[BUFSIZ];
  const char *seqid1, *seqid2;
  GtUword ali_length,
                fn_length,
                min_ali_length;
  double similarity;

  gt_assert(rms && match);
  gt_error_check(err);

  seqid1 = gt_match_get_seqid1(match);
  seqid2 = gt_match_get_seqid2(match);
  fn = (GtFeatureNode*) gt_hashmap_get(rms->header_to_fn, (void*) seqid1);
  fn_length = gt_genome_node_get_length((GtGenomeNode*) fn);
  fn_range = gt_genome_node_get_range((GtGenomeNode*) fn);
  min_ali_length = (GtUword) ((rms->min_ali_len_perc / 100.0) * fn_length);
  ali_length = gt_match_blast_get_align_length((GtMatchBlast*) match);
  if (ali_length < min_ali_length) {
    gt_match_delete(match);
    return;
  }
  gt_match_get_range_seq1(match, &match_range1);
  gt_match_get_range_seq2(match, &match_range2);
  seq = gt_genome_node_get_seqid((GtGenomeNode*) fn);
  dir = gt_match_get_direction(match);
  str = gt_ltr_refseq_match_stream_determine_strand(dir, fn);
  similarity = gt_match_blast_get_similarity((GtMatchBlast*) match);
  new_node = gt_feature_node_new(seq, NEW_FN_TYPE,
                                 fn_range.start + match_range1.start,
                                 fn_range.start + match_range1.end, str);
  (void) snprintf(buf, BUFSIZ, "%.2f", similarity);
  gt_feature_node_set_attribute((GtFeatureNode*) new_node, "identity", buf);
  gt_feature_node_set_source((GtFeatureNode*) new_node,
                             gt_str_new_cstr(rms->source));
  if (rms->params_id != GT_UNDEF_UWORD) {
    char params_id[BUFSIZ];

    (void) snprintf(params_id, BUFSIZ, ""GT_WU"", rms->params_id);
    gt_feature_node_set_attribute((GtFeatureNode*) new_node, ATTR_PARAMS,
                                  params_id);
  }

  tmp = gt_cstr_dup(seqid2);
  tmp2 = strtok(tmp, " ");
  if (tmp2 != NULL) {
    GtStr *tmpstr = NULL;
    tmpstr = gt_str_new_cstr(gt_cstr_dup(tmp2));
    gt_free(tmp2);
    while ((tmp2 = strtok(NULL, " ")) != NULL) {
      gt_str_append_cstr(tmpstr, "%20");
      gt_str_append_cstr(tmpstr, gt_cstr_dup(tmp2));
      gt_free(tmp2);
    }
    (void) snprintf(target, BUFSIZ, "%s "GT_WU" "GT_WU"", gt_str_get(tmpstr),
                    match_range2.start, match_range2.end);
    gt_str_delete(tmpstr);
  } else
    (void) snprintf(target, BUFSIZ, "%s " GT_WU " " GT_WU,
                    seqid2, match_range2.start, match_range2.end);
  gt_feature_node_set_attribute((GtFeatureNode*) new_node, ATTR_TARGET,
                                target);
  gt_feature_node_add_child(fn, (GtFeatureNode*) new_node);

  gt_match_delete(match);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x4048, %rsp           # imm = 0x4048
testq %rsi, %rsi
je 0x212d2b
movq %rsi, %rbx
movq %rdi, %r13
testq %rdx, %rdx
je 0x212a1e
movq %rdx, %rdi
callq 0x101a9a
testb %al, %al
jne 0x212d30
movq %rbx, %rdi
callq 0x16574b
movq %rax, %r14
movq %rbx, %rdi
callq 0x16575f
movq %rax, %rbp
movq 0x20(%r13), %rdi
movq %r14, %rsi
callq 0x105a11
movq %rax, %r12
movq %rax, %rdi
callq 0x14b908
movq %rax, %r14
movq %r12, %rdi
callq 0x14b8df
movsd 0x98(%r13), %xmm0
divsd 0x13fd89(%rip), %xmm0   # 0x3527f0
movq %rax, %r15
movq %r14, %xmm1
punpckldq 0x13de69(%rip), %xmm1 # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x13de71(%rip), %xmm1   # 0x3508f0
movapd %xmm1, %xmm2
unpckhpd %xmm1, %xmm2            # xmm2 = xmm2[1],xmm1[1]
addsd %xmm1, %xmm2
mulsd %xmm0, %xmm2
cvttsd2si %xmm2, %rax
movq %rax, %rcx
sarq $0x3f, %rcx
subsd 0x13e27d(%rip), %xmm2   # 0x350d20
cvttsd2si %xmm2, %r14
andq %rcx, %r14
orq %rax, %r14
movq %rbx, %rdi
callq 0x165abb
cmpq %r14, %rax
jb 0x212d11
movq %rbp, 0x8(%rsp)
leaq 0x30(%rsp), %rsi
movq %rbx, %rdi
callq 0x165773
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x16578b
movq %r12, %rdi
callq 0x14b89b
movq %rax, %rbp
movq %rbx, %rdi
callq 0x1657e1
testq %r12, %r12
je 0x212d35
movl %eax, %r14d
movq %r12, 0x28(%rsp)
movq %r12, %rdi
callq 0x14970e
xorl %ecx, %ecx
cmpl $0x1, %eax
setne %cl
xorl %r12d, %r12d
cmpl %ecx, %r14d
sete %r12b
movq %rbx, %rdi
callq 0x165acb
movsd %xmm0, 0x20(%rsp)
movq 0x30(%rsp), %rdx
addq %r15, %rdx
addq 0x38(%rsp), %r15
leaq 0x1b6432(%rip), %rsi    # 0x3c8f70
movq %rbp, %rdi
movq %r15, %rcx
movl %r12d, %r8d
callq 0x14952c
movq %rax, %r15
leaq 0x16dafb(%rip), %rdx    # 0x380651
leaq 0x2040(%rsp), %r14
movl $0x2000, %esi           # imm = 0x2000
movq %r14, %rdi
movsd 0x20(%rsp), %xmm0
movb $0x1, %al
callq 0x17c60
leaq 0x1a1997(%rip), %rsi    # 0x3b4511
movq %r15, %rdi
movq %r14, %rdx
callq 0x149c3c
movq 0x40(%r13), %rdi
callq 0x120955
movq %r15, %rdi
movq %rax, %rsi
callq 0x1491f1
movq 0x50(%r13), %rcx
cmpq $-0x1, %rcx
je 0x212bd0
leaq 0x1b2a82(%rip), %rdx    # 0x3c562c
leaq 0x40(%rsp), %r14
movl $0x2000, %esi           # imm = 0x2000
movq %r14, %rdi
xorl %eax, %eax
callq 0x17c60
leaq 0x198895(%rip), %rsi    # 0x3ab45a
movq %r15, %rdi
movq %r14, %rdx
callq 0x149c3c
movq 0x8(%rsp), %r12
movq %r12, %rdi
callq 0xe8760
leaq 0x1b8c64(%rip), %rsi    # 0x3cb848
movq %rax, %rdi
callq 0x17c10
testq %rax, %rax
je 0x212ccb
movq %rax, %r14
movq %r15, 0x8(%rsp)
movq %rax, %rdi
callq 0xe8760
movq %rax, %rdi
callq 0x120955
movq %rax, %r12
leaq 0x1b622e(%rip), %rsi    # 0x3c8e45
movq %r14, %rdi
movl $0xf8, %edx
callq 0x109670
leaq 0x1b8c1d(%rip), %rsi    # 0x3cb848
xorl %edi, %edi
callq 0x17c10
testq %rax, %rax
je 0x212c8f
movq %rax, %r14
leaq 0x1b6340(%rip), %r13    # 0x3c8f81
leaq 0x1b61fd(%rip), %rbp    # 0x3c8e45
leaq 0x1b8bf9(%rip), %r15    # 0x3cb848
movq %r12, %rdi
movq %r13, %rsi
callq 0x12097f
movq %r14, %rdi
callq 0xe8760
movq %r12, %rdi
movq %rax, %rsi
callq 0x12097f
movq %r14, %rdi
movq %rbp, %rsi
movl $0xfc, %edx
callq 0x109670
xorl %edi, %edi
movq %r15, %rsi
callq 0x17c10
movq %rax, %r14
testq %rax, %rax
jne 0x212c4f
movq %r12, %rdi
callq 0x120d23
movq 0x10(%rsp), %r8
movq 0x18(%rsp), %r9
leaq 0x15b473(%rip), %rdx    # 0x36e11b
leaq 0x40(%rsp), %rdi
movl $0x2000, %esi           # imm = 0x2000
movq %rax, %rcx
xorl %eax, %eax
callq 0x17c60
movq %r12, %rdi
callq 0x121b03
movq 0x8(%rsp), %r15
jmp 0x212cf0
movq 0x10(%rsp), %r8
movq 0x18(%rsp), %r9
leaq 0x15b43f(%rip), %rdx    # 0x36e11b
leaq 0x40(%rsp), %rdi
movl $0x2000, %esi           # imm = 0x2000
movq %r12, %rcx
xorl %eax, %eax
callq 0x17c60
leaq 0x161bdc(%rip), %rsi    # 0x3748d3
leaq 0x40(%rsp), %rdx
movq %r15, %rdi
callq 0x149c3c
movq 0x28(%rsp), %rdi
movq %r15, %rsi
callq 0x149997
movq %rbx, %rdi
callq 0x1657f0
addq $0x4048, %rsp           # imm = 0x4048
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x8265a
callq 0x825e8
callq 0x82621
nop