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()
{
	char S[51];
	scanf("%s", S);
	
	int i = 0, flag = 0;
	if (S[i] == 'A') i++;
	if (S[i] == 'K') i++;
	else flag = -1;
	if (S[i] == 'I') i++;
	else flag = -1;
	if (S[i] == 'H') i++;
	else flag = -1;
	if (S[i] == 'A') i++;
	if (S[i] == 'B') i++;
	else flag = -1;
	if (S[i] == 'A') i++;
	if (S[i] == 'R') i++;
	else flag = -1;
	if (S[i] == 'A') i++;
	if (S[i] != 0) flag = -1;
	
	if (flag == 0) printf("YES\n");
	else printf("NO\n");
	fflush(stdout);
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%s"
.LC1:
	.string	"YES"
.LC2:
	.string	"NO"
	.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	$80, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-64(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -72(%rbp)
	movl	$0, -68(%rbp)
	movl	-72(%rbp), %eax
	cltq
	movzbl	-64(%rbp,%rax), %eax
	cmpb	$65, %al
	jne	.L2
	addl	$1, -72(%rbp)
.L2:
	movl	-72(%rbp), %eax
	cltq
	movzbl	-64(%rbp,%rax), %eax
	cmpb	$75, %al
	jne	.L3
	addl	$1, -72(%rbp)
	jmp	.L4
.L3:
	movl	$-1, -68(%rbp)
.L4:
	movl	-72(%rbp), %eax
	cltq
	movzbl	-64(%rbp,%rax), %eax
	cmpb	$73, %al
	jne	.L5
	addl	$1, -72(%rbp)
	jmp	.L6
.L5:
	movl	$-1, -68(%rbp)
.L6:
	movl	-72(%rbp), %eax
	cltq
	movzbl	-64(%rbp,%rax), %eax
	cmpb	$72, %al
	jne	.L7
	addl	$1, -72(%rbp)
	jmp	.L8
.L7:
	movl	$-1, -68(%rbp)
.L8:
	movl	-72(%rbp), %eax
	cltq
	movzbl	-64(%rbp,%rax), %eax
	cmpb	$65, %al
	jne	.L9
	addl	$1, -72(%rbp)
.L9:
	movl	-72(%rbp), %eax
	cltq
	movzbl	-64(%rbp,%rax), %eax
	cmpb	$66, %al
	jne	.L10
	addl	$1, -72(%rbp)
	jmp	.L11
.L10:
	movl	$-1, -68(%rbp)
.L11:
	movl	-72(%rbp), %eax
	cltq
	movzbl	-64(%rbp,%rax), %eax
	cmpb	$65, %al
	jne	.L12
	addl	$1, -72(%rbp)
.L12:
	movl	-72(%rbp), %eax
	cltq
	movzbl	-64(%rbp,%rax), %eax
	cmpb	$82, %al
	jne	.L13
	addl	$1, -72(%rbp)
	jmp	.L14
.L13:
	movl	$-1, -68(%rbp)
.L14:
	movl	-72(%rbp), %eax
	cltq
	movzbl	-64(%rbp,%rax), %eax
	cmpb	$65, %al
	jne	.L15
	addl	$1, -72(%rbp)
.L15:
	movl	-72(%rbp), %eax
	cltq
	movzbl	-64(%rbp,%rax), %eax
	testb	%al, %al
	je	.L16
	movl	$-1, -68(%rbp)
.L16:
	cmpl	$0, -68(%rbp)
	jne	.L17
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L18
.L17:
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
.L18:
	movq	stdout(%rip), %rax
	movq	%rax, %rdi
	call	fflush@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L20
	call	__stack_chk_fail@PLT
.L20:
	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	"YES"
.LC2:
	.string	"NO"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	subq	$72, %rsp
	.cfi_def_cfa_offset 80
	leaq	.LC0(%rip), %rdi
	movq	%fs:40, %rax
	movq	%rax, 56(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rsi
	call	__isoc99_scanf@PLT
	xorl	%edx, %edx
	cmpb	$65, (%rsp)
	sete	%al
	sete	%dl
	orl	$-1, %ecx
	movzbl	%al, %eax
	cmpb	$75, (%rsp,%rax)
	jne	.L2
	addl	$1, %edx
	xorl	%ecx, %ecx
	movslq	%edx, %rax
.L2:
	cmpb	$73, (%rsp,%rax)
	je	.L35
	orl	$-1, %ecx
.L3:
	cmpb	$72, (%rsp,%rax)
	je	.L36
	orl	$-1, %ecx
.L4:
	movzbl	(%rsp,%rax), %esi
	cmpb	$65, %sil
	je	.L37
	cmpb	$66, %sil
	je	.L13
	orl	$-1, %ecx
.L7:
	cmpb	$82, (%rsp,%rax)
	je	.L14
.L10:
	leaq	.LC2(%rip), %rdi
	call	puts@PLT
.L11:
	movq	stdout(%rip), %rdi
	call	fflush@PLT
	movq	56(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L38
	xorl	%eax, %eax
	addq	$72, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
.L13:
	.cfi_restore_state
	addl	$1, %edx
	movslq	%edx, %rax
.L6:
	cmpb	$65, (%rsp,%rax)
	jne	.L7
	addl	$1, %edx
	movslq	%edx, %rax
	movzbl	(%rsp,%rax), %eax
	cmpb	$82, %al
	je	.L14
	orl	$-1, %ecx
	cmpb	$65, %al
	jne	.L10
.L12:
	addl	$1, %edx
	movslq	%edx, %rax
.L9:
	cmpb	$0, (%rsp,%rax)
	jne	.L10
	testl	%ecx, %ecx
	jne	.L10
	leaq	.LC1(%rip), %rdi
	call	puts@PLT
	jmp	.L11
.L36:
	addl	$1, %edx
	movslq	%edx, %rax
	jmp	.L4
.L35:
	addl	$1, %edx
	movslq	%edx, %rax
	jmp	.L3
.L37:
	addl	$1, %edx
	movslq	%edx, %rax
	cmpb	$66, (%rsp,%rax)
	je	.L13
	orl	$-1, %ecx
	jmp	.L6
.L14:
	addl	$1, %edx
	movslq	%edx, %rax
	cmpb	$65, (%rsp,%rax)
	jne	.L9
	jmp	.L12
.L38:
	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	"%s"
.LC1:
	.string	"YES"
.LC2:
	.string	"NO"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	subq	$72, %rsp
	.cfi_def_cfa_offset 80
	leaq	.LC0(%rip), %rdi
	movq	%fs:40, %rax
	movq	%rax, 56(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rsi
	call	__isoc99_scanf@PLT
	xorl	%edx, %edx
	cmpb	$65, (%rsp)
	sete	%al
	sete	%dl
	orl	$-1, %ecx
	movzbl	%al, %eax
	cmpb	$75, (%rsp,%rax)
	jne	.L2
	addl	$1, %edx
	xorl	%ecx, %ecx
	movslq	%edx, %rax
.L2:
	cmpb	$73, (%rsp,%rax)
	je	.L35
	orl	$-1, %ecx
.L3:
	cmpb	$72, (%rsp,%rax)
	je	.L36
	orl	$-1, %ecx
.L4:
	movzbl	(%rsp,%rax), %esi
	cmpb	$65, %sil
	je	.L37
	cmpb	$66, %sil
	je	.L13
	orl	$-1, %ecx
.L7:
	cmpb	$82, (%rsp,%rax)
	je	.L14
.L10:
	leaq	.LC2(%rip), %rdi
	call	puts@PLT
.L11:
	movq	stdout(%rip), %rdi
	call	fflush@PLT
	movq	56(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L38
	xorl	%eax, %eax
	addq	$72, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
.L13:
	.cfi_restore_state
	addl	$1, %edx
	movslq	%edx, %rax
.L6:
	cmpb	$65, (%rsp,%rax)
	jne	.L7
	addl	$1, %edx
	movslq	%edx, %rax
	movzbl	(%rsp,%rax), %eax
	cmpb	$82, %al
	je	.L14
	orl	$-1, %ecx
	cmpb	$65, %al
	jne	.L10
.L12:
	addl	$1, %edx
	movslq	%edx, %rax
.L9:
	cmpb	$0, (%rsp,%rax)
	jne	.L10
	testl	%ecx, %ecx
	jne	.L10
	leaq	.LC1(%rip), %rdi
	call	puts@PLT
	jmp	.L11
.L36:
	addl	$1, %edx
	movslq	%edx, %rax
	jmp	.L4
.L35:
	addl	$1, %edx
	movslq	%edx, %rax
	jmp	.L3
.L37:
	addl	$1, %edx
	movslq	%edx, %rax
	cmpb	$66, (%rsp,%rax)
	je	.L13
	orl	$-1, %ecx
	jmp	.L6
.L14:
	addl	$1, %edx
	movslq	%edx, %rax
	cmpb	$65, (%rsp,%rax)
	jne	.L9
	jmp	.L12
.L38:
	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()
{
	char S[51];
	scanf("%s", S);
	
	int i = 0, flag = 0;
	if (S[i] == 'A') i++;
	if (S[i] == 'K') i++;
	else flag = -1;
	if (S[i] == 'I') i++;
	else flag = -1;
	if (S[i] == 'H') i++;
	else flag = -1;
	if (S[i] == 'A') i++;
	if (S[i] == 'B') i++;
	else flag = -1;
	if (S[i] == 'A') i++;
	if (S[i] == 'R') i++;
	else flag = -1;
	if (S[i] == 'A') i++;
	if (S[i] != 0) flag = -1;
	
	if (flag == 0) printf("YES\n");
	else printf("NO\n");
	fflush(stdout);
	return 0;
}
AKIBAAARH
 JIHBR
 ARAABHAIKAA
 HRAAABIKA
 RBHIJ
 AR@ABHAIKAA
 HRAAABHKA
 QBHIJ
 AR@ABHAIJAA
 AKHBAAARH

NO
 NO
 NO
 NO
 NO
 NO
 NO
 NO
 NO
 NO

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()
{
	char S[51];
	scanf("%s", S);
	
	int i = 0, flag = 0;
	if (S[i] == 'A') i++;
	if (S[i] == 'K') i++;
	else flag = -1;
	if (S[i] == 'I') i++;
	else flag = -1;
	if (S[i] == 'H') i++;
	else flag = -1;
	if (S[i] == 'A') i++;
	if (S[i] == 'B') i++;
	else flag = -1;
	if (S[i] == 'A') i++;
	if (S[i] == 'R') i++;
	else flag = -1;
	if (S[i] == 'A') i++;
	if (S[i] != 0) flag = -1;
	
	if (flag == 0) printf("YES\n");
	else printf("NO\n");
	fflush(stdout);
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%s"
.LC1:
	.string	"YES"
.LC2:
	.string	"NO"
	.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	$80, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-64(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -72(%rbp)
	movl	$0, -68(%rbp)
	movl	-72(%rbp), %eax
	cltq
	movzbl	-64(%rbp,%rax), %eax
	cmpb	$65, %al
	jne	.L2
	addl	$1, -72(%rbp)
.L2:
	movl	-72(%rbp), %eax
	cltq
	movzbl	-64(%rbp,%rax), %eax
	cmpb	$75, %al
	jne	.L3
	addl	$1, -72(%rbp)
	jmp	.L4
.L3:
	movl	$-1, -68(%rbp)
.L4:
	movl	-72(%rbp), %eax
	cltq
	movzbl	-64(%rbp,%rax), %eax
	cmpb	$73, %al
	jne	.L5
	addl	$1, -72(%rbp)
	jmp	.L6
.L5:
	movl	$-1, -68(%rbp)
.L6:
	movl	-72(%rbp), %eax
	cltq
	movzbl	-64(%rbp,%rax), %eax
	cmpb	$72, %al
	jne	.L7
	addl	$1, -72(%rbp)
	jmp	.L8
.L7:
	movl	$-1, -68(%rbp)
.L8:
	movl	-72(%rbp), %eax
	cltq
	movzbl	-64(%rbp,%rax), %eax
	cmpb	$65, %al
	jne	.L9
	addl	$1, -72(%rbp)
.L9:
	movl	-72(%rbp), %eax
	cltq
	movzbl	-64(%rbp,%rax), %eax
	cmpb	$66, %al
	jne	.L10
	addl	$1, -72(%rbp)
	jmp	.L11
.L10:
	movl	$-1, -68(%rbp)
.L11:
	movl	-72(%rbp), %eax
	cltq
	movzbl	-64(%rbp,%rax), %eax
	cmpb	$65, %al
	jne	.L12
	addl	$1, -72(%rbp)
.L12:
	movl	-72(%rbp), %eax
	cltq
	movzbl	-64(%rbp,%rax), %eax
	cmpb	$82, %al
	jne	.L13
	addl	$1, -72(%rbp)
	jmp	.L14
.L13:
	movl	$-1, -68(%rbp)
.L14:
	movl	-72(%rbp), %eax
	cltq
	movzbl	-64(%rbp,%rax), %eax
	cmpb	$65, %al
	jne	.L15
	addl	$1, -72(%rbp)
.L15:
	movl	-72(%rbp), %eax
	cltq
	movzbl	-64(%rbp,%rax), %eax
	testb	%al, %al
	je	.L16
	movl	$-1, -68(%rbp)
.L16:
	cmpl	$0, -68(%rbp)
	jne	.L17
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L18
.L17:
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
.L18:
	movq	stdout(%rip), %rax
	movq	%rax, %rdi
	call	fflush@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L20
	call	__stack_chk_fail@PLT
.L20:
	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	"%s"
.LC1:
	.string	"YES"
.LC2:
	.string	"NO"
	.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	$80, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-64(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -72(%rbp)
	movl	$0, -68(%rbp)
	movl	-72(%rbp), %eax
	cltq
	movzbl	-64(%rbp,%rax), %eax
	cmpb	$65, %al
	jne	.L2
	addl	$1, -72(%rbp)
.L2:
	movl	-72(%rbp), %eax
	cltq
	movzbl	-64(%rbp,%rax), %eax
	cmpb	$75, %al
	jne	.L3
	addl	$1, -72(%rbp)
	jmp	.L4
.L3:
	movl	$-1, -68(%rbp)
.L4:
	movl	-72(%rbp), %eax
	cltq
	movzbl	-64(%rbp,%rax), %eax
	cmpb	$73, %al
	jne	.L5
	addl	$1, -72(%rbp)
	jmp	.L6
.L5:
	movl	$-1, -68(%rbp)
.L6:
	movl	-72(%rbp), %eax
	cltq
	movzbl	-64(%rbp,%rax), %eax
	cmpb	$72, %al
	jne	.L7
	addl	$1, -72(%rbp)
	jmp	.L8
.L7:
	movl	$-1, -68(%rbp)
.L8:
	movl	-72(%rbp), %eax
	cltq
	movzbl	-64(%rbp,%rax), %eax
	cmpb	$65, %al
	jne	.L9
	addl	$1, -72(%rbp)
.L9:
	movl	-72(%rbp), %eax
	cltq
	movzbl	-64(%rbp,%rax), %eax
	cmpb	$66, %al
	jne	.L10
	addl	$1, -72(%rbp)
	jmp	.L11
.L10:
	movl	$-1, -68(%rbp)
.L11:
	movl	-72(%rbp), %eax
	cltq
	movzbl	-64(%rbp,%rax), %eax
	cmpb	$65, %al
	jne	.L12
	addl	$1, -72(%rbp)
.L12:
	movl	-72(%rbp), %eax
	cltq
	movzbl	-64(%rbp,%rax), %eax
	cmpb	$82, %al
	jne	.L13
	addl	$1, -72(%rbp)
	jmp	.L14
.L13:
	movl	$-1, -68(%rbp)
.L14:
	movl	-72(%rbp), %eax
	cltq
	movzbl	-64(%rbp,%rax), %eax
	cmpb	$65, %al
	jne	.L15
	addl	$1, -72(%rbp)
.L15:
	movl	-72(%rbp), %eax
	cltq
	movzbl	-64(%rbp,%rax), %eax
	testb	%al, %al
	je	.L16
	movl	$-1, -68(%rbp)
.L16:
	cmpl	$0, -68(%rbp)
	jne	.L17
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L18
.L17:
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
.L18:
	movq	stdout(%rip), %rax
	movq	%rax, %rdi
	call	fflush@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L20
	call	__stack_chk_fail@PLT
.L20:
	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:
