// File: /workspace/github_c_makefile_star2_O1/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
movl $0x1f4, 0x4(%rsp)       # imm = 0x1F4
movl $0x1f4, %edi            # imm = 0x1F4
movl $0x1, %esi
callq 0x2120
movq %rax, 0x8(%rsp)
movl $0x0, (%rsp)
leaq 0x110(%rbx), %r14
cmpq 0x120(%rbx), %r14
je 0x60ff
leaq 0x8(%rsp), %r12
movq %rsp, %r13
leaq 0x4(%rsp), %rbp
movq %r14, %rdi
callq 0x2200
cmpl $0x0, 0x40(%rax)
je 0x60e7
movl (%rsp), %eax
addl $0x64, %eax
movslq 0x4(%rsp), %r15
cmpl %r15d, %eax
jle 0x602f
leaq (%r15,%r15), %rsi
movl %esi, 0x4(%rsp)
movq 0x8(%rsp), %rdi
callq 0x22f0
movq %rax, 0x8(%rsp)
leaq (%rax,%r15), %rdi
movslq 0x4(%rsp), %rdx
subq %r15, %rdx
xorl %esi, %esi
callq 0x20f0
movslq (%rsp), %r15
addq 0x8(%rsp), %r15
movq %r14, %rdi
callq 0x2200
movsd 0x20(%rax), %xmm1
unpcklps 0xfe4(%rip), %xmm1      # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0xfec(%rip), %xmm1      # 0x7040
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
divsd 0xfa8(%rip), %xmm0      # 0x7010
movq %r15, %rdi
leaq 0x1261(%rip), %rsi      # 0x72d3
movb $0x1, %al
callq 0x2050
addl %eax, (%rsp)
movq %r14, %rdi
callq 0x2200
leaq 0x28(%rax), %rdi
movl $0x53, %esi
movq %r12, %rdx
movq %r13, %rcx
movq %rbp, %r8
callq 0x630e
movl (%rsp), %eax
addl $0xa, %eax
movslq 0x4(%rsp), %r15
cmpl %r15d, %eax
jle 0x60d5
leaq (%r15,%r15), %rsi
movl %esi, 0x4(%rsp)
movq 0x8(%rsp), %rdi
callq 0x22f0
movq %rax, 0x8(%rsp)
leaq (%rax,%r15), %rdi
movslq 0x4(%rsp), %rdx
subq %r15, %rdx
xorl %esi, %esi
callq 0x20f0
movq 0x8(%rsp), %rax
movslq (%rsp), %rcx
movw $0xa, (%rax,%rcx)
incl (%rsp)
movq %r14, %rdi
callq 0x2200
movq %rax, %r14
cmpq 0x120(%rbx), %rax
jne 0x5fe3
leaq 0x11c6(%rip), %rsi      # 0x72cc
leaq 0x8(%rsp), %rdi
movq %rsp, %rdx
leaq 0x4(%rsp), %rcx
callq 0x27b1
leaq 0xe0(%rbx), %r14
cmpq 0xf0(%rbx), %r14
je 0x6255
leaq 0x8(%rsp), %r12
movq %rsp, %r13
leaq 0x4(%rsp), %rbp
movq %r14, %rdi
callq 0x2200
cmpl $0x0, 0x40(%rax)
je 0x623d
movl (%rsp), %eax
addl $0x64, %eax
movslq 0x4(%rsp), %r15
cmpl %r15d, %eax
jle 0x6185
leaq (%r15,%r15), %rsi
movl %esi, 0x4(%rsp)
movq 0x8(%rsp), %rdi
callq 0x22f0
movq %rax, 0x8(%rsp)
leaq (%rax,%r15), %rdi
movslq 0x4(%rsp), %rdx
subq %r15, %rdx
xorl %esi, %esi
callq 0x20f0
movslq (%rsp), %r15
addq 0x8(%rsp), %r15
movq %r14, %rdi
callq 0x2200
movsd 0x20(%rax), %xmm1
unpcklps 0xe8e(%rip), %xmm1      # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0xe96(%rip), %xmm1      # 0x7040
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
divsd 0xe52(%rip), %xmm0      # 0x7010
movq %r15, %rdi
leaq 0x110b(%rip), %rsi      # 0x72d3
movb $0x1, %al
callq 0x2050
addl %eax, (%rsp)
movq %r14, %rdi
callq 0x2200
leaq 0x28(%rax), %rdi
movl $0x42, %esi
movq %r12, %rdx
movq %r13, %rcx
movq %rbp, %r8
callq 0x630e
movl (%rsp), %eax
addl $0xa, %eax
movslq 0x4(%rsp), %r15
cmpl %r15d, %eax
jle 0x622b
leaq (%r15,%r15), %rsi
movl %esi, 0x4(%rsp)
movq 0x8(%rsp), %rdi
callq 0x22f0
movq %rax, 0x8(%rsp)
leaq (%rax,%r15), %rdi
movslq 0x4(%rsp), %rdx
subq %r15, %rdx
xorl %esi, %esi
callq 0x20f0
movq 0x8(%rsp), %rax
movslq (%rsp), %rcx
movw $0xa, (%rax,%rcx)
incl (%rsp)
movq %r14, %rdi
callq 0x2200
movq %rax, %r14
cmpq 0xf0(%rbx), %rax
jne 0x6139
movl (%rsp), %eax
addl $0xa, %eax
movslq 0x4(%rsp), %r14
cmpl %r14d, %eax
jle 0x628f
leaq (%r14,%r14), %rsi
movl %esi, 0x4(%rsp)
movq 0x8(%rsp), %rdi
callq 0x22f0
movq %rax, 0x8(%rsp)
leaq (%rax,%r14), %rdi
movslq 0x4(%rsp), %rdx
subq %r14, %rdx
xorl %esi, %esi
callq 0x20f0
movq 0x8(%rsp), %rax
movslq (%rsp), %rcx
movw $0xa, (%rax,%rcx)
incl (%rsp)
movq 0x8(%rsp), %rsi
leaq 0x18(%rsp), %r14
leaq 0x17(%rsp), %rdx
movq %r14, %rdi
callq 0x2080
movq %rbx, %rdi
movq %r14, %rsi
callq 0x5472
leaq 0x28(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x62d6
callq 0x21c0
movq 0x8(%rsp), %rdi
callq 0x2240
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x28(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x6305
callq 0x21c0
movq %rbx, %rdi
callq 0x2310
nop