// File: /workspace/github_c_makefile_star2_O3/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 0xa673
movl (%r14), %eax
cmpq $0x20, %rax
ja 0x2c34
movabsq $0x100010100, %rcx      # imm = 0x100010100
btq %rax, %rcx
jb 0x30ae
movq 0x40(%rbx), %rdi
movq 0x108(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0xf8(%rsp), %xmm0
movups %xmm0, (%rsp)
callq 0xb15e
testq %rax, %rax
je 0x2d6c
movq %rax, 0xc8(%rsp)
leaq 0x278(%rsp), %r14
leaq 0xf0(%rsp), %rsi
movl $0xc0, %edx
movq %r14, %rdi
callq 0x2280
movl 0x28(%r14), %ebp
movq 0xc8(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
movl %ebp, %edx
callq 0x39f3
movq 0x20(%r14), %rdx
addq $0x8, %rdx
cmpl $0x3, %ebp
jne 0x2e99
cmpl $0x0, (%rdx)
je 0x2f0d
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 %r14, %rsi
callq 0x3a91
movzwl 0x18(%r14), %eax
testl $0x1ff, %eax            # imm = 0x1FF
je 0x2fad
movq (%rbx), %rdi
movl $0x50, %esi
callq 0xd960
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 0x8778
movq (%r14), %rcx
movq %rax, 0x10(%rcx)
jmp 0x2f89
movq (%rbx), %rdi
movl $0x38, %esi
callq 0xd960
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 0xac37
leaq 0xd8(%rsp), %rcx
movq 0x10(%rcx), %rax
movq %rax, 0x10(%rsp)
movups (%rcx), %xmm0
movups %xmm0, (%rsp)
movq %r14, %rdi
callq 0xac25
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 0xd960
movq %rax, %r14
leaq 0x8(%rbx), %rax
movq %rax, (%r14)
movq 0x18(%rbx), %rdi
movl $0x1, %esi
callq 0x8778
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 0x3913
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 0x8778
movq %rax, 0x38(%rbx)
jmp 0x2fad
leaq 0x278(%rsp), %rsi
movl $0x18, %ecx
movq %rsp, %rdi
rep  movsq (%rsi), %es:(%rdi)
movq %r13, %rdi
movq %r14, %rsi
callq 0x3a91
movzwl 0x18(%r14), %eax
testl $0x1ff, %eax            # imm = 0x1FF
jne 0x2ed1
cmpl $0x0, 0x2a0(%rsp)
jne 0x2fad
movq 0xc8(%rsp), %rax
movq 0x20(%rax), %r14
movq (%r14), %rax
decq 0x10(%rax)
leaq 0x8(%rbx), %rax
movq %rax, (%r14)
movq 0x18(%rbx), %rdi
movl $0x1, %esi
callq 0x8778
movq (%r14), %rcx
movq 0xc8(%rsp), %r14
movq %rax, 0x10(%rcx)
jmp 0x2fad
movl $0xfffffe00, %eax       # imm = 0xFFFFFE00
andl 0x18(%r14), %eax
orl $0x2, %eax
movl %eax, 0x18(%r14)
movq (%r13), %rbp
leaq 0x1b0(%rsp), %rdi
leaq 0x278(%rsp), %rsi
movl $0xc0, %edx
callq 0x2280
movq (%rbx), %rdi
movl $0x50, %esi
callq 0xd960
movq %rax, %r14
leaq 0x8(%rbx), %rax
movq %rax, (%r14)
movq 0x18(%rbx), %rdi
movl $0x1, %esi
callq 0x8778
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 %rbp, %rdi
movq %rax, %rsi
callq 0x3913
movq 0xc8(%rsp), %rax
movq 0x20(%rax), %rax
movq %rax, 0x48(%r14)
movq 0xc8(%rsp), %rax
movq %r14, 0x20(%rax)
movq 0xc8(%rsp), %r14
cmpl $0x4, 0xf0(%rsp)
jne 0x2fd4
leaq 0x28(%r14), %rbp
movq %r13, %rdi
movq %rbx, %rsi
movq %rbp, %rdx
movq %r12, %rcx
movq %r15, %r8
callq 0x2be4
cmpl $0x10, %eax
jne 0x2fbb
movl $0x1ff, %eax            # imm = 0x1FF
andl 0x18(%r14), %eax
addl $-0x9, %eax
movl 0x118(%rsp), %edx
cmpl $0x1, %eax
ja 0x3020
cmpl $0x3, %edx
je 0x2ff9
testl %edx, %edx
jne 0x30c0
movq 0x28(%r14), %r15
testq %r15, %r15
je 0x3062
xorl %edx, %edx
cmpl $0x3, 0x118(%rsp)
sete %dl
movq %rbx, %rdi
movq %r15, %rsi
callq 0x37e9
movq 0x30(%r15), %r15
jmp 0x2ffd
cmpl $0x3, %edx
jne 0x304b
movq 0x20(%r14), %rax
cmpl $0x1, 0x8(%rax)
jne 0x304b
movq 0x28(%r14), %r15
testq %r15, %r15
je 0x3062
movq %rbx, %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0x37e9
movq 0x30(%r15), %r15
jmp 0x3033
movq 0x110(%rsp), %rsi
movq 0x28(%r14), %rcx
movq %rbx, %rdi
movq %r15, %r8
callq 0x30da
cmpl $0x0, 0x118(%rsp)
jne 0x3098
movq 0x28(%r14), %rax
testq %rax, %rax
je 0x308d
movl $0x1ff, %ecx            # imm = 0x1FF
movl 0x18(%rax), %edx
andl %ecx, %edx
cmpl $0x4, %edx
jne 0x3098
movq 0x30(%rax), %rax
testq %rax, %rax
jne 0x307a
movq %rbx, %rdi
movq %r14, %rsi
callq 0x38dd
cmpl $0x0, 0x18(%r14)
jne 0x30a7
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 0x3062
movq %rbx, %rdi
movq %r15, %rsi
callq 0x38ac
movq 0x30(%r15), %r15
jmp 0x30c4