// File: /workspace/github_c_makefile_star2_O2/nmmmnu[P]HM2/test_hm.c
// Function: hm_pair_test
void hm_pair_test(const int delay){
	const char *key = "aaancdefgh";
	const char *val = "1234567890";

	hm_pair_t *p1 = hm_pair_create(key, val);
#ifdef HM_PAIR_EXPIRATION
	hm_pair_t *p2 = hm_pair_createx(key, val, 1);
#endif

	hm_pair_t *p3 = hm_pair_createtombstone(key);

	PRINTF_TEST("hm_pair_t", "tombstone",	hm_pair_getval(p3) == NULL			);

	PRINTF_TEST("hm_pair_t", "cmp",		hm_pair_cmpkey(p1, key) == 0			);
	PRINTF_TEST("hm_pair_t", "cmp",		hm_pair_cmpkey(p1, "~~~ non existent") < 0	);
	PRINTF_TEST("hm_pair_t", "cmp",		hm_pair_cmpkey(p1, "!!! non existent") > 0	);

	PRINTF_TEST("hm_pair_t", "key",		strcmp(hm_pair_getkey(p1), key) == 0		);
	PRINTF_TEST("hm_pair_t", "val",		strcmp(hm_pair_getval(p1), val) == 0		);

	// these always pass
	PRINTF_TEST("hm_pair_t", "valid",	hm_pair_valid(p1, NULL)				);
	PRINTF_TEST("hm_pair_t", "checksum",	hm_pair_checksumvalid(p1)			);

#ifdef HM_PAIR_EXPIRATION
	PRINTF_TEST("hm_pair_t", "valid",	hm_pair_valid(p2, NULL)				);
	if (delay){
	printf("sleep for 1 sec...\n");
	sleep(1);
	PRINTF_TEST("hm_pair_t", "valid",	hm_pair_valid(p2, NULL) == 0			);
	}
#endif

	hm_pair_free(p1);
#ifdef HM_PAIR_EXPIRATION
	hm_pair_free(p2);
#endif
	hm_pair_free(p3);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
leaq 0xe16(%rip), %r14       # 0x2004
leaq 0xe1a(%rip), %rsi       # 0x200f
movq %r14, %rdi
callq 0x139e
movq %rax, %rbx
movq %r14, %rdi
xorl %esi, %esi
callq 0x139e
movq %rax, (%rsp)
movq %rax, %rdi
callq 0x1827
testq %rax, %rax
leaq 0xe26(%rip), %r15       # 0x2046
leaq 0xe22(%rip), %rbp       # 0x2049
movq %rbp, %rcx
cmoveq %r15, %rcx
leaq 0xde5(%rip), %r12       # 0x201a
leaq 0xdf6(%rip), %r13       # 0x2032
leaq 0xdf9(%rip), %rdx       # 0x203c
movq %r12, %rdi
movq %r13, %rsi
xorl %eax, %eax
callq 0x1050
movq %rbx, %rdi
movq %r14, %rsi
callq 0x1842
testl %eax, %eax
movq %rbp, %rcx
cmoveq %r15, %rcx
leaq 0xde3(%rip), %r14       # 0x204e
movq %r12, %rdi
movq %r13, %rsi
movq %r14, %rdx
xorl %eax, %eax
callq 0x1050
leaq 0xdd0(%rip), %rsi       # 0x2052
movq %rbx, %rdi
callq 0x1842
testl %eax, %eax
movq %rbp, %rcx
cmovsq %r15, %rcx
movq %r12, %rdi
movq %r13, %rsi
movq %r14, %rdx
xorl %eax, %eax
callq 0x1050
leaq 0xdb9(%rip), %rsi       # 0x2063
movq %rbx, %rdi
callq 0x1842
testl %eax, %eax
movq %rbp, %rcx
cmovgq %r15, %rcx
movq %r12, %rdi
movq %r13, %rsi
movq %r14, %rdx
xorl %eax, %eax
callq 0x1050
movq %rbx, %rdi
callq 0x1822
movq %rax, %rdi
leaq 0xd27(%rip), %rsi       # 0x2004
callq 0x1070
testl %eax, %eax
movq %rbp, %rcx
cmoveq %r15, %rcx
leaq 0xd82(%rip), %rdx       # 0x2074
movq %r12, %rdi
movq %r13, %rsi
xorl %eax, %eax
callq 0x1050
movq %rbx, %rdi
callq 0x1827
movq %rax, %rdi
leaq 0xcfe(%rip), %rsi       # 0x200f
callq 0x1070
testl %eax, %eax
movq %rbp, %rcx
cmoveq %r15, %rcx
leaq 0xdba(%rip), %rdx       # 0x20e0
movq %r12, %rdi
movq %r13, %rsi
xorl %eax, %eax
callq 0x1050
movq %rbx, %rdi
xorl %esi, %esi
callq 0x1861
testl %eax, %eax
movq %r15, %rcx
cmoveq %rbp, %rcx
leaq 0xd2b(%rip), %rdx       # 0x2078
movq %r12, %rdi
movq %r13, %rsi
xorl %eax, %eax
callq 0x1050
movq %rbx, %rdi
callq 0x188c
testl %eax, %eax
cmoveq %rbp, %r15
leaq 0xd0f(%rip), %rdx       # 0x207e
movq %r12, %rdi
movq %r13, %rsi
movq %r15, %rcx
xorl %eax, %eax
callq 0x1050
movq %rbx, %rdi
callq 0x17ef
movq (%rsp), %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x17ef