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(void)
{
	int n,m,a[1001],b[1001],i,j,x,z;
	scanf("%d %d",&n,&m);
	for(i=0;i<m;i++){
		scanf("%d %d",&a[i],&b[i]);
	}
	for(i=0;i<m;i++){
		for(j=i+1;j<m;j++){
			if(a[i]<=a[j]){
				x=a[i];
				a[i]=a[j];
				a[j]=x;
			}
		}
	}
	z=0;
	for(i=0;i<m-1;i++){
		// printf("%d\n",a[i]);
		if(a[i]<=n)	z+=n-a[i];
	}
	printf("%d\n",z);
	return 0;
}
			
```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	subq	$4096, %rsp
	.cfi_def_cfa_offset 4136
	orq	$0, (%rsp)
	subq	$3960, %rsp
	.cfi_def_cfa_offset 8096
	leaq	.LC0(%rip), %r12
	movq	%r12, %rdi
	movq	%fs:40, %rax
	movq	%rax, 8040(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rdx
	leaq	8(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %r8d
	testl	%r8d, %r8d
	jle	.L2
	leaq	16(%rsp), %rbp
	xorl	%ebx, %ebx
	leaq	4032(%rsp), %r13
	.p2align 4,,10
	.p2align 3
.L3:
	leaq	0(%r13,%rbx,4), %rdx
	movq	%rbp, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %r8d
	addq	$1, %rbx
	addq	$4, %rbp
	cmpl	%ebx, %r8d
	jg	.L3
	testl	%r8d, %r8d
	jle	.L2
	leaq	20(%rsp), %rdi
	movl	$1, %r9d
	cmpl	$1, %r8d
	je	.L2
	.p2align 4,,10
	.p2align 3
.L6:
	movq	%rdi, %rax
	movl	%r9d, %edx
	.p2align 4,,10
	.p2align 3
.L8:
	movl	-4(%rdi), %ecx
	movl	(%rax), %esi
	cmpl	%esi, %ecx
	jg	.L7
	movl	%esi, -4(%rdi)
	movl	%ecx, (%rax)
.L7:
	addl	$1, %edx
	addq	$4, %rax
	cmpl	%edx, %r8d
	jg	.L8
	addl	$1, %r9d
	addq	$4, %rdi
	cmpl	%r9d, %r8d
	jne	.L6
.L2:
	leal	-1(%r8), %ecx
	testl	%ecx, %ecx
	jle	.L20
	subl	$2, %r8d
	movl	8(%rsp), %esi
	cmpl	$2, %r8d
	jbe	.L21
	movd	%esi, %xmm4
	leaq	16(%rsp), %rax
	pxor	%xmm1, %xmm1
	movl	%ecx, %edx
	shrl	$2, %edx
	pshufd	$0, %xmm4, %xmm2
	subl	$1, %edx
	salq	$4, %rdx
	leaq	32(%rsp,%rdx), %rdx
	.p2align 4,,10
	.p2align 3
.L12:
	movdqa	(%rax), %xmm0
	movdqa	%xmm2, %xmm3
	psubd	(%rax), %xmm3
	addq	$16, %rax
	pcmpgtd	%xmm2, %xmm0
	pandn	%xmm3, %xmm0
	paddd	%xmm0, %xmm1
	cmpq	%rax, %rdx
	jne	.L12
	movdqa	%xmm1, %xmm0
	movl	%ecx, %eax
	psrldq	$8, %xmm0
	andl	$-4, %eax
	paddd	%xmm0, %xmm1
	movdqa	%xmm1, %xmm0
	psrldq	$4, %xmm0
	paddd	%xmm0, %xmm1
	movd	%xmm1, %edx
	testb	$3, %cl
	je	.L10
.L11:
	movslq	%eax, %rdi
	movl	16(%rsp,%rdi,4), %r8d
	movl	%esi, %edi
	subl	%r8d, %edi
	addl	%edx, %edi
	cmpl	%r8d, %esi
	cmovge	%edi, %edx
	leal	1(%rax), %edi
	cmpl	%ecx, %edi
	jge	.L10
	movslq	%edi, %rdi
	movl	16(%rsp,%rdi,4), %edi
	cmpl	%edi, %esi
	jge	.L30
.L16:
	addl	$2, %eax
	cmpl	%ecx, %eax
	jge	.L10
	cltq
	movl	16(%rsp,%rax,4), %eax
	cmpl	%eax, %esi
	jge	.L31
.L10:
	xorl	%eax, %eax
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	8040(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L32
	addq	$8056, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
.L30:
	.cfi_restore_state
	movl	%esi, %r8d
	subl	%edi, %r8d
	addl	%r8d, %edx
	jmp	.L16
.L31:
	subl	%eax, %esi
	addl	%esi, %edx
	jmp	.L10
.L20:
	xorl	%edx, %edx
	jmp	.L10
.L21:
	xorl	%edx, %edx
	xorl	%eax, %eax
	jmp	.L11
.L32:
	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\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	subq	$4096, %rsp
	.cfi_def_cfa_offset 4136
	orq	$0, (%rsp)
	subq	$3960, %rsp
	.cfi_def_cfa_offset 8096
	leaq	.LC0(%rip), %r12
	movq	%r12, %rdi
	movq	%fs:40, %rax
	movq	%rax, 8040(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rdx
	leaq	8(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %r8d
	testl	%r8d, %r8d
	jle	.L2
	leaq	16(%rsp), %rbp
	xorl	%ebx, %ebx
	leaq	4032(%rsp), %r13
	.p2align 4,,10
	.p2align 3
.L3:
	leaq	0(%r13,%rbx,4), %rdx
	movq	%rbp, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %r8d
	addq	$1, %rbx
	addq	$4, %rbp
	cmpl	%ebx, %r8d
	jg	.L3
	testl	%r8d, %r8d
	jle	.L2
	leaq	20(%rsp), %rdi
	movl	$1, %r9d
	cmpl	$1, %r8d
	je	.L2
	.p2align 4,,10
	.p2align 3
.L6:
	movq	%rdi, %rax
	movl	%r9d, %edx
	.p2align 4,,10
	.p2align 3
.L8:
	movl	-4(%rdi), %ecx
	movl	(%rax), %esi
	cmpl	%esi, %ecx
	jg	.L7
	movl	%esi, -4(%rdi)
	movl	%ecx, (%rax)
.L7:
	addl	$1, %edx
	addq	$4, %rax
	cmpl	%edx, %r8d
	jg	.L8
	addl	$1, %r9d
	addq	$4, %rdi
	cmpl	%r9d, %r8d
	jne	.L6
.L2:
	leal	-1(%r8), %ecx
	testl	%ecx, %ecx
	jle	.L20
	subl	$2, %r8d
	movl	8(%rsp), %esi
	cmpl	$2, %r8d
	jbe	.L21
	movd	%esi, %xmm4
	leaq	16(%rsp), %rax
	pxor	%xmm1, %xmm1
	movl	%ecx, %edx
	shrl	$2, %edx
	pshufd	$0, %xmm4, %xmm2
	subl	$1, %edx
	salq	$4, %rdx
	leaq	32(%rsp,%rdx), %rdx
	.p2align 4,,10
	.p2align 3
.L12:
	movdqa	(%rax), %xmm0
	movdqa	%xmm2, %xmm3
	psubd	(%rax), %xmm3
	addq	$16, %rax
	pcmpgtd	%xmm2, %xmm0
	pandn	%xmm3, %xmm0
	paddd	%xmm0, %xmm1
	cmpq	%rax, %rdx
	jne	.L12
	movdqa	%xmm1, %xmm0
	movl	%ecx, %eax
	psrldq	$8, %xmm0
	andl	$-4, %eax
	paddd	%xmm0, %xmm1
	movdqa	%xmm1, %xmm0
	psrldq	$4, %xmm0
	paddd	%xmm0, %xmm1
	movd	%xmm1, %edx
	testb	$3, %cl
	je	.L10
.L11:
	movslq	%eax, %rdi
	movl	16(%rsp,%rdi,4), %r8d
	movl	%esi, %edi
	subl	%r8d, %edi
	addl	%edx, %edi
	cmpl	%r8d, %esi
	cmovge	%edi, %edx
	leal	1(%rax), %edi
	cmpl	%ecx, %edi
	jge	.L10
	movslq	%edi, %rdi
	movl	16(%rsp,%rdi,4), %edi
	cmpl	%edi, %esi
	jge	.L30
.L16:
	addl	$2, %eax
	cmpl	%ecx, %eax
	jge	.L10
	cltq
	movl	16(%rsp,%rax,4), %eax
	cmpl	%eax, %esi
	jge	.L31
.L10:
	xorl	%eax, %eax
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	8040(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L32
	addq	$8056, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
.L30:
	.cfi_restore_state
	movl	%esi, %r8d
	subl	%edi, %r8d
	addl	%r8d, %edx
	jmp	.L16
.L31:
	subl	%eax, %esi
	addl	%esi, %edx
	jmp	.L10
.L20:
	xorl	%edx, %edx
	jmp	.L10
.L21:
	xorl	%edx, %edx
	xorl	%eax, %eax
	jmp	.L11
.L32:
	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\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	subq	$4096, %rsp
	.cfi_def_cfa_offset 4136
	orq	$0, (%rsp)
	subq	$3960, %rsp
	.cfi_def_cfa_offset 8096
	leaq	.LC0(%rip), %r12
	movq	%r12, %rdi
	movq	%fs:40, %rax
	movq	%rax, 8040(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rdx
	leaq	8(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %r8d
	testl	%r8d, %r8d
	jle	.L2
	leaq	16(%rsp), %rbp
	xorl	%ebx, %ebx
	leaq	4032(%rsp), %r13
	.p2align 4,,10
	.p2align 3
.L3:
	leaq	0(%r13,%rbx,4), %rdx
	movq	%rbp, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %r8d
	addq	$1, %rbx
	addq	$4, %rbp
	cmpl	%ebx, %r8d
	jg	.L3
	testl	%r8d, %r8d
	jle	.L2
	leaq	20(%rsp), %rdi
	movl	$1, %r9d
	cmpl	$1, %r8d
	je	.L2
	.p2align 4,,10
	.p2align 3
.L6:
	movq	%rdi, %rax
	movl	%r9d, %edx
	.p2align 4,,10
	.p2align 3
.L8:
	movl	-4(%rdi), %ecx
	movl	(%rax), %esi
	cmpl	%esi, %ecx
	jg	.L7
	movl	%esi, -4(%rdi)
	movl	%ecx, (%rax)
.L7:
	addl	$1, %edx
	addq	$4, %rax
	cmpl	%edx, %r8d
	jg	.L8
	addl	$1, %r9d
	addq	$4, %rdi
	cmpl	%r9d, %r8d
	jne	.L6
.L2:
	leal	-1(%r8), %ecx
	testl	%ecx, %ecx
	jle	.L20
	subl	$2, %r8d
	movl	8(%rsp), %esi
	cmpl	$2, %r8d
	jbe	.L21
	movd	%esi, %xmm4
	leaq	16(%rsp), %rax
	pxor	%xmm1, %xmm1
	movl	%ecx, %edx
	shrl	$2, %edx
	pshufd	$0, %xmm4, %xmm2
	subl	$1, %edx
	salq	$4, %rdx
	leaq	32(%rsp,%rdx), %rdx
	.p2align 4,,10
	.p2align 3
.L12:
	movdqa	(%rax), %xmm0
	movdqa	%xmm2, %xmm3
	psubd	(%rax), %xmm3
	addq	$16, %rax
	pcmpgtd	%xmm2, %xmm0
	pandn	%xmm3, %xmm0
	paddd	%xmm0, %xmm1
	cmpq	%rax, %rdx
	jne	.L12
	movdqa	%xmm1, %xmm0
	movl	%ecx, %eax
	psrldq	$8, %xmm0
	andl	$-4, %eax
	paddd	%xmm0, %xmm1
	movdqa	%xmm1, %xmm0
	psrldq	$4, %xmm0
	paddd	%xmm0, %xmm1
	movd	%xmm1, %edx
	testb	$3, %cl
	je	.L10
.L11:
	movslq	%eax, %rdi
	movl	16(%rsp,%rdi,4), %r8d
	movl	%esi, %edi
	subl	%r8d, %edi
	addl	%edx, %edi
	cmpl	%r8d, %esi
	cmovge	%edi, %edx
	leal	1(%rax), %edi
	cmpl	%ecx, %edi
	jge	.L10
	movslq	%edi, %rdi
	movl	16(%rsp,%rdi,4), %edi
	cmpl	%edi, %esi
	jge	.L30
.L16:
	addl	$2, %eax
	cmpl	%ecx, %eax
	jge	.L10
	cltq
	movl	16(%rsp,%rax,4), %eax
	cmpl	%eax, %esi
	jge	.L31
.L10:
	xorl	%eax, %eax
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	8040(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L32
	addq	$8056, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
.L30:
	.cfi_restore_state
	movl	%esi, %r8d
	subl	%edi, %r8d
	addl	%r8d, %edx
	jmp	.L16
.L31:
	subl	%eax, %esi
	addl	%esi, %edx
	jmp	.L10
.L20:
	xorl	%edx, %edx
	jmp	.L10
.L21:
	xorl	%edx, %edx
	xorl	%eax, %eax
	jmp	.L11
.L32:
	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(void)
{
	int n,m,a[1001],b[1001],i,j,x,z;
	scanf("%d %d",&n,&m);
	for(i=0;i<m;i++){
		scanf("%d %d",&a[i],&b[i]);
	}
	for(i=0;i<m;i++){
		for(j=i+1;j<m;j++){
			if(a[i]<=a[j]){
				x=a[i];
				a[i]=a[j];
				a[j]=x;
			}
		}
	}
	z=0;
	for(i=0;i<m-1;i++){
		// printf("%d\n",a[i]);
		if(a[i]<=n)	z+=n-a[i];
	}
	printf("%d\n",z);
	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(void)
{
	int n,m,a[1001],b[1001],i,j,x,z;
	scanf("%d %d",&n,&m);
	for(i=0;i<m;i++){
		scanf("%d %d",&a[i],&b[i]);
	}
	for(i=0;i<m;i++){
		for(j=i+1;j<m;j++){
			if(a[i]<=a[j]){
				x=a[i];
				a[i]=a[j];
				a[j]=x;
			}
		}
	}
	z=0;
	for(i=0;i<m-1;i++){
		// printf("%d\n",a[i]);
		if(a[i]<=n)	z+=n-a[i];
	}
	printf("%d\n",z);
	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:

4 5
1 7
6 2
3 5
4 4
0 8

4

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(void)
{
	int n,m,a[1001],b[1001],i,j,x,z;
	scanf("%d %d",&n,&m);
	for(i=0;i<m;i++){
		scanf("%d %d",&a[i],&b[i]);
	}
	for(i=0;i<m;i++){
		for(j=i+1;j<m;j++){
			if(a[i]<=a[j]){
				x=a[i];
				a[i]=a[j];
				a[j]=x;
			}
		}
	}
	z=0;
	for(i=0;i<m-1;i++){
		// printf("%d\n",a[i]);
		if(a[i]<=n)	z+=n-a[i];
	}
	printf("%d\n",z);
	return 0;
}
			
```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	subq	$4096, %rsp
	.cfi_def_cfa_offset 4136
	orq	$0, (%rsp)
	subq	$3960, %rsp
	.cfi_def_cfa_offset 8096
	leaq	.LC0(%rip), %r12
	movq	%r12, %rdi
	movq	%fs:40, %rax
	movq	%rax, 8040(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rdx
	leaq	8(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %r8d
	testl	%r8d, %r8d
	jle	.L2
	leaq	16(%rsp), %rbp
	xorl	%ebx, %ebx
	leaq	4032(%rsp), %r13
	.p2align 4,,10
	.p2align 3
.L3:
	leaq	0(%r13,%rbx,4), %rdx
	movq	%rbp, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %r8d
	addq	$1, %rbx
	addq	$4, %rbp
	cmpl	%ebx, %r8d
	jg	.L3
	testl	%r8d, %r8d
	jle	.L2
	leaq	20(%rsp), %rdi
	movl	$1, %r9d
	cmpl	$1, %r8d
	je	.L2
	.p2align 4,,10
	.p2align 3
.L6:
	movq	%rdi, %rax
	movl	%r9d, %edx
	.p2align 4,,10
	.p2align 3
.L8:
	movl	-4(%rdi), %ecx
	movl	(%rax), %esi
	cmpl	%esi, %ecx
	jg	.L7
	movl	%esi, -4(%rdi)
	movl	%ecx, (%rax)
.L7:
	addl	$1, %edx
	addq	$4, %rax
	cmpl	%edx, %r8d
	jg	.L8
	addl	$1, %r9d
	addq	$4, %rdi
	cmpl	%r9d, %r8d
	jne	.L6
.L2:
	leal	-1(%r8), %ecx
	testl	%ecx, %ecx
	jle	.L20
	subl	$2, %r8d
	movl	8(%rsp), %esi
	cmpl	$2, %r8d
	jbe	.L21
	movd	%esi, %xmm4
	leaq	16(%rsp), %rax
	pxor	%xmm1, %xmm1
	movl	%ecx, %edx
	shrl	$2, %edx
	pshufd	$0, %xmm4, %xmm2
	subl	$1, %edx
	salq	$4, %rdx
	leaq	32(%rsp,%rdx), %rdx
	.p2align 4,,10
	.p2align 3
.L12:
	movdqa	(%rax), %xmm0
	movdqa	%xmm2, %xmm3
	psubd	(%rax), %xmm3
	addq	$16, %rax
	pcmpgtd	%xmm2, %xmm0
	pandn	%xmm3, %xmm0
	paddd	%xmm0, %xmm1
	cmpq	%rax, %rdx
	jne	.L12
	movdqa	%xmm1, %xmm0
	movl	%ecx, %eax
	psrldq	$8, %xmm0
	andl	$-4, %eax
	paddd	%xmm0, %xmm1
	movdqa	%xmm1, %xmm0
	psrldq	$4, %xmm0
	paddd	%xmm0, %xmm1
	movd	%xmm1, %edx
	testb	$3, %cl
	je	.L10
.L11:
	movslq	%eax, %rdi
	movl	16(%rsp,%rdi,4), %r8d
	movl	%esi, %edi
	subl	%r8d, %edi
	addl	%edx, %edi
	cmpl	%r8d, %esi
	cmovge	%edi, %edx
	leal	1(%rax), %edi
	cmpl	%ecx, %edi
	jge	.L10
	movslq	%edi, %rdi
	movl	16(%rsp,%rdi,4), %edi
	cmpl	%edi, %esi
	jge	.L30
.L16:
	addl	$2, %eax
	cmpl	%ecx, %eax
	jge	.L10
	cltq
	movl	16(%rsp,%rax,4), %eax
	cmpl	%eax, %esi
	jge	.L31
.L10:
	xorl	%eax, %eax
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	8040(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L32
	addq	$8056, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
.L30:
	.cfi_restore_state
	movl	%esi, %r8d
	subl	%edi, %r8d
	addl	%r8d, %edx
	jmp	.L16
.L31:
	subl	%eax, %esi
	addl	%esi, %edx
	jmp	.L10
.L20:
	xorl	%edx, %edx
	jmp	.L10
.L21:
	xorl	%edx, %edx
	xorl	%eax, %eax
	jmp	.L11
.L32:
	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\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	subq	$4096, %rsp
	.cfi_def_cfa_offset 4136
	orq	$0, (%rsp)
	subq	$3960, %rsp
	.cfi_def_cfa_offset 8096
	leaq	.LC0(%rip), %r12
	movq	%r12, %rdi
	movq	%fs:40, %rax
	movq	%rax, 8040(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rdx
	leaq	8(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %r8d
	testl	%r8d, %r8d
	jle	.L2
	leaq	16(%rsp), %rbp
	xorl	%ebx, %ebx
	leaq	4032(%rsp), %r13
	.p2align 4,,10
	.p2align 3
.L3:
	leaq	0(%r13,%rbx,4), %rdx
	movq	%rbp, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %r8d
	addq	$1, %rbx
	addq	$4, %rbp
	cmpl	%ebx, %r8d
	jg	.L3
	testl	%r8d, %r8d
	jle	.L2
	leaq	20(%rsp), %rdi
	movl	$1, %r9d
	cmpl	$1, %r8d
	je	.L2
	.p2align 4,,10
	.p2align 3
.L6:
	movq	%rdi, %rax
	movl	%r9d, %edx
	.p2align 4,,10
	.p2align 3
.L8:
	movl	-4(%rdi), %ecx
	movl	(%rax), %esi
	cmpl	%esi, %ecx
	jg	.L7
	movl	%esi, -4(%rdi)
	movl	%ecx, (%rax)
.L7:
	addl	$1, %edx
	addq	$4, %rax
	cmpl	%edx, %r8d
	jg	.L8
	addl	$1, %r9d
	addq	$4, %rdi
	cmpl	%r9d, %r8d
	jne	.L6
.L2:
	leal	-1(%r8), %ecx
	testl	%ecx, %ecx
	jle	.L20
	subl	$2, %r8d
	movl	8(%rsp), %esi
	cmpl	$2, %r8d
	jbe	.L21
	movd	%esi, %xmm4
	leaq	16(%rsp), %rax
	pxor	%xmm1, %xmm1
	movl	%ecx, %edx
	shrl	$2, %edx
	pshufd	$0, %xmm4, %xmm2
	subl	$1, %edx
	salq	$4, %rdx
	leaq	32(%rsp,%rdx), %rdx
	.p2align 4,,10
	.p2align 3
.L12:
	movdqa	(%rax), %xmm0
	movdqa	%xmm2, %xmm3
	psubd	(%rax), %xmm3
	addq	$16, %rax
	pcmpgtd	%xmm2, %xmm0
	pandn	%xmm3, %xmm0
	paddd	%xmm0, %xmm1
	cmpq	%rax, %rdx
	jne	.L12
	movdqa	%xmm1, %xmm0
	movl	%ecx, %eax
	psrldq	$8, %xmm0
	andl	$-4, %eax
	paddd	%xmm0, %xmm1
	movdqa	%xmm1, %xmm0
	psrldq	$4, %xmm0
	paddd	%xmm0, %xmm1
	movd	%xmm1, %edx
	testb	$3, %cl
	je	.L10
.L11:
	movslq	%eax, %rdi
	movl	16(%rsp,%rdi,4), %r8d
	movl	%esi, %edi
	subl	%r8d, %edi
	addl	%edx, %edi
	cmpl	%r8d, %esi
	cmovge	%edi, %edx
	leal	1(%rax), %edi
	cmpl	%ecx, %edi
	jge	.L10
	movslq	%edi, %rdi
	movl	16(%rsp,%rdi,4), %edi
	cmpl	%edi, %esi
	jge	.L30
.L16:
	addl	$2, %eax
	cmpl	%ecx, %eax
	jge	.L10
	cltq
	movl	16(%rsp,%rax,4), %eax
	cmpl	%eax, %esi
	jge	.L31
.L10:
	xorl	%eax, %eax
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	8040(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L32
	addq	$8056, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
.L30:
	.cfi_restore_state
	movl	%esi, %r8d
	subl	%edi, %r8d
	addl	%r8d, %edx
	jmp	.L16
.L31:
	subl	%eax, %esi
	addl	%esi, %edx
	jmp	.L10
.L20:
	xorl	%edx, %edx
	jmp	.L10
.L21:
	xorl	%edx, %edx
	xorl	%eax, %eax
	jmp	.L11
.L32:
	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:
```