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>

int N,M;
int d[1001];
int a[1001];

int main(){
	int i,cor;
	
	while(1){
		scanf("%d%d",&N,&M);
		if(N==0&&M==0)break;
		
		cor = 0;
		for( i = 0;i < N;i++ ){
			scanf("%d",d+i);
		}
		for( i = 0;i < M;i++ ){
			scanf("%d",a+i);
		}
		for( i = 0;i < M;i++ ){
			//printf("%d回目 cor = %d\n",i,cor);
			cor += a[i];
			if( cor >= N-1 )
				break;
			cor += d[cor];
			if( cor >= N-1 )
				break;
		}
		//printf("%d回目 cor = %d\n",i,cor);
		printf("%d\n",i+1);
	}
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	N
	.bss
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	4
	.globl	M
	.align 4
	.type	M, @object
	.size	M, 4
M:
	.zero	4
	.globl	d
	.align 32
	.type	d, @object
	.size	d, 4004
d:
	.zero	4004
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 4004
a:
	.zero	4004
	.section	.rodata
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
.L13:
	leaq	M(%rip), %rax
	movq	%rax, %rdx
	leaq	N(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	N(%rip), %eax
	testl	%eax, %eax
	jne	.L2
	movl	M(%rip), %eax
	testl	%eax, %eax
	je	.L16
.L2:
	movl	$0, -4(%rbp)
	movl	$0, -8(%rbp)
	jmp	.L4
.L5:
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	d(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -8(%rbp)
.L4:
	movl	N(%rip), %eax
	cmpl	%eax, -8(%rbp)
	jl	.L5
	movl	$0, -8(%rbp)
	jmp	.L6
.L7:
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -8(%rbp)
.L6:
	movl	M(%rip), %eax
	cmpl	%eax, -8(%rbp)
	jl	.L7
	movl	$0, -8(%rbp)
	jmp	.L8
.L12:
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, -4(%rbp)
	movl	N(%rip), %eax
	subl	$1, %eax
	cmpl	%eax, -4(%rbp)
	jge	.L17
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	d(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, -4(%rbp)
	movl	N(%rip), %eax
	subl	$1, %eax
	cmpl	%eax, -4(%rbp)
	jge	.L18
	addl	$1, -8(%rbp)
.L8:
	movl	M(%rip), %eax
	cmpl	%eax, -8(%rbp)
	jl	.L12
	jmp	.L10
.L17:
	nop
	jmp	.L10
.L18:
	nop
.L10:
	movl	-8(%rbp), %eax
	addl	$1, %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L13
.L16:
	nop
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.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
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	M(%rip), %r15
	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
	leaq	d(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	leaq	-4+a(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	.LC1(%rip), %rbx
	subq	$8, %rsp
	.cfi_def_cfa_offset 64
	.p2align 4,,10
	.p2align 3
.L13:
	movq	%r15, %rdx
	leaq	N(%rip), %rsi
	leaq	.LC0(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	N(%rip), %eax
	testl	%eax, %eax
	jne	.L21
	movl	M(%rip), %eax
	testl	%eax, %eax
	je	.L22
	leaq	a(%rip), %r14
	xorl	%r13d, %r13d
	testl	%eax, %eax
	jle	.L11
	.p2align 4,,10
	.p2align 3
.L10:
	movq	%r14, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	addl	$1, %r13d
	call	__isoc99_scanf@PLT
	movl	M(%rip), %eax
	addq	$4, %r14
	cmpl	%r13d, %eax
	jg	.L10
	testl	%eax, %eax
	jle	.L11
	movl	N(%rip), %ecx
	leal	1(%rax), %edi
	movl	$1, %edx
	xorl	%eax, %eax
	subl	$1, %ecx
	jmp	.L12
	.p2align 4,,10
	.p2align 3
.L24:
	movslq	%eax, %rsi
	addl	(%r12,%rsi,4), %eax
	cmpl	%eax, %ecx
	jle	.L9
	addq	$1, %rdx
	cmpq	%rdx, %rdi
	je	.L23
.L12:
	addl	0(%rbp,%rdx,4), %eax
	movl	%edx, %r8d
	cmpl	%eax, %ecx
	jg	.L24
.L9:
	movl	%r8d, %edx
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L13
	.p2align 4,,10
	.p2align 3
.L21:
	jle	.L18
	leaq	d(%rip), %r14
	xorl	%r13d, %r13d
	.p2align 4,,10
	.p2align 3
.L7:
	movq	%r14, %rsi
	xorl	%eax, %eax
	movq	%rbx, %rdi
	addl	$1, %r13d
	call	__isoc99_scanf@PLT
	addq	$4, %r14
	cmpl	%r13d, N(%rip)
	jg	.L7
.L18:
	movl	M(%rip), %eax
	leaq	a(%rip), %r14
	xorl	%r13d, %r13d
	testl	%eax, %eax
	jg	.L10
.L11:
	movl	$1, %r8d
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L23:
	addl	$1, %r8d
	jmp	.L9
.L22:
	addq	$8, %rsp
	.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
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.globl	a
	.bss
	.align 32
	.type	a, @object
	.size	a, 4004
a:
	.zero	4004
	.globl	d
	.align 32
	.type	d, @object
	.size	d, 4004
d:
	.zero	4004
	.globl	M
	.align 4
	.type	M, @object
	.size	M, 4
M:
	.zero	4
	.globl	N
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	4
	.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
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	M(%rip), %r15
	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
	leaq	d(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	leaq	-4+a(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	.LC1(%rip), %rbx
	subq	$8, %rsp
	.cfi_def_cfa_offset 64
	.p2align 4,,10
	.p2align 3
.L13:
	movq	%r15, %rdx
	leaq	N(%rip), %rsi
	leaq	.LC0(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	N(%rip), %eax
	testl	%eax, %eax
	jne	.L21
	movl	M(%rip), %eax
	testl	%eax, %eax
	je	.L22
	leaq	a(%rip), %r14
	xorl	%r13d, %r13d
	testl	%eax, %eax
	jle	.L11
	.p2align 4,,10
	.p2align 3
.L10:
	movq	%r14, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	addl	$1, %r13d
	call	__isoc99_scanf@PLT
	movl	M(%rip), %eax
	addq	$4, %r14
	cmpl	%r13d, %eax
	jg	.L10
	testl	%eax, %eax
	jle	.L11
	movl	N(%rip), %ecx
	leal	1(%rax), %edi
	movl	$1, %edx
	xorl	%eax, %eax
	subl	$1, %ecx
	jmp	.L12
	.p2align 4,,10
	.p2align 3
.L24:
	movslq	%eax, %rsi
	addl	(%r12,%rsi,4), %eax
	cmpl	%eax, %ecx
	jle	.L9
	addq	$1, %rdx
	cmpq	%rdx, %rdi
	je	.L23
.L12:
	addl	0(%rbp,%rdx,4), %eax
	movl	%edx, %r8d
	cmpl	%eax, %ecx
	jg	.L24
.L9:
	movl	%r8d, %edx
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L13
	.p2align 4,,10
	.p2align 3
.L21:
	jle	.L18
	leaq	d(%rip), %r14
	xorl	%r13d, %r13d
	.p2align 4,,10
	.p2align 3
.L7:
	movq	%r14, %rsi
	xorl	%eax, %eax
	movq	%rbx, %rdi
	addl	$1, %r13d
	call	__isoc99_scanf@PLT
	addq	$4, %r14
	cmpl	%r13d, N(%rip)
	jg	.L7
.L18:
	movl	M(%rip), %eax
	leaq	a(%rip), %r14
	xorl	%r13d, %r13d
	testl	%eax, %eax
	jg	.L10
.L11:
	movl	$1, %r8d
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L23:
	addl	$1, %r8d
	jmp	.L9
.L22:
	addq	$8, %rsp
	.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
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.globl	a
	.bss
	.align 32
	.type	a, @object
	.size	a, 4004
a:
	.zero	4004
	.globl	d
	.align 32
	.type	d, @object
	.size	d, 4004
d:
	.zero	4004
	.globl	M
	.align 4
	.type	M, @object
	.size	M, 4
M:
	.zero	4
	.globl	N
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	4
	.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>

int N,M;
int d[1001];
int a[1001];

int main(){
	int i,cor;
	
	while(1){
		scanf("%d%d",&N,&M);
		if(N==0&&M==0)break;
		
		cor = 0;
		for( i = 0;i < N;i++ ){
			scanf("%d",d+i);
		}
		for( i = 0;i < M;i++ ){
			scanf("%d",a+i);
		}
		for( i = 0;i < M;i++ ){
			//printf("%d回目 cor = %d\n",i,cor);
			cor += a[i];
			if( cor >= N-1 )
				break;
			cor += d[cor];
			if( cor >= N-1 )
				break;
		}
		//printf("%d回目 cor = %d\n",i,cor);
		printf("%d\n",i+1);
	}
	return 0;
}
10 5
0
0
5
6
-3
8
1
8
-4
0
1
3
5
1
5
10 10
0
-1
-1
4
4
-5
0
1
-6
0
1
5
2
5
6
5
5
4
1
6
0 0
 10 5
0
0
5
6
-2
8
1
8
-4
0
1
3
5
1
5
10 10
0
-1
-1
4
4
-5
0
1
-6
0
2
5
2
4
6
5
5
4
1
6
0 0
 10 5
0
1
5
6
-2
8
1
8
-4
0
1
3
5
1
5
10 10
0
-1
-1
4
4
-5
0
1
-6
0
2
5
2
4
6
5
5
4
1
6
0 0
 10 5
0
0
5
6
-3
8
2
8
-4
0
1
3
5
1
5
10 10
0
-1
-1
4
4
-5
0
1
-6
0
1
5
2
4
6
5
5
4
1
6
0 0
 10 5
0
1
5
6
-2
8
1
8
-4
0
1
3
5
1
5
10 10
0
-1
-1
4
4
-5
0
1
-6
0
3
5
2
4
6
5
5
4
1
6
0 0
 10 5
0
1
5
6
-2
8
1
8
-4
0
1
3
5
1
5
10 10
0
-1
0
4
4
-5
0
1
-6
0
2
5
2
5
6
5
5
4
1
6
0 0
 10 5
0
1
5
6
-2
7
1
8
-5
0
2
1
6
1
5
10 10
0
-1
-1
3
4
-5
0
1
-10
0
2
5
2
5
2
5
3
4
3
6
0 0
 10 5
0
0
5
6
-3
8
1
8
-4
0
2
3
5
1
5
10 10
0
-1
-1
4
4
-5
0
1
-6
0
1
5
1
5
6
5
5
4
1
6
0 0
 10 5
0
2
5
6
-2
8
1
8
-4
0
1
3
5
1
5
10 10
0
-1
0
4
4
-5
0
1
-6
0
2
5
2
5
6
5
5
4
1
6
0 0
 10 5
0
1
5
6
-2
8
1
8
-5
0
2
1
5
1
5
10 10
0
-1
-1
4
4
-5
0
1
-6
0
4
5
2
5
6
5
3
4
3
6
0 0

5
5
 3
5
 2
5
 4
6
 2
2
 2
3
 3
7
 2
6
 3
3
 5
2

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>

int N,M;
int d[1001];
int a[1001];

int main(){
	int i,cor;
	
	while(1){
		scanf("%d%d",&N,&M);
		if(N==0&&M==0)break;
		
		cor = 0;
		for( i = 0;i < N;i++ ){
			scanf("%d",d+i);
		}
		for( i = 0;i < M;i++ ){
			scanf("%d",a+i);
		}
		for( i = 0;i < M;i++ ){
			//printf("%d回目 cor = %d\n",i,cor);
			cor += a[i];
			if( cor >= N-1 )
				break;
			cor += d[cor];
			if( cor >= N-1 )
				break;
		}
		//printf("%d回目 cor = %d\n",i,cor);
		printf("%d\n",i+1);
	}
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	N
	.bss
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	4
	.globl	M
	.align 4
	.type	M, @object
	.size	M, 4
M:
	.zero	4
	.globl	d
	.align 32
	.type	d, @object
	.size	d, 4004
d:
	.zero	4004
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 4004
a:
	.zero	4004
	.section	.rodata
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
.L13:
	leaq	M(%rip), %rax
	movq	%rax, %rdx
	leaq	N(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	N(%rip), %eax
	testl	%eax, %eax
	jne	.L2
	movl	M(%rip), %eax
	testl	%eax, %eax
	je	.L16
.L2:
	movl	$0, -4(%rbp)
	movl	$0, -8(%rbp)
	jmp	.L4
.L5:
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	d(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -8(%rbp)
.L4:
	movl	N(%rip), %eax
	cmpl	%eax, -8(%rbp)
	jl	.L5
	movl	$0, -8(%rbp)
	jmp	.L6
.L7:
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -8(%rbp)
.L6:
	movl	M(%rip), %eax
	cmpl	%eax, -8(%rbp)
	jl	.L7
	movl	$0, -8(%rbp)
	jmp	.L8
.L12:
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, -4(%rbp)
	movl	N(%rip), %eax
	subl	$1, %eax
	cmpl	%eax, -4(%rbp)
	jge	.L17
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	d(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, -4(%rbp)
	movl	N(%rip), %eax
	subl	$1, %eax
	cmpl	%eax, -4(%rbp)
	jge	.L18
	addl	$1, -8(%rbp)
.L8:
	movl	M(%rip), %eax
	cmpl	%eax, -8(%rbp)
	jl	.L12
	jmp	.L10
.L17:
	nop
	jmp	.L10
.L18:
	nop
.L10:
	movl	-8(%rbp), %eax
	addl	$1, %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L13
.L16:
	nop
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.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	N
	.bss
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	4
	.globl	M
	.align 4
	.type	M, @object
	.size	M, 4
M:
	.zero	4
	.globl	d
	.align 32
	.type	d, @object
	.size	d, 4004
d:
	.zero	4004
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 4004
a:
	.zero	4004
	.section	.rodata
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
.L13:
	leaq	M(%rip), %rax
	movq	%rax, %rdx
	leaq	N(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	N(%rip), %eax
	testl	%eax, %eax
	jne	.L2
	movl	M(%rip), %eax
	testl	%eax, %eax
	je	.L16
.L2:
	movl	$0, -4(%rbp)
	movl	$0, -8(%rbp)
	jmp	.L4
.L5:
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	d(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -8(%rbp)
.L4:
	movl	N(%rip), %eax
	cmpl	%eax, -8(%rbp)
	jl	.L5
	movl	$0, -8(%rbp)
	jmp	.L6
.L7:
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -8(%rbp)
.L6:
	movl	M(%rip), %eax
	cmpl	%eax, -8(%rbp)
	jl	.L7
	movl	$0, -8(%rbp)
	jmp	.L8
.L12:
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, -4(%rbp)
	movl	N(%rip), %eax
	subl	$1, %eax
	cmpl	%eax, -4(%rbp)
	jge	.L17
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	d(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, -4(%rbp)
	movl	N(%rip), %eax
	subl	$1, %eax
	cmpl	%eax, -4(%rbp)
	jge	.L18
	addl	$1, -8(%rbp)
.L8:
	movl	M(%rip), %eax
	cmpl	%eax, -8(%rbp)
	jl	.L12
	jmp	.L10
.L17:
	nop
	jmp	.L10
.L18:
	nop
.L10:
	movl	-8(%rbp), %eax
	addl	$1, %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L13
.L16:
	nop
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.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:
