// File: /workspace/github_cpp_makefile_star2_O1/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, %rbx
movq %rdi, 0x28(%rsp)
addq $0x28, %rdi
movq %rdi, 0x20(%rsp)
callq 0x63cc
movq %rbx, 0x70(%rsp)
testq %rbx, %rbx
jne 0x43ef
movq 0x28(%rsp), %rdi
callq 0x4ba4
cmpq $0x0, 0x70(%rsp)
jne 0x4500
movq 0x28(%rsp), %rdi
callq 0x4ba4
movq 0x70(%rsp), %r14
testq %r14, %r14
jne 0x45d6
movq 0x28(%rsp), %rbx
movq %rbx, %rdi
callq 0x4ba4
movq %rbx, %rdi
callq 0x4ca6
leaq 0x10(%rsp), %r12
xorl %r14d, %r14d
movq %rsp, %rbx
movq 0x20(%rsp), %r13
movq %r12, (%rsp)
movl $0x400, %esi            # imm = 0x400
movq %rbx, %rdi
movl $0x78, %edx
callq 0x32c0
movq 0x70(%rsp), %rax
leaq (%rax,%r14), %rsi
movq %r13, %rdi
movq %rbx, %rdx
callq 0x534c
movq (%rsp), %rdi
cmpq %r12, %rdi
je 0x42d1
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x3280
incq %r14
cmpq $0x2801, %r14           # imm = 0x2801
jne 0x4291
movq 0xacec(%rip), %rbx      # 0xefd0
leaq 0x6f65(%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
movq 0x70(%rsp), %rbx
addq $0x3e9, %rbx            # imm = 0x3E9
xorl %eax, %eax
movq %rsp, %r15
movl %eax, 0x30(%rsp)
incq %rax
cmpq $0x3e9, %rax            # imm = 0x3E9
jne 0x4338
movq %r13, %rdi
movq %rbx, %rsi
callq 0x6108
xorl %eax, %eax
movl %eax, 0x30(%rsp)
incq %rax
cmpq $0x3e9, %rax            # imm = 0x3E9
jne 0x4354
movq %r12, (%rsp)
movl $0x400, %esi            # imm = 0x400
movq %r15, %rdi
movl $0x2e, %edx
callq 0x32c0
movq %r13, %rdi
movq %rbx, %rsi
movq %r15, %rdx
callq 0x534c
movq (%rsp), %rdi
cmpq %r12, %rdi
je 0x439d
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x3280
xorl %eax, %eax
movl %eax, 0x30(%rsp)
incq %rax
cmpq $0x3e9, %rax            # imm = 0x3E9
jne 0x439f
movq %r12, (%rsp)
movl $0x200, %esi            # imm = 0x200
movq %r15, %rdi
movl $0x78, %edx
callq 0x32c0
movq %r13, %rdi
movq %rbx, %rsi
movq %r15, %rdx
callq 0x534c
movq (%rsp), %rdi
cmpq %r12, %rdi
je 0x43e8
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x3280
xorl %eax, %eax
jmp 0x4338
leaq 0x10(%rsp), %r14
xorl %r15d, %r15d
movq %rsp, %r12
leaq 0x30(%rsp), %r13
leaq 0x50(%rsp), %rbp
leaq 0x1(%r15), %rbx
movq %r14, (%rsp)
movq %r12, %rdi
movq %rbx, %rsi
movl $0x73, %edx
callq 0x32c0
movq 0x20(%rsp), %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x534c
movq (%rsp), %rdi
cmpq %r14, %rdi
je 0x4442
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x3280
movq %r14, (%rsp)
movq %r12, %rdi
movq %rbx, %rsi
movl $0x73, %edx
callq 0x32c0
movq %r13, %rdi
movq 0x20(%rsp), %rsi
movq %r15, %rdx
callq 0x5a28
leaq 0x60(%rsp), %rax
movq %rax, 0x50(%rsp)
movq %rbp, %rdi
leaq 0x6d85(%rip), %rsi      # 0xb1ff
leaq 0x6d8c(%rip), %rdx      # 0xb20d
callq 0x4e24
movq 0x28(%rsp), %rdi
movq %r12, %rsi
movq %r13, %rdx
movq %rbp, %rcx
movl $0x15, %r8d
callq 0x4a82
movq 0x50(%rsp), %rdi
leaq 0x60(%rsp), %rax
cmpq %rax, %rdi
je 0x44bb
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x3280
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x44d7
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x3280
movq (%rsp), %rdi
cmpq %r14, %rdi
je 0x44ed
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x3280
movq %rbx, %r15
cmpq %rbx, 0x70(%rsp)
jne 0x4404
jmp 0x423e
leaq 0x60(%rsp), %r14
xorl %ebx, %ebx
movq %rsp, %r15
leaq 0x30(%rsp), %r12
leaq 0x50(%rsp), %r13
leaq 0x1(%rbx), %rbp
leaq 0x10(%rsp), %rax
movq %rax, (%rsp)
movq %r15, %rdi
movq %rbp, %rsi
movl $0x73, %edx
callq 0x32c0
movq %r12, %rdi
movq 0x20(%rsp), %rsi
movq %rbx, %rdx
callq 0x5a28
movq %r14, 0x50(%rsp)
movq %r13, %rdi
leaq 0x6caf(%rip), %rsi      # 0xb1ff
leaq 0x6cb6(%rip), %rdx      # 0xb20d
callq 0x4e24
movq 0x28(%rsp), %rdi
movq %r15, %rsi
movq %r12, %rdx
movq %r13, %rcx
movl $0x1b, %r8d
callq 0x4a82
movq 0x50(%rsp), %rdi
cmpq %r14, %rdi
je 0x458c
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x3280
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x45a8
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x3280
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x45c3
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x3280
movq %rbp, %rbx
cmpq %rbp, 0x70(%rsp)
jne 0x4514
jmp 0x4254
xorl %ebx, %ebx
leaq 0x6c2e(%rip), %r12      # 0xb20d
movq %rsp, %r13
leaq 0x30(%rsp), %rbp
leaq 0x50(%rsp), %r15
movb $0x1, 0x30(%rsp)
movq 0x20(%rsp), %rdi
movq %rbx, %rsi
callq 0x6108
movb %al, 0x50(%rsp)
leaq 0x10(%rsp), %rax
movq %rax, (%rsp)
movq %r13, %rdi
leaq 0x6bea(%rip), %rsi      # 0xb1ff
movq %r12, %rdx
callq 0x4e24
movq 0x28(%rsp), %rdi
movq %rbp, %rsi
movq %r15, %rdx
movq %r13, %rcx
movl $0x20, %r8d
callq 0x4d34
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x4651
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x3280
addq $0x2, %rbx
cmpq %r14, %rbx
jb 0x45ec
leaq 0x60(%rsp), %rbp
leaq 0x40(%rsp), %r13
xorl %r12d, %r12d
xorl %eax, %eax
andl $0x3, %eax
leaq 0x69a1(%rip), %rbx      # 0xb014
movslq (%rbx,%rax,4), %rax
addq %rbx, %rax
jmpq *%rax
jmp 0x46e3
jmp 0x4754
jmp 0x46e3
jmp 0x4754
movq %rax, %rbx
movq 0x50(%rsp), %rdi
cmpq %r14, %rdi
je 0x46ab
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x3280
jmp 0x46ab
jmp 0x46ce
movq %rax, %rbx
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x46d1
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x3280
jmp 0x46d1
jmp 0x4754
movq %rax, %rbx
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
jne 0x4745
jmp 0x4757
jmp 0x4754
movq %rax, %rbx
movq (%rsp), %rdi
cmpq %r12, %rdi
jne 0x4745
jmp 0x4757
jmp 0x4754
movq %rax, %rbx
movq 0x50(%rsp), %rdi
leaq 0x60(%rsp), %rax
cmpq %rax, %rdi
je 0x4717
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x3280
jmp 0x4717
movq %rax, %rbx
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x473c
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x3280
jmp 0x473c
jmp 0x4739
jmp 0x4754
movq %rax, %rbx
movq (%rsp), %rdi
cmpq %r14, %rdi
je 0x4757
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x3280
jmp 0x4757
movq %rax, %rbx
movq %rbx, %rdi
callq 0x33f0
movq %rsp, %rdi
movq 0x20(%rsp), %rsi
movq %r12, %rdx
callq 0x5a28
leaq 0x30(%rsp), %rdi
movq %r13, (%rdi)
leaq 0x6a81(%rip), %rsi      # 0xb1ff
leaq 0x6a88(%rip), %rdx      # 0xb20d
callq 0x4e24
movq 0x28(%rsp), %rdi
leaq 0xaaaa(%rip), %rsi      # 0xf240
movq %rsp, %rdx
leaq 0x30(%rsp), %rcx
movl $0x26, %r8d
callq 0x4a82
movq 0x30(%rsp), %rdi
cmpq %r13, %rdi
je 0x47c0
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x3280
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x47db
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x3280
leaq 0x1(%r12), %rsi
movq %rsp, %rdi
leaq 0x10(%rsp), %rax
movq %rax, (%rdi)
movl $0x74, %edx
callq 0x32c0
movq %rsp, %rdx
movq 0x20(%rsp), %rdi
movq %r12, %rsi
callq 0x534c
jmp 0x4a30
jmp 0x46ce
jmp 0x4754
jmp 0x4a66
jmp 0x46ce
leaq 0x1(%r12), %rsi
movq %rsp, %rdi
leaq 0x10(%rsp), %rax
movq %rax, (%rdi)
movl $0x73, %edx
callq 0x32c0
movq 0x20(%rsp), %rsi
leaq 0x30(%rsp), %rdi
movq %r12, %rdx
callq 0x5a28
leaq 0x50(%rsp), %rdi
movq %rbp, (%rdi)
leaq 0x69a6(%rip), %rsi      # 0xb1ff
leaq 0x69ad(%rip), %rdx      # 0xb20d
callq 0x4e24
movq %rsp, %rsi
leaq 0x30(%rsp), %rdx
leaq 0x50(%rsp), %rcx
movq 0x28(%rsp), %rdi
movl $0x31, %r8d
callq 0x4a82
movq 0x50(%rsp), %rdi
cmpq %rbp, %rdi
je 0x4a19
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x3280
jmp 0x4a19
jmp 0x499d
jmp 0x4a66
jmp 0x46ce
jmp 0x4754
leaq 0x1(%r12), %r15
movq %rsp, %rdi
leaq 0x10(%rsp), %rax
movq %rax, (%rdi)
movq %r15, %rsi
movl $0x73, %edx
callq 0x32c0
movq 0x20(%rsp), %rsi
leaq 0x30(%rsp), %rdi
movq %r12, %rdx
callq 0x5a28
leaq 0x50(%rsp), %rdi
movq %rbp, (%rdi)
leaq 0x690b(%rip), %rsi      # 0xb1ff
leaq 0x6912(%rip), %rdx      # 0xb20d
callq 0x4e24
movq %rsp, %rsi
leaq 0x30(%rsp), %rdx
leaq 0x50(%rsp), %rcx
movq 0x28(%rsp), %rdi
movl $0x2a, %r8d
callq 0x4a82
movq 0x50(%rsp), %rdi
cmpq %rbp, %rdi
je 0x4934
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x3280
movq 0x30(%rsp), %rdi
cmpq %r13, %rdi
je 0x494b
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x3280
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x4966
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x3280
movq %rsp, %rdi
leaq 0x10(%rsp), %rax
movq %rax, (%rdi)
movq %r15, %rsi
movl $0x74, %edx
callq 0x32c0
movq %rsp, %rdx
movq 0x20(%rsp), %rdi
movq %r12, %rsi
callq 0x534c
jmp 0x4a30
jmp 0x46ce
jmp 0x4754
movq %rax, %rbx
movq 0x50(%rsp), %rdi
cmpq %rbp, %rdi
je 0x4a69
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x3280
jmp 0x4a69
jmp 0x4a66
jmp 0x46ce
jmp 0x4754
movq %rsp, %rdi
movq 0x20(%rsp), %rsi
movq %r12, %rdx
callq 0x5a28
leaq 0x30(%rsp), %rdi
movq %r13, (%rdi)
leaq 0x6811(%rip), %rsi      # 0xb1ff
leaq 0x6818(%rip), %rdx      # 0xb20d
callq 0x4e24
movq 0x28(%rsp), %rdi
leaq 0xa83a(%rip), %rsi      # 0xf240
movq %rsp, %rdx
leaq 0x30(%rsp), %rcx
movl $0x2e, %r8d
callq 0x4a82
movq 0x30(%rsp), %rdi
cmpq %r13, %rdi
je 0x4a30
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x3280
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x4a4b
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x3280
incq %r12
cmpq %r12, %r14
je 0x426c
movl %r12d, %eax
andl $0x3, %eax
movslq (%rbx,%rax,4), %rax
addq %rbx, %rax
jmpq *%rax
movq %rax, %rbx
movq 0x30(%rsp), %rdi
cmpq %r13, %rdi
jne 0x46ba
jmp 0x46d1
jmp 0x46ce
nop