// File: /workspace/github_c_makefile_star2_O1/AlxHnr[P]nano-backup/src/garbage-collector.c
// Function: collectGarbageProgress
GCStatistics collectGarbageProgress(const Metadata *metadata,
                                    StringView repo_path,
                                    GCProgressCallback progress_callback,
                                    void *callback_user_data)
{
  CR_Region *r = CR_RegionNew();

  GCContext ctx = {
    .repo_path = repo_path,
    .paths_to_preserve = strTableNew(r),
    .progress_callback = progress_callback,
    .callback_user_data = callback_user_data,
  };
  strTableMap(ctx.paths_to_preserve, str("config"), (void *)0x1);
  strTableMap(ctx.paths_to_preserve, str("metadata"), (void *)0x1);
  strTableMap(ctx.paths_to_preserve, str("lockfile"), (void *)0x1);
  populateTableRecursively(allocatorWrapRegion(r), ctx.paths_to_preserve,
                           metadata->paths);

  DirIterator *dir = sDirOpen(repo_path);
  for(StringView subpath = sDirGetNext(dir); !strIsEmpty(subpath);
      strSet(&subpath, sDirGetNext(dir)))
  {
    sRemoveRecursivelyIf(subpath, shouldBeRemoved, &ctx);
  }
  sDirClose(dir);

  CR_RegionRelease(r);
  return ctx.statistics;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd8, %rsp
movq %rdx, %r15
movq %rsi, %r12
movq %rdi, %r14
callq 0xdc7c
movq %rax, %rbx
movq 0x120(%rsp), %rax
movq %rax, 0x40(%rsp)
movaps 0x110(%rsp), %xmm0
movaps %xmm0, 0x30(%rsp)
movq %rbx, %rdi
callq 0xb374
movq %rax, %r13
movq %rax, 0x48(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x50(%rsp)
movq %r12, 0x60(%rsp)
movq %r15, 0x68(%rsp)
leaq 0xa0ec(%rip), %rsi      # 0xe1e2
leaq 0xc0(%rsp), %r15
movq %r15, %rdi
callq 0xaf28
movq 0x10(%r15), %rax
movq %rax, 0x10(%rsp)
movups (%r15), %xmm0
movups %xmm0, (%rsp)
movl $0x1, %esi
movq %r13, %rdi
callq 0xb41f
movq 0x48(%rsp), %r15
leaq 0xa0b9(%rip), %rsi      # 0xe1e9
leaq 0xa8(%rsp), %r12
movq %r12, %rdi
callq 0xaf28
movq 0x10(%r12), %rax
movq %rax, 0x10(%rsp)
movups (%r12), %xmm0
movups %xmm0, (%rsp)
movl $0x1, %esi
movq %r15, %rdi
callq 0xb41f
movq 0x48(%rsp), %r15
leaq 0xa086(%rip), %rsi      # 0xe1f2
leaq 0x90(%rsp), %r12
movq %r12, %rdi
callq 0xaf28
movq 0x10(%r12), %rax
movq %rax, 0x10(%rsp)
movups (%r12), %xmm0
movups %xmm0, (%rsp)
movl $0x1, %esi
movq %r15, %rdi
callq 0xb41f
movq %rbx, %rdi
callq 0x28cc
movq 0x48(%rsp), %rsi
movq 0x48(%r14), %rdx
movq %rax, %rdi
callq 0x42a5
movq 0x120(%rsp), %rax
movq %rax, 0x10(%rsp)
movaps 0x110(%rsp), %xmm0
movups %xmm0, (%rsp)
callq 0x8df2
movq %rax, %r14
leaq 0x18(%rsp), %r15
movq %r15, %rdi
movq %rax, %rsi
callq 0x8f07
movq 0x10(%r15), %rax
movq %rax, 0x10(%rsp)
movups (%r15), %xmm0
movups %xmm0, (%rsp)
callq 0xb11c
testb %al, %al
jne 0x4279
leaq 0x1af(%rip), %r15       # 0x43b6
leaq 0x30(%rsp), %r12
leaq 0x78(%rsp), %r13
leaq 0x18(%rsp), %rbp
movq 0x28(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x18(%rsp), %xmm0
movups %xmm0, (%rsp)
movq %r15, %rdi
movq %r12, %rsi
callq 0x9752
movq %r13, %rdi
movq %r14, %rsi
callq 0x8f07
movq 0x88(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x78(%rsp), %xmm0
movups %xmm0, (%rsp)
movq %rbp, %rdi
callq 0xaff1
movq 0x28(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x18(%rsp), %xmm0
movups %xmm0, (%rsp)
callq 0xb11c
testb %al, %al
je 0x4216
movq %r14, %rdi
callq 0x8fe1
movq %rbx, %rdi
callq 0xde6a
movq 0x50(%rsp), %rax
movq 0x58(%rsp), %rdx
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq