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

int main()
{
	int N, M, X;
	scanf("%d%d%d", &N, &M, &X);
	int A[M];
	int i, j, k;
	for (i = 0; i < M; i++)
		scanf("%d", &A[i]);

	int left = 0, right = 0;
	for (i = X; i > 0; i--) {
		for (j = 0; j < M; j++) {
			if (A[j] == i) {
				left += 1;
				break;
			}
		}
	}
	for (i = X; i < N + 1; i++) {
		for (j = 0; j < M; j++) {
			if (A[j] == i) {
				right += 1;
				break;
			}
		}
	}

	if (left < right)
		printf("%d\n", left);
	else
		printf("%d\n", right);

	return 0;
}

```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d%d%d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d\n"
	.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	%r14
	pushq	%r13
	leaq	-44(%rbp), %rcx
	leaq	-48(%rbp), %rdx
	pushq	%r12
	leaq	-52(%rbp), %rsi
	pushq	%rbx
	subq	$32, %rsp
	.cfi_offset 14, -24
	.cfi_offset 13, -32
	.cfi_offset 12, -40
	.cfi_offset 3, -48
	movq	%fs:40, %rax
	movq	%rax, -40(%rbp)
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	-48(%rbp), %rax
	movq	%rsp, %rcx
	movq	%rax, %rdi
	leaq	15(,%rax,4), %rax
	movq	%rax, %rdx
	andq	$-4096, %rax
	subq	%rax, %rcx
	andq	$-16, %rdx
	cmpq	%rcx, %rsp
	je	.L3
.L37:
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	cmpq	%rcx, %rsp
	jne	.L37
.L3:
	andl	$4095, %edx
	subq	%rdx, %rsp
	testq	%rdx, %rdx
	jne	.L38
.L4:
	movq	%rsp, %r13
	testl	%edi, %edi
	jle	.L5
	movq	%r13, %r12
	xorl	%ebx, %ebx
	leaq	.LC1(%rip), %r14
	.p2align 4,,10
	.p2align 3
.L6:
	movq	%r12, %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	movl	-48(%rbp), %edi
	addq	$4, %r12
	cmpl	%ebx, %edi
	jg	.L6
.L5:
	movl	-44(%rbp), %edx
	testl	%edx, %edx
	jle	.L20
	leal	-1(%rdi), %eax
	movl	%edx, %ecx
	xorl	%r9d, %r9d
	leaq	4(%r13,%rax,4), %rsi
	.p2align 4,,10
	.p2align 3
.L8:
	movq	%r13, %rax
	testl	%edi, %edi
	jg	.L11
	jmp	.L10
	.p2align 4,,10
	.p2align 3
.L9:
	addq	$4, %rax
	cmpq	%rsi, %rax
	je	.L10
.L11:
	cmpl	%ecx, (%rax)
	jne	.L9
	addl	$1, %r9d
.L10:
	subl	$1, %ecx
	jne	.L8
.L7:
	movl	-52(%rbp), %esi
	cmpl	%edx, %esi
	jl	.L22
	leal	-1(%rdi), %eax
	addl	$1, %esi
	xorl	%r8d, %r8d
	leaq	4(%r13,%rax,4), %rcx
	.p2align 4,,10
	.p2align 3
.L13:
	movq	%r13, %rax
	testl	%edi, %edi
	jg	.L16
	jmp	.L15
	.p2align 4,,10
	.p2align 3
.L14:
	addq	$4, %rax
	cmpq	%rcx, %rax
	je	.L15
.L16:
	cmpl	%edx, (%rax)
	jne	.L14
	addl	$1, %r8d
.L15:
	addl	$1, %edx
	cmpl	%esi, %edx
	jne	.L13
	cmpl	%r9d, %r8d
	jle	.L12
	movl	%r9d, %edx
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L18:
	movq	-40(%rbp), %rax
	subq	%fs:40, %rax
	jne	.L39
	leaq	-32(%rbp), %rsp
	xorl	%eax, %eax
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%rbp
	.cfi_remember_state
	.cfi_def_cfa 7, 8
	ret
.L22:
	.cfi_restore_state
	xorl	%r8d, %r8d
.L12:
	movl	%r8d, %edx
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L18
.L38:
	orq	$0, -8(%rsp,%rdx)
	jmp	.L4
.L20:
	xorl	%r9d, %r9d
	jmp	.L7
.L39:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE51:
	.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%d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d\n"
	.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	%r14
	pushq	%r13
	leaq	-44(%rbp), %rcx
	leaq	-48(%rbp), %rdx
	pushq	%r12
	leaq	-52(%rbp), %rsi
	pushq	%rbx
	subq	$32, %rsp
	.cfi_offset 14, -24
	.cfi_offset 13, -32
	.cfi_offset 12, -40
	.cfi_offset 3, -48
	movq	%fs:40, %rax
	movq	%rax, -40(%rbp)
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	-48(%rbp), %rax
	movq	%rsp, %rcx
	movq	%rax, %rdi
	leaq	15(,%rax,4), %rax
	movq	%rax, %rdx
	andq	$-4096, %rax
	subq	%rax, %rcx
	andq	$-16, %rdx
	cmpq	%rcx, %rsp
	je	.L3
.L37:
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	cmpq	%rcx, %rsp
	jne	.L37
.L3:
	andl	$4095, %edx
	subq	%rdx, %rsp
	testq	%rdx, %rdx
	jne	.L38
.L4:
	movq	%rsp, %r13
	testl	%edi, %edi
	jle	.L5
	movq	%r13, %r12
	xorl	%ebx, %ebx
	leaq	.LC1(%rip), %r14
	.p2align 4,,10
	.p2align 3
.L6:
	movq	%r12, %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	movl	-48(%rbp), %edi
	addq	$4, %r12
	cmpl	%ebx, %edi
	jg	.L6
.L5:
	movl	-44(%rbp), %edx
	testl	%edx, %edx
	jle	.L20
	leal	-1(%rdi), %eax
	movl	%edx, %ecx
	xorl	%r9d, %r9d
	leaq	4(%r13,%rax,4), %rsi
	.p2align 4,,10
	.p2align 3
.L8:
	movq	%r13, %rax
	testl	%edi, %edi
	jg	.L11
	jmp	.L10
	.p2align 4,,10
	.p2align 3
.L9:
	addq	$4, %rax
	cmpq	%rsi, %rax
	je	.L10
.L11:
	cmpl	%ecx, (%rax)
	jne	.L9
	addl	$1, %r9d
.L10:
	subl	$1, %ecx
	jne	.L8
.L7:
	movl	-52(%rbp), %esi
	cmpl	%edx, %esi
	jl	.L22
	leal	-1(%rdi), %eax
	addl	$1, %esi
	xorl	%r8d, %r8d
	leaq	4(%r13,%rax,4), %rcx
	.p2align 4,,10
	.p2align 3
.L13:
	movq	%r13, %rax
	testl	%edi, %edi
	jg	.L16
	jmp	.L15
	.p2align 4,,10
	.p2align 3
.L14:
	addq	$4, %rax
	cmpq	%rcx, %rax
	je	.L15
.L16:
	cmpl	%edx, (%rax)
	jne	.L14
	addl	$1, %r8d
.L15:
	addl	$1, %edx
	cmpl	%esi, %edx
	jne	.L13
	cmpl	%r9d, %r8d
	jle	.L12
	movl	%r9d, %edx
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L18:
	movq	-40(%rbp), %rax
	subq	%fs:40, %rax
	jne	.L39
	leaq	-32(%rbp), %rsp
	xorl	%eax, %eax
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%rbp
	.cfi_remember_state
	.cfi_def_cfa 7, 8
	ret
.L22:
	.cfi_restore_state
	xorl	%r8d, %r8d
.L12:
	movl	%r8d, %edx
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L18
.L38:
	orq	$0, -8(%rsp,%rdx)
	jmp	.L4
.L20:
	xorl	%r9d, %r9d
	jmp	.L7
.L39:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE51:
	.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%d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d\n"
	.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	%r14
	pushq	%r13
	leaq	-44(%rbp), %rcx
	leaq	-48(%rbp), %rdx
	pushq	%r12
	leaq	-52(%rbp), %rsi
	pushq	%rbx
	subq	$32, %rsp
	.cfi_offset 14, -24
	.cfi_offset 13, -32
	.cfi_offset 12, -40
	.cfi_offset 3, -48
	movq	%fs:40, %rax
	movq	%rax, -40(%rbp)
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	-48(%rbp), %rax
	movq	%rsp, %rcx
	movq	%rax, %rdi
	leaq	15(,%rax,4), %rax
	movq	%rax, %rdx
	andq	$-4096, %rax
	subq	%rax, %rcx
	andq	$-16, %rdx
	cmpq	%rcx, %rsp
	je	.L3
.L37:
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	cmpq	%rcx, %rsp
	jne	.L37
.L3:
	andl	$4095, %edx
	subq	%rdx, %rsp
	testq	%rdx, %rdx
	jne	.L38
.L4:
	movq	%rsp, %r13
	testl	%edi, %edi
	jle	.L5
	movq	%r13, %r12
	xorl	%ebx, %ebx
	leaq	.LC1(%rip), %r14
	.p2align 4,,10
	.p2align 3
.L6:
	movq	%r12, %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	movl	-48(%rbp), %edi
	addq	$4, %r12
	cmpl	%ebx, %edi
	jg	.L6
.L5:
	movl	-44(%rbp), %edx
	testl	%edx, %edx
	jle	.L20
	leal	-1(%rdi), %eax
	movl	%edx, %ecx
	xorl	%r9d, %r9d
	leaq	4(%r13,%rax,4), %rsi
	.p2align 4,,10
	.p2align 3
.L8:
	movq	%r13, %rax
	testl	%edi, %edi
	jg	.L11
	jmp	.L10
	.p2align 4,,10
	.p2align 3
.L9:
	addq	$4, %rax
	cmpq	%rsi, %rax
	je	.L10
.L11:
	cmpl	%ecx, (%rax)
	jne	.L9
	addl	$1, %r9d
.L10:
	subl	$1, %ecx
	jne	.L8
.L7:
	movl	-52(%rbp), %esi
	cmpl	%edx, %esi
	jl	.L22
	leal	-1(%rdi), %eax
	addl	$1, %esi
	xorl	%r8d, %r8d
	leaq	4(%r13,%rax,4), %rcx
	.p2align 4,,10
	.p2align 3
.L13:
	movq	%r13, %rax
	testl	%edi, %edi
	jg	.L16
	jmp	.L15
	.p2align 4,,10
	.p2align 3
.L14:
	addq	$4, %rax
	cmpq	%rcx, %rax
	je	.L15
.L16:
	cmpl	%edx, (%rax)
	jne	.L14
	addl	$1, %r8d
.L15:
	addl	$1, %edx
	cmpl	%esi, %edx
	jne	.L13
	cmpl	%r9d, %r8d
	jle	.L12
	movl	%r9d, %edx
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L18:
	movq	-40(%rbp), %rax
	subq	%fs:40, %rax
	jne	.L39
	leaq	-32(%rbp), %rsp
	xorl	%eax, %eax
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%rbp
	.cfi_remember_state
	.cfi_def_cfa 7, 8
	ret
.L22:
	.cfi_restore_state
	xorl	%r8d, %r8d
.L12:
	movl	%r8d, %edx
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L18
.L38:
	orq	$0, -8(%rsp,%rdx)
	jmp	.L4
.L20:
	xorl	%r9d, %r9d
	jmp	.L7
.L39:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE51:
	.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>
#include <stdlib.h>
#include <string.h>
#include <math.h>

int main()
{
	int N, M, X;
	scanf("%d%d%d", &N, &M, &X);
	int A[M];
	int i, j, k;
	for (i = 0; i < M; i++)
		scanf("%d", &A[i]);

	int left = 0, right = 0;
	for (i = X; i > 0; i--) {
		for (j = 0; j < M; j++) {
			if (A[j] == i) {
				left += 1;
				break;
			}
		}
	}
	for (i = X; i < N + 1; i++) {
		for (j = 0; j < M; j++) {
			if (A[j] == i) {
				right += 1;
				break;
			}
		}
	}

	if (left < right)
		printf("%d\n", left);
	else
		printf("%d\n", right);

	return 0;
}

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

```c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

int main()
{
	int N, M, X;
	scanf("%d%d%d", &N, &M, &X);
	int A[M];
	int i, j, k;
	for (i = 0; i < M; i++)
		scanf("%d", &A[i]);

	int left = 0, right = 0;
	for (i = X; i > 0; i--) {
		for (j = 0; j < M; j++) {
			if (A[j] == i) {
				left += 1;
				break;
			}
		}
	}
	for (i = X; i < N + 1; i++) {
		for (j = 0; j < M; j++) {
			if (A[j] == i) {
				right += 1;
				break;
			}
		}
	}

	if (left < right)
		printf("%d\n", left);
	else
		printf("%d\n", right);

	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:

5 3 3
1 2 4

1

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

int main()
{
	int N, M, X;
	scanf("%d%d%d", &N, &M, &X);
	int A[M];
	int i, j, k;
	for (i = 0; i < M; i++)
		scanf("%d", &A[i]);

	int left = 0, right = 0;
	for (i = X; i > 0; i--) {
		for (j = 0; j < M; j++) {
			if (A[j] == i) {
				left += 1;
				break;
			}
		}
	}
	for (i = X; i < N + 1; i++) {
		for (j = 0; j < M; j++) {
			if (A[j] == i) {
				right += 1;
				break;
			}
		}
	}

	if (left < right)
		printf("%d\n", left);
	else
		printf("%d\n", right);

	return 0;
}

```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d%d%d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d\n"
	.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	%r14
	pushq	%r13
	leaq	-44(%rbp), %rcx
	leaq	-48(%rbp), %rdx
	pushq	%r12
	leaq	-52(%rbp), %rsi
	pushq	%rbx
	subq	$32, %rsp
	.cfi_offset 14, -24
	.cfi_offset 13, -32
	.cfi_offset 12, -40
	.cfi_offset 3, -48
	movq	%fs:40, %rax
	movq	%rax, -40(%rbp)
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	-48(%rbp), %rax
	movq	%rsp, %rcx
	movq	%rax, %rdi
	leaq	15(,%rax,4), %rax
	movq	%rax, %rdx
	andq	$-4096, %rax
	subq	%rax, %rcx
	andq	$-16, %rdx
	cmpq	%rcx, %rsp
	je	.L3
.L37:
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	cmpq	%rcx, %rsp
	jne	.L37
.L3:
	andl	$4095, %edx
	subq	%rdx, %rsp
	testq	%rdx, %rdx
	jne	.L38
.L4:
	movq	%rsp, %r13
	testl	%edi, %edi
	jle	.L5
	movq	%r13, %r12
	xorl	%ebx, %ebx
	leaq	.LC1(%rip), %r14
	.p2align 4,,10
	.p2align 3
.L6:
	movq	%r12, %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	movl	-48(%rbp), %edi
	addq	$4, %r12
	cmpl	%ebx, %edi
	jg	.L6
.L5:
	movl	-44(%rbp), %edx
	testl	%edx, %edx
	jle	.L20
	leal	-1(%rdi), %eax
	movl	%edx, %ecx
	xorl	%r9d, %r9d
	leaq	4(%r13,%rax,4), %rsi
	.p2align 4,,10
	.p2align 3
.L8:
	movq	%r13, %rax
	testl	%edi, %edi
	jg	.L11
	jmp	.L10
	.p2align 4,,10
	.p2align 3
.L9:
	addq	$4, %rax
	cmpq	%rsi, %rax
	je	.L10
.L11:
	cmpl	%ecx, (%rax)
	jne	.L9
	addl	$1, %r9d
.L10:
	subl	$1, %ecx
	jne	.L8
.L7:
	movl	-52(%rbp), %esi
	cmpl	%edx, %esi
	jl	.L22
	leal	-1(%rdi), %eax
	addl	$1, %esi
	xorl	%r8d, %r8d
	leaq	4(%r13,%rax,4), %rcx
	.p2align 4,,10
	.p2align 3
.L13:
	movq	%r13, %rax
	testl	%edi, %edi
	jg	.L16
	jmp	.L15
	.p2align 4,,10
	.p2align 3
.L14:
	addq	$4, %rax
	cmpq	%rcx, %rax
	je	.L15
.L16:
	cmpl	%edx, (%rax)
	jne	.L14
	addl	$1, %r8d
.L15:
	addl	$1, %edx
	cmpl	%esi, %edx
	jne	.L13
	cmpl	%r9d, %r8d
	jle	.L12
	movl	%r9d, %edx
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L18:
	movq	-40(%rbp), %rax
	subq	%fs:40, %rax
	jne	.L39
	leaq	-32(%rbp), %rsp
	xorl	%eax, %eax
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%rbp
	.cfi_remember_state
	.cfi_def_cfa 7, 8
	ret
.L22:
	.cfi_restore_state
	xorl	%r8d, %r8d
.L12:
	movl	%r8d, %edx
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L18
.L38:
	orq	$0, -8(%rsp,%rdx)
	jmp	.L4
.L20:
	xorl	%r9d, %r9d
	jmp	.L7
.L39:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE51:
	.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%d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d\n"
	.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	%r14
	pushq	%r13
	leaq	-44(%rbp), %rcx
	leaq	-48(%rbp), %rdx
	pushq	%r12
	leaq	-52(%rbp), %rsi
	pushq	%rbx
	subq	$32, %rsp
	.cfi_offset 14, -24
	.cfi_offset 13, -32
	.cfi_offset 12, -40
	.cfi_offset 3, -48
	movq	%fs:40, %rax
	movq	%rax, -40(%rbp)
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	-48(%rbp), %rax
	movq	%rsp, %rcx
	movq	%rax, %rdi
	leaq	15(,%rax,4), %rax
	movq	%rax, %rdx
	andq	$-4096, %rax
	subq	%rax, %rcx
	andq	$-16, %rdx
	cmpq	%rcx, %rsp
	je	.L3
.L37:
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	cmpq	%rcx, %rsp
	jne	.L37
.L3:
	andl	$4095, %edx
	subq	%rdx, %rsp
	testq	%rdx, %rdx
	jne	.L38
.L4:
	movq	%rsp, %r13
	testl	%edi, %edi
	jle	.L5
	movq	%r13, %r12
	xorl	%ebx, %ebx
	leaq	.LC1(%rip), %r14
	.p2align 4,,10
	.p2align 3
.L6:
	movq	%r12, %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	movl	-48(%rbp), %edi
	addq	$4, %r12
	cmpl	%ebx, %edi
	jg	.L6
.L5:
	movl	-44(%rbp), %edx
	testl	%edx, %edx
	jle	.L20
	leal	-1(%rdi), %eax
	movl	%edx, %ecx
	xorl	%r9d, %r9d
	leaq	4(%r13,%rax,4), %rsi
	.p2align 4,,10
	.p2align 3
.L8:
	movq	%r13, %rax
	testl	%edi, %edi
	jg	.L11
	jmp	.L10
	.p2align 4,,10
	.p2align 3
.L9:
	addq	$4, %rax
	cmpq	%rsi, %rax
	je	.L10
.L11:
	cmpl	%ecx, (%rax)
	jne	.L9
	addl	$1, %r9d
.L10:
	subl	$1, %ecx
	jne	.L8
.L7:
	movl	-52(%rbp), %esi
	cmpl	%edx, %esi
	jl	.L22
	leal	-1(%rdi), %eax
	addl	$1, %esi
	xorl	%r8d, %r8d
	leaq	4(%r13,%rax,4), %rcx
	.p2align 4,,10
	.p2align 3
.L13:
	movq	%r13, %rax
	testl	%edi, %edi
	jg	.L16
	jmp	.L15
	.p2align 4,,10
	.p2align 3
.L14:
	addq	$4, %rax
	cmpq	%rcx, %rax
	je	.L15
.L16:
	cmpl	%edx, (%rax)
	jne	.L14
	addl	$1, %r8d
.L15:
	addl	$1, %edx
	cmpl	%esi, %edx
	jne	.L13
	cmpl	%r9d, %r8d
	jle	.L12
	movl	%r9d, %edx
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L18:
	movq	-40(%rbp), %rax
	subq	%fs:40, %rax
	jne	.L39
	leaq	-32(%rbp), %rsp
	xorl	%eax, %eax
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%rbp
	.cfi_remember_state
	.cfi_def_cfa 7, 8
	ret
.L22:
	.cfi_restore_state
	xorl	%r8d, %r8d
.L12:
	movl	%r8d, %edx
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L18
.L38:
	orq	$0, -8(%rsp,%rdx)
	jmp	.L4
.L20:
	xorl	%r9d, %r9d
	jmp	.L7
.L39:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE51:
	.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:
```