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>
#include <stdlib.h>
#define ms_valtype int

//比較関数
int compare_ms(ms_valtype a, ms_valtype b){
	return a - b;
}

//昇順
void sort_sub(ms_valtype *origin, int left, int right, ms_valtype *tmp){
	if(right - left > 1){
		int i, j, k, half = (left + right) / 2;
		sort_sub(origin, left, half, tmp);
		sort_sub(origin, half, right, tmp);
		for(i = left; i < right; i++){
			tmp[i] = origin[i];
		}
		for(i = left, j = left, k = half; i < right; i++){
			if(k == right){
				origin[i] = tmp[j];
				j++;
			}
			else if(compare_ms(tmp[j], tmp[k]) <= 0 && j < half){
				origin[i] = tmp[j];
				j++;
			}
			else{
				origin[i] = tmp[k];
				k++;
			}
		}
	}
}

void sort(ms_valtype *origin, int N){
	ms_valtype *tmp = (ms_valtype *)malloc(sizeof(ms_valtype) * N);
	sort_sub(origin, 0, N, tmp);
	free(tmp);
}

int min(int a, int b){
	return a <= b ? a : b;
}

int main(){
	int N, i;
	scanf("%d", &N);
	int *A = (int *)malloc(sizeof(int) * N);
	for(i = 0; i < N; i++){
		scanf("%d", &A[i]);
	}
	sort(A, N);
	int now = 0, ans;
	for(i = 0; i < N - 1; i++){
		if(now < min(A[i], A[N - 1] - A[i])){
			now = min(A[i], A[N - 1] - A[i]);
			ans = A[i];
		}
	}
	printf("%d %d\n", A[N - 1], ans);
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	compare_ms
	.type	compare_ms, @function
compare_ms:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -4(%rbp)
	movl	%esi, -8(%rbp)
	movl	-4(%rbp), %eax
	subl	-8(%rbp), %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	compare_ms, .-compare_ms
	.globl	sort_sub
	.type	sort_sub, @function
sort_sub:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$48, %rsp
	movq	%rdi, -24(%rbp)
	movl	%esi, -28(%rbp)
	movl	%edx, -32(%rbp)
	movq	%rcx, -40(%rbp)
	movl	-32(%rbp), %eax
	subl	-28(%rbp), %eax
	cmpl	$1, %eax
	jle	.L12
	movl	-28(%rbp), %edx
	movl	-32(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, -4(%rbp)
	movq	-40(%rbp), %rcx
	movl	-4(%rbp), %edx
	movl	-28(%rbp), %esi
	movq	-24(%rbp), %rax
	movq	%rax, %rdi
	call	sort_sub
	movq	-40(%rbp), %rcx
	movl	-32(%rbp), %edx
	movl	-4(%rbp), %esi
	movq	-24(%rbp), %rax
	movq	%rax, %rdi
	call	sort_sub
	movl	-28(%rbp), %eax
	movl	%eax, -16(%rbp)
	jmp	.L5
.L6:
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	-16(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	movq	-40(%rbp), %rdx
	addq	%rcx, %rdx
	movl	(%rax), %eax
	movl	%eax, (%rdx)
	addl	$1, -16(%rbp)
.L5:
	movl	-16(%rbp), %eax
	cmpl	-32(%rbp), %eax
	jl	.L6
	movl	-28(%rbp), %eax
	movl	%eax, -16(%rbp)
	movl	-28(%rbp), %eax
	movl	%eax, -12(%rbp)
	movl	-4(%rbp), %eax
	movl	%eax, -8(%rbp)
	jmp	.L7
.L11:
	movl	-8(%rbp), %eax
	cmpl	-32(%rbp), %eax
	jne	.L8
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	-16(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	movq	-24(%rbp), %rdx
	addq	%rcx, %rdx
	movl	(%rax), %eax
	movl	%eax, (%rdx)
	addl	$1, -12(%rbp)
	jmp	.L9
.L8:
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	movq	-40(%rbp), %rax
	addq	%rcx, %rax
	movl	(%rax), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	compare_ms
	testl	%eax, %eax
	jg	.L10
	movl	-12(%rbp), %eax
	cmpl	-4(%rbp), %eax
	jge	.L10
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	-16(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	movq	-24(%rbp), %rdx
	addq	%rcx, %rdx
	movl	(%rax), %eax
	movl	%eax, (%rdx)
	addl	$1, -12(%rbp)
	jmp	.L9
.L10:
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	-16(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	movq	-24(%rbp), %rdx
	addq	%rcx, %rdx
	movl	(%rax), %eax
	movl	%eax, (%rdx)
	addl	$1, -8(%rbp)
.L9:
	addl	$1, -16(%rbp)
.L7:
	movl	-16(%rbp), %eax
	cmpl	-32(%rbp), %eax
	jl	.L11
.L12:
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	sort_sub, .-sort_sub
	.globl	sort
	.type	sort, @function
sort:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movq	%rdi, -24(%rbp)
	movl	%esi, -28(%rbp)
	movl	-28(%rbp), %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -8(%rbp)
	movq	-8(%rbp), %rcx
	movl	-28(%rbp), %edx
	movq	-24(%rbp), %rax
	movl	$0, %esi
	movq	%rax, %rdi
	call	sort_sub
	movq	-8(%rbp), %rax
	movq	%rax, %rdi
	call	free@PLT
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	sort, .-sort
	.globl	min
	.type	min, @function
min:
.LFB9:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -4(%rbp)
	movl	%esi, -8(%rbp)
	movl	-4(%rbp), %edx
	movl	-8(%rbp), %eax
	cmpl	%eax, %edx
	cmovle	%edx, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.size	min, .-min
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d %d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB10:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-32(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-32(%rbp), %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -16(%rbp)
	movl	$0, -28(%rbp)
	jmp	.L17
.L18:
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -28(%rbp)
.L17:
	movl	-32(%rbp), %eax
	cmpl	%eax, -28(%rbp)
	jl	.L18
	movl	-32(%rbp), %edx
	movq	-16(%rbp), %rax
	movl	%edx, %esi
	movq	%rax, %rdi
	call	sort
	movl	$0, -24(%rbp)
	movl	$0, -28(%rbp)
	jmp	.L19
.L21:
	movl	-32(%rbp), %eax
	cltq
	salq	$2, %rax
	leaq	-4(%rax), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	-28(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	movq	-16(%rbp), %rdx
	addq	%rcx, %rdx
	movl	(%rdx), %ecx
	subl	%ecx, %eax
	movl	%eax, %edx
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	movq	-16(%rbp), %rax
	addq	%rcx, %rax
	movl	(%rax), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	min
	cmpl	%eax, -24(%rbp)
	jge	.L20
	movl	-32(%rbp), %eax
	cltq
	salq	$2, %rax
	leaq	-4(%rax), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	-28(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	movq	-16(%rbp), %rdx
	addq	%rcx, %rdx
	movl	(%rdx), %ecx
	subl	%ecx, %eax
	movl	%eax, %edx
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	movq	-16(%rbp), %rax
	addq	%rcx, %rax
	movl	(%rax), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	min
	movl	%eax, -24(%rbp)
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	%eax, -20(%rbp)
.L20:
	addl	$1, -28(%rbp)
.L19:
	movl	-32(%rbp), %eax
	subl	$1, %eax
	cmpl	%eax, -28(%rbp)
	jl	.L21
	movl	-32(%rbp), %eax
	cltq
	salq	$2, %rax
	leaq	-4(%rax), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	-20(%rbp), %edx
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L23
	call	__stack_chk_fail@PLT
.L23:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE10:
	.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	.text.unlikely,"ax",@progbits
.LCOLDB0:
	.text
.LHOTB0:
	.p2align 4
	.type	sort_sub.part.0, @function
sort_sub.part.0:
.LFB44:
	.cfi_startproc
	leal	(%rdx,%rsi), %eax
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	movl	%eax, %r14d
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	movq	%rdi, %r13
	shrl	$31, %r14d
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	movq	%rcx, %r12
	addl	%eax, %r14d
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	movl	%esi, %ebp
	sarl	%r14d
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	movl	%edx, %ebx
	movl	%r14d, %eax
	subl	%esi, %eax
	cmpl	$1, %eax
	jle	.L2
	movl	%r14d, %edx
	call	sort_sub.part.0
.L2:
	movl	%ebx, %eax
	subl	%r14d, %eax
	cmpl	$1, %eax
	jle	.L3
	movq	%r12, %rcx
	movl	%ebx, %edx
	movl	%r14d, %esi
	movq	%r13, %rdi
	call	sort_sub.part.0
.L3:
	cmpl	%ebp, %ebx
	jle	.L1
	movslq	%ebp, %rcx
	movl	%ebx, %r9d
	leaq	0(,%rcx,4), %rsi
	leaq	1(%rcx), %rdx
	subl	%ebp, %r9d
	movq	%rcx, %rdi
	leaq	(%r12,%rsi), %r8
	leaq	4(%r13,%rsi), %r11
	movq	%rdx, %rax
	movq	%r8, %r10
	subq	%r11, %r10
	cmpq	$8, %r10
	jbe	.L37
	leal	-1(%r9), %r10d
	cmpl	$2, %r10d
	jbe	.L37
	movl	%r9d, %edi
	addq	%r13, %rsi
	xorl	%edx, %edx
	shrl	$2, %edi
	salq	$4, %rdi
	.p2align 4,,10
	.p2align 3
.L6:
	movdqu	(%rsi,%rdx), %xmm0
	movups	%xmm0, (%r8,%rdx)
	addq	$16, %rdx
	cmpq	%rdi, %rdx
	jne	.L6
	movl	%r9d, %edx
	andl	$-4, %edx
	leal	(%rdx,%rbp), %esi
	cmpl	%edx, %r9d
	je	.L8
	movslq	%esi, %rdx
	movl	0(%r13,%rdx,4), %edi
	movl	%edi, (%r12,%rdx,4)
	leal	1(%rsi), %edx
	cmpl	%edx, %ebx
	jle	.L8
	movslq	%edx, %rdx
	addl	$2, %esi
	movl	0(%r13,%rdx,4), %r8d
	leaq	0(,%rdx,4), %rdi
	movl	%r8d, (%r12,%rdx,4)
	cmpl	%esi, %ebx
	jle	.L8
	movl	4(%r13,%rdi), %edx
	movl	%edx, 4(%r12,%rdi)
.L8:
	movl	%r14d, %edx
	movl	(%r12,%rcx,4), %ecx
	cmpl	%edx, %ebx
	je	.L45
	.p2align 4,,10
	.p2align 3
.L9:
	movslq	%edx, %rsi
	movl	(%r12,%rsi,4), %esi
	cmpl	%esi, %ecx
	jg	.L12
	cmpl	%ebp, %r14d
	jg	.L46
.L12:
	addl	$1, %edx
.L13:
	movl	%esi, -4(%r13,%rax,4)
	cmpl	%eax, %ebx
	jle	.L1
	movslq	%ebp, %rcx
	addq	$1, %rax
	movl	(%r12,%rcx,4), %ecx
	cmpl	%edx, %ebx
	jne	.L9
.L45:
	movl	%ecx, -4(%r13,%rax,4)
	addl	$1, %ebp
	movl	%eax, %r9d
	cmpl	%eax, %ebx
	jle	.L1
	movl	%ebx, %r10d
	movslq	%ebp, %rdx
	subl	%eax, %r10d
	cltq
	leaq	4(,%rdx,4), %rdx
	leaq	0(,%rax,4), %rdi
	leaq	(%r12,%rdx), %rsi
	leaq	0(%r13,%rdi), %r8
	movq	%r8, %rcx
	subq	%rsi, %rcx
	cmpq	$8, %rcx
	jbe	.L22
	leal	-1(%r10), %ecx
	cmpl	$2, %ecx
	jbe	.L22
	cmpl	%r9d, %ebx
	movl	$1, %eax
	leaq	-4(%r12,%rdx), %rsi
	cmovg	%r10d, %eax
	xorl	%edx, %edx
	movl	%eax, %edi
	shrl	$2, %edi
	jmp	.L15
	.p2align 4,,10
	.p2align 3
.L47:
	addq	$1, %rdx
.L37:
	movl	0(%r13,%rdi,4), %esi
	movl	%esi, (%r12,%rdi,4)
	movq	%rdx, %rdi
	cmpl	%edx, %ebx
	jg	.L47
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L46:
	addl	$1, %ebp
	movl	%ecx, %esi
	jmp	.L13
	.p2align 4,,10
	.p2align 3
.L1:
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
.L22:
	.cfi_restore_state
	subq	$4, %rdx
	subq	%rdi, %rdx
	addq	%r12, %rdx
	jmp	.L18
	.cfi_endproc
	.section	.text.unlikely
	.cfi_startproc
	.type	sort_sub.part.0.cold, @function
sort_sub.part.0.cold:
.LFSB44:
.L15:
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	.cfi_offset 6, -40
	.cfi_offset 12, -32
	.cfi_offset 13, -24
	.cfi_offset 14, -16
	movq	%rdx, %rcx
	addq	$1, %rdx
	salq	$4, %rcx
	movdqu	(%rsi,%rcx), %xmm1
	movups	%xmm1, (%r8,%rcx)
	cmpl	%edx, %edi
	ja	.L15
	movl	%eax, %edx
	andl	$-4, %edx
	addl	%edx, %ebp
	addl	%edx, %r9d
	cmpl	%edx, %eax
	je	.L1
	movslq	%ebp, %rax
	addl	$1, %ebp
	movl	(%r12,%rax,4), %edx
	movslq	%r9d, %rax
	movl	%edx, 0(%r13,%rax,4)
	leal	1(%r9), %edx
	cmpl	%edx, %ebx
	jle	.L1
	movslq	%ebp, %rax
	addl	$2, %r9d
	movl	(%r12,%rax,4), %esi
	leaq	0(,%rax,4), %rcx
	movslq	%edx, %rax
	leaq	0(,%rax,4), %rdx
	movl	%esi, 0(%r13,%rax,4)
	cmpl	%r9d, %ebx
	jle	.L1
	movl	4(%r12,%rcx), %eax
	movl	%eax, 4(%r13,%rdx)
	jmp	.L1
.L18:
	movl	(%rdx,%rax,4), %ecx
	movl	%ecx, 0(%r13,%rax,4)
	addq	$1, %rax
	cmpl	%eax, %ebx
	jg	.L18
	jmp	.L1
	.cfi_endproc
.LFE44:
	.text
	.size	sort_sub.part.0, .-sort_sub.part.0
	.section	.text.unlikely
	.size	sort_sub.part.0.cold, .-sort_sub.part.0.cold
.LCOLDE0:
	.text
.LHOTE0:
	.p2align 4
	.globl	compare_ms
	.type	compare_ms, @function
compare_ms:
.LFB39:
	.cfi_startproc
	endbr64
	movl	%edi, %eax
	subl	%esi, %eax
	ret
	.cfi_endproc
.LFE39:
	.size	compare_ms, .-compare_ms
	.p2align 4
	.globl	sort_sub
	.type	sort_sub, @function
sort_sub:
.LFB40:
	.cfi_startproc
	endbr64
	movl	%edx, %eax
	subl	%esi, %eax
	cmpl	$1, %eax
	jg	.L51
	ret
	.p2align 4,,10
	.p2align 3
.L51:
	jmp	sort_sub.part.0
	.cfi_endproc
.LFE40:
	.size	sort_sub, .-sort_sub
	.p2align 4
	.globl	sort
	.type	sort, @function
sort:
.LFB41:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	movq	%rdi, %r13
	movslq	%esi, %rdi
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	movq	%rdi, %r12
	salq	$2, %rdi
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	call	malloc@PLT
	movq	%rax, %rbp
	cmpl	$1, %r12d
	jle	.L53
	movq	%rax, %rcx
	movl	%r12d, %edx
	xorl	%esi, %esi
	movq	%r13, %rdi
	call	sort_sub.part.0
.L53:
	movq	%rbp, %rdi
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	jmp	free@PLT
	.cfi_endproc
.LFE41:
	.size	sort, .-sort
	.p2align 4
	.globl	min
	.type	min, @function
min:
.LFB42:
	.cfi_startproc
	endbr64
	cmpl	%esi, %edi
	movl	%esi, %eax
	cmovle	%edi, %eax
	ret
	.cfi_endproc
.LFE42:
	.size	min, .-min
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC1:
	.string	"%d"
.LC2:
	.string	"%d %d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB43:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	.LC1(%rip), %r15
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	movq	%r15, %rdi
	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	$24, %rsp
	.cfi_def_cfa_offset 80
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movslq	4(%rsp), %rdi
	movq	%rdi, %r14
	salq	$2, %rdi
	call	malloc@PLT
	movq	%rax, %rbx
	testl	%r14d, %r14d
	jle	.L57
	movq	%rax, %r13
	xorl	%ebp, %ebp
	.p2align 4,,10
	.p2align 3
.L58:
	movq	%r13, %rsi
	movq	%r15, %rdi
	xorl	%eax, %eax
	addl	$1, %ebp
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %r14d
	addq	$4, %r13
	cmpl	%ebp, %r14d
	jg	.L58
.L57:
	movl	%r14d, %esi
	movq	%rbx, %rdi
	call	sort
	movslq	4(%rsp), %rax
	cmpl	$1, %eax
	jle	.L59
	movslq	%eax, %rdx
	subl	$2, %eax
	movq	%rbx, %rcx
	xorl	%esi, %esi
	movl	-4(%rbx,%rdx,4), %r8d
	leaq	4(%rbx,%rax,4), %rdi
	.p2align 4,,10
	.p2align 3
.L61:
	movl	(%rcx), %edx
	movl	%r8d, %eax
	subl	%edx, %eax
	cmpl	%edx, %eax
	cmovg	%edx, %eax
	cmpl	%esi, %eax
	jle	.L60
	movl	%edx, %r12d
	movl	%eax, %esi
.L60:
	addq	$4, %rcx
	cmpq	%rcx, %rdi
	jne	.L61
.L62:
	xorl	%eax, %eax
	movl	%r12d, %ecx
	movl	%r8d, %edx
	movl	$1, %edi
	leaq	.LC2(%rip), %rsi
	call	__printf_chk@PLT
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L68
	addq	$24, %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
.L59:
	.cfi_restore_state
	movl	-4(%rbx,%rax,4), %r8d
	jmp	.L62
.L68:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE43:
	.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
	.file	"temp.c"
	.text
	.section	.text.unlikely,"ax",@progbits
.LCOLDB0:
	.text
.LHOTB0:
	.p2align 4
	.type	sort_sub.part.0, @function
sort_sub.part.0:
.LFB44:
	.cfi_startproc
	leal	(%rdx,%rsi), %eax
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	movl	%eax, %r14d
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	movq	%rdi, %r13
	shrl	$31, %r14d
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	movq	%rcx, %r12
	addl	%eax, %r14d
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	movl	%esi, %ebp
	sarl	%r14d
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	movl	%edx, %ebx
	movl	%r14d, %eax
	subl	%esi, %eax
	cmpl	$1, %eax
	jle	.L2
	movl	%r14d, %edx
	call	sort_sub.part.0
.L2:
	movl	%ebx, %eax
	subl	%r14d, %eax
	cmpl	$1, %eax
	jle	.L3
	movq	%r12, %rcx
	movl	%ebx, %edx
	movl	%r14d, %esi
	movq	%r13, %rdi
	call	sort_sub.part.0
.L3:
	cmpl	%ebp, %ebx
	jle	.L1
	movslq	%ebp, %rcx
	movl	%ebx, %r9d
	leaq	0(,%rcx,4), %rsi
	leaq	1(%rcx), %rdx
	subl	%ebp, %r9d
	movq	%rcx, %rdi
	leaq	(%r12,%rsi), %r8
	leaq	4(%r13,%rsi), %r11
	movq	%rdx, %rax
	movq	%r8, %r10
	subq	%r11, %r10
	cmpq	$8, %r10
	jbe	.L37
	leal	-1(%r9), %r10d
	cmpl	$2, %r10d
	jbe	.L37
	movl	%r9d, %edi
	addq	%r13, %rsi
	xorl	%edx, %edx
	shrl	$2, %edi
	salq	$4, %rdi
	.p2align 4,,10
	.p2align 3
.L6:
	movdqu	(%rsi,%rdx), %xmm0
	movups	%xmm0, (%r8,%rdx)
	addq	$16, %rdx
	cmpq	%rdi, %rdx
	jne	.L6
	movl	%r9d, %edx
	andl	$-4, %edx
	leal	(%rdx,%rbp), %esi
	cmpl	%edx, %r9d
	je	.L8
	movslq	%esi, %rdx
	movl	0(%r13,%rdx,4), %edi
	movl	%edi, (%r12,%rdx,4)
	leal	1(%rsi), %edx
	cmpl	%edx, %ebx
	jle	.L8
	movslq	%edx, %rdx
	addl	$2, %esi
	movl	0(%r13,%rdx,4), %r8d
	leaq	0(,%rdx,4), %rdi
	movl	%r8d, (%r12,%rdx,4)
	cmpl	%esi, %ebx
	jle	.L8
	movl	4(%r13,%rdi), %edx
	movl	%edx, 4(%r12,%rdi)
.L8:
	movl	%r14d, %edx
	movl	(%r12,%rcx,4), %ecx
	cmpl	%edx, %ebx
	je	.L45
	.p2align 4,,10
	.p2align 3
.L9:
	movslq	%edx, %rsi
	movl	(%r12,%rsi,4), %esi
	cmpl	%esi, %ecx
	jg	.L12
	cmpl	%ebp, %r14d
	jg	.L46
.L12:
	addl	$1, %edx
.L13:
	movl	%esi, -4(%r13,%rax,4)
	cmpl	%eax, %ebx
	jle	.L1
	movslq	%ebp, %rcx
	addq	$1, %rax
	movl	(%r12,%rcx,4), %ecx
	cmpl	%edx, %ebx
	jne	.L9
.L45:
	movl	%ecx, -4(%r13,%rax,4)
	addl	$1, %ebp
	movl	%eax, %r9d
	cmpl	%eax, %ebx
	jle	.L1
	movl	%ebx, %r10d
	movslq	%ebp, %rdx
	subl	%eax, %r10d
	cltq
	leaq	4(,%rdx,4), %rdx
	leaq	0(,%rax,4), %rdi
	leaq	(%r12,%rdx), %rsi
	leaq	0(%r13,%rdi), %r8
	movq	%r8, %rcx
	subq	%rsi, %rcx
	cmpq	$8, %rcx
	jbe	.L22
	leal	-1(%r10), %ecx
	cmpl	$2, %ecx
	jbe	.L22
	cmpl	%r9d, %ebx
	movl	$1, %eax
	leaq	-4(%r12,%rdx), %rsi
	cmovg	%r10d, %eax
	xorl	%edx, %edx
	movl	%eax, %edi
	shrl	$2, %edi
	jmp	.L15
	.p2align 4,,10
	.p2align 3
.L47:
	addq	$1, %rdx
.L37:
	movl	0(%r13,%rdi,4), %esi
	movl	%esi, (%r12,%rdi,4)
	movq	%rdx, %rdi
	cmpl	%edx, %ebx
	jg	.L47
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L46:
	addl	$1, %ebp
	movl	%ecx, %esi
	jmp	.L13
	.p2align 4,,10
	.p2align 3
.L1:
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
.L22:
	.cfi_restore_state
	subq	$4, %rdx
	subq	%rdi, %rdx
	addq	%r12, %rdx
	jmp	.L18
	.cfi_endproc
	.section	.text.unlikely
	.cfi_startproc
	.type	sort_sub.part.0.cold, @function
sort_sub.part.0.cold:
.LFSB44:
.L15:
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	.cfi_offset 6, -40
	.cfi_offset 12, -32
	.cfi_offset 13, -24
	.cfi_offset 14, -16
	movq	%rdx, %rcx
	addq	$1, %rdx
	salq	$4, %rcx
	movdqu	(%rsi,%rcx), %xmm1
	movups	%xmm1, (%r8,%rcx)
	cmpl	%edx, %edi
	ja	.L15
	movl	%eax, %edx
	andl	$-4, %edx
	addl	%edx, %ebp
	addl	%edx, %r9d
	cmpl	%edx, %eax
	je	.L1
	movslq	%ebp, %rax
	addl	$1, %ebp
	movl	(%r12,%rax,4), %edx
	movslq	%r9d, %rax
	movl	%edx, 0(%r13,%rax,4)
	leal	1(%r9), %edx
	cmpl	%edx, %ebx
	jle	.L1
	movslq	%ebp, %rax
	addl	$2, %r9d
	movl	(%r12,%rax,4), %esi
	leaq	0(,%rax,4), %rcx
	movslq	%edx, %rax
	leaq	0(,%rax,4), %rdx
	movl	%esi, 0(%r13,%rax,4)
	cmpl	%r9d, %ebx
	jle	.L1
	movl	4(%r12,%rcx), %eax
	movl	%eax, 4(%r13,%rdx)
	jmp	.L1
.L18:
	movl	(%rdx,%rax,4), %ecx
	movl	%ecx, 0(%r13,%rax,4)
	addq	$1, %rax
	cmpl	%eax, %ebx
	jg	.L18
	jmp	.L1
	.cfi_endproc
.LFE44:
	.text
	.size	sort_sub.part.0, .-sort_sub.part.0
	.section	.text.unlikely
	.size	sort_sub.part.0.cold, .-sort_sub.part.0.cold
.LCOLDE0:
	.text
.LHOTE0:
	.p2align 4
	.globl	compare_ms
	.type	compare_ms, @function
compare_ms:
.LFB39:
	.cfi_startproc
	endbr64
	movl	%edi, %eax
	subl	%esi, %eax
	ret
	.cfi_endproc
.LFE39:
	.size	compare_ms, .-compare_ms
	.p2align 4
	.globl	sort_sub
	.type	sort_sub, @function
sort_sub:
.LFB40:
	.cfi_startproc
	endbr64
	movl	%edx, %eax
	subl	%esi, %eax
	cmpl	$1, %eax
	jg	.L51
	ret
	.p2align 4,,10
	.p2align 3
.L51:
	jmp	sort_sub.part.0
	.cfi_endproc
.LFE40:
	.size	sort_sub, .-sort_sub
	.p2align 4
	.globl	sort
	.type	sort, @function
sort:
.LFB41:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	movq	%rdi, %r13
	movslq	%esi, %rdi
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	movq	%rdi, %r12
	salq	$2, %rdi
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	call	malloc@PLT
	movq	%rax, %rbp
	cmpl	$1, %r12d
	jle	.L53
	movq	%rax, %rcx
	movl	%r12d, %edx
	xorl	%esi, %esi
	movq	%r13, %rdi
	call	sort_sub.part.0
.L53:
	movq	%rbp, %rdi
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	jmp	free@PLT
	.cfi_endproc
.LFE41:
	.size	sort, .-sort
	.p2align 4
	.globl	min
	.type	min, @function
min:
.LFB42:
	.cfi_startproc
	endbr64
	cmpl	%esi, %edi
	movl	%esi, %eax
	cmovle	%edi, %eax
	ret
	.cfi_endproc
.LFE42:
	.size	min, .-min
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC1:
	.string	"%d"
.LC2:
	.string	"%d %d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB43:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	.LC1(%rip), %r15
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	movq	%r15, %rdi
	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	$24, %rsp
	.cfi_def_cfa_offset 80
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movslq	4(%rsp), %rdi
	movq	%rdi, %r14
	salq	$2, %rdi
	call	malloc@PLT
	movq	%rax, %rbx
	testl	%r14d, %r14d
	jle	.L57
	movq	%rax, %r13
	xorl	%ebp, %ebp
	.p2align 4,,10
	.p2align 3
.L58:
	movq	%r13, %rsi
	movq	%r15, %rdi
	xorl	%eax, %eax
	addl	$1, %ebp
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %r14d
	addq	$4, %r13
	cmpl	%ebp, %r14d
	jg	.L58
.L57:
	movl	%r14d, %esi
	movq	%rbx, %rdi
	call	sort
	movslq	4(%rsp), %rax
	cmpl	$1, %eax
	jle	.L59
	movslq	%eax, %rdx
	subl	$2, %eax
	movq	%rbx, %rcx
	xorl	%esi, %esi
	movl	-4(%rbx,%rdx,4), %r8d
	leaq	4(%rbx,%rax,4), %rdi
	.p2align 4,,10
	.p2align 3
.L61:
	movl	(%rcx), %edx
	movl	%r8d, %eax
	subl	%edx, %eax
	cmpl	%edx, %eax
	cmovg	%edx, %eax
	cmpl	%esi, %eax
	jle	.L60
	movl	%edx, %r12d
	movl	%eax, %esi
.L60:
	addq	$4, %rcx
	cmpq	%rcx, %rdi
	jne	.L61
.L62:
	xorl	%eax, %eax
	movl	%r12d, %ecx
	movl	%r8d, %edx
	movl	$1, %edi
	leaq	.LC2(%rip), %rsi
	call	__printf_chk@PLT
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L68
	addq	$24, %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
.L59:
	.cfi_restore_state
	movl	-4(%rbx,%rax,4), %r8d
	jmp	.L62
.L68:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE43:
	.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:

#include <stdio.h>
#include <stdlib.h>
#define ms_valtype int

//比較関数
int compare_ms(ms_valtype a, ms_valtype b){
	return a - b;
}

//昇順
void sort_sub(ms_valtype *origin, int left, int right, ms_valtype *tmp){
	if(right - left > 1){
		int i, j, k, half = (left + right) / 2;
		sort_sub(origin, left, half, tmp);
		sort_sub(origin, half, right, tmp);
		for(i = left; i < right; i++){
			tmp[i] = origin[i];
		}
		for(i = left, j = left, k = half; i < right; i++){
			if(k == right){
				origin[i] = tmp[j];
				j++;
			}
			else if(compare_ms(tmp[j], tmp[k]) <= 0 && j < half){
				origin[i] = tmp[j];
				j++;
			}
			else{
				origin[i] = tmp[k];
				k++;
			}
		}
	}
}

void sort(ms_valtype *origin, int N){
	ms_valtype *tmp = (ms_valtype *)malloc(sizeof(ms_valtype) * N);
	sort_sub(origin, 0, N, tmp);
	free(tmp);
}

int min(int a, int b){
	return a <= b ? a : b;
}

int main(){
	int N, i;
	scanf("%d", &N);
	int *A = (int *)malloc(sizeof(int) * N);
	for(i = 0; i < N; i++){
		scanf("%d", &A[i]);
	}
	sort(A, N);
	int now = 0, ans;
	for(i = 0; i < N - 1; i++){
		if(now < min(A[i], A[N - 1] - A[i])){
			now = min(A[i], A[N - 1] - A[i]);
			ans = A[i];
		}
	}
	printf("%d %d\n", A[N - 1], ans);
	return 0;
}
5
6 9 4 2 11

11 6

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>
#include <stdlib.h>
#define ms_valtype int

//比較関数
int compare_ms(ms_valtype a, ms_valtype b){
	return a - b;
}

//昇順
void sort_sub(ms_valtype *origin, int left, int right, ms_valtype *tmp){
	if(right - left > 1){
		int i, j, k, half = (left + right) / 2;
		sort_sub(origin, left, half, tmp);
		sort_sub(origin, half, right, tmp);
		for(i = left; i < right; i++){
			tmp[i] = origin[i];
		}
		for(i = left, j = left, k = half; i < right; i++){
			if(k == right){
				origin[i] = tmp[j];
				j++;
			}
			else if(compare_ms(tmp[j], tmp[k]) <= 0 && j < half){
				origin[i] = tmp[j];
				j++;
			}
			else{
				origin[i] = tmp[k];
				k++;
			}
		}
	}
}

void sort(ms_valtype *origin, int N){
	ms_valtype *tmp = (ms_valtype *)malloc(sizeof(ms_valtype) * N);
	sort_sub(origin, 0, N, tmp);
	free(tmp);
}

int min(int a, int b){
	return a <= b ? a : b;
}

int main(){
	int N, i;
	scanf("%d", &N);
	int *A = (int *)malloc(sizeof(int) * N);
	for(i = 0; i < N; i++){
		scanf("%d", &A[i]);
	}
	sort(A, N);
	int now = 0, ans;
	for(i = 0; i < N - 1; i++){
		if(now < min(A[i], A[N - 1] - A[i])){
			now = min(A[i], A[N - 1] - A[i]);
			ans = A[i];
		}
	}
	printf("%d %d\n", A[N - 1], ans);
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	compare_ms
	.type	compare_ms, @function
compare_ms:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -4(%rbp)
	movl	%esi, -8(%rbp)
	movl	-4(%rbp), %eax
	subl	-8(%rbp), %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	compare_ms, .-compare_ms
	.globl	sort_sub
	.type	sort_sub, @function
sort_sub:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$48, %rsp
	movq	%rdi, -24(%rbp)
	movl	%esi, -28(%rbp)
	movl	%edx, -32(%rbp)
	movq	%rcx, -40(%rbp)
	movl	-32(%rbp), %eax
	subl	-28(%rbp), %eax
	cmpl	$1, %eax
	jle	.L12
	movl	-28(%rbp), %edx
	movl	-32(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, -4(%rbp)
	movq	-40(%rbp), %rcx
	movl	-4(%rbp), %edx
	movl	-28(%rbp), %esi
	movq	-24(%rbp), %rax
	movq	%rax, %rdi
	call	sort_sub
	movq	-40(%rbp), %rcx
	movl	-32(%rbp), %edx
	movl	-4(%rbp), %esi
	movq	-24(%rbp), %rax
	movq	%rax, %rdi
	call	sort_sub
	movl	-28(%rbp), %eax
	movl	%eax, -16(%rbp)
	jmp	.L5
.L6:
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	-16(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	movq	-40(%rbp), %rdx
	addq	%rcx, %rdx
	movl	(%rax), %eax
	movl	%eax, (%rdx)
	addl	$1, -16(%rbp)
.L5:
	movl	-16(%rbp), %eax
	cmpl	-32(%rbp), %eax
	jl	.L6
	movl	-28(%rbp), %eax
	movl	%eax, -16(%rbp)
	movl	-28(%rbp), %eax
	movl	%eax, -12(%rbp)
	movl	-4(%rbp), %eax
	movl	%eax, -8(%rbp)
	jmp	.L7
.L11:
	movl	-8(%rbp), %eax
	cmpl	-32(%rbp), %eax
	jne	.L8
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	-16(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	movq	-24(%rbp), %rdx
	addq	%rcx, %rdx
	movl	(%rax), %eax
	movl	%eax, (%rdx)
	addl	$1, -12(%rbp)
	jmp	.L9
.L8:
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	movq	-40(%rbp), %rax
	addq	%rcx, %rax
	movl	(%rax), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	compare_ms
	testl	%eax, %eax
	jg	.L10
	movl	-12(%rbp), %eax
	cmpl	-4(%rbp), %eax
	jge	.L10
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	-16(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	movq	-24(%rbp), %rdx
	addq	%rcx, %rdx
	movl	(%rax), %eax
	movl	%eax, (%rdx)
	addl	$1, -12(%rbp)
	jmp	.L9
.L10:
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	-16(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	movq	-24(%rbp), %rdx
	addq	%rcx, %rdx
	movl	(%rax), %eax
	movl	%eax, (%rdx)
	addl	$1, -8(%rbp)
.L9:
	addl	$1, -16(%rbp)
.L7:
	movl	-16(%rbp), %eax
	cmpl	-32(%rbp), %eax
	jl	.L11
.L12:
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	sort_sub, .-sort_sub
	.globl	sort
	.type	sort, @function
sort:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movq	%rdi, -24(%rbp)
	movl	%esi, -28(%rbp)
	movl	-28(%rbp), %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -8(%rbp)
	movq	-8(%rbp), %rcx
	movl	-28(%rbp), %edx
	movq	-24(%rbp), %rax
	movl	$0, %esi
	movq	%rax, %rdi
	call	sort_sub
	movq	-8(%rbp), %rax
	movq	%rax, %rdi
	call	free@PLT
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	sort, .-sort
	.globl	min
	.type	min, @function
min:
.LFB9:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -4(%rbp)
	movl	%esi, -8(%rbp)
	movl	-4(%rbp), %edx
	movl	-8(%rbp), %eax
	cmpl	%eax, %edx
	cmovle	%edx, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.size	min, .-min
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d %d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB10:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-32(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-32(%rbp), %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -16(%rbp)
	movl	$0, -28(%rbp)
	jmp	.L17
.L18:
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -28(%rbp)
.L17:
	movl	-32(%rbp), %eax
	cmpl	%eax, -28(%rbp)
	jl	.L18
	movl	-32(%rbp), %edx
	movq	-16(%rbp), %rax
	movl	%edx, %esi
	movq	%rax, %rdi
	call	sort
	movl	$0, -24(%rbp)
	movl	$0, -28(%rbp)
	jmp	.L19
.L21:
	movl	-32(%rbp), %eax
	cltq
	salq	$2, %rax
	leaq	-4(%rax), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	-28(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	movq	-16(%rbp), %rdx
	addq	%rcx, %rdx
	movl	(%rdx), %ecx
	subl	%ecx, %eax
	movl	%eax, %edx
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	movq	-16(%rbp), %rax
	addq	%rcx, %rax
	movl	(%rax), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	min
	cmpl	%eax, -24(%rbp)
	jge	.L20
	movl	-32(%rbp), %eax
	cltq
	salq	$2, %rax
	leaq	-4(%rax), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	-28(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	movq	-16(%rbp), %rdx
	addq	%rcx, %rdx
	movl	(%rdx), %ecx
	subl	%ecx, %eax
	movl	%eax, %edx
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	movq	-16(%rbp), %rax
	addq	%rcx, %rax
	movl	(%rax), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	min
	movl	%eax, -24(%rbp)
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	%eax, -20(%rbp)
.L20:
	addl	$1, -28(%rbp)
.L19:
	movl	-32(%rbp), %eax
	subl	$1, %eax
	cmpl	%eax, -28(%rbp)
	jl	.L21
	movl	-32(%rbp), %eax
	cltq
	salq	$2, %rax
	leaq	-4(%rax), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	-20(%rbp), %edx
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L23
	call	__stack_chk_fail@PLT
.L23:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE10:
	.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
	.globl	compare_ms
	.type	compare_ms, @function
compare_ms:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -4(%rbp)
	movl	%esi, -8(%rbp)
	movl	-4(%rbp), %eax
	subl	-8(%rbp), %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	compare_ms, .-compare_ms
	.globl	sort_sub
	.type	sort_sub, @function
sort_sub:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$48, %rsp
	movq	%rdi, -24(%rbp)
	movl	%esi, -28(%rbp)
	movl	%edx, -32(%rbp)
	movq	%rcx, -40(%rbp)
	movl	-32(%rbp), %eax
	subl	-28(%rbp), %eax
	cmpl	$1, %eax
	jle	.L12
	movl	-28(%rbp), %edx
	movl	-32(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, -4(%rbp)
	movq	-40(%rbp), %rcx
	movl	-4(%rbp), %edx
	movl	-28(%rbp), %esi
	movq	-24(%rbp), %rax
	movq	%rax, %rdi
	call	sort_sub
	movq	-40(%rbp), %rcx
	movl	-32(%rbp), %edx
	movl	-4(%rbp), %esi
	movq	-24(%rbp), %rax
	movq	%rax, %rdi
	call	sort_sub
	movl	-28(%rbp), %eax
	movl	%eax, -16(%rbp)
	jmp	.L5
.L6:
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	-16(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	movq	-40(%rbp), %rdx
	addq	%rcx, %rdx
	movl	(%rax), %eax
	movl	%eax, (%rdx)
	addl	$1, -16(%rbp)
.L5:
	movl	-16(%rbp), %eax
	cmpl	-32(%rbp), %eax
	jl	.L6
	movl	-28(%rbp), %eax
	movl	%eax, -16(%rbp)
	movl	-28(%rbp), %eax
	movl	%eax, -12(%rbp)
	movl	-4(%rbp), %eax
	movl	%eax, -8(%rbp)
	jmp	.L7
.L11:
	movl	-8(%rbp), %eax
	cmpl	-32(%rbp), %eax
	jne	.L8
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	-16(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	movq	-24(%rbp), %rdx
	addq	%rcx, %rdx
	movl	(%rax), %eax
	movl	%eax, (%rdx)
	addl	$1, -12(%rbp)
	jmp	.L9
.L8:
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	movq	-40(%rbp), %rax
	addq	%rcx, %rax
	movl	(%rax), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	compare_ms
	testl	%eax, %eax
	jg	.L10
	movl	-12(%rbp), %eax
	cmpl	-4(%rbp), %eax
	jge	.L10
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	-16(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	movq	-24(%rbp), %rdx
	addq	%rcx, %rdx
	movl	(%rax), %eax
	movl	%eax, (%rdx)
	addl	$1, -12(%rbp)
	jmp	.L9
.L10:
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	-16(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	movq	-24(%rbp), %rdx
	addq	%rcx, %rdx
	movl	(%rax), %eax
	movl	%eax, (%rdx)
	addl	$1, -8(%rbp)
.L9:
	addl	$1, -16(%rbp)
.L7:
	movl	-16(%rbp), %eax
	cmpl	-32(%rbp), %eax
	jl	.L11
.L12:
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	sort_sub, .-sort_sub
	.globl	sort
	.type	sort, @function
sort:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movq	%rdi, -24(%rbp)
	movl	%esi, -28(%rbp)
	movl	-28(%rbp), %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -8(%rbp)
	movq	-8(%rbp), %rcx
	movl	-28(%rbp), %edx
	movq	-24(%rbp), %rax
	movl	$0, %esi
	movq	%rax, %rdi
	call	sort_sub
	movq	-8(%rbp), %rax
	movq	%rax, %rdi
	call	free@PLT
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	sort, .-sort
	.globl	min
	.type	min, @function
min:
.LFB9:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -4(%rbp)
	movl	%esi, -8(%rbp)
	movl	-4(%rbp), %edx
	movl	-8(%rbp), %eax
	cmpl	%eax, %edx
	cmovle	%edx, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.size	min, .-min
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d %d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB10:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-32(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-32(%rbp), %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -16(%rbp)
	movl	$0, -28(%rbp)
	jmp	.L17
.L18:
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -28(%rbp)
.L17:
	movl	-32(%rbp), %eax
	cmpl	%eax, -28(%rbp)
	jl	.L18
	movl	-32(%rbp), %edx
	movq	-16(%rbp), %rax
	movl	%edx, %esi
	movq	%rax, %rdi
	call	sort
	movl	$0, -24(%rbp)
	movl	$0, -28(%rbp)
	jmp	.L19
.L21:
	movl	-32(%rbp), %eax
	cltq
	salq	$2, %rax
	leaq	-4(%rax), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	-28(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	movq	-16(%rbp), %rdx
	addq	%rcx, %rdx
	movl	(%rdx), %ecx
	subl	%ecx, %eax
	movl	%eax, %edx
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	movq	-16(%rbp), %rax
	addq	%rcx, %rax
	movl	(%rax), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	min
	cmpl	%eax, -24(%rbp)
	jge	.L20
	movl	-32(%rbp), %eax
	cltq
	salq	$2, %rax
	leaq	-4(%rax), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	-28(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	movq	-16(%rbp), %rdx
	addq	%rcx, %rdx
	movl	(%rdx), %ecx
	subl	%ecx, %eax
	movl	%eax, %edx
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	movq	-16(%rbp), %rax
	addq	%rcx, %rax
	movl	(%rax), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	min
	movl	%eax, -24(%rbp)
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	%eax, -20(%rbp)
.L20:
	addl	$1, -28(%rbp)
.L19:
	movl	-32(%rbp), %eax
	subl	$1, %eax
	cmpl	%eax, -28(%rbp)
	jl	.L21
	movl	-32(%rbp), %eax
	cltq
	salq	$2, %rax
	leaq	-4(%rax), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	-20(%rbp), %edx
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L23
	call	__stack_chk_fail@PLT
.L23:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE10:
	.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:
