// File: Altius[P]hotspot2/src/findVarWidthPeaks.cpp
// Function: parseInputFindPeaksWriteOutput(char const*, long const&)
bool parseInputFindPeaksWriteOutput(const char* pExeName, const long& minWidth)
{
  const int BUFSIZE(1000);
  char buf[BUFSIZE], *p;
  Region region;
  string curChrom;
  vector<Range> peaksPossiblyWithOverlaps;
  Position curPosn, prevPosn;
  Range curRange;
  short fieldnum;
  long begCoord, curPosSummit, prevPosSummit(0);
  bool ascending(true);
  long linenum(0);

  prevPosn.x = 0;
  region.chrom = string("xxxNONExxx");
  
  while (cin.getline(buf, BUFSIZE))
    {
      linenum++;
      fieldnum = 1;
      bool newChrom(false);
      if (!(p = strtok(buf,"\t")) || !*p)
	{
	MissingField:
	  cerr << "Error:  Failed to find required field "
	       << fieldnum << " on line " << linenum
	       << " of the input to program " << pExeName
	       << '.' << endl << endl;
	  return false;
	}
      if (0 != strcmp(p, region.chrom.c_str()))
	{
	  curChrom = string(p);
	  newChrom = true;
	}
      fieldnum++;
      if (!(p = strtok(NULL,"\t")))
	goto MissingField;
      begCoord = atol(p); // used only for sanity check below
      fieldnum++;
      if (!(p = strtok(NULL,"\t")))
	goto MissingField;
      curPosn.x = atol(p);
      if (curPosn.x != begCoord + 1)
	{
	  cerr << "Error:  Interval on line " << linenum
	       << " of the input to program " << pExeName << " is not 1bp wide as expected; "
	       << "interval is " << curChrom << ':' << begCoord
	       << '-' << curPosn.x << '.' << endl << endl;
	  return false;
	}
      fieldnum++;
      if (!(p = strtok(NULL,"\t")))
	goto MissingField;
      if (1 == linenum) // we currently assume/require the same id in all lines of input
	region.id = string(p);
      fieldnum++;
      if (!(p = strtok(NULL,"\t")))
	goto MissingField;
      curPosn.y = atof(p);
      fieldnum++;
      if (!(p = strtok(NULL,"\t")))
	goto MissingField;
      curPosSummit = atol(p);
      fieldnum++;
      if ((p = strtok(NULL,"\t")))
	{
	  cerr << "Error:  Expected exactly " << fieldnum - 1 << " columns of input for program "
	       << pExeName << ", but encountered at least " << fieldnum
	       << " on line " << linenum << '.' << endl << endl;
	  return false;
	}
      
      if (curPosSummit != prevPosSummit || (!newChrom && curPosn.x != prevPosn.x + 1))
	{
	  if (linenum > 1)
	    {
	      if (curPosSummit == prevPosSummit && curPosn.x != prevPosn.x + 1)
		{
		  cerr << "Error:  In the input to program " << pExeName << ", line " << linenum-1
		       << " contains " << region.chrom << ':'
		       << prevPosn.x-1 << '-' << prevPosn.x
		       << " for summit " << prevPosSummit
		       << ", but line " << linenum << " contains "
		       << curChrom << ':' << curPosn.x-1
		       << '-' << curPosn.x << " for the same summit.\n"
		       << "All entries for a given summit must be in ascending order by column 3."
		       << endl << endl;
		  return false;
		}
	      // Check whether curRange, at the right boundary of region,
	      // is a local maximum.
	      if (region.localMaxima.empty() || ascending)
		region.localMaxima.push_back(curRange);
	    }
	  processRegionAndFlushIt(region, minWidth, peaksPossiblyWithOverlaps); // this will simply return if region.localMaxima is empty
	  region.posSummit = curPosSummit;
	  if (newChrom)
	    region.chrom = curChrom;
	  curPosn.idx = 0;
	  curRange.beg = curPosn;
	  curRange.maxY = curPosn.y;
	  ascending = true; // if the next y value is lower, we want this one stored as a local maximum
	}
      else
	curPosn.idx++;
      region.posns.push_back(curPosn);
      if (fabs(curPosn.y - curRange.beg.y) < 0.0001)
	curRange.end = curPosn;
      else
	{
	  if (curRange.beg.y - curPosn.y > 0.0001)
	    {
	      if (ascending)
		region.localMaxima.push_back(curRange);
	      ascending = false;
	    }
	  else
	    ascending = true;
	  curRange.beg = curRange.end = curPosn;
	  curRange.maxY = curPosn.y;
	}
      prevPosn = curPosn;
      prevPosSummit = curPosSummit;
    }

  // Process the final region.
  // Check whether curRange, at the right boundary of region,
  // is a local maximum.
  if (region.localMaxima.empty() || curRange.beg.y - region.posns[curRange.beg.idx - 1].y > 0.0001)
    region.localMaxima.push_back(curRange);
  processRegionAndFlushIt(region, minWidth, peaksPossiblyWithOverlaps);

  cleanUpAnyOverlapsAndWriteOutput(peaksPossiblyWithOverlaps, minWidth);
  
  return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x820, %rsp            # imm = 0x820
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl $0x3e8, -0x1c(%rbp)     # imm = 0x3E8
leaq -0x490(%rbp), %rdi
callq 0x5520
leaq -0x4b0(%rbp), %rdi
callq 0x2300
leaq -0x4c8(%rbp), %rdi
callq 0x5570
leaq -0x568(%rbp), %rdi
callq 0x5590
movq $0x0, -0x588(%rbp)
movb $0x1, -0x589(%rbp)
movq $0x0, -0x598(%rbp)
movq $0x0, -0x4e8(%rbp)
leaq -0x5b9(%rbp), %rdi
movq %rdi, -0x630(%rbp)
callq 0x23b0
movq -0x630(%rbp), %rdx
leaq 0x6687(%rip), %rsi      # 0xa08a
leaq -0x5b8(%rbp), %rdi
callq 0x55c0
jmp 0x3a11
leaq -0x490(%rbp), %rdi
leaq -0x5b8(%rbp), %rsi
callq 0x22b0
leaq -0x5b8(%rbp), %rdi
callq 0x2140
leaq -0x5b9(%rbp), %rdi
callq 0x2250
movq 0xb595(%rip), %rdi      # 0xefd8
leaq -0x410(%rbp), %rsi
movl $0x3e8, %edx            # imm = 0x3E8
callq 0x2080
movq %rax, -0x638(%rbp)
jmp 0x3a5d
movq -0x638(%rbp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
addq %rax, %rdi
callq 0x22e0
movb %al, -0x639(%rbp)
jmp 0x3a7b
movb -0x639(%rbp), %al
testb $0x1, %al
jne 0x3a8a
jmp 0x4718
movq -0x598(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x598(%rbp)
movw $0x1, -0x56a(%rbp)
movb $0x0, -0x5cd(%rbp)
leaq -0x410(%rbp), %rdi
leaq 0x65db(%rip), %rsi      # 0xa095
callq 0x2340
movq %rax, -0x418(%rbp)
cmpq $0x0, %rax
je 0x3adc
movq -0x418(%rbp), %rax
cmpb $0x0, (%rax)
jne 0x3c1b
jmp 0x3ade
movq 0xb50b(%rip), %rdi      # 0xeff0
leaq 0x65ab(%rip), %rsi      # 0xa097
callq 0x2200
movq %rax, -0x648(%rbp)
jmp 0x3afa
movq -0x648(%rbp), %rdi
movswl -0x56a(%rbp), %esi
callq 0x21f0
movq %rax, -0x650(%rbp)
jmp 0x3b16
movq -0x650(%rbp), %rdi
leaq 0x65c4(%rip), %rsi      # 0xa0e8
callq 0x2200
movq %rax, -0x658(%rbp)
jmp 0x3b32
movq -0x658(%rbp), %rdi
movq -0x598(%rbp), %rsi
callq 0x23e0
movq %rax, -0x660(%rbp)
jmp 0x3b4e
movq -0x660(%rbp), %rdi
leaq 0x6562(%rip), %rsi      # 0xa0be
callq 0x2200
movq %rax, -0x668(%rbp)
jmp 0x3b6a
movq -0x668(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x2200
movq %rax, -0x670(%rbp)
jmp 0x3b83
movq -0x670(%rbp), %rdi
movl $0x2e, %esi
callq 0x2280
movq %rax, -0x678(%rbp)
jmp 0x3b9d
movq -0x678(%rbp), %rdi
movq 0xb40d(%rip), %rsi      # 0xefb8
callq 0x2230
movq %rax, -0x680(%rbp)
jmp 0x3bb9
movq -0x680(%rbp), %rdi
movq 0xb3f1(%rip), %rsi      # 0xefb8
callq 0x2230
jmp 0x3bce
movb $0x0, -0x1(%rbp)
movl $0x1, -0x5d4(%rbp)
jmp 0x47c7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x5c8(%rbp)
movl %eax, -0x5cc(%rbp)
leaq -0x5b9(%rbp), %rdi
callq 0x2250
jmp 0x4805
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x5c8(%rbp)
movl %eax, -0x5cc(%rbp)
jmp 0x4805
movq -0x418(%rbp), %rax
movq %rax, -0x688(%rbp)
leaq -0x490(%rbp), %rdi
callq 0x20b0
movq -0x688(%rbp), %rdi
movq %rax, %rsi
callq 0x2310
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
je 0x3ce4
movq -0x418(%rbp), %rax
movq %rax, -0x698(%rbp)
leaq -0x5f9(%rbp), %rdi
movq %rdi, -0x690(%rbp)
callq 0x23b0
movq -0x698(%rbp), %rsi
movq -0x690(%rbp), %rdx
leaq -0x5f8(%rbp), %rdi
callq 0x55c0
jmp 0x3c8d
leaq -0x4b0(%rbp), %rdi
leaq -0x5f8(%rbp), %rsi
callq 0x22b0
leaq -0x5f8(%rbp), %rdi
callq 0x2140
leaq -0x5f9(%rbp), %rdi
callq 0x2250
movb $0x1, -0x5cd(%rbp)
jmp 0x3ce4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x5c8(%rbp)
movl %eax, -0x5cc(%rbp)
leaq -0x5f9(%rbp), %rdi
callq 0x2250
jmp 0x4805
movw -0x56a(%rbp), %ax
addw $0x1, %ax
movw %ax, -0x56a(%rbp)
xorl %eax, %eax
movl %eax, %edi
leaq 0x6394(%rip), %rsi      # 0xa095
callq 0x2340
movq %rax, -0x418(%rbp)
cmpq $0x0, %rax
jne 0x3d18
jmp 0x3ade
movq -0x418(%rbp), %rdi
callq 0x2290
movq %rax, -0x578(%rbp)
movw -0x56a(%rbp), %ax
addw $0x1, %ax
movw %ax, -0x56a(%rbp)
xorl %eax, %eax
movl %eax, %edi
leaq 0x634d(%rip), %rsi      # 0xa095
callq 0x2340
movq %rax, -0x418(%rbp)
cmpq $0x0, %rax
jne 0x3d5f
jmp 0x3ade
movq -0x418(%rbp), %rdi
callq 0x2290
movq %rax, -0x4d8(%rbp)
movq -0x4d8(%rbp), %rax
movq -0x578(%rbp), %rcx
addq $0x1, %rcx
cmpq %rcx, %rax
je 0x3f18
movq 0xb25c(%rip), %rdi      # 0xeff0
leaq 0x633d(%rip), %rsi      # 0xa0d8
callq 0x2200
movq %rax, -0x6a0(%rbp)
jmp 0x3da9
movq -0x6a0(%rbp), %rdi
movq -0x598(%rbp), %rsi
callq 0x23e0
movq %rax, -0x6a8(%rbp)
jmp 0x3dc5
movq -0x6a8(%rbp), %rdi
leaq 0x62eb(%rip), %rsi      # 0xa0be
callq 0x2200
movq %rax, -0x6b0(%rbp)
jmp 0x3de1
movq -0x6b0(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x2200
movq %rax, -0x6b8(%rbp)
jmp 0x3dfa
movq -0x6b8(%rbp), %rdi
leaq 0x62ea(%rip), %rsi      # 0xa0f2
callq 0x2200
movq %rax, -0x6c0(%rbp)
jmp 0x3e16
movq -0x6c0(%rbp), %rdi
leaq 0x62ed(%rip), %rsi      # 0xa111
callq 0x2200
movq %rax, -0x6c8(%rbp)
jmp 0x3e32
movq -0x6c8(%rbp), %rdi
leaq -0x4b0(%rbp), %rsi
callq 0x21e0
movq %rax, -0x6d0(%rbp)
jmp 0x3e4e
movq -0x6d0(%rbp), %rdi
movl $0x3a, %esi
callq 0x2280
movq %rax, -0x6d8(%rbp)
jmp 0x3e68
movq -0x6d8(%rbp), %rdi
movq -0x578(%rbp), %rsi
callq 0x23e0
movq %rax, -0x6e0(%rbp)
jmp 0x3e84
movq -0x6e0(%rbp), %rdi
movl $0x2d, %esi
callq 0x2280
movq %rax, -0x6e8(%rbp)
jmp 0x3e9e
movq -0x6e8(%rbp), %rdi
movq -0x4d8(%rbp), %rsi
callq 0x23e0
movq %rax, -0x6f0(%rbp)
jmp 0x3eba
movq -0x6f0(%rbp), %rdi
movl $0x2e, %esi
callq 0x2280
movq %rax, -0x6f8(%rbp)
jmp 0x3ed4
movq -0x6f8(%rbp), %rdi
movq 0xb0d6(%rip), %rsi      # 0xefb8
callq 0x2230
movq %rax, -0x700(%rbp)
jmp 0x3ef0
movq -0x700(%rbp), %rdi
movq 0xb0ba(%rip), %rsi      # 0xefb8
callq 0x2230
jmp 0x3f05
movb $0x0, -0x1(%rbp)
movl $0x1, -0x5d4(%rbp)
jmp 0x47c7
movw -0x56a(%rbp), %ax
addw $0x1, %ax
movw %ax, -0x56a(%rbp)
xorl %eax, %eax
movl %eax, %edi
leaq 0x6160(%rip), %rsi      # 0xa095
callq 0x2340
movq %rax, -0x418(%rbp)
cmpq $0x0, %rax
jne 0x3f4c
jmp 0x3ade
movl $0x1, %eax
cmpq -0x598(%rbp), %rax
jne 0x3fef
movq -0x418(%rbp), %rax
movq %rax, -0x710(%rbp)
leaq -0x621(%rbp), %rdi
movq %rdi, -0x708(%rbp)
callq 0x23b0
movq -0x710(%rbp), %rsi
movq -0x708(%rbp), %rdx
leaq -0x620(%rbp), %rdi
callq 0x55c0
jmp 0x3f9b
leaq -0x490(%rbp), %rdi
addq $0x20, %rdi
leaq -0x620(%rbp), %rsi
callq 0x22b0
leaq -0x620(%rbp), %rdi
callq 0x2140
leaq -0x621(%rbp), %rdi
callq 0x2250
jmp 0x3fef
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x5c8(%rbp)
movl %eax, -0x5cc(%rbp)
leaq -0x621(%rbp), %rdi
callq 0x2250
jmp 0x4805
movw -0x56a(%rbp), %ax
addw $0x1, %ax
movw %ax, -0x56a(%rbp)
xorl %eax, %eax
movl %eax, %edi
leaq 0x6089(%rip), %rsi      # 0xa095
callq 0x2340
movq %rax, -0x418(%rbp)
cmpq $0x0, %rax
jne 0x4023
jmp 0x3ade
movq -0x418(%rbp), %rdi
callq 0x22d0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x4d0(%rbp)
movw -0x56a(%rbp), %ax
addw $0x1, %ax
movw %ax, -0x56a(%rbp)
xorl %eax, %eax
movl %eax, %edi
leaq 0x603d(%rip), %rsi      # 0xa095
callq 0x2340
movq %rax, -0x418(%rbp)
cmpq $0x0, %rax
jne 0x406f
jmp 0x3ade
movq -0x418(%rbp), %rdi
callq 0x2290
movq %rax, -0x580(%rbp)
movw -0x56a(%rbp), %ax
addw $0x1, %ax
movw %ax, -0x56a(%rbp)
xorl %eax, %eax
movl %eax, %edi
leaq 0x5ff6(%rip), %rsi      # 0xa095
callq 0x2340
movq %rax, -0x418(%rbp)
cmpq $0x0, %rax
je 0x41f2
movq 0xaf34(%rip), %rdi      # 0xeff0
leaq 0x605b(%rip), %rsi      # 0xa11e
callq 0x2200
movq %rax, -0x718(%rbp)
jmp 0x40d1
movq -0x718(%rbp), %rdi
movswl -0x56a(%rbp), %esi
decl %esi
callq 0x2390
movq %rax, -0x720(%rbp)
jmp 0x40ef
movq -0x720(%rbp), %rdi
leaq 0x603b(%rip), %rsi      # 0xa138
callq 0x2200
movq %rax, -0x728(%rbp)
jmp 0x410b
movq -0x728(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x2200
movq %rax, -0x730(%rbp)
jmp 0x4124
movq -0x730(%rbp), %rdi
leaq 0x6025(%rip), %rsi      # 0xa157
callq 0x2200
movq %rax, -0x738(%rbp)
jmp 0x4140
movq -0x738(%rbp), %rdi
movswl -0x56a(%rbp), %esi
callq 0x21f0
movq %rax, -0x740(%rbp)
jmp 0x415c
movq -0x740(%rbp), %rdi
leaq 0x5f7e(%rip), %rsi      # 0xa0e8
callq 0x2200
movq %rax, -0x748(%rbp)
jmp 0x4178
movq -0x748(%rbp), %rdi
movq -0x598(%rbp), %rsi
callq 0x23e0
movq %rax, -0x750(%rbp)
jmp 0x4194
movq -0x750(%rbp), %rdi
movl $0x2e, %esi
callq 0x2280
movq %rax, -0x758(%rbp)
jmp 0x41ae
movq -0x758(%rbp), %rdi
movq 0xadfc(%rip), %rsi      # 0xefb8
callq 0x2230
movq %rax, -0x760(%rbp)
jmp 0x41ca
movq -0x760(%rbp), %rdi
movq 0xade0(%rip), %rsi      # 0xefb8
callq 0x2230
jmp 0x41df
movb $0x0, -0x1(%rbp)
movl $0x1, -0x5d4(%rbp)
jmp 0x47c7
movq -0x580(%rbp), %rax
cmpq -0x588(%rbp), %rax
jne 0x422a
testb $0x1, -0x5cd(%rbp)
jne 0x45cd
movq -0x4d8(%rbp), %rax
movq -0x4e8(%rbp), %rcx
addq $0x1, %rcx
cmpq %rcx, %rax
je 0x45cd
cmpq $0x1, -0x598(%rbp)
jle 0x4547
movq -0x580(%rbp), %rax
cmpq -0x588(%rbp), %rax
jne 0x4511
movq -0x4d8(%rbp), %rax
movq -0x4e8(%rbp), %rcx
addq $0x1, %rcx
cmpq %rcx, %rax
je 0x4511
movq 0xad82(%rip), %rdi      # 0xeff0
leaq 0x5efe(%rip), %rsi      # 0xa173
callq 0x2200
movq %rax, -0x768(%rbp)
jmp 0x4283
movq -0x768(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x2200
movq %rax, -0x770(%rbp)
jmp 0x429c
movq -0x770(%rbp), %rdi
leaq 0x5eea(%rip), %rsi      # 0xa194
callq 0x2200
movq %rax, -0x778(%rbp)
jmp 0x42b8
movq -0x778(%rbp), %rdi
movq -0x598(%rbp), %rsi
decq %rsi
callq 0x23e0
movq %rax, -0x780(%rbp)
jmp 0x42d7
movq -0x780(%rbp), %rdi
leaq 0x5eb7(%rip), %rsi      # 0xa19c
callq 0x2200
movq %rax, -0x788(%rbp)
jmp 0x42f3
movq -0x788(%rbp), %rdi
leaq -0x490(%rbp), %rsi
callq 0x21e0
movq %rax, -0x790(%rbp)
jmp 0x430f
movq -0x790(%rbp), %rdi
movl $0x3a, %esi
callq 0x2280
movq %rax, -0x798(%rbp)
jmp 0x4329
movq -0x798(%rbp), %rdi
movq -0x4e8(%rbp), %rsi
decq %rsi
callq 0x23e0
movq %rax, -0x7a0(%rbp)
jmp 0x4348
movq -0x7a0(%rbp), %rdi
movl $0x2d, %esi
callq 0x2280
movq %rax, -0x7a8(%rbp)
jmp 0x4362
movq -0x7a8(%rbp), %rdi
movq -0x4e8(%rbp), %rsi
callq 0x23e0
movq %rax, -0x7b0(%rbp)
jmp 0x437e
movq -0x7b0(%rbp), %rdi
leaq 0x5e1b(%rip), %rsi      # 0xa1a7
callq 0x2200
movq %rax, -0x7b8(%rbp)
jmp 0x439a
movq -0x7b8(%rbp), %rdi
movq -0x588(%rbp), %rsi
callq 0x23e0
movq %rax, -0x7c0(%rbp)
jmp 0x43b6
movq -0x7c0(%rbp), %rdi
leaq 0x5df0(%rip), %rsi      # 0xa1b4
callq 0x2200
movq %rax, -0x7c8(%rbp)
jmp 0x43d2
movq -0x7c8(%rbp), %rdi
movq -0x598(%rbp), %rsi
callq 0x23e0
movq %rax, -0x7d0(%rbp)
jmp 0x43ee
movq -0x7d0(%rbp), %rdi
leaq 0x5da0(%rip), %rsi      # 0xa19c
callq 0x2200
movq %rax, -0x7d8(%rbp)
jmp 0x440a
movq -0x7d8(%rbp), %rdi
leaq -0x4b0(%rbp), %rsi
callq 0x21e0
movq %rax, -0x7e0(%rbp)
jmp 0x4426
movq -0x7e0(%rbp), %rdi
movl $0x3a, %esi
callq 0x2280
movq %rax, -0x7e8(%rbp)
jmp 0x4440
movq -0x7e8(%rbp), %rdi
movq -0x4d8(%rbp), %rsi
decq %rsi
callq 0x23e0
movq %rax, -0x7f0(%rbp)
jmp 0x445f
movq -0x7f0(%rbp), %rdi
movl $0x2d, %esi
callq 0x2280
movq %rax, -0x7f8(%rbp)
jmp 0x4479
movq -0x7f8(%rbp), %rdi
movq -0x4d8(%rbp), %rsi
callq 0x23e0
movq %rax, -0x800(%rbp)
jmp 0x4495
movq -0x800(%rbp), %rdi
leaq 0x5d1d(%rip), %rsi      # 0xa1c0
callq 0x2200
movq %rax, -0x808(%rbp)
jmp 0x44b1
movq -0x808(%rbp), %rdi
leaq 0x5d18(%rip), %rsi      # 0xa1d7
callq 0x2200
movq %rax, -0x810(%rbp)
jmp 0x44cd
movq -0x810(%rbp), %rdi
movq 0xaadd(%rip), %rsi      # 0xefb8
callq 0x2230
movq %rax, -0x818(%rbp)
jmp 0x44e9
movq -0x818(%rbp), %rdi
movq 0xaac1(%rip), %rsi      # 0xefb8
callq 0x2230
jmp 0x44fe
movb $0x0, -0x1(%rbp)
movl $0x1, -0x5d4(%rbp)
jmp 0x47c7
leaq -0x490(%rbp), %rdi
addq $0x60, %rdi
callq 0x4b10
testb $0x1, %al
jne 0x452e
testb $0x1, -0x589(%rbp)
je 0x4545
leaq -0x430(%rbp), %rdi
leaq -0x568(%rbp), %rsi
callq 0x5670
jmp 0x4543
jmp 0x4545
jmp 0x4547
movq -0x18(%rbp), %rsi
leaq -0x490(%rbp), %rdi
leaq -0x4c8(%rbp), %rdx
callq 0x2bd0
jmp 0x4560
movq -0x580(%rbp), %rax
movq %rax, -0x450(%rbp)
testb $0x1, -0x5cd(%rbp)
je 0x458e
leaq -0x490(%rbp), %rdi
leaq -0x4b0(%rbp), %rsi
callq 0x2040
jmp 0x458c
jmp 0x458e
movl $0x0, -0x4cc(%rbp)
movq -0x4d8(%rbp), %rax
movq %rax, -0x528(%rbp)
movq -0x4d0(%rbp), %rax
movq %rax, -0x520(%rbp)
movss -0x4d0(%rbp), %xmm0
movss %xmm0, -0x508(%rbp)
movb $0x1, -0x589(%rbp)
jmp 0x45dc
movl -0x4cc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4cc(%rbp)
leaq -0x448(%rbp), %rdi
leaq -0x4d8(%rbp), %rsi
callq 0x56b0
jmp 0x45f1
movss -0x4d0(%rbp), %xmm0
movss -0x520(%rbp), %xmm1
subss %xmm1, %xmm0
callq 0x49e0
movss %xmm0, -0x81c(%rbp)
jmp 0x4614
movss -0x81c(%rbp), %xmm0
cvtss2sd %xmm0, %xmm1
movsd 0x59e0(%rip), %xmm0     # 0xa008
ucomisd %xmm1, %xmm0
jbe 0x464f
movq -0x4d8(%rbp), %rax
movq %rax, -0x518(%rbp)
movq -0x4d0(%rbp), %rax
movq %rax, -0x510(%rbp)
jmp 0x46e9
movss -0x520(%rbp), %xmm0
subss -0x4d0(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
movsd 0x599d(%rip), %xmm1     # 0xa008
ucomisd %xmm1, %xmm0
jbe 0x469a
testb $0x1, -0x589(%rbp)
je 0x4691
leaq -0x430(%rbp), %rdi
leaq -0x568(%rbp), %rsi
callq 0x5670
jmp 0x468f
jmp 0x4691
movb $0x0, -0x589(%rbp)
jmp 0x46a1
movb $0x1, -0x589(%rbp)
movq -0x4d8(%rbp), %rax
movq %rax, -0x518(%rbp)
movq -0x4d0(%rbp), %rax
movq %rax, -0x510(%rbp)
movq -0x518(%rbp), %rax
movq %rax, -0x528(%rbp)
movq -0x510(%rbp), %rax
movq %rax, -0x520(%rbp)
movss -0x4d0(%rbp), %xmm0
movss %xmm0, -0x508(%rbp)
movq -0x4d8(%rbp), %rax
movq %rax, -0x4e8(%rbp)
movq -0x4d0(%rbp), %rax
movq %rax, -0x4e0(%rbp)
movq -0x580(%rbp), %rax
movq %rax, -0x588(%rbp)
jmp 0x3a3c
leaq -0x490(%rbp), %rdi
addq $0x60, %rdi
callq 0x4b10
testb $0x1, %al
jne 0x4777
movss -0x520(%rbp), %xmm0
movss %xmm0, -0x820(%rbp)
leaq -0x490(%rbp), %rdi
addq $0x48, %rdi
movl -0x51c(%rbp), %eax
subl $0x1, %eax
movslq %eax, %rsi
callq 0x5110
movss -0x820(%rbp), %xmm0
subss 0x8(%rax), %xmm0
cvtss2sd %xmm0, %xmm0
movsd 0x5897(%rip), %xmm1     # 0xa008
ucomisd %xmm1, %xmm0
jbe 0x478e
leaq -0x430(%rbp), %rdi
leaq -0x568(%rbp), %rsi
callq 0x5670
jmp 0x478c
jmp 0x478e
movq -0x18(%rbp), %rsi
leaq -0x490(%rbp), %rdi
leaq -0x4c8(%rbp), %rdx
callq 0x2bd0
jmp 0x47a7
movq -0x18(%rbp), %rsi
leaq -0x4c8(%rbp), %rdi
callq 0x2ff0
jmp 0x47b9
movb $0x1, -0x1(%rbp)
movl $0x1, -0x5d4(%rbp)
leaq -0x568(%rbp), %rdi
callq 0x5400
leaq -0x4c8(%rbp), %rdi
callq 0x5720
leaq -0x4b0(%rbp), %rdi
callq 0x2140
leaq -0x490(%rbp), %rdi
callq 0x5780
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x820, %rsp            # imm = 0x820
popq %rbp
retq
leaq -0x568(%rbp), %rdi
callq 0x5400
leaq -0x4c8(%rbp), %rdi
callq 0x5720
leaq -0x4b0(%rbp), %rdi
callq 0x2140
leaq -0x490(%rbp), %rdi
callq 0x5780
movq -0x5c8(%rbp), %rdi
callq 0x23a0
nopw %cs:(%rax,%rax)