// File: tonymuu[P]distributed-kv-store/Application.cpp
// Function: Application::deleteTest()
void Application::deleteTest() {
	int number;
	/**
	 * Test 1: Delete half the KV pairs
	 */
	cout<<endl<<"Deleting "<<testKVPairs.size()/2 <<" valid keys.... ... .. . ."<<endl;
	map<string, string>::iterator it = testKVPairs.begin();
	for ( int i = 0; i < (int)testKVPairs.size()/2; i++ ) {
		it++;

		// Step 1.a. Find a node that is alive
		number = findARandomNodeThatIsAlive();

		// Step 1.b. Issue a delete operation
		log->LOG(&mp2[number]->getMemberNode()->addr, "DELETE OPERATION KEY: %s VALUE: %s at time: %d", it->first.c_str(), it->second.c_str(), par->getcurrtime());
		mp2[number]->clientDelete(it->first);
	}

	/**
	 * Test 2: Delete a non-existent key
	 */
	cout<<endl<<"Deleting an invalid key.... ... .. . ."<<endl;
	string invalidKey = "invalidKey";
	// Step 2.a. Find a node that is alive
	number = findARandomNodeThatIsAlive();

	// Step 2.b. Issue a delete operation
	log->LOG(&mp2[number]->getMemberNode()->addr, "DELETE OPERATION KEY: %s at time: %d", invalidKey.c_str(), par->getcurrtime());
	mp2[number]->clientDelete(invalidKey);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x140, %rsp            # imm = 0x140
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0xa8(%rbp)
movq 0x2d75f(%rip), %rdi     # 0x3dfc0
movq 0x2d740(%rip), %rsi     # 0x3dfa8
callq 0x4390
movq %rax, %rdi
leaq 0x1bb6d(%rip), %rsi     # 0x2c3e4
callq 0x4330
movq -0xa8(%rbp), %rdi
movq %rax, -0xb0(%rbp)
addq $0x60, %rdi
callq 0x14c80
movq -0xb0(%rbp), %rdi
movq %rax, %rsi
shrq %rsi
callq 0x40c0
movq %rax, %rdi
leaq 0x1bb3f(%rip), %rsi     # 0x2c3ee
callq 0x4330
movq %rax, %rdi
movq 0x2d6ea(%rip), %rsi     # 0x3dfa8
callq 0x4390
movq -0xa8(%rbp), %rdi
addq $0x60, %rdi
callq 0x14ef0
movq %rax, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
movq -0xa8(%rbp), %rdi
movl -0x1c(%rbp), %eax
movl %eax, -0xb4(%rbp)
addq $0x60, %rdi
callq 0x14c80
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movl -0xb4(%rbp), %eax
cmpl %ecx, %eax
jge 0x10a67
leaq -0x18(%rbp), %rdi
movq %rdi, -0xd0(%rbp)
xorl %esi, %esi
movl %esi, -0xd4(%rbp)
callq 0x14fd0
movq -0xa8(%rbp), %rdi
movq %rax, -0x28(%rbp)
callq 0x148d0
movl %eax, %ecx
movq -0xa8(%rbp), %rax
movl %ecx, -0xc(%rbp)
movq 0x38(%rax), %rcx
movq %rcx, -0xf8(%rbp)
movq 0x48(%rax), %rax
movslq -0xc(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x14b10
movq -0xd0(%rbp), %rdi
addq $0x8, %rax
movq %rax, -0xf0(%rbp)
callq 0x14f80
movq %rax, %rdi
callq 0x4150
movq -0xd0(%rbp), %rdi
movq %rax, -0xe8(%rbp)
callq 0x14f80
movq %rax, %rdi
addq $0x20, %rdi
callq 0x4150
movq %rax, %rcx
movq -0xa8(%rbp), %rax
movq %rcx, -0xe0(%rbp)
movq 0x58(%rax), %rdi
callq 0x18c60
movq -0xf8(%rbp), %rdi
movq -0xf0(%rbp), %rsi
movq -0xe8(%rbp), %rcx
movq -0xe0(%rbp), %r8
movl %eax, %r9d
movl -0xd4(%rbp), %eax
leaq 0x1ba26(%rip), %rdx     # 0x2c409
callq 0x17ae0
movq -0xa8(%rbp), %rax
movq -0xd0(%rbp), %rdi
movq 0x48(%rax), %rax
movslq -0xc(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0xc8(%rbp)
callq 0x14f80
movq %rax, %rsi
leaq -0x48(%rbp), %rdi
movq %rdi, -0xc0(%rbp)
callq 0x4160
movq -0xc8(%rbp), %rdi
movq -0xc0(%rbp), %rsi
callq 0x1fb60
jmp 0x10a36
leaq -0x48(%rbp), %rdi
callq 0x4200
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x108de
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x4200
jmp 0x10c28
movq 0x2d552(%rip), %rdi     # 0x3dfc0
movq 0x2d533(%rip), %rsi     # 0x3dfa8
movq %rsi, -0x108(%rbp)
callq 0x4390
movq %rax, %rdi
leaq 0x1b9ad(%rip), %rsi     # 0x2c438
callq 0x4330
movq -0x108(%rbp), %rsi
movq %rax, %rdi
callq 0x4390
leaq -0x79(%rbp), %rdi
movq %rdi, -0x100(%rbp)
callq 0x45c0
movq -0x100(%rbp), %rdx
leaq 0x1b9a2(%rip), %rsi     # 0x2c45f
leaq -0x78(%rbp), %rdi
callq 0x7790
jmp 0x10ac8
leaq -0x79(%rbp), %rdi
callq 0x43b0
movq -0xa8(%rbp), %rdi
callq 0x148d0
movl %eax, -0x10c(%rbp)
jmp 0x10ae5
movq -0xa8(%rbp), %rax
movl -0x10c(%rbp), %ecx
movl %ecx, -0xc(%rbp)
movq 0x38(%rax), %rcx
movq %rcx, -0x120(%rbp)
movq 0x48(%rax), %rax
movslq -0xc(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x14b10
movq %rax, -0x118(%rbp)
jmp 0x10b1a
movq -0x118(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x138(%rbp)
leaq -0x78(%rbp), %rdi
callq 0x4150
movq %rax, %rcx
movq -0xa8(%rbp), %rax
movq %rcx, -0x130(%rbp)
movq 0x58(%rax), %rdi
callq 0x18c60
movl %eax, -0x124(%rbp)
jmp 0x10b57
movl -0x124(%rbp), %r8d
movq -0x130(%rbp), %rcx
movq -0x138(%rbp), %rsi
movq -0x120(%rbp), %rdi
leaq 0x1b8f0(%rip), %rdx     # 0x2c46a
xorl %eax, %eax
callq 0x17ae0
jmp 0x10b83
movq -0xa8(%rbp), %rax
movq 0x48(%rax), %rax
movslq -0xc(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x140(%rbp)
leaq -0xa0(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0x4160
jmp 0x10baf
movq -0x140(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x1fb60
jmp 0x10bc4
leaq -0xa0(%rbp), %rdi
callq 0x4200
leaq -0x78(%rbp), %rdi
callq 0x4200
addq $0x140, %rsp            # imm = 0x140
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x79(%rbp), %rdi
callq 0x43b0
jmp 0x10c28
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x10c1f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0xa0(%rbp), %rdi
callq 0x4200
leaq -0x78(%rbp), %rdi
callq 0x4200
movq -0x50(%rbp), %rdi
callq 0x45b0
nopw %cs:(%rax,%rax)