// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x220, %rsp            # imm = 0x220
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movq -0x28(%rbp), %rsi
leaq -0xf0(%rbp), %rdi
callq 0xe840
cmpl $0x10, -0xf0(%rbp)
je 0x2baa
cmpl $0x20, -0xf0(%rbp)
je 0x2baa
cmpl $0x8, -0xf0(%rbp)
jne 0x2bb8
movl -0xf0(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x2faf
movq -0x18(%rbp), %rax
movq 0x40(%rax), %rdi
leaq -0xf0(%rbp), %rax
addq $0x8, %rax
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
callq 0xfb50
movq %rax, -0xf8(%rbp)
cmpq $0x0, -0xf8(%rbp)
jne 0x2d3f
movq -0x18(%rbp), %rax
movq (%rax), %rdi
movl $0x38, %esi
callq 0x230e0
movq %rax, -0xf8(%rbp)
movq -0xf8(%rbp), %rax
movq %rax, -0x150(%rbp)
leaq -0xf0(%rbp), %rax
addq $0x8, %rax
movq -0x10(%rbp), %rcx
movq (%rcx), %rsi
leaq -0x110(%rbp), %rdi
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
callq 0xf270
movq -0x150(%rbp), %rdi
leaq -0x110(%rbp), %rax
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
callq 0xf240
movq -0xf8(%rbp), %rax
movl $0x2, 0x18(%rax)
movl -0xc8(%rbp), %ecx
movq -0xf8(%rbp), %rax
movl %ecx, 0x1c(%rax)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x140(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x148(%rbp)
movq %rsp, %rdi
movl $0x18, %ecx
leaq -0xf0(%rbp), %rsi
rep  movsq (%rsi), %es:(%rdi)
movq -0x148(%rbp), %rsi
movq -0x140(%rbp), %rdi
callq 0x3270
movq %rax, %rcx
movq -0xf8(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0xf8(%rbp), %rax
movq $0x0, 0x28(%rax)
movq -0x20(%rbp), %rax
movq (%rax), %rcx
movq -0xf8(%rbp), %rax
movq %rcx, 0x30(%rax)
movq -0xf8(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
movq -0x18(%rbp), %rax
movq 0x38(%rax), %rdi
movl $0x1, %esi
callq 0xb8f0
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x38(%rax)
jmp 0x2d81
movq -0x10(%rbp), %rax
movq %rax, -0x158(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x160(%rbp)
movq -0xf8(%rbp), %rdx
movq %rsp, %rdi
movl $0x18, %ecx
leaq -0xf0(%rbp), %rsi
rep  movsq (%rsi), %es:(%rdi)
movq -0x160(%rbp), %rsi
movq -0x158(%rbp), %rdi
callq 0x3320
cmpl $0x4, -0xf0(%rbp)
jne 0x2db5
jmp 0x2d8c
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0xf8(%rbp), %rdx
addq $0x28, %rdx
movq -0x28(%rbp), %rcx
movq -0x30(%rbp), %r8
callq 0x2b60
cmpl $0x10, %eax
je 0x2db3
jmp 0x2d8c
jmp 0x2db5
movq -0xf8(%rbp), %rax
movl 0x18(%rax), %eax
andl $0x1ff, %eax            # imm = 0x1FF
cmpl $0x9, %eax
je 0x2de1
movq -0xf8(%rbp), %rax
movl 0x18(%rax), %eax
andl $0x1ff, %eax            # imm = 0x1FF
cmpl $0xa, %eax
jne 0x2e8c
cmpl $0x0, -0xc8(%rbp)
je 0x2df3
cmpl $0x3, -0xc8(%rbp)
jne 0x2e45
movq -0xf8(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x118(%rbp)
cmpq $0x0, -0x118(%rbp)
je 0x2e43
movq -0x18(%rbp), %rdi
movq -0x118(%rbp), %rsi
cmpl $0x3, -0xc8(%rbp)
sete %al
movzbl %al, %edx
andl $0x1, %edx
callq 0x3540
movq -0x118(%rbp), %rax
movq 0x30(%rax), %rax
movq %rax, -0x118(%rbp)
jmp 0x2e05
jmp 0x2e87
movq -0xf8(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x120(%rbp)
cmpq $0x0, -0x120(%rbp)
je 0x2e85
movq -0x18(%rbp), %rdi
movq -0x120(%rbp), %rsi
callq 0x3680
movq -0x120(%rbp), %rax
movq 0x30(%rax), %rax
movq %rax, -0x120(%rbp)
jmp 0x2e57
jmp 0x2e87
jmp 0x2f11
cmpl $0x3, -0xc8(%rbp)
jne 0x2eea
movq -0xf8(%rbp), %rax
movq 0x20(%rax), %rax
cmpl $0x1, 0x8(%rax)
jne 0x2eea
movq -0xf8(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x128(%rbp)
cmpq $0x0, -0x128(%rbp)
je 0x2ee8
movq -0x18(%rbp), %rdi
movq -0x128(%rbp), %rsi
xorl %edx, %edx
callq 0x3540
movq -0x128(%rbp), %rax
movq 0x30(%rax), %rax
movq %rax, -0x128(%rbp)
jmp 0x2eb8
jmp 0x2f0f
movq -0x18(%rbp), %rdi
movq -0xd0(%rbp), %rsi
movl -0xc8(%rbp), %edx
movq -0xf8(%rbp), %rax
movq 0x28(%rax), %rcx
movq -0x30(%rbp), %r8
callq 0x2fc0
jmp 0x2f11
cmpl $0x0, -0xc8(%rbp)
jne 0x2f8b
movb $0x0, -0x129(%rbp)
movq -0xf8(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x138(%rbp)
cmpq $0x0, -0x138(%rbp)
je 0x2f70
movq -0x138(%rbp), %rax
movl 0x18(%rax), %eax
andl $0x1ff, %eax            # imm = 0x1FF
cmpl $0x4, %eax
je 0x2f5a
movb $0x1, -0x129(%rbp)
jmp 0x2f70
jmp 0x2f5c
movq -0x138(%rbp), %rax
movq 0x30(%rax), %rax
movq %rax, -0x138(%rbp)
jmp 0x2f33
testb $0x1, -0x129(%rbp)
jne 0x2f89
movq -0x18(%rbp), %rdi
movq -0xf8(%rbp), %rsi
callq 0x36e0
jmp 0x2f8b
movq -0xf8(%rbp), %rax
cmpl $0x0, 0x18(%rax)
jne 0x2fa6
movq -0xf8(%rbp), %rax
movl $0x1, 0x18(%rax)
movl -0xf0(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x220, %rsp            # imm = 0x220
popq %rbp
retq
nopl (%rax,%rax)