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

```c
int main(){while(1){int n,m,i,j,a,b,x[501]={},c[501][501]={},num[501]={},sum=0;scanf("%d%d",&n,&m);if(n==0)break;for(i=1;i<=m;i++){scanf("%d%d",&a,&b);if(a==1){num[b]++;}c[a][b]=1;c[b][a]=1;}for(i=1;i<=n;i++){for(j=1;j<=n;j++){if(c[1][i]==1&&c[i][j]==1){num[j]++;}}}for(i=2;i<=n;i++){if(num[i]!=0)sum++;}printf("%d\n",sum);}return 0;}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d%d"
.LC1:
	.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	-1007616(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$464, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
.L15:
	leaq	-1008048(%rbp), %rdx
	movl	$0, %eax
	movl	$250, %ecx
	movq	%rdx, %rdi
	rep stosq
	movq	%rdi, %rdx
	movl	%eax, (%rdx)
	addq	$4, %rdx
	leaq	-1004016(%rbp), %rax
	movl	$1004004, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	leaq	-1006032(%rbp), %rdx
	movl	$0, %eax
	movl	$250, %ecx
	movq	%rdx, %rdi
	rep stosq
	movq	%rdi, %rdx
	movl	%eax, (%rdx)
	addq	$4, %rdx
	movl	$0, -1008052(%rbp)
	leaq	-1008072(%rbp), %rdx
	leaq	-1008076(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movl	-1008076(%rbp), %eax
	testl	%eax, %eax
	jne	.L2
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L16
	jmp	.L17
.L2:
	movl	$1, -1008060(%rbp)
	jmp	.L4
.L6:
	leaq	-1008064(%rbp), %rdx
	leaq	-1008068(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movl	-1008068(%rbp), %eax
	cmpl	$1, %eax
	jne	.L5
	movl	-1008064(%rbp), %eax
	movslq	%eax, %rdx
	movl	-1006032(%rbp,%rdx,4), %edx
	addl	$1, %edx
	cltq
	movl	%edx, -1006032(%rbp,%rax,4)
.L5:
	movl	-1008068(%rbp), %eax
	movl	-1008064(%rbp), %edx
	movslq	%edx, %rdx
	cltq
	imulq	$501, %rax, %rax
	addq	%rdx, %rax
	movl	$1, -1004016(%rbp,%rax,4)
	movl	-1008064(%rbp), %eax
	movl	-1008068(%rbp), %edx
	movslq	%edx, %rdx
	cltq
	imulq	$501, %rax, %rax
	addq	%rdx, %rax
	movl	$1, -1004016(%rbp,%rax,4)
	addl	$1, -1008060(%rbp)
.L4:
	movl	-1008072(%rbp), %eax
	cmpl	%eax, -1008060(%rbp)
	jle	.L6
	movl	$1, -1008060(%rbp)
	jmp	.L7
.L11:
	movl	$1, -1008056(%rbp)
	jmp	.L8
.L10:
	movl	-1008060(%rbp), %eax
	cltq
	addq	$501, %rax
	movl	-1004016(%rbp,%rax,4), %eax
	cmpl	$1, %eax
	jne	.L9
	movl	-1008056(%rbp), %eax
	movslq	%eax, %rdx
	movl	-1008060(%rbp), %eax
	cltq
	imulq	$501, %rax, %rax
	addq	%rdx, %rax
	movl	-1004016(%rbp,%rax,4), %eax
	cmpl	$1, %eax
	jne	.L9
	movl	-1008056(%rbp), %eax
	cltq
	movl	-1006032(%rbp,%rax,4), %eax
	leal	1(%rax), %edx
	movl	-1008056(%rbp), %eax
	cltq
	movl	%edx, -1006032(%rbp,%rax,4)
.L9:
	addl	$1, -1008056(%rbp)
.L8:
	movl	-1008076(%rbp), %eax
	cmpl	%eax, -1008056(%rbp)
	jle	.L10
	addl	$1, -1008060(%rbp)
.L7:
	movl	-1008076(%rbp), %eax
	cmpl	%eax, -1008060(%rbp)
	jle	.L11
	movl	$2, -1008060(%rbp)
	jmp	.L12
.L14:
	movl	-1008060(%rbp), %eax
	cltq
	movl	-1006032(%rbp,%rax,4), %eax
	testl	%eax, %eax
	je	.L13
	addl	$1, -1008052(%rbp)
.L13:
	addl	$1, -1008060(%rbp)
.L12:
	movl	-1008076(%rbp), %eax
	cmpl	%eax, -1008060(%rbp)
	jle	.L14
	movl	-1008052(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L15
.L17:
	call	__stack_chk_fail@PLT
.L16:
	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\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB0:
	.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	-1003520(%rsp), %r11
	.cfi_def_cfa 11, 1003576
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$2552, %rsp
	.cfi_def_cfa_offset 1006128
	leaq	.LC0(%rip), %rbx
	movq	%fs:40, %rax
	movq	%rax, 1006056(%rsp)
	xorl	%eax, %eax
	leaq	32(%rsp), %rax
	leaq	2048(%rsp), %r15
	movq	%rax, (%rsp)
	leaq	16(%rsp), %rax
	leaq	20(%rsp), %r14
	movq	%rax, 8(%rsp)
	.p2align 4,,10
	.p2align 3
.L24:
	movl	$1004004, %edx
	xorl	%esi, %esi
	movq	%r15, %rdi
	call	memset@PLT
	movq	(%rsp), %rdi
	xorl	%eax, %eax
	movl	$250, %ecx
	movq	8(%rsp), %rsi
	movq	%r14, %rdx
	rep stosq
	movl	$0, (%rdi)
	movq	%rbx, %rdi
	call	scanf@PLT
	movl	16(%rsp), %edi
	testl	%edi, %edi
	je	.L2
	movl	20(%rsp), %eax
	testl	%eax, %eax
	jle	.L3
	movl	$1, %r13d
	leaq	28(%rsp), %r12
	leaq	24(%rsp), %rbp
	.p2align 4,,10
	.p2align 3
.L7:
	movq	%r12, %rdx
	movq	%rbp, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	scanf@PLT
	movslq	24(%rsp), %rax
	cmpl	$1, %eax
	je	.L4
	imulq	$501, %rax, %rsi
	movslq	28(%rsp), %rdx
	addl	$1, %r13d
	addq	%rdx, %rsi
	imulq	$501, %rdx, %rdx
	movl	$1, 2048(%rsp,%rsi,4)
	addq	%rax, %rdx
	movl	$1, 2048(%rsp,%rdx,4)
	cmpl	20(%rsp), %r13d
	jle	.L7
.L6:
	movl	16(%rsp), %edi
.L3:
	testl	%edi, %edi
	jle	.L32
	leal	-1(%rdi), %esi
	leaq	4056(%rsp), %rcx
	movq	%rsi, %r8
	leaq	40(%rsp), %r9
	salq	$2, %rsi
	movq	%rcx, %r11
	leaq	4060(%rsp,%rsi), %r10
	addq	%r9, %rsi
	jmp	.L14
	.p2align 4,,10
	.p2align 3
.L11:
	addq	$4, %rcx
	addq	$2004, %r11
	cmpq	%r10, %rcx
	je	.L34
.L14:
	cmpl	$1, (%rcx)
	jne	.L11
	leaq	36(%rsp), %rax
	movq	%r11, %rdx
	jmp	.L13
	.p2align 4,,10
	.p2align 3
.L12:
	addq	$4, %rax
	addq	$4, %rdx
	cmpq	%rsi, %rax
	je	.L11
.L13:
	cmpl	$1, (%rdx)
	jne	.L12
	addl	$1, (%rax)
	jmp	.L12
	.p2align 4,,10
	.p2align 3
.L4:
	movslq	28(%rsp), %rax
	addl	$1, %r13d
	movl	$1, 4052(%rsp,%rax,4)
	addl	$1, 32(%rsp,%rax,4)
	imulq	$2004, %rax, %rax
	movl	$1, 2052(%rsp,%rax)
	cmpl	%r13d, 20(%rsp)
	jge	.L7
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L34:
	cmpl	$1, %edi
	jle	.L32
	leal	-2(%rdi), %eax
	cmpl	$2, %eax
	jbe	.L26
	movl	%r8d, %edx
	pxor	%xmm1, %xmm1
	movq	%r9, %rax
	shrl	$2, %edx
	movdqa	%xmm1, %xmm2
	subl	$1, %edx
	salq	$4, %rdx
	leaq	56(%rsp,%rdx), %rdx
	.p2align 4,,10
	.p2align 3
.L17:
	movdqu	(%rax), %xmm0
	addq	$16, %rax
	pcmpeqd	%xmm2, %xmm0
	pcmpeqd	%xmm2, %xmm0
	psubd	%xmm0, %xmm1
	cmpq	%rax, %rdx
	jne	.L17
	movdqa	%xmm1, %xmm0
	movl	%r8d, %edx
	psrldq	$8, %xmm0
	andl	$-4, %edx
	paddd	%xmm0, %xmm1
	leal	2(%rdx), %eax
	movdqa	%xmm1, %xmm0
	psrldq	$4, %xmm0
	paddd	%xmm0, %xmm1
	movd	%xmm1, %esi
	cmpl	%edx, %r8d
	je	.L9
.L16:
	movslq	%eax, %rdx
	cmpl	$1, 32(%rsp,%rdx,4)
	leal	1(%rax), %edx
	sbbl	$-1, %esi
	cmpl	%edx, %edi
	jl	.L9
	movslq	%edx, %rdx
	cmpl	$1, 32(%rsp,%rdx,4)
	sbbl	$-1, %esi
	addl	$2, %eax
	cmpl	%edi, %eax
	jg	.L9
	cltq
	cmpl	$1, 32(%rsp,%rax,4)
	sbbl	$-1, %esi
.L9:
	leaq	.LC1(%rip), %rdi
	xorl	%eax, %eax
	call	printf@PLT
	jmp	.L24
.L2:
	movq	1006056(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L35
	addq	$1006072, %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
.L32:
	.cfi_restore_state
	xorl	%esi, %esi
	jmp	.L9
.L26:
	xorl	%esi, %esi
	movl	$2, %eax
	jmp	.L16
.L35:
	call	__stack_chk_fail@PLT
	.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:

rule
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB0:
	.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	-1003520(%rsp), %r11
	.cfi_def_cfa 11, 1003576
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$2552, %rsp
	.cfi_def_cfa_offset 1006128
	leaq	.LC0(%rip), %rbx
	movq	%fs:40, %rax
	movq	%rax, 1006056(%rsp)
	xorl	%eax, %eax
	leaq	32(%rsp), %rax
	leaq	2048(%rsp), %r15
	movq	%rax, (%rsp)
	leaq	16(%rsp), %rax
	leaq	20(%rsp), %r14
	movq	%rax, 8(%rsp)
	.p2align 4,,10
	.p2align 3
.L24:
	movl	$1004004, %edx
	xorl	%esi, %esi
	movq	%r15, %rdi
	call	memset@PLT
	movq	(%rsp), %rdi
	xorl	%eax, %eax
	movl	$250, %ecx
	movq	8(%rsp), %rsi
	movq	%r14, %rdx
	rep stosq
	movl	$0, (%rdi)
	movq	%rbx, %rdi
	call	scanf@PLT
	movl	16(%rsp), %edi
	testl	%edi, %edi
	je	.L2
	movl	20(%rsp), %eax
	testl	%eax, %eax
	jle	.L3
	movl	$1, %r13d
	leaq	28(%rsp), %r12
	leaq	24(%rsp), %rbp
	.p2align 4,,10
	.p2align 3
.L7:
	movq	%r12, %rdx
	movq	%rbp, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	scanf@PLT
	movslq	24(%rsp), %rax
	cmpl	$1, %eax
	je	.L4
	imulq	$501, %rax, %rsi
	movslq	28(%rsp), %rdx
	addl	$1, %r13d
	addq	%rdx, %rsi
	imulq	$501, %rdx, %rdx
	movl	$1, 2048(%rsp,%rsi,4)
	addq	%rax, %rdx
	movl	$1, 2048(%rsp,%rdx,4)
	cmpl	20(%rsp), %r13d
	jle	.L7
.L6:
	movl	16(%rsp), %edi
.L3:
	testl	%edi, %edi
	jle	.L32
	leal	-1(%rdi), %esi
	leaq	4056(%rsp), %rcx
	movq	%rsi, %r8
	leaq	40(%rsp), %r9
	salq	$2, %rsi
	movq	%rcx, %r11
	leaq	4060(%rsp,%rsi), %r10
	addq	%r9, %rsi
	jmp	.L14
	.p2align 4,,10
	.p2align 3
.L11:
	addq	$4, %rcx
	addq	$2004, %r11
	cmpq	%r10, %rcx
	je	.L34
.L14:
	cmpl	$1, (%rcx)
	jne	.L11
	leaq	36(%rsp), %rax
	movq	%r11, %rdx
	jmp	.L13
	.p2align 4,,10
	.p2align 3
.L12:
	addq	$4, %rax
	addq	$4, %rdx
	cmpq	%rsi, %rax
	je	.L11
.L13:
	cmpl	$1, (%rdx)
	jne	.L12
	addl	$1, (%rax)
	jmp	.L12
	.p2align 4,,10
	.p2align 3
.L4:
	movslq	28(%rsp), %rax
	addl	$1, %r13d
	movl	$1, 4052(%rsp,%rax,4)
	addl	$1, 32(%rsp,%rax,4)
	imulq	$2004, %rax, %rax
	movl	$1, 2052(%rsp,%rax)
	cmpl	%r13d, 20(%rsp)
	jge	.L7
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L34:
	cmpl	$1, %edi
	jle	.L32
	leal	-2(%rdi), %eax
	cmpl	$2, %eax
	jbe	.L26
	movl	%r8d, %edx
	pxor	%xmm1, %xmm1
	movq	%r9, %rax
	shrl	$2, %edx
	movdqa	%xmm1, %xmm2
	subl	$1, %edx
	salq	$4, %rdx
	leaq	56(%rsp,%rdx), %rdx
	.p2align 4,,10
	.p2align 3
.L17:
	movdqu	(%rax), %xmm0
	addq	$16, %rax
	pcmpeqd	%xmm2, %xmm0
	pcmpeqd	%xmm2, %xmm0
	psubd	%xmm0, %xmm1
	cmpq	%rax, %rdx
	jne	.L17
	movdqa	%xmm1, %xmm0
	movl	%r8d, %edx
	psrldq	$8, %xmm0
	andl	$-4, %edx
	paddd	%xmm0, %xmm1
	leal	2(%rdx), %eax
	movdqa	%xmm1, %xmm0
	psrldq	$4, %xmm0
	paddd	%xmm0, %xmm1
	movd	%xmm1, %esi
	cmpl	%edx, %r8d
	je	.L9
.L16:
	movslq	%eax, %rdx
	cmpl	$1, 32(%rsp,%rdx,4)
	leal	1(%rax), %edx
	sbbl	$-1, %esi
	cmpl	%edx, %edi
	jl	.L9
	movslq	%edx, %rdx
	cmpl	$1, 32(%rsp,%rdx,4)
	sbbl	$-1, %esi
	addl	$2, %eax
	cmpl	%edi, %eax
	jg	.L9
	cltq
	cmpl	$1, 32(%rsp,%rax,4)
	sbbl	$-1, %esi
.L9:
	leaq	.LC1(%rip), %rdi
	xorl	%eax, %eax
	call	printf@PLT
	jmp	.L24
.L2:
	movq	1006056(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L35
	addq	$1006072, %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
.L32:
	.cfi_restore_state
	xorl	%esi, %esi
	jmp	.L9
.L26:
	xorl	%esi, %esi
	movl	$2, %eax
	jmp	.L16
.L35:
	call	__stack_chk_fail@PLT
	.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:

int main(){while(1){int n,m,i,j,a,b,x[501]={},c[501][501]={},num[501]={},sum=0;scanf("%d%d",&n,&m);if(n==0)break;for(i=1;i<=m;i++){scanf("%d%d",&a,&b);if(a==1){num[b]++;}c[a][b]=1;c[b][a]=1;}for(i=1;i<=n;i++){for(j=1;j<=n;j++){if(c[1][i]==1&&c[i][j]==1){num[j]++;}}}for(i=2;i<=n;i++){if(num[i]!=0)sum++;}printf("%d\n",sum);}return 0;}
6
5
1 2
1 3
3 4
2 3
4 5
6
5
2 3
3 4
4 5
5 6
2 6
0
0
 6
5
1 2
1 3
3 4
2 3
4 5
6
5
2 3
3 4
1 5
5 6
2 6
0
0
 6
5
1 2
1 3
3 5
2 3
4 5
6
5
2 3
3 4
1 5
6 6
2 6
0
0
 6
5
1 2
1 3
3 5
2 3
4 5
6
5
2 3
3 4
1 5
1 6
2 6
0
0
 6
5
1 2
1 3
2 4
2 3
3 5
6
5
2 3
4 4
4 5
5 6
2 5
0
0
 6
5
1 2
1 4
3 4
2 3
4 5
6
5
2 3
3 4
4 3
5 6
1 6
0
0
 6
5
1 2
1 3
3 2
3 3
4 5
6
5
2 3
3 4
4 4
5 6
1 6
0
0
 6
5
1 2
1 3
3 2
3 3
4 5
6
5
2 3
3 4
4 4
5 5
1 6
0
0
 6
5
1 4
1 3
3 2
3 3
3 5
6
5
2 3
3 4
4 3
5 5
1 6
0
0
 6
5
1 2
1 3
3 5
3 4
4 5
6
5
2 3
3 4
1 5
1 6
2 6
0
0

3
0
 3
2
 3
1
 3
3
 4
0
 4
2
 2
2
 2
1
 4
1
 4
3

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

```c
int main(){while(1){int n,m,i,j,a,b,x[501]={},c[501][501]={},num[501]={},sum=0;scanf("%d%d",&n,&m);if(n==0)break;for(i=1;i<=m;i++){scanf("%d%d",&a,&b);if(a==1){num[b]++;}c[a][b]=1;c[b][a]=1;}for(i=1;i<=n;i++){for(j=1;j<=n;j++){if(c[1][i]==1&&c[i][j]==1){num[j]++;}}}for(i=2;i<=n;i++){if(num[i]!=0)sum++;}printf("%d\n",sum);}return 0;}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d%d"
.LC1:
	.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	-1007616(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$464, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
.L15:
	leaq	-1008048(%rbp), %rdx
	movl	$0, %eax
	movl	$250, %ecx
	movq	%rdx, %rdi
	rep stosq
	movq	%rdi, %rdx
	movl	%eax, (%rdx)
	addq	$4, %rdx
	leaq	-1004016(%rbp), %rax
	movl	$1004004, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	leaq	-1006032(%rbp), %rdx
	movl	$0, %eax
	movl	$250, %ecx
	movq	%rdx, %rdi
	rep stosq
	movq	%rdi, %rdx
	movl	%eax, (%rdx)
	addq	$4, %rdx
	movl	$0, -1008052(%rbp)
	leaq	-1008072(%rbp), %rdx
	leaq	-1008076(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movl	-1008076(%rbp), %eax
	testl	%eax, %eax
	jne	.L2
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L16
	jmp	.L17
.L2:
	movl	$1, -1008060(%rbp)
	jmp	.L4
.L6:
	leaq	-1008064(%rbp), %rdx
	leaq	-1008068(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movl	-1008068(%rbp), %eax
	cmpl	$1, %eax
	jne	.L5
	movl	-1008064(%rbp), %eax
	movslq	%eax, %rdx
	movl	-1006032(%rbp,%rdx,4), %edx
	addl	$1, %edx
	cltq
	movl	%edx, -1006032(%rbp,%rax,4)
.L5:
	movl	-1008068(%rbp), %eax
	movl	-1008064(%rbp), %edx
	movslq	%edx, %rdx
	cltq
	imulq	$501, %rax, %rax
	addq	%rdx, %rax
	movl	$1, -1004016(%rbp,%rax,4)
	movl	-1008064(%rbp), %eax
	movl	-1008068(%rbp), %edx
	movslq	%edx, %rdx
	cltq
	imulq	$501, %rax, %rax
	addq	%rdx, %rax
	movl	$1, -1004016(%rbp,%rax,4)
	addl	$1, -1008060(%rbp)
.L4:
	movl	-1008072(%rbp), %eax
	cmpl	%eax, -1008060(%rbp)
	jle	.L6
	movl	$1, -1008060(%rbp)
	jmp	.L7
.L11:
	movl	$1, -1008056(%rbp)
	jmp	.L8
.L10:
	movl	-1008060(%rbp), %eax
	cltq
	addq	$501, %rax
	movl	-1004016(%rbp,%rax,4), %eax
	cmpl	$1, %eax
	jne	.L9
	movl	-1008056(%rbp), %eax
	movslq	%eax, %rdx
	movl	-1008060(%rbp), %eax
	cltq
	imulq	$501, %rax, %rax
	addq	%rdx, %rax
	movl	-1004016(%rbp,%rax,4), %eax
	cmpl	$1, %eax
	jne	.L9
	movl	-1008056(%rbp), %eax
	cltq
	movl	-1006032(%rbp,%rax,4), %eax
	leal	1(%rax), %edx
	movl	-1008056(%rbp), %eax
	cltq
	movl	%edx, -1006032(%rbp,%rax,4)
.L9:
	addl	$1, -1008056(%rbp)
.L8:
	movl	-1008076(%rbp), %eax
	cmpl	%eax, -1008056(%rbp)
	jle	.L10
	addl	$1, -1008060(%rbp)
.L7:
	movl	-1008076(%rbp), %eax
	cmpl	%eax, -1008060(%rbp)
	jle	.L11
	movl	$2, -1008060(%rbp)
	jmp	.L12
.L14:
	movl	-1008060(%rbp), %eax
	cltq
	movl	-1006032(%rbp,%rax,4), %eax
	testl	%eax, %eax
	je	.L13
	addl	$1, -1008052(%rbp)
.L13:
	addl	$1, -1008060(%rbp)
.L12:
	movl	-1008076(%rbp), %eax
	cmpl	%eax, -1008060(%rbp)
	jle	.L14
	movl	-1008052(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L15
.L17:
	call	__stack_chk_fail@PLT
.L16:
	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\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	-1007616(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$464, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
.L15:
	leaq	-1008048(%rbp), %rdx
	movl	$0, %eax
	movl	$250, %ecx
	movq	%rdx, %rdi
	rep stosq
	movq	%rdi, %rdx
	movl	%eax, (%rdx)
	addq	$4, %rdx
	leaq	-1004016(%rbp), %rax
	movl	$1004004, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	leaq	-1006032(%rbp), %rdx
	movl	$0, %eax
	movl	$250, %ecx
	movq	%rdx, %rdi
	rep stosq
	movq	%rdi, %rdx
	movl	%eax, (%rdx)
	addq	$4, %rdx
	movl	$0, -1008052(%rbp)
	leaq	-1008072(%rbp), %rdx
	leaq	-1008076(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movl	-1008076(%rbp), %eax
	testl	%eax, %eax
	jne	.L2
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L16
	jmp	.L17
.L2:
	movl	$1, -1008060(%rbp)
	jmp	.L4
.L6:
	leaq	-1008064(%rbp), %rdx
	leaq	-1008068(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movl	-1008068(%rbp), %eax
	cmpl	$1, %eax
	jne	.L5
	movl	-1008064(%rbp), %eax
	movslq	%eax, %rdx
	movl	-1006032(%rbp,%rdx,4), %edx
	addl	$1, %edx
	cltq
	movl	%edx, -1006032(%rbp,%rax,4)
.L5:
	movl	-1008068(%rbp), %eax
	movl	-1008064(%rbp), %edx
	movslq	%edx, %rdx
	cltq
	imulq	$501, %rax, %rax
	addq	%rdx, %rax
	movl	$1, -1004016(%rbp,%rax,4)
	movl	-1008064(%rbp), %eax
	movl	-1008068(%rbp), %edx
	movslq	%edx, %rdx
	cltq
	imulq	$501, %rax, %rax
	addq	%rdx, %rax
	movl	$1, -1004016(%rbp,%rax,4)
	addl	$1, -1008060(%rbp)
.L4:
	movl	-1008072(%rbp), %eax
	cmpl	%eax, -1008060(%rbp)
	jle	.L6
	movl	$1, -1008060(%rbp)
	jmp	.L7
.L11:
	movl	$1, -1008056(%rbp)
	jmp	.L8
.L10:
	movl	-1008060(%rbp), %eax
	cltq
	addq	$501, %rax
	movl	-1004016(%rbp,%rax,4), %eax
	cmpl	$1, %eax
	jne	.L9
	movl	-1008056(%rbp), %eax
	movslq	%eax, %rdx
	movl	-1008060(%rbp), %eax
	cltq
	imulq	$501, %rax, %rax
	addq	%rdx, %rax
	movl	-1004016(%rbp,%rax,4), %eax
	cmpl	$1, %eax
	jne	.L9
	movl	-1008056(%rbp), %eax
	cltq
	movl	-1006032(%rbp,%rax,4), %eax
	leal	1(%rax), %edx
	movl	-1008056(%rbp), %eax
	cltq
	movl	%edx, -1006032(%rbp,%rax,4)
.L9:
	addl	$1, -1008056(%rbp)
.L8:
	movl	-1008076(%rbp), %eax
	cmpl	%eax, -1008056(%rbp)
	jle	.L10
	addl	$1, -1008060(%rbp)
.L7:
	movl	-1008076(%rbp), %eax
	cmpl	%eax, -1008060(%rbp)
	jle	.L11
	movl	$2, -1008060(%rbp)
	jmp	.L12
.L14:
	movl	-1008060(%rbp), %eax
	cltq
	movl	-1006032(%rbp,%rax,4), %eax
	testl	%eax, %eax
	je	.L13
	addl	$1, -1008052(%rbp)
.L13:
	addl	$1, -1008060(%rbp)
.L12:
	movl	-1008076(%rbp), %eax
	cmpl	%eax, -1008060(%rbp)
	jle	.L14
	movl	-1008052(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L15
.L17:
	call	__stack_chk_fail@PLT
.L16:
	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:
