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>

int main(void)
{
	int m, d, d1, d10, count;
	scanf("%d %d", &m, &d);
	d1 = d % 10;
	d10 = d / 10;

	int i, j, tmp;
	count = 0;
	for (i = 2; i < d10; i++)
	{
		if ((tmp = m / i) > 9)
			count += 8;
		else if (tmp > 2)
			count += tmp - 1;
	}
	if (i == d10 && d1 >= 2 && (tmp = m / i) >= 2)
		count += tmp > d1 ? d1 - 1 : tmp - 1;
	printf("%d\n", count);
	return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.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	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-32(%rbp), %rdx
	leaq	-36(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-32(%rbp), %edx
	movslq	%edx, %rax
	imulq	$1717986919, %rax, %rax
	shrq	$32, %rax
	sarl	$2, %eax
	movl	%edx, %ecx
	sarl	$31, %ecx
	subl	%ecx, %eax
	movl	%eax, -20(%rbp)
	movl	-20(%rbp), %ecx
	movl	%ecx, %eax
	sall	$2, %eax
	addl	%ecx, %eax
	addl	%eax, %eax
	subl	%eax, %edx
	movl	%edx, -20(%rbp)
	movl	-32(%rbp), %eax
	movslq	%eax, %rdx
	imulq	$1717986919, %rdx, %rdx
	shrq	$32, %rdx
	sarl	$2, %edx
	sarl	$31, %eax
	movl	%eax, %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	movl	%eax, -16(%rbp)
	movl	$0, -28(%rbp)
	movl	$2, -24(%rbp)
	jmp	.L2
.L5:
	movl	-36(%rbp), %eax
	cltd
	idivl	-24(%rbp)
	movl	%eax, -12(%rbp)
	cmpl	$9, -12(%rbp)
	jle	.L3
	addl	$8, -28(%rbp)
	jmp	.L4
.L3:
	cmpl	$2, -12(%rbp)
	jle	.L4
	movl	-12(%rbp), %eax
	subl	$1, %eax
	addl	%eax, -28(%rbp)
.L4:
	addl	$1, -24(%rbp)
.L2:
	movl	-24(%rbp), %eax
	cmpl	-16(%rbp), %eax
	jl	.L5
	movl	-24(%rbp), %eax
	cmpl	-16(%rbp), %eax
	jne	.L6
	cmpl	$1, -20(%rbp)
	jle	.L6
	movl	-36(%rbp), %eax
	cltd
	idivl	-24(%rbp)
	movl	%eax, -12(%rbp)
	cmpl	$1, -12(%rbp)
	jle	.L6
	movl	-12(%rbp), %eax
	cmpl	-20(%rbp), %eax
	jle	.L7
	movl	-20(%rbp), %eax
	subl	$1, %eax
	jmp	.L8
.L7:
	movl	-12(%rbp), %eax
	subl	$1, %eax
.L8:
	addl	%eax, -28(%rbp)
.L6:
	movl	-28(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L10
	call	__stack_chk_fail@PLT
.L10:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.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 %d"
.LC1:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	subq	$24, %rsp
	.cfi_def_cfa_offset 32
	leaq	.LC0(%rip), %rdi
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rdx
	movq	%rsp, %rsi
	call	__isoc99_scanf@PLT
	movslq	4(%rsp), %r9
	movq	%r9, %rax
	imulq	$1717986919, %r9, %r9
	cltd
	sarq	$34, %r9
	subl	%edx, %r9d
	leal	(%r9,%r9,4), %edx
	movl	%r9d, %edi
	movl	%eax, %r9d
	addl	%edx, %edx
	subl	%edx, %r9d
	cmpl	$29, %eax
	jle	.L11
	movl	(%rsp), %esi
	movl	$2, %ecx
	xorl	%r8d, %r8d
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L23:
	addl	$1, %ecx
	addl	$8, %r8d
	cmpl	%ecx, %edi
	jle	.L22
.L3:
	movl	%esi, %eax
	cltd
	idivl	%ecx
	cmpl	$9, %eax
	jg	.L23
	cmpl	$2, %eax
	leal	-1(%r8,%rax), %edx
	cmovg	%edx, %r8d
	addl	$1, %ecx
	cmpl	%ecx, %edi
	jg	.L3
.L22:
	movl	$3, %ecx
	cmpl	%ecx, %edi
	cmovge	%edi, %ecx
.L2:
	cmpl	%ecx, %edi
	jne	.L7
	cmpl	$1, %r9d
	jle	.L7
	movl	(%rsp), %eax
	cltd
	idivl	%ecx
	cmpl	$1, %eax
	jle	.L7
	leal	-1(%rax), %edx
	cmpl	%eax, %r9d
	jge	.L9
	leal	-1(%r9), %edx
.L9:
	addl	%edx, %r8d
.L7:
	xorl	%eax, %eax
	movl	%r8d, %edx
	movl	$1, %edi
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L24
	xorl	%eax, %eax
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
.L11:
	.cfi_restore_state
	movl	$2, %ecx
	xorl	%r8d, %r8d
	jmp	.L2
.L24:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.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 %d"
.LC1:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	subq	$24, %rsp
	.cfi_def_cfa_offset 32
	leaq	.LC0(%rip), %rdi
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rdx
	movq	%rsp, %rsi
	call	__isoc99_scanf@PLT
	movslq	4(%rsp), %r9
	movq	%r9, %rax
	imulq	$1717986919, %r9, %r9
	cltd
	sarq	$34, %r9
	subl	%edx, %r9d
	leal	(%r9,%r9,4), %edx
	movl	%r9d, %edi
	movl	%eax, %r9d
	addl	%edx, %edx
	subl	%edx, %r9d
	cmpl	$29, %eax
	jle	.L11
	movl	(%rsp), %esi
	movl	$2, %ecx
	xorl	%r8d, %r8d
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L23:
	addl	$1, %ecx
	addl	$8, %r8d
	cmpl	%ecx, %edi
	jle	.L22
.L3:
	movl	%esi, %eax
	cltd
	idivl	%ecx
	cmpl	$9, %eax
	jg	.L23
	cmpl	$2, %eax
	leal	-1(%r8,%rax), %edx
	cmovg	%edx, %r8d
	addl	$1, %ecx
	cmpl	%ecx, %edi
	jg	.L3
.L22:
	movl	$3, %ecx
	cmpl	%ecx, %edi
	cmovge	%edi, %ecx
.L2:
	cmpl	%ecx, %edi
	jne	.L7
	cmpl	$1, %r9d
	jle	.L7
	movl	(%rsp), %eax
	cltd
	idivl	%ecx
	cmpl	$1, %eax
	jle	.L7
	leal	-1(%rax), %edx
	cmpl	%eax, %r9d
	jge	.L9
	leal	-1(%r9), %edx
.L9:
	addl	%edx, %r8d
.L7:
	xorl	%eax, %eax
	movl	%r8d, %edx
	movl	$1, %edi
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L24
	xorl	%eax, %eax
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
.L11:
	.cfi_restore_state
	movl	$2, %ecx
	xorl	%r8d, %r8d
	jmp	.L2
.L24:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.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>

int main(void)
{
	int m, d, d1, d10, count;
	scanf("%d %d", &m, &d);
	d1 = d % 10;
	d10 = d / 10;

	int i, j, tmp;
	count = 0;
	for (i = 2; i < d10; i++)
	{
		if ((tmp = m / i) > 9)
			count += 8;
		else if (tmp > 2)
			count += tmp - 1;
	}
	if (i == d10 && d1 >= 2 && (tmp = m / i) >= 2)
		count += tmp > d1 ? d1 - 1 : tmp - 1;
	printf("%d\n", count);
	return 0;
}

15 38
 0 1
 16 38
 16 57
 16 94
 12 94
 12 28
 19 28
 6 27
 12 25

10
 0
 11
 16
 16
 10
 5
 7
 2
 4

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>

int main(void)
{
	int m, d, d1, d10, count;
	scanf("%d %d", &m, &d);
	d1 = d % 10;
	d10 = d / 10;

	int i, j, tmp;
	count = 0;
	for (i = 2; i < d10; i++)
	{
		if ((tmp = m / i) > 9)
			count += 8;
		else if (tmp > 2)
			count += tmp - 1;
	}
	if (i == d10 && d1 >= 2 && (tmp = m / i) >= 2)
		count += tmp > d1 ? d1 - 1 : tmp - 1;
	printf("%d\n", count);
	return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.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	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-32(%rbp), %rdx
	leaq	-36(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-32(%rbp), %edx
	movslq	%edx, %rax
	imulq	$1717986919, %rax, %rax
	shrq	$32, %rax
	sarl	$2, %eax
	movl	%edx, %ecx
	sarl	$31, %ecx
	subl	%ecx, %eax
	movl	%eax, -20(%rbp)
	movl	-20(%rbp), %ecx
	movl	%ecx, %eax
	sall	$2, %eax
	addl	%ecx, %eax
	addl	%eax, %eax
	subl	%eax, %edx
	movl	%edx, -20(%rbp)
	movl	-32(%rbp), %eax
	movslq	%eax, %rdx
	imulq	$1717986919, %rdx, %rdx
	shrq	$32, %rdx
	sarl	$2, %edx
	sarl	$31, %eax
	movl	%eax, %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	movl	%eax, -16(%rbp)
	movl	$0, -28(%rbp)
	movl	$2, -24(%rbp)
	jmp	.L2
.L5:
	movl	-36(%rbp), %eax
	cltd
	idivl	-24(%rbp)
	movl	%eax, -12(%rbp)
	cmpl	$9, -12(%rbp)
	jle	.L3
	addl	$8, -28(%rbp)
	jmp	.L4
.L3:
	cmpl	$2, -12(%rbp)
	jle	.L4
	movl	-12(%rbp), %eax
	subl	$1, %eax
	addl	%eax, -28(%rbp)
.L4:
	addl	$1, -24(%rbp)
.L2:
	movl	-24(%rbp), %eax
	cmpl	-16(%rbp), %eax
	jl	.L5
	movl	-24(%rbp), %eax
	cmpl	-16(%rbp), %eax
	jne	.L6
	cmpl	$1, -20(%rbp)
	jle	.L6
	movl	-36(%rbp), %eax
	cltd
	idivl	-24(%rbp)
	movl	%eax, -12(%rbp)
	cmpl	$1, -12(%rbp)
	jle	.L6
	movl	-12(%rbp), %eax
	cmpl	-20(%rbp), %eax
	jle	.L7
	movl	-20(%rbp), %eax
	subl	$1, %eax
	jmp	.L8
.L7:
	movl	-12(%rbp), %eax
	subl	$1, %eax
.L8:
	addl	%eax, -28(%rbp)
.L6:
	movl	-28(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L10
	call	__stack_chk_fail@PLT
.L10:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.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 %d"
.LC1:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.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	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-32(%rbp), %rdx
	leaq	-36(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-32(%rbp), %edx
	movslq	%edx, %rax
	imulq	$1717986919, %rax, %rax
	shrq	$32, %rax
	sarl	$2, %eax
	movl	%edx, %ecx
	sarl	$31, %ecx
	subl	%ecx, %eax
	movl	%eax, -20(%rbp)
	movl	-20(%rbp), %ecx
	movl	%ecx, %eax
	sall	$2, %eax
	addl	%ecx, %eax
	addl	%eax, %eax
	subl	%eax, %edx
	movl	%edx, -20(%rbp)
	movl	-32(%rbp), %eax
	movslq	%eax, %rdx
	imulq	$1717986919, %rdx, %rdx
	shrq	$32, %rdx
	sarl	$2, %edx
	sarl	$31, %eax
	movl	%eax, %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	movl	%eax, -16(%rbp)
	movl	$0, -28(%rbp)
	movl	$2, -24(%rbp)
	jmp	.L2
.L5:
	movl	-36(%rbp), %eax
	cltd
	idivl	-24(%rbp)
	movl	%eax, -12(%rbp)
	cmpl	$9, -12(%rbp)
	jle	.L3
	addl	$8, -28(%rbp)
	jmp	.L4
.L3:
	cmpl	$2, -12(%rbp)
	jle	.L4
	movl	-12(%rbp), %eax
	subl	$1, %eax
	addl	%eax, -28(%rbp)
.L4:
	addl	$1, -24(%rbp)
.L2:
	movl	-24(%rbp), %eax
	cmpl	-16(%rbp), %eax
	jl	.L5
	movl	-24(%rbp), %eax
	cmpl	-16(%rbp), %eax
	jne	.L6
	cmpl	$1, -20(%rbp)
	jle	.L6
	movl	-36(%rbp), %eax
	cltd
	idivl	-24(%rbp)
	movl	%eax, -12(%rbp)
	cmpl	$1, -12(%rbp)
	jle	.L6
	movl	-12(%rbp), %eax
	cmpl	-20(%rbp), %eax
	jle	.L7
	movl	-20(%rbp), %eax
	subl	$1, %eax
	jmp	.L8
.L7:
	movl	-12(%rbp), %eax
	subl	$1, %eax
.L8:
	addl	%eax, -28(%rbp)
.L6:
	movl	-28(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L10
	call	__stack_chk_fail@PLT
.L10:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.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:
