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

  FileStream *reader = sFopenRead(node->path);
  RepoWriter *writer = repoWriterOpenFile(repo_path, repo_tmp_file_path,
                                          node->path, file_info);

  io_buffer = CR_EnsureCapacity(io_buffer, blocksize);

  while(bytes_left > 0)
  {
    const size_t bytes_to_read =
      bytes_left > blocksize ? blocksize : bytes_left;

    sFread(io_buffer, bytes_to_read, reader);
    repoWriterWrite(io_buffer, bytes_to_read, writer);

    bytes_left -= bytes_to_read;
  }

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

  if(stream_not_at_end)
  {
    die("file has changed during backup: \"" PRI_STR "\"",
        STR_FMT(node->path));
  }

  repoWriterClose(writer);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
leaq 0x40(%rbp), %rax
leaq 0x28(%rbp), %rcx
movq %rcx, -0x48(%rbp)
leaq 0x10(%rbp), %rcx
movq %rcx, -0x50(%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 -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x20(%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 -0x50(%rbp), %rdx
movq -0x48(%rbp), %rcx
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rax
movq -0x10(%rbp), %rdi
movq (%rdx), %rsi
movq %rsi, (%rsp)
movq 0x8(%rdx), %rsi
movq %rsi, 0x8(%rsp)
movq 0x10(%rdx), %rdx
movq %rdx, 0x10(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x18(%rsp)
movq 0x8(%rcx), %rdx
movq %rdx, 0x20(%rsp)
movq 0x10(%rcx), %rcx
movq %rcx, 0x28(%rsp)
movq (%rax), %rcx
movq %rcx, 0x30(%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x38(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x40(%rsp)
callq 0x9e90
movq %rax, -0x30(%rbp)
movq 0x24faa(%rip), %rdi     # 0x29288
movq -0x18(%rbp), %rsi
callq 0x22ab0
movq %rax, 0x24f9a(%rip)     # 0x29288
cmpq $0x0, -0x20(%rbp)
jbe 0x4352
movq -0x20(%rbp), %rax
cmpq -0x18(%rbp), %rax
jbe 0x4309
movq -0x18(%rbp), %rax
movq %rax, -0x58(%rbp)
jmp 0x4311
movq -0x20(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rax
movq %rax, -0x38(%rbp)
movq 0x24f68(%rip), %rdi     # 0x29288
movq -0x38(%rbp), %rsi
movq -0x28(%rbp), %rdx
callq 0xbdc0
movq 0x24f54(%rip), %rdi     # 0x29288
movq -0x38(%rbp), %rsi
movq -0x30(%rbp), %rdx
callq 0xa0d0
movq -0x38(%rbp), %rcx
movq -0x20(%rbp), %rax
subq %rcx, %rax
movq %rax, -0x20(%rbp)
jmp 0x42ee
movq -0x28(%rbp), %rdi
callq 0xc410
andb $0x1, %al
movb %al, -0x39(%rbp)
movq -0x28(%rbp), %rdi
callq 0xc020
testb $0x1, -0x39(%rbp)
je 0x438e
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movl %eax, %esi
movq -0x8(%rbp), %rax
movq (%rax), %rdx
leaq 0x1fd2e(%rip), %rdi     # 0x240b5
movb $0x0, %al
callq 0x4680
movq -0x30(%rbp), %rdi
callq 0xa180
addq $0xa0, %rsp
popq %rbp
retq