Given the following C code and unoptimized assembly code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
#include<stdio.h>

long long mod;

void matpow(long long a[3][3],long long k){
  long long i,j,r[3][3],mem[3][3],t;
  for(i=0;i<3;i++){
    for(j=0;j<3;j++){
      if(i==j){r[i][j]=1;}
      else{r[i][j]=0;}
    }
  }
  while(k>0){
    if(k%2==1){
      for(i=0;i<3;i++){
        for(j=0;j<3;j++){
          mem[i][j]=0;
          for(t=0;t<3;t++){
            mem[i][j]+=r[i][t]*a[t][j];
            mem[i][j]%=mod;
          }
        }
      }
      for(i=0;i<3;i++){
        for(j=0;j<3;j++){
          r[i][j]=mem[i][j];
        }
      }
    }
    k/=2;
    for(i=0;i<3;i++){
      for(j=0;j<3;j++){
        mem[i][j]=0;
        for(t=0;t<3;t++){
          mem[i][j]+=a[i][t]*a[t][j];
          mem[i][j]%=mod;
        }
      }
    }
    for(i=0;i<3;i++){
      for(j=0;j<3;j++){
        a[i][j]=mem[i][j];
      }
    }
  }
  for(i=0;i<3;i++){
    for(j=0;j<3;j++){
      a[i][j]=r[i][j];
    }
  }
}

long long power(long long a, long long b){
	long long x = 1, y = a;
	while (b > 0){
		if(b%2){
			x = (x*y)%mod;
		}
		y = (y*y)%mod;
		b /= 2;
	}
	return x%mod;
}

int main(){
  long long l,a,b,k=10,r=0;
  long long st,fi,te;
  long long mat[3][3];
  scanf("%lld%lld%lld%lld",&l,&a,&b,&mod);
  while(l>0){
    if(a>=k){k*=10;continue;}
    st=0;fi=l-1;
    while(st<=fi){
      te=(st+fi)/2;
      if((a+b*te)>=k){fi=te-1;}
      else{st=te+1;}
    }
    if(fi==-1){k*=10;continue;}
    mat[0][0]=k%mod;
    mat[0][1]=(mod-(k%mod))%mod;
    mat[0][2]=0;
    mat[1][0]=0;mat[1][1]=k%mod;mat[1][2]=0;
    mat[2][0]=1;mat[2][1]=0;mat[2][2]=1;
    matpow(mat,fi+1);
    r*=power(k%mod,fi+1);r%=mod;
    r+=(mat[2][0]*((a+fi*b)%mod));r%=mod;
    r+=(mat[2][1]*(b%mod));r%=mod;
    l-=(fi+1);
    a=a+b*st;
    k*=10;
  }
  printf("%lld\n",r);
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	mod
	.bss
	.align 8
	.type	mod, @object
	.size	mod, 8
mod:
	.zero	8
	.text
	.globl	matpow
	.type	matpow, @function
matpow:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$208, %rsp
	movq	%rdi, -200(%rbp)
	movq	%rsi, -208(%rbp)
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movq	$0, -184(%rbp)
	jmp	.L2
.L7:
	movq	$0, -176(%rbp)
	jmp	.L3
.L6:
	movq	-184(%rbp), %rax
	cmpq	-176(%rbp), %rax
	jne	.L4
	movq	-184(%rbp), %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	movq	-176(%rbp), %rdx
	addq	%rdx, %rax
	movq	$1, -160(%rbp,%rax,8)
	jmp	.L5
.L4:
	movq	-184(%rbp), %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	movq	-176(%rbp), %rdx
	addq	%rdx, %rax
	movq	$0, -160(%rbp,%rax,8)
.L5:
	addq	$1, -176(%rbp)
.L3:
	cmpq	$2, -176(%rbp)
	jle	.L6
	addq	$1, -184(%rbp)
.L2:
	cmpq	$2, -184(%rbp)
	jle	.L7
	jmp	.L8
.L30:
	movq	-208(%rbp), %rax
	cqto
	shrq	$63, %rdx
	addq	%rdx, %rax
	andl	$1, %eax
	subq	%rdx, %rax
	cmpq	$1, %rax
	jne	.L9
	movq	$0, -184(%rbp)
	jmp	.L10
.L15:
	movq	$0, -176(%rbp)
	jmp	.L11
.L14:
	movq	-184(%rbp), %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	movq	-176(%rbp), %rdx
	addq	%rdx, %rax
	movq	$0, -80(%rbp,%rax,8)
	movq	$0, -168(%rbp)
	jmp	.L12
.L13:
	movq	-184(%rbp), %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	movq	-176(%rbp), %rdx
	addq	%rdx, %rax
	movq	-80(%rbp,%rax,8), %rsi
	movq	-184(%rbp), %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	movq	-168(%rbp), %rdx
	addq	%rdx, %rax
	movq	-160(%rbp,%rax,8), %rcx
	movq	-168(%rbp), %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	movq	%rax, %rdx
	movq	-200(%rbp), %rax
	addq	%rax, %rdx
	movq	-176(%rbp), %rax
	movq	(%rdx,%rax,8), %rax
	imulq	%rcx, %rax
	leaq	(%rsi,%rax), %rcx
	movq	-184(%rbp), %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	movq	-176(%rbp), %rdx
	addq	%rdx, %rax
	movq	%rcx, -80(%rbp,%rax,8)
	movq	-184(%rbp), %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	movq	-176(%rbp), %rdx
	addq	%rdx, %rax
	movq	-80(%rbp,%rax,8), %rax
	movq	mod(%rip), %rcx
	cqto
	idivq	%rcx
	movq	%rdx, %rcx
	movq	-184(%rbp), %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	movq	-176(%rbp), %rdx
	addq	%rdx, %rax
	movq	%rcx, -80(%rbp,%rax,8)
	addq	$1, -168(%rbp)
.L12:
	cmpq	$2, -168(%rbp)
	jle	.L13
	addq	$1, -176(%rbp)
.L11:
	cmpq	$2, -176(%rbp)
	jle	.L14
	addq	$1, -184(%rbp)
.L10:
	cmpq	$2, -184(%rbp)
	jle	.L15
	movq	$0, -184(%rbp)
	jmp	.L16
.L19:
	movq	$0, -176(%rbp)
	jmp	.L17
.L18:
	movq	-184(%rbp), %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	movq	-176(%rbp), %rdx
	addq	%rdx, %rax
	movq	-80(%rbp,%rax,8), %rdx
	movq	-184(%rbp), %rcx
	movq	%rcx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	movq	-176(%rbp), %rcx
	addq	%rcx, %rax
	movq	%rdx, -160(%rbp,%rax,8)
	addq	$1, -176(%rbp)
.L17:
	cmpq	$2, -176(%rbp)
	jle	.L18
	addq	$1, -184(%rbp)
.L16:
	cmpq	$2, -184(%rbp)
	jle	.L19
.L9:
	movq	-208(%rbp), %rax
	movq	%rax, %rdx
	shrq	$63, %rdx
	addq	%rdx, %rax
	sarq	%rax
	movq	%rax, -208(%rbp)
	movq	$0, -184(%rbp)
	jmp	.L20
.L25:
	movq	$0, -176(%rbp)
	jmp	.L21
.L24:
	movq	-184(%rbp), %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	movq	-176(%rbp), %rdx
	addq	%rdx, %rax
	movq	$0, -80(%rbp,%rax,8)
	movq	$0, -168(%rbp)
	jmp	.L22
.L23:
	movq	-184(%rbp), %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	movq	-176(%rbp), %rdx
	addq	%rdx, %rax
	movq	-80(%rbp,%rax,8), %rsi
	movq	-184(%rbp), %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	movq	%rax, %rdx
	movq	-200(%rbp), %rax
	addq	%rax, %rdx
	movq	-168(%rbp), %rax
	movq	(%rdx,%rax,8), %rcx
	movq	-168(%rbp), %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	movq	%rax, %rdx
	movq	-200(%rbp), %rax
	addq	%rax, %rdx
	movq	-176(%rbp), %rax
	movq	(%rdx,%rax,8), %rax
	imulq	%rcx, %rax
	leaq	(%rsi,%rax), %rcx
	movq	-184(%rbp), %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	movq	-176(%rbp), %rdx
	addq	%rdx, %rax
	movq	%rcx, -80(%rbp,%rax,8)
	movq	-184(%rbp), %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	movq	-176(%rbp), %rdx
	addq	%rdx, %rax
	movq	-80(%rbp,%rax,8), %rax
	movq	mod(%rip), %rcx
	cqto
	idivq	%rcx
	movq	%rdx, %rcx
	movq	-184(%rbp), %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	movq	-176(%rbp), %rdx
	addq	%rdx, %rax
	movq	%rcx, -80(%rbp,%rax,8)
	addq	$1, -168(%rbp)
.L22:
	cmpq	$2, -168(%rbp)
	jle	.L23
	addq	$1, -176(%rbp)
.L21:
	cmpq	$2, -176(%rbp)
	jle	.L24
	addq	$1, -184(%rbp)
.L20:
	cmpq	$2, -184(%rbp)
	jle	.L25
	movq	$0, -184(%rbp)
	jmp	.L26
.L29:
	movq	$0, -176(%rbp)
	jmp	.L27
.L28:
	movq	-184(%rbp), %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	movq	%rax, %rdx
	movq	-200(%rbp), %rax
	leaq	(%rdx,%rax), %rcx
	movq	-184(%rbp), %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	movq	-176(%rbp), %rdx
	addq	%rdx, %rax
	movq	-80(%rbp,%rax,8), %rdx
	movq	-176(%rbp), %rax
	movq	%rdx, (%rcx,%rax,8)
	addq	$1, -176(%rbp)
.L27:
	cmpq	$2, -176(%rbp)
	jle	.L28
	addq	$1, -184(%rbp)
.L26:
	cmpq	$2, -184(%rbp)
	jle	.L29
.L8:
	cmpq	$0, -208(%rbp)
	jg	.L30
	movq	$0, -184(%rbp)
	jmp	.L31
.L34:
	movq	$0, -176(%rbp)
	jmp	.L32
.L33:
	movq	-184(%rbp), %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	movq	%rax, %rdx
	movq	-200(%rbp), %rax
	leaq	(%rdx,%rax), %rcx
	movq	-184(%rbp), %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	movq	-176(%rbp), %rdx
	addq	%rdx, %rax
	movq	-160(%rbp,%rax,8), %rdx
	movq	-176(%rbp), %rax
	movq	%rdx, (%rcx,%rax,8)
	addq	$1, -176(%rbp)
.L32:
	cmpq	$2, -176(%rbp)
	jle	.L33
	addq	$1, -184(%rbp)
.L31:
	cmpq	$2, -184(%rbp)
	jle	.L34
	nop
	movq	-8(%rbp), %rax
	subq	%fs:40, %rax
	je	.L35
	call	__stack_chk_fail@PLT
.L35:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	matpow, .-matpow
	.globl	power
	.type	power, @function
power:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -24(%rbp)
	movq	%rsi, -32(%rbp)
	movq	$1, -16(%rbp)
	movq	-24(%rbp), %rax
	movq	%rax, -8(%rbp)
	jmp	.L37
.L39:
	movq	-32(%rbp), %rax
	andl	$1, %eax
	testq	%rax, %rax
	je	.L38
	movq	-16(%rbp), %rax
	imulq	-8(%rbp), %rax
	movq	mod(%rip), %rcx
	cqto
	idivq	%rcx
	movq	%rdx, -16(%rbp)
.L38:
	movq	-8(%rbp), %rax
	imulq	%rax, %rax
	movq	mod(%rip), %rcx
	cqto
	idivq	%rcx
	movq	%rdx, -8(%rbp)
	movq	-32(%rbp), %rax
	movq	%rax, %rdx
	shrq	$63, %rdx
	addq	%rdx, %rax
	sarq	%rax
	movq	%rax, -32(%rbp)
.L37:
	cmpq	$0, -32(%rbp)
	jg	.L39
	movq	mod(%rip), %rcx
	movq	-16(%rbp), %rax
	cqto
	idivq	%rcx
	movq	%rdx, %rax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	power, .-power
	.section	.rodata
.LC0:
	.string	"%lld%lld%lld%lld"
.LC1:
	.string	"%lld\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB2:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$144, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movq	$10, -120(%rbp)
	movq	$0, -112(%rbp)
	leaq	-128(%rbp), %rcx
	leaq	-136(%rbp), %rdx
	leaq	-144(%rbp), %rax
	leaq	mod(%rip), %r8
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	jmp	.L42
.L48:
	movq	-136(%rbp), %rax
	cmpq	%rax, -120(%rbp)
	jg	.L43
	movq	-120(%rbp), %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	movq	%rax, -120(%rbp)
	jmp	.L42
.L43:
	movq	$0, -104(%rbp)
	movq	-144(%rbp), %rax
	subq	$1, %rax
	movq	%rax, -96(%rbp)
	jmp	.L44
.L46:
	movq	-104(%rbp), %rdx
	movq	-96(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rdx
	shrq	$63, %rdx
	addq	%rdx, %rax
	sarq	%rax
	movq	%rax, -88(%rbp)
	movq	-128(%rbp), %rax
	imulq	-88(%rbp), %rax
	movq	%rax, %rdx
	movq	-136(%rbp), %rax
	addq	%rdx, %rax
	cmpq	%rax, -120(%rbp)
	jg	.L45
	movq	-88(%rbp), %rax
	subq	$1, %rax
	movq	%rax, -96(%rbp)
	jmp	.L44
.L45:
	movq	-88(%rbp), %rax
	addq	$1, %rax
	movq	%rax, -104(%rbp)
.L44:
	movq	-104(%rbp), %rax
	cmpq	-96(%rbp), %rax
	jle	.L46
	cmpq	$-1, -96(%rbp)
	jne	.L47
	movq	-120(%rbp), %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	movq	%rax, -120(%rbp)
	jmp	.L42
.L47:
	movq	mod(%rip), %rcx
	movq	-120(%rbp), %rax
	cqto
	idivq	%rcx
	movq	%rdx, %rax
	movq	%rax, -80(%rbp)
	movq	mod(%rip), %rcx
	movq	mod(%rip), %rsi
	movq	-120(%rbp), %rax
	cqto
	idivq	%rsi
	movq	%rcx, %rax
	subq	%rdx, %rax
	movq	mod(%rip), %rcx
	cqto
	idivq	%rcx
	movq	%rdx, %rax
	movq	%rax, -72(%rbp)
	movq	$0, -64(%rbp)
	movq	$0, -56(%rbp)
	movq	mod(%rip), %rcx
	movq	-120(%rbp), %rax
	cqto
	idivq	%rcx
	movq	%rdx, %rax
	movq	%rax, -48(%rbp)
	movq	$0, -40(%rbp)
	movq	$1, -32(%rbp)
	movq	$0, -24(%rbp)
	movq	$1, -16(%rbp)
	movq	-96(%rbp), %rax
	leaq	1(%rax), %rdx
	leaq	-80(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	matpow
	movq	-96(%rbp), %rax
	leaq	1(%rax), %rcx
	movq	mod(%rip), %rsi
	movq	-120(%rbp), %rax
	cqto
	idivq	%rsi
	movq	%rdx, %rax
	movq	%rcx, %rsi
	movq	%rax, %rdi
	call	power
	movq	-112(%rbp), %rdx
	imulq	%rdx, %rax
	movq	%rax, -112(%rbp)
	movq	mod(%rip), %rcx
	movq	-112(%rbp), %rax
	cqto
	idivq	%rcx
	movq	%rdx, -112(%rbp)
	movq	-32(%rbp), %rcx
	movq	-128(%rbp), %rax
	imulq	-96(%rbp), %rax
	movq	%rax, %rdx
	movq	-136(%rbp), %rax
	addq	%rdx, %rax
	movq	mod(%rip), %rsi
	cqto
	idivq	%rsi
	movq	%rdx, %rax
	imulq	%rcx, %rax
	addq	%rax, -112(%rbp)
	movq	mod(%rip), %rcx
	movq	-112(%rbp), %rax
	cqto
	idivq	%rcx
	movq	%rdx, -112(%rbp)
	movq	-24(%rbp), %rcx
	movq	-128(%rbp), %rax
	movq	mod(%rip), %rsi
	cqto
	idivq	%rsi
	movq	%rdx, %rax
	imulq	%rcx, %rax
	addq	%rax, -112(%rbp)
	movq	mod(%rip), %rcx
	movq	-112(%rbp), %rax
	cqto
	idivq	%rcx
	movq	%rdx, -112(%rbp)
	movq	-144(%rbp), %rax
	movq	-96(%rbp), %rdx
	addq	$1, %rdx
	subq	%rdx, %rax
	movq	%rax, -144(%rbp)
	movq	-128(%rbp), %rax
	imulq	-104(%rbp), %rax
	movq	%rax, %rdx
	movq	-136(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, -136(%rbp)
	movq	-120(%rbp), %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	movq	%rax, -120(%rbp)
.L42:
	movq	-144(%rbp), %rax
	testq	%rax, %rax
	jg	.L48
	movq	-112(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L50
	call	__stack_chk_fail@PLT
.L50:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```

Only output the optimized assembly code. Do not include any other text. Do not write any comments in the assembly code. Wrap the assembly code in ```assembly``` tags.
user
	.file	"temp.c"
	.text
	.p2align 4
	.globl	matpow
	.type	matpow, @function
matpow:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pxor	%xmm0, %xmm0
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movq	%rdi, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$216, %rsp
	.cfi_def_cfa_offset 272
	movdqa	.LC0(%rip), %xmm1
	movq	%rsi, 32(%rsp)
	movq	%fs:40, %rax
	movq	%rax, 200(%rsp)
	xorl	%eax, %eax
	movaps	%xmm1, 128(%rsp)
	movq	$1, 192(%rsp)
	movaps	%xmm0, 144(%rsp)
	movaps	%xmm1, 160(%rsp)
	movaps	%xmm0, 176(%rsp)
	testq	%rsi, %rsi
	jle	.L3
	movq	mod(%rip), %r11
	movq	(%rdi), %rcx
	movq	%r12, 120(%rsp)
	movq	24(%rdi), %r10
	movq	8(%r12), %r13
	movb	$0, 119(%rsp)
	movq	32(%r12), %r9
	movq	56(%r12), %r15
	movq	$1, 64(%rsp)
	movq	16(%r12), %rsi
	movq	40(%r12), %r14
	movq	$0, 56(%rsp)
	movq	64(%r12), %r8
	movq	48(%rdi), %rdi
	movq	%r11, %r12
	movq	$0, 48(%rsp)
	movq	$0, 40(%rsp)
	movq	$1, 104(%rsp)
	movq	$0, 96(%rsp)
	movq	$0, 88(%rsp)
	movq	$0, 80(%rsp)
	movq	$1, 72(%rsp)
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L4:
	movq	%rcx, %rax
	movq	%r10, %rbx
	movq	%rdi, %r11
	movq	%r15, %rbp
	imulq	%rcx, %rax
	imulq	%r13, %rbx
	imulq	%rsi, %r11
	cqto
	idivq	%r12
	leaq	(%rdx,%rbx), %rax
	cqto
	idivq	%r12
	leaq	(%rdx,%r11), %rax
	cqto
	idivq	%r12
	movq	%rcx, %rax
	imulq	%r13, %rax
	movq	%rdx, (%rsp)
	cqto
	movq	(%rsp), %xmm3
	idivq	%r12
	movq	%r13, %rax
	imulq	%r9, %rax
	addq	%rdx, %rax
	cqto
	idivq	%r12
	movq	%r15, %rax
	imulq	%rsi, %rax
	addq	%rdx, %rax
	cqto
	idivq	%r12
	movq	%rcx, %rax
	imulq	%rsi, %rax
	movq	%rdx, 8(%rsp)
	cqto
	idivq	%r12
	movq	%r13, %rax
	movhps	8(%rsp), %xmm3
	imulq	%r14, %rax
	addq	%rdx, %rax
	cqto
	idivq	%r12
	movq	%rsi, %rax
	imulq	%r8, %rax
	addq	%rdx, %rax
	cqto
	idivq	%r12
	movq	%rcx, %rax
	imulq	%r10, %rax
	movq	%rdx, 16(%rsp)
	cqto
	imulq	%r14, %rbp
	movq	16(%rsp), %xmm2
	idivq	%r12
	movq	%r10, %rax
	imulq	%r9, %rax
	addq	%rdx, %rax
	cqto
	idivq	%r12
	movq	%rdi, %rax
	imulq	%r14, %rax
	addq	%rdx, %rax
	cqto
	idivq	%r12
	movq	%rbx, %rax
	movq	%rdx, 24(%rsp)
	cqto
	idivq	%r12
	movq	%r9, %rax
	movhps	24(%rsp), %xmm2
	imulq	%r9, %rax
	addq	%rdx, %rax
	cqto
	idivq	%r12
	leaq	(%rdx,%rbp), %rax
	cqto
	idivq	%r12
	movq	%rsi, %rax
	imulq	%r10, %rax
	movq	%rdx, %rbx
	cqto
	idivq	%r12
	movq	%r9, %rax
	movq	%rbx, %xmm1
	imulq	%r14, %rax
	imulq	%r8, %r14
	addq	%rdx, %rax
	cqto
	idivq	%r12
	leaq	(%rdx,%r14), %rax
	cqto
	idivq	%r12
	movq	%rcx, %rax
	imulq	%rdi, %rax
	movq	%rdx, %xmm4
	movq	%rdx, %r14
	cqto
	idivq	%r12
	imulq	%r15, %r10
	punpcklqdq	%xmm4, %xmm1
	imulq	%r15, %r9
	imulq	%r8, %r15
	leaq	(%rdx,%r10), %rax
	cqto
	idivq	%r12
	movq	%rdi, %rax
	imulq	%r8, %rax
	imulq	%r8, %r8
	addq	%rdx, %rax
	cqto
	idivq	%r12
	movq	%rdi, %rax
	imulq	%r13, %rax
	movq	%rdx, %rcx
	cqto
	idivq	%r12
	movq	%rcx, %xmm0
	leaq	(%rdx,%r9), %rax
	cqto
	idivq	%r12
	leaq	(%rdx,%r15), %rax
	cqto
	idivq	%r12
	movq	%r11, %rax
	movq	%rdx, %xmm5
	movq	%rdx, %r15
	cqto
	idivq	%r12
	punpcklqdq	%xmm5, %xmm0
	leaq	(%rdx,%rbp), %rax
	cqto
	idivq	%r12
	leaq	(%rdx,%r8), %rax
	cqto
	idivq	%r12
	sarq	32(%rsp)
	movq	%rdx, %r8
	je	.L17
	movq	%rcx, %rdi
	movq	16(%rsp), %rsi
	movq	8(%rsp), %r13
	movq	%rbx, %r9
	movq	24(%rsp), %r10
	movq	(%rsp), %rcx
.L5:
	testb	$1, 32(%rsp)
	je	.L4
	movq	72(%rsp), %rbx
	movq	80(%rsp), %r11
	movb	$1, 119(%rsp)
	movq	88(%rsp), %rbp
	movq	%rbx, %rax
	imulq	%rcx, %rax
	cqto
	idivq	%r12
	movq	%r11, %rax
	imulq	%r10, %rax
	addq	%rdx, %rax
	cqto
	idivq	%r12
	movq	%rbp, %rax
	imulq	%rdi, %rax
	addq	%rdx, %rax
	cqto
	idivq	%r12
	movq	%rbx, %rax
	imulq	%r13, %rax
	movq	%rdx, (%rsp)
	cqto
	idivq	%r12
	movq	%r11, %rax
	imulq	%r9, %rax
	addq	%rdx, %rax
	cqto
	idivq	%r12
	movq	%rbp, %rax
	imulq	%r15, %rax
	addq	%rdx, %rax
	cqto
	idivq	%r12
	movq	%rbx, %rax
	movq	96(%rsp), %rbx
	imulq	%rsi, %rax
	movq	%rdx, 8(%rsp)
	cqto
	idivq	%r12
	movq	%r11, %rax
	movq	104(%rsp), %r11
	imulq	%r14, %rax
	addq	%rdx, %rax
	cqto
	idivq	%r12
	movq	%rbp, %rax
	movq	40(%rsp), %rbp
	imulq	%r8, %rax
	addq	%rdx, %rax
	cqto
	idivq	%r12
	movq	%rbx, %rax
	imulq	%rcx, %rax
	movq	%rdx, 88(%rsp)
	cqto
	idivq	%r12
	movq	%r11, %rax
	imulq	%r10, %rax
	addq	%rdx, %rax
	cqto
	idivq	%r12
	movq	%rbp, %rax
	imulq	%rdi, %rax
	addq	%rdx, %rax
	cqto
	idivq	%r12
	movq	%rbx, %rax
	imulq	%r13, %rax
	movq	%rdx, 16(%rsp)
	cqto
	idivq	%r12
	movq	%r11, %rax
	imulq	%r9, %rax
	addq	%rdx, %rax
	cqto
	idivq	%r12
	movq	%rbp, %rax
	imulq	%r15, %rax
	addq	%rdx, %rax
	cqto
	idivq	%r12
	movq	%rbx, %rax
	movq	64(%rsp), %rbx
	imulq	%rsi, %rax
	movq	%rdx, %rbp
	cqto
	idivq	%r12
	movq	%rbp, 104(%rsp)
	movq	%r11, %rax
	movq	48(%rsp), %r11
	imulq	%r14, %rax
	addq	%rdx, %rax
	cqto
	idivq	%r12
	movq	40(%rsp), %rax
	imulq	%r8, %rax
	addq	%rdx, %rax
	cqto
	imulq	%rdi, %rbx
	idivq	%r12
	movq	%r11, %rax
	imulq	%rcx, %rax
	movq	%rdx, 40(%rsp)
	cqto
	idivq	%r12
	movq	56(%rsp), %rax
	imulq	%r10, %rax
	addq	%rdx, %rax
	cqto
	idivq	%r12
	movq	%rbx, %rax
	addq	%rdx, %rax
	cqto
	idivq	%r12
	movq	%r11, %rax
	movq	56(%rsp), %r11
	imulq	%r13, %rax
	imulq	%r9, %r11
	movq	%rdx, %rbx
	cqto
	idivq	%r12
	movq	%r11, %rax
	movq	64(%rsp), %r11
	imulq	%r15, %r11
	addq	%rdx, %rax
	cqto
	idivq	%r12
	movq	%r11, %rax
	addq	%rdx, %rax
	cqto
	idivq	%r12
	movq	48(%rsp), %rax
	movq	%rbx, 48(%rsp)
	imulq	%rsi, %rax
	movq	%rdx, %r11
	cqto
	idivq	%r12
	movq	56(%rsp), %rax
	movq	%r11, 56(%rsp)
	imulq	%r14, %rax
	addq	%rdx, %rax
	cqto
	idivq	%r12
	movq	64(%rsp), %rax
	imulq	%r8, %rax
	addq	%rdx, %rax
	cqto
	idivq	%r12
	movq	16(%rsp), %rax
	movq	%rax, 96(%rsp)
	movq	8(%rsp), %rax
	movq	%rax, 80(%rsp)
	movq	%rdx, 64(%rsp)
	movq	(%rsp), %rdx
	movq	%rdx, 72(%rsp)
	jmp	.L4
.L17:
	movq	120(%rsp), %r12
	cmpb	$0, 119(%rsp)
	movq	%rdx, 64(%r12)
	movups	%xmm3, (%r12)
	movups	%xmm2, 16(%r12)
	movups	%xmm1, 32(%r12)
	movups	%xmm0, 48(%r12)
	je	.L3
	movq	64(%rsp), %rax
	movq	%rax, 192(%rsp)
	movq	56(%rsp), %rax
	movq	%rax, 184(%rsp)
	movq	48(%rsp), %rax
	movq	%rax, 176(%rsp)
	movq	40(%rsp), %rax
	movq	%rax, 168(%rsp)
	movq	104(%rsp), %rax
	movq	%rax, 160(%rsp)
	movq	96(%rsp), %rax
	movq	%rax, 152(%rsp)
	movq	88(%rsp), %rax
	movq	%rax, 144(%rsp)
	movq	80(%rsp), %rax
	movq	%rax, 136(%rsp)
	movq	72(%rsp), %rax
	movq	%rax, 128(%rsp)
.L3:
	movq	176(%rsp), %rax
	movdqa	128(%rsp), %xmm6
	movdqa	144(%rsp), %xmm7
	movq	%rax, 48(%r12)
	movq	184(%rsp), %rax
	movups	%xmm6, (%r12)
	movdqa	160(%rsp), %xmm6
	movq	%rax, 56(%r12)
	movq	192(%rsp), %rax
	movups	%xmm7, 16(%r12)
	movq	%rax, 64(%r12)
	movups	%xmm6, 32(%r12)
	movq	200(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L18
	addq	$216, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
.L18:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	matpow, .-matpow
	.p2align 4
	.globl	power
	.type	power, @function
power:
.LFB24:
	.cfi_startproc
	endbr64
	movq	mod(%rip), %rcx
	movl	$1, %r8d
	testq	%rsi, %rsi
	jle	.L20
	.p2align 4,,10
	.p2align 3
.L22:
	testb	$1, %sil
	je	.L21
	movq	%r8, %rax
	imulq	%rdi, %rax
	cqto
	idivq	%rcx
	movq	%rdx, %r8
.L21:
	imulq	%rdi, %rdi
	movq	%rdi, %rax
	cqto
	idivq	%rcx
	sarq	%rsi
	movq	%rdx, %rdi
	jne	.L22
.L20:
	movq	%r8, %rax
	cqto
	idivq	%rcx
	movq	%rdx, %rax
	ret
	.cfi_endproc
.LFE24:
	.size	power, .-power
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC1:
	.string	"%lld%lld%lld%lld"
.LC2:
	.string	"%lld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB25:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	mod(%rip), %r8
	leaq	.LC1(%rip), %rdi
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$168, %rsp
	.cfi_def_cfa_offset 224
	movq	%fs:40, %rax
	movq	%rax, 152(%rsp)
	xorl	%eax, %eax
	leaq	72(%rsp), %rcx
	leaq	64(%rsp), %rdx
	leaq	56(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movq	56(%rsp), %r9
	testq	%r9, %r9
	jle	.L40
	leaq	80(%rsp), %rdi
	movq	64(%rsp), %r14
	xorl	%r10d, %r10d
	xorl	%r11d, %r11d
	movq	%rdi, 40(%rsp)
	movq	72(%rsp), %r15
	movl	$10, %eax
	leaq	-1(%r9), %rsi
	jmp	.L38
	.p2align 4,,10
	.p2align 3
.L30:
	movq	%r8, %rax
.L38:
	leaq	(%rax,%rax,4), %r8
	addq	%r8, %r8
	cmpq	%r14, %rax
	jle	.L30
	movq	%rsi, %rbx
	xorl	%ebp, %ebp
	.p2align 4,,10
	.p2align 3
.L35:
	leaq	(%rbx,%rbp), %rdx
	movq	%r15, %rcx
	sarq	%rdx
	imulq	%rdx, %rcx
	addq	%r14, %rcx
	cmpq	%rcx, %rax
	jg	.L31
	leaq	-1(%rdx), %rbx
	cmpq	%rbp, %rbx
	jge	.L35
	cmpq	$-1, %rbx
	je	.L30
	.p2align 4,,10
	.p2align 3
.L34:
	cqto
	movq	40(%rsp), %rdi
	leaq	1(%rbx), %rsi
	movq	%r8, 32(%rsp)
	movq	mod(%rip), %r12
	movq	%r9, 24(%rsp)
	movq	%r10, 16(%rsp)
	idivq	%r12
	movq	%r11, 120(%rsp)
	movq	%r11, 136(%rsp)
	movq	%rsi, 8(%rsp)
	movq	$1, 128(%rsp)
	movq	$1, 144(%rsp)
	movq	%r12, %rax
	subq	%rdx, %rax
	movq	%rdx, %r13
	cqto
	movq	%r13, %xmm0
	movq	%r13, 112(%rsp)
	idivq	%r12
	movq	%rdx, %xmm1
	punpcklqdq	%xmm1, %xmm0
	movaps	%xmm0, 80(%rsp)
	pxor	%xmm0, %xmm0
	movaps	%xmm0, 96(%rsp)
	call	matpow
	movq	8(%rsp), %rsi
	movq	32(%rsp), %r8
	movl	$1, %edi
	movq	24(%rsp), %r9
	movq	16(%rsp), %r10
	xorl	%r11d, %r11d
	movq	%rsi, %rcx
	.p2align 4,,10
	.p2align 3
.L37:
	testb	$1, %cl
	je	.L36
	movq	%rdi, %rax
	imulq	%r13, %rax
	cqto
	idivq	%r12
	movq	%rdx, %rdi
.L36:
	movq	%r13, %rax
	imulq	%r13, %rax
	cqto
	idivq	%r12
	sarq	%rcx
	movq	%rdx, %r13
	jne	.L37
	movq	%rdi, %rax
	imulq	%r15, %rbx
	subq	%rsi, %r9
	cqto
	imulq	%r15, %rbp
	movq	%r9, 56(%rsp)
	idivq	%r12
	movq	%rdx, %rax
	imulq	%r10, %rax
	cqto
	idivq	%r12
	leaq	(%rbx,%r14), %rax
	addq	%rbp, %r14
	movq	%r14, 64(%rsp)
	movq	%rdx, %rcx
	cqto
	idivq	%r12
	imulq	128(%rsp), %rdx
	leaq	(%rdx,%rcx), %rax
	cqto
	idivq	%r12
	movq	%r15, %rax
	movq	%rdx, %rcx
	cqto
	idivq	%r12
	imulq	136(%rsp), %rdx
	leaq	(%rdx,%rcx), %rax
	cqto
	idivq	%r12
	movq	%rdx, %r10
	testq	%r9, %r9
	jg	.L50
.L29:
	xorl	%eax, %eax
	movq	%r10, %rdx
	movl	$1, %edi
	leaq	.LC2(%rip), %rsi
	call	__printf_chk@PLT
	movq	152(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L51
	addq	$168, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L31:
	.cfi_restore_state
	leaq	1(%rdx), %rbp
	cmpq	%rbx, %rbp
	jle	.L35
	jmp	.L34
.L50:
	movq	72(%rsp), %r15
	leaq	-1(%r9), %rsi
	jmp	.L30
.L40:
	xorl	%r10d, %r10d
	jmp	.L29
.L51:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE25:
	.size	main, .-main
	.globl	mod
	.bss
	.align 8
	.type	mod, @object
	.size	mod, 8
mod:
	.zero	8
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC0:
	.quad	1
	.quad	0
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:

rule
	.file	"temp.c"
	.text
	.p2align 4
	.globl	matpow
	.type	matpow, @function
matpow:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pxor	%xmm0, %xmm0
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movq	%rdi, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$216, %rsp
	.cfi_def_cfa_offset 272
	movdqa	.LC0(%rip), %xmm1
	movq	%rsi, 32(%rsp)
	movq	%fs:40, %rax
	movq	%rax, 200(%rsp)
	xorl	%eax, %eax
	movaps	%xmm1, 128(%rsp)
	movq	$1, 192(%rsp)
	movaps	%xmm0, 144(%rsp)
	movaps	%xmm1, 160(%rsp)
	movaps	%xmm0, 176(%rsp)
	testq	%rsi, %rsi
	jle	.L3
	movq	mod(%rip), %r11
	movq	(%rdi), %rcx
	movq	%r12, 120(%rsp)
	movq	24(%rdi), %r10
	movq	8(%r12), %r13
	movb	$0, 119(%rsp)
	movq	32(%r12), %r9
	movq	56(%r12), %r15
	movq	$1, 64(%rsp)
	movq	16(%r12), %rsi
	movq	40(%r12), %r14
	movq	$0, 56(%rsp)
	movq	64(%r12), %r8
	movq	48(%rdi), %rdi
	movq	%r11, %r12
	movq	$0, 48(%rsp)
	movq	$0, 40(%rsp)
	movq	$1, 104(%rsp)
	movq	$0, 96(%rsp)
	movq	$0, 88(%rsp)
	movq	$0, 80(%rsp)
	movq	$1, 72(%rsp)
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L4:
	movq	%rcx, %rax
	movq	%r10, %rbx
	movq	%rdi, %r11
	movq	%r15, %rbp
	imulq	%rcx, %rax
	imulq	%r13, %rbx
	imulq	%rsi, %r11
	cqto
	idivq	%r12
	leaq	(%rdx,%rbx), %rax
	cqto
	idivq	%r12
	leaq	(%rdx,%r11), %rax
	cqto
	idivq	%r12
	movq	%rcx, %rax
	imulq	%r13, %rax
	movq	%rdx, (%rsp)
	cqto
	movq	(%rsp), %xmm3
	idivq	%r12
	movq	%r13, %rax
	imulq	%r9, %rax
	addq	%rdx, %rax
	cqto
	idivq	%r12
	movq	%r15, %rax
	imulq	%rsi, %rax
	addq	%rdx, %rax
	cqto
	idivq	%r12
	movq	%rcx, %rax
	imulq	%rsi, %rax
	movq	%rdx, 8(%rsp)
	cqto
	idivq	%r12
	movq	%r13, %rax
	movhps	8(%rsp), %xmm3
	imulq	%r14, %rax
	addq	%rdx, %rax
	cqto
	idivq	%r12
	movq	%rsi, %rax
	imulq	%r8, %rax
	addq	%rdx, %rax
	cqto
	idivq	%r12
	movq	%rcx, %rax
	imulq	%r10, %rax
	movq	%rdx, 16(%rsp)
	cqto
	imulq	%r14, %rbp
	movq	16(%rsp), %xmm2
	idivq	%r12
	movq	%r10, %rax
	imulq	%r9, %rax
	addq	%rdx, %rax
	cqto
	idivq	%r12
	movq	%rdi, %rax
	imulq	%r14, %rax
	addq	%rdx, %rax
	cqto
	idivq	%r12
	movq	%rbx, %rax
	movq	%rdx, 24(%rsp)
	cqto
	idivq	%r12
	movq	%r9, %rax
	movhps	24(%rsp), %xmm2
	imulq	%r9, %rax
	addq	%rdx, %rax
	cqto
	idivq	%r12
	leaq	(%rdx,%rbp), %rax
	cqto
	idivq	%r12
	movq	%rsi, %rax
	imulq	%r10, %rax
	movq	%rdx, %rbx
	cqto
	idivq	%r12
	movq	%r9, %rax
	movq	%rbx, %xmm1
	imulq	%r14, %rax
	imulq	%r8, %r14
	addq	%rdx, %rax
	cqto
	idivq	%r12
	leaq	(%rdx,%r14), %rax
	cqto
	idivq	%r12
	movq	%rcx, %rax
	imulq	%rdi, %rax
	movq	%rdx, %xmm4
	movq	%rdx, %r14
	cqto
	idivq	%r12
	imulq	%r15, %r10
	punpcklqdq	%xmm4, %xmm1
	imulq	%r15, %r9
	imulq	%r8, %r15
	leaq	(%rdx,%r10), %rax
	cqto
	idivq	%r12
	movq	%rdi, %rax
	imulq	%r8, %rax
	imulq	%r8, %r8
	addq	%rdx, %rax
	cqto
	idivq	%r12
	movq	%rdi, %rax
	imulq	%r13, %rax
	movq	%rdx, %rcx
	cqto
	idivq	%r12
	movq	%rcx, %xmm0
	leaq	(%rdx,%r9), %rax
	cqto
	idivq	%r12
	leaq	(%rdx,%r15), %rax
	cqto
	idivq	%r12
	movq	%r11, %rax
	movq	%rdx, %xmm5
	movq	%rdx, %r15
	cqto
	idivq	%r12
	punpcklqdq	%xmm5, %xmm0
	leaq	(%rdx,%rbp), %rax
	cqto
	idivq	%r12
	leaq	(%rdx,%r8), %rax
	cqto
	idivq	%r12
	sarq	32(%rsp)
	movq	%rdx, %r8
	je	.L17
	movq	%rcx, %rdi
	movq	16(%rsp), %rsi
	movq	8(%rsp), %r13
	movq	%rbx, %r9
	movq	24(%rsp), %r10
	movq	(%rsp), %rcx
.L5:
	testb	$1, 32(%rsp)
	je	.L4
	movq	72(%rsp), %rbx
	movq	80(%rsp), %r11
	movb	$1, 119(%rsp)
	movq	88(%rsp), %rbp
	movq	%rbx, %rax
	imulq	%rcx, %rax
	cqto
	idivq	%r12
	movq	%r11, %rax
	imulq	%r10, %rax
	addq	%rdx, %rax
	cqto
	idivq	%r12
	movq	%rbp, %rax
	imulq	%rdi, %rax
	addq	%rdx, %rax
	cqto
	idivq	%r12
	movq	%rbx, %rax
	imulq	%r13, %rax
	movq	%rdx, (%rsp)
	cqto
	idivq	%r12
	movq	%r11, %rax
	imulq	%r9, %rax
	addq	%rdx, %rax
	cqto
	idivq	%r12
	movq	%rbp, %rax
	imulq	%r15, %rax
	addq	%rdx, %rax
	cqto
	idivq	%r12
	movq	%rbx, %rax
	movq	96(%rsp), %rbx
	imulq	%rsi, %rax
	movq	%rdx, 8(%rsp)
	cqto
	idivq	%r12
	movq	%r11, %rax
	movq	104(%rsp), %r11
	imulq	%r14, %rax
	addq	%rdx, %rax
	cqto
	idivq	%r12
	movq	%rbp, %rax
	movq	40(%rsp), %rbp
	imulq	%r8, %rax
	addq	%rdx, %rax
	cqto
	idivq	%r12
	movq	%rbx, %rax
	imulq	%rcx, %rax
	movq	%rdx, 88(%rsp)
	cqto
	idivq	%r12
	movq	%r11, %rax
	imulq	%r10, %rax
	addq	%rdx, %rax
	cqto
	idivq	%r12
	movq	%rbp, %rax
	imulq	%rdi, %rax
	addq	%rdx, %rax
	cqto
	idivq	%r12
	movq	%rbx, %rax
	imulq	%r13, %rax
	movq	%rdx, 16(%rsp)
	cqto
	idivq	%r12
	movq	%r11, %rax
	imulq	%r9, %rax
	addq	%rdx, %rax
	cqto
	idivq	%r12
	movq	%rbp, %rax
	imulq	%r15, %rax
	addq	%rdx, %rax
	cqto
	idivq	%r12
	movq	%rbx, %rax
	movq	64(%rsp), %rbx
	imulq	%rsi, %rax
	movq	%rdx, %rbp
	cqto
	idivq	%r12
	movq	%rbp, 104(%rsp)
	movq	%r11, %rax
	movq	48(%rsp), %r11
	imulq	%r14, %rax
	addq	%rdx, %rax
	cqto
	idivq	%r12
	movq	40(%rsp), %rax
	imulq	%r8, %rax
	addq	%rdx, %rax
	cqto
	imulq	%rdi, %rbx
	idivq	%r12
	movq	%r11, %rax
	imulq	%rcx, %rax
	movq	%rdx, 40(%rsp)
	cqto
	idivq	%r12
	movq	56(%rsp), %rax
	imulq	%r10, %rax
	addq	%rdx, %rax
	cqto
	idivq	%r12
	movq	%rbx, %rax
	addq	%rdx, %rax
	cqto
	idivq	%r12
	movq	%r11, %rax
	movq	56(%rsp), %r11
	imulq	%r13, %rax
	imulq	%r9, %r11
	movq	%rdx, %rbx
	cqto
	idivq	%r12
	movq	%r11, %rax
	movq	64(%rsp), %r11
	imulq	%r15, %r11
	addq	%rdx, %rax
	cqto
	idivq	%r12
	movq	%r11, %rax
	addq	%rdx, %rax
	cqto
	idivq	%r12
	movq	48(%rsp), %rax
	movq	%rbx, 48(%rsp)
	imulq	%rsi, %rax
	movq	%rdx, %r11
	cqto
	idivq	%r12
	movq	56(%rsp), %rax
	movq	%r11, 56(%rsp)
	imulq	%r14, %rax
	addq	%rdx, %rax
	cqto
	idivq	%r12
	movq	64(%rsp), %rax
	imulq	%r8, %rax
	addq	%rdx, %rax
	cqto
	idivq	%r12
	movq	16(%rsp), %rax
	movq	%rax, 96(%rsp)
	movq	8(%rsp), %rax
	movq	%rax, 80(%rsp)
	movq	%rdx, 64(%rsp)
	movq	(%rsp), %rdx
	movq	%rdx, 72(%rsp)
	jmp	.L4
.L17:
	movq	120(%rsp), %r12
	cmpb	$0, 119(%rsp)
	movq	%rdx, 64(%r12)
	movups	%xmm3, (%r12)
	movups	%xmm2, 16(%r12)
	movups	%xmm1, 32(%r12)
	movups	%xmm0, 48(%r12)
	je	.L3
	movq	64(%rsp), %rax
	movq	%rax, 192(%rsp)
	movq	56(%rsp), %rax
	movq	%rax, 184(%rsp)
	movq	48(%rsp), %rax
	movq	%rax, 176(%rsp)
	movq	40(%rsp), %rax
	movq	%rax, 168(%rsp)
	movq	104(%rsp), %rax
	movq	%rax, 160(%rsp)
	movq	96(%rsp), %rax
	movq	%rax, 152(%rsp)
	movq	88(%rsp), %rax
	movq	%rax, 144(%rsp)
	movq	80(%rsp), %rax
	movq	%rax, 136(%rsp)
	movq	72(%rsp), %rax
	movq	%rax, 128(%rsp)
.L3:
	movq	176(%rsp), %rax
	movdqa	128(%rsp), %xmm6
	movdqa	144(%rsp), %xmm7
	movq	%rax, 48(%r12)
	movq	184(%rsp), %rax
	movups	%xmm6, (%r12)
	movdqa	160(%rsp), %xmm6
	movq	%rax, 56(%r12)
	movq	192(%rsp), %rax
	movups	%xmm7, 16(%r12)
	movq	%rax, 64(%r12)
	movups	%xmm6, 32(%r12)
	movq	200(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L18
	addq	$216, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
.L18:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	matpow, .-matpow
	.p2align 4
	.globl	power
	.type	power, @function
power:
.LFB24:
	.cfi_startproc
	endbr64
	movq	mod(%rip), %rcx
	movl	$1, %r8d
	testq	%rsi, %rsi
	jle	.L20
	.p2align 4,,10
	.p2align 3
.L22:
	testb	$1, %sil
	je	.L21
	movq	%r8, %rax
	imulq	%rdi, %rax
	cqto
	idivq	%rcx
	movq	%rdx, %r8
.L21:
	imulq	%rdi, %rdi
	movq	%rdi, %rax
	cqto
	idivq	%rcx
	sarq	%rsi
	movq	%rdx, %rdi
	jne	.L22
.L20:
	movq	%r8, %rax
	cqto
	idivq	%rcx
	movq	%rdx, %rax
	ret
	.cfi_endproc
.LFE24:
	.size	power, .-power
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC1:
	.string	"%lld%lld%lld%lld"
.LC2:
	.string	"%lld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB25:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	mod(%rip), %r8
	leaq	.LC1(%rip), %rdi
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$168, %rsp
	.cfi_def_cfa_offset 224
	movq	%fs:40, %rax
	movq	%rax, 152(%rsp)
	xorl	%eax, %eax
	leaq	72(%rsp), %rcx
	leaq	64(%rsp), %rdx
	leaq	56(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movq	56(%rsp), %r9
	testq	%r9, %r9
	jle	.L40
	leaq	80(%rsp), %rdi
	movq	64(%rsp), %r14
	xorl	%r10d, %r10d
	xorl	%r11d, %r11d
	movq	%rdi, 40(%rsp)
	movq	72(%rsp), %r15
	movl	$10, %eax
	leaq	-1(%r9), %rsi
	jmp	.L38
	.p2align 4,,10
	.p2align 3
.L30:
	movq	%r8, %rax
.L38:
	leaq	(%rax,%rax,4), %r8
	addq	%r8, %r8
	cmpq	%r14, %rax
	jle	.L30
	movq	%rsi, %rbx
	xorl	%ebp, %ebp
	.p2align 4,,10
	.p2align 3
.L35:
	leaq	(%rbx,%rbp), %rdx
	movq	%r15, %rcx
	sarq	%rdx
	imulq	%rdx, %rcx
	addq	%r14, %rcx
	cmpq	%rcx, %rax
	jg	.L31
	leaq	-1(%rdx), %rbx
	cmpq	%rbp, %rbx
	jge	.L35
	cmpq	$-1, %rbx
	je	.L30
	.p2align 4,,10
	.p2align 3
.L34:
	cqto
	movq	40(%rsp), %rdi
	leaq	1(%rbx), %rsi
	movq	%r8, 32(%rsp)
	movq	mod(%rip), %r12
	movq	%r9, 24(%rsp)
	movq	%r10, 16(%rsp)
	idivq	%r12
	movq	%r11, 120(%rsp)
	movq	%r11, 136(%rsp)
	movq	%rsi, 8(%rsp)
	movq	$1, 128(%rsp)
	movq	$1, 144(%rsp)
	movq	%r12, %rax
	subq	%rdx, %rax
	movq	%rdx, %r13
	cqto
	movq	%r13, %xmm0
	movq	%r13, 112(%rsp)
	idivq	%r12
	movq	%rdx, %xmm1
	punpcklqdq	%xmm1, %xmm0
	movaps	%xmm0, 80(%rsp)
	pxor	%xmm0, %xmm0
	movaps	%xmm0, 96(%rsp)
	call	matpow
	movq	8(%rsp), %rsi
	movq	32(%rsp), %r8
	movl	$1, %edi
	movq	24(%rsp), %r9
	movq	16(%rsp), %r10
	xorl	%r11d, %r11d
	movq	%rsi, %rcx
	.p2align 4,,10
	.p2align 3
.L37:
	testb	$1, %cl
	je	.L36
	movq	%rdi, %rax
	imulq	%r13, %rax
	cqto
	idivq	%r12
	movq	%rdx, %rdi
.L36:
	movq	%r13, %rax
	imulq	%r13, %rax
	cqto
	idivq	%r12
	sarq	%rcx
	movq	%rdx, %r13
	jne	.L37
	movq	%rdi, %rax
	imulq	%r15, %rbx
	subq	%rsi, %r9
	cqto
	imulq	%r15, %rbp
	movq	%r9, 56(%rsp)
	idivq	%r12
	movq	%rdx, %rax
	imulq	%r10, %rax
	cqto
	idivq	%r12
	leaq	(%rbx,%r14), %rax
	addq	%rbp, %r14
	movq	%r14, 64(%rsp)
	movq	%rdx, %rcx
	cqto
	idivq	%r12
	imulq	128(%rsp), %rdx
	leaq	(%rdx,%rcx), %rax
	cqto
	idivq	%r12
	movq	%r15, %rax
	movq	%rdx, %rcx
	cqto
	idivq	%r12
	imulq	136(%rsp), %rdx
	leaq	(%rdx,%rcx), %rax
	cqto
	idivq	%r12
	movq	%rdx, %r10
	testq	%r9, %r9
	jg	.L50
.L29:
	xorl	%eax, %eax
	movq	%r10, %rdx
	movl	$1, %edi
	leaq	.LC2(%rip), %rsi
	call	__printf_chk@PLT
	movq	152(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L51
	addq	$168, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L31:
	.cfi_restore_state
	leaq	1(%rdx), %rbp
	cmpq	%rbx, %rbp
	jle	.L35
	jmp	.L34
.L50:
	movq	72(%rsp), %r15
	leaq	-1(%r9), %rsi
	jmp	.L30
.L40:
	xorl	%r10d, %r10d
	jmp	.L29
.L51:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE25:
	.size	main, .-main
	.globl	mod
	.bss
	.align 8
	.type	mod, @object
	.size	mod, 8
mod:
	.zero	8
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC0:
	.quad	1
	.quad	0
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:

#include<stdio.h>

long long mod;

void matpow(long long a[3][3],long long k){
  long long i,j,r[3][3],mem[3][3],t;
  for(i=0;i<3;i++){
    for(j=0;j<3;j++){
      if(i==j){r[i][j]=1;}
      else{r[i][j]=0;}
    }
  }
  while(k>0){
    if(k%2==1){
      for(i=0;i<3;i++){
        for(j=0;j<3;j++){
          mem[i][j]=0;
          for(t=0;t<3;t++){
            mem[i][j]+=r[i][t]*a[t][j];
            mem[i][j]%=mod;
          }
        }
      }
      for(i=0;i<3;i++){
        for(j=0;j<3;j++){
          r[i][j]=mem[i][j];
        }
      }
    }
    k/=2;
    for(i=0;i<3;i++){
      for(j=0;j<3;j++){
        mem[i][j]=0;
        for(t=0;t<3;t++){
          mem[i][j]+=a[i][t]*a[t][j];
          mem[i][j]%=mod;
        }
      }
    }
    for(i=0;i<3;i++){
      for(j=0;j<3;j++){
        a[i][j]=mem[i][j];
      }
    }
  }
  for(i=0;i<3;i++){
    for(j=0;j<3;j++){
      a[i][j]=r[i][j];
    }
  }
}

long long power(long long a, long long b){
	long long x = 1, y = a;
	while (b > 0){
		if(b%2){
			x = (x*y)%mod;
		}
		y = (y*y)%mod;
		b /= 2;
	}
	return x%mod;
}

int main(){
  long long l,a,b,k=10,r=0;
  long long st,fi,te;
  long long mat[3][3];
  scanf("%lld%lld%lld%lld",&l,&a,&b,&mod);
  while(l>0){
    if(a>=k){k*=10;continue;}
    st=0;fi=l-1;
    while(st<=fi){
      te=(st+fi)/2;
      if((a+b*te)>=k){fi=te-1;}
      else{st=te+1;}
    }
    if(fi==-1){k*=10;continue;}
    mat[0][0]=k%mod;
    mat[0][1]=(mod-(k%mod))%mod;
    mat[0][2]=0;
    mat[1][0]=0;mat[1][1]=k%mod;mat[1][2]=0;
    mat[2][0]=1;mat[2][1]=0;mat[2][2]=1;
    matpow(mat,fi+1);
    r*=power(k%mod,fi+1);r%=mod;
    r+=(mat[2][0]*((a+fi*b)%mod));r%=mod;
    r+=(mat[2][1]*(b%mod));r%=mod;
    l-=(fi+1);
    a=a+b*st;
    k*=10;
  }
  printf("%lld\n",r);
}
6 8 1 1000000
 107 10000000000007 1000000000000007 1055093371
 5 5 4 10007
 4 8 1 1001000
 107 10000000000007 1000000000000007 498250141
 2 5 4 10007
 3 8 1 1001000
 107 17664785118816 1000000000000007 498250141
 2 1 4 10007
 3 7 1 1001000

111213
 58425676
 358
 891011
 152045046
 59
 8910
 240202539
 15
 789

Given the following C code and unoptimized assembly code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
#include<stdio.h>

long long mod;

void matpow(long long a[3][3],long long k){
  long long i,j,r[3][3],mem[3][3],t;
  for(i=0;i<3;i++){
    for(j=0;j<3;j++){
      if(i==j){r[i][j]=1;}
      else{r[i][j]=0;}
    }
  }
  while(k>0){
    if(k%2==1){
      for(i=0;i<3;i++){
        for(j=0;j<3;j++){
          mem[i][j]=0;
          for(t=0;t<3;t++){
            mem[i][j]+=r[i][t]*a[t][j];
            mem[i][j]%=mod;
          }
        }
      }
      for(i=0;i<3;i++){
        for(j=0;j<3;j++){
          r[i][j]=mem[i][j];
        }
      }
    }
    k/=2;
    for(i=0;i<3;i++){
      for(j=0;j<3;j++){
        mem[i][j]=0;
        for(t=0;t<3;t++){
          mem[i][j]+=a[i][t]*a[t][j];
          mem[i][j]%=mod;
        }
      }
    }
    for(i=0;i<3;i++){
      for(j=0;j<3;j++){
        a[i][j]=mem[i][j];
      }
    }
  }
  for(i=0;i<3;i++){
    for(j=0;j<3;j++){
      a[i][j]=r[i][j];
    }
  }
}

long long power(long long a, long long b){
	long long x = 1, y = a;
	while (b > 0){
		if(b%2){
			x = (x*y)%mod;
		}
		y = (y*y)%mod;
		b /= 2;
	}
	return x%mod;
}

int main(){
  long long l,a,b,k=10,r=0;
  long long st,fi,te;
  long long mat[3][3];
  scanf("%lld%lld%lld%lld",&l,&a,&b,&mod);
  while(l>0){
    if(a>=k){k*=10;continue;}
    st=0;fi=l-1;
    while(st<=fi){
      te=(st+fi)/2;
      if((a+b*te)>=k){fi=te-1;}
      else{st=te+1;}
    }
    if(fi==-1){k*=10;continue;}
    mat[0][0]=k%mod;
    mat[0][1]=(mod-(k%mod))%mod;
    mat[0][2]=0;
    mat[1][0]=0;mat[1][1]=k%mod;mat[1][2]=0;
    mat[2][0]=1;mat[2][1]=0;mat[2][2]=1;
    matpow(mat,fi+1);
    r*=power(k%mod,fi+1);r%=mod;
    r+=(mat[2][0]*((a+fi*b)%mod));r%=mod;
    r+=(mat[2][1]*(b%mod));r%=mod;
    l-=(fi+1);
    a=a+b*st;
    k*=10;
  }
  printf("%lld\n",r);
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	mod
	.bss
	.align 8
	.type	mod, @object
	.size	mod, 8
mod:
	.zero	8
	.text
	.globl	matpow
	.type	matpow, @function
matpow:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$208, %rsp
	movq	%rdi, -200(%rbp)
	movq	%rsi, -208(%rbp)
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movq	$0, -184(%rbp)
	jmp	.L2
.L7:
	movq	$0, -176(%rbp)
	jmp	.L3
.L6:
	movq	-184(%rbp), %rax
	cmpq	-176(%rbp), %rax
	jne	.L4
	movq	-184(%rbp), %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	movq	-176(%rbp), %rdx
	addq	%rdx, %rax
	movq	$1, -160(%rbp,%rax,8)
	jmp	.L5
.L4:
	movq	-184(%rbp), %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	movq	-176(%rbp), %rdx
	addq	%rdx, %rax
	movq	$0, -160(%rbp,%rax,8)
.L5:
	addq	$1, -176(%rbp)
.L3:
	cmpq	$2, -176(%rbp)
	jle	.L6
	addq	$1, -184(%rbp)
.L2:
	cmpq	$2, -184(%rbp)
	jle	.L7
	jmp	.L8
.L30:
	movq	-208(%rbp), %rax
	cqto
	shrq	$63, %rdx
	addq	%rdx, %rax
	andl	$1, %eax
	subq	%rdx, %rax
	cmpq	$1, %rax
	jne	.L9
	movq	$0, -184(%rbp)
	jmp	.L10
.L15:
	movq	$0, -176(%rbp)
	jmp	.L11
.L14:
	movq	-184(%rbp), %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	movq	-176(%rbp), %rdx
	addq	%rdx, %rax
	movq	$0, -80(%rbp,%rax,8)
	movq	$0, -168(%rbp)
	jmp	.L12
.L13:
	movq	-184(%rbp), %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	movq	-176(%rbp), %rdx
	addq	%rdx, %rax
	movq	-80(%rbp,%rax,8), %rsi
	movq	-184(%rbp), %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	movq	-168(%rbp), %rdx
	addq	%rdx, %rax
	movq	-160(%rbp,%rax,8), %rcx
	movq	-168(%rbp), %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	movq	%rax, %rdx
	movq	-200(%rbp), %rax
	addq	%rax, %rdx
	movq	-176(%rbp), %rax
	movq	(%rdx,%rax,8), %rax
	imulq	%rcx, %rax
	leaq	(%rsi,%rax), %rcx
	movq	-184(%rbp), %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	movq	-176(%rbp), %rdx
	addq	%rdx, %rax
	movq	%rcx, -80(%rbp,%rax,8)
	movq	-184(%rbp), %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	movq	-176(%rbp), %rdx
	addq	%rdx, %rax
	movq	-80(%rbp,%rax,8), %rax
	movq	mod(%rip), %rcx
	cqto
	idivq	%rcx
	movq	%rdx, %rcx
	movq	-184(%rbp), %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	movq	-176(%rbp), %rdx
	addq	%rdx, %rax
	movq	%rcx, -80(%rbp,%rax,8)
	addq	$1, -168(%rbp)
.L12:
	cmpq	$2, -168(%rbp)
	jle	.L13
	addq	$1, -176(%rbp)
.L11:
	cmpq	$2, -176(%rbp)
	jle	.L14
	addq	$1, -184(%rbp)
.L10:
	cmpq	$2, -184(%rbp)
	jle	.L15
	movq	$0, -184(%rbp)
	jmp	.L16
.L19:
	movq	$0, -176(%rbp)
	jmp	.L17
.L18:
	movq	-184(%rbp), %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	movq	-176(%rbp), %rdx
	addq	%rdx, %rax
	movq	-80(%rbp,%rax,8), %rdx
	movq	-184(%rbp), %rcx
	movq	%rcx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	movq	-176(%rbp), %rcx
	addq	%rcx, %rax
	movq	%rdx, -160(%rbp,%rax,8)
	addq	$1, -176(%rbp)
.L17:
	cmpq	$2, -176(%rbp)
	jle	.L18
	addq	$1, -184(%rbp)
.L16:
	cmpq	$2, -184(%rbp)
	jle	.L19
.L9:
	movq	-208(%rbp), %rax
	movq	%rax, %rdx
	shrq	$63, %rdx
	addq	%rdx, %rax
	sarq	%rax
	movq	%rax, -208(%rbp)
	movq	$0, -184(%rbp)
	jmp	.L20
.L25:
	movq	$0, -176(%rbp)
	jmp	.L21
.L24:
	movq	-184(%rbp), %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	movq	-176(%rbp), %rdx
	addq	%rdx, %rax
	movq	$0, -80(%rbp,%rax,8)
	movq	$0, -168(%rbp)
	jmp	.L22
.L23:
	movq	-184(%rbp), %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	movq	-176(%rbp), %rdx
	addq	%rdx, %rax
	movq	-80(%rbp,%rax,8), %rsi
	movq	-184(%rbp), %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	movq	%rax, %rdx
	movq	-200(%rbp), %rax
	addq	%rax, %rdx
	movq	-168(%rbp), %rax
	movq	(%rdx,%rax,8), %rcx
	movq	-168(%rbp), %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	movq	%rax, %rdx
	movq	-200(%rbp), %rax
	addq	%rax, %rdx
	movq	-176(%rbp), %rax
	movq	(%rdx,%rax,8), %rax
	imulq	%rcx, %rax
	leaq	(%rsi,%rax), %rcx
	movq	-184(%rbp), %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	movq	-176(%rbp), %rdx
	addq	%rdx, %rax
	movq	%rcx, -80(%rbp,%rax,8)
	movq	-184(%rbp), %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	movq	-176(%rbp), %rdx
	addq	%rdx, %rax
	movq	-80(%rbp,%rax,8), %rax
	movq	mod(%rip), %rcx
	cqto
	idivq	%rcx
	movq	%rdx, %rcx
	movq	-184(%rbp), %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	movq	-176(%rbp), %rdx
	addq	%rdx, %rax
	movq	%rcx, -80(%rbp,%rax,8)
	addq	$1, -168(%rbp)
.L22:
	cmpq	$2, -168(%rbp)
	jle	.L23
	addq	$1, -176(%rbp)
.L21:
	cmpq	$2, -176(%rbp)
	jle	.L24
	addq	$1, -184(%rbp)
.L20:
	cmpq	$2, -184(%rbp)
	jle	.L25
	movq	$0, -184(%rbp)
	jmp	.L26
.L29:
	movq	$0, -176(%rbp)
	jmp	.L27
.L28:
	movq	-184(%rbp), %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	movq	%rax, %rdx
	movq	-200(%rbp), %rax
	leaq	(%rdx,%rax), %rcx
	movq	-184(%rbp), %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	movq	-176(%rbp), %rdx
	addq	%rdx, %rax
	movq	-80(%rbp,%rax,8), %rdx
	movq	-176(%rbp), %rax
	movq	%rdx, (%rcx,%rax,8)
	addq	$1, -176(%rbp)
.L27:
	cmpq	$2, -176(%rbp)
	jle	.L28
	addq	$1, -184(%rbp)
.L26:
	cmpq	$2, -184(%rbp)
	jle	.L29
.L8:
	cmpq	$0, -208(%rbp)
	jg	.L30
	movq	$0, -184(%rbp)
	jmp	.L31
.L34:
	movq	$0, -176(%rbp)
	jmp	.L32
.L33:
	movq	-184(%rbp), %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	movq	%rax, %rdx
	movq	-200(%rbp), %rax
	leaq	(%rdx,%rax), %rcx
	movq	-184(%rbp), %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	movq	-176(%rbp), %rdx
	addq	%rdx, %rax
	movq	-160(%rbp,%rax,8), %rdx
	movq	-176(%rbp), %rax
	movq	%rdx, (%rcx,%rax,8)
	addq	$1, -176(%rbp)
.L32:
	cmpq	$2, -176(%rbp)
	jle	.L33
	addq	$1, -184(%rbp)
.L31:
	cmpq	$2, -184(%rbp)
	jle	.L34
	nop
	movq	-8(%rbp), %rax
	subq	%fs:40, %rax
	je	.L35
	call	__stack_chk_fail@PLT
.L35:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	matpow, .-matpow
	.globl	power
	.type	power, @function
power:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -24(%rbp)
	movq	%rsi, -32(%rbp)
	movq	$1, -16(%rbp)
	movq	-24(%rbp), %rax
	movq	%rax, -8(%rbp)
	jmp	.L37
.L39:
	movq	-32(%rbp), %rax
	andl	$1, %eax
	testq	%rax, %rax
	je	.L38
	movq	-16(%rbp), %rax
	imulq	-8(%rbp), %rax
	movq	mod(%rip), %rcx
	cqto
	idivq	%rcx
	movq	%rdx, -16(%rbp)
.L38:
	movq	-8(%rbp), %rax
	imulq	%rax, %rax
	movq	mod(%rip), %rcx
	cqto
	idivq	%rcx
	movq	%rdx, -8(%rbp)
	movq	-32(%rbp), %rax
	movq	%rax, %rdx
	shrq	$63, %rdx
	addq	%rdx, %rax
	sarq	%rax
	movq	%rax, -32(%rbp)
.L37:
	cmpq	$0, -32(%rbp)
	jg	.L39
	movq	mod(%rip), %rcx
	movq	-16(%rbp), %rax
	cqto
	idivq	%rcx
	movq	%rdx, %rax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	power, .-power
	.section	.rodata
.LC0:
	.string	"%lld%lld%lld%lld"
.LC1:
	.string	"%lld\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB2:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$144, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movq	$10, -120(%rbp)
	movq	$0, -112(%rbp)
	leaq	-128(%rbp), %rcx
	leaq	-136(%rbp), %rdx
	leaq	-144(%rbp), %rax
	leaq	mod(%rip), %r8
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	jmp	.L42
.L48:
	movq	-136(%rbp), %rax
	cmpq	%rax, -120(%rbp)
	jg	.L43
	movq	-120(%rbp), %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	movq	%rax, -120(%rbp)
	jmp	.L42
.L43:
	movq	$0, -104(%rbp)
	movq	-144(%rbp), %rax
	subq	$1, %rax
	movq	%rax, -96(%rbp)
	jmp	.L44
.L46:
	movq	-104(%rbp), %rdx
	movq	-96(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rdx
	shrq	$63, %rdx
	addq	%rdx, %rax
	sarq	%rax
	movq	%rax, -88(%rbp)
	movq	-128(%rbp), %rax
	imulq	-88(%rbp), %rax
	movq	%rax, %rdx
	movq	-136(%rbp), %rax
	addq	%rdx, %rax
	cmpq	%rax, -120(%rbp)
	jg	.L45
	movq	-88(%rbp), %rax
	subq	$1, %rax
	movq	%rax, -96(%rbp)
	jmp	.L44
.L45:
	movq	-88(%rbp), %rax
	addq	$1, %rax
	movq	%rax, -104(%rbp)
.L44:
	movq	-104(%rbp), %rax
	cmpq	-96(%rbp), %rax
	jle	.L46
	cmpq	$-1, -96(%rbp)
	jne	.L47
	movq	-120(%rbp), %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	movq	%rax, -120(%rbp)
	jmp	.L42
.L47:
	movq	mod(%rip), %rcx
	movq	-120(%rbp), %rax
	cqto
	idivq	%rcx
	movq	%rdx, %rax
	movq	%rax, -80(%rbp)
	movq	mod(%rip), %rcx
	movq	mod(%rip), %rsi
	movq	-120(%rbp), %rax
	cqto
	idivq	%rsi
	movq	%rcx, %rax
	subq	%rdx, %rax
	movq	mod(%rip), %rcx
	cqto
	idivq	%rcx
	movq	%rdx, %rax
	movq	%rax, -72(%rbp)
	movq	$0, -64(%rbp)
	movq	$0, -56(%rbp)
	movq	mod(%rip), %rcx
	movq	-120(%rbp), %rax
	cqto
	idivq	%rcx
	movq	%rdx, %rax
	movq	%rax, -48(%rbp)
	movq	$0, -40(%rbp)
	movq	$1, -32(%rbp)
	movq	$0, -24(%rbp)
	movq	$1, -16(%rbp)
	movq	-96(%rbp), %rax
	leaq	1(%rax), %rdx
	leaq	-80(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	matpow
	movq	-96(%rbp), %rax
	leaq	1(%rax), %rcx
	movq	mod(%rip), %rsi
	movq	-120(%rbp), %rax
	cqto
	idivq	%rsi
	movq	%rdx, %rax
	movq	%rcx, %rsi
	movq	%rax, %rdi
	call	power
	movq	-112(%rbp), %rdx
	imulq	%rdx, %rax
	movq	%rax, -112(%rbp)
	movq	mod(%rip), %rcx
	movq	-112(%rbp), %rax
	cqto
	idivq	%rcx
	movq	%rdx, -112(%rbp)
	movq	-32(%rbp), %rcx
	movq	-128(%rbp), %rax
	imulq	-96(%rbp), %rax
	movq	%rax, %rdx
	movq	-136(%rbp), %rax
	addq	%rdx, %rax
	movq	mod(%rip), %rsi
	cqto
	idivq	%rsi
	movq	%rdx, %rax
	imulq	%rcx, %rax
	addq	%rax, -112(%rbp)
	movq	mod(%rip), %rcx
	movq	-112(%rbp), %rax
	cqto
	idivq	%rcx
	movq	%rdx, -112(%rbp)
	movq	-24(%rbp), %rcx
	movq	-128(%rbp), %rax
	movq	mod(%rip), %rsi
	cqto
	idivq	%rsi
	movq	%rdx, %rax
	imulq	%rcx, %rax
	addq	%rax, -112(%rbp)
	movq	mod(%rip), %rcx
	movq	-112(%rbp), %rax
	cqto
	idivq	%rcx
	movq	%rdx, -112(%rbp)
	movq	-144(%rbp), %rax
	movq	-96(%rbp), %rdx
	addq	$1, %rdx
	subq	%rdx, %rax
	movq	%rax, -144(%rbp)
	movq	-128(%rbp), %rax
	imulq	-104(%rbp), %rax
	movq	%rax, %rdx
	movq	-136(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, -136(%rbp)
	movq	-120(%rbp), %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	movq	%rax, -120(%rbp)
.L42:
	movq	-144(%rbp), %rax
	testq	%rax, %rax
	jg	.L48
	movq	-112(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L50
	call	__stack_chk_fail@PLT
.L50:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```

Only output the optimized assembly code. Do not include any other text. Do not write any comments in the assembly code. Wrap the assembly code in ```assembly``` tags.
train
	.file	"temp.c"
	.text
	.globl	mod
	.bss
	.align 8
	.type	mod, @object
	.size	mod, 8
mod:
	.zero	8
	.text
	.globl	matpow
	.type	matpow, @function
matpow:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$208, %rsp
	movq	%rdi, -200(%rbp)
	movq	%rsi, -208(%rbp)
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movq	$0, -184(%rbp)
	jmp	.L2
.L7:
	movq	$0, -176(%rbp)
	jmp	.L3
.L6:
	movq	-184(%rbp), %rax
	cmpq	-176(%rbp), %rax
	jne	.L4
	movq	-184(%rbp), %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	movq	-176(%rbp), %rdx
	addq	%rdx, %rax
	movq	$1, -160(%rbp,%rax,8)
	jmp	.L5
.L4:
	movq	-184(%rbp), %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	movq	-176(%rbp), %rdx
	addq	%rdx, %rax
	movq	$0, -160(%rbp,%rax,8)
.L5:
	addq	$1, -176(%rbp)
.L3:
	cmpq	$2, -176(%rbp)
	jle	.L6
	addq	$1, -184(%rbp)
.L2:
	cmpq	$2, -184(%rbp)
	jle	.L7
	jmp	.L8
.L30:
	movq	-208(%rbp), %rax
	cqto
	shrq	$63, %rdx
	addq	%rdx, %rax
	andl	$1, %eax
	subq	%rdx, %rax
	cmpq	$1, %rax
	jne	.L9
	movq	$0, -184(%rbp)
	jmp	.L10
.L15:
	movq	$0, -176(%rbp)
	jmp	.L11
.L14:
	movq	-184(%rbp), %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	movq	-176(%rbp), %rdx
	addq	%rdx, %rax
	movq	$0, -80(%rbp,%rax,8)
	movq	$0, -168(%rbp)
	jmp	.L12
.L13:
	movq	-184(%rbp), %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	movq	-176(%rbp), %rdx
	addq	%rdx, %rax
	movq	-80(%rbp,%rax,8), %rsi
	movq	-184(%rbp), %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	movq	-168(%rbp), %rdx
	addq	%rdx, %rax
	movq	-160(%rbp,%rax,8), %rcx
	movq	-168(%rbp), %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	movq	%rax, %rdx
	movq	-200(%rbp), %rax
	addq	%rax, %rdx
	movq	-176(%rbp), %rax
	movq	(%rdx,%rax,8), %rax
	imulq	%rcx, %rax
	leaq	(%rsi,%rax), %rcx
	movq	-184(%rbp), %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	movq	-176(%rbp), %rdx
	addq	%rdx, %rax
	movq	%rcx, -80(%rbp,%rax,8)
	movq	-184(%rbp), %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	movq	-176(%rbp), %rdx
	addq	%rdx, %rax
	movq	-80(%rbp,%rax,8), %rax
	movq	mod(%rip), %rcx
	cqto
	idivq	%rcx
	movq	%rdx, %rcx
	movq	-184(%rbp), %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	movq	-176(%rbp), %rdx
	addq	%rdx, %rax
	movq	%rcx, -80(%rbp,%rax,8)
	addq	$1, -168(%rbp)
.L12:
	cmpq	$2, -168(%rbp)
	jle	.L13
	addq	$1, -176(%rbp)
.L11:
	cmpq	$2, -176(%rbp)
	jle	.L14
	addq	$1, -184(%rbp)
.L10:
	cmpq	$2, -184(%rbp)
	jle	.L15
	movq	$0, -184(%rbp)
	jmp	.L16
.L19:
	movq	$0, -176(%rbp)
	jmp	.L17
.L18:
	movq	-184(%rbp), %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	movq	-176(%rbp), %rdx
	addq	%rdx, %rax
	movq	-80(%rbp,%rax,8), %rdx
	movq	-184(%rbp), %rcx
	movq	%rcx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	movq	-176(%rbp), %rcx
	addq	%rcx, %rax
	movq	%rdx, -160(%rbp,%rax,8)
	addq	$1, -176(%rbp)
.L17:
	cmpq	$2, -176(%rbp)
	jle	.L18
	addq	$1, -184(%rbp)
.L16:
	cmpq	$2, -184(%rbp)
	jle	.L19
.L9:
	movq	-208(%rbp), %rax
	movq	%rax, %rdx
	shrq	$63, %rdx
	addq	%rdx, %rax
	sarq	%rax
	movq	%rax, -208(%rbp)
	movq	$0, -184(%rbp)
	jmp	.L20
.L25:
	movq	$0, -176(%rbp)
	jmp	.L21
.L24:
	movq	-184(%rbp), %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	movq	-176(%rbp), %rdx
	addq	%rdx, %rax
	movq	$0, -80(%rbp,%rax,8)
	movq	$0, -168(%rbp)
	jmp	.L22
.L23:
	movq	-184(%rbp), %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	movq	-176(%rbp), %rdx
	addq	%rdx, %rax
	movq	-80(%rbp,%rax,8), %rsi
	movq	-184(%rbp), %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	movq	%rax, %rdx
	movq	-200(%rbp), %rax
	addq	%rax, %rdx
	movq	-168(%rbp), %rax
	movq	(%rdx,%rax,8), %rcx
	movq	-168(%rbp), %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	movq	%rax, %rdx
	movq	-200(%rbp), %rax
	addq	%rax, %rdx
	movq	-176(%rbp), %rax
	movq	(%rdx,%rax,8), %rax
	imulq	%rcx, %rax
	leaq	(%rsi,%rax), %rcx
	movq	-184(%rbp), %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	movq	-176(%rbp), %rdx
	addq	%rdx, %rax
	movq	%rcx, -80(%rbp,%rax,8)
	movq	-184(%rbp), %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	movq	-176(%rbp), %rdx
	addq	%rdx, %rax
	movq	-80(%rbp,%rax,8), %rax
	movq	mod(%rip), %rcx
	cqto
	idivq	%rcx
	movq	%rdx, %rcx
	movq	-184(%rbp), %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	movq	-176(%rbp), %rdx
	addq	%rdx, %rax
	movq	%rcx, -80(%rbp,%rax,8)
	addq	$1, -168(%rbp)
.L22:
	cmpq	$2, -168(%rbp)
	jle	.L23
	addq	$1, -176(%rbp)
.L21:
	cmpq	$2, -176(%rbp)
	jle	.L24
	addq	$1, -184(%rbp)
.L20:
	cmpq	$2, -184(%rbp)
	jle	.L25
	movq	$0, -184(%rbp)
	jmp	.L26
.L29:
	movq	$0, -176(%rbp)
	jmp	.L27
.L28:
	movq	-184(%rbp), %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	movq	%rax, %rdx
	movq	-200(%rbp), %rax
	leaq	(%rdx,%rax), %rcx
	movq	-184(%rbp), %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	movq	-176(%rbp), %rdx
	addq	%rdx, %rax
	movq	-80(%rbp,%rax,8), %rdx
	movq	-176(%rbp), %rax
	movq	%rdx, (%rcx,%rax,8)
	addq	$1, -176(%rbp)
.L27:
	cmpq	$2, -176(%rbp)
	jle	.L28
	addq	$1, -184(%rbp)
.L26:
	cmpq	$2, -184(%rbp)
	jle	.L29
.L8:
	cmpq	$0, -208(%rbp)
	jg	.L30
	movq	$0, -184(%rbp)
	jmp	.L31
.L34:
	movq	$0, -176(%rbp)
	jmp	.L32
.L33:
	movq	-184(%rbp), %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	movq	%rax, %rdx
	movq	-200(%rbp), %rax
	leaq	(%rdx,%rax), %rcx
	movq	-184(%rbp), %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	movq	-176(%rbp), %rdx
	addq	%rdx, %rax
	movq	-160(%rbp,%rax,8), %rdx
	movq	-176(%rbp), %rax
	movq	%rdx, (%rcx,%rax,8)
	addq	$1, -176(%rbp)
.L32:
	cmpq	$2, -176(%rbp)
	jle	.L33
	addq	$1, -184(%rbp)
.L31:
	cmpq	$2, -184(%rbp)
	jle	.L34
	nop
	movq	-8(%rbp), %rax
	subq	%fs:40, %rax
	je	.L35
	call	__stack_chk_fail@PLT
.L35:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	matpow, .-matpow
	.globl	power
	.type	power, @function
power:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -24(%rbp)
	movq	%rsi, -32(%rbp)
	movq	$1, -16(%rbp)
	movq	-24(%rbp), %rax
	movq	%rax, -8(%rbp)
	jmp	.L37
.L39:
	movq	-32(%rbp), %rax
	andl	$1, %eax
	testq	%rax, %rax
	je	.L38
	movq	-16(%rbp), %rax
	imulq	-8(%rbp), %rax
	movq	mod(%rip), %rcx
	cqto
	idivq	%rcx
	movq	%rdx, -16(%rbp)
.L38:
	movq	-8(%rbp), %rax
	imulq	%rax, %rax
	movq	mod(%rip), %rcx
	cqto
	idivq	%rcx
	movq	%rdx, -8(%rbp)
	movq	-32(%rbp), %rax
	movq	%rax, %rdx
	shrq	$63, %rdx
	addq	%rdx, %rax
	sarq	%rax
	movq	%rax, -32(%rbp)
.L37:
	cmpq	$0, -32(%rbp)
	jg	.L39
	movq	mod(%rip), %rcx
	movq	-16(%rbp), %rax
	cqto
	idivq	%rcx
	movq	%rdx, %rax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	power, .-power
	.section	.rodata
.LC0:
	.string	"%lld%lld%lld%lld"
.LC1:
	.string	"%lld\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB2:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$144, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movq	$10, -120(%rbp)
	movq	$0, -112(%rbp)
	leaq	-128(%rbp), %rcx
	leaq	-136(%rbp), %rdx
	leaq	-144(%rbp), %rax
	leaq	mod(%rip), %r8
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	jmp	.L42
.L48:
	movq	-136(%rbp), %rax
	cmpq	%rax, -120(%rbp)
	jg	.L43
	movq	-120(%rbp), %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	movq	%rax, -120(%rbp)
	jmp	.L42
.L43:
	movq	$0, -104(%rbp)
	movq	-144(%rbp), %rax
	subq	$1, %rax
	movq	%rax, -96(%rbp)
	jmp	.L44
.L46:
	movq	-104(%rbp), %rdx
	movq	-96(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rdx
	shrq	$63, %rdx
	addq	%rdx, %rax
	sarq	%rax
	movq	%rax, -88(%rbp)
	movq	-128(%rbp), %rax
	imulq	-88(%rbp), %rax
	movq	%rax, %rdx
	movq	-136(%rbp), %rax
	addq	%rdx, %rax
	cmpq	%rax, -120(%rbp)
	jg	.L45
	movq	-88(%rbp), %rax
	subq	$1, %rax
	movq	%rax, -96(%rbp)
	jmp	.L44
.L45:
	movq	-88(%rbp), %rax
	addq	$1, %rax
	movq	%rax, -104(%rbp)
.L44:
	movq	-104(%rbp), %rax
	cmpq	-96(%rbp), %rax
	jle	.L46
	cmpq	$-1, -96(%rbp)
	jne	.L47
	movq	-120(%rbp), %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	movq	%rax, -120(%rbp)
	jmp	.L42
.L47:
	movq	mod(%rip), %rcx
	movq	-120(%rbp), %rax
	cqto
	idivq	%rcx
	movq	%rdx, %rax
	movq	%rax, -80(%rbp)
	movq	mod(%rip), %rcx
	movq	mod(%rip), %rsi
	movq	-120(%rbp), %rax
	cqto
	idivq	%rsi
	movq	%rcx, %rax
	subq	%rdx, %rax
	movq	mod(%rip), %rcx
	cqto
	idivq	%rcx
	movq	%rdx, %rax
	movq	%rax, -72(%rbp)
	movq	$0, -64(%rbp)
	movq	$0, -56(%rbp)
	movq	mod(%rip), %rcx
	movq	-120(%rbp), %rax
	cqto
	idivq	%rcx
	movq	%rdx, %rax
	movq	%rax, -48(%rbp)
	movq	$0, -40(%rbp)
	movq	$1, -32(%rbp)
	movq	$0, -24(%rbp)
	movq	$1, -16(%rbp)
	movq	-96(%rbp), %rax
	leaq	1(%rax), %rdx
	leaq	-80(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	matpow
	movq	-96(%rbp), %rax
	leaq	1(%rax), %rcx
	movq	mod(%rip), %rsi
	movq	-120(%rbp), %rax
	cqto
	idivq	%rsi
	movq	%rdx, %rax
	movq	%rcx, %rsi
	movq	%rax, %rdi
	call	power
	movq	-112(%rbp), %rdx
	imulq	%rdx, %rax
	movq	%rax, -112(%rbp)
	movq	mod(%rip), %rcx
	movq	-112(%rbp), %rax
	cqto
	idivq	%rcx
	movq	%rdx, -112(%rbp)
	movq	-32(%rbp), %rcx
	movq	-128(%rbp), %rax
	imulq	-96(%rbp), %rax
	movq	%rax, %rdx
	movq	-136(%rbp), %rax
	addq	%rdx, %rax
	movq	mod(%rip), %rsi
	cqto
	idivq	%rsi
	movq	%rdx, %rax
	imulq	%rcx, %rax
	addq	%rax, -112(%rbp)
	movq	mod(%rip), %rcx
	movq	-112(%rbp), %rax
	cqto
	idivq	%rcx
	movq	%rdx, -112(%rbp)
	movq	-24(%rbp), %rcx
	movq	-128(%rbp), %rax
	movq	mod(%rip), %rsi
	cqto
	idivq	%rsi
	movq	%rdx, %rax
	imulq	%rcx, %rax
	addq	%rax, -112(%rbp)
	movq	mod(%rip), %rcx
	movq	-112(%rbp), %rax
	cqto
	idivq	%rcx
	movq	%rdx, -112(%rbp)
	movq	-144(%rbp), %rax
	movq	-96(%rbp), %rdx
	addq	$1, %rdx
	subq	%rdx, %rax
	movq	%rax, -144(%rbp)
	movq	-128(%rbp), %rax
	imulq	-104(%rbp), %rax
	movq	%rax, %rdx
	movq	-136(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, -136(%rbp)
	movq	-120(%rbp), %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	movq	%rax, -120(%rbp)
.L42:
	movq	-144(%rbp), %rax
	testq	%rax, %rax
	jg	.L48
	movq	-112(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L50
	call	__stack_chk_fail@PLT
.L50:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
