// File: /workspace/github_cpp_makefile_star2_O1/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 $0x2a8, %rsp            # imm = 0x2A8
movl $0x50, %edi
callq 0x31d0
movabsq $0x100000001, %rbx      # imm = 0x100000001
movq %rbx, 0x8(%rax)
leaq 0x5611(%rip), %rcx      # 0x8b20
movq %rcx, (%rax)
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rax)
movups %xmm0, 0x20(%rax)
movups %xmm0, 0x30(%rax)
leaq 0x5788(%rip), %rcx      # 0x8cb0
addq $0x10, %rcx
movq %rcx, 0x10(%rax)
leaq 0x48(%rax), %rcx
movq %rcx, 0x18(%rax)
movq $0x1, 0x20(%rax)
movups %xmm0, 0x28(%rax)
movl $0x3f800000, 0x38(%rax) # imm = 0x3F800000
movq %rax, -0x40(%rbp)
movups %xmm0, 0x40(%rax)
movl $0x50, %edi
callq 0x31d0
movq %rbx, 0x8(%rax)
leaq 0x5668(%rip), %rcx      # 0x8bd0
movq %rcx, (%rax)
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rax)
movups %xmm0, 0x20(%rax)
movups %xmm0, 0x30(%rax)
leaq 0x5777(%rip), %rcx      # 0x8cf8
addq $0x10, %rcx
movq %rcx, 0x10(%rax)
leaq 0x48(%rax), %rcx
movq %rcx, 0x18(%rax)
movq $0x1, 0x20(%rax)
movups %xmm0, 0x28(%rax)
movl $0x3f800000, 0x38(%rax) # imm = 0x3F800000
movq %rax, -0x38(%rbp)
movups %xmm0, 0x40(%rax)
movl $0x50, %edi
callq 0x31d0
movq %rbx, 0x8(%rax)
leaq 0x565f(%rip), %rcx      # 0x8c20
movq %rcx, (%rax)
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rax)
movups %xmm0, 0x20(%rax)
movups %xmm0, 0x30(%rax)
leaq 0x5756(%rip), %rcx      # 0x8d30
addq $0x10, %rcx
movq %rcx, 0x10(%rax)
leaq 0x48(%rax), %rcx
movq %rcx, 0x18(%rax)
movq $0x1, 0x20(%rax)
movups %xmm0, 0x28(%rax)
movl $0x3f800000, 0x38(%rax) # imm = 0x3F800000
movq %rax, -0x30(%rbp)
movups %xmm0, 0x40(%rax)
movl $0x50, %edi
callq 0x31d0
movq %rax, %r12
movq -0x40(%rbp), %rsi
addq $0x10, %rsi
movq %rbx, 0x8(%rax)
leaq 0x564b(%rip), %rax      # 0x8c70
movq %rax, (%r12)
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%r12)
movups %xmm0, 0x20(%r12)
movups %xmm0, 0x30(%r12)
leaq 0x5723(%rip), %rax      # 0x8d68
addq $0x10, %rax
movq %rax, 0x10(%r12)
leaq 0x48(%r12), %rax
movq %rax, 0x18(%r12)
movq $0x1, 0x20(%r12)
movups %xmm0, 0x28(%r12)
movl $0x3f800000, 0x38(%r12) # imm = 0x3F800000
movups %xmm0, 0x40(%r12)
leaq -0xb8(%rbp), %rax
movl $0x0, (%rax)
movq $0x0, 0x8(%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
movups %xmm0, 0x20(%rax)
movups %xmm0, 0x30(%rax)
leaq -0xc0(%rbp), %rdi
callq 0x464c
movq -0x38(%rbp), %rsi
addq $0x10, %rsi
leaq -0xc0(%rbp), %rdi
callq 0x464c
movq -0x30(%rbp), %rsi
addq $0x10, %rsi
leaq -0xc0(%rbp), %rdi
callq 0x464c
movq %r12, %rsi
addq $0x10, %rsi
leaq -0xc0(%rbp), %rdi
callq 0x464c
leaq -0x68(%rbp), %rax
movq %rax, -0x10(%rax)
leaq 0x2913(%rip), %rsi      # 0x6004
leaq 0x2915(%rip), %rdx      # 0x600d
leaq -0x78(%rbp), %rdi
callq 0x3e44
leaq -0x2c8(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0x3ee0
movq -0x78(%rbp), %rdi
leaq -0x68(%rbp), %rax
cmpq %rax, %rdi
je 0x3723
callq 0x31a0
leaq -0x60(%rbp), %r15
leaq -0x2c8(%rbp), %r13
leaq -0x78(%rbp), %rbx
leaq -0xc0(%rbp), %r14
movq %r13, %rdi
callq 0x30e0
cmpl $-0x1, %eax
je 0x376c
movq %rbx, %rdi
movq %r13, %rsi
callq 0x3f36
movq %r14, %rdi
movq %rbx, %rsi
callq 0x4682
movq -0x70(%rbp), %rdi
cmpq %r15, %rdi
je 0x3739
callq 0x31a0
jmp 0x3739
leaq -0x78(%rbp), %rdi
leaq -0x68(%rbp), %rax
movq %rax, (%rdi)
leaq 0x2890(%rip), %rsi      # 0x600e
leaq 0x2893(%rip), %rdx      # 0x6018
callq 0x3e44
leaq -0xc0(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0x4714
movq -0x78(%rbp), %rdi
leaq -0x68(%rbp), %rax
cmpq %rax, %rdi
je 0x37ac
callq 0x31a0
leaq -0x2c8(%rbp), %rdi
callq 0x4254
movq -0x90(%rbp), %rdi
testq %rdi, %rdi
je 0x37c9
callq 0x31a0
leaq -0xc0(%rbp), %rdi
callq 0x39c8
movq %r12, %rdi
callq 0x395c
movq -0x30(%rbp), %rdi
callq 0x395c
movq -0x38(%rbp), %rdi
callq 0x395c
movq -0x40(%rbp), %rdi
callq 0x395c
xorl %eax, %eax
addq $0x2a8, %rsp            # imm = 0x2A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rdx, %r13
movq %rax, %rbx
movq -0x78(%rbp), %rdi
leaq -0x68(%rbp), %rax
cmpq %rax, %rdi
jne 0x38ad
jmp 0x38ba
jmp 0x38b4
movq %rdx, %r13
movq %rax, %rbx
movq -0x78(%rbp), %rdi
leaq -0x68(%rbp), %rax
cmpq %rax, %rdi
je 0x38c6
callq 0x31a0
jmp 0x38c6
movq %rdx, %r13
movq %rax, %rbx
jmp 0x38c6
movq %rax, %rbx
jmp 0x3879
movq %rax, %rbx
jmp 0x3882
movq %rax, %rbx
jmp 0x388b
movq %rax, %rbx
leaq -0xc0(%rbp), %rdi
callq 0x3936
movq %r12, %rdi
callq 0x395c
movq -0x30(%rbp), %rdi
callq 0x395c
movq -0x38(%rbp), %rdi
callq 0x395c
movq -0x40(%rbp), %rdi
callq 0x395c
movq %rbx, %rdi
callq 0x32f0
jmp 0x38b4
movq %rdx, %r13
movq %rax, %rbx
movq -0x70(%rbp), %rdi
cmpq %r15, %rdi
je 0x38ba
callq 0x31a0
jmp 0x38ba
movq %rdx, %r13
movq %rax, %rbx
leaq -0x2c8(%rbp), %rdi
callq 0x4254
cmpl $0x1, %r13d
jne 0x3865
movq %rbx, %rdi
callq 0x30f0
movq (%rax), %rcx
movq %rax, %rdi
callq *0x10(%rcx)
movq 0x56f4(%rip), %rdi      # 0x8fd8
movq %rax, %rsi
callq 0x31c0
leaq -0x2c8(%rbp), %rsi
movb $0xa, (%rsi)
movl $0x1, %edx
movq %rax, %rdi
callq 0x3210
callq 0x32c0
jmp 0x37b8
jmp 0x3862
movq %rax, %rbx
callq 0x32c0
jmp 0x3865
movq %rax, %rdi
callq 0x3927