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 student[501][501];
	int list[501];
	int n, m;
	int i, j;
	int p1, p2;
	int loop;
	int count;
	
    
    while (1){
    	scanf("%d", &n);
    	scanf("%d", &m);
    	
        if ((n | m) == 0){
            break;
        }
        
        
    	for (i = 0; i <= 500; i++){
    		list[i] = 0;
    		for (j = 0; j <= 500; j++){
    			student[i][j] = 0;
    		}
    	}
    	
    	for (i = 0; i < m; i++){
    		scanf("%d%d", &p1, &p2);
    		student[p1][p2] = 1;
    		student[p2][p1] = 1;
    	}
    	

    	for (i = 2; i <= n; i++){
    		if (student[1][i] == 1){
    			list[i] = 1;
    		}
    	}
    	
    	for (i = 2; i <= n; i++){
    		if (student[1][i] == 1){
    			for (j = 2; j <= n; j++){
    				if (student[i][j] == 1){
  						list[j] = 1;
    				}
    			}
    		}
    	}
    	
    	count = 0;
    	for (i = 2; i <= n; i++){
    		count += list[i];
    	}
    	printf("%d\n", count);
    }
    
	return (0);
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d%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	-1003520(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$2544, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
.L21:
	leaq	-1006060(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-1006056(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-1006060(%rbp), %edx
	movl	-1006056(%rbp), %eax
	orl	%edx, %eax
	testl	%eax, %eax
	je	.L25
	movl	$0, -1006044(%rbp)
	jmp	.L4
.L7:
	movl	-1006044(%rbp), %eax
	cltq
	movl	$0, -1006032(%rbp,%rax,4)
	movl	$0, -1006040(%rbp)
	jmp	.L5
.L6:
	movl	-1006040(%rbp), %eax
	movslq	%eax, %rdx
	movl	-1006044(%rbp), %eax
	cltq
	imulq	$501, %rax, %rax
	addq	%rdx, %rax
	movl	$0, -1004016(%rbp,%rax,4)
	addl	$1, -1006040(%rbp)
.L5:
	cmpl	$500, -1006040(%rbp)
	jle	.L6
	addl	$1, -1006044(%rbp)
.L4:
	cmpl	$500, -1006044(%rbp)
	jle	.L7
	movl	$0, -1006044(%rbp)
	jmp	.L8
.L9:
	leaq	-1006048(%rbp), %rdx
	leaq	-1006052(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-1006052(%rbp), %eax
	movl	-1006048(%rbp), %edx
	movslq	%edx, %rdx
	cltq
	imulq	$501, %rax, %rax
	addq	%rdx, %rax
	movl	$1, -1004016(%rbp,%rax,4)
	movl	-1006048(%rbp), %eax
	movl	-1006052(%rbp), %edx
	movslq	%edx, %rdx
	cltq
	imulq	$501, %rax, %rax
	addq	%rdx, %rax
	movl	$1, -1004016(%rbp,%rax,4)
	addl	$1, -1006044(%rbp)
.L8:
	movl	-1006056(%rbp), %eax
	cmpl	%eax, -1006044(%rbp)
	jl	.L9
	movl	$2, -1006044(%rbp)
	jmp	.L10
.L12:
	movl	-1006044(%rbp), %eax
	cltq
	addq	$501, %rax
	movl	-1004016(%rbp,%rax,4), %eax
	cmpl	$1, %eax
	jne	.L11
	movl	-1006044(%rbp), %eax
	cltq
	movl	$1, -1006032(%rbp,%rax,4)
.L11:
	addl	$1, -1006044(%rbp)
.L10:
	movl	-1006060(%rbp), %eax
	cmpl	%eax, -1006044(%rbp)
	jle	.L12
	movl	$2, -1006044(%rbp)
	jmp	.L13
.L18:
	movl	-1006044(%rbp), %eax
	cltq
	addq	$501, %rax
	movl	-1004016(%rbp,%rax,4), %eax
	cmpl	$1, %eax
	jne	.L14
	movl	$2, -1006040(%rbp)
	jmp	.L15
.L17:
	movl	-1006040(%rbp), %eax
	movslq	%eax, %rdx
	movl	-1006044(%rbp), %eax
	cltq
	imulq	$501, %rax, %rax
	addq	%rdx, %rax
	movl	-1004016(%rbp,%rax,4), %eax
	cmpl	$1, %eax
	jne	.L16
	movl	-1006040(%rbp), %eax
	cltq
	movl	$1, -1006032(%rbp,%rax,4)
.L16:
	addl	$1, -1006040(%rbp)
.L15:
	movl	-1006060(%rbp), %eax
	cmpl	%eax, -1006040(%rbp)
	jle	.L17
.L14:
	addl	$1, -1006044(%rbp)
.L13:
	movl	-1006060(%rbp), %eax
	cmpl	%eax, -1006044(%rbp)
	jle	.L18
	movl	$0, -1006036(%rbp)
	movl	$2, -1006044(%rbp)
	jmp	.L19
.L20:
	movl	-1006044(%rbp), %eax
	cltq
	movl	-1006032(%rbp,%rax,4), %eax
	addl	%eax, -1006036(%rbp)
	addl	$1, -1006044(%rbp)
.L19:
	movl	-1006060(%rbp), %eax
	cmpl	%eax, -1006044(%rbp)
	jle	.L20
	movl	-1006036(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L21
.L25:
	nop
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L23
	call	__stack_chk_fail@PLT
.L23:
	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"
.LC1:
	.string	"%d%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	-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	$2568, %rsp
	.cfi_def_cfa_offset 1006144
	leaq	.LC0(%rip), %rbp
	leaq	.LC1(%rip), %r13
	movq	%fs:40, %rax
	movq	%rax, 1006072(%rsp)
	xorl	%eax, %eax
	leaq	32(%rsp), %r15
	leaq	36(%rsp), %r14
	leaq	48(%rsp), %rbx
.L17:
	movq	%r15, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	xorl	%eax, %eax
	movq	%r14, %rsi
	movq	%rbp, %rdi
	call	__isoc99_scanf@PLT
	movl	32(%rsp), %r8d
	movl	36(%rsp), %r9d
	movl	%r8d, %eax
	movl	%r8d, 16(%rsp)
	orl	%r9d, %eax
	movl	%r9d, 8(%rsp)
	je	.L2
	xorl	%eax, %eax
	movl	$250, %ecx
	movq	%rbx, %rdi
	xorl	%esi, %esi
	rep stosq
	leaq	2064(%rsp), %r12
	movl	$1004004, %edx
	movl	$0, (%rdi)
	movq	%r12, %rdi
	call	memset@PLT
	movl	8(%rsp), %r9d
	movl	16(%rsp), %r8d
	testl	%r9d, %r9d
	jle	.L3
	xorl	%ecx, %ecx
	leaq	44(%rsp), %rdx
	leaq	40(%rsp), %rsi
.L4:
	movq	%r13, %rdi
	xorl	%eax, %eax
	movl	%ecx, 28(%rsp)
	movq	%rdx, 16(%rsp)
	movq	%rsi, 8(%rsp)
	call	__isoc99_scanf@PLT
	movslq	40(%rsp), %r8
	movslq	44(%rsp), %rax
	movl	28(%rsp), %ecx
	movq	8(%rsp), %rsi
	imulq	$501, %r8, %rdi
	movq	16(%rsp), %rdx
	addl	$1, %ecx
	addq	%rax, %rdi
	imulq	$501, %rax, %rax
	movl	$1, 2064(%rsp,%rdi,4)
	addq	%r8, %rax
	cmpl	%ecx, 36(%rsp)
	movl	$1, 2064(%rsp,%rax,4)
	jg	.L4
	movl	32(%rsp), %r8d
.L3:
	cmpl	$1, %r8d
	jle	.L19
	leal	-2(%r8), %edi
	movl	$2, %eax
	movq	%rdi, %rsi
	leaq	3(%rdi), %r9
.L7:
	cmpl	$1, 2004(%r12,%rax,4)
	jne	.L6
	movl	$1, (%rbx,%rax,4)
.L6:
	addq	$1, %rax
	cmpq	%r9, %rax
	jne	.L7
	leaq	4076(%rsp), %rdx
	leaq	6072(%rsp), %rcx
	leaq	4080(%rsp,%rdi,4), %rdi
	jmp	.L9
.L31:
	addq	$4, %rdx
	addq	$2004, %rcx
	cmpq	%rdi, %rdx
	je	.L30
.L9:
	cmpl	$1, (%rdx)
	jne	.L31
	movl	$2, %eax
.L8:
	cmpl	$1, (%rcx,%rax,4)
	jne	.L11
	movl	$1, (%rbx,%rax,4)
.L11:
	addq	$1, %rax
	cmpq	%r9, %rax
	jne	.L8
	addq	$4, %rdx
	addq	$2004, %rcx
	cmpq	%rdi, %rdx
	jne	.L9
.L30:
	leal	-1(%r8), %ecx
	cmpl	$2, %esi
	jbe	.L21
	movl	%ecx, %edx
	leaq	56(%rsp), %rax
	pxor	%xmm0, %xmm0
	shrl	$2, %edx
	subl	$1, %edx
	salq	$4, %rdx
	leaq	72(%rsp,%rdx), %rdx
.L14:
	movdqu	(%rax), %xmm2
	addq	$16, %rax
	paddd	%xmm2, %xmm0
	cmpq	%rdx, %rax
	jne	.L14
	movdqa	%xmm0, %xmm1
	movl	%ecx, %esi
	psrldq	$8, %xmm1
	andl	$-4, %esi
	paddd	%xmm1, %xmm0
	leal	2(%rsi), %eax
	movdqa	%xmm0, %xmm1
	psrldq	$4, %xmm1
	paddd	%xmm1, %xmm0
	movd	%xmm0, %edx
	cmpl	%esi, %ecx
	je	.L5
.L13:
	movslq	%eax, %rcx
	addl	48(%rsp,%rcx,4), %edx
	leal	1(%rax), %ecx
	cmpl	%ecx, %r8d
	jl	.L5
	movslq	%ecx, %rcx
	addl	$2, %eax
	addl	48(%rsp,%rcx,4), %edx
	cmpl	%eax, %r8d
	jl	.L5
	cltq
	addl	48(%rsp,%rax,4), %edx
.L5:
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L17
.L21:
	xorl	%edx, %edx
	movl	$2, %eax
	jmp	.L13
.L19:
	xorl	%edx, %edx
	jmp	.L5
.L2:
	movq	1006072(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L32
	addq	$1006088, %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
	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"
.LC1:
	.string	"%d%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	-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	$2568, %rsp
	.cfi_def_cfa_offset 1006144
	leaq	.LC0(%rip), %rbp
	leaq	.LC1(%rip), %r13
	movq	%fs:40, %rax
	movq	%rax, 1006072(%rsp)
	xorl	%eax, %eax
	leaq	32(%rsp), %r15
	leaq	36(%rsp), %r14
	leaq	48(%rsp), %rbx
.L17:
	movq	%r15, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	xorl	%eax, %eax
	movq	%r14, %rsi
	movq	%rbp, %rdi
	call	__isoc99_scanf@PLT
	movl	32(%rsp), %r8d
	movl	36(%rsp), %r9d
	movl	%r8d, %eax
	movl	%r8d, 16(%rsp)
	orl	%r9d, %eax
	movl	%r9d, 8(%rsp)
	je	.L2
	xorl	%eax, %eax
	movl	$250, %ecx
	movq	%rbx, %rdi
	xorl	%esi, %esi
	rep stosq
	leaq	2064(%rsp), %r12
	movl	$1004004, %edx
	movl	$0, (%rdi)
	movq	%r12, %rdi
	call	memset@PLT
	movl	8(%rsp), %r9d
	movl	16(%rsp), %r8d
	testl	%r9d, %r9d
	jle	.L3
	xorl	%ecx, %ecx
	leaq	44(%rsp), %rdx
	leaq	40(%rsp), %rsi
.L4:
	movq	%r13, %rdi
	xorl	%eax, %eax
	movl	%ecx, 28(%rsp)
	movq	%rdx, 16(%rsp)
	movq	%rsi, 8(%rsp)
	call	__isoc99_scanf@PLT
	movslq	40(%rsp), %r8
	movslq	44(%rsp), %rax
	movl	28(%rsp), %ecx
	movq	8(%rsp), %rsi
	imulq	$501, %r8, %rdi
	movq	16(%rsp), %rdx
	addl	$1, %ecx
	addq	%rax, %rdi
	imulq	$501, %rax, %rax
	movl	$1, 2064(%rsp,%rdi,4)
	addq	%r8, %rax
	cmpl	%ecx, 36(%rsp)
	movl	$1, 2064(%rsp,%rax,4)
	jg	.L4
	movl	32(%rsp), %r8d
.L3:
	cmpl	$1, %r8d
	jle	.L19
	leal	-2(%r8), %edi
	movl	$2, %eax
	movq	%rdi, %rsi
	leaq	3(%rdi), %r9
.L7:
	cmpl	$1, 2004(%r12,%rax,4)
	jne	.L6
	movl	$1, (%rbx,%rax,4)
.L6:
	addq	$1, %rax
	cmpq	%r9, %rax
	jne	.L7
	leaq	4076(%rsp), %rdx
	leaq	6072(%rsp), %rcx
	leaq	4080(%rsp,%rdi,4), %rdi
	jmp	.L9
.L31:
	addq	$4, %rdx
	addq	$2004, %rcx
	cmpq	%rdi, %rdx
	je	.L30
.L9:
	cmpl	$1, (%rdx)
	jne	.L31
	movl	$2, %eax
.L8:
	cmpl	$1, (%rcx,%rax,4)
	jne	.L11
	movl	$1, (%rbx,%rax,4)
.L11:
	addq	$1, %rax
	cmpq	%r9, %rax
	jne	.L8
	addq	$4, %rdx
	addq	$2004, %rcx
	cmpq	%rdi, %rdx
	jne	.L9
.L30:
	leal	-1(%r8), %ecx
	cmpl	$2, %esi
	jbe	.L21
	movl	%ecx, %edx
	leaq	56(%rsp), %rax
	pxor	%xmm0, %xmm0
	shrl	$2, %edx
	subl	$1, %edx
	salq	$4, %rdx
	leaq	72(%rsp,%rdx), %rdx
.L14:
	movdqu	(%rax), %xmm2
	addq	$16, %rax
	paddd	%xmm2, %xmm0
	cmpq	%rdx, %rax
	jne	.L14
	movdqa	%xmm0, %xmm1
	movl	%ecx, %esi
	psrldq	$8, %xmm1
	andl	$-4, %esi
	paddd	%xmm1, %xmm0
	leal	2(%rsi), %eax
	movdqa	%xmm0, %xmm1
	psrldq	$4, %xmm1
	paddd	%xmm1, %xmm0
	movd	%xmm0, %edx
	cmpl	%esi, %ecx
	je	.L5
.L13:
	movslq	%eax, %rcx
	addl	48(%rsp,%rcx,4), %edx
	leal	1(%rax), %ecx
	cmpl	%ecx, %r8d
	jl	.L5
	movslq	%ecx, %rcx
	addl	$2, %eax
	addl	48(%rsp,%rcx,4), %edx
	cmpl	%eax, %r8d
	jl	.L5
	cltq
	addl	48(%rsp,%rax,4), %edx
.L5:
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L17
.L21:
	xorl	%edx, %edx
	movl	$2, %eax
	jmp	.L13
.L19:
	xorl	%edx, %edx
	jmp	.L5
.L2:
	movq	1006072(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L32
	addq	$1006088, %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
	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 student[501][501];
	int list[501];
	int n, m;
	int i, j;
	int p1, p2;
	int loop;
	int count;
	
    
    while (1){
    	scanf("%d", &n);
    	scanf("%d", &m);
    	
        if ((n | m) == 0){
            break;
        }
        
        
    	for (i = 0; i <= 500; i++){
    		list[i] = 0;
    		for (j = 0; j <= 500; j++){
    			student[i][j] = 0;
    		}
    	}
    	
    	for (i = 0; i < m; i++){
    		scanf("%d%d", &p1, &p2);
    		student[p1][p2] = 1;
    		student[p2][p1] = 1;
    	}
    	

    	for (i = 2; i <= n; i++){
    		if (student[1][i] == 1){
    			list[i] = 1;
    		}
    	}
    	
    	for (i = 2; i <= n; i++){
    		if (student[1][i] == 1){
    			for (j = 2; j <= n; j++){
    				if (student[i][j] == 1){
  						list[j] = 1;
    				}
    			}
    		}
    	}
    	
    	count = 0;
    	for (i = 2; i <= n; i++){
    		count += list[i];
    	}
    	printf("%d\n", count);
    }
    
	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
#include <stdio.h>

int main(void)
{
	int student[501][501];
	int list[501];
	int n, m;
	int i, j;
	int p1, p2;
	int loop;
	int count;
	
    
    while (1){
    	scanf("%d", &n);
    	scanf("%d", &m);
    	
        if ((n | m) == 0){
            break;
        }
        
        
    	for (i = 0; i <= 500; i++){
    		list[i] = 0;
    		for (j = 0; j <= 500; j++){
    			student[i][j] = 0;
    		}
    	}
    	
    	for (i = 0; i < m; i++){
    		scanf("%d%d", &p1, &p2);
    		student[p1][p2] = 1;
    		student[p2][p1] = 1;
    	}
    	

    	for (i = 2; i <= n; i++){
    		if (student[1][i] == 1){
    			list[i] = 1;
    		}
    	}
    	
    	for (i = 2; i <= n; i++){
    		if (student[1][i] == 1){
    			for (j = 2; j <= n; j++){
    				if (student[i][j] == 1){
  						list[j] = 1;
    				}
    			}
    		}
    	}
    	
    	count = 0;
    	for (i = 2; i <= n; i++){
    		count += list[i];
    	}
    	printf("%d\n", count);
    }
    
	return (0);
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d%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	-1003520(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$2544, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
.L21:
	leaq	-1006060(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-1006056(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-1006060(%rbp), %edx
	movl	-1006056(%rbp), %eax
	orl	%edx, %eax
	testl	%eax, %eax
	je	.L25
	movl	$0, -1006044(%rbp)
	jmp	.L4
.L7:
	movl	-1006044(%rbp), %eax
	cltq
	movl	$0, -1006032(%rbp,%rax,4)
	movl	$0, -1006040(%rbp)
	jmp	.L5
.L6:
	movl	-1006040(%rbp), %eax
	movslq	%eax, %rdx
	movl	-1006044(%rbp), %eax
	cltq
	imulq	$501, %rax, %rax
	addq	%rdx, %rax
	movl	$0, -1004016(%rbp,%rax,4)
	addl	$1, -1006040(%rbp)
.L5:
	cmpl	$500, -1006040(%rbp)
	jle	.L6
	addl	$1, -1006044(%rbp)
.L4:
	cmpl	$500, -1006044(%rbp)
	jle	.L7
	movl	$0, -1006044(%rbp)
	jmp	.L8
.L9:
	leaq	-1006048(%rbp), %rdx
	leaq	-1006052(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-1006052(%rbp), %eax
	movl	-1006048(%rbp), %edx
	movslq	%edx, %rdx
	cltq
	imulq	$501, %rax, %rax
	addq	%rdx, %rax
	movl	$1, -1004016(%rbp,%rax,4)
	movl	-1006048(%rbp), %eax
	movl	-1006052(%rbp), %edx
	movslq	%edx, %rdx
	cltq
	imulq	$501, %rax, %rax
	addq	%rdx, %rax
	movl	$1, -1004016(%rbp,%rax,4)
	addl	$1, -1006044(%rbp)
.L8:
	movl	-1006056(%rbp), %eax
	cmpl	%eax, -1006044(%rbp)
	jl	.L9
	movl	$2, -1006044(%rbp)
	jmp	.L10
.L12:
	movl	-1006044(%rbp), %eax
	cltq
	addq	$501, %rax
	movl	-1004016(%rbp,%rax,4), %eax
	cmpl	$1, %eax
	jne	.L11
	movl	-1006044(%rbp), %eax
	cltq
	movl	$1, -1006032(%rbp,%rax,4)
.L11:
	addl	$1, -1006044(%rbp)
.L10:
	movl	-1006060(%rbp), %eax
	cmpl	%eax, -1006044(%rbp)
	jle	.L12
	movl	$2, -1006044(%rbp)
	jmp	.L13
.L18:
	movl	-1006044(%rbp), %eax
	cltq
	addq	$501, %rax
	movl	-1004016(%rbp,%rax,4), %eax
	cmpl	$1, %eax
	jne	.L14
	movl	$2, -1006040(%rbp)
	jmp	.L15
.L17:
	movl	-1006040(%rbp), %eax
	movslq	%eax, %rdx
	movl	-1006044(%rbp), %eax
	cltq
	imulq	$501, %rax, %rax
	addq	%rdx, %rax
	movl	-1004016(%rbp,%rax,4), %eax
	cmpl	$1, %eax
	jne	.L16
	movl	-1006040(%rbp), %eax
	cltq
	movl	$1, -1006032(%rbp,%rax,4)
.L16:
	addl	$1, -1006040(%rbp)
.L15:
	movl	-1006060(%rbp), %eax
	cmpl	%eax, -1006040(%rbp)
	jle	.L17
.L14:
	addl	$1, -1006044(%rbp)
.L13:
	movl	-1006060(%rbp), %eax
	cmpl	%eax, -1006044(%rbp)
	jle	.L18
	movl	$0, -1006036(%rbp)
	movl	$2, -1006044(%rbp)
	jmp	.L19
.L20:
	movl	-1006044(%rbp), %eax
	cltq
	movl	-1006032(%rbp,%rax,4), %eax
	addl	%eax, -1006036(%rbp)
	addl	$1, -1006044(%rbp)
.L19:
	movl	-1006060(%rbp), %eax
	cmpl	%eax, -1006044(%rbp)
	jle	.L20
	movl	-1006036(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L21
.L25:
	nop
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L23
	call	__stack_chk_fail@PLT
.L23:
	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"
.LC1:
	.string	"%d%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	-1003520(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$2544, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
.L21:
	leaq	-1006060(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-1006056(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-1006060(%rbp), %edx
	movl	-1006056(%rbp), %eax
	orl	%edx, %eax
	testl	%eax, %eax
	je	.L25
	movl	$0, -1006044(%rbp)
	jmp	.L4
.L7:
	movl	-1006044(%rbp), %eax
	cltq
	movl	$0, -1006032(%rbp,%rax,4)
	movl	$0, -1006040(%rbp)
	jmp	.L5
.L6:
	movl	-1006040(%rbp), %eax
	movslq	%eax, %rdx
	movl	-1006044(%rbp), %eax
	cltq
	imulq	$501, %rax, %rax
	addq	%rdx, %rax
	movl	$0, -1004016(%rbp,%rax,4)
	addl	$1, -1006040(%rbp)
.L5:
	cmpl	$500, -1006040(%rbp)
	jle	.L6
	addl	$1, -1006044(%rbp)
.L4:
	cmpl	$500, -1006044(%rbp)
	jle	.L7
	movl	$0, -1006044(%rbp)
	jmp	.L8
.L9:
	leaq	-1006048(%rbp), %rdx
	leaq	-1006052(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-1006052(%rbp), %eax
	movl	-1006048(%rbp), %edx
	movslq	%edx, %rdx
	cltq
	imulq	$501, %rax, %rax
	addq	%rdx, %rax
	movl	$1, -1004016(%rbp,%rax,4)
	movl	-1006048(%rbp), %eax
	movl	-1006052(%rbp), %edx
	movslq	%edx, %rdx
	cltq
	imulq	$501, %rax, %rax
	addq	%rdx, %rax
	movl	$1, -1004016(%rbp,%rax,4)
	addl	$1, -1006044(%rbp)
.L8:
	movl	-1006056(%rbp), %eax
	cmpl	%eax, -1006044(%rbp)
	jl	.L9
	movl	$2, -1006044(%rbp)
	jmp	.L10
.L12:
	movl	-1006044(%rbp), %eax
	cltq
	addq	$501, %rax
	movl	-1004016(%rbp,%rax,4), %eax
	cmpl	$1, %eax
	jne	.L11
	movl	-1006044(%rbp), %eax
	cltq
	movl	$1, -1006032(%rbp,%rax,4)
.L11:
	addl	$1, -1006044(%rbp)
.L10:
	movl	-1006060(%rbp), %eax
	cmpl	%eax, -1006044(%rbp)
	jle	.L12
	movl	$2, -1006044(%rbp)
	jmp	.L13
.L18:
	movl	-1006044(%rbp), %eax
	cltq
	addq	$501, %rax
	movl	-1004016(%rbp,%rax,4), %eax
	cmpl	$1, %eax
	jne	.L14
	movl	$2, -1006040(%rbp)
	jmp	.L15
.L17:
	movl	-1006040(%rbp), %eax
	movslq	%eax, %rdx
	movl	-1006044(%rbp), %eax
	cltq
	imulq	$501, %rax, %rax
	addq	%rdx, %rax
	movl	-1004016(%rbp,%rax,4), %eax
	cmpl	$1, %eax
	jne	.L16
	movl	-1006040(%rbp), %eax
	cltq
	movl	$1, -1006032(%rbp,%rax,4)
.L16:
	addl	$1, -1006040(%rbp)
.L15:
	movl	-1006060(%rbp), %eax
	cmpl	%eax, -1006040(%rbp)
	jle	.L17
.L14:
	addl	$1, -1006044(%rbp)
.L13:
	movl	-1006060(%rbp), %eax
	cmpl	%eax, -1006044(%rbp)
	jle	.L18
	movl	$0, -1006036(%rbp)
	movl	$2, -1006044(%rbp)
	jmp	.L19
.L20:
	movl	-1006044(%rbp), %eax
	cltq
	movl	-1006032(%rbp,%rax,4), %eax
	addl	%eax, -1006036(%rbp)
	addl	$1, -1006044(%rbp)
.L19:
	movl	-1006060(%rbp), %eax
	cmpl	%eax, -1006044(%rbp)
	jle	.L20
	movl	-1006036(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L21
.L25:
	nop
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L23
	call	__stack_chk_fail@PLT
.L23:
	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:
