// File: bothaynahazem[P]AsuMathLabG13/main.cpp
// Function: replaceCos(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
string replaceCos(string s)
{
	if (s.find("cos") != string::npos)
	{
	    string mat_name ="CT";
		int begin = s.find('(', s.find("cos"));
		int end = s.find(')', begin+1);
		string x1 = s.substr(begin+1 , end-begin-1);
		int lengthOfCos = x1.length()+5;
		int start = (s.find("cos"));
		Matrix Y(evaluate(x1));
         Matrix x;
		x=Matrix::cos(Y);
//		char buffer[100];
//		sprintf(buffer, "%f", x);
//		string xstr = buffer;
        if(x.getn()==1)
		s.replace(start, lengthOfCos+1, x.getAltString());
		else
        {
            variables_names[in_cntr] = mat_name;
            mat_name+="X";
            input_matrices[in_cntr] = x;
            s.replace(start, lengthOfCos+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 0x152dd(%rip), %rsi     # 0x1b299
xorl %eax, %eax
movl %eax, %edx
callq 0x3710
cmpq $-0x1, %rax
je 0x63b7
leaq -0x31(%rbp), %rdi
movq %rdi, -0x218(%rbp)
callq 0x3640
movq -0x218(%rbp), %rdx
leaq 0x152b0(%rip), %rsi     # 0x1b29d
leaq -0x30(%rbp), %rdi
callq 0xab40
jmp 0x5ff8
leaq -0x31(%rbp), %rdi
callq 0x3410
movq -0x210(%rbp), %rdi
leaq 0x1528a(%rip), %rsi     # 0x1b299
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 0x6071
leaq -0x70(%rbp), %rdi
movq %rdi, -0x220(%rbp)
callq 0x3550
movq -0x210(%rbp), %rdi
addl $0x5, %eax
movl %eax, -0x74(%rbp)
leaq 0x15204(%rip), %rsi     # 0x1b299
xorl %eax, %eax
movl %eax, %edx
callq 0x3710
movq -0x220(%rbp), %rsi
movl %eax, -0x78(%rbp)
leaq -0xf0(%rbp), %rdi
callq 0x3180
jmp 0x60b6
leaq -0xd0(%rbp), %rdi
leaq -0xf0(%rbp), %rsi
callq 0x45e0
jmp 0x60cb
leaq -0xb0(%rbp), %rdi
leaq -0xd0(%rbp), %rsi
callq 0xf070
jmp 0x60e0
leaq -0xd0(%rbp), %rdi
callq 0x3270
leaq -0xf0(%rbp), %rdi
callq 0x3270
leaq -0x128(%rbp), %rdi
callq 0xe5d0
jmp 0x6106
leaq -0x198(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
callq 0x160b0
jmp 0x611b
leaq -0x160(%rbp), %rdi
leaq -0x128(%rbp), %rsi
leaq -0x198(%rbp), %rdx
callq 0x10e80
jmp 0x6137
leaq -0x160(%rbp), %rdi
callq 0xe650
leaq -0x198(%rbp), %rdi
callq 0xe650
leaq -0x128(%rbp), %rdi
callq 0xabf0
movl %eax, -0x224(%rbp)
jmp 0x6163
movl -0x224(%rbp), %eax
cmpl $0x1, %eax
jne 0x62a3
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 0x61a0
movq -0x230(%rbp), %rdx
movq -0x238(%rbp), %rsi
movq -0x210(%rbp), %rdi
leaq -0x1b8(%rbp), %rcx
callq 0x3150
jmp 0x61c3
leaq -0x1b8(%rbp), %rdi
callq 0x3270
jmp 0x6349
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x31(%rbp), %rdi
callq 0x3410
jmp 0x641b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x63ac
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x63a3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x6236
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 0x63a3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x6397
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x638b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x198(%rbp), %rdi
callq 0xe650
jmp 0x638b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x1b8(%rbp), %rdi
callq 0x3270
jmp 0x638b
movq 0x1c126(%rip), %rdi     # 0x223d0
movslq 0x1c127(%rip), %rax     # 0x223d8
shlq $0x5, %rax
addq %rax, %rdi
leaq -0x30(%rbp), %rsi
callq 0x3040
jmp 0x62c3
leaq 0x14fcd(%rip), %rsi     # 0x1b297
leaq -0x30(%rbp), %rdi
callq 0x33a0
jmp 0x62d5
movq 0x1c0ec(%rip), %rsi     # 0x223c8
movslq 0x1c0f5(%rip), %rax     # 0x223d8
imulq $0x38, %rax, %rax
addq %rax, %rsi
leaq -0x1f0(%rbp), %rdi
leaq -0x128(%rbp), %rdx
callq 0x10e80
jmp 0x62ff
leaq -0x1f0(%rbp), %rdi
callq 0xe650
movq -0x210(%rbp), %rdi
movslq -0x78(%rbp), %rsi
movl -0x74(%rbp), %eax
incl %eax
movslq %eax, %rdx
movq 0x1c0ab(%rip), %rcx     # 0x223d0
movslq 0x1c0ac(%rip), %rax     # 0x223d8
shlq $0x5, %rax
addq %rax, %rcx
callq 0x3150
jmp 0x633a
movl 0x1c098(%rip), %eax     # 0x223d8
addl $0x1, %eax
movl %eax, 0x1c08f(%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 0x640b
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 0x641b
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 0x63e3
leaq -0x1f1(%rbp), %rdi
callq 0x3410
jmp 0x640b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x1f1(%rbp), %rdi
callq 0x3410
jmp 0x641b
movq -0x200(%rbp), %rax
addq $0x240, %rsp            # imm = 0x240
popq %rbp
retq
movq -0x40(%rbp), %rdi
callq 0x3630
nopw %cs:(%rax,%rax)