// File: /workspace/github_cpp_makefile_star2_O3/matthewarcus[P]mmps/project.cpp
// Function: main
int main(int argc, char* argv[])
{
  Image inImage;
  const char *infilename = "images/earth.ppm";
  const char *outfilename = NULL;
  const char *backfilename = NULL;
  int width = 800;
  int height = 600;
  bool adjust = false;

  TransformParams params;
  // Multi image stuff
  double xinc = 0.0;
  double yinc = 0.0;
  double zinc = 0.0;
  double turninc = 0.0;
  double tiltinc = 0.0;
  double latinc = 0.0;
  double loninc = 0.0;
  double timeinc = 0.0;
  double dateinc = 0.0;
  int loop = 1;

  bool invert = false; // Apply the inverse mapping

  // array of pointers. Dynamic allocation is less typing than
  // stack allocating everything.
  OptSpec *optspecs [] = {
    // General options
    new RgbSpec ("-bg", params.background),
    new IntSpec ("-w", width),
    new IntSpec ("-h", height),
    new BoolSpec ("-adjust", adjust),
    new StringSpec ("-f", infilename),
    new StringSpec ("-out", outfilename),
    new StringSpec ("-back", backfilename),
    new BoolSpec ("-i", invert),

    // First the projection parameters
    new DoubleSpec ("-tilt", params.tilt, 2 * pi / 360.0 ),
    new DoubleSpec ("-turn", params.turn, 2 * pi / 360.0 ),
    new DoubleSpec ("-rotate", params.rotate, 2 * pi / 360.0 ),
    new DoubleSpec ("-lat", params.lat, 2 * pi / 360.0 ),
    new DoubleSpec ("-long", params.lon, 2 * pi / 360.0 ),
    new DoubleSpec ("-scale", params.scale),
    new DoubleSpec ("-radius", params.radius, 2 * pi / 360.0 ),
    new DoubleSpec ("-x", params.x),
    new DoubleSpec ("-y", params.y),
    new DoubleSpec ("-z", params.z),
    new DoubleSpec ("-ox", params.ox),
    new DoubleSpec ("-oy", params.oy),
    new DoubleSpec ("-oz", params.oz),
    new DoubleSpec ("-a", params.a),
    new DoubleSpec ("-date", params.date),
    new DoubleSpec ("-time", params.time, 2 * pi / 24.0),
    new DoubleSpec ("-p", params.p, 2 * pi / 360.0),
    new DoubleSpec ("-aw", params.aw, 2 * pi / 360.0),
    new DoubleSpec ("-conic", params.conic),
    new DoubleSpec ("-conicr", params.conicr),
    new DoubleSpec ("-xoff", params.xoff),
    new DoubleSpec ("-yoff", params.yoff),
    new BoolSpec ("-sun", params.sun),

    // Grid and dial options
    // These accumulate in a list and are 'executed' in order.
    new CmdSpec ("-color", 1), // Set color
    new CmdSpec ("-gridx", 1), // Set grid coordinates
    new CmdSpec ("-gridy", 1),
    new CmdSpec ("-gridoff", 1), // Angular offset
    new CmdSpec ("-dlat", 1), // Set dial origin
    new CmdSpec ("-dlong", 1),

    new CmdSpec ("-grid", 0),
    new CmdSpec ("-localhours",0),
    new CmdSpec ("-temporaryhours",0),
    new CmdSpec ("-altitudes",0),
    new CmdSpec ("-analemma",0),
    new CmdSpec ("-tropics",0),
    new CmdSpec ("-arctics",0),
    new CmdSpec ("-dateline",1),
    new CmdSpec ("-datetime",1),

    // Backwards compatible - set default initial color
    new RgbSpec ("-gridcolor", params.gridcolor),

    // Loop options
    new IntSpec ("-loop", loop ),
    new DoubleSpec ("-tiltinc", tiltinc, 2 * pi / 360.0 ),
    new DoubleSpec ("-turninc", tiltinc, 2 * pi / 360.0 ),
    new DoubleSpec ("-latinc", latinc, 2 * pi / 360.0 ),
    new DoubleSpec ("-longinc", loninc, 2 * pi / 360.0 ),
    new DoubleSpec ("-xinc", xinc),
    new DoubleSpec ("-yinc", yinc),
    new DoubleSpec ("-zinc", zinc),
    new DoubleSpec ("-dateinc", dateinc, 2 * pi / 365.25),
    new DoubleSpec ("-timeinc", timeinc, 2 * pi / 24.0),

    NULL // Finish up
  };
  
  char *progname = argv[0];
  argc--;argv++;
  if (argc == 1 && strcmp(argv[0],"-v") == 0) {
    fprintf(stderr,"MMPS Version %s " __DATE__ "\n", VERSION);
    exit(0);
  }

  Transform* transform = NULL;

  while (argc > 0) {
    int result = OptSpec::ReadOpts(argc, argv, optspecs);
    if (result == -1) {
      // Assume error has been reported by ReadOpts
      error(usage, progname);
    } else if (result != 1) {
      // Option not recognized
      // Is it a transform>?
      Transform *t = Transform::GetTransform(argv[0]);
      if (t == NULL) {
	fprintf(stderr,"Unrecognized option %s\n",argv[0]);
	error(usage, progname);
      } else {
	if (transform == NULL) {
	  // Found a transform
	  transform = t;
	} else {
	  // Oops, two transforms
	  fprintf(stderr,"Can only specify one projection type\n");
	  error(usage, progname); 
	}
      }
    }
    argc--; argv++;
  }

  if (transform == NULL) {
    fprintf(stderr,"Need to specify a projection type\n");
    error(usage, progname);
  }

  inImage.Read(infilename);

  if (adjust) {
    transform->AdjustSize(width, height, params);
  }
  Image outImage(width, height);
  Image backImage;
  if (backfilename != NULL) {
    backImage.Read(backfilename);
  }
  for (int i = 0; i < loop; i++) {
    if (backfilename != NULL) {
      outImage.Copy(backImage);
      params.noback = true;
    }
    transform->Init(params);
    if (invert) {
      transform->TransformImageInv(inImage, outImage, params);
      // No commands for inverse transformation yet
    } else {
      transform->TransformImage(inImage, outImage, params);
      transform->DoCommands(outImage, params, CmdSpec::getcmdlist());
    }
    if (loop > 1) {
      char fname[256];
      sprintf(fname, "%s%04d.ppm", outfilename, i);
      outImage.Write(fname);
      fprintf(stderr, "Written %s\n", fname);
    } else {
      outImage.Write(outfilename);
    }      
    params.turn += turninc;
    params.tilt += tiltinc;
    params.lat += latinc;
    params.lon += loninc;
    params.x += xinc;
    params.y += yinc;
    params.z += zinc;
    params.time += timeinc;
    params.date += dateinc;
  }
  delete(transform);
  return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x7f8, %rsp            # imm = 0x7F8
movl %edi, 0x8(%rsp)
movq %rsi, 0x20(%rsp)
xorl %ebx, %ebx
leaq 0x390(%rsp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0xbd38
leaq 0x8be5(%rip), %rax      # 0xd275
movq %rax, 0x78(%rsp)
movq %rbx, 0x38(%rsp)
movq %rbx, 0x30(%rsp)
movl $0x320, 0x14(%rsp)      # imm = 0x320
movl $0x258, 0x10(%rsp)      # imm = 0x258
movb $0x0, 0x7(%rsp)
leaq 0x80(%rsp), %rdi
callq 0x64ba
xorl %eax, %eax
movq %rax, 0x70(%rsp)
movq %rax, 0x68(%rsp)
movq %rax, 0x60(%rsp)
movq %rax, 0x28(%rsp)
movq %rax, 0x58(%rsp)
movq %rax, 0x50(%rsp)
movq %rax, 0x48(%rsp)
movq %rax, 0x40(%rsp)
movl $0x1, 0xc(%rsp)
movb $0x0, 0x6(%rsp)
movl $0x18, %edi
callq 0x4200
movq %rax, %r14
leaq 0x8b7a(%rip), %rsi      # 0xd286
movq %rax, %rdi
callq 0xb132
leaq 0x140(%rsp), %rax
leaq 0xe65d(%rip), %rbx      # 0x12d80
addq $0x10, %rbx
movq %rbx, (%r14)
movq %rax, 0x10(%r14)
movq %r14, 0x170(%rsp)
movl $0x18, %edi
callq 0x4200
movq %rax, %r14
leaq 0x8b40(%rip), %rsi      # 0xd28a
leaq 0x14(%rsp), %rdx
movq %rax, %rdi
callq 0xb22c
movq %r14, 0x178(%rsp)
movl $0x18, %edi
callq 0x4200
movq %rax, %r14
leaq 0x8b1a(%rip), %rsi      # 0xd28d
leaq 0x10(%rsp), %rdx
movq %rax, %rdi
callq 0xb22c
movq %r14, 0x180(%rsp)
movl $0x18, %edi
callq 0x4200
movq %rax, %r14
leaq 0x8af4(%rip), %rsi      # 0xd290
leaq 0x7(%rsp), %rdx
movq %rax, %rdi
callq 0xb176
movq %r14, 0x188(%rsp)
movl $0x18, %edi
callq 0x4200
movq %rax, %r14
leaq 0x8ad3(%rip), %rsi      # 0xd298
leaq 0x78(%rsp), %rdx
movq %rax, %rdi
callq 0xb1b4
movq %r14, 0x190(%rsp)
movl $0x18, %edi
callq 0x4200
movq %rax, %r14
leaq 0x8aad(%rip), %rsi      # 0xd29b
leaq 0x38(%rsp), %rdx
movq %rax, %rdi
callq 0xb1b4
movq %r14, 0x198(%rsp)
movl $0x18, %edi
callq 0x4200
movq %rax, %r14
leaq 0x8a89(%rip), %rsi      # 0xd2a0
leaq 0x30(%rsp), %rdx
movq %rax, %rdi
callq 0xb1b4
movq %r14, 0x1a0(%rsp)
movl $0x18, %edi
callq 0x4200
movq %rax, %r14
leaq 0x8a66(%rip), %rsi      # 0xd2a6
leaq 0x6(%rsp), %rdx
movq %rax, %rdi
callq 0xb176
movq %r14, 0x1a8(%rsp)
movl $0x20, %edi
callq 0x4200
movq %rax, %r14
leaq 0x8a40(%rip), %rsi      # 0xd2a9
leaq 0x80(%rsp), %rdx
movsd 0x878f(%rip), %xmm0     # 0xd008
movq %rax, %rdi
callq 0xb2ac
movq %r14, 0x1b0(%rsp)
movl $0x20, %edi
callq 0x4200
movq %rax, %r14
leaq 0x88(%rsp), %rdx
leaq 0x8a0a(%rip), %rsi      # 0xd2af
movsd 0x875b(%rip), %xmm0     # 0xd008
movq %rax, %rdi
callq 0xb2ac
movq %r14, 0x1b8(%rsp)
movl $0x20, %edi
callq 0x4200
movq %rax, %r14
leaq 0x90(%rsp), %rdx
leaq 0x89dc(%rip), %rsi      # 0xd2b5
movsd 0x8727(%rip), %xmm0     # 0xd008
movq %rax, %rdi
callq 0xb2ac
movq %r14, 0x1c0(%rsp)
movl $0x20, %edi
callq 0x4200
movq %rax, %r14
leaq 0x98(%rsp), %rdx
leaq 0x89b0(%rip), %rsi      # 0xd2bd
movsd 0x86f3(%rip), %xmm0     # 0xd008
movq %rax, %rdi
callq 0xb2ac
movq %r14, 0x1c8(%rsp)
movl $0x20, %edi
callq 0x4200
movq %rax, %r14
leaq 0xa0(%rsp), %rdx
leaq 0x8981(%rip), %rsi      # 0xd2c2
movsd 0x86bf(%rip), %xmm0     # 0xd008
movq %rax, %rdi
callq 0xb2ac
movq %r14, 0x1d0(%rsp)
movl $0x20, %edi
callq 0x4200
movq %rax, %r14
leaq 0xa8(%rsp), %rdx
leaq 0x8953(%rip), %rsi      # 0xd2c8
movsd 0x8693(%rip), %xmm0     # 0xd010
movq %rax, %rdi
callq 0xb2ac
movq %r14, 0x1d8(%rsp)
movl $0x20, %edi
callq 0x4200
movq %rax, %r14
leaq 0xb0(%rsp), %rdx
leaq 0x8926(%rip), %rsi      # 0xd2cf
movsd 0x8657(%rip), %xmm0     # 0xd008
movq %rax, %rdi
callq 0xb2ac
movq %r14, 0x1e0(%rsp)
movl $0x20, %edi
callq 0x4200
movq %rax, %r14
leaq 0xc8(%rsp), %rdx
leaq 0x88fa(%rip), %rsi      # 0xd2d7
movsd 0x862b(%rip), %xmm0     # 0xd010
movq %rax, %rdi
callq 0xb2ac
movq %r14, 0x1e8(%rsp)
movl $0x20, %edi
callq 0x4200
movq %rax, %r14
leaq 0xd0(%rsp), %rdx
leaq 0x88c9(%rip), %rsi      # 0xd2da
movsd 0x85f7(%rip), %xmm0     # 0xd010
movq %rax, %rdi
callq 0xb2ac
movq %r14, 0x1f0(%rsp)
movl $0x20, %edi
callq 0x4200
movq %rax, %r14
leaq 0xd8(%rsp), %rdx
leaq 0x8898(%rip), %rsi      # 0xd2dd
movsd 0x85c3(%rip), %xmm0     # 0xd010
movq %rax, %rdi
callq 0xb2ac
movq %r14, 0x1f8(%rsp)
movl $0x20, %edi
callq 0x4200
movq %rax, %r14
leaq 0xe0(%rsp), %rdx
leaq 0x8867(%rip), %rsi      # 0xd2e0
movsd 0x858f(%rip), %xmm0     # 0xd010
movq %rax, %rdi
callq 0xb2ac
movq %r14, 0x200(%rsp)
movl $0x20, %edi
callq 0x4200
movq %rax, %r14
leaq 0xe8(%rsp), %rdx
leaq 0x8837(%rip), %rsi      # 0xd2e4
movsd 0x855b(%rip), %xmm0     # 0xd010
movq %rax, %rdi
callq 0xb2ac
movq %r14, 0x208(%rsp)
movl $0x20, %edi
callq 0x4200
movq %rax, %r14
leaq 0xf0(%rsp), %rdx
leaq 0x8807(%rip), %rsi      # 0xd2e8
movsd 0x8527(%rip), %xmm0     # 0xd010
movq %rax, %rdi
callq 0xb2ac
movq %r14, 0x210(%rsp)
movl $0x20, %edi
callq 0x4200
movq %rax, %r14
leaq 0xb8(%rsp), %rdx
leaq 0x87d7(%rip), %rsi      # 0xd2ec
movsd 0x84f3(%rip), %xmm0     # 0xd010
movq %rax, %rdi
callq 0xb2ac
movq %r14, 0x218(%rsp)
movl $0x20, %edi
callq 0x4200
movq %rax, %r14
leaq 0x110(%rsp), %rdx
leaq 0x87a6(%rip), %rsi      # 0xd2ef
movsd 0x84bf(%rip), %xmm0     # 0xd010
movq %rax, %rdi
callq 0xb2ac
movq %r14, 0x220(%rsp)
movl $0x20, %edi
callq 0x4200
movq %rax, %r14
leaq 0x108(%rsp), %rdx
leaq 0x8778(%rip), %rsi      # 0xd2f5
movsd 0x8493(%rip), %xmm0     # 0xd018
movq %rax, %rdi
callq 0xb2ac
movq %r14, 0x228(%rsp)
movl $0x20, %edi
callq 0x4200
movq %rax, %r14
leaq 0x100(%rsp), %rdx
leaq 0x874a(%rip), %rsi      # 0xd2fb
movsd 0x844f(%rip), %xmm0     # 0xd008
movq %rax, %rdi
callq 0xb2ac
movq %r14, 0x230(%rsp)
movl $0x20, %edi
callq 0x4200
movq %rax, %r14
leaq 0xc0(%rsp), %rdx
leaq 0x8719(%rip), %rsi      # 0xd2fe
movsd 0x841b(%rip), %xmm0     # 0xd008
movq %rax, %rdi
callq 0xb2ac
movq %r14, 0x238(%rsp)
movl $0x20, %edi
callq 0x4200
movq %rax, %r14
leaq 0x120(%rsp), %rdx
leaq 0x86e9(%rip), %rsi      # 0xd302
movsd 0x83ef(%rip), %xmm0     # 0xd010
movq %rax, %rdi
callq 0xb2ac
movq %r14, 0x240(%rsp)
movl $0x20, %edi
callq 0x4200
movq %rax, %r14
leaq 0x128(%rsp), %rdx
leaq 0x86bc(%rip), %rsi      # 0xd309
movsd 0x83bb(%rip), %xmm0     # 0xd010
movq %rax, %rdi
callq 0xb2ac
movq %r14, 0x248(%rsp)
movl $0x20, %edi
callq 0x4200
movq %rax, %r14
leaq 0x130(%rsp), %rdx
leaq 0x8690(%rip), %rsi      # 0xd311
movsd 0x8387(%rip), %xmm0     # 0xd010
movq %rax, %rdi
callq 0xb2ac
movq %r14, 0x250(%rsp)
movl $0x20, %edi
callq 0x4200
movq %rax, %r14
leaq 0x138(%rsp), %rdx
leaq 0x8662(%rip), %rsi      # 0xd317
movsd 0x8353(%rip), %xmm0     # 0xd010
movq %rax, %rdi
callq 0xb2ac
movq %r14, 0x258(%rsp)
movl $0x18, %edi
callq 0x4200
movq %rax, %r14
leaq 0xf8(%rsp), %rdx
leaq 0x8634(%rip), %rsi      # 0xd31d
movq %rax, %rdi
callq 0xb176
movq %r14, 0x260(%rsp)
movl $0x18, %edi
callq 0x4200
movq %rax, %r14
leaq 0x8615(%rip), %rsi      # 0xd322
movq %rax, %rdi
movl $0x1, %edx
callq 0xb340
movq %r14, 0x268(%rsp)
movl $0x18, %edi
callq 0x4200
movq %rax, %r14
leaq 0x85f3(%rip), %rsi      # 0xd329
movq %rax, %rdi
movl $0x1, %edx
callq 0xb340
movq %r14, 0x270(%rsp)
movl $0x18, %edi
callq 0x4200
movq %rax, %r14
leaq 0x85d1(%rip), %rsi      # 0xd330
movq %rax, %rdi
movl $0x1, %edx
callq 0xb340
movq %r14, 0x278(%rsp)
movl $0x18, %edi
callq 0x4200
movq %rax, %r14
leaq 0x85af(%rip), %rsi      # 0xd337
movq %rax, %rdi
movl $0x1, %edx
callq 0xb340
movq %r14, 0x280(%rsp)
movl $0x18, %edi
callq 0x4200
movq %rax, %r14
leaq 0x858f(%rip), %rsi      # 0xd340
movq %rax, %rdi
movl $0x1, %edx
callq 0xb340
movq %r14, 0x288(%rsp)
movl $0x18, %edi
callq 0x4200
movq %rax, %r14
leaq 0x856c(%rip), %rsi      # 0xd346
movq %rax, %rdi
movl $0x1, %edx
callq 0xb340
movq %r14, 0x290(%rsp)
movl $0x18, %edi
callq 0x4200
movq %rax, %r14
leaq 0x854a(%rip), %rsi      # 0xd34d
movq %rax, %rdi
xorl %edx, %edx
callq 0xb340
movq %r14, 0x298(%rsp)
movl $0x18, %edi
callq 0x4200
movq %rax, %r14
leaq 0x852a(%rip), %rsi      # 0xd353
movq %rax, %rdi
xorl %edx, %edx
callq 0xb340
movq %r14, 0x2a0(%rsp)
movl $0x18, %edi
callq 0x4200
movq %rax, %r14
leaq 0x8510(%rip), %rsi      # 0xd35f
movq %rax, %rdi
xorl %edx, %edx
callq 0xb340
movq %r14, 0x2a8(%rsp)
movl $0x18, %edi
callq 0x4200
movq %rax, %r14
leaq 0x84fa(%rip), %rsi      # 0xd36f
movq %rax, %rdi
xorl %edx, %edx
callq 0xb340
movq %r14, 0x2b0(%rsp)
movl $0x18, %edi
callq 0x4200
movq %rax, %r14
leaq 0x84df(%rip), %rsi      # 0xd37a
movq %rax, %rdi
xorl %edx, %edx
callq 0xb340
movq %r14, 0x2b8(%rsp)
movl $0x18, %edi
callq 0x4200
movq %rax, %r14
leaq 0x84c3(%rip), %rsi      # 0xd384
movq %rax, %rdi
xorl %edx, %edx
callq 0xb340
movq %r14, 0x2c0(%rsp)
movl $0x18, %edi
callq 0x4200
movq %rax, %r14
leaq 0x84a6(%rip), %rsi      # 0xd38d
movq %rax, %rdi
xorl %edx, %edx
callq 0xb340
movq %r14, 0x2c8(%rsp)
movl $0x18, %edi
callq 0x4200
movq %rax, %r14
leaq 0x8489(%rip), %rsi      # 0xd396
movq %rax, %rdi
movl $0x1, %edx
callq 0xb340
movq %r14, 0x2d0(%rsp)
movl $0x18, %edi
callq 0x4200
movq %rax, %r14
leaq 0x846a(%rip), %rsi      # 0xd3a0
movq %rax, %rdi
movl $0x1, %edx
callq 0xb340
movq %r14, 0x2d8(%rsp)
movl $0x18, %edi
callq 0x4200
movq %rax, %r14
leaq 0x844b(%rip), %rsi      # 0xd3aa
movq %rax, %rdi
callq 0xb132
leaq 0x14c(%rsp), %rax
movq %rbx, (%r14)
movq %rax, 0x10(%r14)
movq %r14, 0x2e0(%rsp)
movl $0x18, %edi
callq 0x4200
movq %rax, %r14
leaq 0x8423(%rip), %rsi      # 0xd3b5
leaq 0xc(%rsp), %rdx
movq %rax, %rdi
callq 0xb22c
movq %r14, 0x2e8(%rsp)
movl $0x20, %edi
callq 0x4200
movq %rax, %r14
leaq 0x8400(%rip), %rsi      # 0xd3bb
leaq 0x28(%rsp), %rdx
movsd 0x8040(%rip), %xmm0     # 0xd008
movq %rax, %rdi
callq 0xb2ac
movq %r14, 0x2f0(%rsp)
movl $0x20, %edi
callq 0x4200
movq %rax, %r14
leaq 0x83d8(%rip), %rsi      # 0xd3c4
leaq 0x28(%rsp), %rdx
movsd 0x800f(%rip), %xmm0     # 0xd008
movq %rax, %rdi
callq 0xb2ac
movq %r14, 0x2f8(%rsp)
movl $0x20, %edi
callq 0x4200
movq %rax, %r14
leaq 0x83b0(%rip), %rsi      # 0xd3cd
leaq 0x58(%rsp), %rdx
movsd 0x7fde(%rip), %xmm0     # 0xd008
movq %rax, %rdi
callq 0xb2ac
movq %r14, 0x300(%rsp)
movl $0x20, %edi
callq 0x4200
movq %rax, %r14
leaq 0x8387(%rip), %rsi      # 0xd3d5
leaq 0x50(%rsp), %rdx
movsd 0x7fad(%rip), %xmm0     # 0xd008
movq %rax, %rdi
callq 0xb2ac
movq %r14, 0x308(%rsp)
movl $0x20, %edi
callq 0x4200
movq %rax, %r14
leaq 0x835f(%rip), %rsi      # 0xd3de
leaq 0x70(%rsp), %rdx
movsd 0x7f84(%rip), %xmm0     # 0xd010
movq %rax, %rdi
callq 0xb2ac
movq %r14, 0x310(%rsp)
movl $0x20, %edi
callq 0x4200
movq %rax, %r14
leaq 0x8334(%rip), %rsi      # 0xd3e4
leaq 0x68(%rsp), %rdx
movsd 0x7f53(%rip), %xmm0     # 0xd010
movq %rax, %rdi
callq 0xb2ac
movq %r14, 0x318(%rsp)
movl $0x20, %edi
callq 0x4200
movq %rax, %r14
leaq 0x8309(%rip), %rsi      # 0xd3ea
leaq 0x60(%rsp), %rdx
movsd 0x7f22(%rip), %xmm0     # 0xd010
movq %rax, %rdi
callq 0xb2ac
movq %r14, 0x320(%rsp)
movl $0x20, %edi
callq 0x4200
movq %rax, %r14
leaq 0x82de(%rip), %rsi      # 0xd3f0
leaq 0x40(%rsp), %rdx
movsd 0x7f01(%rip), %xmm0     # 0xd020
movq %rax, %rdi
callq 0xb2ac
movq %r14, 0x328(%rsp)
movl $0x20, %edi
callq 0x4200
movq %rax, %r14
leaq 0x82b6(%rip), %rsi      # 0xd3f9
leaq 0x48(%rsp), %rdx
movsd 0x7ec8(%rip), %xmm0     # 0xd018
movq %rax, %rdi
callq 0xb2ac
movq %r14, 0x330(%rsp)
movq $0x0, 0x338(%rsp)
movq 0x20(%rsp), %rax
movq (%rax), %rcx
movq %rcx, 0x18(%rsp)
movl 0x8(%rsp), %ecx
leal -0x1(%rcx), %edx
movl %edx, 0x8(%rsp)
addq $0x8, %rax
movq %rax, 0x20(%rsp)
cmpl $0x1, %edx
jne 0x51ab
movq (%rax), %rax
cmpb $0x2d, (%rax)
jne 0x51b4
cmpb $0x76, 0x1(%rax)
jne 0x51b4
cmpb $0x0, 0x2(%rax)
jne 0x51b4
callq 0x4380
cmpl $0x2, %ecx
jl 0x556b
leaq 0x8(%rsp), %r15
leaq 0x20(%rsp), %r12
leaq 0x170(%rsp), %r13
leaq 0x3f0(%rsp), %r14
xorl %ebp, %ebp
movq %rbp, %rbx
movq %r15, %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0xb142
cmpl $0x1, %eax
je 0x520e
cmpl $-0x1, %eax
jne 0x5213
movq 0xdfd6(%rip), %rdx      # 0x131c8
movl $0x400, %esi            # imm = 0x400
movq %r14, %rdi
movq 0x18(%rsp), %rcx
xorl %eax, %eax
callq 0x4290
movq %r14, %rdi
callq 0xb0dc
movq %rbx, %rbp
jmp 0x522d
movq 0x20(%rsp), %rax
movq (%rax), %rdi
callq 0x7610
movq %rax, %rbp
testq %rax, %rax
je 0x5248
testq %rbx, %rbx
jne 0x528d
movl 0x8(%rsp), %eax
leal -0x1(%rax), %ecx
movl %ecx, 0x8(%rsp)
addq $0x8, 0x20(%rsp)
cmpl $0x1, %eax
jg 0x51d0
jmp 0x52d5
movq 0xdd91(%rip), %rax      # 0x12fe0
movq (%rax), %rdi
movq 0x20(%rsp), %rax
movq (%rax), %rdx
leaq 0x81c5(%rip), %rsi      # 0xd426
xorl %eax, %eax
callq 0x4260
movq 0xdf59(%rip), %rdx      # 0x131c8
movl $0x400, %esi            # imm = 0x400
movq %r14, %rdi
movq 0x18(%rsp), %rcx
xorl %eax, %eax
callq 0x4290
movq %r14, %rdi
callq 0xb0dc
jmp 0x520e
movq 0xdd4c(%rip), %rax      # 0x12fe0
movq (%rax), %rcx
movl $0x25, %esi
movl $0x1, %edx
leaq 0x8196(%rip), %rdi      # 0xd43e
callq 0x4350
movq 0xdf14(%rip), %rdx      # 0x131c8
movl $0x400, %esi            # imm = 0x400
movq %r14, %rdi
movq 0x18(%rsp), %rcx
xorl %eax, %eax
callq 0x4290
movq %r14, %rdi
callq 0xb0dc
jmp 0x520e
testq %rbp, %rbp
je 0x556b
xorl %ebx, %ebx
movq 0x78(%rsp), %rsi
leaq 0x390(%rsp), %rdi
xorl %edx, %edx
callq 0xbf26
cmpb $0x1, 0x7(%rsp)
jne 0x5317
movq (%rbp), %rax
leaq 0x14(%rsp), %rsi
leaq 0x10(%rsp), %rdx
leaq 0x80(%rsp), %rcx
movq %rbp, %rdi
callq *0x10(%rax)
movslq 0x14(%rsp), %rsi
movslq 0x10(%rsp), %rdx
leaq 0x3c0(%rsp), %rdi
callq 0xbd38
movl %ebx, 0x18(%rsp)
leaq 0x360(%rsp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0xbd38
movq 0x30(%rsp), %rsi
testq %rsi, %rsi
je 0x535c
leaq 0x360(%rsp), %rdi
xorl %edx, %edx
callq 0xbf26
cmpl $0x0, 0xc(%rsp)
jle 0x551f
leaq 0x80(%rsp), %r14
leaq 0x390(%rsp), %r15
leaq 0x3c0(%rsp), %r12
xorl %r13d, %r13d
cmpq $0x0, 0x30(%rsp)
je 0x53a2
movq %r12, %rdi
leaq 0x360(%rsp), %rsi
callq 0xbdf4
movb $0x1, 0x118(%rsp)
movq (%rbp), %rax
movq %rbp, %rdi
movq %r14, %rsi
callq *0x8(%rax)
cmpb $0x1, 0x6(%rsp)
jne 0x53c9
movq %rbp, %rdi
movq %r15, %rsi
movq %r12, %rdx
movq %r14, %rcx
callq 0x703c
jmp 0x540f
movq %rbp, %rdi
movq %r15, %rsi
movq %r12, %rdx
movq %r14, %rcx
callq 0x6d1c
leaq 0x348(%rsp), %rdi
leaq 0xddff(%rip), %rsi      # 0x131e8
callq 0x56ae
movq %rbp, %rdi
movq %r12, %rsi
movq %r14, %rdx
leaq 0x348(%rsp), %rbx
movq %rbx, %rcx
callq 0x97f2
movq %rbx, %rdi
callq 0x5748
cmpl $0x2, 0xc(%rsp)
jge 0x54cd
movq 0x38(%rsp), %rsi
movq %r12, %rdi
callq 0xc14a
movsd 0x28(%rsp), %xmm0
addpd 0x80(%rsp), %xmm0
movapd %xmm0, 0x80(%rsp)
movsd 0x58(%rsp), %xmm0
movhpd 0x50(%rsp), %xmm0       # xmm0 = xmm0[0],mem[0]
movupd 0x98(%rsp), %xmm1
addpd %xmm0, %xmm1
movupd 0xc8(%rsp), %xmm0
movupd 0x108(%rsp), %xmm2
movupd %xmm1, 0x98(%rsp)
movsd 0x70(%rsp), %xmm1
movhpd 0x68(%rsp), %xmm1       # xmm1 = xmm1[0],mem[0]
addpd %xmm0, %xmm1
movupd %xmm1, 0xc8(%rsp)
movsd 0x60(%rsp), %xmm0
addsd 0xd8(%rsp), %xmm0
movsd %xmm0, 0xd8(%rsp)
movsd 0x48(%rsp), %xmm0
movhpd 0x40(%rsp), %xmm0       # xmm0 = xmm0[0],mem[0]
addpd %xmm2, %xmm0
movupd %xmm0, 0x108(%rsp)
incl %r13d
cmpl 0xc(%rsp), %r13d
jl 0x5382
jmp 0x551f
movq %r15, %rbx
movq 0x38(%rsp), %rdx
leaq 0x3f0(%rsp), %r15
movq %r15, %rdi
leaq 0x7fa0(%rip), %rsi      # 0xd487
movl %r13d, %ecx
xorl %eax, %eax
callq 0x4060
movq %r12, %rdi
movq %r15, %rsi
callq 0xc14a
movq 0xdadd(%rip), %rax      # 0x12fe0
movq (%rax), %rdi
leaq 0x7f85(%rip), %rsi      # 0xd492
movq %r15, %rdx
xorl %eax, %eax
callq 0x4260
movq %rbx, %r15
jmp 0x5427
cmpb $0x0, 0x18(%rsp)
jne 0x5530
movq (%rbp), %rax
movq %rbp, %rdi
callq *0x40(%rax)
leaq 0x360(%rsp), %rdi
callq 0xbd8c
leaq 0x3c0(%rsp), %rdi
callq 0xbd8c
leaq 0x390(%rsp), %rdi
callq 0xbd8c
xorl %eax, %eax
addq $0x7f8, %rsp            # imm = 0x7F8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0xda6e(%rip), %rax      # 0x12fe0
movq (%rax), %rcx
leaq 0x7ee8(%rip), %rdi      # 0xd464
movl $0x22, %esi
movl $0x1, %edx
callq 0x4350
movq 0xdc36(%rip), %rdx      # 0x131c8
leaq 0x3f0(%rsp), %rbx
movl $0x400, %esi            # imm = 0x400
movq %rbx, %rdi
movq 0x18(%rsp), %rcx
xorl %eax, %eax
callq 0x4290
movq %rbx, %rdi
callq 0xb0dc
movb $0x1, %bl
xorl %ebp, %ebp
jmp 0x52e0
jmp 0x567c
movq %rax, %rbx
jmp 0x568c
jmp 0x5677
jmp 0x5631
jmp 0x5631
jmp 0x5631
jmp 0x5631
jmp 0x5631
jmp 0x5631
jmp 0x5631
jmp 0x5631
jmp 0x5631
jmp 0x5649
jmp 0x5649
jmp 0x5649
jmp 0x5649
jmp 0x5649
jmp 0x5649
jmp 0x5649
jmp 0x5649
jmp 0x5649
jmp 0x5649
jmp 0x5649
jmp 0x5649
jmp 0x5649
jmp 0x5649
jmp 0x5649
jmp 0x5649
jmp 0x5649
jmp 0x5649
jmp 0x5631
jmp 0x5631
jmp 0x5631
jmp 0x5631
jmp 0x5631
jmp 0x5631
jmp 0x5631
jmp 0x5631
jmp 0x5631
jmp 0x5631
jmp 0x5631
jmp 0x5631
jmp 0x5631
jmp 0x5631
jmp 0x5631
jmp 0x5631
jmp 0x5631
jmp 0x5631
jmp 0x5631
jmp 0x5631
jmp 0x5631
movq %rax, %rbx
movl $0x20, %esi
jmp 0x5651
jmp 0x5649
jmp 0x5649
jmp 0x5649
jmp 0x5649
jmp 0x5649
jmp 0x5649
jmp 0x5649
movq %rax, %rbx
movl $0x18, %esi
movq %r14, %rdi
callq 0x4210
jmp 0x5699
jmp 0x5677
jmp 0x5677
movq %rax, %rbx
leaq 0x348(%rsp), %rdi
callq 0x5748
jmp 0x567f
jmp 0x5677
jmp 0x567c
jmp 0x5677
movq %rax, %rbx
jmp 0x5699
movq %rax, %rbx
leaq 0x360(%rsp), %rdi
callq 0xbd8c
leaq 0x3c0(%rsp), %rdi
callq 0xbd8c
leaq 0x390(%rsp), %rdi
callq 0xbd8c
movq %rbx, %rdi
callq 0x4300