// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x28, %rsp
movl %edi, 0x24(%rsp)
leaq 0x1e15(%rip), %rax      # 0x3004
movq %rax, 0x18(%rsp)
leaq 0x1e14(%rip), %rax      # 0x300f
movq %rax, 0x10(%rsp)
movq 0x18(%rsp), %rdi
movq 0x10(%rsp), %rsi
callq 0x1460
movq %rax, 0x8(%rsp)
movq 0x18(%rsp), %rdi
callq 0x1490
movq %rax, (%rsp)
movq (%rsp), %rdi
callq 0x1c40
movq %rax, %rdx
leaq 0x1e14(%rip), %rcx      # 0x3049
leaq 0x1e0a(%rip), %rax      # 0x3046
cmpq $0x0, %rdx
cmoveq %rax, %rcx
leaq 0x1dcf(%rip), %rdi      # 0x301a
leaq 0x1de0(%rip), %rsi      # 0x3032
leaq 0x1de3(%rip), %rdx      # 0x303c
movb $0x0, %al
callq 0x1050
movq 0x8(%rsp), %rdi
movq 0x18(%rsp), %rsi
callq 0x1ca0
movl %eax, %edx
leaq 0x1dd1(%rip), %rcx      # 0x3049
leaq 0x1dc7(%rip), %rax      # 0x3046
cmpl $0x0, %edx
cmoveq %rax, %rcx
leaq 0x1d8d(%rip), %rdi      # 0x301a
leaq 0x1d9e(%rip), %rsi      # 0x3032
leaq 0x1db3(%rip), %rdx      # 0x304e
movb $0x0, %al
callq 0x1050
movq 0x8(%rsp), %rdi
leaq 0x1da4(%rip), %rsi      # 0x3052
callq 0x1ca0
movl %eax, %edx
leaq 0x1d8d(%rip), %rcx      # 0x3049
leaq 0x1d83(%rip), %rax      # 0x3046
cmpl $0x0, %edx
cmovlq %rax, %rcx
leaq 0x1d49(%rip), %rdi      # 0x301a
leaq 0x1d5a(%rip), %rsi      # 0x3032
leaq 0x1d6f(%rip), %rdx      # 0x304e
movb $0x0, %al
callq 0x1050
movq 0x8(%rsp), %rdi
leaq 0x1d71(%rip), %rsi      # 0x3063
callq 0x1ca0
movl %eax, %edx
leaq 0x1d49(%rip), %rcx      # 0x3049
leaq 0x1d3f(%rip), %rax      # 0x3046
cmpl $0x0, %edx
cmovgq %rax, %rcx
leaq 0x1d05(%rip), %rdi      # 0x301a
leaq 0x1d16(%rip), %rsi      # 0x3032
leaq 0x1d2b(%rip), %rdx      # 0x304e
movb $0x0, %al
callq 0x1050
movq 0x8(%rsp), %rdi
callq 0x1c30
movq %rax, %rdi
movq 0x18(%rsp), %rsi
callq 0x1070
movl %eax, %edx
leaq 0x1cff(%rip), %rcx      # 0x3049
leaq 0x1cf5(%rip), %rax      # 0x3046
cmpl $0x0, %edx
cmoveq %rax, %rcx
leaq 0x1cbb(%rip), %rdi      # 0x301a
leaq 0x1ccc(%rip), %rsi      # 0x3032
leaq 0x1d07(%rip), %rdx      # 0x3074
movb $0x0, %al
callq 0x1050
movq 0x8(%rsp), %rdi
callq 0x1c40
movq %rax, %rdi
movq 0x10(%rsp), %rsi
callq 0x1070
movl %eax, %edx
leaq 0x1cb5(%rip), %rcx      # 0x3049
leaq 0x1cab(%rip), %rax      # 0x3046
cmpl $0x0, %edx
cmoveq %rax, %rcx
leaq 0x1c71(%rip), %rdi      # 0x301a
leaq 0x1c82(%rip), %rsi      # 0x3032
leaq 0x1d29(%rip), %rdx      # 0x30e0
movb $0x0, %al
callq 0x1050
movq 0x8(%rsp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x1d30
movl %eax, %edx
leaq 0x1c74(%rip), %rcx      # 0x3049
leaq 0x1c6a(%rip), %rax      # 0x3046
cmpl $0x0, %edx
cmovneq %rax, %rcx
leaq 0x1c30(%rip), %rdi      # 0x301a
leaq 0x1c41(%rip), %rsi      # 0x3032
leaq 0x1c80(%rip), %rdx      # 0x3078
movb $0x0, %al
callq 0x1050
movq 0x8(%rsp), %rdi
callq 0x1d80
movl %eax, %edx
leaq 0x1c37(%rip), %rcx      # 0x3049
leaq 0x1c2d(%rip), %rax      # 0x3046
cmpl $0x0, %edx
cmovneq %rax, %rcx
leaq 0x1bf3(%rip), %rdi      # 0x301a
leaq 0x1c04(%rip), %rsi      # 0x3032
leaq 0x1c49(%rip), %rdx      # 0x307e
movb $0x0, %al
callq 0x1050
movq 0x8(%rsp), %rdi
callq 0x1bc0
movq (%rsp), %rdi
callq 0x1bc0
addq $0x28, %rsp
retq
nopw %cs:(%rax,%rax)