// File: 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
movq %rsp, %rbp
subq $0x270, %rsp            # imm = 0x270
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
callq 0x60b0
movss %xmm0, -0x14(%rbp)
callq 0x60a0
movss %xmm0, -0x18(%rbp)
movl $0xa, -0x1c(%rbp)
movl $0x0, -0x20(%rbp)
leaq -0x41(%rbp), %rdi
movq %rdi, -0xf0(%rbp)
callq 0x23b0
movq -0xf0(%rbp), %rdx
leaq 0x4255(%rip), %rsi      # 0x828e
leaq -0x40(%rbp), %rdi
callq 0x49c0
jmp 0x4044
leaq -0x41(%rbp), %rdi
callq 0x2270
movb $0x1, -0x55(%rbp)
movb $0x1, -0x56(%rbp)
movl $0x1, -0x5c(%rbp)
movl -0x5c(%rbp), %eax
cmpl -0x8(%rbp), %eax
jge 0x4779
movq -0x10(%rbp), %rax
movslq -0x5c(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x421e(%rip), %rsi      # 0x8299
callq 0x2300
cmpl $0x0, %eax
je 0x40a6
movq -0x10(%rbp), %rax
movslq -0x5c(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x4204(%rip), %rsi      # 0x829c
callq 0x2300
cmpl $0x0, %eax
jne 0x4517
movq 0x7f13(%rip), %rdi      # 0xbfc0
leaq 0x41ef(%rip), %rsi      # 0x82a3
callq 0x2210
movq %rax, -0xf8(%rbp)
jmp 0x40c2
movq -0xf8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rsi
callq 0x2210
movq %rax, -0x100(%rbp)
jmp 0x40de
movq -0x100(%rbp), %rdi
leaq 0x41bf(%rip), %rsi      # 0x82ab
callq 0x2210
movq %rax, -0x108(%rbp)
jmp 0x40fa
movq -0x108(%rbp), %rdi
movq 0x7e98(%rip), %rsi      # 0xbfa0
callq 0x2250
movq %rax, -0x110(%rbp)
jmp 0x4116
movq -0x110(%rbp), %rdi
movq 0x7e7c(%rip), %rsi      # 0xbfa0
callq 0x2250
movq %rax, -0x118(%rbp)
jmp 0x4132
movq -0x118(%rbp), %rdi
leaq 0x4176(%rip), %rsi      # 0x82b6
callq 0x2210
movq %rax, -0x120(%rbp)
jmp 0x414e
movq -0x120(%rbp), %rdi
movq 0x7e44(%rip), %rsi      # 0xbfa0
callq 0x2250
movq %rax, -0x128(%rbp)
jmp 0x416a
movq -0x128(%rbp), %rdi
movq 0x7e28(%rip), %rsi      # 0xbfa0
callq 0x2250
movq %rax, -0x130(%rbp)
jmp 0x4186
leaq -0x80(%rbp), %rdi
callq 0x3040
jmp 0x4191
movq -0x130(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0x2200
movq %rax, -0x138(%rbp)
jmp 0x41aa
movq -0x138(%rbp), %rdi
movq 0x7de8(%rip), %rsi      # 0xbfa0
callq 0x2250
movq %rax, -0x140(%rbp)
jmp 0x41c6
movq -0x140(%rbp), %rdi
leaq 0x40f8(%rip), %rsi      # 0x82cc
callq 0x2210
movq %rax, -0x148(%rbp)
jmp 0x41e2
movq -0x148(%rbp), %rdi
movq 0x7db0(%rip), %rsi      # 0xbfa0
callq 0x2250
movq %rax, -0x150(%rbp)
jmp 0x41fe
movq -0x150(%rbp), %rdi
movq 0x7d94(%rip), %rsi      # 0xbfa0
callq 0x2250
movq %rax, -0x158(%rbp)
jmp 0x421a
movq -0x158(%rbp), %rdi
leaq 0x40ce(%rip), %rsi      # 0x82f6
callq 0x2210
movq %rax, -0x160(%rbp)
jmp 0x4236
movq -0x160(%rbp), %rdi
movq 0x7d5c(%rip), %rsi      # 0xbfa0
callq 0x2250
movq %rax, -0x168(%rbp)
jmp 0x4252
movq -0x168(%rbp), %rdi
leaq 0x409f(%rip), %rsi      # 0x82ff
callq 0x2210
movq %rax, -0x170(%rbp)
jmp 0x426e
movq -0x170(%rbp), %rdi
leaq 0x4091(%rip), %rsi      # 0x830d
callq 0x2210
movq %rax, -0x178(%rbp)
jmp 0x428a
movq -0x178(%rbp), %rdi
movq 0x7d08(%rip), %rsi      # 0xbfa0
callq 0x2250
movq %rax, -0x180(%rbp)
jmp 0x42a6
movq -0x180(%rbp), %rdi
leaq 0x406c(%rip), %rsi      # 0x8320
callq 0x2210
movq %rax, -0x188(%rbp)
jmp 0x42c2
movq -0x188(%rbp), %rdi
leaq 0x405e(%rip), %rsi      # 0x832e
callq 0x2210
movq %rax, -0x190(%rbp)
jmp 0x42de
movq -0x190(%rbp), %rdi
movq 0x7cb4(%rip), %rsi      # 0xbfa0
callq 0x2250
movq %rax, -0x198(%rbp)
jmp 0x42fa
movq -0x198(%rbp), %rdi
leaq 0x4039(%rip), %rsi      # 0x8341
callq 0x2210
movq %rax, -0x1a0(%rbp)
jmp 0x4316
movq -0x1a0(%rbp), %rdi
leaq 0x402b(%rip), %rsi      # 0x834f
callq 0x2210
movq %rax, -0x1a8(%rbp)
jmp 0x4332
movq -0x1a8(%rbp), %rdi
movq 0x7c60(%rip), %rsi      # 0xbfa0
callq 0x2250
movq %rax, -0x1b0(%rbp)
jmp 0x434e
movq -0x1b0(%rbp), %rdi
leaq 0x4008(%rip), %rsi      # 0x8364
callq 0x2210
movq %rax, -0x1b8(%rbp)
jmp 0x436a
movq -0x1b8(%rbp), %rdi
leaq 0x3ffa(%rip), %rsi      # 0x8372
callq 0x2210
movq %rax, -0x1c0(%rbp)
jmp 0x4386
movq -0x1c0(%rbp), %rdi
movq 0x7c0c(%rip), %rsi      # 0xbfa0
callq 0x2250
movq %rax, -0x1c8(%rbp)
jmp 0x43a2
movq -0x1c8(%rbp), %rdi
leaq 0x3fdb(%rip), %rsi      # 0x838b
callq 0x2210
movq %rax, -0x1d0(%rbp)
jmp 0x43be
movq -0x1d0(%rbp), %rdi
leaq 0x3fcd(%rip), %rsi      # 0x8399
callq 0x2210
movq %rax, -0x1d8(%rbp)
jmp 0x43da
movq -0x1d8(%rbp), %rdi
movq 0x7bb8(%rip), %rsi      # 0xbfa0
callq 0x2250
movq %rax, -0x1e0(%rbp)
jmp 0x43f6
movq -0x1e0(%rbp), %rdi
leaq 0x3fa0(%rip), %rsi      # 0x83a4
callq 0x2210
movq %rax, -0x1e8(%rbp)
jmp 0x4412
movq -0x1e8(%rbp), %rdi
leaq 0x3f92(%rip), %rsi      # 0x83b2
callq 0x2210
movq %rax, -0x1f0(%rbp)
jmp 0x442e
movq -0x1f0(%rbp), %rdi
movq 0x7b64(%rip), %rsi      # 0xbfa0
callq 0x2250
movq %rax, -0x1f8(%rbp)
jmp 0x444a
movq -0x1f8(%rbp), %rdi
leaq 0x3f70(%rip), %rsi      # 0x83c8
callq 0x2210
movq %rax, -0x200(%rbp)
jmp 0x4466
movq -0x200(%rbp), %rdi
leaq 0x3f62(%rip), %rsi      # 0x83d6
callq 0x2210
movq %rax, -0x208(%rbp)
jmp 0x4482
movq -0x208(%rbp), %rdi
movq 0x7b10(%rip), %rsi      # 0xbfa0
callq 0x2250
movq %rax, -0x210(%rbp)
jmp 0x449e
movq -0x210(%rbp), %rdi
movq 0x7af4(%rip), %rsi      # 0xbfa0
callq 0x2250
jmp 0x44b3
leaq -0x80(%rbp), %rdi
callq 0x23f8
movl $0x1, -0x4(%rbp)
movl $0x1, -0x84(%rbp)
jmp 0x498e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x41(%rbp), %rdi
callq 0x2270
jmp 0x49ac
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x49a3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x80(%rbp), %rdi
callq 0x23f8
jmp 0x49a3
movq -0x10(%rbp), %rax
movslq -0x5c(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x3ec1(%rip), %rsi      # 0x83eb
callq 0x2300
cmpl $0x0, %eax
jne 0x4569
movl -0x5c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x5c(%rbp)
movl -0x5c(%rbp), %eax
cmpl -0x8(%rbp), %eax
jl 0x454a
jmp 0x4779
movq -0x10(%rbp), %rax
movslq -0x5c(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x22d0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x14(%rbp)
jmp 0x4767
movq -0x10(%rbp), %rax
movslq -0x5c(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x3e75(%rip), %rsi      # 0x83f1
callq 0x2300
cmpl $0x0, %eax
jne 0x45bb
movl -0x5c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x5c(%rbp)
movl -0x5c(%rbp), %eax
cmpl -0x8(%rbp), %eax
jl 0x459c
jmp 0x4779
movq -0x10(%rbp), %rax
movslq -0x5c(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x22d0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x18(%rbp)
jmp 0x4765
movq -0x10(%rbp), %rax
movslq -0x5c(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x3e29(%rip), %rsi      # 0x83f7
callq 0x2300
cmpl $0x0, %eax
jne 0x4607
movl -0x5c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x5c(%rbp)
movl -0x5c(%rbp), %eax
cmpl -0x8(%rbp), %eax
jl 0x45ee
jmp 0x4779
movq -0x10(%rbp), %rax
movslq -0x5c(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x2350
movl %eax, -0x1c(%rbp)
jmp 0x4763
movq -0x10(%rbp), %rax
movslq -0x5c(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x3de6(%rip), %rsi      # 0x8400
callq 0x2300
cmpl $0x0, %eax
jne 0x4653
movl -0x5c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x5c(%rbp)
movl -0x5c(%rbp), %eax
cmpl -0x8(%rbp), %eax
jl 0x463a
jmp 0x4779
movq -0x10(%rbp), %rax
movslq -0x5c(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x2350
movl %eax, -0x20(%rbp)
jmp 0x4761
movq -0x10(%rbp), %rax
movslq -0x5c(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x3da2(%rip), %rsi      # 0x8408
callq 0x2300
cmpl $0x0, %eax
jne 0x46a2
movl -0x5c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x5c(%rbp)
movl -0x5c(%rbp), %eax
cmpl -0x8(%rbp), %eax
jl 0x4686
jmp 0x4779
movq -0x10(%rbp), %rax
movslq -0x5c(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
leaq -0x40(%rbp), %rdi
callq 0x22f0
jmp 0x469d
jmp 0x475f
movq -0x10(%rbp), %rax
movslq -0x5c(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x3d5b(%rip), %rsi      # 0x8410
callq 0x2300
cmpl $0x0, %eax
jne 0x46c8
movb $0x0, -0x55(%rbp)
jmp 0x475d
movq -0x10(%rbp), %rax
movslq -0x5c(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x3d3e(%rip), %rsi      # 0x8419
callq 0x2300
cmpl $0x0, %eax
jne 0x46eb
movb $0x0, -0x56(%rbp)
jmp 0x475b
movq 0x78f6(%rip), %rdi      # 0xbfe8
leaq 0x3d2b(%rip), %rsi      # 0x8424
callq 0x2210
movq %rax, -0x218(%rbp)
jmp 0x4707
movq -0x218(%rbp), %rdi
movq -0x10(%rbp), %rax
movslq -0x5c(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
callq 0x2210
movq %rax, -0x220(%rbp)
jmp 0x4728
movq -0x220(%rbp), %rdi
leaq 0x3d03(%rip), %rsi      # 0x8439
callq 0x2210
movq %rax, -0x228(%rbp)
jmp 0x4744
movq -0x228(%rbp), %rdi
movq 0x784e(%rip), %rsi      # 0xbfa0
callq 0x2250
jmp 0x4759
jmp 0x475b
jmp 0x475d
jmp 0x475f
jmp 0x4761
jmp 0x4763
jmp 0x4765
jmp 0x4767
jmp 0x4769
jmp 0x476b
movl -0x5c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x5c(%rbp)
jmp 0x405c
leaq -0xa0(%rbp), %rdi
callq 0x6380
movq 0x7844(%rip), %rdi      # 0xbfd0
movq (%rdi), %rax
movq -0x18(%rax), %rax
addq %rax, %rdi
callq 0x23d0
movb %al, -0x229(%rbp)
jmp 0x47a3
movb -0x229(%rbp), %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x47b1
jmp 0x481d
movq 0x7818(%rip), %rdi      # 0xbfd0
leaq -0xa4(%rbp), %rsi
callq 0x2070
jmp 0x47c6
movq 0x7803(%rip), %rdi      # 0xbfd0
movq (%rdi), %rax
movq -0x18(%rax), %rax
addq %rax, %rdi
callq 0x2030
movb %al, -0x22a(%rbp)
jmp 0x47e4
movb -0x22a(%rbp), %al
testb $0x1, %al
jne 0x47f0
jmp 0x4803
jmp 0x481d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x4980
leaq -0xa0(%rbp), %rdi
leaq -0xa4(%rbp), %rsi
callq 0x63f0
jmp 0x4818
jmp 0x4785
leaq -0xa0(%rbp), %rdi
movq %rdi, -0x258(%rbp)
callq 0x6460
movq -0x258(%rbp), %rdi
movq %rax, -0x250(%rbp)
callq 0x6480
movq %rax, -0x248(%rbp)
movslq -0x1c(%rbp), %rax
movq %rax, -0x240(%rbp)
movslq -0x20(%rbp), %rax
movq %rax, -0x238(%rbp)
movb -0x55(%rbp), %al
movb %al, -0x22c(%rbp)
movb -0x56(%rbp), %al
movb %al, -0x22b(%rbp)
leaq -0xe8(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x2120
jmp 0x4884
movq -0x238(%rbp), %r8
movq -0x240(%rbp), %rcx
movq -0x248(%rbp), %rdx
movq -0x250(%rbp), %rsi
movb -0x22c(%rbp), %al
movb -0x22b(%rbp), %r9b
movss -0x18(%rbp), %xmm0
movss -0x14(%rbp), %xmm1
movq %rsp, %rdi
leaq -0xe8(%rbp), %r10
movq %r10, 0x8(%rdi)
movzbl %r9b, %r9d
andl $0x1, %r9d
movl %r9d, (%rdi)
movzbl %al, %r9d
andl $0x1, %r9d
leaq -0xc8(%rbp), %rdi
callq 0x4a70
jmp 0x48e6
movq 0x76d3(%rip), %rdi      # 0xbfc0
leaq -0xc8(%rbp), %rsi
callq 0x2200
movq %rax, -0x260(%rbp)
jmp 0x4902
movq -0x260(%rbp), %rdi
movq 0x7690(%rip), %rsi      # 0xbfa0
callq 0x2250
jmp 0x4917
leaq -0xc8(%rbp), %rdi
callq 0x23f8
leaq -0xe8(%rbp), %rdi
callq 0x23f8
movl $0x0, -0x4(%rbp)
movl $0x1, -0x84(%rbp)
leaq -0xa0(%rbp), %rdi
callq 0x6320
jmp 0x498e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x4974
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0xc8(%rbp), %rdi
callq 0x23f8
leaq -0xe8(%rbp), %rdi
callq 0x23f8
leaq -0xa0(%rbp), %rdi
callq 0x6320
jmp 0x49a3
leaq -0x40(%rbp), %rdi
callq 0x23f8
movl -0x4(%rbp), %eax
addq $0x270, %rsp            # imm = 0x270
popq %rbp
retq
leaq -0x40(%rbp), %rdi
callq 0x23f8
movq -0x50(%rbp), %rdi
callq 0x23a0
nopw %cs:(%rax,%rax)
nop