// File: /workspace/github_cpp_makefile_star2_O2/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 $0x4f8, %rsp            # imm = 0x4F8
movl %edi, 0x10(%rsp)
movq %rsi, 0x20(%rsp)
leaq 0x390(%rsp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0xae62
andq $0x0, 0x38(%rsp)
leaq 0x7d71(%rip), %rax      # 0xc275
andq $0x0, 0x30(%rsp)
movq %rax, 0x78(%rsp)
movl $0x320, 0x1c(%rsp)      # imm = 0x320
movl $0x258, 0x18(%rsp)      # imm = 0x258
movb $0x0, 0xf(%rsp)
leaq 0x80(%rsp), %rdi
callq 0x5dba
andq $0x0, 0x70(%rsp)
andq $0x0, 0x68(%rsp)
andq $0x0, 0x60(%rsp)
andq $0x0, 0x28(%rsp)
andq $0x0, 0x58(%rsp)
andq $0x0, 0x50(%rsp)
andq $0x0, 0x48(%rsp)
andq $0x0, 0x40(%rsp)
movl $0x1, 0x14(%rsp)
movb $0x0, 0xe(%rsp)
pushq $0x18
popq %rdi
callq 0x4210
movq %rax, %r14
leaq 0x140(%rsp), %rdx
leaq 0x7cfe(%rip), %rsi      # 0xc286
movq %rax, %rdi
callq 0x540e
movq %r14, 0x170(%rsp)
pushq $0x18
popq %rdi
callq 0x4210
movq %rax, %r14
leaq 0x7ce0(%rip), %rsi      # 0xc28a
leaq 0x1c(%rsp), %rdx
movq %rax, %rdi
callq 0xa486
movq %r14, 0x178(%rsp)
pushq $0x18
popq %rdi
callq 0x4210
movq %rax, %r14
leaq 0x7cbc(%rip), %rsi      # 0xc28d
leaq 0x18(%rsp), %rdx
movq %rax, %rdi
callq 0xa486
movq %r14, 0x180(%rsp)
pushq $0x18
popq %rdi
callq 0x4210
movq %rax, %r14
leaq 0x7c98(%rip), %rsi      # 0xc290
leaq 0xf(%rsp), %rdx
movq %rax, %rdi
callq 0xa3c6
movq %r14, 0x188(%rsp)
pushq $0x18
popq %rdi
callq 0x4210
movq %rax, %r14
leaq 0x7c79(%rip), %rsi      # 0xc298
leaq 0x78(%rsp), %rdx
movq %rax, %rdi
callq 0xa402
movq %r14, 0x190(%rsp)
pushq $0x18
popq %rdi
callq 0x4210
movq %rax, %r14
leaq 0x7c55(%rip), %rsi      # 0xc29b
leaq 0x38(%rsp), %rdx
movq %rax, %rdi
callq 0xa402
movq %r14, 0x198(%rsp)
pushq $0x18
popq %rdi
callq 0x4210
movq %rax, %r14
leaq 0x7c33(%rip), %rsi      # 0xc2a0
leaq 0x30(%rsp), %rdx
movq %rax, %rdi
callq 0xa402
movq %r14, 0x1a0(%rsp)
pushq $0x18
popq %rdi
callq 0x4210
movq %rax, %r14
leaq 0x7c12(%rip), %rsi      # 0xc2a6
leaq 0xe(%rsp), %rdx
movq %rax, %rdi
callq 0xa3c6
movq %r14, 0x1a8(%rsp)
pushq $0x20
popq %rdi
callq 0x4210
movq %rax, %r14
leaq 0x7bee(%rip), %rsi      # 0xc2a9
leaq 0x80(%rsp), %rdx
movsd 0x793d(%rip), %xmm0     # 0xc008
movq %rax, %rdi
callq 0xa512
movq %r14, 0x1b0(%rsp)
pushq $0x20
popq %rdi
callq 0x4210
movq %rax, %r14
leaq 0x88(%rsp), %rdx
leaq 0x7bba(%rip), %rsi      # 0xc2af
movsd 0x790b(%rip), %xmm0     # 0xc008
movq %rax, %rdi
callq 0xa512
movq %r14, 0x1b8(%rsp)
pushq $0x20
popq %rdi
callq 0x4210
movq %rax, %r14
leaq 0x90(%rsp), %rdx
leaq 0x7b8e(%rip), %rsi      # 0xc2b5
movsd 0x78d9(%rip), %xmm0     # 0xc008
movq %rax, %rdi
callq 0xa512
movq %r14, 0x1c0(%rsp)
pushq $0x20
popq %rdi
callq 0x4210
movq %rax, %r14
leaq 0x98(%rsp), %rdx
leaq 0x7b64(%rip), %rsi      # 0xc2bd
movsd 0x78a7(%rip), %xmm0     # 0xc008
movq %rax, %rdi
callq 0xa512
movq %r14, 0x1c8(%rsp)
pushq $0x20
popq %rdi
callq 0x4210
movq %rax, %r14
leaq 0xa0(%rsp), %rdx
leaq 0x7b37(%rip), %rsi      # 0xc2c2
movsd 0x7875(%rip), %xmm0     # 0xc008
movq %rax, %rdi
callq 0xa512
movq %r14, 0x1d0(%rsp)
pushq $0x20
popq %rdi
callq 0x4210
movq %rax, %r14
leaq 0xa8(%rsp), %rdx
leaq 0x7b0b(%rip), %rsi      # 0xc2c8
movsd 0x784b(%rip), %xmm0     # 0xc010
movq %rax, %rdi
callq 0xa512
movq %r14, 0x1d8(%rsp)
pushq $0x20
popq %rdi
callq 0x4210
movq %rax, %r14
leaq 0xb0(%rsp), %rdx
leaq 0x7ae0(%rip), %rsi      # 0xc2cf
movsd 0x7811(%rip), %xmm0     # 0xc008
movq %rax, %rdi
callq 0xa512
movq %r14, 0x1e0(%rsp)
pushq $0x20
popq %rdi
callq 0x4210
movq %rax, %r14
leaq 0xc8(%rsp), %rdx
leaq 0x7ab6(%rip), %rsi      # 0xc2d7
movsd 0x77e7(%rip), %xmm0     # 0xc010
movq %rax, %rdi
callq 0xa512
movq %r14, 0x1e8(%rsp)
pushq $0x20
popq %rdi
callq 0x4210
movq %rax, %r14
leaq 0xd0(%rsp), %rdx
leaq 0x7a87(%rip), %rsi      # 0xc2da
movsd 0x77b5(%rip), %xmm0     # 0xc010
movq %rax, %rdi
callq 0xa512
movq %r14, 0x1f0(%rsp)
pushq $0x20
popq %rdi
callq 0x4210
movq %rax, %r14
leaq 0xd8(%rsp), %rdx
leaq 0x7a58(%rip), %rsi      # 0xc2dd
movsd 0x7783(%rip), %xmm0     # 0xc010
movq %rax, %rdi
callq 0xa512
movq %r14, 0x1f8(%rsp)
pushq $0x20
popq %rdi
callq 0x4210
movq %rax, %r14
leaq 0xe0(%rsp), %rdx
leaq 0x7a29(%rip), %rsi      # 0xc2e0
movsd 0x7751(%rip), %xmm0     # 0xc010
movq %rax, %rdi
callq 0xa512
movq %r14, 0x200(%rsp)
pushq $0x20
popq %rdi
callq 0x4210
movq %rax, %r14
leaq 0xe8(%rsp), %rdx
leaq 0x79fb(%rip), %rsi      # 0xc2e4
movsd 0x771f(%rip), %xmm0     # 0xc010
movq %rax, %rdi
callq 0xa512
movq %r14, 0x208(%rsp)
pushq $0x20
popq %rdi
callq 0x4210
movq %rax, %r14
leaq 0xf0(%rsp), %rdx
leaq 0x79cd(%rip), %rsi      # 0xc2e8
movsd 0x76ed(%rip), %xmm0     # 0xc010
movq %rax, %rdi
callq 0xa512
movq %r14, 0x210(%rsp)
pushq $0x20
popq %rdi
callq 0x4210
movq %rax, %r14
leaq 0xb8(%rsp), %rdx
leaq 0x799f(%rip), %rsi      # 0xc2ec
movsd 0x76bb(%rip), %xmm0     # 0xc010
movq %rax, %rdi
callq 0xa512
movq %r14, 0x218(%rsp)
pushq $0x20
popq %rdi
callq 0x4210
movq %rax, %r14
leaq 0x110(%rsp), %rdx
leaq 0x7970(%rip), %rsi      # 0xc2ef
movsd 0x7689(%rip), %xmm0     # 0xc010
movq %rax, %rdi
callq 0xa512
movq %r14, 0x220(%rsp)
pushq $0x20
popq %rdi
callq 0x4210
movq %rax, %r14
leaq 0x108(%rsp), %rdx
leaq 0x7944(%rip), %rsi      # 0xc2f5
movsd 0x765f(%rip), %xmm0     # 0xc018
movq %rax, %rdi
callq 0xa512
movq %r14, 0x228(%rsp)
pushq $0x20
popq %rdi
callq 0x4210
movq %rax, %r14
leaq 0x100(%rsp), %rdx
leaq 0x7918(%rip), %rsi      # 0xc2fb
movsd 0x761d(%rip), %xmm0     # 0xc008
movq %rax, %rdi
callq 0xa512
movq %r14, 0x230(%rsp)
pushq $0x20
popq %rdi
callq 0x4210
movq %rax, %r14
leaq 0xc0(%rsp), %rdx
leaq 0x78e9(%rip), %rsi      # 0xc2fe
movsd 0x75eb(%rip), %xmm0     # 0xc008
movq %rax, %rdi
callq 0xa512
movq %r14, 0x238(%rsp)
pushq $0x20
popq %rdi
callq 0x4210
movq %rax, %r14
leaq 0x120(%rsp), %rdx
leaq 0x78bb(%rip), %rsi      # 0xc302
movsd 0x75c1(%rip), %xmm0     # 0xc010
movq %rax, %rdi
callq 0xa512
movq %r14, 0x240(%rsp)
pushq $0x20
popq %rdi
callq 0x4210
movq %rax, %r14
leaq 0x128(%rsp), %rdx
leaq 0x7890(%rip), %rsi      # 0xc309
movsd 0x758f(%rip), %xmm0     # 0xc010
movq %rax, %rdi
callq 0xa512
movq %r14, 0x248(%rsp)
pushq $0x20
popq %rdi
callq 0x4210
movq %rax, %r14
leaq 0x130(%rsp), %rdx
leaq 0x7866(%rip), %rsi      # 0xc311
movsd 0x755d(%rip), %xmm0     # 0xc010
movq %rax, %rdi
callq 0xa512
movq %r14, 0x250(%rsp)
pushq $0x20
popq %rdi
callq 0x4210
movq %rax, %r14
leaq 0x138(%rsp), %rdx
leaq 0x783a(%rip), %rsi      # 0xc317
movsd 0x752b(%rip), %xmm0     # 0xc010
movq %rax, %rdi
callq 0xa512
movq %r14, 0x258(%rsp)
pushq $0x18
popq %rdi
callq 0x4210
movq %rax, %r14
leaq 0xf8(%rsp), %rdx
leaq 0x780e(%rip), %rsi      # 0xc31d
movq %rax, %rdi
callq 0xa3c6
movq %r14, 0x260(%rsp)
pushq $0x18
popq %rdi
callq 0x4210
movq %rax, %r14
leaq 0x77f1(%rip), %rsi      # 0xc322
pushq $0x1
popq %rdx
movq %rax, %rdi
callq 0xa5b0
movq %r14, 0x268(%rsp)
pushq $0x18
popq %rdi
callq 0x4210
movq %rax, %r14
leaq 0x77d3(%rip), %rsi      # 0xc329
pushq $0x1
popq %rdx
movq %rax, %rdi
callq 0xa5b0
movq %r14, 0x270(%rsp)
pushq $0x18
popq %rdi
callq 0x4210
movq %rax, %r14
leaq 0x77b5(%rip), %rsi      # 0xc330
pushq $0x1
popq %rdx
movq %rax, %rdi
callq 0xa5b0
movq %r14, 0x278(%rsp)
pushq $0x18
popq %rdi
callq 0x4210
movq %rax, %r14
leaq 0x7797(%rip), %rsi      # 0xc337
pushq $0x1
popq %rdx
movq %rax, %rdi
callq 0xa5b0
movq %r14, 0x280(%rsp)
pushq $0x18
popq %rdi
callq 0x4210
movq %rax, %r14
leaq 0x777b(%rip), %rsi      # 0xc340
pushq $0x1
popq %rdx
movq %rax, %rdi
callq 0xa5b0
movq %r14, 0x288(%rsp)
pushq $0x18
popq %rdi
callq 0x4210
movq %rax, %r14
leaq 0x775c(%rip), %rsi      # 0xc346
pushq $0x1
popq %rdx
movq %rax, %rdi
callq 0xa5b0
movq %r14, 0x290(%rsp)
pushq $0x18
popq %rdi
callq 0x4210
movq %rax, %r14
leaq 0x773e(%rip), %rsi      # 0xc34d
movq %rax, %rdi
xorl %edx, %edx
callq 0xa5b0
movq %r14, 0x298(%rsp)
pushq $0x18
popq %rdi
callq 0x4210
movq %rax, %r14
leaq 0x7720(%rip), %rsi      # 0xc353
movq %rax, %rdi
xorl %edx, %edx
callq 0xa5b0
movq %r14, 0x2a0(%rsp)
pushq $0x18
popq %rdi
callq 0x4210
movq %rax, %r14
leaq 0x7708(%rip), %rsi      # 0xc35f
movq %rax, %rdi
xorl %edx, %edx
callq 0xa5b0
movq %r14, 0x2a8(%rsp)
pushq $0x18
popq %rdi
callq 0x4210
movq %rax, %r14
leaq 0x76f4(%rip), %rsi      # 0xc36f
movq %rax, %rdi
xorl %edx, %edx
callq 0xa5b0
movq %r14, 0x2b0(%rsp)
pushq $0x18
popq %rdi
callq 0x4210
movq %rax, %r14
leaq 0x76db(%rip), %rsi      # 0xc37a
movq %rax, %rdi
xorl %edx, %edx
callq 0xa5b0
movq %r14, 0x2b8(%rsp)
pushq $0x18
popq %rdi
callq 0x4210
movq %rax, %r14
leaq 0x76c1(%rip), %rsi      # 0xc384
movq %rax, %rdi
xorl %edx, %edx
callq 0xa5b0
movq %r14, 0x2c0(%rsp)
pushq $0x18
popq %rdi
callq 0x4210
movq %rax, %r14
leaq 0x76a6(%rip), %rsi      # 0xc38d
movq %rax, %rdi
xorl %edx, %edx
callq 0xa5b0
movq %r14, 0x2c8(%rsp)
pushq $0x18
popq %rdi
callq 0x4210
movq %rax, %r14
leaq 0x768b(%rip), %rsi      # 0xc396
pushq $0x1
popq %rdx
movq %rax, %rdi
callq 0xa5b0
movq %r14, 0x2d0(%rsp)
pushq $0x18
popq %rdi
callq 0x4210
movq %rax, %r14
leaq 0x7670(%rip), %rsi      # 0xc3a0
pushq $0x1
popq %rdx
movq %rax, %rdi
callq 0xa5b0
movq %r14, 0x2d8(%rsp)
pushq $0x18
popq %rdi
callq 0x4210
movq %rax, %r14
leaq 0x14c(%rsp), %rdx
leaq 0x764d(%rip), %rsi      # 0xc3aa
movq %rax, %rdi
callq 0x540e
movq %r14, 0x2e0(%rsp)
pushq $0x18
popq %rdi
callq 0x4210
movq %rax, %r14
leaq 0x7636(%rip), %rsi      # 0xc3b5
leaq 0x14(%rsp), %rdx
movq %rax, %rdi
callq 0xa486
movq %r14, 0x2e8(%rsp)
pushq $0x20
popq %rdi
callq 0x4210
movq %rax, %r14
leaq 0x7615(%rip), %rsi      # 0xc3bb
leaq 0x28(%rsp), %rdx
movsd 0x7255(%rip), %xmm0     # 0xc008
movq %rax, %rdi
callq 0xa512
movq %r14, 0x2f0(%rsp)
pushq $0x20
popq %rdi
callq 0x4210
movq %rax, %r14
leaq 0x75ef(%rip), %rsi      # 0xc3c4
leaq 0x28(%rsp), %rdx
movsd 0x7226(%rip), %xmm0     # 0xc008
movq %rax, %rdi
callq 0xa512
movq %r14, 0x2f8(%rsp)
pushq $0x20
popq %rdi
callq 0x4210
movq %rax, %r14
leaq 0x75c9(%rip), %rsi      # 0xc3cd
leaq 0x58(%rsp), %rdx
movsd 0x71f7(%rip), %xmm0     # 0xc008
movq %rax, %rdi
callq 0xa512
movq %r14, 0x300(%rsp)
pushq $0x20
popq %rdi
callq 0x4210
movq %rax, %r14
leaq 0x75a2(%rip), %rsi      # 0xc3d5
leaq 0x50(%rsp), %rdx
movsd 0x71c8(%rip), %xmm0     # 0xc008
movq %rax, %rdi
callq 0xa512
movq %r14, 0x308(%rsp)
pushq $0x20
popq %rdi
callq 0x4210
movq %rax, %r14
leaq 0x757c(%rip), %rsi      # 0xc3de
leaq 0x70(%rsp), %rdx
movsd 0x71a1(%rip), %xmm0     # 0xc010
movq %rax, %rdi
callq 0xa512
movq %r14, 0x310(%rsp)
pushq $0x20
popq %rdi
callq 0x4210
movq %rax, %r14
leaq 0x7553(%rip), %rsi      # 0xc3e4
leaq 0x68(%rsp), %rdx
movsd 0x7172(%rip), %xmm0     # 0xc010
movq %rax, %rdi
callq 0xa512
movq %r14, 0x318(%rsp)
pushq $0x20
popq %rdi
callq 0x4210
movq %rax, %r14
leaq 0x752a(%rip), %rsi      # 0xc3ea
leaq 0x60(%rsp), %rdx
movsd 0x7143(%rip), %xmm0     # 0xc010
movq %rax, %rdi
callq 0xa512
movq %r14, 0x320(%rsp)
pushq $0x20
popq %rdi
callq 0x4210
movq %rax, %r14
leaq 0x7501(%rip), %rsi      # 0xc3f0
leaq 0x40(%rsp), %rdx
movsd 0x7124(%rip), %xmm0     # 0xc020
movq %rax, %rdi
callq 0xa512
movq %r14, 0x328(%rsp)
pushq $0x20
popq %rdi
callq 0x4210
movq %rax, %r14
leaq 0x74db(%rip), %rsi      # 0xc3f9
leaq 0x48(%rsp), %rdx
movsd 0x70ed(%rip), %xmm0     # 0xc018
movq %rax, %rdi
callq 0xa512
movq %r14, 0x330(%rsp)
andq $0x0, 0x338(%rsp)
movq 0x20(%rsp), %rax
movq (%rax), %r14
movl 0x10(%rsp), %ecx
decl %ecx
movl %ecx, 0x10(%rsp)
addq $0x8, %rax
movq %rax, 0x20(%rsp)
cmpl $0x1, %ecx
jne 0x4f7c
movq (%rax), %rax
cmpb $0x2d, (%rax)
jne 0x4f7c
cmpb $0x76, 0x1(%rax)
jne 0x4f7c
cmpb $0x0, 0x2(%rax)
je 0x52fd
leaq 0x10(%rsp), %r15
leaq 0x20(%rsp), %r12
leaq 0x170(%rsp), %r13
pushq $0x1
popq %rbp
xorl %ebx, %ebx
testl %ecx, %ecx
jle 0x504a
movq %r15, %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0xa392
cmpl $0x1, %eax
je 0x4fc7
cmpl $-0x1, %eax
jne 0x4fcc
movq 0xd226(%rip), %rdi      # 0x121e0
movq %r14, %rsi
callq 0x5437
movq %rbx, %rax
jmp 0x4fe3
movq %rbx, %rax
jmp 0x4fe3
movq 0x20(%rsp), %rax
movq (%rax), %rdi
callq 0x6ca2
testq %rax, %rax
je 0x4ff8
testq %rbx, %rbx
jne 0x501a
movl 0x10(%rsp), %ecx
decl %ecx
movl %ecx, 0x10(%rsp)
addq $0x8, 0x20(%rsp)
movq %rax, %rbx
jmp 0x4f93
movq 0xcfe1(%rip), %rax      # 0x11fe0
movq (%rax), %rdi
movq 0x20(%rsp), %rax
movq (%rax), %rdx
leaq 0x7415(%rip), %rsi      # 0xc426
xorl %eax, %eax
callq 0x4290
jmp 0x5036
movq 0xcfbf(%rip), %rax      # 0x11fe0
movq (%rax), %rcx
leaq 0x7413(%rip), %rdi      # 0xc43e
pushq $0x25
popq %rsi
movq %rbp, %rdx
callq 0x4380
movq 0xd1a3(%rip), %rdi      # 0x121e0
movq %r14, %rsi
callq 0x5437
movq %rbx, %rax
jmp 0x4fe3
testq %rbx, %rbx
je 0x52cd
movq 0x78(%rsp), %rsi
leaq 0x390(%rsp), %rdi
xorl %edx, %edx
callq 0xafe6
cmpb $0x1, 0xf(%rsp)
jne 0x5089
movq (%rbx), %rax
leaq 0x1c(%rsp), %rsi
leaq 0x18(%rsp), %rdx
leaq 0x80(%rsp), %rcx
movq %rbx, %rdi
callq *0x10(%rax)
movslq 0x1c(%rsp), %rsi
movslq 0x18(%rsp), %rdx
leaq 0x3c0(%rsp), %rdi
callq 0xae62
leaq 0x360(%rsp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0xae62
movq 0x30(%rsp), %rsi
testq %rsi, %rsi
je 0x50ca
leaq 0x360(%rsp), %rdi
xorl %edx, %edx
callq 0xafe6
leaq 0x80(%rsp), %r14
leaq 0x390(%rsp), %r15
leaq 0x3c0(%rsp), %r12
xorl %r13d, %r13d
cmpl 0x14(%rsp), %r13d
jge 0x5284
cmpq $0x0, 0x30(%rsp)
je 0x5110
movq %r12, %rdi
leaq 0x360(%rsp), %rsi
callq 0xaefe
movb $0x1, 0x118(%rsp)
movq (%rbx), %rax
movq %rbx, %rdi
movq %r14, %rsi
callq *0x8(%rax)
cmpb $0x1, 0xe(%rsp)
jne 0x5136
movq %rbx, %rdi
movq %r15, %rsi
movq %r12, %rdx
movq %r14, %rcx
callq 0x6782
jmp 0x517c
movq %rbx, %rdi
movq %r15, %rsi
movq %r12, %rdx
movq %r14, %rcx
callq 0x6476
leaq 0x348(%rsp), %rdi
leaq 0xd0aa(%rip), %rsi      # 0x12200
callq 0x5468
movq %rbx, %rdi
movq %r12, %rsi
movq %r14, %rdx
leaq 0x348(%rsp), %rbp
movq %rbp, %rcx
callq 0x8da8
movq %rbp, %rdi
callq 0x54c2
cmpl $0x2, 0x14(%rsp)
jge 0x5232
movq 0x38(%rsp), %rsi
movq %r12, %rdi
callq 0xb1ee
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 0x48(%rsp), %xmm1
movhpd 0x40(%rsp), %xmm1       # xmm1 = xmm1[0],mem[0]
movsd %xmm0, 0xd8(%rsp)
addpd %xmm2, %xmm1
movupd %xmm1, 0x108(%rsp)
incl %r13d
jmp 0x50e5
movq %r15, %rbp
movq 0x38(%rsp), %rdx
leaq 0x3f0(%rsp), %r15
movq %r15, %rdi
leaq 0x723b(%rip), %rsi      # 0xc487
movl %r13d, %ecx
xorl %eax, %eax
callq 0x4060
movq %r12, %rdi
movq %r15, %rsi
callq 0xb1ee
movq 0xcd78(%rip), %rax      # 0x11fe0
movq (%rax), %rdi
leaq 0x7220(%rip), %rsi      # 0xc492
movq %r15, %rdx
xorl %eax, %eax
callq 0x4290
movq %rbp, %r15
jmp 0x5194
testq %rbx, %rbx
je 0x5292
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x40(%rax)
leaq 0x360(%rsp), %rdi
callq 0xae9a
leaq 0x3c0(%rsp), %rdi
callq 0xae9a
leaq 0x390(%rsp), %rdi
callq 0xae9a
xorl %eax, %eax
addq $0x4f8, %rsp            # imm = 0x4F8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0xcd0c(%rip), %rax      # 0x11fe0
movq (%rax), %rcx
leaq 0x7186(%rip), %rdi      # 0xc464
pushq $0x22
popq %rsi
pushq $0x1
popq %rdx
callq 0x4380
movq 0xcef0(%rip), %rdi      # 0x121e0
movq %r14, %rsi
callq 0x5437
jmp 0x5053
movq 0xccdc(%rip), %rax      # 0x11fe0
movq (%rax), %rdi
leaq 0x70f4(%rip), %rsi      # 0xc402
leaq 0x710a(%rip), %rdx      # 0xc41f
xorl %eax, %eax
callq 0x4290
xorl %edi, %edi
callq 0x4230
jmp 0x53db
movq %rax, %rbx
jmp 0x53eb
jmp 0x53d6
jmp 0x5395
jmp 0x5395
jmp 0x5395
jmp 0x5395
jmp 0x5395
jmp 0x5395
jmp 0x5395
jmp 0x5395
jmp 0x5395
jmp 0x53aa
jmp 0x53aa
jmp 0x53aa
jmp 0x53aa
jmp 0x53aa
jmp 0x53aa
jmp 0x53aa
jmp 0x53aa
jmp 0x53aa
jmp 0x53aa
jmp 0x53aa
jmp 0x53aa
jmp 0x53aa
jmp 0x53aa
jmp 0x53aa
jmp 0x53aa
jmp 0x53aa
jmp 0x53aa
jmp 0x5395
jmp 0x5395
jmp 0x5395
jmp 0x5395
jmp 0x5395
jmp 0x5395
jmp 0x5395
jmp 0x5395
jmp 0x5395
jmp 0x5395
jmp 0x5395
jmp 0x5395
jmp 0x5395
jmp 0x5395
jmp 0x5395
jmp 0x5395
jmp 0x5395
jmp 0x5395
jmp 0x5395
jmp 0x5395
jmp 0x5395
movq %rax, %rbx
pushq $0x20
jmp 0x53af
jmp 0x53aa
jmp 0x53aa
jmp 0x53aa
jmp 0x53aa
jmp 0x53aa
jmp 0x53aa
jmp 0x53aa
movq %rax, %rbx
pushq $0x18
popq %rsi
movq %r14, %rdi
callq 0x4220
jmp 0x53f8
jmp 0x53d6
jmp 0x53d6
jmp 0x53d6
movq %rax, %rbx
leaq 0x348(%rsp), %rdi
callq 0x54c2
jmp 0x53de
jmp 0x53db
jmp 0x53d6
movq %rax, %rbx
jmp 0x53f8
movq %rax, %rbx
leaq 0x360(%rsp), %rdi
callq 0xae9a
leaq 0x3c0(%rsp), %rdi
callq 0xae9a
leaq 0x390(%rsp), %rdi
callq 0xae9a
movq %rbx, %rdi
callq 0x4330
nop