// File: /workspace/github_cpp_makefile_star2_O1/nikolausmayer[P]SimplePlot/./Sparkline.h
// Function: std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> Sparkline::Sparkline<float>(float const*, unsigned long, unsigned long, unsigned long, bool, bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, float, float)
std::string Sparkline( const T* const data,
                         size_t number_of_data_points,
                         size_t this_many_lines_high=1,
                         size_t this_many_characters_wide=0,
                         bool enclose_in_box=false,
                         bool print_colored=true,
                         std::string title="",
                         T minv=std::numeric_limits<T>::max(),
                         T maxv=std::numeric_limits<T>::min()
                       ) 
  {
    /// Use provided min/max values or adapt to data range
    minv = std::min(minv, std::numeric_limits<T>::max());
    maxv = std::max(maxv, std::numeric_limits<T>::min());
    if ( minv == std::numeric_limits<T>::max() and
         maxv == std::numeric_limits<T>::min() ) {
      for ( size_t i = 0; i < number_of_data_points; ++i ) {
        minv = std::min(minv, data[i]);
        maxv = std::max(maxv, data[i]);
      }
    }

    /// If the plot could spill over the terminal boundaries,
    /// then limit its width
    float w_scale = 1.f;
    {
      size_t max_width = (size_t)SparklineHelpers::TerminalWidth();
      if ( enclose_in_box ) 
        max_width -= ENCLOSURE_WIDTH;

      if ( this_many_characters_wide == 0 )
        this_many_characters_wide = number_of_data_points;

      if ( max_width < this_many_characters_wide )
        this_many_characters_wide = max_width;

      w_scale = (float)this_many_characters_wide/number_of_data_points;
    }

    /// TODO 
    if ( this_many_characters_wide > number_of_data_points ) {
      throw std::runtime_error("Woops! Not implemented..");
    }

    /// Interpolate data points
    T bins[this_many_characters_wide];
    {
      float bin_slices_indices[this_many_characters_wide+1];
      for ( size_t i = 0; i <= this_many_characters_wide; ++i ) {
        bin_slices_indices[i] = i/w_scale;
      }

      const float mass_per_bin = 1/w_scale;

      for ( size_t i = 0; i < this_many_characters_wide; ++i ) {
        bins[i] = 0;

        const float lower = bin_slices_indices[i];
        const float upper = bin_slices_indices[i+1];
        bins[i] += (1.f-(lower-(size_t)lower)) * data[(size_t)lower];
        for (size_t j = (size_t)lower+1; j < (size_t)upper; ++j) {
          bins[i] += data[j];
        }
        if ((size_t)upper < number_of_data_points) {
          bins[i] += (upper-(size_t)upper) * data[(size_t)upper];
        }

        bins[i] /= mass_per_bin;
      }
    }
         

    #ifdef WITH_TEXTDECORATOR
      TextDecorator::TextDecorator TD(print_colored);
    #endif

    /// Assemble the output in a stringstream
    std::ostringstream oss;

    /// Begin box (upper border)
    if ( enclose_in_box ) {
      if ( title.compare("") == 0 ) {
        oss << GREEN(BOX_NW_CORNER);
        for ( size_t i = 0; i < this_many_characters_wide; ++i )
          oss << GREEN(BOX_H_BORDER);
        oss << GREEN(BOX_NE_CORNER) << '\n';
      } else if ( title.size() > this_many_characters_wide ) {
        oss << GREEN(title) << '\n';
      } else {
        size_t filler = this_many_characters_wide-title.size();
        oss << GREEN(BOX_NW_CORNER);
        size_t i = 0;
        /// Ticks left of the title
        while ( i < filler/2 ) {
          oss << GREEN(BOX_H_BORDER);
          ++i;
        }
        oss << GREEN(title);
        /// Skip ticks covered by title
        i += title.length();
        /// Ticks right of the title
        while ( i < this_many_characters_wide ) {
          oss << GREEN(BOX_H_BORDER);
          ++i;
        }
        oss << GREEN(BOX_NE_CORNER) << '\n';
      }
    }


    /// A higher line count means we can display the data more
    /// finely grained!
    size_t levels = this_many_lines_high*TICKS-1;
    /// Stretch plot over multiple lines if requested
    for ( int line = (int)this_many_lines_high-1; line >= 0; --line ) {
      int this_line_min_index = line*TICKS;
      int this_line_max_index = this_line_min_index+(TICKS-1);

      /// Left box border
      if ( enclose_in_box )
        oss << GREEN(BOX_V_BORDER);

      /// Go through all data points
      for ( size_t i = 0; i < this_many_characters_wide; ++i ) {
        const T _data = std::min(maxv, std::max(minv, bins[i]));
        float fraction = (float)(_data-minv)/(float)(maxv-minv);
        int index = std::floor(fraction*levels);
        if ( index < this_line_min_index ) {
          /// Current cell is above the data line -> empty
          oss << ' '; 
        } else if ( index > this_line_max_index ) {
          /// Current cell is below the data line -> solid
          oss << BLUE(ticks[TICKS-1]);
        } else {
          oss << BLUE(ticks[index-this_line_min_index]);
        }
      }

      /// Right box border and min/max value marks
      if ( enclose_in_box ) {
        if ( this_many_lines_high == 1 )
          oss << GREEN(BOX_V_BORDER_TICK) 
              << GREEN(" min: ")
              << std::left << std::setw(PREC) << GREEN(minv) 
              << GREEN(", max: ") 
              << std::left << std::setw(PREC) << GREEN(maxv);
        else if ( line == (int)this_many_lines_high-1 )
          oss << GREEN(BOX_V_BORDER_TICK) << GREEN(" max: ") << GREEN(maxv);
        else if ( line == 0 )
          oss << GREEN(BOX_V_BORDER_TICK) << GREEN(" min: ") << GREEN(minv);
        else
          /// Show "middle" level of this line
          oss << GREEN(BOX_V_BORDER_TICK) << GREEN("      ") 
              << GREEN((line*TICKS+4) * 
                  (maxv-minv)/(this_many_lines_high*TICKS) + minv);
          //oss << GREEN(BOX_V_BORDER);
      }

      if ( line > 0 )
        oss << '\n';
    }

    /// Finish box (lower border and sample index marks)
    if ( enclose_in_box ) {
      /// Compute tick marks positions
      const size_t sep = 2;
      const size_t x_ticks_separation = 2*sep + std::ceil(log10(number_of_data_points+1));
      const size_t x_ticks_number = this_many_characters_wide / x_ticks_separation + 1;
      size_t x_ticks[x_ticks_number];
      size_t x_ticks_values[x_ticks_number];
      for ( size_t i = 0; i < x_ticks_number-1; ++i ) {
        x_ticks[i]        = i*x_ticks_separation;
        x_ticks_values[i] = i*number_of_data_points/x_ticks_number;
      }
      x_ticks[x_ticks_number-1]        = this_many_characters_wide-1;
      x_ticks_values[x_ticks_number-1] = number_of_data_points;

      size_t next_tick = 0;
      oss << '\n';

      oss << GREEN(BOX_SW_CORNER);
      for ( size_t i = 0; i < this_many_characters_wide; ++i )
        if ( i == x_ticks[next_tick] ) {
          oss << GREEN(BOX_H_BORDER_TICK);
          ++next_tick;
        } else {
          oss << GREEN(BOX_H_BORDER);
        }
      oss << GREEN(BOX_SE_CORNER);


      /// X-ticks values
      {
        oss << "\n " << GREEN(x_ticks_values[0]);

        /// Keep track of the line length
        size_t current_col = 1;
        for ( size_t i = 1; i < x_ticks_number-1; ++i ) {
          /// We somehow have to distribute the string representations
          /// of the tick numbers over the length of one line.
          /// 
          ///           x_ticks_separation
          ///      vvvvvvv       >      vvvvvvv   
          ///                    > 
          ///       tofill       >       tofill
          ///        vvvv        >        vvv
          /// ...──┬──────┬──... > ...──┬──────┬──...
          ///     998    999     >     999   1000
          ///       ^    ^^      >       ^   ^^
          ///      lw    rw      >      lw   rw

          /// Width of the current tick's number
          size_t tmp = SparklineHelpers::CharLength(x_ticks_values[i]);
          current_col += tmp;
          /// This iteration takes tmp-tmp/2 characters of the total
          /// width of the next entry. The remaining tmp-2 characters
          /// will by covered by "lw" in the next iteration.
          const size_t rw = tmp-tmp/2;
          /// Width of the previous tick's number
          tmp = SparklineHelpers::CharLength(x_ticks_values[i-1]);
          const size_t lw = tmp/2;

          /// The remaining sepration space is filled with blanks
          size_t tofill = x_ticks_separation - rw - lw;
          oss << std::setw(tofill) << std::setfill(' ') << ' ';
          oss << GREEN(x_ticks_values[i]);

          current_col += tofill;
        }

        oss << std::setw(x_ticks[x_ticks_number-1]
               - current_col
               - SparklineHelpers::CharLength(number_of_data_points)+2)
            << ' ';
        oss << GREEN(x_ticks_values[x_ticks_number-1]) 
            << std::endl;
      }
    }

    return oss.str();
  }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1f8, %rsp            # imm = 0x1F8
movl %r9d, -0x48(%rbp)
movq %r8, %r13
movq %rcx, -0x68(%rbp)
movq %rdx, %r12
movq %rsi, %rbx
movq %rdi, %r15
movss 0x12d7(%rip), %xmm3     # 0x5058
movaps %xmm3, %xmm2
minss %xmm0, %xmm2
movss 0x12cc(%rip), %xmm4     # 0x505c
movaps %xmm4, %xmm0
maxss %xmm1, %xmm0
cmpneqps %xmm0, %xmm4
cmpneqps %xmm2, %xmm3
orps %xmm4, %xmm3
movd %xmm3, %eax
testq %rdx, %rdx
sete %cl
orb %al, %cl
testb $0x1, %cl
jne 0x3dd5
xorl %eax, %eax
movss (%rbx,%rax,4), %xmm1
movaps %xmm1, %xmm3
minss %xmm2, %xmm3
maxss %xmm0, %xmm1
incq %rax
movaps %xmm3, %xmm2
movaps %xmm1, %xmm0
cmpq %rax, %r12
jne 0x3db5
jmp 0x3ddb
movaps %xmm0, %xmm1
movaps %xmm2, %xmm3
movss %xmm3, -0x50(%rbp)
movss %xmm1, -0x58(%rbp)
leaq -0x218(%rbp), %r14
movl $0x5413, %esi           # imm = 0x5413
movl $0x1, %edi
movq %r14, %rdx
xorl %eax, %eax
callq 0x21f0
movzwl 0x2(%r14), %eax
leaq -0x14(%rax), %rcx
cmpb $0x0, -0x48(%rbp)
cmoveq %rax, %rcx
testq %r13, %r13
cmoveq %r12, %r13
cmpq %r13, %rcx
cmovbq %rcx, %r13
testq %r13, %r13
js 0x3e2e
xorps %xmm2, %xmm2
cvtsi2ss %r13, %xmm2
jmp 0x3e49
movq %r13, %rax
shrq %rax
movl %r13d, %ecx
andl $0x1, %ecx
orq %rax, %rcx
xorps %xmm2, %xmm2
cvtsi2ss %rcx, %xmm2
addss %xmm2, %xmm2
testq %r12, %r12
js 0x3e58
xorps %xmm0, %xmm0
cvtsi2ss %r12, %xmm0
jmp 0x3e73
movq %r12, %rax
shrq %rax
movl %r12d, %ecx
andl $0x1, %ecx
orq %rax, %rcx
xorps %xmm0, %xmm0
cvtsi2ss %rcx, %xmm0
addss %xmm0, %xmm0
movq %r15, -0x98(%rbp)
movq %r12, -0x78(%rbp)
cmpq %r12, %r13
ja 0x4918
movq %r13, %rdi
movq 0x18(%rbp), %r13
divss %xmm0, %xmm2
movq %rsp, %r12
leaq 0xf(,%rdi,4), %rax
andq $-0x10, %rax
subq %rax, %r12
movq %r12, %rsp
movq %rsp, %rax
leaq 0x1(%rdi), %rdx
movq %rsp, %rcx
leaq 0x13(,%rdi,4), %rsi
andq $-0x10, %rsi
subq %rsi, %rcx
movq %rcx, %rsp
cmpq $0x1, %rdx
movq %rdi, -0x38(%rbp)
movq %rdi, %rdx
adcq $0x1, %rdx
xorl %esi, %esi
testq %rsi, %rsi
js 0x3ee3
xorps %xmm0, %xmm0
cvtsi2ss %rsi, %xmm0
jmp 0x3eff
movq %rsi, %rdi
shrq %rdi
movl %esi, %r8d
andl $0x1, %r8d
orq %rdi, %r8
xorps %xmm0, %xmm0
cvtsi2ss %r8, %xmm0
addss %xmm0, %xmm0
divss %xmm2, %xmm0
movss %xmm0, (%rcx,%rsi,4)
incq %rsi
cmpq %rsi, %rdx
jne 0x3ed4
cmpq $0x0, -0x38(%rbp)
je 0x403f
movss 0x113d(%rip), %xmm0     # 0x5060
movaps %xmm0, %xmm1
divss %xmm2, %xmm1
xorl %edx, %edx
movss 0x1130(%rip), %xmm2     # 0x5064
xorps %xmm3, %xmm3
movl $0x0, (%r12,%rdx,4)
movss (%rcx,%rdx,4), %xmm6
cvttss2si %xmm6, %rdi
movq %rdi, %r8
sarq $0x3f, %r8
movaps %xmm6, %xmm4
subss %xmm2, %xmm4
cvttss2si %xmm4, %rsi
andq %r8, %rsi
orq %rdi, %rsi
js 0x3f6e
xorps %xmm4, %xmm4
cvtsi2ss %rsi, %xmm4
jmp 0x3f8a
movq %rsi, %rdi
shrq %rdi
movl %esi, %r8d
andl $0x1, %r8d
orq %rdi, %r8
xorps %xmm4, %xmm4
cvtsi2ss %r8, %xmm4
addss %xmm4, %xmm4
movss 0x4(%rcx,%rdx,4), %xmm5
subss %xmm6, %xmm4
addss %xmm0, %xmm4
mulss (%rbx,%rsi,4), %xmm4
addss %xmm3, %xmm4
cvttss2si %xmm5, %r8
movq %r8, %r9
sarq $0x3f, %r9
movaps %xmm5, %xmm6
subss %xmm2, %xmm6
cvttss2si %xmm6, %rdi
andq %r9, %rdi
orq %r8, %rdi
incq %rsi
cmpq %rdi, %rsi
jae 0x3fd4
addss (%rbx,%rsi,4), %xmm4
incq %rsi
cmpq %rsi, %rdi
jne 0x3fc7
movss %xmm4, (%r12,%rdx,4)
cmpq -0x78(%rbp), %rdi
jae 0x401e
testq %rdi, %rdi
js 0x3fef
xorps %xmm6, %xmm6
cvtsi2ss %rdi, %xmm6
jmp 0x400b
movq %rdi, %rsi
shrq %rsi
movl %edi, %r8d
andl $0x1, %r8d
orq %rsi, %r8
xorps %xmm6, %xmm6
cvtsi2ss %r8, %xmm6
addss %xmm6, %xmm6
subss %xmm6, %xmm5
mulss (%rbx,%rdi,4), %xmm5
addss %xmm4, %xmm5
movss %xmm5, (%r12,%rdx,4)
movss (%r12,%rdx,4), %xmm4
divss %xmm1, %xmm4
movss %xmm4, (%r12,%rdx,4)
leaq 0x1(%rdx), %rsi
movq %rsi, %rdx
cmpq -0x38(%rbp), %rsi
jne 0x3f37
movq %rax, %rsp
leaq -0x218(%rbp), %rdi
callq 0x21d0
cmpb $0x0, -0x48(%rbp)
je 0x41e6
leaq 0x10d0(%rip), %rsi      # 0x512f
movq %r13, %rdi
callq 0x2060
testl %eax, %eax
je 0x40a5
movq 0x8(%r13), %rdx
movq -0x38(%rbp), %r14
subq %rdx, %r14
jae 0x411d
movq (%r13), %rsi
leaq -0x218(%rbp), %rdi
callq 0x21b0
leaq -0x29(%rbp), %rsi
movb $0xa, (%rsi)
movl $0x1, %edx
movq %rax, %rdi
callq 0x21b0
jmp 0x41e6
movq 0x41e4(%rip), %rsi      # 0x8290
movq 0x41e5(%rip), %rdx      # 0x8298
leaq -0x218(%rbp), %rdi
callq 0x21b0
movq -0x38(%rbp), %r14
testq %r14, %r14
je 0x40ea
leaq -0x218(%rbp), %rbx
movq 0x423a(%rip), %rsi      # 0x8310
movq 0x423b(%rip), %rdx      # 0x8318
movq %rbx, %rdi
callq 0x21b0
decq %r14
jne 0x40cf
movq 0x41bf(%rip), %rsi      # 0x82b0
movq 0x41c0(%rip), %rdx      # 0x82b8
leaq -0x218(%rbp), %rdi
callq 0x21b0
leaq -0x29(%rbp), %rsi
movb $0xa, (%rsi)
movl $0x1, %edx
movq %rax, %rdi
callq 0x21b0
jmp 0x41e6
movq 0x416c(%rip), %rsi      # 0x8290
movq 0x416d(%rip), %rdx      # 0x8298
leaq -0x218(%rbp), %rdi
callq 0x21b0
cmpq $0x2, %r14
jae 0x4142
xorl %r14d, %r14d
jmp 0x4172
shrq %r14
cmpq $0x1, %r14
adcq $0x0, %r14
leaq -0x218(%rbp), %rbx
movq %r14, %r15
movq 0x41b2(%rip), %rsi      # 0x8310
movq 0x41b3(%rip), %rdx      # 0x8318
movq %rbx, %rdi
callq 0x21b0
decq %r15
jne 0x4157
movq (%r13), %rsi
movq 0x8(%r13), %rdx
leaq -0x218(%rbp), %rdi
callq 0x21b0
addq 0x8(%r13), %r14
movq -0x38(%rbp), %r15
cmpq %r15, %r14
jae 0x41b8
leaq -0x218(%rbp), %rbx
movq 0x416f(%rip), %rsi      # 0x8310
movq 0x4170(%rip), %rdx      # 0x8318
movq %rbx, %rdi
callq 0x21b0
incq %r14
cmpq %r15, %r14
jb 0x419a
movq 0x40f1(%rip), %rsi      # 0x82b0
movq 0x40f2(%rip), %rdx      # 0x82b8
leaq -0x218(%rbp), %rdi
callq 0x21b0
leaq -0x29(%rbp), %rsi
movb $0xa, (%rsi)
movl $0x1, %edx
movq %rax, %rdi
callq 0x21b0
cmpl $0x0, -0x68(%rbp)
movq -0x38(%rbp), %r13
jle 0x4513
movq -0x68(%rbp), %rcx
leaq (,%rcx,8), %rax
leaq -0x1(,%rcx,8), %rcx
testq %rcx, %rcx
js 0x4217
xorps %xmm0, %xmm0
cvtsi2ss %rcx, %xmm0
jmp 0x4226
shrq %rcx
xorps %xmm0, %xmm0
cvtsi2ss %rcx, %xmm0
addss %xmm0, %xmm0
movss %xmm0, -0x90(%rbp)
testq %rax, %rax
movss -0x58(%rbp), %xmm0
js 0x4242
xorps %xmm1, %xmm1
cvtsi2ss %rax, %xmm1
jmp 0x4251
shrq %rax
xorps %xmm1, %xmm1
cvtsi2ss %rax, %xmm1
addss %xmm1, %xmm1
movss %xmm1, -0x5c(%rbp)
movq -0x68(%rbp), %rax
decl %eax
movaps %xmm0, %xmm1
movss -0x50(%rbp), %xmm0
subss %xmm0, %xmm1
movss %xmm1, -0x70(%rbp)
cvtss2sd %xmm0, %xmm0
movsd %xmm0, -0xa0(%rbp)
leaq -0x218(%rbp), %rbx
movl %eax, -0x7c(%rbp)
movq %rax, -0x40(%rbp)
cmpb $0x0, -0x48(%rbp)
je 0x42a3
movq 0x40bc(%rip), %rsi      # 0x8350
movq 0x40bd(%rip), %rdx      # 0x8358
movq %rbx, %rdi
callq 0x21b0
movq -0x40(%rbp), %rax
leal (,%rax,8), %r15d
testq %r13, %r13
je 0x435e
movq -0x40(%rbp), %rax
leal 0x7(,%rax,8), %r14d
xorl %r13d, %r13d
movss (%r12,%r13,4), %xmm0
movss -0x50(%rbp), %xmm1
maxss %xmm1, %xmm0
minss -0x58(%rbp), %xmm0
subss %xmm1, %xmm0
divss -0x70(%rbp), %xmm0
mulss -0x90(%rbp), %xmm0
callq 0x2090
cvttss2si %xmm0, %eax
movl %eax, %ecx
subl %r15d, %ecx
jge 0x4313
movb $0x20, -0x29(%rbp)
movl $0x1, %edx
movq %rbx, %rdi
leaq -0x29(%rbp), %rsi
callq 0x21b0
jmp 0x4351
movslq %ecx, %rcx
shlq $0x5, %rcx
leaq 0x3e6f(%rip), %rsi      # 0x8190
leaq (%rsi,%rcx), %rdx
cmpl %eax, %r14d
leaq 0x8(%rcx,%rsi), %rax
leaq 0x3f44(%rip), %rcx      # 0x8278
cmovlq %rcx, %rax
leaq 0x3f31(%rip), %rcx      # 0x8270
cmovlq %rcx, %rdx
movq (%rdx), %rsi
movq (%rax), %rdx
movq %rbx, %rdi
callq 0x21b0
incq %r13
cmpq %r13, -0x38(%rbp)
jne 0x42c7
cmpb $0x0, -0x48(%rbp)
movq -0x38(%rbp), %r13
je 0x44e0
cmpq $0x1, -0x68(%rbp)
jne 0x4425
movq 0x3ff2(%rip), %rsi      # 0x8370
movq 0x3ff3(%rip), %rdx      # 0x8378
movq %rbx, %rdi
callq 0x21b0
movq %rax, %r14
movl $0x6, %edx
movq %rax, %rdi
leaq 0x10cb(%rip), %rsi      # 0x546a
callq 0x21b0
movq (%r14), %rax
movq -0x18(%rax), %rcx
movl 0x18(%r14,%rcx), %edx
movl $0xffffff4f, %esi       # imm = 0xFFFFFF4F
andl %esi, %edx
orl $0x20, %edx
movl %edx, 0x18(%r14,%rcx)
movq -0x18(%rax), %rax
movq $0xc, 0x10(%r14,%rax)
movq %r14, %rdi
movsd -0xa0(%rbp), %xmm0
callq 0x2240
movq %rax, %r14
movl $0x7, %edx
movq %rax, %rdi
leaq 0x1083(%rip), %rsi      # 0x5471
callq 0x21b0
movq (%r14), %rax
movq -0x18(%rax), %rcx
movl 0x18(%r14,%rcx), %edx
movl $0xffffff4f, %esi       # imm = 0xFFFFFF4F
andl %esi, %edx
orl $0x20, %edx
movl %edx, 0x18(%r14,%rcx)
movq -0x18(%rax), %rax
movq $0xc, 0x10(%r14,%rax)
movss -0x58(%rbp), %xmm0
jmp 0x44d4
movq -0x40(%rbp), %rax
cmpl -0x7c(%rbp), %eax
jne 0x4462
movq 0x3f3b(%rip), %rsi      # 0x8370
movq 0x3f3c(%rip), %rdx      # 0x8378
movq %rbx, %rdi
callq 0x21b0
movq %rax, %r14
movl $0x6, %edx
movq %rax, %rdi
leaq 0x101c(%rip), %rsi      # 0x5472
callq 0x21b0
movss -0x58(%rbp), %xmm0
jmp 0x44d4
movq 0x3f07(%rip), %rsi      # 0x8370
movq 0x3f08(%rip), %rdx      # 0x8378
testl %eax, %eax
je 0x44b0
movq %rbx, %rdi
callq 0x21b0
movq %rax, %r14
movl $0x6, %edx
movq %rax, %rdi
leaq 0xe85(%rip), %rsi       # 0x5313
callq 0x21b0
orl $0x4, %r15d
xorps %xmm0, %xmm0
cvtsi2ss %r15, %xmm0
mulss -0x70(%rbp), %xmm0
divss -0x5c(%rbp), %xmm0
addss -0x50(%rbp), %xmm0
jmp 0x44d4
movq %rbx, %rdi
callq 0x21b0
movq %rax, %r14
movl $0x6, %edx
movq %rax, %rdi
leaq 0xfa0(%rip), %rsi       # 0x546a
callq 0x21b0
movss -0x50(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
movq %r14, %rdi
callq 0x2240
movq -0x40(%rbp), %rax
movl %eax, %r14d
subl $0x1, %r14d
jb 0x4502
movb $0xa, -0x29(%rbp)
movl $0x1, %edx
movq %rbx, %rdi
leaq -0x29(%rbp), %rsi
callq 0x21b0
cmpl $0x0, -0x40(%rbp)
movl %r14d, %eax
movq %rax, -0x40(%rbp)
jg 0x4287
cmpb $0x0, -0x48(%rbp)
je 0x48d1
movq -0x78(%rbp), %rbx
leaq 0x1(%rbx), %rax
movq %rax, %xmm1
punpckldq 0xade(%rip), %xmm1 # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0xae6(%rip), %xmm1      # 0x5020
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
movapd %xmm0, -0x90(%rbp)
callq 0x20d0
callq 0x2040
movq %rsp, -0x48(%rbp)
addsd 0xad4(%rip), %xmm0      # 0x5038
cvttsd2si %xmm0, %rax
movq %rax, %rcx
sarq $0x3f, %rcx
subsd 0xab8(%rip), %xmm0      # 0x5030
cvttsd2si %xmm0, %r9
andq %rcx, %r9
orq %rax, %r9
movq %r13, %rax
xorl %edx, %edx
divq %r9
movq %rax, %r10
leaq 0x17(,%rax,8), %rax
andq $-0x10, %rax
movq %rsp, %r15
subq %rax, %r15
movq %r15, %rsp
movq %rsp, %r11
subq %rax, %r11
movq %r11, %rsp
cmpq %r9, %r13
jb 0x45da
leaq 0x1(%r10), %rsi
xorl %edi, %edi
xorl %ecx, %ecx
xorl %r8d, %r8d
movq %rdi, (%r15,%r8,8)
movq %rcx, %rax
xorl %edx, %edx
divq %rsi
movq %rax, (%r11,%r8,8)
incq %r8
addq %rbx, %rcx
addq %r9, %rdi
cmpq %r10, %r8
jb 0x45bc
movq %r9, -0x70(%rbp)
leaq -0x1(%r13), %rax
movq %rax, -0x40(%rbp)
movq %rax, (%r15,%r10,8)
movq %r10, -0x50(%rbp)
movq %r11, -0x58(%rbp)
movq %rbx, (%r11,%r10,8)
leaq -0x29(%rbp), %rsi
movb $0xa, (%rsi)
leaq -0x218(%rbp), %rdi
movl $0x1, %edx
callq 0x21b0
movq 0x3cbb(%rip), %rsi      # 0x82d0
movq 0x3cbc(%rip), %rdx      # 0x82d8
leaq -0x218(%rbp), %rdi
callq 0x21b0
testq %r13, %r13
je 0x4678
xorl %ebx, %ebx
leaq -0x218(%rbp), %r14
xorl %r12d, %r12d
cmpq (%r15,%r12,8), %rbx
jne 0x465a
movq 0x3cea(%rip), %rsi      # 0x8330
movq 0x3ceb(%rip), %rdx      # 0x8338
movq %r14, %rdi
callq 0x21b0
incq %r12
jmp 0x4670
movq 0x3caf(%rip), %rsi      # 0x8310
movq 0x3cb0(%rip), %rdx      # 0x8318
movq %r14, %rdi
callq 0x21b0
incq %rbx
cmpq %rbx, %r13
jne 0x4639
movq 0x3c71(%rip), %rsi      # 0x82f0
movq 0x3c72(%rip), %rdx      # 0x82f8
leaq -0x218(%rbp), %rdi
callq 0x21b0
leaq 0xde0(%rip), %rsi       # 0x5479
leaq -0x218(%rbp), %rdi
movl $0x2, %edx
callq 0x21b0
movq -0x58(%rbp), %rax
movq (%rax), %rsi
leaq -0x218(%rbp), %rdi
callq 0x2110
movl $0x1, %r15d
cmpq $0x2, -0x50(%rbp)
jb 0x482d
movl $0x1, %r12d
movq -0x58(%rbp), %r14
movq (%r14,%r12,8), %rax
movq %rax, -0x38(%rbp)
incq %rax
movq %rax, %xmm1
movq 0x920(%rip), %xmm0      # 0x5010
punpckldq %xmm0, %xmm1    # xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1]
movapd 0x924(%rip), %xmm0      # 0x5020
subpd %xmm0, %xmm1
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
callq 0x20d0
callq 0x2040
cvttsd2si %xmm0, %rax
movq %rax, %rcx
sarq $0x3f, %rcx
movsd 0x906(%rip), %xmm1      # 0x5030
subsd %xmm1, %xmm0
cvttsd2si %xmm0, %r13
andq %rcx, %r13
orq %rax, %r13
movq %r13, %rbx
shrq %rbx
movq -0x8(%r14,%r12,8), %rax
incq %rax
movq %rax, %xmm1
punpckldq 0x8bc(%rip), %xmm1 # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x8c4(%rip), %xmm1      # 0x5020
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
callq 0x20d0
callq 0x2040
cvttsd2si %xmm0, %rax
movq %rax, %rcx
sarq $0x3f, %rcx
subsd 0x8aa(%rip), %xmm0      # 0x5030
cvttsd2si %xmm0, %rdx
andq %rcx, %rdx
orq %rax, %rdx
shrq %rdx
addq -0x70(%rbp), %rbx
addq %r13, %rdx
subq %rdx, %rbx
movq -0x218(%rbp), %rax
movq -0x18(%rax), %rcx
movslq %ebx, %rdx
movq %rdx, -0x208(%rbp,%rcx)
movq -0x18(%rax), %rax
leaq (%rax,%rbp), %r14
addq $-0x218, %r14           # imm = 0xFDE8
cmpb $0x0, 0xe1(%r14)
jne 0x47e9
movq %r14, %rdi
movl $0x20, %esi
callq 0x2180
movb %al, 0xe0(%r14)
movb $0x1, 0xe1(%r14)
movb $0x20, %al
movb %al, 0xe0(%r14)
movb %al, -0x29(%rbp)
movl $0x1, %edx
leaq -0x218(%rbp), %rdi
leaq -0x29(%rbp), %rsi
callq 0x21b0
leaq -0x218(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x2110
addq %r13, %r15
addq %rbx, %r15
incq %r12
cmpq -0x50(%rbp), %r12
jb 0x46d4
movapd -0x90(%rbp), %xmm0
callq 0x20d0
callq 0x2040
cvttsd2si %xmm0, %rax
movq %rax, %rcx
sarq $0x3f, %rcx
subsd 0x7dd(%rip), %xmm0      # 0x5030
cvttsd2si %xmm0, %rdx
andl %ecx, %edx
orl %edx, %eax
addl %eax, %r15d
movq -0x40(%rbp), %rcx
subl %r15d, %ecx
leaq -0x218(%rbp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
addl $0x2, %ecx
movslq %ecx, %rcx
movq %rcx, -0x208(%rbp,%rax)
leaq -0x29(%rbp), %rsi
movb $0x20, (%rsi)
movl $0x1, %edx
callq 0x21b0
leaq -0x218(%rbp), %rdi
movq -0x78(%rbp), %rsi
callq 0x2110
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2180
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2120
movq -0x48(%rbp), %rsp
leaq -0x210(%rbp), %rsi
movq -0x98(%rbp), %rbx
movq %rbx, %rdi
callq 0x2230
movq 0x36ca(%rip), %rsi      # 0x7fb8
leaq -0x218(%rbp), %rdi
callq 0x20f0
leaq -0x1a8(%rbp), %rdi
callq 0x2070
movq %rbx, %rax
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x10, %edi
callq 0x20c0
movq %rax, %r14
leaq 0xb25(%rip), %rsi       # 0x5451
movq %rax, %rdi
callq 0x20a0
movq 0x36b5(%rip), %rsi      # 0x7ff0
movq 0x366e(%rip), %rdx      # 0x7fb0
movq %r14, %rdi
callq 0x2270
jmp 0x496f
jmp 0x496f
movq %rax, %rbx
movq %r14, %rdi
callq 0x2140
jmp 0x4991
jmp 0x496f
jmp 0x496f
jmp 0x496f
jmp 0x496f
jmp 0x496f
jmp 0x496f
jmp 0x496f
jmp 0x496f
jmp 0x496f
jmp 0x496f
movq %rax, %rbx
movq 0x363f(%rip), %rsi      # 0x7fb8
leaq -0x218(%rbp), %rdi
callq 0x20f0
leaq -0x1a8(%rbp), %rdi
callq 0x2070
movq %rbx, %rdi
callq 0x2280