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

```c
m[1<<20],v[1<<21],*d,*e,w,p[10],x,t,i,c;Q(y){m[y]&1&&v[y]<t?v[*++e=y]=v[x]+1:0;}main(n){scanf("%*d%d%d",&w,&n);for(x=w++;c=~getchar(x++);m[x]=c>12?p[c-13]=x,11:c)c=~c%88%35;for(;i<n;)for(d=e=v+(1<<20),t=++v[*e=p[i++]];c=v[p[i]],c<t;Q(x-1),Q(x+1),Q(x-w),Q(x+w))x=*d++;x=!printf("%d\n",c-n);}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	m
	.bss
	.align 32
	.type	m, @object
	.size	m, 4194304
m:
	.zero	4194304
	.globl	v
	.align 32
	.type	v, @object
	.size	v, 8388608
v:
	.zero	8388608
	.globl	d
	.align 8
	.type	d, @object
	.size	d, 8
d:
	.zero	8
	.globl	e
	.align 8
	.type	e, @object
	.size	e, 8
e:
	.zero	8
	.globl	w
	.align 4
	.type	w, @object
	.size	w, 4
w:
	.zero	4
	.globl	p
	.align 32
	.type	p, @object
	.size	p, 40
p:
	.zero	40
	.globl	x
	.align 4
	.type	x, @object
	.size	x, 4
x:
	.zero	4
	.globl	t
	.align 4
	.type	t, @object
	.size	t, 4
t:
	.zero	4
	.globl	i
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.globl	c
	.align 4
	.type	c, @object
	.size	c, 4
c:
	.zero	4
	.text
	.globl	Q
	.type	Q, @function
Q:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -4(%rbp)
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	m(%rip), %rax
	movl	(%rdx,%rax), %eax
	andl	$1, %eax
	testl	%eax, %eax
	je	.L3
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	v(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	t(%rip), %eax
	cmpl	%eax, %edx
	jge	.L3
	movl	x(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	v(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movq	e(%rip), %rax
	addq	$4, %rax
	movq	%rax, e(%rip)
	movq	e(%rip), %rax
	movl	-4(%rbp), %edx
	movl	%edx, (%rax)
	movl	(%rax), %eax
	addl	$1, %ecx
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	v(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	nop
.L3:
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	Q, .-Q
	.section	.rodata
.LC0:
	.string	"%*d%d%d"
.LC1:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movl	%edi, -4(%rbp)
	leaq	-4(%rbp), %rax
	movq	%rax, %rdx
	leaq	w(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movl	w(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, w(%rip)
	movl	%eax, x(%rip)
	jmp	.L5
.L8:
	movl	c(%rip), %eax
	notl	%eax
	movl	%eax, %edx
	movslq	%edx, %rax
	imulq	$780903145, %rax, %rax
	shrq	$32, %rax
	sarl	$4, %eax
	movl	%edx, %ecx
	sarl	$31, %ecx
	subl	%ecx, %eax
	imull	$88, %eax, %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	movslq	%eax, %rdx
	imulq	$-368140053, %rdx, %rdx
	shrq	$32, %rdx
	addl	%eax, %edx
	sarl	$5, %edx
	movl	%eax, %ecx
	sarl	$31, %ecx
	subl	%ecx, %edx
	imull	$35, %edx, %ecx
	subl	%ecx, %eax
	movl	%eax, %edx
	movl	%edx, c(%rip)
	movl	c(%rip), %eax
	cmpl	$12, %eax
	jle	.L6
	movl	c(%rip), %eax
	leal	-13(%rax), %edx
	movl	x(%rip), %eax
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	p(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	$11, %eax
	jmp	.L7
.L6:
	movl	c(%rip), %eax
.L7:
	movl	x(%rip), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	m(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
.L5:
	movl	x(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, x(%rip)
	movl	%eax, %edi
	movl	$0, %eax
	call	getchar@PLT
	notl	%eax
	movl	%eax, c(%rip)
	movl	c(%rip), %eax
	testl	%eax, %eax
	jne	.L8
	jmp	.L9
.L12:
	leaq	4194304+v(%rip), %rax
	movq	%rax, e(%rip)
	movq	e(%rip), %rax
	movq	%rax, d(%rip)
	movl	i(%rip), %edx
	leal	1(%rdx), %eax
	movl	%eax, i(%rip)
	movq	e(%rip), %rax
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	p(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	movl	%edx, (%rax)
	movl	(%rax), %eax
	movslq	%eax, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	v(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	leal	1(%rdx), %esi
	movslq	%eax, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	v(%rip), %rdx
	movl	%esi, (%rcx,%rdx)
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	v(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, t(%rip)
	jmp	.L10
.L11:
	movq	d(%rip), %rax
	leaq	4(%rax), %rdx
	movq	%rdx, d(%rip)
	movl	(%rax), %eax
	movl	%eax, x(%rip)
	movl	x(%rip), %eax
	subl	$1, %eax
	movl	%eax, %edi
	movl	$0, %eax
	call	Q
	movl	x(%rip), %eax
	addl	$1, %eax
	movl	%eax, %edi
	movl	$0, %eax
	call	Q
	movl	x(%rip), %eax
	movl	w(%rip), %edx
	subl	%edx, %eax
	movl	%eax, %edi
	movl	$0, %eax
	call	Q
	movl	x(%rip), %edx
	movl	w(%rip), %eax
	addl	%edx, %eax
	movl	%eax, %edi
	movl	$0, %eax
	call	Q
.L10:
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	p(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	v(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, c(%rip)
	movl	c(%rip), %edx
	movl	t(%rip), %eax
	cmpl	%eax, %edx
	jl	.L11
.L9:
	movl	i(%rip), %edx
	movl	-4(%rbp), %eax
	cmpl	%eax, %edx
	jl	.L12
	movl	c(%rip), %eax
	movl	-4(%rbp), %edx
	subl	%edx, %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	testl	%eax, %eax
	sete	%al
	movzbl	%al, %eax
	movl	%eax, x(%rip)
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.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	Q
	.type	Q, @function
Q:
.LFB0:
	.cfi_startproc
	endbr64
	movslq	%edi, %rax
	leaq	m(%rip), %rdx
	testb	$1, (%rdx,%rax,4)
	je	.L2
	leaq	v(%rip), %rdx
	movl	t(%rip), %esi
	cmpl	%esi, (%rdx,%rax,4)
	jge	.L2
	movslq	x(%rip), %rcx
	movq	e(%rip), %rsi
	movl	(%rdx,%rcx,4), %ecx
	leaq	4(%rsi), %r8
	movq	%r8, e(%rip)
	addl	$1, %ecx
	movl	%edi, 4(%rsi)
	movl	%ecx, (%rdx,%rax,4)
.L2:
	ret
	.cfi_endproc
.LFE0:
	.size	Q, .-Q
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%*d%d%d"
.LC1:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	w(%rip), %rsi
	xorl	%eax, %eax
	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
	leaq	p(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	m(%rip), %rbx
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	movl	%edi, 12(%rsp)
	leaq	12(%rsp), %rdx
	leaq	.LC0(%rip), %rdi
	call	scanf@PLT
	movl	w(%rip), %edi
	leal	1(%rdi), %eax
	movl	%eax, w(%rip)
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L10:
	movslq	%eax, %rdx
	movl	%eax, %ecx
	movl	x(%rip), %edi
	imulq	$780903145, %rdx, %rdx
	sarl	$31, %ecx
	sarq	$36, %rdx
	subl	%ecx, %edx
	imull	$88, %edx, %edx
	subl	%edx, %eax
	movslq	%eax, %rdx
	movl	%eax, %ecx
	imulq	$-368140053, %rdx, %rdx
	sarl	$31, %ecx
	shrq	$32, %rdx
	addl	%eax, %edx
	sarl	$5, %edx
	subl	%ecx, %edx
	imull	$35, %edx, %ecx
	subl	%ecx, %eax
	movl	%eax, c(%rip)
	movl	%eax, %edx
	cmpl	$12, %eax
	jle	.L9
	subl	$13, %edx
	movslq	%edx, %rdx
	movl	%edi, 0(%rbp,%rdx,4)
	movl	$11, %edx
.L9:
	movslq	%edi, %rax
	movl	%edx, (%rbx,%rax,4)
	leal	1(%rdi), %eax
.L8:
	movl	%eax, x(%rip)
	xorl	%eax, %eax
	call	getchar@PLT
	movl	%eax, %esi
	notl	%esi
	movl	%esi, c(%rip)
	testl	%esi, %esi
	jne	.L10
	movslq	i(%rip), %rax
	movl	12(%rsp), %ebx
	cmpl	%ebx, %eax
	jge	.L11
	leaq	p(%rip), %rdx
	movl	w(%rip), %r9d
	leal	1(%rax), %r11d
	leaq	4194304+v(%rip), %rbp
	leaq	(%rdx,%rax,4), %r10
	leaq	m(%rip), %rdi
	leaq	-4194304(%rbp), %rdx
	.p2align 4,,10
	.p2align 3
.L18:
	movslq	(%r10), %rax
	movq	%rbp, e(%rip)
	movq	%rbp, d(%rip)
	movl	%eax, 4194304+v(%rip)
	movl	(%rdx,%rax,4), %ecx
	movl	%r11d, i(%rip)
	leal	1(%rcx), %r8d
	movl	%r8d, (%rdx,%rax,4)
	movslq	4(%r10), %rax
	movl	%r8d, t(%rip)
	movl	(%rdx,%rax,4), %esi
	movl	%esi, c(%rip)
	cmpl	%esi, %r8d
	jle	.L12
	leaq	4194308+v(%rip), %rcx
	.p2align 4,,10
	.p2align 3
.L17:
	movslq	-4(%rcx), %rax
	movq	%rcx, d(%rip)
	leal	-1(%rax), %r12d
	movl	%eax, x(%rip)
	movslq	%r12d, %rsi
	testb	$1, (%rdi,%rsi,4)
	je	.L13
	cmpl	(%rdx,%rsi,4), %r8d
	jle	.L13
	movq	e(%rip), %r14
	movslq	%eax, %r13
	movl	(%rdx,%r13,4), %r13d
	leaq	4(%r14), %r15
	movq	%r15, e(%rip)
	movl	%r12d, 4(%r14)
	leal	1(%r13), %r12d
	movl	%r12d, (%rdx,%rsi,4)
.L13:
	leal	1(%rax), %r12d
	movslq	%r12d, %rsi
	testb	$1, (%rdi,%rsi,4)
	je	.L14
	cmpl	(%rdx,%rsi,4), %r8d
	jle	.L14
	movq	e(%rip), %r14
	movslq	%eax, %r13
	movl	(%rdx,%r13,4), %r13d
	leaq	4(%r14), %r15
	movq	%r15, e(%rip)
	movl	%r12d, 4(%r14)
	leal	1(%r13), %r12d
	movl	%r12d, (%rdx,%rsi,4)
.L14:
	movl	%eax, %r12d
	subl	%r9d, %r12d
	movslq	%r12d, %rsi
	testb	$1, (%rdi,%rsi,4)
	je	.L15
	cmpl	(%rdx,%rsi,4), %r8d
	jle	.L15
	movq	e(%rip), %r14
	movslq	%eax, %r13
	movl	(%rdx,%r13,4), %r13d
	leaq	4(%r14), %r15
	movq	%r15, e(%rip)
	movl	%r12d, 4(%r14)
	leal	1(%r13), %r12d
	movl	%r12d, (%rdx,%rsi,4)
.L15:
	leal	(%rax,%r9), %r12d
	movslq	%r12d, %rsi
	testb	$1, (%rdi,%rsi,4)
	je	.L16
	cmpl	(%rdx,%rsi,4), %r8d
	jle	.L16
	movl	(%rdx,%rax,4), %eax
	movq	e(%rip), %r13
	addl	$1, %eax
	leaq	4(%r13), %r14
	movq	%r14, e(%rip)
	movl	%r12d, 4(%r13)
	movl	%eax, (%rdx,%rsi,4)
.L16:
	movslq	4(%r10), %rax
	addq	$4, %rcx
	movl	(%rdx,%rax,4), %esi
	movl	%esi, c(%rip)
	cmpl	%esi, %r8d
	jg	.L17
.L12:
	leal	1(%r11), %eax
	addq	$4, %r10
	cmpl	%ebx, %r11d
	je	.L11
	movl	%eax, %r11d
	jmp	.L18
	.p2align 4,,10
	.p2align 3
.L11:
	subl	%ebx, %esi
	xorl	%eax, %eax
	leaq	.LC1(%rip), %rdi
	call	printf@PLT
	testl	%eax, %eax
	sete	%al
	movzbl	%al, %eax
	movl	%eax, x(%rip)
	addq	$24, %rsp
	.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
	.cfi_endproc
.LFE1:
	.size	main, .-main
	.globl	c
	.bss
	.align 4
	.type	c, @object
	.size	c, 4
c:
	.zero	4
	.globl	i
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.globl	t
	.align 4
	.type	t, @object
	.size	t, 4
t:
	.zero	4
	.globl	x
	.align 4
	.type	x, @object
	.size	x, 4
x:
	.zero	4
	.globl	p
	.align 32
	.type	p, @object
	.size	p, 40
p:
	.zero	40
	.globl	w
	.align 4
	.type	w, @object
	.size	w, 4
w:
	.zero	4
	.globl	e
	.align 8
	.type	e, @object
	.size	e, 8
e:
	.zero	8
	.globl	d
	.align 8
	.type	d, @object
	.size	d, 8
d:
	.zero	8
	.globl	v
	.align 32
	.type	v, @object
	.size	v, 8388608
v:
	.zero	8388608
	.globl	m
	.align 32
	.type	m, @object
	.size	m, 4194304
m:
	.zero	4194304
	.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	Q
	.type	Q, @function
Q:
.LFB0:
	.cfi_startproc
	endbr64
	movslq	%edi, %rax
	leaq	m(%rip), %rdx
	testb	$1, (%rdx,%rax,4)
	je	.L2
	leaq	v(%rip), %rdx
	movl	t(%rip), %esi
	cmpl	%esi, (%rdx,%rax,4)
	jge	.L2
	movslq	x(%rip), %rcx
	movq	e(%rip), %rsi
	movl	(%rdx,%rcx,4), %ecx
	leaq	4(%rsi), %r8
	movq	%r8, e(%rip)
	addl	$1, %ecx
	movl	%edi, 4(%rsi)
	movl	%ecx, (%rdx,%rax,4)
.L2:
	ret
	.cfi_endproc
.LFE0:
	.size	Q, .-Q
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%*d%d%d"
.LC1:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	w(%rip), %rsi
	xorl	%eax, %eax
	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
	leaq	p(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	m(%rip), %rbx
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	movl	%edi, 12(%rsp)
	leaq	12(%rsp), %rdx
	leaq	.LC0(%rip), %rdi
	call	scanf@PLT
	movl	w(%rip), %edi
	leal	1(%rdi), %eax
	movl	%eax, w(%rip)
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L10:
	movslq	%eax, %rdx
	movl	%eax, %ecx
	movl	x(%rip), %edi
	imulq	$780903145, %rdx, %rdx
	sarl	$31, %ecx
	sarq	$36, %rdx
	subl	%ecx, %edx
	imull	$88, %edx, %edx
	subl	%edx, %eax
	movslq	%eax, %rdx
	movl	%eax, %ecx
	imulq	$-368140053, %rdx, %rdx
	sarl	$31, %ecx
	shrq	$32, %rdx
	addl	%eax, %edx
	sarl	$5, %edx
	subl	%ecx, %edx
	imull	$35, %edx, %ecx
	subl	%ecx, %eax
	movl	%eax, c(%rip)
	movl	%eax, %edx
	cmpl	$12, %eax
	jle	.L9
	subl	$13, %edx
	movslq	%edx, %rdx
	movl	%edi, 0(%rbp,%rdx,4)
	movl	$11, %edx
.L9:
	movslq	%edi, %rax
	movl	%edx, (%rbx,%rax,4)
	leal	1(%rdi), %eax
.L8:
	movl	%eax, x(%rip)
	xorl	%eax, %eax
	call	getchar@PLT
	movl	%eax, %esi
	notl	%esi
	movl	%esi, c(%rip)
	testl	%esi, %esi
	jne	.L10
	movslq	i(%rip), %rax
	movl	12(%rsp), %ebx
	cmpl	%ebx, %eax
	jge	.L11
	leaq	p(%rip), %rdx
	movl	w(%rip), %r9d
	leal	1(%rax), %r11d
	leaq	4194304+v(%rip), %rbp
	leaq	(%rdx,%rax,4), %r10
	leaq	m(%rip), %rdi
	leaq	-4194304(%rbp), %rdx
	.p2align 4,,10
	.p2align 3
.L18:
	movslq	(%r10), %rax
	movq	%rbp, e(%rip)
	movq	%rbp, d(%rip)
	movl	%eax, 4194304+v(%rip)
	movl	(%rdx,%rax,4), %ecx
	movl	%r11d, i(%rip)
	leal	1(%rcx), %r8d
	movl	%r8d, (%rdx,%rax,4)
	movslq	4(%r10), %rax
	movl	%r8d, t(%rip)
	movl	(%rdx,%rax,4), %esi
	movl	%esi, c(%rip)
	cmpl	%esi, %r8d
	jle	.L12
	leaq	4194308+v(%rip), %rcx
	.p2align 4,,10
	.p2align 3
.L17:
	movslq	-4(%rcx), %rax
	movq	%rcx, d(%rip)
	leal	-1(%rax), %r12d
	movl	%eax, x(%rip)
	movslq	%r12d, %rsi
	testb	$1, (%rdi,%rsi,4)
	je	.L13
	cmpl	(%rdx,%rsi,4), %r8d
	jle	.L13
	movq	e(%rip), %r14
	movslq	%eax, %r13
	movl	(%rdx,%r13,4), %r13d
	leaq	4(%r14), %r15
	movq	%r15, e(%rip)
	movl	%r12d, 4(%r14)
	leal	1(%r13), %r12d
	movl	%r12d, (%rdx,%rsi,4)
.L13:
	leal	1(%rax), %r12d
	movslq	%r12d, %rsi
	testb	$1, (%rdi,%rsi,4)
	je	.L14
	cmpl	(%rdx,%rsi,4), %r8d
	jle	.L14
	movq	e(%rip), %r14
	movslq	%eax, %r13
	movl	(%rdx,%r13,4), %r13d
	leaq	4(%r14), %r15
	movq	%r15, e(%rip)
	movl	%r12d, 4(%r14)
	leal	1(%r13), %r12d
	movl	%r12d, (%rdx,%rsi,4)
.L14:
	movl	%eax, %r12d
	subl	%r9d, %r12d
	movslq	%r12d, %rsi
	testb	$1, (%rdi,%rsi,4)
	je	.L15
	cmpl	(%rdx,%rsi,4), %r8d
	jle	.L15
	movq	e(%rip), %r14
	movslq	%eax, %r13
	movl	(%rdx,%r13,4), %r13d
	leaq	4(%r14), %r15
	movq	%r15, e(%rip)
	movl	%r12d, 4(%r14)
	leal	1(%r13), %r12d
	movl	%r12d, (%rdx,%rsi,4)
.L15:
	leal	(%rax,%r9), %r12d
	movslq	%r12d, %rsi
	testb	$1, (%rdi,%rsi,4)
	je	.L16
	cmpl	(%rdx,%rsi,4), %r8d
	jle	.L16
	movl	(%rdx,%rax,4), %eax
	movq	e(%rip), %r13
	addl	$1, %eax
	leaq	4(%r13), %r14
	movq	%r14, e(%rip)
	movl	%r12d, 4(%r13)
	movl	%eax, (%rdx,%rsi,4)
.L16:
	movslq	4(%r10), %rax
	addq	$4, %rcx
	movl	(%rdx,%rax,4), %esi
	movl	%esi, c(%rip)
	cmpl	%esi, %r8d
	jg	.L17
.L12:
	leal	1(%r11), %eax
	addq	$4, %r10
	cmpl	%ebx, %r11d
	je	.L11
	movl	%eax, %r11d
	jmp	.L18
	.p2align 4,,10
	.p2align 3
.L11:
	subl	%ebx, %esi
	xorl	%eax, %eax
	leaq	.LC1(%rip), %rdi
	call	printf@PLT
	testl	%eax, %eax
	sete	%al
	movzbl	%al, %eax
	movl	%eax, x(%rip)
	addq	$24, %rsp
	.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
	.cfi_endproc
.LFE1:
	.size	main, .-main
	.globl	c
	.bss
	.align 4
	.type	c, @object
	.size	c, 4
c:
	.zero	4
	.globl	i
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.globl	t
	.align 4
	.type	t, @object
	.size	t, 4
t:
	.zero	4
	.globl	x
	.align 4
	.type	x, @object
	.size	x, 4
x:
	.zero	4
	.globl	p
	.align 32
	.type	p, @object
	.size	p, 40
p:
	.zero	40
	.globl	w
	.align 4
	.type	w, @object
	.size	w, 4
w:
	.zero	4
	.globl	e
	.align 8
	.type	e, @object
	.size	e, 8
e:
	.zero	8
	.globl	d
	.align 8
	.type	d, @object
	.size	d, 8
d:
	.zero	8
	.globl	v
	.align 32
	.type	v, @object
	.size	v, 8388608
v:
	.zero	8388608
	.globl	m
	.align 32
	.type	m, @object
	.size	m, 4194304
m:
	.zero	4194304
	.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:

m[1<<20],v[1<<21],*d,*e,w,p[10],x,t,i,c;Q(y){m[y]&1&&v[y]<t?v[*++e=y]=v[x]+1:0;}main(n){scanf("%*d%d%d",&w,&n);for(x=w++;c=~getchar(x++);m[x]=c>12?p[c-13]=x,11:c)c=~c%88%35;for(;i<n;)for(d=e=v+(1<<20),t=++v[*e=p[i++]];c=v[p[i]],c<t;Q(x-1),Q(x+1),Q(x-w),Q(x+w))x=*d++;x=!printf("%d\n",c-n);}
3 3 1
S..
...
..1

4

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

```c
m[1<<20],v[1<<21],*d,*e,w,p[10],x,t,i,c;Q(y){m[y]&1&&v[y]<t?v[*++e=y]=v[x]+1:0;}main(n){scanf("%*d%d%d",&w,&n);for(x=w++;c=~getchar(x++);m[x]=c>12?p[c-13]=x,11:c)c=~c%88%35;for(;i<n;)for(d=e=v+(1<<20),t=++v[*e=p[i++]];c=v[p[i]],c<t;Q(x-1),Q(x+1),Q(x-w),Q(x+w))x=*d++;x=!printf("%d\n",c-n);}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	m
	.bss
	.align 32
	.type	m, @object
	.size	m, 4194304
m:
	.zero	4194304
	.globl	v
	.align 32
	.type	v, @object
	.size	v, 8388608
v:
	.zero	8388608
	.globl	d
	.align 8
	.type	d, @object
	.size	d, 8
d:
	.zero	8
	.globl	e
	.align 8
	.type	e, @object
	.size	e, 8
e:
	.zero	8
	.globl	w
	.align 4
	.type	w, @object
	.size	w, 4
w:
	.zero	4
	.globl	p
	.align 32
	.type	p, @object
	.size	p, 40
p:
	.zero	40
	.globl	x
	.align 4
	.type	x, @object
	.size	x, 4
x:
	.zero	4
	.globl	t
	.align 4
	.type	t, @object
	.size	t, 4
t:
	.zero	4
	.globl	i
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.globl	c
	.align 4
	.type	c, @object
	.size	c, 4
c:
	.zero	4
	.text
	.globl	Q
	.type	Q, @function
Q:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -4(%rbp)
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	m(%rip), %rax
	movl	(%rdx,%rax), %eax
	andl	$1, %eax
	testl	%eax, %eax
	je	.L3
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	v(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	t(%rip), %eax
	cmpl	%eax, %edx
	jge	.L3
	movl	x(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	v(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movq	e(%rip), %rax
	addq	$4, %rax
	movq	%rax, e(%rip)
	movq	e(%rip), %rax
	movl	-4(%rbp), %edx
	movl	%edx, (%rax)
	movl	(%rax), %eax
	addl	$1, %ecx
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	v(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	nop
.L3:
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	Q, .-Q
	.section	.rodata
.LC0:
	.string	"%*d%d%d"
.LC1:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movl	%edi, -4(%rbp)
	leaq	-4(%rbp), %rax
	movq	%rax, %rdx
	leaq	w(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movl	w(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, w(%rip)
	movl	%eax, x(%rip)
	jmp	.L5
.L8:
	movl	c(%rip), %eax
	notl	%eax
	movl	%eax, %edx
	movslq	%edx, %rax
	imulq	$780903145, %rax, %rax
	shrq	$32, %rax
	sarl	$4, %eax
	movl	%edx, %ecx
	sarl	$31, %ecx
	subl	%ecx, %eax
	imull	$88, %eax, %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	movslq	%eax, %rdx
	imulq	$-368140053, %rdx, %rdx
	shrq	$32, %rdx
	addl	%eax, %edx
	sarl	$5, %edx
	movl	%eax, %ecx
	sarl	$31, %ecx
	subl	%ecx, %edx
	imull	$35, %edx, %ecx
	subl	%ecx, %eax
	movl	%eax, %edx
	movl	%edx, c(%rip)
	movl	c(%rip), %eax
	cmpl	$12, %eax
	jle	.L6
	movl	c(%rip), %eax
	leal	-13(%rax), %edx
	movl	x(%rip), %eax
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	p(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	$11, %eax
	jmp	.L7
.L6:
	movl	c(%rip), %eax
.L7:
	movl	x(%rip), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	m(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
.L5:
	movl	x(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, x(%rip)
	movl	%eax, %edi
	movl	$0, %eax
	call	getchar@PLT
	notl	%eax
	movl	%eax, c(%rip)
	movl	c(%rip), %eax
	testl	%eax, %eax
	jne	.L8
	jmp	.L9
.L12:
	leaq	4194304+v(%rip), %rax
	movq	%rax, e(%rip)
	movq	e(%rip), %rax
	movq	%rax, d(%rip)
	movl	i(%rip), %edx
	leal	1(%rdx), %eax
	movl	%eax, i(%rip)
	movq	e(%rip), %rax
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	p(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	movl	%edx, (%rax)
	movl	(%rax), %eax
	movslq	%eax, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	v(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	leal	1(%rdx), %esi
	movslq	%eax, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	v(%rip), %rdx
	movl	%esi, (%rcx,%rdx)
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	v(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, t(%rip)
	jmp	.L10
.L11:
	movq	d(%rip), %rax
	leaq	4(%rax), %rdx
	movq	%rdx, d(%rip)
	movl	(%rax), %eax
	movl	%eax, x(%rip)
	movl	x(%rip), %eax
	subl	$1, %eax
	movl	%eax, %edi
	movl	$0, %eax
	call	Q
	movl	x(%rip), %eax
	addl	$1, %eax
	movl	%eax, %edi
	movl	$0, %eax
	call	Q
	movl	x(%rip), %eax
	movl	w(%rip), %edx
	subl	%edx, %eax
	movl	%eax, %edi
	movl	$0, %eax
	call	Q
	movl	x(%rip), %edx
	movl	w(%rip), %eax
	addl	%edx, %eax
	movl	%eax, %edi
	movl	$0, %eax
	call	Q
.L10:
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	p(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	v(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, c(%rip)
	movl	c(%rip), %edx
	movl	t(%rip), %eax
	cmpl	%eax, %edx
	jl	.L11
.L9:
	movl	i(%rip), %edx
	movl	-4(%rbp), %eax
	cmpl	%eax, %edx
	jl	.L12
	movl	c(%rip), %eax
	movl	-4(%rbp), %edx
	subl	%edx, %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	testl	%eax, %eax
	sete	%al
	movzbl	%al, %eax
	movl	%eax, x(%rip)
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.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	m
	.bss
	.align 32
	.type	m, @object
	.size	m, 4194304
m:
	.zero	4194304
	.globl	v
	.align 32
	.type	v, @object
	.size	v, 8388608
v:
	.zero	8388608
	.globl	d
	.align 8
	.type	d, @object
	.size	d, 8
d:
	.zero	8
	.globl	e
	.align 8
	.type	e, @object
	.size	e, 8
e:
	.zero	8
	.globl	w
	.align 4
	.type	w, @object
	.size	w, 4
w:
	.zero	4
	.globl	p
	.align 32
	.type	p, @object
	.size	p, 40
p:
	.zero	40
	.globl	x
	.align 4
	.type	x, @object
	.size	x, 4
x:
	.zero	4
	.globl	t
	.align 4
	.type	t, @object
	.size	t, 4
t:
	.zero	4
	.globl	i
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.globl	c
	.align 4
	.type	c, @object
	.size	c, 4
c:
	.zero	4
	.text
	.globl	Q
	.type	Q, @function
Q:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -4(%rbp)
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	m(%rip), %rax
	movl	(%rdx,%rax), %eax
	andl	$1, %eax
	testl	%eax, %eax
	je	.L3
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	v(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	t(%rip), %eax
	cmpl	%eax, %edx
	jge	.L3
	movl	x(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	v(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movq	e(%rip), %rax
	addq	$4, %rax
	movq	%rax, e(%rip)
	movq	e(%rip), %rax
	movl	-4(%rbp), %edx
	movl	%edx, (%rax)
	movl	(%rax), %eax
	addl	$1, %ecx
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	v(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	nop
.L3:
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	Q, .-Q
	.section	.rodata
.LC0:
	.string	"%*d%d%d"
.LC1:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movl	%edi, -4(%rbp)
	leaq	-4(%rbp), %rax
	movq	%rax, %rdx
	leaq	w(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movl	w(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, w(%rip)
	movl	%eax, x(%rip)
	jmp	.L5
.L8:
	movl	c(%rip), %eax
	notl	%eax
	movl	%eax, %edx
	movslq	%edx, %rax
	imulq	$780903145, %rax, %rax
	shrq	$32, %rax
	sarl	$4, %eax
	movl	%edx, %ecx
	sarl	$31, %ecx
	subl	%ecx, %eax
	imull	$88, %eax, %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	movslq	%eax, %rdx
	imulq	$-368140053, %rdx, %rdx
	shrq	$32, %rdx
	addl	%eax, %edx
	sarl	$5, %edx
	movl	%eax, %ecx
	sarl	$31, %ecx
	subl	%ecx, %edx
	imull	$35, %edx, %ecx
	subl	%ecx, %eax
	movl	%eax, %edx
	movl	%edx, c(%rip)
	movl	c(%rip), %eax
	cmpl	$12, %eax
	jle	.L6
	movl	c(%rip), %eax
	leal	-13(%rax), %edx
	movl	x(%rip), %eax
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	p(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	$11, %eax
	jmp	.L7
.L6:
	movl	c(%rip), %eax
.L7:
	movl	x(%rip), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	m(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
.L5:
	movl	x(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, x(%rip)
	movl	%eax, %edi
	movl	$0, %eax
	call	getchar@PLT
	notl	%eax
	movl	%eax, c(%rip)
	movl	c(%rip), %eax
	testl	%eax, %eax
	jne	.L8
	jmp	.L9
.L12:
	leaq	4194304+v(%rip), %rax
	movq	%rax, e(%rip)
	movq	e(%rip), %rax
	movq	%rax, d(%rip)
	movl	i(%rip), %edx
	leal	1(%rdx), %eax
	movl	%eax, i(%rip)
	movq	e(%rip), %rax
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	p(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	movl	%edx, (%rax)
	movl	(%rax), %eax
	movslq	%eax, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	v(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	leal	1(%rdx), %esi
	movslq	%eax, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	v(%rip), %rdx
	movl	%esi, (%rcx,%rdx)
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	v(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, t(%rip)
	jmp	.L10
.L11:
	movq	d(%rip), %rax
	leaq	4(%rax), %rdx
	movq	%rdx, d(%rip)
	movl	(%rax), %eax
	movl	%eax, x(%rip)
	movl	x(%rip), %eax
	subl	$1, %eax
	movl	%eax, %edi
	movl	$0, %eax
	call	Q
	movl	x(%rip), %eax
	addl	$1, %eax
	movl	%eax, %edi
	movl	$0, %eax
	call	Q
	movl	x(%rip), %eax
	movl	w(%rip), %edx
	subl	%edx, %eax
	movl	%eax, %edi
	movl	$0, %eax
	call	Q
	movl	x(%rip), %edx
	movl	w(%rip), %eax
	addl	%edx, %eax
	movl	%eax, %edi
	movl	$0, %eax
	call	Q
.L10:
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	p(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	v(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, c(%rip)
	movl	c(%rip), %edx
	movl	t(%rip), %eax
	cmpl	%eax, %edx
	jl	.L11
.L9:
	movl	i(%rip), %edx
	movl	-4(%rbp), %eax
	cmpl	%eax, %edx
	jl	.L12
	movl	c(%rip), %eax
	movl	-4(%rbp), %edx
	subl	%edx, %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	testl	%eax, %eax
	sete	%al
	movzbl	%al, %eax
	movl	%eax, x(%rip)
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.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:
