// File: /workspace/github_c_makefile_star2_O3/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 0xd89c
movq %rax, %rbx
movq 0x120(%rsp), %rax
movq %rax, 0x40(%rsp)
movaps 0x110(%rsp), %xmm0
movaps %xmm0, 0x30(%rsp)
movq %rbx, %rdi
callq 0xaf98
movq %rax, %r13
movq %rax, 0x48(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x50(%rsp)
movq %r12, 0x60(%rsp)
movq %r15, 0x68(%rsp)
leaq 0xa208(%rip), %rsi      # 0xe1e2
leaq 0xc0(%rsp), %r15
movq %r15, %rdi
callq 0xab5c
movq 0x10(%r15), %rax
movq %rax, 0x10(%rsp)
movups (%r15), %xmm0
movups %xmm0, (%rsp)
movl $0x1, %esi
movq %r13, %rdi
callq 0xb043
movq 0x48(%rsp), %r15
leaq 0xa1d5(%rip), %rsi      # 0xe1e9
leaq 0xa8(%rsp), %r12
movq %r12, %rdi
callq 0xab5c
movq 0x10(%r12), %rax
movq %rax, 0x10(%rsp)
movups (%r12), %xmm0
movups %xmm0, (%rsp)
movl $0x1, %esi
movq %r15, %rdi
callq 0xb043
movq 0x48(%rsp), %r15
leaq 0xa1a2(%rip), %rsi      # 0xe1f2
leaq 0x90(%rsp), %r12
movq %r12, %rdi
callq 0xab5c
movq 0x10(%r12), %rax
movq %rax, 0x10(%rsp)
movups (%r12), %xmm0
movups %xmm0, (%rsp)
movl $0x1, %esi
movq %r15, %rdi
callq 0xb043
movq %rbx, %rdi
callq 0x2828
movq 0x48(%rsp), %rsi
movq 0x48(%r14), %rdx
movq %rax, %rdi
callq 0x4189
movq 0x120(%rsp), %rax
movq %rax, 0x10(%rsp)
movaps 0x110(%rsp), %xmm0
movups %xmm0, (%rsp)
callq 0x8c32
movq %rax, %r14
leaq 0x18(%rsp), %r15
movq %r15, %rdi
movq %rax, %rsi
callq 0x8d47
movq 0x10(%r15), %rax
movq %rax, 0x10(%rsp)
movups (%r15), %xmm0
movups %xmm0, (%rsp)
callq 0xad4c
testb %al, %al
jne 0x415d
leaq 0x1af(%rip), %r15       # 0x429a
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 0x9465
movq %r13, %rdi
movq %r14, %rsi
callq 0x8d47
movq 0x88(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x78(%rsp), %xmm0
movups %xmm0, (%rsp)
movq %rbp, %rdi
callq 0xac25
movq 0x28(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x18(%rsp), %xmm0
movups %xmm0, (%rsp)
callq 0xad4c
testb %al, %al
je 0x40fa
movq %r14, %rdi
callq 0x8e13
movq %rbx, %rdi
callq 0xda8a
movq 0x50(%rsp), %rax
movq 0x58(%rsp), %rdx
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq