// File: /workspace/github_cpp_makefile_star2_O3/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 0x5649(%rip), %rcx      # 0x8b58
movq %rcx, (%rax)
movq $0x0, 0x38(%rax)
leaq 0x578f(%rip), %rcx      # 0x8cb0
addq $0x10, %rcx
movq %rcx, 0x10(%rax)
leaq 0x48(%rax), %rcx
movq %rcx, 0x18(%rax)
movq $0x1, 0x20(%rax)
xorps %xmm0, %xmm0
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 0x566c(%rip), %rcx      # 0x8bd0
movq %rcx, (%rax)
movq $0x0, 0x38(%rax)
leaq 0x5782(%rip), %rcx      # 0x8cf8
addq $0x10, %rcx
movq %rcx, 0x10(%rax)
leaq 0x48(%rax), %rcx
movq %rcx, 0x18(%rax)
movq $0x1, 0x20(%rax)
xorps %xmm0, %xmm0
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 0x5667(%rip), %rcx      # 0x8c20
movq %rcx, (%rax)
movq $0x0, 0x38(%rax)
leaq 0x5765(%rip), %rcx      # 0x8d30
addq $0x10, %rcx
movq %rcx, 0x10(%rax)
leaq 0x48(%rax), %rcx
movq %rcx, 0x18(%rax)
movq $0x1, 0x20(%rax)
xorps %xmm0, %xmm0
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 0x5657(%rip), %rax      # 0x8c70
movq %rax, (%r12)
xorl %eax, %eax
movq %rax, 0x38(%r12)
leaq 0x573d(%rip), %rcx      # 0x8d68
addq $0x10, %rcx
movq %rcx, 0x10(%r12)
leaq 0x48(%r12), %rcx
movq %rcx, 0x18(%r12)
movq $0x1, 0x20(%r12)
xorps %xmm0, %xmm0
movups %xmm0, 0x28(%r12)
movl $0x3f800000, 0x38(%r12) # imm = 0x3F800000
movups %xmm0, 0x40(%r12)
leaq -0xb8(%rbp), %rcx
movl $0x0, (%rcx)
movq %rax, 0x8(%rcx)
movq %rcx, 0x10(%rcx)
movq %rcx, 0x18(%rcx)
movups %xmm0, 0x20(%rcx)
movups %xmm0, 0x30(%rcx)
leaq -0xc0(%rbp), %rdi
callq 0x45fc
movq -0x38(%rbp), %rsi
addq $0x10, %rsi
leaq -0xc0(%rbp), %rdi
callq 0x45fc
movq -0x30(%rbp), %rsi
addq $0x10, %rsi
leaq -0xc0(%rbp), %rdi
callq 0x45fc
movq %r12, %rsi
addq $0x10, %rsi
leaq -0xc0(%rbp), %rdi
callq 0x45fc
leaq -0x68(%rbp), %rax
movq %rax, -0x10(%rax)
leaq 0x292e(%rip), %rsi      # 0x6004
leaq 0x2930(%rip), %rdx      # 0x600d
leaq -0x78(%rbp), %rdi
callq 0x3dfe
leaq -0x2c8(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0x3e9c
movq -0x78(%rbp), %rdi
leaq -0x68(%rbp), %rax
cmpq %rax, %rdi
je 0x3708
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 0x3751
movq %rbx, %rdi
movq %r13, %rsi
callq 0x3ef2
movq %r14, %rdi
movq %rbx, %rsi
callq 0x4632
movq -0x70(%rbp), %rdi
cmpq %r15, %rdi
je 0x371e
callq 0x31a0
jmp 0x371e
leaq -0x78(%rbp), %rdi
leaq -0x68(%rbp), %rax
movq %rax, (%rdi)
leaq 0x28ab(%rip), %rsi      # 0x600e
leaq 0x28ae(%rip), %rdx      # 0x6018
callq 0x3dfe
leaq -0xc0(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0x46c4
movq -0x78(%rbp), %rdi
leaq -0x68(%rbp), %rax
cmpq %rax, %rdi
je 0x3791
callq 0x31a0
leaq -0x2c8(%rbp), %rdi
callq 0x4228
movq -0x90(%rbp), %rdi
testq %rdi, %rdi
je 0x37ae
callq 0x31a0
leaq -0xc0(%rbp), %rdi
callq 0x39ac
movq %r12, %rdi
callq 0x3940
movq -0x30(%rbp), %rdi
callq 0x3940
movq -0x38(%rbp), %rdi
callq 0x3940
movq -0x40(%rbp), %rdi
callq 0x3940
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 0x3892
jmp 0x389f
jmp 0x3899
movq %rdx, %r13
movq %rax, %rbx
movq -0x78(%rbp), %rdi
leaq -0x68(%rbp), %rax
cmpq %rax, %rdi
je 0x38ab
callq 0x31a0
jmp 0x38ab
movq %rdx, %r13
movq %rax, %rbx
jmp 0x38ab
movq %rax, %rbx
jmp 0x385e
movq %rax, %rbx
jmp 0x3867
movq %rax, %rbx
jmp 0x3870
movq %rax, %rbx
leaq -0xc0(%rbp), %rdi
callq 0x391a
movq %r12, %rdi
callq 0x3940
movq -0x30(%rbp), %rdi
callq 0x3940
movq -0x38(%rbp), %rdi
callq 0x3940
movq -0x40(%rbp), %rdi
callq 0x3940
movq %rbx, %rdi
callq 0x32f0
jmp 0x3899
movq %rdx, %r13
movq %rax, %rbx
movq -0x70(%rbp), %rdi
cmpq %r15, %rdi
je 0x389f
callq 0x31a0
jmp 0x389f
movq %rdx, %r13
movq %rax, %rbx
leaq -0x2c8(%rbp), %rdi
callq 0x4228
cmpl $0x1, %r13d
jne 0x384a
movq %rbx, %rdi
callq 0x30f0
movq (%rax), %rcx
movq %rax, %rdi
callq *0x10(%rcx)
movq 0x570f(%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 0x379d
jmp 0x3847
movq %rax, %rbx
callq 0x32c0
jmp 0x384a
movq %rax, %rdi
callq 0x390c