// File: donfreiday[P]gb/./imgui/imgui.cpp
// Function: ImHash(void const*, int, unsigned int)
ImU32 ImHash(const void* data, int data_size, ImU32 seed)
{
    static ImU32 crc32_lut[256] = { 0 };
    if (!crc32_lut[1])
    {
        const ImU32 polynomial = 0xEDB88320;
        for (ImU32 i = 0; i < 256; i++)
        {
            ImU32 crc = i;
            for (ImU32 j = 0; j < 8; j++)
                crc = (crc >> 1) ^ (ImU32(-int(crc & 1)) & polynomial);
            crc32_lut[i] = crc;
        }
    }

    seed = ~seed;
    ImU32 crc = seed;
    const unsigned char* current = (const unsigned char*)data;

    if (data_size > 0)
    {
        // Known size
        while (data_size--)
            crc = (crc >> 8) ^ crc32_lut[(crc & 0xFF) ^ *current++];
    }
    else
    {
        // Zero-terminated string
        while (unsigned char c = *current++)
        {
            // We support a syntax of "label###id" where only "###id" is included in the hash, and only "label" gets displayed.
            // Because this syntax is rarely used we are optimizing for the common case.
            // - If we reach ### in the string we discard the hash so far and reset to the seed.
            // - We don't do 'current += 2; continue;' after handling ### to keep the code smaller.
            if (c == '#' && current[0] == '#' && current[1] == '#')
                crc = seed;

            crc = (crc >> 8) ^ crc32_lut[(crc & 0xFF) ^ c];
        }
    }
    return ~crc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
cmpl $0x0, 0x799bf(%rip)     # 0x830b4
jne 0x9765
movl $0xedb88320, -0x14(%rbp) # imm = 0xEDB88320
movl $0x0, -0x18(%rbp)
cmpl $0x100, -0x18(%rbp)     # imm = 0x100
jae 0x9763
movl -0x18(%rbp), %eax
movl %eax, -0x1c(%rbp)
movl $0x0, -0x20(%rbp)
cmpl $0x8, -0x20(%rbp)
jae 0x9746
movl -0x1c(%rbp), %eax
shrl %eax
movl -0x1c(%rbp), %edx
andl $0x1, %edx
xorl %ecx, %ecx
subl %edx, %ecx
andl $0xedb88320, %ecx       # imm = 0xEDB88320
xorl %ecx, %eax
movl %eax, -0x1c(%rbp)
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x971b
movl -0x1c(%rbp), %edx
movl -0x18(%rbp), %eax
movl %eax, %ecx
leaq 0x7995b(%rip), %rax     # 0x830b0
movl %edx, (%rax,%rcx,4)
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x9705
jmp 0x9765
movl -0x10(%rbp), %eax
xorl $-0x1, %eax
movl %eax, -0x10(%rbp)
movl -0x10(%rbp), %eax
movl %eax, -0x24(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x30(%rbp)
cmpl $0x0, -0xc(%rbp)
jle 0x97cc
jmp 0x9784
movl -0xc(%rbp), %eax
movl %eax, %ecx
addl $-0x1, %ecx
movl %ecx, -0xc(%rbp)
cmpl $0x0, %eax
je 0x97ca
movl -0x24(%rbp), %eax
shrl $0x8, %eax
movl -0x24(%rbp), %ecx
andl $0xff, %ecx
movq -0x30(%rbp), %rdx
movq %rdx, %rsi
addq $0x1, %rsi
movq %rsi, -0x30(%rbp)
movzbl (%rdx), %edx
xorl %edx, %ecx
movl %ecx, %ecx
movl %ecx, %edx
leaq 0x798ee(%rip), %rcx     # 0x830b0
xorl (%rcx,%rdx,4), %eax
movl %eax, -0x24(%rbp)
jmp 0x9784
jmp 0x983a
jmp 0x97ce
movq -0x30(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x30(%rbp)
movb (%rax), %al
movb %al, -0x31(%rbp)
cmpb $0x0, -0x31(%rbp)
je 0x9838
movzbl -0x31(%rbp), %eax
cmpl $0x23, %eax
jne 0x9810
movq -0x30(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x23, %eax
jne 0x9810
movq -0x30(%rbp), %rax
movzbl 0x1(%rax), %eax
cmpl $0x23, %eax
jne 0x9810
movl -0x10(%rbp), %eax
movl %eax, -0x24(%rbp)
movl -0x24(%rbp), %eax
shrl $0x8, %eax
movl -0x24(%rbp), %ecx
andl $0xff, %ecx
movzbl -0x31(%rbp), %edx
xorl %edx, %ecx
movl %ecx, %ecx
movl %ecx, %edx
leaq 0x79880(%rip), %rcx     # 0x830b0
xorl (%rcx,%rdx,4), %eax
movl %eax, -0x24(%rbp)
jmp 0x97ce
jmp 0x983a
movl -0x24(%rbp), %eax
xorl $-0x1, %eax
popq %rbp
retq
nopw %cs:(%rax,%rax)