// File: /workspace/github_cpp_makefile_star2_O2/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 $0x258, %rsp            # imm = 0x258
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, 0x18(%rsp)
movq (%rdx), %rdi
movq 0x8(%rdx), %rsi
addq %rdi, %rsi
movb $0x20, %bpl
leaq 0xd0(%rsp), %rbx
movb %bpl, (%rbx)
movq %rbx, %rdx
callq 0x7d7f
movq (%r14), %rdx
addq 0x8(%r14), %rdx
movq %r14, %rdi
movq %rax, %rsi
callq 0x4070
leaq 0x8(%r15), %rdi
movq %r14, %rsi
callq 0x41b0
leaq 0x6616(%rip), %rsi      # 0xd4a9
movq %r14, %rdi
xorl %edx, %edx
callq 0x4640
leaq 0x69af(%rip), %rcx      # 0xd853
pushq $0x1
popq %rdx
movq %r14, %rdi
movq %rax, %rsi
callq 0x41d0
movq (%r14), %rdi
movq 0x8(%r14), %rsi
addq %rdi, %rsi
movb %bpl, (%rbx)
leaq 0xd0(%rsp), %rdx
callq 0x7d7f
movq (%r14), %rdx
addq 0x8(%r14), %rdx
movq %r14, %rdi
movq %rax, %rsi
callq 0x4070
leaq 0xb0(%rsp), %rbx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x4440
leaq 0xd0(%rsp), %rdi
movq %rbx, %rsi
callq 0x9a13
leaq 0xd0(%rsp), %rbx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x43b0
movq %rbx, %rdi
callq 0x4150
leaq 0xb0(%rsp), %rdi
callq 0x4150
leaq 0x657b(%rip), %rsi      # 0xd4ab
leaq 0x70(%rsp), %rdi
leaq 0xd0(%rsp), %rdx
callq 0x5138
leaq 0xa0(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x70(%rsp), %rsi
movq %r14, 0x8(%rsp)
movq %r14, %rdi
xorl %edx, %edx
callq 0x4650
movq %rax, %rbx
leaq 0x60(%r15), %rax
movq %rax, 0x20(%rsp)
leaq 0x88(%r15), %rax
movq %rax, 0x68(%rsp)
leaq 0x90(%rsp), %r13
cmpq $-0x1, %rbx
je 0x7244
movq 0x8(%rsp), %r12
movq %r12, %rdi
leaq 0x6983(%rip), %rsi      # 0xd926
movq %rbx, %rdx
callq 0x4640
movq %rax, %r14
leaq 0x4(%rbx), %rdx
movq %rbx, %rbp
subq %rbx, %r14
incq %r14
leaq 0xd0(%rsp), %rbx
movq %rbx, %rdi
movq %r12, %rsi
movq %r14, %rcx
callq 0x4330
movq %r13, %r12
movq %r13, %rdi
movq %rbx, %rsi
callq 0x43b0
movq %rbx, %rdi
callq 0x4150
movq %rbx, %rdi
callq 0x4220
leaq 0xe0(%rsp), %rdi
movq %r12, %rsi
callq 0x42f0
movq %rbp, %rbx
leaq 0xd0(%rsp), %rdi
leaq 0x4(%rsp), %rsi
callq 0x4420
cmpb $0x28, 0x4(%rsp)
jne 0x70b8
andl $0x0, 0x14(%rsp)
andl $0x0, 0x10(%rsp)
leaq 0xd0(%rsp), %rdi
leaq 0x14(%rsp), %rsi
callq 0x41e0
leaq 0xd0(%rsp), %rdi
leaq 0x4(%rsp), %rsi
callq 0x4420
cmpb $0x2c, 0x4(%rsp)
jne 0x70d0
leaq 0xd0(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x41e0
leaq 0xd0(%rsp), %rdi
leaq 0x4(%rsp), %rsi
callq 0x4420
cmpb $0x29, 0x4(%rsp)
jne 0x70e8
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 0x712b
movb $0x1, 0x58(%r15)
movq 0x20(%rsp), %rdi
leaq 0x63ff(%rip), %rsi      # 0xd4b0
callq 0x4610
jmp 0x70fe
movb $0x1, 0x58(%r15)
movq 0x20(%rsp), %rdi
leaq 0x63e7(%rip), %rsi      # 0xd4b0
callq 0x4610
jmp 0x70fe
movb $0x1, 0x58(%r15)
movq 0x20(%rsp), %rdi
leaq 0x63cf(%rip), %rsi      # 0xd4b0
callq 0x4610
jmp 0x70fe
movb $0x1, 0x58(%r15)
movq 0x20(%rsp), %rdi
leaq 0x63b7(%rip), %rsi      # 0xd4b0
callq 0x4610
movq 0x18(%rsp), %rdi
movq 0x8(%rsp), %rsi
callq 0x43f0
xorl %r14d, %r14d
leaq 0xd0(%rsp), %rdi
callq 0x4250
testb %r14b, %r14b
jne 0x6f8a
jmp 0x7a72
movl %ecx, %ecx
shlq $0x20, %rax
orq %rcx, %rax
movq %rax, 0x40(%rsp)
movq 0x68(%rsp), %rdi
leaq 0x40(%rsp), %rsi
callq 0x6526
movq 0x38(%r15), %rdi
movl 0x14(%rsp), %esi
movl 0x10(%rsp), %edx
movq (%rdi), %rax
callq *0x30(%rax)
movq %rax, %r12
movq %rax, %rdi
callq 0x5356
cmpl 0x28(%r15), %eax
jne 0x7186
movb $0x1, 0x58(%r15)
movq 0x20(%rsp), %rdi
leaq 0x634b(%rip), %rsi      # 0xd4c7
callq 0x4610
jmp 0x70fe
movq (%r12), %rax
movq %r12, %rdi
callq *0x20(%rax)
leaq 0x40(%rsp), %r12
movq %r12, %rdi
callq 0x7bbb
movq 0x8(%rsp), %rbp
movq %rbp, %rdi
movq %rbx, %rsi
movq %r14, %rdx
movq %r12, %rcx
callq 0x40f0
movq %r12, %rdi
callq 0x4150
incq %rbx
movq %rbp, %rdi
leaq 0x70(%rsp), %rsi
movq %rbx, %rdx
callq 0x4650
movq %rax, %rbx
movb $0x1, %r14b
jmp 0x7110
movq 0x18(%rsp), %r14
movq %rax, %rbx
cmpl $0x1, %edx
jne 0x7b57
movq %rbx, %rdi
callq 0x43d0
leaq 0x40(%rsp), %rdi
movq %rax, %rsi
callq 0x45d0
movq %rbx, %rdi
callq 0x4120
movb $0x1, 0x58(%r15)
movq 0x20(%rsp), %rdi
leaq 0x62e3(%rip), %rsi      # 0xd4fb
callq 0x4610
movq %r14, %rdi
movq 0x8(%rsp), %rsi
callq 0x43f0
leaq 0x40(%rsp), %rdi
callq 0x4688
callq 0x4520
xorl %r14d, %r14d
movq %rbp, %rbx
jmp 0x7110
leaq 0x62e1(%rip), %rsi      # 0xd52c
leaq 0x70(%rsp), %rdi
callq 0x4610
leaq 0x70(%rsp), %rsi
movq 0x8(%rsp), %rdi
xorl %edx, %edx
callq 0x4650
movq %rax, %r12
cmpq $-0x1, %r12
je 0x7641
movq 0x8(%rsp), %r14
movq %r14, %rdi
leaq 0x66a4(%rip), %rsi      # 0xd926
movq %r12, %rdx
callq 0x4640
movq %rax, %rbx
leaq 0x3(%r12), %rdx
movq %r12, 0x30(%rsp)
subq %r12, %rbx
incq %rbx
leaq 0xd0(%rsp), %r12
movq %r12, %rdi
movq %r14, %rsi
movq %rbx, %rcx
callq 0x4330
leaq 0x90(%rsp), %r14
movq %r14, %rdi
movq %r12, %rsi
callq 0x43b0
movq %r12, %rdi
callq 0x4150
movq %r12, %rdi
callq 0x4220
leaq 0xe0(%rsp), %rdi
movq %r14, %rsi
callq 0x42f0
movq %r12, %rdi
leaq 0x3(%rsp), %rsi
callq 0x4420
cmpb $0x28, 0x3(%rsp)
jne 0x73f9
andl $0x0, 0x14(%rsp)
andl $0x0, 0x10(%rsp)
andl $0x0, 0x4(%rsp)
andl $0x0, 0x2c(%rsp)
movq %r12, %rdi
leaq 0x14(%rsp), %rsi
callq 0x41e0
movq %r12, %rdi
leaq 0x3(%rsp), %rsi
callq 0x4420
cmpb $0x2c, 0x3(%rsp)
jne 0x7411
movq %r12, %rdi
leaq 0x10(%rsp), %rsi
callq 0x41e0
movq %r12, %rdi
leaq 0x3(%rsp), %rsi
callq 0x4420
cmpb $0x3a, 0x3(%rsp)
jne 0x7429
movq %r12, %rdi
leaq 0x4(%rsp), %rsi
callq 0x41e0
movq %r12, %rdi
leaq 0x3(%rsp), %rsi
callq 0x4420
cmpb $0x2c, 0x3(%rsp)
jne 0x7441
movq %r12, %rdi
leaq 0x2c(%rsp), %rsi
callq 0x41e0
movq %r12, %rdi
leaq 0x3(%rsp), %rsi
callq 0x4420
cmpb $0x29, 0x3(%rsp)
jne 0x7459
movl 0x10(%rsp), %eax
testl %eax, %eax
sete %cl
movl 0x14(%rsp), %esi
testl %esi, %esi
sete %dil
orb %cl, %dil
movl 0x4(%rsp), %r14d
testl %r14d, %r14d
sete %cl
movl 0x2c(%rsp), %edx
testl %edx, %edx
sete %r8b
orb %cl, %r8b
orb %dil, %r8b
cmpb $0x1, %r8b
jne 0x74a0
movb $0x1, 0x58(%r15)
movq 0x20(%rsp), %rdi
leaq 0x613e(%rip), %rsi      # 0xd530
callq 0x4610
jmp 0x746f
movb $0x1, 0x58(%r15)
movq 0x20(%rsp), %rdi
leaq 0x6126(%rip), %rsi      # 0xd530
callq 0x4610
jmp 0x746f
movb $0x1, 0x58(%r15)
movq 0x20(%rsp), %rdi
leaq 0x610e(%rip), %rsi      # 0xd530
callq 0x4610
jmp 0x746f
movb $0x1, 0x58(%r15)
movq 0x20(%rsp), %rdi
leaq 0x60f6(%rip), %rsi      # 0xd530
callq 0x4610
jmp 0x746f
movb $0x1, 0x58(%r15)
movq 0x20(%rsp), %rdi
leaq 0x60de(%rip), %rsi      # 0xd530
callq 0x4610
jmp 0x746f
movb $0x1, 0x58(%r15)
movq 0x20(%rsp), %rdi
leaq 0x60c6(%rip), %rsi      # 0xd530
callq 0x4610
movq 0x18(%rsp), %rdi
movq 0x8(%rsp), %rsi
callq 0x43f0
xorl %ebp, %ebp
leaq 0xd0(%rsp), %rdi
callq 0x4250
testb %bpl, %bpl
movq 0x30(%rsp), %r12
jne 0x7269
jmp 0x7a72
cmpl %r14d, %esi
jle 0x74b2
movl %esi, 0x4(%rsp)
movl %r14d, 0x14(%rsp)
movl %esi, %ecx
jmp 0x74b8
movl %r14d, %ecx
movl %esi, %r14d
cmpl %edx, %eax
jle 0x74c6
movl %eax, 0x2c(%rsp)
movl %edx, 0x10(%rsp)
jmp 0x74c8
movl %edx, %eax
xorpd %xmm0, %xmm0
movsd %xmm0, 0x38(%rsp)
leaq 0x40(%rsp), %r12
cmpl %ecx, %r14d
jg 0x75d2
movl 0x10(%rsp), %r12d
movl %r14d, %r13d
cmpl %eax, %r12d
jg 0x75c6
movq %r12, %rax
shlq $0x20, %rax
orq %r13, %rax
movq %rax, 0x40(%rsp)
movq 0x68(%rsp), %rdi
leaq 0x40(%rsp), %rsi
callq 0x6526
movq 0x38(%r15), %rdi
movq (%rdi), %rax
movl %r14d, %esi
movl %r12d, %edx
callq *0x30(%rax)
movq %rax, %rbp
movq %rax, %rdi
callq 0x5356
cmpl 0x28(%r15), %eax
jne 0x7548
movb $0x1, 0x58(%r15)
movq 0x20(%rsp), %rdi
leaq 0x6005(%rip), %rsi      # 0xd546
callq 0x4610
jmp 0x7562
movq (%rbp), %rax
movq %rbp, %rdi
callq *0x20(%rax)
movsd 0x38(%rsp), %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, 0x38(%rsp)
incl %r12d
movl 0x2c(%rsp), %eax
jmp 0x74e8
movq %rax, %rbp
cmpl $0x1, %edx
jne 0x7b6e
movq %rbp, %rdi
callq 0x43d0
movq %rbp, 0x60(%rsp)
leaq 0x40(%rsp), %rbp
movq %rbp, %rdi
movq %rax, %rsi
callq 0x45d0
movq 0x60(%rsp), %rdi
callq 0x4120
movb $0x1, 0x58(%r15)
movq 0x20(%rsp), %rdi
leaq 0x5f49(%rip), %rsi      # 0xd4fb
callq 0x4610
movq %rbp, %rdi
callq 0x4688
callq 0x4520
jmp 0x7562
incl %r14d
movl 0x4(%rsp), %ecx
jmp 0x74d2
movb 0x58(%r15), %bpl
testb %bpl, %bpl
je 0x75ec
movq 0x18(%rsp), %rdi
movq 0x8(%rsp), %rsi
callq 0x43f0
jmp 0x7638
movq %r12, %rdi
movsd 0x38(%rsp), %xmm0
callq 0x7bbb
movq %r12, %r14
movq 0x8(%rsp), %rdi
movq %rdi, %r13
movq 0x30(%rsp), %r12
movq %r12, %rsi
movq %rbx, %rdx
movq %r14, %rcx
callq 0x40f0
movq %r14, %rdi
callq 0x4150
incq %r12
movq %r13, %rdi
leaq 0x70(%rsp), %rsi
movq %r12, %rdx
callq 0x4650
movq %rax, 0x30(%rsp)
xorb $0x1, %bpl
jmp 0x7480
leaq 0x5f31(%rip), %rsi      # 0xd579
leaq 0x70(%rsp), %rdi
callq 0x4610
leaq 0x70(%rsp), %rsi
movq 0x8(%rsp), %rdi
xorl %edx, %edx
callq 0x4650
movq %rax, %r14
leaq 0xe0(%rsp), %r13
cmpq $-0x1, %r14
je 0x7a63
movq 0x8(%rsp), %r12
movq %r12, %rdi
leaq 0x629f(%rip), %rsi      # 0xd926
movq %r14, %rdx
callq 0x4640
movq %rax, %rbp
leaq 0x3(%r14), %rdx
subq %r14, %rbp
incq %rbp
leaq 0xd0(%rsp), %rbx
movq %rbx, %rdi
movq %r12, %rsi
movq %rbp, %rcx
callq 0x4330
leaq 0x90(%rsp), %r12
movq %r12, %rdi
movq %rbx, %rsi
callq 0x43b0
movq %rbx, %rdi
callq 0x4150
movq %rbx, %rdi
callq 0x4220
movq %r13, %rdi
movq %r12, %rsi
callq 0x42f0
movq %rbx, %rdi
leaq 0x3(%rsp), %rsi
callq 0x4420
cmpb $0x28, 0x3(%rsp)
jne 0x77fd
andl $0x0, 0x14(%rsp)
andl $0x0, 0x10(%rsp)
andl $0x0, 0x4(%rsp)
andl $0x0, 0x2c(%rsp)
movq %rbx, %rdi
leaq 0x14(%rsp), %rsi
callq 0x41e0
movq %rbx, %rdi
leaq 0x3(%rsp), %rsi
callq 0x4420
cmpb $0x2c, 0x3(%rsp)
jne 0x7815
movq %rbx, %rdi
leaq 0x10(%rsp), %rsi
callq 0x41e0
movq %rbx, %rdi
leaq 0x3(%rsp), %rsi
callq 0x4420
cmpb $0x3a, 0x3(%rsp)
jne 0x782d
movq %rbx, %rdi
leaq 0x4(%rsp), %rsi
callq 0x41e0
movq %rbx, %rdi
leaq 0x3(%rsp), %rsi
callq 0x4420
cmpb $0x2c, 0x3(%rsp)
jne 0x7845
movq %rbx, %rdi
leaq 0x2c(%rsp), %rsi
callq 0x41e0
movq %rbx, %rdi
leaq 0x3(%rsp), %rsi
callq 0x4420
cmpb $0x29, 0x3(%rsp)
jne 0x785d
movq %r14, 0x30(%rsp)
movl 0x10(%rsp), %eax
testl %eax, %eax
sete %cl
movl 0x14(%rsp), %esi
testl %esi, %esi
sete %dil
orb %cl, %dil
movl 0x4(%rsp), %r14d
testl %r14d, %r14d
sete %cl
movl 0x2c(%rsp), %edx
testl %edx, %edx
sete %r8b
orb %cl, %r8b
orb %dil, %r8b
cmpb $0x1, %r8b
jne 0x789e
movb $0x1, 0x58(%r15)
movq 0x20(%rsp), %rdi
leaq 0x5d8c(%rip), %rsi      # 0xd57d
callq 0x4610
movq 0x30(%rsp), %r14
jmp 0x7873
movb $0x1, 0x58(%r15)
movq 0x20(%rsp), %rdi
leaq 0x5d6f(%rip), %rsi      # 0xd57d
callq 0x4610
jmp 0x7873
movb $0x1, 0x58(%r15)
movq 0x20(%rsp), %rdi
leaq 0x5d57(%rip), %rsi      # 0xd57d
callq 0x4610
jmp 0x7873
movb $0x1, 0x58(%r15)
movq 0x20(%rsp), %rdi
leaq 0x5d3f(%rip), %rsi      # 0xd57d
callq 0x4610
jmp 0x7873
movb $0x1, 0x58(%r15)
movq 0x20(%rsp), %rdi
leaq 0x5d27(%rip), %rsi      # 0xd57d
callq 0x4610
jmp 0x7873
movb $0x1, 0x58(%r15)
movq 0x20(%rsp), %rdi
leaq 0x5d0f(%rip), %rsi      # 0xd57d
callq 0x4610
movq 0x18(%rsp), %rdi
movq 0x8(%rsp), %rsi
callq 0x43f0
xorl %ebx, %ebx
leaq 0xd0(%rsp), %rdi
callq 0x4250
testb %bl, %bl
jne 0x766e
jmp 0x7a72
cmpl %r14d, %esi
jle 0x78b0
movl %esi, 0x4(%rsp)
movl %r14d, 0x14(%rsp)
movl %esi, %ecx
jmp 0x78b6
movl %r14d, %ecx
movl %esi, %r14d
cmpl %edx, %eax
jle 0x78c4
movl %eax, 0x2c(%rsp)
movl %edx, 0x10(%rsp)
jmp 0x78c6
movl %edx, %eax
xorpd %xmm0, %xmm0
movsd %xmm0, 0x38(%rsp)
leaq 0x40(%rsp), %r12
cmpl %ecx, %r14d
jg 0x79d4
movl 0x10(%rsp), %r12d
movl %r14d, %r13d
cmpl %eax, %r12d
jg 0x79c0
movq %r12, %rax
shlq $0x20, %rax
orq %r13, %rax
movq %rax, 0x40(%rsp)
movq 0x68(%rsp), %rdi
leaq 0x40(%rsp), %rsi
callq 0x6526
movq 0x38(%r15), %rdi
movq (%rdi), %rax
movl %r14d, %esi
movl %r12d, %edx
callq *0x30(%rax)
movq %rax, %rbx
movq %rax, %rdi
callq 0x5356
cmpl 0x28(%r15), %eax
jne 0x7946
movb $0x1, 0x58(%r15)
movq 0x20(%rsp), %rdi
leaq 0x5c54(%rip), %rsi      # 0xd593
callq 0x4610
jmp 0x795f
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x20(%rax)
movsd 0x38(%rsp), %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, 0x38(%rsp)
incl %r12d
movl 0x2c(%rsp), %eax
jmp 0x78e6
cmpl $0x1, %edx
jne 0x7b6b
movq %rax, %rdi
movq %rax, 0x60(%rsp)
callq 0x43d0
leaq 0x40(%rsp), %rbx
movq %rbx, %rdi
movq %rax, %rsi
callq 0x45d0
movq 0x60(%rsp), %rdi
callq 0x4120
movb $0x1, 0x58(%r15)
movq 0x20(%rsp), %rdi
leaq 0x5b4f(%rip), %rsi      # 0xd4fb
callq 0x4610
movq %rbx, %rdi
callq 0x4688
callq 0x4520
jmp 0x795f
incl %r14d
movl 0x4(%rsp), %ecx
leaq 0xe0(%rsp), %r13
jmp 0x78d0
movb 0x58(%r15), %bl
testb %bl, %bl
je 0x79f2
movq 0x18(%rsp), %rdi
movq 0x8(%rsp), %rsi
callq 0x43f0
movq 0x30(%rsp), %r14
jmp 0x7a5b
subl 0x14(%rsp), %ecx
incl %ecx
subl 0x10(%rsp), %eax
incl %eax
imull %ecx, %eax
cvtsi2sd %eax, %xmm1
movsd 0x38(%rsp), %xmm0
divsd %xmm1, %xmm0
movq %r12, %rdi
callq 0x7bbb
movq %r12, %r14
movq 0x8(%rsp), %rdi
movq %rdi, %r13
movq 0x30(%rsp), %r12
movq %r12, %rsi
movq %rbp, %rdx
movq %r14, %rcx
callq 0x40f0
movq %r14, %rdi
callq 0x4150
incq %r12
movq %r13, %rdi
leaq 0x70(%rsp), %rsi
movq %r12, %rdx
callq 0x4650
movq %rax, %r14
leaq 0xe0(%rsp), %r13
xorb $0x1, %bl
jmp 0x7884
movq 0x18(%rsp), %rdi
movq 0x8(%rsp), %rsi
callq 0x43f0
leaq 0x90(%rsp), %rdi
callq 0x4150
leaq 0x70(%rsp), %rdi
callq 0x4150
movq 0x18(%rsp), %rax
addq $0x258, %rsp            # imm = 0x258
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x7b54
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0x4688
callq 0x4520
jmp 0x7b57
jmp 0x7b6b
movq %rax, %rbp
leaq 0x40(%rsp), %rdi
callq 0x4688
callq 0x4520
jmp 0x7b6e
jmp 0x7b6b
movq %rax, %rbp
leaq 0x40(%rsp), %rdi
callq 0x4688
callq 0x4520
jmp 0x7b6e
movq %rax, %rdi
callq 0x535e
jmp 0x7afd
jmp 0x7b6b
movq %rax, %rbp
leaq 0x40(%rsp), %rdi
callq 0x4150
jmp 0x7b6e
jmp 0x7b6b
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0x4150
jmp 0x7b57
jmp 0x7b54
jmp 0x7b49
jmp 0x7b54
movq %rax, %rbp
jmp 0x7b92
movq %rax, %rbp
leaq 0xb0(%rsp), %rdi
jmp 0x7b8d
jmp 0x7b49
jmp 0x7b49
jmp 0x7b6b
jmp 0x7b6b
jmp 0x7b49
jmp 0x7b49
jmp 0x7b6b
jmp 0x7b6b
jmp 0x7b6b
jmp 0x7b49
movq %rax, %rbp
jmp 0x7b7b
jmp 0x7b54
jmp 0x7b6b
jmp 0x7b54
movq %rax, %rbx
leaq 0xd0(%rsp), %rdi
callq 0x4250
movq %rbx, %rbp
jmp 0x7b7b
jmp 0x7b6b
movq %rax, %rbp
leaq 0xd0(%rsp), %rdi
callq 0x4250
leaq 0x90(%rsp), %rdi
callq 0x4150
leaq 0x70(%rsp), %rdi
callq 0x4150
movq %rbp, %rdi
callq 0x4590