// File: /workspace/github_cpp_makefile_star2_O2/nikolausmayer[P]SimplePlot/main.cpp
// Function: main
int main(int argc, char** argv) {

  float maxv = std::numeric_limits<float>::min();
  float minv = std::numeric_limits<float>::max();
  int height = 10;
  int width  = 0;
  std::string title = "SimplePlot";
  bool box   = true;
  bool color = true;

  #define INCREMENT_i_AND_CHECK ++i; if (i>=argc) break;
  for (int i = 1; i < argc; ++i) {
    if        (std::strcmp(argv[i], "-h"        ) == 0 or
               std::strcmp(argv[i], "--help"    ) == 0) {
      std::cout << "Usage: " << argv[0] << " [options]" << std::endl
                << std::endl
                << "Plot stuff like this:" << std::endl << std::endl
                << Sparkline::ShowExampleGaussian() << std::endl
                << "Values to be plotted are read from STDIN." << std::endl
                << std::endl
                << "Options:" << std::endl
                << "  --max      " << "Upper plot y-limit" << std::endl
                << "  --min      " << "Lower plot y-limit" << std::endl
                << "  --height   " << "Plot height in lines" << std::endl
                << "  --width    " << "Plot width in characters" << std::endl
                << "  --title    " << "Plot title" << std::endl
                << "  --no-box   " << "Disable enclosing box" << std::endl
                << "  --no-color " << "Disable color output" << std::endl
                << std::endl;
      return EXIT_FAILURE;
    } else if (std::strcmp(argv[i], "--max"     ) == 0) {
      INCREMENT_i_AND_CHECK;
      maxv = std::atof(argv[i]);
    } else if (std::strcmp(argv[i], "--min"     ) == 0) {
      INCREMENT_i_AND_CHECK;
      minv = std::atof(argv[i]);
    } else if (std::strcmp(argv[i], "--height"  ) == 0) {
      INCREMENT_i_AND_CHECK;
      height = std::atoi(argv[i]);
    } else if (std::strcmp(argv[i], "--width"   ) == 0) {
      INCREMENT_i_AND_CHECK;
      width = std::atoi(argv[i]);
    } else if (std::strcmp(argv[i], "--title"   ) == 0) {
      INCREMENT_i_AND_CHECK;
      title = argv[i];
    } else if (std::strcmp(argv[i], "--no-box"  ) == 0) {
      box = false;
    } else if (std::strcmp(argv[i], "--no-color") == 0) {
      color = false;
    } else {
      std::cerr << "Unrecognized option: \"" << argv[i] << "\"" << std::endl;
    }
  }
  #undef INCREMENT_i_AND_CHECK

  std::vector<float> data;
  {
    float dummy;
    while (!std::cin.eof())
    {
      std::cin >> dummy;
      if (std::cin.fail())
        break;
      data.push_back(dummy);
    }
  }

  std::cout << Sparkline::Sparkline<float>(data.data(),
                                           data.size(),
                                           height,
                                           width,
                                           box,
                                           color,
                                           title,
                                           minv,
                                           maxv) 
            << std::endl;

  /// Bye!
  return EXIT_SUCCESS;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq %rsi, %r14
movl %edi, %r15d
leaq 0x235a(%rip), %rsi      # 0x52ba
leaq 0x58(%rsp), %rdi
leaq 0x20(%rsp), %rdx
callq 0x34a2
pushq $0x1
popq %rbp
movb $0x1, %al
movl %eax, 0xc(%rsp)
movl $0x0, 0x10(%rsp)
pushq $0xa
popq %rax
movl %eax, 0x14(%rsp)
movss 0x2109(%rip), %xmm0     # 0x5098
movss %xmm0, 0x18(%rsp)
movss 0x20ff(%rip), %xmm0     # 0x509c
movss %xmm0, 0x1c(%rsp)
leaq 0x231b(%rip), %r13      # 0x52c5
movb $0x1, %al
movl %eax, 0x8(%rsp)
cmpl %r15d, %ebp
jge 0x316b
movslq %ebp, %r12
movq (%r14,%r12,8), %rbx
cmpb $0x2d, (%rbx)
jne 0x2fd5
cmpb $0x68, 0x1(%rbx)
jne 0x2fd5
cmpb $0x0, 0x2(%rbx)
je 0x325a
movq %rbx, %rdi
movq %r13, %rsi
callq 0x2210
testl %eax, %eax
je 0x325a
movq %rbx, %rdi
leaq 0x2422(%rip), %rsi      # 0x5414
callq 0x2210
testl %eax, %eax
je 0x30c4
movq %rbx, %rdi
leaq 0x2411(%rip), %rsi      # 0x541a
callq 0x2210
testl %eax, %eax
je 0x30e7
movq %rbx, %rdi
leaq 0x2400(%rip), %rsi      # 0x5420
callq 0x2210
testl %eax, %eax
je 0x3106
movq %rbx, %rdi
leaq 0x23f2(%rip), %rsi      # 0x5429
callq 0x2210
testl %eax, %eax
je 0x311f
movq %rbx, %rdi
leaq 0x23e3(%rip), %rsi      # 0x5431
callq 0x2210
testl %eax, %eax
je 0x3138
movq %rbx, %rdi
leaq 0x23d4(%rip), %rsi      # 0x5439
callq 0x2210
testl %eax, %eax
je 0x3152
movq %rbx, %rdi
leaq 0x23c6(%rip), %rsi      # 0x5442
callq 0x2210
testl %eax, %eax
je 0x315c
movq 0x4f58(%rip), %rdi      # 0x7fe8
leaq 0x23b6(%rip), %rsi      # 0x544d
callq 0x21a0
movq (%r14,%r12,8), %rsi
movq %rax, %rdi
callq 0x21a0
movq %rax, %rdi
leaq 0x23b0(%rip), %rsi      # 0x5462
callq 0x21a0
movq %rax, %rdi
callq 0x20d0
jmp 0x3164
incl %ebp
cmpl %r15d, %ebp
jge 0x316b
movslq %ebp, %rax
movq (%r14,%rax,8), %rdi
callq 0x21e0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x1c(%rsp)
jmp 0x3164
incl %ebp
cmpl %r15d, %ebp
jge 0x316b
movslq %ebp, %rax
movq (%r14,%rax,8), %rdi
callq 0x21e0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x18(%rsp)
jmp 0x3164
incl %ebp
cmpl %r15d, %ebp
jge 0x316b
movslq %ebp, %rax
movq (%r14,%rax,8), %rdi
callq 0x2240
movl %eax, 0x14(%rsp)
jmp 0x3164
incl %ebp
cmpl %r15d, %ebp
jge 0x316b
movslq %ebp, %rax
movq (%r14,%rax,8), %rdi
callq 0x2240
movl %eax, 0x10(%rsp)
jmp 0x3164
incl %ebp
cmpl %r15d, %ebp
jge 0x316b
movslq %ebp, %rax
movq (%r14,%rax,8), %rsi
leaq 0x58(%rsp), %rdi
callq 0x22b0
jmp 0x3164
movl $0x0, 0xc(%rsp)
jmp 0x3164
movl $0x0, 0x8(%rsp)
incl %ebp
jmp 0x2fb0
leaq 0x40(%rsp), %rbx
andq $0x0, 0x10(%rbx)
xorps %xmm0, %xmm0
movaps %xmm0, (%rbx)
movq 0x4e4e(%rip), %r14      # 0x7fd0
leaq 0x20(%rsp), %r15
movq (%r14), %rax
movq -0x18(%rax), %rax
testb $0x2, 0x20(%r14,%rax)
jne 0x31bd
movq %r14, %rdi
movq %r15, %rsi
callq 0x22c0
movq (%r14), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x20(%r14,%rax)
jne 0x31bd
movq %rbx, %rdi
movq %r15, %rsi
callq 0x3f7c
jmp 0x3187
movq 0x40(%rsp), %r14
movq 0x48(%rsp), %r15
leaq 0x78(%rsp), %rbx
leaq 0x58(%rsp), %rsi
movq %rbx, %rdi
callq 0x2200
subq %r14, %r15
sarq $0x2, %r15
movslq 0x10(%rsp), %r8
movslq 0x14(%rsp), %rcx
movzbl 0x8(%rsp), %eax
andl $0x1, %eax
movzbl 0xc(%rsp), %r9d
andl $0x1, %r9d
leaq 0x20(%rsp), %rdi
movq %r14, %rsi
movq %r15, %rdx
movss 0x18(%rsp), %xmm0
movss 0x1c(%rsp), %xmm1
pushq %rbx
pushq %rax
callq 0x34dd
popq %rax
popq %rcx
movq 0x4d9d(%rip), %rdi      # 0x7fc0
leaq 0x20(%rsp), %rsi
callq 0x2190
movq %rax, %rdi
callq 0x20d0
leaq 0x20(%rsp), %rdi
callq 0x22d8
leaq 0x78(%rsp), %rdi
callq 0x22d8
leaq 0x40(%rsp), %rdi
callq 0x409c
xorl %ebx, %ebx
jmp 0x342d
movq 0x4d5f(%rip), %rdi      # 0x7fc0
leaq 0x2064(%rip), %rsi      # 0x52cc
callq 0x21a0
movq (%r14), %rsi
movq %rax, %rdi
callq 0x21a0
leaq 0x2055(%rip), %rsi      # 0x52d4
movq %rax, %rdi
callq 0x21a0
movq %rax, %rdi
callq 0x20d0
movq %rax, %rdi
callq 0x20d0
leaq 0x2041(%rip), %rsi      # 0x52df
movq %rax, %rdi
callq 0x21a0
movq %rax, %rdi
callq 0x20d0
movq %rax, %rdi
callq 0x20d0
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x284d
leaq 0x20(%rsp), %rsi
movq %rbx, %rdi
callq 0x2190
movq %rax, %rdi
callq 0x20d0
leaq 0x2016(%rip), %rsi      # 0x52f5
movq %rax, %rdi
callq 0x21a0
movq %rax, %rdi
callq 0x20d0
movq %rax, %rdi
callq 0x20d0
leaq 0x2021(%rip), %rsi      # 0x531f
movq %rax, %rdi
callq 0x21a0
movq %rax, %rdi
callq 0x20d0
leaq 0x2013(%rip), %rsi      # 0x5328
movq %rax, %rdi
callq 0x21a0
leaq 0x2012(%rip), %rsi      # 0x5336
movq %rax, %rdi
callq 0x21a0
movq %rax, %rdi
callq 0x20d0
leaq 0x200e(%rip), %rsi      # 0x5349
movq %rax, %rdi
callq 0x21a0
leaq 0x200d(%rip), %rsi      # 0x5357
movq %rax, %rdi
callq 0x21a0
movq %rax, %rdi
callq 0x20d0
leaq 0x2009(%rip), %rsi      # 0x536a
movq %rax, %rdi
callq 0x21a0
leaq 0x2008(%rip), %rsi      # 0x5378
movq %rax, %rdi
callq 0x21a0
movq %rax, %rdi
callq 0x20d0
leaq 0x2006(%rip), %rsi      # 0x538d
movq %rax, %rdi
callq 0x21a0
leaq 0x2005(%rip), %rsi      # 0x539b
movq %rax, %rdi
callq 0x21a0
movq %rax, %rdi
callq 0x20d0
leaq 0x2007(%rip), %rsi      # 0x53b4
movq %rax, %rdi
callq 0x21a0
leaq 0x2006(%rip), %rsi      # 0x53c2
movq %rax, %rdi
callq 0x21a0
movq %rax, %rdi
callq 0x20d0
leaq 0x1ffa(%rip), %rsi      # 0x53cd
movq %rax, %rdi
callq 0x21a0
leaq 0x1ff9(%rip), %rsi      # 0x53db
movq %rax, %rdi
callq 0x21a0
movq %rax, %rdi
callq 0x20d0
leaq 0x1ff8(%rip), %rsi      # 0x53f1
movq %rax, %rdi
callq 0x21a0
leaq 0x1ff7(%rip), %rsi      # 0x53ff
movq %rax, %rdi
callq 0x21a0
movq %rax, %rdi
callq 0x20d0
movq %rax, %rdi
callq 0x20d0
leaq 0x20(%rsp), %rdi
callq 0x22d8
pushq $0x1
popq %rbx
leaq 0x58(%rsp), %rdi
callq 0x22d8
movl %ebx, %eax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x346f
movq %rax, %rbx
jmp 0x3461
jmp 0x3483
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x22d8
leaq 0x78(%rsp), %rdi
callq 0x22d8
jmp 0x3486
jmp 0x346f
movq %rax, %rbx
jmp 0x3490
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x22d8
jmp 0x3490
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0x409c
leaq 0x58(%rsp), %rdi
callq 0x22d8
movq %rbx, %rdi
callq 0x2290