// File: /workspace/github_c_makefile_star2_O2/aspone[P]OrderBook/./OrderBook.h
// Function: OrderBook::OrderBook<unsigned int, OrderLevelEntry>::printBook()
void printBook() {
      int max_buffer = 500;
      char *buffer = (char*)calloc(max_buffer, sizeof(char));
      int index = 0;

      for (auto it = sell_book_map_.rbegin(); it != sell_book_map_.rend(); ++it) {
         if (it->second.getQuantity() != 0) {
            // char header[50];
            // sprintf(header, "%.2f ", it->first / 100.);
            // safeCopyToBuffer(buffer, header, index, max_buffer);

            // 2 ^ 308, double max, is 93 digits.
            if (index + 100 > max_buffer) growBuffer(buffer, max_buffer);
            index += sprintf(&buffer[index], "%.2f ", it->first / 100.);

            it->second.printLevel('S', buffer, index, max_buffer);

            // safeCopyToBuffer(buffer, "\n", index, max_buffer);

            if (index + 10 > max_buffer) growBuffer(buffer, max_buffer);
            index += sprintf(&buffer[index], "\n");
         }
      }
      safeCopyToBuffer(buffer, "\n", index, max_buffer);
      for (auto it = buy_book_map_.rbegin(); it != buy_book_map_.rend(); ++it) {
         if (it->second.getQuantity() != 0) {
            // char header[50];
            // sprintf(header, "%.2f ", it->first / 100.);
            // safeCopyToBuffer(buffer, header, index, max_buffer);

            // 2 ^ 308, double max, is 93 digits.
            if (index + 100 > max_buffer) growBuffer(buffer, max_buffer);
            index += sprintf(&buffer[index], "%.2f ", it->first / 100.);

            it->second.printLevel('B', buffer, index, max_buffer);

            // safeCopyToBuffer(buffer, "\n", index, max_buffer);

            if (index + 10 > max_buffer) growBuffer(buffer, max_buffer);
            index += sprintf(&buffer[index], "\n");
         }
      }
      // safeCopyToBuffer(buffer, "\n", index, max_buffer);
      if (index + 10 > max_buffer) growBuffer(buffer, max_buffer);
      index += sprintf(&buffer[index], "\n");

      logger_.print(buffer);
      free(buffer);
   }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdi, %rbx
leaq 0x4(%rsp), %r14
movl $0x1f4, (%r14)          # imm = 0x1F4
pushq $0x1
popq %rsi
movl $0x1f4, %edi            # imm = 0x1F4
callq 0x2120
leaq 0x8(%rsp), %r15
movq %rsp, %rcx
andl $0x0, (%rcx)
movq %rax, (%r15)
leaq 0x110(%rbx), %r13
xorl %ebp, %ebp
pushq $0x53
popq %r12
cmpq 0x120(%rbx), %r13
je 0x5779
movq %r13, %rdi
callq 0x21e0
cmpl $0x0, 0x40(%rax)
je 0x5769
leal 0x64(%rbp), %eax
cmpl 0x4(%rsp), %eax
jle 0x56d1
movq %r15, %rdi
movq %r14, %rsi
callq 0x25ac
movl (%rsp), %ebp
movslq %ebp, %rbp
addq 0x8(%rsp), %rbp
movq %r13, %rdi
callq 0x21e0
movsd 0x20(%rax), %xmm1
unpcklps 0x943(%rip), %xmm1      # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x94b(%rip), %xmm1      # 0x6040
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
divsd 0x907(%rip), %xmm0      # 0x6010
movq %rbp, %rdi
leaq 0xbe6(%rip), %rsi       # 0x62f9
movb $0x1, %al
callq 0x2040
addl %eax, (%rsp)
movq %r13, %rdi
callq 0x21e0
leaq 0x28(%rax), %rdi
movl %r12d, %esi
movq %r15, %rdx
movq %rsp, %rcx
movq %r14, %r8
callq 0x5906
movl (%rsp), %eax
leal 0xa(%rax), %ecx
cmpl 0x4(%rsp), %ecx
jle 0x5754
movq %r15, %rdi
movq %r14, %rsi
callq 0x25ac
movl (%rsp), %eax
movq 0x8(%rsp), %rcx
cltq
movw $0xa, (%rcx,%rax)
movl (%rsp), %ebp
incl %ebp
movl %ebp, (%rsp)
movq %r13, %rdi
callq 0x21e0
movq %rax, %r13
jmp 0x569b
leaq 0xb72(%rip), %rsi       # 0x62f2
leaq 0x8(%rsp), %r14
movq %rsp, %rdx
leaq 0x4(%rsp), %r12
movq %r14, %rdi
movq %r12, %rcx
callq 0x25e1
leaq 0xe0(%rbx), %r15
pushq $0x42
popq %rbp
cmpq 0xf0(%rbx), %r15
je 0x587d
movq %r15, %rdi
callq 0x21e0
cmpl $0x0, 0x40(%rax)
je 0x586d
movl (%rsp), %eax
leal 0x64(%rax), %ecx
cmpl 0x4(%rsp), %ecx
jle 0x57db
movq %r14, %rdi
movq %r12, %rsi
callq 0x25ac
movl (%rsp), %eax
movslq %eax, %r13
addq 0x8(%rsp), %r13
movq %r15, %rdi
callq 0x21e0
movsd 0x20(%rax), %xmm1
unpcklps 0x839(%rip), %xmm1      # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x841(%rip), %xmm1      # 0x6040
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
divsd 0x7fd(%rip), %xmm0      # 0x6010
movq %r13, %rdi
leaq 0xadc(%rip), %rsi       # 0x62f9
movb $0x1, %al
callq 0x2040
addl %eax, (%rsp)
movq %r15, %rdi
callq 0x21e0
leaq 0x28(%rax), %rdi
movl %ebp, %esi
movq %r14, %rdx
movq %rsp, %rcx
movq %r12, %r8
callq 0x5906
movl (%rsp), %eax
leal 0xa(%rax), %ecx
cmpl 0x4(%rsp), %ecx
jle 0x585d
movq %r14, %rdi
movq %r12, %rsi
callq 0x25ac
movl (%rsp), %eax
movq 0x8(%rsp), %rcx
cltq
movw $0xa, (%rcx,%rax)
incl (%rsp)
movq %r15, %rdi
callq 0x21e0
movq %rax, %r15
jmp 0x57a2
movl (%rsp), %eax
leal 0xa(%rax), %ecx
cmpl 0x4(%rsp), %ecx
jle 0x589b
leaq 0x8(%rsp), %rdi
leaq 0x4(%rsp), %rsi
callq 0x25ac
movl (%rsp), %eax
movq 0x8(%rsp), %rcx
cltq
movw $0xa, (%rcx,%rax)
incl (%rsp)
movq 0x8(%rsp), %rsi
leaq 0x18(%rsp), %r14
leaq 0x17(%rsp), %rdx
movq %r14, %rdi
callq 0x2070
movq %rbx, %rdi
movq %r14, %rsi
callq 0x4af6
leaq 0x18(%rsp), %rdi
callq 0x20a0
movq 0x8(%rsp), %rdi
callq 0x2210
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0x20a0
movq %rbx, %rdi
callq 0x22f0
nop