// File: /workspace/github_cpp_makefile_star2_O3/obliviousram[P]PathOHeap/src/Job.cpp
// Function: Job::run()
void Job::run() {
  int bucket_size = 4;
  int num_blocks = pow(2, 5);
  UntrustedStorageInterface* storage = new ServerStorage();
  RandForOHeapInterface* random = new RandomForOHeap();
  OHeapInterface* oheap = new OHeapReadPathEviction(storage, random, bucket_size, num_blocks, false);

  // Sample computation: fill the heap with some numbers, then read it back.
  for (int i = 0; i < num_blocks; i++) {
    oheap->insertBlock(i, Job::sampleData(i));
    std::cout << "Inserting Block " << i << " to OHeap. The stash size is: " <<
        oheap->getStashSize() << std::endl;
  }

  for (int i = 0; i < num_blocks; i++) {
    std::cout << "Extracting Block " << i << " from OHeap. " << oheap->extractMin() << std::endl;
  }

  delete oheap;
  delete random;
  delete storage;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movl $0x28, %edi
callq 0x2160
movq %rax, %r14
movq %rax, %rdi
callq 0x5ff4
movl $0x20, %edi
callq 0x2160
movq %rax, %r12
movq %rax, %rdi
callq 0x5e7c
movl $0x58, %edi
callq 0x2160
movq %rax, %r15
xorl %ebp, %ebp
movq %rax, %rdi
movq %r14, %rsi
movq %r12, 0x28(%rsp)
movq %r12, %rdx
movl $0x4, %ecx
movl $0x20, %r8d
xorl %r9d, %r9d
callq 0x3be8
movq %r14, 0x20(%rsp)
leaq 0x34(%rsp), %r13
movq 0x8400(%rip), %r12      # 0xafd0
leaq 0x44d3(%rip), %rbx      # 0x70aa
xorps %xmm0, %xmm0
movups %xmm0, 0xc(%r13)
movups %xmm0, (%r13)
movw $0x0, 0x30(%rsp)
movb $0x0, 0x32(%rsp)
movb %bpl, 0x33(%rsp)
movq (%r15), %rax
movups 0x30(%rsp), %xmm0
movups 0x40(%rsp), %xmm1
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
movq %r15, %rdi
movl %ebp, %esi
callq *0x8(%rax)
movl $0x10, %edx
movq %r12, %rdi
leaq 0x4477(%rip), %rsi      # 0x7099
callq 0x2190
movq %r12, %rdi
movl %ebp, %esi
callq 0x2240
movq %rax, %r14
movl $0x1e, %edx
movq %rax, %rdi
movq %rbx, %rsi
callq 0x2190
movq (%r15), %rax
movq %r15, %rdi
callq *0x40(%rax)
movq %r14, %rdi
movl %eax, %esi
callq 0x2240
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x2150
movsbl %al, %esi
movq %r14, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2100
incl %ebp
cmpl $0x20, %ebp
jne 0x2bd7
xorl %ebx, %ebx
movq 0x833b(%rip), %r12      # 0xafd0
leaq 0x443f(%rip), %rbp      # 0x70db
leaq 0x50(%rsp), %r14
movl $0x11, %edx
movq %r12, %rdi
leaq 0x4419(%rip), %rsi      # 0x70c9
callq 0x2190
movq %r12, %rdi
movl %ebx, %esi
callq 0x2240
movq %rax, %r13
movl $0xd, %edx
movq %rax, %rdi
movq %rbp, %rsi
callq 0x2190
movq (%r15), %rax
movq %r14, %rdi
movq %r15, %rsi
callq *0x18(%rax)
movq %r13, %rdi
movq %r14, %rsi
callq 0x2668
movq %rax, %r13
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x2150
movsbl %al, %esi
movq %r13, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2100
incl %ebx
cmpl $0x20, %ebx
jne 0x2ca1
movl $0x8, %esi
movq %r15, %rdi
callq 0x2170
movl $0x8, %esi
movq 0x28(%rsp), %rdi
callq 0x2170
movl $0x8, %esi
movq 0x20(%rsp), %rdi
callq 0x2170
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movl $0x58, %esi
movq %r15, %rdi
jmp 0x2d7c
movq %rax, %rbx
movl $0x20, %esi
movq %r12, %rdi
jmp 0x2d7c
movq %rax, %rbx
movl $0x28, %esi
movq %r14, %rdi
callq 0x2170
movq %rbx, %rdi
callq 0x2250
nopl (%rax)