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>          // printf(), scanf()
#include <stdlib.h>         // qsort()
#include <stdbool.h>

#define MAX_N 10000

typedef struct customer_tbl
{
	int use;
	int latency;
} customer_t;

int
cmp_func(const void *l_, const void *r_)
{
	const customer_t *l = (const customer_t*) l_;
	const customer_t *r = (const customer_t*) r_;

	if (l->use < r->use)
		return -1;

	if (l->use > r->use)
		return 1;

	return 0;
}

int
main(int argc, char **argv)
{
	customer_t customers[MAX_N];
	int n, i;

	while (true)
	{
		scanf("%d", &n);
		if (n == 0)
			break;

		for (i = 0; i < n; ++i)
			scanf("%d", &customers[i].use);

		qsort(customers, n, sizeof(customer_t), cmp_func);

		customers[0].latency = 0;
		long total = 0;
		for (i = 1; i < n; ++i)
		{
			customers[i].latency = customers[i - 1].latency + customers[i - 1].use;
			total += customers[i].latency;
		}

		printf("%ld\n", total);
	}

	return 0;
}```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.p2align 4
	.globl	cmp_func
	.type	cmp_func, @function
cmp_func:
.LFB39:
	.cfi_startproc
	endbr64
	movl	(%rsi), %eax
	cmpl	%eax, (%rdi)
	movl	$-1, %edx
	setg	%al
	movzbl	%al, %eax
	cmovl	%edx, %eax
	ret
	.cfi_endproc
.LFE39:
	.size	cmp_func, .-cmp_func
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%ld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB40:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	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
	leaq	-77824(%rsp), %r11
	.cfi_def_cfa 11, 77880
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$2232, %rsp
	.cfi_def_cfa_offset 80112
	leaq	.LC0(%rip), %rbx
	leaq	cmp_func(%rip), %r14
	movq	%fs:40, %rax
	movq	%rax, 80040(%rsp)
	xorl	%eax, %eax
	leaq	40(%rsp), %rax
	leaq	28(%rsp), %r12
	movq	%rax, 8(%rsp)
	leaq	32(%rsp), %rbp
	.p2align 4,,10
	.p2align 3
.L11:
	movq	%r12, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	28(%rsp), %rsi
	testl	%esi, %esi
	je	.L6
	jle	.L7
	movq	%rbp, %r13
	xorl	%r15d, %r15d
	.p2align 4,,10
	.p2align 3
.L8:
	movq	%r13, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	addl	$1, %r15d
	call	__isoc99_scanf@PLT
	movslq	28(%rsp), %rsi
	addq	$8, %r13
	cmpl	%r15d, %esi
	jg	.L8
.L7:
	movl	$8, %edx
	movq	%r14, %rcx
	movq	%rbp, %rdi
	call	qsort@PLT
	movl	28(%rsp), %edx
	movl	$0, 36(%rsp)
	cmpl	$1, %edx
	jle	.L13
	movq	8(%rsp), %rdi
	subl	$2, %edx
	movq	%rbp, %rax
	xorl	%r8d, %r8d
	leaq	(%rdi,%rdx,8), %rsi
	xorl	%edx, %edx
	.p2align 4,,10
	.p2align 3
.L10:
	addl	(%rax), %edx
	addq	$8, %rax
	movslq	%edx, %rcx
	movl	%edx, 4(%rax)
	addq	%rcx, %r8
	cmpq	%rsi, %rax
	jne	.L10
.L9:
	movq	%r8, %rdx
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L11
	.p2align 4,,10
	.p2align 3
.L6:
	movq	80040(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L18
	addq	$80056, %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
	.p2align 4,,10
	.p2align 3
.L13:
	.cfi_restore_state
	xorl	%r8d, %r8d
	jmp	.L9
.L18:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE40:
	.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
	.p2align 4
	.globl	cmp_func
	.type	cmp_func, @function
cmp_func:
.LFB39:
	.cfi_startproc
	endbr64
	movl	(%rsi), %eax
	cmpl	%eax, (%rdi)
	movl	$-1, %edx
	setg	%al
	movzbl	%al, %eax
	cmovl	%edx, %eax
	ret
	.cfi_endproc
.LFE39:
	.size	cmp_func, .-cmp_func
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%ld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB40:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	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
	leaq	-77824(%rsp), %r11
	.cfi_def_cfa 11, 77880
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$2232, %rsp
	.cfi_def_cfa_offset 80112
	leaq	.LC0(%rip), %rbx
	leaq	cmp_func(%rip), %r14
	movq	%fs:40, %rax
	movq	%rax, 80040(%rsp)
	xorl	%eax, %eax
	leaq	40(%rsp), %rax
	leaq	28(%rsp), %r12
	movq	%rax, 8(%rsp)
	leaq	32(%rsp), %rbp
	.p2align 4,,10
	.p2align 3
.L11:
	movq	%r12, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	28(%rsp), %rsi
	testl	%esi, %esi
	je	.L6
	jle	.L7
	movq	%rbp, %r13
	xorl	%r15d, %r15d
	.p2align 4,,10
	.p2align 3
.L8:
	movq	%r13, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	addl	$1, %r15d
	call	__isoc99_scanf@PLT
	movslq	28(%rsp), %rsi
	addq	$8, %r13
	cmpl	%r15d, %esi
	jg	.L8
.L7:
	movl	$8, %edx
	movq	%r14, %rcx
	movq	%rbp, %rdi
	call	qsort@PLT
	movl	28(%rsp), %edx
	movl	$0, 36(%rsp)
	cmpl	$1, %edx
	jle	.L13
	movq	8(%rsp), %rdi
	subl	$2, %edx
	movq	%rbp, %rax
	xorl	%r8d, %r8d
	leaq	(%rdi,%rdx,8), %rsi
	xorl	%edx, %edx
	.p2align 4,,10
	.p2align 3
.L10:
	addl	(%rax), %edx
	addq	$8, %rax
	movslq	%edx, %rcx
	movl	%edx, 4(%rax)
	addq	%rcx, %r8
	cmpq	%rsi, %rax
	jne	.L10
.L9:
	movq	%r8, %rdx
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L11
	.p2align 4,,10
	.p2align 3
.L6:
	movq	80040(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L18
	addq	$80056, %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
	.p2align 4,,10
	.p2align 3
.L13:
	.cfi_restore_state
	xorl	%r8d, %r8d
	jmp	.L9
.L18:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE40:
	.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
	.p2align 4
	.globl	cmp_func
	.type	cmp_func, @function
cmp_func:
.LFB39:
	.cfi_startproc
	endbr64
	movl	(%rsi), %eax
	cmpl	%eax, (%rdi)
	movl	$-1, %edx
	setg	%al
	movzbl	%al, %eax
	cmovl	%edx, %eax
	ret
	.cfi_endproc
.LFE39:
	.size	cmp_func, .-cmp_func
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%ld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB40:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	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
	leaq	-77824(%rsp), %r11
	.cfi_def_cfa 11, 77880
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$2232, %rsp
	.cfi_def_cfa_offset 80112
	leaq	.LC0(%rip), %rbx
	leaq	cmp_func(%rip), %r14
	movq	%fs:40, %rax
	movq	%rax, 80040(%rsp)
	xorl	%eax, %eax
	leaq	40(%rsp), %rax
	leaq	28(%rsp), %r12
	movq	%rax, 8(%rsp)
	leaq	32(%rsp), %rbp
	.p2align 4,,10
	.p2align 3
.L11:
	movq	%r12, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	28(%rsp), %rsi
	testl	%esi, %esi
	je	.L6
	jle	.L7
	movq	%rbp, %r13
	xorl	%r15d, %r15d
	.p2align 4,,10
	.p2align 3
.L8:
	movq	%r13, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	addl	$1, %r15d
	call	__isoc99_scanf@PLT
	movslq	28(%rsp), %rsi
	addq	$8, %r13
	cmpl	%r15d, %esi
	jg	.L8
.L7:
	movl	$8, %edx
	movq	%r14, %rcx
	movq	%rbp, %rdi
	call	qsort@PLT
	movl	28(%rsp), %edx
	movl	$0, 36(%rsp)
	cmpl	$1, %edx
	jle	.L13
	movq	8(%rsp), %rdi
	subl	$2, %edx
	movq	%rbp, %rax
	xorl	%r8d, %r8d
	leaq	(%rdi,%rdx,8), %rsi
	xorl	%edx, %edx
	.p2align 4,,10
	.p2align 3
.L10:
	addl	(%rax), %edx
	addq	$8, %rax
	movslq	%edx, %rcx
	movl	%edx, 4(%rax)
	addq	%rcx, %r8
	cmpq	%rsi, %rax
	jne	.L10
.L9:
	movq	%r8, %rdx
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L11
	.p2align 4,,10
	.p2align 3
.L6:
	movq	80040(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L18
	addq	$80056, %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
	.p2align 4,,10
	.p2align 3
.L13:
	.cfi_restore_state
	xorl	%r8d, %r8d
	jmp	.L9
.L18:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE40:
	.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>          // printf(), scanf()
#include <stdlib.h>         // qsort()
#include <stdbool.h>

#define MAX_N 10000

typedef struct customer_tbl
{
	int use;
	int latency;
} customer_t;

int
cmp_func(const void *l_, const void *r_)
{
	const customer_t *l = (const customer_t*) l_;
	const customer_t *r = (const customer_t*) r_;

	if (l->use < r->use)
		return -1;

	if (l->use > r->use)
		return 1;

	return 0;
}

int
main(int argc, char **argv)
{
	customer_t customers[MAX_N];
	int n, i;

	while (true)
	{
		scanf("%d", &n);
		if (n == 0)
			break;

		for (i = 0; i < n; ++i)
			scanf("%d", &customers[i].use);

		qsort(customers, n, sizeof(customer_t), cmp_func);

		customers[0].latency = 0;
		long total = 0;
		for (i = 1; i < n; ++i)
		{
			customers[i].latency = customers[i - 1].latency + customers[i - 1].use;
			total += customers[i].latency;
		}

		printf("%ld\n", total);
	}

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

```c
#include <stdio.h>          // printf(), scanf()
#include <stdlib.h>         // qsort()
#include <stdbool.h>

#define MAX_N 10000

typedef struct customer_tbl
{
	int use;
	int latency;
} customer_t;

int
cmp_func(const void *l_, const void *r_)
{
	const customer_t *l = (const customer_t*) l_;
	const customer_t *r = (const customer_t*) r_;

	if (l->use < r->use)
		return -1;

	if (l->use > r->use)
		return 1;

	return 0;
}

int
main(int argc, char **argv)
{
	customer_t customers[MAX_N];
	int n, i;

	while (true)
	{
		scanf("%d", &n);
		if (n == 0)
			break;

		for (i = 0; i < n; ++i)
			scanf("%d", &customers[i].use);

		qsort(customers, n, sizeof(customer_t), cmp_func);

		customers[0].latency = 0;
		long total = 0;
		for (i = 1; i < n; ++i)
		{
			customers[i].latency = customers[i - 1].latency + customers[i - 1].use;
			total += customers[i].latency;
		}

		printf("%ld\n", total);
	}

	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
2
6
4
6
9
0
 5
2
10
4
6
9
0
 5
2
6
4
7
9
0
 5
2
10
4
7
9
0
 5
2
17
8
7
9
0
 5
4
6
4
7
14
0
 5
2
17
8
7
12
0
 5
4
6
5
7
14
0
 5
1
17
8
7
12
0
 5
0
17
8
7
12
0

38
 41
 39
 43
 54
 47
 57
 50
 53
 49

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>          // printf(), scanf()
#include <stdlib.h>         // qsort()
#include <stdbool.h>

#define MAX_N 10000

typedef struct customer_tbl
{
	int use;
	int latency;
} customer_t;

int
cmp_func(const void *l_, const void *r_)
{
	const customer_t *l = (const customer_t*) l_;
	const customer_t *r = (const customer_t*) r_;

	if (l->use < r->use)
		return -1;

	if (l->use > r->use)
		return 1;

	return 0;
}

int
main(int argc, char **argv)
{
	customer_t customers[MAX_N];
	int n, i;

	while (true)
	{
		scanf("%d", &n);
		if (n == 0)
			break;

		for (i = 0; i < n; ++i)
			scanf("%d", &customers[i].use);

		qsort(customers, n, sizeof(customer_t), cmp_func);

		customers[0].latency = 0;
		long total = 0;
		for (i = 1; i < n; ++i)
		{
			customers[i].latency = customers[i - 1].latency + customers[i - 1].use;
			total += customers[i].latency;
		}

		printf("%ld\n", total);
	}

	return 0;
}```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.p2align 4
	.globl	cmp_func
	.type	cmp_func, @function
cmp_func:
.LFB39:
	.cfi_startproc
	endbr64
	movl	(%rsi), %eax
	cmpl	%eax, (%rdi)
	movl	$-1, %edx
	setg	%al
	movzbl	%al, %eax
	cmovl	%edx, %eax
	ret
	.cfi_endproc
.LFE39:
	.size	cmp_func, .-cmp_func
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%ld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB40:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	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
	leaq	-77824(%rsp), %r11
	.cfi_def_cfa 11, 77880
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$2232, %rsp
	.cfi_def_cfa_offset 80112
	leaq	.LC0(%rip), %rbx
	leaq	cmp_func(%rip), %r14
	movq	%fs:40, %rax
	movq	%rax, 80040(%rsp)
	xorl	%eax, %eax
	leaq	40(%rsp), %rax
	leaq	28(%rsp), %r12
	movq	%rax, 8(%rsp)
	leaq	32(%rsp), %rbp
	.p2align 4,,10
	.p2align 3
.L11:
	movq	%r12, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	28(%rsp), %rsi
	testl	%esi, %esi
	je	.L6
	jle	.L7
	movq	%rbp, %r13
	xorl	%r15d, %r15d
	.p2align 4,,10
	.p2align 3
.L8:
	movq	%r13, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	addl	$1, %r15d
	call	__isoc99_scanf@PLT
	movslq	28(%rsp), %rsi
	addq	$8, %r13
	cmpl	%r15d, %esi
	jg	.L8
.L7:
	movl	$8, %edx
	movq	%r14, %rcx
	movq	%rbp, %rdi
	call	qsort@PLT
	movl	28(%rsp), %edx
	movl	$0, 36(%rsp)
	cmpl	$1, %edx
	jle	.L13
	movq	8(%rsp), %rdi
	subl	$2, %edx
	movq	%rbp, %rax
	xorl	%r8d, %r8d
	leaq	(%rdi,%rdx,8), %rsi
	xorl	%edx, %edx
	.p2align 4,,10
	.p2align 3
.L10:
	addl	(%rax), %edx
	addq	$8, %rax
	movslq	%edx, %rcx
	movl	%edx, 4(%rax)
	addq	%rcx, %r8
	cmpq	%rsi, %rax
	jne	.L10
.L9:
	movq	%r8, %rdx
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L11
	.p2align 4,,10
	.p2align 3
.L6:
	movq	80040(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L18
	addq	$80056, %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
	.p2align 4,,10
	.p2align 3
.L13:
	.cfi_restore_state
	xorl	%r8d, %r8d
	jmp	.L9
.L18:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE40:
	.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
	.p2align 4
	.globl	cmp_func
	.type	cmp_func, @function
cmp_func:
.LFB39:
	.cfi_startproc
	endbr64
	movl	(%rsi), %eax
	cmpl	%eax, (%rdi)
	movl	$-1, %edx
	setg	%al
	movzbl	%al, %eax
	cmovl	%edx, %eax
	ret
	.cfi_endproc
.LFE39:
	.size	cmp_func, .-cmp_func
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%ld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB40:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	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
	leaq	-77824(%rsp), %r11
	.cfi_def_cfa 11, 77880
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$2232, %rsp
	.cfi_def_cfa_offset 80112
	leaq	.LC0(%rip), %rbx
	leaq	cmp_func(%rip), %r14
	movq	%fs:40, %rax
	movq	%rax, 80040(%rsp)
	xorl	%eax, %eax
	leaq	40(%rsp), %rax
	leaq	28(%rsp), %r12
	movq	%rax, 8(%rsp)
	leaq	32(%rsp), %rbp
	.p2align 4,,10
	.p2align 3
.L11:
	movq	%r12, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	28(%rsp), %rsi
	testl	%esi, %esi
	je	.L6
	jle	.L7
	movq	%rbp, %r13
	xorl	%r15d, %r15d
	.p2align 4,,10
	.p2align 3
.L8:
	movq	%r13, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	addl	$1, %r15d
	call	__isoc99_scanf@PLT
	movslq	28(%rsp), %rsi
	addq	$8, %r13
	cmpl	%r15d, %esi
	jg	.L8
.L7:
	movl	$8, %edx
	movq	%r14, %rcx
	movq	%rbp, %rdi
	call	qsort@PLT
	movl	28(%rsp), %edx
	movl	$0, 36(%rsp)
	cmpl	$1, %edx
	jle	.L13
	movq	8(%rsp), %rdi
	subl	$2, %edx
	movq	%rbp, %rax
	xorl	%r8d, %r8d
	leaq	(%rdi,%rdx,8), %rsi
	xorl	%edx, %edx
	.p2align 4,,10
	.p2align 3
.L10:
	addl	(%rax), %edx
	addq	$8, %rax
	movslq	%edx, %rcx
	movl	%edx, 4(%rax)
	addq	%rcx, %r8
	cmpq	%rsi, %rax
	jne	.L10
.L9:
	movq	%r8, %rdx
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L11
	.p2align 4,,10
	.p2align 3
.L6:
	movq	80040(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L18
	addq	$80056, %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
	.p2align 4,,10
	.p2align 3
.L13:
	.cfi_restore_state
	xorl	%r8d, %r8d
	jmp	.L9
.L18:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE40:
	.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:
```