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>
#include <stdlib.h>
#include <string.h>

int main(void){

    int i, N, M, count=0;
    scanf("%d%d",&N,&M);
    int table[N+1], heat[N+1];

    for(i=0;i<=N;i++){
        table[i] = 1;
    }

    for(i=1;i<=N;i++){
        scanf("%d",&heat[i]);
    }

    for(i=0;i<M;i++){
        int a, b;
        scanf("%d%d",&a, &b);
        if(heat[a]==heat[b]){
            table[a]--;
            table[b]--;
        }else if(heat[a]<heat[b]){
            table[a]--;
        }else{
            table[b]--;
        }
    }

    for(i=1;i<=N;i++){
        if(table[i]==1){
            count++;
        }
    }

    printf("%d",count);

    return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d"
	.text
	.globl	main
	.type	main, @function
main:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$104, %rsp
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	movq	%rsp, %rax
	movq	%rax, %rbx
	movl	$0, -92(%rbp)
	leaq	-108(%rbp), %rdx
	leaq	-112(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-112(%rbp), %eax
	addl	$1, %eax
	movslq	%eax, %rdx
	subq	$1, %rdx
	movq	%rdx, -88(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, -128(%rbp)
	movq	$0, -120(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, -144(%rbp)
	movq	$0, -136(%rbp)
	cltq
	leaq	0(,%rax,4), %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %esi
	movl	$0, %edx
	divq	%rsi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L2:
	cmpq	%rdx, %rsp
	je	.L3
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L2
.L3:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L4
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L4:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -80(%rbp)
	movl	-112(%rbp), %eax
	addl	$1, %eax
	movslq	%eax, %rdx
	subq	$1, %rdx
	movq	%rdx, -72(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, %r14
	movl	$0, %r15d
	movslq	%eax, %rdx
	movq	%rdx, %r12
	movl	$0, %r13d
	cltq
	leaq	0(,%rax,4), %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %edi
	movl	$0, %edx
	divq	%rdi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L5:
	cmpq	%rdx, %rsp
	je	.L6
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L5
.L6:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L7
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L7:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -64(%rbp)
	movl	$0, -96(%rbp)
	jmp	.L8
.L9:
	movq	-80(%rbp), %rax
	movl	-96(%rbp), %edx
	movslq	%edx, %rdx
	movl	$1, (%rax,%rdx,4)
	addl	$1, -96(%rbp)
.L8:
	movl	-112(%rbp), %eax
	cmpl	%eax, -96(%rbp)
	jle	.L9
	movl	$1, -96(%rbp)
	jmp	.L10
.L11:
	movl	-96(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-64(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -96(%rbp)
.L10:
	movl	-112(%rbp), %eax
	cmpl	%eax, -96(%rbp)
	jle	.L11
	movl	$0, -96(%rbp)
	jmp	.L12
.L16:
	leaq	-100(%rbp), %rdx
	leaq	-104(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-104(%rbp), %edx
	movq	-64(%rbp), %rax
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %ecx
	movl	-100(%rbp), %edx
	movq	-64(%rbp), %rax
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	cmpl	%eax, %ecx
	jne	.L13
	movl	-104(%rbp), %eax
	movq	-80(%rbp), %rdx
	movslq	%eax, %rcx
	movl	(%rdx,%rcx,4), %edx
	leal	-1(%rdx), %ecx
	movq	-80(%rbp), %rdx
	cltq
	movl	%ecx, (%rdx,%rax,4)
	movl	-100(%rbp), %eax
	movq	-80(%rbp), %rdx
	movslq	%eax, %rcx
	movl	(%rdx,%rcx,4), %edx
	leal	-1(%rdx), %ecx
	movq	-80(%rbp), %rdx
	cltq
	movl	%ecx, (%rdx,%rax,4)
	jmp	.L14
.L13:
	movl	-104(%rbp), %edx
	movq	-64(%rbp), %rax
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %ecx
	movl	-100(%rbp), %edx
	movq	-64(%rbp), %rax
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	cmpl	%eax, %ecx
	jge	.L15
	movl	-104(%rbp), %eax
	movq	-80(%rbp), %rdx
	movslq	%eax, %rcx
	movl	(%rdx,%rcx,4), %edx
	leal	-1(%rdx), %ecx
	movq	-80(%rbp), %rdx
	cltq
	movl	%ecx, (%rdx,%rax,4)
	jmp	.L14
.L15:
	movl	-100(%rbp), %eax
	movq	-80(%rbp), %rdx
	movslq	%eax, %rcx
	movl	(%rdx,%rcx,4), %edx
	leal	-1(%rdx), %ecx
	movq	-80(%rbp), %rdx
	cltq
	movl	%ecx, (%rdx,%rax,4)
.L14:
	addl	$1, -96(%rbp)
.L12:
	movl	-108(%rbp), %eax
	cmpl	%eax, -96(%rbp)
	jl	.L16
	movl	$1, -96(%rbp)
	jmp	.L17
.L19:
	movq	-80(%rbp), %rax
	movl	-96(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	cmpl	$1, %eax
	jne	.L18
	addl	$1, -92(%rbp)
.L18:
	addl	$1, -96(%rbp)
.L17:
	movl	-112(%rbp), %eax
	cmpl	%eax, -96(%rbp)
	jle	.L19
	movl	-92(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	%rbx, %rsp
	movq	-56(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L21
	call	__stack_chk_fail@PLT
.L21:
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.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"
.LC2:
	.string	"%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB51:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	leaq	.LC0(%rip), %rdi
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r15
	pushq	%r14
	leaq	-68(%rbp), %rdx
	leaq	-72(%rbp), %rsi
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$56, %rsp
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	-72(%rbp), %esi
	movq	%rsp, %rdi
	leal	1(%rsi), %ecx
	movslq	%ecx, %rax
	leaq	15(,%rax,4), %rax
	movq	%rax, %r8
	movq	%rax, %rdx
	andq	$-4096, %r8
	andq	$-16, %rdx
	subq	%r8, %rdi
	cmpq	%rdi, %rsp
	je	.L3
.L48:
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	cmpq	%rdi, %rsp
	jne	.L48
.L3:
	andl	$4095, %edx
	subq	%rdx, %rsp
	testq	%rdx, %rdx
	jne	.L49
.L4:
	movq	%rax, %rdx
	movq	%rsp, %rdi
	andq	$-4096, %rax
	movq	%rsp, %rbx
	andq	$-16, %rdx
	subq	%rax, %rdi
.L5:
	cmpq	%rdi, %rsp
	je	.L6
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L5
.L49:
	orq	$0, -8(%rsp,%rdx)
	jmp	.L4
.L6:
	andl	$4095, %edx
	subq	%rdx, %rsp
	testq	%rdx, %rdx
	jne	.L50
.L7:
	movq	%rsp, %r12
	testl	%esi, %esi
	js	.L8
	cmpl	$2, %esi
	jle	.L32
	movl	%ecx, %edx
	movdqa	.LC1(%rip), %xmm2
	movq	%rbx, %rax
	shrl	$2, %edx
	salq	$4, %rdx
	addq	%rbx, %rdx
	.p2align 4,,10
	.p2align 3
.L10:
	movups	%xmm2, (%rax)
	addq	$16, %rax
	cmpq	%rdx, %rax
	jne	.L10
	movl	%ecx, %eax
	andl	$-4, %eax
	andl	$3, %ecx
	je	.L30
.L9:
	movslq	%eax, %rdx
	leal	1(%rax), %ecx
	leaq	(%rbx,%rdx,4), %rdx
	movl	$1, (%rdx)
	cmpl	%ecx, %esi
	jl	.L12
	addl	$2, %eax
	movl	$1, 4(%rdx)
	cmpl	%eax, %esi
	jl	.L30
	movl	$1, 8(%rdx)
.L30:
	leaq	4(%r12), %r13
	movl	$1, %r15d
	leaq	.LC2(%rip), %r14
	.p2align 4,,10
	.p2align 3
.L13:
	movq	%r13, %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	addl	$1, %r15d
	call	__isoc99_scanf@PLT
	addq	$4, %r13
	cmpl	%r15d, -72(%rbp)
	jge	.L13
	movl	-68(%rbp), %eax
	testl	%eax, %eax
	jle	.L14
.L29:
	leaq	-64(%rbp), %rax
	xorl	%r15d, %r15d
	leaq	-60(%rbp), %r13
	movq	%rax, -88(%rbp)
	jmp	.L18
	.p2align 4,,10
	.p2align 3
.L15:
	jge	.L17
	subl	$1, (%rbx,%rdx,4)
.L16:
	addl	$1, %r15d
	cmpl	%r15d, -68(%rbp)
	jle	.L14
.L18:
	movq	-88(%rbp), %rsi
	movq	%r13, %rdx
	leaq	.LC0(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	-60(%rbp), %rax
	movslq	-64(%rbp), %rdx
	movl	(%r12,%rax,4), %ecx
	cmpl	%ecx, (%r12,%rdx,4)
	jne	.L15
	subl	$1, (%rbx,%rdx,4)
	addl	$1, %r15d
	subl	$1, (%rbx,%rax,4)
	cmpl	%r15d, -68(%rbp)
	jg	.L18
.L14:
	movl	-72(%rbp), %ecx
	testl	%ecx, %ecx
	jle	.L19
	leal	-1(%rcx), %eax
	cmpl	$2, %eax
	jbe	.L33
	movl	%ecx, %edx
	movdqa	.LC1(%rip), %xmm2
	leaq	4(%rbx), %rax
	pxor	%xmm0, %xmm0
	shrl	$2, %edx
	subl	$1, %edx
	salq	$4, %rdx
	leaq	20(%rbx,%rdx), %rdx
	.p2align 4,,10
	.p2align 3
.L21:
	movdqu	(%rax), %xmm1
	addq	$16, %rax
	pcmpeqd	%xmm2, %xmm1
	psubd	%xmm1, %xmm0
	cmpq	%rax, %rdx
	jne	.L21
	movdqa	%xmm0, %xmm1
	movl	%ecx, %esi
	psrldq	$8, %xmm1
	andl	$-4, %esi
	paddd	%xmm1, %xmm0
	leal	1(%rsi), %eax
	movdqa	%xmm0, %xmm1
	psrldq	$4, %xmm1
	paddd	%xmm1, %xmm0
	movd	%xmm0, %edx
	cmpl	%esi, %ecx
	je	.L23
.L20:
	movslq	%eax, %rsi
	xorl	%edi, %edi
	leaq	(%rbx,%rsi,4), %rsi
	cmpl	$1, (%rsi)
	sete	%dil
	addl	%edi, %edx
	leal	1(%rax), %edi
	cmpl	%edi, %ecx
	jl	.L23
	cmpl	$1, 4(%rsi)
	jne	.L26
	addl	$1, %edx
.L26:
	addl	$2, %eax
	cmpl	%eax, %ecx
	jl	.L23
	cmpl	$1, 8(%rsi)
	jne	.L23
	addl	$1, %edx
	.p2align 4,,10
	.p2align 3
.L23:
	xorl	%eax, %eax
	movq	%r14, %rsi
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	-56(%rbp), %rax
	subq	%fs:40, %rax
	jne	.L51
	leaq	-40(%rbp), %rsp
	xorl	%eax, %eax
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.cfi_remember_state
	.cfi_def_cfa 7, 8
	ret
	.p2align 4,,10
	.p2align 3
.L17:
	.cfi_restore_state
	subl	$1, (%rbx,%rax,4)
	jmp	.L16
.L12:
	testl	%esi, %esi
	jg	.L30
.L8:
	cmpl	$0, -68(%rbp)
	leaq	.LC2(%rip), %r14
	jg	.L29
.L19:
	xorl	%edx, %edx
	jmp	.L23
.L32:
	xorl	%eax, %eax
	jmp	.L9
.L33:
	xorl	%edx, %edx
	movl	$1, %eax
	jmp	.L20
.L50:
	orq	$0, -8(%rsp,%rdx)
	jmp	.L7
.L51:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE51:
	.size	main, .-main
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC1:
	.long	1
	.long	1
	.long	1
	.long	1
	.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"
.LC2:
	.string	"%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB51:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	leaq	.LC0(%rip), %rdi
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r15
	pushq	%r14
	leaq	-68(%rbp), %rdx
	leaq	-72(%rbp), %rsi
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$56, %rsp
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	-72(%rbp), %esi
	movq	%rsp, %rdi
	leal	1(%rsi), %ecx
	movslq	%ecx, %rax
	leaq	15(,%rax,4), %rax
	movq	%rax, %r8
	movq	%rax, %rdx
	andq	$-4096, %r8
	andq	$-16, %rdx
	subq	%r8, %rdi
	cmpq	%rdi, %rsp
	je	.L3
.L48:
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	cmpq	%rdi, %rsp
	jne	.L48
.L3:
	andl	$4095, %edx
	subq	%rdx, %rsp
	testq	%rdx, %rdx
	jne	.L49
.L4:
	movq	%rax, %rdx
	movq	%rsp, %rdi
	andq	$-4096, %rax
	movq	%rsp, %rbx
	andq	$-16, %rdx
	subq	%rax, %rdi
.L5:
	cmpq	%rdi, %rsp
	je	.L6
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L5
.L49:
	orq	$0, -8(%rsp,%rdx)
	jmp	.L4
.L6:
	andl	$4095, %edx
	subq	%rdx, %rsp
	testq	%rdx, %rdx
	jne	.L50
.L7:
	movq	%rsp, %r12
	testl	%esi, %esi
	js	.L8
	cmpl	$2, %esi
	jle	.L32
	movl	%ecx, %edx
	movdqa	.LC1(%rip), %xmm2
	movq	%rbx, %rax
	shrl	$2, %edx
	salq	$4, %rdx
	addq	%rbx, %rdx
	.p2align 4,,10
	.p2align 3
.L10:
	movups	%xmm2, (%rax)
	addq	$16, %rax
	cmpq	%rdx, %rax
	jne	.L10
	movl	%ecx, %eax
	andl	$-4, %eax
	andl	$3, %ecx
	je	.L30
.L9:
	movslq	%eax, %rdx
	leal	1(%rax), %ecx
	leaq	(%rbx,%rdx,4), %rdx
	movl	$1, (%rdx)
	cmpl	%ecx, %esi
	jl	.L12
	addl	$2, %eax
	movl	$1, 4(%rdx)
	cmpl	%eax, %esi
	jl	.L30
	movl	$1, 8(%rdx)
.L30:
	leaq	4(%r12), %r13
	movl	$1, %r15d
	leaq	.LC2(%rip), %r14
	.p2align 4,,10
	.p2align 3
.L13:
	movq	%r13, %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	addl	$1, %r15d
	call	__isoc99_scanf@PLT
	addq	$4, %r13
	cmpl	%r15d, -72(%rbp)
	jge	.L13
	movl	-68(%rbp), %eax
	testl	%eax, %eax
	jle	.L14
.L29:
	leaq	-64(%rbp), %rax
	xorl	%r15d, %r15d
	leaq	-60(%rbp), %r13
	movq	%rax, -88(%rbp)
	jmp	.L18
	.p2align 4,,10
	.p2align 3
.L15:
	jge	.L17
	subl	$1, (%rbx,%rdx,4)
.L16:
	addl	$1, %r15d
	cmpl	%r15d, -68(%rbp)
	jle	.L14
.L18:
	movq	-88(%rbp), %rsi
	movq	%r13, %rdx
	leaq	.LC0(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	-60(%rbp), %rax
	movslq	-64(%rbp), %rdx
	movl	(%r12,%rax,4), %ecx
	cmpl	%ecx, (%r12,%rdx,4)
	jne	.L15
	subl	$1, (%rbx,%rdx,4)
	addl	$1, %r15d
	subl	$1, (%rbx,%rax,4)
	cmpl	%r15d, -68(%rbp)
	jg	.L18
.L14:
	movl	-72(%rbp), %ecx
	testl	%ecx, %ecx
	jle	.L19
	leal	-1(%rcx), %eax
	cmpl	$2, %eax
	jbe	.L33
	movl	%ecx, %edx
	movdqa	.LC1(%rip), %xmm2
	leaq	4(%rbx), %rax
	pxor	%xmm0, %xmm0
	shrl	$2, %edx
	subl	$1, %edx
	salq	$4, %rdx
	leaq	20(%rbx,%rdx), %rdx
	.p2align 4,,10
	.p2align 3
.L21:
	movdqu	(%rax), %xmm1
	addq	$16, %rax
	pcmpeqd	%xmm2, %xmm1
	psubd	%xmm1, %xmm0
	cmpq	%rax, %rdx
	jne	.L21
	movdqa	%xmm0, %xmm1
	movl	%ecx, %esi
	psrldq	$8, %xmm1
	andl	$-4, %esi
	paddd	%xmm1, %xmm0
	leal	1(%rsi), %eax
	movdqa	%xmm0, %xmm1
	psrldq	$4, %xmm1
	paddd	%xmm1, %xmm0
	movd	%xmm0, %edx
	cmpl	%esi, %ecx
	je	.L23
.L20:
	movslq	%eax, %rsi
	xorl	%edi, %edi
	leaq	(%rbx,%rsi,4), %rsi
	cmpl	$1, (%rsi)
	sete	%dil
	addl	%edi, %edx
	leal	1(%rax), %edi
	cmpl	%edi, %ecx
	jl	.L23
	cmpl	$1, 4(%rsi)
	jne	.L26
	addl	$1, %edx
.L26:
	addl	$2, %eax
	cmpl	%eax, %ecx
	jl	.L23
	cmpl	$1, 8(%rsi)
	jne	.L23
	addl	$1, %edx
	.p2align 4,,10
	.p2align 3
.L23:
	xorl	%eax, %eax
	movq	%r14, %rsi
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	-56(%rbp), %rax
	subq	%fs:40, %rax
	jne	.L51
	leaq	-40(%rbp), %rsp
	xorl	%eax, %eax
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.cfi_remember_state
	.cfi_def_cfa 7, 8
	ret
	.p2align 4,,10
	.p2align 3
.L17:
	.cfi_restore_state
	subl	$1, (%rbx,%rax,4)
	jmp	.L16
.L12:
	testl	%esi, %esi
	jg	.L30
.L8:
	cmpl	$0, -68(%rbp)
	leaq	.LC2(%rip), %r14
	jg	.L29
.L19:
	xorl	%edx, %edx
	jmp	.L23
.L32:
	xorl	%eax, %eax
	jmp	.L9
.L33:
	xorl	%edx, %edx
	movl	$1, %eax
	jmp	.L20
.L50:
	orq	$0, -8(%rsp,%rdx)
	jmp	.L7
.L51:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE51:
	.size	main, .-main
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC1:
	.long	1
	.long	1
	.long	1
	.long	1
	.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>
#include <stdlib.h>
#include <string.h>

int main(void){

    int i, N, M, count=0;
    scanf("%d%d",&N,&M);
    int table[N+1], heat[N+1];

    for(i=0;i<=N;i++){
        table[i] = 1;
    }

    for(i=1;i<=N;i++){
        scanf("%d",&heat[i]);
    }

    for(i=0;i<M;i++){
        int a, b;
        scanf("%d%d",&a, &b);
        if(heat[a]==heat[b]){
            table[a]--;
            table[b]--;
        }else if(heat[a]<heat[b]){
            table[a]--;
        }else{
            table[b]--;
        }
    }

    for(i=1;i<=N;i++){
        if(table[i]==1){
            count++;
        }
    }

    printf("%d",count);

    return 0;
}
6 5
8 6 9 1 2 1
1 3
4 2
4 0
4 6
4 6
 4 3
1 2 3 4
1 3
3 3
2 4
 4 2
2 4 3 5
1 3
3 3
2 4
 4 0
2 4 3 5
1 3
3 3
4 4
 6 0
9 6 8 1 1 1
0 3
3 0
4 1
4 2
1 6
 6 5
8 6 9 1 2 0
0 3
4 0
4 0
2 6
4 6
 4 3
1 6 3 3
1 3
2 2
3 4
 6 5
8 6 9 1 2 1
1 3
4 1
4 0
4 6
4 6
 4 3
1 2 3 5
1 3
3 3
2 4
 6 5
8 6 9 1 2 1
1 3
4 1
4 0
4 3
4 6

3 1 2 4 6 4 0 3 1 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>
#include <stdlib.h>
#include <string.h>

int main(void){

    int i, N, M, count=0;
    scanf("%d%d",&N,&M);
    int table[N+1], heat[N+1];

    for(i=0;i<=N;i++){
        table[i] = 1;
    }

    for(i=1;i<=N;i++){
        scanf("%d",&heat[i]);
    }

    for(i=0;i<M;i++){
        int a, b;
        scanf("%d%d",&a, &b);
        if(heat[a]==heat[b]){
            table[a]--;
            table[b]--;
        }else if(heat[a]<heat[b]){
            table[a]--;
        }else{
            table[b]--;
        }
    }

    for(i=1;i<=N;i++){
        if(table[i]==1){
            count++;
        }
    }

    printf("%d",count);

    return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d"
	.text
	.globl	main
	.type	main, @function
main:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$104, %rsp
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	movq	%rsp, %rax
	movq	%rax, %rbx
	movl	$0, -92(%rbp)
	leaq	-108(%rbp), %rdx
	leaq	-112(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-112(%rbp), %eax
	addl	$1, %eax
	movslq	%eax, %rdx
	subq	$1, %rdx
	movq	%rdx, -88(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, -128(%rbp)
	movq	$0, -120(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, -144(%rbp)
	movq	$0, -136(%rbp)
	cltq
	leaq	0(,%rax,4), %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %esi
	movl	$0, %edx
	divq	%rsi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L2:
	cmpq	%rdx, %rsp
	je	.L3
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L2
.L3:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L4
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L4:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -80(%rbp)
	movl	-112(%rbp), %eax
	addl	$1, %eax
	movslq	%eax, %rdx
	subq	$1, %rdx
	movq	%rdx, -72(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, %r14
	movl	$0, %r15d
	movslq	%eax, %rdx
	movq	%rdx, %r12
	movl	$0, %r13d
	cltq
	leaq	0(,%rax,4), %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %edi
	movl	$0, %edx
	divq	%rdi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L5:
	cmpq	%rdx, %rsp
	je	.L6
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L5
.L6:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L7
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L7:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -64(%rbp)
	movl	$0, -96(%rbp)
	jmp	.L8
.L9:
	movq	-80(%rbp), %rax
	movl	-96(%rbp), %edx
	movslq	%edx, %rdx
	movl	$1, (%rax,%rdx,4)
	addl	$1, -96(%rbp)
.L8:
	movl	-112(%rbp), %eax
	cmpl	%eax, -96(%rbp)
	jle	.L9
	movl	$1, -96(%rbp)
	jmp	.L10
.L11:
	movl	-96(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-64(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -96(%rbp)
.L10:
	movl	-112(%rbp), %eax
	cmpl	%eax, -96(%rbp)
	jle	.L11
	movl	$0, -96(%rbp)
	jmp	.L12
.L16:
	leaq	-100(%rbp), %rdx
	leaq	-104(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-104(%rbp), %edx
	movq	-64(%rbp), %rax
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %ecx
	movl	-100(%rbp), %edx
	movq	-64(%rbp), %rax
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	cmpl	%eax, %ecx
	jne	.L13
	movl	-104(%rbp), %eax
	movq	-80(%rbp), %rdx
	movslq	%eax, %rcx
	movl	(%rdx,%rcx,4), %edx
	leal	-1(%rdx), %ecx
	movq	-80(%rbp), %rdx
	cltq
	movl	%ecx, (%rdx,%rax,4)
	movl	-100(%rbp), %eax
	movq	-80(%rbp), %rdx
	movslq	%eax, %rcx
	movl	(%rdx,%rcx,4), %edx
	leal	-1(%rdx), %ecx
	movq	-80(%rbp), %rdx
	cltq
	movl	%ecx, (%rdx,%rax,4)
	jmp	.L14
.L13:
	movl	-104(%rbp), %edx
	movq	-64(%rbp), %rax
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %ecx
	movl	-100(%rbp), %edx
	movq	-64(%rbp), %rax
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	cmpl	%eax, %ecx
	jge	.L15
	movl	-104(%rbp), %eax
	movq	-80(%rbp), %rdx
	movslq	%eax, %rcx
	movl	(%rdx,%rcx,4), %edx
	leal	-1(%rdx), %ecx
	movq	-80(%rbp), %rdx
	cltq
	movl	%ecx, (%rdx,%rax,4)
	jmp	.L14
.L15:
	movl	-100(%rbp), %eax
	movq	-80(%rbp), %rdx
	movslq	%eax, %rcx
	movl	(%rdx,%rcx,4), %edx
	leal	-1(%rdx), %ecx
	movq	-80(%rbp), %rdx
	cltq
	movl	%ecx, (%rdx,%rax,4)
.L14:
	addl	$1, -96(%rbp)
.L12:
	movl	-108(%rbp), %eax
	cmpl	%eax, -96(%rbp)
	jl	.L16
	movl	$1, -96(%rbp)
	jmp	.L17
.L19:
	movq	-80(%rbp), %rax
	movl	-96(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	cmpl	$1, %eax
	jne	.L18
	addl	$1, -92(%rbp)
.L18:
	addl	$1, -96(%rbp)
.L17:
	movl	-112(%rbp), %eax
	cmpl	%eax, -96(%rbp)
	jle	.L19
	movl	-92(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	%rbx, %rsp
	movq	-56(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L21
	call	__stack_chk_fail@PLT
.L21:
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.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"
	.text
	.globl	main
	.type	main, @function
main:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$104, %rsp
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	movq	%rsp, %rax
	movq	%rax, %rbx
	movl	$0, -92(%rbp)
	leaq	-108(%rbp), %rdx
	leaq	-112(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-112(%rbp), %eax
	addl	$1, %eax
	movslq	%eax, %rdx
	subq	$1, %rdx
	movq	%rdx, -88(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, -128(%rbp)
	movq	$0, -120(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, -144(%rbp)
	movq	$0, -136(%rbp)
	cltq
	leaq	0(,%rax,4), %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %esi
	movl	$0, %edx
	divq	%rsi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L2:
	cmpq	%rdx, %rsp
	je	.L3
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L2
.L3:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L4
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L4:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -80(%rbp)
	movl	-112(%rbp), %eax
	addl	$1, %eax
	movslq	%eax, %rdx
	subq	$1, %rdx
	movq	%rdx, -72(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, %r14
	movl	$0, %r15d
	movslq	%eax, %rdx
	movq	%rdx, %r12
	movl	$0, %r13d
	cltq
	leaq	0(,%rax,4), %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %edi
	movl	$0, %edx
	divq	%rdi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L5:
	cmpq	%rdx, %rsp
	je	.L6
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L5
.L6:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L7
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L7:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -64(%rbp)
	movl	$0, -96(%rbp)
	jmp	.L8
.L9:
	movq	-80(%rbp), %rax
	movl	-96(%rbp), %edx
	movslq	%edx, %rdx
	movl	$1, (%rax,%rdx,4)
	addl	$1, -96(%rbp)
.L8:
	movl	-112(%rbp), %eax
	cmpl	%eax, -96(%rbp)
	jle	.L9
	movl	$1, -96(%rbp)
	jmp	.L10
.L11:
	movl	-96(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-64(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -96(%rbp)
.L10:
	movl	-112(%rbp), %eax
	cmpl	%eax, -96(%rbp)
	jle	.L11
	movl	$0, -96(%rbp)
	jmp	.L12
.L16:
	leaq	-100(%rbp), %rdx
	leaq	-104(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-104(%rbp), %edx
	movq	-64(%rbp), %rax
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %ecx
	movl	-100(%rbp), %edx
	movq	-64(%rbp), %rax
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	cmpl	%eax, %ecx
	jne	.L13
	movl	-104(%rbp), %eax
	movq	-80(%rbp), %rdx
	movslq	%eax, %rcx
	movl	(%rdx,%rcx,4), %edx
	leal	-1(%rdx), %ecx
	movq	-80(%rbp), %rdx
	cltq
	movl	%ecx, (%rdx,%rax,4)
	movl	-100(%rbp), %eax
	movq	-80(%rbp), %rdx
	movslq	%eax, %rcx
	movl	(%rdx,%rcx,4), %edx
	leal	-1(%rdx), %ecx
	movq	-80(%rbp), %rdx
	cltq
	movl	%ecx, (%rdx,%rax,4)
	jmp	.L14
.L13:
	movl	-104(%rbp), %edx
	movq	-64(%rbp), %rax
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %ecx
	movl	-100(%rbp), %edx
	movq	-64(%rbp), %rax
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	cmpl	%eax, %ecx
	jge	.L15
	movl	-104(%rbp), %eax
	movq	-80(%rbp), %rdx
	movslq	%eax, %rcx
	movl	(%rdx,%rcx,4), %edx
	leal	-1(%rdx), %ecx
	movq	-80(%rbp), %rdx
	cltq
	movl	%ecx, (%rdx,%rax,4)
	jmp	.L14
.L15:
	movl	-100(%rbp), %eax
	movq	-80(%rbp), %rdx
	movslq	%eax, %rcx
	movl	(%rdx,%rcx,4), %edx
	leal	-1(%rdx), %ecx
	movq	-80(%rbp), %rdx
	cltq
	movl	%ecx, (%rdx,%rax,4)
.L14:
	addl	$1, -96(%rbp)
.L12:
	movl	-108(%rbp), %eax
	cmpl	%eax, -96(%rbp)
	jl	.L16
	movl	$1, -96(%rbp)
	jmp	.L17
.L19:
	movq	-80(%rbp), %rax
	movl	-96(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	cmpl	$1, %eax
	jne	.L18
	addl	$1, -92(%rbp)
.L18:
	addl	$1, -96(%rbp)
.L17:
	movl	-112(%rbp), %eax
	cmpl	%eax, -96(%rbp)
	jle	.L19
	movl	-92(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	%rbx, %rsp
	movq	-56(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L21
	call	__stack_chk_fail@PLT
.L21:
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.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:
