// File: /workspace/github_c_makefile_star2_O3/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 0x28b7
movl 0x20(%r15), %ecx
cmpl %ecx, 0x8(%r14)
jne 0x28bb
jmp 0x28cf
movl 0x20(%r15), %ecx
movl 0x18(%rbx), %edx
andl $-0x20, %edx
orl $0x10, %edx
movl %edx, 0x18(%rbx)
movl %eax, 0x4(%r14)
movl %ecx, 0x8(%r14)
movl (%r14), %eax
cmpl $0x3, %eax
je 0x2a5a
cmpl $0x2, %eax
je 0x298f
cmpl $0x1, %eax
jne 0x2b2f
movl 0x18(%r15), %eax
cmpl %eax, 0x10(%r14)
je 0x2907
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 0x2921
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 0x2a97
testb $0x40, %cl
sete %al
testq %r12, %r12
sete %cl
orb %al, %cl
jne 0x2b2f
cmpq $0x15, %r12
jb 0x2aaf
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 0x3e50
movl $0x14, %r12d
jmp 0x2af1
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 0x9101
movq 0x8(%r13), %rax
cmpq 0x30(%r15), %rax
jne 0x2b41
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 0xad56
testb %al, %al
jne 0x2b2f
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 0xac37
movq 0x10(%r15), %rax
movq %rax, 0x10(%rsp)
movups (%r15), %xmm0
movups %xmm0, (%rsp)
movq %r14, %rdi
callq 0xac25
movl $0xffffff70, %eax       # imm = 0xFFFFFF70
andl 0x18(%rbx), %eax
orl $0x80, %eax
movl %eax, 0x18(%rbx)
jmp 0x2b2f
movl 0x18(%r15), %eax
cmpl %eax, 0x10(%r14)
je 0x2a74
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 0x2b2f
movl 0x18(%rbx), %ecx
andl $-0x50, %ecx
orl $0x40, %ecx
movl %ecx, 0x18(%rbx)
movq %rax, 0x18(%r14)
jmp 0x2b2f
andl $0xffffff70, %ecx       # imm = 0xFFFFFF70
orl $0x80, %ecx
movl %ecx, 0x18(%rbx)
movq %rax, 0x20(%r14)
jmp 0x2b2f
movq 0x10(%rbx), %rax
movq %rax, 0x10(%rsp)
movups (%rbx), %xmm0
movups %xmm0, (%rsp)
callq 0x8833
movq %rax, %r15
leaq 0xb0(%rsp), %rdi
movq %r12, %rsi
movq %rax, %rdx
callq 0x8a20
movq %r15, %rdi
callq 0x8e4a
movl %eax, %ebp
movq %r15, %rdi
callq 0x8bc9
testb %bpl, %bpl
jne 0x2b55
addq $0x28, %r14
leaq 0xb0(%rsp), %rsi
movq %r14, %rdi
movq %r12, %rdx
callq 0x2320
testl %eax, %eax
je 0x2b2f
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 0xb4fd(%rip), %rdi      # 0xe04b
xorl %eax, %eax
callq 0x3ca8
movl 0x8(%rbx), %esi
movq (%rbx), %rdx
leaq 0xb50f(%rip), %rdi      # 0xe071
jmp 0x2b4e