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()
{

    int a,b,c,i,j=0,sum=0,max,x,min,count1=0,count2=0,P;

    scanf("%d%d%d",&a,&b,&c);

    int A[b+1],B[a+1];
    
    
    for(i=0; i<a+1; i++){
        
        B[i]=0;
    }
        

    for(i=1;i<=b;i++){

        scanf("%d",&A[i]);

        B[A[i]]=1;

    }






    for(i=c;i>0;i--){

        if(B[i]==1) count1++;


    }

    for(i=c;i<a+1;i++){

        if(B[i]==1) count2++;


    }

    if(count1>count2) printf("%d\n",count2);

    else printf("%d\n",count1);







    return 0;

}

```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d%d%d"
.LC1:
	.string	"%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
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$120, %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, -96(%rbp)
	movl	$0, -92(%rbp)
	movl	$0, -104(%rbp)
	movl	$0, -100(%rbp)
	leaq	-112(%rbp), %rcx
	leaq	-116(%rbp), %rdx
	leaq	-120(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-116(%rbp), %eax
	addl	$1, %eax
	movslq	%eax, %rdx
	subq	$1, %rdx
	movq	%rdx, -88(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, -144(%rbp)
	movq	$0, -136(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, -160(%rbp)
	movq	$0, -152(%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	-120(%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, -108(%rbp)
	jmp	.L8
.L9:
	movq	-64(%rbp), %rax
	movl	-108(%rbp), %edx
	movslq	%edx, %rdx
	movl	$0, (%rax,%rdx,4)
	addl	$1, -108(%rbp)
.L8:
	movl	-120(%rbp), %eax
	cmpl	%eax, -108(%rbp)
	jle	.L9
	movl	$1, -108(%rbp)
	jmp	.L10
.L11:
	movl	-108(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-80(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	-80(%rbp), %rax
	movl	-108(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %edx
	movq	-64(%rbp), %rax
	movslq	%edx, %rdx
	movl	$1, (%rax,%rdx,4)
	addl	$1, -108(%rbp)
.L10:
	movl	-116(%rbp), %eax
	cmpl	%eax, -108(%rbp)
	jle	.L11
	movl	-112(%rbp), %eax
	movl	%eax, -108(%rbp)
	jmp	.L12
.L14:
	movq	-64(%rbp), %rax
	movl	-108(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	cmpl	$1, %eax
	jne	.L13
	addl	$1, -104(%rbp)
.L13:
	subl	$1, -108(%rbp)
.L12:
	cmpl	$0, -108(%rbp)
	jg	.L14
	movl	-112(%rbp), %eax
	movl	%eax, -108(%rbp)
	jmp	.L15
.L17:
	movq	-64(%rbp), %rax
	movl	-108(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	cmpl	$1, %eax
	jne	.L16
	addl	$1, -100(%rbp)
.L16:
	addl	$1, -108(%rbp)
.L15:
	movl	-120(%rbp), %eax
	cmpl	%eax, -108(%rbp)
	jle	.L17
	movl	-104(%rbp), %eax
	cmpl	-100(%rbp), %eax
	jle	.L18
	movl	-100(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L19
.L18:
	movl	-104(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L19:
	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
.LFE0:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```

Only output the optimized assembly code. Do not include any other text. Do not write any comments in the assembly code. Wrap the assembly code in ```assembly``` tags.
user
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d%d%d"
.LC1:
	.string	"%d"
.LC3:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.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	-60(%rbp), %rcx
	leaq	-64(%rbp), %rdx
	pushq	%r13
	leaq	-68(%rbp), %rsi
	pushq	%r12
	pushq	%rbx
	subq	$40, %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	-64(%rbp), %r15d
	movq	%rsp, %rcx
	leal	1(%r15), %eax
	cltq
	leaq	15(,%rax,4), %rax
	movq	%rax, %rdx
	andq	$-4096, %rax
	subq	%rax, %rcx
	andq	$-16, %rdx
	cmpq	%rcx, %rsp
	je	.L3
.L60:
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	cmpq	%rcx, %rsp
	jne	.L60
.L3:
	andl	$4095, %edx
	subq	%rdx, %rsp
	testq	%rdx, %rdx
	jne	.L61
.L4:
	movslq	-68(%rbp), %rax
	movq	%rsp, %rsi
	movq	%rsp, %rbx
	leal	1(%rax), %edx
	movslq	%edx, %rdx
	leaq	15(,%rdx,4), %rdx
	movq	%rdx, %rcx
	andq	$-4096, %rdx
	andq	$-16, %rcx
	subq	%rdx, %rsi
.L5:
	cmpq	%rsi, %rsp
	je	.L6
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L5
.L61:
	orq	$0, -8(%rsp,%rdx)
	jmp	.L4
.L6:
	andl	$4095, %ecx
	subq	%rcx, %rsp
	testq	%rcx, %rcx
	jne	.L62
.L7:
	movq	%rsp, %r13
	testl	%eax, %eax
	js	.L11
	leaq	4(,%rax,4), %rdx
	xorl	%esi, %esi
	movq	%r13, %rdi
	call	memset@PLT
.L11:
	addq	$4, %rbx
	movl	$1, %r12d
	leaq	.LC1(%rip), %r14
	testl	%r15d, %r15d
	jle	.L10
	.p2align 4,,10
	.p2align 3
.L14:
	movq	%rbx, %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	addl	$1, %r12d
	call	__isoc99_scanf@PLT
	movslq	(%rbx), %rax
	addq	$4, %rbx
	movl	$1, 0(%r13,%rax,4)
	cmpl	%r12d, -64(%rbp)
	jge	.L14
.L10:
	movl	-60(%rbp), %ecx
	movl	-68(%rbp), %esi
	testl	%ecx, %ecx
	jle	.L63
	cmpl	$3, %ecx
	jle	.L35
	movl	%ecx, %edx
	movslq	%ecx, %rax
	movdqa	.LC2(%rip), %xmm2
	pxor	%xmm1, %xmm1
	shrl	$2, %edx
	leaq	-12(%r13,%rax,4), %rax
	subl	$1, %edx
	movq	%rax, %rdi
	salq	$4, %rdx
	subq	%rdx, %rdi
	leaq	-16(%rdi), %rdx
	.p2align 4,,10
	.p2align 3
.L16:
	movdqu	(%rax), %xmm3
	subq	$16, %rax
	pshufd	$27, %xmm3, %xmm0
	pcmpeqd	%xmm2, %xmm0
	psubd	%xmm0, %xmm1
	cmpq	%rax, %rdx
	jne	.L16
	movdqa	%xmm1, %xmm0
	movl	%ecx, %eax
	psrldq	$8, %xmm0
	andl	$3, %eax
	paddd	%xmm0, %xmm1
	movdqa	%xmm1, %xmm0
	psrldq	$4, %xmm0
	paddd	%xmm0, %xmm1
	movd	%xmm1, %r8d
	testb	$3, %cl
	je	.L17
.L15:
	movslq	%eax, %rdx
	xorl	%edi, %edi
	leaq	0(%r13,%rdx,4), %rdx
	cmpl	$1, (%rdx)
	sete	%dil
	addl	%edi, %r8d
	cmpl	$1, %eax
	je	.L17
	cmpl	$1, -4(%rdx)
	jne	.L19
	addl	$1, %r8d
.L19:
	cmpl	$2, %eax
	je	.L17
	cmpl	$1, -8(%rdx)
	jne	.L17
	addl	$1, %r8d
.L17:
	cmpl	%esi, %ecx
	jg	.L36
.L33:
	movl	%esi, %eax
	movl	$1, %edx
	subl	%ecx, %eax
	cmpl	%esi, %ecx
	leal	1(%rax), %edi
	cmovg	%edx, %edi
	cmpl	$2, %eax
	jbe	.L37
	movl	%edi, %edx
	movslq	%ecx, %rax
	movdqa	.LC2(%rip), %xmm2
	shrl	$2, %edx
	leaq	0(%r13,%rax,4), %rax
	pxor	%xmm0, %xmm0
	salq	$4, %rdx
	addq	%rax, %rdx
	.p2align 4,,10
	.p2align 3
.L24:
	movdqu	(%rax), %xmm1
	addq	$16, %rax
	pcmpeqd	%xmm2, %xmm1
	psubd	%xmm1, %xmm0
	cmpq	%rax, %rdx
	jne	.L24
	movdqa	%xmm0, %xmm1
	movl	%edi, %eax
	psrldq	$8, %xmm1
	andl	$-4, %eax
	paddd	%xmm1, %xmm0
	addl	%eax, %ecx
	movdqa	%xmm0, %xmm1
	psrldq	$4, %xmm1
	paddd	%xmm1, %xmm0
	movd	%xmm0, %edx
	cmpl	%eax, %edi
	je	.L22
.L23:
	movslq	%ecx, %rax
	xorl	%edi, %edi
	leaq	0(%r13,%rax,4), %rax
	cmpl	$1, (%rax)
	sete	%dil
	addl	%edi, %edx
	leal	1(%rcx), %edi
	cmpl	%esi, %edi
	jg	.L22
	cmpl	$1, 4(%rax)
	jne	.L28
	addl	$1, %edx
.L28:
	addl	$2, %ecx
	cmpl	%ecx, %esi
	jl	.L22
	cmpl	$1, 8(%rax)
	jne	.L22
	addl	$1, %edx
	.p2align 4,,10
	.p2align 3
.L22:
	cmpl	%edx, %r8d
	jg	.L58
.L31:
	movl	%r8d, %edx
.L58:
	xorl	%eax, %eax
	leaq	.LC3(%rip), %rsi
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	-56(%rbp), %rax
	subq	%fs:40, %rax
	jne	.L64
	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
.L63:
	.cfi_restore_state
	xorl	%r8d, %r8d
	cmpl	%esi, %ecx
	jle	.L33
	jmp	.L31
.L36:
	xorl	%edx, %edx
	jmp	.L22
.L35:
	movl	%ecx, %eax
	xorl	%r8d, %r8d
	jmp	.L15
.L37:
	xorl	%edx, %edx
	jmp	.L23
.L62:
	orq	$0, -8(%rsp,%rcx)
	jmp	.L7
.L64:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC2:
	.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%d"
.LC1:
	.string	"%d"
.LC3:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.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	-60(%rbp), %rcx
	leaq	-64(%rbp), %rdx
	pushq	%r13
	leaq	-68(%rbp), %rsi
	pushq	%r12
	pushq	%rbx
	subq	$40, %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	-64(%rbp), %r15d
	movq	%rsp, %rcx
	leal	1(%r15), %eax
	cltq
	leaq	15(,%rax,4), %rax
	movq	%rax, %rdx
	andq	$-4096, %rax
	subq	%rax, %rcx
	andq	$-16, %rdx
	cmpq	%rcx, %rsp
	je	.L3
.L60:
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	cmpq	%rcx, %rsp
	jne	.L60
.L3:
	andl	$4095, %edx
	subq	%rdx, %rsp
	testq	%rdx, %rdx
	jne	.L61
.L4:
	movslq	-68(%rbp), %rax
	movq	%rsp, %rsi
	movq	%rsp, %rbx
	leal	1(%rax), %edx
	movslq	%edx, %rdx
	leaq	15(,%rdx,4), %rdx
	movq	%rdx, %rcx
	andq	$-4096, %rdx
	andq	$-16, %rcx
	subq	%rdx, %rsi
.L5:
	cmpq	%rsi, %rsp
	je	.L6
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L5
.L61:
	orq	$0, -8(%rsp,%rdx)
	jmp	.L4
.L6:
	andl	$4095, %ecx
	subq	%rcx, %rsp
	testq	%rcx, %rcx
	jne	.L62
.L7:
	movq	%rsp, %r13
	testl	%eax, %eax
	js	.L11
	leaq	4(,%rax,4), %rdx
	xorl	%esi, %esi
	movq	%r13, %rdi
	call	memset@PLT
.L11:
	addq	$4, %rbx
	movl	$1, %r12d
	leaq	.LC1(%rip), %r14
	testl	%r15d, %r15d
	jle	.L10
	.p2align 4,,10
	.p2align 3
.L14:
	movq	%rbx, %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	addl	$1, %r12d
	call	__isoc99_scanf@PLT
	movslq	(%rbx), %rax
	addq	$4, %rbx
	movl	$1, 0(%r13,%rax,4)
	cmpl	%r12d, -64(%rbp)
	jge	.L14
.L10:
	movl	-60(%rbp), %ecx
	movl	-68(%rbp), %esi
	testl	%ecx, %ecx
	jle	.L63
	cmpl	$3, %ecx
	jle	.L35
	movl	%ecx, %edx
	movslq	%ecx, %rax
	movdqa	.LC2(%rip), %xmm2
	pxor	%xmm1, %xmm1
	shrl	$2, %edx
	leaq	-12(%r13,%rax,4), %rax
	subl	$1, %edx
	movq	%rax, %rdi
	salq	$4, %rdx
	subq	%rdx, %rdi
	leaq	-16(%rdi), %rdx
	.p2align 4,,10
	.p2align 3
.L16:
	movdqu	(%rax), %xmm3
	subq	$16, %rax
	pshufd	$27, %xmm3, %xmm0
	pcmpeqd	%xmm2, %xmm0
	psubd	%xmm0, %xmm1
	cmpq	%rax, %rdx
	jne	.L16
	movdqa	%xmm1, %xmm0
	movl	%ecx, %eax
	psrldq	$8, %xmm0
	andl	$3, %eax
	paddd	%xmm0, %xmm1
	movdqa	%xmm1, %xmm0
	psrldq	$4, %xmm0
	paddd	%xmm0, %xmm1
	movd	%xmm1, %r8d
	testb	$3, %cl
	je	.L17
.L15:
	movslq	%eax, %rdx
	xorl	%edi, %edi
	leaq	0(%r13,%rdx,4), %rdx
	cmpl	$1, (%rdx)
	sete	%dil
	addl	%edi, %r8d
	cmpl	$1, %eax
	je	.L17
	cmpl	$1, -4(%rdx)
	jne	.L19
	addl	$1, %r8d
.L19:
	cmpl	$2, %eax
	je	.L17
	cmpl	$1, -8(%rdx)
	jne	.L17
	addl	$1, %r8d
.L17:
	cmpl	%esi, %ecx
	jg	.L36
.L33:
	movl	%esi, %eax
	movl	$1, %edx
	subl	%ecx, %eax
	cmpl	%esi, %ecx
	leal	1(%rax), %edi
	cmovg	%edx, %edi
	cmpl	$2, %eax
	jbe	.L37
	movl	%edi, %edx
	movslq	%ecx, %rax
	movdqa	.LC2(%rip), %xmm2
	shrl	$2, %edx
	leaq	0(%r13,%rax,4), %rax
	pxor	%xmm0, %xmm0
	salq	$4, %rdx
	addq	%rax, %rdx
	.p2align 4,,10
	.p2align 3
.L24:
	movdqu	(%rax), %xmm1
	addq	$16, %rax
	pcmpeqd	%xmm2, %xmm1
	psubd	%xmm1, %xmm0
	cmpq	%rax, %rdx
	jne	.L24
	movdqa	%xmm0, %xmm1
	movl	%edi, %eax
	psrldq	$8, %xmm1
	andl	$-4, %eax
	paddd	%xmm1, %xmm0
	addl	%eax, %ecx
	movdqa	%xmm0, %xmm1
	psrldq	$4, %xmm1
	paddd	%xmm1, %xmm0
	movd	%xmm0, %edx
	cmpl	%eax, %edi
	je	.L22
.L23:
	movslq	%ecx, %rax
	xorl	%edi, %edi
	leaq	0(%r13,%rax,4), %rax
	cmpl	$1, (%rax)
	sete	%dil
	addl	%edi, %edx
	leal	1(%rcx), %edi
	cmpl	%esi, %edi
	jg	.L22
	cmpl	$1, 4(%rax)
	jne	.L28
	addl	$1, %edx
.L28:
	addl	$2, %ecx
	cmpl	%ecx, %esi
	jl	.L22
	cmpl	$1, 8(%rax)
	jne	.L22
	addl	$1, %edx
	.p2align 4,,10
	.p2align 3
.L22:
	cmpl	%edx, %r8d
	jg	.L58
.L31:
	movl	%r8d, %edx
.L58:
	xorl	%eax, %eax
	leaq	.LC3(%rip), %rsi
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	-56(%rbp), %rax
	subq	%fs:40, %rax
	jne	.L64
	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
.L63:
	.cfi_restore_state
	xorl	%r8d, %r8d
	cmpl	%esi, %ecx
	jle	.L33
	jmp	.L31
.L36:
	xorl	%edx, %edx
	jmp	.L22
.L35:
	movl	%ecx, %eax
	xorl	%r8d, %r8d
	jmp	.L15
.L37:
	xorl	%edx, %edx
	jmp	.L23
.L62:
	orq	$0, -8(%rsp,%rcx)
	jmp	.L7
.L64:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC2:
	.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>


int main()
{

    int a,b,c,i,j=0,sum=0,max,x,min,count1=0,count2=0,P;

    scanf("%d%d%d",&a,&b,&c);

    int A[b+1],B[a+1];
    
    
    for(i=0; i<a+1; i++){
        
        B[i]=0;
    }
        

    for(i=1;i<=b;i++){

        scanf("%d",&A[i]);

        B[A[i]]=1;

    }






    for(i=c;i>0;i--){

        if(B[i]==1) count1++;


    }

    for(i=c;i<a+1;i++){

        if(B[i]==1) count2++;


    }

    if(count1>count2) printf("%d\n",count2);

    else printf("%d\n",count1);







    return 0;

}


5 3 3
1 2 4

1

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()
{

    int a,b,c,i,j=0,sum=0,max,x,min,count1=0,count2=0,P;

    scanf("%d%d%d",&a,&b,&c);

    int A[b+1],B[a+1];
    
    
    for(i=0; i<a+1; i++){
        
        B[i]=0;
    }
        

    for(i=1;i<=b;i++){

        scanf("%d",&A[i]);

        B[A[i]]=1;

    }






    for(i=c;i>0;i--){

        if(B[i]==1) count1++;


    }

    for(i=c;i<a+1;i++){

        if(B[i]==1) count2++;


    }

    if(count1>count2) printf("%d\n",count2);

    else printf("%d\n",count1);







    return 0;

}

```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d%d%d"
.LC1:
	.string	"%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
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$120, %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, -96(%rbp)
	movl	$0, -92(%rbp)
	movl	$0, -104(%rbp)
	movl	$0, -100(%rbp)
	leaq	-112(%rbp), %rcx
	leaq	-116(%rbp), %rdx
	leaq	-120(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-116(%rbp), %eax
	addl	$1, %eax
	movslq	%eax, %rdx
	subq	$1, %rdx
	movq	%rdx, -88(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, -144(%rbp)
	movq	$0, -136(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, -160(%rbp)
	movq	$0, -152(%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	-120(%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, -108(%rbp)
	jmp	.L8
.L9:
	movq	-64(%rbp), %rax
	movl	-108(%rbp), %edx
	movslq	%edx, %rdx
	movl	$0, (%rax,%rdx,4)
	addl	$1, -108(%rbp)
.L8:
	movl	-120(%rbp), %eax
	cmpl	%eax, -108(%rbp)
	jle	.L9
	movl	$1, -108(%rbp)
	jmp	.L10
.L11:
	movl	-108(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-80(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	-80(%rbp), %rax
	movl	-108(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %edx
	movq	-64(%rbp), %rax
	movslq	%edx, %rdx
	movl	$1, (%rax,%rdx,4)
	addl	$1, -108(%rbp)
.L10:
	movl	-116(%rbp), %eax
	cmpl	%eax, -108(%rbp)
	jle	.L11
	movl	-112(%rbp), %eax
	movl	%eax, -108(%rbp)
	jmp	.L12
.L14:
	movq	-64(%rbp), %rax
	movl	-108(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	cmpl	$1, %eax
	jne	.L13
	addl	$1, -104(%rbp)
.L13:
	subl	$1, -108(%rbp)
.L12:
	cmpl	$0, -108(%rbp)
	jg	.L14
	movl	-112(%rbp), %eax
	movl	%eax, -108(%rbp)
	jmp	.L15
.L17:
	movq	-64(%rbp), %rax
	movl	-108(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	cmpl	$1, %eax
	jne	.L16
	addl	$1, -100(%rbp)
.L16:
	addl	$1, -108(%rbp)
.L15:
	movl	-120(%rbp), %eax
	cmpl	%eax, -108(%rbp)
	jle	.L17
	movl	-104(%rbp), %eax
	cmpl	-100(%rbp), %eax
	jle	.L18
	movl	-100(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L19
.L18:
	movl	-104(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L19:
	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
.LFE0:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```

Only output the optimized assembly code. Do not include any other text. Do not write any comments in the assembly code. Wrap the assembly code in ```assembly``` tags.
train
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d%d%d"
.LC1:
	.string	"%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
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$120, %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, -96(%rbp)
	movl	$0, -92(%rbp)
	movl	$0, -104(%rbp)
	movl	$0, -100(%rbp)
	leaq	-112(%rbp), %rcx
	leaq	-116(%rbp), %rdx
	leaq	-120(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-116(%rbp), %eax
	addl	$1, %eax
	movslq	%eax, %rdx
	subq	$1, %rdx
	movq	%rdx, -88(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, -144(%rbp)
	movq	$0, -136(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, -160(%rbp)
	movq	$0, -152(%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	-120(%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, -108(%rbp)
	jmp	.L8
.L9:
	movq	-64(%rbp), %rax
	movl	-108(%rbp), %edx
	movslq	%edx, %rdx
	movl	$0, (%rax,%rdx,4)
	addl	$1, -108(%rbp)
.L8:
	movl	-120(%rbp), %eax
	cmpl	%eax, -108(%rbp)
	jle	.L9
	movl	$1, -108(%rbp)
	jmp	.L10
.L11:
	movl	-108(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-80(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	-80(%rbp), %rax
	movl	-108(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %edx
	movq	-64(%rbp), %rax
	movslq	%edx, %rdx
	movl	$1, (%rax,%rdx,4)
	addl	$1, -108(%rbp)
.L10:
	movl	-116(%rbp), %eax
	cmpl	%eax, -108(%rbp)
	jle	.L11
	movl	-112(%rbp), %eax
	movl	%eax, -108(%rbp)
	jmp	.L12
.L14:
	movq	-64(%rbp), %rax
	movl	-108(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	cmpl	$1, %eax
	jne	.L13
	addl	$1, -104(%rbp)
.L13:
	subl	$1, -108(%rbp)
.L12:
	cmpl	$0, -108(%rbp)
	jg	.L14
	movl	-112(%rbp), %eax
	movl	%eax, -108(%rbp)
	jmp	.L15
.L17:
	movq	-64(%rbp), %rax
	movl	-108(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	cmpl	$1, %eax
	jne	.L16
	addl	$1, -100(%rbp)
.L16:
	addl	$1, -108(%rbp)
.L15:
	movl	-120(%rbp), %eax
	cmpl	%eax, -108(%rbp)
	jle	.L17
	movl	-104(%rbp), %eax
	cmpl	-100(%rbp), %eax
	jle	.L18
	movl	-100(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L19
.L18:
	movl	-104(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L19:
	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
.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:
