// File: /workspace/github_cpp_makefile_star2_O2/amadvance[P]tommyds/check.c
// Function: test_hash
void test_hash(void)
{
	unsigned i;
	unsigned char buffer[16];
	unsigned COUNT = 1024*1024*16;
	tommy_uint32_t hash32;
	tommy_uint64_t hash64;

	START("hash_test_vectors");

	for(i=0;HASH32[i].data;++i) {
		if (tommy_hash_u32(0xa766795d, HASH32[i].data, HASH32[i].len) != HASH32[i].hash)
			/* LCOV_EXCL_START */
			abort();
			/* LCOV_EXCL_STOP */
	}

	for(i=0;STRHASH32[i].data;++i) {
		if (tommy_strhash_u32(0xa766795d, STRHASH32[i].data) != STRHASH32[i].hash)
			/* LCOV_EXCL_START */
			abort();
			/* LCOV_EXCL_STOP */
	}

	for(i=0;HASH64[i].data;++i) {
		if (tommy_hash_u64(0x2f022773a766795dULL, HASH64[i].data, HASH64[i].len) != HASH64[i].hash)
			/* LCOV_EXCL_START */
			abort();
			/* LCOV_EXCL_STOP */
	}

	for(i=0;INTHASH32[i].value || !i;++i) {
		if (tommy_inthash_u32(INTHASH32[i].value) != INTHASH32[i].hash)
			/* LCOV_EXCL_START */
			abort();
			/* LCOV_EXCL_STOP */
	}

	for(i=0;INTHASH64[i].value || !i;++i) {
		if (tommy_inthash_u64(INTHASH64[i].value) != INTHASH64[i].hash)
			/* LCOV_EXCL_START */
			abort();
			/* LCOV_EXCL_STOP */
	}

	STOP();

	memset(buffer, 0xAA, sizeof(buffer));
	buffer[sizeof(buffer) - 1] = 0;

	hash32 = 0;
	hash64 = 0;

	START("hash_u32");

	for(i=0;i<COUNT;++i) {
		hash32 = tommy_hash_u32(hash32, buffer, sizeof(buffer));
	}

	STOP();

	START("strhash_u32");

	for(i=0;i<COUNT;++i) {
		hash32 = tommy_strhash_u32(hash32, buffer);
	}

	STOP();

	START("hash_u64");

	for(i=0;i<COUNT;++i) {
		hash64 = tommy_hash_u64(hash64, buffer, sizeof(buffer));
	}

	STOP();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
leaq 0x4e57(%rip), %rdi      # 0x616f
callq 0x127d
xorl %ebx, %ebx
leaq 0x8d4a(%rip), %r14      # 0xa070
movl %ebx, %r15d
shlq $0x4, %r15
movq (%r15,%r14), %rsi
testq %rsi, %rsi
je 0x1354
addq %r14, %r15
movl 0x8(%r15), %edx
movl $0xa766795d, %edi       # imm = 0xA766795D
callq 0x31e4
incl %ebx
cmpl 0xc(%r15), %eax
je 0x1326
jmp 0x146d
xorl %ebp, %ebp
movl $0x80000001, %r14d      # imm = 0x80000001
leaq 0x8e8d(%rip), %r15      # 0xa1f0
leaq 0x2766795c(%r14), %rbx
movl %ebp, %r12d
shlq $0x4, %r12
movq (%r12,%r15), %rsi
testq %rsi, %rsi
je 0x1393
addq %r15, %r12
movq %rbx, %rdi
callq 0x3449
incl %ebp
cmpl 0x8(%r12), %eax
je 0x136a
jmp 0x146d
xorl %ebp, %ebp
leaq 0x8fd4(%rip), %r15      # 0xa370
movabsq $0x2f022773a766795d, %rbx # imm = 0x2F022773A766795D
movl %ebp, %eax
imulq $0x18, %rax, %r12
movq (%r12,%r15), %rsi
testq %rsi, %rsi
je 0x13d3
addq %r15, %r12
movl 0x8(%r12), %edx
movq %rbx, %rdi
callq 0x3301
incl %ebp
cmpq 0x10(%r12), %rax
je 0x13a6
jmp 0x146d
xorl %ecx, %ecx
leaq 0x91d4(%rip), %rbx      # 0xa5b0
movl %ecx, %r15d
movl (%rbx,%r15,8), %edi
testl %edi, %edi
setne %al
testl %ecx, %ecx
sete %cl
orb %al, %cl
je 0x1403
callq 0x1529
leal 0x1(%r15), %ecx
cmpl 0x4(%rbx,%r15,8), %eax
je 0x13dc
jmp 0x146d
xorl %eax, %eax
leaq 0x93b4(%rip), %rcx      # 0xa7c0
movl %eax, %edx
shlq $0x4, %rdx
movq (%rdx,%rcx), %rsi
testq %rsi, %rsi
sete %dil
testl %eax, %eax
setne %r8b
testb %dil, %r8b
jne 0x1472
addq %rcx, %rdx
movq %rsi, %rdi
notq %rdi
shlq $0x15, %rsi
addq %rdi, %rsi
movq %rsi, %rdi
shrq $0x18, %rdi
xorq %rsi, %rdi
imulq $0x109, %rdi, %rsi      # imm = 0x109
movq %rsi, %rdi
shrq $0xe, %rdi
xorq %rsi, %rdi
imulq $0x15, %rdi, %rsi
movq %rsi, %rdi
shrq $0x1c, %rdi
xorq %rsi, %rdi
imulq %r14, %rdi
incl %eax
cmpq 0x8(%rdx), %rdi
je 0x140c
callq 0x1040
callq 0x12cf
movaps 0x4b92(%rip), %xmm0     # 0x6010
movq %rsp, %r14
movaps %xmm0, (%r14)
movb $0x0, 0xf(%r14)
leaq 0x4cf3(%rip), %rdi      # 0x6184
callq 0x127d
xorl %ebx, %ebx
movl $0x1000000, %ebp        # imm = 0x1000000
pushq $0x10
popq %r15
subl $0x1, %ebp
jb 0x14b7
movl %ebx, %edi
movq %r14, %rsi
movq %r15, %rdx
callq 0x31e4
movl %eax, %ebx
jmp 0x14a1
callq 0x12cf
leaq 0x4cbe(%rip), %rdi      # 0x6181
callq 0x127d
movl $0x1000000, %ebp        # imm = 0x1000000
movq %rsp, %r14
subl $0x1, %ebp
jb 0x14e3
movl %ebx, %edi
movq %r14, %rsi
callq 0x3449
movl %eax, %ebx
jmp 0x14d0
callq 0x12cf
leaq 0x4c9e(%rip), %rdi      # 0x618d
callq 0x127d
movl $0x1000000, %ebp        # imm = 0x1000000
xorl %eax, %eax
movq %rsp, %rbx
pushq $0x10
popq %r14
subl $0x1, %ebp
jb 0x1517
movq %rax, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x3301
jmp 0x1502
callq 0x12cf
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq