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 <math.h>
#include <ctype.h>
#include <string.h>
#define ll long long

int main(void){
int N;
scanf("%d",&N);
int *a=(int*)malloc(sizeof(int)*N);
int i;
for(i=0;i<N;i++) scanf("%d",&a[i]);
int max=0;
for(i=0;i<N;i++)
if(max<a[i]) max=a[i];

for(i=0;i<N;i++)
if(a[i]!=max&&a[i]!=max-1) {printf("No\n");
return 0;
}

int count=0;
for(i=0;i<N;i++)
 if(a[i]!=max) count++;

if(count==0&&max+1==N){
printf("Yes\n");
return 0;
}

if((N-count)>=2*(max-count)&&(max-count)>0){
printf("Yes\n");
return 0;
}

printf("No\n");
return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"No"
.LC2:
	.string	"Yes"
	.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
	subq	$32, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-32(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-32(%rbp), %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -16(%rbp)
	movl	$0, -28(%rbp)
	jmp	.L2
.L3:
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -28(%rbp)
.L2:
	movl	-32(%rbp), %eax
	cmpl	%eax, -28(%rbp)
	jl	.L3
	movl	$0, -24(%rbp)
	movl	$0, -28(%rbp)
	jmp	.L4
.L6:
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	%eax, -24(%rbp)
	jge	.L5
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	%eax, -24(%rbp)
.L5:
	addl	$1, -28(%rbp)
.L4:
	movl	-32(%rbp), %eax
	cmpl	%eax, -28(%rbp)
	jl	.L6
	movl	$0, -28(%rbp)
	jmp	.L7
.L10:
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	%eax, -24(%rbp)
	je	.L8
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	-24(%rbp), %edx
	subl	$1, %edx
	cmpl	%edx, %eax
	je	.L8
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	movl	$0, %eax
	jmp	.L16
.L8:
	addl	$1, -28(%rbp)
.L7:
	movl	-32(%rbp), %eax
	cmpl	%eax, -28(%rbp)
	jl	.L10
	movl	$0, -20(%rbp)
	movl	$0, -28(%rbp)
	jmp	.L11
.L13:
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	%eax, -24(%rbp)
	je	.L12
	addl	$1, -20(%rbp)
.L12:
	addl	$1, -28(%rbp)
.L11:
	movl	-32(%rbp), %eax
	cmpl	%eax, -28(%rbp)
	jl	.L13
	cmpl	$0, -20(%rbp)
	jne	.L14
	movl	-24(%rbp), %eax
	leal	1(%rax), %edx
	movl	-32(%rbp), %eax
	cmpl	%eax, %edx
	jne	.L14
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	movl	$0, %eax
	jmp	.L16
.L14:
	movl	-32(%rbp), %eax
	subl	-20(%rbp), %eax
	movl	%eax, %edx
	movl	-24(%rbp), %eax
	subl	-20(%rbp), %eax
	addl	%eax, %eax
	cmpl	%eax, %edx
	jl	.L15
	movl	-24(%rbp), %eax
	subl	-20(%rbp), %eax
	testl	%eax, %eax
	jle	.L15
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	movl	$0, %eax
	jmp	.L16
.L15:
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	movl	$0, %eax
.L16:
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L17
	call	__stack_chk_fail@PLT
.L17:
	leave
	.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"
.LC1:
	.string	"No"
.LC2:
	.string	"Yes"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB53:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	leaq	.LC0(%rip), %r14
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	movq	%r14, %rdi
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	subq	$16, %rsp
	.cfi_def_cfa_offset 64
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movslq	4(%rsp), %rdi
	movq	%rdi, %rbx
	salq	$2, %rdi
	call	malloc@PLT
	testl	%ebx, %ebx
	jle	.L22
	movq	%rax, %r12
	movq	%rax, %rbp
	movq	%rax, %r13
	xorl	%ebx, %ebx
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%r13, %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %esi
	addq	$4, %r13
	cmpl	%ebx, %esi
	jg	.L3
	testl	%esi, %esi
	jle	.L22
	leal	-1(%rsi), %r9d
	cmpl	$2, %r9d
	jbe	.L24
	movl	%esi, %edx
	movq	%r12, %rax
	pxor	%xmm2, %xmm2
	shrl	$2, %edx
	salq	$4, %rdx
	addq	%r12, %rdx
	.p2align 4,,10
	.p2align 3
.L5:
	movdqu	(%rax), %xmm0
	addq	$16, %rax
	movdqa	%xmm0, %xmm1
	pcmpgtd	%xmm2, %xmm1
	pand	%xmm1, %xmm0
	pandn	%xmm2, %xmm1
	movdqa	%xmm1, %xmm2
	por	%xmm0, %xmm2
	cmpq	%rdx, %rax
	jne	.L5
	movdqa	%xmm2, %xmm1
	movl	%esi, %eax
	psrldq	$8, %xmm1
	andl	$-4, %eax
	movdqa	%xmm1, %xmm0
	pcmpgtd	%xmm2, %xmm0
	pand	%xmm0, %xmm1
	pandn	%xmm2, %xmm0
	por	%xmm1, %xmm0
	movdqa	%xmm0, %xmm2
	psrldq	$4, %xmm2
	movdqa	%xmm2, %xmm1
	pcmpgtd	%xmm0, %xmm1
	pand	%xmm1, %xmm2
	pandn	%xmm0, %xmm1
	por	%xmm2, %xmm1
	movd	%xmm1, %ecx
	testb	$3, %sil
	je	.L6
.L4:
	movslq	%eax, %rdx
	leaq	0(,%rdx,4), %rdi
	movl	(%r12,%rdx,4), %edx
	cmpl	%edx, %ecx
	cmovl	%edx, %ecx
	leal	1(%rax), %edx
	cmpl	%edx, %esi
	jle	.L6
	movl	4(%r12,%rdi), %edx
	cmpl	%edx, %ecx
	cmovl	%edx, %ecx
	addl	$2, %eax
	cmpl	%eax, %esi
	jle	.L6
	movl	8(%r12,%rdi), %eax
	cmpl	%eax, %ecx
	cmovl	%eax, %ecx
.L6:
	movl	%esi, %eax
	leal	-1(%rcx), %r8d
	leaq	(%r12,%rax,4), %rdi
	movq	%r12, %rax
	.p2align 4,,10
	.p2align 3
.L9:
	movl	(%rax), %edx
	cmpl	%ecx, %edx
	je	.L7
	cmpl	%r8d, %edx
	jne	.L22
.L7:
	addq	$4, %rax
	cmpq	%rdi, %rax
	jne	.L9
	cmpl	$2, %r9d
	jbe	.L25
	movl	%esi, %eax
	movd	%ecx, %xmm4
	pxor	%xmm1, %xmm1
	shrl	$2, %eax
	pshufd	$0, %xmm4, %xmm3
	movdqa	%xmm1, %xmm2
	salq	$4, %rax
	addq	%r12, %rax
	.p2align 4,,10
	.p2align 3
.L11:
	movdqu	0(%rbp), %xmm0
	addq	$16, %rbp
	pcmpeqd	%xmm3, %xmm0
	pcmpeqd	%xmm2, %xmm0
	psubd	%xmm0, %xmm1
	cmpq	%rax, %rbp
	jne	.L11
	movdqa	%xmm1, %xmm0
	movl	%esi, %eax
	psrldq	$8, %xmm0
	andl	$-4, %eax
	paddd	%xmm0, %xmm1
	movdqa	%xmm1, %xmm0
	psrldq	$4, %xmm0
	paddd	%xmm0, %xmm1
	movd	%xmm1, %edx
	testb	$3, %sil
	je	.L12
.L10:
	movslq	%eax, %rdi
	leaq	0(,%rdi,4), %r8
	cmpl	%ecx, (%r12,%rdi,4)
	je	.L13
	addl	$1, %eax
	addl	$1, %edx
	cmpl	%eax, %esi
	jle	.L15
.L14:
	cmpl	%ecx, 4(%r12,%r8)
	je	.L16
	addl	$1, %eax
	addl	$1, %edx
	cmpl	%esi, %eax
	jge	.L15
.L17:
	cmpl	%ecx, 8(%r12,%r8)
	je	.L12
	addl	$1, %edx
.L12:
	testl	%edx, %edx
	je	.L35
.L15:
	subl	%edx, %ecx
	movl	%esi, %eax
	subl	%edx, %eax
	leal	(%rcx,%rcx), %edx
	cmpl	%edx, %eax
	jl	.L22
	testl	%ecx, %ecx
	jg	.L20
.L22:
	leaq	.LC1(%rip), %rdi
	call	puts@PLT
.L8:
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L36
	addq	$16, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 48
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
.L35:
	.cfi_restore_state
	leal	1(%rcx), %eax
	cmpl	%eax, %esi
	jne	.L15
.L20:
	leaq	.LC2(%rip), %rdi
	call	puts@PLT
	jmp	.L8
.L13:
	addl	$1, %eax
	cmpl	%eax, %esi
	jg	.L14
	jmp	.L12
.L16:
	addl	$1, %eax
	cmpl	%eax, %esi
	jg	.L17
	jmp	.L12
.L24:
	xorl	%ecx, %ecx
	xorl	%eax, %eax
	jmp	.L4
.L25:
	xorl	%edx, %edx
	xorl	%eax, %eax
	jmp	.L10
.L36:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE53:
	.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	"No"
.LC2:
	.string	"Yes"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB53:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	leaq	.LC0(%rip), %r14
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	movq	%r14, %rdi
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	subq	$16, %rsp
	.cfi_def_cfa_offset 64
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movslq	4(%rsp), %rdi
	movq	%rdi, %rbx
	salq	$2, %rdi
	call	malloc@PLT
	testl	%ebx, %ebx
	jle	.L22
	movq	%rax, %r12
	movq	%rax, %rbp
	movq	%rax, %r13
	xorl	%ebx, %ebx
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%r13, %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %esi
	addq	$4, %r13
	cmpl	%ebx, %esi
	jg	.L3
	testl	%esi, %esi
	jle	.L22
	leal	-1(%rsi), %r9d
	cmpl	$2, %r9d
	jbe	.L24
	movl	%esi, %edx
	movq	%r12, %rax
	pxor	%xmm2, %xmm2
	shrl	$2, %edx
	salq	$4, %rdx
	addq	%r12, %rdx
	.p2align 4,,10
	.p2align 3
.L5:
	movdqu	(%rax), %xmm0
	addq	$16, %rax
	movdqa	%xmm0, %xmm1
	pcmpgtd	%xmm2, %xmm1
	pand	%xmm1, %xmm0
	pandn	%xmm2, %xmm1
	movdqa	%xmm1, %xmm2
	por	%xmm0, %xmm2
	cmpq	%rdx, %rax
	jne	.L5
	movdqa	%xmm2, %xmm1
	movl	%esi, %eax
	psrldq	$8, %xmm1
	andl	$-4, %eax
	movdqa	%xmm1, %xmm0
	pcmpgtd	%xmm2, %xmm0
	pand	%xmm0, %xmm1
	pandn	%xmm2, %xmm0
	por	%xmm1, %xmm0
	movdqa	%xmm0, %xmm2
	psrldq	$4, %xmm2
	movdqa	%xmm2, %xmm1
	pcmpgtd	%xmm0, %xmm1
	pand	%xmm1, %xmm2
	pandn	%xmm0, %xmm1
	por	%xmm2, %xmm1
	movd	%xmm1, %ecx
	testb	$3, %sil
	je	.L6
.L4:
	movslq	%eax, %rdx
	leaq	0(,%rdx,4), %rdi
	movl	(%r12,%rdx,4), %edx
	cmpl	%edx, %ecx
	cmovl	%edx, %ecx
	leal	1(%rax), %edx
	cmpl	%edx, %esi
	jle	.L6
	movl	4(%r12,%rdi), %edx
	cmpl	%edx, %ecx
	cmovl	%edx, %ecx
	addl	$2, %eax
	cmpl	%eax, %esi
	jle	.L6
	movl	8(%r12,%rdi), %eax
	cmpl	%eax, %ecx
	cmovl	%eax, %ecx
.L6:
	movl	%esi, %eax
	leal	-1(%rcx), %r8d
	leaq	(%r12,%rax,4), %rdi
	movq	%r12, %rax
	.p2align 4,,10
	.p2align 3
.L9:
	movl	(%rax), %edx
	cmpl	%ecx, %edx
	je	.L7
	cmpl	%r8d, %edx
	jne	.L22
.L7:
	addq	$4, %rax
	cmpq	%rdi, %rax
	jne	.L9
	cmpl	$2, %r9d
	jbe	.L25
	movl	%esi, %eax
	movd	%ecx, %xmm4
	pxor	%xmm1, %xmm1
	shrl	$2, %eax
	pshufd	$0, %xmm4, %xmm3
	movdqa	%xmm1, %xmm2
	salq	$4, %rax
	addq	%r12, %rax
	.p2align 4,,10
	.p2align 3
.L11:
	movdqu	0(%rbp), %xmm0
	addq	$16, %rbp
	pcmpeqd	%xmm3, %xmm0
	pcmpeqd	%xmm2, %xmm0
	psubd	%xmm0, %xmm1
	cmpq	%rax, %rbp
	jne	.L11
	movdqa	%xmm1, %xmm0
	movl	%esi, %eax
	psrldq	$8, %xmm0
	andl	$-4, %eax
	paddd	%xmm0, %xmm1
	movdqa	%xmm1, %xmm0
	psrldq	$4, %xmm0
	paddd	%xmm0, %xmm1
	movd	%xmm1, %edx
	testb	$3, %sil
	je	.L12
.L10:
	movslq	%eax, %rdi
	leaq	0(,%rdi,4), %r8
	cmpl	%ecx, (%r12,%rdi,4)
	je	.L13
	addl	$1, %eax
	addl	$1, %edx
	cmpl	%eax, %esi
	jle	.L15
.L14:
	cmpl	%ecx, 4(%r12,%r8)
	je	.L16
	addl	$1, %eax
	addl	$1, %edx
	cmpl	%esi, %eax
	jge	.L15
.L17:
	cmpl	%ecx, 8(%r12,%r8)
	je	.L12
	addl	$1, %edx
.L12:
	testl	%edx, %edx
	je	.L35
.L15:
	subl	%edx, %ecx
	movl	%esi, %eax
	subl	%edx, %eax
	leal	(%rcx,%rcx), %edx
	cmpl	%edx, %eax
	jl	.L22
	testl	%ecx, %ecx
	jg	.L20
.L22:
	leaq	.LC1(%rip), %rdi
	call	puts@PLT
.L8:
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L36
	addq	$16, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 48
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
.L35:
	.cfi_restore_state
	leal	1(%rcx), %eax
	cmpl	%eax, %esi
	jne	.L15
.L20:
	leaq	.LC2(%rip), %rdi
	call	puts@PLT
	jmp	.L8
.L13:
	addl	$1, %eax
	cmpl	%eax, %esi
	jg	.L14
	jmp	.L12
.L16:
	addl	$1, %eax
	cmpl	%eax, %esi
	jg	.L17
	jmp	.L12
.L24:
	xorl	%ecx, %ecx
	xorl	%eax, %eax
	jmp	.L4
.L25:
	xorl	%edx, %edx
	xorl	%eax, %eax
	jmp	.L10
.L36:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE53:
	.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>
#include <stdlib.h>
#include <math.h>
#include <ctype.h>
#include <string.h>
#define ll long long

int main(void){
int N;
scanf("%d",&N);
int *a=(int*)malloc(sizeof(int)*N);
int i;
for(i=0;i<N;i++) scanf("%d",&a[i]);
int max=0;
for(i=0;i<N;i++)
if(max<a[i]) max=a[i];

for(i=0;i<N;i++)
if(a[i]!=max&&a[i]!=max-1) {printf("No\n");
return 0;
}

int count=0;
for(i=0;i<N;i++)
 if(a[i]!=max) count++;

if(count==0&&max+1==N){
printf("Yes\n");
return 0;
}

if((N-count)>=2*(max-count)&&(max-count)>0){
printf("Yes\n");
return 0;
}

printf("No\n");
return 0;
}
3
1 1 3
 5
3 4 3 4 3
 5
3 4 3 3 3
 3
0 2 2
 4
2 4 2 2
 3
4 2 2
 3
1 0 3
 3
0 2 4
 4
2 4 4 2
 3
4 0 2

No
 Yes
 No
 No
 No
 No
 No
 No
 No
 No

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 <math.h>
#include <ctype.h>
#include <string.h>
#define ll long long

int main(void){
int N;
scanf("%d",&N);
int *a=(int*)malloc(sizeof(int)*N);
int i;
for(i=0;i<N;i++) scanf("%d",&a[i]);
int max=0;
for(i=0;i<N;i++)
if(max<a[i]) max=a[i];

for(i=0;i<N;i++)
if(a[i]!=max&&a[i]!=max-1) {printf("No\n");
return 0;
}

int count=0;
for(i=0;i<N;i++)
 if(a[i]!=max) count++;

if(count==0&&max+1==N){
printf("Yes\n");
return 0;
}

if((N-count)>=2*(max-count)&&(max-count)>0){
printf("Yes\n");
return 0;
}

printf("No\n");
return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"No"
.LC2:
	.string	"Yes"
	.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
	subq	$32, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-32(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-32(%rbp), %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -16(%rbp)
	movl	$0, -28(%rbp)
	jmp	.L2
.L3:
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -28(%rbp)
.L2:
	movl	-32(%rbp), %eax
	cmpl	%eax, -28(%rbp)
	jl	.L3
	movl	$0, -24(%rbp)
	movl	$0, -28(%rbp)
	jmp	.L4
.L6:
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	%eax, -24(%rbp)
	jge	.L5
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	%eax, -24(%rbp)
.L5:
	addl	$1, -28(%rbp)
.L4:
	movl	-32(%rbp), %eax
	cmpl	%eax, -28(%rbp)
	jl	.L6
	movl	$0, -28(%rbp)
	jmp	.L7
.L10:
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	%eax, -24(%rbp)
	je	.L8
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	-24(%rbp), %edx
	subl	$1, %edx
	cmpl	%edx, %eax
	je	.L8
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	movl	$0, %eax
	jmp	.L16
.L8:
	addl	$1, -28(%rbp)
.L7:
	movl	-32(%rbp), %eax
	cmpl	%eax, -28(%rbp)
	jl	.L10
	movl	$0, -20(%rbp)
	movl	$0, -28(%rbp)
	jmp	.L11
.L13:
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	%eax, -24(%rbp)
	je	.L12
	addl	$1, -20(%rbp)
.L12:
	addl	$1, -28(%rbp)
.L11:
	movl	-32(%rbp), %eax
	cmpl	%eax, -28(%rbp)
	jl	.L13
	cmpl	$0, -20(%rbp)
	jne	.L14
	movl	-24(%rbp), %eax
	leal	1(%rax), %edx
	movl	-32(%rbp), %eax
	cmpl	%eax, %edx
	jne	.L14
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	movl	$0, %eax
	jmp	.L16
.L14:
	movl	-32(%rbp), %eax
	subl	-20(%rbp), %eax
	movl	%eax, %edx
	movl	-24(%rbp), %eax
	subl	-20(%rbp), %eax
	addl	%eax, %eax
	cmpl	%eax, %edx
	jl	.L15
	movl	-24(%rbp), %eax
	subl	-20(%rbp), %eax
	testl	%eax, %eax
	jle	.L15
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	movl	$0, %eax
	jmp	.L16
.L15:
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	movl	$0, %eax
.L16:
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L17
	call	__stack_chk_fail@PLT
.L17:
	leave
	.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"
.LC1:
	.string	"No"
.LC2:
	.string	"Yes"
	.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
	subq	$32, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-32(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-32(%rbp), %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -16(%rbp)
	movl	$0, -28(%rbp)
	jmp	.L2
.L3:
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -28(%rbp)
.L2:
	movl	-32(%rbp), %eax
	cmpl	%eax, -28(%rbp)
	jl	.L3
	movl	$0, -24(%rbp)
	movl	$0, -28(%rbp)
	jmp	.L4
.L6:
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	%eax, -24(%rbp)
	jge	.L5
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	%eax, -24(%rbp)
.L5:
	addl	$1, -28(%rbp)
.L4:
	movl	-32(%rbp), %eax
	cmpl	%eax, -28(%rbp)
	jl	.L6
	movl	$0, -28(%rbp)
	jmp	.L7
.L10:
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	%eax, -24(%rbp)
	je	.L8
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	-24(%rbp), %edx
	subl	$1, %edx
	cmpl	%edx, %eax
	je	.L8
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	movl	$0, %eax
	jmp	.L16
.L8:
	addl	$1, -28(%rbp)
.L7:
	movl	-32(%rbp), %eax
	cmpl	%eax, -28(%rbp)
	jl	.L10
	movl	$0, -20(%rbp)
	movl	$0, -28(%rbp)
	jmp	.L11
.L13:
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	%eax, -24(%rbp)
	je	.L12
	addl	$1, -20(%rbp)
.L12:
	addl	$1, -28(%rbp)
.L11:
	movl	-32(%rbp), %eax
	cmpl	%eax, -28(%rbp)
	jl	.L13
	cmpl	$0, -20(%rbp)
	jne	.L14
	movl	-24(%rbp), %eax
	leal	1(%rax), %edx
	movl	-32(%rbp), %eax
	cmpl	%eax, %edx
	jne	.L14
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	movl	$0, %eax
	jmp	.L16
.L14:
	movl	-32(%rbp), %eax
	subl	-20(%rbp), %eax
	movl	%eax, %edx
	movl	-24(%rbp), %eax
	subl	-20(%rbp), %eax
	addl	%eax, %eax
	cmpl	%eax, %edx
	jl	.L15
	movl	-24(%rbp), %eax
	subl	-20(%rbp), %eax
	testl	%eax, %eax
	jle	.L15
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	movl	$0, %eax
	jmp	.L16
.L15:
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	movl	$0, %eax
.L16:
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L17
	call	__stack_chk_fail@PLT
.L17:
	leave
	.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:
