// File: /workspace/github_c_makefile_star2_O0/AlxHnr[P]nano-backup/src/backup.c
// Function: equalsToStoredFile
static bool equalsToStoredFile(const PathNode *node, StringView repo_path,
                               const struct stat stats)
{
  const RegularFileInfo *file_info =
    &node->history->state.metadata.file_info;
  const size_t blocksize = stats.st_blksize;

  FileStream *stream = sFopenRead(node->path);

  io_buffer = CR_EnsureCapacity(io_buffer, sSizeMul(blocksize, 2));

  RepoReader *repo_stream =
    repoReaderOpenFile(repo_path, node->path, file_info);
  unsigned char *repo_buffer = &io_buffer[blocksize];

  uint64_t bytes_left = file_info->size;
  bool files_equal = true;
  while(bytes_left > 0 && files_equal)
  {
    const size_t bytes_to_read =
      bytes_left > blocksize ? blocksize : bytes_left;

    sFread(io_buffer, bytes_to_read, stream);
    repoReaderRead(repo_buffer, bytes_to_read, repo_stream);

    files_equal = memcmp(io_buffer, repo_buffer, bytes_to_read) == 0;

    bytes_left -= bytes_to_read;
  }

  repoReaderClose(repo_stream);

  const bool stream_not_at_end = sFbytesLeft(stream);
  sFclose(stream);

  if(bytes_left == 0 && stream_not_at_end)
  {
    die("file has changed while comparing to backup: \"" PRI_STR "\"",
        STR_FMT(node->path));
  }

  return files_equal;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
leaq 0x28(%rbp), %rax
leaq 0x10(%rbp), %rcx
movq %rcx, -0x58(%rbp)
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rcx
movq 0x20(%rcx), %rcx
addq $0x8, %rcx
addq $0x10, %rcx
movq %rcx, -0x10(%rbp)
movq 0x38(%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x8(%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 0xbad0
movq %rax, -0x20(%rbp)
movq 0x24e84(%rip), %rax     # 0x29288
movq %rax, -0x60(%rbp)
movq -0x18(%rbp), %rdi
movl $0x2, %esi
callq 0xb930
movq -0x60(%rbp), %rdi
movq %rax, %rsi
callq 0x22ab0
movq -0x58(%rbp), %rcx
movq %rax, 0x24e5b(%rip)     # 0x29288
movq -0x8(%rbp), %rax
movq -0x10(%rbp), %rdi
movq (%rcx), %rdx
movq %rdx, (%rsp)
movq 0x8(%rcx), %rdx
movq %rdx, 0x8(%rsp)
movq 0x10(%rcx), %rcx
movq %rcx, 0x10(%rsp)
movq (%rax), %rcx
movq %rcx, 0x18(%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x20(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x28(%rsp)
callq 0x9c20
movq %rax, -0x28(%rbp)
movq 0x24e10(%rip), %rax     # 0x29288
addq -0x18(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x38(%rbp)
movb $0x1, -0x39(%rbp)
xorl %eax, %eax
cmpq $0x0, -0x38(%rbp)
movb %al, -0x61(%rbp)
jbe 0x44a2
movb -0x39(%rbp), %al
movb %al, -0x61(%rbp)
movb -0x61(%rbp), %al
testb $0x1, %al
jne 0x44ab
jmp 0x4527
movq -0x38(%rbp), %rax
cmpq -0x18(%rbp), %rax
jbe 0x44bf
movq -0x18(%rbp), %rax
movq %rax, -0x70(%rbp)
jmp 0x44c7
movq -0x38(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rax
movq %rax, -0x48(%rbp)
movq 0x24db2(%rip), %rdi     # 0x29288
movq -0x48(%rbp), %rsi
movq -0x20(%rbp), %rdx
callq 0xbdc0
movq -0x30(%rbp), %rdi
movq -0x48(%rbp), %rsi
movq -0x28(%rbp), %rdx
callq 0x9d20
movq 0x24d8d(%rip), %rdi     # 0x29288
movq -0x30(%rbp), %rsi
movq -0x48(%rbp), %rdx
callq 0x2200
cmpl $0x0, %eax
sete %al
andb $0x1, %al
movb %al, -0x39(%rbp)
movq -0x48(%rbp), %rcx
movq -0x38(%rbp), %rax
subq %rcx, %rax
movq %rax, -0x38(%rbp)
jmp 0x4490
movq -0x28(%rbp), %rdi
callq 0x9e30
movq -0x20(%rbp), %rdi
callq 0xc410
andb $0x1, %al
movb %al, -0x49(%rbp)
movq -0x20(%rbp), %rdi
callq 0xc020
cmpq $0x0, -0x38(%rbp)
jne 0x4573
testb $0x1, -0x49(%rbp)
je 0x4573
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movl %eax, %esi
movq -0x8(%rbp), %rax
movq (%rax), %rdx
leaq 0x1fb91(%rip), %rdi     # 0x240fd
movb $0x0, %al
callq 0x4680
movb -0x39(%rbp), %al
andb $0x1, %al
addq $0xa0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nopl (%rax,%rax)