// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/extended/id_to_md5_visitor.c
// Function: seqid_to_md5
static int seqid_to_md5(GtGenomeNode *gn, GtRegionMapping *region_mapping,
                        bool substitute_target_ids, GtError *err)
{
  GtStr *seqid;
  int had_err = 0;
  gt_error_check(err);
  gt_assert(gn && region_mapping);
  seqid = gt_genome_node_get_seqid(gn);
  if (!gt_md5_seqid_has_prefix(gt_str_get(seqid))) {
    /* seqid is not already a MD5 seqid -> change id */
    GtUword offset;
    const char *md5;
    GtRange range = gt_genome_node_get_range(gn);
    if (!(md5 = gt_region_mapping_get_md5_fingerprint(region_mapping, seqid,
                                                      &range, &offset, err))) {
      had_err = -1;
    }
    if (!had_err) {
      GtStr *new_seqid = gt_str_new_cstr(GT_MD5_SEQID_PREFIX);
      gt_str_append_cstr(new_seqid, md5);
      gt_str_append_char(new_seqid, GT_MD5_SEQID_SEPARATOR);
      gt_str_append_str(new_seqid, seqid);
      if (gt_feature_node_try_cast(gn)) {
        I2MChangeSeqidInfo info;
        info.new_seqid = new_seqid;
        info.region_mapping = region_mapping;
        info.substitute_target_ids = substitute_target_ids;
        gt_assert(offset);
        info.offset = offset - 1;
        had_err = gt_feature_node_traverse_children((GtFeatureNode*) gn, &info,
                                                    i2m_change_seqid, true,
                                                    err);
      }
      else
        gt_genome_node_change_seqid(gn, new_seqid);
      gt_str_delete(new_seqid);
    }
  }
  return had_err;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rcx, %rbx
movl %edx, %r12d
movq %rsi, %r15
movq %rdi, %r14
testq %rcx, %rcx
je 0x15da83
movq %rbx, %rdi
callq 0x101a9a
testb %al, %al
jne 0x15dba9
testq %r14, %r14
je 0x15dba4
testq %r15, %r15
je 0x15dba4
movq %r14, %rdi
callq 0x14b89b
movq %rax, %r13
movq %rax, %rdi
callq 0x120d23
movq %rax, %rdi
callq 0x10ba1c
xorl %ebp, %ebp
testb %al, %al
jne 0x15db93
movq %r14, %rdi
callq 0x14b8df
leaq 0x38(%rsp), %r8
movq %rax, (%r8)
movq %rdx, 0x8(%r8)
leaq 0x10(%rsp), %rcx
movq %r15, %rdi
movq %r13, %rsi
movq %r8, %rdx
movq %rbx, %r8
callq 0x176724
testq %rax, %rax
je 0x15db77
movq %rax, %rbp
movl %r12d, 0xc(%rsp)
leaq 0x21794d(%rip), %rdi    # 0x375449
callq 0x120955
movq %rax, %r12
movq %rax, %rdi
movq %rbp, %rsi
callq 0x12097f
movq %r12, %rdi
movl $0x3a, %esi
callq 0x120ba5
movq %r12, %rdi
movq %r13, %rsi
callq 0x120a43
movq %r14, %rdi
callq 0x14aefc
testq %rax, %rax
je 0x15db7e
movq %r12, 0x18(%rsp)
movq %r15, 0x20(%rsp)
movl 0xc(%rsp), %eax
movb %al, 0x28(%rsp)
movq 0x10(%rsp), %rax
testq %rax, %rax
je 0x15dbae
decq %rax
leaq 0x18(%rsp), %rsi
movq %rax, 0x18(%rsi)
leaq 0x50(%rip), %rdx        # 0x15dbb3
movq %r14, %rdi
movl $0x1, %ecx
movq %rbx, %r8
callq 0x149fca
movl %eax, %ebp
jmp 0x15db8b
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
jmp 0x15db93
movq %r14, %rdi
movq %r12, %rsi
callq 0x14b96f
xorl %ebp, %ebp
movq %r12, %rdi
callq 0x121b03
movl %ebp, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x4a34c
callq 0x4a313
callq 0x4a385