// File: /workspace/github_c_makefile_star2_O1/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 %r15
pushq %r14
pushq %rbx
subq $0x20, %rsp
movq %rdx, %rbx
movq %rsi, %r14
movq %rsi, 0x8(%rsp)
leaq 0x3d73(%rip), %rsi      # 0x7218
xorl %edi, %edi
callq 0x22c0
movq %rax, 0x8(%rsp)
testq %rax, %rax
je 0x34f9
movq %rax, %r15
movl $0x5, %eax
cmpb $0x2d, (%r15)
je 0x350a
movq %r15, %rdi
callq 0x20a0
movq %r15, %rcx
addq %rax, %rcx
movq %rcx, 0x10(%rsp)
testq %rax, %rax
je 0x3500
leaq 0x8(%rsp), %rdi
leaq 0x10(%rsp), %rsi
movq %rbx, %rdx
callq 0x4448
testb %al, %al
jne 0x3502
movq %r15, 0x8(%rsp)
jmp 0x3502
movl $0x1, %eax
jmp 0x350a
xorl %eax, %eax
xorb $0x1, %al
movzbl %al, %eax
leal (%rax,%rax,4), %eax
testl %eax, %eax
je 0x355f
cmpl $0x1, %eax
jne 0x35cf
movl $0x0, (%rbx)
movq $0x0, 0x8(%rbx)
leaq 0x7c94(%rip), %rbx      # 0xb1c0
cmpq $0x0, (%rbx)
jne 0x3554
movl $0x28, %edi
callq 0x21f0
xorpd %xmm0, %xmm0
movupd %xmm0, (%rax)
movupd %xmm0, 0x10(%rax)
movq $0x0, 0x20(%rax)
movq %rax, (%rbx)
movq (%rbx), %rax
incl 0x14(%rax)
jmp 0x3752
cmpl $0x0, (%rbx)
je 0x3617
movq %r14, 0x8(%rsp)
leaq 0x3ca4(%rip), %rsi      # 0x7218
xorl %edi, %edi
callq 0x22c0
movq %rax, 0x8(%rsp)
testq %rax, %rax
je 0x365f
movq %rax, %r14
movl $0x5, %eax
cmpb $0x2d, (%r14)
je 0x3664
movq %r14, %rdi
callq 0x20a0
addq %rax, %r14
leaq 0x10(%rsp), %rsi
movq %r14, (%rsi)
leaq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rdx
leaq 0x7(%rsp), %rcx
callq 0x4658
xorb $0x1, %al
movzbl %al, %eax
leal (%rax,%rax,4), %eax
jmp 0x3664
movl $0x0, (%rbx)
movq $0x0, 0x8(%rbx)
leaq 0x7bdc(%rip), %rbx      # 0xb1c0
cmpq $0x0, (%rbx)
jne 0x360c
movl $0x28, %edi
callq 0x21f0
xorpd %xmm0, %xmm0
movupd %xmm0, (%rax)
movupd %xmm0, 0x10(%rax)
movq $0x0, 0x20(%rax)
movq %rax, (%rbx)
movq (%rbx), %rax
incl 0x18(%rax)
jmp 0x3752
movl $0x0, (%rbx)
movq $0x0, 0x8(%rbx)
leaq 0x7b94(%rip), %rbx      # 0xb1c0
cmpq $0x0, (%rbx)
jne 0x3654
movl $0x28, %edi
callq 0x21f0
xorpd %xmm0, %xmm0
movupd %xmm0, (%rax)
movupd %xmm0, 0x10(%rax)
movq $0x0, 0x20(%rax)
movq %rax, (%rbx)
movq (%rbx), %rax
incl 0x1c(%rax)
jmp 0x3752
movl $0x1, %eax
testl %eax, %eax
je 0x3690
cmpl $0x1, %eax
jne 0x36fc
movl $0x0, (%rbx)
movq $0x0, 0x8(%rbx)
leaq 0x7b3a(%rip), %rax      # 0xb1c0
movl $0x14, %ebx
jmp 0x3716
movsd 0x18(%rsp), %xmm0
ucomisd 0x396a(%rip), %xmm0     # 0x7008
ja 0x36fc
mulsd 0x3968(%rip), %xmm0     # 0x7010
cvttsd2si %xmm0, %rcx
movq %rcx, %rdx
movapd %xmm0, %xmm1
subsd 0x395c(%rip), %xmm1     # 0x7018
cvttsd2si %xmm1, %rax
sarq $0x3f, %rdx
andq %rdx, %rax
orq %rcx, %rax
movq %rax, %xmm1
punpckldq 0x3958(%rip), %xmm1 # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x3960(%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 0x36fc
jnp 0x375c
movl $0x0, (%rbx)
movq $0x0, 0x8(%rbx)
leaq 0x7aaf(%rip), %rax      # 0xb1c0
movl $0x1c, %ebx
cmpq $0x0, (%rax)
jne 0x3745
movl $0x28, %edi
callq 0x21f0
xorpd %xmm0, %xmm0
movupd %xmm0, (%rax)
movupd %xmm0, 0x10(%rax)
movq $0x0, 0x20(%rax)
leaq 0x7a7e(%rip), %rcx      # 0xb1c0
movq %rax, (%rcx)
leaq 0x7a74(%rip), %rax      # 0xb1c0
movq (%rax), %rax
incl (%rax,%rbx)
addq $0x20, %rsp
popq %rbx
popq %r14
popq %r15
retq
testq %rax, %rax
je 0x36fc
movq %rax, 0x8(%rbx)
cmpq $0x989680, %rax         # imm = 0x989680
jae 0x36fc
leaq 0x7a4c(%rip), %rax      # 0xb1c0
movl $0x24, %ebx
jmp 0x3716
nop