// File: /workspace/github_c_makefile_star2_O3/aspone[P]OrderBook/./MessageParser.h
// Function: OrderBook::MessageParser::parseTrade(char*, TradeMessage&)
inline void MessageParser::parseTrade(char *tk_msg, TradeMessage &tm) {
   ParseStatus result = tokenizeAndConvertToUint(tk_msg, tm.trade_qty_);
   if (result != ePS_Good) {
      if (result == ePS_CorruptMessage)
         return failTradeParse(tm, result);;
      return failTradeParse(tm, ePS_BadQuantity);
   }
   if (tm.trade_qty_ == 0) return failTradeParse(tm, ePS_BadPrice);

   double price;
   result = tokenizeAndConvertToDouble(tk_msg, price);
   if (result != ePS_Good) {
      if (result == ePS_CorruptMessage)
         return failTradeParse(tm, result);
      return failTradeParse(tm, ePS_BadPrice);
   }
   // technically not supporting prices up to double here.
   if (price > ULLONG_MAX) {
      return failTradeParse(tm, ePS_BadPrice);
   }

   // Bail if not 0-2 decimals of precision
   if ((double)(price * 100) - static_cast<unsigned long long>(price * 100) != 0) {
      return failTradeParse(tm, ePS_BadPrice);
   }
   if (static_cast<unsigned long long>(price * 100) == 0) return failTradeParse(tm, ePS_BadPrice);

   tm.trade_price_ = static_cast<unsigned long long>(price * 100);
   if (tm.trade_price_ > MAXPRICE - 1) {
      DB("Price: %llu.  Max: %d\n", tm.trade_price_, MAXPRICE - 1);
      return failTradeParse(tm, ePS_BadPrice);
   }

   FHErrorTracker::instance()->goodMessage();
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x28, %rsp
movq %rdx, %rbx
leaq 0x3ddb(%rip), %rsi      # 0x71dc
xorl %edi, %edi
callq 0x22c0
movq %rax, 0x10(%rsp)
testq %rax, %rax
je 0x35ad
movq %rax, %r14
cmpb $0x2d, (%rax)
je 0x3569
movq %r14, %rdi
callq 0x20a0
addq %rax, %r14
movq %r14, 0x18(%rsp)
testq %rax, %rax
je 0x3569
leaq 0x10(%rsp), %rdi
leaq 0x18(%rsp), %rsi
movq %rbx, %rdx
callq 0x4308
testb %al, %al
je 0x3569
cmpl $0x0, (%rbx)
je 0x35f7
leaq 0x3d77(%rip), %rsi      # 0x71dc
xorl %edi, %edi
callq 0x22c0
movq %rax, 0x10(%rsp)
testq %rax, %rax
je 0x3635
movq %rax, %r14
cmpb $0x2d, (%rax)
je 0x3521
movq %r14, %rdi
callq 0x20a0
addq %rax, %r14
leaq 0x18(%rsp), %rsi
movq %r14, (%rsi)
leaq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rdx
leaq 0xf(%rsp), %rcx
callq 0x44b0
testb %al, %al
je 0x3521
movsd 0x20(%rsp), %xmm0
ucomisd 0x3b49(%rip), %xmm0     # 0x7008
ja 0x3521
mulsd 0x3b47(%rip), %xmm0     # 0x7010
cvttsd2si %xmm0, %rcx
movq %rcx, %rdx
movapd %xmm0, %xmm1
subsd 0x3b3b(%rip), %xmm1     # 0x7018
cvttsd2si %xmm1, %rax
sarq $0x3f, %rdx
andq %rdx, %rax
orq %rcx, %rax
movq %rax, %xmm1
punpckldq 0x3b37(%rip), %xmm1 # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x3b3f(%rip), %xmm1     # 0x7040
movapd %xmm1, %xmm2
unpckhpd %xmm1, %xmm2            # xmm2 = xmm2[1],xmm1[1]
addsd %xmm1, %xmm2
subsd %xmm2, %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x3521
jnp 0x367f
movl $0x0, (%rbx)
movq $0x0, 0x8(%rbx)
leaq 0x7c8a(%rip), %rbx      # 0xb1c0
movq (%rbx), %rax
testq %rax, %rax
jne 0x3560
movl $0x28, %edi
callq 0x21f0
xorpd %xmm0, %xmm0
movupd %xmm0, (%rax)
movupd %xmm0, 0x10(%rax)
movq $0x0, 0x20(%rax)
movq %rax, (%rbx)
addq $0x1c, %rax
jmp 0x3678
movl $0x0, (%rbx)
movq $0x0, 0x8(%rbx)
leaq 0x7c42(%rip), %rbx      # 0xb1c0
movq (%rbx), %rax
testq %rax, %rax
jne 0x35a8
movl $0x28, %edi
callq 0x21f0
xorpd %xmm0, %xmm0
movupd %xmm0, (%rax)
movupd %xmm0, 0x10(%rax)
movq $0x0, 0x20(%rax)
movq %rax, (%rbx)
incl 0x18(%rax)
jmp 0x35ef
movl $0x0, (%rbx)
movq $0x0, 0x8(%rbx)
leaq 0x7bfe(%rip), %rbx      # 0xb1c0
movq (%rbx), %rax
testq %rax, %rax
jne 0x35ec
movl $0x28, %edi
callq 0x21f0
xorpd %xmm0, %xmm0
movupd %xmm0, (%rax)
movupd %xmm0, 0x10(%rax)
movq $0x0, 0x20(%rax)
movq %rax, (%rbx)
incl 0x14(%rax)
addq $0x28, %rsp
popq %rbx
popq %r14
retq
movq $0x0, 0x8(%rbx)
leaq 0x7bba(%rip), %rbx      # 0xb1c0
movq (%rbx), %rax
testq %rax, %rax
jne 0x3630
movl $0x28, %edi
callq 0x21f0
xorpd %xmm0, %xmm0
movupd %xmm0, (%rax)
movupd %xmm0, 0x10(%rax)
movq $0x0, 0x20(%rax)
movq %rax, (%rbx)
incl 0x1c(%rax)
jmp 0x35ef
movl $0x0, (%rbx)
movq $0x0, 0x8(%rbx)
leaq 0x7b76(%rip), %rbx      # 0xb1c0
movq (%rbx), %rax
testq %rax, %rax
jne 0x3674
movl $0x28, %edi
callq 0x21f0
xorpd %xmm0, %xmm0
movupd %xmm0, (%rax)
movupd %xmm0, 0x10(%rax)
movq $0x0, 0x20(%rax)
movq %rax, (%rbx)
addq $0x14, %rax
incl (%rax)
jmp 0x35ef
testq %rax, %rax
je 0x3521
movq %rax, 0x8(%rbx)
cmpq $0x989680, %rax         # imm = 0x989680
jae 0x3521
leaq 0x7b21(%rip), %rbx      # 0xb1c0
movq (%rbx), %rax
testq %rax, %rax
jne 0x36c9
movl $0x28, %edi
callq 0x21f0
xorpd %xmm0, %xmm0
movupd %xmm0, (%rax)
movupd %xmm0, 0x10(%rax)
movq $0x0, 0x20(%rax)
movq %rax, (%rbx)
addq $0x24, %rax
jmp 0x3678
nop