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

```c
// AOJ 2669: A-Z Cat
// 2017.10.11 bal4u@uu

#include <stdio.h>
#include <string.h>

char s[22];
char ans[22];

int main()
{
	char *p, *q;

	scanf("%s", s); p = s, q = ans;
	while (*p) {
		if (*p == 'A') {
			p++; while (*p && *p != 'Z') p++;
			if (!*p) break;
			*q++ = 'A', *q++ = 'Z';
		}
		p++;
	}
	if (q == ans) puts("-1");
	else { *q = 0; puts(ans); }
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	s
	.bss
	.align 16
	.type	s, @object
	.size	s, 22
s:
	.zero	22
	.globl	ans
	.align 16
	.type	ans, @object
	.size	ans, 22
ans:
	.zero	22
	.section	.rodata
.LC0:
	.string	"%s"
.LC1:
	.string	"-1"
	.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	$16, %rsp
	leaq	s(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	s(%rip), %rax
	movq	%rax, -16(%rbp)
	leaq	ans(%rip), %rax
	movq	%rax, -8(%rbp)
	jmp	.L2
.L9:
	movq	-16(%rbp), %rax
	movzbl	(%rax), %eax
	cmpb	$65, %al
	jne	.L3
	addq	$1, -16(%rbp)
	jmp	.L4
.L6:
	addq	$1, -16(%rbp)
.L4:
	movq	-16(%rbp), %rax
	movzbl	(%rax), %eax
	testb	%al, %al
	je	.L5
	movq	-16(%rbp), %rax
	movzbl	(%rax), %eax
	cmpb	$90, %al
	jne	.L6
.L5:
	movq	-16(%rbp), %rax
	movzbl	(%rax), %eax
	testb	%al, %al
	je	.L13
	movq	-8(%rbp), %rax
	leaq	1(%rax), %rdx
	movq	%rdx, -8(%rbp)
	movb	$65, (%rax)
	movq	-8(%rbp), %rax
	leaq	1(%rax), %rdx
	movq	%rdx, -8(%rbp)
	movb	$90, (%rax)
.L3:
	addq	$1, -16(%rbp)
.L2:
	movq	-16(%rbp), %rax
	movzbl	(%rax), %eax
	testb	%al, %al
	jne	.L9
	jmp	.L8
.L13:
	nop
.L8:
	leaq	ans(%rip), %rax
	cmpq	%rax, -8(%rbp)
	jne	.L10
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L11
.L10:
	movq	-8(%rbp), %rax
	movb	$0, (%rax)
	leaq	ans(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
.L11:
	movl	$0, %eax
	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	"%s"
.LC1:
	.string	"-1"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB35:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	leaq	s(%rip), %rbx
	leaq	.LC0(%rip), %rdi
	xorl	%eax, %eax
	movq	%rbx, %rsi
	call	__isoc99_scanf@PLT
	movzbl	s(%rip), %esi
	leaq	ans(%rip), %r8
	movq	%rbx, %rcx
	movq	%r8, %rdi
	testb	%sil, %sil
	jne	.L2
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L4:
	movzbl	1(%rax), %esi
	leaq	1(%rax), %rcx
	testb	%sil, %sil
	je	.L8
.L2:
	movzbl	1(%rcx), %edx
	movq	%rcx, %rax
	cmpb	$65, %sil
	jne	.L4
	addq	$1, %rax
	cmpb	$90, %dl
	je	.L5
	testb	%dl, %dl
	je	.L8
	.p2align 4,,10
	.p2align 3
.L6:
	movzbl	1(%rax), %edx
	addq	$1, %rax
	testb	%dl, %dl
	je	.L8
	cmpb	$90, %dl
	jne	.L6
.L5:
	testb	%dl, %dl
	je	.L8
	movzbl	1(%rax), %esi
	movl	$23105, %edx
	addq	$2, %rdi
	leaq	1(%rax), %rcx
	movw	%dx, -2(%rdi)
	testb	%sil, %sil
	jne	.L2
	.p2align 4,,10
	.p2align 3
.L8:
	cmpq	%r8, %rdi
	je	.L9
	movb	$0, (%rdi)
	movq	%r8, %rdi
	call	puts@PLT
.L3:
	xorl	%eax, %eax
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
.L9:
	.cfi_restore_state
	leaq	.LC1(%rip), %rdi
	call	puts@PLT
	jmp	.L3
	.cfi_endproc
.LFE35:
	.size	main, .-main
	.globl	ans
	.bss
	.align 16
	.type	ans, @object
	.size	ans, 22
ans:
	.zero	22
	.globl	s
	.align 16
	.type	s, @object
	.size	s, 22
s:
	.zero	22
	.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	"%s"
.LC1:
	.string	"-1"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB35:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	leaq	s(%rip), %rbx
	leaq	.LC0(%rip), %rdi
	xorl	%eax, %eax
	movq	%rbx, %rsi
	call	__isoc99_scanf@PLT
	movzbl	s(%rip), %esi
	leaq	ans(%rip), %r8
	movq	%rbx, %rcx
	movq	%r8, %rdi
	testb	%sil, %sil
	jne	.L2
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L4:
	movzbl	1(%rax), %esi
	leaq	1(%rax), %rcx
	testb	%sil, %sil
	je	.L8
.L2:
	movzbl	1(%rcx), %edx
	movq	%rcx, %rax
	cmpb	$65, %sil
	jne	.L4
	addq	$1, %rax
	cmpb	$90, %dl
	je	.L5
	testb	%dl, %dl
	je	.L8
	.p2align 4,,10
	.p2align 3
.L6:
	movzbl	1(%rax), %edx
	addq	$1, %rax
	testb	%dl, %dl
	je	.L8
	cmpb	$90, %dl
	jne	.L6
.L5:
	testb	%dl, %dl
	je	.L8
	movzbl	1(%rax), %esi
	movl	$23105, %edx
	addq	$2, %rdi
	leaq	1(%rax), %rcx
	movw	%dx, -2(%rdi)
	testb	%sil, %sil
	jne	.L2
	.p2align 4,,10
	.p2align 3
.L8:
	cmpq	%r8, %rdi
	je	.L9
	movb	$0, (%rdi)
	movq	%r8, %rdi
	call	puts@PLT
.L3:
	xorl	%eax, %eax
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
.L9:
	.cfi_restore_state
	leaq	.LC1(%rip), %rdi
	call	puts@PLT
	jmp	.L3
	.cfi_endproc
.LFE35:
	.size	main, .-main
	.globl	ans
	.bss
	.align 16
	.type	ans, @object
	.size	ans, 22
ans:
	.zero	22
	.globl	s
	.align 16
	.type	s, @object
	.size	s, 22
s:
	.zero	22
	.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:

// AOJ 2669: A-Z Cat
// 2017.10.11 bal4u@uu

#include <stdio.h>
#include <string.h>

char s[22];
char ans[22];

int main()
{
	char *p, *q;

	scanf("%s", s); p = s, q = ans;
	while (*p) {
		if (*p == 'A') {
			p++; while (*p && *p != 'Z') p++;
			if (!*p) break;
			*q++ = 'A', *q++ = 'Z';
		}
		p++;
	}
	if (q == ans) puts("-1");
	else { *q = 0; puts(ans); }
	return 0;
}
AOZUNYANPERIPERO
 OREQIRMQEAYNUYOA
 OREPIREPNAYNUZOA
 OREPIRNPEAYNUZOA
 OREQIRNPEAYNUZOA
 OREQIRMPEAYNUZOA
 AOZUNYAEPMRIQERO
 OREQIRMQEAYNUZOA
 ORFQIRMQEAYNUYOA
 OREQIRNQEAYNUYOA

AZ
 -1
 AZ
 AZ
 AZ
 AZ
 AZ
 AZ
 -1
 -1

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

```c
// AOJ 2669: A-Z Cat
// 2017.10.11 bal4u@uu

#include <stdio.h>
#include <string.h>

char s[22];
char ans[22];

int main()
{
	char *p, *q;

	scanf("%s", s); p = s, q = ans;
	while (*p) {
		if (*p == 'A') {
			p++; while (*p && *p != 'Z') p++;
			if (!*p) break;
			*q++ = 'A', *q++ = 'Z';
		}
		p++;
	}
	if (q == ans) puts("-1");
	else { *q = 0; puts(ans); }
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	s
	.bss
	.align 16
	.type	s, @object
	.size	s, 22
s:
	.zero	22
	.globl	ans
	.align 16
	.type	ans, @object
	.size	ans, 22
ans:
	.zero	22
	.section	.rodata
.LC0:
	.string	"%s"
.LC1:
	.string	"-1"
	.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	$16, %rsp
	leaq	s(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	s(%rip), %rax
	movq	%rax, -16(%rbp)
	leaq	ans(%rip), %rax
	movq	%rax, -8(%rbp)
	jmp	.L2
.L9:
	movq	-16(%rbp), %rax
	movzbl	(%rax), %eax
	cmpb	$65, %al
	jne	.L3
	addq	$1, -16(%rbp)
	jmp	.L4
.L6:
	addq	$1, -16(%rbp)
.L4:
	movq	-16(%rbp), %rax
	movzbl	(%rax), %eax
	testb	%al, %al
	je	.L5
	movq	-16(%rbp), %rax
	movzbl	(%rax), %eax
	cmpb	$90, %al
	jne	.L6
.L5:
	movq	-16(%rbp), %rax
	movzbl	(%rax), %eax
	testb	%al, %al
	je	.L13
	movq	-8(%rbp), %rax
	leaq	1(%rax), %rdx
	movq	%rdx, -8(%rbp)
	movb	$65, (%rax)
	movq	-8(%rbp), %rax
	leaq	1(%rax), %rdx
	movq	%rdx, -8(%rbp)
	movb	$90, (%rax)
.L3:
	addq	$1, -16(%rbp)
.L2:
	movq	-16(%rbp), %rax
	movzbl	(%rax), %eax
	testb	%al, %al
	jne	.L9
	jmp	.L8
.L13:
	nop
.L8:
	leaq	ans(%rip), %rax
	cmpq	%rax, -8(%rbp)
	jne	.L10
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L11
.L10:
	movq	-8(%rbp), %rax
	movb	$0, (%rax)
	leaq	ans(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
.L11:
	movl	$0, %eax
	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
	.globl	s
	.bss
	.align 16
	.type	s, @object
	.size	s, 22
s:
	.zero	22
	.globl	ans
	.align 16
	.type	ans, @object
	.size	ans, 22
ans:
	.zero	22
	.section	.rodata
.LC0:
	.string	"%s"
.LC1:
	.string	"-1"
	.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	$16, %rsp
	leaq	s(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	s(%rip), %rax
	movq	%rax, -16(%rbp)
	leaq	ans(%rip), %rax
	movq	%rax, -8(%rbp)
	jmp	.L2
.L9:
	movq	-16(%rbp), %rax
	movzbl	(%rax), %eax
	cmpb	$65, %al
	jne	.L3
	addq	$1, -16(%rbp)
	jmp	.L4
.L6:
	addq	$1, -16(%rbp)
.L4:
	movq	-16(%rbp), %rax
	movzbl	(%rax), %eax
	testb	%al, %al
	je	.L5
	movq	-16(%rbp), %rax
	movzbl	(%rax), %eax
	cmpb	$90, %al
	jne	.L6
.L5:
	movq	-16(%rbp), %rax
	movzbl	(%rax), %eax
	testb	%al, %al
	je	.L13
	movq	-8(%rbp), %rax
	leaq	1(%rax), %rdx
	movq	%rdx, -8(%rbp)
	movb	$65, (%rax)
	movq	-8(%rbp), %rax
	leaq	1(%rax), %rdx
	movq	%rdx, -8(%rbp)
	movb	$90, (%rax)
.L3:
	addq	$1, -16(%rbp)
.L2:
	movq	-16(%rbp), %rax
	movzbl	(%rax), %eax
	testb	%al, %al
	jne	.L9
	jmp	.L8
.L13:
	nop
.L8:
	leaq	ans(%rip), %rax
	cmpq	%rax, -8(%rbp)
	jne	.L10
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L11
.L10:
	movq	-8(%rbp), %rax
	movb	$0, (%rax)
	leaq	ans(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
.L11:
	movl	$0, %eax
	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:
