// File: /workspace/github_cpp_makefile_star2_O3/SeanChao[P]KV-Store/persistence.cc
// Function: PersistenceTest::prepare(unsigned long)
void prepare(uint64_t max)
	{
		uint64_t i;

		// Clean up
		store.reset();

		// Test multiple key-value pairs
		for (i = 0; i < max; ++i) {
			store.put(i, std::string(i+1, 's'));
			EXPECT(std::string(i+1, 's'), store.get(i));
		}
		phase();

		// Test after all insertions
		for (i = 0; i < max; ++i)
			EXPECT(std::string(i+1, 's'), store.get(i));
		phase();

		// Test deletions
		for (i = 0; i < max; i+=2)
			EXPECT(true, store.del(i));

		// Prepare data for Test Mode
		for (i = 0; i < max; ++i) {
			switch (i & 3) {
			case 0:
				EXPECT(not_found, store.get(i));
				store.put(i, std::string(i+1, 't'));
				break;
			case 1:
				EXPECT(std::string(i+1, 's'), store.get(i));
				store.put(i, std::string(i+1, 't'));
				break;
			case 2:
				EXPECT(not_found, store.get(i));
				break;
			case 3:
				EXPECT(std::string(i+1, 's'), store.get(i));
				break;
			default:
				assert(0);
			}
		}

		phase();

		report();

		/**
		 * Write 10MB data to drain previous data out of memory.
		 */
		for (i = 0; i <= 10240; ++i)
			store.put(max + i, std::string(1024, 'x'));

		std::cout << "Data is ready, please press ctrl-c/ctrl-d to"
			" terminate this program!" << std::endl;
		std::cout.flush();

		while (true) {
			volatile int dummy;
			for (i = 0; i <= 1024; ++i) {
				// The loop slows down the program
				for (i = 0; i <= 1000; ++i)
					dummy = i;

				store.del(max + i);

				for (i = 0; i <= 1000; ++i)
					dummy = i;

				store.put(max + i, std::string(1024, '.'));

				for (i = 0; i <= 1000; ++i)
					dummy = i;

				store.put(max + i, std::string(512, 'x'));
			}
		}
	}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rsi, %rbp
movq %rdi, %rbx
leaq 0x28(%rdi), %r14
movq %r14, %rdi
callq 0x643c
testq %rbp, %rbp
movq %rbx, 0x48(%rsp)
jne 0x4422
movq %rbx, %rdi
callq 0x4c26
movq %rbx, %rdi
callq 0x4c26
movq 0x48(%rsp), %rbx
movq %rbx, %rdi
callq 0x4c26
movq %rbx, %rdi
callq 0x4d28
leaq 0x18(%rsp), %r12
xorl %r15d, %r15d
leaq 0x8(%rsp), %rbx
movq %r12, 0x8(%rsp)
movl $0x400, %esi            # imm = 0x400
movq %rbx, %rdi
movl $0x78, %edx
callq 0x32c0
leaq (%r15,%rbp), %rsi
movq %r14, %rdi
movq %rbx, %rdx
callq 0x53c0
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x4303
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x3280
incq %r15
cmpq $0x2801, %r15           # imm = 0x2801
jne 0x42c6
movq 0xacba(%rip), %rbx      # 0xefd0
leaq 0x6f33(%rip), %rsi      # 0xb250
movl $0x44, %edx
movq %rbx, %rdi
callq 0x32b0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3250
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x31b0
movq %rbx, %rdi
callq 0x31b0
addq $0x3e9, %rbp            # imm = 0x3E9
xorl %eax, %eax
leaq 0x8(%rsp), %r15
movl %eax, 0x28(%rsp)
incq %rax
cmpq $0x3e9, %rax            # imm = 0x3E9
jne 0x4367
movq %r14, %rdi
movq %rbp, %rsi
callq 0x617c
xorl %eax, %eax
movl %eax, 0x28(%rsp)
incq %rax
cmpq $0x3e9, %rax            # imm = 0x3E9
jne 0x4383
movq %r12, 0x8(%rsp)
movl $0x400, %esi            # imm = 0x400
movq %r15, %rdi
movl $0x2e, %edx
callq 0x32c0
movq %r14, %rdi
movq %rbp, %rsi
movq %r15, %rdx
callq 0x53c0
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x43ce
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x3280
xorl %eax, %eax
movl %eax, 0x28(%rsp)
incq %rax
cmpq $0x3e9, %rax            # imm = 0x3E9
jne 0x43d0
movq %r12, 0x8(%rsp)
movl $0x200, %esi            # imm = 0x200
movq %r15, %rdi
movl $0x78, %edx
callq 0x32c0
movq %r14, %rdi
movq %rbp, %rsi
movq %r15, %rdx
callq 0x53c0
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x441b
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x3280
xorl %eax, %eax
jmp 0x4367
movq %rbp, 0x70(%rsp)
xorl %r15d, %r15d
leaq 0x8(%rsp), %r12
leaq 0x28(%rsp), %r13
leaq 0x50(%rsp), %rbp
leaq 0x1(%r15), %rbx
leaq 0x18(%rsp), %rax
movq %rax, 0x8(%rsp)
movq %r12, %rdi
movq %rbx, %rsi
movl $0x73, %edx
callq 0x32c0
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x53c0
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x4481
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x3280
leaq 0x18(%rsp), %rax
movq %rax, 0x8(%rsp)
movq %r12, %rdi
movq %rbx, %rsi
movl $0x73, %edx
callq 0x32c0
movq %r13, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x5aa6
leaq 0x60(%rsp), %rax
movq %rax, 0x50(%rsp)
movq %rbp, %rdi
leaq 0x6d42(%rip), %rsi      # 0xb1ff
leaq 0x6d49(%rip), %rdx      # 0xb20d
callq 0x4ea6
movq 0x48(%rsp), %rdi
movq %r12, %rsi
movq %r13, %rdx
movq %rbp, %rcx
movl $0x15, %r8d
callq 0x4b04
movq 0x50(%rsp), %rdi
leaq 0x60(%rsp), %rax
cmpq %rax, %rdi
je 0x44fe
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x3280
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x451a
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x3280
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x4536
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x3280
movq %rbx, %r15
cmpq %rbx, 0x70(%rsp)
jne 0x4439
movq 0x48(%rsp), %rdi
callq 0x4c26
xorl %ebx, %ebx
leaq 0x8(%rsp), %r15
leaq 0x28(%rsp), %r12
leaq 0x50(%rsp), %r13
leaq 0x1(%rbx), %rbp
leaq 0x18(%rsp), %rax
movq %rax, 0x8(%rsp)
movq %r15, %rdi
movq %rbp, %rsi
movl $0x73, %edx
callq 0x32c0
movq %r12, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x5aa6
leaq 0x60(%rsp), %rax
movq %rax, 0x50(%rsp)
movq %r13, %rdi
leaq 0x6c60(%rip), %rsi      # 0xb1ff
leaq 0x6c67(%rip), %rdx      # 0xb20d
callq 0x4ea6
movq 0x48(%rsp), %rdi
movq %r15, %rsi
movq %r12, %rdx
movq %r13, %rcx
movl $0x1b, %r8d
callq 0x4b04
movq 0x50(%rsp), %rdi
leaq 0x60(%rsp), %rax
cmpq %rax, %rdi
je 0x45e0
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x3280
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x45fc
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x3280
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x4618
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x3280
movq %rbp, %rbx
cmpq %rbp, 0x70(%rsp)
jne 0x455f
movq 0x48(%rsp), %rdi
callq 0x4c26
xorl %ebx, %ebx
leaq 0x6bd4(%rip), %r12      # 0xb20d
leaq 0x8(%rsp), %r13
leaq 0x28(%rsp), %rbp
leaq 0x50(%rsp), %r15
movb $0x1, 0x28(%rsp)
movq %r14, %rdi
movq %rbx, %rsi
callq 0x617c
movb %al, 0x50(%rsp)
leaq 0x18(%rsp), %rax
movq %rax, 0x8(%rsp)
movq %r13, %rdi
leaq 0x6b8f(%rip), %rsi      # 0xb1ff
movq %r12, %rdx
callq 0x4ea6
movq 0x48(%rsp), %rdi
movq %rbp, %rsi
movq %r15, %rdx
movq %r13, %rcx
movl $0x20, %r8d
callq 0x4db6
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x46ad
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x3280
addq $0x2, %rbx
cmpq 0x70(%rsp), %rbx
jb 0x4648
xorl %r12d, %r12d
xorl %eax, %eax
andl $0x3, %eax
leaq 0x694d(%rip), %r13      # 0xb014
movslq (%r13,%rax,4), %rax
addq %r13, %rax
movq 0x70(%rsp), %rbp
jmpq *%rax
jmp 0x4736
jmp 0x4768
jmp 0x46f0
jmp 0x4711
jmp 0x4736
jmp 0x4768
jmp 0x474c
jmp 0x4768
jmp 0x474c
jmp 0x4768
movq %rax, %rbx
movq 0x50(%rsp), %rdi
leaq 0x60(%rsp), %rax
cmpq %rax, %rdi
je 0x4714
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x3280
jmp 0x4714
movq %rax, %rbx
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x4739
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x3280
jmp 0x4739
jmp 0x4736
jmp 0x4768
movq %rax, %rbx
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
jne 0x4759
jmp 0x476b
jmp 0x4768
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x476b
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x3280
jmp 0x476b
movq %rax, %rbx
movq %rbx, %rdi
callq 0x33f0
leaq 0x8(%rsp), %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0x5aa6
leaq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
movq %rax, (%rdi)
leaq 0x6a68(%rip), %rsi      # 0xb1ff
leaq 0x6a6f(%rip), %rdx      # 0xb20d
callq 0x4ea6
movq 0x48(%rsp), %rdi
leaq 0xaa91(%rip), %rsi      # 0xf240
leaq 0x8(%rsp), %rdx
leaq 0x28(%rsp), %rcx
movl $0x26, %r8d
callq 0x4b04
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x47e0
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x3280
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x47fc
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x3280
leaq 0x1(%r12), %rbx
leaq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
movq %rax, (%rdi)
movq %rbx, %rsi
movl $0x74, %edx
callq 0x32c0
leaq 0x8(%rsp), %rdx
movq %r14, %rdi
movq %r12, %rsi
callq 0x53c0
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x4847
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x3280
movq %rbx, %r12
jmp 0x4ae0
jmp 0x4736
jmp 0x4768
jmp 0x4711
jmp 0x4736
leaq 0x1(%r12), %r15
leaq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
movq %rax, (%rdi)
movq %r15, %rsi
movl $0x73, %edx
callq 0x32c0
leaq 0x28(%rsp), %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0x5aa6
leaq 0x50(%rsp), %rdi
leaq 0x60(%rsp), %rax
movq %rax, (%rdi)
leaq 0x6959(%rip), %rsi      # 0xb1ff
leaq 0x6960(%rip), %rdx      # 0xb20d
callq 0x4ea6
leaq 0x8(%rsp), %rsi
leaq 0x28(%rsp), %rdx
leaq 0x50(%rsp), %rcx
movq 0x48(%rsp), %rdi
movl $0x31, %r8d
callq 0x4b04
movq 0x50(%rsp), %rdi
leaq 0x60(%rsp), %rax
cmpq %rax, %rdi
je 0x48ed
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x3280
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x4a12
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x3280
jmp 0x4a12
jmp 0x46f0
jmp 0x4711
jmp 0x4736
jmp 0x4768
leaq 0x1(%r12), %r15
leaq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
movq %rax, (%rdi)
movq %r15, %rsi
movl $0x73, %edx
callq 0x32c0
leaq 0x28(%rsp), %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0x5aa6
leaq 0x50(%rsp), %rdi
leaq 0x60(%rsp), %rax
movq %rax, (%rdi)
leaq 0x6896(%rip), %rsi      # 0xb1ff
leaq 0x689d(%rip), %rdx      # 0xb20d
callq 0x4ea6
leaq 0x8(%rsp), %rsi
leaq 0x28(%rsp), %rdx
leaq 0x50(%rsp), %rcx
movq 0x48(%rsp), %rdi
movl $0x2a, %r8d
callq 0x4b04
movq 0x50(%rsp), %rdi
leaq 0x60(%rsp), %rax
cmpq %rax, %rdi
je 0x49b0
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x3280
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x49cc
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x3280
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x49e8
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x3280
leaq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
movq %rax, (%rdi)
movq %r15, %rsi
movl $0x74, %edx
callq 0x32c0
leaq 0x8(%rsp), %rdx
movq %r14, %rdi
movq %r12, %rsi
callq 0x53c0
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x4a2e
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x3280
movq %r15, %r12
jmp 0x4ae0
jmp 0x4736
jmp 0x4768
jmp 0x46f0
jmp 0x4711
jmp 0x4736
jmp 0x4768
leaq 0x8(%rsp), %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0x5aa6
leaq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
movq %rax, (%rdi)
leaq 0x6787(%rip), %rsi      # 0xb1ff
leaq 0x678e(%rip), %rdx      # 0xb20d
callq 0x4ea6
movq 0x48(%rsp), %rdi
leaq 0xa7b0(%rip), %rsi      # 0xf240
leaq 0x8(%rsp), %rdx
leaq 0x28(%rsp), %rcx
movl $0x2e, %r8d
callq 0x4b04
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x4ac1
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x3280
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x4add
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x3280
incq %r12
cmpq %rbp, %r12
je 0x42a4
movl %r12d, %eax
andl $0x3, %eax
movslq (%r13,%rax,4), %rax
addq %r13, %rax
jmpq *%rax
jmp 0x4711
jmp 0x4736
nop