// File: /workspace/github_cpp_makefile_star2_O2/UBOdin[P]jitd-cpp/src/ds_tester.cpp
// Function: ds_test(std::istream&)
void ds_test(istream &input) 
{
  string line;
  shared_ptr<map<Key,Value>> ds(new map<Key,Value>());

  while(getline(input, line)){
    istringstream toks(line);
    string op;

    CASE_1("--") {
      // skip, comment
    } CASE("init") {
      RecordBuffer data = buffer_cmd(toks);
      vector<pair<Key, Value>> map_data;

      for(BufferElement<Record> curr = data->begin(); curr != data->end(); ++curr){
        map_data.push_back(std::make_pair(curr->key, curr->value));
      }

      timeval start, end;      
      gettimeofday(&start, NULL);
      for(vector<pair<Key,Value>>::iterator curr = map_data.begin(); curr != map_data.end(); curr++){
        ds->insert(*curr);
      }
      // for(BufferElement<Record> curr = data->begin(); curr != data->end(); ++curr){
      //   ds->emplace(curr->key, curr->value);
      // }
      gettimeofday(&end, NULL);
      cout << "Load Map: " << total_time(start, end) << " us" << endl;

    } else {
      cout << "Skipping irrelevant operation: " << line << endl;
    }

  }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x228, %rsp            # imm = 0x228
movq %rdi, -0x40(%rbp)
leaq -0xa0(%rbp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
pushq $0x30
popq %rdi
callq 0x4270
movq %rax, %rcx
addq $0x8, %rcx
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rax)
movaps %xmm0, (%rax)
movq %rcx, 0x18(%rax)
movq %rcx, 0x20(%rax)
andq $0x0, 0x28(%rax)
leaq -0x50(%rbp), %rdi
movq %rax, %rsi
callq 0xcbc6
leaq -0x250(%rbp), %r12
leaq -0x90(%rbp), %r14
leaq -0x70(%rbp), %r13
leaq -0xd0(%rbp), %rbx
movq -0x40(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
callq 0x4050
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0xcb3a
movq %r12, %rdi
leaq -0xb0(%rbp), %rsi
pushq $0x8
popq %rdx
callq 0x43a0
leaq -0x80(%rbp), %rax
movq %rax, -0x90(%rbp)
andq $0x0, -0x88(%rbp)
movb $0x0, -0x80(%rbp)
movq %r12, %rdi
movq %r14, %rsi
callq 0x42e0
movq %r13, %rdi
leaq 0x16bb(%rip), %rsi      # 0xe08d
leaq -0x38(%rbp), %rdx
callq 0x40d0
movq %r13, %rdi
movq %r14, %rsi
callq 0x5850
movl %eax, %r15d
movq %r13, %rdi
callq 0x4110
testb %r15b, %r15b
jne 0xcb25
movq %r13, %rdi
leaq 0x1bde(%rip), %rsi      # 0xe5e2
leaq -0x38(%rbp), %rdx
callq 0x40d0
movq %r13, %rdi
movq %r14, %rsi
callq 0x5850
movl %eax, %r15d
movq %r13, %rdi
callq 0x4110
testb %r15b, %r15b
je 0xca6d
leaq -0x38(%rbp), %rdi
movq %r12, %rsi
callq 0xd09e
andq $0x0, -0x60(%rbp)
xorps %xmm0, %xmm0
movaps %xmm0, -0x70(%rbp)
movq -0x38(%rbp), %rax
movq (%rax), %r15
cmpq 0x8(%rax), %r15
je 0xca9c
movups (%r15), %xmm0
movups %xmm0, -0xd0(%rbp)
movq %r13, %rdi
movq %rbx, %rsi
callq 0xcd44
addq $0x10, %r15
movq -0x38(%rbp), %rax
jmp 0xca47
movq 0x9554(%rip), %rdi      # 0x15fc8
leaq 0x23ca(%rip), %rsi      # 0xee45
callq 0x4260
movq %rax, %rdi
leaq -0xb0(%rbp), %rsi
callq 0x4210
movq %rax, %rdi
callq 0x4140
jmp 0xcb25
movq %rbx, %rdi
xorl %esi, %esi
callq 0x4370
movq -0x70(%rbp), %r15
cmpq -0x68(%rbp), %r15
je 0xcac2
movq -0x50(%rbp), %rdi
movq %r15, %rsi
callq 0xcebe
addq $0x10, %r15
jmp 0xcaaa
leaq -0xc0(%rbp), %rdi
xorl %esi, %esi
callq 0x4370
movq 0x94f1(%rip), %rdi      # 0x15fc8
leaq 0x235c(%rip), %rsi      # 0xee3a
callq 0x4260
movq %rax, %r15
movq %rbx, %rdi
leaq -0xc0(%rbp), %rsi
callq 0xd074
movq %r15, %rdi
callq 0x4350
movq %rax, %rdi
leaq 0x15b2(%rip), %rsi      # 0xe0b9
callq 0x4260
movq %rax, %rdi
callq 0x4140
movq %r13, %rdi
callq 0xcd06
leaq -0x30(%rbp), %rdi
callq 0x59d4
movq %r14, %rdi
callq 0x4110
movq %r12, %rdi
callq 0x4130
jmp 0xc972
leaq -0x48(%rbp), %rdi
callq 0x59d4
leaq -0xb0(%rbp), %rdi
callq 0x4110
addq $0x228, %rsp            # imm = 0x228
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0xcbb2
jmp 0xcb75
jmp 0xcb75
jmp 0xcb6e
jmp 0xcb75
movq %rax, %rbx
jmp 0xcba9
jmp 0xcb7c
movq %rax, %rbx
jmp 0xcb91
jmp 0xcb7c
movq %rax, %rbx
leaq -0x70(%rbp), %rdi
callq 0xcd06
leaq -0x30(%rbp), %rdi
callq 0x59d4
leaq -0x90(%rbp), %rdi
callq 0x4110
leaq -0x250(%rbp), %rdi
callq 0x4130
leaq -0x48(%rbp), %rdi
callq 0x59d4
leaq -0xb0(%rbp), %rdi
callq 0x4110
movq %rbx, %rdi
callq 0x43e0