// File: /workspace/github_cpp_makefile_star2_O3/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, %r14
leaq -0x80(%rbp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
movl $0x30, %edi
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)
movq $0x0, 0x28(%rax)
leaq -0xb8(%rbp), %rdi
movq %rax, -0x8(%rdi)
movq %rax, %rsi
callq 0xf912
leaq -0x250(%rbp), %r12
leaq -0x50(%rbp), %rbx
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x4250
movsbl %al, %edx
movq %r14, %rdi
leaq -0x90(%rbp), %rsi
callq 0x4420
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0xf81f
movq %r12, %rdi
leaq -0x90(%rbp), %rsi
movl $0x8, %edx
callq 0x43b0
leaq -0x60(%rbp), %rax
movq %rax, -0x70(%rbp)
movq $0x0, -0x68(%rbp)
movb $0x0, -0x60(%rbp)
movq %r12, %rdi
leaq -0x70(%rbp), %rsi
callq 0x4300
leaq -0x40(%rbp), %rax
movq %rax, -0x50(%rbp)
movq %rbx, %rdi
leaq 0x1b20(%rip), %rsi      # 0x1108d
leaq 0x1b1b(%rip), %rdx      # 0x1108f
callq 0x78c0
movq -0x48(%rbp), %rdx
cmpq -0x68(%rbp), %rdx
jne 0xf5a0
movq -0x50(%rbp), %r15
testq %rdx, %rdx
je 0xf5a9
movq -0x70(%rbp), %rsi
movq %r15, %rdi
callq 0x42a0
testl %eax, %eax
sete %r13b
jmp 0xf5ac
movq -0x50(%rbp), %r15
xorl %r13d, %r13d
jmp 0xf5ac
movb $0x1, %r13b
leaq -0x40(%rbp), %rax
cmpq %rax, %r15
je 0xf5c4
movq -0x40(%rbp), %rsi
incq %rsi
movq %r15, %rdi
callq 0x4280
testb %r13b, %r13b
jne 0xf7e6
leaq -0x40(%rbp), %rax
movq %rax, -0x50(%rbp)
movq %rbx, %rdi
leaq 0x2033(%rip), %rsi      # 0x11612
leaq 0x2030(%rip), %rdx      # 0x11616
callq 0x78c0
movq -0x48(%rbp), %rdx
cmpq -0x68(%rbp), %rdx
jne 0xf612
movq -0x50(%rbp), %r15
testq %rdx, %rdx
je 0xf61b
movq -0x70(%rbp), %rsi
movq %r15, %rdi
callq 0x42a0
testl %eax, %eax
sete %r13b
jmp 0xf61e
movq -0x50(%rbp), %r15
xorl %r13d, %r13d
jmp 0xf61e
movb $0x1, %r13b
leaq -0x40(%rbp), %rax
cmpq %rax, %r15
je 0xf636
movq -0x40(%rbp), %rsi
incq %rsi
movq %r15, %rdi
callq 0x4280
testb %r13b, %r13b
je 0xf6af
leaq -0xb0(%rbp), %rdi
movq %r12, %rsi
callq 0xfd12
xorps %xmm0, %xmm0
movaps %xmm0, -0x50(%rbp)
movq $0x0, -0x40(%rbp)
movq -0xb0(%rbp), %rax
movq (%rax), %r15
cmpq 0x8(%rax), %r15
je 0xf710
movups (%r15), %xmm0
movups %xmm0, -0xa0(%rbp)
movq -0x48(%rbp), %rsi
cmpq -0x40(%rbp), %rsi
je 0xf693
movups -0xa0(%rbp), %xmm0
movups %xmm0, (%rsi)
addq $0x10, -0x48(%rbp)
jmp 0xf6a2
movq %rbx, %rdi
leaq -0xa0(%rbp), %rdx
callq 0xfa44
addq $0x10, %r15
movq -0xb0(%rbp), %rax
jmp 0xf663
movl $0x1f, %edx
movq 0x890d(%rip), %rdi      # 0x17fc8
leaq 0x27b3(%rip), %rsi      # 0x11e75
callq 0x42d0
movq -0x90(%rbp), %rsi
movq -0x88(%rbp), %rdx
movq 0x88ec(%rip), %rdi      # 0x17fc8
callq 0x42d0
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x4250
movsbl %al, %esi
movq %r15, %rdi
callq 0x4030
movq %rax, %rdi
callq 0x4190
jmp 0xf7e6
leaq -0xa0(%rbp), %rdi
xorl %esi, %esi
callq 0x4380
movq -0x50(%rbp), %r15
cmpq -0x48(%rbp), %r15
je 0xf73d
movq -0xc0(%rbp), %rdi
movq %r15, %rsi
callq 0xfb92
addq $0x10, %r15
jmp 0xf722
leaq -0xd0(%rbp), %rdi
xorl %esi, %esi
callq 0x4380
movl $0xa, %edx
movq 0x8871(%rip), %rdi      # 0x17fc8
leaq 0x270c(%rip), %rsi      # 0x11e6a
callq 0x42d0
leaq -0xa0(%rbp), %rdi
leaq -0xd0(%rbp), %rsi
callq 0xfce8
movq 0x884b(%rip), %rdi      # 0x17fc8
callq 0x4360
movq %rax, %r15
movl $0x3, %edx
movq %rax, %rdi
leaq 0x1925(%rip), %rsi      # 0x110b9
callq 0x42d0
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x4250
movsbl %al, %esi
movq %r15, %rdi
callq 0x4030
movq %rax, %rdi
callq 0x4190
movq -0x50(%rbp), %rdi
testq %rdi, %rdi
je 0xf7d5
movq -0x40(%rbp), %rsi
subq %rdi, %rsi
callq 0x4280
movq -0xa8(%rbp), %rdi
testq %rdi, %rdi
je 0xf7e6
callq 0x65c2
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0xf7ff
movq -0x60(%rbp), %rsi
incq %rsi
callq 0x4280
movq %r12, %rdi
movq 0x87af(%rip), %rsi      # 0x17fb8
callq 0x4310
leaq -0x1d8(%rbp), %rdi
callq 0x40b0
jmp 0xf4ef
movq -0xb8(%rbp), %rdi
testq %rdi, %rdi
je 0xf830
callq 0x65c2
movq -0x90(%rbp), %rdi
leaq -0x80(%rbp), %rax
cmpq %rax, %rdi
je 0xf84c
movq -0x80(%rbp), %rsi
incq %rsi
callq 0x4280
addq $0x228, %rsp            # imm = 0x228
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0xf8ee
jmp 0xf877
jmp 0xf877
jmp 0xf877
jmp 0xf872
jmp 0xf87c
jmp 0xf87c
movq %rax, %rbx
jmp 0xf8dd
movq %rax, %rbx
jmp 0xf8a5
movq %rax, %rbx
movq -0x50(%rbp), %rdi
testq %rdi, %rdi
je 0xf894
movq -0x40(%rbp), %rsi
subq %rdi, %rsi
callq 0x4280
movq -0xa8(%rbp), %rdi
testq %rdi, %rdi
je 0xf8a5
callq 0x65c2
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0xf8be
movq -0x60(%rbp), %rsi
incq %rsi
callq 0x4280
movq 0x86f3(%rip), %rsi      # 0x17fb8
leaq -0x250(%rbp), %rdi
callq 0x4310
leaq -0x1d8(%rbp), %rdi
callq 0x40b0
movq -0xb8(%rbp), %rdi
testq %rdi, %rdi
je 0xf8ee
callq 0x65c2
movq -0x90(%rbp), %rdi
leaq -0x80(%rbp), %rax
cmpq %rax, %rdi
je 0xf90a
movq -0x80(%rbp), %rsi
incq %rsi
callq 0x4280
movq %rbx, %rdi
callq 0x4400