// File: /workspace/github_c_makefile_star2_O1/AlxHnr[P]nano-backup/src/backup-helpers.c
// Function: applyNodeChanges
void applyNodeChanges(AllocatorPair *allocator_pair, PathNode *node,
                      PathState *state, const struct stat stats)
{
  if(state->uid != stats.st_uid || state->gid != stats.st_gid)
  {
    backupHintSet(node->hint, BH_owner_changed);
    state->uid = stats.st_uid;
    state->gid = stats.st_gid;
  }

  /* Path state specific change checks. */
  if(state->type == PST_regular_file)
  {
    if(state->metadata.file_info.permission_bits != stats.st_mode)
    {
      backupHintSet(node->hint, BH_permissions_changed);
      state->metadata.file_info.permission_bits = stats.st_mode;
    }

    if(state->metadata.file_info.modification_time != stats.st_mtime)
    {
      backupHintSet(node->hint, BH_timestamp_changed);
      state->metadata.file_info.modification_time = stats.st_mtime;
    }

    if(state->metadata.file_info.size != (uint64_t)stats.st_size)
    {
      backupHintSet(node->hint, BH_content_changed);
      state->metadata.file_info.size = stats.st_size;
    }
    else if((node->hint & BH_timestamp_changed) &&
            state->metadata.file_info.size > 0)
    {
      checkFileContentChanges(node, state, stats);
    }
  }
  else if(state->type == PST_symlink)
  {
    StringView target =
      sSymlinkReadTarget(node->path, allocator_pair->reusable_buffer);
    if((off_t)target.length != stats.st_size)
    {
      die("symlink changed while reading: \"" PRI_STR "\"",
          STR_FMT(node->path));
    }

    if(!strIsEqual(state->metadata.symlink_target, target))
    {
      strSet(&state->metadata.symlink_target,
             strCopy(target, allocator_pair->a));
      backupHintSet(node->hint, BH_content_changed);
    }
  }
  else if(state->type == PST_directory)
  {
    if(state->metadata.directory_info.permission_bits != stats.st_mode)
    {
      backupHintSet(node->hint, BH_permissions_changed);
      state->metadata.directory_info.permission_bits = stats.st_mode;
    }

    if(state->metadata.directory_info.modification_time != stats.st_mtime)
    {
      backupHintSet(node->hint, BH_timestamp_changed);
      state->metadata.directory_info.modification_time = stats.st_mtime;
    }
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xe8, %rsp
movq %rdx, %r14
movq %rsi, %rbx
movq %rdi, %r12
leaq 0x120(%rsp), %r15
movl 0x1c(%r15), %eax
cmpl %eax, 0x4(%rdx)
jne 0x2959
movl 0x8(%r14), %ecx
cmpl 0x20(%r15), %ecx
je 0x2971
movl 0x18(%rbx), %ecx
andl $-0x20, %ecx
orl $0x10, %ecx
movl %ecx, 0x18(%rbx)
movl %eax, 0x4(%r14)
movl 0x20(%r15), %eax
movl %eax, 0x8(%r14)
movl (%r14), %eax
cmpl $0x3, %eax
je 0x2afc
cmpl $0x2, %eax
je 0x2a31
cmpl $0x1, %eax
jne 0x2bd1
movl 0x18(%r15), %eax
cmpl %eax, 0x10(%r14)
je 0x29a9
movl 0x18(%rbx), %ecx
andl $-0x30, %ecx
orl $0x20, %ecx
movl %ecx, 0x18(%rbx)
movl %eax, 0x10(%r14)
movq 0x58(%r15), %rax
cmpq %rax, 0x18(%r14)
je 0x29c3
movl 0x18(%rbx), %ecx
andl $-0x50, %ecx
orl $0x40, %ecx
movl %ecx, 0x18(%rbx)
movq %rax, 0x18(%r14)
movq 0x20(%r14), %r12
movq 0x30(%r15), %rax
movl 0x18(%rbx), %ecx
cmpq %rax, %r12
jne 0x2b39
testb $0x40, %cl
sete %al
testq %r12, %r12
sete %cl
orb %al, %cl
jne 0x2bd1
cmpq $0x15, %r12
jb 0x2b51
leaq 0x18(%rsp), %rdi
movl $0x12, %ecx
movq %r15, %rsi
rep  movsq (%rsi), %es:(%rdi)
movq 0x10(%rbx), %rax
movq %rax, 0x10(%rsp)
movups (%rbx), %xmm0
movups %xmm0, (%rsp)
leaq 0xb0(%rsp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x3f6c
movl $0x14, %r12d
jmp 0x2b93
movq 0x8(%r12), %rsi
movq 0x10(%rbx), %rax
movq %rax, 0x10(%rsp)
movups (%rbx), %xmm0
movups %xmm0, (%rsp)
leaq 0xb0(%rsp), %r13
movq %r13, %rdi
callq 0x934a
movq 0x8(%r13), %rax
cmpq 0x30(%r15), %rax
jne 0x2be3
movq 0xc0(%rsp), %rax
movq %rax, 0x28(%rsp)
movups 0xb0(%rsp), %xmm0
movups %xmm0, 0x18(%rsp)
movq 0x20(%r14), %rax
movq %rax, 0x10(%rsp)
movups 0x10(%r14), %xmm0
movups %xmm0, (%rsp)
callq 0xb126
testb %al, %al
jne 0x2bd1
addq $0x10, %r14
movq (%r12), %rsi
movq 0xc0(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0xb0(%rsp), %xmm0
movups %xmm0, (%rsp)
leaq 0xd0(%rsp), %r15
movq %r15, %rdi
callq 0xb003
movq 0x10(%r15), %rax
movq %rax, 0x10(%rsp)
movups (%r15), %xmm0
movups %xmm0, (%rsp)
movq %r14, %rdi
callq 0xaff1
movl $0xffffff70, %eax       # imm = 0xFFFFFF70
andl 0x18(%rbx), %eax
orl $0x80, %eax
movl %eax, 0x18(%rbx)
jmp 0x2bd1
movl 0x18(%r15), %eax
cmpl %eax, 0x10(%r14)
je 0x2b16
movl 0x18(%rbx), %ecx
andl $-0x30, %ecx
orl $0x20, %ecx
movl %ecx, 0x18(%rbx)
movl %eax, 0x10(%r14)
movq 0x58(%r15), %rax
cmpq %rax, 0x18(%r14)
je 0x2bd1
movl 0x18(%rbx), %ecx
andl $-0x50, %ecx
orl $0x40, %ecx
movl %ecx, 0x18(%rbx)
movq %rax, 0x18(%r14)
jmp 0x2bd1
andl $0xffffff70, %ecx       # imm = 0xFFFFFF70
orl $0x80, %ecx
movl %ecx, 0x18(%rbx)
movq %rax, 0x20(%r14)
jmp 0x2bd1
movq 0x10(%rbx), %rax
movq %rax, 0x10(%rsp)
movups (%rbx), %xmm0
movups %xmm0, (%rsp)
callq 0x89df
movq %rax, %r15
leaq 0xb0(%rsp), %rdi
movq %r12, %rsi
movq %rax, %rdx
callq 0x8bcc
movq %r15, %rdi
callq 0x9018
movl %eax, %ebp
movq %r15, %rdi
callq 0x8d89
testb %bpl, %bpl
jne 0x2bf7
addq $0x28, %r14
leaq 0xb0(%rsp), %rsi
movq %r14, %rdi
movq %r12, %rdx
callq 0x2320
testl %eax, %eax
je 0x2bd1
movl $0xfffffe70, %eax       # imm = 0xFFFFFE70
andl 0x18(%rbx), %eax
orl $0x180, %eax            # imm = 0x180
movl %eax, 0x18(%rbx)
leaq 0xb0(%rsp), %rsi
movq %r14, %rdi
movq %r12, %rdx
callq 0x2280
addq $0xe8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl 0x8(%rbx), %esi
movq (%rbx), %rdx
leaq 0xb45b(%rip), %rdi      # 0xe04b
xorl %eax, %eax
callq 0x3dc4
movl 0x8(%rbx), %esi
movq (%rbx), %rdx
leaq 0xb46d(%rip), %rdi      # 0xe071
jmp 0x2bf0
nop