// File: /workspace/github_cpp_makefile_star2_O3/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 0x101c2
movsd 0x1335(%rip), %xmm1     # 0x11160
ucomisd %xmm0, %xmm1
ja 0x101d5
movq %rsi, %r14
movq %rdi, %rbx
xorpd %xmm1, %xmm1
leaq 0x18(%rsi), %rdi
leaq 0x13ab(%rip), %rsi      # 0x111f5
ucomisd %xmm1, %xmm0
jne 0xfe78
jp 0xfe78
callq 0x30e0
testl %eax, %eax
je 0xfebe
movl (%r14), %esi
movl 0x4(%r14), %edx
xorpd %xmm0, %xmm0
movq %rbx, %rdi
movl $0x2, %ecx
callq 0xa262
jmp 0x10110
ucomisd 0x12d8(%rip), %xmm0     # 0x11158
jne 0xff2b
jp 0xff2b
callq 0x30e0
testl %eax, %eax
je 0xffa4
movl (%r14), %esi
movl 0x4(%r14), %edx
xorpd %xmm0, %xmm0
movq %rbx, %rdi
xorl %ecx, %ecx
callq 0xa262
movq %rbx, %rdi
movq %r14, %rsi
callq 0xa5fe
jmp 0x10110
leaq -0x98(%rbp), %r12
movq %r12, -0x10(%r12)
leaq 0x1324(%rip), %rsi      # 0x111f5
leaq 0x1324(%rip), %rdx      # 0x111fc
leaq -0xa8(%rbp), %r15
movq %r15, %rdi
callq 0x93ea
movl (%r14), %edx
movl 0x4(%r14), %ecx
xorpd %xmm0, %xmm0
xorpd %xmm1, %xmm1
movq %rbx, %rdi
movq %r15, %rsi
movl $0x2, %r8d
callq 0x106da
movq -0xa8(%rbp), %rdi
cmpq %r12, %rdi
je 0x10110
movq -0x98(%rbp), %rsi
incq %rsi
callq 0x3300
jmp 0x10110
movsd %xmm0, -0x28(%rbp)
callq 0x30e0
movsd -0x28(%rbp), %xmm0
ucomisd 0x121e(%rip), %xmm0     # 0x11160
jne 0x1000f
jp 0x1000f
testl %eax, %eax
je 0x10076
movl (%r14), %esi
movl 0x4(%r14), %edx
xorpd %xmm0, %xmm0
movq %rbx, %rdi
xorl %ecx, %ecx
callq 0xa262
leaq -0xe0(%rbp), %rdi
movq %r14, %rsi
callq 0xcbbc
leaq -0xe0(%rbp), %rsi
movq %rbx, %rdi
callq 0xa5fe
leaq -0x118(%rbp), %rdi
movq %rbx, %rsi
callq 0xa5a6
leaq -0x118(%rbp), %rdi
jmp 0x100ff
leaq -0x78(%rbp), %r12
movq %r12, -0x10(%r12)
leaq 0x1241(%rip), %rsi      # 0x111f5
leaq 0x1241(%rip), %rdx      # 0x111fc
leaq -0x88(%rbp), %r15
movq %r15, %rdi
callq 0x93ea
movl (%r14), %edx
movl 0x4(%r14), %ecx
xorpd %xmm0, %xmm0
xorpd %xmm1, %xmm1
movq %rbx, %rdi
movq %r15, %rsi
xorl %r8d, %r8d
callq 0x106da
movq -0x88(%rbp), %rdi
cmpq %r12, %rdi
je 0xffff
movq -0x78(%rbp), %rsi
incq %rsi
callq 0x3300
movq %rbx, %rdi
movq %r14, %rsi
callq 0xa5fe
jmp 0x10110
testl %eax, %eax
je 0x10123
movl (%r14), %esi
movl 0x4(%r14), %edx
xorpd %xmm0, %xmm0
movq %rbx, %rdi
xorl %ecx, %ecx
callq 0xa262
movq %rbx, %rdi
movq %r14, %rsi
callq 0xa5fe
movsd -0x28(%rbp), %xmm0
ucomisd 0x1114(%rip), %xmm0     # 0x11158
jbe 0x10110
movl $0x2, %r15d
movq %rbx, %rdi
movq %r14, %rsi
callq 0xc1b6
xorps %xmm0, %xmm0
cvtsi2sd %r15d, %xmm0
incl %r15d
movsd -0x28(%rbp), %xmm1
ucomisd %xmm0, %xmm1
ja 0x10050
jmp 0x10110
leaq -0x58(%rbp), %r12
movq %r12, -0x10(%r12)
leaq 0x116f(%rip), %rsi      # 0x111f5
leaq 0x116f(%rip), %rdx      # 0x111fc
leaq -0x68(%rbp), %r15
movq %r15, %rdi
callq 0x93ea
movl (%r14), %edx
movl 0x4(%r14), %ecx
xorpd %xmm0, %xmm0
xorpd %xmm1, %xmm1
movq %rbx, %rdi
movq %r15, %rsi
xorl %r8d, %r8d
callq 0x106da
movq -0x68(%rbp), %rdi
cmpq %r12, %rdi
je 0x100cb
movq -0x58(%rbp), %rsi
incq %rsi
callq 0x3300
leaq -0xe0(%rbp), %rdi
movq %r14, %rsi
callq 0xcbbc
leaq -0xe0(%rbp), %rsi
movq %rbx, %rdi
callq 0xa5fe
leaq -0x150(%rbp), %rdi
movq %rbx, %rsi
callq 0xa5a6
leaq -0x150(%rbp), %rdi
callq 0xa186
leaq -0xe0(%rbp), %rdi
callq 0xa186
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 0x10c2(%rip), %rsi      # 0x111f5
leaq 0x10c2(%rip), %rdx      # 0x111fc
leaq -0x48(%rbp), %r15
movq %r15, %rdi
callq 0x93ea
movl (%r14), %edx
movl 0x4(%r14), %ecx
xorpd %xmm0, %xmm0
xorpd %xmm1, %xmm1
movq %rbx, %rdi
movq %r15, %rsi
xorl %r8d, %r8d
callq 0x106da
movq -0x48(%rbp), %rdi
cmpq %r12, %rdi
je 0x10178
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x3300
movq %rbx, %rdi
movq %r14, %rsi
callq 0xa5fe
movsd -0x28(%rbp), %xmm0
ucomisd 0xfc8(%rip), %xmm0      # 0x11158
jbe 0x10110
movl $0x2, %r15d
movq %rbx, %rdi
movq %r14, %rsi
callq 0xc1b6
xorps %xmm0, %xmm0
cvtsi2sd %r15d, %xmm0
incl %r15d
movsd -0x28(%rbp), %xmm1
ucomisd %xmm0, %xmm1
ja 0x1019c
jmp 0x10110
movl $0x8, %edi
callq 0x3170
leaq 0x1124(%rip), %rcx      # 0x112f7
jmp 0x101e6
movl $0x8, %edi
callq 0x3170
leaq 0x112b(%rip), %rcx      # 0x11311
movq %rcx, (%rax)
movq 0x5dd0(%rip), %rsi      # 0x15fc0
movq %rax, %rdi
xorl %edx, %edx
callq 0x34d0
jmp 0x10274
movq %rax, %r14
movq -0x48(%rbp), %rdi
cmpq %r12, %rdi
je 0x1027f
movq -0x38(%rbp), %rsi
jmp 0x10268
jmp 0x10274
movq %rax, %r14
movq -0x68(%rbp), %rdi
cmpq %r12, %rdi
je 0x1027f
movq -0x58(%rbp), %rsi
jmp 0x10268
jmp 0x10274
jmp 0x10274
jmp 0x1023f
jmp 0x10274
movq %rax, %r14
movq -0x88(%rbp), %rdi
cmpq %r12, %rdi
je 0x1027f
movq -0x78(%rbp), %rsi
jmp 0x10268
movq %rax, %r14
leaq -0xe0(%rbp), %rdi
callq 0xa186
jmp 0x10277
jmp 0x10274
movq %rax, %r14
movq -0xa8(%rbp), %rdi
cmpq %r12, %rdi
je 0x1027f
movq -0x98(%rbp), %rsi
incq %rsi
callq 0x3300
jmp 0x1027f
jmp 0x10274
movq %rax, %r14
movq %rbx, %rdi
callq 0xa186
movq %r14, %rdi
callq 0x3520
nop