// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/png/crc32.c
// Function: crc32
unsigned long ZEXPORT crc32(crc, buf, len)
    unsigned long crc;
    const unsigned char FAR *buf;
    uInt len;
{
    if (buf == Z_NULL) return 0UL;

#ifdef DYNAMIC_CRC_TABLE
    if (crc_table_empty)
        make_crc_table();
#endif /* DYNAMIC_CRC_TABLE */

#ifdef BYFOUR
    if (sizeof(void *) == sizeof(ptrdiff_t)) {
        u4 endian;

        endian = 1;
        if (*((unsigned char *)(&endian)))
            return crc32_little(crc, buf, len);
        else
            return crc32_big(crc, buf, len);
    }
#endif /* BYFOUR */
    crc = crc ^ 0xffffffffUL;
    while (len >= 8) {
        DO8;
        len -= 8;
    }
    if (len) do {
        DO1;
    } while (--len);
    return crc ^ 0xffffffffUL;
}

// Assembly:
testq %rsi, %rsi
je 0x925b8
notl %edi
testl %edx, %edx
sete %al
testb $0x3, %sil
sete %cl
orb %al, %cl
leaq 0x1ace0(%rip), %rcx     # 0xad010
jne 0x92363
leaq 0x1(%rsi), %rax
movl %edx, %r8d
movb (%rsi), %dl
xorb %dil, %dl
incq %rsi
movzbl %dl, %edx
shrl $0x8, %edi
xorl (%rcx,%rdx,8), %edi
leal -0x1(%r8), %edx
cmpl $0x1, %r8d
je 0x92363
movl %eax, %r8d
andl $0x3, %r8d
incq %rax
testq %r8, %r8
jne 0x92336
cmpl $0x20, %edx
jb 0x92562
movl $0xff, %eax
movl $0x7f8, %r8d            # imm = 0x7F8
xorl (%rsi), %edi
movl %edi, %r10d
andl %eax, %r10d
movl %edi, %r9d
shrl $0x8, %r9d
andl %eax, %r9d
movl 0x1000(%rcx,%r9,8), %r9d
xorl 0x1800(%rcx,%r10,8), %r9d
movl %edi, %r10d
shrl $0xd, %r10d
andl %r8d, %r10d
xorl 0x800(%r10,%rcx), %r9d
shrl $0x18, %edi
xorl (%rcx,%rdi,8), %r9d
xorl 0x4(%rsi), %r9d
movl %r9d, %r10d
andl %eax, %r10d
movl %r9d, %edi
shrl $0x8, %edi
andl %eax, %edi
movl 0x1000(%rcx,%rdi,8), %edi
xorl 0x1800(%rcx,%r10,8), %edi
movl %r9d, %r10d
shrl $0xd, %r10d
andl %r8d, %r10d
xorl 0x800(%r10,%rcx), %edi
shrl $0x18, %r9d
xorl (%rcx,%r9,8), %edi
xorl 0x8(%rsi), %edi
movl %edi, %r10d
andl %eax, %r10d
movl %edi, %r9d
shrl $0x8, %r9d
andl %eax, %r9d
movl 0x1000(%rcx,%r9,8), %r9d
xorl 0x1800(%rcx,%r10,8), %r9d
movl %edi, %r10d
shrl $0xd, %r10d
andl %r8d, %r10d
xorl 0x800(%r10,%rcx), %r9d
shrl $0x18, %edi
xorl (%rcx,%rdi,8), %r9d
xorl 0xc(%rsi), %r9d
movl %r9d, %r10d
andl %eax, %r10d
movl %r9d, %edi
shrl $0x8, %edi
andl %eax, %edi
movl 0x1000(%rcx,%rdi,8), %edi
xorl 0x1800(%rcx,%r10,8), %edi
movl %r9d, %r10d
shrl $0xd, %r10d
andl %r8d, %r10d
xorl 0x800(%r10,%rcx), %edi
shrl $0x18, %r9d
xorl (%rcx,%r9,8), %edi
xorl 0x10(%rsi), %edi
movl %edi, %r10d
andl %eax, %r10d
movl %edi, %r9d
shrl $0x8, %r9d
andl %eax, %r9d
movl 0x1000(%rcx,%r9,8), %r9d
xorl 0x1800(%rcx,%r10,8), %r9d
movl %edi, %r10d
shrl $0xd, %r10d
andl %r8d, %r10d
xorl 0x800(%r10,%rcx), %r9d
shrl $0x18, %edi
xorl (%rcx,%rdi,8), %r9d
xorl 0x14(%rsi), %r9d
movl %r9d, %r10d
andl %eax, %r10d
movl %r9d, %edi
shrl $0x8, %edi
andl %eax, %edi
movl 0x1000(%rcx,%rdi,8), %edi
xorl 0x1800(%rcx,%r10,8), %edi
movl %r9d, %r10d
shrl $0xd, %r10d
andl %r8d, %r10d
xorl 0x800(%r10,%rcx), %edi
shrl $0x18, %r9d
xorl (%rcx,%r9,8), %edi
xorl 0x18(%rsi), %edi
movl %edi, %r10d
andl %eax, %r10d
movl %edi, %r9d
shrl $0x8, %r9d
andl %eax, %r9d
movl 0x1000(%rcx,%r9,8), %r9d
xorl 0x1800(%rcx,%r10,8), %r9d
movl %edi, %r10d
shrl $0xd, %r10d
andl %r8d, %r10d
xorl 0x800(%r10,%rcx), %r9d
shrl $0x18, %edi
xorl (%rcx,%rdi,8), %r9d
xorl 0x1c(%rsi), %r9d
addq $0x20, %rsi
movl %r9d, %r10d
andl %eax, %r10d
movl %r9d, %edi
shrl $0x8, %edi
andl %eax, %edi
movl 0x1000(%rcx,%rdi,8), %edi
xorl 0x1800(%rcx,%r10,8), %edi
movl %r9d, %r10d
shrl $0xd, %r10d
andl %r8d, %r10d
xorl 0x800(%r10,%rcx), %edi
shrl $0x18, %r9d
xorl (%rcx,%r9,8), %edi
addl $-0x20, %edx
cmpl $0x1f, %edx
ja 0x92377
cmpl $0x4, %edx
jb 0x925bb
movl $0xff, %r8d
xorl (%rsi), %edi
movl %edi, %r9d
andl %r8d, %r9d
movl %edi, %eax
shrl $0x8, %eax
andl %r8d, %eax
movl 0x1000(%rcx,%rax,8), %eax
xorl 0x1800(%rcx,%r9,8), %eax
movl %edi, %r9d
shrl $0xd, %r9d
andl $0x7f8, %r9d            # imm = 0x7F8
xorl 0x800(%r9,%rcx), %eax
shrl $0x18, %edi
xorl (%rcx,%rdi,8), %eax
addq $0x4, %rsi
addl $-0x4, %edx
movl %eax, %edi
cmpl $0x3, %edx
ja 0x9256d
jmp 0x925bd
xorl %eax, %eax
retq
movl %edi, %eax
testl %edx, %edx
je 0x925de
movl %edx, %edx
xorl %edi, %edi
movb (%rsi,%rdi), %r8b
xorb %al, %r8b
movzbl %r8b, %r8d
shrl $0x8, %eax
xorl (%rcx,%r8,8), %eax
incq %rdi
cmpl %edi, %edx
jne 0x925c5
notl %eax
retq