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>

int cmp(const void* a,const void* b){
	return *(int*)a - *(int*)b;
}
int b[200000]={};
int main(void){
	int n,k;
	scanf("%d%d",&n,&k);
	int i,c=0;
	int a[n+1];
	for(i=0;i<n;i++)scanf("%d",&a[i]);
	qsort(a,n,sizeof(int),cmp);
	for(i=0;i<n;i++){
		b[c]++;
		while(a[i]==a[i+1]){
			i++;
			b[c]++;
			if(i>=n)continue;
		}
		c++;
	}
	//cはボールの種類数で,b[i]にはその数が入る
	//ボールに書かれている整数がK種類以下にする最適な方法は、
	//b[i]が小さいヤツから消していく
	qsort(b,c,sizeof(int),cmp);
	int ans = 0;
	for(i=0;i<c-k;i++){
		ans += b[i];
	}
	printf("%d",ans);
	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, -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	cmp, .-cmp
	.globl	b
	.bss
	.align 32
	.type	b, @object
	.size	b, 800000
b:
	.zero	800000
	.section	.rodata
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d"
	.text
	.globl	main
	.type	main, @function
main:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$56, %rsp
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	movq	%rsp, %rax
	movq	%rax, %rbx
	leaq	-88(%rbp), %rdx
	leaq	-92(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -80(%rbp)
	movl	-92(%rbp), %eax
	addl	$1, %eax
	movslq	%eax, %rdx
	subq	$1, %rdx
	movq	%rdx, -72(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, %r14
	movl	$0, %r15d
	movslq	%eax, %rdx
	movq	%rdx, %r12
	movl	$0, %r13d
	cltq
	leaq	0(,%rax,4), %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %edi
	movl	$0, %edx
	divq	%rdi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L4:
	cmpq	%rdx, %rsp
	je	.L5
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L4
.L5:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L6
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L6:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -64(%rbp)
	movl	$0, -84(%rbp)
	jmp	.L7
.L8:
	movl	-84(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-64(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -84(%rbp)
.L7:
	movl	-92(%rbp), %eax
	cmpl	%eax, -84(%rbp)
	jl	.L8
	movl	-92(%rbp), %eax
	movslq	%eax, %rsi
	movq	-64(%rbp), %rax
	leaq	cmp(%rip), %rdx
	movq	%rdx, %rcx
	movl	$4, %edx
	movq	%rax, %rdi
	call	qsort@PLT
	movl	$0, -84(%rbp)
	jmp	.L9
.L12:
	movl	-80(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	b(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	1(%rax), %ecx
	movl	-80(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	b(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	jmp	.L10
.L11:
	addl	$1, -84(%rbp)
	movl	-80(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	b(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	1(%rax), %ecx
	movl	-80(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	b(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	-92(%rbp), %eax
	cmpl	%eax, -84(%rbp)
	jl	.L10
	nop
.L10:
	movq	-64(%rbp), %rax
	movl	-84(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %ecx
	movl	-84(%rbp), %eax
	leal	1(%rax), %edx
	movq	-64(%rbp), %rax
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	cmpl	%eax, %ecx
	je	.L11
	addl	$1, -80(%rbp)
	addl	$1, -84(%rbp)
.L9:
	movl	-92(%rbp), %eax
	cmpl	%eax, -84(%rbp)
	jl	.L12
	movl	-80(%rbp), %eax
	cltq
	leaq	cmp(%rip), %rdx
	movq	%rdx, %rcx
	movl	$4, %edx
	movq	%rax, %rsi
	leaq	b(%rip), %rax
	movq	%rax, %rdi
	call	qsort@PLT
	movl	$0, -76(%rbp)
	movl	$0, -84(%rbp)
	jmp	.L13
.L14:
	movl	-84(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	b(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, -76(%rbp)
	addl	$1, -84(%rbp)
.L13:
	movl	-88(%rbp), %edx
	movl	-80(%rbp), %eax
	subl	%edx, %eax
	cmpl	%eax, -84(%rbp)
	jl	.L14
	movl	-76(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	%rbx, %rsp
	movq	-56(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L16
	call	__stack_chk_fail@PLT
.L16:
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.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:
.LFB39:
	.cfi_startproc
	endbr64
	movl	(%rdi), %eax
	subl	(%rsi), %eax
	ret
	.cfi_endproc
.LFE39:
	.size	cmp, .-cmp
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB40:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	leaq	.LC0(%rip), %rdi
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r15
	pushq	%r14
	leaq	-60(%rbp), %rdx
	leaq	-64(%rbp), %rsi
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$24, %rsp
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	-64(%rbp), %eax
	movq	%rsp, %rsi
	leal	1(%rax), %edx
	movslq	%edx, %rdx
	leaq	15(,%rdx,4), %rdx
	movq	%rdx, %rcx
	andq	$-4096, %rdx
	subq	%rdx, %rsi
	andq	$-16, %rcx
	cmpq	%rsi, %rsp
	je	.L5
.L32:
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	cmpq	%rsi, %rsp
	jne	.L32
.L5:
	andl	$4095, %ecx
	subq	%rcx, %rsp
	testq	%rcx, %rcx
	jne	.L33
.L6:
	leaq	3(%rsp), %rbx
	leaq	.LC1(%rip), %r12
	movq	%rbx, %r13
	andq	$-4, %rbx
	shrq	$2, %r13
	testl	%eax, %eax
	jle	.L7
	movq	%rbx, %r15
	xorl	%r14d, %r14d
	.p2align 4,,10
	.p2align 3
.L8:
	movq	%r15, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	addl	$1, %r14d
	call	__isoc99_scanf@PLT
	movl	-64(%rbp), %eax
	addq	$4, %r15
	cmpl	%r14d, %eax
	jg	.L8
.L7:
	leaq	cmp(%rip), %r15
	movslq	%eax, %rsi
	movl	$4, %edx
	movq	%rbx, %rdi
	movq	%r15, %rcx
	call	qsort@PLT
	movl	-64(%rbp), %r9d
	testl	%r9d, %r9d
	jle	.L19
	leaq	b(%rip), %r14
	movl	0(,%r13,4), %edx
	xorl	%edi, %edi
	xorl	%r13d, %r13d
	movq	%r14, %r8
	.p2align 4,,10
	.p2align 3
.L12:
	movl	(%r8), %esi
	leal	1(%rsi), %eax
	movl	%eax, (%r8)
	leal	1(%rdi), %eax
	movslq	%eax, %rcx
	movl	(%rbx,%rcx,4), %ecx
	cmpl	%edx, %ecx
	jne	.L20
	movslq	%edi, %rax
	subl	%edi, %esi
	movl	4(%rbx,%rax,4), %edx
	leal	2(%rdi), %eax
	cltq
	.p2align 4,,10
	.p2align 3
.L11:
	leal	(%rsi,%rax), %r10d
	movl	%eax, %edi
	addq	$1, %rax
	movl	%edx, %ecx
	movl	-4(%rbx,%rax,4), %edx
	cmpl	%ecx, %edx
	je	.L11
	movl	%r10d, (%r8)
.L10:
	addl	$1, %r13d
	addq	$4, %r8
	cmpl	%edi, %r9d
	jg	.L12
.L9:
	movslq	%r13d, %rsi
	movq	%r15, %rcx
	movl	$4, %edx
	movq	%r14, %rdi
	call	qsort@PLT
	subl	-60(%rbp), %r13d
	testl	%r13d, %r13d
	jle	.L21
	leal	-1(%r13), %eax
	cmpl	$2, %eax
	jbe	.L22
	movl	%r13d, %edx
	leaq	b(%rip), %rax
	pxor	%xmm0, %xmm0
	shrl	$2, %edx
	leaq	16(%rax), %rcx
	subl	$1, %edx
	salq	$4, %rdx
	addq	%rcx, %rdx
	.p2align 4,,10
	.p2align 3
.L15:
	paddd	(%rax), %xmm0
	addq	$16, %rax
	cmpq	%rdx, %rax
	jne	.L15
	movdqa	%xmm0, %xmm1
	movl	%r13d, %eax
	psrldq	$8, %xmm1
	andl	$-4, %eax
	paddd	%xmm1, %xmm0
	movdqa	%xmm0, %xmm1
	psrldq	$4, %xmm1
	paddd	%xmm1, %xmm0
	movd	%xmm0, %edx
	testb	$3, %r13b
	je	.L13
.L14:
	movslq	%eax, %rcx
	addl	(%r14,%rcx,4), %edx
	leal	1(%rax), %ecx
	cmpl	%ecx, %r13d
	jle	.L13
	movslq	%ecx, %rcx
	addl	$2, %eax
	addl	(%r14,%rcx,4), %edx
	cmpl	%eax, %r13d
	jle	.L13
	cltq
	addl	(%r14,%rax,4), %edx
.L13:
	xorl	%eax, %eax
	movq	%r12, %rsi
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	-56(%rbp), %rax
	subq	%fs:40, %rax
	jne	.L34
	leaq	-40(%rbp), %rsp
	xorl	%eax, %eax
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.cfi_remember_state
	.cfi_def_cfa 7, 8
	ret
	.p2align 4,,10
	.p2align 3
.L20:
	.cfi_restore_state
	movl	%ecx, %edx
	movl	%eax, %edi
	jmp	.L10
.L33:
	orq	$0, -8(%rsp,%rcx)
	jmp	.L6
.L21:
	xorl	%edx, %edx
	jmp	.L13
.L19:
	xorl	%r13d, %r13d
	leaq	b(%rip), %r14
	jmp	.L9
.L22:
	xorl	%edx, %edx
	xorl	%eax, %eax
	jmp	.L14
.L34:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE40:
	.size	main, .-main
	.globl	b
	.bss
	.align 32
	.type	b, @object
	.size	b, 800000
b:
	.zero	800000
	.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:
.LFB39:
	.cfi_startproc
	endbr64
	movl	(%rdi), %eax
	subl	(%rsi), %eax
	ret
	.cfi_endproc
.LFE39:
	.size	cmp, .-cmp
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB40:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	leaq	.LC0(%rip), %rdi
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r15
	pushq	%r14
	leaq	-60(%rbp), %rdx
	leaq	-64(%rbp), %rsi
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$24, %rsp
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	-64(%rbp), %eax
	movq	%rsp, %rsi
	leal	1(%rax), %edx
	movslq	%edx, %rdx
	leaq	15(,%rdx,4), %rdx
	movq	%rdx, %rcx
	andq	$-4096, %rdx
	subq	%rdx, %rsi
	andq	$-16, %rcx
	cmpq	%rsi, %rsp
	je	.L5
.L32:
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	cmpq	%rsi, %rsp
	jne	.L32
.L5:
	andl	$4095, %ecx
	subq	%rcx, %rsp
	testq	%rcx, %rcx
	jne	.L33
.L6:
	leaq	3(%rsp), %rbx
	leaq	.LC1(%rip), %r12
	movq	%rbx, %r13
	andq	$-4, %rbx
	shrq	$2, %r13
	testl	%eax, %eax
	jle	.L7
	movq	%rbx, %r15
	xorl	%r14d, %r14d
	.p2align 4,,10
	.p2align 3
.L8:
	movq	%r15, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	addl	$1, %r14d
	call	__isoc99_scanf@PLT
	movl	-64(%rbp), %eax
	addq	$4, %r15
	cmpl	%r14d, %eax
	jg	.L8
.L7:
	leaq	cmp(%rip), %r15
	movslq	%eax, %rsi
	movl	$4, %edx
	movq	%rbx, %rdi
	movq	%r15, %rcx
	call	qsort@PLT
	movl	-64(%rbp), %r9d
	testl	%r9d, %r9d
	jle	.L19
	leaq	b(%rip), %r14
	movl	0(,%r13,4), %edx
	xorl	%edi, %edi
	xorl	%r13d, %r13d
	movq	%r14, %r8
	.p2align 4,,10
	.p2align 3
.L12:
	movl	(%r8), %esi
	leal	1(%rsi), %eax
	movl	%eax, (%r8)
	leal	1(%rdi), %eax
	movslq	%eax, %rcx
	movl	(%rbx,%rcx,4), %ecx
	cmpl	%edx, %ecx
	jne	.L20
	movslq	%edi, %rax
	subl	%edi, %esi
	movl	4(%rbx,%rax,4), %edx
	leal	2(%rdi), %eax
	cltq
	.p2align 4,,10
	.p2align 3
.L11:
	leal	(%rsi,%rax), %r10d
	movl	%eax, %edi
	addq	$1, %rax
	movl	%edx, %ecx
	movl	-4(%rbx,%rax,4), %edx
	cmpl	%ecx, %edx
	je	.L11
	movl	%r10d, (%r8)
.L10:
	addl	$1, %r13d
	addq	$4, %r8
	cmpl	%edi, %r9d
	jg	.L12
.L9:
	movslq	%r13d, %rsi
	movq	%r15, %rcx
	movl	$4, %edx
	movq	%r14, %rdi
	call	qsort@PLT
	subl	-60(%rbp), %r13d
	testl	%r13d, %r13d
	jle	.L21
	leal	-1(%r13), %eax
	cmpl	$2, %eax
	jbe	.L22
	movl	%r13d, %edx
	leaq	b(%rip), %rax
	pxor	%xmm0, %xmm0
	shrl	$2, %edx
	leaq	16(%rax), %rcx
	subl	$1, %edx
	salq	$4, %rdx
	addq	%rcx, %rdx
	.p2align 4,,10
	.p2align 3
.L15:
	paddd	(%rax), %xmm0
	addq	$16, %rax
	cmpq	%rdx, %rax
	jne	.L15
	movdqa	%xmm0, %xmm1
	movl	%r13d, %eax
	psrldq	$8, %xmm1
	andl	$-4, %eax
	paddd	%xmm1, %xmm0
	movdqa	%xmm0, %xmm1
	psrldq	$4, %xmm1
	paddd	%xmm1, %xmm0
	movd	%xmm0, %edx
	testb	$3, %r13b
	je	.L13
.L14:
	movslq	%eax, %rcx
	addl	(%r14,%rcx,4), %edx
	leal	1(%rax), %ecx
	cmpl	%ecx, %r13d
	jle	.L13
	movslq	%ecx, %rcx
	addl	$2, %eax
	addl	(%r14,%rcx,4), %edx
	cmpl	%eax, %r13d
	jle	.L13
	cltq
	addl	(%r14,%rax,4), %edx
.L13:
	xorl	%eax, %eax
	movq	%r12, %rsi
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	-56(%rbp), %rax
	subq	%fs:40, %rax
	jne	.L34
	leaq	-40(%rbp), %rsp
	xorl	%eax, %eax
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.cfi_remember_state
	.cfi_def_cfa 7, 8
	ret
	.p2align 4,,10
	.p2align 3
.L20:
	.cfi_restore_state
	movl	%ecx, %edx
	movl	%eax, %edi
	jmp	.L10
.L33:
	orq	$0, -8(%rsp,%rcx)
	jmp	.L6
.L21:
	xorl	%edx, %edx
	jmp	.L13
.L19:
	xorl	%r13d, %r13d
	leaq	b(%rip), %r14
	jmp	.L9
.L22:
	xorl	%edx, %edx
	xorl	%eax, %eax
	jmp	.L14
.L34:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE40:
	.size	main, .-main
	.globl	b
	.bss
	.align 32
	.type	b, @object
	.size	b, 800000
b:
	.zero	800000
	.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>

int cmp(const void* a,const void* b){
	return *(int*)a - *(int*)b;
}
int b[200000]={};
int main(void){
	int n,k;
	scanf("%d%d",&n,&k);
	int i,c=0;
	int a[n+1];
	for(i=0;i<n;i++)scanf("%d",&a[i]);
	qsort(a,n,sizeof(int),cmp);
	for(i=0;i<n;i++){
		b[c]++;
		while(a[i]==a[i+1]){
			i++;
			b[c]++;
			if(i>=n)continue;
		}
		c++;
	}
	//cはボールの種類数で,b[i]にはその数が入る
	//ボールに書かれている整数がK種類以下にする最適な方法は、
	//b[i]が小さいヤツから消していく
	qsort(b,c,sizeof(int),cmp);
	int ans = 0;
	for(i=0;i<c-k;i++){
		ans += b[i];
	}
	printf("%d",ans);
	return 0;
}
4 4
0 1 2 2
 10 3
5 1 3 2 4 1 2 2 3 4
 10 3
5 1 3 4 8 1 2 2 3 4
 10 3
3 2 3 4 8 1 2 2 3 4
 5 2
2 1 4 2 1
 10 1
5 1 3 2 4 1 2 2 3 8
 10 1
5 2 3 2 4 1 2 2 3 8
 4 4
0 1 2 4
 4 4
-1 1 2 4
 4 4
-2 1 2 4

0 3 4 2 1 7 6 0 0 0
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>

int cmp(const void* a,const void* b){
	return *(int*)a - *(int*)b;
}
int b[200000]={};
int main(void){
	int n,k;
	scanf("%d%d",&n,&k);
	int i,c=0;
	int a[n+1];
	for(i=0;i<n;i++)scanf("%d",&a[i]);
	qsort(a,n,sizeof(int),cmp);
	for(i=0;i<n;i++){
		b[c]++;
		while(a[i]==a[i+1]){
			i++;
			b[c]++;
			if(i>=n)continue;
		}
		c++;
	}
	//cはボールの種類数で,b[i]にはその数が入る
	//ボールに書かれている整数がK種類以下にする最適な方法は、
	//b[i]が小さいヤツから消していく
	qsort(b,c,sizeof(int),cmp);
	int ans = 0;
	for(i=0;i<c-k;i++){
		ans += b[i];
	}
	printf("%d",ans);
	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, -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	cmp, .-cmp
	.globl	b
	.bss
	.align 32
	.type	b, @object
	.size	b, 800000
b:
	.zero	800000
	.section	.rodata
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d"
	.text
	.globl	main
	.type	main, @function
main:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$56, %rsp
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	movq	%rsp, %rax
	movq	%rax, %rbx
	leaq	-88(%rbp), %rdx
	leaq	-92(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -80(%rbp)
	movl	-92(%rbp), %eax
	addl	$1, %eax
	movslq	%eax, %rdx
	subq	$1, %rdx
	movq	%rdx, -72(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, %r14
	movl	$0, %r15d
	movslq	%eax, %rdx
	movq	%rdx, %r12
	movl	$0, %r13d
	cltq
	leaq	0(,%rax,4), %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %edi
	movl	$0, %edx
	divq	%rdi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L4:
	cmpq	%rdx, %rsp
	je	.L5
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L4
.L5:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L6
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L6:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -64(%rbp)
	movl	$0, -84(%rbp)
	jmp	.L7
.L8:
	movl	-84(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-64(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -84(%rbp)
.L7:
	movl	-92(%rbp), %eax
	cmpl	%eax, -84(%rbp)
	jl	.L8
	movl	-92(%rbp), %eax
	movslq	%eax, %rsi
	movq	-64(%rbp), %rax
	leaq	cmp(%rip), %rdx
	movq	%rdx, %rcx
	movl	$4, %edx
	movq	%rax, %rdi
	call	qsort@PLT
	movl	$0, -84(%rbp)
	jmp	.L9
.L12:
	movl	-80(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	b(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	1(%rax), %ecx
	movl	-80(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	b(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	jmp	.L10
.L11:
	addl	$1, -84(%rbp)
	movl	-80(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	b(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	1(%rax), %ecx
	movl	-80(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	b(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	-92(%rbp), %eax
	cmpl	%eax, -84(%rbp)
	jl	.L10
	nop
.L10:
	movq	-64(%rbp), %rax
	movl	-84(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %ecx
	movl	-84(%rbp), %eax
	leal	1(%rax), %edx
	movq	-64(%rbp), %rax
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	cmpl	%eax, %ecx
	je	.L11
	addl	$1, -80(%rbp)
	addl	$1, -84(%rbp)
.L9:
	movl	-92(%rbp), %eax
	cmpl	%eax, -84(%rbp)
	jl	.L12
	movl	-80(%rbp), %eax
	cltq
	leaq	cmp(%rip), %rdx
	movq	%rdx, %rcx
	movl	$4, %edx
	movq	%rax, %rsi
	leaq	b(%rip), %rax
	movq	%rax, %rdi
	call	qsort@PLT
	movl	$0, -76(%rbp)
	movl	$0, -84(%rbp)
	jmp	.L13
.L14:
	movl	-84(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	b(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, -76(%rbp)
	addl	$1, -84(%rbp)
.L13:
	movl	-88(%rbp), %edx
	movl	-80(%rbp), %eax
	subl	%edx, %eax
	cmpl	%eax, -84(%rbp)
	jl	.L14
	movl	-76(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	%rbx, %rsp
	movq	-56(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L16
	call	__stack_chk_fail@PLT
.L16:
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.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, -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	cmp, .-cmp
	.globl	b
	.bss
	.align 32
	.type	b, @object
	.size	b, 800000
b:
	.zero	800000
	.section	.rodata
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d"
	.text
	.globl	main
	.type	main, @function
main:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$56, %rsp
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	movq	%rsp, %rax
	movq	%rax, %rbx
	leaq	-88(%rbp), %rdx
	leaq	-92(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -80(%rbp)
	movl	-92(%rbp), %eax
	addl	$1, %eax
	movslq	%eax, %rdx
	subq	$1, %rdx
	movq	%rdx, -72(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, %r14
	movl	$0, %r15d
	movslq	%eax, %rdx
	movq	%rdx, %r12
	movl	$0, %r13d
	cltq
	leaq	0(,%rax,4), %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %edi
	movl	$0, %edx
	divq	%rdi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L4:
	cmpq	%rdx, %rsp
	je	.L5
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L4
.L5:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L6
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L6:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -64(%rbp)
	movl	$0, -84(%rbp)
	jmp	.L7
.L8:
	movl	-84(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-64(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -84(%rbp)
.L7:
	movl	-92(%rbp), %eax
	cmpl	%eax, -84(%rbp)
	jl	.L8
	movl	-92(%rbp), %eax
	movslq	%eax, %rsi
	movq	-64(%rbp), %rax
	leaq	cmp(%rip), %rdx
	movq	%rdx, %rcx
	movl	$4, %edx
	movq	%rax, %rdi
	call	qsort@PLT
	movl	$0, -84(%rbp)
	jmp	.L9
.L12:
	movl	-80(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	b(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	1(%rax), %ecx
	movl	-80(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	b(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	jmp	.L10
.L11:
	addl	$1, -84(%rbp)
	movl	-80(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	b(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	1(%rax), %ecx
	movl	-80(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	b(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	-92(%rbp), %eax
	cmpl	%eax, -84(%rbp)
	jl	.L10
	nop
.L10:
	movq	-64(%rbp), %rax
	movl	-84(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %ecx
	movl	-84(%rbp), %eax
	leal	1(%rax), %edx
	movq	-64(%rbp), %rax
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	cmpl	%eax, %ecx
	je	.L11
	addl	$1, -80(%rbp)
	addl	$1, -84(%rbp)
.L9:
	movl	-92(%rbp), %eax
	cmpl	%eax, -84(%rbp)
	jl	.L12
	movl	-80(%rbp), %eax
	cltq
	leaq	cmp(%rip), %rdx
	movq	%rdx, %rcx
	movl	$4, %edx
	movq	%rax, %rsi
	leaq	b(%rip), %rax
	movq	%rax, %rdi
	call	qsort@PLT
	movl	$0, -76(%rbp)
	movl	$0, -84(%rbp)
	jmp	.L13
.L14:
	movl	-84(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	b(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, -76(%rbp)
	addl	$1, -84(%rbp)
.L13:
	movl	-88(%rbp), %edx
	movl	-80(%rbp), %eax
	subl	%edx, %eax
	cmpl	%eax, -84(%rbp)
	jl	.L14
	movl	-76(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	%rbx, %rsp
	movq	-56(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L16
	call	__stack_chk_fail@PLT
.L16:
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.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:
