// File: /workspace/github_c_makefile_star2_O0/AlxHnr[P]nano-backup/src/metadata.c
// Function: readPathHistory
static PathHistory *readPathHistory(Allocator *region_wrapper,
                                    const FileContent content,
                                    size_t *reader_position,
                                    StringView metadata_path,
                                    Metadata *metadata)
{
  PathHistory *point = allocate(region_wrapper, sizeof *point);

  const size_t id = readSize(content, reader_position, metadata_path);
  if(id >= metadata->backup_history_length)
  {
    die("backup id is out of range in \"" PRI_STR "\"",
        STR_FMT(metadata_path));
  }

  point->backup = &metadata->backup_history[id];
  point->backup->ref_count = sSizeAdd(point->backup->ref_count, 1);

  point->state.type = read8(content, reader_position, metadata_path);

  if(point->state.type != PST_non_existing)
  {
    point->state.uid = read32(content, reader_position, metadata_path);
    point->state.gid = read32(content, reader_position, metadata_path);
  }

  if(point->state.type == PST_regular_file)
  {
    point->state.metadata.file_info.permission_bits =
      read32(content, reader_position, metadata_path);

    point->state.metadata.file_info.modification_time =
      readTime(content, reader_position, metadata_path);

    point->state.metadata.file_info.size =
      read64(content, reader_position, metadata_path);

    if(point->state.metadata.file_info.size > FILE_HASH_SIZE)
    {
      readBytes(content, reader_position,
                point->state.metadata.file_info.hash, FILE_HASH_SIZE,
                metadata_path);
      point->state.metadata.file_info.slot =
        read8(content, reader_position, metadata_path);
    }
    else if(point->state.metadata.file_info.size > 0)
    {
      readBytes(content, reader_position,
                point->state.metadata.file_info.hash,
                point->state.metadata.file_info.size, metadata_path);
    }
  }
  else if(point->state.type == PST_symlink)
  {
    const size_t target_length =
      readSize(content, reader_position, metadata_path);

    char *buffer = allocate(region_wrapper, sSizeAdd(target_length, 1));

    readBytes(content, reader_position, (uint8_t *)buffer, target_length,
              metadata_path);

    buffer[target_length] = '\0';

    strSet(&point->state.metadata.symlink_target, str(buffer));
  }
  else if(point->state.type == PST_directory)
  {
    point->state.metadata.directory_info.permission_bits =
      read32(content, reader_position, metadata_path);
    point->state.metadata.directory_info.modification_time =
      readTime(content, reader_position, metadata_path);
  }
  else if(point->state.type != PST_non_existing)
  {
    die("invalid PathStateType in \"" PRI_STR "\"",
        STR_FMT(metadata_path));
  }

  point->next = NULL;
  return point;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
leaq 0x10(%rbp), %rax
movq %rax, -0x68(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x8(%rbp)
movq %rdi, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq -0x18(%rbp), %rdi
movl $0x50, %esi
callq 0x24c0
movq %rax, %rcx
movq -0x68(%rbp), %rax
movq %rcx, -0x30(%rbp)
movq -0x20(%rbp), %rdx
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rsi
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
callq 0x7000
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movq -0x28(%rbp), %rcx
cmpq 0x20(%rcx), %rax
jb 0x7dd7
movq -0x68(%rbp), %rax
movq 0x8(%rax), %rcx
movl %ecx, %esi
movq (%rax), %rdx
leaq 0x1c736(%rip), %rdi     # 0x24506
movb $0x0, %al
callq 0x4680
movq -0x28(%rbp), %rax
movq 0x28(%rax), %rcx
imulq $0x18, -0x38(%rbp), %rax
addq %rax, %rcx
movq -0x30(%rbp), %rax
movq %rcx, (%rax)
movq -0x30(%rbp), %rax
movq (%rax), %rax
movq 0x10(%rax), %rdi
movl $0x1, %esi
callq 0xb8f0
movq %rax, %rdx
movq -0x68(%rbp), %rax
movq -0x30(%rbp), %rcx
movq (%rcx), %rcx
movq %rdx, 0x10(%rcx)
movq -0x20(%rbp), %rdx
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rsi
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
callq 0x8210
movzbl %al, %ecx
movq -0x30(%rbp), %rax
movl %ecx, 0x8(%rax)
movq -0x30(%rbp), %rax
cmpl $0x0, 0x8(%rax)
je 0x7ec1
movq -0x68(%rbp), %rax
movq -0x20(%rbp), %rdx
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rsi
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
callq 0x8290
movl %eax, %edx
movq -0x68(%rbp), %rax
movq -0x30(%rbp), %rcx
movl %edx, 0xc(%rcx)
movq -0x20(%rbp), %rdx
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rsi
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
callq 0x8290
movl %eax, %ecx
movq -0x30(%rbp), %rax
movl %ecx, 0x10(%rax)
movq -0x30(%rbp), %rax
cmpl $0x1, 0x8(%rax)
jne 0x8058
movq -0x68(%rbp), %rax
movq -0x20(%rbp), %rdx
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rsi
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
callq 0x8290
movl %eax, %edx
movq -0x68(%rbp), %rax
movq -0x30(%rbp), %rcx
movl %edx, 0x18(%rcx)
movq -0x20(%rbp), %rdx
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rsi
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
callq 0x7080
movq %rax, %rdx
movq -0x68(%rbp), %rax
movq -0x30(%rbp), %rcx
movq %rdx, 0x20(%rcx)
movq -0x20(%rbp), %rdx
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rsi
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
callq 0x7b70
movq %rax, %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x28(%rax)
movq -0x30(%rbp), %rax
cmpq $0x14, 0x28(%rax)
jbe 0x8000
movq -0x68(%rbp), %rax
movq -0x20(%rbp), %rdx
movq -0x30(%rbp), %rcx
addq $0x8, %rcx
addq $0x10, %rcx
addq $0x18, %rcx
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rsi
movl $0x14, %r8d
movq (%rax), %r9
movq %r9, (%rsp)
movq 0x8(%rax), %r9
movq %r9, 0x8(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
callq 0x8310
movq -0x68(%rbp), %rax
movq -0x20(%rbp), %rdx
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rsi
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
callq 0x8210
movb %al, %cl
movq -0x30(%rbp), %rax
movb %cl, 0x44(%rax)
jmp 0x8053
movq -0x30(%rbp), %rax
cmpq $0x0, 0x28(%rax)
jbe 0x8051
movq -0x68(%rbp), %rax
movq -0x20(%rbp), %rdx
movq -0x30(%rbp), %rcx
addq $0x8, %rcx
addq $0x10, %rcx
addq $0x18, %rcx
movq -0x30(%rbp), %rsi
movq 0x28(%rsi), %r8
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rsi
movq (%rax), %r9
movq %r9, (%rsp)
movq 0x8(%rax), %r9
movq %r9, 0x8(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
callq 0x8310
jmp 0x8053
jmp 0x81f2
movq -0x30(%rbp), %rax
cmpl $0x2, 0x8(%rax)
jne 0x814b
movq -0x68(%rbp), %rax
movq -0x20(%rbp), %rdx
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rsi
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
callq 0x7000
movq %rax, -0x40(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x40(%rbp), %rdi
movl $0x1, %esi
callq 0xb8f0
movq -0x78(%rbp), %rdi
movq %rax, %rsi
callq 0x24c0
movq %rax, %rcx
movq -0x68(%rbp), %rax
movq %rcx, -0x48(%rbp)
movq -0x20(%rbp), %rdx
movq -0x48(%rbp), %rcx
movq -0x40(%rbp), %r8
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rsi
movq (%rax), %r9
movq %r9, (%rsp)
movq 0x8(%rax), %r9
movq %r9, 0x8(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
callq 0x8310
movq -0x48(%rbp), %rax
movq -0x40(%rbp), %rcx
movb $0x0, (%rax,%rcx)
movq -0x30(%rbp), %rax
addq $0x8, %rax
addq $0x10, %rax
movq %rax, -0x70(%rbp)
movq -0x48(%rbp), %rsi
leaq -0x60(%rbp), %rdi
callq 0xf100
movq -0x70(%rbp), %rdi
leaq -0x60(%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 0xf240
jmp 0x81f0
movq -0x30(%rbp), %rax
cmpl $0x3, 0x8(%rax)
jne 0x81c7
movq -0x68(%rbp), %rax
movq -0x20(%rbp), %rdx
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rsi
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
callq 0x8290
movl %eax, %edx
movq -0x68(%rbp), %rax
movq -0x30(%rbp), %rcx
movl %edx, 0x18(%rcx)
movq -0x20(%rbp), %rdx
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rsi
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
callq 0x7080
movq %rax, %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x20(%rax)
jmp 0x81ee
movq -0x30(%rbp), %rax
cmpl $0x0, 0x8(%rax)
je 0x81ec
movq -0x68(%rbp), %rax
movq 0x8(%rax), %rcx
movl %ecx, %esi
movq (%rax), %rdx
leaq 0x1c345(%rip), %rdi     # 0x2452a
movb $0x0, %al
callq 0x4680
jmp 0x81ee
jmp 0x81f0
jmp 0x81f2
movq -0x30(%rbp), %rax
movq $0x0, 0x48(%rax)
movq -0x30(%rbp), %rax
addq $0x90, %rsp
popq %rbp
retq
nopl (%rax,%rax)