// File: /workspace/github_c_makefile_star2_O2/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 0x1bd877
movq %rsi, %rbx
movq %rdi, %r13
testq %rdx, %rdx
je 0x1bd56d
movq %rdx, %rdi
callq 0x89eb7
testb %al, %al
jne 0x1bd8a5
movq %rbx, %rdi
callq 0xfbda9
movq %rax, %r14
movq %rbx, %rdi
callq 0xfbdf0
movq %rax, %rbp
movq 0x20(%r13), %rdi
movq %r14, %rsi
callq 0x8f482
movq %rax, %r15
movq %rax, %rdi
callq 0xdd250
movq %rax, %r14
movq %r15, %rdi
callq 0xdd1f4
movsd 0x98(%r13), %xmm0
divsd 0x12c22a(%rip), %xmm0   # 0x2e97e0
movq %rax, %r12
movq %r14, %xmm1
punpckldq 0x12a31a(%rip), %xmm1 # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x12a322(%rip), %xmm1   # 0x2e78f0
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 0x12a72e(%rip), %xmm2   # 0x2e7d20
cvttsd2si %xmm2, %r14
andq %rcx, %r14
orq %rax, %r14
movq %rbx, %rdi
callq 0xfc4e9
cmpq %r14, %rax
jae 0x1bd623
movq %rbx, %rdi
addq $0x4048, %rsp           # imm = 0x4048
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xfc005
movq %rbp, 0x8(%rsp)
leaq 0x30(%rsp), %rsi
movq %rbx, %rdi
callq 0xfbe37
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0xfbe82
movq %r15, %rdi
callq 0xdd14a
movq %rax, %rbp
movq %rbx, %rdi
callq 0xfbfc3
testq %r15, %r15
je 0x1bd8d3
movl %eax, %r14d
movq %r15, 0x28(%rsp)
movq %r15, %rdi
callq 0xd9d99
xorl %ecx, %ecx
cmpl $0x1, %eax
setne %cl
xorl %r15d, %r15d
cmpl %ecx, %r14d
sete %r15b
movq %rbx, %rdi
callq 0xfc52c
movsd %xmm0, 0x20(%rsp)
movq 0x30(%rsp), %rdx
addq %r12, %rdx
addq 0x38(%rsp), %r12
leaq 0x1a269e(%rip), %rsi    # 0x35fd40
movq %rbp, %rdi
movq %r12, %rcx
movl %r15d, %r8d
callq 0xd9acb
movq %rax, %r12
leaq 0x15a017(%rip), %rdx    # 0x3176d1
leaq 0x2040(%rsp), %r14
movl $0x2000, %esi           # imm = 0x2000
movq %r14, %rdi
movsd 0x20(%rsp), %xmm0
movb $0x1, %al
callq 0x17bf0
leaq 0x18dbd0(%rip), %rsi    # 0x34b2ae
movq %r12, %rdi
movq %r14, %rdx
callq 0xda48b
movq 0x40(%r13), %rdi
callq 0xacbd1
movq %r12, %rdi
movq %rax, %rsi
callq 0xd96be
movq 0x50(%r13), %rcx
cmpq $-0x1, %rcx
je 0x1bd734
leaq 0x19ed00(%rip), %rdx    # 0x35c40e
leaq 0x40(%rsp), %r14
movl $0x2000, %esi           # imm = 0x2000
movq %r14, %rdi
xorl %eax, %eax
callq 0x17bf0
leaq 0x184ac3(%rip), %rsi    # 0x3421ec
movq %r12, %rdi
movq %r14, %rdx
callq 0xda48b
movq 0x8(%rsp), %r15
movq %r15, %rdi
callq 0x6c2be
leaq 0x1a4de8(%rip), %rsi    # 0x362530
movq %rax, %rdi
callq 0x17ba0
testq %rax, %rax
je 0x1bd817
movq %rax, %r14
movq %r12, 0x8(%rsp)
movq %rax, %rdi
callq 0x6c2be
movq %rax, %rdi
callq 0xacbd1
movq %rax, %r15
leaq 0x1a249a(%rip), %r13    # 0x35fc15
movq %r14, %rdi
movq %r13, %rsi
movl $0xf8, %edx
callq 0x936f9
leaq 0x1a4d9e(%rip), %rbp    # 0x362530
leaq 0x1a25b8(%rip), %r12    # 0x35fd51
xorl %edi, %edi
movq %rbp, %rsi
callq 0x17ba0
testq %rax, %rax
je 0x1bd7db
movq %rax, %r14
movq %r15, %rdi
movq %r12, %rsi
callq 0xacbfb
movq %r14, %rdi
callq 0x6c2be
movq %r15, %rdi
movq %rax, %rsi
callq 0xacbfb
movq %r14, %rdi
movq %r13, %rsi
movl $0xfc, %edx
callq 0x936f9
jmp 0x1bd799
movq %r15, %rdi
callq 0xad1fa
movq 0x10(%rsp), %r8
movq 0x18(%rsp), %r9
leaq 0x147672(%rip), %rdx    # 0x304e66
leaq 0x40(%rsp), %rdi
movl $0x2000, %esi           # imm = 0x2000
movq %rax, %rcx
xorl %eax, %eax
callq 0x17bf0
movq %r15, %rdi
callq 0xae103
movq 0x8(%rsp), %r12
jmp 0x1bd83c
movq 0x10(%rsp), %r8
movq 0x18(%rsp), %r9
leaq 0x14763e(%rip), %rdx    # 0x304e66
leaq 0x40(%rsp), %rdi
movl $0x2000, %esi           # imm = 0x2000
movq %r15, %rcx
xorl %eax, %eax
callq 0x17bf0
leaq 0x14dda0(%rip), %rsi    # 0x30b5e3
leaq 0x40(%rsp), %rdx
movq %r12, %rdi
callq 0xda48b
movq 0x28(%rsp), %rdi
movq %r12, %rsi
callq 0xda055
movq %rbx, %rdi
callq 0xfc005
addq $0x4048, %rsp           # imm = 0x4048
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x27a6ea(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x12778b(%rip), %rsi    # 0x2e5013
leaq 0x1a2479(%rip), %rdx    # 0x35fd08
leaq 0x1a247f(%rip), %rcx    # 0x35fd15
leaq 0x1a2378(%rip), %r8     # 0x35fc15
movl $0xd0, %r9d
jmp 0x1bd8ff
movq 0x27a6bc(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x12775d(%rip), %rsi    # 0x2e5013
leaq 0x127902(%rip), %rdx    # 0x2e51bf
leaq 0x1a2451(%rip), %rcx    # 0x35fd15
leaq 0x1a234a(%rip), %r8     # 0x35fc15
movl $0xd1, %r9d
jmp 0x1bd8ff
movq 0x27a68e(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x12772f(%rip), %rsi    # 0x2e5013
leaq 0x1c05b5(%rip), %rdx    # 0x37dea0
leaq 0x1a2463(%rip), %rcx    # 0x35fd55
leaq 0x1a231c(%rip), %r8     # 0x35fc15
movl $0xb0, %r9d
xorl %eax, %eax
callq 0x17a50
callq 0x17390
nop