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 main(void){
	int n,k,a,flg[100001],i,ii,cnt[100001],max,kai,J,c,cc;
	while(1){
		scanf("%d %d",&n,&k);
		if(n==0) break;
		for(i=0;i<=n;i++){
			flg[i]=0;
			cnt[i]=0;
		}
		for(i=0;i<k;i++){
			scanf("%d",&a);
			flg[a]=1;
		}
		ii=0;
		c=0;
		cc=0;
		for(i=1;i<=n;i++){
			if(ii==0&&flg[i]==1){
				if(c>=2) cc-=c-1;
				c=0;
				ii=i+cc;
			}
			if(flg[i]==1){
				cnt[ii]++;
				c++;
			}
			else ii=0;
		}
		max=0;
		for(i=0;i<n;i++){
			if(max<cnt[i])max=cnt[i];
		}
		if(flg[0]!=0){
			for(i=1;i<=n;i++){
				if(cnt[i]==0){
					if(i==1) kai=cnt[i+1]+1;
					if(i!=1) kai=cnt[i-1]+1+cnt[i+1];
					if(max<kai) max=kai;
				}
			}
		}
		printf("%d\n",max);
	}
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.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
	leaq	-798720(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$1360, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
.L23:
	leaq	-800064(%rbp), %rdx
	leaq	-800068(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-800068(%rbp), %eax
	testl	%eax, %eax
	je	.L27
	movl	$0, -800056(%rbp)
	jmp	.L4
.L5:
	movl	-800056(%rbp), %eax
	cltq
	movl	$0, -800032(%rbp,%rax,4)
	movl	-800056(%rbp), %eax
	cltq
	movl	$0, -400016(%rbp,%rax,4)
	addl	$1, -800056(%rbp)
.L4:
	movl	-800068(%rbp), %eax
	cmpl	%eax, -800056(%rbp)
	jle	.L5
	movl	$0, -800056(%rbp)
	jmp	.L6
.L7:
	leaq	-800060(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-800060(%rbp), %eax
	cltq
	movl	$1, -800032(%rbp,%rax,4)
	addl	$1, -800056(%rbp)
.L6:
	movl	-800064(%rbp), %eax
	cmpl	%eax, -800056(%rbp)
	jl	.L7
	movl	$0, -800052(%rbp)
	movl	$0, -800040(%rbp)
	movl	$0, -800036(%rbp)
	movl	$1, -800056(%rbp)
	jmp	.L8
.L13:
	cmpl	$0, -800052(%rbp)
	jne	.L9
	movl	-800056(%rbp), %eax
	cltq
	movl	-800032(%rbp,%rax,4), %eax
	cmpl	$1, %eax
	jne	.L9
	cmpl	$1, -800040(%rbp)
	jle	.L10
	movl	-800040(%rbp), %eax
	subl	$1, %eax
	subl	%eax, -800036(%rbp)
.L10:
	movl	$0, -800040(%rbp)
	movl	-800056(%rbp), %edx
	movl	-800036(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -800052(%rbp)
.L9:
	movl	-800056(%rbp), %eax
	cltq
	movl	-800032(%rbp,%rax,4), %eax
	cmpl	$1, %eax
	jne	.L11
	movl	-800052(%rbp), %eax
	cltq
	movl	-400016(%rbp,%rax,4), %eax
	leal	1(%rax), %edx
	movl	-800052(%rbp), %eax
	cltq
	movl	%edx, -400016(%rbp,%rax,4)
	addl	$1, -800040(%rbp)
	jmp	.L12
.L11:
	movl	$0, -800052(%rbp)
.L12:
	addl	$1, -800056(%rbp)
.L8:
	movl	-800068(%rbp), %eax
	cmpl	%eax, -800056(%rbp)
	jle	.L13
	movl	$0, -800048(%rbp)
	movl	$0, -800056(%rbp)
	jmp	.L14
.L16:
	movl	-800056(%rbp), %eax
	cltq
	movl	-400016(%rbp,%rax,4), %eax
	cmpl	%eax, -800048(%rbp)
	jge	.L15
	movl	-800056(%rbp), %eax
	cltq
	movl	-400016(%rbp,%rax,4), %eax
	movl	%eax, -800048(%rbp)
.L15:
	addl	$1, -800056(%rbp)
.L14:
	movl	-800068(%rbp), %eax
	cmpl	%eax, -800056(%rbp)
	jl	.L16
	movl	-800032(%rbp), %eax
	testl	%eax, %eax
	je	.L17
	movl	$1, -800056(%rbp)
	jmp	.L18
.L22:
	movl	-800056(%rbp), %eax
	cltq
	movl	-400016(%rbp,%rax,4), %eax
	testl	%eax, %eax
	jne	.L19
	cmpl	$1, -800056(%rbp)
	jne	.L20
	movl	-800056(%rbp), %eax
	addl	$1, %eax
	cltq
	movl	-400016(%rbp,%rax,4), %eax
	addl	$1, %eax
	movl	%eax, -800044(%rbp)
.L20:
	cmpl	$1, -800056(%rbp)
	je	.L21
	movl	-800056(%rbp), %eax
	subl	$1, %eax
	cltq
	movl	-400016(%rbp,%rax,4), %eax
	leal	1(%rax), %edx
	movl	-800056(%rbp), %eax
	addl	$1, %eax
	cltq
	movl	-400016(%rbp,%rax,4), %eax
	addl	%edx, %eax
	movl	%eax, -800044(%rbp)
.L21:
	movl	-800048(%rbp), %eax
	cmpl	-800044(%rbp), %eax
	jge	.L19
	movl	-800044(%rbp), %eax
	movl	%eax, -800048(%rbp)
.L19:
	addl	$1, -800056(%rbp)
.L18:
	movl	-800068(%rbp), %eax
	cmpl	%eax, -800056(%rbp)
	jle	.L22
.L17:
	movl	-800048(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L23
.L27:
	nop
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L25
	call	__stack_chk_fail@PLT
.L25:
	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
	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
	leaq	-798720(%rsp), %r11
	.cfi_def_cfa 11, 798776
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$1352, %rsp
	.cfi_def_cfa_offset 800128
	leaq	.LC0(%rip), %rbp
	leaq	.LC1(%rip), %rbx
	movq	%fs:40, %rax
	movq	%rax, 800056(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %r13
	leaq	20(%rsp), %r12
	.p2align 4,,10
	.p2align 3
.L20:
	movq	%r13, %rdx
	movq	%r12, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	20(%rsp), %r15d
	testl	%r15d, %r15d
	je	.L2
	js	.L33
	movslq	%r15d, %rax
	leaq	32(%rsp), %r8
	xorl	%esi, %esi
	leaq	4(,%rax,4), %r14
	movq	%r8, %rdi
	movq	%r8, 8(%rsp)
	movq	%r14, %rdx
	call	memset@PLT
	xorl	%esi, %esi
	leaq	400048(%rsp), %rdi
	movq	%r14, %rdx
	call	memset@PLT
	movl	24(%rsp), %r9d
	movq	8(%rsp), %r8
	testl	%r9d, %r9d
	jle	.L6
.L4:
	xorl	%r14d, %r14d
	leaq	28(%rsp), %r15
	.p2align 4,,10
	.p2align 3
.L7:
	movq	%r15, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	addl	$1, %r14d
	call	__isoc99_scanf@PLT
	movslq	28(%rsp), %rax
	movl	$1, 32(%rsp,%rax,4)
	cmpl	%r14d, 24(%rsp)
	jg	.L7
	movl	20(%rsp), %r15d
	testl	%r15d, %r15d
	jle	.L23
.L39:
	leaq	32(%rsp), %r8
.L6:
	leal	-1(%r15), %r11d
	leal	1(%r15), %esi
	movl	$1, %eax
	xorl	%r10d, %r10d
	xorl	%r9d, %r9d
	xorl	%ecx, %ecx
	jmp	.L13
	.p2align 4,,10
	.p2align 3
.L36:
	cmpl	$1, %edx
	je	.L34
.L10:
	addq	$1, %rax
	cmpq	%rax, %rsi
	je	.L35
.L13:
	movl	(%r8,%rax,4), %edx
	testl	%ecx, %ecx
	je	.L36
	cmpl	$1, %edx
	je	.L37
	addq	$1, %rax
	xorl	%ecx, %ecx
	cmpq	%rax, %rsi
	jne	.L13
.L35:
	cmpl	$2, %r11d
	jbe	.L25
	movl	%r15d, %edx
	leaq	400048(%rsp), %rax
	pxor	%xmm0, %xmm0
	shrl	$2, %edx
	subl	$1, %edx
	salq	$4, %rdx
	leaq	400064(%rsp,%rdx), %rdx
	.p2align 4,,10
	.p2align 3
.L15:
	movdqa	%xmm0, %xmm1
	addq	$16, %rax
	pcmpgtd	-16(%rax), %xmm1
	pand	%xmm1, %xmm0
	pandn	-16(%rax), %xmm1
	por	%xmm1, %xmm0
	cmpq	%rax, %rdx
	jne	.L15
	movdqa	%xmm0, %xmm2
	movl	%r15d, %eax
	psrldq	$8, %xmm2
	andl	$-4, %eax
	movdqa	%xmm2, %xmm1
	pcmpgtd	%xmm0, %xmm1
	pand	%xmm1, %xmm2
	pandn	%xmm0, %xmm1
	movdqa	%xmm1, %xmm0
	por	%xmm2, %xmm0
	movdqa	%xmm0, %xmm2
	psrldq	$4, %xmm2
	movdqa	%xmm2, %xmm1
	pcmpgtd	%xmm0, %xmm1
	pand	%xmm1, %xmm2
	pandn	%xmm0, %xmm1
	por	%xmm2, %xmm1
	movd	%xmm1, %edx
	testb	$3, %r15b
	je	.L16
.L14:
	movslq	%eax, %rcx
	movl	400048(%rsp,%rcx,4), %ecx
	cmpl	%ecx, %edx
	cmovl	%ecx, %edx
	leal	1(%rax), %ecx
	cmpl	%r15d, %ecx
	jge	.L16
	movslq	%ecx, %rcx
	movl	400048(%rsp,%rcx,4), %ecx
	cmpl	%ecx, %edx
	cmovl	%ecx, %edx
	addl	$2, %eax
	cmpl	%r15d, %eax
	jge	.L16
	cltq
	movl	400048(%rsp,%rax,4), %eax
	cmpl	%eax, %edx
	cmovl	%eax, %edx
.L16:
	movl	32(%rsp), %r8d
	testl	%r8d, %r8d
	jne	.L38
.L8:
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L20
	.p2align 4,,10
	.p2align 3
.L34:
	leal	-1(%r9), %ecx
	movl	%r10d, %edx
	subl	%ecx, %edx
	cmpl	$1, %r9d
	movl	$1, %r9d
	cmovg	%edx, %r10d
	leal	(%r10,%rax), %ecx
.L12:
	movslq	%ecx, %rdx
	addl	$1, 400048(%rsp,%rdx,4)
	jmp	.L10
	.p2align 4,,10
	.p2align 3
.L37:
	addl	$1, %r9d
	jmp	.L12
	.p2align 4,,10
	.p2align 3
.L33:
	movl	24(%rsp), %r10d
	testl	%r10d, %r10d
	jg	.L4
	testl	%r15d, %r15d
	jg	.L39
	.p2align 4,,10
	.p2align 3
.L23:
	xorl	%edx, %edx
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L38:
	movl	400056(%rsp), %eax
	movl	$1, %ecx
	leal	1(%rax), %r9d
	leaq	400048(%rsp), %rax
	jmp	.L19
	.p2align 4,,10
	.p2align 3
.L18:
	movl	(%rax), %r8d
	movl	8(%rax), %edi
	leal	1(%r8,%rdi), %edi
.L21:
	cmpl	%edi, %edx
	cmovl	%edi, %edx
.L17:
	addq	$1, %rcx
	addq	$4, %rax
	cmpq	%rcx, %rsi
	je	.L8
.L19:
	movl	4(%rax), %edi
	testl	%edi, %edi
	jne	.L17
	cmpq	$1, %rcx
	jne	.L18
	movl	%r9d, %edi
	jmp	.L21
	.p2align 4,,10
	.p2align 3
.L2:
	movq	800056(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L40
	addq	$800072, %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
.L25:
	.cfi_restore_state
	xorl	%edx, %edx
	xorl	%eax, %eax
	jmp	.L14
.L40:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.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:

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
	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
	leaq	-798720(%rsp), %r11
	.cfi_def_cfa 11, 798776
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$1352, %rsp
	.cfi_def_cfa_offset 800128
	leaq	.LC0(%rip), %rbp
	leaq	.LC1(%rip), %rbx
	movq	%fs:40, %rax
	movq	%rax, 800056(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %r13
	leaq	20(%rsp), %r12
	.p2align 4,,10
	.p2align 3
.L20:
	movq	%r13, %rdx
	movq	%r12, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	20(%rsp), %r15d
	testl	%r15d, %r15d
	je	.L2
	js	.L33
	movslq	%r15d, %rax
	leaq	32(%rsp), %r8
	xorl	%esi, %esi
	leaq	4(,%rax,4), %r14
	movq	%r8, %rdi
	movq	%r8, 8(%rsp)
	movq	%r14, %rdx
	call	memset@PLT
	xorl	%esi, %esi
	leaq	400048(%rsp), %rdi
	movq	%r14, %rdx
	call	memset@PLT
	movl	24(%rsp), %r9d
	movq	8(%rsp), %r8
	testl	%r9d, %r9d
	jle	.L6
.L4:
	xorl	%r14d, %r14d
	leaq	28(%rsp), %r15
	.p2align 4,,10
	.p2align 3
.L7:
	movq	%r15, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	addl	$1, %r14d
	call	__isoc99_scanf@PLT
	movslq	28(%rsp), %rax
	movl	$1, 32(%rsp,%rax,4)
	cmpl	%r14d, 24(%rsp)
	jg	.L7
	movl	20(%rsp), %r15d
	testl	%r15d, %r15d
	jle	.L23
.L39:
	leaq	32(%rsp), %r8
.L6:
	leal	-1(%r15), %r11d
	leal	1(%r15), %esi
	movl	$1, %eax
	xorl	%r10d, %r10d
	xorl	%r9d, %r9d
	xorl	%ecx, %ecx
	jmp	.L13
	.p2align 4,,10
	.p2align 3
.L36:
	cmpl	$1, %edx
	je	.L34
.L10:
	addq	$1, %rax
	cmpq	%rax, %rsi
	je	.L35
.L13:
	movl	(%r8,%rax,4), %edx
	testl	%ecx, %ecx
	je	.L36
	cmpl	$1, %edx
	je	.L37
	addq	$1, %rax
	xorl	%ecx, %ecx
	cmpq	%rax, %rsi
	jne	.L13
.L35:
	cmpl	$2, %r11d
	jbe	.L25
	movl	%r15d, %edx
	leaq	400048(%rsp), %rax
	pxor	%xmm0, %xmm0
	shrl	$2, %edx
	subl	$1, %edx
	salq	$4, %rdx
	leaq	400064(%rsp,%rdx), %rdx
	.p2align 4,,10
	.p2align 3
.L15:
	movdqa	%xmm0, %xmm1
	addq	$16, %rax
	pcmpgtd	-16(%rax), %xmm1
	pand	%xmm1, %xmm0
	pandn	-16(%rax), %xmm1
	por	%xmm1, %xmm0
	cmpq	%rax, %rdx
	jne	.L15
	movdqa	%xmm0, %xmm2
	movl	%r15d, %eax
	psrldq	$8, %xmm2
	andl	$-4, %eax
	movdqa	%xmm2, %xmm1
	pcmpgtd	%xmm0, %xmm1
	pand	%xmm1, %xmm2
	pandn	%xmm0, %xmm1
	movdqa	%xmm1, %xmm0
	por	%xmm2, %xmm0
	movdqa	%xmm0, %xmm2
	psrldq	$4, %xmm2
	movdqa	%xmm2, %xmm1
	pcmpgtd	%xmm0, %xmm1
	pand	%xmm1, %xmm2
	pandn	%xmm0, %xmm1
	por	%xmm2, %xmm1
	movd	%xmm1, %edx
	testb	$3, %r15b
	je	.L16
.L14:
	movslq	%eax, %rcx
	movl	400048(%rsp,%rcx,4), %ecx
	cmpl	%ecx, %edx
	cmovl	%ecx, %edx
	leal	1(%rax), %ecx
	cmpl	%r15d, %ecx
	jge	.L16
	movslq	%ecx, %rcx
	movl	400048(%rsp,%rcx,4), %ecx
	cmpl	%ecx, %edx
	cmovl	%ecx, %edx
	addl	$2, %eax
	cmpl	%r15d, %eax
	jge	.L16
	cltq
	movl	400048(%rsp,%rax,4), %eax
	cmpl	%eax, %edx
	cmovl	%eax, %edx
.L16:
	movl	32(%rsp), %r8d
	testl	%r8d, %r8d
	jne	.L38
.L8:
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L20
	.p2align 4,,10
	.p2align 3
.L34:
	leal	-1(%r9), %ecx
	movl	%r10d, %edx
	subl	%ecx, %edx
	cmpl	$1, %r9d
	movl	$1, %r9d
	cmovg	%edx, %r10d
	leal	(%r10,%rax), %ecx
.L12:
	movslq	%ecx, %rdx
	addl	$1, 400048(%rsp,%rdx,4)
	jmp	.L10
	.p2align 4,,10
	.p2align 3
.L37:
	addl	$1, %r9d
	jmp	.L12
	.p2align 4,,10
	.p2align 3
.L33:
	movl	24(%rsp), %r10d
	testl	%r10d, %r10d
	jg	.L4
	testl	%r15d, %r15d
	jg	.L39
	.p2align 4,,10
	.p2align 3
.L23:
	xorl	%edx, %edx
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L38:
	movl	400056(%rsp), %eax
	movl	$1, %ecx
	leal	1(%rax), %r9d
	leaq	400048(%rsp), %rax
	jmp	.L19
	.p2align 4,,10
	.p2align 3
.L18:
	movl	(%rax), %r8d
	movl	8(%rax), %edi
	leal	1(%r8,%rdi), %edi
.L21:
	cmpl	%edi, %edx
	cmovl	%edi, %edx
.L17:
	addq	$1, %rcx
	addq	$4, %rax
	cmpq	%rcx, %rsi
	je	.L8
.L19:
	movl	4(%rax), %edi
	testl	%edi, %edi
	jne	.L17
	cmpq	$1, %rcx
	jne	.L18
	movl	%r9d, %edi
	jmp	.L21
	.p2align 4,,10
	.p2align 3
.L2:
	movq	800056(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L40
	addq	$800072, %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
.L25:
	.cfi_restore_state
	xorl	%edx, %edx
	xorl	%eax, %eax
	jmp	.L14
.L40:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.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:

#include<stdio.h>
int main(void){
	int n,k,a,flg[100001],i,ii,cnt[100001],max,kai,J,c,cc;
	while(1){
		scanf("%d %d",&n,&k);
		if(n==0) break;
		for(i=0;i<=n;i++){
			flg[i]=0;
			cnt[i]=0;
		}
		for(i=0;i<k;i++){
			scanf("%d",&a);
			flg[a]=1;
		}
		ii=0;
		c=0;
		cc=0;
		for(i=1;i<=n;i++){
			if(ii==0&&flg[i]==1){
				if(c>=2) cc-=c-1;
				c=0;
				ii=i+cc;
			}
			if(flg[i]==1){
				cnt[ii]++;
				c++;
			}
			else ii=0;
		}
		max=0;
		for(i=0;i<n;i++){
			if(max<cnt[i])max=cnt[i];
		}
		if(flg[0]!=0){
			for(i=1;i<=n;i++){
				if(cnt[i]==0){
					if(i==1) kai=cnt[i+1]+1;
					if(i!=1) kai=cnt[i-1]+1+cnt[i+1];
					if(max<kai) max=kai;
				}
			}
		}
		printf("%d\n",max);
	}
	return 0;
}
7 5
6
2
4
7
1
7 5
5
2
0
4
7
0 0
 7 5
6
2
4
7
1
7 5
5
2
0
1
7
0 0
 9 5
6
2
4
7
1
7 5
5
2
1
4
7
0 0
 14 5
6
0
4
7
1
7 5
5
2
0
4
7
0 0
 7 5
6
2
3
7
1
7 5
6
2
0
4
7
0 0
 7 5
6
2
4
7
0
25 5
5
2
0
1
7
0 0
 14 5
5
3
4
7
1
7 5
5
2
1
4
7
0 0
 7 5
6
2
4
7
1
7 5
5
2
0
4
6
0 0
 9 5
6
2
4
3
1
7 5
5
2
1
4
7
0 0
 7 5
6
2
4
3
0
25 5
5
2
0
1
7
0 0

2
4
 2
3
 2
2
 4
4
 3
4
 4
3
 3
2
 2
5
 4
2
 5
3

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 main(void){
	int n,k,a,flg[100001],i,ii,cnt[100001],max,kai,J,c,cc;
	while(1){
		scanf("%d %d",&n,&k);
		if(n==0) break;
		for(i=0;i<=n;i++){
			flg[i]=0;
			cnt[i]=0;
		}
		for(i=0;i<k;i++){
			scanf("%d",&a);
			flg[a]=1;
		}
		ii=0;
		c=0;
		cc=0;
		for(i=1;i<=n;i++){
			if(ii==0&&flg[i]==1){
				if(c>=2) cc-=c-1;
				c=0;
				ii=i+cc;
			}
			if(flg[i]==1){
				cnt[ii]++;
				c++;
			}
			else ii=0;
		}
		max=0;
		for(i=0;i<n;i++){
			if(max<cnt[i])max=cnt[i];
		}
		if(flg[0]!=0){
			for(i=1;i<=n;i++){
				if(cnt[i]==0){
					if(i==1) kai=cnt[i+1]+1;
					if(i!=1) kai=cnt[i-1]+1+cnt[i+1];
					if(max<kai) max=kai;
				}
			}
		}
		printf("%d\n",max);
	}
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.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
	leaq	-798720(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$1360, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
.L23:
	leaq	-800064(%rbp), %rdx
	leaq	-800068(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-800068(%rbp), %eax
	testl	%eax, %eax
	je	.L27
	movl	$0, -800056(%rbp)
	jmp	.L4
.L5:
	movl	-800056(%rbp), %eax
	cltq
	movl	$0, -800032(%rbp,%rax,4)
	movl	-800056(%rbp), %eax
	cltq
	movl	$0, -400016(%rbp,%rax,4)
	addl	$1, -800056(%rbp)
.L4:
	movl	-800068(%rbp), %eax
	cmpl	%eax, -800056(%rbp)
	jle	.L5
	movl	$0, -800056(%rbp)
	jmp	.L6
.L7:
	leaq	-800060(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-800060(%rbp), %eax
	cltq
	movl	$1, -800032(%rbp,%rax,4)
	addl	$1, -800056(%rbp)
.L6:
	movl	-800064(%rbp), %eax
	cmpl	%eax, -800056(%rbp)
	jl	.L7
	movl	$0, -800052(%rbp)
	movl	$0, -800040(%rbp)
	movl	$0, -800036(%rbp)
	movl	$1, -800056(%rbp)
	jmp	.L8
.L13:
	cmpl	$0, -800052(%rbp)
	jne	.L9
	movl	-800056(%rbp), %eax
	cltq
	movl	-800032(%rbp,%rax,4), %eax
	cmpl	$1, %eax
	jne	.L9
	cmpl	$1, -800040(%rbp)
	jle	.L10
	movl	-800040(%rbp), %eax
	subl	$1, %eax
	subl	%eax, -800036(%rbp)
.L10:
	movl	$0, -800040(%rbp)
	movl	-800056(%rbp), %edx
	movl	-800036(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -800052(%rbp)
.L9:
	movl	-800056(%rbp), %eax
	cltq
	movl	-800032(%rbp,%rax,4), %eax
	cmpl	$1, %eax
	jne	.L11
	movl	-800052(%rbp), %eax
	cltq
	movl	-400016(%rbp,%rax,4), %eax
	leal	1(%rax), %edx
	movl	-800052(%rbp), %eax
	cltq
	movl	%edx, -400016(%rbp,%rax,4)
	addl	$1, -800040(%rbp)
	jmp	.L12
.L11:
	movl	$0, -800052(%rbp)
.L12:
	addl	$1, -800056(%rbp)
.L8:
	movl	-800068(%rbp), %eax
	cmpl	%eax, -800056(%rbp)
	jle	.L13
	movl	$0, -800048(%rbp)
	movl	$0, -800056(%rbp)
	jmp	.L14
.L16:
	movl	-800056(%rbp), %eax
	cltq
	movl	-400016(%rbp,%rax,4), %eax
	cmpl	%eax, -800048(%rbp)
	jge	.L15
	movl	-800056(%rbp), %eax
	cltq
	movl	-400016(%rbp,%rax,4), %eax
	movl	%eax, -800048(%rbp)
.L15:
	addl	$1, -800056(%rbp)
.L14:
	movl	-800068(%rbp), %eax
	cmpl	%eax, -800056(%rbp)
	jl	.L16
	movl	-800032(%rbp), %eax
	testl	%eax, %eax
	je	.L17
	movl	$1, -800056(%rbp)
	jmp	.L18
.L22:
	movl	-800056(%rbp), %eax
	cltq
	movl	-400016(%rbp,%rax,4), %eax
	testl	%eax, %eax
	jne	.L19
	cmpl	$1, -800056(%rbp)
	jne	.L20
	movl	-800056(%rbp), %eax
	addl	$1, %eax
	cltq
	movl	-400016(%rbp,%rax,4), %eax
	addl	$1, %eax
	movl	%eax, -800044(%rbp)
.L20:
	cmpl	$1, -800056(%rbp)
	je	.L21
	movl	-800056(%rbp), %eax
	subl	$1, %eax
	cltq
	movl	-400016(%rbp,%rax,4), %eax
	leal	1(%rax), %edx
	movl	-800056(%rbp), %eax
	addl	$1, %eax
	cltq
	movl	-400016(%rbp,%rax,4), %eax
	addl	%edx, %eax
	movl	%eax, -800044(%rbp)
.L21:
	movl	-800048(%rbp), %eax
	cmpl	-800044(%rbp), %eax
	jge	.L19
	movl	-800044(%rbp), %eax
	movl	%eax, -800048(%rbp)
.L19:
	addl	$1, -800056(%rbp)
.L18:
	movl	-800068(%rbp), %eax
	cmpl	%eax, -800056(%rbp)
	jle	.L22
.L17:
	movl	-800048(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L23
.L27:
	nop
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L25
	call	__stack_chk_fail@PLT
.L25:
	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
	.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
	leaq	-798720(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$1360, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
.L23:
	leaq	-800064(%rbp), %rdx
	leaq	-800068(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-800068(%rbp), %eax
	testl	%eax, %eax
	je	.L27
	movl	$0, -800056(%rbp)
	jmp	.L4
.L5:
	movl	-800056(%rbp), %eax
	cltq
	movl	$0, -800032(%rbp,%rax,4)
	movl	-800056(%rbp), %eax
	cltq
	movl	$0, -400016(%rbp,%rax,4)
	addl	$1, -800056(%rbp)
.L4:
	movl	-800068(%rbp), %eax
	cmpl	%eax, -800056(%rbp)
	jle	.L5
	movl	$0, -800056(%rbp)
	jmp	.L6
.L7:
	leaq	-800060(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-800060(%rbp), %eax
	cltq
	movl	$1, -800032(%rbp,%rax,4)
	addl	$1, -800056(%rbp)
.L6:
	movl	-800064(%rbp), %eax
	cmpl	%eax, -800056(%rbp)
	jl	.L7
	movl	$0, -800052(%rbp)
	movl	$0, -800040(%rbp)
	movl	$0, -800036(%rbp)
	movl	$1, -800056(%rbp)
	jmp	.L8
.L13:
	cmpl	$0, -800052(%rbp)
	jne	.L9
	movl	-800056(%rbp), %eax
	cltq
	movl	-800032(%rbp,%rax,4), %eax
	cmpl	$1, %eax
	jne	.L9
	cmpl	$1, -800040(%rbp)
	jle	.L10
	movl	-800040(%rbp), %eax
	subl	$1, %eax
	subl	%eax, -800036(%rbp)
.L10:
	movl	$0, -800040(%rbp)
	movl	-800056(%rbp), %edx
	movl	-800036(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -800052(%rbp)
.L9:
	movl	-800056(%rbp), %eax
	cltq
	movl	-800032(%rbp,%rax,4), %eax
	cmpl	$1, %eax
	jne	.L11
	movl	-800052(%rbp), %eax
	cltq
	movl	-400016(%rbp,%rax,4), %eax
	leal	1(%rax), %edx
	movl	-800052(%rbp), %eax
	cltq
	movl	%edx, -400016(%rbp,%rax,4)
	addl	$1, -800040(%rbp)
	jmp	.L12
.L11:
	movl	$0, -800052(%rbp)
.L12:
	addl	$1, -800056(%rbp)
.L8:
	movl	-800068(%rbp), %eax
	cmpl	%eax, -800056(%rbp)
	jle	.L13
	movl	$0, -800048(%rbp)
	movl	$0, -800056(%rbp)
	jmp	.L14
.L16:
	movl	-800056(%rbp), %eax
	cltq
	movl	-400016(%rbp,%rax,4), %eax
	cmpl	%eax, -800048(%rbp)
	jge	.L15
	movl	-800056(%rbp), %eax
	cltq
	movl	-400016(%rbp,%rax,4), %eax
	movl	%eax, -800048(%rbp)
.L15:
	addl	$1, -800056(%rbp)
.L14:
	movl	-800068(%rbp), %eax
	cmpl	%eax, -800056(%rbp)
	jl	.L16
	movl	-800032(%rbp), %eax
	testl	%eax, %eax
	je	.L17
	movl	$1, -800056(%rbp)
	jmp	.L18
.L22:
	movl	-800056(%rbp), %eax
	cltq
	movl	-400016(%rbp,%rax,4), %eax
	testl	%eax, %eax
	jne	.L19
	cmpl	$1, -800056(%rbp)
	jne	.L20
	movl	-800056(%rbp), %eax
	addl	$1, %eax
	cltq
	movl	-400016(%rbp,%rax,4), %eax
	addl	$1, %eax
	movl	%eax, -800044(%rbp)
.L20:
	cmpl	$1, -800056(%rbp)
	je	.L21
	movl	-800056(%rbp), %eax
	subl	$1, %eax
	cltq
	movl	-400016(%rbp,%rax,4), %eax
	leal	1(%rax), %edx
	movl	-800056(%rbp), %eax
	addl	$1, %eax
	cltq
	movl	-400016(%rbp,%rax,4), %eax
	addl	%edx, %eax
	movl	%eax, -800044(%rbp)
.L21:
	movl	-800048(%rbp), %eax
	cmpl	-800044(%rbp), %eax
	jge	.L19
	movl	-800044(%rbp), %eax
	movl	%eax, -800048(%rbp)
.L19:
	addl	$1, -800056(%rbp)
.L18:
	movl	-800068(%rbp), %eax
	cmpl	%eax, -800056(%rbp)
	jle	.L22
.L17:
	movl	-800048(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L23
.L27:
	nop
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L25
	call	__stack_chk_fail@PLT
.L25:
	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:
