// File: /workspace/github_c_makefile_star2_O2/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 0x2603
movl 0x20(%r15), %ecx
cmpl %ecx, 0x8(%r14)
jne 0x2607
jmp 0x261b
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 0x27a2
cmpl $0x2, %eax
je 0x26d7
cmpl $0x1, %eax
jne 0x2877
movl 0x18(%r15), %eax
cmpl %eax, 0x10(%r14)
je 0x2653
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 0x266d
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 0x27df
testb $0x40, %cl
sete %al
testq %r12, %r12
sete %cl
orb %al, %cl
jne 0x2877
cmpq $0x15, %r12
jb 0x27f7
leaq 0x18(%rsp), %rdi
pushq $0x12
popq %rcx
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 0x3ab0
pushq $0x14
popq %r12
jmp 0x2839
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 0x8a69
movq 0x8(%r13), %rax
cmpq 0x30(%r15), %rax
jne 0x2889
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 0xa564
testb %al, %al
jne 0x2877
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 0xa466
movq 0x10(%r15), %rax
movq %rax, 0x10(%rsp)
movups (%r15), %xmm0
movups %xmm0, (%rsp)
movq %r14, %rdi
callq 0xa454
movl $0xffffff70, %eax       # imm = 0xFFFFFF70
andl 0x18(%rbx), %eax
orl $0x80, %eax
movl %eax, 0x18(%rbx)
jmp 0x2877
movl 0x18(%r15), %eax
cmpl %eax, 0x10(%r14)
je 0x27bc
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 0x2877
movl 0x18(%rbx), %ecx
andl $-0x50, %ecx
orl $0x40, %ecx
movl %ecx, 0x18(%rbx)
movq %rax, 0x18(%r14)
jmp 0x2877
andl $0xffffff70, %ecx       # imm = 0xFFFFFF70
orl $0x80, %ecx
movl %ecx, 0x18(%rbx)
movq %rax, 0x20(%r14)
jmp 0x2877
movq 0x10(%rbx), %rax
movq %rax, 0x10(%rsp)
movups (%rbx), %xmm0
movups %xmm0, (%rsp)
callq 0x8243
movq %rax, %r15
leaq 0xb0(%rsp), %rdi
movq %r12, %rsi
movq %rax, %rdx
callq 0x8403
movq %r15, %rdi
callq 0x87e5
movl %eax, %ebp
movq %r15, %rdi
callq 0x859c
testb %bpl, %bpl
jne 0x289d
addq $0x28, %r14
leaq 0xb0(%rsp), %rsi
movq %r14, %rdi
movq %r12, %rdx
callq 0x2320
testl %eax, %eax
je 0x2877
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 0xb7b5(%rip), %rdi      # 0xe04b
xorl %eax, %eax
callq 0x3918
movl 0x8(%rbx), %esi
movq (%rbx), %rdx
leaq 0xb7c7(%rip), %rdi      # 0xe071
jmp 0x2896