// File: dustin[P]kvtest/tests.cc
// Function: WriteTest::run(kvtest::KVStore*)
bool WriteTest::run(KVStore *tut) {
    int i = 0;
    setup_alarm(5);
    CountingCallback cb;
    time_t start = time(NULL);

    for(i = 0 ; !alarmed; i++) {
        std::stringstream kStream;
        std::stringstream vStream;
        kStream << "testKey" << i;
        vStream << "testValue" << i;

        std::string key = kStream.str();
        std::string value = vStream.str();

        tut->set(key, value, cb);
    }

    // Last one to wait for a commit.
    RememberingCallback<bool> cbLast;
    tut->noop(cbLast);
    cbLast.waitForValue();
    time_t end = time(NULL);

    assertEquals(i, cb.num_calls());

    int delta = (int)(end - start);
    std::cout << "Ran " << i << " operations in "
              << delta << "s ("
              << (i/delta) << " ops/s)"
              << std::endl;
    return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x490, %rsp            # imm = 0x490
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x438(%rbp)
movl $0x0, -0x14(%rbp)
movl $0x5, %edi
callq 0x68b0
leaq -0x50(%rbp), %rdi
callq 0x74b0
xorl %eax, %eax
movl %eax, %edi
callq 0x3260
movq %rax, -0x58(%rbp)
movl $0x0, -0x14(%rbp)
movb 0xed69(%rip), %al       # 0x152bb
xorb $-0x1, %al
testb $0x1, %al
jne 0x655d
jmp 0x66f6
leaq -0x1e0(%rbp), %rdi
callq 0x31b0
jmp 0x656b
leaq -0x378(%rbp), %rdi
callq 0x31b0
jmp 0x6579
leaq -0x1d0(%rbp), %rdi
leaq 0x7bb3(%rip), %rsi      # 0xe13a
callq 0x3280
movq %rax, -0x440(%rbp)
jmp 0x6595
movq -0x440(%rbp), %rdi
movl -0x14(%rbp), %esi
callq 0x3440
jmp 0x65a6
leaq -0x368(%rbp), %rdi
leaq 0x7b8e(%rip), %rsi      # 0xe142
callq 0x3280
movq %rax, -0x448(%rbp)
jmp 0x65c2
movq -0x448(%rbp), %rdi
movl -0x14(%rbp), %esi
callq 0x3440
jmp 0x65d3
leaq -0x398(%rbp), %rdi
leaq -0x1e0(%rbp), %rsi
callq 0x3270
jmp 0x65e8
leaq -0x3b8(%rbp), %rdi
leaq -0x378(%rbp), %rsi
callq 0x3270
jmp 0x65fd
movq -0x10(%rbp), %rdi
movq (%rdi), %rax
movq 0x20(%rax), %rax
leaq -0x398(%rbp), %rsi
leaq -0x3b8(%rbp), %rdx
leaq -0x50(%rbp), %rcx
callq *%rax
jmp 0x661e
leaq -0x3b8(%rbp), %rdi
callq 0x3160
leaq -0x398(%rbp), %rdi
callq 0x3160
leaq -0x378(%rbp), %rdi
callq 0x31e0
leaq -0x1e0(%rbp), %rdi
callq 0x31e0
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x654c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1e8(%rbp)
movl %eax, -0x1ec(%rbp)
jmp 0x6898
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1e8(%rbp)
movl %eax, -0x1ec(%rbp)
jmp 0x66e5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1e8(%rbp)
movl %eax, -0x1ec(%rbp)
jmp 0x66d9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1e8(%rbp)
movl %eax, -0x1ec(%rbp)
jmp 0x66cd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1e8(%rbp)
movl %eax, -0x1ec(%rbp)
leaq -0x3b8(%rbp), %rdi
callq 0x3160
leaq -0x398(%rbp), %rdi
callq 0x3160
leaq -0x378(%rbp), %rdi
callq 0x31e0
leaq -0x1e0(%rbp), %rdi
callq 0x31e0
jmp 0x6898
leaq -0x420(%rbp), %rdi
callq 0x6d50
jmp 0x6704
movq -0x10(%rbp), %rdi
movq (%rdi), %rax
movq 0x18(%rax), %rax
leaq -0x420(%rbp), %rsi
callq *%rax
jmp 0x671a
leaq -0x420(%rbp), %rdi
callq 0x6f10
jmp 0x6728
xorl %eax, %eax
movl %eax, %edi
callq 0x3260
movq %rax, -0x428(%rbp)
movl -0x14(%rbp), %eax
movl %eax, -0x450(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x76b0
movl %eax, -0x44c(%rbp)
jmp 0x6752
movl -0x44c(%rbp), %edx
movl -0x450(%rbp), %esi
movq -0x438(%rbp), %rdi
callq 0x7570
jmp 0x676c
movl -0x428(%rbp), %eax
movl -0x58(%rbp), %ecx
subl %ecx, %eax
movl %eax, -0x42c(%rbp)
movq 0xe83c(%rip), %rdi      # 0x14fc0
leaq 0x79c1(%rip), %rsi      # 0xe14c
callq 0x3280
movq %rax, -0x458(%rbp)
jmp 0x6799
movq -0x458(%rbp), %rdi
movl -0x14(%rbp), %esi
callq 0x3440
movq %rax, -0x460(%rbp)
jmp 0x67b1
movq -0x460(%rbp), %rdi
leaq 0x7992(%rip), %rsi      # 0xe151
callq 0x3280
movq %rax, -0x468(%rbp)
jmp 0x67cd
movq -0x468(%rbp), %rdi
movl -0x42c(%rbp), %esi
callq 0x3440
movq %rax, -0x470(%rbp)
jmp 0x67e8
movq -0x470(%rbp), %rdi
leaq 0x796b(%rip), %rsi      # 0xe161
callq 0x3280
movq %rax, -0x478(%rbp)
jmp 0x6804
movq -0x478(%rbp), %rdi
movl -0x14(%rbp), %eax
movl -0x42c(%rbp), %ecx
cltd
idivl %ecx
movl %eax, %esi
callq 0x3440
movq %rax, -0x480(%rbp)
jmp 0x6827
movq -0x480(%rbp), %rdi
leaq 0x7930(%rip), %rsi      # 0xe165
callq 0x3280
movq %rax, -0x488(%rbp)
jmp 0x6843
movq -0x488(%rbp), %rdi
movq 0xe757(%rip), %rsi      # 0x14fa8
callq 0x32c0
jmp 0x6858
leaq -0x420(%rbp), %rdi
callq 0x7460
leaq -0x50(%rbp), %rdi
callq 0x76f0
movb $0x1, %al
andb $0x1, %al
addq $0x490, %rsp            # imm = 0x490
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1e8(%rbp)
movl %eax, -0x1ec(%rbp)
leaq -0x420(%rbp), %rdi
callq 0x7460
leaq -0x50(%rbp), %rdi
callq 0x76f0
movq -0x1e8(%rbp), %rdi
callq 0x3450
nopl (%rax)