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

```c
/*
AizuOnline A0519
Title Worst sport writer

*/
#include <stdio.h>
// Select Below
//#include <stdlib.h>
//#include <string.h>
//#include <float.h>
//#include <math.h>
//#include <limits.h>
//Global data section
#define SHOUGENNO 100000
#define NINZUU 5000
int n,m;
int x[SHOUGENNO],y[SHOUGENNO];
int flag[NINZUU+1];
//
void show()
{
  int i;
  for(i=1;i<=n;i++)
    printf("%d:",flag[i]);
  printf("\n");
}
main()
{
  int i,cnt,cnt2,multi;

  scanf("%d ",&n);
  scanf("%d ",&m);
  for(i=0;i<m;i++)
    scanf("%d %d",&x[i],&y[i]);
  for(i=0;i<n;i++)
    flag[i]=0;

  cnt=n;multi=0; 

  while(cnt>0)
    {
      for(i=1;i<=n;i++)
	if(flag[i]>0)
	  flag[i]=0;
      //show();
      for(i=0;i<m;i++)
	if(flag[x[i]]!=-1)
	  flag[y[i]]=1;
      cnt2=0;
      for(i=1;i<=n;i++)
	{
	  if(flag[i]==0)
	    {
	      printf("%d\n",i);
	      cnt--;
	      flag[i]=-1;
	      cnt2++;
	      if(cnt2>1)
		multi=1;
	    }
	}
      //show();
    }
  printf("%d\n",multi);  
  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	x
	.align 32
	.type	x, @object
	.size	x, 400000
x:
	.zero	400000
	.globl	y
	.align 32
	.type	y, @object
	.size	y, 400000
y:
	.zero	400000
	.globl	flag
	.align 32
	.type	flag, @object
	.size	flag, 20004
flag:
	.zero	20004
	.section	.rodata
.LC0:
	.string	"%d:"
	.text
	.globl	show
	.type	show, @function
show:
.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
	movl	$1, -4(%rbp)
	jmp	.L2
.L3:
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	flag(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -4(%rbp)
.L2:
	movl	n(%rip), %eax
	cmpl	%eax, -4(%rbp)
	jle	.L3
	movl	$10, %edi
	call	putchar@PLT
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	show, .-show
	.section	.rodata
.LC1:
	.string	"%d "
.LC2:
	.string	"%d %d"
.LC3:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB1:
	.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
	leaq	n(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	m(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -16(%rbp)
	jmp	.L5
.L6:
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	y(%rip), %rax
	addq	%rax, %rdx
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	x(%rip), %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -16(%rbp)
.L5:
	movl	m(%rip), %eax
	cmpl	%eax, -16(%rbp)
	jl	.L6
	movl	$0, -16(%rbp)
	jmp	.L7
.L8:
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	flag(%rip), %rax
	movl	$0, (%rdx,%rax)
	addl	$1, -16(%rbp)
.L7:
	movl	n(%rip), %eax
	cmpl	%eax, -16(%rbp)
	jl	.L8
	movl	n(%rip), %eax
	movl	%eax, -12(%rbp)
	movl	$0, -4(%rbp)
	jmp	.L9
.L19:
	movl	$1, -16(%rbp)
	jmp	.L10
.L12:
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	flag(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	jle	.L11
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	flag(%rip), %rax
	movl	$0, (%rdx,%rax)
.L11:
	addl	$1, -16(%rbp)
.L10:
	movl	n(%rip), %eax
	cmpl	%eax, -16(%rbp)
	jle	.L12
	movl	$0, -16(%rbp)
	jmp	.L13
.L15:
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	x(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	flag(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	$-1, %eax
	je	.L14
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	y(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	flag(%rip), %rax
	movl	$1, (%rdx,%rax)
.L14:
	addl	$1, -16(%rbp)
.L13:
	movl	m(%rip), %eax
	cmpl	%eax, -16(%rbp)
	jl	.L15
	movl	$0, -8(%rbp)
	movl	$1, -16(%rbp)
	jmp	.L16
.L18:
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	flag(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	jne	.L17
	movl	-16(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	subl	$1, -12(%rbp)
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	flag(%rip), %rax
	movl	$-1, (%rdx,%rax)
	addl	$1, -8(%rbp)
	cmpl	$1, -8(%rbp)
	jle	.L17
	movl	$1, -4(%rbp)
.L17:
	addl	$1, -16(%rbp)
.L16:
	movl	n(%rip), %eax
	cmpl	%eax, -16(%rbp)
	jle	.L18
.L9:
	cmpl	$0, -12(%rbp)
	jg	.L19
	movl	-4(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.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:"
	.text
	.p2align 4
	.globl	show
	.type	show, @function
show:
.LFB23:
	.cfi_startproc
	endbr64
	movl	n(%rip), %eax
	testl	%eax, %eax
	jle	.L6
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	leaq	flag(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	leaq	.LC0(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	movl	$1, %ebx
	.p2align 4,,10
	.p2align 3
.L3:
	movl	(%r12,%rbx,4), %edx
	xorl	%eax, %eax
	movq	%rbp, %rsi
	movl	$1, %edi
	addq	$1, %rbx
	call	__printf_chk@PLT
	cmpl	%ebx, n(%rip)
	jge	.L3
	popq	%rbx
	.cfi_restore 3
	.cfi_def_cfa_offset 24
	movl	$10, %edi
	popq	%rbp
	.cfi_restore 6
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_restore 12
	.cfi_def_cfa_offset 8
	jmp	putchar@PLT
	.p2align 4,,10
	.p2align 3
.L6:
	movl	$10, %edi
	jmp	putchar@PLT
	.cfi_endproc
.LFE23:
	.size	show, .-show
	.section	.rodata.str1.1
.LC1:
	.string	"%d "
.LC2:
	.string	"%d %d"
.LC3:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB24:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	n(%rip), %rsi
	xorl	%eax, %eax
	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
	leaq	.LC1(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movq	%rbp, %rdi
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	call	__isoc99_scanf@PLT
	leaq	m(%rip), %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	m(%rip), %ebx
	testl	%ebx, %ebx
	jle	.L11
	leaq	x(%rip), %r12
	xorl	%ebp, %ebp
	leaq	y(%rip), %r14
	leaq	.LC2(%rip), %r13
	.p2align 4,,10
	.p2align 3
.L12:
	leaq	(%r14,%rbp,4), %rdx
	movq	%r12, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	m(%rip), %ebx
	addq	$1, %rbp
	addq	$4, %r12
	cmpl	%ebp, %ebx
	jg	.L12
.L11:
	movl	n(%rip), %r15d
	testl	%r15d, %r15d
	jle	.L29
	movslq	%r15d, %rdx
	leaq	flag(%rip), %rbp
	xorl	%esi, %esi
	salq	$2, %rdx
	movq	%rbp, %rdi
	leaq	.LC3(%rip), %r13
	call	memset@PLT
	movl	%r15d, %ecx
	movl	$0, 8(%rsp)
	leaq	x(%rip), %r14
	leaq	y(%rip), %r12
	testl	%ecx, %ecx
	jle	.L39
	.p2align 4,,10
	.p2align 3
.L26:
	leaq	4+flag(%rip), %rax
	leal	-1(%rcx), %edx
	leaq	4(%rax), %rsi
	leaq	(%rsi,%rdx,4), %rdx
	.p2align 4,,10
	.p2align 3
.L16:
	movl	(%rax), %esi
	testl	%esi, %esi
	jle	.L15
	movl	$0, (%rax)
.L15:
	addq	$4, %rax
	cmpq	%rdx, %rax
	jne	.L16
	movl	m(%rip), %ebx
	testl	%ebx, %ebx
	jle	.L18
.L17:
	xorl	%eax, %eax
	.p2align 4,,10
	.p2align 3
.L21:
	movslq	(%r14,%rax,4), %rdx
	cmpl	$-1, 0(%rbp,%rdx,4)
	je	.L20
	movslq	(%r12,%rax,4), %rdx
	movl	$1, 0(%rbp,%rdx,4)
.L20:
	addq	$1, %rax
	cmpl	%eax, %ebx
	jg	.L21
	testl	%ecx, %ecx
	jle	.L28
.L18:
	movl	$1, %ebx
	xorl	%r9d, %r9d
	jmp	.L25
	.p2align 4,,10
	.p2align 3
.L23:
	addq	$1, %rbx
	cmpl	%ebx, %ecx
	jl	.L40
.L25:
	movl	0(%rbp,%rbx,4), %eax
	movl	%ebx, %edx
	testl	%eax, %eax
	jne	.L23
	xorl	%eax, %eax
	movq	%r13, %rsi
	movl	$1, %edi
	movl	%r9d, 12(%rsp)
	call	__printf_chk@PLT
	movl	12(%rsp), %r9d
	subl	$1, %r15d
	movl	$1, %eax
	movl	n(%rip), %ecx
	movl	$-1, 0(%rbp,%rbx,4)
	addl	$1, %r9d
	cmpl	$1, %r9d
	cmove	8(%rsp), %eax
	addq	$1, %rbx
	movl	%eax, 8(%rsp)
	cmpl	%ebx, %ecx
	jge	.L25
.L40:
	testl	%r15d, %r15d
	jle	.L13
.L28:
	movl	m(%rip), %ebx
	testl	%ecx, %ecx
	jg	.L26
.L39:
	testl	%ebx, %ebx
	jg	.L17
	jmp	.L28
.L29:
	movl	$0, 8(%rsp)
	leaq	.LC3(%rip), %r13
.L13:
	movl	8(%rsp), %edx
	movq	%r13, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	addq	$24, %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
.LFE24:
	.size	main, .-main
	.globl	flag
	.bss
	.align 32
	.type	flag, @object
	.size	flag, 20004
flag:
	.zero	20004
	.globl	y
	.align 32
	.type	y, @object
	.size	y, 400000
y:
	.zero	400000
	.globl	x
	.align 32
	.type	x, @object
	.size	x, 400000
x:
	.zero	400000
	.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:"
	.text
	.p2align 4
	.globl	show
	.type	show, @function
show:
.LFB23:
	.cfi_startproc
	endbr64
	movl	n(%rip), %eax
	testl	%eax, %eax
	jle	.L6
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	leaq	flag(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	leaq	.LC0(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	movl	$1, %ebx
	.p2align 4,,10
	.p2align 3
.L3:
	movl	(%r12,%rbx,4), %edx
	xorl	%eax, %eax
	movq	%rbp, %rsi
	movl	$1, %edi
	addq	$1, %rbx
	call	__printf_chk@PLT
	cmpl	%ebx, n(%rip)
	jge	.L3
	popq	%rbx
	.cfi_restore 3
	.cfi_def_cfa_offset 24
	movl	$10, %edi
	popq	%rbp
	.cfi_restore 6
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_restore 12
	.cfi_def_cfa_offset 8
	jmp	putchar@PLT
	.p2align 4,,10
	.p2align 3
.L6:
	movl	$10, %edi
	jmp	putchar@PLT
	.cfi_endproc
.LFE23:
	.size	show, .-show
	.section	.rodata.str1.1
.LC1:
	.string	"%d "
.LC2:
	.string	"%d %d"
.LC3:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB24:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	n(%rip), %rsi
	xorl	%eax, %eax
	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
	leaq	.LC1(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movq	%rbp, %rdi
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	call	__isoc99_scanf@PLT
	leaq	m(%rip), %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	m(%rip), %ebx
	testl	%ebx, %ebx
	jle	.L11
	leaq	x(%rip), %r12
	xorl	%ebp, %ebp
	leaq	y(%rip), %r14
	leaq	.LC2(%rip), %r13
	.p2align 4,,10
	.p2align 3
.L12:
	leaq	(%r14,%rbp,4), %rdx
	movq	%r12, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	m(%rip), %ebx
	addq	$1, %rbp
	addq	$4, %r12
	cmpl	%ebp, %ebx
	jg	.L12
.L11:
	movl	n(%rip), %r15d
	testl	%r15d, %r15d
	jle	.L29
	movslq	%r15d, %rdx
	leaq	flag(%rip), %rbp
	xorl	%esi, %esi
	salq	$2, %rdx
	movq	%rbp, %rdi
	leaq	.LC3(%rip), %r13
	call	memset@PLT
	movl	%r15d, %ecx
	movl	$0, 8(%rsp)
	leaq	x(%rip), %r14
	leaq	y(%rip), %r12
	testl	%ecx, %ecx
	jle	.L39
	.p2align 4,,10
	.p2align 3
.L26:
	leaq	4+flag(%rip), %rax
	leal	-1(%rcx), %edx
	leaq	4(%rax), %rsi
	leaq	(%rsi,%rdx,4), %rdx
	.p2align 4,,10
	.p2align 3
.L16:
	movl	(%rax), %esi
	testl	%esi, %esi
	jle	.L15
	movl	$0, (%rax)
.L15:
	addq	$4, %rax
	cmpq	%rdx, %rax
	jne	.L16
	movl	m(%rip), %ebx
	testl	%ebx, %ebx
	jle	.L18
.L17:
	xorl	%eax, %eax
	.p2align 4,,10
	.p2align 3
.L21:
	movslq	(%r14,%rax,4), %rdx
	cmpl	$-1, 0(%rbp,%rdx,4)
	je	.L20
	movslq	(%r12,%rax,4), %rdx
	movl	$1, 0(%rbp,%rdx,4)
.L20:
	addq	$1, %rax
	cmpl	%eax, %ebx
	jg	.L21
	testl	%ecx, %ecx
	jle	.L28
.L18:
	movl	$1, %ebx
	xorl	%r9d, %r9d
	jmp	.L25
	.p2align 4,,10
	.p2align 3
.L23:
	addq	$1, %rbx
	cmpl	%ebx, %ecx
	jl	.L40
.L25:
	movl	0(%rbp,%rbx,4), %eax
	movl	%ebx, %edx
	testl	%eax, %eax
	jne	.L23
	xorl	%eax, %eax
	movq	%r13, %rsi
	movl	$1, %edi
	movl	%r9d, 12(%rsp)
	call	__printf_chk@PLT
	movl	12(%rsp), %r9d
	subl	$1, %r15d
	movl	$1, %eax
	movl	n(%rip), %ecx
	movl	$-1, 0(%rbp,%rbx,4)
	addl	$1, %r9d
	cmpl	$1, %r9d
	cmove	8(%rsp), %eax
	addq	$1, %rbx
	movl	%eax, 8(%rsp)
	cmpl	%ebx, %ecx
	jge	.L25
.L40:
	testl	%r15d, %r15d
	jle	.L13
.L28:
	movl	m(%rip), %ebx
	testl	%ecx, %ecx
	jg	.L26
.L39:
	testl	%ebx, %ebx
	jg	.L17
	jmp	.L28
.L29:
	movl	$0, 8(%rsp)
	leaq	.LC3(%rip), %r13
.L13:
	movl	8(%rsp), %edx
	movq	%r13, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	addq	$24, %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
.LFE24:
	.size	main, .-main
	.globl	flag
	.bss
	.align 32
	.type	flag, @object
	.size	flag, 20004
flag:
	.zero	20004
	.globl	y
	.align 32
	.type	y, @object
	.size	y, 400000
y:
	.zero	400000
	.globl	x
	.align 32
	.type	x, @object
	.size	x, 400000
x:
	.zero	400000
	.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:

/*
AizuOnline A0519
Title Worst sport writer

*/
#include <stdio.h>
// Select Below
//#include <stdlib.h>
//#include <string.h>
//#include <float.h>
//#include <math.h>
//#include <limits.h>
//Global data section
#define SHOUGENNO 100000
#define NINZUU 5000
int n,m;
int x[SHOUGENNO],y[SHOUGENNO];
int flag[NINZUU+1];
//
void show()
{
  int i;
  for(i=1;i<=n;i++)
    printf("%d:",flag[i]);
  printf("\n");
}
main()
{
  int i,cnt,cnt2,multi;

  scanf("%d ",&n);
  scanf("%d ",&m);
  for(i=0;i<m;i++)
    scanf("%d %d",&x[i],&y[i]);
  for(i=0;i<n;i++)
    flag[i]=0;

  cnt=n;multi=0; 

  while(cnt>0)
    {
      for(i=1;i<=n;i++)
	if(flag[i]>0)
	  flag[i]=0;
      //show();
      for(i=0;i<m;i++)
	if(flag[x[i]]!=-1)
	  flag[y[i]]=1;
      cnt2=0;
      for(i=1;i<=n;i++)
	{
	  if(flag[i]==0)
	    {
	      printf("%d\n",i);
	      cnt--;
	      flag[i]=-1;
	      cnt2++;
	      if(cnt2>1)
		multi=1;
	    }
	}
      //show();
    }
  printf("%d\n",multi);  
  return(0);
}
4
5
1 2
3 1
3 2
3 4
4 1

3
4
1
2
0

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

```c
/*
AizuOnline A0519
Title Worst sport writer

*/
#include <stdio.h>
// Select Below
//#include <stdlib.h>
//#include <string.h>
//#include <float.h>
//#include <math.h>
//#include <limits.h>
//Global data section
#define SHOUGENNO 100000
#define NINZUU 5000
int n,m;
int x[SHOUGENNO],y[SHOUGENNO];
int flag[NINZUU+1];
//
void show()
{
  int i;
  for(i=1;i<=n;i++)
    printf("%d:",flag[i]);
  printf("\n");
}
main()
{
  int i,cnt,cnt2,multi;

  scanf("%d ",&n);
  scanf("%d ",&m);
  for(i=0;i<m;i++)
    scanf("%d %d",&x[i],&y[i]);
  for(i=0;i<n;i++)
    flag[i]=0;

  cnt=n;multi=0; 

  while(cnt>0)
    {
      for(i=1;i<=n;i++)
	if(flag[i]>0)
	  flag[i]=0;
      //show();
      for(i=0;i<m;i++)
	if(flag[x[i]]!=-1)
	  flag[y[i]]=1;
      cnt2=0;
      for(i=1;i<=n;i++)
	{
	  if(flag[i]==0)
	    {
	      printf("%d\n",i);
	      cnt--;
	      flag[i]=-1;
	      cnt2++;
	      if(cnt2>1)
		multi=1;
	    }
	}
      //show();
    }
  printf("%d\n",multi);  
  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	x
	.align 32
	.type	x, @object
	.size	x, 400000
x:
	.zero	400000
	.globl	y
	.align 32
	.type	y, @object
	.size	y, 400000
y:
	.zero	400000
	.globl	flag
	.align 32
	.type	flag, @object
	.size	flag, 20004
flag:
	.zero	20004
	.section	.rodata
.LC0:
	.string	"%d:"
	.text
	.globl	show
	.type	show, @function
show:
.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
	movl	$1, -4(%rbp)
	jmp	.L2
.L3:
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	flag(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -4(%rbp)
.L2:
	movl	n(%rip), %eax
	cmpl	%eax, -4(%rbp)
	jle	.L3
	movl	$10, %edi
	call	putchar@PLT
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	show, .-show
	.section	.rodata
.LC1:
	.string	"%d "
.LC2:
	.string	"%d %d"
.LC3:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB1:
	.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
	leaq	n(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	m(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -16(%rbp)
	jmp	.L5
.L6:
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	y(%rip), %rax
	addq	%rax, %rdx
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	x(%rip), %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -16(%rbp)
.L5:
	movl	m(%rip), %eax
	cmpl	%eax, -16(%rbp)
	jl	.L6
	movl	$0, -16(%rbp)
	jmp	.L7
.L8:
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	flag(%rip), %rax
	movl	$0, (%rdx,%rax)
	addl	$1, -16(%rbp)
.L7:
	movl	n(%rip), %eax
	cmpl	%eax, -16(%rbp)
	jl	.L8
	movl	n(%rip), %eax
	movl	%eax, -12(%rbp)
	movl	$0, -4(%rbp)
	jmp	.L9
.L19:
	movl	$1, -16(%rbp)
	jmp	.L10
.L12:
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	flag(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	jle	.L11
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	flag(%rip), %rax
	movl	$0, (%rdx,%rax)
.L11:
	addl	$1, -16(%rbp)
.L10:
	movl	n(%rip), %eax
	cmpl	%eax, -16(%rbp)
	jle	.L12
	movl	$0, -16(%rbp)
	jmp	.L13
.L15:
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	x(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	flag(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	$-1, %eax
	je	.L14
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	y(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	flag(%rip), %rax
	movl	$1, (%rdx,%rax)
.L14:
	addl	$1, -16(%rbp)
.L13:
	movl	m(%rip), %eax
	cmpl	%eax, -16(%rbp)
	jl	.L15
	movl	$0, -8(%rbp)
	movl	$1, -16(%rbp)
	jmp	.L16
.L18:
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	flag(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	jne	.L17
	movl	-16(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	subl	$1, -12(%rbp)
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	flag(%rip), %rax
	movl	$-1, (%rdx,%rax)
	addl	$1, -8(%rbp)
	cmpl	$1, -8(%rbp)
	jle	.L17
	movl	$1, -4(%rbp)
.L17:
	addl	$1, -16(%rbp)
.L16:
	movl	n(%rip), %eax
	cmpl	%eax, -16(%rbp)
	jle	.L18
.L9:
	cmpl	$0, -12(%rbp)
	jg	.L19
	movl	-4(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.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	x
	.align 32
	.type	x, @object
	.size	x, 400000
x:
	.zero	400000
	.globl	y
	.align 32
	.type	y, @object
	.size	y, 400000
y:
	.zero	400000
	.globl	flag
	.align 32
	.type	flag, @object
	.size	flag, 20004
flag:
	.zero	20004
	.section	.rodata
.LC0:
	.string	"%d:"
	.text
	.globl	show
	.type	show, @function
show:
.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
	movl	$1, -4(%rbp)
	jmp	.L2
.L3:
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	flag(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -4(%rbp)
.L2:
	movl	n(%rip), %eax
	cmpl	%eax, -4(%rbp)
	jle	.L3
	movl	$10, %edi
	call	putchar@PLT
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	show, .-show
	.section	.rodata
.LC1:
	.string	"%d "
.LC2:
	.string	"%d %d"
.LC3:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB1:
	.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
	leaq	n(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	m(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -16(%rbp)
	jmp	.L5
.L6:
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	y(%rip), %rax
	addq	%rax, %rdx
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	x(%rip), %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -16(%rbp)
.L5:
	movl	m(%rip), %eax
	cmpl	%eax, -16(%rbp)
	jl	.L6
	movl	$0, -16(%rbp)
	jmp	.L7
.L8:
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	flag(%rip), %rax
	movl	$0, (%rdx,%rax)
	addl	$1, -16(%rbp)
.L7:
	movl	n(%rip), %eax
	cmpl	%eax, -16(%rbp)
	jl	.L8
	movl	n(%rip), %eax
	movl	%eax, -12(%rbp)
	movl	$0, -4(%rbp)
	jmp	.L9
.L19:
	movl	$1, -16(%rbp)
	jmp	.L10
.L12:
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	flag(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	jle	.L11
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	flag(%rip), %rax
	movl	$0, (%rdx,%rax)
.L11:
	addl	$1, -16(%rbp)
.L10:
	movl	n(%rip), %eax
	cmpl	%eax, -16(%rbp)
	jle	.L12
	movl	$0, -16(%rbp)
	jmp	.L13
.L15:
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	x(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	flag(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	$-1, %eax
	je	.L14
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	y(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	flag(%rip), %rax
	movl	$1, (%rdx,%rax)
.L14:
	addl	$1, -16(%rbp)
.L13:
	movl	m(%rip), %eax
	cmpl	%eax, -16(%rbp)
	jl	.L15
	movl	$0, -8(%rbp)
	movl	$1, -16(%rbp)
	jmp	.L16
.L18:
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	flag(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	jne	.L17
	movl	-16(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	subl	$1, -12(%rbp)
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	flag(%rip), %rax
	movl	$-1, (%rdx,%rax)
	addl	$1, -8(%rbp)
	cmpl	$1, -8(%rbp)
	jle	.L17
	movl	$1, -4(%rbp)
.L17:
	addl	$1, -16(%rbp)
.L16:
	movl	n(%rip), %eax
	cmpl	%eax, -16(%rbp)
	jle	.L18
.L9:
	cmpl	$0, -12(%rbp)
	jg	.L19
	movl	-4(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.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:
