// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/extended/cds_check_visitor.c
// Function: check_cds_phases_if_necessary
static int check_cds_phases_if_necessary(GtFeatureNode *fn,
                                         GtCDSCheckVisitor *v,
                                         bool second_pass, GtError *err)
{
  GtFeatureNodeIterator *fni;
  GtFeatureNode *node;
  GtArray *cds_features = NULL;
  GtHashmap *multi_features = NULL;
  int had_err = 0;
  gt_error_check(err);
  gt_assert(fn);
  fni = gt_feature_node_iterator_new_direct(fn);
  while ((node = gt_feature_node_iterator_next(fni))) {
    if (gt_feature_node_has_type(node, gt_ft_CDS)) {
      if (gt_feature_node_is_multi(node)) {
        GtArray *features;
        if (!multi_features)
          multi_features = gt_hashmap_new(GT_HASH_DIRECT, NULL,
                                          (GtFree) gt_array_delete);
        if ((features =
                gt_hashmap_get(multi_features,
                             gt_feature_node_get_multi_representative(node)))) {
          gt_array_add(features, node);
        }
        else {
          GtFeatureNode *representative;
          features = gt_array_new(sizeof (GtFeatureNode*));
          representative = gt_feature_node_get_multi_representative(node);
          gt_array_add(features, representative);
          gt_hashmap_add(multi_features, representative, features);
        }
      }
      else {
        if (!cds_features)
          cds_features = gt_array_new(sizeof (GtFeatureNode*));
        gt_array_add(cds_features, node);
      }
    }
  }
  if (cds_features)
    had_err = check_cds_phases(cds_features, v, false, second_pass, err);
  if (!had_err && multi_features)
    had_err = gt_hashmap_foreach(multi_features, check_cds_phases_hm, v, err);
  gt_array_delete(cds_features);
  gt_hashmap_delete(multi_features);
  gt_feature_node_iterator_delete(fni);
  return had_err;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdx, %r14
movq %rsi, 0x20(%rsp)
movq %rdi, %rbx
testq %rdx, %rdx
je 0x847b9
movq %r14, %rdi
callq 0x3566a
testb %al, %al
jne 0x84945
movq %r14, 0x18(%rsp)
movq %rbx, %rdi
callq 0x41959
movq %rax, %r15
movq %rax, %rdi
callq 0x41a02
movq %rax, 0x8(%rsp)
xorl %r12d, %r12d
testq %rax, %rax
je 0x848c9
xorl %r13d, %r13d
leaq 0x60a03(%rip), %r14     # 0xe51ef
leaq 0x8(%rsp), %rbx
xorl %ebp, %ebp
movq %rax, %rdi
movq %r14, %rsi
callq 0x40409
testb %al, %al
je 0x8486e
movq 0x8(%rsp), %rdi
callq 0x40432
testb %al, %al
je 0x8484c
testq %r13, %r13
jne 0x84828
xorl %edi, %edi
xorl %esi, %esi
leaq -0x156ec(%rip), %rdx    # 0x6f134
callq 0x76f28
movq %rax, %r13
movq 0x8(%rsp), %rdi
callq 0x40571
movq %r13, %rdi
movq %rax, %rsi
callq 0x77109
testq %rax, %rax
je 0x84886
movl $0x8, %edx
movq %rax, %rdi
jmp 0x84866
testq %rbp, %rbp
jne 0x8485e
movl $0x8, %edi
callq 0x6e93c
movq %rax, %rbp
movl $0x8, %edx
movq %rbp, %rdi
movq %rbx, %rsi
callq 0x6ec0e
movq %r15, %rdi
callq 0x41a02
movq %rax, 0x8(%rsp)
testq %rax, %rax
jne 0x847f3
jmp 0x848ce
movl $0x8, %edi
callq 0x6e93c
movq %rax, %r12
movq 0x8(%rsp), %rdi
callq 0x40571
movq %rax, 0x10(%rsp)
movl $0x8, %edx
movq %r12, %rdi
leaq 0x10(%rsp), %rsi
callq 0x6ec0e
movq 0x10(%rsp), %rsi
movq %r13, %rdi
movq %r12, %rdx
xorl %r12d, %r12d
callq 0x77144
jmp 0x8486e
xorl %ebp, %ebp
xorl %r13d, %r13d
testq %rbp, %rbp
movq 0x18(%rsp), %rbx
movq 0x20(%rsp), %r14
je 0x848f0
movq %rbp, %rdi
movq %r14, %rsi
xorl %edx, %edx
movq %rbx, %rcx
callq 0x8494a
movl %eax, %r12d
testl %r12d, %r12d
sete %al
testq %r13, %r13
setne %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x8491b
leaq 0x3aa(%rip), %rsi       # 0x84cb4
movq %r13, %rdi
movq %r14, %rdx
movq %rbx, %rcx
callq 0x771f5
movl %eax, %r12d
movq %rbp, %rdi
callq 0x6f134
movq %r13, %rdi
callq 0x77675
movq %r15, %rdi
callq 0x41a94
movl %r12d, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x1f1ee