// File: /workspace/github_cpp_makefile_star2_O1/bothaynahazem[P]AsuMathLabG13/Matrix2017.cpp
// Function: Matrix::pow(Matrix&, double)
Matrix Matrix::pow(Matrix&s,double x)
{
    if(s.nRows!=s.nColumns)throw("Invalid matrix dimensions");
    if(x<-1)throw("Invalid Power");
    if(x==0)
    {
        if(s.type=="complex")
        {
        Matrix m("complex",s.nRows,s.nColumns,MI_EYE);
        return m;
        }
        else
        {
        Matrix m(s.nRows,s.nColumns,MI_EYE);
        return m;
        }
    }
    else if(x==1)
    {
        if(s.type=="complex")
        {

        Matrix m("complex",s.nRows,s.nColumns);
         m.copy(s);
         return m;
        }
        else{
        Matrix m(s.nRows,s.nColumns);
         m.copy(s);
         return m;
        }
    }
    else if(x==-1)
    {  if(s.type=="complex")
    {
        Matrix m("complex",s.nRows,s.nColumns);
        m=s.getInverse();
        return m;
    }
    else{
        Matrix m(s.nRows,s.nColumns);
        m=s.getInverse();
        return m;
    }
    }
    else
    {
        if(s.type=="complex")
        {
          Matrix m("complex",s.nRows,s.nColumns);
         m.copy(s);
         for(int i=1;i<x;i++)
          {
           m*=s;
           }
          return m;
        }
        else{
      Matrix m(s.nRows,s.nColumns);
      m.copy(s);
      for(int i=1;i<x;i++)
        {
           m*=s;
        }
     return m;
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x130, %rsp            # imm = 0x130
movl (%rsi), %eax
cmpl 0x4(%rsi), %eax
jne 0x10012
movsd 0x14e5(%rip), %xmm1     # 0x11160
ucomisd %xmm0, %xmm1
ja 0x10025
movq %rsi, %r14
movq %rdi, %rbx
xorpd %xmm1, %xmm1
leaq 0x18(%rsi), %rdi
leaq 0x155b(%rip), %rsi      # 0x111f5
ucomisd %xmm1, %xmm0
jne 0xfcc8
jp 0xfcc8
callq 0x30e0
testl %eax, %eax
je 0xfd0e
movl (%r14), %esi
movl 0x4(%r14), %edx
xorpd %xmm0, %xmm0
movq %rbx, %rdi
movl $0x2, %ecx
callq 0xa1a2
jmp 0xff60
ucomisd 0x1488(%rip), %xmm0     # 0x11158
jne 0xfd7b
jp 0xfd7b
callq 0x30e0
testl %eax, %eax
je 0xfdf4
movl (%r14), %esi
movl 0x4(%r14), %edx
xorpd %xmm0, %xmm0
movq %rbx, %rdi
xorl %ecx, %ecx
callq 0xa1a2
movq %rbx, %rdi
movq %r14, %rsi
callq 0xa54e
jmp 0xff60
leaq -0x98(%rbp), %r12
movq %r12, -0x10(%r12)
leaq 0x14d4(%rip), %rsi      # 0x111f5
leaq 0x14d4(%rip), %rdx      # 0x111fc
leaq -0xa8(%rbp), %r15
movq %r15, %rdi
callq 0x9334
movl (%r14), %edx
movl 0x4(%r14), %ecx
xorpd %xmm0, %xmm0
xorpd %xmm1, %xmm1
movq %rbx, %rdi
movq %r15, %rsi
movl $0x2, %r8d
callq 0x10518
movq -0xa8(%rbp), %rdi
cmpq %r12, %rdi
je 0xff60
movq -0x98(%rbp), %rsi
incq %rsi
callq 0x3300
jmp 0xff60
movsd %xmm0, -0x28(%rbp)
callq 0x30e0
movsd -0x28(%rbp), %xmm0
ucomisd 0x13ce(%rip), %xmm0     # 0x11160
jne 0xfe5f
jp 0xfe5f
testl %eax, %eax
je 0xfec6
movl (%r14), %esi
movl 0x4(%r14), %edx
xorpd %xmm0, %xmm0
movq %rbx, %rdi
xorl %ecx, %ecx
callq 0xa1a2
leaq -0xe0(%rbp), %rdi
movq %r14, %rsi
callq 0xcac0
leaq -0xe0(%rbp), %rsi
movq %rbx, %rdi
callq 0xa54e
leaq -0x118(%rbp), %rdi
movq %rbx, %rsi
callq 0xa4f6
leaq -0x118(%rbp), %rdi
jmp 0xff4f
leaq -0x78(%rbp), %r12
movq %r12, -0x10(%r12)
leaq 0x13f1(%rip), %rsi      # 0x111f5
leaq 0x13f1(%rip), %rdx      # 0x111fc
leaq -0x88(%rbp), %r15
movq %r15, %rdi
callq 0x9334
movl (%r14), %edx
movl 0x4(%r14), %ecx
xorpd %xmm0, %xmm0
xorpd %xmm1, %xmm1
movq %rbx, %rdi
movq %r15, %rsi
xorl %r8d, %r8d
callq 0x10518
movq -0x88(%rbp), %rdi
cmpq %r12, %rdi
je 0xfe4f
movq -0x78(%rbp), %rsi
incq %rsi
callq 0x3300
movq %rbx, %rdi
movq %r14, %rsi
callq 0xa54e
jmp 0xff60
testl %eax, %eax
je 0xff73
movl (%r14), %esi
movl 0x4(%r14), %edx
xorpd %xmm0, %xmm0
movq %rbx, %rdi
xorl %ecx, %ecx
callq 0xa1a2
movq %rbx, %rdi
movq %r14, %rsi
callq 0xa54e
movsd -0x28(%rbp), %xmm0
ucomisd 0x12c4(%rip), %xmm0     # 0x11158
jbe 0xff60
movl $0x2, %r15d
movq %rbx, %rdi
movq %r14, %rsi
callq 0xc0c6
xorps %xmm0, %xmm0
cvtsi2sd %r15d, %xmm0
incl %r15d
movsd -0x28(%rbp), %xmm1
ucomisd %xmm0, %xmm1
ja 0xfea0
jmp 0xff60
leaq -0x58(%rbp), %r12
movq %r12, -0x10(%r12)
leaq 0x131f(%rip), %rsi      # 0x111f5
leaq 0x131f(%rip), %rdx      # 0x111fc
leaq -0x68(%rbp), %r15
movq %r15, %rdi
callq 0x9334
movl (%r14), %edx
movl 0x4(%r14), %ecx
xorpd %xmm0, %xmm0
xorpd %xmm1, %xmm1
movq %rbx, %rdi
movq %r15, %rsi
xorl %r8d, %r8d
callq 0x10518
movq -0x68(%rbp), %rdi
cmpq %r12, %rdi
je 0xff1b
movq -0x58(%rbp), %rsi
incq %rsi
callq 0x3300
leaq -0xe0(%rbp), %rdi
movq %r14, %rsi
callq 0xcac0
leaq -0xe0(%rbp), %rsi
movq %rbx, %rdi
callq 0xa54e
leaq -0x150(%rbp), %rdi
movq %rbx, %rsi
callq 0xa4f6
leaq -0x150(%rbp), %rdi
callq 0xa0be
leaq -0xe0(%rbp), %rdi
callq 0xa0be
movq %rbx, %rax
addq $0x130, %rsp            # imm = 0x130
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq -0x38(%rbp), %r12
movq %r12, -0x10(%r12)
leaq 0x1272(%rip), %rsi      # 0x111f5
leaq 0x1272(%rip), %rdx      # 0x111fc
leaq -0x48(%rbp), %r15
movq %r15, %rdi
callq 0x9334
movl (%r14), %edx
movl 0x4(%r14), %ecx
xorpd %xmm0, %xmm0
xorpd %xmm1, %xmm1
movq %rbx, %rdi
movq %r15, %rsi
xorl %r8d, %r8d
callq 0x10518
movq -0x48(%rbp), %rdi
cmpq %r12, %rdi
je 0xffc8
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x3300
movq %rbx, %rdi
movq %r14, %rsi
callq 0xa54e
movsd -0x28(%rbp), %xmm0
ucomisd 0x1178(%rip), %xmm0     # 0x11158
jbe 0xff60
movl $0x2, %r15d
movq %rbx, %rdi
movq %r14, %rsi
callq 0xc0c6
xorps %xmm0, %xmm0
cvtsi2sd %r15d, %xmm0
incl %r15d
movsd -0x28(%rbp), %xmm1
ucomisd %xmm0, %xmm1
ja 0xffec
jmp 0xff60
movl $0x8, %edi
callq 0x3170
leaq 0x12d4(%rip), %rcx      # 0x112f7
jmp 0x10036
movl $0x8, %edi
callq 0x3170
leaq 0x12db(%rip), %rcx      # 0x11311
movq %rcx, (%rax)
movq 0x5f80(%rip), %rsi      # 0x15fc0
movq %rax, %rdi
xorl %edx, %edx
callq 0x34d0
jmp 0x100c4
movq %rax, %r14
movq -0x48(%rbp), %rdi
cmpq %r12, %rdi
je 0x100cf
movq -0x38(%rbp), %rsi
jmp 0x100b8
jmp 0x100c4
movq %rax, %r14
movq -0x68(%rbp), %rdi
cmpq %r12, %rdi
je 0x100cf
movq -0x58(%rbp), %rsi
jmp 0x100b8
jmp 0x100c4
jmp 0x100c4
jmp 0x1008f
jmp 0x100c4
movq %rax, %r14
movq -0x88(%rbp), %rdi
cmpq %r12, %rdi
je 0x100cf
movq -0x78(%rbp), %rsi
jmp 0x100b8
movq %rax, %r14
leaq -0xe0(%rbp), %rdi
callq 0xa0be
jmp 0x100c7
jmp 0x100c4
movq %rax, %r14
movq -0xa8(%rbp), %rdi
cmpq %r12, %rdi
je 0x100cf
movq -0x98(%rbp), %rsi
incq %rsi
callq 0x3300
jmp 0x100cf
jmp 0x100c4
movq %rax, %r14
movq %rbx, %rdi
callq 0xa0be
movq %r14, %rdi
callq 0x3520
nop