// File: attractivechaos[P]udb2/tommyds/./tommyhash.c
// Function: tommy_hash_u32
tommy_uint32_t tommy_hash_u32(tommy_uint32_t init_val, const void* void_key, tommy_size_t key_len)
{
	const unsigned char* key = tommy_cast(const unsigned char*, void_key);
	tommy_uint32_t a, b, c;

	a = b = c = 0xdeadbeef + ((tommy_uint32_t)key_len) + init_val;

	while (key_len > 12) {
		a += tommy_le_uint32_read(key + 0);
		b += tommy_le_uint32_read(key + 4);
		c += tommy_le_uint32_read(key + 8);

		tommy_mix(a, b, c);

		key_len -= 12;
		key += 12;
	}

	switch (key_len) {
	case 0 :
		return c; /* used only when called with a zero length */
	case 12 :
		c += tommy_le_uint32_read(key + 8);
		b += tommy_le_uint32_read(key + 4);
		a += tommy_le_uint32_read(key + 0);
		break;
	case 11 : c += ((tommy_uint32_t)key[10]) << 16;
	case 10 : c += ((tommy_uint32_t)key[9]) << 8;
	case 9 : c += key[8];
	case 8 :
		b += tommy_le_uint32_read(key + 4);
		a += tommy_le_uint32_read(key + 0);
		break;
	case 7 : b += ((tommy_uint32_t)key[6]) << 16;
	case 6 : b += ((tommy_uint32_t)key[5]) << 8;
	case 5 : b += key[4];
	case 4 :
		a += tommy_le_uint32_read(key + 0);
		break;
	case 3 : a += ((tommy_uint32_t)key[2]) << 16;
	case 2 : a += ((tommy_uint32_t)key[1]) << 8;
	case 1 : a += key[0];
	}

	tommy_final(a, b, c);

	return c;
}

// Assembly:
subq $0x38, %rsp
movl %edi, 0x30(%rsp)
movq %rsi, 0x28(%rsp)
movq %rdx, 0x20(%rsp)
movq 0x28(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0x20(%rsp), %rax
addl $0xdeadbeef, %eax       # imm = 0xDEADBEEF
addl 0x30(%rsp), %eax
movl %eax, 0xc(%rsp)
movl %eax, 0x10(%rsp)
movl %eax, 0x14(%rsp)
cmpq $0xc, 0x20(%rsp)
jbe 0x199d
movq 0x18(%rsp), %rdi
callq 0x1c20
addl 0x14(%rsp), %eax
movl %eax, 0x14(%rsp)
movq 0x18(%rsp), %rdi
addq $0x4, %rdi
callq 0x1c20
addl 0x10(%rsp), %eax
movl %eax, 0x10(%rsp)
movq 0x18(%rsp), %rdi
addq $0x8, %rdi
callq 0x1c20
addl 0xc(%rsp), %eax
movl %eax, 0xc(%rsp)
movl 0xc(%rsp), %ecx
movl 0x14(%rsp), %eax
subl %ecx, %eax
movl %eax, 0x14(%rsp)
movl 0xc(%rsp), %eax
shll $0x4, %eax
movl 0xc(%rsp), %ecx
shrl $0x1c, %ecx
orl %ecx, %eax
xorl 0x14(%rsp), %eax
movl %eax, 0x14(%rsp)
movl 0x10(%rsp), %eax
addl 0xc(%rsp), %eax
movl %eax, 0xc(%rsp)
movl 0x14(%rsp), %ecx
movl 0x10(%rsp), %eax
subl %ecx, %eax
movl %eax, 0x10(%rsp)
movl 0x14(%rsp), %eax
shll $0x6, %eax
movl 0x14(%rsp), %ecx
shrl $0x1a, %ecx
orl %ecx, %eax
xorl 0x10(%rsp), %eax
movl %eax, 0x10(%rsp)
movl 0xc(%rsp), %eax
addl 0x14(%rsp), %eax
movl %eax, 0x14(%rsp)
movl 0x10(%rsp), %ecx
movl 0xc(%rsp), %eax
subl %ecx, %eax
movl %eax, 0xc(%rsp)
movl 0x10(%rsp), %eax
shll $0x8, %eax
movl 0x10(%rsp), %ecx
shrl $0x18, %ecx
orl %ecx, %eax
xorl 0xc(%rsp), %eax
movl %eax, 0xc(%rsp)
movl 0x14(%rsp), %eax
addl 0x10(%rsp), %eax
movl %eax, 0x10(%rsp)
movl 0xc(%rsp), %ecx
movl 0x14(%rsp), %eax
subl %ecx, %eax
movl %eax, 0x14(%rsp)
movl 0xc(%rsp), %eax
shll $0x10, %eax
movl 0xc(%rsp), %ecx
shrl $0x10, %ecx
orl %ecx, %eax
xorl 0x14(%rsp), %eax
movl %eax, 0x14(%rsp)
movl 0x10(%rsp), %eax
addl 0xc(%rsp), %eax
movl %eax, 0xc(%rsp)
movl 0x14(%rsp), %ecx
movl 0x10(%rsp), %eax
subl %ecx, %eax
movl %eax, 0x10(%rsp)
movl 0x14(%rsp), %eax
shll $0x13, %eax
movl 0x14(%rsp), %ecx
shrl $0xd, %ecx
orl %ecx, %eax
xorl 0x10(%rsp), %eax
movl %eax, 0x10(%rsp)
movl 0xc(%rsp), %eax
addl 0x14(%rsp), %eax
movl %eax, 0x14(%rsp)
movl 0x10(%rsp), %ecx
movl 0xc(%rsp), %eax
subl %ecx, %eax
movl %eax, 0xc(%rsp)
movl 0x10(%rsp), %eax
shll $0x4, %eax
movl 0x10(%rsp), %ecx
shrl $0x1c, %ecx
orl %ecx, %eax
xorl 0xc(%rsp), %eax
movl %eax, 0xc(%rsp)
movl 0x14(%rsp), %eax
addl 0x10(%rsp), %eax
movl %eax, 0x10(%rsp)
movq 0x20(%rsp), %rax
subq $0xc, %rax
movq %rax, 0x20(%rsp)
movq 0x18(%rsp), %rax
addq $0xc, %rax
movq %rax, 0x18(%rsp)
jmp 0x1806
movq 0x20(%rsp), %rax
movq %rax, (%rsp)
subq $0xc, %rax
ja 0x1aff
movq (%rsp), %rax
leaq 0x56dd(%rip), %rcx      # 0x7098
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl 0xc(%rsp), %eax
movl %eax, 0x34(%rsp)
jmp 0x1c13
movq 0x18(%rsp), %rdi
addq $0x8, %rdi
callq 0x1c20
addl 0xc(%rsp), %eax
movl %eax, 0xc(%rsp)
movq 0x18(%rsp), %rdi
addq $0x4, %rdi
callq 0x1c20
addl 0x10(%rsp), %eax
movl %eax, 0x10(%rsp)
movq 0x18(%rsp), %rdi
callq 0x1c20
addl 0x14(%rsp), %eax
movl %eax, 0x14(%rsp)
jmp 0x1aff
movq 0x18(%rsp), %rax
movzbl 0xa(%rax), %eax
shll $0x10, %eax
addl 0xc(%rsp), %eax
movl %eax, 0xc(%rsp)
movq 0x18(%rsp), %rax
movzbl 0x9(%rax), %eax
shll $0x8, %eax
addl 0xc(%rsp), %eax
movl %eax, 0xc(%rsp)
movq 0x18(%rsp), %rax
movzbl 0x8(%rax), %eax
addl 0xc(%rsp), %eax
movl %eax, 0xc(%rsp)
movq 0x18(%rsp), %rdi
addq $0x4, %rdi
callq 0x1c20
addl 0x10(%rsp), %eax
movl %eax, 0x10(%rsp)
movq 0x18(%rsp), %rdi
callq 0x1c20
addl 0x14(%rsp), %eax
movl %eax, 0x14(%rsp)
jmp 0x1aff
movq 0x18(%rsp), %rax
movzbl 0x6(%rax), %eax
shll $0x10, %eax
addl 0x10(%rsp), %eax
movl %eax, 0x10(%rsp)
movq 0x18(%rsp), %rax
movzbl 0x5(%rax), %eax
shll $0x8, %eax
addl 0x10(%rsp), %eax
movl %eax, 0x10(%rsp)
movq 0x18(%rsp), %rax
movzbl 0x4(%rax), %eax
addl 0x10(%rsp), %eax
movl %eax, 0x10(%rsp)
movq 0x18(%rsp), %rdi
callq 0x1c20
addl 0x14(%rsp), %eax
movl %eax, 0x14(%rsp)
jmp 0x1aff
movq 0x18(%rsp), %rax
movzbl 0x2(%rax), %eax
shll $0x10, %eax
addl 0x14(%rsp), %eax
movl %eax, 0x14(%rsp)
movq 0x18(%rsp), %rax
movzbl 0x1(%rax), %eax
shll $0x8, %eax
addl 0x14(%rsp), %eax
movl %eax, 0x14(%rsp)
movq 0x18(%rsp), %rax
movzbl (%rax), %eax
addl 0x14(%rsp), %eax
movl %eax, 0x14(%rsp)
jmp 0x1b01
movl 0x10(%rsp), %eax
xorl 0xc(%rsp), %eax
movl %eax, 0xc(%rsp)
movl 0x10(%rsp), %ecx
shll $0xe, %ecx
movl 0x10(%rsp), %eax
shrl $0x12, %eax
orl %eax, %ecx
movl 0xc(%rsp), %eax
subl %ecx, %eax
movl %eax, 0xc(%rsp)
movl 0xc(%rsp), %eax
xorl 0x14(%rsp), %eax
movl %eax, 0x14(%rsp)
movl 0xc(%rsp), %ecx
shll $0xb, %ecx
movl 0xc(%rsp), %eax
shrl $0x15, %eax
orl %eax, %ecx
movl 0x14(%rsp), %eax
subl %ecx, %eax
movl %eax, 0x14(%rsp)
movl 0x14(%rsp), %eax
xorl 0x10(%rsp), %eax
movl %eax, 0x10(%rsp)
movl 0x14(%rsp), %ecx
shll $0x19, %ecx
movl 0x14(%rsp), %eax
shrl $0x7, %eax
orl %eax, %ecx
movl 0x10(%rsp), %eax
subl %ecx, %eax
movl %eax, 0x10(%rsp)
movl 0x10(%rsp), %eax
xorl 0xc(%rsp), %eax
movl %eax, 0xc(%rsp)
movl 0x10(%rsp), %ecx
shll $0x10, %ecx
movl 0x10(%rsp), %eax
shrl $0x10, %eax
orl %eax, %ecx
movl 0xc(%rsp), %eax
subl %ecx, %eax
movl %eax, 0xc(%rsp)
movl 0xc(%rsp), %eax
xorl 0x14(%rsp), %eax
movl %eax, 0x14(%rsp)
movl 0xc(%rsp), %ecx
shll $0x4, %ecx
movl 0xc(%rsp), %eax
shrl $0x1c, %eax
orl %eax, %ecx
movl 0x14(%rsp), %eax
subl %ecx, %eax
movl %eax, 0x14(%rsp)
movl 0x14(%rsp), %eax
xorl 0x10(%rsp), %eax
movl %eax, 0x10(%rsp)
movl 0x14(%rsp), %ecx
shll $0xe, %ecx
movl 0x14(%rsp), %eax
shrl $0x12, %eax
orl %eax, %ecx
movl 0x10(%rsp), %eax
subl %ecx, %eax
movl %eax, 0x10(%rsp)
movl 0x10(%rsp), %eax
xorl 0xc(%rsp), %eax
movl %eax, 0xc(%rsp)
movl 0x10(%rsp), %ecx
shll $0x18, %ecx
movl 0x10(%rsp), %eax
shrl $0x8, %eax
orl %eax, %ecx
movl 0xc(%rsp), %eax
subl %ecx, %eax
movl %eax, 0xc(%rsp)
movl 0xc(%rsp), %eax
movl %eax, 0x34(%rsp)
movl 0x34(%rsp), %eax
addq $0x38, %rsp
retq
nopl (%rax)