// File: /workspace/github_c_makefile_star2_O0/aremmell[P]libsir/src/sirfilecache.c
// Function: sir_fcache_pred_path
bool _sir_fcache_pred_path(const void* match, const sirfile* iter) {
    const char* path = (const char*)match;
    bool equal       = false;

    _sir_selflog("comparing '%s' == '%s'", path, iter->path);

#if !defined(__WIN__)
    /* if we're able to stat both files then we can use that information for the
     * comparison. otherwise, fall back on comparing the canonical path strings
     * returned by realpath. */
    char resolved1[SIR_MAXPATH] = {0};
    char resolved2[SIR_MAXPATH] = {0};
    struct stat st1             = {0};
    struct stat st2             = {0};

    const char* real1 = realpath(path, resolved1);
    const char* real2 = realpath(iter->path, resolved2);

    SIR_UNUSED(real1);
    SIR_UNUSED(real2);

    if ((!stat(resolved1, &st1) && !stat(resolved2, &st2)) ||
        (!stat(path, &st1) && !stat(iter->path, &st2))) {
        equal = st1.st_dev == st2.st_dev && st1.st_ino == st2.st_ino;
        _sir_selflog("returning %d for '%s' == '%s'", equal, path, iter->path);
    } else {
        _sir_selflog("falling back to canonical path string compare");
        equal = 0 == strncmp(resolved1, resolved2, SIR_MAXPATH);
        _sir_selflog("returning %d for '%s' == '%s'", equal, resolved1, resolved2);
    }

    return equal;
#else /* __WIN__ */
    /* open both files (only if they already exist) and compare their
     * filesystem info. failing that, fall back on conversion to canonical path
     * and string comparison. */
    DWORD sh_flags   = FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE;
    DWORD open_type  = OPEN_EXISTING;
    DWORD attr_flags = FILE_ATTRIBUTE_NORMAL;
    BY_HANDLE_FILE_INFORMATION fi1 = {0};
    BY_HANDLE_FILE_INFORMATION fi2 = {0};

    HANDLE h1 = CreateFileA(path, 0, sh_flags, NULL, open_type, attr_flags, NULL);
    HANDLE h2 = CreateFileA(iter->path,0, sh_flags, NULL, open_type, attr_flags, NULL);

    if (INVALID_HANDLE_VALUE != h1 && INVALID_HANDLE_VALUE != h2 &&
        GetFileInformationByHandle(h1, &fi1) && GetFileInformationByHandle(h2, &fi2)) {
        equal = fi1.dwVolumeSerialNumber == fi2.dwVolumeSerialNumber &&
                fi1.nFileIndexLow        == fi2.nFileIndexLow        &&
                fi1.nFileIndexHigh       == fi2.nFileIndexHigh;
        _sir_selflog("returning %d for '%s' == '%s'", equal, path, iter->path);
    } else {
        _sir_selflog("falling back to canonical path string compare");
        char resolved1[SIR_MAXPATH] = {0}, resolved2[SIR_MAXPATH] = {0};
        if (GetFullPathNameA(path, SIR_MAXPATH, resolved1, NULL) &&
            GetFullPathNameA(iter->path, SIR_MAXPATH, resolved2, NULL))
            equal = 0 == StrCmpIA(resolved1, resolved2);
        _sir_selflog("returning %d for '%s' == '%s'", equal, resolved1, resolved2);
    }

    if (INVALID_HANDLE_VALUE != h1)
        CloseHandle(h1);

    if (INVALID_HANDLE_VALUE != h2)
        CloseHandle(h2);

    return equal;
#endif
}

// Assembly:
subq $0x2168, %rsp           # imm = 0x2168
movq %rdi, 0x2160(%rsp)
movq %rsi, 0x2158(%rsp)
movq 0x2160(%rsp), %rax
movq %rax, 0x2150(%rsp)
movb $0x0, 0x214f(%rsp)
movq 0x2150(%rsp), %rsi
movq 0x2158(%rsp), %rax
movq (%rax), %rdx
leaq 0xa862(%rip), %rdi      # 0x10cbb
movb $0x0, %al
callq 0x5ff0
leaq 0x1140(%rsp), %rdi
xorl %esi, %esi
movl $0x1000, %edx           # imm = 0x1000
callq 0x21c0
leaq 0x140(%rsp), %rdi
xorl %esi, %esi
movl $0x1000, %edx           # imm = 0x1000
callq 0x21c0
leaq 0xb0(%rsp), %rdi
xorl %esi, %esi
movl $0x90, %edx
callq 0x21c0
leaq 0x20(%rsp), %rdi
xorl %esi, %esi
movl $0x90, %edx
callq 0x21c0
movq 0x2150(%rsp), %rdi
leaq 0x1140(%rsp), %rsi
callq 0x2290
movq %rax, 0x18(%rsp)
movq 0x2158(%rsp), %rax
movq (%rax), %rdi
leaq 0x140(%rsp), %rsi
callq 0x2290
movq %rax, 0x10(%rsp)
leaq 0x1140(%rsp), %rdi
leaq 0xb0(%rsp), %rsi
callq 0x2270
cmpl $0x0, %eax
jne 0x6515
leaq 0x140(%rsp), %rdi
leaq 0x20(%rsp), %rsi
callq 0x2270
cmpl $0x0, %eax
je 0x6549
movq 0x2150(%rsp), %rdi
leaq 0xb0(%rsp), %rsi
callq 0x2270
cmpl $0x0, %eax
jne 0x65ae
movq 0x2158(%rsp), %rax
movq (%rax), %rdi
leaq 0x20(%rsp), %rsi
callq 0x2270
cmpl $0x0, %eax
jne 0x65ae
movq 0xb0(%rsp), %rcx
xorl %eax, %eax
cmpq 0x20(%rsp), %rcx
movb %al, 0xf(%rsp)
jne 0x6572
movq 0xb8(%rsp), %rax
cmpq 0x28(%rsp), %rax
sete %al
movb %al, 0xf(%rsp)
movb 0xf(%rsp), %al
andb $0x1, %al
movb %al, 0x214f(%rsp)
movb 0x214f(%rsp), %al
andb $0x1, %al
movzbl %al, %esi
movq 0x2150(%rsp), %rdx
movq 0x2158(%rsp), %rax
movq (%rax), %rcx
leaq 0xa72d(%rip), %rdi      # 0x10cd2
movb $0x0, %al
callq 0x5ff0
jmp 0x6612
leaq 0xa73b(%rip), %rdi      # 0x10cf0
movb $0x0, %al
callq 0x5ff0
leaq 0x1140(%rsp), %rdi
leaq 0x140(%rsp), %rsi
movl $0x1000, %edx           # imm = 0x1000
callq 0x2090
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
sete %al
andb $0x1, %al
movb %al, 0x214f(%rsp)
movb 0x214f(%rsp), %al
andb $0x1, %al
movzbl %al, %esi
leaq 0x1140(%rsp), %rdx
leaq 0x140(%rsp), %rcx
leaq 0xa6c7(%rip), %rdi      # 0x10cd2
movb $0x0, %al
callq 0x5ff0
movb 0x214f(%rsp), %al
andb $0x1, %al
addq $0x2168, %rsp           # imm = 0x2168
retq
nopw %cs:(%rax,%rax)