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>

typedef char                SINT8;
typedef unsigned char       UINT8;
typedef short               SINT16;
typedef unsigned short      UINT16;
typedef int                 SINT32;
typedef unsigned int        UINT32;
typedef long long           SINT64;
typedef unsigned long long  UINT64;

#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a) ((a)>(0)?(a):-(a))


    SINT32 T[100001] = {0};
    SINT32 A[100001] = {0};

    SINT64 SUM[100001] = {0};


void quick_sort (SINT64 array[], int left, int right);
void swap_int (int *x,  int *y);
void swap_d (SINT64 *x,  SINT64 *y);
int partition (SINT64 array[], int left, int right);


void swap_int (int *x,  int *y) {
    int temp;
    temp = *x;
    *x = *y;
    *y = temp;
}

void swap_d (SINT64 *x,  SINT64 *y) {
    SINT64 temp;
    temp = *x;
    *x = *y;
    *y = temp;
}
 
int partition (SINT64 array[], int left, int right) {
    int i, j, pivot;
    i = left;
    j = right + 1;
    pivot = left;   // 先頭要素をpivotとする
 
    do {
        do { i++; } while (array[i] < array[pivot]);
        do { j--; } while (array[pivot] < array[j]);
        // pivotより小さいものを左へ、大きいものを右へ
        if (i < j) {
            swap_d(&array[i], &array[j]);
            swap_int(&T[i], &T[j]);
            swap_int(&A[i], &A[j]);
        }
    } while (i < j);
 
    swap_d(&array[pivot], &array[j]);   //pivotを更新
    swap_int(&T[pivot], &T[j]);   //pivotを更新
    swap_int(&A[pivot], &A[j]);   //pivotを更新
    return j;
}
 

void quick_sort (SINT64 array[], int left, int right) {
    int pivot;
    if (left < right) {
        pivot = partition(array, left, right);
        // pivotを境に再帰的にクイックソート
        quick_sort(array, left, pivot-1);
        quick_sort(array, pivot+1, right);
    }
}





SINT32 main() {
    SINT32 a;
    scanf("%d",&a);

    SINT64 ans = 0;


    
    for (SINT32 i = 0; i < a; i++) {
        scanf("%d%d", &T[i],&A[i]);

        SUM[i] = T[i] + A[i];
    }

    quick_sort(SUM, 0, a-1);

    for (SINT32 i = a; i >= 0; i--) {
        if (a % 2 == 0) {
        if ( i % 2 == 1 ) {
            ans = ans + T[i];
        } else {
            ans = ans - A[i];
        }
        } else {
        if ( i % 2 == 0 ) {
            ans = ans + T[i];
        } else {
            ans = ans - A[i];
        }
        }
    }


    printf("%lld\n",ans);
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	T
	.bss
	.align 32
	.type	T, @object
	.size	T, 400004
T:
	.zero	400004
	.globl	A
	.align 32
	.type	A, @object
	.size	A, 400004
A:
	.zero	400004
	.globl	SUM
	.align 32
	.type	SUM, @object
	.size	SUM, 800008
SUM:
	.zero	800008
	.text
	.globl	swap_int
	.type	swap_int, @function
swap_int:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -24(%rbp)
	movq	%rsi, -32(%rbp)
	movq	-24(%rbp), %rax
	movl	(%rax), %eax
	movl	%eax, -4(%rbp)
	movq	-32(%rbp), %rax
	movl	(%rax), %edx
	movq	-24(%rbp), %rax
	movl	%edx, (%rax)
	movq	-32(%rbp), %rax
	movl	-4(%rbp), %edx
	movl	%edx, (%rax)
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	swap_int, .-swap_int
	.globl	swap_d
	.type	swap_d, @function
swap_d:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -24(%rbp)
	movq	%rsi, -32(%rbp)
	movq	-24(%rbp), %rax
	movq	(%rax), %rax
	movq	%rax, -8(%rbp)
	movq	-32(%rbp), %rax
	movq	(%rax), %rdx
	movq	-24(%rbp), %rax
	movq	%rdx, (%rax)
	movq	-32(%rbp), %rax
	movq	-8(%rbp), %rdx
	movq	%rdx, (%rax)
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	swap_d, .-swap_d
	.globl	partition
	.type	partition, @function
partition:
.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	%edx, -32(%rbp)
	movl	-28(%rbp), %eax
	movl	%eax, -12(%rbp)
	movl	-32(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -8(%rbp)
	movl	-28(%rbp), %eax
	movl	%eax, -4(%rbp)
.L4:
	addl	$1, -12(%rbp)
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	movq	-24(%rbp), %rax
	addq	%rcx, %rax
	movq	(%rax), %rax
	cmpq	%rax, %rdx
	jl	.L4
.L5:
	subl	$1, -8(%rbp)
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	movq	-24(%rbp), %rax
	addq	%rcx, %rax
	movq	(%rax), %rax
	cmpq	%rax, %rdx
	jl	.L5
	movl	-12(%rbp), %eax
	cmpl	-8(%rbp), %eax
	jge	.L6
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-24(%rbp), %rax
	addq	%rax, %rdx
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	movq	-24(%rbp), %rax
	addq	%rcx, %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	swap_d
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	T(%rip), %rax
	addq	%rax, %rdx
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	T(%rip), %rax
	addq	%rcx, %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	swap_int
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	A(%rip), %rax
	addq	%rax, %rdx
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	A(%rip), %rax
	addq	%rcx, %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	swap_int
.L6:
	movl	-12(%rbp), %eax
	cmpl	-8(%rbp), %eax
	jl	.L4
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-24(%rbp), %rax
	addq	%rax, %rdx
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	movq	-24(%rbp), %rax
	addq	%rcx, %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	swap_d
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	T(%rip), %rax
	addq	%rax, %rdx
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	T(%rip), %rax
	addq	%rcx, %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	swap_int
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	A(%rip), %rax
	addq	%rax, %rdx
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	A(%rip), %rax
	addq	%rcx, %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	swap_int
	movl	-8(%rbp), %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	partition, .-partition
	.globl	quick_sort
	.type	quick_sort, @function
quick_sort:
.LFB9:
	.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	%edx, -32(%rbp)
	movl	-28(%rbp), %eax
	cmpl	-32(%rbp), %eax
	jge	.L10
	movl	-32(%rbp), %edx
	movl	-28(%rbp), %ecx
	movq	-24(%rbp), %rax
	movl	%ecx, %esi
	movq	%rax, %rdi
	call	partition
	movl	%eax, -4(%rbp)
	movl	-4(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-28(%rbp), %ecx
	movq	-24(%rbp), %rax
	movl	%ecx, %esi
	movq	%rax, %rdi
	call	quick_sort
	movl	-4(%rbp), %eax
	leal	1(%rax), %ecx
	movl	-32(%rbp), %edx
	movq	-24(%rbp), %rax
	movl	%ecx, %esi
	movq	%rax, %rdi
	call	quick_sort
.L10:
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.size	quick_sort, .-quick_sort
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d%d"
.LC2:
	.string	"%lld\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	-28(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	$0, -16(%rbp)
	movl	$0, -24(%rbp)
	jmp	.L12
.L13:
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	A(%rip), %rax
	addq	%rax, %rdx
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	T(%rip), %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	T(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	A(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%ecx, %eax
	cltq
	movl	-24(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	SUM(%rip), %rdx
	movq	%rax, (%rcx,%rdx)
	addl	$1, -24(%rbp)
.L12:
	movl	-28(%rbp), %eax
	cmpl	%eax, -24(%rbp)
	jl	.L13
	movl	-28(%rbp), %eax
	subl	$1, %eax
	movl	%eax, %edx
	movl	$0, %esi
	leaq	SUM(%rip), %rax
	movq	%rax, %rdi
	call	quick_sort
	movl	-28(%rbp), %eax
	movl	%eax, -20(%rbp)
	jmp	.L14
.L19:
	movl	-28(%rbp), %eax
	andl	$1, %eax
	testl	%eax, %eax
	jne	.L15
	movl	-20(%rbp), %eax
	cltd
	shrl	$31, %edx
	addl	%edx, %eax
	andl	$1, %eax
	subl	%edx, %eax
	cmpl	$1, %eax
	jne	.L16
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	T(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	addq	%rax, -16(%rbp)
	jmp	.L17
.L16:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	A(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	subq	%rax, -16(%rbp)
	jmp	.L17
.L15:
	movl	-20(%rbp), %eax
	andl	$1, %eax
	testl	%eax, %eax
	jne	.L18
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	T(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	addq	%rax, -16(%rbp)
	jmp	.L17
.L18:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	A(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	subq	%rax, -16(%rbp)
.L17:
	subl	$1, -20(%rbp)
.L14:
	cmpl	$0, -20(%rbp)
	jns	.L19
	movq	-16(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L21
	call	__stack_chk_fail@PLT
.L21:
	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
	.p2align 4
	.globl	swap_int
	.type	swap_int, @function
swap_int:
.LFB39:
	.cfi_startproc
	endbr64
	movl	(%rdi), %eax
	movl	(%rsi), %edx
	movl	%edx, (%rdi)
	movl	%eax, (%rsi)
	ret
	.cfi_endproc
.LFE39:
	.size	swap_int, .-swap_int
	.p2align 4
	.globl	swap_d
	.type	swap_d, @function
swap_d:
.LFB40:
	.cfi_startproc
	endbr64
	movq	(%rdi), %rax
	movq	(%rsi), %rdx
	movq	%rdx, (%rdi)
	movq	%rax, (%rsi)
	ret
	.cfi_endproc
.LFE40:
	.size	swap_d, .-swap_d
	.p2align 4
	.globl	partition
	.type	partition, @function
partition:
.LFB41:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	movslq	%esi, %r14
	leal	1(%rdx), %r8d
	addl	$1, %esi
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	leaq	(%rdi,%r14,8), %r13
	movq	%rdi, %r10
	movslq	%r8d, %rax
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	movslq	%esi, %rdi
	leaq	A(%rip), %r11
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	movq	0(%r13), %rcx
	leaq	T(%rip), %rbx
	.p2align 4,,10
	.p2align 3
.L5:
	movq	(%r10,%rdi,8), %r9
	cmpq	%rcx, %r9
	jl	.L6
	leaq	-8(%r10,%rax,8), %rax
	.p2align 4,,10
	.p2align 3
.L7:
	movq	%rax, %rsi
	movq	(%rax), %rdx
	subq	$8, %rax
	subl	$1, %r8d
	cmpq	%rdx, %rcx
	jl	.L7
	movslq	%r8d, %rax
	movl	(%r11,%rax,4), %ebp
	movl	(%rbx,%rax,4), %r12d
	cmpl	%edi, %r8d
	jg	.L11
	movq	%rdx, 0(%r13)
	movl	(%rbx,%r14,4), %edx
	movq	%rcx, (%rsi)
	movl	%r12d, (%rbx,%r14,4)
	movl	%edx, (%rbx,%rax,4)
	movl	(%r11,%r14,4), %edx
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	movl	%ebp, (%r11,%r14,4)
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	movl	%edx, (%r11,%rax,4)
	movl	%r8d, %eax
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L11:
	.cfi_restore_state
	movq	%rdx, (%r10,%rdi,8)
	movl	(%rbx,%rdi,4), %edx
	movq	%r9, (%rsi)
	movq	0(%r13), %rcx
	movl	%r12d, (%rbx,%rdi,4)
	movl	%edx, (%rbx,%rax,4)
	movl	(%r11,%rdi,4), %edx
	movl	%ebp, (%r11,%rdi,4)
	movl	%edx, (%r11,%rax,4)
.L6:
	addq	$1, %rdi
	jmp	.L5
	.cfi_endproc
.LFE41:
	.size	partition, .-partition
	.p2align 4
	.globl	quick_sort
	.type	quick_sort, @function
quick_sort:
.LFB42:
	.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
	subq	$72, %rsp
	.cfi_def_cfa_offset 128
	movl	%edx, 36(%rsp)
	cmpl	%esi, %edx
	jle	.L12
	movq	%rdi, %r15
	movl	%esi, %r13d
.L30:
	movl	36(%rsp), %edx
	movl	%r13d, %esi
	movq	%r15, %rdi
	call	partition
	movl	%eax, 40(%rsp)
	subl	$1, %eax
	movl	%eax, 24(%rsp)
	cmpl	%r13d, %eax
	jle	.L14
	movl	%r13d, %r14d
	movq	%r15, %r13
.L29:
	movl	24(%rsp), %edx
	movl	%r14d, %esi
	movq	%r13, %rdi
	call	partition
	movl	%eax, 44(%rsp)
	subl	$1, %eax
	movl	%eax, 28(%rsp)
	cmpl	%r14d, %eax
	jle	.L15
	movl	%r14d, %eax
	movq	%r13, %r14
	movl	%eax, %r13d
.L28:
	movl	28(%rsp), %edx
	movl	%r13d, %esi
	movq	%r14, %rdi
	call	partition
	movl	%eax, 48(%rsp)
	subl	$1, %eax
	movl	%eax, 32(%rsp)
	cmpl	%r13d, %eax
	jle	.L16
.L27:
	movl	32(%rsp), %edx
	movl	%r13d, %esi
	movq	%r14, %rdi
	call	partition
	leal	-1(%rax), %r12d
	movl	%eax, 52(%rsp)
	cmpl	%r13d, %r12d
	jle	.L17
.L26:
	movl	%r12d, %edx
	movl	%r13d, %esi
	movq	%r14, %rdi
	call	partition
	leal	-1(%rax), %ebx
	movl	%eax, %ebp
	cmpl	%r13d, %ebx
	jle	.L18
	movl	%r12d, 8(%rsp)
	movl	%r13d, %r15d
	movl	%ebx, %ebp
	movq	%r14, %r13
	movl	%eax, %r14d
.L25:
	movl	%ebp, %edx
	movl	%r15d, %esi
	movq	%r13, %rdi
	call	partition
	leal	-1(%rax), %ebx
	movl	%eax, 16(%rsp)
	cmpl	%r15d, %ebx
	jle	.L19
	movl	%ebp, 12(%rsp)
	movl	%ebx, %ebp
	movq	%r13, %rbx
.L24:
	movl	%ebp, %edx
	movl	%r15d, %esi
	movq	%rbx, %rdi
	call	partition
	leal	-1(%rax), %r13d
	movl	%eax, 56(%rsp)
	cmpl	%r15d, %r13d
	jle	.L20
	movl	%ebp, 20(%rsp)
	movq	%rbx, %rbp
	movl	%r13d, %ebx
.L23:
	movl	%ebx, %edx
	movl	%r15d, %esi
	movq	%rbp, %rdi
	call	partition
	leal	-1(%rax), %r13d
	movl	%eax, %r12d
	cmpl	%r15d, %r13d
	jle	.L21
	movl	%ebx, %r12d
	movl	%eax, %ecx
	movl	%r13d, %ebx
.L22:
	movl	%r15d, %esi
	movl	%ebx, %edx
	movq	%rbp, %rdi
	movl	%ecx, 60(%rsp)
	call	partition
	movl	%r15d, %esi
	movq	%rbp, %rdi
	movl	%eax, %r13d
	leal	-1(%rax), %edx
	call	quick_sort
	leal	1(%r13), %r15d
	movl	60(%rsp), %ecx
	cmpl	%r15d, %ebx
	jg	.L22
	movl	%r12d, %ebx
	movl	%ecx, %r12d
.L21:
	leal	1(%r12), %r15d
	cmpl	%r15d, %ebx
	jg	.L23
	movq	%rbp, %rbx
	movl	20(%rsp), %ebp
.L20:
	movl	56(%rsp), %r15d
	addl	$1, %r15d
	cmpl	%r15d, %ebp
	jg	.L24
	movl	12(%rsp), %ebp
	movq	%rbx, %r13
.L19:
	movl	16(%rsp), %r15d
	addl	$1, %r15d
	cmpl	%r15d, %ebp
	jg	.L25
	movl	8(%rsp), %r12d
	movl	%r14d, %ebp
	movq	%r13, %r14
.L18:
	leal	1(%rbp), %r13d
	cmpl	%r13d, %r12d
	jg	.L26
.L17:
	movl	52(%rsp), %r13d
	addl	$1, %r13d
	cmpl	%r13d, 32(%rsp)
	jg	.L27
.L16:
	movl	48(%rsp), %r13d
	addl	$1, %r13d
	cmpl	%r13d, 28(%rsp)
	jg	.L28
	movq	%r14, %r13
.L15:
	movl	44(%rsp), %r14d
	addl	$1, %r14d
	cmpl	%r14d, 24(%rsp)
	jg	.L29
	movq	%r13, %r15
.L14:
	movl	40(%rsp), %r13d
	addl	$1, %r13d
	cmpl	36(%rsp), %r13d
	jl	.L30
.L12:
	addq	$72, %rsp
	.cfi_def_cfa_offset 56
	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
	.cfi_endproc
.LFE42:
	.size	quick_sort, .-quick_sort
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%d%d"
.LC2:
	.string	"%lld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB43:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	leaq	.LC0(%rip), %rdi
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	leaq	SUM(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	subq	$16, %rsp
	.cfi_def_cfa_offset 64
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %edx
	testl	%edx, %edx
	jle	.L42
	leaq	T(%rip), %r14
	leaq	A(%rip), %r13
	xorl	%ebx, %ebx
	leaq	.LC1(%rip), %r12
	.p2align 4,,10
	.p2align 3
.L43:
	movq	%r13, %rdx
	movq	%r14, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	0(%r13), %eax
	addl	(%r14), %eax
	addq	$4, %r13
	cltq
	movl	4(%rsp), %edx
	addq	$4, %r14
	movq	%rax, 0(%rbp,%rbx,8)
	addq	$1, %rbx
	cmpl	%ebx, %edx
	jg	.L43
.L42:
	subl	$1, %edx
	xorl	%esi, %esi
	movq	%rbp, %rdi
	call	quick_sort
	movslq	4(%rsp), %rax
	xorl	%edx, %edx
	testl	%eax, %eax
	js	.L44
	testb	$1, %al
	je	.L45
	leaq	T(%rip), %rdi
	leaq	A(%rip), %rsi
	jmp	.L48
	.p2align 4,,10
	.p2align 3
.L60:
	movslq	(%rsi,%rax,4), %rcx
	subq	$1, %rax
	subq	%rcx, %rdx
	testl	%eax, %eax
	js	.L44
.L48:
	testb	$1, %al
	jne	.L60
	movslq	(%rdi,%rax,4), %rcx
	subq	$1, %rax
	addq	%rcx, %rdx
	testl	%eax, %eax
	jns	.L48
	.p2align 4,,10
	.p2align 3
.L44:
	xorl	%eax, %eax
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L61
	addq	$16, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 48
	xorl	%eax, %eax
	popq	%rbx
	.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
.L45:
	.cfi_restore_state
	leaq	A(%rip), %rsi
	leaq	T(%rip), %rdi
	jmp	.L52
	.p2align 4,,10
	.p2align 3
.L50:
	movslq	(%rsi,%rax,4), %rcx
	subq	%rcx, %rdx
.L51:
	subq	$1, %rax
	testl	%eax, %eax
	js	.L44
.L52:
	testb	$1, %al
	je	.L50
	movslq	(%rdi,%rax,4), %rcx
	addq	%rcx, %rdx
	jmp	.L51
.L61:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE43:
	.size	main, .-main
	.globl	SUM
	.bss
	.align 32
	.type	SUM, @object
	.size	SUM, 800008
SUM:
	.zero	800008
	.globl	A
	.align 32
	.type	A, @object
	.size	A, 400004
A:
	.zero	400004
	.globl	T
	.align 32
	.type	T, @object
	.size	T, 400004
T:
	.zero	400004
	.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
	.globl	swap_int
	.type	swap_int, @function
swap_int:
.LFB39:
	.cfi_startproc
	endbr64
	movl	(%rdi), %eax
	movl	(%rsi), %edx
	movl	%edx, (%rdi)
	movl	%eax, (%rsi)
	ret
	.cfi_endproc
.LFE39:
	.size	swap_int, .-swap_int
	.p2align 4
	.globl	swap_d
	.type	swap_d, @function
swap_d:
.LFB40:
	.cfi_startproc
	endbr64
	movq	(%rdi), %rax
	movq	(%rsi), %rdx
	movq	%rdx, (%rdi)
	movq	%rax, (%rsi)
	ret
	.cfi_endproc
.LFE40:
	.size	swap_d, .-swap_d
	.p2align 4
	.globl	partition
	.type	partition, @function
partition:
.LFB41:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	movslq	%esi, %r14
	leal	1(%rdx), %r8d
	addl	$1, %esi
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	leaq	(%rdi,%r14,8), %r13
	movq	%rdi, %r10
	movslq	%r8d, %rax
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	movslq	%esi, %rdi
	leaq	A(%rip), %r11
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	movq	0(%r13), %rcx
	leaq	T(%rip), %rbx
	.p2align 4,,10
	.p2align 3
.L5:
	movq	(%r10,%rdi,8), %r9
	cmpq	%rcx, %r9
	jl	.L6
	leaq	-8(%r10,%rax,8), %rax
	.p2align 4,,10
	.p2align 3
.L7:
	movq	%rax, %rsi
	movq	(%rax), %rdx
	subq	$8, %rax
	subl	$1, %r8d
	cmpq	%rdx, %rcx
	jl	.L7
	movslq	%r8d, %rax
	movl	(%r11,%rax,4), %ebp
	movl	(%rbx,%rax,4), %r12d
	cmpl	%edi, %r8d
	jg	.L11
	movq	%rdx, 0(%r13)
	movl	(%rbx,%r14,4), %edx
	movq	%rcx, (%rsi)
	movl	%r12d, (%rbx,%r14,4)
	movl	%edx, (%rbx,%rax,4)
	movl	(%r11,%r14,4), %edx
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	movl	%ebp, (%r11,%r14,4)
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	movl	%edx, (%r11,%rax,4)
	movl	%r8d, %eax
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L11:
	.cfi_restore_state
	movq	%rdx, (%r10,%rdi,8)
	movl	(%rbx,%rdi,4), %edx
	movq	%r9, (%rsi)
	movq	0(%r13), %rcx
	movl	%r12d, (%rbx,%rdi,4)
	movl	%edx, (%rbx,%rax,4)
	movl	(%r11,%rdi,4), %edx
	movl	%ebp, (%r11,%rdi,4)
	movl	%edx, (%r11,%rax,4)
.L6:
	addq	$1, %rdi
	jmp	.L5
	.cfi_endproc
.LFE41:
	.size	partition, .-partition
	.p2align 4
	.globl	quick_sort
	.type	quick_sort, @function
quick_sort:
.LFB42:
	.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
	subq	$72, %rsp
	.cfi_def_cfa_offset 128
	movl	%edx, 36(%rsp)
	cmpl	%esi, %edx
	jle	.L12
	movq	%rdi, %r15
	movl	%esi, %r13d
.L30:
	movl	36(%rsp), %edx
	movl	%r13d, %esi
	movq	%r15, %rdi
	call	partition
	movl	%eax, 40(%rsp)
	subl	$1, %eax
	movl	%eax, 24(%rsp)
	cmpl	%r13d, %eax
	jle	.L14
	movl	%r13d, %r14d
	movq	%r15, %r13
.L29:
	movl	24(%rsp), %edx
	movl	%r14d, %esi
	movq	%r13, %rdi
	call	partition
	movl	%eax, 44(%rsp)
	subl	$1, %eax
	movl	%eax, 28(%rsp)
	cmpl	%r14d, %eax
	jle	.L15
	movl	%r14d, %eax
	movq	%r13, %r14
	movl	%eax, %r13d
.L28:
	movl	28(%rsp), %edx
	movl	%r13d, %esi
	movq	%r14, %rdi
	call	partition
	movl	%eax, 48(%rsp)
	subl	$1, %eax
	movl	%eax, 32(%rsp)
	cmpl	%r13d, %eax
	jle	.L16
.L27:
	movl	32(%rsp), %edx
	movl	%r13d, %esi
	movq	%r14, %rdi
	call	partition
	leal	-1(%rax), %r12d
	movl	%eax, 52(%rsp)
	cmpl	%r13d, %r12d
	jle	.L17
.L26:
	movl	%r12d, %edx
	movl	%r13d, %esi
	movq	%r14, %rdi
	call	partition
	leal	-1(%rax), %ebx
	movl	%eax, %ebp
	cmpl	%r13d, %ebx
	jle	.L18
	movl	%r12d, 8(%rsp)
	movl	%r13d, %r15d
	movl	%ebx, %ebp
	movq	%r14, %r13
	movl	%eax, %r14d
.L25:
	movl	%ebp, %edx
	movl	%r15d, %esi
	movq	%r13, %rdi
	call	partition
	leal	-1(%rax), %ebx
	movl	%eax, 16(%rsp)
	cmpl	%r15d, %ebx
	jle	.L19
	movl	%ebp, 12(%rsp)
	movl	%ebx, %ebp
	movq	%r13, %rbx
.L24:
	movl	%ebp, %edx
	movl	%r15d, %esi
	movq	%rbx, %rdi
	call	partition
	leal	-1(%rax), %r13d
	movl	%eax, 56(%rsp)
	cmpl	%r15d, %r13d
	jle	.L20
	movl	%ebp, 20(%rsp)
	movq	%rbx, %rbp
	movl	%r13d, %ebx
.L23:
	movl	%ebx, %edx
	movl	%r15d, %esi
	movq	%rbp, %rdi
	call	partition
	leal	-1(%rax), %r13d
	movl	%eax, %r12d
	cmpl	%r15d, %r13d
	jle	.L21
	movl	%ebx, %r12d
	movl	%eax, %ecx
	movl	%r13d, %ebx
.L22:
	movl	%r15d, %esi
	movl	%ebx, %edx
	movq	%rbp, %rdi
	movl	%ecx, 60(%rsp)
	call	partition
	movl	%r15d, %esi
	movq	%rbp, %rdi
	movl	%eax, %r13d
	leal	-1(%rax), %edx
	call	quick_sort
	leal	1(%r13), %r15d
	movl	60(%rsp), %ecx
	cmpl	%r15d, %ebx
	jg	.L22
	movl	%r12d, %ebx
	movl	%ecx, %r12d
.L21:
	leal	1(%r12), %r15d
	cmpl	%r15d, %ebx
	jg	.L23
	movq	%rbp, %rbx
	movl	20(%rsp), %ebp
.L20:
	movl	56(%rsp), %r15d
	addl	$1, %r15d
	cmpl	%r15d, %ebp
	jg	.L24
	movl	12(%rsp), %ebp
	movq	%rbx, %r13
.L19:
	movl	16(%rsp), %r15d
	addl	$1, %r15d
	cmpl	%r15d, %ebp
	jg	.L25
	movl	8(%rsp), %r12d
	movl	%r14d, %ebp
	movq	%r13, %r14
.L18:
	leal	1(%rbp), %r13d
	cmpl	%r13d, %r12d
	jg	.L26
.L17:
	movl	52(%rsp), %r13d
	addl	$1, %r13d
	cmpl	%r13d, 32(%rsp)
	jg	.L27
.L16:
	movl	48(%rsp), %r13d
	addl	$1, %r13d
	cmpl	%r13d, 28(%rsp)
	jg	.L28
	movq	%r14, %r13
.L15:
	movl	44(%rsp), %r14d
	addl	$1, %r14d
	cmpl	%r14d, 24(%rsp)
	jg	.L29
	movq	%r13, %r15
.L14:
	movl	40(%rsp), %r13d
	addl	$1, %r13d
	cmpl	36(%rsp), %r13d
	jl	.L30
.L12:
	addq	$72, %rsp
	.cfi_def_cfa_offset 56
	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
	.cfi_endproc
.LFE42:
	.size	quick_sort, .-quick_sort
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%d%d"
.LC2:
	.string	"%lld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB43:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	leaq	.LC0(%rip), %rdi
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	leaq	SUM(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	subq	$16, %rsp
	.cfi_def_cfa_offset 64
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %edx
	testl	%edx, %edx
	jle	.L42
	leaq	T(%rip), %r14
	leaq	A(%rip), %r13
	xorl	%ebx, %ebx
	leaq	.LC1(%rip), %r12
	.p2align 4,,10
	.p2align 3
.L43:
	movq	%r13, %rdx
	movq	%r14, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	0(%r13), %eax
	addl	(%r14), %eax
	addq	$4, %r13
	cltq
	movl	4(%rsp), %edx
	addq	$4, %r14
	movq	%rax, 0(%rbp,%rbx,8)
	addq	$1, %rbx
	cmpl	%ebx, %edx
	jg	.L43
.L42:
	subl	$1, %edx
	xorl	%esi, %esi
	movq	%rbp, %rdi
	call	quick_sort
	movslq	4(%rsp), %rax
	xorl	%edx, %edx
	testl	%eax, %eax
	js	.L44
	testb	$1, %al
	je	.L45
	leaq	T(%rip), %rdi
	leaq	A(%rip), %rsi
	jmp	.L48
	.p2align 4,,10
	.p2align 3
.L60:
	movslq	(%rsi,%rax,4), %rcx
	subq	$1, %rax
	subq	%rcx, %rdx
	testl	%eax, %eax
	js	.L44
.L48:
	testb	$1, %al
	jne	.L60
	movslq	(%rdi,%rax,4), %rcx
	subq	$1, %rax
	addq	%rcx, %rdx
	testl	%eax, %eax
	jns	.L48
	.p2align 4,,10
	.p2align 3
.L44:
	xorl	%eax, %eax
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L61
	addq	$16, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 48
	xorl	%eax, %eax
	popq	%rbx
	.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
.L45:
	.cfi_restore_state
	leaq	A(%rip), %rsi
	leaq	T(%rip), %rdi
	jmp	.L52
	.p2align 4,,10
	.p2align 3
.L50:
	movslq	(%rsi,%rax,4), %rcx
	subq	%rcx, %rdx
.L51:
	subq	$1, %rax
	testl	%eax, %eax
	js	.L44
.L52:
	testb	$1, %al
	je	.L50
	movslq	(%rdi,%rax,4), %rcx
	addq	%rcx, %rdx
	jmp	.L51
.L61:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE43:
	.size	main, .-main
	.globl	SUM
	.bss
	.align 32
	.type	SUM, @object
	.size	SUM, 800008
SUM:
	.zero	800008
	.globl	A
	.align 32
	.type	A, @object
	.size	A, 400004
A:
	.zero	400004
	.globl	T
	.align 32
	.type	T, @object
	.size	T, 400004
T:
	.zero	400004
	.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>

typedef char                SINT8;
typedef unsigned char       UINT8;
typedef short               SINT16;
typedef unsigned short      UINT16;
typedef int                 SINT32;
typedef unsigned int        UINT32;
typedef long long           SINT64;
typedef unsigned long long  UINT64;

#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a) ((a)>(0)?(a):-(a))


    SINT32 T[100001] = {0};
    SINT32 A[100001] = {0};

    SINT64 SUM[100001] = {0};


void quick_sort (SINT64 array[], int left, int right);
void swap_int (int *x,  int *y);
void swap_d (SINT64 *x,  SINT64 *y);
int partition (SINT64 array[], int left, int right);


void swap_int (int *x,  int *y) {
    int temp;
    temp = *x;
    *x = *y;
    *y = temp;
}

void swap_d (SINT64 *x,  SINT64 *y) {
    SINT64 temp;
    temp = *x;
    *x = *y;
    *y = temp;
}
 
int partition (SINT64 array[], int left, int right) {
    int i, j, pivot;
    i = left;
    j = right + 1;
    pivot = left;   // 先頭要素をpivotとする
 
    do {
        do { i++; } while (array[i] < array[pivot]);
        do { j--; } while (array[pivot] < array[j]);
        // pivotより小さいものを左へ、大きいものを右へ
        if (i < j) {
            swap_d(&array[i], &array[j]);
            swap_int(&T[i], &T[j]);
            swap_int(&A[i], &A[j]);
        }
    } while (i < j);
 
    swap_d(&array[pivot], &array[j]);   //pivotを更新
    swap_int(&T[pivot], &T[j]);   //pivotを更新
    swap_int(&A[pivot], &A[j]);   //pivotを更新
    return j;
}
 

void quick_sort (SINT64 array[], int left, int right) {
    int pivot;
    if (left < right) {
        pivot = partition(array, left, right);
        // pivotを境に再帰的にクイックソート
        quick_sort(array, left, pivot-1);
        quick_sort(array, pivot+1, right);
    }
}





SINT32 main() {
    SINT32 a;
    scanf("%d",&a);

    SINT64 ans = 0;


    
    for (SINT32 i = 0; i < a; i++) {
        scanf("%d%d", &T[i],&A[i]);

        SUM[i] = T[i] + A[i];
    }

    quick_sort(SUM, 0, a-1);

    for (SINT32 i = a; i >= 0; i--) {
        if (a % 2 == 0) {
        if ( i % 2 == 1 ) {
            ans = ans + T[i];
        } else {
            ans = ans - A[i];
        }
        } else {
        if ( i % 2 == 0 ) {
            ans = ans + T[i];
        } else {
            ans = ans - A[i];
        }
        }
    }


    printf("%lld\n",ans);
	return 0;
}
3
20 10
16 20
20 30
 3
10 10
20 34
30 30
 6
1 1000000000
1 1000000000
1 1000000000
1 1000000000
1 1000000000
1 1000000001
 3
20 10
16 20
20 7
 3
10 10
20 4
30 30
 6
1 1000000000
1 1000000000
1 1000000000
1 1000000000
1 1000000000
2 1000000001

20
 6
 -2999999997
 26
 36
 -2999999996

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>

typedef char                SINT8;
typedef unsigned char       UINT8;
typedef short               SINT16;
typedef unsigned short      UINT16;
typedef int                 SINT32;
typedef unsigned int        UINT32;
typedef long long           SINT64;
typedef unsigned long long  UINT64;

#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a) ((a)>(0)?(a):-(a))


    SINT32 T[100001] = {0};
    SINT32 A[100001] = {0};

    SINT64 SUM[100001] = {0};


void quick_sort (SINT64 array[], int left, int right);
void swap_int (int *x,  int *y);
void swap_d (SINT64 *x,  SINT64 *y);
int partition (SINT64 array[], int left, int right);


void swap_int (int *x,  int *y) {
    int temp;
    temp = *x;
    *x = *y;
    *y = temp;
}

void swap_d (SINT64 *x,  SINT64 *y) {
    SINT64 temp;
    temp = *x;
    *x = *y;
    *y = temp;
}
 
int partition (SINT64 array[], int left, int right) {
    int i, j, pivot;
    i = left;
    j = right + 1;
    pivot = left;   // 先頭要素をpivotとする
 
    do {
        do { i++; } while (array[i] < array[pivot]);
        do { j--; } while (array[pivot] < array[j]);
        // pivotより小さいものを左へ、大きいものを右へ
        if (i < j) {
            swap_d(&array[i], &array[j]);
            swap_int(&T[i], &T[j]);
            swap_int(&A[i], &A[j]);
        }
    } while (i < j);
 
    swap_d(&array[pivot], &array[j]);   //pivotを更新
    swap_int(&T[pivot], &T[j]);   //pivotを更新
    swap_int(&A[pivot], &A[j]);   //pivotを更新
    return j;
}
 

void quick_sort (SINT64 array[], int left, int right) {
    int pivot;
    if (left < right) {
        pivot = partition(array, left, right);
        // pivotを境に再帰的にクイックソート
        quick_sort(array, left, pivot-1);
        quick_sort(array, pivot+1, right);
    }
}





SINT32 main() {
    SINT32 a;
    scanf("%d",&a);

    SINT64 ans = 0;


    
    for (SINT32 i = 0; i < a; i++) {
        scanf("%d%d", &T[i],&A[i]);

        SUM[i] = T[i] + A[i];
    }

    quick_sort(SUM, 0, a-1);

    for (SINT32 i = a; i >= 0; i--) {
        if (a % 2 == 0) {
        if ( i % 2 == 1 ) {
            ans = ans + T[i];
        } else {
            ans = ans - A[i];
        }
        } else {
        if ( i % 2 == 0 ) {
            ans = ans + T[i];
        } else {
            ans = ans - A[i];
        }
        }
    }


    printf("%lld\n",ans);
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	T
	.bss
	.align 32
	.type	T, @object
	.size	T, 400004
T:
	.zero	400004
	.globl	A
	.align 32
	.type	A, @object
	.size	A, 400004
A:
	.zero	400004
	.globl	SUM
	.align 32
	.type	SUM, @object
	.size	SUM, 800008
SUM:
	.zero	800008
	.text
	.globl	swap_int
	.type	swap_int, @function
swap_int:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -24(%rbp)
	movq	%rsi, -32(%rbp)
	movq	-24(%rbp), %rax
	movl	(%rax), %eax
	movl	%eax, -4(%rbp)
	movq	-32(%rbp), %rax
	movl	(%rax), %edx
	movq	-24(%rbp), %rax
	movl	%edx, (%rax)
	movq	-32(%rbp), %rax
	movl	-4(%rbp), %edx
	movl	%edx, (%rax)
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	swap_int, .-swap_int
	.globl	swap_d
	.type	swap_d, @function
swap_d:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -24(%rbp)
	movq	%rsi, -32(%rbp)
	movq	-24(%rbp), %rax
	movq	(%rax), %rax
	movq	%rax, -8(%rbp)
	movq	-32(%rbp), %rax
	movq	(%rax), %rdx
	movq	-24(%rbp), %rax
	movq	%rdx, (%rax)
	movq	-32(%rbp), %rax
	movq	-8(%rbp), %rdx
	movq	%rdx, (%rax)
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	swap_d, .-swap_d
	.globl	partition
	.type	partition, @function
partition:
.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	%edx, -32(%rbp)
	movl	-28(%rbp), %eax
	movl	%eax, -12(%rbp)
	movl	-32(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -8(%rbp)
	movl	-28(%rbp), %eax
	movl	%eax, -4(%rbp)
.L4:
	addl	$1, -12(%rbp)
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	movq	-24(%rbp), %rax
	addq	%rcx, %rax
	movq	(%rax), %rax
	cmpq	%rax, %rdx
	jl	.L4
.L5:
	subl	$1, -8(%rbp)
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	movq	-24(%rbp), %rax
	addq	%rcx, %rax
	movq	(%rax), %rax
	cmpq	%rax, %rdx
	jl	.L5
	movl	-12(%rbp), %eax
	cmpl	-8(%rbp), %eax
	jge	.L6
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-24(%rbp), %rax
	addq	%rax, %rdx
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	movq	-24(%rbp), %rax
	addq	%rcx, %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	swap_d
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	T(%rip), %rax
	addq	%rax, %rdx
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	T(%rip), %rax
	addq	%rcx, %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	swap_int
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	A(%rip), %rax
	addq	%rax, %rdx
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	A(%rip), %rax
	addq	%rcx, %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	swap_int
.L6:
	movl	-12(%rbp), %eax
	cmpl	-8(%rbp), %eax
	jl	.L4
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-24(%rbp), %rax
	addq	%rax, %rdx
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	movq	-24(%rbp), %rax
	addq	%rcx, %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	swap_d
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	T(%rip), %rax
	addq	%rax, %rdx
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	T(%rip), %rax
	addq	%rcx, %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	swap_int
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	A(%rip), %rax
	addq	%rax, %rdx
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	A(%rip), %rax
	addq	%rcx, %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	swap_int
	movl	-8(%rbp), %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	partition, .-partition
	.globl	quick_sort
	.type	quick_sort, @function
quick_sort:
.LFB9:
	.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	%edx, -32(%rbp)
	movl	-28(%rbp), %eax
	cmpl	-32(%rbp), %eax
	jge	.L10
	movl	-32(%rbp), %edx
	movl	-28(%rbp), %ecx
	movq	-24(%rbp), %rax
	movl	%ecx, %esi
	movq	%rax, %rdi
	call	partition
	movl	%eax, -4(%rbp)
	movl	-4(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-28(%rbp), %ecx
	movq	-24(%rbp), %rax
	movl	%ecx, %esi
	movq	%rax, %rdi
	call	quick_sort
	movl	-4(%rbp), %eax
	leal	1(%rax), %ecx
	movl	-32(%rbp), %edx
	movq	-24(%rbp), %rax
	movl	%ecx, %esi
	movq	%rax, %rdi
	call	quick_sort
.L10:
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.size	quick_sort, .-quick_sort
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d%d"
.LC2:
	.string	"%lld\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	-28(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	$0, -16(%rbp)
	movl	$0, -24(%rbp)
	jmp	.L12
.L13:
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	A(%rip), %rax
	addq	%rax, %rdx
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	T(%rip), %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	T(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	A(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%ecx, %eax
	cltq
	movl	-24(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	SUM(%rip), %rdx
	movq	%rax, (%rcx,%rdx)
	addl	$1, -24(%rbp)
.L12:
	movl	-28(%rbp), %eax
	cmpl	%eax, -24(%rbp)
	jl	.L13
	movl	-28(%rbp), %eax
	subl	$1, %eax
	movl	%eax, %edx
	movl	$0, %esi
	leaq	SUM(%rip), %rax
	movq	%rax, %rdi
	call	quick_sort
	movl	-28(%rbp), %eax
	movl	%eax, -20(%rbp)
	jmp	.L14
.L19:
	movl	-28(%rbp), %eax
	andl	$1, %eax
	testl	%eax, %eax
	jne	.L15
	movl	-20(%rbp), %eax
	cltd
	shrl	$31, %edx
	addl	%edx, %eax
	andl	$1, %eax
	subl	%edx, %eax
	cmpl	$1, %eax
	jne	.L16
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	T(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	addq	%rax, -16(%rbp)
	jmp	.L17
.L16:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	A(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	subq	%rax, -16(%rbp)
	jmp	.L17
.L15:
	movl	-20(%rbp), %eax
	andl	$1, %eax
	testl	%eax, %eax
	jne	.L18
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	T(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	addq	%rax, -16(%rbp)
	jmp	.L17
.L18:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	A(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	subq	%rax, -16(%rbp)
.L17:
	subl	$1, -20(%rbp)
.L14:
	cmpl	$0, -20(%rbp)
	jns	.L19
	movq	-16(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L21
	call	__stack_chk_fail@PLT
.L21:
	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	T
	.bss
	.align 32
	.type	T, @object
	.size	T, 400004
T:
	.zero	400004
	.globl	A
	.align 32
	.type	A, @object
	.size	A, 400004
A:
	.zero	400004
	.globl	SUM
	.align 32
	.type	SUM, @object
	.size	SUM, 800008
SUM:
	.zero	800008
	.text
	.globl	swap_int
	.type	swap_int, @function
swap_int:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -24(%rbp)
	movq	%rsi, -32(%rbp)
	movq	-24(%rbp), %rax
	movl	(%rax), %eax
	movl	%eax, -4(%rbp)
	movq	-32(%rbp), %rax
	movl	(%rax), %edx
	movq	-24(%rbp), %rax
	movl	%edx, (%rax)
	movq	-32(%rbp), %rax
	movl	-4(%rbp), %edx
	movl	%edx, (%rax)
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	swap_int, .-swap_int
	.globl	swap_d
	.type	swap_d, @function
swap_d:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -24(%rbp)
	movq	%rsi, -32(%rbp)
	movq	-24(%rbp), %rax
	movq	(%rax), %rax
	movq	%rax, -8(%rbp)
	movq	-32(%rbp), %rax
	movq	(%rax), %rdx
	movq	-24(%rbp), %rax
	movq	%rdx, (%rax)
	movq	-32(%rbp), %rax
	movq	-8(%rbp), %rdx
	movq	%rdx, (%rax)
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	swap_d, .-swap_d
	.globl	partition
	.type	partition, @function
partition:
.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	%edx, -32(%rbp)
	movl	-28(%rbp), %eax
	movl	%eax, -12(%rbp)
	movl	-32(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -8(%rbp)
	movl	-28(%rbp), %eax
	movl	%eax, -4(%rbp)
.L4:
	addl	$1, -12(%rbp)
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	movq	-24(%rbp), %rax
	addq	%rcx, %rax
	movq	(%rax), %rax
	cmpq	%rax, %rdx
	jl	.L4
.L5:
	subl	$1, -8(%rbp)
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	movq	-24(%rbp), %rax
	addq	%rcx, %rax
	movq	(%rax), %rax
	cmpq	%rax, %rdx
	jl	.L5
	movl	-12(%rbp), %eax
	cmpl	-8(%rbp), %eax
	jge	.L6
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-24(%rbp), %rax
	addq	%rax, %rdx
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	movq	-24(%rbp), %rax
	addq	%rcx, %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	swap_d
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	T(%rip), %rax
	addq	%rax, %rdx
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	T(%rip), %rax
	addq	%rcx, %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	swap_int
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	A(%rip), %rax
	addq	%rax, %rdx
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	A(%rip), %rax
	addq	%rcx, %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	swap_int
.L6:
	movl	-12(%rbp), %eax
	cmpl	-8(%rbp), %eax
	jl	.L4
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-24(%rbp), %rax
	addq	%rax, %rdx
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	movq	-24(%rbp), %rax
	addq	%rcx, %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	swap_d
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	T(%rip), %rax
	addq	%rax, %rdx
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	T(%rip), %rax
	addq	%rcx, %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	swap_int
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	A(%rip), %rax
	addq	%rax, %rdx
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	A(%rip), %rax
	addq	%rcx, %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	swap_int
	movl	-8(%rbp), %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	partition, .-partition
	.globl	quick_sort
	.type	quick_sort, @function
quick_sort:
.LFB9:
	.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	%edx, -32(%rbp)
	movl	-28(%rbp), %eax
	cmpl	-32(%rbp), %eax
	jge	.L10
	movl	-32(%rbp), %edx
	movl	-28(%rbp), %ecx
	movq	-24(%rbp), %rax
	movl	%ecx, %esi
	movq	%rax, %rdi
	call	partition
	movl	%eax, -4(%rbp)
	movl	-4(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-28(%rbp), %ecx
	movq	-24(%rbp), %rax
	movl	%ecx, %esi
	movq	%rax, %rdi
	call	quick_sort
	movl	-4(%rbp), %eax
	leal	1(%rax), %ecx
	movl	-32(%rbp), %edx
	movq	-24(%rbp), %rax
	movl	%ecx, %esi
	movq	%rax, %rdi
	call	quick_sort
.L10:
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.size	quick_sort, .-quick_sort
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d%d"
.LC2:
	.string	"%lld\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	-28(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	$0, -16(%rbp)
	movl	$0, -24(%rbp)
	jmp	.L12
.L13:
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	A(%rip), %rax
	addq	%rax, %rdx
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	T(%rip), %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	T(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	A(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%ecx, %eax
	cltq
	movl	-24(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	SUM(%rip), %rdx
	movq	%rax, (%rcx,%rdx)
	addl	$1, -24(%rbp)
.L12:
	movl	-28(%rbp), %eax
	cmpl	%eax, -24(%rbp)
	jl	.L13
	movl	-28(%rbp), %eax
	subl	$1, %eax
	movl	%eax, %edx
	movl	$0, %esi
	leaq	SUM(%rip), %rax
	movq	%rax, %rdi
	call	quick_sort
	movl	-28(%rbp), %eax
	movl	%eax, -20(%rbp)
	jmp	.L14
.L19:
	movl	-28(%rbp), %eax
	andl	$1, %eax
	testl	%eax, %eax
	jne	.L15
	movl	-20(%rbp), %eax
	cltd
	shrl	$31, %edx
	addl	%edx, %eax
	andl	$1, %eax
	subl	%edx, %eax
	cmpl	$1, %eax
	jne	.L16
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	T(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	addq	%rax, -16(%rbp)
	jmp	.L17
.L16:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	A(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	subq	%rax, -16(%rbp)
	jmp	.L17
.L15:
	movl	-20(%rbp), %eax
	andl	$1, %eax
	testl	%eax, %eax
	jne	.L18
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	T(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	addq	%rax, -16(%rbp)
	jmp	.L17
.L18:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	A(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	subq	%rax, -16(%rbp)
.L17:
	subl	$1, -20(%rbp)
.L14:
	cmpl	$0, -20(%rbp)
	jns	.L19
	movq	-16(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L21
	call	__stack_chk_fail@PLT
.L21:
	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:
