// File: Altius[P]hotspot2/src/resolveOverlapsInSummit-CenteredPeaks.cpp
// Function: parseInputWriteOutput()
bool parseInputWriteOutput(void)
{
  const int BUFSIZE(500000);
  char buf[BUFSIZE], *p;
  long linenum(0);

  while (cin.getline(buf, BUFSIZE))
    {
      list<Peak> Peaks;
      vector<string> vec; // this vector is used for parsing/extracting Peak data
      linenum++;
      if (!(p = strtok(buf, "|")))
	{
	  cerr << "Error:  Failed to find |-delimited input on line " << linenum
	       << " of the input file." << endl << endl;
	  return false;
	}
      while ((p = strtok(NULL, ";")))
	vec.push_back(string(p));
      for (int i = 0; i < static_cast<int>(vec.size()); i++)
	{
	  Peak d;
	  char s[1000];
	  strcpy(s,vec[i].c_str());
	  if (!PeakfromString(s, d))
	    return false;
	  Peaks.push_back(d);
	}
      resolveOverlaps(Peaks);
      for (list<Peak>::const_iterator it = Peaks.begin();
	   it != Peaks.end(); it++)
	cout << it->chrom << '\t'
	     << it->beg << '\t'
	     << it->end << '\t'
	     << it->id << '\t'
	     << it->score_string << endl; // write the score exactly as we received it (same # of digits, etc.)
    }
  
  return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x7a6d0, %rsp          # imm = 0x7A6D0
movl $0x7a120, -0x8(%rbp)    # imm = 0x7A120
movq $0x0, -0x7a140(%rbp)
leaq -0x7a130(%rbp), %rsi
movq 0x656d(%rip), %rdi      # 0x8fd8
movl $0x7a120, %edx          # imm = 0x7A120
callq 0x2070
movq %rax, %rdi
movq (%rdi), %rax
addq -0x18(%rax), %rdi
callq 0x22a0
testb $0x1, %al
jne 0x2a8d
jmp 0x2f9d
leaq -0x7a158(%rbp), %rdi
callq 0x36e0
leaq -0x7a170(%rbp), %rdi
callq 0x3700
movq -0x7a140(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x7a140(%rbp)
leaq -0x7a130(%rbp), %rdi
leaq 0x3566(%rip), %rsi      # 0x602b
callq 0x22f0
movq %rax, -0x7a138(%rbp)
cmpq $0x0, %rax
jne 0x2b8a
movq 0x650e(%rip), %rdi      # 0x8ff0
leaq 0x3544(%rip), %rsi      # 0x602d
callq 0x21d0
movq %rax, -0x7a640(%rbp)
jmp 0x2af7
movq -0x7a640(%rbp), %rdi
movq -0x7a140(%rbp), %rsi
callq 0x2370
movq %rax, -0x7a648(%rbp)
jmp 0x2b13
movq -0x7a648(%rbp), %rdi
leaq 0x353e(%rip), %rsi      # 0x605f
callq 0x21d0
movq %rax, -0x7a650(%rbp)
jmp 0x2b2f
movq -0x7a650(%rbp), %rdi
movq 0x647b(%rip), %rsi      # 0x8fb8
callq 0x2200
movq %rax, -0x7a658(%rbp)
jmp 0x2b4b
movq -0x7a658(%rbp), %rdi
movq 0x645f(%rip), %rsi      # 0x8fb8
callq 0x2200
jmp 0x2b60
movb $0x0, -0x1(%rbp)
movl $0x1, -0x7a180(%rbp)
jmp 0x2f58
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x7a178(%rbp)
movl %eax, -0x7a17c(%rbp)
jmp 0x2f83
jmp 0x2b8c
xorl %eax, %eax
movl %eax, %edi
leaq 0x34dc(%rip), %rsi      # 0x6073
callq 0x22f0
movq %rax, -0x7a138(%rbp)
cmpq $0x0, %rax
je 0x2c5f
movq -0x7a138(%rbp), %rax
movq %rax, -0x7a668(%rbp)
leaq -0x7a1a1(%rbp), %rdi
movq %rdi, -0x7a660(%rbp)
callq 0x2340
movq -0x7a668(%rbp), %rsi
movq -0x7a660(%rbp), %rdx
leaq -0x7a1a0(%rbp), %rdi
callq 0x3630
jmp 0x2bea
leaq -0x7a170(%rbp), %rdi
leaq -0x7a1a0(%rbp), %rsi
callq 0x3720
jmp 0x2bff
leaq -0x7a1a0(%rbp), %rdi
callq 0x2130
leaq -0x7a1a1(%rbp), %rdi
callq 0x2220
jmp 0x2b8c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x7a178(%rbp)
movl %eax, -0x7a17c(%rbp)
jmp 0x2c4e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x7a178(%rbp)
movl %eax, -0x7a17c(%rbp)
leaq -0x7a1a0(%rbp), %rdi
callq 0x2130
leaq -0x7a1a1(%rbp), %rdi
callq 0x2220
jmp 0x2f83
movl $0x0, -0x7a1a8(%rbp)
movl -0x7a1a8(%rbp), %eax
movl %eax, -0x7a66c(%rbp)
leaq -0x7a170(%rbp), %rdi
callq 0x3750
movq %rax, %rcx
movl -0x7a66c(%rbp), %eax
cmpl %ecx, %eax
jge 0x2d81
leaq -0x7a220(%rbp), %rdi
movq %rdi, -0x7a678(%rbp)
callq 0x3770
movslq -0x7a1a8(%rbp), %rsi
leaq -0x7a170(%rbp), %rdi
callq 0x37b0
movq %rax, %rdi
callq 0x20a0
movq %rax, %rsi
leaq -0x7a610(%rbp), %rdi
movq %rdi, -0x7a680(%rbp)
callq 0x21c0
movq -0x7a680(%rbp), %rdi
movq -0x7a678(%rbp), %rsi
callq 0x2730
movb %al, -0x7a66d(%rbp)
jmp 0x2cf1
movb -0x7a66d(%rbp), %al
testb $0x1, %al
jne 0x2d30
jmp 0x2cfd
movb $0x0, -0x1(%rbp)
movl $0x1, -0x7a180(%rbp)
jmp 0x2d4f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x7a178(%rbp)
movl %eax, -0x7a17c(%rbp)
leaq -0x7a220(%rbp), %rdi
callq 0x3810
jmp 0x2f83
leaq -0x7a158(%rbp), %rdi
leaq -0x7a220(%rbp), %rsi
callq 0x37d0
jmp 0x2d45
movl $0x0, -0x7a180(%rbp)
leaq -0x7a220(%rbp), %rdi
callq 0x3810
movl -0x7a180(%rbp), %eax
testl %eax, %eax
jne 0x2f58
jmp 0x2d6b
jmp 0x2d6d
movl -0x7a1a8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x7a1a8(%rbp)
jmp 0x2c69
leaq -0x7a158(%rbp), %rdi
callq 0x25d0
jmp 0x2d8f
leaq -0x7a158(%rbp), %rdi
callq 0x34e0
movq %rax, -0x7a620(%rbp)
leaq -0x7a618(%rbp), %rdi
leaq -0x7a620(%rbp), %rsi
callq 0x3610
leaq -0x7a158(%rbp), %rdi
callq 0x3540
movq %rax, -0x7a630(%rbp)
leaq -0x7a628(%rbp), %rdi
leaq -0x7a630(%rbp), %rsi
callq 0x3610
leaq -0x7a618(%rbp), %rdi
leaq -0x7a628(%rbp), %rsi
callq 0x3850
testb $0x1, %al
jne 0x2df7
jmp 0x2f4e
leaq -0x7a618(%rbp), %rdi
callq 0x3880
movq %rax, %rsi
movq 0x61bb(%rip), %rdi      # 0x8fc8
callq 0x21b0
movq %rax, -0x7a688(%rbp)
jmp 0x2e1b
movq -0x7a688(%rbp), %rdi
movl $0x9, %esi
callq 0x2250
movq %rax, -0x7a690(%rbp)
jmp 0x2e35
leaq -0x7a618(%rbp), %rdi
callq 0x3880
movq -0x7a690(%rbp), %rdi
movq 0x20(%rax), %rsi
callq 0x2370
movq %rax, -0x7a698(%rbp)
jmp 0x2e5a
movq -0x7a698(%rbp), %rdi
movl $0x9, %esi
callq 0x2250
movq %rax, -0x7a6a0(%rbp)
jmp 0x2e74
leaq -0x7a618(%rbp), %rdi
callq 0x3880
movq -0x7a6a0(%rbp), %rdi
movq 0x28(%rax), %rsi
callq 0x2370
movq %rax, -0x7a6a8(%rbp)
jmp 0x2e99
movq -0x7a6a8(%rbp), %rdi
movl $0x9, %esi
callq 0x2250
movq %rax, -0x7a6b0(%rbp)
jmp 0x2eb3
leaq -0x7a618(%rbp), %rdi
callq 0x3880
movq -0x7a6b0(%rbp), %rdi
movq %rax, %rsi
addq $0x30, %rsi
callq 0x21b0
movq %rax, -0x7a6b8(%rbp)
jmp 0x2edb
movq -0x7a6b8(%rbp), %rdi
movl $0x9, %esi
callq 0x2250
movq %rax, -0x7a6c0(%rbp)
jmp 0x2ef5
leaq -0x7a618(%rbp), %rdi
callq 0x3880
movq -0x7a6c0(%rbp), %rdi
movq %rax, %rsi
addq $0x58, %rsi
callq 0x21b0
movq %rax, -0x7a6c8(%rbp)
jmp 0x2f1d
movq -0x7a6c8(%rbp), %rdi
movq 0x608d(%rip), %rsi      # 0x8fb8
callq 0x2200
jmp 0x2f32
jmp 0x2f34
leaq -0x7a618(%rbp), %rdi
xorl %esi, %esi
callq 0x38b0
movq %rax, -0x7a638(%rbp)
jmp 0x2db5
movl $0x0, -0x7a180(%rbp)
leaq -0x7a170(%rbp), %rdi
callq 0x38e0
leaq -0x7a158(%rbp), %rdi
callq 0x3940
movl -0x7a180(%rbp), %eax
testl %eax, %eax
je 0x2f7e
jmp 0x2f7c
jmp 0x2fa1
jmp 0x2a5d
leaq -0x7a170(%rbp), %rdi
callq 0x38e0
leaq -0x7a158(%rbp), %rdi
callq 0x3940
jmp 0x2faf
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x7a6d0, %rsp          # imm = 0x7A6D0
popq %rbp
retq
movq -0x7a178(%rbp), %rdi
callq 0x2330
nopl (%rax,%rax)