// File: bothaynahazem[P]AsuMathLabG13/main.cpp
// Function: replaceSqrt(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
string replaceSqrt(string s)
{
	if (s.find("sqrt") != string::npos)
	{
	    string mat_name ="SST";
		int begin = s.find('(', s.find("sqrt"));
		int end = s.find(')', begin+1);
		string x1 = s.substr(begin+1 , end-begin-1);
		int lengthOfSqrt = x1.length()+6;
		int start = (s.find("sqrt"));
		Matrix Y(evaluate(x1));
		Matrix x;
		x=Matrix::sqrt(Y);
//		char buffer[100];
//		sprintf(buffer, "%f", x);
//		string xstr = buffer;
        if(x.getn()==1)
		s.replace(start, lengthOfSqrt+1, x.getAltString());
		else
        {
            variables_names[in_cntr] = mat_name;
            mat_name+="X";
            input_matrices[in_cntr] = x;
            s.replace(start, lengthOfSqrt+1, variables_names[in_cntr]);
            in_cntr++;
        }
        return s;
	}
	return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x240, %rsp            # imm = 0x240
movq %rsi, -0x210(%rbp)
movq %rdi, %rax
movq -0x210(%rbp), %rdi
movq %rax, -0x208(%rbp)
movq %rax, %rcx
movq %rcx, -0x200(%rbp)
movq %rax, -0x8(%rbp)
movq %rdi, -0x10(%rbp)
leaq 0x13b90(%rip), %rsi     # 0x1b2bc
xorl %eax, %eax
movl %eax, %edx
callq 0x3710
cmpq $-0x1, %rax
je 0x7b27
leaq -0x31(%rbp), %rdi
movq %rdi, -0x218(%rbp)
callq 0x3640
movq -0x218(%rbp), %rdx
leaq 0x13b64(%rip), %rsi     # 0x1b2c1
leaq -0x30(%rbp), %rdi
callq 0xab40
jmp 0x7768
leaq -0x31(%rbp), %rdi
callq 0x3410
movq -0x210(%rbp), %rdi
leaq 0x13b3d(%rip), %rsi     # 0x1b2bc
xorl %eax, %eax
movl %eax, %edx
callq 0x3710
movq -0x210(%rbp), %rdi
movq %rax, %rdx
movl $0x28, %esi
callq 0x34d0
movq -0x210(%rbp), %rdi
movl %eax, -0x48(%rbp)
movl -0x48(%rbp), %eax
incl %eax
movslq %eax, %rdx
movl $0x29, %esi
callq 0x34d0
movq -0x210(%rbp), %rsi
movl %eax, -0x4c(%rbp)
movl -0x48(%rbp), %eax
movl %eax, %ecx
incl %ecx
movslq %ecx, %rdx
movl -0x4c(%rbp), %ecx
notl %eax
addl %ecx, %eax
movslq %eax, %rcx
leaq -0x70(%rbp), %rdi
callq 0x33e0
jmp 0x77e1
leaq -0x70(%rbp), %rdi
movq %rdi, -0x220(%rbp)
callq 0x3550
movq -0x210(%rbp), %rdi
addl $0x6, %eax
movl %eax, -0x74(%rbp)
leaq 0x13ab7(%rip), %rsi     # 0x1b2bc
xorl %eax, %eax
movl %eax, %edx
callq 0x3710
movq -0x220(%rbp), %rsi
movl %eax, -0x78(%rbp)
leaq -0xf0(%rbp), %rdi
callq 0x3180
jmp 0x7826
leaq -0xd0(%rbp), %rdi
leaq -0xf0(%rbp), %rsi
callq 0x45e0
jmp 0x783b
leaq -0xb0(%rbp), %rdi
leaq -0xd0(%rbp), %rsi
callq 0xf070
jmp 0x7850
leaq -0xd0(%rbp), %rdi
callq 0x3270
leaq -0xf0(%rbp), %rdi
callq 0x3270
leaq -0x128(%rbp), %rdi
callq 0xe5d0
jmp 0x7876
leaq -0x198(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
callq 0x17d10
jmp 0x788b
leaq -0x160(%rbp), %rdi
leaq -0x128(%rbp), %rsi
leaq -0x198(%rbp), %rdx
callq 0x10e80
jmp 0x78a7
leaq -0x160(%rbp), %rdi
callq 0xe650
leaq -0x198(%rbp), %rdi
callq 0xe650
leaq -0x128(%rbp), %rdi
callq 0xabf0
movl %eax, -0x224(%rbp)
jmp 0x78d3
movl -0x224(%rbp), %eax
cmpl $0x1, %eax
jne 0x7a13
movslq -0x78(%rbp), %rax
movq %rax, -0x238(%rbp)
movl -0x74(%rbp), %eax
incl %eax
cltq
movq %rax, -0x230(%rbp)
leaq -0x1b8(%rbp), %rdi
leaq -0x128(%rbp), %rsi
callq 0x10af0
jmp 0x7910
movq -0x230(%rbp), %rdx
movq -0x238(%rbp), %rsi
movq -0x210(%rbp), %rdi
leaq -0x1b8(%rbp), %rcx
callq 0x3150
jmp 0x7933
leaq -0x1b8(%rbp), %rdi
callq 0x3270
jmp 0x7ab9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x31(%rbp), %rdi
callq 0x3410
jmp 0x7b8b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x7b1c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x7b13
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x79a6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0xd0(%rbp), %rdi
callq 0x3270
leaq -0xf0(%rbp), %rdi
callq 0x3270
jmp 0x7b13
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x7b07
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x7afb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x198(%rbp), %rdi
callq 0xe650
jmp 0x7afb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x1b8(%rbp), %rdi
callq 0x3270
jmp 0x7afb
movq 0x1a9b6(%rip), %rdi     # 0x223d0
movslq 0x1a9b7(%rip), %rax     # 0x223d8
shlq $0x5, %rax
addq %rax, %rdi
leaq -0x30(%rbp), %rsi
callq 0x3040
jmp 0x7a33
leaq 0x1385d(%rip), %rsi     # 0x1b297
leaq -0x30(%rbp), %rdi
callq 0x33a0
jmp 0x7a45
movq 0x1a97c(%rip), %rsi     # 0x223c8
movslq 0x1a985(%rip), %rax     # 0x223d8
imulq $0x38, %rax, %rax
addq %rax, %rsi
leaq -0x1f0(%rbp), %rdi
leaq -0x128(%rbp), %rdx
callq 0x10e80
jmp 0x7a6f
leaq -0x1f0(%rbp), %rdi
callq 0xe650
movq -0x210(%rbp), %rdi
movslq -0x78(%rbp), %rsi
movl -0x74(%rbp), %eax
incl %eax
movslq %eax, %rdx
movq 0x1a93b(%rip), %rcx     # 0x223d0
movslq 0x1a93c(%rip), %rax     # 0x223d8
shlq $0x5, %rax
addq %rax, %rcx
callq 0x3150
jmp 0x7aaa
movl 0x1a928(%rip), %eax     # 0x223d8
addl $0x1, %eax
movl %eax, 0x1a91f(%rip)     # 0x223d8
movq -0x210(%rbp), %rsi
movq -0x208(%rbp), %rdi
callq 0x3250
leaq -0x128(%rbp), %rdi
callq 0xe650
leaq -0xb0(%rbp), %rdi
callq 0xe650
leaq -0x70(%rbp), %rdi
callq 0x3270
leaq -0x30(%rbp), %rdi
callq 0x3270
jmp 0x7b7b
leaq -0x128(%rbp), %rdi
callq 0xe650
leaq -0xb0(%rbp), %rdi
callq 0xe650
leaq -0x70(%rbp), %rdi
callq 0x3270
leaq -0x30(%rbp), %rdi
callq 0x3270
jmp 0x7b8b
leaq -0x1f1(%rbp), %rdi
movq %rdi, -0x240(%rbp)
callq 0x3640
movq -0x208(%rbp), %rdi
movq -0x240(%rbp), %rdx
xorl %eax, %eax
movl %eax, %esi
callq 0xab40
jmp 0x7b53
leaq -0x1f1(%rbp), %rdi
callq 0x3410
jmp 0x7b7b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x1f1(%rbp), %rdi
callq 0x3410
jmp 0x7b8b
movq -0x200(%rbp), %rax
addq $0x240, %rsp            # imm = 0x240
popq %rbp
retq
movq -0x40(%rbp), %rdi
callq 0x3630
nopw %cs:(%rax,%rax)