// File: /workspace/github_c_makefile_star2_O1/AlxHnr[P]nano-backup/src/backup.c
// Function: initiateMetadataRecursively
static SearchResultType initiateMetadataRecursively(
  AllocatorPair *allocator_pair, Metadata *metadata, PathNode **node_list,
  SearchIterator *context, const RegexList *ignore_list)
{
  const SearchResult result = searchGetNext(context);
  if(result.type == SRT_end_of_directory ||
     result.type == SRT_end_of_search || result.type == SRT_other)
  {
    return result.type;
  }

  PathNode *node = strTableGet(metadata->path_table, result.path);

  if(node == NULL)
  {
    node = CR_RegionAlloc(metadata->r, sizeof *node);

    strSet(&node->path, strCopy(result.path, allocator_pair->a));

    node->hint = BH_added;
    node->policy = result.policy;
    node->history =
      buildPathHistoryPoint(allocator_pair->a, metadata, result);
    node->subnodes = NULL;

    /* Prepend the new node to the current node list. */
    node->next = *node_list;
    *node_list = node;

    metadata->total_path_count = sSizeAdd(metadata->total_path_count, 1);
  }
  else
  {
    handleFoundNode(allocator_pair, metadata, node, result);
  }

  if(result.type == SRT_directory)
  {
    while(initiateMetadataRecursively(allocator_pair, metadata,
                                      &node->subnodes, context,
                                      ignore_list) != SRT_end_of_directory)
      ;
  }

  if(backupHintNoPol(node->hint) == BH_directory_to_regular ||
     backupHintNoPol(node->hint) == BH_directory_to_symlink)
  {
    if(result.policy == BPOL_none || result.policy == BPOL_track)
    {
      for(PathNode *subnode = node->subnodes; subnode != NULL;
          subnode = subnode->next)
      {
        markAsRemovedRecursively(metadata, subnode,
                                 result.policy == BPOL_track);
      }
    }
    else
    {
      for(PathNode *subnode = node->subnodes; subnode != NULL;
          subnode = subnode->next)
      {
        prepareNodeForWipingRecursively(metadata, subnode);
      }
    }
  }
  else if(result.policy == BPOL_track &&
          node->history->state.type == PST_regular_file)
  {
    for(PathNode *subnode = node->subnodes; subnode != NULL;
        subnode = subnode->next)
    {
      markAsRemovedRecursively(metadata, subnode, false);
    }
  }
  else
  {
    handleNotFoundSubnodes(metadata, result.node, result.policy,
                           node->subnodes, ignore_list);
  }

  /* Mark nodes without a policy and needed subnodes for purging. */
  if(result.policy == BPOL_none)
  {
    bool has_needed_subnode = false;
    for(PathNode *subnode = node->subnodes; subnode != NULL;
        subnode = subnode->next)
    {
      if(backupHintNoPol(subnode->hint) != BH_not_part_of_repository)
      {
        has_needed_subnode = true;
        break;
      }
    }

    if(!has_needed_subnode)
    {
      prepareNodeForWiping(metadata, node);
    }
  }

  if(node->hint == BH_none)
  {
    backupHintSet(node->hint, BH_unchanged);
  }

  return result.type;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x338, %rsp            # imm = 0x338
movq %r8, %r15
movq %rcx, %r12
movq %rdx, %rbp
movq %rsi, %rbx
movq %rdi, %r13
leaq 0xf0(%rsp), %r14
movq %r14, %rdi
movq %rcx, %rsi
callq 0xaa2f
movl (%r14), %eax
cmpq $0x20, %rax
ja 0x2cd8
movabsq $0x100010100, %rcx      # imm = 0x100010100
btq %rax, %rcx
jb 0x313d
movq 0x40(%rbx), %rdi
movq 0x108(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0xf8(%rsp), %xmm0
movups %xmm0, (%rsp)
callq 0xb53a
testq %rax, %rax
je 0x2e05
movq %rax, %rbp
leaq 0x278(%rsp), %r14
leaq 0xf0(%rsp), %rsi
movl $0xc0, %edx
movq %r14, %rdi
callq 0x2280
movl 0x28(%r14), %edx
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x3b08
movq 0x20(%rbp), %rdx
addq $0x8, %rdx
cmpl $0x3, 0x28(%r14)
jne 0x2f32
cmpl $0x0, (%rdx)
je 0x2f9e
movups (%rdx), %xmm0
movups 0x10(%rdx), %xmm1
movups 0x20(%rdx), %xmm2
movups 0x30(%rdx), %xmm3
leaq 0x1b0(%rsp), %rdx
movaps %xmm3, 0x30(%rdx)
movaps %xmm2, 0x20(%rdx)
movaps %xmm1, 0x10(%rdx)
movaps %xmm0, (%rdx)
leaq 0x278(%rsp), %rsi
movl $0x18, %ecx
movq %rsp, %rdi
rep  movsq (%rsi), %es:(%rdi)
movq %r13, %rdi
movq %rbp, %r14
movq %rbp, %rsi
callq 0x3baa
movzwl 0x18(%rbp), %eax
testl $0x1ff, %eax            # imm = 0x1FF
je 0x303c
movq (%rbx), %rdi
movl $0x50, %esi
callq 0xdd40
movq %rax, %r14
movaps 0x1b0(%rsp), %xmm0
movaps 0x1c0(%rsp), %xmm1
movaps 0x1d0(%rsp), %xmm2
movaps 0x1e0(%rsp), %xmm3
movups %xmm0, 0x8(%rax)
movups %xmm1, 0x18(%rax)
movups %xmm2, 0x28(%rax)
movups %xmm3, 0x38(%rax)
leaq 0x8(%rbx), %rax
movq %rax, (%r14)
movq 0x18(%rbx), %rdi
movl $0x1, %esi
callq 0x8924
movq (%r14), %rcx
movq %rax, 0x10(%rcx)
jmp 0x302d
movq (%rbx), %rdi
movl $0x38, %esi
callq 0xdd40
movq %rax, %r14
movq (%r13), %rsi
leaq 0xf8(%rsp), %rcx
movq 0x10(%rcx), %rax
movq %rax, 0x10(%rsp)
movups (%rcx), %xmm0
movups %xmm0, (%rsp)
leaq 0xd8(%rsp), %rdi
callq 0xb003
leaq 0xd8(%rsp), %rcx
movq 0x10(%rcx), %rax
movq %rax, 0x10(%rsp)
movups (%rcx), %xmm0
movups %xmm0, (%rsp)
movq %r14, %rdi
callq 0xaff1
movq %r14, 0xc8(%rsp)
movl $0x2, 0x18(%r14)
leaq 0xf8(%rsp), %rax
movl 0x20(%rax), %eax
movl %eax, 0x1c(%r14)
movq (%r13), %rax
movq %rax, 0xd0(%rsp)
leaq 0x1b0(%rsp), %rdi
leaq 0xf0(%rsp), %rsi
movl $0xc0, %edx
callq 0x2280
movq (%rbx), %rdi
movl $0x50, %esi
callq 0xdd40
movq %rax, %r14
leaq 0x8(%rbx), %rax
movq %rax, (%r14)
movq 0x18(%rbx), %rdi
movl $0x1, %esi
callq 0x8924
movq (%r14), %rcx
movq %rax, 0x10(%rcx)
leaq 0x8(%r14), %rax
movl $0x18, %ecx
movq %rsp, %rdi
leaq 0x1b0(%rsp), %rsi
rep  movsq (%rsi), %es:(%rdi)
movq 0xd0(%rsp), %rdi
movq %rax, %rsi
callq 0x3a22
xorl %eax, %eax
movq %rax, 0x48(%r14)
movq 0xc8(%rsp), %rcx
movq %r14, 0x20(%rcx)
movq %rcx, %r14
movq %rax, 0x28(%rcx)
movq (%rbp), %rax
movq %rax, 0x30(%rcx)
movq %rcx, (%rbp)
movq 0x38(%rbx), %rdi
movl $0x1, %esi
callq 0x8924
movq %rax, 0x38(%rbx)
jmp 0x303c
leaq 0x278(%rsp), %rsi
movl $0x18, %ecx
movq %rsp, %rdi
rep  movsq (%rsi), %es:(%rdi)
movq %r13, %rdi
movq %rbp, %rsi
callq 0x3baa
movzwl 0x18(%rbp), %eax
testl $0x1ff, %eax            # imm = 0x1FF
movq %rbp, %r14
jne 0x2f6c
cmpl $0x0, 0x2a0(%rsp)
jne 0x303c
movq %r14, %rbp
movq 0x20(%r14), %r14
movq (%r14), %rax
decq 0x10(%rax)
leaq 0x8(%rbx), %rax
movq %rax, (%r14)
movq 0x18(%rbx), %rdi
movl $0x1, %esi
callq 0x8924
movq (%r14), %rcx
movq %rbp, %r14
movq %rax, 0x10(%rcx)
jmp 0x303c
movl $0xfffffe00, %eax       # imm = 0xFFFFFE00
andl 0x18(%rbp), %eax
orl $0x2, %eax
movl %eax, 0x18(%rbp)
movq (%r13), %rax
movq %rax, 0xc8(%rsp)
leaq 0x1b0(%rsp), %rdi
leaq 0x278(%rsp), %rsi
movl $0xc0, %edx
callq 0x2280
movq (%rbx), %rdi
movl $0x50, %esi
callq 0xdd40
movq %rax, %r14
leaq 0x8(%rbx), %rax
movq %rax, (%r14)
movq 0x18(%rbx), %rdi
movl $0x1, %esi
callq 0x8924
movq (%r14), %rcx
movq %rax, 0x10(%rcx)
leaq 0x8(%r14), %rax
movl $0x18, %ecx
movq %rsp, %rdi
leaq 0x1b0(%rsp), %rsi
rep  movsq (%rsi), %es:(%rdi)
movq 0xc8(%rsp), %rdi
movq %rax, %rsi
callq 0x3a22
movq $0x0, 0x48(%r14)
movq 0x20(%rbp), %rax
movq %rax, 0x48(%r14)
movq %r14, 0x20(%rbp)
movq %rbp, %r14
cmpl $0x4, 0xf0(%rsp)
jne 0x3063
leaq 0x28(%r14), %rbp
movq %r13, %rdi
movq %rbx, %rsi
movq %rbp, %rdx
movq %r12, %rcx
movq %r15, %r8
callq 0x2c88
cmpl $0x10, %eax
jne 0x304a
movl $0x1ff, %eax            # imm = 0x1FF
andl 0x18(%r14), %eax
addl $-0x9, %eax
movl 0x118(%rsp), %edx
cmpl $0x1, %eax
ja 0x30af
cmpl $0x3, %edx
je 0x3088
testl %edx, %edx
jne 0x314f
movq 0x28(%r14), %r15
testq %r15, %r15
je 0x30f1
xorl %edx, %edx
cmpl $0x3, 0x118(%rsp)
sete %dl
movq %rbx, %rdi
movq %r15, %rsi
callq 0x38fb
movq 0x30(%r15), %r15
jmp 0x308c
cmpl $0x3, %edx
jne 0x30da
movq 0x20(%r14), %rax
cmpl $0x1, 0x8(%rax)
jne 0x30da
movq 0x28(%r14), %r15
testq %r15, %r15
je 0x30f1
movq %rbx, %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0x38fb
movq 0x30(%r15), %r15
jmp 0x30c2
movq 0x110(%rsp), %rsi
movq 0x28(%r14), %rcx
movq %rbx, %rdi
movq %r15, %r8
callq 0x3169
cmpl $0x0, 0x118(%rsp)
jne 0x3127
movq 0x28(%r14), %rax
testq %rax, %rax
je 0x311c
movl $0x1ff, %ecx            # imm = 0x1FF
movl 0x18(%rax), %edx
andl %ecx, %edx
cmpl $0x4, %edx
jne 0x3127
movq 0x30(%rax), %rax
testq %rax, %rax
jne 0x3109
movq %rbx, %rdi
movq %r14, %rsi
callq 0x39ec
cmpl $0x0, 0x18(%r14)
jne 0x3136
movl $0x1, 0x18(%r14)
movl 0xf0(%rsp), %eax
addq $0x338, %rsp            # imm = 0x338
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x28(%r14), %r15
testq %r15, %r15
je 0x30f1
movq %rbx, %rdi
movq %r15, %rsi
callq 0x39bb
movq 0x30(%r15), %r15
jmp 0x3153