// File: /workspace/github_cpp_makefile_star2_O2/dsudheerdantuluri[P]quantlab/tradecal.cc
// Function: main
int main()
{
  std::shared_ptr<TradeOperation> p_mtg = std::make_shared<TradeMTGap>();
  std::shared_ptr<TradeOperation> p_tv = std::make_shared<TradeVolume>();
  std::shared_ptr<TradeOperation> p_wap = std::make_shared<TradeWAP>();
  std::shared_ptr<TradeOperation> p_tm = std::make_shared<TradeMax>();

  TradeProcessor tp;
  tp.addOperation(p_mtg.get());
  tp.addOperation(p_tv.get());
  tp.addOperation(p_wap.get());
  tp.addOperation(p_tm.get());

  try {
    TradeStreamReader tr("input.csv");
    while (tr.hasNext()) {
      Trade t = tr.next();
      tp.process(t);
    }

    tp.dumpResults("output.csv");
  } catch(std::exception &e) {
    std::cout << e.what() << '\n';
  }

  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x2d8, %rsp            # imm = 0x2D8
leaq -0x2f8(%rbp), %rbx
movq %rbx, %rdi
callq 0x3776
movups (%rbx), %xmm0
leaq -0x58(%rbp), %rax
movups %xmm0, -0x8(%rax)
leaq -0x2f0(%rbp), %rdi
xorps %xmm0, %xmm0
movups %xmm0, -0x8(%rdi)
callq 0x3826
leaq -0x2f8(%rbp), %rdi
callq 0x3792
leaq -0x2f0(%rbp), %rdi
movups -0x8(%rdi), %xmm0
leaq -0x48(%rbp), %rax
movups %xmm0, -0x8(%rax)
xorps %xmm0, %xmm0
movups %xmm0, -0x8(%rdi)
callq 0x3826
leaq -0x2f8(%rbp), %rdi
callq 0x37ae
leaq -0x2f0(%rbp), %rdi
movups -0x8(%rdi), %xmm0
leaq -0x38(%rbp), %rax
movups %xmm0, -0x8(%rax)
xorps %xmm0, %xmm0
movups %xmm0, -0x8(%rdi)
callq 0x3826
leaq -0x2f8(%rbp), %rdi
callq 0x37ca
leaq -0x2f0(%rbp), %rdi
movups -0x8(%rdi), %xmm0
leaq -0xe8(%rbp), %r12
movups %xmm0, -0x8(%r12)
xorps %xmm0, %xmm0
movups %xmm0, -0x8(%rdi)
callq 0x3826
leaq -0xd8(%rbp), %rax
andl $0x0, (%rax)
andq $0x0, 0x8(%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
xorps %xmm0, %xmm0
movups %xmm0, 0x20(%rax)
movups %xmm0, 0x30(%rax)
movq -0x60(%rbp), %rsi
leaq -0xe0(%rbp), %rdi
callq 0x48b4
movq -0x50(%rbp), %rsi
leaq -0xe0(%rbp), %rdi
callq 0x48b4
movq -0x40(%rbp), %rsi
leaq -0xe0(%rbp), %rdi
callq 0x48b4
movq -0xf0(%rbp), %rsi
leaq -0xe0(%rbp), %rdi
callq 0x48b4
leaq 0x3a91(%rip), %rsi      # 0x7020
leaq -0x98(%rbp), %rdi
leaq -0x29(%rbp), %rdx
callq 0x30f0
leaq -0x2f8(%rbp), %rdi
leaq -0x98(%rbp), %rsi
callq 0x42d0
leaq -0x98(%rbp), %rbx
movq %rbx, %rdi
callq 0x3120
leaq -0x90(%rbp), %r13
leaq -0x2f8(%rbp), %r14
leaq -0xe0(%rbp), %r15
movq %r14, %rdi
callq 0x37e6
testb %al, %al
je 0x3602
movq %rbx, %rdi
movq %r14, %rsi
callq 0x431a
movq %r15, %rdi
movq %rbx, %rsi
callq 0x48d6
movq %r13, %rdi
callq 0x3120
jmp 0x35d6
leaq 0x3a21(%rip), %rsi      # 0x702a
leaq -0x98(%rbp), %rdi
leaq -0x29(%rbp), %rdx
callq 0x30f0
leaq -0xe0(%rbp), %rdi
leaq -0x98(%rbp), %rsi
callq 0x4952
leaq -0x98(%rbp), %rdi
callq 0x3120
leaq -0x2f8(%rbp), %rdi
callq 0x44c6
leaq -0xe0(%rbp), %rdi
callq 0x3806
movq %r12, %rdi
callq 0x3826
leaq -0x38(%rbp), %rdi
callq 0x3826
leaq -0x48(%rbp), %rdi
callq 0x3826
leaq -0x58(%rbp), %rdi
callq 0x3826
xorl %eax, %eax
addq $0x2d8, %rsp            # imm = 0x2D8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rdx, %r14
movq %rax, %rbx
leaq -0x98(%rbp), %rdi
jmp 0x3706
jmp 0x370f
movq %rdx, %r14
movq %rax, %rbx
leaq -0x98(%rbp), %rdi
callq 0x3120
jmp 0x3721
movq %rdx, %r14
movq %rax, %rbx
jmp 0x3721
movq %rax, %rbx
jmp 0x36da
movq %rax, %rbx
jmp 0x36e3
movq %rax, %rbx
jmp 0x36ec
movq %rax, %rbx
leaq -0xe0(%rbp), %rdi
callq 0x3806
movq %r12, %rdi
callq 0x3826
leaq -0x38(%rbp), %rdi
callq 0x3826
leaq -0x48(%rbp), %rdi
callq 0x3826
leaq -0x58(%rbp), %rdi
callq 0x3826
movq %rbx, %rdi
callq 0x32f0
movq %rdx, %r14
movq %rax, %rbx
movq %r13, %rdi
callq 0x3120
jmp 0x3715
jmp 0x370f
movq %rdx, %r14
movq %rax, %rbx
leaq -0x2f8(%rbp), %rdi
callq 0x44c6
cmpl $0x1, %r14d
jne 0x36c6
movq %rbx, %rdi
callq 0x3100
movq (%rax), %rcx
movq %rax, %rdi
callq *0x10(%rcx)
movq 0x7899(%rip), %rdi      # 0xafd8
movq %rax, %rsi
callq 0x31d0
pushq $0xa
popq %rsi
movq %rax, %rdi
callq 0x3220
callq 0x32d0
jmp 0x3644
jmp 0x36c3
movq %rax, %rbx
callq 0x32d0
jmp 0x36c6
movq %rax, %rdi
callq 0x37f7