// File: /workspace/github_c_makefile_star2_O2/aspone[P]OrderBook/./MessageParser.h
// Function: OrderBook::MessageParser::parseOrder(char*, OrderLevelEntry&)
inline void MessageParser::parseOrder(char *tk_msg, OrderLevelEntry &ole) {
   ParseStatus result = tokenizeAndConvertToUint(tk_msg, ole.order_id_);
   if (result != ePS_Good) {
      if (result == ePS_CorruptMessage)
         return failOrderParse(ole, result);
      return failOrderParse(ole, ePS_BadID);
   }

   tk_msg = strtok(NULL, ",");
   if (tk_msg == NULL) {
      return failOrderParse(ole, ePS_CorruptMessage);
   }
   else {
      switch(tk_msg[0]) {
         case 'B':
            ole.order_side_ = eS_Buy;
            break;
         case 'S':
            ole.order_side_ = eS_Sell;
            break;
         default:
            return failOrderParse(ole, ePS_CorruptMessage);
            break;
      }
   }

   result = tokenizeAndConvertToUint(tk_msg, ole.order_qty_);
   if (result != ePS_Good) {
      if (result == ePS_CorruptMessage)
         return failOrderParse(ole, result);
      return failOrderParse(ole, ePS_BadQuantity);
   }
   if (ole.order_qty_ == 0) return failOrderParse(ole, ePS_BadQuantity);

   double price = 0;
   result = tokenizeAndConvertToDouble(tk_msg, price);
   if (result != ePS_Good) {
      if (result == ePS_CorruptMessage)
         return failOrderParse(ole, result);
      return failOrderParse(ole, ePS_BadPrice);
   }
   if (static_cast<unsigned long long>(price * 100) == 0) return failOrderParse(ole, ePS_BadPrice);
   // technically not supporting prices up to double here.
   if (price > ULLONG_MAX) {
      return failOrderParse(ole, ePS_BadPrice);
   }

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

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

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r14
movq %rdi, %rbx
callq 0x3bce
testl %eax, %eax
je 0x3695
cmpl $0x1, %eax
je 0x36de
andl $0x0, 0x14(%r14)
pushq $0x4
jmp 0x36e5
leaq 0x2b66(%rip), %rsi      # 0x6202
xorl %edi, %edi
callq 0x22a0
testq %rax, %rax
je 0x36de
movq %rax, %r15
movzbl (%rax), %eax
cmpl $0x42, %eax
je 0x36bc
cmpl $0x53, %eax
jne 0x36de
pushq $0x2
jmp 0x36be
pushq $0x1
popq %rax
movl %eax, 0x14(%r14)
leaq 0x10(%r14), %r12
movq %rbx, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x3bce
testl %eax, %eax
je 0x36f9
cmpl $0x1, %eax
jne 0x372b
andl $0x0, 0x14(%r14)
pushq $0x1
popq %rsi
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x3e82
cmpl $0x0, (%r12)
je 0x372b
movq %rsp, %rdx
andq $0x0, (%rdx)
movq %rbx, %rdi
movq %r15, %rsi
callq 0x3c3e
testl %eax, %eax
je 0x3734
cmpl $0x1, %eax
jne 0x37a5
andl $0x0, 0x14(%r14)
pushq $0x1
jmp 0x37ac
andl $0x0, 0x14(%r14)
pushq $0x2
jmp 0x36e5
movsd (%rsp), %xmm1
movsd 0x28cf(%rip), %xmm0     # 0x6010
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %rcx
movq %rcx, %rdx
sarq $0x3f, %rdx
movapd %xmm0, %xmm2
subsd 0x28bb(%rip), %xmm2     # 0x6018
cvttsd2si %xmm2, %rax
andq %rdx, %rax
orq %rcx, %rax
je 0x37a5
ucomisd 0x2896(%rip), %xmm1     # 0x6008
ja 0x37a5
movq %rax, %xmm1
punpckldq 0x28af(%rip), %xmm1 # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x28b7(%rip), %xmm1     # 0x6040
movapd %xmm1, %xmm2
unpckhpd %xmm1, %xmm2            # xmm2 = xmm2[1],xmm1[1]
addsd %xmm1, %xmm2
subsd %xmm2, %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x37a5
jnp 0x37c1
andl $0x0, 0x14(%r14)
pushq $0x3
popq %rsi
movq %rbx, %rdi
callq 0x3e82
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %rax, 0x8(%r14)
callq 0x2842
incl 0x24(%rax)
jmp 0x37b5
nop