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>
#include<string.h>

#define Min(a,b) ((a)<(b)?(a):(b))

int cmp(const void *ax, const void *ay){
	unsigned long x = *(unsigned long *)ax;
	unsigned long y = *(unsigned long *)ay;

	if(x > y) return -1;
	if(x < y) return 1;
	if(x = y) return 0;
}

unsigned long sub2(unsigned long **V, unsigned int *n, unsigned long W, unsigned long base, unsigned int ofs){
	unsigned int i,  N;	
	unsigned long sum = 0, tmp, w;
	w = base+ofs;
	N = Min(n[ofs], (unsigned int)(W/w+1));

	if(ofs == 0) return V[0][N-1];

	for(i = 0; i < N; i++){
		tmp = V[ofs][i] + sub2(V, n, W-w*i, base, ofs-1); 
		if(sum < tmp) sum = tmp;
	}

	return sum;
}

unsigned long sub1(unsigned int N, unsigned long W, unsigned long *w, unsigned long *v){
	unsigned int i, n[4], diff;
	unsigned long *V[4], Vmax;

	for(diff = 0; diff < 4; diff++){
		V[diff] = (unsigned long *)malloc(sizeof(unsigned long) * (N+1));
		if(V[diff] == NULL) exit(1);
		V[diff][0] = 0;
		n[diff] = 1;
	}
		
	for(i = 0; i < N; i++){
		diff = (unsigned int)(w[i] - w[0]);
		V[diff][n[diff]] = v[i];
		n[diff]++;
	}
	for(diff = 0; diff < 4; diff++){
		qsort(&V[diff][1], n[diff]-1, sizeof(unsigned long), cmp);
		for(i = 1; i < n[diff]; i++) V[diff][i] += V[diff][i-1];
	}
	
	Vmax = sub2(V, n, W, w[0], 3);
	for(diff = 0; diff < 4; diff++) free(V[diff]);
	return Vmax;
}

int main(){
	unsigned int N, i;
	unsigned long W, *w, *v;
	char line[64];

	fgets(line, 64, stdin);
	sscanf(line, "%u %lu", &N, &W);

	w = (long *)malloc(sizeof(long) * N);
	v = (long *)malloc(sizeof(long) * N);
	if((w == NULL)||(v == NULL)) exit(1);
	for(i = 0; i < N; i++){
		fgets(line, 64, stdin);
		sscanf(line, "%lu %lu", w+i, v+i);
	}

	printf("%lu\n", sub1(N, W, w, v));

	free(w);
	free(v);
	return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	cmp
	.type	cmp, @function
cmp:
.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
	movq	(%rax), %rax
	movq	%rax, -16(%rbp)
	movq	-32(%rbp), %rax
	movq	(%rax), %rax
	movq	%rax, -8(%rbp)
	movq	-16(%rbp), %rax
	cmpq	-8(%rbp), %rax
	jbe	.L2
	movl	$-1, %eax
	jmp	.L1
.L2:
	movq	-16(%rbp), %rax
	cmpq	-8(%rbp), %rax
	jnb	.L4
	movl	$1, %eax
	jmp	.L1
.L4:
	movq	-8(%rbp), %rax
	movq	%rax, -16(%rbp)
	cmpq	$0, -16(%rbp)
	je	.L5
	movl	$0, %eax
	jmp	.L1
.L5:
.L1:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	cmp, .-cmp
	.globl	sub2
	.type	sub2, @function
sub2:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%rbx
	subq	$88, %rsp
	.cfi_offset 3, -24
	movq	%rdi, -56(%rbp)
	movq	%rsi, -64(%rbp)
	movq	%rdx, -72(%rbp)
	movq	%rcx, -80(%rbp)
	movl	%r8d, -84(%rbp)
	movq	$0, -40(%rbp)
	movl	-84(%rbp), %edx
	movq	-80(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, -32(%rbp)
	movq	-72(%rbp), %rax
	movl	$0, %edx
	divq	-32(%rbp)
	leal	1(%rax), %edx
	movl	-84(%rbp), %eax
	leaq	0(,%rax,4), %rcx
	movq	-64(%rbp), %rax
	addq	%rcx, %rax
	movl	(%rax), %eax
	cmpl	%eax, %edx
	cmovbe	%edx, %eax
	movl	%eax, -44(%rbp)
	cmpl	$0, -84(%rbp)
	jne	.L7
	movq	-56(%rbp), %rax
	movq	(%rax), %rdx
	movl	-44(%rbp), %eax
	subl	$1, %eax
	movl	%eax, %eax
	salq	$3, %rax
	addq	%rdx, %rax
	movq	(%rax), %rax
	jmp	.L8
.L7:
	movl	$0, -48(%rbp)
	jmp	.L9
.L11:
	movl	-84(%rbp), %eax
	leaq	0(,%rax,8), %rdx
	movq	-56(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-48(%rbp), %eax
	salq	$3, %rax
	addq	%rdx, %rax
	movq	(%rax), %rbx
	movl	-84(%rbp), %eax
	leal	-1(%rax), %ecx
	movl	-48(%rbp), %eax
	imulq	-32(%rbp), %rax
	movq	%rax, %rdx
	movq	-72(%rbp), %rax
	subq	%rdx, %rax
	movq	%rax, %rdi
	movq	-80(%rbp), %rdx
	movq	-64(%rbp), %rsi
	movq	-56(%rbp), %rax
	movl	%ecx, %r8d
	movq	%rdx, %rcx
	movq	%rdi, %rdx
	movq	%rax, %rdi
	call	sub2
	addq	%rbx, %rax
	movq	%rax, -24(%rbp)
	movq	-40(%rbp), %rax
	cmpq	-24(%rbp), %rax
	jnb	.L10
	movq	-24(%rbp), %rax
	movq	%rax, -40(%rbp)
.L10:
	addl	$1, -48(%rbp)
.L9:
	movl	-48(%rbp), %eax
	cmpl	-44(%rbp), %eax
	jb	.L11
	movq	-40(%rbp), %rax
.L8:
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	sub2, .-sub2
	.globl	sub1
	.type	sub1, @function
sub1:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$112, %rsp
	movl	%edi, -84(%rbp)
	movq	%rsi, -96(%rbp)
	movq	%rdx, -104(%rbp)
	movq	%rcx, -112(%rbp)
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, -76(%rbp)
	jmp	.L13
.L15:
	movl	-84(%rbp), %eax
	addl	$1, %eax
	movl	%eax, %eax
	salq	$3, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, %rdx
	movl	-76(%rbp), %eax
	movq	%rdx, -48(%rbp,%rax,8)
	movl	-76(%rbp), %eax
	movq	-48(%rbp,%rax,8), %rax
	testq	%rax, %rax
	jne	.L14
	movl	$1, %edi
	call	exit@PLT
.L14:
	movl	-76(%rbp), %eax
	movq	-48(%rbp,%rax,8), %rax
	movq	$0, (%rax)
	movl	-76(%rbp), %eax
	movl	$1, -64(%rbp,%rax,4)
	addl	$1, -76(%rbp)
.L13:
	cmpl	$3, -76(%rbp)
	jbe	.L15
	movl	$0, -80(%rbp)
	jmp	.L16
.L17:
	movl	-80(%rbp), %eax
	leaq	0(,%rax,8), %rdx
	movq	-104(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rax
	movl	%eax, %edx
	movq	-104(%rbp), %rax
	movq	(%rax), %rax
	movl	%eax, %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	movl	%eax, -76(%rbp)
	movl	-80(%rbp), %eax
	leaq	0(,%rax,8), %rdx
	movq	-112(%rbp), %rax
	leaq	(%rdx,%rax), %rcx
	movl	-76(%rbp), %eax
	movq	-48(%rbp,%rax,8), %rdx
	movl	-76(%rbp), %eax
	movl	-64(%rbp,%rax,4), %eax
	movl	%eax, %eax
	salq	$3, %rax
	addq	%rax, %rdx
	movq	(%rcx), %rax
	movq	%rax, (%rdx)
	movl	-76(%rbp), %eax
	movl	-64(%rbp,%rax,4), %eax
	leal	1(%rax), %edx
	movl	-76(%rbp), %eax
	movl	%edx, -64(%rbp,%rax,4)
	addl	$1, -80(%rbp)
.L16:
	movl	-80(%rbp), %eax
	cmpl	-84(%rbp), %eax
	jb	.L17
	movl	$0, -76(%rbp)
	jmp	.L18
.L21:
	movl	-76(%rbp), %eax
	movl	-64(%rbp,%rax,4), %eax
	subl	$1, %eax
	movl	%eax, %esi
	movl	-76(%rbp), %eax
	movq	-48(%rbp,%rax,8), %rax
	addq	$8, %rax
	leaq	cmp(%rip), %rdx
	movq	%rdx, %rcx
	movl	$8, %edx
	movq	%rax, %rdi
	call	qsort@PLT
	movl	$1, -80(%rbp)
	jmp	.L19
.L20:
	movl	-76(%rbp), %eax
	movq	-48(%rbp,%rax,8), %rdx
	movl	-80(%rbp), %eax
	salq	$3, %rax
	addq	%rdx, %rax
	movq	(%rax), %rcx
	movl	-76(%rbp), %eax
	movq	-48(%rbp,%rax,8), %rdx
	movl	-80(%rbp), %eax
	subl	$1, %eax
	movl	%eax, %eax
	salq	$3, %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-76(%rbp), %eax
	movq	-48(%rbp,%rax,8), %rsi
	movl	-80(%rbp), %eax
	salq	$3, %rax
	addq	%rsi, %rax
	addq	%rcx, %rdx
	movq	%rdx, (%rax)
	addl	$1, -80(%rbp)
.L19:
	movl	-76(%rbp), %eax
	movl	-64(%rbp,%rax,4), %eax
	cmpl	%eax, -80(%rbp)
	jb	.L20
	addl	$1, -76(%rbp)
.L18:
	cmpl	$3, -76(%rbp)
	jbe	.L21
	movq	-104(%rbp), %rax
	movq	(%rax), %rcx
	movq	-96(%rbp), %rdx
	leaq	-64(%rbp), %rsi
	leaq	-48(%rbp), %rax
	movl	$3, %r8d
	movq	%rax, %rdi
	call	sub2
	movq	%rax, -72(%rbp)
	movl	$0, -76(%rbp)
	jmp	.L22
.L23:
	movl	-76(%rbp), %eax
	movq	-48(%rbp,%rax,8), %rax
	movq	%rax, %rdi
	call	free@PLT
	addl	$1, -76(%rbp)
.L22:
	cmpl	$3, -76(%rbp)
	jbe	.L23
	movq	-72(%rbp), %rax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L25
	call	__stack_chk_fail@PLT
.L25:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	sub1, .-sub1
	.section	.rodata
.LC0:
	.string	"%u %lu"
.LC1:
	.string	"%lu %lu"
.LC2:
	.string	"%lu\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB9:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$112, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movq	stdin(%rip), %rdx
	leaq	-80(%rbp), %rax
	movl	$64, %esi
	movq	%rax, %rdi
	call	fgets@PLT
	leaq	-104(%rbp), %rcx
	leaq	-112(%rbp), %rdx
	leaq	-80(%rbp), %rax
	leaq	.LC0(%rip), %rsi
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_sscanf@PLT
	movl	-112(%rbp), %eax
	movl	%eax, %eax
	salq	$3, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -96(%rbp)
	movl	-112(%rbp), %eax
	movl	%eax, %eax
	salq	$3, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -88(%rbp)
	cmpq	$0, -96(%rbp)
	je	.L27
	cmpq	$0, -88(%rbp)
	jne	.L28
.L27:
	movl	$1, %edi
	call	exit@PLT
.L28:
	movl	$0, -108(%rbp)
	jmp	.L29
.L30:
	movq	stdin(%rip), %rdx
	leaq	-80(%rbp), %rax
	movl	$64, %esi
	movq	%rax, %rdi
	call	fgets@PLT
	movl	-108(%rbp), %eax
	leaq	0(,%rax,8), %rdx
	movq	-88(%rbp), %rax
	leaq	(%rdx,%rax), %rcx
	movl	-108(%rbp), %eax
	leaq	0(,%rax,8), %rdx
	movq	-96(%rbp), %rax
	addq	%rax, %rdx
	leaq	-80(%rbp), %rax
	leaq	.LC1(%rip), %rsi
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_sscanf@PLT
	addl	$1, -108(%rbp)
.L29:
	movl	-112(%rbp), %eax
	cmpl	%eax, -108(%rbp)
	jb	.L30
	movq	-104(%rbp), %rsi
	movl	-112(%rbp), %eax
	movq	-88(%rbp), %rcx
	movq	-96(%rbp), %rdx
	movl	%eax, %edi
	call	sub1
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movq	-96(%rbp), %rax
	movq	%rax, %rdi
	call	free@PLT
	movq	-88(%rbp), %rax
	movq	%rax, %rdi
	call	free@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L32
	call	__stack_chk_fail@PLT
.L32:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.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	cmp
	.type	cmp, @function
cmp:
.LFB51:
	.cfi_startproc
	endbr64
	movq	(%rsi), %rdx
	movl	$-1, %eax
	cmpq	%rdx, (%rdi)
	ja	.L1
	movl	$1, %eax
	jb	.L1
	xorl	%eax, %eax
.L1:
	ret
	.cfi_endproc
.LFE51:
	.size	cmp, .-cmp
	.p2align 4
	.globl	sub2
	.type	sub2, @function
sub2:
.LFB52:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movq	%rsi, %r9
	movq	%rdx, %rax
	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	$664, %rsp
	.cfi_def_cfa_offset 720
	movq	%rsi, 128(%rsp)
	movl	%r8d, %esi
	leaq	(%rsi,%rcx), %rbx
	movq	%rdx, 512(%rsp)
	xorl	%edx, %edx
	divq	%rbx
	movl	(%r9,%rsi,4), %edx
	movq	%rbx, 584(%rsp)
	addl	$1, %eax
	cmpl	%edx, %eax
	cmova	%edx, %eax
	testl	%r8d, %r8d
	je	.L8
	testl	%eax, %eax
	je	.L62
	leal	-1(%r8), %edx
	movq	%r9, %rbx
	leal	-2(%r8), %r14d
	subl	$1, %eax
	movl	(%r9,%rdx,4), %r9d
	movl	%r14d, 532(%rsp)
	movq	%r14, 600(%rsp)
	movl	%r9d, 640(%rsp)
	leaq	(%rdi,%rdx,8), %r9
	movq	%r9, 592(%rsp)
	leaq	(%rbx,%r14,4), %r9
	leaq	(%rdi,%r14,8), %r14
	movq	%r9, 608(%rsp)
	leal	-3(%r8), %r9d
	movq	%r14, 616(%rsp)
	leaq	(%rbx,%r9,4), %r14
	movl	%r9d, 484(%rsp)
	movq	%r9, 624(%rsp)
	leaq	(%rdi,%r9,8), %r9
	movq	%r14, 632(%rsp)
	leal	-4(%r8), %r14d
	movq	%r9, 536(%rsp)
	leaq	(%rbx,%r14,4), %r9
	movl	%r14d, 480(%rsp)
	movq	%r14, 544(%rsp)
	leaq	(%rdi,%r14,8), %r14
	movq	%r9, 552(%rsp)
	leal	-5(%r8), %r9d
	movq	%r14, 432(%rsp)
	leaq	(%rbx,%r9,4), %r14
	movl	%r9d, 368(%rsp)
	movq	%r9, 440(%rsp)
	leaq	(%rdi,%r9,8), %r9
	movq	%r14, 448(%rsp)
	leal	-6(%r8), %r14d
	movq	%r9, 336(%rsp)
	leaq	(%rbx,%r14,4), %r9
	movl	%r14d, 224(%rsp)
	movq	%r14, 344(%rsp)
	leaq	(%rdi,%r14,8), %r14
	movq	%r9, 352(%rsp)
	leal	-7(%r8), %r9d
	movq	%r14, 240(%rsp)
	leaq	(%rbx,%r9,4), %r14
	movq	%r14, 248(%rsp)
	leal	-8(%r8), %r14d
	subl	$9, %r8d
	leaq	(%rbx,%r14,4), %rbx
	movl	%edx, 580(%rsp)
	addq	%rcx, %rdx
	movl	%r9d, 644(%rsp)
	movq	%r9, 360(%rsp)
	leaq	(%rdi,%r9,8), %r9
	movq	%rbx, 80(%rsp)
	leaq	(%rdi,%r14,8), %rbx
	movq	%r9, 72(%rsp)
	movl	%r14d, 228(%rsp)
	movq	%r14, 256(%rsp)
	movq	%rbx, 288(%rsp)
	movq	%rdx, 496(%rsp)
	movq	(%rdi,%rsi,8), %rdx
	movq	$0, 472(%rsp)
	leaq	8(%rdx), %rsi
	leaq	(%rsi,%rax,8), %rax
	movq	%rsi, 568(%rsp)
	movq	%rax, 648(%rsp)
.L43:
	movq	(%rdx), %rax
	xorl	%edx, %edx
	movl	580(%rsp), %r12d
	movq	%rax, 504(%rsp)
	movq	512(%rsp), %rax
	divq	496(%rsp)
	movl	640(%rsp), %edx
	addl	$1, %eax
	cmpl	%edx, %eax
	cmova	%edx, %eax
	testl	%r12d, %r12d
	je	.L11
	testl	%eax, %eax
	je	.L13
	movq	608(%rsp), %rdx
	subl	$1, %eax
	movq	$0, 424(%rsp)
	movl	(%rdx), %edx
	movl	%edx, 576(%rsp)
	movq	600(%rsp), %rdx
	leaq	(%rcx,%rdx), %rsi
	movq	%rsi, 416(%rsp)
	movq	592(%rsp), %rsi
	movq	(%rsi), %rdx
	leaq	8(%rdx), %rbx
	leaq	(%rbx,%rax,8), %rax
	movq	%rbx, 520(%rsp)
	movq	%rax, 560(%rsp)
	movq	512(%rsp), %rax
	movq	%rax, 456(%rsp)
.L42:
	movq	(%rdx), %rax
	xorl	%edx, %edx
	movl	532(%rsp), %ebp
	movq	%rax, 464(%rsp)
	movq	456(%rsp), %rax
	divq	416(%rsp)
	movl	576(%rsp), %edx
	addl	$1, %eax
	cmpl	%edx, %eax
	cmova	%edx, %eax
	testl	%ebp, %ebp
	je	.L14
	testl	%eax, %eax
	je	.L16
	movq	632(%rsp), %rbx
	subl	$1, %eax
	movq	$0, 400(%rsp)
	movl	(%rbx), %edx
	movq	624(%rsp), %rbx
	movl	%edx, 528(%rsp)
	movq	616(%rsp), %rdx
	leaq	(%rcx,%rbx), %rsi
	movq	%rsi, 328(%rsp)
	movq	(%rdx), %rdx
	leaq	8(%rdx), %rsi
	leaq	(%rsi,%rax,8), %rax
	movq	%rsi, 408(%rsp)
	movq	%rax, 488(%rsp)
	movq	456(%rsp), %rax
	movq	%rax, 384(%rsp)
.L41:
	movq	(%rdx), %rax
	xorl	%edx, %edx
	movl	484(%rsp), %ebx
	movq	%rax, 392(%rsp)
	movq	384(%rsp), %rax
	divq	328(%rsp)
	movl	528(%rsp), %edx
	addl	$1, %eax
	cmpl	%edx, %eax
	cmova	%edx, %eax
	testl	%ebx, %ebx
	je	.L17
	testl	%eax, %eax
	je	.L19
	movq	552(%rsp), %rdx
	subl	$1, %eax
	movq	$0, 312(%rsp)
	movl	(%rdx), %esi
	movq	544(%rsp), %rdx
	movl	%esi, 372(%rsp)
	movq	536(%rsp), %rsi
	leaq	(%rcx,%rdx), %rbx
	movq	%rbx, 232(%rsp)
	movq	(%rsi), %rdx
	leaq	8(%rdx), %rsi
	leaq	(%rsi,%rax,8), %rax
	movq	%rsi, 320(%rsp)
	movq	%rax, 376(%rsp)
	movq	384(%rsp), %rax
	movq	%rax, 304(%rsp)
.L40:
	movq	(%rdx), %rax
	xorl	%edx, %edx
	movl	480(%rsp), %r11d
	movq	%rax, 296(%rsp)
	movq	304(%rsp), %rax
	divq	232(%rsp)
	movl	372(%rsp), %edx
	addl	$1, %eax
	cmpl	%edx, %eax
	cmova	%edx, %eax
	testl	%r11d, %r11d
	je	.L20
	testl	%eax, %eax
	je	.L22
	movq	448(%rsp), %rbx
	subl	$1, %eax
	movq	$0, 144(%rsp)
	movl	(%rbx), %edx
	movl	%edx, 276(%rsp)
	movq	440(%rsp), %rdx
	leaq	(%rcx,%rdx), %rbx
	movq	%rbx, 64(%rsp)
	movq	432(%rsp), %rbx
	movq	(%rbx), %rdx
	leaq	8(%rdx), %rsi
	leaq	(%rsi,%rax,8), %rax
	movq	%rsi, 216(%rsp)
	movq	%rax, 280(%rsp)
	movq	304(%rsp), %rax
	movq	%rax, 120(%rsp)
.L39:
	movq	(%rdx), %rax
	xorl	%edx, %edx
	movl	276(%rsp), %ebx
	movl	368(%rsp), %r10d
	movq	%rax, 112(%rsp)
	movq	120(%rsp), %rax
	divq	64(%rsp)
	addl	$1, %eax
	cmpl	%ebx, %eax
	cmova	%ebx, %eax
	testl	%r10d, %r10d
	je	.L23
	testl	%eax, %eax
	je	.L25
	movq	352(%rsp), %rdx
	subl	$1, %eax
	movq	344(%rsp), %rsi
	movq	$0, 16(%rsp)
	movl	(%rdx), %ebx
	leaq	(%rcx,%rsi), %rdx
	movq	%rdx, 88(%rsp)
	movl	%ebx, 100(%rsp)
	movq	336(%rsp), %rbx
	movq	(%rbx), %rdx
	leaq	8(%rdx), %r12
	leaq	(%r12,%rax,8), %rax
	movq	%r12, 40(%rsp)
	movq	%rax, 104(%rsp)
	movq	120(%rsp), %rax
	movq	%rax, (%rsp)
	movq	360(%rsp), %rax
	addq	%rcx, %rax
	movq	%rax, 152(%rsp)
.L38:
	movq	(%rsp), %rax
	movq	(%rdx), %r10
	xorl	%edx, %edx
	movl	100(%rsp), %esi
	movl	224(%rsp), %r9d
	divq	88(%rsp)
	addl	$1, %eax
	cmpl	%esi, %eax
	cmova	%esi, %eax
	testl	%r9d, %r9d
	je	.L26
	testl	%eax, %eax
	je	.L28
	movq	248(%rsp), %rbx
	subl	$1, %eax
	movq	240(%rsp), %rsi
	movq	$0, 136(%rsp)
	movq	%r10, 160(%rsp)
	movq	%rdi, %r15
	movl	(%rbx), %edx
	movl	%edx, 272(%rsp)
	movq	(%rsi), %rdx
	leaq	8(%rdx), %r11
	leaq	(%r11,%rax,8), %rax
	movq	%rax, 264(%rsp)
	movq	(%rsp), %rax
	movq	%rax, 48(%rsp)
	movq	256(%rsp), %rax
	addq	%rcx, %rax
	movq	%rax, 8(%rsp)
.L37:
	movq	48(%rsp), %rax
	movq	(%rdx), %r10
	xorl	%edx, %edx
	movl	644(%rsp), %esi
	divq	152(%rsp)
	leal	1(%rax), %edx
	movl	272(%rsp), %eax
	cmpl	%eax, %edx
	cmova	%eax, %edx
	testl	%esi, %esi
	je	.L29
	testl	%edx, %edx
	je	.L31
	movq	80(%rsp), %rax
	movq	48(%rsp), %r12
	subl	$1, %edx
	xorl	%r9d, %r9d
	movl	(%rax), %eax
	movq	%r12, %r13
	movl	%eax, 96(%rsp)
	movq	72(%rsp), %rax
	movq	(%rax), %rax
	leaq	8(%rax), %rbx
	leaq	(%rbx,%rdx,8), %rdi
	movq	%rdi, 32(%rsp)
	movq	%r15, %rdi
.L36:
	xorl	%edx, %edx
	movq	(%rax), %rbp
	movq	%r13, %rax
	movl	96(%rsp), %esi
	divq	8(%rsp)
	movl	228(%rsp), %edx
	addl	$1, %eax
	cmpl	%esi, %eax
	cmova	%esi, %eax
	testl	%edx, %edx
	je	.L32
	testl	%eax, %eax
	je	.L34
	movq	288(%rsp), %rdx
	subl	$1, %eax
	movq	%r9, 168(%rsp)
	xorl	%r12d, %r12d
	movq	%r10, 192(%rsp)
	movq	(%rdx), %r15
	movq	%r11, 200(%rsp)
	movq	%r13, %rdx
	movq	%r13, 176(%rsp)
	movq	%rcx, %r13
	leaq	8(%r15), %r14
	movq	%rbp, 184(%rsp)
	movq	%rdi, %rbp
	leaq	(%r14,%rax,8), %rax
	movq	%rbx, 208(%rsp)
	movq	%r15, %rbx
	movq	%rdx, %r15
	movq	%rax, 56(%rsp)
.L35:
	movq	%r15, %rdx
	movq	%r13, %rcx
	movq	%rbp, %rdi
	movl	%r8d, 28(%rsp)
	movq	128(%rsp), %rsi
	call	sub2
	addq	(%rbx), %rax
	movl	28(%rsp), %r8d
	movq	%r14, %rbx
	cmpq	%rax, %r12
	cmovb	%rax, %r12
	subq	8(%rsp), %r15
	cmpq	%r14, 56(%rsp)
	je	.L53
	addq	$8, %r14
	jmp	.L35
	.p2align 4,,10
	.p2align 3
.L32:
	leal	-1(%rax), %edx
	movq	(%rdi), %rax
	addq	(%rax,%rdx,8), %rbp
.L34:
	cmpq	%rbp, %r9
	movq	%rbx, %rax
	cmovb	%rbp, %r9
	subq	152(%rsp), %r13
	cmpq	%rbx, 32(%rsp)
	je	.L54
	addq	$8, %rbx
	jmp	.L36
	.p2align 4,,10
	.p2align 3
.L54:
	movq	%rdi, %r15
	addq	%r9, %r10
.L31:
	movq	136(%rsp), %rax
	movq	88(%rsp), %rdi
	movq	%r11, %rdx
	cmpq	%r10, %rax
	cmovnb	%rax, %r10
	subq	%rdi, 48(%rsp)
	movq	%r10, 136(%rsp)
	cmpq	%r11, 264(%rsp)
	je	.L55
	addq	$8, %r11
	jmp	.L37
	.p2align 4,,10
	.p2align 3
.L55:
	movq	160(%rsp), %r10
	movq	%r15, %rdi
	addq	136(%rsp), %r10
.L28:
	movq	16(%rsp), %rax
	movq	64(%rsp), %rbx
	cmpq	%r10, %rax
	cmovnb	%rax, %r10
	movq	40(%rsp), %rax
	subq	%rbx, (%rsp)
	movq	%r10, 16(%rsp)
	movq	%rax, %rdx
	cmpq	%rax, 104(%rsp)
	je	.L56
	addq	$8, %rax
	movq	%rax, 40(%rsp)
	jmp	.L38
	.p2align 4,,10
	.p2align 3
.L29:
	movq	(%r15), %rax
	subl	$1, %edx
	addq	(%rax,%rdx,8), %r10
	jmp	.L31
	.p2align 4,,10
	.p2align 3
.L53:
	movq	%rbp, %rdi
	movq	184(%rsp), %rbp
	movq	%r13, %rcx
	movq	168(%rsp), %r9
	movq	192(%rsp), %r10
	movq	176(%rsp), %r13
	movq	200(%rsp), %r11
	movq	208(%rsp), %rbx
	addq	%r12, %rbp
	jmp	.L34
	.p2align 4,,10
	.p2align 3
.L56:
	addq	%r10, 112(%rsp)
.L25:
	movq	144(%rsp), %rbx
	movq	112(%rsp), %rax
	cmpq	%rax, %rbx
	cmovnb	%rbx, %rax
	movq	232(%rsp), %rbx
	subq	%rbx, 120(%rsp)
	movq	%rax, 144(%rsp)
	movq	216(%rsp), %rax
	movq	%rax, %rdx
	cmpq	%rax, 280(%rsp)
	je	.L57
	addq	$8, %rax
	movq	%rax, 216(%rsp)
	jmp	.L39
	.p2align 4,,10
	.p2align 3
.L26:
	leal	-1(%rax), %edx
	movq	(%rdi), %rax
	addq	(%rax,%rdx,8), %r10
	jmp	.L28
.L57:
	movq	144(%rsp), %rdx
	addq	%rdx, 296(%rsp)
.L22:
	movq	312(%rsp), %rbx
	movq	296(%rsp), %rax
	cmpq	%rax, %rbx
	cmovnb	%rbx, %rax
	movq	328(%rsp), %rbx
	subq	%rbx, 304(%rsp)
	movq	%rax, 312(%rsp)
	movq	320(%rsp), %rax
	movq	%rax, %rdx
	cmpq	%rax, 376(%rsp)
	je	.L58
	addq	$8, %rax
	movq	%rax, 320(%rsp)
	jmp	.L40
.L23:
	leal	-1(%rax), %edx
	movq	(%rdi), %rax
	movq	(%rax,%rdx,8), %rax
	addq	%rax, 112(%rsp)
	jmp	.L25
.L58:
	movq	312(%rsp), %rbx
	addq	%rbx, 392(%rsp)
.L19:
	movq	400(%rsp), %rdx
	movq	392(%rsp), %rax
	movq	416(%rsp), %rsi
	cmpq	%rax, %rdx
	cmovnb	%rdx, %rax
	subq	%rsi, 384(%rsp)
	movq	%rax, 400(%rsp)
	movq	408(%rsp), %rax
	movq	%rax, %rdx
	cmpq	%rax, 488(%rsp)
	je	.L59
	addq	$8, %rax
	movq	%rax, 408(%rsp)
	jmp	.L41
.L20:
	leal	-1(%rax), %edx
	movq	(%rdi), %rax
	movq	(%rax,%rdx,8), %rax
	addq	%rax, 296(%rsp)
	jmp	.L22
.L59:
	movq	400(%rsp), %rsi
	addq	%rsi, 464(%rsp)
.L16:
	movq	424(%rsp), %rdx
	movq	464(%rsp), %rax
	movq	496(%rsp), %rsi
	cmpq	%rax, %rdx
	cmovnb	%rdx, %rax
	subq	%rsi, 456(%rsp)
	movq	%rax, 424(%rsp)
	movq	520(%rsp), %rax
	movq	%rax, %rdx
	cmpq	%rax, 560(%rsp)
	je	.L60
	addq	$8, %rax
	movq	%rax, 520(%rsp)
	jmp	.L42
.L17:
	leal	-1(%rax), %edx
	movq	(%rdi), %rax
	movq	(%rax,%rdx,8), %rax
	addq	%rax, 392(%rsp)
	jmp	.L19
.L60:
	movq	424(%rsp), %rbx
	addq	%rbx, 504(%rsp)
.L13:
	movq	472(%rsp), %rdx
	movq	504(%rsp), %rax
	movq	584(%rsp), %rsi
	cmpq	%rax, %rdx
	cmovnb	%rdx, %rax
	subq	%rsi, 512(%rsp)
	movq	%rax, 472(%rsp)
	movq	568(%rsp), %rax
	movq	%rax, %rdx
	cmpq	%rax, 648(%rsp)
	je	.L7
	addq	$8, %rax
	movq	%rax, 568(%rsp)
	jmp	.L43
.L14:
	leal	-1(%rax), %edx
	movq	(%rdi), %rax
	movq	(%rax,%rdx,8), %rax
	addq	%rax, 464(%rsp)
	jmp	.L16
.L8:
	leal	-1(%rax), %edx
	movq	(%rdi), %rax
	movq	(%rax,%rdx,8), %rax
	movq	%rax, 472(%rsp)
.L7:
	movq	472(%rsp), %rax
	addq	$664, %rsp
	.cfi_remember_state
	.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
.L11:
	.cfi_restore_state
	leal	-1(%rax), %edx
	movq	(%rdi), %rax
	movq	(%rax,%rdx,8), %rax
	addq	%rax, 504(%rsp)
	jmp	.L13
.L62:
	movq	$0, 472(%rsp)
	jmp	.L7
	.cfi_endproc
.LFE52:
	.size	sub2, .-sub2
	.p2align 4
	.globl	sub1
	.type	sub1, @function
sub1:
.LFB53:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	xorl	%r15d, %r15d
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	movq	%rcx, %r14
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movq	%rdx, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movl	%edi, %ebx
	leal	1(%rbx), %ebp
	salq	$3, %rbp
	subq	$184, %rsp
	.cfi_def_cfa_offset 240
	movq	%rsi, 16(%rsp)
	leaq	128(%rsp), %r13
	movq	%fs:40, %rax
	movq	%rax, 168(%rsp)
	xorl	%eax, %eax
	movq	%r13, 104(%rsp)
.L65:
	movq	%rbp, %rdi
	call	malloc@PLT
	movq	%rax, 0(%r13,%r15,8)
	testq	%rax, %rax
	je	.L101
	movq	$0, (%rax)
	leaq	112(%rsp), %rax
	movl	$1, (%rax,%r15,4)
	addq	$1, %r15
	cmpq	$4, %r15
	jne	.L65
	movq	%rax, %r13
	testl	%ebx, %ebx
	je	.L69
	movl	(%r12), %r9d
	xorl	%edx, %edx
	.p2align 4,,10
	.p2align 3
.L68:
	movq	(%r12,%rdx,8), %rax
	movq	(%r14,%rdx,8), %r8
	addq	$1, %rdx
	subl	%r9d, %eax
	movl	112(%rsp,%rax,4), %edi
	movq	128(%rsp,%rax,8), %rsi
	movq	%rdi, %rcx
	movq	%r8, (%rsi,%rdi,8)
	addl	$1, %ecx
	movl	%ecx, 112(%rsp,%rax,4)
	cmpq	%rdx, %rbx
	jne	.L68
.L69:
	movq	%r12, (%rsp)
	movq	104(%rsp), %rbp
	xorl	%r14d, %r14d
.L67:
	movq	0(%rbp,%r14,8), %r12
	movl	0(%r13,%r14,4), %r15d
	movl	$8, %edx
	leaq	cmp(%rip), %rcx
	leaq	8(%r12), %rbx
	leal	-1(%r15), %esi
	movq	%rbx, %rdi
	call	qsort@PLT
	cmpl	$1, %r15d
	jbe	.L73
	leal	-2(%r15), %ecx
	movq	(%r12), %rdx
	movq	%rbx, %rax
	leaq	16(%r12,%rcx,8), %rcx
	.p2align 4,,10
	.p2align 3
.L72:
	addq	(%rax), %rdx
	addq	$8, %rax
	movq	%rdx, -8(%rax)
	cmpq	%rax, %rcx
	jne	.L72
.L73:
	addq	$1, %r14
	cmpq	$4, %r14
	jne	.L67
	movq	$0, 48(%rsp)
	movq	(%rsp), %r12
	xorl	%edx, %edx
	movq	(%r12), %r15
	leaq	3(%r15), %rax
	movq	%rax, %rdi
	movq	%rax, 64(%rsp)
	movq	16(%rsp), %rax
	divq	%rdi
	movl	124(%rsp), %edx
	addl	$1, %eax
	cmpl	%edx, %eax
	cmovbe	%eax, %edx
	testl	%edx, %edx
	je	.L74
	movl	120(%rsp), %eax
	subl	$1, %edx
	movl	116(%rsp), %r14d
	leaq	1(%r15), %r9
	movq	144(%rsp), %rsi
	movq	136(%rsp), %rbx
	movl	%eax, 76(%rsp)
	leaq	2(%r15), %rax
	movl	112(%rsp), %r8d
	movq	%rax, (%rsp)
	movq	152(%rsp), %rax
	movq	%rsi, 88(%rsp)
	addq	$8, %rsi
	movq	128(%rsp), %r12
	leaq	8(%rax), %rcx
	movq	%rbx, 24(%rsp)
	leaq	(%rcx,%rdx,8), %rdi
	movq	%rcx, 56(%rsp)
	movq	%rdi, 80(%rsp)
	leaq	8(%rbx), %rdi
	movq	%rsi, 96(%rsp)
	movq	%rdi, 32(%rsp)
.L79:
	movq	(%rax), %rax
	xorl	%edx, %edx
	movl	76(%rsp), %ebx
	movq	%rax, 40(%rsp)
	movq	16(%rsp), %rax
	divq	(%rsp)
	addl	$1, %eax
	cmpl	%ebx, %eax
	cmova	%ebx, %eax
	testl	%eax, %eax
	je	.L75
	movq	96(%rsp), %rbx
	subl	$1, %eax
	movq	88(%rsp), %rbp
	xorl	%r13d, %r13d
	movq	16(%rsp), %r10
	leaq	(%rbx,%rax,8), %rbx
	movq	%rbx, 8(%rsp)
.L78:
	xorl	%edx, %edx
	movq	%r10, %rax
	movq	0(%rbp), %r11
	divq	%r9
	addl	$1, %eax
	cmpl	%r14d, %eax
	cmova	%r14d, %eax
	testl	%eax, %eax
	je	.L76
	movq	32(%rsp), %rbx
	subl	$1, %eax
	movq	24(%rsp), %rsi
	movq	%r10, %rcx
	xorl	%edi, %edi
	leaq	(%rbx,%rax,8), %rbx
.L77:
	movq	%rcx, %rax
	xorl	%edx, %edx
	divq	%r15
	addl	$1, %eax
	cmpl	%r8d, %eax
	cmova	%r8d, %eax
	leal	-1(%rax), %edx
	movq	(%rsi), %rax
	addq	(%r12,%rdx,8), %rax
	cmpq	%rax, %rdi
	cmovb	%rax, %rdi
	addq	$8, %rsi
	subq	%r9, %rcx
	cmpq	%rsi, %rbx
	jne	.L77
	addq	%rdi, %r11
.L76:
	cmpq	%r11, %r13
	cmovb	%r11, %r13
	addq	$8, %rbp
	subq	(%rsp), %r10
	cmpq	%rbp, 8(%rsp)
	jne	.L78
	addq	%r13, 40(%rsp)
.L75:
	movq	48(%rsp), %rdi
	movq	40(%rsp), %rax
	movq	56(%rsp), %rbx
	cmpq	%rax, %rdi
	cmovnb	%rdi, %rax
	movq	64(%rsp), %rdi
	subq	%rdi, 16(%rsp)
	movq	%rax, 48(%rsp)
	movq	%rbx, %rax
	cmpq	%rbx, 80(%rsp)
	je	.L74
	leaq	8(%rbx), %rcx
	movq	%rcx, 56(%rsp)
	jmp	.L79
	.p2align 4,,10
	.p2align 3
.L74:
	movq	104(%rsp), %rbx
	leaq	160(%rsp), %rbp
.L80:
	movq	(%rbx), %rdi
	addq	$8, %rbx
	call	free@PLT
	cmpq	%rbx, %rbp
	jne	.L80
	movq	168(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L102
	movq	48(%rsp), %rax
	addq	$184, %rsp
	.cfi_remember_state
	.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
.L101:
	.cfi_restore_state
	movl	$1, %edi
	call	exit@PLT
.L102:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE53:
	.size	sub1, .-sub1
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%u %lu"
.LC1:
	.string	"%lu %lu"
.LC2:
	.string	"%lu\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB54:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movl	$64, %esi
	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	$104, %rsp
	.cfi_def_cfa_offset 160
	movq	stdin(%rip), %rdx
	movq	%fs:40, %rax
	movq	%rax, 88(%rsp)
	xorl	%eax, %eax
	leaq	16(%rsp), %rbp
	movq	%rbp, %rdi
	call	fgets@PLT
	leaq	8(%rsp), %rcx
	movq	%rbp, %rdi
	xorl	%eax, %eax
	leaq	4(%rsp), %rdx
	leaq	.LC0(%rip), %rsi
	call	__isoc99_sscanf@PLT
	movl	4(%rsp), %r12d
	movq	%r12, %r15
	salq	$3, %r12
	movq	%r12, %rdi
	call	malloc@PLT
	movq	%r12, %rdi
	movq	%rax, %r13
	call	malloc@PLT
	testq	%r13, %r13
	je	.L104
	movq	%rax, %r12
	testq	%rax, %rax
	je	.L104
	xorl	%ebx, %ebx
	leaq	.LC1(%rip), %r14
	testl	%r15d, %r15d
	je	.L106
	.p2align 4,,10
	.p2align 3
.L105:
	movq	stdin(%rip), %rdx
	movl	$64, %esi
	movq	%rbp, %rdi
	call	fgets@PLT
	movl	%ebx, %edx
	movq	%r14, %rsi
	movq	%rbp, %rdi
	salq	$3, %rdx
	xorl	%eax, %eax
	addl	$1, %ebx
	leaq	(%r12,%rdx), %rcx
	addq	%r13, %rdx
	call	__isoc99_sscanf@PLT
	movl	4(%rsp), %r15d
	cmpl	%ebx, %r15d
	ja	.L105
.L106:
	movq	8(%rsp), %rsi
	movq	%r12, %rcx
	movq	%r13, %rdx
	movl	%r15d, %edi
	call	sub1
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	movq	%rax, %rdx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	%r13, %rdi
	call	free@PLT
	movq	%r12, %rdi
	call	free@PLT
	movq	88(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L112
	addq	$104, %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
.L104:
	.cfi_restore_state
	movl	$1, %edi
	call	exit@PLT
.L112:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE54:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:

rule
	.file	"temp.c"
	.text
	.p2align 4
	.globl	cmp
	.type	cmp, @function
cmp:
.LFB51:
	.cfi_startproc
	endbr64
	movq	(%rsi), %rdx
	movl	$-1, %eax
	cmpq	%rdx, (%rdi)
	ja	.L1
	movl	$1, %eax
	jb	.L1
	xorl	%eax, %eax
.L1:
	ret
	.cfi_endproc
.LFE51:
	.size	cmp, .-cmp
	.p2align 4
	.globl	sub2
	.type	sub2, @function
sub2:
.LFB52:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movq	%rsi, %r9
	movq	%rdx, %rax
	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	$664, %rsp
	.cfi_def_cfa_offset 720
	movq	%rsi, 128(%rsp)
	movl	%r8d, %esi
	leaq	(%rsi,%rcx), %rbx
	movq	%rdx, 512(%rsp)
	xorl	%edx, %edx
	divq	%rbx
	movl	(%r9,%rsi,4), %edx
	movq	%rbx, 584(%rsp)
	addl	$1, %eax
	cmpl	%edx, %eax
	cmova	%edx, %eax
	testl	%r8d, %r8d
	je	.L8
	testl	%eax, %eax
	je	.L62
	leal	-1(%r8), %edx
	movq	%r9, %rbx
	leal	-2(%r8), %r14d
	subl	$1, %eax
	movl	(%r9,%rdx,4), %r9d
	movl	%r14d, 532(%rsp)
	movq	%r14, 600(%rsp)
	movl	%r9d, 640(%rsp)
	leaq	(%rdi,%rdx,8), %r9
	movq	%r9, 592(%rsp)
	leaq	(%rbx,%r14,4), %r9
	leaq	(%rdi,%r14,8), %r14
	movq	%r9, 608(%rsp)
	leal	-3(%r8), %r9d
	movq	%r14, 616(%rsp)
	leaq	(%rbx,%r9,4), %r14
	movl	%r9d, 484(%rsp)
	movq	%r9, 624(%rsp)
	leaq	(%rdi,%r9,8), %r9
	movq	%r14, 632(%rsp)
	leal	-4(%r8), %r14d
	movq	%r9, 536(%rsp)
	leaq	(%rbx,%r14,4), %r9
	movl	%r14d, 480(%rsp)
	movq	%r14, 544(%rsp)
	leaq	(%rdi,%r14,8), %r14
	movq	%r9, 552(%rsp)
	leal	-5(%r8), %r9d
	movq	%r14, 432(%rsp)
	leaq	(%rbx,%r9,4), %r14
	movl	%r9d, 368(%rsp)
	movq	%r9, 440(%rsp)
	leaq	(%rdi,%r9,8), %r9
	movq	%r14, 448(%rsp)
	leal	-6(%r8), %r14d
	movq	%r9, 336(%rsp)
	leaq	(%rbx,%r14,4), %r9
	movl	%r14d, 224(%rsp)
	movq	%r14, 344(%rsp)
	leaq	(%rdi,%r14,8), %r14
	movq	%r9, 352(%rsp)
	leal	-7(%r8), %r9d
	movq	%r14, 240(%rsp)
	leaq	(%rbx,%r9,4), %r14
	movq	%r14, 248(%rsp)
	leal	-8(%r8), %r14d
	subl	$9, %r8d
	leaq	(%rbx,%r14,4), %rbx
	movl	%edx, 580(%rsp)
	addq	%rcx, %rdx
	movl	%r9d, 644(%rsp)
	movq	%r9, 360(%rsp)
	leaq	(%rdi,%r9,8), %r9
	movq	%rbx, 80(%rsp)
	leaq	(%rdi,%r14,8), %rbx
	movq	%r9, 72(%rsp)
	movl	%r14d, 228(%rsp)
	movq	%r14, 256(%rsp)
	movq	%rbx, 288(%rsp)
	movq	%rdx, 496(%rsp)
	movq	(%rdi,%rsi,8), %rdx
	movq	$0, 472(%rsp)
	leaq	8(%rdx), %rsi
	leaq	(%rsi,%rax,8), %rax
	movq	%rsi, 568(%rsp)
	movq	%rax, 648(%rsp)
.L43:
	movq	(%rdx), %rax
	xorl	%edx, %edx
	movl	580(%rsp), %r12d
	movq	%rax, 504(%rsp)
	movq	512(%rsp), %rax
	divq	496(%rsp)
	movl	640(%rsp), %edx
	addl	$1, %eax
	cmpl	%edx, %eax
	cmova	%edx, %eax
	testl	%r12d, %r12d
	je	.L11
	testl	%eax, %eax
	je	.L13
	movq	608(%rsp), %rdx
	subl	$1, %eax
	movq	$0, 424(%rsp)
	movl	(%rdx), %edx
	movl	%edx, 576(%rsp)
	movq	600(%rsp), %rdx
	leaq	(%rcx,%rdx), %rsi
	movq	%rsi, 416(%rsp)
	movq	592(%rsp), %rsi
	movq	(%rsi), %rdx
	leaq	8(%rdx), %rbx
	leaq	(%rbx,%rax,8), %rax
	movq	%rbx, 520(%rsp)
	movq	%rax, 560(%rsp)
	movq	512(%rsp), %rax
	movq	%rax, 456(%rsp)
.L42:
	movq	(%rdx), %rax
	xorl	%edx, %edx
	movl	532(%rsp), %ebp
	movq	%rax, 464(%rsp)
	movq	456(%rsp), %rax
	divq	416(%rsp)
	movl	576(%rsp), %edx
	addl	$1, %eax
	cmpl	%edx, %eax
	cmova	%edx, %eax
	testl	%ebp, %ebp
	je	.L14
	testl	%eax, %eax
	je	.L16
	movq	632(%rsp), %rbx
	subl	$1, %eax
	movq	$0, 400(%rsp)
	movl	(%rbx), %edx
	movq	624(%rsp), %rbx
	movl	%edx, 528(%rsp)
	movq	616(%rsp), %rdx
	leaq	(%rcx,%rbx), %rsi
	movq	%rsi, 328(%rsp)
	movq	(%rdx), %rdx
	leaq	8(%rdx), %rsi
	leaq	(%rsi,%rax,8), %rax
	movq	%rsi, 408(%rsp)
	movq	%rax, 488(%rsp)
	movq	456(%rsp), %rax
	movq	%rax, 384(%rsp)
.L41:
	movq	(%rdx), %rax
	xorl	%edx, %edx
	movl	484(%rsp), %ebx
	movq	%rax, 392(%rsp)
	movq	384(%rsp), %rax
	divq	328(%rsp)
	movl	528(%rsp), %edx
	addl	$1, %eax
	cmpl	%edx, %eax
	cmova	%edx, %eax
	testl	%ebx, %ebx
	je	.L17
	testl	%eax, %eax
	je	.L19
	movq	552(%rsp), %rdx
	subl	$1, %eax
	movq	$0, 312(%rsp)
	movl	(%rdx), %esi
	movq	544(%rsp), %rdx
	movl	%esi, 372(%rsp)
	movq	536(%rsp), %rsi
	leaq	(%rcx,%rdx), %rbx
	movq	%rbx, 232(%rsp)
	movq	(%rsi), %rdx
	leaq	8(%rdx), %rsi
	leaq	(%rsi,%rax,8), %rax
	movq	%rsi, 320(%rsp)
	movq	%rax, 376(%rsp)
	movq	384(%rsp), %rax
	movq	%rax, 304(%rsp)
.L40:
	movq	(%rdx), %rax
	xorl	%edx, %edx
	movl	480(%rsp), %r11d
	movq	%rax, 296(%rsp)
	movq	304(%rsp), %rax
	divq	232(%rsp)
	movl	372(%rsp), %edx
	addl	$1, %eax
	cmpl	%edx, %eax
	cmova	%edx, %eax
	testl	%r11d, %r11d
	je	.L20
	testl	%eax, %eax
	je	.L22
	movq	448(%rsp), %rbx
	subl	$1, %eax
	movq	$0, 144(%rsp)
	movl	(%rbx), %edx
	movl	%edx, 276(%rsp)
	movq	440(%rsp), %rdx
	leaq	(%rcx,%rdx), %rbx
	movq	%rbx, 64(%rsp)
	movq	432(%rsp), %rbx
	movq	(%rbx), %rdx
	leaq	8(%rdx), %rsi
	leaq	(%rsi,%rax,8), %rax
	movq	%rsi, 216(%rsp)
	movq	%rax, 280(%rsp)
	movq	304(%rsp), %rax
	movq	%rax, 120(%rsp)
.L39:
	movq	(%rdx), %rax
	xorl	%edx, %edx
	movl	276(%rsp), %ebx
	movl	368(%rsp), %r10d
	movq	%rax, 112(%rsp)
	movq	120(%rsp), %rax
	divq	64(%rsp)
	addl	$1, %eax
	cmpl	%ebx, %eax
	cmova	%ebx, %eax
	testl	%r10d, %r10d
	je	.L23
	testl	%eax, %eax
	je	.L25
	movq	352(%rsp), %rdx
	subl	$1, %eax
	movq	344(%rsp), %rsi
	movq	$0, 16(%rsp)
	movl	(%rdx), %ebx
	leaq	(%rcx,%rsi), %rdx
	movq	%rdx, 88(%rsp)
	movl	%ebx, 100(%rsp)
	movq	336(%rsp), %rbx
	movq	(%rbx), %rdx
	leaq	8(%rdx), %r12
	leaq	(%r12,%rax,8), %rax
	movq	%r12, 40(%rsp)
	movq	%rax, 104(%rsp)
	movq	120(%rsp), %rax
	movq	%rax, (%rsp)
	movq	360(%rsp), %rax
	addq	%rcx, %rax
	movq	%rax, 152(%rsp)
.L38:
	movq	(%rsp), %rax
	movq	(%rdx), %r10
	xorl	%edx, %edx
	movl	100(%rsp), %esi
	movl	224(%rsp), %r9d
	divq	88(%rsp)
	addl	$1, %eax
	cmpl	%esi, %eax
	cmova	%esi, %eax
	testl	%r9d, %r9d
	je	.L26
	testl	%eax, %eax
	je	.L28
	movq	248(%rsp), %rbx
	subl	$1, %eax
	movq	240(%rsp), %rsi
	movq	$0, 136(%rsp)
	movq	%r10, 160(%rsp)
	movq	%rdi, %r15
	movl	(%rbx), %edx
	movl	%edx, 272(%rsp)
	movq	(%rsi), %rdx
	leaq	8(%rdx), %r11
	leaq	(%r11,%rax,8), %rax
	movq	%rax, 264(%rsp)
	movq	(%rsp), %rax
	movq	%rax, 48(%rsp)
	movq	256(%rsp), %rax
	addq	%rcx, %rax
	movq	%rax, 8(%rsp)
.L37:
	movq	48(%rsp), %rax
	movq	(%rdx), %r10
	xorl	%edx, %edx
	movl	644(%rsp), %esi
	divq	152(%rsp)
	leal	1(%rax), %edx
	movl	272(%rsp), %eax
	cmpl	%eax, %edx
	cmova	%eax, %edx
	testl	%esi, %esi
	je	.L29
	testl	%edx, %edx
	je	.L31
	movq	80(%rsp), %rax
	movq	48(%rsp), %r12
	subl	$1, %edx
	xorl	%r9d, %r9d
	movl	(%rax), %eax
	movq	%r12, %r13
	movl	%eax, 96(%rsp)
	movq	72(%rsp), %rax
	movq	(%rax), %rax
	leaq	8(%rax), %rbx
	leaq	(%rbx,%rdx,8), %rdi
	movq	%rdi, 32(%rsp)
	movq	%r15, %rdi
.L36:
	xorl	%edx, %edx
	movq	(%rax), %rbp
	movq	%r13, %rax
	movl	96(%rsp), %esi
	divq	8(%rsp)
	movl	228(%rsp), %edx
	addl	$1, %eax
	cmpl	%esi, %eax
	cmova	%esi, %eax
	testl	%edx, %edx
	je	.L32
	testl	%eax, %eax
	je	.L34
	movq	288(%rsp), %rdx
	subl	$1, %eax
	movq	%r9, 168(%rsp)
	xorl	%r12d, %r12d
	movq	%r10, 192(%rsp)
	movq	(%rdx), %r15
	movq	%r11, 200(%rsp)
	movq	%r13, %rdx
	movq	%r13, 176(%rsp)
	movq	%rcx, %r13
	leaq	8(%r15), %r14
	movq	%rbp, 184(%rsp)
	movq	%rdi, %rbp
	leaq	(%r14,%rax,8), %rax
	movq	%rbx, 208(%rsp)
	movq	%r15, %rbx
	movq	%rdx, %r15
	movq	%rax, 56(%rsp)
.L35:
	movq	%r15, %rdx
	movq	%r13, %rcx
	movq	%rbp, %rdi
	movl	%r8d, 28(%rsp)
	movq	128(%rsp), %rsi
	call	sub2
	addq	(%rbx), %rax
	movl	28(%rsp), %r8d
	movq	%r14, %rbx
	cmpq	%rax, %r12
	cmovb	%rax, %r12
	subq	8(%rsp), %r15
	cmpq	%r14, 56(%rsp)
	je	.L53
	addq	$8, %r14
	jmp	.L35
	.p2align 4,,10
	.p2align 3
.L32:
	leal	-1(%rax), %edx
	movq	(%rdi), %rax
	addq	(%rax,%rdx,8), %rbp
.L34:
	cmpq	%rbp, %r9
	movq	%rbx, %rax
	cmovb	%rbp, %r9
	subq	152(%rsp), %r13
	cmpq	%rbx, 32(%rsp)
	je	.L54
	addq	$8, %rbx
	jmp	.L36
	.p2align 4,,10
	.p2align 3
.L54:
	movq	%rdi, %r15
	addq	%r9, %r10
.L31:
	movq	136(%rsp), %rax
	movq	88(%rsp), %rdi
	movq	%r11, %rdx
	cmpq	%r10, %rax
	cmovnb	%rax, %r10
	subq	%rdi, 48(%rsp)
	movq	%r10, 136(%rsp)
	cmpq	%r11, 264(%rsp)
	je	.L55
	addq	$8, %r11
	jmp	.L37
	.p2align 4,,10
	.p2align 3
.L55:
	movq	160(%rsp), %r10
	movq	%r15, %rdi
	addq	136(%rsp), %r10
.L28:
	movq	16(%rsp), %rax
	movq	64(%rsp), %rbx
	cmpq	%r10, %rax
	cmovnb	%rax, %r10
	movq	40(%rsp), %rax
	subq	%rbx, (%rsp)
	movq	%r10, 16(%rsp)
	movq	%rax, %rdx
	cmpq	%rax, 104(%rsp)
	je	.L56
	addq	$8, %rax
	movq	%rax, 40(%rsp)
	jmp	.L38
	.p2align 4,,10
	.p2align 3
.L29:
	movq	(%r15), %rax
	subl	$1, %edx
	addq	(%rax,%rdx,8), %r10
	jmp	.L31
	.p2align 4,,10
	.p2align 3
.L53:
	movq	%rbp, %rdi
	movq	184(%rsp), %rbp
	movq	%r13, %rcx
	movq	168(%rsp), %r9
	movq	192(%rsp), %r10
	movq	176(%rsp), %r13
	movq	200(%rsp), %r11
	movq	208(%rsp), %rbx
	addq	%r12, %rbp
	jmp	.L34
	.p2align 4,,10
	.p2align 3
.L56:
	addq	%r10, 112(%rsp)
.L25:
	movq	144(%rsp), %rbx
	movq	112(%rsp), %rax
	cmpq	%rax, %rbx
	cmovnb	%rbx, %rax
	movq	232(%rsp), %rbx
	subq	%rbx, 120(%rsp)
	movq	%rax, 144(%rsp)
	movq	216(%rsp), %rax
	movq	%rax, %rdx
	cmpq	%rax, 280(%rsp)
	je	.L57
	addq	$8, %rax
	movq	%rax, 216(%rsp)
	jmp	.L39
	.p2align 4,,10
	.p2align 3
.L26:
	leal	-1(%rax), %edx
	movq	(%rdi), %rax
	addq	(%rax,%rdx,8), %r10
	jmp	.L28
.L57:
	movq	144(%rsp), %rdx
	addq	%rdx, 296(%rsp)
.L22:
	movq	312(%rsp), %rbx
	movq	296(%rsp), %rax
	cmpq	%rax, %rbx
	cmovnb	%rbx, %rax
	movq	328(%rsp), %rbx
	subq	%rbx, 304(%rsp)
	movq	%rax, 312(%rsp)
	movq	320(%rsp), %rax
	movq	%rax, %rdx
	cmpq	%rax, 376(%rsp)
	je	.L58
	addq	$8, %rax
	movq	%rax, 320(%rsp)
	jmp	.L40
.L23:
	leal	-1(%rax), %edx
	movq	(%rdi), %rax
	movq	(%rax,%rdx,8), %rax
	addq	%rax, 112(%rsp)
	jmp	.L25
.L58:
	movq	312(%rsp), %rbx
	addq	%rbx, 392(%rsp)
.L19:
	movq	400(%rsp), %rdx
	movq	392(%rsp), %rax
	movq	416(%rsp), %rsi
	cmpq	%rax, %rdx
	cmovnb	%rdx, %rax
	subq	%rsi, 384(%rsp)
	movq	%rax, 400(%rsp)
	movq	408(%rsp), %rax
	movq	%rax, %rdx
	cmpq	%rax, 488(%rsp)
	je	.L59
	addq	$8, %rax
	movq	%rax, 408(%rsp)
	jmp	.L41
.L20:
	leal	-1(%rax), %edx
	movq	(%rdi), %rax
	movq	(%rax,%rdx,8), %rax
	addq	%rax, 296(%rsp)
	jmp	.L22
.L59:
	movq	400(%rsp), %rsi
	addq	%rsi, 464(%rsp)
.L16:
	movq	424(%rsp), %rdx
	movq	464(%rsp), %rax
	movq	496(%rsp), %rsi
	cmpq	%rax, %rdx
	cmovnb	%rdx, %rax
	subq	%rsi, 456(%rsp)
	movq	%rax, 424(%rsp)
	movq	520(%rsp), %rax
	movq	%rax, %rdx
	cmpq	%rax, 560(%rsp)
	je	.L60
	addq	$8, %rax
	movq	%rax, 520(%rsp)
	jmp	.L42
.L17:
	leal	-1(%rax), %edx
	movq	(%rdi), %rax
	movq	(%rax,%rdx,8), %rax
	addq	%rax, 392(%rsp)
	jmp	.L19
.L60:
	movq	424(%rsp), %rbx
	addq	%rbx, 504(%rsp)
.L13:
	movq	472(%rsp), %rdx
	movq	504(%rsp), %rax
	movq	584(%rsp), %rsi
	cmpq	%rax, %rdx
	cmovnb	%rdx, %rax
	subq	%rsi, 512(%rsp)
	movq	%rax, 472(%rsp)
	movq	568(%rsp), %rax
	movq	%rax, %rdx
	cmpq	%rax, 648(%rsp)
	je	.L7
	addq	$8, %rax
	movq	%rax, 568(%rsp)
	jmp	.L43
.L14:
	leal	-1(%rax), %edx
	movq	(%rdi), %rax
	movq	(%rax,%rdx,8), %rax
	addq	%rax, 464(%rsp)
	jmp	.L16
.L8:
	leal	-1(%rax), %edx
	movq	(%rdi), %rax
	movq	(%rax,%rdx,8), %rax
	movq	%rax, 472(%rsp)
.L7:
	movq	472(%rsp), %rax
	addq	$664, %rsp
	.cfi_remember_state
	.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
.L11:
	.cfi_restore_state
	leal	-1(%rax), %edx
	movq	(%rdi), %rax
	movq	(%rax,%rdx,8), %rax
	addq	%rax, 504(%rsp)
	jmp	.L13
.L62:
	movq	$0, 472(%rsp)
	jmp	.L7
	.cfi_endproc
.LFE52:
	.size	sub2, .-sub2
	.p2align 4
	.globl	sub1
	.type	sub1, @function
sub1:
.LFB53:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	xorl	%r15d, %r15d
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	movq	%rcx, %r14
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movq	%rdx, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movl	%edi, %ebx
	leal	1(%rbx), %ebp
	salq	$3, %rbp
	subq	$184, %rsp
	.cfi_def_cfa_offset 240
	movq	%rsi, 16(%rsp)
	leaq	128(%rsp), %r13
	movq	%fs:40, %rax
	movq	%rax, 168(%rsp)
	xorl	%eax, %eax
	movq	%r13, 104(%rsp)
.L65:
	movq	%rbp, %rdi
	call	malloc@PLT
	movq	%rax, 0(%r13,%r15,8)
	testq	%rax, %rax
	je	.L101
	movq	$0, (%rax)
	leaq	112(%rsp), %rax
	movl	$1, (%rax,%r15,4)
	addq	$1, %r15
	cmpq	$4, %r15
	jne	.L65
	movq	%rax, %r13
	testl	%ebx, %ebx
	je	.L69
	movl	(%r12), %r9d
	xorl	%edx, %edx
	.p2align 4,,10
	.p2align 3
.L68:
	movq	(%r12,%rdx,8), %rax
	movq	(%r14,%rdx,8), %r8
	addq	$1, %rdx
	subl	%r9d, %eax
	movl	112(%rsp,%rax,4), %edi
	movq	128(%rsp,%rax,8), %rsi
	movq	%rdi, %rcx
	movq	%r8, (%rsi,%rdi,8)
	addl	$1, %ecx
	movl	%ecx, 112(%rsp,%rax,4)
	cmpq	%rdx, %rbx
	jne	.L68
.L69:
	movq	%r12, (%rsp)
	movq	104(%rsp), %rbp
	xorl	%r14d, %r14d
.L67:
	movq	0(%rbp,%r14,8), %r12
	movl	0(%r13,%r14,4), %r15d
	movl	$8, %edx
	leaq	cmp(%rip), %rcx
	leaq	8(%r12), %rbx
	leal	-1(%r15), %esi
	movq	%rbx, %rdi
	call	qsort@PLT
	cmpl	$1, %r15d
	jbe	.L73
	leal	-2(%r15), %ecx
	movq	(%r12), %rdx
	movq	%rbx, %rax
	leaq	16(%r12,%rcx,8), %rcx
	.p2align 4,,10
	.p2align 3
.L72:
	addq	(%rax), %rdx
	addq	$8, %rax
	movq	%rdx, -8(%rax)
	cmpq	%rax, %rcx
	jne	.L72
.L73:
	addq	$1, %r14
	cmpq	$4, %r14
	jne	.L67
	movq	$0, 48(%rsp)
	movq	(%rsp), %r12
	xorl	%edx, %edx
	movq	(%r12), %r15
	leaq	3(%r15), %rax
	movq	%rax, %rdi
	movq	%rax, 64(%rsp)
	movq	16(%rsp), %rax
	divq	%rdi
	movl	124(%rsp), %edx
	addl	$1, %eax
	cmpl	%edx, %eax
	cmovbe	%eax, %edx
	testl	%edx, %edx
	je	.L74
	movl	120(%rsp), %eax
	subl	$1, %edx
	movl	116(%rsp), %r14d
	leaq	1(%r15), %r9
	movq	144(%rsp), %rsi
	movq	136(%rsp), %rbx
	movl	%eax, 76(%rsp)
	leaq	2(%r15), %rax
	movl	112(%rsp), %r8d
	movq	%rax, (%rsp)
	movq	152(%rsp), %rax
	movq	%rsi, 88(%rsp)
	addq	$8, %rsi
	movq	128(%rsp), %r12
	leaq	8(%rax), %rcx
	movq	%rbx, 24(%rsp)
	leaq	(%rcx,%rdx,8), %rdi
	movq	%rcx, 56(%rsp)
	movq	%rdi, 80(%rsp)
	leaq	8(%rbx), %rdi
	movq	%rsi, 96(%rsp)
	movq	%rdi, 32(%rsp)
.L79:
	movq	(%rax), %rax
	xorl	%edx, %edx
	movl	76(%rsp), %ebx
	movq	%rax, 40(%rsp)
	movq	16(%rsp), %rax
	divq	(%rsp)
	addl	$1, %eax
	cmpl	%ebx, %eax
	cmova	%ebx, %eax
	testl	%eax, %eax
	je	.L75
	movq	96(%rsp), %rbx
	subl	$1, %eax
	movq	88(%rsp), %rbp
	xorl	%r13d, %r13d
	movq	16(%rsp), %r10
	leaq	(%rbx,%rax,8), %rbx
	movq	%rbx, 8(%rsp)
.L78:
	xorl	%edx, %edx
	movq	%r10, %rax
	movq	0(%rbp), %r11
	divq	%r9
	addl	$1, %eax
	cmpl	%r14d, %eax
	cmova	%r14d, %eax
	testl	%eax, %eax
	je	.L76
	movq	32(%rsp), %rbx
	subl	$1, %eax
	movq	24(%rsp), %rsi
	movq	%r10, %rcx
	xorl	%edi, %edi
	leaq	(%rbx,%rax,8), %rbx
.L77:
	movq	%rcx, %rax
	xorl	%edx, %edx
	divq	%r15
	addl	$1, %eax
	cmpl	%r8d, %eax
	cmova	%r8d, %eax
	leal	-1(%rax), %edx
	movq	(%rsi), %rax
	addq	(%r12,%rdx,8), %rax
	cmpq	%rax, %rdi
	cmovb	%rax, %rdi
	addq	$8, %rsi
	subq	%r9, %rcx
	cmpq	%rsi, %rbx
	jne	.L77
	addq	%rdi, %r11
.L76:
	cmpq	%r11, %r13
	cmovb	%r11, %r13
	addq	$8, %rbp
	subq	(%rsp), %r10
	cmpq	%rbp, 8(%rsp)
	jne	.L78
	addq	%r13, 40(%rsp)
.L75:
	movq	48(%rsp), %rdi
	movq	40(%rsp), %rax
	movq	56(%rsp), %rbx
	cmpq	%rax, %rdi
	cmovnb	%rdi, %rax
	movq	64(%rsp), %rdi
	subq	%rdi, 16(%rsp)
	movq	%rax, 48(%rsp)
	movq	%rbx, %rax
	cmpq	%rbx, 80(%rsp)
	je	.L74
	leaq	8(%rbx), %rcx
	movq	%rcx, 56(%rsp)
	jmp	.L79
	.p2align 4,,10
	.p2align 3
.L74:
	movq	104(%rsp), %rbx
	leaq	160(%rsp), %rbp
.L80:
	movq	(%rbx), %rdi
	addq	$8, %rbx
	call	free@PLT
	cmpq	%rbx, %rbp
	jne	.L80
	movq	168(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L102
	movq	48(%rsp), %rax
	addq	$184, %rsp
	.cfi_remember_state
	.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
.L101:
	.cfi_restore_state
	movl	$1, %edi
	call	exit@PLT
.L102:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE53:
	.size	sub1, .-sub1
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%u %lu"
.LC1:
	.string	"%lu %lu"
.LC2:
	.string	"%lu\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB54:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movl	$64, %esi
	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	$104, %rsp
	.cfi_def_cfa_offset 160
	movq	stdin(%rip), %rdx
	movq	%fs:40, %rax
	movq	%rax, 88(%rsp)
	xorl	%eax, %eax
	leaq	16(%rsp), %rbp
	movq	%rbp, %rdi
	call	fgets@PLT
	leaq	8(%rsp), %rcx
	movq	%rbp, %rdi
	xorl	%eax, %eax
	leaq	4(%rsp), %rdx
	leaq	.LC0(%rip), %rsi
	call	__isoc99_sscanf@PLT
	movl	4(%rsp), %r12d
	movq	%r12, %r15
	salq	$3, %r12
	movq	%r12, %rdi
	call	malloc@PLT
	movq	%r12, %rdi
	movq	%rax, %r13
	call	malloc@PLT
	testq	%r13, %r13
	je	.L104
	movq	%rax, %r12
	testq	%rax, %rax
	je	.L104
	xorl	%ebx, %ebx
	leaq	.LC1(%rip), %r14
	testl	%r15d, %r15d
	je	.L106
	.p2align 4,,10
	.p2align 3
.L105:
	movq	stdin(%rip), %rdx
	movl	$64, %esi
	movq	%rbp, %rdi
	call	fgets@PLT
	movl	%ebx, %edx
	movq	%r14, %rsi
	movq	%rbp, %rdi
	salq	$3, %rdx
	xorl	%eax, %eax
	addl	$1, %ebx
	leaq	(%r12,%rdx), %rcx
	addq	%r13, %rdx
	call	__isoc99_sscanf@PLT
	movl	4(%rsp), %r15d
	cmpl	%ebx, %r15d
	ja	.L105
.L106:
	movq	8(%rsp), %rsi
	movq	%r12, %rcx
	movq	%r13, %rdx
	movl	%r15d, %edi
	call	sub1
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	movq	%rax, %rdx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	%r13, %rdi
	call	free@PLT
	movq	%r12, %rdi
	call	free@PLT
	movq	88(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L112
	addq	$104, %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
.L104:
	.cfi_restore_state
	movl	$1, %edi
	call	exit@PLT
.L112:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE54:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:

#include<stdio.h>
#include<stdlib.h>
#include<string.h>

#define Min(a,b) ((a)<(b)?(a):(b))

int cmp(const void *ax, const void *ay){
	unsigned long x = *(unsigned long *)ax;
	unsigned long y = *(unsigned long *)ay;

	if(x > y) return -1;
	if(x < y) return 1;
	if(x = y) return 0;
}

unsigned long sub2(unsigned long **V, unsigned int *n, unsigned long W, unsigned long base, unsigned int ofs){
	unsigned int i,  N;	
	unsigned long sum = 0, tmp, w;
	w = base+ofs;
	N = Min(n[ofs], (unsigned int)(W/w+1));

	if(ofs == 0) return V[0][N-1];

	for(i = 0; i < N; i++){
		tmp = V[ofs][i] + sub2(V, n, W-w*i, base, ofs-1); 
		if(sum < tmp) sum = tmp;
	}

	return sum;
}

unsigned long sub1(unsigned int N, unsigned long W, unsigned long *w, unsigned long *v){
	unsigned int i, n[4], diff;
	unsigned long *V[4], Vmax;

	for(diff = 0; diff < 4; diff++){
		V[diff] = (unsigned long *)malloc(sizeof(unsigned long) * (N+1));
		if(V[diff] == NULL) exit(1);
		V[diff][0] = 0;
		n[diff] = 1;
	}
		
	for(i = 0; i < N; i++){
		diff = (unsigned int)(w[i] - w[0]);
		V[diff][n[diff]] = v[i];
		n[diff]++;
	}
	for(diff = 0; diff < 4; diff++){
		qsort(&V[diff][1], n[diff]-1, sizeof(unsigned long), cmp);
		for(i = 1; i < n[diff]; i++) V[diff][i] += V[diff][i-1];
	}
	
	Vmax = sub2(V, n, W, w[0], 3);
	for(diff = 0; diff < 4; diff++) free(V[diff]);
	return Vmax;
}

int main(){
	unsigned int N, i;
	unsigned long W, *w, *v;
	char line[64];

	fgets(line, 64, stdin);
	sscanf(line, "%u %lu", &N, &W);

	w = (long *)malloc(sizeof(long) * N);
	v = (long *)malloc(sizeof(long) * N);
	if((w == NULL)||(v == NULL)) exit(1);
	for(i = 0; i < N; i++){
		fgets(line, 64, stdin);
		sscanf(line, "%lu %lu", w+i, v+i);
	}

	printf("%lu\n", sub1(N, W, w, v));

	free(w);
	free(v);
	return 0;
}

4 6
2 1
3 4
4 10
3 4

11

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>
#include<string.h>

#define Min(a,b) ((a)<(b)?(a):(b))

int cmp(const void *ax, const void *ay){
	unsigned long x = *(unsigned long *)ax;
	unsigned long y = *(unsigned long *)ay;

	if(x > y) return -1;
	if(x < y) return 1;
	if(x = y) return 0;
}

unsigned long sub2(unsigned long **V, unsigned int *n, unsigned long W, unsigned long base, unsigned int ofs){
	unsigned int i,  N;	
	unsigned long sum = 0, tmp, w;
	w = base+ofs;
	N = Min(n[ofs], (unsigned int)(W/w+1));

	if(ofs == 0) return V[0][N-1];

	for(i = 0; i < N; i++){
		tmp = V[ofs][i] + sub2(V, n, W-w*i, base, ofs-1); 
		if(sum < tmp) sum = tmp;
	}

	return sum;
}

unsigned long sub1(unsigned int N, unsigned long W, unsigned long *w, unsigned long *v){
	unsigned int i, n[4], diff;
	unsigned long *V[4], Vmax;

	for(diff = 0; diff < 4; diff++){
		V[diff] = (unsigned long *)malloc(sizeof(unsigned long) * (N+1));
		if(V[diff] == NULL) exit(1);
		V[diff][0] = 0;
		n[diff] = 1;
	}
		
	for(i = 0; i < N; i++){
		diff = (unsigned int)(w[i] - w[0]);
		V[diff][n[diff]] = v[i];
		n[diff]++;
	}
	for(diff = 0; diff < 4; diff++){
		qsort(&V[diff][1], n[diff]-1, sizeof(unsigned long), cmp);
		for(i = 1; i < n[diff]; i++) V[diff][i] += V[diff][i-1];
	}
	
	Vmax = sub2(V, n, W, w[0], 3);
	for(diff = 0; diff < 4; diff++) free(V[diff]);
	return Vmax;
}

int main(){
	unsigned int N, i;
	unsigned long W, *w, *v;
	char line[64];

	fgets(line, 64, stdin);
	sscanf(line, "%u %lu", &N, &W);

	w = (long *)malloc(sizeof(long) * N);
	v = (long *)malloc(sizeof(long) * N);
	if((w == NULL)||(v == NULL)) exit(1);
	for(i = 0; i < N; i++){
		fgets(line, 64, stdin);
		sscanf(line, "%lu %lu", w+i, v+i);
	}

	printf("%lu\n", sub1(N, W, w, v));

	free(w);
	free(v);
	return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	cmp
	.type	cmp, @function
cmp:
.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
	movq	(%rax), %rax
	movq	%rax, -16(%rbp)
	movq	-32(%rbp), %rax
	movq	(%rax), %rax
	movq	%rax, -8(%rbp)
	movq	-16(%rbp), %rax
	cmpq	-8(%rbp), %rax
	jbe	.L2
	movl	$-1, %eax
	jmp	.L1
.L2:
	movq	-16(%rbp), %rax
	cmpq	-8(%rbp), %rax
	jnb	.L4
	movl	$1, %eax
	jmp	.L1
.L4:
	movq	-8(%rbp), %rax
	movq	%rax, -16(%rbp)
	cmpq	$0, -16(%rbp)
	je	.L5
	movl	$0, %eax
	jmp	.L1
.L5:
.L1:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	cmp, .-cmp
	.globl	sub2
	.type	sub2, @function
sub2:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%rbx
	subq	$88, %rsp
	.cfi_offset 3, -24
	movq	%rdi, -56(%rbp)
	movq	%rsi, -64(%rbp)
	movq	%rdx, -72(%rbp)
	movq	%rcx, -80(%rbp)
	movl	%r8d, -84(%rbp)
	movq	$0, -40(%rbp)
	movl	-84(%rbp), %edx
	movq	-80(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, -32(%rbp)
	movq	-72(%rbp), %rax
	movl	$0, %edx
	divq	-32(%rbp)
	leal	1(%rax), %edx
	movl	-84(%rbp), %eax
	leaq	0(,%rax,4), %rcx
	movq	-64(%rbp), %rax
	addq	%rcx, %rax
	movl	(%rax), %eax
	cmpl	%eax, %edx
	cmovbe	%edx, %eax
	movl	%eax, -44(%rbp)
	cmpl	$0, -84(%rbp)
	jne	.L7
	movq	-56(%rbp), %rax
	movq	(%rax), %rdx
	movl	-44(%rbp), %eax
	subl	$1, %eax
	movl	%eax, %eax
	salq	$3, %rax
	addq	%rdx, %rax
	movq	(%rax), %rax
	jmp	.L8
.L7:
	movl	$0, -48(%rbp)
	jmp	.L9
.L11:
	movl	-84(%rbp), %eax
	leaq	0(,%rax,8), %rdx
	movq	-56(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-48(%rbp), %eax
	salq	$3, %rax
	addq	%rdx, %rax
	movq	(%rax), %rbx
	movl	-84(%rbp), %eax
	leal	-1(%rax), %ecx
	movl	-48(%rbp), %eax
	imulq	-32(%rbp), %rax
	movq	%rax, %rdx
	movq	-72(%rbp), %rax
	subq	%rdx, %rax
	movq	%rax, %rdi
	movq	-80(%rbp), %rdx
	movq	-64(%rbp), %rsi
	movq	-56(%rbp), %rax
	movl	%ecx, %r8d
	movq	%rdx, %rcx
	movq	%rdi, %rdx
	movq	%rax, %rdi
	call	sub2
	addq	%rbx, %rax
	movq	%rax, -24(%rbp)
	movq	-40(%rbp), %rax
	cmpq	-24(%rbp), %rax
	jnb	.L10
	movq	-24(%rbp), %rax
	movq	%rax, -40(%rbp)
.L10:
	addl	$1, -48(%rbp)
.L9:
	movl	-48(%rbp), %eax
	cmpl	-44(%rbp), %eax
	jb	.L11
	movq	-40(%rbp), %rax
.L8:
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	sub2, .-sub2
	.globl	sub1
	.type	sub1, @function
sub1:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$112, %rsp
	movl	%edi, -84(%rbp)
	movq	%rsi, -96(%rbp)
	movq	%rdx, -104(%rbp)
	movq	%rcx, -112(%rbp)
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, -76(%rbp)
	jmp	.L13
.L15:
	movl	-84(%rbp), %eax
	addl	$1, %eax
	movl	%eax, %eax
	salq	$3, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, %rdx
	movl	-76(%rbp), %eax
	movq	%rdx, -48(%rbp,%rax,8)
	movl	-76(%rbp), %eax
	movq	-48(%rbp,%rax,8), %rax
	testq	%rax, %rax
	jne	.L14
	movl	$1, %edi
	call	exit@PLT
.L14:
	movl	-76(%rbp), %eax
	movq	-48(%rbp,%rax,8), %rax
	movq	$0, (%rax)
	movl	-76(%rbp), %eax
	movl	$1, -64(%rbp,%rax,4)
	addl	$1, -76(%rbp)
.L13:
	cmpl	$3, -76(%rbp)
	jbe	.L15
	movl	$0, -80(%rbp)
	jmp	.L16
.L17:
	movl	-80(%rbp), %eax
	leaq	0(,%rax,8), %rdx
	movq	-104(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rax
	movl	%eax, %edx
	movq	-104(%rbp), %rax
	movq	(%rax), %rax
	movl	%eax, %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	movl	%eax, -76(%rbp)
	movl	-80(%rbp), %eax
	leaq	0(,%rax,8), %rdx
	movq	-112(%rbp), %rax
	leaq	(%rdx,%rax), %rcx
	movl	-76(%rbp), %eax
	movq	-48(%rbp,%rax,8), %rdx
	movl	-76(%rbp), %eax
	movl	-64(%rbp,%rax,4), %eax
	movl	%eax, %eax
	salq	$3, %rax
	addq	%rax, %rdx
	movq	(%rcx), %rax
	movq	%rax, (%rdx)
	movl	-76(%rbp), %eax
	movl	-64(%rbp,%rax,4), %eax
	leal	1(%rax), %edx
	movl	-76(%rbp), %eax
	movl	%edx, -64(%rbp,%rax,4)
	addl	$1, -80(%rbp)
.L16:
	movl	-80(%rbp), %eax
	cmpl	-84(%rbp), %eax
	jb	.L17
	movl	$0, -76(%rbp)
	jmp	.L18
.L21:
	movl	-76(%rbp), %eax
	movl	-64(%rbp,%rax,4), %eax
	subl	$1, %eax
	movl	%eax, %esi
	movl	-76(%rbp), %eax
	movq	-48(%rbp,%rax,8), %rax
	addq	$8, %rax
	leaq	cmp(%rip), %rdx
	movq	%rdx, %rcx
	movl	$8, %edx
	movq	%rax, %rdi
	call	qsort@PLT
	movl	$1, -80(%rbp)
	jmp	.L19
.L20:
	movl	-76(%rbp), %eax
	movq	-48(%rbp,%rax,8), %rdx
	movl	-80(%rbp), %eax
	salq	$3, %rax
	addq	%rdx, %rax
	movq	(%rax), %rcx
	movl	-76(%rbp), %eax
	movq	-48(%rbp,%rax,8), %rdx
	movl	-80(%rbp), %eax
	subl	$1, %eax
	movl	%eax, %eax
	salq	$3, %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-76(%rbp), %eax
	movq	-48(%rbp,%rax,8), %rsi
	movl	-80(%rbp), %eax
	salq	$3, %rax
	addq	%rsi, %rax
	addq	%rcx, %rdx
	movq	%rdx, (%rax)
	addl	$1, -80(%rbp)
.L19:
	movl	-76(%rbp), %eax
	movl	-64(%rbp,%rax,4), %eax
	cmpl	%eax, -80(%rbp)
	jb	.L20
	addl	$1, -76(%rbp)
.L18:
	cmpl	$3, -76(%rbp)
	jbe	.L21
	movq	-104(%rbp), %rax
	movq	(%rax), %rcx
	movq	-96(%rbp), %rdx
	leaq	-64(%rbp), %rsi
	leaq	-48(%rbp), %rax
	movl	$3, %r8d
	movq	%rax, %rdi
	call	sub2
	movq	%rax, -72(%rbp)
	movl	$0, -76(%rbp)
	jmp	.L22
.L23:
	movl	-76(%rbp), %eax
	movq	-48(%rbp,%rax,8), %rax
	movq	%rax, %rdi
	call	free@PLT
	addl	$1, -76(%rbp)
.L22:
	cmpl	$3, -76(%rbp)
	jbe	.L23
	movq	-72(%rbp), %rax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L25
	call	__stack_chk_fail@PLT
.L25:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	sub1, .-sub1
	.section	.rodata
.LC0:
	.string	"%u %lu"
.LC1:
	.string	"%lu %lu"
.LC2:
	.string	"%lu\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB9:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$112, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movq	stdin(%rip), %rdx
	leaq	-80(%rbp), %rax
	movl	$64, %esi
	movq	%rax, %rdi
	call	fgets@PLT
	leaq	-104(%rbp), %rcx
	leaq	-112(%rbp), %rdx
	leaq	-80(%rbp), %rax
	leaq	.LC0(%rip), %rsi
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_sscanf@PLT
	movl	-112(%rbp), %eax
	movl	%eax, %eax
	salq	$3, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -96(%rbp)
	movl	-112(%rbp), %eax
	movl	%eax, %eax
	salq	$3, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -88(%rbp)
	cmpq	$0, -96(%rbp)
	je	.L27
	cmpq	$0, -88(%rbp)
	jne	.L28
.L27:
	movl	$1, %edi
	call	exit@PLT
.L28:
	movl	$0, -108(%rbp)
	jmp	.L29
.L30:
	movq	stdin(%rip), %rdx
	leaq	-80(%rbp), %rax
	movl	$64, %esi
	movq	%rax, %rdi
	call	fgets@PLT
	movl	-108(%rbp), %eax
	leaq	0(,%rax,8), %rdx
	movq	-88(%rbp), %rax
	leaq	(%rdx,%rax), %rcx
	movl	-108(%rbp), %eax
	leaq	0(,%rax,8), %rdx
	movq	-96(%rbp), %rax
	addq	%rax, %rdx
	leaq	-80(%rbp), %rax
	leaq	.LC1(%rip), %rsi
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_sscanf@PLT
	addl	$1, -108(%rbp)
.L29:
	movl	-112(%rbp), %eax
	cmpl	%eax, -108(%rbp)
	jb	.L30
	movq	-104(%rbp), %rsi
	movl	-112(%rbp), %eax
	movq	-88(%rbp), %rcx
	movq	-96(%rbp), %rdx
	movl	%eax, %edi
	call	sub1
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movq	-96(%rbp), %rax
	movq	%rax, %rdi
	call	free@PLT
	movq	-88(%rbp), %rax
	movq	%rax, %rdi
	call	free@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L32
	call	__stack_chk_fail@PLT
.L32:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.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	cmp
	.type	cmp, @function
cmp:
.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
	movq	(%rax), %rax
	movq	%rax, -16(%rbp)
	movq	-32(%rbp), %rax
	movq	(%rax), %rax
	movq	%rax, -8(%rbp)
	movq	-16(%rbp), %rax
	cmpq	-8(%rbp), %rax
	jbe	.L2
	movl	$-1, %eax
	jmp	.L1
.L2:
	movq	-16(%rbp), %rax
	cmpq	-8(%rbp), %rax
	jnb	.L4
	movl	$1, %eax
	jmp	.L1
.L4:
	movq	-8(%rbp), %rax
	movq	%rax, -16(%rbp)
	cmpq	$0, -16(%rbp)
	je	.L5
	movl	$0, %eax
	jmp	.L1
.L5:
.L1:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	cmp, .-cmp
	.globl	sub2
	.type	sub2, @function
sub2:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%rbx
	subq	$88, %rsp
	.cfi_offset 3, -24
	movq	%rdi, -56(%rbp)
	movq	%rsi, -64(%rbp)
	movq	%rdx, -72(%rbp)
	movq	%rcx, -80(%rbp)
	movl	%r8d, -84(%rbp)
	movq	$0, -40(%rbp)
	movl	-84(%rbp), %edx
	movq	-80(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, -32(%rbp)
	movq	-72(%rbp), %rax
	movl	$0, %edx
	divq	-32(%rbp)
	leal	1(%rax), %edx
	movl	-84(%rbp), %eax
	leaq	0(,%rax,4), %rcx
	movq	-64(%rbp), %rax
	addq	%rcx, %rax
	movl	(%rax), %eax
	cmpl	%eax, %edx
	cmovbe	%edx, %eax
	movl	%eax, -44(%rbp)
	cmpl	$0, -84(%rbp)
	jne	.L7
	movq	-56(%rbp), %rax
	movq	(%rax), %rdx
	movl	-44(%rbp), %eax
	subl	$1, %eax
	movl	%eax, %eax
	salq	$3, %rax
	addq	%rdx, %rax
	movq	(%rax), %rax
	jmp	.L8
.L7:
	movl	$0, -48(%rbp)
	jmp	.L9
.L11:
	movl	-84(%rbp), %eax
	leaq	0(,%rax,8), %rdx
	movq	-56(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-48(%rbp), %eax
	salq	$3, %rax
	addq	%rdx, %rax
	movq	(%rax), %rbx
	movl	-84(%rbp), %eax
	leal	-1(%rax), %ecx
	movl	-48(%rbp), %eax
	imulq	-32(%rbp), %rax
	movq	%rax, %rdx
	movq	-72(%rbp), %rax
	subq	%rdx, %rax
	movq	%rax, %rdi
	movq	-80(%rbp), %rdx
	movq	-64(%rbp), %rsi
	movq	-56(%rbp), %rax
	movl	%ecx, %r8d
	movq	%rdx, %rcx
	movq	%rdi, %rdx
	movq	%rax, %rdi
	call	sub2
	addq	%rbx, %rax
	movq	%rax, -24(%rbp)
	movq	-40(%rbp), %rax
	cmpq	-24(%rbp), %rax
	jnb	.L10
	movq	-24(%rbp), %rax
	movq	%rax, -40(%rbp)
.L10:
	addl	$1, -48(%rbp)
.L9:
	movl	-48(%rbp), %eax
	cmpl	-44(%rbp), %eax
	jb	.L11
	movq	-40(%rbp), %rax
.L8:
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	sub2, .-sub2
	.globl	sub1
	.type	sub1, @function
sub1:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$112, %rsp
	movl	%edi, -84(%rbp)
	movq	%rsi, -96(%rbp)
	movq	%rdx, -104(%rbp)
	movq	%rcx, -112(%rbp)
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, -76(%rbp)
	jmp	.L13
.L15:
	movl	-84(%rbp), %eax
	addl	$1, %eax
	movl	%eax, %eax
	salq	$3, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, %rdx
	movl	-76(%rbp), %eax
	movq	%rdx, -48(%rbp,%rax,8)
	movl	-76(%rbp), %eax
	movq	-48(%rbp,%rax,8), %rax
	testq	%rax, %rax
	jne	.L14
	movl	$1, %edi
	call	exit@PLT
.L14:
	movl	-76(%rbp), %eax
	movq	-48(%rbp,%rax,8), %rax
	movq	$0, (%rax)
	movl	-76(%rbp), %eax
	movl	$1, -64(%rbp,%rax,4)
	addl	$1, -76(%rbp)
.L13:
	cmpl	$3, -76(%rbp)
	jbe	.L15
	movl	$0, -80(%rbp)
	jmp	.L16
.L17:
	movl	-80(%rbp), %eax
	leaq	0(,%rax,8), %rdx
	movq	-104(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rax
	movl	%eax, %edx
	movq	-104(%rbp), %rax
	movq	(%rax), %rax
	movl	%eax, %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	movl	%eax, -76(%rbp)
	movl	-80(%rbp), %eax
	leaq	0(,%rax,8), %rdx
	movq	-112(%rbp), %rax
	leaq	(%rdx,%rax), %rcx
	movl	-76(%rbp), %eax
	movq	-48(%rbp,%rax,8), %rdx
	movl	-76(%rbp), %eax
	movl	-64(%rbp,%rax,4), %eax
	movl	%eax, %eax
	salq	$3, %rax
	addq	%rax, %rdx
	movq	(%rcx), %rax
	movq	%rax, (%rdx)
	movl	-76(%rbp), %eax
	movl	-64(%rbp,%rax,4), %eax
	leal	1(%rax), %edx
	movl	-76(%rbp), %eax
	movl	%edx, -64(%rbp,%rax,4)
	addl	$1, -80(%rbp)
.L16:
	movl	-80(%rbp), %eax
	cmpl	-84(%rbp), %eax
	jb	.L17
	movl	$0, -76(%rbp)
	jmp	.L18
.L21:
	movl	-76(%rbp), %eax
	movl	-64(%rbp,%rax,4), %eax
	subl	$1, %eax
	movl	%eax, %esi
	movl	-76(%rbp), %eax
	movq	-48(%rbp,%rax,8), %rax
	addq	$8, %rax
	leaq	cmp(%rip), %rdx
	movq	%rdx, %rcx
	movl	$8, %edx
	movq	%rax, %rdi
	call	qsort@PLT
	movl	$1, -80(%rbp)
	jmp	.L19
.L20:
	movl	-76(%rbp), %eax
	movq	-48(%rbp,%rax,8), %rdx
	movl	-80(%rbp), %eax
	salq	$3, %rax
	addq	%rdx, %rax
	movq	(%rax), %rcx
	movl	-76(%rbp), %eax
	movq	-48(%rbp,%rax,8), %rdx
	movl	-80(%rbp), %eax
	subl	$1, %eax
	movl	%eax, %eax
	salq	$3, %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-76(%rbp), %eax
	movq	-48(%rbp,%rax,8), %rsi
	movl	-80(%rbp), %eax
	salq	$3, %rax
	addq	%rsi, %rax
	addq	%rcx, %rdx
	movq	%rdx, (%rax)
	addl	$1, -80(%rbp)
.L19:
	movl	-76(%rbp), %eax
	movl	-64(%rbp,%rax,4), %eax
	cmpl	%eax, -80(%rbp)
	jb	.L20
	addl	$1, -76(%rbp)
.L18:
	cmpl	$3, -76(%rbp)
	jbe	.L21
	movq	-104(%rbp), %rax
	movq	(%rax), %rcx
	movq	-96(%rbp), %rdx
	leaq	-64(%rbp), %rsi
	leaq	-48(%rbp), %rax
	movl	$3, %r8d
	movq	%rax, %rdi
	call	sub2
	movq	%rax, -72(%rbp)
	movl	$0, -76(%rbp)
	jmp	.L22
.L23:
	movl	-76(%rbp), %eax
	movq	-48(%rbp,%rax,8), %rax
	movq	%rax, %rdi
	call	free@PLT
	addl	$1, -76(%rbp)
.L22:
	cmpl	$3, -76(%rbp)
	jbe	.L23
	movq	-72(%rbp), %rax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L25
	call	__stack_chk_fail@PLT
.L25:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	sub1, .-sub1
	.section	.rodata
.LC0:
	.string	"%u %lu"
.LC1:
	.string	"%lu %lu"
.LC2:
	.string	"%lu\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB9:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$112, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movq	stdin(%rip), %rdx
	leaq	-80(%rbp), %rax
	movl	$64, %esi
	movq	%rax, %rdi
	call	fgets@PLT
	leaq	-104(%rbp), %rcx
	leaq	-112(%rbp), %rdx
	leaq	-80(%rbp), %rax
	leaq	.LC0(%rip), %rsi
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_sscanf@PLT
	movl	-112(%rbp), %eax
	movl	%eax, %eax
	salq	$3, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -96(%rbp)
	movl	-112(%rbp), %eax
	movl	%eax, %eax
	salq	$3, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -88(%rbp)
	cmpq	$0, -96(%rbp)
	je	.L27
	cmpq	$0, -88(%rbp)
	jne	.L28
.L27:
	movl	$1, %edi
	call	exit@PLT
.L28:
	movl	$0, -108(%rbp)
	jmp	.L29
.L30:
	movq	stdin(%rip), %rdx
	leaq	-80(%rbp), %rax
	movl	$64, %esi
	movq	%rax, %rdi
	call	fgets@PLT
	movl	-108(%rbp), %eax
	leaq	0(,%rax,8), %rdx
	movq	-88(%rbp), %rax
	leaq	(%rdx,%rax), %rcx
	movl	-108(%rbp), %eax
	leaq	0(,%rax,8), %rdx
	movq	-96(%rbp), %rax
	addq	%rax, %rdx
	leaq	-80(%rbp), %rax
	leaq	.LC1(%rip), %rsi
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_sscanf@PLT
	addl	$1, -108(%rbp)
.L29:
	movl	-112(%rbp), %eax
	cmpl	%eax, -108(%rbp)
	jb	.L30
	movq	-104(%rbp), %rsi
	movl	-112(%rbp), %eax
	movq	-88(%rbp), %rcx
	movq	-96(%rbp), %rdx
	movl	%eax, %edi
	call	sub1
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movq	-96(%rbp), %rax
	movq	%rax, %rdi
	call	free@PLT
	movq	-88(%rbp), %rax
	movq	%rax, %rdi
	call	free@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L32
	call	__stack_chk_fail@PLT
.L32:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.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:
