// File: /workspace/github_cpp_makefile_star2_O2/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 $0x88, %rsp
movq %rsi, %rbp
movq %rdi, 0x18(%rsp)
addq $0x28, %rdi
movq %rdi, 0x10(%rsp)
callq 0x54dc
xorl %ebx, %ebx
leaq 0x20(%rsp), %r12
leaq 0x48(%rsp), %r13
leaq 0x68(%rsp), %r15
movq %rbp, 0x40(%rsp)
subq $0x1, %rbp
jb 0x3e32
leaq 0x1(%rbx), %r14
leaq 0x30(%rsp), %rax
movq %rax, 0x20(%rsp)
movq %r12, %rdi
movq %r14, %rsi
pushq $0x73
popq %rdx
callq 0x32a0
movq 0x10(%rsp), %rdi
movq %rbx, %rsi
movq %r12, %rdx
callq 0x49a2
movq %r12, %rdi
callq 0x3438
leaq 0x30(%rsp), %rax
movq %rax, 0x20(%rsp)
movq %r12, %rdi
movq %r14, %rsi
pushq $0x73
popq %rdx
callq 0x32a0
movq %r13, %rdi
movq 0x10(%rsp), %rsi
movq %rbx, %rdx
callq 0x4e82
movq %r15, %rdi
leaq 0x640e(%rip), %rsi      # 0xa1ff
leaq 0xf(%rsp), %rdx
callq 0x3992
movq 0x18(%rsp), %rdi
movq %r12, %rsi
movq %r13, %rdx
movq %r15, %rcx
pushq $0x15
popq %r8
callq 0x4330
movq %r15, %rdi
callq 0x3438
movq %r13, %rdi
callq 0x3438
movq %r12, %rdi
callq 0x3438
movq %r14, %rbx
jmp 0x3d81
movq 0x18(%rsp), %rdi
callq 0x43f4
xorl %r13d, %r13d
leaq 0x20(%rsp), %rbx
leaq 0x48(%rsp), %r14
leaq 0x68(%rsp), %r12
movq 0x40(%rsp), %rbp
subq $0x1, %rbp
jb 0x3ecd
leaq 0x1(%r13), %r15
leaq 0x30(%rsp), %rax
movq %rax, 0x20(%rsp)
movq %rbx, %rdi
movq %r15, %rsi
pushq $0x73
popq %rdx
callq 0x32a0
movq %r14, %rdi
movq 0x10(%rsp), %rsi
movq %r13, %rdx
callq 0x4e82
movq %r12, %rdi
leaq 0x6370(%rip), %rsi      # 0xa1ff
leaq 0xf(%rsp), %rdx
callq 0x3992
movq 0x18(%rsp), %rdi
movq %rbx, %rsi
movq %r14, %rdx
movq %r12, %rcx
pushq $0x1b
popq %r8
callq 0x4330
movq %r12, %rdi
callq 0x3438
movq %r14, %rdi
callq 0x3438
movq %rbx, %rdi
callq 0x3438
movq %r15, %r13
jmp 0x3e53
movq 0x18(%rsp), %rdi
callq 0x43f4
xorl %ebx, %ebx
leaq 0x20(%rsp), %r15
leaq 0xf(%rsp), %r12
leaq 0x48(%rsp), %r13
leaq 0x68(%rsp), %rbp
pushq $0x20
popq %r14
cmpq 0x40(%rsp), %rbx
jae 0x3f44
movb $0x1, 0x48(%rsp)
movq 0x10(%rsp), %rdi
movq %rbx, %rsi
callq 0x5314
movb %al, 0x68(%rsp)
movq %r15, %rdi
leaq 0x62e7(%rip), %rsi      # 0xa1ff
movq %r12, %rdx
callq 0x3992
movq 0x18(%rsp), %rdi
movq %r13, %rsi
movq %rbp, %rdx
movq %r15, %rcx
movl %r14d, %r8d
callq 0x455e
movq %r15, %rdi
callq 0x3438
addq $0x2, %rbx
jmp 0x3ef1
xorl %r13d, %r13d
leaq 0x60c6(%rip), %r14      # 0xa014
leaq 0x20(%rsp), %r12
leaq 0x48(%rsp), %rbp
cmpq 0x40(%rsp), %r13
je 0x4166
movl %r13d, %eax
andl $0x3, %eax
movslq (%r14,%rax,4), %rax
addq %r14, %rax
jmpq *%rax
movq %r12, %rdi
movq 0x10(%rsp), %rsi
movq %r13, %rdx
callq 0x4e82
movq %rbp, %rdi
leaq 0x6273(%rip), %rsi      # 0xa1ff
leaq 0x68(%rsp), %rdx
callq 0x3992
movq 0x18(%rsp), %rdi
leaq 0xb29e(%rip), %rsi      # 0xf240
movq %r12, %rdx
movq %rbp, %rcx
pushq $0x26
popq %r8
callq 0x4330
movq %rbp, %rdi
callq 0x3438
movq %r12, %rdi
callq 0x3438
leaq 0x1(%r13), %rbx
leaq 0x30(%rsp), %rax
movq %rax, 0x20(%rsp)
movq %r12, %rdi
movq %rbx, %rsi
pushq $0x74
popq %rdx
callq 0x32a0
movq 0x10(%rsp), %rdi
movq %r13, %rsi
movq %r12, %rdx
callq 0x49a2
jmp 0x4156
movq %r12, %rdi
movq 0x10(%rsp), %rsi
movq %r13, %rdx
callq 0x4e82
movq %rbp, %rdi
leaq 0x61f3(%rip), %rsi      # 0xa1ff
leaq 0x68(%rsp), %rdx
callq 0x3992
movq 0x18(%rsp), %rdi
leaq 0xb21e(%rip), %rsi      # 0xf240
movq %r12, %rdx
movq %rbp, %rcx
pushq $0x2e
popq %r8
callq 0x4330
movq %rbp, %rdi
callq 0x3438
movq %r12, %rdi
callq 0x3438
incq %r13
jmp 0x3f58
leaq 0x1(%r13), %rbx
leaq 0x30(%rsp), %rax
movq %rax, 0x20(%rsp)
movq %r12, %rdi
movq %rbx, %rsi
pushq $0x73
popq %rdx
callq 0x32a0
movq %rbp, %rdi
movq 0x10(%rsp), %rsi
movq %r13, %rdx
callq 0x4e82
leaq 0x68(%rsp), %r15
movq %r15, %rdi
leaq 0x617b(%rip), %rsi      # 0xa1ff
leaq 0xf(%rsp), %rdx
callq 0x3992
movq 0x18(%rsp), %rdi
movq %r12, %rsi
movq %rbp, %rdx
movq %r15, %rcx
pushq $0x31
popq %r8
callq 0x4330
movq %r15, %rdi
callq 0x3438
movq %rbp, %rdi
callq 0x3438
jmp 0x4156
leaq 0x1(%r13), %rbx
leaq 0x30(%rsp), %rax
movq %rax, 0x20(%rsp)
movq %r12, %rdi
movq %rbx, %rsi
pushq $0x73
popq %rdx
callq 0x32a0
movq %rbp, %rdi
movq 0x10(%rsp), %rsi
movq %r13, %rdx
callq 0x4e82
leaq 0x68(%rsp), %r15
movq %r15, %rdi
leaq 0x610a(%rip), %rsi      # 0xa1ff
leaq 0xf(%rsp), %rdx
callq 0x3992
movq 0x18(%rsp), %rdi
movq %r12, %rsi
movq %rbp, %rdx
movq %r15, %rcx
pushq $0x2a
popq %r8
callq 0x4330
movq %r15, %rdi
callq 0x3438
movq %rbp, %rdi
callq 0x3438
movq %r12, %rdi
callq 0x3438
leaq 0x30(%rsp), %rax
movq %rax, 0x20(%rsp)
movq %r12, %rdi
movq %rbx, %rsi
pushq $0x74
popq %rdx
callq 0x32a0
movq 0x10(%rsp), %rdi
movq %r13, %rsi
movq %r12, %rdx
callq 0x49a2
movq %r12, %rdi
callq 0x3438
movq %rbx, %r13
jmp 0x3f58
movq 0x18(%rsp), %rbx
movq %rbx, %rdi
callq 0x43f4
movq %rbx, %rdi
callq 0x44ba
xorl %r14d, %r14d
leaq 0x20(%rsp), %rbx
pushq $0x78
popq %rbp
cmpq $0x2801, %r14           # imm = 0x2801
je 0x41cb
leaq 0x30(%rsp), %rax
movq %rax, 0x20(%rsp)
movl $0x400, %esi            # imm = 0x400
movq %rbx, %rdi
movl %ebp, %edx
callq 0x32a0
movq 0x40(%rsp), %rax
leaq (%rax,%r14), %rsi
movq 0x10(%rsp), %rdi
movq %rbx, %rdx
callq 0x49a2
movq %rbx, %rdi
callq 0x3438
incq %r14
jmp 0x4186
movq 0xadfe(%rip), %rbx      # 0xefd0
leaq 0x6077(%rip), %rsi      # 0xa250
movq %rbx, %rdi
callq 0x3270
movq %rax, %rdi
callq 0x3160
movq %rbx, %rdi
callq 0x31c0
addq $0x3e9, 0x40(%rsp)      # imm = 0x3E9
xorl %eax, %eax
leaq 0x20(%rsp), %r15
pushq $0x2e
popq %rbp
pushq $0x78
popq %r12
cmpq $0x3e9, %rax            # imm = 0x3E9
jne 0x4232
movq 0x10(%rsp), %rdi
movq 0x40(%rsp), %rsi
callq 0x5314
xorl %eax, %eax
cmpq $0x3e9, %rax            # imm = 0x3E9
je 0x423b
movl %eax, 0x48(%rsp)
incq %rax
jmp 0x4221
movl %eax, 0x48(%rsp)
incq %rax
jmp 0x4208
leaq 0x30(%rsp), %rax
movq %rax, 0x20(%rsp)
movl $0x400, %esi            # imm = 0x400
movq %r15, %rdi
movl %ebp, %edx
callq 0x32a0
movq 0x10(%rsp), %rdi
movq 0x40(%rsp), %rsi
movq %r15, %rdx
callq 0x49a2
movq %r15, %rdi
callq 0x3438
xorl %eax, %eax
cmpq $0x3e9, %rax            # imm = 0x3E9
je 0x4281
movl %eax, 0x48(%rsp)
incq %rax
jmp 0x4270
leaq 0x30(%rsp), %rax
movq %rax, 0x20(%rsp)
movl $0x200, %esi            # imm = 0x200
movq %r15, %rdi
movl %r12d, %edx
callq 0x32a0
movq 0x10(%rsp), %rdi
movq 0x40(%rsp), %rsi
movq %r15, %rdx
callq 0x49a2
movq %r15, %rdi
callq 0x3438
xorl %eax, %eax
jmp 0x4208
jmp 0x4316
jmp 0x4325
jmp 0x4316
jmp 0x4325
jmp 0x4316
jmp 0x4325
jmp 0x42f4
jmp 0x42f4
jmp 0x4316
jmp 0x4303
jmp 0x4303
jmp 0x4325
jmp 0x4316
jmp 0x4316
jmp 0x4303
jmp 0x4303
jmp 0x4325
jmp 0x4316
jmp 0x4316
jmp 0x4325
jmp 0x4316
jmp 0x4325
jmp 0x4316
jmp 0x4325
jmp 0x42f4
jmp 0x4303
jmp 0x4316
jmp 0x4325
movq %rax, %rbx
leaq 0x68(%rsp), %rdi
callq 0x3438
jmp 0x4306
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
callq 0x3438
jmp 0x4319
jmp 0x4316
jmp 0x4325
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x3438
jmp 0x4328
movq %rax, %rbx
movq %rbx, %rdi
callq 0x33e0