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 struct {
    int a;
    int no;
    int order;
} DATA;

DATA a[300000];

int comp1(const void *a, const void *b)
{
    return ((*(DATA *)a).a - (*(DATA *)b).a);
}

int comp2(const void *a, const void *b)
{
    return ((*(DATA *)a).no - (*(DATA *)b).no);
}

int main(void)
{
    int N, Q, x, y;
    int diff;
    int i;
    int out;
    DATA tmp;
    int sort_flag;
    
    
    scanf("%d", &N);
    for (i = 0; i < N; i++){
        scanf("%d", &a[i].a);
        a[i].no = i;
    }
    
    qsort(a, N, sizeof(DATA), comp1);
    for (i = 0; i < N; i++){
        a[i].order = i;
    }
    
    qsort(a, N, sizeof(DATA), comp2);
    
//for (i = 0; i < N; i++){
//    printf("%d:%d:%d ", a[i].no, a[i].a, a[i].order);
//}
//printf("\n");
    
    diff = 0;
    for (i = 0; i < N; i++){
        if (a[i].no != a[i].order){
            diff++;
        }
    }

    sort_flag = 0;
    for (i = 0; i < N - 1; i++){
        if (a[i].a > a[i + 1].a){
            sort_flag = 1;
            break;
        }
    }
    
    if (sort_flag == 0){
        out = 0;
    }
    else {
        out = -1;
    }

    scanf("%d", &Q);
    for (i = 0; i < Q; i++){
        scanf("%d%d", &x, &y);
        x--;
        y--;

        if (out != -1){
            continue;
        }
        
        if (x == a[y].order){
            diff--;
        }
        if (y == a[x].order){
            diff--;
        }
        if (x == a[x].order){
            diff++;
        }
        if (y == a[y].order){
            diff++;
        }
        
        tmp = a[x];
        a[x] = a[y];
        a[y] = tmp;
        
        if (diff == 0){
            out = i + 1;
        }
    }
    
    printf("%d\n", out);
    
    return (0);
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	a
	.bss
	.align 32
	.type	a, @object
	.size	a, 3600000
a:
	.zero	3600000
	.text
	.globl	comp1
	.type	comp1, @function
comp1:
.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, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-8(%rbp), %rax
	movl	(%rax), %edx
	movq	-16(%rbp), %rax
	movl	(%rax), %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	comp1, .-comp1
	.globl	comp2
	.type	comp2, @function
comp2:
.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, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-8(%rbp), %rax
	movl	4(%rax), %edx
	movq	-16(%rbp), %rax
	movl	4(%rax), %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	comp2, .-comp2
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d%d"
.LC2:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$64, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-52(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -32(%rbp)
	jmp	.L6
.L7:
	movl	-32(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	leaq	a(%rip), %rdx
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-32(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rcx
	leaq	4+a(%rip), %rdx
	movl	-32(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	addl	$1, -32(%rbp)
.L6:
	movl	-52(%rbp), %eax
	cmpl	%eax, -32(%rbp)
	jl	.L7
	movl	-52(%rbp), %eax
	cltq
	leaq	comp1(%rip), %rdx
	movq	%rdx, %rcx
	movl	$12, %edx
	movq	%rax, %rsi
	leaq	a(%rip), %rax
	movq	%rax, %rdi
	call	qsort@PLT
	movl	$0, -32(%rbp)
	jmp	.L8
.L9:
	movl	-32(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rcx
	leaq	8+a(%rip), %rdx
	movl	-32(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	addl	$1, -32(%rbp)
.L8:
	movl	-52(%rbp), %eax
	cmpl	%eax, -32(%rbp)
	jl	.L9
	movl	-52(%rbp), %eax
	cltq
	leaq	comp2(%rip), %rdx
	movq	%rdx, %rcx
	movl	$12, %edx
	movq	%rax, %rsi
	leaq	a(%rip), %rax
	movq	%rax, %rdi
	call	qsort@PLT
	movl	$0, -36(%rbp)
	movl	$0, -32(%rbp)
	jmp	.L10
.L12:
	movl	-32(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	leaq	4+a(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	-32(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	leaq	8+a(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, %ecx
	je	.L11
	addl	$1, -36(%rbp)
.L11:
	addl	$1, -32(%rbp)
.L10:
	movl	-52(%rbp), %eax
	cmpl	%eax, -32(%rbp)
	jl	.L12
	movl	$0, -24(%rbp)
	movl	$0, -32(%rbp)
	jmp	.L13
.L16:
	movl	-32(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	-32(%rbp), %eax
	addl	$1, %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, %ecx
	jle	.L14
	movl	$1, -24(%rbp)
	jmp	.L15
.L14:
	addl	$1, -32(%rbp)
.L13:
	movl	-52(%rbp), %eax
	subl	$1, %eax
	cmpl	%eax, -32(%rbp)
	jl	.L16
.L15:
	cmpl	$0, -24(%rbp)
	jne	.L17
	movl	$0, -28(%rbp)
	jmp	.L18
.L17:
	movl	$-1, -28(%rbp)
.L18:
	leaq	-48(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -32(%rbp)
	jmp	.L19
.L26:
	leaq	-40(%rbp), %rdx
	leaq	-44(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-44(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -44(%rbp)
	movl	-40(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -40(%rbp)
	cmpl	$-1, -28(%rbp)
	jne	.L29
	movl	-40(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	leaq	8+a(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-44(%rbp), %eax
	cmpl	%eax, %edx
	jne	.L22
	subl	$1, -36(%rbp)
.L22:
	movl	-44(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	leaq	8+a(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-40(%rbp), %eax
	cmpl	%eax, %edx
	jne	.L23
	subl	$1, -36(%rbp)
.L23:
	movl	-44(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	leaq	8+a(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-44(%rbp), %eax
	cmpl	%eax, %edx
	jne	.L24
	addl	$1, -36(%rbp)
.L24:
	movl	-40(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	leaq	8+a(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-40(%rbp), %eax
	cmpl	%eax, %edx
	jne	.L25
	addl	$1, -36(%rbp)
.L25:
	movl	-44(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rcx
	movq	%rcx, -20(%rbp)
	movl	8(%rdx,%rax), %eax
	movl	%eax, -12(%rbp)
	movl	-40(%rbp), %esi
	movl	-44(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rcx
	leaq	a(%rip), %rdx
	movslq	%esi, %rsi
	movq	%rsi, %rax
	addq	%rax, %rax
	addq	%rsi, %rax
	salq	$2, %rax
	movq	%rax, %rsi
	leaq	a(%rip), %rax
	movq	(%rsi,%rax), %rdi
	movq	%rdi, (%rcx,%rdx)
	movl	8(%rsi,%rax), %eax
	movl	%eax, 8(%rcx,%rdx)
	movl	-40(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	leaq	a(%rip), %rax
	movq	-20(%rbp), %rcx
	movq	%rcx, (%rdx,%rax)
	movl	-12(%rbp), %ecx
	movl	%ecx, 8(%rdx,%rax)
	cmpl	$0, -36(%rbp)
	jne	.L21
	movl	-32(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -28(%rbp)
	jmp	.L21
.L29:
	nop
.L21:
	addl	$1, -32(%rbp)
.L19:
	movl	-48(%rbp), %eax
	cmpl	%eax, -32(%rbp)
	jl	.L26
	movl	-28(%rbp), %eax
	movl	%eax, %esi
	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	.L28
	call	__stack_chk_fail@PLT
.L28:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.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	comp1
	.type	comp1, @function
comp1:
.LFB39:
	.cfi_startproc
	endbr64
	movl	(%rdi), %eax
	subl	(%rsi), %eax
	ret
	.cfi_endproc
.LFE39:
	.size	comp1, .-comp1
	.p2align 4
	.globl	comp2
	.type	comp2, @function
comp2:
.LFB40:
	.cfi_startproc
	endbr64
	movl	4(%rdi), %eax
	subl	4(%rsi), %eax
	ret
	.cfi_endproc
.LFE40:
	.size	comp2, .-comp2
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%d%d"
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB41:
	.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
	leaq	.LC0(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movq	%r13, %rdi
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	leaq	a(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$56, %rsp
	.cfi_def_cfa_offset 112
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movslq	24(%rsp), %rsi
	testl	%esi, %esi
	jle	.L5
	movq	%rbp, %r12
	xorl	%ebx, %ebx
	.p2align 4,,10
	.p2align 3
.L6:
	movq	%r12, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	addq	$12, %r12
	call	__isoc99_scanf@PLT
	movslq	24(%rsp), %rsi
	movl	%ebx, -8(%r12)
	addl	$1, %ebx
	cmpl	%ebx, %esi
	jg	.L6
.L5:
	movl	$12, %edx
	leaq	comp1(%rip), %rcx
	movq	%rbp, %rdi
	call	qsort@PLT
	movslq	24(%rsp), %rsi
	leaq	8+a(%rip), %rdx
	xorl	%eax, %eax
	testl	%esi, %esi
	jle	.L11
	.p2align 4,,10
	.p2align 3
.L10:
	movl	%eax, (%rdx)
	addl	$1, %eax
	addq	$12, %rdx
	cmpl	%esi, %eax
	jne	.L10
.L11:
	movq	%rbp, %rdi
	leaq	comp2(%rip), %rcx
	movl	$12, %edx
	call	qsort@PLT
	movl	24(%rsp), %edi
	testl	%edi, %edi
	jle	.L40
	leal	-1(%rdi), %edx
	leaq	4+a(%rip), %rax
	xorl	%ebx, %ebx
	leaq	(%rdx,%rdx,2), %rcx
	movq	%rdx, %rdi
	leaq	12(%rax), %rdx
	leaq	(%rdx,%rcx,4), %rcx
	.p2align 4,,10
	.p2align 3
.L13:
	movl	4(%rax), %edx
	cmpl	%edx, (%rax)
	setne	%dl
	addq	$12, %rax
	movzbl	%dl, %edx
	addl	%edx, %ebx
	cmpq	%rax, %rcx
	jne	.L13
.L9:
	movl	a(%rip), %esi
	leaq	12+a(%rip), %rdx
	xorl	%eax, %eax
	jmp	.L14
	.p2align 4,,10
	.p2align 3
.L16:
	movl	(%rdx), %ecx
	addl	$1, %eax
	addq	$12, %rdx
	cmpl	%esi, %ecx
	jl	.L28
	movl	%ecx, %esi
.L14:
	cmpl	%eax, %edi
	jg	.L16
	movl	$0, 12(%rsp)
.L15:
	leaq	28(%rsp), %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	28(%rsp), %eax
	testl	%eax, %eax
	jle	.L17
	leaq	36(%rsp), %r15
	xorl	%r12d, %r12d
	leaq	32(%rsp), %r14
	movq	%r15, %rax
	leaq	.LC1(%rip), %r13
	movq	%r14, %r15
	movl	%r12d, %r14d
	movq	%rax, %r12
	.p2align 4,,10
	.p2align 3
.L26:
	movq	%r12, %rdx
	xorl	%eax, %eax
	movq	%r15, %rsi
	movq	%r13, %rdi
	call	__isoc99_scanf@PLT
	movl	32(%rsp), %eax
	addl	$1, %r14d
	leal	-1(%rax), %edx
	movl	36(%rsp), %eax
	movl	%edx, 32(%rsp)
	subl	$1, %eax
	cmpl	$-1, 12(%rsp)
	movl	%eax, 36(%rsp)
	jne	.L18
	movslq	%eax, %rcx
	xorl	%esi, %esi
	leaq	(%rcx,%rcx,2), %r9
	leaq	0(%rbp,%r9,4), %rcx
	movl	8(%rcx), %r8d
	cmpl	%r8d, %edx
	sete	%sil
	xorl	%r11d, %r11d
	subl	%esi, %ebx
	movslq	%edx, %rsi
	leaq	(%rsi,%rsi,2), %r10
	leaq	0(%rbp,%r10,4), %rdi
	movl	8(%rdi), %esi
	cmpl	%esi, %eax
	sete	%r11b
	subl	%r11d, %ebx
	cmpl	%esi, %edx
	sete	%dl
	movzbl	%dl, %edx
	addl	%edx, %ebx
	movq	0(%rbp,%r10,4), %rdx
	movq	(%rcx), %r10
	cmpl	%r8d, %eax
	sete	%al
	movq	%r10, (%rdi)
	movl	8(%rcx), %r10d
	movzbl	%al, %eax
	addl	%eax, %ebx
	movl	%r10d, 8(%rdi)
	movl	12(%rsp), %edi
	movq	%rdx, 0(%rbp,%r9,4)
	cmove	%r14d, %edi
	movl	%esi, 8(%rcx)
	movl	%edi, 12(%rsp)
	cmpl	%r14d, 28(%rsp)
	jg	.L26
.L17:
	movl	12(%rsp), %edx
	xorl	%eax, %eax
	movl	$1, %edi
	leaq	.LC2(%rip), %rsi
	call	__printf_chk@PLT
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L41
	addq	$56, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L18:
	.cfi_restore_state
	movq	%r12, %rax
	movl	%r14d, %r12d
	movq	%r15, %r14
	movq	%rax, %r15
	cmpl	%r12d, 28(%rsp)
	jle	.L17
.L24:
	movq	%r15, %rdx
	movq	%r14, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	addl	$1, %r12d
	subl	$1, 32(%rsp)
	subl	$1, 36(%rsp)
	cmpl	28(%rsp), %r12d
	jl	.L24
	jmp	.L17
.L28:
	movl	$-1, 12(%rsp)
	jmp	.L15
.L40:
	xorl	%ebx, %ebx
	subl	$1, %edi
	jmp	.L9
.L41:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE41:
	.size	main, .-main
	.globl	a
	.bss
	.align 32
	.type	a, @object
	.size	a, 3600000
a:
	.zero	3600000
	.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	comp1
	.type	comp1, @function
comp1:
.LFB39:
	.cfi_startproc
	endbr64
	movl	(%rdi), %eax
	subl	(%rsi), %eax
	ret
	.cfi_endproc
.LFE39:
	.size	comp1, .-comp1
	.p2align 4
	.globl	comp2
	.type	comp2, @function
comp2:
.LFB40:
	.cfi_startproc
	endbr64
	movl	4(%rdi), %eax
	subl	4(%rsi), %eax
	ret
	.cfi_endproc
.LFE40:
	.size	comp2, .-comp2
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%d%d"
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB41:
	.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
	leaq	.LC0(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movq	%r13, %rdi
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	leaq	a(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$56, %rsp
	.cfi_def_cfa_offset 112
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movslq	24(%rsp), %rsi
	testl	%esi, %esi
	jle	.L5
	movq	%rbp, %r12
	xorl	%ebx, %ebx
	.p2align 4,,10
	.p2align 3
.L6:
	movq	%r12, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	addq	$12, %r12
	call	__isoc99_scanf@PLT
	movslq	24(%rsp), %rsi
	movl	%ebx, -8(%r12)
	addl	$1, %ebx
	cmpl	%ebx, %esi
	jg	.L6
.L5:
	movl	$12, %edx
	leaq	comp1(%rip), %rcx
	movq	%rbp, %rdi
	call	qsort@PLT
	movslq	24(%rsp), %rsi
	leaq	8+a(%rip), %rdx
	xorl	%eax, %eax
	testl	%esi, %esi
	jle	.L11
	.p2align 4,,10
	.p2align 3
.L10:
	movl	%eax, (%rdx)
	addl	$1, %eax
	addq	$12, %rdx
	cmpl	%esi, %eax
	jne	.L10
.L11:
	movq	%rbp, %rdi
	leaq	comp2(%rip), %rcx
	movl	$12, %edx
	call	qsort@PLT
	movl	24(%rsp), %edi
	testl	%edi, %edi
	jle	.L40
	leal	-1(%rdi), %edx
	leaq	4+a(%rip), %rax
	xorl	%ebx, %ebx
	leaq	(%rdx,%rdx,2), %rcx
	movq	%rdx, %rdi
	leaq	12(%rax), %rdx
	leaq	(%rdx,%rcx,4), %rcx
	.p2align 4,,10
	.p2align 3
.L13:
	movl	4(%rax), %edx
	cmpl	%edx, (%rax)
	setne	%dl
	addq	$12, %rax
	movzbl	%dl, %edx
	addl	%edx, %ebx
	cmpq	%rax, %rcx
	jne	.L13
.L9:
	movl	a(%rip), %esi
	leaq	12+a(%rip), %rdx
	xorl	%eax, %eax
	jmp	.L14
	.p2align 4,,10
	.p2align 3
.L16:
	movl	(%rdx), %ecx
	addl	$1, %eax
	addq	$12, %rdx
	cmpl	%esi, %ecx
	jl	.L28
	movl	%ecx, %esi
.L14:
	cmpl	%eax, %edi
	jg	.L16
	movl	$0, 12(%rsp)
.L15:
	leaq	28(%rsp), %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	28(%rsp), %eax
	testl	%eax, %eax
	jle	.L17
	leaq	36(%rsp), %r15
	xorl	%r12d, %r12d
	leaq	32(%rsp), %r14
	movq	%r15, %rax
	leaq	.LC1(%rip), %r13
	movq	%r14, %r15
	movl	%r12d, %r14d
	movq	%rax, %r12
	.p2align 4,,10
	.p2align 3
.L26:
	movq	%r12, %rdx
	xorl	%eax, %eax
	movq	%r15, %rsi
	movq	%r13, %rdi
	call	__isoc99_scanf@PLT
	movl	32(%rsp), %eax
	addl	$1, %r14d
	leal	-1(%rax), %edx
	movl	36(%rsp), %eax
	movl	%edx, 32(%rsp)
	subl	$1, %eax
	cmpl	$-1, 12(%rsp)
	movl	%eax, 36(%rsp)
	jne	.L18
	movslq	%eax, %rcx
	xorl	%esi, %esi
	leaq	(%rcx,%rcx,2), %r9
	leaq	0(%rbp,%r9,4), %rcx
	movl	8(%rcx), %r8d
	cmpl	%r8d, %edx
	sete	%sil
	xorl	%r11d, %r11d
	subl	%esi, %ebx
	movslq	%edx, %rsi
	leaq	(%rsi,%rsi,2), %r10
	leaq	0(%rbp,%r10,4), %rdi
	movl	8(%rdi), %esi
	cmpl	%esi, %eax
	sete	%r11b
	subl	%r11d, %ebx
	cmpl	%esi, %edx
	sete	%dl
	movzbl	%dl, %edx
	addl	%edx, %ebx
	movq	0(%rbp,%r10,4), %rdx
	movq	(%rcx), %r10
	cmpl	%r8d, %eax
	sete	%al
	movq	%r10, (%rdi)
	movl	8(%rcx), %r10d
	movzbl	%al, %eax
	addl	%eax, %ebx
	movl	%r10d, 8(%rdi)
	movl	12(%rsp), %edi
	movq	%rdx, 0(%rbp,%r9,4)
	cmove	%r14d, %edi
	movl	%esi, 8(%rcx)
	movl	%edi, 12(%rsp)
	cmpl	%r14d, 28(%rsp)
	jg	.L26
.L17:
	movl	12(%rsp), %edx
	xorl	%eax, %eax
	movl	$1, %edi
	leaq	.LC2(%rip), %rsi
	call	__printf_chk@PLT
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L41
	addq	$56, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L18:
	.cfi_restore_state
	movq	%r12, %rax
	movl	%r14d, %r12d
	movq	%r15, %r14
	movq	%rax, %r15
	cmpl	%r12d, 28(%rsp)
	jle	.L17
.L24:
	movq	%r15, %rdx
	movq	%r14, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	addl	$1, %r12d
	subl	$1, 32(%rsp)
	subl	$1, 36(%rsp)
	cmpl	28(%rsp), %r12d
	jl	.L24
	jmp	.L17
.L28:
	movl	$-1, 12(%rsp)
	jmp	.L15
.L40:
	xorl	%ebx, %ebx
	subl	$1, %edi
	jmp	.L9
.L41:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE41:
	.size	main, .-main
	.globl	a
	.bss
	.align 32
	.type	a, @object
	.size	a, 3600000
a:
	.zero	3600000
	.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 struct {
    int a;
    int no;
    int order;
} DATA;

DATA a[300000];

int comp1(const void *a, const void *b)
{
    return ((*(DATA *)a).a - (*(DATA *)b).a);
}

int comp2(const void *a, const void *b)
{
    return ((*(DATA *)a).no - (*(DATA *)b).no);
}

int main(void)
{
    int N, Q, x, y;
    int diff;
    int i;
    int out;
    DATA tmp;
    int sort_flag;
    
    
    scanf("%d", &N);
    for (i = 0; i < N; i++){
        scanf("%d", &a[i].a);
        a[i].no = i;
    }
    
    qsort(a, N, sizeof(DATA), comp1);
    for (i = 0; i < N; i++){
        a[i].order = i;
    }
    
    qsort(a, N, sizeof(DATA), comp2);
    
//for (i = 0; i < N; i++){
//    printf("%d:%d:%d ", a[i].no, a[i].a, a[i].order);
//}
//printf("\n");
    
    diff = 0;
    for (i = 0; i < N; i++){
        if (a[i].no != a[i].order){
            diff++;
        }
    }

    sort_flag = 0;
    for (i = 0; i < N - 1; i++){
        if (a[i].a > a[i + 1].a){
            sort_flag = 1;
            break;
        }
    }
    
    if (sort_flag == 0){
        out = 0;
    }
    else {
        out = -1;
    }

    scanf("%d", &Q);
    for (i = 0; i < Q; i++){
        scanf("%d%d", &x, &y);
        x--;
        y--;

        if (out != -1){
            continue;
        }
        
        if (x == a[y].order){
            diff--;
        }
        if (y == a[x].order){
            diff--;
        }
        if (x == a[x].order){
            diff++;
        }
        if (y == a[y].order){
            diff++;
        }
        
        tmp = a[x];
        a[x] = a[y];
        a[y] = tmp;
        
        if (diff == 0){
            out = i + 1;
        }
    }
    
    printf("%d\n", out);
    
    return (0);
}

6
9 7 5 6 3 1
3
1 6
2 5
3 4

2

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 struct {
    int a;
    int no;
    int order;
} DATA;

DATA a[300000];

int comp1(const void *a, const void *b)
{
    return ((*(DATA *)a).a - (*(DATA *)b).a);
}

int comp2(const void *a, const void *b)
{
    return ((*(DATA *)a).no - (*(DATA *)b).no);
}

int main(void)
{
    int N, Q, x, y;
    int diff;
    int i;
    int out;
    DATA tmp;
    int sort_flag;
    
    
    scanf("%d", &N);
    for (i = 0; i < N; i++){
        scanf("%d", &a[i].a);
        a[i].no = i;
    }
    
    qsort(a, N, sizeof(DATA), comp1);
    for (i = 0; i < N; i++){
        a[i].order = i;
    }
    
    qsort(a, N, sizeof(DATA), comp2);
    
//for (i = 0; i < N; i++){
//    printf("%d:%d:%d ", a[i].no, a[i].a, a[i].order);
//}
//printf("\n");
    
    diff = 0;
    for (i = 0; i < N; i++){
        if (a[i].no != a[i].order){
            diff++;
        }
    }

    sort_flag = 0;
    for (i = 0; i < N - 1; i++){
        if (a[i].a > a[i + 1].a){
            sort_flag = 1;
            break;
        }
    }
    
    if (sort_flag == 0){
        out = 0;
    }
    else {
        out = -1;
    }

    scanf("%d", &Q);
    for (i = 0; i < Q; i++){
        scanf("%d%d", &x, &y);
        x--;
        y--;

        if (out != -1){
            continue;
        }
        
        if (x == a[y].order){
            diff--;
        }
        if (y == a[x].order){
            diff--;
        }
        if (x == a[x].order){
            diff++;
        }
        if (y == a[y].order){
            diff++;
        }
        
        tmp = a[x];
        a[x] = a[y];
        a[y] = tmp;
        
        if (diff == 0){
            out = i + 1;
        }
    }
    
    printf("%d\n", out);
    
    return (0);
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	a
	.bss
	.align 32
	.type	a, @object
	.size	a, 3600000
a:
	.zero	3600000
	.text
	.globl	comp1
	.type	comp1, @function
comp1:
.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, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-8(%rbp), %rax
	movl	(%rax), %edx
	movq	-16(%rbp), %rax
	movl	(%rax), %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	comp1, .-comp1
	.globl	comp2
	.type	comp2, @function
comp2:
.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, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-8(%rbp), %rax
	movl	4(%rax), %edx
	movq	-16(%rbp), %rax
	movl	4(%rax), %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	comp2, .-comp2
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d%d"
.LC2:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$64, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-52(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -32(%rbp)
	jmp	.L6
.L7:
	movl	-32(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	leaq	a(%rip), %rdx
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-32(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rcx
	leaq	4+a(%rip), %rdx
	movl	-32(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	addl	$1, -32(%rbp)
.L6:
	movl	-52(%rbp), %eax
	cmpl	%eax, -32(%rbp)
	jl	.L7
	movl	-52(%rbp), %eax
	cltq
	leaq	comp1(%rip), %rdx
	movq	%rdx, %rcx
	movl	$12, %edx
	movq	%rax, %rsi
	leaq	a(%rip), %rax
	movq	%rax, %rdi
	call	qsort@PLT
	movl	$0, -32(%rbp)
	jmp	.L8
.L9:
	movl	-32(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rcx
	leaq	8+a(%rip), %rdx
	movl	-32(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	addl	$1, -32(%rbp)
.L8:
	movl	-52(%rbp), %eax
	cmpl	%eax, -32(%rbp)
	jl	.L9
	movl	-52(%rbp), %eax
	cltq
	leaq	comp2(%rip), %rdx
	movq	%rdx, %rcx
	movl	$12, %edx
	movq	%rax, %rsi
	leaq	a(%rip), %rax
	movq	%rax, %rdi
	call	qsort@PLT
	movl	$0, -36(%rbp)
	movl	$0, -32(%rbp)
	jmp	.L10
.L12:
	movl	-32(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	leaq	4+a(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	-32(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	leaq	8+a(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, %ecx
	je	.L11
	addl	$1, -36(%rbp)
.L11:
	addl	$1, -32(%rbp)
.L10:
	movl	-52(%rbp), %eax
	cmpl	%eax, -32(%rbp)
	jl	.L12
	movl	$0, -24(%rbp)
	movl	$0, -32(%rbp)
	jmp	.L13
.L16:
	movl	-32(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	-32(%rbp), %eax
	addl	$1, %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, %ecx
	jle	.L14
	movl	$1, -24(%rbp)
	jmp	.L15
.L14:
	addl	$1, -32(%rbp)
.L13:
	movl	-52(%rbp), %eax
	subl	$1, %eax
	cmpl	%eax, -32(%rbp)
	jl	.L16
.L15:
	cmpl	$0, -24(%rbp)
	jne	.L17
	movl	$0, -28(%rbp)
	jmp	.L18
.L17:
	movl	$-1, -28(%rbp)
.L18:
	leaq	-48(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -32(%rbp)
	jmp	.L19
.L26:
	leaq	-40(%rbp), %rdx
	leaq	-44(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-44(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -44(%rbp)
	movl	-40(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -40(%rbp)
	cmpl	$-1, -28(%rbp)
	jne	.L29
	movl	-40(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	leaq	8+a(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-44(%rbp), %eax
	cmpl	%eax, %edx
	jne	.L22
	subl	$1, -36(%rbp)
.L22:
	movl	-44(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	leaq	8+a(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-40(%rbp), %eax
	cmpl	%eax, %edx
	jne	.L23
	subl	$1, -36(%rbp)
.L23:
	movl	-44(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	leaq	8+a(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-44(%rbp), %eax
	cmpl	%eax, %edx
	jne	.L24
	addl	$1, -36(%rbp)
.L24:
	movl	-40(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	leaq	8+a(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-40(%rbp), %eax
	cmpl	%eax, %edx
	jne	.L25
	addl	$1, -36(%rbp)
.L25:
	movl	-44(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rcx
	movq	%rcx, -20(%rbp)
	movl	8(%rdx,%rax), %eax
	movl	%eax, -12(%rbp)
	movl	-40(%rbp), %esi
	movl	-44(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rcx
	leaq	a(%rip), %rdx
	movslq	%esi, %rsi
	movq	%rsi, %rax
	addq	%rax, %rax
	addq	%rsi, %rax
	salq	$2, %rax
	movq	%rax, %rsi
	leaq	a(%rip), %rax
	movq	(%rsi,%rax), %rdi
	movq	%rdi, (%rcx,%rdx)
	movl	8(%rsi,%rax), %eax
	movl	%eax, 8(%rcx,%rdx)
	movl	-40(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	leaq	a(%rip), %rax
	movq	-20(%rbp), %rcx
	movq	%rcx, (%rdx,%rax)
	movl	-12(%rbp), %ecx
	movl	%ecx, 8(%rdx,%rax)
	cmpl	$0, -36(%rbp)
	jne	.L21
	movl	-32(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -28(%rbp)
	jmp	.L21
.L29:
	nop
.L21:
	addl	$1, -32(%rbp)
.L19:
	movl	-48(%rbp), %eax
	cmpl	%eax, -32(%rbp)
	jl	.L26
	movl	-28(%rbp), %eax
	movl	%eax, %esi
	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	.L28
	call	__stack_chk_fail@PLT
.L28:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.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	a
	.bss
	.align 32
	.type	a, @object
	.size	a, 3600000
a:
	.zero	3600000
	.text
	.globl	comp1
	.type	comp1, @function
comp1:
.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, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-8(%rbp), %rax
	movl	(%rax), %edx
	movq	-16(%rbp), %rax
	movl	(%rax), %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	comp1, .-comp1
	.globl	comp2
	.type	comp2, @function
comp2:
.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, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-8(%rbp), %rax
	movl	4(%rax), %edx
	movq	-16(%rbp), %rax
	movl	4(%rax), %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	comp2, .-comp2
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d%d"
.LC2:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$64, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-52(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -32(%rbp)
	jmp	.L6
.L7:
	movl	-32(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	leaq	a(%rip), %rdx
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-32(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rcx
	leaq	4+a(%rip), %rdx
	movl	-32(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	addl	$1, -32(%rbp)
.L6:
	movl	-52(%rbp), %eax
	cmpl	%eax, -32(%rbp)
	jl	.L7
	movl	-52(%rbp), %eax
	cltq
	leaq	comp1(%rip), %rdx
	movq	%rdx, %rcx
	movl	$12, %edx
	movq	%rax, %rsi
	leaq	a(%rip), %rax
	movq	%rax, %rdi
	call	qsort@PLT
	movl	$0, -32(%rbp)
	jmp	.L8
.L9:
	movl	-32(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rcx
	leaq	8+a(%rip), %rdx
	movl	-32(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	addl	$1, -32(%rbp)
.L8:
	movl	-52(%rbp), %eax
	cmpl	%eax, -32(%rbp)
	jl	.L9
	movl	-52(%rbp), %eax
	cltq
	leaq	comp2(%rip), %rdx
	movq	%rdx, %rcx
	movl	$12, %edx
	movq	%rax, %rsi
	leaq	a(%rip), %rax
	movq	%rax, %rdi
	call	qsort@PLT
	movl	$0, -36(%rbp)
	movl	$0, -32(%rbp)
	jmp	.L10
.L12:
	movl	-32(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	leaq	4+a(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	-32(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	leaq	8+a(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, %ecx
	je	.L11
	addl	$1, -36(%rbp)
.L11:
	addl	$1, -32(%rbp)
.L10:
	movl	-52(%rbp), %eax
	cmpl	%eax, -32(%rbp)
	jl	.L12
	movl	$0, -24(%rbp)
	movl	$0, -32(%rbp)
	jmp	.L13
.L16:
	movl	-32(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	-32(%rbp), %eax
	addl	$1, %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, %ecx
	jle	.L14
	movl	$1, -24(%rbp)
	jmp	.L15
.L14:
	addl	$1, -32(%rbp)
.L13:
	movl	-52(%rbp), %eax
	subl	$1, %eax
	cmpl	%eax, -32(%rbp)
	jl	.L16
.L15:
	cmpl	$0, -24(%rbp)
	jne	.L17
	movl	$0, -28(%rbp)
	jmp	.L18
.L17:
	movl	$-1, -28(%rbp)
.L18:
	leaq	-48(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -32(%rbp)
	jmp	.L19
.L26:
	leaq	-40(%rbp), %rdx
	leaq	-44(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-44(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -44(%rbp)
	movl	-40(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -40(%rbp)
	cmpl	$-1, -28(%rbp)
	jne	.L29
	movl	-40(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	leaq	8+a(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-44(%rbp), %eax
	cmpl	%eax, %edx
	jne	.L22
	subl	$1, -36(%rbp)
.L22:
	movl	-44(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	leaq	8+a(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-40(%rbp), %eax
	cmpl	%eax, %edx
	jne	.L23
	subl	$1, -36(%rbp)
.L23:
	movl	-44(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	leaq	8+a(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-44(%rbp), %eax
	cmpl	%eax, %edx
	jne	.L24
	addl	$1, -36(%rbp)
.L24:
	movl	-40(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	leaq	8+a(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-40(%rbp), %eax
	cmpl	%eax, %edx
	jne	.L25
	addl	$1, -36(%rbp)
.L25:
	movl	-44(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rcx
	movq	%rcx, -20(%rbp)
	movl	8(%rdx,%rax), %eax
	movl	%eax, -12(%rbp)
	movl	-40(%rbp), %esi
	movl	-44(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rcx
	leaq	a(%rip), %rdx
	movslq	%esi, %rsi
	movq	%rsi, %rax
	addq	%rax, %rax
	addq	%rsi, %rax
	salq	$2, %rax
	movq	%rax, %rsi
	leaq	a(%rip), %rax
	movq	(%rsi,%rax), %rdi
	movq	%rdi, (%rcx,%rdx)
	movl	8(%rsi,%rax), %eax
	movl	%eax, 8(%rcx,%rdx)
	movl	-40(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	leaq	a(%rip), %rax
	movq	-20(%rbp), %rcx
	movq	%rcx, (%rdx,%rax)
	movl	-12(%rbp), %ecx
	movl	%ecx, 8(%rdx,%rax)
	cmpl	$0, -36(%rbp)
	jne	.L21
	movl	-32(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -28(%rbp)
	jmp	.L21
.L29:
	nop
.L21:
	addl	$1, -32(%rbp)
.L19:
	movl	-48(%rbp), %eax
	cmpl	%eax, -32(%rbp)
	jl	.L26
	movl	-28(%rbp), %eax
	movl	%eax, %esi
	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	.L28
	call	__stack_chk_fail@PLT
.L28:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.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:
