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

```c
char*p,*h,*r,s[1025],t[52];main(){for(;~scanf("%*d%s"+!!h*3,s);puts(h))for(h=p=memset(t,0,52)+25,r=s-1;*p=*++r,*++r;)*++r-62?--p<h?h=p:0:++p;}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	p
	.bss
	.align 8
	.type	p, @object
	.size	p, 8
p:
	.zero	8
	.globl	h
	.align 8
	.type	h, @object
	.size	h, 8
h:
	.zero	8
	.globl	r
	.align 8
	.type	r, @object
	.size	r, 8
r:
	.zero	8
	.globl	s
	.align 32
	.type	s, @object
	.size	s, 1025
s:
	.zero	1025
	.globl	t
	.align 32
	.type	t, @object
	.size	t, 52
t:
	.zero	52
	.section	.rodata
.LC0:
	.string	"%*d%s"
	.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
	jmp	.L2
.L10:
	movl	$52, %edx
	movl	$0, %esi
	leaq	t(%rip), %rax
	movq	%rax, %rdi
	call	memset@PLT
	addq	$25, %rax
	movq	%rax, p(%rip)
	movq	p(%rip), %rax
	movq	%rax, h(%rip)
	leaq	-1+s(%rip), %rax
	movq	%rax, r(%rip)
	jmp	.L3
.L7:
	movq	r(%rip), %rax
	addq	$1, %rax
	movq	%rax, r(%rip)
	movq	r(%rip), %rax
	movzbl	(%rax), %eax
	cmpb	$62, %al
	je	.L4
	movq	p(%rip), %rax
	subq	$1, %rax
	movq	%rax, p(%rip)
	movq	p(%rip), %rdx
	movq	h(%rip), %rax
	cmpq	%rax, %rdx
	jnb	.L3
	movq	p(%rip), %rax
	movq	%rax, h(%rip)
	jmp	.L3
.L4:
	movq	p(%rip), %rax
	addq	$1, %rax
	movq	%rax, p(%rip)
.L3:
	movq	r(%rip), %rax
	addq	$1, %rax
	movq	%rax, r(%rip)
	movq	r(%rip), %rdx
	movq	p(%rip), %rax
	movzbl	(%rdx), %edx
	movb	%dl, (%rax)
	movq	r(%rip), %rax
	addq	$1, %rax
	movq	%rax, r(%rip)
	movq	r(%rip), %rax
	movzbl	(%rax), %eax
	testb	%al, %al
	jne	.L7
	movq	h(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
.L2:
	movq	h(%rip), %rax
	testq	%rax, %rax
	je	.L8
	leaq	3+.LC0(%rip), %rax
	jmp	.L9
.L8:
	leaq	.LC0(%rip), %rax
.L9:
	leaq	s(%rip), %rdx
	movq	%rdx, %rsi
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	cmpl	$-1, %eax
	jne	.L10
	movl	$0, %eax
	popq	%rbp
	.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%s"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	leaq	3+.LC0(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	leaq	-3(%r13), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	leaq	s(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	leaq	1(%rbp), %r14
	leaq	25+t(%rip), %rbx
	.p2align 4,,10
	.p2align 3
.L2:
	cmpq	$0, h(%rip)
	movq	%r12, %rdi
	movq	%rbp, %rsi
	cmovne	%r13, %rdi
	xorl	%eax, %eax
	call	scanf@PLT
	cmpl	$-1, %eax
	je	.L13
	movzbl	0(%rbp), %eax
	pxor	%xmm0, %xmm0
	movq	%rbx, %rdi
	cmpb	$0, 1+s(%rip)
	movaps	%xmm0, 16+t(%rip)
	movl	$0, 48+t(%rip)
	movq	%rbx, p(%rip)
	movq	%rbx, h(%rip)
	movb	%al, 25+t(%rip)
	movq	%r14, r(%rip)
	movaps	%xmm0, t(%rip)
	movaps	%xmm0, 32+t(%rip)
	je	.L3
	leaq	s(%rip), %rax
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L15:
	subq	$1, %rdi
	cmpq	h(%rip), %rdi
	movq	%rdi, p(%rip)
	jnb	.L5
	movq	%rdi, h(%rip)
.L5:
	leaq	3(%rax), %rdx
	movq	%rdx, r(%rip)
	movzbl	3(%rax), %eax
	movb	%al, (%rdi)
	movq	r(%rip), %rax
	leaq	1(%rax), %rdx
	movq	%rdx, r(%rip)
	cmpb	$0, 1(%rax)
	je	.L14
	movq	p(%rip), %rdi
.L7:
	leaq	2(%rax), %rdx
	movq	%rdx, r(%rip)
	cmpb	$62, 2(%rax)
	jne	.L15
	addq	$1, %rdi
	movq	%rdi, p(%rip)
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L14:
	movq	h(%rip), %rdi
.L3:
	call	puts@PLT
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L13:
	popq	%rbx
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	t
	.bss
	.align 32
	.type	t, @object
	.size	t, 52
t:
	.zero	52
	.globl	s
	.align 32
	.type	s, @object
	.size	s, 1025
s:
	.zero	1025
	.globl	r
	.align 8
	.type	r, @object
	.size	r, 8
r:
	.zero	8
	.globl	h
	.align 8
	.type	h, @object
	.size	h, 8
h:
	.zero	8
	.globl	p
	.align 8
	.type	p, @object
	.size	p, 8
p:
	.zero	8
	.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%s"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	leaq	3+.LC0(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	leaq	-3(%r13), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	leaq	s(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	leaq	1(%rbp), %r14
	leaq	25+t(%rip), %rbx
	.p2align 4,,10
	.p2align 3
.L2:
	cmpq	$0, h(%rip)
	movq	%r12, %rdi
	movq	%rbp, %rsi
	cmovne	%r13, %rdi
	xorl	%eax, %eax
	call	scanf@PLT
	cmpl	$-1, %eax
	je	.L13
	movzbl	0(%rbp), %eax
	pxor	%xmm0, %xmm0
	movq	%rbx, %rdi
	cmpb	$0, 1+s(%rip)
	movaps	%xmm0, 16+t(%rip)
	movl	$0, 48+t(%rip)
	movq	%rbx, p(%rip)
	movq	%rbx, h(%rip)
	movb	%al, 25+t(%rip)
	movq	%r14, r(%rip)
	movaps	%xmm0, t(%rip)
	movaps	%xmm0, 32+t(%rip)
	je	.L3
	leaq	s(%rip), %rax
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L15:
	subq	$1, %rdi
	cmpq	h(%rip), %rdi
	movq	%rdi, p(%rip)
	jnb	.L5
	movq	%rdi, h(%rip)
.L5:
	leaq	3(%rax), %rdx
	movq	%rdx, r(%rip)
	movzbl	3(%rax), %eax
	movb	%al, (%rdi)
	movq	r(%rip), %rax
	leaq	1(%rax), %rdx
	movq	%rdx, r(%rip)
	cmpb	$0, 1(%rax)
	je	.L14
	movq	p(%rip), %rdi
.L7:
	leaq	2(%rax), %rdx
	movq	%rdx, r(%rip)
	cmpb	$62, 2(%rax)
	jne	.L15
	addq	$1, %rdi
	movq	%rdi, p(%rip)
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L14:
	movq	h(%rip), %rdi
.L3:
	call	puts@PLT
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L13:
	popq	%rbx
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	t
	.bss
	.align 32
	.type	t, @object
	.size	t, 52
t:
	.zero	52
	.globl	s
	.align 32
	.type	s, @object
	.size	s, 1025
s:
	.zero	1025
	.globl	r
	.align 8
	.type	r, @object
	.size	r, 8
r:
	.zero	8
	.globl	h
	.align 8
	.type	h, @object
	.size	h, 8
h:
	.zero	8
	.globl	p
	.align 8
	.type	p, @object
	.size	p, 8
p:
	.zero	8
	.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:

char*p,*h,*r,s[1025],t[52];main(){for(;~scanf("%*d%s"+!!h*3,s);puts(h))for(h=p=memset(t,0,52)+25,r=s-1;*p=*++r,*++r;)*++r-62?--p<h?h=p:0:++p;}
4
a->f->c->b->d
b
 4
a->e->c->b->d
a
 4
a->f->c->b->d
a
 4
a->f->c->b->d
`
 4
a->e->c->b->d
c
 4
a->f->c->b->d
c
 4
`->f->c->b->d
c
 4
`->f->c->b->d
d
 4
a->e->c->b->d
d
 4
a->e->c->b->d
`

afcbd
b
 aecbd
a
 afcbd
a
 afcbd
`
 aecbd
c
 afcbd
c
 `fcbd
c
 `fcbd
d
 aecbd
d
 aecbd
`

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

```c
char*p,*h,*r,s[1025],t[52];main(){for(;~scanf("%*d%s"+!!h*3,s);puts(h))for(h=p=memset(t,0,52)+25,r=s-1;*p=*++r,*++r;)*++r-62?--p<h?h=p:0:++p;}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	p
	.bss
	.align 8
	.type	p, @object
	.size	p, 8
p:
	.zero	8
	.globl	h
	.align 8
	.type	h, @object
	.size	h, 8
h:
	.zero	8
	.globl	r
	.align 8
	.type	r, @object
	.size	r, 8
r:
	.zero	8
	.globl	s
	.align 32
	.type	s, @object
	.size	s, 1025
s:
	.zero	1025
	.globl	t
	.align 32
	.type	t, @object
	.size	t, 52
t:
	.zero	52
	.section	.rodata
.LC0:
	.string	"%*d%s"
	.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
	jmp	.L2
.L10:
	movl	$52, %edx
	movl	$0, %esi
	leaq	t(%rip), %rax
	movq	%rax, %rdi
	call	memset@PLT
	addq	$25, %rax
	movq	%rax, p(%rip)
	movq	p(%rip), %rax
	movq	%rax, h(%rip)
	leaq	-1+s(%rip), %rax
	movq	%rax, r(%rip)
	jmp	.L3
.L7:
	movq	r(%rip), %rax
	addq	$1, %rax
	movq	%rax, r(%rip)
	movq	r(%rip), %rax
	movzbl	(%rax), %eax
	cmpb	$62, %al
	je	.L4
	movq	p(%rip), %rax
	subq	$1, %rax
	movq	%rax, p(%rip)
	movq	p(%rip), %rdx
	movq	h(%rip), %rax
	cmpq	%rax, %rdx
	jnb	.L3
	movq	p(%rip), %rax
	movq	%rax, h(%rip)
	jmp	.L3
.L4:
	movq	p(%rip), %rax
	addq	$1, %rax
	movq	%rax, p(%rip)
.L3:
	movq	r(%rip), %rax
	addq	$1, %rax
	movq	%rax, r(%rip)
	movq	r(%rip), %rdx
	movq	p(%rip), %rax
	movzbl	(%rdx), %edx
	movb	%dl, (%rax)
	movq	r(%rip), %rax
	addq	$1, %rax
	movq	%rax, r(%rip)
	movq	r(%rip), %rax
	movzbl	(%rax), %eax
	testb	%al, %al
	jne	.L7
	movq	h(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
.L2:
	movq	h(%rip), %rax
	testq	%rax, %rax
	je	.L8
	leaq	3+.LC0(%rip), %rax
	jmp	.L9
.L8:
	leaq	.LC0(%rip), %rax
.L9:
	leaq	s(%rip), %rdx
	movq	%rdx, %rsi
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	cmpl	$-1, %eax
	jne	.L10
	movl	$0, %eax
	popq	%rbp
	.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
	.globl	p
	.bss
	.align 8
	.type	p, @object
	.size	p, 8
p:
	.zero	8
	.globl	h
	.align 8
	.type	h, @object
	.size	h, 8
h:
	.zero	8
	.globl	r
	.align 8
	.type	r, @object
	.size	r, 8
r:
	.zero	8
	.globl	s
	.align 32
	.type	s, @object
	.size	s, 1025
s:
	.zero	1025
	.globl	t
	.align 32
	.type	t, @object
	.size	t, 52
t:
	.zero	52
	.section	.rodata
.LC0:
	.string	"%*d%s"
	.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
	jmp	.L2
.L10:
	movl	$52, %edx
	movl	$0, %esi
	leaq	t(%rip), %rax
	movq	%rax, %rdi
	call	memset@PLT
	addq	$25, %rax
	movq	%rax, p(%rip)
	movq	p(%rip), %rax
	movq	%rax, h(%rip)
	leaq	-1+s(%rip), %rax
	movq	%rax, r(%rip)
	jmp	.L3
.L7:
	movq	r(%rip), %rax
	addq	$1, %rax
	movq	%rax, r(%rip)
	movq	r(%rip), %rax
	movzbl	(%rax), %eax
	cmpb	$62, %al
	je	.L4
	movq	p(%rip), %rax
	subq	$1, %rax
	movq	%rax, p(%rip)
	movq	p(%rip), %rdx
	movq	h(%rip), %rax
	cmpq	%rax, %rdx
	jnb	.L3
	movq	p(%rip), %rax
	movq	%rax, h(%rip)
	jmp	.L3
.L4:
	movq	p(%rip), %rax
	addq	$1, %rax
	movq	%rax, p(%rip)
.L3:
	movq	r(%rip), %rax
	addq	$1, %rax
	movq	%rax, r(%rip)
	movq	r(%rip), %rdx
	movq	p(%rip), %rax
	movzbl	(%rdx), %edx
	movb	%dl, (%rax)
	movq	r(%rip), %rax
	addq	$1, %rax
	movq	%rax, r(%rip)
	movq	r(%rip), %rax
	movzbl	(%rax), %eax
	testb	%al, %al
	jne	.L7
	movq	h(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
.L2:
	movq	h(%rip), %rax
	testq	%rax, %rax
	je	.L8
	leaq	3+.LC0(%rip), %rax
	jmp	.L9
.L8:
	leaq	.LC0(%rip), %rax
.L9:
	leaq	s(%rip), %rdx
	movq	%rdx, %rsi
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	cmpl	$-1, %eax
	jne	.L10
	movl	$0, %eax
	popq	%rbp
	.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:
