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 *n1, const void *n2)
{
    return *(int *)n1 - *(int *)n2;
}

int main(void)
{
    int inputN, inputQ, *inputA, *flag, answerCount = 1;
    long int inputK;
    scanf("%d%ld%d", &inputN, &inputK, &inputQ);
    inputA = (int *)malloc(sizeof(int) * inputQ);
    flag = (int *)malloc(sizeof(int) * inputN);
    if (inputK - inputQ > 0)
    {
        for (int index = 0; index < inputN; index++)
        {
            flag[index] = 1;
        }
    }
    else
    {
        for (int index = 0; index < inputN; index++)
        {
            flag[index] = 0;
        }
    }
    for (int count = 0; count < inputQ; count++)
    {
        scanf("%d", &inputA[count]);
    }
    qsort(inputA, inputQ, sizeof(int), cmp);
    for (int count = 0; count < inputQ; count++)
    {
        if (count == inputQ - 1)
        {
            if (inputK - (inputQ - answerCount) > 0)
            {
                flag[inputA[count] - 1] = 1;
                break;
            }
        }
        if (inputA[count] != inputA[count + 1])
        {
            if (inputK - (inputQ - answerCount) > 0)
            {
                flag[inputA[count] - 1] = 1;
            }
            answerCount = 1;
        }
        else
        {
            answerCount++;
        }
    }
    for (int index = 0; index < inputN; index++)
    {
        if (flag[index])
        {
            printf("Yes\n");
        }
        else
        {
            printf("No\n");
        }
    }

    free(inputA);
    free(flag);

    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
	.section	.rodata
.LC0:
	.string	"%d%ld%d"
.LC1:
	.string	"%d"
.LC2:
	.string	"Yes"
.LC3:
	.string	"No"
	.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
	subq	$64, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$1, -56(%rbp)
	leaq	-60(%rbp), %rcx
	leaq	-32(%rbp), %rdx
	leaq	-64(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-60(%rbp), %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -24(%rbp)
	movl	-64(%rbp), %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -16(%rbp)
	movq	-32(%rbp), %rax
	movl	-60(%rbp), %edx
	movslq	%edx, %rdx
	subq	%rdx, %rax
	testq	%rax, %rax
	jle	.L4
	movl	$0, -52(%rbp)
	jmp	.L5
.L6:
	movl	-52(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	$1, (%rax)
	addl	$1, -52(%rbp)
.L5:
	movl	-64(%rbp), %eax
	cmpl	%eax, -52(%rbp)
	jl	.L6
	jmp	.L7
.L4:
	movl	$0, -48(%rbp)
	jmp	.L8
.L9:
	movl	-48(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	$0, (%rax)
	addl	$1, -48(%rbp)
.L8:
	movl	-64(%rbp), %eax
	cmpl	%eax, -48(%rbp)
	jl	.L9
.L7:
	movl	$0, -44(%rbp)
	jmp	.L10
.L11:
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -44(%rbp)
.L10:
	movl	-60(%rbp), %eax
	cmpl	%eax, -44(%rbp)
	jl	.L11
	movl	-60(%rbp), %eax
	movslq	%eax, %rsi
	movq	-24(%rbp), %rax
	leaq	cmp(%rip), %rdx
	movq	%rdx, %rcx
	movl	$4, %edx
	movq	%rax, %rdi
	call	qsort@PLT
	movl	$0, -40(%rbp)
	jmp	.L12
.L18:
	movl	-60(%rbp), %eax
	subl	$1, %eax
	cmpl	%eax, -40(%rbp)
	jne	.L13
	movq	-32(%rbp), %rdx
	movl	-60(%rbp), %eax
	subl	-56(%rbp), %eax
	movslq	%eax, %rcx
	movq	%rdx, %rax
	subq	%rcx, %rax
	testq	%rax, %rax
	jle	.L13
	movl	-40(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cltq
	salq	$2, %rax
	leaq	-4(%rax), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	$1, (%rax)
	jmp	.L14
.L13:
	movl	-40(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	movl	-40(%rbp), %eax
	cltq
	addq	$1, %rax
	leaq	0(,%rax,4), %rcx
	movq	-24(%rbp), %rax
	addq	%rcx, %rax
	movl	(%rax), %eax
	cmpl	%eax, %edx
	je	.L15
	movq	-32(%rbp), %rdx
	movl	-60(%rbp), %eax
	subl	-56(%rbp), %eax
	movslq	%eax, %rcx
	movq	%rdx, %rax
	subq	%rcx, %rax
	testq	%rax, %rax
	jle	.L16
	movl	-40(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cltq
	salq	$2, %rax
	leaq	-4(%rax), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	$1, (%rax)
.L16:
	movl	$1, -56(%rbp)
	jmp	.L17
.L15:
	addl	$1, -56(%rbp)
.L17:
	addl	$1, -40(%rbp)
.L12:
	movl	-60(%rbp), %eax
	cmpl	%eax, -40(%rbp)
	jl	.L18
.L14:
	movl	$0, -36(%rbp)
	jmp	.L19
.L22:
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	testl	%eax, %eax
	je	.L20
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L21
.L20:
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
.L21:
	addl	$1, -36(%rbp)
.L19:
	movl	-64(%rbp), %eax
	cmpl	%eax, -36(%rbp)
	jl	.L22
	movq	-24(%rbp), %rax
	movq	%rax, %rdi
	call	free@PLT
	movq	-16(%rbp), %rax
	movq	%rax, %rdi
	call	free@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L24
	call	__stack_chk_fail@PLT
.L24:
	leave
	.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%ld%d"
.LC2:
	.string	"%d"
.LC3:
	.string	"Yes"
.LC4:
	.string	"No"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB40:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	.LC0(%rip), %rdi
	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	$56, %rsp
	.cfi_def_cfa_offset 112
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	leaq	28(%rsp), %rcx
	leaq	32(%rsp), %rdx
	leaq	24(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movslq	28(%rsp), %r8
	leaq	0(,%r8,4), %rdi
	movq	%r8, 8(%rsp)
	movq	%r8, %r14
	call	malloc@PLT
	movslq	24(%rsp), %r13
	movq	%rax, %rbp
	movq	%r13, %rbx
	salq	$2, %r13
	movq	%r13, %rdi
	call	malloc@PLT
	movq	8(%rsp), %r8
	movq	%rax, %r12
	cmpq	%r8, 32(%rsp)
	jle	.L38
	testl	%ebx, %ebx
	jle	.L8
	leal	-1(%rbx), %eax
	cmpl	$2, %eax
	jbe	.L27
	movl	%ebx, %edx
	movdqa	.LC1(%rip), %xmm0
	movq	%r12, %rax
	shrl	$2, %edx
	salq	$4, %rdx
	addq	%r12, %rdx
	.p2align 4,,10
	.p2align 3
.L10:
	movups	%xmm0, (%rax)
	addq	$16, %rax
	cmpq	%rax, %rdx
	jne	.L10
	movl	%ebx, %eax
	andl	$-4, %eax
	testb	$3, %bl
	je	.L8
.L9:
	movslq	%eax, %rdx
	movl	$1, (%r12,%rdx,4)
	leaq	0(,%rdx,4), %rcx
	leal	1(%rax), %edx
	cmpl	%edx, %ebx
	jle	.L8
	movl	$1, 4(%r12,%rcx)
	addl	$2, %eax
	cmpl	%eax, %ebx
	jle	.L8
	movl	$1, 8(%r12,%rcx)
.L8:
	movq	%rbp, %r13
	xorl	%ebx, %ebx
	leaq	.LC2(%rip), %r15
	testl	%r14d, %r14d
	jle	.L7
	.p2align 4,,10
	.p2align 3
.L13:
	movq	%r13, %rsi
	movq	%r15, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	movl	28(%rsp), %r14d
	addq	$4, %r13
	cmpl	%ebx, %r14d
	jg	.L13
	movslq	%r14d, %r8
.L7:
	movq	%r8, %rsi
	leaq	cmp(%rip), %rcx
	movl	$4, %edx
	movq	%rbp, %rdi
	call	qsort@PLT
	movl	28(%rsp), %r8d
	testl	%r8d, %r8d
	jle	.L15
	movq	32(%rsp), %r10
	leal	-1(%r8), %edi
	movslq	%r8d, %r9
	xorl	%eax, %eax
	movl	$1, %ecx
	jmp	.L21
	.p2align 4,,10
	.p2align 3
.L16:
	cmpl	%edx, 4(%rbp,%rax,4)
	je	.L19
	movl	%r8d, %esi
	subl	%ecx, %esi
	movslq	%esi, %rcx
	cmpq	%rcx, %r10
	jle	.L30
	movl	$1, -4(%r12,%rdx,4)
	movl	$1, %ecx
.L20:
	addq	$1, %rax
	cmpq	%r9, %rax
	je	.L15
.L21:
	movslq	0(%rbp,%rax,4), %rdx
	cmpl	%eax, %edi
	jne	.L16
	movl	%r8d, %esi
	subl	%ecx, %esi
	movslq	%esi, %rsi
	cmpq	%rsi, %r10
	jg	.L39
	cmpl	%edx, 4(%rbp,%rax,4)
	je	.L19
.L30:
	addq	$1, %rax
	movl	$1, %ecx
	cmpq	%r9, %rax
	jne	.L21
	.p2align 4,,10
	.p2align 3
.L15:
	movl	24(%rsp), %edx
	xorl	%ebx, %ebx
	leaq	.LC4(%rip), %r14
	leaq	.LC3(%rip), %r13
	testl	%edx, %edx
	jle	.L25
	.p2align 4,,10
	.p2align 3
.L18:
	movl	(%r12,%rbx,4), %eax
	testl	%eax, %eax
	je	.L23
	movq	%r13, %rdi
	addq	$1, %rbx
	call	puts@PLT
	cmpl	%ebx, 24(%rsp)
	jg	.L18
.L25:
	movq	%rbp, %rdi
	call	free@PLT
	movq	%r12, %rdi
	call	free@PLT
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L40
	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
.L19:
	.cfi_restore_state
	addl	$1, %ecx
	jmp	.L20
	.p2align 4,,10
	.p2align 3
.L23:
	movq	%r14, %rdi
	addq	$1, %rbx
	call	puts@PLT
	cmpl	%ebx, 24(%rsp)
	jg	.L18
	jmp	.L25
.L38:
	testl	%ebx, %ebx
	jle	.L8
	movq	%r13, %rdx
	xorl	%esi, %esi
	movq	%rax, %rdi
	movq	%r8, 8(%rsp)
	call	memset@PLT
	movq	8(%rsp), %r8
	jmp	.L8
.L39:
	movl	$1, -4(%r12,%rdx,4)
	jmp	.L15
.L27:
	xorl	%eax, %eax
	jmp	.L9
.L40:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE40:
	.size	main, .-main
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC1:
	.long	1
	.long	1
	.long	1
	.long	1
	.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%ld%d"
.LC2:
	.string	"%d"
.LC3:
	.string	"Yes"
.LC4:
	.string	"No"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB40:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	.LC0(%rip), %rdi
	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	$56, %rsp
	.cfi_def_cfa_offset 112
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	leaq	28(%rsp), %rcx
	leaq	32(%rsp), %rdx
	leaq	24(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movslq	28(%rsp), %r8
	leaq	0(,%r8,4), %rdi
	movq	%r8, 8(%rsp)
	movq	%r8, %r14
	call	malloc@PLT
	movslq	24(%rsp), %r13
	movq	%rax, %rbp
	movq	%r13, %rbx
	salq	$2, %r13
	movq	%r13, %rdi
	call	malloc@PLT
	movq	8(%rsp), %r8
	movq	%rax, %r12
	cmpq	%r8, 32(%rsp)
	jle	.L38
	testl	%ebx, %ebx
	jle	.L8
	leal	-1(%rbx), %eax
	cmpl	$2, %eax
	jbe	.L27
	movl	%ebx, %edx
	movdqa	.LC1(%rip), %xmm0
	movq	%r12, %rax
	shrl	$2, %edx
	salq	$4, %rdx
	addq	%r12, %rdx
	.p2align 4,,10
	.p2align 3
.L10:
	movups	%xmm0, (%rax)
	addq	$16, %rax
	cmpq	%rax, %rdx
	jne	.L10
	movl	%ebx, %eax
	andl	$-4, %eax
	testb	$3, %bl
	je	.L8
.L9:
	movslq	%eax, %rdx
	movl	$1, (%r12,%rdx,4)
	leaq	0(,%rdx,4), %rcx
	leal	1(%rax), %edx
	cmpl	%edx, %ebx
	jle	.L8
	movl	$1, 4(%r12,%rcx)
	addl	$2, %eax
	cmpl	%eax, %ebx
	jle	.L8
	movl	$1, 8(%r12,%rcx)
.L8:
	movq	%rbp, %r13
	xorl	%ebx, %ebx
	leaq	.LC2(%rip), %r15
	testl	%r14d, %r14d
	jle	.L7
	.p2align 4,,10
	.p2align 3
.L13:
	movq	%r13, %rsi
	movq	%r15, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	movl	28(%rsp), %r14d
	addq	$4, %r13
	cmpl	%ebx, %r14d
	jg	.L13
	movslq	%r14d, %r8
.L7:
	movq	%r8, %rsi
	leaq	cmp(%rip), %rcx
	movl	$4, %edx
	movq	%rbp, %rdi
	call	qsort@PLT
	movl	28(%rsp), %r8d
	testl	%r8d, %r8d
	jle	.L15
	movq	32(%rsp), %r10
	leal	-1(%r8), %edi
	movslq	%r8d, %r9
	xorl	%eax, %eax
	movl	$1, %ecx
	jmp	.L21
	.p2align 4,,10
	.p2align 3
.L16:
	cmpl	%edx, 4(%rbp,%rax,4)
	je	.L19
	movl	%r8d, %esi
	subl	%ecx, %esi
	movslq	%esi, %rcx
	cmpq	%rcx, %r10
	jle	.L30
	movl	$1, -4(%r12,%rdx,4)
	movl	$1, %ecx
.L20:
	addq	$1, %rax
	cmpq	%r9, %rax
	je	.L15
.L21:
	movslq	0(%rbp,%rax,4), %rdx
	cmpl	%eax, %edi
	jne	.L16
	movl	%r8d, %esi
	subl	%ecx, %esi
	movslq	%esi, %rsi
	cmpq	%rsi, %r10
	jg	.L39
	cmpl	%edx, 4(%rbp,%rax,4)
	je	.L19
.L30:
	addq	$1, %rax
	movl	$1, %ecx
	cmpq	%r9, %rax
	jne	.L21
	.p2align 4,,10
	.p2align 3
.L15:
	movl	24(%rsp), %edx
	xorl	%ebx, %ebx
	leaq	.LC4(%rip), %r14
	leaq	.LC3(%rip), %r13
	testl	%edx, %edx
	jle	.L25
	.p2align 4,,10
	.p2align 3
.L18:
	movl	(%r12,%rbx,4), %eax
	testl	%eax, %eax
	je	.L23
	movq	%r13, %rdi
	addq	$1, %rbx
	call	puts@PLT
	cmpl	%ebx, 24(%rsp)
	jg	.L18
.L25:
	movq	%rbp, %rdi
	call	free@PLT
	movq	%r12, %rdi
	call	free@PLT
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L40
	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
.L19:
	.cfi_restore_state
	addl	$1, %ecx
	jmp	.L20
	.p2align 4,,10
	.p2align 3
.L23:
	movq	%r14, %rdi
	addq	$1, %rbx
	call	puts@PLT
	cmpl	%ebx, 24(%rsp)
	jg	.L18
	jmp	.L25
.L38:
	testl	%ebx, %ebx
	jle	.L8
	movq	%r13, %rdx
	xorl	%esi, %esi
	movq	%rax, %rdi
	movq	%r8, 8(%rsp)
	call	memset@PLT
	movq	8(%rsp), %r8
	jmp	.L8
.L39:
	movl	$1, -4(%r12,%rdx,4)
	jmp	.L15
.L27:
	xorl	%eax, %eax
	jmp	.L9
.L40:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE40:
	.size	main, .-main
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC1:
	.long	1
	.long	1
	.long	1
	.long	1
	.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 *n1, const void *n2)
{
    return *(int *)n1 - *(int *)n2;
}

int main(void)
{
    int inputN, inputQ, *inputA, *flag, answerCount = 1;
    long int inputK;
    scanf("%d%ld%d", &inputN, &inputK, &inputQ);
    inputA = (int *)malloc(sizeof(int) * inputQ);
    flag = (int *)malloc(sizeof(int) * inputN);
    if (inputK - inputQ > 0)
    {
        for (int index = 0; index < inputN; index++)
        {
            flag[index] = 1;
        }
    }
    else
    {
        for (int index = 0; index < inputN; index++)
        {
            flag[index] = 0;
        }
    }
    for (int count = 0; count < inputQ; count++)
    {
        scanf("%d", &inputA[count]);
    }
    qsort(inputA, inputQ, sizeof(int), cmp);
    for (int count = 0; count < inputQ; count++)
    {
        if (count == inputQ - 1)
        {
            if (inputK - (inputQ - answerCount) > 0)
            {
                flag[inputA[count] - 1] = 1;
                break;
            }
        }
        if (inputA[count] != inputA[count + 1])
        {
            if (inputK - (inputQ - answerCount) > 0)
            {
                flag[inputA[count] - 1] = 1;
            }
            answerCount = 1;
        }
        else
        {
            answerCount++;
        }
    }
    for (int index = 0; index < inputN; index++)
    {
        if (flag[index])
        {
            printf("Yes\n");
        }
        else
        {
            printf("No\n");
        }
    }

    free(inputA);
    free(flag);

    return 0;
}
6 1 4
3
1
3
2
 10 8 15
3
1
4
1
5
9
2
6
5
3
5
8
9
7
9
 6 3 4
3
1
3
4
 19 8 15
3
1
4
1
5
0
2
6
5
3
5
8
9
7
9
 37 8 15
3
0
4
1
5
0
2
6
5
6
5
8
1
7
13

No
No
No
No
No
No
 No
No
No
No
No
No
No
No
No
No
 No
No
Yes
No
No
No
 No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
 No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No

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 *n1, const void *n2)
{
    return *(int *)n1 - *(int *)n2;
}

int main(void)
{
    int inputN, inputQ, *inputA, *flag, answerCount = 1;
    long int inputK;
    scanf("%d%ld%d", &inputN, &inputK, &inputQ);
    inputA = (int *)malloc(sizeof(int) * inputQ);
    flag = (int *)malloc(sizeof(int) * inputN);
    if (inputK - inputQ > 0)
    {
        for (int index = 0; index < inputN; index++)
        {
            flag[index] = 1;
        }
    }
    else
    {
        for (int index = 0; index < inputN; index++)
        {
            flag[index] = 0;
        }
    }
    for (int count = 0; count < inputQ; count++)
    {
        scanf("%d", &inputA[count]);
    }
    qsort(inputA, inputQ, sizeof(int), cmp);
    for (int count = 0; count < inputQ; count++)
    {
        if (count == inputQ - 1)
        {
            if (inputK - (inputQ - answerCount) > 0)
            {
                flag[inputA[count] - 1] = 1;
                break;
            }
        }
        if (inputA[count] != inputA[count + 1])
        {
            if (inputK - (inputQ - answerCount) > 0)
            {
                flag[inputA[count] - 1] = 1;
            }
            answerCount = 1;
        }
        else
        {
            answerCount++;
        }
    }
    for (int index = 0; index < inputN; index++)
    {
        if (flag[index])
        {
            printf("Yes\n");
        }
        else
        {
            printf("No\n");
        }
    }

    free(inputA);
    free(flag);

    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
	.section	.rodata
.LC0:
	.string	"%d%ld%d"
.LC1:
	.string	"%d"
.LC2:
	.string	"Yes"
.LC3:
	.string	"No"
	.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
	subq	$64, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$1, -56(%rbp)
	leaq	-60(%rbp), %rcx
	leaq	-32(%rbp), %rdx
	leaq	-64(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-60(%rbp), %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -24(%rbp)
	movl	-64(%rbp), %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -16(%rbp)
	movq	-32(%rbp), %rax
	movl	-60(%rbp), %edx
	movslq	%edx, %rdx
	subq	%rdx, %rax
	testq	%rax, %rax
	jle	.L4
	movl	$0, -52(%rbp)
	jmp	.L5
.L6:
	movl	-52(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	$1, (%rax)
	addl	$1, -52(%rbp)
.L5:
	movl	-64(%rbp), %eax
	cmpl	%eax, -52(%rbp)
	jl	.L6
	jmp	.L7
.L4:
	movl	$0, -48(%rbp)
	jmp	.L8
.L9:
	movl	-48(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	$0, (%rax)
	addl	$1, -48(%rbp)
.L8:
	movl	-64(%rbp), %eax
	cmpl	%eax, -48(%rbp)
	jl	.L9
.L7:
	movl	$0, -44(%rbp)
	jmp	.L10
.L11:
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -44(%rbp)
.L10:
	movl	-60(%rbp), %eax
	cmpl	%eax, -44(%rbp)
	jl	.L11
	movl	-60(%rbp), %eax
	movslq	%eax, %rsi
	movq	-24(%rbp), %rax
	leaq	cmp(%rip), %rdx
	movq	%rdx, %rcx
	movl	$4, %edx
	movq	%rax, %rdi
	call	qsort@PLT
	movl	$0, -40(%rbp)
	jmp	.L12
.L18:
	movl	-60(%rbp), %eax
	subl	$1, %eax
	cmpl	%eax, -40(%rbp)
	jne	.L13
	movq	-32(%rbp), %rdx
	movl	-60(%rbp), %eax
	subl	-56(%rbp), %eax
	movslq	%eax, %rcx
	movq	%rdx, %rax
	subq	%rcx, %rax
	testq	%rax, %rax
	jle	.L13
	movl	-40(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cltq
	salq	$2, %rax
	leaq	-4(%rax), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	$1, (%rax)
	jmp	.L14
.L13:
	movl	-40(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	movl	-40(%rbp), %eax
	cltq
	addq	$1, %rax
	leaq	0(,%rax,4), %rcx
	movq	-24(%rbp), %rax
	addq	%rcx, %rax
	movl	(%rax), %eax
	cmpl	%eax, %edx
	je	.L15
	movq	-32(%rbp), %rdx
	movl	-60(%rbp), %eax
	subl	-56(%rbp), %eax
	movslq	%eax, %rcx
	movq	%rdx, %rax
	subq	%rcx, %rax
	testq	%rax, %rax
	jle	.L16
	movl	-40(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cltq
	salq	$2, %rax
	leaq	-4(%rax), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	$1, (%rax)
.L16:
	movl	$1, -56(%rbp)
	jmp	.L17
.L15:
	addl	$1, -56(%rbp)
.L17:
	addl	$1, -40(%rbp)
.L12:
	movl	-60(%rbp), %eax
	cmpl	%eax, -40(%rbp)
	jl	.L18
.L14:
	movl	$0, -36(%rbp)
	jmp	.L19
.L22:
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	testl	%eax, %eax
	je	.L20
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L21
.L20:
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
.L21:
	addl	$1, -36(%rbp)
.L19:
	movl	-64(%rbp), %eax
	cmpl	%eax, -36(%rbp)
	jl	.L22
	movq	-24(%rbp), %rax
	movq	%rax, %rdi
	call	free@PLT
	movq	-16(%rbp), %rax
	movq	%rax, %rdi
	call	free@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L24
	call	__stack_chk_fail@PLT
.L24:
	leave
	.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
	.section	.rodata
.LC0:
	.string	"%d%ld%d"
.LC1:
	.string	"%d"
.LC2:
	.string	"Yes"
.LC3:
	.string	"No"
	.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
	subq	$64, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$1, -56(%rbp)
	leaq	-60(%rbp), %rcx
	leaq	-32(%rbp), %rdx
	leaq	-64(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-60(%rbp), %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -24(%rbp)
	movl	-64(%rbp), %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -16(%rbp)
	movq	-32(%rbp), %rax
	movl	-60(%rbp), %edx
	movslq	%edx, %rdx
	subq	%rdx, %rax
	testq	%rax, %rax
	jle	.L4
	movl	$0, -52(%rbp)
	jmp	.L5
.L6:
	movl	-52(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	$1, (%rax)
	addl	$1, -52(%rbp)
.L5:
	movl	-64(%rbp), %eax
	cmpl	%eax, -52(%rbp)
	jl	.L6
	jmp	.L7
.L4:
	movl	$0, -48(%rbp)
	jmp	.L8
.L9:
	movl	-48(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	$0, (%rax)
	addl	$1, -48(%rbp)
.L8:
	movl	-64(%rbp), %eax
	cmpl	%eax, -48(%rbp)
	jl	.L9
.L7:
	movl	$0, -44(%rbp)
	jmp	.L10
.L11:
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -44(%rbp)
.L10:
	movl	-60(%rbp), %eax
	cmpl	%eax, -44(%rbp)
	jl	.L11
	movl	-60(%rbp), %eax
	movslq	%eax, %rsi
	movq	-24(%rbp), %rax
	leaq	cmp(%rip), %rdx
	movq	%rdx, %rcx
	movl	$4, %edx
	movq	%rax, %rdi
	call	qsort@PLT
	movl	$0, -40(%rbp)
	jmp	.L12
.L18:
	movl	-60(%rbp), %eax
	subl	$1, %eax
	cmpl	%eax, -40(%rbp)
	jne	.L13
	movq	-32(%rbp), %rdx
	movl	-60(%rbp), %eax
	subl	-56(%rbp), %eax
	movslq	%eax, %rcx
	movq	%rdx, %rax
	subq	%rcx, %rax
	testq	%rax, %rax
	jle	.L13
	movl	-40(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cltq
	salq	$2, %rax
	leaq	-4(%rax), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	$1, (%rax)
	jmp	.L14
.L13:
	movl	-40(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	movl	-40(%rbp), %eax
	cltq
	addq	$1, %rax
	leaq	0(,%rax,4), %rcx
	movq	-24(%rbp), %rax
	addq	%rcx, %rax
	movl	(%rax), %eax
	cmpl	%eax, %edx
	je	.L15
	movq	-32(%rbp), %rdx
	movl	-60(%rbp), %eax
	subl	-56(%rbp), %eax
	movslq	%eax, %rcx
	movq	%rdx, %rax
	subq	%rcx, %rax
	testq	%rax, %rax
	jle	.L16
	movl	-40(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cltq
	salq	$2, %rax
	leaq	-4(%rax), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	$1, (%rax)
.L16:
	movl	$1, -56(%rbp)
	jmp	.L17
.L15:
	addl	$1, -56(%rbp)
.L17:
	addl	$1, -40(%rbp)
.L12:
	movl	-60(%rbp), %eax
	cmpl	%eax, -40(%rbp)
	jl	.L18
.L14:
	movl	$0, -36(%rbp)
	jmp	.L19
.L22:
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	testl	%eax, %eax
	je	.L20
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L21
.L20:
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
.L21:
	addl	$1, -36(%rbp)
.L19:
	movl	-64(%rbp), %eax
	cmpl	%eax, -36(%rbp)
	jl	.L22
	movq	-24(%rbp), %rax
	movq	%rax, %rdi
	call	free@PLT
	movq	-16(%rbp), %rax
	movq	%rax, %rdi
	call	free@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L24
	call	__stack_chk_fail@PLT
.L24:
	leave
	.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:
