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

```c
#include<stdio.h>
int main()
{
    int i, x, n, p[105], j;
    scanf("%d %d", &x, &n);
    if(n==0)
    {
        printf("%d", x);
        return 0;
    }
    for(i=0; i<n; i++)
    {
        scanf("%d", &p[i]);
    }
    for(i=0; i<n+1; i++)
    {
        int a=0, b=0;
        for(j=0; j<n; j++)
        {
            if(x-i==p[j])
            {
                a++;
            }
            if(x+i==p[j])
            {
                b++;
            }
        }
        if(a<1)
        {
            printf("%d", x-i);
            return 0;
        }
        if(b<1)
        {
            printf("%d", x+i);
            return 0;
        }
    }
}
```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	.LC0(%rip), %rdi
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$456, %rsp
	.cfi_def_cfa_offset 512
	movq	%fs:40, %rax
	movq	%rax, 440(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rdx
	leaq	8(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	testl	%eax, %eax
	je	.L2
	jle	.L5
	leaq	16(%rsp), %rbx
	xorl	%r12d, %r12d
	leaq	.LC1(%rip), %rbp
	movq	%rbx, %r13
	.p2align 4,,10
	.p2align 3
.L6:
	movq	%r13, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	addl	$1, %r12d
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %ecx
	addq	$4, %r13
	cmpl	%r12d, %ecx
	jg	.L6
	testl	%ecx, %ecx
	js	.L5
	movl	%ecx, %eax
	movl	8(%rsp), %r13d
	movl	%ecx, %r11d
	leal	-1(%rcx), %r12d
	shrl	$2, %eax
	andl	$-4, %r11d
	xorl	%r10d, %r10d
	subl	$1, %eax
	movl	%r13d, %r8d
	movl	%r13d, %edi
	salq	$4, %rax
	leaq	16(%rbx,%rax), %r9
	.p2align 4,,10
	.p2align 3
.L7:
	testl	%ecx, %ecx
	je	.L23
	cmpl	$3, %r12d
	jbe	.L25
	movd	%edi, %xmm5
	movd	%r8d, %xmm6
	pxor	%xmm2, %xmm2
	movq	%rbx, %rax
	pshufd	$0, %xmm5, %xmm4
	pshufd	$0, %xmm6, %xmm3
	movdqa	%xmm2, %xmm1
	.p2align 4,,10
	.p2align 3
.L9:
	movdqa	%xmm4, %xmm0
	addq	$16, %rax
	pcmpeqd	-16(%rax), %xmm0
	psubd	%xmm0, %xmm1
	movdqa	%xmm3, %xmm0
	pcmpeqd	-16(%rax), %xmm0
	psubd	%xmm0, %xmm2
	cmpq	%rax, %r9
	jne	.L9
	movdqa	%xmm2, %xmm0
	movl	%r11d, %esi
	psrldq	$8, %xmm0
	paddd	%xmm0, %xmm2
	movdqa	%xmm2, %xmm0
	psrldq	$4, %xmm0
	paddd	%xmm0, %xmm2
	movdqa	%xmm1, %xmm0
	psrldq	$8, %xmm0
	movd	%xmm2, %edx
	paddd	%xmm0, %xmm1
	movdqa	%xmm1, %xmm0
	psrldq	$4, %xmm0
	paddd	%xmm0, %xmm1
	movd	%xmm1, %eax
	cmpl	%r11d, %ecx
	je	.L10
.L8:
	movslq	%esi, %r14
	xorl	%r15d, %r15d
	movl	16(%rsp,%r14,4), %r14d
	cmpl	%edi, %r14d
	sete	%r15b
	addl	%r15d, %eax
	cmpl	%r14d, %r8d
	sete	%r14b
	movzbl	%r14b, %r14d
	addl	%r14d, %edx
	leal	1(%rsi), %r14d
	cmpl	%r14d, %ecx
	jle	.L10
	movslq	%r14d, %r14
	xorl	%r15d, %r15d
	movl	16(%rsp,%r14,4), %r14d
	cmpl	%edi, %r14d
	sete	%r15b
	addl	%r15d, %eax
	cmpl	%r14d, %r8d
	sete	%r14b
	movzbl	%r14b, %r14d
	addl	%r14d, %edx
	leal	2(%rsi), %r14d
	cmpl	%r14d, %ecx
	jle	.L10
	movslq	%r14d, %r14
	xorl	%r15d, %r15d
	movl	16(%rsp,%r14,4), %r14d
	cmpl	%edi, %r14d
	sete	%r15b
	addl	%r15d, %eax
	cmpl	%r8d, %r14d
	sete	%r14b
	addl	$3, %esi
	movzbl	%r14b, %r14d
	addl	%r14d, %edx
	cmpl	%esi, %ecx
	jle	.L10
	movslq	%esi, %rsi
	xorl	%r14d, %r14d
	movl	16(%rsp,%rsi,4), %esi
	cmpl	%esi, %edi
	sete	%r14b
	addl	%r14d, %eax
	cmpl	%esi, %r8d
	sete	%sil
	movzbl	%sil, %esi
	addl	%esi, %edx
.L10:
	testl	%eax, %eax
	je	.L23
	testl	%edx, %edx
	je	.L30
	addl	$1, %r10d
	addl	$1, %r8d
	subl	$1, %edi
	cmpl	%r10d, %ecx
	jge	.L7
.L5:
	movq	440(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L31
	addq	$456, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
.L25:
	.cfi_restore_state
	xorl	%edx, %edx
	xorl	%eax, %eax
	xorl	%esi, %esi
	jmp	.L8
.L23:
	movl	%r13d, %edx
	movq	%rbp, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	subl	%r10d, %edx
	call	__printf_chk@PLT
	jmp	.L5
.L30:
	movl	%r8d, %edx
	movq	%rbp, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L5
.L2:
	movl	8(%rsp), %edx
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L5
.L31:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```

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.
Optimized Assembly Code:

user
```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	.LC0(%rip), %rdi
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$456, %rsp
	.cfi_def_cfa_offset 512
	movq	%fs:40, %rax
	movq	%rax, 440(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rdx
	leaq	8(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	testl	%eax, %eax
	je	.L2
	jle	.L5
	leaq	16(%rsp), %rbx
	xorl	%r12d, %r12d
	leaq	.LC1(%rip), %rbp
	movq	%rbx, %r13
	.p2align 4,,10
	.p2align 3
.L6:
	movq	%r13, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	addl	$1, %r12d
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %ecx
	addq	$4, %r13
	cmpl	%r12d, %ecx
	jg	.L6
	testl	%ecx, %ecx
	js	.L5
	movl	%ecx, %eax
	movl	8(%rsp), %r13d
	movl	%ecx, %r11d
	leal	-1(%rcx), %r12d
	shrl	$2, %eax
	andl	$-4, %r11d
	xorl	%r10d, %r10d
	subl	$1, %eax
	movl	%r13d, %r8d
	movl	%r13d, %edi
	salq	$4, %rax
	leaq	16(%rbx,%rax), %r9
	.p2align 4,,10
	.p2align 3
.L7:
	testl	%ecx, %ecx
	je	.L23
	cmpl	$3, %r12d
	jbe	.L25
	movd	%edi, %xmm5
	movd	%r8d, %xmm6
	pxor	%xmm2, %xmm2
	movq	%rbx, %rax
	pshufd	$0, %xmm5, %xmm4
	pshufd	$0, %xmm6, %xmm3
	movdqa	%xmm2, %xmm1
	.p2align 4,,10
	.p2align 3
.L9:
	movdqa	%xmm4, %xmm0
	addq	$16, %rax
	pcmpeqd	-16(%rax), %xmm0
	psubd	%xmm0, %xmm1
	movdqa	%xmm3, %xmm0
	pcmpeqd	-16(%rax), %xmm0
	psubd	%xmm0, %xmm2
	cmpq	%rax, %r9
	jne	.L9
	movdqa	%xmm2, %xmm0
	movl	%r11d, %esi
	psrldq	$8, %xmm0
	paddd	%xmm0, %xmm2
	movdqa	%xmm2, %xmm0
	psrldq	$4, %xmm0
	paddd	%xmm0, %xmm2
	movdqa	%xmm1, %xmm0
	psrldq	$8, %xmm0
	movd	%xmm2, %edx
	paddd	%xmm0, %xmm1
	movdqa	%xmm1, %xmm0
	psrldq	$4, %xmm0
	paddd	%xmm0, %xmm1
	movd	%xmm1, %eax
	cmpl	%r11d, %ecx
	je	.L10
.L8:
	movslq	%esi, %r14
	xorl	%r15d, %r15d
	movl	16(%rsp,%r14,4), %r14d
	cmpl	%edi, %r14d
	sete	%r15b
	addl	%r15d, %eax
	cmpl	%r14d, %r8d
	sete	%r14b
	movzbl	%r14b, %r14d
	addl	%r14d, %edx
	leal	1(%rsi), %r14d
	cmpl	%r14d, %ecx
	jle	.L10
	movslq	%r14d, %r14
	xorl	%r15d, %r15d
	movl	16(%rsp,%r14,4), %r14d
	cmpl	%edi, %r14d
	sete	%r15b
	addl	%r15d, %eax
	cmpl	%r14d, %r8d
	sete	%r14b
	movzbl	%r14b, %r14d
	addl	%r14d, %edx
	leal	2(%rsi), %r14d
	cmpl	%r14d, %ecx
	jle	.L10
	movslq	%r14d, %r14
	xorl	%r15d, %r15d
	movl	16(%rsp,%r14,4), %r14d
	cmpl	%edi, %r14d
	sete	%r15b
	addl	%r15d, %eax
	cmpl	%r8d, %r14d
	sete	%r14b
	addl	$3, %esi
	movzbl	%r14b, %r14d
	addl	%r14d, %edx
	cmpl	%esi, %ecx
	jle	.L10
	movslq	%esi, %rsi
	xorl	%r14d, %r14d
	movl	16(%rsp,%rsi,4), %esi
	cmpl	%esi, %edi
	sete	%r14b
	addl	%r14d, %eax
	cmpl	%esi, %r8d
	sete	%sil
	movzbl	%sil, %esi
	addl	%esi, %edx
.L10:
	testl	%eax, %eax
	je	.L23
	testl	%edx, %edx
	je	.L30
	addl	$1, %r10d
	addl	$1, %r8d
	subl	$1, %edi
	cmpl	%r10d, %ecx
	jge	.L7
.L5:
	movq	440(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L31
	addq	$456, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
.L25:
	.cfi_restore_state
	xorl	%edx, %edx
	xorl	%eax, %eax
	xorl	%esi, %esi
	jmp	.L8
.L23:
	movl	%r13d, %edx
	movq	%rbp, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	subl	%r10d, %edx
	call	__printf_chk@PLT
	jmp	.L5
.L30:
	movl	%r8d, %edx
	movq	%rbp, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L5
.L2:
	movl	8(%rsp), %edx
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L5
.L31:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```
rule
```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	.LC0(%rip), %rdi
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$456, %rsp
	.cfi_def_cfa_offset 512
	movq	%fs:40, %rax
	movq	%rax, 440(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rdx
	leaq	8(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	testl	%eax, %eax
	je	.L2
	jle	.L5
	leaq	16(%rsp), %rbx
	xorl	%r12d, %r12d
	leaq	.LC1(%rip), %rbp
	movq	%rbx, %r13
	.p2align 4,,10
	.p2align 3
.L6:
	movq	%r13, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	addl	$1, %r12d
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %ecx
	addq	$4, %r13
	cmpl	%r12d, %ecx
	jg	.L6
	testl	%ecx, %ecx
	js	.L5
	movl	%ecx, %eax
	movl	8(%rsp), %r13d
	movl	%ecx, %r11d
	leal	-1(%rcx), %r12d
	shrl	$2, %eax
	andl	$-4, %r11d
	xorl	%r10d, %r10d
	subl	$1, %eax
	movl	%r13d, %r8d
	movl	%r13d, %edi
	salq	$4, %rax
	leaq	16(%rbx,%rax), %r9
	.p2align 4,,10
	.p2align 3
.L7:
	testl	%ecx, %ecx
	je	.L23
	cmpl	$3, %r12d
	jbe	.L25
	movd	%edi, %xmm5
	movd	%r8d, %xmm6
	pxor	%xmm2, %xmm2
	movq	%rbx, %rax
	pshufd	$0, %xmm5, %xmm4
	pshufd	$0, %xmm6, %xmm3
	movdqa	%xmm2, %xmm1
	.p2align 4,,10
	.p2align 3
.L9:
	movdqa	%xmm4, %xmm0
	addq	$16, %rax
	pcmpeqd	-16(%rax), %xmm0
	psubd	%xmm0, %xmm1
	movdqa	%xmm3, %xmm0
	pcmpeqd	-16(%rax), %xmm0
	psubd	%xmm0, %xmm2
	cmpq	%rax, %r9
	jne	.L9
	movdqa	%xmm2, %xmm0
	movl	%r11d, %esi
	psrldq	$8, %xmm0
	paddd	%xmm0, %xmm2
	movdqa	%xmm2, %xmm0
	psrldq	$4, %xmm0
	paddd	%xmm0, %xmm2
	movdqa	%xmm1, %xmm0
	psrldq	$8, %xmm0
	movd	%xmm2, %edx
	paddd	%xmm0, %xmm1
	movdqa	%xmm1, %xmm0
	psrldq	$4, %xmm0
	paddd	%xmm0, %xmm1
	movd	%xmm1, %eax
	cmpl	%r11d, %ecx
	je	.L10
.L8:
	movslq	%esi, %r14
	xorl	%r15d, %r15d
	movl	16(%rsp,%r14,4), %r14d
	cmpl	%edi, %r14d
	sete	%r15b
	addl	%r15d, %eax
	cmpl	%r14d, %r8d
	sete	%r14b
	movzbl	%r14b, %r14d
	addl	%r14d, %edx
	leal	1(%rsi), %r14d
	cmpl	%r14d, %ecx
	jle	.L10
	movslq	%r14d, %r14
	xorl	%r15d, %r15d
	movl	16(%rsp,%r14,4), %r14d
	cmpl	%edi, %r14d
	sete	%r15b
	addl	%r15d, %eax
	cmpl	%r14d, %r8d
	sete	%r14b
	movzbl	%r14b, %r14d
	addl	%r14d, %edx
	leal	2(%rsi), %r14d
	cmpl	%r14d, %ecx
	jle	.L10
	movslq	%r14d, %r14
	xorl	%r15d, %r15d
	movl	16(%rsp,%r14,4), %r14d
	cmpl	%edi, %r14d
	sete	%r15b
	addl	%r15d, %eax
	cmpl	%r8d, %r14d
	sete	%r14b
	addl	$3, %esi
	movzbl	%r14b, %r14d
	addl	%r14d, %edx
	cmpl	%esi, %ecx
	jle	.L10
	movslq	%esi, %rsi
	xorl	%r14d, %r14d
	movl	16(%rsp,%rsi,4), %esi
	cmpl	%esi, %edi
	sete	%r14b
	addl	%r14d, %eax
	cmpl	%esi, %r8d
	sete	%sil
	movzbl	%sil, %esi
	addl	%esi, %edx
.L10:
	testl	%eax, %eax
	je	.L23
	testl	%edx, %edx
	je	.L30
	addl	$1, %r10d
	addl	$1, %r8d
	subl	$1, %edi
	cmpl	%r10d, %ecx
	jge	.L7
.L5:
	movq	440(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L31
	addq	$456, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
.L25:
	.cfi_restore_state
	xorl	%edx, %edx
	xorl	%eax, %eax
	xorl	%esi, %esi
	jmp	.L8
.L23:
	movl	%r13d, %edx
	movq	%rbp, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	subl	%r10d, %edx
	call	__printf_chk@PLT
	jmp	.L5
.L30:
	movl	%r8d, %edx
	movq	%rbp, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L5
.L2:
	movl	8(%rsp), %edx
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L5
.L31:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```
```c
#include<stdio.h>
int main()
{
    int i, x, n, p[105], j;
    scanf("%d %d", &x, &n);
    if(n==0)
    {
        printf("%d", x);
        return 0;
    }
    for(i=0; i<n; i++)
    {
        scanf("%d", &p[i]);
    }
    for(i=0; i<n+1; i++)
    {
        int a=0, b=0;
        for(j=0; j<n; j++)
        {
            if(x-i==p[j])
            {
                a++;
            }
            if(x+i==p[j])
            {
                b++;
            }
        }
        if(a<1)
        {
            printf("%d", x-i);
            return 0;
        }
        if(b<1)
        {
            printf("%d", x+i);
            return 0;
        }
    }
}
```
Given the following C code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
#include<stdio.h>
int main()
{
    int i, x, n, p[105], j;
    scanf("%d %d", &x, &n);
    if(n==0)
    {
        printf("%d", x);
        return 0;
    }
    for(i=0; i<n; i++)
    {
        scanf("%d", &p[i]);
    }
    for(i=0; i<n+1; i++)
    {
        int a=0, b=0;
        for(j=0; j<n; j++)
        {
            if(x-i==p[j])
            {
                a++;
            }
            if(x+i==p[j])
            {
                b++;
            }
        }
        if(a<1)
        {
            printf("%d", x-i);
            return 0;
        }
        if(b<1)
        {
            printf("%d", x+i);
            return 0;
        }
    }
}
```

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.
Optimized Assembly Code:

6 2
4 7 10 6 5
 10 3
4 7 10 6 5
 6 2
4 7 10 8 5
 10 3
4 7 9 6 5
 15 3
7 5 3 6 5
 12 1
2 5 3 16 11
 2 1
4 5 0 16 4
 6 5
3 7 10 6 5
 19 5
4 7 10 6 5
 101 0

6 9 6 10 15 12 2 4 19 101
Given the following C code and assembly code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
#include<stdio.h>
int main()
{
    int i, x, n, p[105], j;
    scanf("%d %d", &x, &n);
    if(n==0)
    {
        printf("%d", x);
        return 0;
    }
    for(i=0; i<n; i++)
    {
        scanf("%d", &p[i]);
    }
    for(i=0; i<n+1; i++)
    {
        int a=0, b=0;
        for(j=0; j<n; j++)
        {
            if(x-i==p[j])
            {
                a++;
            }
            if(x+i==p[j])
            {
                b++;
            }
        }
        if(a<1)
        {
            printf("%d", x-i);
            return 0;
        }
        if(b<1)
        {
            printf("%d", x+i);
            return 0;
        }
    }
}
```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	.LC0(%rip), %rdi
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$456, %rsp
	.cfi_def_cfa_offset 512
	movq	%fs:40, %rax
	movq	%rax, 440(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rdx
	leaq	8(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	testl	%eax, %eax
	je	.L2
	jle	.L5
	leaq	16(%rsp), %rbx
	xorl	%r12d, %r12d
	leaq	.LC1(%rip), %rbp
	movq	%rbx, %r13
	.p2align 4,,10
	.p2align 3
.L6:
	movq	%r13, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	addl	$1, %r12d
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %ecx
	addq	$4, %r13
	cmpl	%r12d, %ecx
	jg	.L6
	testl	%ecx, %ecx
	js	.L5
	movl	%ecx, %eax
	movl	8(%rsp), %r13d
	movl	%ecx, %r11d
	leal	-1(%rcx), %r12d
	shrl	$2, %eax
	andl	$-4, %r11d
	xorl	%r10d, %r10d
	subl	$1, %eax
	movl	%r13d, %r8d
	movl	%r13d, %edi
	salq	$4, %rax
	leaq	16(%rbx,%rax), %r9
	.p2align 4,,10
	.p2align 3
.L7:
	testl	%ecx, %ecx
	je	.L23
	cmpl	$3, %r12d
	jbe	.L25
	movd	%edi, %xmm5
	movd	%r8d, %xmm6
	pxor	%xmm2, %xmm2
	movq	%rbx, %rax
	pshufd	$0, %xmm5, %xmm4
	pshufd	$0, %xmm6, %xmm3
	movdqa	%xmm2, %xmm1
	.p2align 4,,10
	.p2align 3
.L9:
	movdqa	%xmm4, %xmm0
	addq	$16, %rax
	pcmpeqd	-16(%rax), %xmm0
	psubd	%xmm0, %xmm1
	movdqa	%xmm3, %xmm0
	pcmpeqd	-16(%rax), %xmm0
	psubd	%xmm0, %xmm2
	cmpq	%rax, %r9
	jne	.L9
	movdqa	%xmm2, %xmm0
	movl	%r11d, %esi
	psrldq	$8, %xmm0
	paddd	%xmm0, %xmm2
	movdqa	%xmm2, %xmm0
	psrldq	$4, %xmm0
	paddd	%xmm0, %xmm2
	movdqa	%xmm1, %xmm0
	psrldq	$8, %xmm0
	movd	%xmm2, %edx
	paddd	%xmm0, %xmm1
	movdqa	%xmm1, %xmm0
	psrldq	$4, %xmm0
	paddd	%xmm0, %xmm1
	movd	%xmm1, %eax
	cmpl	%r11d, %ecx
	je	.L10
.L8:
	movslq	%esi, %r14
	xorl	%r15d, %r15d
	movl	16(%rsp,%r14,4), %r14d
	cmpl	%edi, %r14d
	sete	%r15b
	addl	%r15d, %eax
	cmpl	%r14d, %r8d
	sete	%r14b
	movzbl	%r14b, %r14d
	addl	%r14d, %edx
	leal	1(%rsi), %r14d
	cmpl	%r14d, %ecx
	jle	.L10
	movslq	%r14d, %r14
	xorl	%r15d, %r15d
	movl	16(%rsp,%r14,4), %r14d
	cmpl	%edi, %r14d
	sete	%r15b
	addl	%r15d, %eax
	cmpl	%r14d, %r8d
	sete	%r14b
	movzbl	%r14b, %r14d
	addl	%r14d, %edx
	leal	2(%rsi), %r14d
	cmpl	%r14d, %ecx
	jle	.L10
	movslq	%r14d, %r14
	xorl	%r15d, %r15d
	movl	16(%rsp,%r14,4), %r14d
	cmpl	%edi, %r14d
	sete	%r15b
	addl	%r15d, %eax
	cmpl	%r8d, %r14d
	sete	%r14b
	addl	$3, %esi
	movzbl	%r14b, %r14d
	addl	%r14d, %edx
	cmpl	%esi, %ecx
	jle	.L10
	movslq	%esi, %rsi
	xorl	%r14d, %r14d
	movl	16(%rsp,%rsi,4), %esi
	cmpl	%esi, %edi
	sete	%r14b
	addl	%r14d, %eax
	cmpl	%esi, %r8d
	sete	%sil
	movzbl	%sil, %esi
	addl	%esi, %edx
.L10:
	testl	%eax, %eax
	je	.L23
	testl	%edx, %edx
	je	.L30
	addl	$1, %r10d
	addl	$1, %r8d
	subl	$1, %edi
	cmpl	%r10d, %ecx
	jge	.L7
.L5:
	movq	440(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L31
	addq	$456, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
.L25:
	.cfi_restore_state
	xorl	%edx, %edx
	xorl	%eax, %eax
	xorl	%esi, %esi
	jmp	.L8
.L23:
	movl	%r13d, %edx
	movq	%rbp, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	subl	%r10d, %edx
	call	__printf_chk@PLT
	jmp	.L5
.L30:
	movl	%r8d, %edx
	movq	%rbp, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L5
.L2:
	movl	8(%rsp), %edx
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L5
.L31:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```

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.
Optimized Assembly Code:

train
```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	.LC0(%rip), %rdi
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$456, %rsp
	.cfi_def_cfa_offset 512
	movq	%fs:40, %rax
	movq	%rax, 440(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rdx
	leaq	8(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	testl	%eax, %eax
	je	.L2
	jle	.L5
	leaq	16(%rsp), %rbx
	xorl	%r12d, %r12d
	leaq	.LC1(%rip), %rbp
	movq	%rbx, %r13
	.p2align 4,,10
	.p2align 3
.L6:
	movq	%r13, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	addl	$1, %r12d
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %ecx
	addq	$4, %r13
	cmpl	%r12d, %ecx
	jg	.L6
	testl	%ecx, %ecx
	js	.L5
	movl	%ecx, %eax
	movl	8(%rsp), %r13d
	movl	%ecx, %r11d
	leal	-1(%rcx), %r12d
	shrl	$2, %eax
	andl	$-4, %r11d
	xorl	%r10d, %r10d
	subl	$1, %eax
	movl	%r13d, %r8d
	movl	%r13d, %edi
	salq	$4, %rax
	leaq	16(%rbx,%rax), %r9
	.p2align 4,,10
	.p2align 3
.L7:
	testl	%ecx, %ecx
	je	.L23
	cmpl	$3, %r12d
	jbe	.L25
	movd	%edi, %xmm5
	movd	%r8d, %xmm6
	pxor	%xmm2, %xmm2
	movq	%rbx, %rax
	pshufd	$0, %xmm5, %xmm4
	pshufd	$0, %xmm6, %xmm3
	movdqa	%xmm2, %xmm1
	.p2align 4,,10
	.p2align 3
.L9:
	movdqa	%xmm4, %xmm0
	addq	$16, %rax
	pcmpeqd	-16(%rax), %xmm0
	psubd	%xmm0, %xmm1
	movdqa	%xmm3, %xmm0
	pcmpeqd	-16(%rax), %xmm0
	psubd	%xmm0, %xmm2
	cmpq	%rax, %r9
	jne	.L9
	movdqa	%xmm2, %xmm0
	movl	%r11d, %esi
	psrldq	$8, %xmm0
	paddd	%xmm0, %xmm2
	movdqa	%xmm2, %xmm0
	psrldq	$4, %xmm0
	paddd	%xmm0, %xmm2
	movdqa	%xmm1, %xmm0
	psrldq	$8, %xmm0
	movd	%xmm2, %edx
	paddd	%xmm0, %xmm1
	movdqa	%xmm1, %xmm0
	psrldq	$4, %xmm0
	paddd	%xmm0, %xmm1
	movd	%xmm1, %eax
	cmpl	%r11d, %ecx
	je	.L10
.L8:
	movslq	%esi, %r14
	xorl	%r15d, %r15d
	movl	16(%rsp,%r14,4), %r14d
	cmpl	%edi, %r14d
	sete	%r15b
	addl	%r15d, %eax
	cmpl	%r14d, %r8d
	sete	%r14b
	movzbl	%r14b, %r14d
	addl	%r14d, %edx
	leal	1(%rsi), %r14d
	cmpl	%r14d, %ecx
	jle	.L10
	movslq	%r14d, %r14
	xorl	%r15d, %r15d
	movl	16(%rsp,%r14,4), %r14d
	cmpl	%edi, %r14d
	sete	%r15b
	addl	%r15d, %eax
	cmpl	%r14d, %r8d
	sete	%r14b
	movzbl	%r14b, %r14d
	addl	%r14d, %edx
	leal	2(%rsi), %r14d
	cmpl	%r14d, %ecx
	jle	.L10
	movslq	%r14d, %r14
	xorl	%r15d, %r15d
	movl	16(%rsp,%r14,4), %r14d
	cmpl	%edi, %r14d
	sete	%r15b
	addl	%r15d, %eax
	cmpl	%r8d, %r14d
	sete	%r14b
	addl	$3, %esi
	movzbl	%r14b, %r14d
	addl	%r14d, %edx
	cmpl	%esi, %ecx
	jle	.L10
	movslq	%esi, %rsi
	xorl	%r14d, %r14d
	movl	16(%rsp,%rsi,4), %esi
	cmpl	%esi, %edi
	sete	%r14b
	addl	%r14d, %eax
	cmpl	%esi, %r8d
	sete	%sil
	movzbl	%sil, %esi
	addl	%esi, %edx
.L10:
	testl	%eax, %eax
	je	.L23
	testl	%edx, %edx
	je	.L30
	addl	$1, %r10d
	addl	$1, %r8d
	subl	$1, %edi
	cmpl	%r10d, %ecx
	jge	.L7
.L5:
	movq	440(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L31
	addq	$456, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
.L25:
	.cfi_restore_state
	xorl	%edx, %edx
	xorl	%eax, %eax
	xorl	%esi, %esi
	jmp	.L8
.L23:
	movl	%r13d, %edx
	movq	%rbp, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	subl	%r10d, %edx
	call	__printf_chk@PLT
	jmp	.L5
.L30:
	movl	%r8d, %edx
	movq	%rbp, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L5
.L2:
	movl	8(%rsp), %edx
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L5
.L31:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```