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>

#define MAX_PEAPLE	( 10000 )

int needTime[ MAX_PEAPLE ];

int tmp[ MAX_PEAPLE ];

void sort( int data[], int size );
long long getWaitTime( int data[], int size );

int main( void )
{
	int n;
	int i;
	
	while( scanf( "%d", &n ) != EOF )
	{
		if( n == 0 )break;
		for( i = 0; i < n; i++ )
		{
			scanf( "%d", &needTime[i] );
		}
		sort( needTime, n );
		printf( "%llu\n", (unsigned)getWaitTime( needTime, n ) );
	}
	
	return (0);
}

long long getWaitTime( int data[], int size )
{
	long long waitTime[ MAX_PEAPLE ];
	int i;
	long long totalWaitTime;
	
	waitTime[0] = 0;
	for( i = 1; i < size; i++ )
	{
		waitTime[i] = waitTime[i - 1] + data[i - 1];
	}
	
	for( i = 0, totalWaitTime = 0; i < size; i++ )
	{
		totalWaitTime += waitTime[i];
	}
	
	return (totalWaitTime);
}

void sort( int data[], int size )
{
	int i;
	int j;
	int k;
	int l;
	
	if( size <= 1 )return;
	
	i = 0;
	j = size / 2;
	k = 0;
	
	sort( data, size / 2 );
	sort( data + size / 2, size - (size / 2) );
	
	while( i < size / 2 && j < size )
	{
		if( data[i] < data[j] )
		{
			tmp[k] = data[i];
			k++;
			i++;
		}
		else
		{
			tmp[k] = data[j];
			k++;
			j++;
		}
	}
	while( i < size / 2 )
	{
		tmp[k] = data[i];
		k++;
		i++;
	}
	while( j < size )
	{
		tmp[k] = data[j];
		k++;
		j++;
	}
	
	for( l = 0; l < size; l++ )
	{
		data[l] = tmp[l];
	}
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	needTime
	.bss
	.align 32
	.type	needTime, @object
	.size	needTime, 40000
needTime:
	.zero	40000
	.globl	tmp
	.align 32
	.type	tmp, @object
	.size	tmp, 40000
tmp:
	.zero	40000
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%llu\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	jmp	.L2
.L7:
	movl	-16(%rbp), %eax
	testl	%eax, %eax
	je	.L10
	movl	$0, -12(%rbp)
	jmp	.L5
.L6:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	needTime(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -12(%rbp)
.L5:
	movl	-16(%rbp), %eax
	cmpl	%eax, -12(%rbp)
	jl	.L6
	movl	-16(%rbp), %eax
	movl	%eax, %esi
	leaq	needTime(%rip), %rax
	movq	%rax, %rdi
	call	sort
	movl	-16(%rbp), %eax
	movl	%eax, %esi
	leaq	needTime(%rip), %rax
	movq	%rax, %rdi
	call	getWaitTime
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L2:
	leaq	-16(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	cmpl	$-1, %eax
	jne	.L7
	jmp	.L4
.L10:
	nop
.L4:
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L9
	call	__stack_chk_fail@PLT
.L9:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	getWaitTime
	.type	getWaitTime, @function
getWaitTime:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	leaq	-77824(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$2224, %rsp
	movq	%rdi, -80040(%rbp)
	movl	%esi, -80044(%rbp)
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movq	$0, -80016(%rbp)
	movl	$1, -80028(%rbp)
	jmp	.L12
.L13:
	movl	-80028(%rbp), %eax
	subl	$1, %eax
	cltq
	movq	-80016(%rbp,%rax,8), %rdx
	movl	-80028(%rbp), %eax
	cltq
	salq	$2, %rax
	leaq	-4(%rax), %rcx
	movq	-80040(%rbp), %rax
	addq	%rcx, %rax
	movl	(%rax), %eax
	cltq
	addq	%rax, %rdx
	movl	-80028(%rbp), %eax
	cltq
	movq	%rdx, -80016(%rbp,%rax,8)
	addl	$1, -80028(%rbp)
.L12:
	movl	-80028(%rbp), %eax
	cmpl	-80044(%rbp), %eax
	jl	.L13
	movl	$0, -80028(%rbp)
	movq	$0, -80024(%rbp)
	jmp	.L14
.L15:
	movl	-80028(%rbp), %eax
	cltq
	movq	-80016(%rbp,%rax,8), %rax
	addq	%rax, -80024(%rbp)
	addl	$1, -80028(%rbp)
.L14:
	movl	-80028(%rbp), %eax
	cmpl	-80044(%rbp), %eax
	jl	.L15
	movq	-80024(%rbp), %rax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L17
	call	__stack_chk_fail@PLT
.L17:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	getWaitTime, .-getWaitTime
	.globl	sort
	.type	sort, @function
sort:
.LFB2:
	.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)
	cmpl	$1, -28(%rbp)
	jle	.L31
	movl	$0, -16(%rbp)
	movl	-28(%rbp), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, -12(%rbp)
	movl	$0, -8(%rbp)
	movl	-28(%rbp), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, %edx
	movq	-24(%rbp), %rax
	movl	%edx, %esi
	movq	%rax, %rdi
	call	sort
	movl	-28(%rbp), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	negl	%eax
	movl	%eax, %edx
	movl	-28(%rbp), %eax
	addl	%eax, %edx
	movl	-28(%rbp), %eax
	movl	%eax, %ecx
	shrl	$31, %ecx
	addl	%ecx, %eax
	sarl	%eax
	cltq
	leaq	0(,%rax,4), %rcx
	movq	-24(%rbp), %rax
	addq	%rcx, %rax
	movl	%edx, %esi
	movq	%rax, %rdi
	call	sort
	jmp	.L21
.L24:
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	movq	-24(%rbp), %rax
	addq	%rcx, %rax
	movl	(%rax), %eax
	cmpl	%eax, %edx
	jge	.L22
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	-8(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	tmp(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	addl	$1, -8(%rbp)
	addl	$1, -16(%rbp)
	jmp	.L21
.L22:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	-8(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	tmp(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	addl	$1, -8(%rbp)
	addl	$1, -12(%rbp)
.L21:
	movl	-28(%rbp), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	cmpl	%eax, -16(%rbp)
	jge	.L25
	movl	-12(%rbp), %eax
	cmpl	-28(%rbp), %eax
	jl	.L24
	jmp	.L25
.L26:
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	-8(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	tmp(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	addl	$1, -8(%rbp)
	addl	$1, -16(%rbp)
.L25:
	movl	-28(%rbp), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	cmpl	%eax, -16(%rbp)
	jl	.L26
	jmp	.L27
.L28:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	-8(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	tmp(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	addl	$1, -8(%rbp)
	addl	$1, -12(%rbp)
.L27:
	movl	-12(%rbp), %eax
	cmpl	-28(%rbp), %eax
	jl	.L28
	movl	$0, -4(%rbp)
	jmp	.L29
.L30:
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rax, %rdx
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	tmp(%rip), %rax
	movl	(%rcx,%rax), %eax
	movl	%eax, (%rdx)
	addl	$1, -4(%rbp)
.L29:
	movl	-4(%rbp), %eax
	cmpl	-28(%rbp), %eax
	jl	.L30
	jmp	.L18
.L31:
	nop
.L18:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	sort, .-sort
	.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
	.p2align 4
	.type	sort.part.0, @function
sort.part.0:
.LFB26:
	.cfi_startproc
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	movl	%esi, %r12d
	sarl	%r12d
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	movl	%esi, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	movq	%rdi, %rbx
	cmpl	$1, %r12d
	je	.L2
	movl	%r12d, %esi
	call	sort.part.0
.L2:
	movl	%ebp, %esi
	subl	%r12d, %esi
	cmpl	$1, %esi
	jle	.L3
	movslq	%r12d, %rax
	leaq	(%rbx,%rax,4), %rdi
	call	sort.part.0
.L3:
	leaq	tmp(%rip), %r9
	movl	%r12d, %eax
	xorl	%ecx, %ecx
	xorl	%edx, %edx
	movq	%r9, %rsi
	.p2align 4,,10
	.p2align 3
.L8:
	cmpl	%eax, %ebp
	jle	.L60
	movslq	%edx, %rdi
	addl	$1, %ecx
	movl	(%rbx,%rdi,4), %r8d
	movslq	%eax, %rdi
	movl	(%rbx,%rdi,4), %edi
	cmpl	%edi, %r8d
	jge	.L4
	addl	$1, %edx
	movl	%r8d, (%rsi)
	addq	$4, %rsi
	cmpl	%edx, %r12d
	jg	.L8
.L6:
	movslq	%ecx, %rdx
	movl	%ebp, %r10d
	leaq	(%r9,%rdx,4), %rdi
	leal	1(%rax), %edx
	subl	%eax, %r10d
	movslq	%edx, %rdx
	movq	%rdi, %rsi
	salq	$2, %rdx
	leaq	(%rbx,%rdx), %r8
	subq	%r8, %rsi
	cmpq	$8, %rsi
	jbe	.L18
	leal	-1(%r10), %esi
	cmpl	$2, %esi
	jbe	.L18
	movl	%r10d, %esi
	leaq	-4(%rbx,%rdx), %r8
	xorl	%edx, %edx
	shrl	$2, %esi
	salq	$4, %rsi
	.p2align 4,,10
	.p2align 3
.L19:
	movdqu	(%r8,%rdx), %xmm0
	movups	%xmm0, (%rdi,%rdx)
	addq	$16, %rdx
	cmpq	%rdx, %rsi
	jne	.L19
	movl	%r10d, %edx
	andl	$-4, %edx
	addl	%edx, %eax
	addl	%edx, %ecx
	cmpl	%edx, %r10d
	je	.L29
	movslq	%eax, %rdx
	movl	(%rbx,%rdx,4), %esi
	movslq	%ecx, %rdx
	movl	%esi, (%r9,%rdx,4)
	leal	1(%rax), %edx
	leal	1(%rcx), %esi
	cmpl	%edx, %ebp
	jle	.L29
	movslq	%edx, %rdx
	movslq	%esi, %rsi
	addl	$2, %eax
	addl	$2, %ecx
	leaq	0(,%rdx,4), %rdi
	movl	(%rbx,%rdx,4), %edx
	movl	%edx, (%r9,%rsi,4)
	cmpl	%eax, %ebp
	jle	.L29
	movl	4(%rbx,%rdi), %eax
	movslq	%ecx, %rcx
	movl	%eax, (%r9,%rcx,4)
.L29:
	leaq	4+tmp(%rip), %rdx
	movq	%rbx, %rax
	subq	%rdx, %rax
	cmpq	$8, %rax
	jbe	.L24
	leal	-1(%rbp), %eax
	cmpl	$2, %eax
	jbe	.L24
	movl	%ebp, %edx
	xorl	%eax, %eax
	shrl	$2, %edx
	salq	$4, %rdx
	.p2align 4,,10
	.p2align 3
.L25:
	movdqa	(%r9,%rax), %xmm1
	movups	%xmm1, (%rbx,%rax)
	addq	$16, %rax
	cmpq	%rdx, %rax
	jne	.L25
	movl	%ebp, %eax
	andl	$-4, %eax
	testb	$3, %bpl
	je	.L1
	movslq	%eax, %rsi
	movl	%eax, %edx
	movl	(%r9,%rsi,4), %esi
	leaq	0(,%rdx,4), %rcx
	movl	%esi, (%rbx,%rdx,4)
	leal	1(%rax), %edx
	cmpl	%edx, %ebp
	jle	.L1
	movslq	%edx, %rdx
	addl	$2, %eax
	movl	(%r9,%rdx,4), %edx
	movl	%edx, 4(%rbx,%rcx)
	cmpl	%eax, %ebp
	jle	.L1
	cltq
	movl	(%r9,%rax,4), %eax
	movl	%eax, 8(%rbx,%rcx)
.L1:
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L4:
	.cfi_restore_state
	movl	%edi, (%rsi)
	addl	$1, %eax
	addq	$4, %rsi
	cmpl	%edx, %r12d
	jg	.L8
	cmpl	%eax, %ebp
	jg	.L6
	jmp	.L29
	.p2align 4,,10
	.p2align 3
.L60:
	cmpl	%edx, %r12d
	jle	.L11
	movslq	%ecx, %rax
	movl	%r12d, %r8d
	leaq	(%r9,%rax,4), %rsi
	leal	1(%rdx), %eax
	subl	%edx, %r8d
	cltq
	movq	%rsi, %rdi
	salq	$2, %rax
	leaq	(%rbx,%rax), %r10
	subq	%r10, %rdi
	cmpq	$8, %rdi
	jbe	.L12
	leal	-1(%r8), %edi
	cmpl	$2, %edi
	jbe	.L12
	movl	%r8d, %edi
	leaq	-4(%rbx,%rax), %r10
	xorl	%eax, %eax
	shrl	$2, %edi
	salq	$4, %rdi
	.p2align 4,,10
	.p2align 3
.L13:
	movdqu	(%r10,%rax), %xmm2
	movups	%xmm2, (%rsi,%rax)
	addq	$16, %rax
	cmpq	%rdi, %rax
	jne	.L13
	movl	%r8d, %eax
	andl	$-4, %eax
	addl	%eax, %edx
	addl	%eax, %ecx
	cmpl	%eax, %r8d
	je	.L11
	movslq	%edx, %rax
	movl	(%rbx,%rax,4), %esi
	movslq	%ecx, %rax
	movl	%esi, (%r9,%rax,4)
	leal	1(%rdx), %eax
	leal	1(%rcx), %esi
	cmpl	%eax, %r12d
	jle	.L11
	cltq
	movslq	%esi, %rsi
	addl	$2, %edx
	addl	$2, %ecx
	leaq	0(,%rax,4), %rdi
	movl	(%rbx,%rax,4), %eax
	movl	%eax, (%r9,%rsi,4)
	cmpl	%edx, %r12d
	jle	.L11
	movl	4(%rbx,%rdi), %eax
	movslq	%ecx, %rcx
	movl	%eax, (%r9,%rcx,4)
.L11:
	testl	%ebp, %ebp
	jg	.L29
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L24:
	.cfi_restore_state
	movl	%ebp, %ebp
	xorl	%eax, %eax
	.p2align 4,,10
	.p2align 3
.L27:
	movl	(%r9,%rax,4), %edx
	movl	%edx, (%rbx,%rax,4)
	addq	$1, %rax
	cmpq	%rbp, %rax
	jne	.L27
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L18:
	.cfi_restore_state
	leal	-1(%rbp), %ecx
	subl	%eax, %ecx
	xorl	%eax, %eax
	leaq	4(,%rcx,4), %rsi
	leaq	-4(%rbx,%rdx), %rcx
	.p2align 4,,10
	.p2align 3
.L22:
	movl	(%rcx,%rax), %edx
	movl	%edx, (%rdi,%rax)
	addq	$4, %rax
	cmpq	%rax, %rsi
	jne	.L22
	jmp	.L29
.L12:
	subl	$1, %r12d
	leaq	-4(%rbx,%rax), %rcx
	xorl	%eax, %eax
	subl	%edx, %r12d
	leaq	4(,%r12,4), %rdi
	.p2align 4,,10
	.p2align 3
.L16:
	movl	(%rcx,%rax), %edx
	movl	%edx, (%rsi,%rax)
	addq	$4, %rax
	cmpq	%rdi, %rax
	jne	.L16
	jmp	.L11
	.cfi_endproc
.LFE26:
	.size	sort.part.0, .-sort.part.0
	.p2align 4
	.globl	getWaitTime
	.type	getWaitTime, @function
getWaitTime:
.LFB24:
	.cfi_startproc
	endbr64
	leaq	-77824(%rsp), %r11
	.cfi_def_cfa 11, 77832
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$2200, %rsp
	.cfi_def_cfa_offset 80032
	movq	%fs:40, %rax
	movq	%rax, 80008(%rsp)
	xorl	%eax, %eax
	movq	$0, (%rsp)
	cmpl	$1, %esi
	jle	.L62
	leal	-1(%rsi), %r9d
	xorl	%ecx, %ecx
	movq	%rsp, %rdx
	.p2align 4,,10
	.p2align 3
.L63:
	movslq	(%rdi,%rax,4), %r8
	addq	%r8, %rcx
	movq	%rcx, 8(%rdx,%rax,8)
	addq	$1, %rax
	cmpq	%r9, %rax
	jne	.L63
	testl	%esi, %esi
	movl	$1, %eax
	pxor	%xmm0, %xmm0
	cmovle	%eax, %esi
	movq	%rdx, %rax
	movl	%esi, %edx
	shrl	%edx
	subl	$1, %edx
	salq	$4, %rdx
	leaq	16(%rsp,%rdx), %rdx
	.p2align 4,,10
	.p2align 3
.L68:
	paddq	(%rax), %xmm0
	addq	$16, %rax
	cmpq	%rdx, %rax
	jne	.L68
	movdqa	%xmm0, %xmm1
	movl	%esi, %edx
	psrldq	$8, %xmm1
	andl	$-2, %edx
	andl	$1, %esi
	paddq	%xmm1, %xmm0
	movq	%xmm0, %rax
	je	.L61
.L65:
	movslq	%edx, %rdx
	addq	(%rsp,%rdx,8), %rax
.L61:
	movq	80008(%rsp), %rdx
	subq	%fs:40, %rdx
	jne	.L77
	addq	$80024, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L62:
	.cfi_restore_state
	movl	$0, %eax
	jne	.L61
	xorl	%edx, %edx
	jmp	.L65
.L77:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE24:
	.size	getWaitTime, .-getWaitTime
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%llu\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	.LC1(%rip), %r15
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	leaq	needTime(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	leaq	.LC0(%rip), %r12
	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), %r14
	.p2align 4,,10
	.p2align 3
.L79:
	xorl	%eax, %eax
	movq	%r14, %rsi
	movq	%r12, %rdi
	call	__isoc99_scanf@PLT
	cmpl	$-1, %eax
	je	.L80
	movl	4(%rsp), %esi
	testl	%esi, %esi
	je	.L80
	jle	.L81
	leaq	needTime(%rip), %rbp
	xorl	%ebx, %ebx
	.p2align 4,,10
	.p2align 3
.L82:
	movq	%rbp, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %esi
	addq	$4, %rbp
	cmpl	%ebx, %esi
	jg	.L82
.L81:
	cmpl	$1, %esi
	jle	.L83
	movq	%r13, %rdi
	call	sort.part.0
	movl	4(%rsp), %esi
.L83:
	movq	%r13, %rdi
	call	getWaitTime
	movq	%r15, %rsi
	movl	$1, %edi
	movl	%eax, %edx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L79
	.p2align 4,,10
	.p2align 3
.L80:
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L92
	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
.L92:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.text
	.p2align 4
	.globl	sort
	.type	sort, @function
sort:
.LFB25:
	.cfi_startproc
	endbr64
	cmpl	$1, %esi
	jle	.L93
	jmp	sort.part.0
	.p2align 4,,10
	.p2align 3
.L93:
	ret
	.cfi_endproc
.LFE25:
	.size	sort, .-sort
	.globl	tmp
	.bss
	.align 32
	.type	tmp, @object
	.size	tmp, 40000
tmp:
	.zero	40000
	.globl	needTime
	.align 32
	.type	needTime, @object
	.size	needTime, 40000
needTime:
	.zero	40000
	.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
	.p2align 4
	.type	sort.part.0, @function
sort.part.0:
.LFB26:
	.cfi_startproc
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	movl	%esi, %r12d
	sarl	%r12d
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	movl	%esi, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	movq	%rdi, %rbx
	cmpl	$1, %r12d
	je	.L2
	movl	%r12d, %esi
	call	sort.part.0
.L2:
	movl	%ebp, %esi
	subl	%r12d, %esi
	cmpl	$1, %esi
	jle	.L3
	movslq	%r12d, %rax
	leaq	(%rbx,%rax,4), %rdi
	call	sort.part.0
.L3:
	leaq	tmp(%rip), %r9
	movl	%r12d, %eax
	xorl	%ecx, %ecx
	xorl	%edx, %edx
	movq	%r9, %rsi
	.p2align 4,,10
	.p2align 3
.L8:
	cmpl	%eax, %ebp
	jle	.L60
	movslq	%edx, %rdi
	addl	$1, %ecx
	movl	(%rbx,%rdi,4), %r8d
	movslq	%eax, %rdi
	movl	(%rbx,%rdi,4), %edi
	cmpl	%edi, %r8d
	jge	.L4
	addl	$1, %edx
	movl	%r8d, (%rsi)
	addq	$4, %rsi
	cmpl	%edx, %r12d
	jg	.L8
.L6:
	movslq	%ecx, %rdx
	movl	%ebp, %r10d
	leaq	(%r9,%rdx,4), %rdi
	leal	1(%rax), %edx
	subl	%eax, %r10d
	movslq	%edx, %rdx
	movq	%rdi, %rsi
	salq	$2, %rdx
	leaq	(%rbx,%rdx), %r8
	subq	%r8, %rsi
	cmpq	$8, %rsi
	jbe	.L18
	leal	-1(%r10), %esi
	cmpl	$2, %esi
	jbe	.L18
	movl	%r10d, %esi
	leaq	-4(%rbx,%rdx), %r8
	xorl	%edx, %edx
	shrl	$2, %esi
	salq	$4, %rsi
	.p2align 4,,10
	.p2align 3
.L19:
	movdqu	(%r8,%rdx), %xmm0
	movups	%xmm0, (%rdi,%rdx)
	addq	$16, %rdx
	cmpq	%rdx, %rsi
	jne	.L19
	movl	%r10d, %edx
	andl	$-4, %edx
	addl	%edx, %eax
	addl	%edx, %ecx
	cmpl	%edx, %r10d
	je	.L29
	movslq	%eax, %rdx
	movl	(%rbx,%rdx,4), %esi
	movslq	%ecx, %rdx
	movl	%esi, (%r9,%rdx,4)
	leal	1(%rax), %edx
	leal	1(%rcx), %esi
	cmpl	%edx, %ebp
	jle	.L29
	movslq	%edx, %rdx
	movslq	%esi, %rsi
	addl	$2, %eax
	addl	$2, %ecx
	leaq	0(,%rdx,4), %rdi
	movl	(%rbx,%rdx,4), %edx
	movl	%edx, (%r9,%rsi,4)
	cmpl	%eax, %ebp
	jle	.L29
	movl	4(%rbx,%rdi), %eax
	movslq	%ecx, %rcx
	movl	%eax, (%r9,%rcx,4)
.L29:
	leaq	4+tmp(%rip), %rdx
	movq	%rbx, %rax
	subq	%rdx, %rax
	cmpq	$8, %rax
	jbe	.L24
	leal	-1(%rbp), %eax
	cmpl	$2, %eax
	jbe	.L24
	movl	%ebp, %edx
	xorl	%eax, %eax
	shrl	$2, %edx
	salq	$4, %rdx
	.p2align 4,,10
	.p2align 3
.L25:
	movdqa	(%r9,%rax), %xmm1
	movups	%xmm1, (%rbx,%rax)
	addq	$16, %rax
	cmpq	%rdx, %rax
	jne	.L25
	movl	%ebp, %eax
	andl	$-4, %eax
	testb	$3, %bpl
	je	.L1
	movslq	%eax, %rsi
	movl	%eax, %edx
	movl	(%r9,%rsi,4), %esi
	leaq	0(,%rdx,4), %rcx
	movl	%esi, (%rbx,%rdx,4)
	leal	1(%rax), %edx
	cmpl	%edx, %ebp
	jle	.L1
	movslq	%edx, %rdx
	addl	$2, %eax
	movl	(%r9,%rdx,4), %edx
	movl	%edx, 4(%rbx,%rcx)
	cmpl	%eax, %ebp
	jle	.L1
	cltq
	movl	(%r9,%rax,4), %eax
	movl	%eax, 8(%rbx,%rcx)
.L1:
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L4:
	.cfi_restore_state
	movl	%edi, (%rsi)
	addl	$1, %eax
	addq	$4, %rsi
	cmpl	%edx, %r12d
	jg	.L8
	cmpl	%eax, %ebp
	jg	.L6
	jmp	.L29
	.p2align 4,,10
	.p2align 3
.L60:
	cmpl	%edx, %r12d
	jle	.L11
	movslq	%ecx, %rax
	movl	%r12d, %r8d
	leaq	(%r9,%rax,4), %rsi
	leal	1(%rdx), %eax
	subl	%edx, %r8d
	cltq
	movq	%rsi, %rdi
	salq	$2, %rax
	leaq	(%rbx,%rax), %r10
	subq	%r10, %rdi
	cmpq	$8, %rdi
	jbe	.L12
	leal	-1(%r8), %edi
	cmpl	$2, %edi
	jbe	.L12
	movl	%r8d, %edi
	leaq	-4(%rbx,%rax), %r10
	xorl	%eax, %eax
	shrl	$2, %edi
	salq	$4, %rdi
	.p2align 4,,10
	.p2align 3
.L13:
	movdqu	(%r10,%rax), %xmm2
	movups	%xmm2, (%rsi,%rax)
	addq	$16, %rax
	cmpq	%rdi, %rax
	jne	.L13
	movl	%r8d, %eax
	andl	$-4, %eax
	addl	%eax, %edx
	addl	%eax, %ecx
	cmpl	%eax, %r8d
	je	.L11
	movslq	%edx, %rax
	movl	(%rbx,%rax,4), %esi
	movslq	%ecx, %rax
	movl	%esi, (%r9,%rax,4)
	leal	1(%rdx), %eax
	leal	1(%rcx), %esi
	cmpl	%eax, %r12d
	jle	.L11
	cltq
	movslq	%esi, %rsi
	addl	$2, %edx
	addl	$2, %ecx
	leaq	0(,%rax,4), %rdi
	movl	(%rbx,%rax,4), %eax
	movl	%eax, (%r9,%rsi,4)
	cmpl	%edx, %r12d
	jle	.L11
	movl	4(%rbx,%rdi), %eax
	movslq	%ecx, %rcx
	movl	%eax, (%r9,%rcx,4)
.L11:
	testl	%ebp, %ebp
	jg	.L29
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L24:
	.cfi_restore_state
	movl	%ebp, %ebp
	xorl	%eax, %eax
	.p2align 4,,10
	.p2align 3
.L27:
	movl	(%r9,%rax,4), %edx
	movl	%edx, (%rbx,%rax,4)
	addq	$1, %rax
	cmpq	%rbp, %rax
	jne	.L27
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L18:
	.cfi_restore_state
	leal	-1(%rbp), %ecx
	subl	%eax, %ecx
	xorl	%eax, %eax
	leaq	4(,%rcx,4), %rsi
	leaq	-4(%rbx,%rdx), %rcx
	.p2align 4,,10
	.p2align 3
.L22:
	movl	(%rcx,%rax), %edx
	movl	%edx, (%rdi,%rax)
	addq	$4, %rax
	cmpq	%rax, %rsi
	jne	.L22
	jmp	.L29
.L12:
	subl	$1, %r12d
	leaq	-4(%rbx,%rax), %rcx
	xorl	%eax, %eax
	subl	%edx, %r12d
	leaq	4(,%r12,4), %rdi
	.p2align 4,,10
	.p2align 3
.L16:
	movl	(%rcx,%rax), %edx
	movl	%edx, (%rsi,%rax)
	addq	$4, %rax
	cmpq	%rdi, %rax
	jne	.L16
	jmp	.L11
	.cfi_endproc
.LFE26:
	.size	sort.part.0, .-sort.part.0
	.p2align 4
	.globl	getWaitTime
	.type	getWaitTime, @function
getWaitTime:
.LFB24:
	.cfi_startproc
	endbr64
	leaq	-77824(%rsp), %r11
	.cfi_def_cfa 11, 77832
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$2200, %rsp
	.cfi_def_cfa_offset 80032
	movq	%fs:40, %rax
	movq	%rax, 80008(%rsp)
	xorl	%eax, %eax
	movq	$0, (%rsp)
	cmpl	$1, %esi
	jle	.L62
	leal	-1(%rsi), %r9d
	xorl	%ecx, %ecx
	movq	%rsp, %rdx
	.p2align 4,,10
	.p2align 3
.L63:
	movslq	(%rdi,%rax,4), %r8
	addq	%r8, %rcx
	movq	%rcx, 8(%rdx,%rax,8)
	addq	$1, %rax
	cmpq	%r9, %rax
	jne	.L63
	testl	%esi, %esi
	movl	$1, %eax
	pxor	%xmm0, %xmm0
	cmovle	%eax, %esi
	movq	%rdx, %rax
	movl	%esi, %edx
	shrl	%edx
	subl	$1, %edx
	salq	$4, %rdx
	leaq	16(%rsp,%rdx), %rdx
	.p2align 4,,10
	.p2align 3
.L68:
	paddq	(%rax), %xmm0
	addq	$16, %rax
	cmpq	%rdx, %rax
	jne	.L68
	movdqa	%xmm0, %xmm1
	movl	%esi, %edx
	psrldq	$8, %xmm1
	andl	$-2, %edx
	andl	$1, %esi
	paddq	%xmm1, %xmm0
	movq	%xmm0, %rax
	je	.L61
.L65:
	movslq	%edx, %rdx
	addq	(%rsp,%rdx,8), %rax
.L61:
	movq	80008(%rsp), %rdx
	subq	%fs:40, %rdx
	jne	.L77
	addq	$80024, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L62:
	.cfi_restore_state
	movl	$0, %eax
	jne	.L61
	xorl	%edx, %edx
	jmp	.L65
.L77:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE24:
	.size	getWaitTime, .-getWaitTime
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%llu\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	.LC1(%rip), %r15
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	leaq	needTime(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	leaq	.LC0(%rip), %r12
	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), %r14
	.p2align 4,,10
	.p2align 3
.L79:
	xorl	%eax, %eax
	movq	%r14, %rsi
	movq	%r12, %rdi
	call	__isoc99_scanf@PLT
	cmpl	$-1, %eax
	je	.L80
	movl	4(%rsp), %esi
	testl	%esi, %esi
	je	.L80
	jle	.L81
	leaq	needTime(%rip), %rbp
	xorl	%ebx, %ebx
	.p2align 4,,10
	.p2align 3
.L82:
	movq	%rbp, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %esi
	addq	$4, %rbp
	cmpl	%ebx, %esi
	jg	.L82
.L81:
	cmpl	$1, %esi
	jle	.L83
	movq	%r13, %rdi
	call	sort.part.0
	movl	4(%rsp), %esi
.L83:
	movq	%r13, %rdi
	call	getWaitTime
	movq	%r15, %rsi
	movl	$1, %edi
	movl	%eax, %edx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L79
	.p2align 4,,10
	.p2align 3
.L80:
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L92
	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
.L92:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.text
	.p2align 4
	.globl	sort
	.type	sort, @function
sort:
.LFB25:
	.cfi_startproc
	endbr64
	cmpl	$1, %esi
	jle	.L93
	jmp	sort.part.0
	.p2align 4,,10
	.p2align 3
.L93:
	ret
	.cfi_endproc
.LFE25:
	.size	sort, .-sort
	.globl	tmp
	.bss
	.align 32
	.type	tmp, @object
	.size	tmp, 40000
tmp:
	.zero	40000
	.globl	needTime
	.align 32
	.type	needTime, @object
	.size	needTime, 40000
needTime:
	.zero	40000
	.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>

#define MAX_PEAPLE	( 10000 )

int needTime[ MAX_PEAPLE ];

int tmp[ MAX_PEAPLE ];

void sort( int data[], int size );
long long getWaitTime( int data[], int size );

int main( void )
{
	int n;
	int i;
	
	while( scanf( "%d", &n ) != EOF )
	{
		if( n == 0 )break;
		for( i = 0; i < n; i++ )
		{
			scanf( "%d", &needTime[i] );
		}
		sort( needTime, n );
		printf( "%llu\n", (unsigned)getWaitTime( needTime, n ) );
	}
	
	return (0);
}

long long getWaitTime( int data[], int size )
{
	long long waitTime[ MAX_PEAPLE ];
	int i;
	long long totalWaitTime;
	
	waitTime[0] = 0;
	for( i = 1; i < size; i++ )
	{
		waitTime[i] = waitTime[i - 1] + data[i - 1];
	}
	
	for( i = 0, totalWaitTime = 0; i < size; i++ )
	{
		totalWaitTime += waitTime[i];
	}
	
	return (totalWaitTime);
}

void sort( int data[], int size )
{
	int i;
	int j;
	int k;
	int l;
	
	if( size <= 1 )return;
	
	i = 0;
	j = size / 2;
	k = 0;
	
	sort( data, size / 2 );
	sort( data + size / 2, size - (size / 2) );
	
	while( i < size / 2 && j < size )
	{
		if( data[i] < data[j] )
		{
			tmp[k] = data[i];
			k++;
			i++;
		}
		else
		{
			tmp[k] = data[j];
			k++;
			j++;
		}
	}
	while( i < size / 2 )
	{
		tmp[k] = data[i];
		k++;
		i++;
	}
	while( j < size )
	{
		tmp[k] = data[j];
		k++;
		j++;
	}
	
	for( l = 0; l < size; l++ )
	{
		data[l] = tmp[l];
	}
}
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 unoptimized assembly code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
#include <stdio.h>

#define MAX_PEAPLE	( 10000 )

int needTime[ MAX_PEAPLE ];

int tmp[ MAX_PEAPLE ];

void sort( int data[], int size );
long long getWaitTime( int data[], int size );

int main( void )
{
	int n;
	int i;
	
	while( scanf( "%d", &n ) != EOF )
	{
		if( n == 0 )break;
		for( i = 0; i < n; i++ )
		{
			scanf( "%d", &needTime[i] );
		}
		sort( needTime, n );
		printf( "%llu\n", (unsigned)getWaitTime( needTime, n ) );
	}
	
	return (0);
}

long long getWaitTime( int data[], int size )
{
	long long waitTime[ MAX_PEAPLE ];
	int i;
	long long totalWaitTime;
	
	waitTime[0] = 0;
	for( i = 1; i < size; i++ )
	{
		waitTime[i] = waitTime[i - 1] + data[i - 1];
	}
	
	for( i = 0, totalWaitTime = 0; i < size; i++ )
	{
		totalWaitTime += waitTime[i];
	}
	
	return (totalWaitTime);
}

void sort( int data[], int size )
{
	int i;
	int j;
	int k;
	int l;
	
	if( size <= 1 )return;
	
	i = 0;
	j = size / 2;
	k = 0;
	
	sort( data, size / 2 );
	sort( data + size / 2, size - (size / 2) );
	
	while( i < size / 2 && j < size )
	{
		if( data[i] < data[j] )
		{
			tmp[k] = data[i];
			k++;
			i++;
		}
		else
		{
			tmp[k] = data[j];
			k++;
			j++;
		}
	}
	while( i < size / 2 )
	{
		tmp[k] = data[i];
		k++;
		i++;
	}
	while( j < size )
	{
		tmp[k] = data[j];
		k++;
		j++;
	}
	
	for( l = 0; l < size; l++ )
	{
		data[l] = tmp[l];
	}
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	needTime
	.bss
	.align 32
	.type	needTime, @object
	.size	needTime, 40000
needTime:
	.zero	40000
	.globl	tmp
	.align 32
	.type	tmp, @object
	.size	tmp, 40000
tmp:
	.zero	40000
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%llu\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	jmp	.L2
.L7:
	movl	-16(%rbp), %eax
	testl	%eax, %eax
	je	.L10
	movl	$0, -12(%rbp)
	jmp	.L5
.L6:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	needTime(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -12(%rbp)
.L5:
	movl	-16(%rbp), %eax
	cmpl	%eax, -12(%rbp)
	jl	.L6
	movl	-16(%rbp), %eax
	movl	%eax, %esi
	leaq	needTime(%rip), %rax
	movq	%rax, %rdi
	call	sort
	movl	-16(%rbp), %eax
	movl	%eax, %esi
	leaq	needTime(%rip), %rax
	movq	%rax, %rdi
	call	getWaitTime
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L2:
	leaq	-16(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	cmpl	$-1, %eax
	jne	.L7
	jmp	.L4
.L10:
	nop
.L4:
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L9
	call	__stack_chk_fail@PLT
.L9:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	getWaitTime
	.type	getWaitTime, @function
getWaitTime:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	leaq	-77824(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$2224, %rsp
	movq	%rdi, -80040(%rbp)
	movl	%esi, -80044(%rbp)
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movq	$0, -80016(%rbp)
	movl	$1, -80028(%rbp)
	jmp	.L12
.L13:
	movl	-80028(%rbp), %eax
	subl	$1, %eax
	cltq
	movq	-80016(%rbp,%rax,8), %rdx
	movl	-80028(%rbp), %eax
	cltq
	salq	$2, %rax
	leaq	-4(%rax), %rcx
	movq	-80040(%rbp), %rax
	addq	%rcx, %rax
	movl	(%rax), %eax
	cltq
	addq	%rax, %rdx
	movl	-80028(%rbp), %eax
	cltq
	movq	%rdx, -80016(%rbp,%rax,8)
	addl	$1, -80028(%rbp)
.L12:
	movl	-80028(%rbp), %eax
	cmpl	-80044(%rbp), %eax
	jl	.L13
	movl	$0, -80028(%rbp)
	movq	$0, -80024(%rbp)
	jmp	.L14
.L15:
	movl	-80028(%rbp), %eax
	cltq
	movq	-80016(%rbp,%rax,8), %rax
	addq	%rax, -80024(%rbp)
	addl	$1, -80028(%rbp)
.L14:
	movl	-80028(%rbp), %eax
	cmpl	-80044(%rbp), %eax
	jl	.L15
	movq	-80024(%rbp), %rax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L17
	call	__stack_chk_fail@PLT
.L17:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	getWaitTime, .-getWaitTime
	.globl	sort
	.type	sort, @function
sort:
.LFB2:
	.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)
	cmpl	$1, -28(%rbp)
	jle	.L31
	movl	$0, -16(%rbp)
	movl	-28(%rbp), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, -12(%rbp)
	movl	$0, -8(%rbp)
	movl	-28(%rbp), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, %edx
	movq	-24(%rbp), %rax
	movl	%edx, %esi
	movq	%rax, %rdi
	call	sort
	movl	-28(%rbp), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	negl	%eax
	movl	%eax, %edx
	movl	-28(%rbp), %eax
	addl	%eax, %edx
	movl	-28(%rbp), %eax
	movl	%eax, %ecx
	shrl	$31, %ecx
	addl	%ecx, %eax
	sarl	%eax
	cltq
	leaq	0(,%rax,4), %rcx
	movq	-24(%rbp), %rax
	addq	%rcx, %rax
	movl	%edx, %esi
	movq	%rax, %rdi
	call	sort
	jmp	.L21
.L24:
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	movq	-24(%rbp), %rax
	addq	%rcx, %rax
	movl	(%rax), %eax
	cmpl	%eax, %edx
	jge	.L22
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	-8(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	tmp(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	addl	$1, -8(%rbp)
	addl	$1, -16(%rbp)
	jmp	.L21
.L22:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	-8(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	tmp(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	addl	$1, -8(%rbp)
	addl	$1, -12(%rbp)
.L21:
	movl	-28(%rbp), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	cmpl	%eax, -16(%rbp)
	jge	.L25
	movl	-12(%rbp), %eax
	cmpl	-28(%rbp), %eax
	jl	.L24
	jmp	.L25
.L26:
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	-8(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	tmp(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	addl	$1, -8(%rbp)
	addl	$1, -16(%rbp)
.L25:
	movl	-28(%rbp), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	cmpl	%eax, -16(%rbp)
	jl	.L26
	jmp	.L27
.L28:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	-8(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	tmp(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	addl	$1, -8(%rbp)
	addl	$1, -12(%rbp)
.L27:
	movl	-12(%rbp), %eax
	cmpl	-28(%rbp), %eax
	jl	.L28
	movl	$0, -4(%rbp)
	jmp	.L29
.L30:
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rax, %rdx
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	tmp(%rip), %rax
	movl	(%rcx,%rax), %eax
	movl	%eax, (%rdx)
	addl	$1, -4(%rbp)
.L29:
	movl	-4(%rbp), %eax
	cmpl	-28(%rbp), %eax
	jl	.L30
	jmp	.L18
.L31:
	nop
.L18:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	sort, .-sort
	.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	needTime
	.bss
	.align 32
	.type	needTime, @object
	.size	needTime, 40000
needTime:
	.zero	40000
	.globl	tmp
	.align 32
	.type	tmp, @object
	.size	tmp, 40000
tmp:
	.zero	40000
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%llu\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	jmp	.L2
.L7:
	movl	-16(%rbp), %eax
	testl	%eax, %eax
	je	.L10
	movl	$0, -12(%rbp)
	jmp	.L5
.L6:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	needTime(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -12(%rbp)
.L5:
	movl	-16(%rbp), %eax
	cmpl	%eax, -12(%rbp)
	jl	.L6
	movl	-16(%rbp), %eax
	movl	%eax, %esi
	leaq	needTime(%rip), %rax
	movq	%rax, %rdi
	call	sort
	movl	-16(%rbp), %eax
	movl	%eax, %esi
	leaq	needTime(%rip), %rax
	movq	%rax, %rdi
	call	getWaitTime
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L2:
	leaq	-16(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	cmpl	$-1, %eax
	jne	.L7
	jmp	.L4
.L10:
	nop
.L4:
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L9
	call	__stack_chk_fail@PLT
.L9:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	getWaitTime
	.type	getWaitTime, @function
getWaitTime:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	leaq	-77824(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$2224, %rsp
	movq	%rdi, -80040(%rbp)
	movl	%esi, -80044(%rbp)
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movq	$0, -80016(%rbp)
	movl	$1, -80028(%rbp)
	jmp	.L12
.L13:
	movl	-80028(%rbp), %eax
	subl	$1, %eax
	cltq
	movq	-80016(%rbp,%rax,8), %rdx
	movl	-80028(%rbp), %eax
	cltq
	salq	$2, %rax
	leaq	-4(%rax), %rcx
	movq	-80040(%rbp), %rax
	addq	%rcx, %rax
	movl	(%rax), %eax
	cltq
	addq	%rax, %rdx
	movl	-80028(%rbp), %eax
	cltq
	movq	%rdx, -80016(%rbp,%rax,8)
	addl	$1, -80028(%rbp)
.L12:
	movl	-80028(%rbp), %eax
	cmpl	-80044(%rbp), %eax
	jl	.L13
	movl	$0, -80028(%rbp)
	movq	$0, -80024(%rbp)
	jmp	.L14
.L15:
	movl	-80028(%rbp), %eax
	cltq
	movq	-80016(%rbp,%rax,8), %rax
	addq	%rax, -80024(%rbp)
	addl	$1, -80028(%rbp)
.L14:
	movl	-80028(%rbp), %eax
	cmpl	-80044(%rbp), %eax
	jl	.L15
	movq	-80024(%rbp), %rax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L17
	call	__stack_chk_fail@PLT
.L17:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	getWaitTime, .-getWaitTime
	.globl	sort
	.type	sort, @function
sort:
.LFB2:
	.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)
	cmpl	$1, -28(%rbp)
	jle	.L31
	movl	$0, -16(%rbp)
	movl	-28(%rbp), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, -12(%rbp)
	movl	$0, -8(%rbp)
	movl	-28(%rbp), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, %edx
	movq	-24(%rbp), %rax
	movl	%edx, %esi
	movq	%rax, %rdi
	call	sort
	movl	-28(%rbp), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	negl	%eax
	movl	%eax, %edx
	movl	-28(%rbp), %eax
	addl	%eax, %edx
	movl	-28(%rbp), %eax
	movl	%eax, %ecx
	shrl	$31, %ecx
	addl	%ecx, %eax
	sarl	%eax
	cltq
	leaq	0(,%rax,4), %rcx
	movq	-24(%rbp), %rax
	addq	%rcx, %rax
	movl	%edx, %esi
	movq	%rax, %rdi
	call	sort
	jmp	.L21
.L24:
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	movq	-24(%rbp), %rax
	addq	%rcx, %rax
	movl	(%rax), %eax
	cmpl	%eax, %edx
	jge	.L22
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	-8(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	tmp(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	addl	$1, -8(%rbp)
	addl	$1, -16(%rbp)
	jmp	.L21
.L22:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	-8(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	tmp(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	addl	$1, -8(%rbp)
	addl	$1, -12(%rbp)
.L21:
	movl	-28(%rbp), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	cmpl	%eax, -16(%rbp)
	jge	.L25
	movl	-12(%rbp), %eax
	cmpl	-28(%rbp), %eax
	jl	.L24
	jmp	.L25
.L26:
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	-8(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	tmp(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	addl	$1, -8(%rbp)
	addl	$1, -16(%rbp)
.L25:
	movl	-28(%rbp), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	cmpl	%eax, -16(%rbp)
	jl	.L26
	jmp	.L27
.L28:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	-8(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	tmp(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	addl	$1, -8(%rbp)
	addl	$1, -12(%rbp)
.L27:
	movl	-12(%rbp), %eax
	cmpl	-28(%rbp), %eax
	jl	.L28
	movl	$0, -4(%rbp)
	jmp	.L29
.L30:
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rax, %rdx
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	tmp(%rip), %rax
	movl	(%rcx,%rax), %eax
	movl	%eax, (%rdx)
	addl	$1, -4(%rbp)
.L29:
	movl	-4(%rbp), %eax
	cmpl	-28(%rbp), %eax
	jl	.L30
	jmp	.L18
.L31:
	nop
.L18:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	sort, .-sort
	.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:
