// File: /workspace/github_c_makefile_star2_O2/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, %r12
movq %rsi, %r13
movq %rdi, %r15
callq 0xd040
movq %rax, %rbx
movq 0x120(%rsp), %rax
leaq 0x50(%rsp), %r14
movq %rax, 0x10(%r14)
movaps 0x110(%rsp), %xmm0
movaps %xmm0, (%r14)
movq %rbx, %rdi
callq 0xa764
movq %rax, %rbp
movq %rax, 0x18(%r14)
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%r14)
movq %r13, 0x30(%r14)
movq %r12, 0x38(%r14)
leaq 0xa5b0(%rip), %rsi      # 0xe1e2
leaq 0xc0(%rsp), %r12
movq %r12, %rdi
callq 0xa3d0
movq 0x10(%r12), %rax
movq %rax, 0x10(%rsp)
movups (%r12), %xmm0
movups %xmm0, (%rsp)
pushq $0x1
popq %r12
movq %rbp, %rdi
movq %r12, %rsi
callq 0xa7f2
movq 0x18(%r14), %r13
leaq 0xa57a(%rip), %rsi      # 0xe1e9
leaq 0xa8(%rsp), %rbp
movq %rbp, %rdi
callq 0xa3d0
movq 0x10(%rbp), %rax
movq %rax, 0x10(%rsp)
movups (%rbp), %xmm0
movups %xmm0, (%rsp)
movq %r13, %rdi
movq %r12, %rsi
callq 0xa7f2
movq 0x18(%r14), %r13
leaq 0xa54c(%rip), %rsi      # 0xe1f2
leaq 0x90(%rsp), %rbp
movq %rbp, %rdi
callq 0xa3d0
movq 0x10(%rbp), %rax
movq %rax, 0x10(%rsp)
movups (%rbp), %xmm0
movups %xmm0, (%rsp)
movq %r13, %rdi
movq %r12, %rsi
callq 0xa7f2
movq %rbx, %rdi
callq 0x2578
movq 0x18(%r14), %rsi
movq 0x48(%r15), %rdx
movq %rax, %rdi
callq 0x3db5
movq 0x120(%rsp), %rax
movq %rax, 0x10(%rsp)
movaps 0x110(%rsp), %xmm0
movups %xmm0, (%rsp)
callq 0x8602
movq %rax, %r15
leaq 0x20(%rsp), %r12
movq %r12, %rdi
movq %rax, %rsi
callq 0x86e8
leaq 0x1a2(%rip), %r13       # 0x3ec4
leaq 0x38(%rsp), %rbp
movq 0x30(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x20(%rsp), %xmm0
movups %xmm0, (%rsp)
callq 0xa55a
testb %al, %al
jne 0x3d89
movq 0x30(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x20(%rsp), %xmm0
movups %xmm0, (%rsp)
movq %r13, %rdi
movq %r14, %rsi
callq 0x8d78
movq %rbp, %rdi
movq %r15, %rsi
callq 0x86e8
movq 0x48(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x38(%rsp), %xmm0
movups %xmm0, (%rsp)
movq %r12, %rdi
callq 0xa454
jmp 0x3d27
movq %r15, %rdi
callq 0x87b1
movq %rbx, %rdi
callq 0xd21a
movq 0x70(%rsp), %rax
movq 0x78(%rsp), %rdx
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq