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<math.h>
int main()
{
    int n, m;
    scanf("%d %d", &n, &m);
    int i;
    int a[30], b[30];
    for (i = 0; i < m; i++)
        scanf("%d %d", &a[i], &b[i]);
    int p[10][10] = {};
    for (i = 0; i < m; i++)
        p[a[i] - 1][b[i] - 1] = p[b[i] - 1][a[i] - 1] = 1;
    int x, now, y;
    int j, k;
    int q[10];
    int ans = 0;
    for (j = 0; j < pow(n, n - 1); j++)
    {
        for (i = 0; i < n; i++)
            q[i] = 0;
        x = j;
        now = x % n;
        x /= n;
        k = 0;
        q[now] = 1;
        for (i = 1; i < n; i++)
        {
            y = x % n;
            x /= n;
            if (q[y] == 1)
            {
                k++;
                break;
            }
            if (p[now][y] == 0)
            {
                k++;
                break;
            }
            now = y;
            q[now] = 1;
        }
        if (k == 0)
            ans++;
    }
    printf("%d\n", ans);
    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	$784, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-752(%rbp), %rdx
	leaq	-756(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -748(%rbp)
	jmp	.L2
.L3:
	leaq	-544(%rbp), %rdx
	movl	-748(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rax, %rdx
	leaq	-672(%rbp), %rcx
	movl	-748(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -748(%rbp)
.L2:
	movl	-752(%rbp), %eax
	cmpl	%eax, -748(%rbp)
	jl	.L3
	leaq	-416(%rbp), %rdx
	movl	$0, %eax
	movl	$50, %ecx
	movq	%rdx, %rdi
	rep stosq
	movl	$0, -748(%rbp)
	jmp	.L4
.L5:
	movl	-748(%rbp), %eax
	cltq
	movl	-544(%rbp,%rax,4), %eax
	leal	-1(%rax), %edx
	movl	-748(%rbp), %eax
	cltq
	movl	-672(%rbp,%rax,4), %eax
	leal	-1(%rax), %ecx
	movslq	%ecx, %rdi
	movslq	%edx, %rsi
	movq	%rsi, %rax
	salq	$2, %rax
	addq	%rsi, %rax
	addq	%rax, %rax
	addq	%rdi, %rax
	movl	$1, -416(%rbp,%rax,4)
	movl	-748(%rbp), %eax
	cltq
	movl	-672(%rbp,%rax,4), %eax
	leal	-1(%rax), %esi
	movl	-748(%rbp), %eax
	cltq
	movl	-544(%rbp,%rax,4), %eax
	leal	-1(%rax), %edi
	movslq	%ecx, %rcx
	movslq	%edx, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	movl	-416(%rbp,%rax,4), %edx
	movslq	%edi, %rdi
	movslq	%esi, %rcx
	movq	%rcx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	addq	%rax, %rax
	addq	%rdi, %rax
	movl	%edx, -416(%rbp,%rax,4)
	addl	$1, -748(%rbp)
.L4:
	movl	-752(%rbp), %eax
	cmpl	%eax, -748(%rbp)
	jl	.L5
	movl	$0, -728(%rbp)
	movl	$0, -736(%rbp)
	jmp	.L6
.L15:
	movl	$0, -748(%rbp)
	jmp	.L7
.L8:
	movl	-748(%rbp), %eax
	cltq
	movl	$0, -720(%rbp,%rax,4)
	addl	$1, -748(%rbp)
.L7:
	movl	-756(%rbp), %eax
	cmpl	%eax, -748(%rbp)
	jl	.L8
	movl	-736(%rbp), %eax
	movl	%eax, -744(%rbp)
	movl	-756(%rbp), %ecx
	movl	-744(%rbp), %eax
	cltd
	idivl	%ecx
	movl	%edx, -740(%rbp)
	movl	-756(%rbp), %esi
	movl	-744(%rbp), %eax
	cltd
	idivl	%esi
	movl	%eax, -744(%rbp)
	movl	$0, -732(%rbp)
	movl	-740(%rbp), %eax
	cltq
	movl	$1, -720(%rbp,%rax,4)
	movl	$1, -748(%rbp)
	jmp	.L9
.L13:
	movl	-756(%rbp), %ecx
	movl	-744(%rbp), %eax
	cltd
	idivl	%ecx
	movl	%edx, -724(%rbp)
	movl	-756(%rbp), %esi
	movl	-744(%rbp), %eax
	cltd
	idivl	%esi
	movl	%eax, -744(%rbp)
	movl	-724(%rbp), %eax
	cltq
	movl	-720(%rbp,%rax,4), %eax
	cmpl	$1, %eax
	jne	.L10
	addl	$1, -732(%rbp)
	jmp	.L11
.L10:
	movl	-724(%rbp), %eax
	movslq	%eax, %rcx
	movl	-740(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	movl	-416(%rbp,%rax,4), %eax
	testl	%eax, %eax
	jne	.L12
	addl	$1, -732(%rbp)
	jmp	.L11
.L12:
	movl	-724(%rbp), %eax
	movl	%eax, -740(%rbp)
	movl	-740(%rbp), %eax
	cltq
	movl	$1, -720(%rbp,%rax,4)
	addl	$1, -748(%rbp)
.L9:
	movl	-756(%rbp), %eax
	cmpl	%eax, -748(%rbp)
	jl	.L13
.L11:
	cmpl	$0, -732(%rbp)
	jne	.L14
	addl	$1, -728(%rbp)
.L14:
	addl	$1, -736(%rbp)
.L6:
	pxor	%xmm2, %xmm2
	cvtsi2sdl	-736(%rbp), %xmm2
	movsd	%xmm2, -776(%rbp)
	movl	-756(%rbp), %eax
	subl	$1, %eax
	pxor	%xmm0, %xmm0
	cvtsi2sdl	%eax, %xmm0
	movl	-756(%rbp), %eax
	pxor	%xmm3, %xmm3
	cvtsi2sdl	%eax, %xmm3
	movq	%xmm3, %rax
	movapd	%xmm0, %xmm1
	movq	%rax, %xmm0
	call	pow@PLT
	movq	%xmm0, %rax
	movq	%rax, %xmm4
	comisd	-776(%rbp), %xmm4
	ja	.L15
	movl	-728(%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	.L17
	call	__stack_chk_fail@PLT
.L17:
	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
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	leaq	.LC0(%rip), %r14
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	movq	%r14, %rdi
	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	$760, %rsp
	.cfi_def_cfa_offset 816
	movq	%fs:40, %rax
	movq	%rax, 744(%rsp)
	xorl	%eax, %eax
	leaq	28(%rsp), %rdx
	leaq	24(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	28(%rsp), %ecx
	testl	%ecx, %ecx
	jle	.L2
	leaq	80(%rsp), %r12
	xorl	%ebx, %ebx
	leaq	208(%rsp), %rbp
	movq	%r12, %r13
	.p2align 4,,10
	.p2align 3
.L3:
	leaq	0(%rbp,%rbx,4), %rdx
	movq	%r13, %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	28(%rsp), %edx
	addq	$1, %rbx
	addq	$4, %r13
	cmpl	%ebx, %edx
	jg	.L3
	leaq	336(%rsp), %rdi
	movl	$50, %ecx
	xorl	%eax, %eax
	rep stosq
	testl	%edx, %edx
	jle	.L5
	movslq	%edx, %rsi
	.p2align 4,,10
	.p2align 3
.L6:
	movl	0(%rbp,%rcx,4), %eax
	movl	(%r12,%rcx,4), %edi
	addq	$1, %rcx
	subl	$1, %eax
	leal	-1(%rdi), %edx
	cltq
	movslq	%edx, %rdx
	leaq	(%rax,%rax,4), %rdi
	leaq	(%rdx,%rdi,2), %rdi
	leaq	(%rdx,%rdx,4), %rdx
	movl	$1, 336(%rsp,%rdi,4)
	leaq	(%rax,%rdx,2), %rax
	movl	$1, 336(%rsp,%rax,4)
	cmpq	%rcx, %rsi
	jne	.L6
.L5:
	movl	24(%rsp), %ebx
	pxor	%xmm3, %xmm3
	pxor	%xmm1, %xmm1
	xorl	%r12d, %r12d
	xorl	%ebp, %ebp
	leaq	32(%rsp), %r13
	cvtsi2sdl	%ebx, %xmm3
	leal	-1(%rbx), %eax
	cvtsi2sdl	%eax, %xmm1
	leaq	4(,%rax,4), %r14
	movq	%xmm3, %r15
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L52:
	testl	%ebx, %ebx
	movsd	8(%rsp), %xmm1
	jle	.L51
	xorl	%esi, %esi
	movq	%r14, %rdx
	movq	%r13, %rdi
	movsd	%xmm1, 8(%rsp)
	call	memset@PLT
	movl	%ebp, %eax
	movsd	8(%rsp), %xmm1
	cltd
	idivl	%ebx
	cmpl	$1, %ebx
	movslq	%edx, %rsi
	movl	$1, 32(%rsp,%rsi,4)
	jle	.L9
	cltd
	idivl	%ebx
	movslq	%edx, %rcx
	cmpl	$1, 32(%rsp,%rcx,4)
	je	.L10
	leaq	(%rsi,%rsi,4), %rdx
	leaq	(%rcx,%rdx,2), %rdx
	movl	336(%rsp,%rdx,4), %edx
	testl	%edx, %edx
	je	.L10
	movl	$1, 32(%rsp,%rcx,4)
	cmpl	$2, %ebx
	je	.L9
	cltd
	idivl	%ebx
	movslq	%edx, %rsi
	cmpl	$1, 32(%rsp,%rsi,4)
	je	.L10
	leaq	(%rcx,%rcx,4), %rdx
	leaq	(%rsi,%rdx,2), %rdx
	movl	336(%rsp,%rdx,4), %r11d
	testl	%r11d, %r11d
	je	.L10
	movl	$1, 32(%rsp,%rsi,4)
	cmpl	$3, %ebx
	je	.L9
	cltd
	idivl	%ebx
	movslq	%edx, %rcx
	cmpl	$1, 32(%rsp,%rcx,4)
	je	.L10
	leaq	(%rsi,%rsi,4), %rdx
	leaq	(%rcx,%rdx,2), %rdx
	movl	336(%rsp,%rdx,4), %r10d
	testl	%r10d, %r10d
	je	.L10
	movl	$1, 32(%rsp,%rcx,4)
	cmpl	$4, %ebx
	je	.L9
	cltd
	idivl	%ebx
	movslq	%edx, %rsi
	cmpl	$1, 32(%rsp,%rsi,4)
	je	.L10
	leaq	(%rcx,%rcx,4), %rdx
	leaq	(%rsi,%rdx,2), %rdx
	movl	336(%rsp,%rdx,4), %r9d
	testl	%r9d, %r9d
	je	.L10
	movl	$1, 32(%rsp,%rsi,4)
	cmpl	$5, %ebx
	je	.L9
	cltd
	idivl	%ebx
	movslq	%edx, %rcx
	cmpl	$1, 32(%rsp,%rcx,4)
	je	.L10
	leaq	(%rsi,%rsi,4), %rdx
	leaq	(%rcx,%rdx,2), %rdx
	movl	336(%rsp,%rdx,4), %r8d
	testl	%r8d, %r8d
	je	.L10
	movl	$1, 32(%rsp,%rcx,4)
	cmpl	$6, %ebx
	je	.L9
	cltd
	idivl	%ebx
	movslq	%edx, %rsi
	cmpl	$1, 32(%rsp,%rsi,4)
	je	.L10
	leaq	(%rcx,%rcx,4), %rdx
	leaq	(%rsi,%rdx,2), %rdx
	movl	336(%rsp,%rdx,4), %edi
	testl	%edi, %edi
	je	.L10
	movl	$1, 32(%rsp,%rsi,4)
	cmpl	$7, %ebx
	je	.L9
	cltd
	idivl	%ebx
	movslq	%edx, %rcx
	cmpl	$1, 32(%rsp,%rcx,4)
	je	.L10
	leaq	(%rsi,%rsi,4), %rdx
	leaq	(%rcx,%rdx,2), %rdx
	movl	336(%rsp,%rdx,4), %esi
	testl	%esi, %esi
	je	.L10
	movl	$1, 32(%rsp,%rcx,4)
	cmpl	$8, %ebx
	je	.L9
	cltd
	idivl	%ebx
	movslq	%edx, %rsi
	cmpl	$1, 32(%rsp,%rsi,4)
	je	.L10
	leaq	(%rcx,%rcx,4), %rdx
	leaq	(%rsi,%rdx,2), %rdx
	movl	336(%rsp,%rdx,4), %edx
	testl	%edx, %edx
	je	.L10
	movl	$1, 32(%rsp,%rsi,4)
	cmpl	$9, %ebx
	je	.L9
	cltd
	idivl	%ebx
	movslq	%edx, %rdx
	cmpl	$1, 32(%rsp,%rdx,4)
	je	.L10
	leaq	(%rsi,%rsi,4), %rax
	leaq	(%rdx,%rax,2), %rax
	movl	336(%rsp,%rax,4), %eax
	testl	%eax, %eax
	je	.L10
	movl	$1, 32(%rsp,%rdx,4)
	cmpl	$10, %ebx
	je	.L9
.L10:
	addl	$1, %ebp
.L8:
	movq	%r15, %xmm0
	movsd	%xmm1, 8(%rsp)
	call	pow@PLT
	movapd	%xmm0, %xmm2
	pxor	%xmm0, %xmm0
	cvtsi2sdl	%ebp, %xmm0
	comisd	%xmm0, %xmm2
	ja	.L52
	xorl	%eax, %eax
	movl	%r12d, %edx
	movl	$1, %edi
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	744(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L53
	addq	$760, %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
.L51:
	.cfi_restore_state
	movl	%ebp, %eax
	cltd
	idivl	%ebx
	movslq	%edx, %rdx
	movl	$1, 32(%rsp,%rdx,4)
	.p2align 4,,10
	.p2align 3
.L9:
	addl	$1, %r12d
	jmp	.L10
.L2:
	leaq	336(%rsp), %rdi
	movl	$50, %ecx
	xorl	%eax, %eax
	rep stosq
	jmp	.L5
.L53:
	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
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	leaq	.LC0(%rip), %r14
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	movq	%r14, %rdi
	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	$760, %rsp
	.cfi_def_cfa_offset 816
	movq	%fs:40, %rax
	movq	%rax, 744(%rsp)
	xorl	%eax, %eax
	leaq	28(%rsp), %rdx
	leaq	24(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	28(%rsp), %ecx
	testl	%ecx, %ecx
	jle	.L2
	leaq	80(%rsp), %r12
	xorl	%ebx, %ebx
	leaq	208(%rsp), %rbp
	movq	%r12, %r13
	.p2align 4,,10
	.p2align 3
.L3:
	leaq	0(%rbp,%rbx,4), %rdx
	movq	%r13, %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	28(%rsp), %edx
	addq	$1, %rbx
	addq	$4, %r13
	cmpl	%ebx, %edx
	jg	.L3
	leaq	336(%rsp), %rdi
	movl	$50, %ecx
	xorl	%eax, %eax
	rep stosq
	testl	%edx, %edx
	jle	.L5
	movslq	%edx, %rsi
	.p2align 4,,10
	.p2align 3
.L6:
	movl	0(%rbp,%rcx,4), %eax
	movl	(%r12,%rcx,4), %edi
	addq	$1, %rcx
	subl	$1, %eax
	leal	-1(%rdi), %edx
	cltq
	movslq	%edx, %rdx
	leaq	(%rax,%rax,4), %rdi
	leaq	(%rdx,%rdi,2), %rdi
	leaq	(%rdx,%rdx,4), %rdx
	movl	$1, 336(%rsp,%rdi,4)
	leaq	(%rax,%rdx,2), %rax
	movl	$1, 336(%rsp,%rax,4)
	cmpq	%rcx, %rsi
	jne	.L6
.L5:
	movl	24(%rsp), %ebx
	pxor	%xmm3, %xmm3
	pxor	%xmm1, %xmm1
	xorl	%r12d, %r12d
	xorl	%ebp, %ebp
	leaq	32(%rsp), %r13
	cvtsi2sdl	%ebx, %xmm3
	leal	-1(%rbx), %eax
	cvtsi2sdl	%eax, %xmm1
	leaq	4(,%rax,4), %r14
	movq	%xmm3, %r15
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L52:
	testl	%ebx, %ebx
	movsd	8(%rsp), %xmm1
	jle	.L51
	xorl	%esi, %esi
	movq	%r14, %rdx
	movq	%r13, %rdi
	movsd	%xmm1, 8(%rsp)
	call	memset@PLT
	movl	%ebp, %eax
	movsd	8(%rsp), %xmm1
	cltd
	idivl	%ebx
	cmpl	$1, %ebx
	movslq	%edx, %rsi
	movl	$1, 32(%rsp,%rsi,4)
	jle	.L9
	cltd
	idivl	%ebx
	movslq	%edx, %rcx
	cmpl	$1, 32(%rsp,%rcx,4)
	je	.L10
	leaq	(%rsi,%rsi,4), %rdx
	leaq	(%rcx,%rdx,2), %rdx
	movl	336(%rsp,%rdx,4), %edx
	testl	%edx, %edx
	je	.L10
	movl	$1, 32(%rsp,%rcx,4)
	cmpl	$2, %ebx
	je	.L9
	cltd
	idivl	%ebx
	movslq	%edx, %rsi
	cmpl	$1, 32(%rsp,%rsi,4)
	je	.L10
	leaq	(%rcx,%rcx,4), %rdx
	leaq	(%rsi,%rdx,2), %rdx
	movl	336(%rsp,%rdx,4), %r11d
	testl	%r11d, %r11d
	je	.L10
	movl	$1, 32(%rsp,%rsi,4)
	cmpl	$3, %ebx
	je	.L9
	cltd
	idivl	%ebx
	movslq	%edx, %rcx
	cmpl	$1, 32(%rsp,%rcx,4)
	je	.L10
	leaq	(%rsi,%rsi,4), %rdx
	leaq	(%rcx,%rdx,2), %rdx
	movl	336(%rsp,%rdx,4), %r10d
	testl	%r10d, %r10d
	je	.L10
	movl	$1, 32(%rsp,%rcx,4)
	cmpl	$4, %ebx
	je	.L9
	cltd
	idivl	%ebx
	movslq	%edx, %rsi
	cmpl	$1, 32(%rsp,%rsi,4)
	je	.L10
	leaq	(%rcx,%rcx,4), %rdx
	leaq	(%rsi,%rdx,2), %rdx
	movl	336(%rsp,%rdx,4), %r9d
	testl	%r9d, %r9d
	je	.L10
	movl	$1, 32(%rsp,%rsi,4)
	cmpl	$5, %ebx
	je	.L9
	cltd
	idivl	%ebx
	movslq	%edx, %rcx
	cmpl	$1, 32(%rsp,%rcx,4)
	je	.L10
	leaq	(%rsi,%rsi,4), %rdx
	leaq	(%rcx,%rdx,2), %rdx
	movl	336(%rsp,%rdx,4), %r8d
	testl	%r8d, %r8d
	je	.L10
	movl	$1, 32(%rsp,%rcx,4)
	cmpl	$6, %ebx
	je	.L9
	cltd
	idivl	%ebx
	movslq	%edx, %rsi
	cmpl	$1, 32(%rsp,%rsi,4)
	je	.L10
	leaq	(%rcx,%rcx,4), %rdx
	leaq	(%rsi,%rdx,2), %rdx
	movl	336(%rsp,%rdx,4), %edi
	testl	%edi, %edi
	je	.L10
	movl	$1, 32(%rsp,%rsi,4)
	cmpl	$7, %ebx
	je	.L9
	cltd
	idivl	%ebx
	movslq	%edx, %rcx
	cmpl	$1, 32(%rsp,%rcx,4)
	je	.L10
	leaq	(%rsi,%rsi,4), %rdx
	leaq	(%rcx,%rdx,2), %rdx
	movl	336(%rsp,%rdx,4), %esi
	testl	%esi, %esi
	je	.L10
	movl	$1, 32(%rsp,%rcx,4)
	cmpl	$8, %ebx
	je	.L9
	cltd
	idivl	%ebx
	movslq	%edx, %rsi
	cmpl	$1, 32(%rsp,%rsi,4)
	je	.L10
	leaq	(%rcx,%rcx,4), %rdx
	leaq	(%rsi,%rdx,2), %rdx
	movl	336(%rsp,%rdx,4), %edx
	testl	%edx, %edx
	je	.L10
	movl	$1, 32(%rsp,%rsi,4)
	cmpl	$9, %ebx
	je	.L9
	cltd
	idivl	%ebx
	movslq	%edx, %rdx
	cmpl	$1, 32(%rsp,%rdx,4)
	je	.L10
	leaq	(%rsi,%rsi,4), %rax
	leaq	(%rdx,%rax,2), %rax
	movl	336(%rsp,%rax,4), %eax
	testl	%eax, %eax
	je	.L10
	movl	$1, 32(%rsp,%rdx,4)
	cmpl	$10, %ebx
	je	.L9
.L10:
	addl	$1, %ebp
.L8:
	movq	%r15, %xmm0
	movsd	%xmm1, 8(%rsp)
	call	pow@PLT
	movapd	%xmm0, %xmm2
	pxor	%xmm0, %xmm0
	cvtsi2sdl	%ebp, %xmm0
	comisd	%xmm0, %xmm2
	ja	.L52
	xorl	%eax, %eax
	movl	%r12d, %edx
	movl	$1, %edi
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	744(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L53
	addq	$760, %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
.L51:
	.cfi_restore_state
	movl	%ebp, %eax
	cltd
	idivl	%ebx
	movslq	%edx, %rdx
	movl	$1, 32(%rsp,%rdx,4)
	.p2align 4,,10
	.p2align 3
.L9:
	addl	$1, %r12d
	jmp	.L10
.L2:
	leaq	336(%rsp), %rdi
	movl	$50, %ecx
	xorl	%eax, %eax
	rep stosq
	jmp	.L5
.L53:
	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>
#include<math.h>
int main()
{
    int n, m;
    scanf("%d %d", &n, &m);
    int i;
    int a[30], b[30];
    for (i = 0; i < m; i++)
        scanf("%d %d", &a[i], &b[i]);
    int p[10][10] = {};
    for (i = 0; i < m; i++)
        p[a[i] - 1][b[i] - 1] = p[b[i] - 1][a[i] - 1] = 1;
    int x, now, y;
    int j, k;
    int q[10];
    int ans = 0;
    for (j = 0; j < pow(n, n - 1); j++)
    {
        for (i = 0; i < n; i++)
            q[i] = 0;
        x = j;
        now = x % n;
        x /= n;
        k = 0;
        q[now] = 1;
        for (i = 1; i < n; i++)
        {
            y = x % n;
            x /= n;
            if (q[y] == 1)
            {
                k++;
                break;
            }
            if (p[now][y] == 0)
            {
                k++;
                break;
            }
            now = y;
            q[now] = 1;
        }
        if (k == 0)
            ans++;
    }
    printf("%d\n", ans);
    return 0;
}
7 4
1 3
2 7
3 4
4 5
4 6
5 6
6 7
 7 7
1 3
2 7
3 4
4 5
4 1
5 6
6 7
 7 7
1 3
2 7
3 4
4 5
4 6
4 6
6 7
 7 4
1 4
2 7
3 4
4 5
4 6
5 6
6 7
 7 7
1 5
2 7
3 4
4 5
4 6
4 6
6 7
 7 4
1 5
2 7
3 4
4 5
4 6
5 6
6 7
 7 4
1 5
2 7
3 4
4 5
4 12
5 6
6 7
 7 4
1 5
2 7
3 4
4 5
4 12
5 6
0 7
 7 4
1 3
2 7
3 4
5 5
4 6
5 6
6 7
 7 4
1 4
3 7
3 4
4 5
4 6
5 6
6 7

0
 1
 0
 0
 0
 0
 0
 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<math.h>
int main()
{
    int n, m;
    scanf("%d %d", &n, &m);
    int i;
    int a[30], b[30];
    for (i = 0; i < m; i++)
        scanf("%d %d", &a[i], &b[i]);
    int p[10][10] = {};
    for (i = 0; i < m; i++)
        p[a[i] - 1][b[i] - 1] = p[b[i] - 1][a[i] - 1] = 1;
    int x, now, y;
    int j, k;
    int q[10];
    int ans = 0;
    for (j = 0; j < pow(n, n - 1); j++)
    {
        for (i = 0; i < n; i++)
            q[i] = 0;
        x = j;
        now = x % n;
        x /= n;
        k = 0;
        q[now] = 1;
        for (i = 1; i < n; i++)
        {
            y = x % n;
            x /= n;
            if (q[y] == 1)
            {
                k++;
                break;
            }
            if (p[now][y] == 0)
            {
                k++;
                break;
            }
            now = y;
            q[now] = 1;
        }
        if (k == 0)
            ans++;
    }
    printf("%d\n", ans);
    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	$784, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-752(%rbp), %rdx
	leaq	-756(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -748(%rbp)
	jmp	.L2
.L3:
	leaq	-544(%rbp), %rdx
	movl	-748(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rax, %rdx
	leaq	-672(%rbp), %rcx
	movl	-748(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -748(%rbp)
.L2:
	movl	-752(%rbp), %eax
	cmpl	%eax, -748(%rbp)
	jl	.L3
	leaq	-416(%rbp), %rdx
	movl	$0, %eax
	movl	$50, %ecx
	movq	%rdx, %rdi
	rep stosq
	movl	$0, -748(%rbp)
	jmp	.L4
.L5:
	movl	-748(%rbp), %eax
	cltq
	movl	-544(%rbp,%rax,4), %eax
	leal	-1(%rax), %edx
	movl	-748(%rbp), %eax
	cltq
	movl	-672(%rbp,%rax,4), %eax
	leal	-1(%rax), %ecx
	movslq	%ecx, %rdi
	movslq	%edx, %rsi
	movq	%rsi, %rax
	salq	$2, %rax
	addq	%rsi, %rax
	addq	%rax, %rax
	addq	%rdi, %rax
	movl	$1, -416(%rbp,%rax,4)
	movl	-748(%rbp), %eax
	cltq
	movl	-672(%rbp,%rax,4), %eax
	leal	-1(%rax), %esi
	movl	-748(%rbp), %eax
	cltq
	movl	-544(%rbp,%rax,4), %eax
	leal	-1(%rax), %edi
	movslq	%ecx, %rcx
	movslq	%edx, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	movl	-416(%rbp,%rax,4), %edx
	movslq	%edi, %rdi
	movslq	%esi, %rcx
	movq	%rcx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	addq	%rax, %rax
	addq	%rdi, %rax
	movl	%edx, -416(%rbp,%rax,4)
	addl	$1, -748(%rbp)
.L4:
	movl	-752(%rbp), %eax
	cmpl	%eax, -748(%rbp)
	jl	.L5
	movl	$0, -728(%rbp)
	movl	$0, -736(%rbp)
	jmp	.L6
.L15:
	movl	$0, -748(%rbp)
	jmp	.L7
.L8:
	movl	-748(%rbp), %eax
	cltq
	movl	$0, -720(%rbp,%rax,4)
	addl	$1, -748(%rbp)
.L7:
	movl	-756(%rbp), %eax
	cmpl	%eax, -748(%rbp)
	jl	.L8
	movl	-736(%rbp), %eax
	movl	%eax, -744(%rbp)
	movl	-756(%rbp), %ecx
	movl	-744(%rbp), %eax
	cltd
	idivl	%ecx
	movl	%edx, -740(%rbp)
	movl	-756(%rbp), %esi
	movl	-744(%rbp), %eax
	cltd
	idivl	%esi
	movl	%eax, -744(%rbp)
	movl	$0, -732(%rbp)
	movl	-740(%rbp), %eax
	cltq
	movl	$1, -720(%rbp,%rax,4)
	movl	$1, -748(%rbp)
	jmp	.L9
.L13:
	movl	-756(%rbp), %ecx
	movl	-744(%rbp), %eax
	cltd
	idivl	%ecx
	movl	%edx, -724(%rbp)
	movl	-756(%rbp), %esi
	movl	-744(%rbp), %eax
	cltd
	idivl	%esi
	movl	%eax, -744(%rbp)
	movl	-724(%rbp), %eax
	cltq
	movl	-720(%rbp,%rax,4), %eax
	cmpl	$1, %eax
	jne	.L10
	addl	$1, -732(%rbp)
	jmp	.L11
.L10:
	movl	-724(%rbp), %eax
	movslq	%eax, %rcx
	movl	-740(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	movl	-416(%rbp,%rax,4), %eax
	testl	%eax, %eax
	jne	.L12
	addl	$1, -732(%rbp)
	jmp	.L11
.L12:
	movl	-724(%rbp), %eax
	movl	%eax, -740(%rbp)
	movl	-740(%rbp), %eax
	cltq
	movl	$1, -720(%rbp,%rax,4)
	addl	$1, -748(%rbp)
.L9:
	movl	-756(%rbp), %eax
	cmpl	%eax, -748(%rbp)
	jl	.L13
.L11:
	cmpl	$0, -732(%rbp)
	jne	.L14
	addl	$1, -728(%rbp)
.L14:
	addl	$1, -736(%rbp)
.L6:
	pxor	%xmm2, %xmm2
	cvtsi2sdl	-736(%rbp), %xmm2
	movsd	%xmm2, -776(%rbp)
	movl	-756(%rbp), %eax
	subl	$1, %eax
	pxor	%xmm0, %xmm0
	cvtsi2sdl	%eax, %xmm0
	movl	-756(%rbp), %eax
	pxor	%xmm3, %xmm3
	cvtsi2sdl	%eax, %xmm3
	movq	%xmm3, %rax
	movapd	%xmm0, %xmm1
	movq	%rax, %xmm0
	call	pow@PLT
	movq	%xmm0, %rax
	movq	%rax, %xmm4
	comisd	-776(%rbp), %xmm4
	ja	.L15
	movl	-728(%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	.L17
	call	__stack_chk_fail@PLT
.L17:
	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	$784, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-752(%rbp), %rdx
	leaq	-756(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -748(%rbp)
	jmp	.L2
.L3:
	leaq	-544(%rbp), %rdx
	movl	-748(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rax, %rdx
	leaq	-672(%rbp), %rcx
	movl	-748(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -748(%rbp)
.L2:
	movl	-752(%rbp), %eax
	cmpl	%eax, -748(%rbp)
	jl	.L3
	leaq	-416(%rbp), %rdx
	movl	$0, %eax
	movl	$50, %ecx
	movq	%rdx, %rdi
	rep stosq
	movl	$0, -748(%rbp)
	jmp	.L4
.L5:
	movl	-748(%rbp), %eax
	cltq
	movl	-544(%rbp,%rax,4), %eax
	leal	-1(%rax), %edx
	movl	-748(%rbp), %eax
	cltq
	movl	-672(%rbp,%rax,4), %eax
	leal	-1(%rax), %ecx
	movslq	%ecx, %rdi
	movslq	%edx, %rsi
	movq	%rsi, %rax
	salq	$2, %rax
	addq	%rsi, %rax
	addq	%rax, %rax
	addq	%rdi, %rax
	movl	$1, -416(%rbp,%rax,4)
	movl	-748(%rbp), %eax
	cltq
	movl	-672(%rbp,%rax,4), %eax
	leal	-1(%rax), %esi
	movl	-748(%rbp), %eax
	cltq
	movl	-544(%rbp,%rax,4), %eax
	leal	-1(%rax), %edi
	movslq	%ecx, %rcx
	movslq	%edx, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	movl	-416(%rbp,%rax,4), %edx
	movslq	%edi, %rdi
	movslq	%esi, %rcx
	movq	%rcx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	addq	%rax, %rax
	addq	%rdi, %rax
	movl	%edx, -416(%rbp,%rax,4)
	addl	$1, -748(%rbp)
.L4:
	movl	-752(%rbp), %eax
	cmpl	%eax, -748(%rbp)
	jl	.L5
	movl	$0, -728(%rbp)
	movl	$0, -736(%rbp)
	jmp	.L6
.L15:
	movl	$0, -748(%rbp)
	jmp	.L7
.L8:
	movl	-748(%rbp), %eax
	cltq
	movl	$0, -720(%rbp,%rax,4)
	addl	$1, -748(%rbp)
.L7:
	movl	-756(%rbp), %eax
	cmpl	%eax, -748(%rbp)
	jl	.L8
	movl	-736(%rbp), %eax
	movl	%eax, -744(%rbp)
	movl	-756(%rbp), %ecx
	movl	-744(%rbp), %eax
	cltd
	idivl	%ecx
	movl	%edx, -740(%rbp)
	movl	-756(%rbp), %esi
	movl	-744(%rbp), %eax
	cltd
	idivl	%esi
	movl	%eax, -744(%rbp)
	movl	$0, -732(%rbp)
	movl	-740(%rbp), %eax
	cltq
	movl	$1, -720(%rbp,%rax,4)
	movl	$1, -748(%rbp)
	jmp	.L9
.L13:
	movl	-756(%rbp), %ecx
	movl	-744(%rbp), %eax
	cltd
	idivl	%ecx
	movl	%edx, -724(%rbp)
	movl	-756(%rbp), %esi
	movl	-744(%rbp), %eax
	cltd
	idivl	%esi
	movl	%eax, -744(%rbp)
	movl	-724(%rbp), %eax
	cltq
	movl	-720(%rbp,%rax,4), %eax
	cmpl	$1, %eax
	jne	.L10
	addl	$1, -732(%rbp)
	jmp	.L11
.L10:
	movl	-724(%rbp), %eax
	movslq	%eax, %rcx
	movl	-740(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	movl	-416(%rbp,%rax,4), %eax
	testl	%eax, %eax
	jne	.L12
	addl	$1, -732(%rbp)
	jmp	.L11
.L12:
	movl	-724(%rbp), %eax
	movl	%eax, -740(%rbp)
	movl	-740(%rbp), %eax
	cltq
	movl	$1, -720(%rbp,%rax,4)
	addl	$1, -748(%rbp)
.L9:
	movl	-756(%rbp), %eax
	cmpl	%eax, -748(%rbp)
	jl	.L13
.L11:
	cmpl	$0, -732(%rbp)
	jne	.L14
	addl	$1, -728(%rbp)
.L14:
	addl	$1, -736(%rbp)
.L6:
	pxor	%xmm2, %xmm2
	cvtsi2sdl	-736(%rbp), %xmm2
	movsd	%xmm2, -776(%rbp)
	movl	-756(%rbp), %eax
	subl	$1, %eax
	pxor	%xmm0, %xmm0
	cvtsi2sdl	%eax, %xmm0
	movl	-756(%rbp), %eax
	pxor	%xmm3, %xmm3
	cvtsi2sdl	%eax, %xmm3
	movq	%xmm3, %rax
	movapd	%xmm0, %xmm1
	movq	%rax, %xmm0
	call	pow@PLT
	movq	%xmm0, %rax
	movq	%rax, %xmm4
	comisd	-776(%rbp), %xmm4
	ja	.L15
	movl	-728(%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	.L17
	call	__stack_chk_fail@PLT
.L17:
	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:
