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 <math.h>

#define DATE_NUM 100

void readDate(int date[]) {
  int i, m, di;
  scanf("%d", &m);
  for (i=0; i<m; i++) {
    scanf("%d", &di);
    date[di]++;
  }
}

int getConvDate(int date[], int q){
  int i;
  int buf = 0, cdi = 0;
  for (i=DATE_NUM-1; i>=0; i--)
    if (date[i] >= buf && date[i] >= q) {
      buf = date[i];
      cdi = i;
    }
  return cdi;
}

void solve() {
  int n, q, m, cdi;
  int date[DATE_NUM];
  int i;

  while (1) {
    scanf("%d %d", &n, &q);
    if (n == 0 && q == 0) break;

    for (i=0; i<DATE_NUM; i++)
      date[i] = 0;
    while (--n >= 0) {
      readDate(date);
    }
    cdi = getConvDate(date, q);
    printf("%d\n", cdi);
  }
}

int main(){
  solve();
  return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
	.text
	.globl	readDate
	.type	readDate, @function
readDate:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$48, %rsp
	movq	%rdi, -40(%rbp)
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-20(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -12(%rbp)
	jmp	.L2
.L3:
	leaq	-16(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	addl	$1, %edx
	movl	%edx, (%rax)
	addl	$1, -12(%rbp)
.L2:
	movl	-20(%rbp), %eax
	cmpl	%eax, -12(%rbp)
	jl	.L3
	nop
	movq	-8(%rbp), %rax
	subq	%fs:40, %rax
	je	.L4
	call	__stack_chk_fail@PLT
.L4:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	readDate, .-readDate
	.globl	getConvDate
	.type	getConvDate, @function
getConvDate:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -24(%rbp)
	movl	%esi, -28(%rbp)
	movl	$0, -8(%rbp)
	movl	$0, -4(%rbp)
	movl	$99, -12(%rbp)
	jmp	.L6
.L8:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	%eax, -8(%rbp)
	jg	.L7
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	%eax, -28(%rbp)
	jg	.L7
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	%eax, -8(%rbp)
	movl	-12(%rbp), %eax
	movl	%eax, -4(%rbp)
.L7:
	subl	$1, -12(%rbp)
.L6:
	cmpl	$0, -12(%rbp)
	jns	.L8
	movl	-4(%rbp), %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	getConvDate, .-getConvDate
	.section	.rodata
.LC1:
	.string	"%d %d"
.LC2:
	.string	"%d\n"
	.text
	.globl	solve
	.type	solve, @function
solve:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$432, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
.L17:
	leaq	-428(%rbp), %rdx
	leaq	-432(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-432(%rbp), %eax
	testl	%eax, %eax
	jne	.L11
	movl	-428(%rbp), %eax
	testl	%eax, %eax
	je	.L20
.L11:
	movl	$0, -424(%rbp)
	jmp	.L13
.L14:
	movl	-424(%rbp), %eax
	cltq
	movl	$0, -416(%rbp,%rax,4)
	addl	$1, -424(%rbp)
.L13:
	cmpl	$99, -424(%rbp)
	jle	.L14
	jmp	.L15
.L16:
	leaq	-416(%rbp), %rax
	movq	%rax, %rdi
	call	readDate
.L15:
	movl	-432(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -432(%rbp)
	movl	-432(%rbp), %eax
	testl	%eax, %eax
	jns	.L16
	movl	-428(%rbp), %edx
	leaq	-416(%rbp), %rax
	movl	%edx, %esi
	movq	%rax, %rdi
	call	getConvDate
	movl	%eax, -420(%rbp)
	movl	-420(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L17
.L20:
	nop
	nop
	movq	-8(%rbp), %rax
	subq	%fs:40, %rax
	je	.L18
	call	__stack_chk_fail@PLT
.L18:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	solve, .-solve
	.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
	movl	$0, %eax
	call	solve
	movl	$0, %eax
	popq	%rbp
	.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
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
	.text
	.p2align 4
	.globl	readDate
	.type	readDate, @function
readDate:
.LFB39:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	leaq	.LC0(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	movq	%rdi, %rbp
	movq	%r12, %rdi
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	subq	$24, %rsp
	.cfi_def_cfa_offset 64
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rsi
	call	__isoc99_scanf@PLT
	movl	(%rsp), %eax
	testl	%eax, %eax
	jle	.L1
	xorl	%ebx, %ebx
	leaq	4(%rsp), %r13
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%r13, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	movslq	4(%rsp), %rax
	addl	$1, 0(%rbp,%rax,4)
	cmpl	%ebx, (%rsp)
	jg	.L3
.L1:
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L8
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
.L8:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE39:
	.size	readDate, .-readDate
	.p2align 4
	.globl	getConvDate
	.type	getConvDate, @function
getConvDate:
.LFB40:
	.cfi_startproc
	endbr64
	movl	$99, %eax
	xorl	%r8d, %r8d
	xorl	%edx, %edx
	.p2align 4,,10
	.p2align 3
.L11:
	cmpl	%edx, %esi
	movl	%edx, %r9d
	movl	(%rdi,%rax,4), %ecx
	cmovge	%esi, %r9d
	cmpl	%r9d, %ecx
	cmovge	%eax, %r8d
	cmovge	%ecx, %edx
	subq	$1, %rax
	jnb	.L11
	movl	%r8d, %eax
	ret
	.cfi_endproc
.LFE40:
	.size	getConvDate, .-getConvDate
	.section	.rodata.str1.1
.LC1:
	.string	"%d %d"
.LC2:
	.string	"%d\n"
	.text
	.p2align 4
	.globl	solve
	.type	solve, @function
solve:
.LFB41:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	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
	leaq	.LC0(%rip), %rbx
	subq	$456, %rsp
	.cfi_def_cfa_offset 512
	movq	%fs:40, %rax
	movq	%rax, 440(%rsp)
	xorl	%eax, %eax
	leaq	16(%rsp), %rax
	leaq	20(%rsp), %r15
	movq	%rax, 8(%rsp)
	leaq	32(%rsp), %r13
	.p2align 4,,10
	.p2align 3
.L23:
	movq	8(%rsp), %rsi
	movq	%r15, %rdx
	xorl	%eax, %eax
	leaq	.LC1(%rip), %rdi
	call	__isoc99_scanf@PLT
	movl	16(%rsp), %edx
	movl	20(%rsp), %esi
	movl	%edx, %eax
	orl	%esi, %eax
	je	.L14
	xorl	%eax, %eax
	movl	$50, %ecx
	movq	%r13, %rdi
	subl	$1, %edx
	rep stosq
	movl	%edx, 16(%rsp)
	js	.L16
	leaq	24(%rsp), %r12
	leaq	28(%rsp), %rbp
	.p2align 4,,10
	.p2align 3
.L18:
	movq	%r12, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	xorl	%r14d, %r14d
	call	__isoc99_scanf@PLT
	movl	24(%rsp), %eax
	testl	%eax, %eax
	jle	.L20
	.p2align 4,,10
	.p2align 3
.L17:
	movq	%rbp, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	addl	$1, %r14d
	call	__isoc99_scanf@PLT
	movslq	28(%rsp), %rax
	addl	$1, 0(%r13,%rax,4)
	cmpl	24(%rsp), %r14d
	jl	.L17
.L20:
	subl	$1, 16(%rsp)
	jns	.L18
	movl	20(%rsp), %esi
.L16:
	movl	$99, %eax
	xorl	%r9d, %r9d
	xorl	%edx, %edx
	.p2align 4,,10
	.p2align 3
.L22:
	cmpl	%esi, %edx
	movl	%esi, %edi
	movl	0(%r13,%rax,4), %ecx
	cmovge	%edx, %edi
	cmpl	%ecx, %edi
	cmovle	%eax, %r9d
	cmovle	%ecx, %edx
	subq	$1, %rax
	jnb	.L22
	movl	%r9d, %edx
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L23
.L14:
	movq	440(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L32
	addq	$456, %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
.L32:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE41:
	.size	solve, .-solve
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB42:
	.cfi_startproc
	endbr64
	subq	$8, %rsp
	.cfi_def_cfa_offset 16
	xorl	%eax, %eax
	call	solve
	xorl	%eax, %eax
	addq	$8, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE42:
	.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
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
	.text
	.p2align 4
	.globl	readDate
	.type	readDate, @function
readDate:
.LFB39:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	leaq	.LC0(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	movq	%rdi, %rbp
	movq	%r12, %rdi
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	subq	$24, %rsp
	.cfi_def_cfa_offset 64
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rsi
	call	__isoc99_scanf@PLT
	movl	(%rsp), %eax
	testl	%eax, %eax
	jle	.L1
	xorl	%ebx, %ebx
	leaq	4(%rsp), %r13
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%r13, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	movslq	4(%rsp), %rax
	addl	$1, 0(%rbp,%rax,4)
	cmpl	%ebx, (%rsp)
	jg	.L3
.L1:
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L8
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
.L8:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE39:
	.size	readDate, .-readDate
	.p2align 4
	.globl	getConvDate
	.type	getConvDate, @function
getConvDate:
.LFB40:
	.cfi_startproc
	endbr64
	movl	$99, %eax
	xorl	%r8d, %r8d
	xorl	%edx, %edx
	.p2align 4,,10
	.p2align 3
.L11:
	cmpl	%edx, %esi
	movl	%edx, %r9d
	movl	(%rdi,%rax,4), %ecx
	cmovge	%esi, %r9d
	cmpl	%r9d, %ecx
	cmovge	%eax, %r8d
	cmovge	%ecx, %edx
	subq	$1, %rax
	jnb	.L11
	movl	%r8d, %eax
	ret
	.cfi_endproc
.LFE40:
	.size	getConvDate, .-getConvDate
	.section	.rodata.str1.1
.LC1:
	.string	"%d %d"
.LC2:
	.string	"%d\n"
	.text
	.p2align 4
	.globl	solve
	.type	solve, @function
solve:
.LFB41:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	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
	leaq	.LC0(%rip), %rbx
	subq	$456, %rsp
	.cfi_def_cfa_offset 512
	movq	%fs:40, %rax
	movq	%rax, 440(%rsp)
	xorl	%eax, %eax
	leaq	16(%rsp), %rax
	leaq	20(%rsp), %r15
	movq	%rax, 8(%rsp)
	leaq	32(%rsp), %r13
	.p2align 4,,10
	.p2align 3
.L23:
	movq	8(%rsp), %rsi
	movq	%r15, %rdx
	xorl	%eax, %eax
	leaq	.LC1(%rip), %rdi
	call	__isoc99_scanf@PLT
	movl	16(%rsp), %edx
	movl	20(%rsp), %esi
	movl	%edx, %eax
	orl	%esi, %eax
	je	.L14
	xorl	%eax, %eax
	movl	$50, %ecx
	movq	%r13, %rdi
	subl	$1, %edx
	rep stosq
	movl	%edx, 16(%rsp)
	js	.L16
	leaq	24(%rsp), %r12
	leaq	28(%rsp), %rbp
	.p2align 4,,10
	.p2align 3
.L18:
	movq	%r12, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	xorl	%r14d, %r14d
	call	__isoc99_scanf@PLT
	movl	24(%rsp), %eax
	testl	%eax, %eax
	jle	.L20
	.p2align 4,,10
	.p2align 3
.L17:
	movq	%rbp, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	addl	$1, %r14d
	call	__isoc99_scanf@PLT
	movslq	28(%rsp), %rax
	addl	$1, 0(%r13,%rax,4)
	cmpl	24(%rsp), %r14d
	jl	.L17
.L20:
	subl	$1, 16(%rsp)
	jns	.L18
	movl	20(%rsp), %esi
.L16:
	movl	$99, %eax
	xorl	%r9d, %r9d
	xorl	%edx, %edx
	.p2align 4,,10
	.p2align 3
.L22:
	cmpl	%esi, %edx
	movl	%esi, %edi
	movl	0(%r13,%rax,4), %ecx
	cmovge	%edx, %edi
	cmpl	%ecx, %edi
	cmovle	%eax, %r9d
	cmovle	%ecx, %edx
	subq	$1, %rax
	jnb	.L22
	movl	%r9d, %edx
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L23
.L14:
	movq	440(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L32
	addq	$456, %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
.L32:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE41:
	.size	solve, .-solve
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB42:
	.cfi_startproc
	endbr64
	subq	$8, %rsp
	.cfi_def_cfa_offset 16
	xorl	%eax, %eax
	call	solve
	xorl	%eax, %eax
	addq	$8, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE42:
	.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 <math.h>

#define DATE_NUM 100

void readDate(int date[]) {
  int i, m, di;
  scanf("%d", &m);
  for (i=0; i<m; i++) {
    scanf("%d", &di);
    date[di]++;
  }
}

int getConvDate(int date[], int q){
  int i;
  int buf = 0, cdi = 0;
  for (i=DATE_NUM-1; i>=0; i--)
    if (date[i] >= buf && date[i] >= q) {
      buf = date[i];
      cdi = i;
    }
  return cdi;
}

void solve() {
  int n, q, m, cdi;
  int date[DATE_NUM];
  int i;

  while (1) {
    scanf("%d %d", &n, &q);
    if (n == 0 && q == 0) break;

    for (i=0; i<DATE_NUM; i++)
      date[i] = 0;
    while (--n >= 0) {
      readDate(date);
    }
    cdi = getConvDate(date, q);
    printf("%d\n", cdi);
  }
}

int main(){
  solve();
  return 0;
}
3 2
2 1 2
0
3 3 4 8
3 2
4 1 5 8 9
3 2 5 9
5 2 4 5 7 9
3 3
2 1 4
3 2 5 9
2 2 4
3 3
2 1 2
3 1 2 9
2 2 4
0 0
 3 2
2 1 4
0
3 3 4 8
3 2
4 1 5 8 9
3 2 5 9
5 1 4 5 7 9
3 3
2 1 4
3 2 5 9
2 2 4
3 3
2 1 2
3 1 2 9
2 2 4
0 0
 3 2
2 1 2
0
3 3 4 8
3 2
4 1 5 2 9
3 2 5 9
5 2 4 5 7 9
3 3
2 1 4
3 2 5 9
2 2 4
3 3
2 1 2
3 1 2 9
2 2 4
0 0
 3 2
2 1 2
0
3 3 4 8
3 2
4 1 5 2 9
3 2 5 9
5 2 4 5 7 9
3 3
2 1 4
3 2 5 9
2 2 4
3 3
2 1 1
3 1 2 9
2 2 4
0 0
 3 2
2 1 2
0
3 3 4 8
3 2
4 1 5 0 9
3 2 5 9
5 2 4 5 7 9
3 3
2 1 4
3 2 5 9
2 2 4
3 3
2 1 1
3 1 2 9
2 2 4
0 0
 3 2
2 1 2
0
3 3 4 8
3 2
4 1 9 2 9
3 2 5 9
5 2 4 5 7 9
3 3
2 1 4
3 2 5 9
2 2 4
3 3
2 1 2
3 1 2 9
2 2 4
0 0
 3 2
2 2 2
0
3 3 4 8
3 2
4 1 5 2 9
3 2 5 9
5 2 4 5 7 9
3 3
2 1 4
3 2 5 9
2 2 4
3 3
2 1 1
3 1 2 9
2 2 4
0 0
 3 2
2 1 2
0
3 3 4 8
3 2
4 1 5 0 9
3 2 5 9
5 2 4 5 7 9
3 3
2 1 4
3 2 5 9
2 2 4
3 3
2 0 1
3 1 2 9
2 2 4
0 0
 3 2
2 1 3
0
3 3 4 8
3 2
4 1 5 8 9
3 2 5 9
5 1 4 5 7 9
3 3
2 1 4
3 2 5 9
2 2 7
3 3
2 1 2
3 1 2 9
2 2 4
0 0
 3 2
2 1 3
0
3 3 4 8
3 2
4 1 5 8 9
3 2 5 9
5 1 4 5 7 9
3 1
2 1 4
3 2 5 9
2 2 7
3 3
2 1 2
3 1 2 9
2 2 4
0 0

0
5
0
2
 4
5
0
2
 0
2
0
2
 0
2
0
1
 0
5
0
1
 0
9
0
2
 2
2
0
1
 0
5
0
0
 3
5
0
2
 3
5
2
2

Given the following C code and unoptimized assembly code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

#define DATE_NUM 100

void readDate(int date[]) {
  int i, m, di;
  scanf("%d", &m);
  for (i=0; i<m; i++) {
    scanf("%d", &di);
    date[di]++;
  }
}

int getConvDate(int date[], int q){
  int i;
  int buf = 0, cdi = 0;
  for (i=DATE_NUM-1; i>=0; i--)
    if (date[i] >= buf && date[i] >= q) {
      buf = date[i];
      cdi = i;
    }
  return cdi;
}

void solve() {
  int n, q, m, cdi;
  int date[DATE_NUM];
  int i;

  while (1) {
    scanf("%d %d", &n, &q);
    if (n == 0 && q == 0) break;

    for (i=0; i<DATE_NUM; i++)
      date[i] = 0;
    while (--n >= 0) {
      readDate(date);
    }
    cdi = getConvDate(date, q);
    printf("%d\n", cdi);
  }
}

int main(){
  solve();
  return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
	.text
	.globl	readDate
	.type	readDate, @function
readDate:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$48, %rsp
	movq	%rdi, -40(%rbp)
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-20(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -12(%rbp)
	jmp	.L2
.L3:
	leaq	-16(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	addl	$1, %edx
	movl	%edx, (%rax)
	addl	$1, -12(%rbp)
.L2:
	movl	-20(%rbp), %eax
	cmpl	%eax, -12(%rbp)
	jl	.L3
	nop
	movq	-8(%rbp), %rax
	subq	%fs:40, %rax
	je	.L4
	call	__stack_chk_fail@PLT
.L4:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	readDate, .-readDate
	.globl	getConvDate
	.type	getConvDate, @function
getConvDate:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -24(%rbp)
	movl	%esi, -28(%rbp)
	movl	$0, -8(%rbp)
	movl	$0, -4(%rbp)
	movl	$99, -12(%rbp)
	jmp	.L6
.L8:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	%eax, -8(%rbp)
	jg	.L7
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	%eax, -28(%rbp)
	jg	.L7
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	%eax, -8(%rbp)
	movl	-12(%rbp), %eax
	movl	%eax, -4(%rbp)
.L7:
	subl	$1, -12(%rbp)
.L6:
	cmpl	$0, -12(%rbp)
	jns	.L8
	movl	-4(%rbp), %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	getConvDate, .-getConvDate
	.section	.rodata
.LC1:
	.string	"%d %d"
.LC2:
	.string	"%d\n"
	.text
	.globl	solve
	.type	solve, @function
solve:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$432, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
.L17:
	leaq	-428(%rbp), %rdx
	leaq	-432(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-432(%rbp), %eax
	testl	%eax, %eax
	jne	.L11
	movl	-428(%rbp), %eax
	testl	%eax, %eax
	je	.L20
.L11:
	movl	$0, -424(%rbp)
	jmp	.L13
.L14:
	movl	-424(%rbp), %eax
	cltq
	movl	$0, -416(%rbp,%rax,4)
	addl	$1, -424(%rbp)
.L13:
	cmpl	$99, -424(%rbp)
	jle	.L14
	jmp	.L15
.L16:
	leaq	-416(%rbp), %rax
	movq	%rax, %rdi
	call	readDate
.L15:
	movl	-432(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -432(%rbp)
	movl	-432(%rbp), %eax
	testl	%eax, %eax
	jns	.L16
	movl	-428(%rbp), %edx
	leaq	-416(%rbp), %rax
	movl	%edx, %esi
	movq	%rax, %rdi
	call	getConvDate
	movl	%eax, -420(%rbp)
	movl	-420(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L17
.L20:
	nop
	nop
	movq	-8(%rbp), %rax
	subq	%fs:40, %rax
	je	.L18
	call	__stack_chk_fail@PLT
.L18:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	solve, .-solve
	.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
	movl	$0, %eax
	call	solve
	movl	$0, %eax
	popq	%rbp
	.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
	.section	.rodata
.LC0:
	.string	"%d"
	.text
	.globl	readDate
	.type	readDate, @function
readDate:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$48, %rsp
	movq	%rdi, -40(%rbp)
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-20(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -12(%rbp)
	jmp	.L2
.L3:
	leaq	-16(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	addl	$1, %edx
	movl	%edx, (%rax)
	addl	$1, -12(%rbp)
.L2:
	movl	-20(%rbp), %eax
	cmpl	%eax, -12(%rbp)
	jl	.L3
	nop
	movq	-8(%rbp), %rax
	subq	%fs:40, %rax
	je	.L4
	call	__stack_chk_fail@PLT
.L4:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	readDate, .-readDate
	.globl	getConvDate
	.type	getConvDate, @function
getConvDate:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -24(%rbp)
	movl	%esi, -28(%rbp)
	movl	$0, -8(%rbp)
	movl	$0, -4(%rbp)
	movl	$99, -12(%rbp)
	jmp	.L6
.L8:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	%eax, -8(%rbp)
	jg	.L7
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	%eax, -28(%rbp)
	jg	.L7
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	%eax, -8(%rbp)
	movl	-12(%rbp), %eax
	movl	%eax, -4(%rbp)
.L7:
	subl	$1, -12(%rbp)
.L6:
	cmpl	$0, -12(%rbp)
	jns	.L8
	movl	-4(%rbp), %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	getConvDate, .-getConvDate
	.section	.rodata
.LC1:
	.string	"%d %d"
.LC2:
	.string	"%d\n"
	.text
	.globl	solve
	.type	solve, @function
solve:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$432, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
.L17:
	leaq	-428(%rbp), %rdx
	leaq	-432(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-432(%rbp), %eax
	testl	%eax, %eax
	jne	.L11
	movl	-428(%rbp), %eax
	testl	%eax, %eax
	je	.L20
.L11:
	movl	$0, -424(%rbp)
	jmp	.L13
.L14:
	movl	-424(%rbp), %eax
	cltq
	movl	$0, -416(%rbp,%rax,4)
	addl	$1, -424(%rbp)
.L13:
	cmpl	$99, -424(%rbp)
	jle	.L14
	jmp	.L15
.L16:
	leaq	-416(%rbp), %rax
	movq	%rax, %rdi
	call	readDate
.L15:
	movl	-432(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -432(%rbp)
	movl	-432(%rbp), %eax
	testl	%eax, %eax
	jns	.L16
	movl	-428(%rbp), %edx
	leaq	-416(%rbp), %rax
	movl	%edx, %esi
	movq	%rax, %rdi
	call	getConvDate
	movl	%eax, -420(%rbp)
	movl	-420(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L17
.L20:
	nop
	nop
	movq	-8(%rbp), %rax
	subq	%fs:40, %rax
	je	.L18
	call	__stack_chk_fail@PLT
.L18:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	solve, .-solve
	.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
	movl	$0, %eax
	call	solve
	movl	$0, %eax
	popq	%rbp
	.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:
