// File: /workspace/github_c_makefile_star2_O1/AlxHnr[P]nano-backup/src/search.c
// Function: finishSearchStep
static SearchResult finishSearchStep(SearchIterator *iterator)
{
  StringView entry = sDirGetNext(iterator->state.access.search.dir);
  if(strIsEmpty(entry))
  {
    sDirClose(iterator->state.access.search.dir);
    return finishDirectory(iterator);
  }

  /* Create new path for matching. */
  StringView dir_entry_name = strSplitPath(entry).tail;
  replaceCurrentFilename(iterator, dir_entry_name);

  /* Match subnodes against dir_entry. */
  SearchNode *matched_node = NULL;
  for(SearchNode *node = iterator->state.access.search.subnodes;
      node != NULL; node = node->next)
  {
    if(nodeMatches(node, dir_entry_name))
    {
      if(matched_node == NULL)
      {
        matched_node = node;
      }
      else
      {
        warnNodeMatches(node, dir_entry_name);
        warnNodeMatches(matched_node, dir_entry_name);
        die("ambiguous rules for path: \"" PRI_STR "\"",
            STR_FMT(iterator->current_path));
      }
    }
  }

  if(matched_node != NULL)
  {
    return finishNodeStep(iterator, matched_node, matched_node->policy);
  }

  /* Skip current path, if no fallback policy was defined. */
  if(iterator->state.access.search.fallback_policy == BPOL_none)
  {
    return finishSearchStep(iterator);
  }

  /* Match against ignore expressions. */
  for(RegexList *element = iterator->ignore_expressions; element != NULL;
      element = element->next)
  {
    if(sRegexIsMatching(element->regex, iterator->current_path))
    {
      element->has_matched = true;
      return finishSearchStep(iterator);
    }
  }

  return finishNodeStep(iterator, NULL,
                        iterator->state.access.search.fallback_policy);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movq 0x48(%rsi), %rsi
leaq 0x50(%rsp), %r15
movq %r15, %rdi
callq 0x8f07
movq 0x10(%r15), %rax
movq %rax, 0x10(%rsp)
movups (%r15), %xmm0
movups %xmm0, (%rsp)
callq 0xb11c
testb %al, %al
je 0xaaa8
movq 0x48(%r14), %rdi
callq 0x8fe1
movq %rbx, %rdi
movq %r14, %rsi
callq 0xacb9
jmp 0xabcd
movq 0x60(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x50(%rsp), %xmm0
movups %xmm0, (%rsp)
leaq 0x68(%rsp), %r15
movq %r15, %rdi
callq 0xb0a5
movq 0x28(%r15), %rax
movq %rax, 0x40(%rsp)
movups 0x18(%r15), %xmm0
movaps %xmm0, 0x30(%rsp)
movq 0x28(%r15), %rax
movq %rax, 0x10(%rsp)
movups 0x18(%r15), %xmm0
movups %xmm0, (%rsp)
movq %r14, %rdi
callq 0xad20
movq 0x50(%r14), %r15
testq %r15, %r15
je 0xab70
xorl %r12d, %r12d
movq 0x20(%r15), %rdi
testq %rdi, %rdi
je 0xab24
movq 0x40(%rsp), %rax
movq %rax, 0x10(%rsp)
movaps 0x30(%rsp), %xmm0
movups %xmm0, (%rsp)
callq 0x9f28
jmp 0xab4e
movq 0x40(%rsp), %rax
movq %rax, 0x28(%rsp)
movaps 0x30(%rsp), %xmm0
movups %xmm0, 0x18(%rsp)
movq 0x10(%r15), %rax
movq %rax, 0x10(%rsp)
movups (%r15), %xmm0
movups %xmm0, (%rsp)
callq 0xb126
testb %al, %al
je 0xab5f
movq %r15, %rdx
testq %r12, %r12
je 0xab62
jmp 0xabed
movq %r12, %rdx
movq 0x60(%r15), %r15
movq %rdx, %r12
testq %r15, %r15
jne 0xab01
jmp 0xab72
xorl %edx, %edx
testq %rdx, %rdx
je 0xab87
movl 0x2c(%rdx), %ecx
movq %rbx, %rdi
movq %r14, %rsi
callq 0xadcc
jmp 0xabcd
cmpl $0x0, 0x58(%r14)
je 0xabc2
leaq 0x8(%r14), %r12
movq %r14, %r15
movq 0x30(%r15), %r15
testq %r15, %r15
je 0xabdf
movq (%r15), %rdi
movq 0x10(%r12), %rax
movq %rax, 0x10(%rsp)
movups (%r12), %xmm0
movups %xmm0, (%rsp)
callq 0x9f28
testb %al, %al
je 0xab95
movb $0x1, 0x28(%r15)
movq %rbx, %rdi
movq %r14, %rsi
callq 0xaa50
movq %rbx, %rax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movl 0x58(%r14), %ecx
movq %rbx, %rdi
movq %r14, %rsi
xorl %edx, %edx
jmp 0xab80
movq 0x40(%rsp), %rax
movq %rax, 0x10(%rsp)
movaps 0x30(%rsp), %xmm0
movups %xmm0, (%rsp)
movq %r15, %rdi
callq 0x2410
movq 0x40(%rsp), %rax
movq %rax, 0x10(%rsp)
movaps 0x30(%rsp), %xmm0
movups %xmm0, (%rsp)
movq %r12, %rdi
callq 0x2410
movl 0x10(%r14), %esi
movq 0x8(%r14), %rdx
leaq 0x43c5(%rip), %rdi      # 0xeff7
xorl %eax, %eax
callq 0x3dc4