// File: /workspace/github_cpp_makefile_star2_O2/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 0x84ee6
movq %rdi, %rax
notl %eax
leaq 0x190ab(%rip), %rcx     # 0x9dcf0
movq %rsi, %rdi
movl %edx, %r8d
addl $-0x1, %r8d
jae 0x84e65
movl %edi, %r9d
andl $0x3, %r9d
je 0x84e65
movb (%rsi), %dl
xorb %al, %dl
incq %rsi
movzbl %dl, %edx
shrl $0x8, %eax
xorl (%rcx,%rdx,8), %eax
incq %rdi
movl %r8d, %edx
jmp 0x84c4b
xorl (%rsi), %eax
movl $0xff, %edi
movl %eax, %r8d
andl %edi, %r8d
movl %eax, %r9d
shrl $0x8, %r9d
andl %edi, %r9d
movl 0x1000(%rcx,%r9,8), %r9d
xorl 0x1800(%rcx,%r8,8), %r9d
movl %eax, %r10d
shrl $0xd, %r10d
movl $0x7f8, %r8d            # imm = 0x7F8
andl %r8d, %r10d
xorl 0x800(%r10,%rcx), %r9d
shrl $0x18, %eax
xorl (%rcx,%rax,8), %r9d
xorl 0x4(%rsi), %r9d
movl %r9d, %r10d
andl %edi, %r10d
movl %r9d, %eax
shrl $0x8, %eax
andl %edi, %eax
movl 0x1000(%rcx,%rax,8), %eax
xorl 0x1800(%rcx,%r10,8), %eax
movl %r9d, %r10d
shrl $0xd, %r10d
andl %r8d, %r10d
xorl 0x800(%r10,%rcx), %eax
shrl $0x18, %r9d
xorl (%rcx,%r9,8), %eax
xorl 0x8(%rsi), %eax
movl %eax, %r10d
andl %edi, %r10d
movl %eax, %r9d
shrl $0x8, %r9d
andl %edi, %r9d
movl 0x1000(%rcx,%r9,8), %r9d
xorl 0x1800(%rcx,%r10,8), %r9d
movl %eax, %r10d
shrl $0xd, %r10d
andl %r8d, %r10d
xorl 0x800(%r10,%rcx), %r9d
shrl $0x18, %eax
xorl (%rcx,%rax,8), %r9d
xorl 0xc(%rsi), %r9d
movl %r9d, %r10d
andl %edi, %r10d
movl %r9d, %eax
shrl $0x8, %eax
andl %edi, %eax
movl 0x1000(%rcx,%rax,8), %eax
xorl 0x1800(%rcx,%r10,8), %eax
movl %r9d, %r10d
shrl $0xd, %r10d
andl %r8d, %r10d
xorl 0x800(%r10,%rcx), %eax
shrl $0x18, %r9d
xorl (%rcx,%r9,8), %eax
xorl 0x10(%rsi), %eax
movl %eax, %r10d
andl %edi, %r10d
movl %eax, %r9d
shrl $0x8, %r9d
andl %edi, %r9d
movl 0x1000(%rcx,%r9,8), %r9d
xorl 0x1800(%rcx,%r10,8), %r9d
movl %eax, %r10d
shrl $0xd, %r10d
andl %r8d, %r10d
xorl 0x800(%r10,%rcx), %r9d
shrl $0x18, %eax
xorl (%rcx,%rax,8), %r9d
xorl 0x14(%rsi), %r9d
movl %r9d, %r10d
andl %edi, %r10d
movl %r9d, %eax
shrl $0x8, %eax
andl %edi, %eax
movl 0x1000(%rcx,%rax,8), %eax
xorl 0x1800(%rcx,%r10,8), %eax
movl %r9d, %r10d
shrl $0xd, %r10d
andl %r8d, %r10d
xorl 0x800(%r10,%rcx), %eax
shrl $0x18, %r9d
xorl (%rcx,%r9,8), %eax
xorl 0x18(%rsi), %eax
movl %eax, %r10d
andl %edi, %r10d
movl %eax, %r9d
shrl $0x8, %r9d
andl %edi, %r9d
movl 0x1000(%rcx,%r9,8), %r9d
xorl 0x1800(%rcx,%r10,8), %r9d
movl %eax, %r10d
shrl $0xd, %r10d
andl %r8d, %r10d
xorl 0x800(%r10,%rcx), %r9d
shrl $0x18, %eax
xorl (%rcx,%rax,8), %r9d
xorl 0x1c(%rsi), %r9d
addq $0x20, %rsi
movl %r9d, %r10d
andl %edi, %r10d
movl %r9d, %eax
shrl $0x8, %eax
andl %edi, %eax
movl 0x1000(%rcx,%rax,8), %eax
xorl 0x1800(%rcx,%r10,8), %eax
movl %r9d, %edi
shrl $0xd, %edi
andl %r8d, %edi
xorl 0x800(%rdi,%rcx), %eax
shrl $0x18, %r9d
xorl (%rcx,%r9,8), %eax
addl $-0x20, %edx
cmpl $0x1f, %edx
ja 0x84c7a
movl $0xff, %edi
cmpl $0x4, %edx
jb 0x84ec3
xorl (%rsi), %eax
addq $0x4, %rsi
movl %eax, %r8d
andl %edi, %r8d
movl %eax, %r9d
shrl $0x8, %r9d
andl %edi, %r9d
movl 0x1000(%rcx,%r9,8), %r9d
xorl 0x1800(%rcx,%r8,8), %r9d
movl %eax, %r8d
shrl $0xd, %r8d
andl $0x7f8, %r8d            # imm = 0x7F8
xorl 0x800(%r8,%rcx), %r9d
shrl $0x18, %eax
xorl (%rcx,%rax,8), %r9d
addl $-0x4, %edx
movl %r9d, %eax
jmp 0x84e73
testl %edx, %edx
je 0x84ee3
xorl %edi, %edi
movb (%rsi), %r8b
xorb %al, %r8b
incq %rsi
movzbl %r8b, %r8d
shrl $0x8, %eax
xorl (%rcx,%r8,8), %eax
incl %edi
cmpl %edi, %edx
jne 0x84ec9
notl %eax
retq
xorl %eax, %eax
retq