// File: nmmmnu[P]HM3/hm3/test/test_pair.cc
// Function: pair_test_raw(char const*)
static void pair_test_raw(const char *module){
	const char *key = "name";
	const char *val = "Peter";

	ChecksumCalculator chk;

	char checksum = (char) chk("name\0Peter\0", 11);

	static char raw_memory[] = {
		0x50, 0x00, 0x00, 0x00,		// created, 2012-07-13 11:01:20
		0x00, 0x00, 0x00, 0x00,		// milliseconds
		0x00, 0x00, 0x00, 0x00,		// expires
		0x00, 0x00, 0x00, 0x05,		// vallen
		0x00, 0x04,			// keylen
		checksum,			// checksum
		'n', 'a', 'm', 'e', '\0',	// key
		'P', 'e', 't', 'e', 'r', '\0'	// val
	};

	auto pp = (const PairBlob *) raw_memory;
	pair_blob_test("pair::blob", *pp, key, val);

	const Pair p = (const PairBlob *) raw_memory;
	pair_test_raw_do(module, p, key, val);

	raw_memory[20] = (char) ~ raw_memory[20];

	const Pair cp = (const PairBlob *) raw_memory;

	PRINTF_TEST("valid corrupted",	! cp.valid()			);
}

// Assembly:
subq $0xc8, %rsp
movq %rdi, 0xc0(%rsp)
leaq 0x4aee(%rip), %rax      # 0x6024
movq %rax, 0xb8(%rsp)
leaq 0x4ae4(%rip), %rax      # 0x6029
movq %rax, 0xb0(%rsp)
leaq 0xaf(%rsp), %rdi
leaq 0x4c18(%rip), %rsi      # 0x6174
movl $0xb, %edx
callq 0x2b60
movb %al, 0xae(%rsp)
cmpb $0x0, 0x7bac(%rip)      # 0x9120
jne 0x1673
leaq 0x7b9f(%rip), %rdi      # 0x9120
callq 0x1180
cmpl $0x0, %eax
je 0x1673
movb $0x50, 0x7b6a(%rip)     # 0x9100
movb $0x0, 0x7b64(%rip)      # 0x9101
movb $0x0, 0x7b5e(%rip)      # 0x9102
movb $0x0, 0x7b58(%rip)      # 0x9103
movb $0x0, 0x7b52(%rip)      # 0x9104
movb $0x0, 0x7b4c(%rip)      # 0x9105
movb $0x0, 0x7b46(%rip)      # 0x9106
movb $0x0, 0x7b40(%rip)      # 0x9107
movb $0x0, 0x7b3a(%rip)      # 0x9108
movb $0x0, 0x7b34(%rip)      # 0x9109
movb $0x0, 0x7b2e(%rip)      # 0x910a
movb $0x0, 0x7b28(%rip)      # 0x910b
movb $0x0, 0x7b22(%rip)      # 0x910c
movb $0x0, 0x7b1c(%rip)      # 0x910d
movb $0x0, 0x7b16(%rip)      # 0x910e
movb $0x5, 0x7b10(%rip)      # 0x910f
movb $0x0, 0x7b0a(%rip)      # 0x9110
movb $0x4, 0x7b04(%rip)      # 0x9111
movb 0xae(%rsp), %al
movb %al, 0x7af8(%rip)       # 0x9112
movb $0x6e, 0x7af2(%rip)     # 0x9113
movb $0x61, 0x7aec(%rip)     # 0x9114
movb $0x6d, 0x7ae6(%rip)     # 0x9115
movb $0x65, 0x7ae0(%rip)     # 0x9116
movb $0x0, 0x7ada(%rip)      # 0x9117
movb $0x50, 0x7ad4(%rip)     # 0x9118
movb $0x65, 0x7ace(%rip)     # 0x9119
movb $0x74, 0x7ac8(%rip)     # 0x911a
movb $0x65, 0x7ac2(%rip)     # 0x911b
movb $0x72, 0x7abc(%rip)     # 0x911c
movb $0x0, 0x7ab6(%rip)      # 0x911d
leaq 0x7ab2(%rip), %rdi      # 0x9120
callq 0x10b0
leaq 0x7a86(%rip), %rax      # 0x9100
movq %rax, 0x30(%rsp)
movq %rax, 0xa0(%rsp)
movq 0xa0(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0xb8(%rsp), %rsi
leaq 0x90(%rsp), %rdi
movq %rdi, 0x20(%rsp)
callq 0x2bd0
movq 0xb0(%rsp), %rsi
leaq 0x80(%rsp), %rdi
movq %rdi, 0x28(%rsp)
callq 0x2bd0
movq 0x18(%rsp), %rsi
movq 0x20(%rsp), %rdx
movq 0x28(%rsp), %rcx
leaq 0x4951(%rip), %rdi      # 0x602f
callq 0x2610
movq 0x30(%rsp), %rsi
leaq 0x78(%rsp), %rdi
callq 0x36c0
movq 0xc0(%rsp), %rax
movq %rax, 0x38(%rsp)
movq 0xb8(%rsp), %rsi
leaq 0x68(%rsp), %rdi
callq 0x2bd0
jmp 0x1713
movq 0xb0(%rsp), %rsi
leaq 0x48(%rsp), %rdi
callq 0x2bd0
jmp 0x1727
movq 0x38(%rsp), %rdi
leaq 0x78(%rsp), %rsi
leaq 0x68(%rsp), %rdx
leaq 0x48(%rsp), %rcx
callq 0x2820
jmp 0x1742
leaq 0x79b7(%rip), %rsi      # 0x9100
movb 0x79c5(%rip), %al       # 0x9114
notb %al
movb %al, 0x79bd(%rip)       # 0x9114
leaq 0x40(%rsp), %rdi
callq 0x36c0
jmp 0x1763
movq 0xc0(%rsp), %rax
movq %rax, 0x8(%rsp)
leaq 0x40(%rsp), %rdi
xorl %esi, %esi
movl %esi, 0x14(%rsp)
callq 0x3b50
movq 0x8(%rsp), %rsi
movb %al, %dil
movl 0x14(%rsp), %eax
leaq 0x48d2(%rip), %rdx      # 0x6065
leaq 0x48c8(%rip), %rcx      # 0x6062
testb %dil, %dil
cmovneq %rdx, %rcx
leaq 0x4892(%rip), %rdi      # 0x603a
leaq 0x48a3(%rip), %rdx      # 0x6052
callq 0x1030
jmp 0x17b6
leaq 0x40(%rsp), %rdi
callq 0x35c0
leaq 0x78(%rsp), %rdi
callq 0x35c0
addq $0xc8, %rsp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x60(%rsp)
movl %eax, 0x5c(%rsp)
jmp 0x17fa
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x60(%rsp)
movl %eax, 0x5c(%rsp)
leaq 0x40(%rsp), %rdi
callq 0x35c0
leaq 0x78(%rsp), %rdi
callq 0x35c0
movq 0x60(%rsp), %rdi
callq 0x1170
nop