// File: /workspace/github_cpp_makefile_star2_O3/havluj[P]spreadsheet/src/CEquation.cpp
// Function: CEquation::replaceOtherCells(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
std::string CEquation::replaceOtherCells(std::string exp) {
    // erase all the spaces
    exp.erase(std::remove(exp.begin(), exp.end(), ' '), exp.end());
    m_expression = exp; 
    // replace = with a space
    exp.replace(exp.find("="), 1, " "); 
    // erase all the spaces
    exp.erase(std::remove(exp.begin(), exp.end(), ' '), exp.end());
    

    /* make everything upper case */
    exp = UpperCase(exp);

    /* PARSING CELL FUNCTION */
    std::string phraze = "CELL"; // substring we are looking for
    std::string subExp;
    size_t pos = exp.find(phraze, 0);
    while (pos != std::string::npos) {
	  size_t endingParentheses = exp.find(")", pos);
	  subExp = exp.substr(pos + 4, endingParentheses - pos + 1);
	  std::stringstream stream;
	  stream << subExp;
	  char ch;
	  stream >> ch;
	  if (ch != '(') {
		m_error = true;
		m_errorMsg = "ERR: wrong CELL format";
		return exp;
	  }
	  int row = 0, col = 0;
	  stream >> row;
	  stream >> ch;
	  if (ch != ',') {
		m_error = true;
		m_errorMsg = "ERR: wrong CELL format";
		return exp;
	  }
	  stream >> col;

	  stream >> ch;
	  if (ch != ')') {
		m_error = true;
		m_errorMsg = "ERR: wrong CELL format";
		return exp;
	  }

	  if (col == 0 || row == 0) {
		m_error = true;
		m_errorMsg = "ERR: wrong CELL format";
		return exp;
	  }

	  m_affectedBy.insert(std::make_pair(row, col));

	  //replace the cell
	  double val = 0;
	  CCell* cell = NULL;
	  try {
		cell = m_database->getCell(row, col);
		if (cell->getId() == m_id) {
		    m_error = true;
		    m_errorMsg = "ERR: trying to get value of itself in CELL function";
		    return exp;
		} else {
		    val = cell->getValue();
		}
	  } catch (std::logic_error e) {
		m_error = true;
		m_errorMsg = "ERR: trying to compute with string or empty cell";
		return exp;
	  }

	  exp.replace(pos, endingParentheses - pos + 1, std::to_string(val));

	  pos = exp.find(phraze, pos + 1);
    }


    /* PARSING SUM FUNCTION */
    phraze = "SUM"; // substring we are looking for
    pos = exp.find(phraze, 0);
    while (pos != std::string::npos) {
	  size_t endingParentheses = exp.find(")", pos);
	  subExp = exp.substr(pos + 3, endingParentheses - pos + 1);
	  std::stringstream stream;
	  stream << subExp;
	  char ch;
	  stream >> ch;
	  if (ch != '(') {
		m_error = true;
		m_errorMsg = "ERR: wrong SUM format";
		return exp;
	  }
	  int rowBegin = 0, colBegin = 0, rowEnd = 0, colEnd = 0;
	  stream >> rowBegin;
	  stream >> ch;
	  if (ch != ',') {
		m_error = true;
		m_errorMsg = "ERR: wrong SUM format";
		return exp;
	  }
	  stream >> colBegin;

	  stream >> ch;
	  if (ch != ':') {
		m_error = true;
		m_errorMsg = "ERR: wrong SUM format";
		return exp;
	  }
	  stream >> rowEnd;
	  stream >> ch;
	  if (ch != ',') {
		m_error = true;
		m_errorMsg = "ERR: wrong SUM format";
		return exp;
	  }
	  stream >> colEnd;

	  stream >> ch;
	  if (ch != ')') {
		m_error = true;
		m_errorMsg = "ERR: wrong SUM format";
		return exp;
	  }

	  if (colBegin == 0 || rowBegin == 0 || rowEnd == 0 || colEnd == 0) {
		m_error = true;
		m_errorMsg = "ERR: wrong SUM format";
		return exp;
	  }

	  if (rowBegin > rowEnd) {
		int tmp = rowEnd;
		rowEnd = rowBegin;
		rowBegin = tmp;
	  }

	  if (colBegin > colEnd) {
		int tmp = colEnd;
		colEnd = colBegin;
		colBegin = tmp;
	  }

	  double val = 0;
	  for (int i = rowBegin; i <= rowEnd; i++) {
		for (int j = colBegin; j <= colEnd; j++) {
		    m_affectedBy.insert(std::make_pair(i, j));

		    //replace the cell
		    CCell* cell = NULL;
		    try {
			  cell = m_database->getCell(i, j);
			  if (cell->getId() == m_id) {
				m_error = true;
				m_errorMsg = "ERR: trying to get value of itself in SUM function";
			  } else {
				val += cell->getValue();
			  }
		    } catch (std::logic_error e) {
			  m_error = true;
			  m_errorMsg = "ERR: trying to compute with string or empty cell";
		    }
		}
	  }
	  if (m_error) {
		return exp;
	  }

	  exp.replace(pos, endingParentheses - pos + 1, std::to_string(val));

	  pos = exp.find(phraze, pos + 1);
    }


    /* PARSING SUM FUNCTION */
    phraze = "AVG"; // substring we are looking for
    pos = exp.find(phraze, 0);
    while (pos != std::string::npos) {
	  size_t endingParentheses = exp.find(")", pos);
	  subExp = exp.substr(pos + 3, endingParentheses - pos + 1);
	  std::stringstream stream;
	  stream << subExp;
	  char ch;
	  stream >> ch;
	  if (ch != '(') {
		m_error = true;
		m_errorMsg = "ERR: wrong AVG format";
		return exp;
	  }
	  int rowBegin = 0, colBegin = 0, rowEnd = 0, colEnd = 0;
	  stream >> rowBegin;
	  stream >> ch;
	  if (ch != ',') {
		m_error = true;
		m_errorMsg = "ERR: wrong AVG format";
		return exp;
	  }
	  stream >> colBegin;

	  stream >> ch;
	  if (ch != ':') {
		m_error = true;
		m_errorMsg = "ERR: wrong AVG format";
		return exp;
	  }
	  stream >> rowEnd;
	  stream >> ch;
	  if (ch != ',') {
		m_error = true;
		m_errorMsg = "ERR: wrong AVG format";
		return exp;
	  }
	  stream >> colEnd;

	  stream >> ch;
	  if (ch != ')') {
		m_error = true;
		m_errorMsg = "ERR: wrong AVG format";
		return exp;
	  }

	  if (colBegin == 0 || rowBegin == 0 || rowEnd == 0 || colEnd == 0) {
		m_error = true;
		m_errorMsg = "ERR: wrong AVG format";
		return exp;
	  }

	  if (rowBegin > rowEnd) {
		int tmp = rowEnd;
		rowEnd = rowBegin;
		rowBegin = tmp;
	  }

	  if (colBegin > colEnd) {
		int tmp = colEnd;
		colEnd = colBegin;
		colBegin = tmp;
	  }

	  double val = 0;
	  for (int i = rowBegin; i <= rowEnd; i++) {
		for (int j = colBegin; j <= colEnd; j++) {
		    m_affectedBy.insert(std::make_pair(i, j));

		    //replace the cell
		    CCell* cell = NULL;
		    try {
			  cell = m_database->getCell(i, j);
			  if (cell->getId() == m_id) {
				m_error = true;
				m_errorMsg = "ERR: trying to get value of itself in AVG function";
			  } else {
				val += cell->getValue();
			  }
		    } catch (std::logic_error e) {
			  m_error = true;
			  m_errorMsg = "ERR: trying to compute with string or empty cell";
		    }
		}
	  }
	  if (m_error) {
		return exp;
	  }
	  int rowCnt = rowEnd - rowBegin + 1;
	  int colCnt = colEnd - colBegin + 1;

	  exp.replace(pos, endingParentheses - pos + 1, std::to_string(val / (rowCnt * colCnt)));

	  pos = exp.find(phraze, pos + 1);
    }

    return exp;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x278, %rsp            # imm = 0x278
movq %rdx, %r14
movq %rsi, %r12
movq %rdi, 0x70(%rsp)
movq (%rdx), %rdi
movq 0x8(%rdx), %rsi
addq %rdi, %rsi
movb $0x20, %bpl
leaq 0xf0(%rsp), %rbx
movb %bpl, (%rbx)
movq %rbx, %rdx
callq 0x84cd
movq %rax, %rcx
subq (%r14), %rcx
movq %rcx, 0x8(%r14)
xorl %r15d, %r15d
movb %r15b, (%rax)
leaq 0x8(%r12), %rdi
movq %r14, %rsi
callq 0x4190
leaq 0x74cc(%rip), %rsi      # 0xe4b6
movl $0x1, %ecx
movq %r14, %rdi
xorl %edx, %edx
callq 0x4580
leaq 0x7893(%rip), %rcx      # 0xe893
movl $0x1, %edx
movl $0x1, %r8d
movq %r14, %rdi
movq %rax, %rsi
callq 0x4320
movq (%r14), %rdi
movq 0x8(%r14), %rsi
addq %rdi, %rsi
movb %bpl, (%rbx)
leaq 0xf0(%rsp), %rdx
callq 0x84cd
movq %rax, %rcx
subq (%r14), %rcx
movq %rcx, 0x8(%r14)
movb %r15b, (%rax)
movq (%r14), %rsi
leaq 0xe0(%rsp), %r15
movq %r15, -0x10(%r15)
movq 0x8(%r14), %rdx
addq %rsi, %rdx
leaq 0xd0(%rsp), %rbx
movq %rbx, %rdi
callq 0x5370
leaq 0xf0(%rsp), %rdi
movq %rbx, %rsi
callq 0xa426
leaq 0xf0(%rsp), %rbx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x4380
movq (%rbx), %rdi
leaq 0x100(%rsp), %rax
cmpq %rax, %rdi
je 0x70a6
movq 0x100(%rsp), %rsi
incq %rsi
callq 0x42d0
movq 0xd0(%rsp), %rdi
cmpq %r15, %rdi
je 0x70c3
movq 0xe0(%rsp), %rsi
incq %rsi
callq 0x42d0
leaq 0x88(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x73e2(%rip), %rsi      # 0xe4b8
leaq 0x73df(%rip), %rdx      # 0xe4bc
leaq 0x78(%rsp), %rdi
callq 0x8438
movq 0x70(%rsp), %r15
leaq 0xa8(%rsp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
movq 0x78(%rsp), %rsi
movq 0x80(%rsp), %rcx
movq %r14, %rdi
xorl %edx, %edx
callq 0x4580
movq %rax, %rbp
leaq 0x60(%r12), %rax
movq %rax, 0x20(%rsp)
leaq 0x10(%r15), %rax
movq %rax, 0x18(%rsp)
leaq 0x10(%r14), %rax
movq %rax, 0x38(%rsp)
movq %r12, 0x28(%rsp)
leaq 0x88(%r12), %rax
movq %rax, 0xc0(%rsp)
leaq 0xf0(%rsp), %r13
cmpq $-0x1, %rbp
je 0x7535
movl $0x1, %ecx
movq %r14, %rdi
leaq 0x77f5(%rip), %rsi      # 0xe964
movq %rbp, %rdx
callq 0x4580
movq %rax, %r12
leaq 0x4(%rbp), %rdx
subq %rbp, %r12
incq %r12
movq %r13, %rdi
movq %r14, %rsi
movq %r12, %rcx
callq 0x42e0
leaq 0x98(%rsp), %rdi
movq %r13, %rsi
callq 0x4380
movq 0xf0(%rsp), %rdi
leaq 0x100(%rsp), %rax
cmpq %rax, %rdi
je 0x71c7
movq 0x100(%rsp), %rsi
incq %rsi
callq 0x42d0
movq %r13, %rdi
callq 0x41f0
movq 0x98(%rsp), %rsi
movq 0xa0(%rsp), %rdx
leaq 0x100(%rsp), %rdi
callq 0x4330
movq %r13, %rdi
leaq 0xc(%rsp), %rsi
callq 0x43e0
cmpb $0x28, 0xc(%rsp)
jne 0x72a1
xorl %eax, %eax
movl %eax, 0x14(%rsp)
movl %eax, 0x10(%rsp)
movq %r13, %rdi
leaq 0x14(%rsp), %rsi
callq 0x41b0
movq %r13, %rdi
leaq 0xc(%rsp), %rsi
callq 0x43e0
cmpb $0x2c, 0xc(%rsp)
jne 0x72c9
movq %r13, %rdi
leaq 0x10(%rsp), %rsi
callq 0x41b0
movq %r13, %rdi
leaq 0xc(%rsp), %rsi
callq 0x43e0
cmpb $0x29, 0xc(%rsp)
jne 0x72f1
movl 0x10(%rsp), %eax
testq %rax, %rax
sete %dl
movl 0x14(%rsp), %ecx
testl %ecx, %ecx
sete %sil
orb %dl, %sil
cmpb $0x1, %sil
jne 0x7383
movq 0x28(%rsp), %rax
movb $0x1, 0x58(%rax)
movq 0x68(%rax), %rdx
movl $0x16, %r8d
movq 0x20(%rsp), %rdi
xorl %esi, %esi
leaq 0x7223(%rip), %rcx      # 0xe4bd
callq 0x44a0
jmp 0x7317
movq 0x28(%rsp), %rax
movb $0x1, 0x58(%rax)
movq 0x68(%rax), %rdx
movl $0x16, %r8d
movq 0x20(%rsp), %rdi
xorl %esi, %esi
leaq 0x71fb(%rip), %rcx      # 0xe4bd
callq 0x44a0
jmp 0x7317
movq 0x28(%rsp), %rax
movb $0x1, 0x58(%rax)
movq 0x68(%rax), %rdx
movl $0x16, %r8d
movq 0x20(%rsp), %rdi
xorl %esi, %esi
leaq 0x71d3(%rip), %rcx      # 0xe4bd
callq 0x44a0
jmp 0x7317
movq 0x28(%rsp), %rax
movb $0x1, 0x58(%rax)
movq 0x68(%rax), %rdx
movl $0x16, %r8d
movq 0x20(%rsp), %rdi
xorl %esi, %esi
leaq 0x71ab(%rip), %rcx      # 0xe4bd
callq 0x44a0
movq 0x18(%rsp), %rdx
movq %rdx, (%r15)
movq (%r14), %rax
movq 0x38(%rsp), %rcx
cmpq %rcx, %rax
je 0x7338
movq %rax, (%r15)
movq (%rcx), %rax
movq %rax, 0x10(%r15)
jmp 0x7340
movupd (%rcx), %xmm0
movupd %xmm0, (%rdx)
movq 0x8(%r14), %rax
movq %rax, 0x8(%r15)
movq %rcx, (%r14)
movq $0x0, 0x8(%r14)
movb $0x0, 0x10(%r14)
xorl %ebx, %ebx
movq %r13, %rdi
movq 0xbc1c(%rip), %rsi      # 0x12f80
callq 0x4220
leaq 0x170(%rsp), %rdi
callq 0x40d0
testb %bl, %bl
jne 0x7156
jmp 0x8102
movl %ecx, %ecx
shlq $0x20, %rax
orq %rcx, %rax
movq %rax, 0x40(%rsp)
movq 0xc0(%rsp), %rdi
leaq 0x40(%rsp), %rsi
callq 0x658c
movq 0x28(%rsp), %rax
movq 0x38(%rax), %rdi
movl 0x14(%rsp), %esi
movl 0x10(%rsp), %edx
movq (%rdi), %rax
callq *0x30(%rax)
movq %rax, %rbx
movq %rax, %rdi
callq 0x530c
movq 0x28(%rsp), %rcx
cmpl 0x28(%rcx), %eax
jne 0x73f5
movb $0x1, 0x58(%rcx)
movq 0x68(%rcx), %rdx
movl $0x33, %r8d
movq 0x20(%rsp), %rdi
xorl %esi, %esi
leaq 0x70e9(%rip), %rcx      # 0xe4d4
callq 0x44a0
jmp 0x7317
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x20(%rax)
movl $0x148, %edx            # imm = 0x148
leaq 0x40(%rsp), %rdi
movq 0xbb81(%rip), %rsi      # 0x12f90
leaq 0x7204(%rip), %rcx      # 0xe61a
movb $0x1, %al
callq 0x8386
movq 0x40(%rsp), %rcx
movq 0x48(%rsp), %r8
movq %r14, %rdi
movq %rbp, %rsi
movq %r12, %rdx
callq 0x4320
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x7451
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x42d0
incq %rbp
movq 0x78(%rsp), %rsi
movq 0x80(%rsp), %rcx
movq %r14, %rdi
movq %rbp, %rdx
callq 0x4580
movq %rax, %rbp
movb $0x1, %bl
jmp 0x735a
movq %rax, %r15
cmpl $0x1, %edx
jne 0x82b7
movq %r15, %rdi
callq 0x43a0
leaq 0x40(%rsp), %rdi
movq %rax, %rsi
callq 0x45e0
movq %r15, %rdi
callq 0x4110
movq 0x28(%rsp), %rax
movb $0x1, 0x58(%rax)
movq 0x20(%rsp), %rdi
leaq 0x7054(%rip), %rsi      # 0xe508
callq 0x4400
movq 0x70(%rsp), %rax
movq 0x18(%rsp), %rcx
movq %rcx, (%rax)
movq (%r14), %rax
cmpq 0x38(%rsp), %rax
je 0x74e6
movq 0x70(%rsp), %rcx
movq %rax, (%rcx)
movq 0x38(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x10(%rcx)
jmp 0x74f8
movq 0x38(%rsp), %rax
movupd (%rax), %xmm0
movq 0x18(%rsp), %rax
movupd %xmm0, (%rax)
movq 0x8(%r14), %rax
movq 0x70(%rsp), %rcx
movq %rax, 0x8(%rcx)
movq 0x38(%rsp), %rax
movq %rax, (%r14)
movq $0x0, 0x8(%r14)
movb $0x0, 0x10(%r14)
leaq 0x40(%rsp), %rdi
callq 0x4648
callq 0x4510
xorl %ebx, %ebx
movq 0x70(%rsp), %r15
jmp 0x735a
leaq 0x78(%rsp), %rdi
movq 0x8(%rdi), %rdx
leaq 0x6ff4(%rip), %rcx      # 0xe539
movl $0x3, %r8d
xorl %esi, %esi
callq 0x44a0
movq 0x78(%rsp), %rsi
movq 0x80(%rsp), %rcx
movq %r14, %rdi
xorl %edx, %edx
callq 0x4580
movq %rax, %rbx
leaq 0xf0(%rsp), %rbp
cmpq $-0x1, %rbx
je 0x7afd
movl $0x1, %ecx
movq %r14, %rdi
leaq 0x73d7(%rip), %rsi      # 0xe964
movq %rbx, %rdx
callq 0x4580
movq %rax, %r12
leaq 0x3(%rbx), %rdx
movq %rbx, 0x60(%rsp)
subq %rbx, %r12
incq %r12
movq %rbp, %rdi
movq %r14, %rsi
movq %r12, %rcx
callq 0x42e0
movq 0x28(%rsp), %rbx
movq 0x38(%rsp), %r13
leaq 0x98(%rsp), %rdi
movq %rbp, %rsi
callq 0x4380
movq 0xf0(%rsp), %rdi
leaq 0x100(%rsp), %rax
cmpq %rax, %rdi
je 0x75f4
movq 0x100(%rsp), %rsi
incq %rsi
callq 0x42d0
movq %rbp, %rdi
callq 0x41f0
movq 0x98(%rsp), %rsi
movq 0xa0(%rsp), %rdx
leaq 0x100(%rsp), %rdi
callq 0x4330
movq %rbp, %rdi
leaq 0xb(%rsp), %rsi
callq 0x43e0
cmpb $0x28, 0xb(%rsp)
jne 0x7770
xorl %eax, %eax
movl %eax, 0x14(%rsp)
movl %eax, 0x10(%rsp)
movl %eax, 0xc(%rsp)
movl %eax, 0x34(%rsp)
movq %rbp, %rdi
leaq 0x14(%rsp), %rsi
callq 0x41b0
movq %rbp, %rdi
leaq 0xb(%rsp), %rsi
callq 0x43e0
cmpb $0x2c, 0xb(%rsp)
jne 0x7796
movq %rbp, %rdi
leaq 0x10(%rsp), %rsi
callq 0x41b0
movq %rbp, %rdi
leaq 0xb(%rsp), %rsi
callq 0x43e0
cmpb $0x3a, 0xb(%rsp)
jne 0x77b9
movq %rbp, %rdi
leaq 0xc(%rsp), %rsi
callq 0x41b0
movq %rbp, %rdi
leaq 0xb(%rsp), %rsi
callq 0x43e0
cmpb $0x2c, 0xb(%rsp)
jne 0x77dc
movq %rbp, %rdi
leaq 0x34(%rsp), %rsi
callq 0x41b0
movq %rbp, %rdi
leaq 0xb(%rsp), %rsi
callq 0x43e0
cmpb $0x29, 0xb(%rsp)
jne 0x77ff
movq %r14, 0xb8(%rsp)
movl 0x10(%rsp), %eax
testl %eax, %eax
sete %cl
movl 0x14(%rsp), %esi
testl %esi, %esi
sete %dil
orb %cl, %dil
movl 0xc(%rsp), %r14d
testl %r14d, %r14d
sete %cl
movl 0x34(%rsp), %edx
testl %edx, %edx
sete %r8b
orb %cl, %r8b
orb %dil, %r8b
cmpb $0x1, %r8b
jne 0x788f
movq 0x28(%rsp), %rax
movb $0x1, 0x58(%rax)
movq 0x68(%rax), %rdx
movl $0x15, %r8d
movq 0x20(%rsp), %rdi
xorl %esi, %esi
leaq 0x6e02(%rip), %rcx      # 0xe53d
callq 0x44a0
movq 0x38(%rsp), %rcx
movq 0xb8(%rsp), %r14
movq 0x18(%rsp), %rdx
movq %rdx, (%r15)
movq (%r14), %rax
cmpq %rcx, %rax
je 0x7abd
movq %rax, (%r15)
movq (%rcx), %rax
movq %rax, 0x10(%r15)
jmp 0x7ac5
movb $0x1, 0x58(%rbx)
movq 0x68(%rbx), %rdx
movl $0x15, %r8d
movq 0x20(%rsp), %rdi
xorl %esi, %esi
leaq 0x6db1(%rip), %rcx      # 0xe53d
callq 0x44a0
jmp 0x7820
movb $0x1, 0x58(%rbx)
movq 0x68(%rbx), %rdx
movl $0x15, %r8d
movq 0x20(%rsp), %rdi
xorl %esi, %esi
leaq 0x6d8b(%rip), %rcx      # 0xe53d
callq 0x44a0
jmp 0x7820
movb $0x1, 0x58(%rbx)
movq 0x68(%rbx), %rdx
movl $0x15, %r8d
movq 0x20(%rsp), %rdi
xorl %esi, %esi
leaq 0x6d68(%rip), %rcx      # 0xe53d
callq 0x44a0
jmp 0x7820
movb $0x1, 0x58(%rbx)
movq 0x68(%rbx), %rdx
movl $0x15, %r8d
movq 0x20(%rsp), %rdi
xorl %esi, %esi
leaq 0x6d45(%rip), %rcx      # 0xe53d
callq 0x44a0
jmp 0x7820
movb $0x1, 0x58(%rbx)
movq 0x68(%rbx), %rdx
movl $0x15, %r8d
movq 0x20(%rsp), %rdi
xorl %esi, %esi
leaq 0x6d22(%rip), %rcx      # 0xe53d
callq 0x44a0
movq 0x18(%rsp), %rcx
movq %rcx, (%r15)
movq (%r14), %rax
cmpq %r13, %rax
je 0x783d
movq %rax, (%r15)
movq (%r13), %rax
movq %rax, 0x10(%r15)
jmp 0x7847
movupd (%r13), %xmm0
movupd %xmm0, (%rcx)
movq 0x8(%r14), %rax
movq %rax, 0x8(%r15)
movq %r13, (%r14)
movq $0x0, 0x8(%r14)
movb $0x0, 0x10(%r14)
xorl %ebx, %ebx
movq %rbp, %rdi
movq 0xb715(%rip), %rsi      # 0x12f80
callq 0x4220
leaq 0x170(%rsp), %rdi
callq 0x40d0
testb %bl, %bl
movq 0x60(%rsp), %rbx
jne 0x7574
jmp 0x8102
cmpl %r14d, %esi
jle 0x78a1
movl %esi, 0xc(%rsp)
movl %r14d, 0x14(%rsp)
movl %esi, %ecx
jmp 0x78a7
movl %r14d, %ecx
movl %esi, %r14d
cmpl %edx, %eax
jle 0x78b5
movl %eax, 0x34(%rsp)
movl %edx, 0x10(%rsp)
jmp 0x78b7
movl %edx, %eax
xorpd %xmm0, %xmm0
movsd %xmm0, 0x68(%rsp)
cmpl %ecx, %r14d
jg 0x79fa
movsd %xmm0, 0x68(%rsp)
movl 0x10(%rsp), %ebx
cmpl %eax, %ebx
jg 0x79ea
movl %r14d, %r15d
movq %rbp, %r13
movq %rbx, %rax
shlq $0x20, %rax
orq %r15, %rax
movq %rax, 0x40(%rsp)
movq 0xc0(%rsp), %rdi
leaq 0x40(%rsp), %rsi
callq 0x658c
movq 0x28(%rsp), %rax
movq 0x38(%rax), %rdi
movq (%rdi), %rax
movl %r14d, %esi
movl %ebx, %edx
callq *0x30(%rax)
movq %rax, %rbp
movq %rax, %rdi
callq 0x530c
movq 0x28(%rsp), %rcx
cmpl 0x28(%rcx), %eax
jne 0x794f
movb $0x1, 0x58(%rcx)
movq 0x68(%rcx), %rdx
movl $0x32, %r8d
movq 0x20(%rsp), %rdi
xorl %esi, %esi
leaq 0x6c0b(%rip), %rcx      # 0xe553
callq 0x44a0
jmp 0x7969
movq (%rbp), %rax
movq %rbp, %rdi
callq *0x20(%rax)
movsd 0x68(%rsp), %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, 0x68(%rsp)
movq %r13, %rbp
leal 0x1(%rbx), %ecx
movl 0x34(%rsp), %eax
cmpl %eax, %ebx
movl %ecx, %ebx
jl 0x78df
jmp 0x79e1
movq %rax, %rbp
cmpl $0x1, %edx
jne 0x815e
movq %rbp, %rdi
callq 0x43a0
movq %rbp, 0xc8(%rsp)
leaq 0x40(%rsp), %rbp
movq %rbp, %rdi
movq %rax, %rsi
callq 0x45e0
movq 0xc8(%rsp), %rdi
callq 0x4110
movq 0x28(%rsp), %rax
movb $0x1, 0x58(%rax)
movq 0x20(%rsp), %rdi
leaq 0x6b3b(%rip), %rsi      # 0xe508
callq 0x4400
movq %rbp, %rdi
callq 0x4648
callq 0x4510
jmp 0x7969
movl 0xc(%rsp), %ecx
movq 0x70(%rsp), %r15
leal 0x1(%r14), %edx
cmpl %ecx, %r14d
movl %edx, %r14d
jl 0x78d0
movq 0x28(%rsp), %rax
movb 0x58(%rax), %bl
testb %bl, %bl
je 0x7a36
movq 0x18(%rsp), %rdx
movq %rdx, (%r15)
movq 0xb8(%rsp), %r14
movq (%r14), %rax
movq 0x38(%rsp), %rcx
cmpq %rcx, %rax
je 0x7ad5
movq %rax, (%r15)
movq (%rcx), %rax
movq %rax, 0x10(%r15)
jmp 0x7add
movl $0x148, %edx            # imm = 0x148
leaq 0x40(%rsp), %rdi
movq 0xb549(%rip), %rsi      # 0x12f90
leaq 0x6bcc(%rip), %rcx      # 0xe61a
movsd 0x68(%rsp), %xmm0
movb $0x1, %al
callq 0x8386
movq 0xb8(%rsp), %r14
movq 0x40(%rsp), %rcx
movq 0x48(%rsp), %r8
movq %r14, %rdi
movq 0x60(%rsp), %rsi
movq %r12, %rdx
callq 0x4320
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x7a99
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x42d0
movq 0x60(%rsp), %rdx
incq %rdx
movq 0x78(%rsp), %rsi
movq 0x80(%rsp), %rcx
movq %r14, %rdi
callq 0x4580
movq %rax, 0x60(%rsp)
jmp 0x7af5
movupd (%rcx), %xmm0
movupd %xmm0, (%rdx)
movq 0x8(%r14), %rax
movq %rax, 0x8(%r15)
movq %rcx, (%r14)
jmp 0x7852
movupd (%rcx), %xmm0
movupd %xmm0, (%rdx)
movq 0x8(%r14), %rax
movq %rax, 0x8(%r15)
movq %rcx, (%r14)
movq $0x0, 0x8(%r14)
movb $0x0, 0x10(%r14)
xorb $0x1, %bl
jmp 0x7861
leaq 0x78(%rsp), %rdi
movq 0x8(%rdi), %rdx
leaq 0x6a79(%rip), %rcx      # 0xe586
movl $0x3, %r8d
xorl %esi, %esi
callq 0x44a0
movq 0x78(%rsp), %rsi
movq 0x80(%rsp), %rcx
movq %r14, %rdi
xorl %edx, %edx
callq 0x4580
movq %rax, %rbx
leaq 0xf0(%rsp), %rbp
cmpq $-0x1, %rbx
je 0x80c1
movl $0x1, %ecx
movq %r14, %rdi
leaq 0x6e0f(%rip), %rsi      # 0xe964
movq %rbx, %rdx
callq 0x4580
movq %rax, %r12
leaq 0x3(%rbx), %rdx
movq %rbx, 0x60(%rsp)
subq %rbx, %r12
incq %r12
movq %rbp, %rdi
movq %r14, %rsi
movq %r12, %rcx
callq 0x42e0
movq 0x38(%rsp), %r13
leaq 0x98(%rsp), %rdi
movq %rbp, %rsi
callq 0x4380
movq 0xf0(%rsp), %rdi
leaq 0x100(%rsp), %rax
cmpq %rax, %rdi
movq 0x28(%rsp), %rbx
je 0x7bbc
movq 0x100(%rsp), %rsi
incq %rsi
callq 0x42d0
movq %rbp, %rdi
callq 0x41f0
movq 0x98(%rsp), %rsi
movq 0xa0(%rsp), %rdx
leaq 0x100(%rsp), %rdi
callq 0x4330
movq %rbp, %rdi
leaq 0xb(%rsp), %rsi
callq 0x43e0
cmpb $0x28, 0xb(%rsp)
jne 0x7d28
xorl %eax, %eax
movl %eax, 0x14(%rsp)
movl %eax, 0x10(%rsp)
movl %eax, 0xc(%rsp)
movl %eax, 0x34(%rsp)
movq %rbp, %rdi
leaq 0x14(%rsp), %rsi
callq 0x41b0
movq %rbp, %rdi
leaq 0xb(%rsp), %rsi
callq 0x43e0
cmpb $0x2c, 0xb(%rsp)
jne 0x7d4e
movq %rbp, %rdi
leaq 0x10(%rsp), %rsi
callq 0x41b0
movq %rbp, %rdi
leaq 0xb(%rsp), %rsi
callq 0x43e0
cmpb $0x3a, 0xb(%rsp)
jne 0x7d71
movq %rbp, %rdi
leaq 0xc(%rsp), %rsi
callq 0x41b0
movq %rbp, %rdi
leaq 0xb(%rsp), %rsi
callq 0x43e0
cmpb $0x2c, 0xb(%rsp)
jne 0x7d94
movq %rbp, %rdi
leaq 0x34(%rsp), %rsi
callq 0x41b0
movq %rbp, %rdi
leaq 0xb(%rsp), %rsi
callq 0x43e0
cmpb $0x29, 0xb(%rsp)
jne 0x7db7
movl 0x10(%rsp), %eax
testl %eax, %eax
sete %cl
movl 0x14(%rsp), %esi
testl %esi, %esi
sete %dil
orb %cl, %dil
movl 0xc(%rsp), %r13d
testl %r13d, %r13d
sete %cl
movl 0x34(%rsp), %edx
testl %edx, %edx
sete %r8b
orb %cl, %r8b
orb %dil, %r8b
cmpb $0x1, %r8b
jne 0x7e47
movq 0x28(%rsp), %rax
movb $0x1, 0x58(%rax)
movq 0x68(%rax), %rdx
movl $0x15, %r8d
movq 0x20(%rsp), %rdi
xorl %esi, %esi
leaq 0x688f(%rip), %rcx      # 0xe58a
callq 0x44a0
movq 0x38(%rsp), %rcx
movq 0x18(%rsp), %rdx
movq %rdx, (%r15)
movq (%r14), %rax
cmpq %rcx, %rax
je 0x8081
movq %rax, (%r15)
movq (%rcx), %rax
movq %rax, 0x10(%r15)
jmp 0x8089
movb $0x1, 0x58(%rbx)
movq 0x68(%rbx), %rdx
movl $0x15, %r8d
movq 0x20(%rsp), %rdi
xorl %esi, %esi
leaq 0x6846(%rip), %rcx      # 0xe58a
callq 0x44a0
jmp 0x7dd8
movb $0x1, 0x58(%rbx)
movq 0x68(%rbx), %rdx
movl $0x15, %r8d
movq 0x20(%rsp), %rdi
xorl %esi, %esi
leaq 0x6820(%rip), %rcx      # 0xe58a
callq 0x44a0
jmp 0x7dd8
movb $0x1, 0x58(%rbx)
movq 0x68(%rbx), %rdx
movl $0x15, %r8d
movq 0x20(%rsp), %rdi
xorl %esi, %esi
leaq 0x67fd(%rip), %rcx      # 0xe58a
callq 0x44a0
jmp 0x7dd8
movb $0x1, 0x58(%rbx)
movq 0x68(%rbx), %rdx
movl $0x15, %r8d
movq 0x20(%rsp), %rdi
xorl %esi, %esi
leaq 0x67da(%rip), %rcx      # 0xe58a
callq 0x44a0
jmp 0x7dd8
movb $0x1, 0x58(%rbx)
movq 0x68(%rbx), %rdx
movl $0x15, %r8d
movq 0x20(%rsp), %rdi
xorl %esi, %esi
leaq 0x67b7(%rip), %rcx      # 0xe58a
callq 0x44a0
movq 0x18(%rsp), %rcx
movq %rcx, (%r15)
movq (%r14), %rax
cmpq %r13, %rax
je 0x7df5
movq %rax, (%r15)
movq (%r13), %rax
movq %rax, 0x10(%r15)
jmp 0x7dff
movupd (%r13), %xmm0
movupd %xmm0, (%rcx)
movq 0x8(%r14), %rax
movq %rax, 0x8(%r15)
movq %r13, (%r14)
movq $0x0, 0x8(%r14)
movb $0x0, 0x10(%r14)
xorl %ebx, %ebx
movq %rbp, %rdi
movq 0xb15d(%rip), %rsi      # 0x12f80
callq 0x4220
leaq 0x170(%rsp), %rdi
callq 0x40d0
testb %bl, %bl
movq 0x60(%rsp), %rbx
jne 0x7b3c
jmp 0x8102
cmpl %r13d, %esi
jle 0x7e59
movl %esi, 0xc(%rsp)
movl %r13d, 0x14(%rsp)
movl %esi, %ecx
jmp 0x7e5f
movl %r13d, %ecx
movl %esi, %r13d
cmpl %edx, %eax
jle 0x7e6d
movl %eax, 0x34(%rsp)
movl %edx, 0x10(%rsp)
jmp 0x7e6f
movl %edx, %eax
xorpd %xmm0, %xmm0
movsd %xmm0, 0x68(%rsp)
cmpl %ecx, %r13d
jg 0x7fb4
movsd %xmm0, 0x68(%rsp)
movq %r14, 0xb8(%rsp)
movl 0x10(%rsp), %ebx
cmpl %eax, %ebx
jg 0x7fa4
movl %r13d, %r15d
movq %rbp, %r14
movq %rbx, %rax
shlq $0x20, %rax
orq %r15, %rax
movq %rax, 0x40(%rsp)
movq 0xc0(%rsp), %rdi
leaq 0x40(%rsp), %rsi
callq 0x658c
movq 0x28(%rsp), %rax
movq 0x38(%rax), %rdi
movq (%rdi), %rax
movl %r13d, %esi
movl %ebx, %edx
callq *0x30(%rax)
movq %rax, %rbp
movq %rax, %rdi
callq 0x530c
movq 0x28(%rsp), %rcx
cmpl 0x28(%rcx), %eax
jne 0x7f0f
movb $0x1, 0x58(%rcx)
movq 0x68(%rcx), %rdx
movl $0x32, %r8d
movq 0x20(%rsp), %rdi
xorl %esi, %esi
leaq 0x6698(%rip), %rcx      # 0xe5a0
callq 0x44a0
jmp 0x7f29
movq (%rbp), %rax
movq %rbp, %rdi
callq *0x20(%rax)
movsd 0x68(%rsp), %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, 0x68(%rsp)
movq %r14, %rbp
leal 0x1(%rbx), %ecx
movl 0x34(%rsp), %eax
cmpl %eax, %ebx
movl %ecx, %ebx
jl 0x7e9f
jmp 0x7f93
movq %rax, %rbp
cmpl $0x1, %edx
jne 0x8278
movq %rbp, %rdi
callq 0x43a0
leaq 0x40(%rsp), %rdi
movq %rax, %rsi
callq 0x45e0
movq %rbp, %rdi
callq 0x4110
movq 0x28(%rsp), %rax
movb $0x1, 0x58(%rax)
movq 0x20(%rsp), %rdi
leaq 0x658b(%rip), %rsi      # 0xe508
callq 0x4400
leaq 0x40(%rsp), %rdi
callq 0x4648
callq 0x4510
jmp 0x7f29
movl 0xc(%rsp), %ecx
movq 0x70(%rsp), %r15
movq 0xb8(%rsp), %r14
leal 0x1(%r13), %edx
cmpl %ecx, %r13d
movl %edx, %r13d
jl 0x7e90
movq 0x28(%rsp), %rdx
movb 0x58(%rdx), %bl
testb %bl, %bl
je 0x7fe8
movq 0x18(%rsp), %rdx
movq %rdx, (%r15)
movq (%r14), %rax
movq 0x38(%rsp), %rcx
cmpq %rcx, %rax
je 0x8099
movq %rax, (%r15)
movq (%rcx), %rax
movq %rax, 0x10(%r15)
jmp 0x80a1
subl 0x14(%rsp), %ecx
incl %ecx
subl 0x10(%rsp), %eax
incl %eax
imull %ecx, %eax
xorps %xmm1, %xmm1
cvtsi2sd %eax, %xmm1
movsd 0x68(%rsp), %xmm0
divsd %xmm1, %xmm0
movl $0x148, %edx            # imm = 0x148
leaq 0x40(%rsp), %rdi
movq 0xaf77(%rip), %rsi      # 0x12f90
leaq 0x65fa(%rip), %rcx      # 0xe61a
movb $0x1, %al
callq 0x8386
movq 0x40(%rsp), %rcx
movq 0x48(%rsp), %r8
movq %r14, %rdi
movq 0x60(%rsp), %rsi
movq %r12, %rdx
callq 0x4320
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x805d
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x42d0
movq 0x60(%rsp), %rdx
incq %rdx
movq 0x78(%rsp), %rsi
movq 0x80(%rsp), %rcx
movq %r14, %rdi
callq 0x4580
movq %rax, 0x60(%rsp)
jmp 0x80b9
movupd (%rcx), %xmm0
movupd %xmm0, (%rdx)
movq 0x8(%r14), %rax
movq %rax, 0x8(%r15)
movq %rcx, (%r14)
jmp 0x7e0a
movupd (%rcx), %xmm0
movupd %xmm0, (%rdx)
movq 0x8(%r14), %rax
movq %rax, 0x8(%r15)
movq %rcx, (%r14)
movq $0x0, 0x8(%r14)
movb $0x0, 0x10(%r14)
xorb $0x1, %bl
jmp 0x7e19
movq 0x18(%rsp), %rdx
movq %rdx, (%r15)
movq (%r14), %rax
movq 0x38(%rsp), %rcx
cmpq %rcx, %rax
je 0x80e2
movq %rax, (%r15)
movq (%rcx), %rax
movq %rax, 0x10(%r15)
jmp 0x80ea
movupd (%rcx), %xmm0
movupd %xmm0, (%rdx)
movq 0x8(%r14), %rax
movq %rax, 0x8(%r15)
movq %rcx, (%r14)
movq $0x0, 0x8(%r14)
movb $0x0, 0x10(%r14)
movq 0x98(%rsp), %rdi
leaq 0xa8(%rsp), %rax
cmpq %rax, %rdi
je 0x8127
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x42d0
movq 0x78(%rsp), %rdi
leaq 0x88(%rsp), %rax
cmpq %rax, %rdi
je 0x8149
movq 0x88(%rsp), %rsi
incq %rsi
callq 0x42d0
movq %r15, %rax
addq $0x278, %rsp            # imm = 0x278
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rbp, %r15
jmp 0x82b7
jmp 0x82b4
movq %rax, %r15
leaq 0x40(%rsp), %rdi
callq 0x4648
callq 0x4510
jmp 0x82b7
jmp 0x8275
movq %rax, %rbp
leaq 0x40(%rsp), %rdi
callq 0x4648
callq 0x4510
jmp 0x8278
jmp 0x82b4
movq %rax, %r15
leaq 0x40(%rsp), %rdi
callq 0x4648
callq 0x4510
jmp 0x82b7
movq %rax, %rdi
callq 0x5314
movq %rax, %rbp
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x8278
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x42d0
jmp 0x8278
jmp 0x8275
jmp 0x81f6
jmp 0x82b4
movq %rax, %r15
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x82b7
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x42d0
jmp 0x82b7
jmp 0x82b4
jmp 0x826e
jmp 0x82b4
movq %rax, %r15
jmp 0x831f
movq %rax, %rbx
movq 0xd0(%rsp), %rdi
cmpq %r15, %rdi
je 0x8252
movq 0xe0(%rsp), %rsi
incq %rsi
callq 0x42d0
movq %rbx, %r15
jmp 0x831f
jmp 0x826e
jmp 0x826e
jmp 0x8275
jmp 0x8275
jmp 0x826e
jmp 0x826e
jmp 0x82b4
jmp 0x8275
jmp 0x82b4
jmp 0x826e
movq %rax, %r15
jmp 0x82d8
jmp 0x82b4
movq %rax, %rbp
movq 0xad01(%rip), %rsi      # 0x12f80
leaq 0xf0(%rsp), %rdi
callq 0x4220
leaq 0x170(%rsp), %rdi
callq 0x40d0
leaq 0x88(%rsp), %rbx
leaq 0xa8(%rsp), %rax
movq %rbp, %r15
jmp 0x82e8
jmp 0x82b4
jmp 0x82b4
jmp 0x82b4
movq %rax, %r15
movq 0xacc2(%rip), %rsi      # 0x12f80
leaq 0xf0(%rsp), %rdi
callq 0x4220
leaq 0x170(%rsp), %rdi
callq 0x40d0
leaq 0x88(%rsp), %rbx
leaq 0xa8(%rsp), %rax
movq 0x98(%rsp), %rdi
cmpq %rax, %rdi
je 0x8305
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x42d0
movq 0x78(%rsp), %rdi
cmpq %rbx, %rdi
je 0x831f
movq 0x88(%rsp), %rsi
incq %rsi
callq 0x42d0
movq %r15, %rdi
callq 0x45a0
nop