// File: tomfunkhouser[P]gaps/pkgs/png/crc32.c
// Function: crc32_little
local unsigned long crc32_little(crc, buf, len)
    unsigned long crc;
    const unsigned char FAR *buf;
    unsigned len;
{
    register u4 c;
    register const u4 FAR *buf4;

    c = (u4)crc;
    c = ~c;
    while (len && ((ptrdiff_t)buf & 3)) {
        c = crc_table[0][(c ^ *buf++) & 0xff] ^ (c >> 8);
        len--;
    }

    buf4 = (const u4 FAR *)(const void FAR *)buf;
    while (len >= 32) {
        DOLIT32;
        len -= 32;
    }
    while (len >= 4) {
        DOLIT4;
        len -= 4;
    }
    buf = (const unsigned char FAR *)buf4;

    if (len) do {
        c = crc_table[0][(c ^ *buf++) & 0xff] ^ (c >> 8);
    } while (--len);
    c = ~c;
    return (unsigned long)c;
}

// Assembly:
movq %rdi, -0x8(%rsp)
movq %rsi, -0x10(%rsp)
movl %edx, -0x14(%rsp)
movq -0x8(%rsp), %rax
movl %eax, -0x18(%rsp)
movl -0x18(%rsp), %eax
xorl $-0x1, %eax
movl %eax, -0x18(%rsp)
xorl %eax, %eax
cmpl $0x0, -0x14(%rsp)
movb %al, -0x21(%rsp)
je 0x113e53
movq -0x10(%rsp), %rax
andq $0x3, %rax
cmpq $0x0, %rax
setne %al
movb %al, -0x21(%rsp)
movb -0x21(%rsp), %al
testb $0x1, %al
jne 0x113e5d
jmp 0x113ea8
movl -0x18(%rsp), %eax
movq -0x10(%rsp), %rcx
movq %rcx, %rdx
addq $0x1, %rdx
movq %rdx, -0x10(%rsp)
movzbl (%rcx), %ecx
xorl %ecx, %eax
andl $0xff, %eax
movl %eax, %eax
movl %eax, %ecx
leaq 0x25a29(%rip), %rax     # 0x1398b0
movq (%rax,%rcx,8), %rax
movl -0x18(%rsp), %ecx
shrl $0x8, %ecx
movl %ecx, %ecx
xorq %rcx, %rax
movl %eax, -0x18(%rsp)
movl -0x14(%rsp), %eax
addl $-0x1, %eax
movl %eax, -0x14(%rsp)
jmp 0x113e32
movq -0x10(%rsp), %rax
movq %rax, -0x20(%rsp)
cmpl $0x20, -0x14(%rsp)
jb 0x114355
movq -0x20(%rsp), %rax
movq %rax, %rcx
addq $0x4, %rcx
movq %rcx, -0x20(%rsp)
movl (%rax), %eax
xorl -0x18(%rsp), %eax
movl %eax, -0x18(%rsp)
movl -0x18(%rsp), %eax
andl $0xff, %eax
movl %eax, %eax
movl %eax, %ecx
leaq 0x259c4(%rip), %rax     # 0x1398b0
movq 0x1800(%rax,%rcx,8), %rax
movl -0x18(%rsp), %ecx
shrl $0x8, %ecx
andl $0xff, %ecx
movl %ecx, %ecx
movl %ecx, %edx
leaq 0x259a4(%rip), %rcx     # 0x1398b0
xorq 0x1000(%rcx,%rdx,8), %rax
movl -0x18(%rsp), %ecx
shrl $0x10, %ecx
andl $0xff, %ecx
movl %ecx, %ecx
movl %ecx, %edx
leaq 0x25984(%rip), %rcx     # 0x1398b0
xorq 0x800(%rcx,%rdx,8), %rax
movl -0x18(%rsp), %ecx
shrl $0x18, %ecx
movl %ecx, %ecx
movl %ecx, %edx
leaq 0x2596a(%rip), %rcx     # 0x1398b0
xorq (%rcx,%rdx,8), %rax
movl %eax, -0x18(%rsp)
movq -0x20(%rsp), %rax
movq %rax, %rcx
addq $0x4, %rcx
movq %rcx, -0x20(%rsp)
movl (%rax), %eax
xorl -0x18(%rsp), %eax
movl %eax, -0x18(%rsp)
movl -0x18(%rsp), %eax
andl $0xff, %eax
movl %eax, %eax
movl %eax, %ecx
leaq 0x25933(%rip), %rax     # 0x1398b0
movq 0x1800(%rax,%rcx,8), %rax
movl -0x18(%rsp), %ecx
shrl $0x8, %ecx
andl $0xff, %ecx
movl %ecx, %ecx
movl %ecx, %edx
leaq 0x25913(%rip), %rcx     # 0x1398b0
xorq 0x1000(%rcx,%rdx,8), %rax
movl -0x18(%rsp), %ecx
shrl $0x10, %ecx
andl $0xff, %ecx
movl %ecx, %ecx
movl %ecx, %edx
leaq 0x258f3(%rip), %rcx     # 0x1398b0
xorq 0x800(%rcx,%rdx,8), %rax
movl -0x18(%rsp), %ecx
shrl $0x18, %ecx
movl %ecx, %ecx
movl %ecx, %edx
leaq 0x258d9(%rip), %rcx     # 0x1398b0
xorq (%rcx,%rdx,8), %rax
movl %eax, -0x18(%rsp)
movq -0x20(%rsp), %rax
movq %rax, %rcx
addq $0x4, %rcx
movq %rcx, -0x20(%rsp)
movl (%rax), %eax
xorl -0x18(%rsp), %eax
movl %eax, -0x18(%rsp)
movl -0x18(%rsp), %eax
andl $0xff, %eax
movl %eax, %eax
movl %eax, %ecx
leaq 0x258a2(%rip), %rax     # 0x1398b0
movq 0x1800(%rax,%rcx,8), %rax
movl -0x18(%rsp), %ecx
shrl $0x8, %ecx
andl $0xff, %ecx
movl %ecx, %ecx
movl %ecx, %edx
leaq 0x25882(%rip), %rcx     # 0x1398b0
xorq 0x1000(%rcx,%rdx,8), %rax
movl -0x18(%rsp), %ecx
shrl $0x10, %ecx
andl $0xff, %ecx
movl %ecx, %ecx
movl %ecx, %edx
leaq 0x25862(%rip), %rcx     # 0x1398b0
xorq 0x800(%rcx,%rdx,8), %rax
movl -0x18(%rsp), %ecx
shrl $0x18, %ecx
movl %ecx, %ecx
movl %ecx, %edx
leaq 0x25848(%rip), %rcx     # 0x1398b0
xorq (%rcx,%rdx,8), %rax
movl %eax, -0x18(%rsp)
movq -0x20(%rsp), %rax
movq %rax, %rcx
addq $0x4, %rcx
movq %rcx, -0x20(%rsp)
movl (%rax), %eax
xorl -0x18(%rsp), %eax
movl %eax, -0x18(%rsp)
movl -0x18(%rsp), %eax
andl $0xff, %eax
movl %eax, %eax
movl %eax, %ecx
leaq 0x25811(%rip), %rax     # 0x1398b0
movq 0x1800(%rax,%rcx,8), %rax
movl -0x18(%rsp), %ecx
shrl $0x8, %ecx
andl $0xff, %ecx
movl %ecx, %ecx
movl %ecx, %edx
leaq 0x257f1(%rip), %rcx     # 0x1398b0
xorq 0x1000(%rcx,%rdx,8), %rax
movl -0x18(%rsp), %ecx
shrl $0x10, %ecx
andl $0xff, %ecx
movl %ecx, %ecx
movl %ecx, %edx
leaq 0x257d1(%rip), %rcx     # 0x1398b0
xorq 0x800(%rcx,%rdx,8), %rax
movl -0x18(%rsp), %ecx
shrl $0x18, %ecx
movl %ecx, %ecx
movl %ecx, %edx
leaq 0x257b7(%rip), %rcx     # 0x1398b0
xorq (%rcx,%rdx,8), %rax
movl %eax, -0x18(%rsp)
movq -0x20(%rsp), %rax
movq %rax, %rcx
addq $0x4, %rcx
movq %rcx, -0x20(%rsp)
movl (%rax), %eax
xorl -0x18(%rsp), %eax
movl %eax, -0x18(%rsp)
movl -0x18(%rsp), %eax
andl $0xff, %eax
movl %eax, %eax
movl %eax, %ecx
leaq 0x25780(%rip), %rax     # 0x1398b0
movq 0x1800(%rax,%rcx,8), %rax
movl -0x18(%rsp), %ecx
shrl $0x8, %ecx
andl $0xff, %ecx
movl %ecx, %ecx
movl %ecx, %edx
leaq 0x25760(%rip), %rcx     # 0x1398b0
xorq 0x1000(%rcx,%rdx,8), %rax
movl -0x18(%rsp), %ecx
shrl $0x10, %ecx
andl $0xff, %ecx
movl %ecx, %ecx
movl %ecx, %edx
leaq 0x25740(%rip), %rcx     # 0x1398b0
xorq 0x800(%rcx,%rdx,8), %rax
movl -0x18(%rsp), %ecx
shrl $0x18, %ecx
movl %ecx, %ecx
movl %ecx, %edx
leaq 0x25726(%rip), %rcx     # 0x1398b0
xorq (%rcx,%rdx,8), %rax
movl %eax, -0x18(%rsp)
movq -0x20(%rsp), %rax
movq %rax, %rcx
addq $0x4, %rcx
movq %rcx, -0x20(%rsp)
movl (%rax), %eax
xorl -0x18(%rsp), %eax
movl %eax, -0x18(%rsp)
movl -0x18(%rsp), %eax
andl $0xff, %eax
movl %eax, %eax
movl %eax, %ecx
leaq 0x256ef(%rip), %rax     # 0x1398b0
movq 0x1800(%rax,%rcx,8), %rax
movl -0x18(%rsp), %ecx
shrl $0x8, %ecx
andl $0xff, %ecx
movl %ecx, %ecx
movl %ecx, %edx
leaq 0x256cf(%rip), %rcx     # 0x1398b0
xorq 0x1000(%rcx,%rdx,8), %rax
movl -0x18(%rsp), %ecx
shrl $0x10, %ecx
andl $0xff, %ecx
movl %ecx, %ecx
movl %ecx, %edx
leaq 0x256af(%rip), %rcx     # 0x1398b0
xorq 0x800(%rcx,%rdx,8), %rax
movl -0x18(%rsp), %ecx
shrl $0x18, %ecx
movl %ecx, %ecx
movl %ecx, %edx
leaq 0x25695(%rip), %rcx     # 0x1398b0
xorq (%rcx,%rdx,8), %rax
movl %eax, -0x18(%rsp)
movq -0x20(%rsp), %rax
movq %rax, %rcx
addq $0x4, %rcx
movq %rcx, -0x20(%rsp)
movl (%rax), %eax
xorl -0x18(%rsp), %eax
movl %eax, -0x18(%rsp)
movl -0x18(%rsp), %eax
andl $0xff, %eax
movl %eax, %eax
movl %eax, %ecx
leaq 0x2565e(%rip), %rax     # 0x1398b0
movq 0x1800(%rax,%rcx,8), %rax
movl -0x18(%rsp), %ecx
shrl $0x8, %ecx
andl $0xff, %ecx
movl %ecx, %ecx
movl %ecx, %edx
leaq 0x2563e(%rip), %rcx     # 0x1398b0
xorq 0x1000(%rcx,%rdx,8), %rax
movl -0x18(%rsp), %ecx
shrl $0x10, %ecx
andl $0xff, %ecx
movl %ecx, %ecx
movl %ecx, %edx
leaq 0x2561e(%rip), %rcx     # 0x1398b0
xorq 0x800(%rcx,%rdx,8), %rax
movl -0x18(%rsp), %ecx
shrl $0x18, %ecx
movl %ecx, %ecx
movl %ecx, %edx
leaq 0x25604(%rip), %rcx     # 0x1398b0
xorq (%rcx,%rdx,8), %rax
movl %eax, -0x18(%rsp)
movq -0x20(%rsp), %rax
movq %rax, %rcx
addq $0x4, %rcx
movq %rcx, -0x20(%rsp)
movl (%rax), %eax
xorl -0x18(%rsp), %eax
movl %eax, -0x18(%rsp)
movl -0x18(%rsp), %eax
andl $0xff, %eax
movl %eax, %eax
movl %eax, %ecx
leaq 0x255cd(%rip), %rax     # 0x1398b0
movq 0x1800(%rax,%rcx,8), %rax
movl -0x18(%rsp), %ecx
shrl $0x8, %ecx
andl $0xff, %ecx
movl %ecx, %ecx
movl %ecx, %edx
leaq 0x255ad(%rip), %rcx     # 0x1398b0
xorq 0x1000(%rcx,%rdx,8), %rax
movl -0x18(%rsp), %ecx
shrl $0x10, %ecx
andl $0xff, %ecx
movl %ecx, %ecx
movl %ecx, %edx
leaq 0x2558d(%rip), %rcx     # 0x1398b0
xorq 0x800(%rcx,%rdx,8), %rax
movl -0x18(%rsp), %ecx
shrl $0x18, %ecx
movl %ecx, %ecx
movl %ecx, %edx
leaq 0x25573(%rip), %rcx     # 0x1398b0
xorq (%rcx,%rdx,8), %rax
movl %eax, -0x18(%rsp)
movl -0x14(%rsp), %eax
subl $0x20, %eax
movl %eax, -0x14(%rsp)
jmp 0x113eb2
jmp 0x114357
cmpl $0x4, -0x14(%rsp)
jb 0x114403
movq -0x20(%rsp), %rax
movq %rax, %rcx
addq $0x4, %rcx
movq %rcx, -0x20(%rsp)
movl (%rax), %eax
xorl -0x18(%rsp), %eax
movl %eax, -0x18(%rsp)
movl -0x18(%rsp), %eax
andl $0xff, %eax
movl %eax, %eax
movl %eax, %ecx
leaq 0x2551f(%rip), %rax     # 0x1398b0
movq 0x1800(%rax,%rcx,8), %rax
movl -0x18(%rsp), %ecx
shrl $0x8, %ecx
andl $0xff, %ecx
movl %ecx, %ecx
movl %ecx, %edx
leaq 0x254ff(%rip), %rcx     # 0x1398b0
xorq 0x1000(%rcx,%rdx,8), %rax
movl -0x18(%rsp), %ecx
shrl $0x10, %ecx
andl $0xff, %ecx
movl %ecx, %ecx
movl %ecx, %edx
leaq 0x254df(%rip), %rcx     # 0x1398b0
xorq 0x800(%rcx,%rdx,8), %rax
movl -0x18(%rsp), %ecx
shrl $0x18, %ecx
movl %ecx, %ecx
movl %ecx, %edx
leaq 0x254c5(%rip), %rcx     # 0x1398b0
xorq (%rcx,%rdx,8), %rax
movl %eax, -0x18(%rsp)
movl -0x14(%rsp), %eax
subl $0x4, %eax
movl %eax, -0x14(%rsp)
jmp 0x114357
movq -0x20(%rsp), %rax
movq %rax, -0x10(%rsp)
cmpl $0x0, -0x14(%rsp)
je 0x114466
jmp 0x114416
movl -0x18(%rsp), %eax
movq -0x10(%rsp), %rcx
movq %rcx, %rdx
addq $0x1, %rdx
movq %rdx, -0x10(%rsp)
movzbl (%rcx), %ecx
xorl %ecx, %eax
andl $0xff, %eax
movl %eax, %eax
movl %eax, %ecx
leaq 0x25470(%rip), %rax     # 0x1398b0
movq (%rax,%rcx,8), %rax
movl -0x18(%rsp), %ecx
shrl $0x8, %ecx
movl %ecx, %ecx
xorq %rcx, %rax
movl %eax, -0x18(%rsp)
movl -0x14(%rsp), %eax
addl $-0x1, %eax
movl %eax, -0x14(%rsp)
cmpl $0x0, %eax
jne 0x114416
jmp 0x114466
movl -0x18(%rsp), %eax
xorl $-0x1, %eax
movl %eax, -0x18(%rsp)
movl -0x18(%rsp), %eax
retq
nopw %cs:(%rax,%rax)