// File: /workspace/github_c_makefile_star2_O0/AlxHnr[P]nano-backup/src/metadata.c
// Function: writePathHistoryList
static void writePathHistoryList(const PathHistory *starting_point,
                                 RepoWriter *writer)
{
  size_t history_length = 0;
  for(const PathHistory *point = starting_point; point != NULL;
      point = point->next)
  {
    history_length = sSizeAdd(history_length, 1);
  }

  write64(history_length, writer);
  for(const PathHistory *point = starting_point; point != NULL;
      point = point->next)
  {
    write64(point->backup->id, writer);
    write8(point->state.type, writer);

    if(point->state.type != PST_non_existing)
    {
      write32(point->state.uid, writer);
      write32(point->state.gid, writer);
    }

    if(point->state.type == PST_regular_file)
    {
      write32(point->state.metadata.file_info.permission_bits, writer);
      write64(point->state.metadata.file_info.modification_time, writer);
      write64(point->state.metadata.file_info.size, writer);

      if(point->state.metadata.file_info.size > FILE_HASH_SIZE)
      {
        repoWriterWrite(point->state.metadata.file_info.hash,
                        FILE_HASH_SIZE, writer);
        write8(point->state.metadata.file_info.slot, writer);
      }
      else if(point->state.metadata.file_info.size > 0)
      {
        repoWriterWrite(point->state.metadata.file_info.hash,
                        point->state.metadata.file_info.size, writer);
      }
    }
    else if(point->state.type == PST_symlink)
    {
      StringView target_path = point->state.metadata.symlink_target;
      write64(target_path.length, writer);
      repoWriterWrite(target_path.content, target_path.length, writer);
    }
    else if(point->state.type == PST_directory)
    {
      write32(point->state.metadata.directory_info.permission_bits,
              writer);
      write64(point->state.metadata.directory_info.modification_time,
              writer);
    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq $0x0, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x7877
movq -0x18(%rbp), %rdi
movl $0x1, %esi
callq 0xb8f0
movq %rax, -0x18(%rbp)
movq -0x20(%rbp), %rax
movq 0x48(%rax), %rax
movq %rax, -0x20(%rbp)
jmp 0x7850
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x77f0
movq -0x8(%rbp), %rax
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0x7a1d
movq -0x28(%rbp), %rax
movq (%rax), %rax
movq (%rax), %rdi
movq -0x10(%rbp), %rsi
callq 0x77f0
movq -0x28(%rbp), %rax
movl 0x8(%rax), %eax
movq -0x10(%rbp), %rsi
movzbl %al, %edi
callq 0x8410
movq -0x28(%rbp), %rax
cmpl $0x0, 0x8(%rax)
je 0x78e7
movq -0x28(%rbp), %rax
movl 0xc(%rax), %edi
movq -0x10(%rbp), %rsi
callq 0x8440
movq -0x28(%rbp), %rax
movl 0x10(%rax), %edi
movq -0x10(%rbp), %rsi
callq 0x8440
movq -0x28(%rbp), %rax
cmpl $0x1, 0x8(%rax)
jne 0x7995
movq -0x28(%rbp), %rax
movl 0x18(%rax), %edi
movq -0x10(%rbp), %rsi
callq 0x8440
movq -0x28(%rbp), %rax
movq 0x20(%rax), %rdi
movq -0x10(%rbp), %rsi
callq 0x77f0
movq -0x28(%rbp), %rax
movq 0x28(%rax), %rdi
movq -0x10(%rbp), %rsi
callq 0x77f0
movq -0x28(%rbp), %rax
cmpq $0x14, 0x28(%rax)
jbe 0x7965
movq -0x28(%rbp), %rdi
addq $0x8, %rdi
addq $0x10, %rdi
addq $0x18, %rdi
movq -0x10(%rbp), %rdx
movl $0x14, %esi
callq 0xa0d0
movq -0x28(%rbp), %rax
movb 0x44(%rax), %al
movq -0x10(%rbp), %rsi
movzbl %al, %edi
callq 0x8410
jmp 0x7993
movq -0x28(%rbp), %rax
cmpq $0x0, 0x28(%rax)
jbe 0x7991
movq -0x28(%rbp), %rdi
addq $0x8, %rdi
addq $0x10, %rdi
addq $0x18, %rdi
movq -0x28(%rbp), %rax
movq 0x28(%rax), %rsi
movq -0x10(%rbp), %rdx
callq 0xa0d0
jmp 0x7993
jmp 0x7a0a
movq -0x28(%rbp), %rax
cmpl $0x2, 0x8(%rax)
jne 0x79db
movq -0x28(%rbp), %rax
movq 0x18(%rax), %rcx
movq %rcx, -0x40(%rbp)
movq 0x20(%rax), %rcx
movq %rcx, -0x38(%rbp)
movq 0x28(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x38(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x77f0
movq -0x40(%rbp), %rdi
movq -0x38(%rbp), %rsi
movq -0x10(%rbp), %rdx
callq 0xa0d0
jmp 0x7a08
movq -0x28(%rbp), %rax
cmpl $0x3, 0x8(%rax)
jne 0x7a06
movq -0x28(%rbp), %rax
movl 0x18(%rax), %edi
movq -0x10(%rbp), %rsi
callq 0x8440
movq -0x28(%rbp), %rax
movq 0x20(%rax), %rdi
movq -0x10(%rbp), %rsi
callq 0x77f0
jmp 0x7a08
jmp 0x7a0a
jmp 0x7a0c
movq -0x28(%rbp), %rax
movq 0x48(%rax), %rax
movq %rax, -0x28(%rbp)
jmp 0x788c
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)