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(void){
  char S[50];
  scanf("%s", S);

  int ans = 1, num = 0;
  if(S[num] == 'A') num++;
  if(S[num++] != 'K') ans = 0;
  if(S[num++] != 'I') ans = 0;
  if(S[num++] != 'H') ans = 0;
  if(S[num] == 'A') num++;
  if(S[num++] != 'B') ans = 0;
  if(S[num] == 'A') num++;
  if(S[num++] != 'R') ans = 0;
  if(S[num] == 'A') num++;
  if(S[num++] != '\0') ans = 0;

  if(ans) printf("YES\n");
  else printf("NO\n");

  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	$1, -72(%rbp)
	movl	$0, -68(%rbp)
	movl	-68(%rbp), %eax
	cltq
	movzbl	-64(%rbp,%rax), %eax
	cmpb	$65, %al
	jne	.L2
	addl	$1, -68(%rbp)
.L2:
	movl	-68(%rbp), %eax
	leal	1(%rax), %edx
	movl	%edx, -68(%rbp)
	cltq
	movzbl	-64(%rbp,%rax), %eax
	cmpb	$75, %al
	je	.L3
	movl	$0, -72(%rbp)
.L3:
	movl	-68(%rbp), %eax
	leal	1(%rax), %edx
	movl	%edx, -68(%rbp)
	cltq
	movzbl	-64(%rbp,%rax), %eax
	cmpb	$73, %al
	je	.L4
	movl	$0, -72(%rbp)
.L4:
	movl	-68(%rbp), %eax
	leal	1(%rax), %edx
	movl	%edx, -68(%rbp)
	cltq
	movzbl	-64(%rbp,%rax), %eax
	cmpb	$72, %al
	je	.L5
	movl	$0, -72(%rbp)
.L5:
	movl	-68(%rbp), %eax
	cltq
	movzbl	-64(%rbp,%rax), %eax
	cmpb	$65, %al
	jne	.L6
	addl	$1, -68(%rbp)
.L6:
	movl	-68(%rbp), %eax
	leal	1(%rax), %edx
	movl	%edx, -68(%rbp)
	cltq
	movzbl	-64(%rbp,%rax), %eax
	cmpb	$66, %al
	je	.L7
	movl	$0, -72(%rbp)
.L7:
	movl	-68(%rbp), %eax
	cltq
	movzbl	-64(%rbp,%rax), %eax
	cmpb	$65, %al
	jne	.L8
	addl	$1, -68(%rbp)
.L8:
	movl	-68(%rbp), %eax
	leal	1(%rax), %edx
	movl	%edx, -68(%rbp)
	cltq
	movzbl	-64(%rbp,%rax), %eax
	cmpb	$82, %al
	je	.L9
	movl	$0, -72(%rbp)
.L9:
	movl	-68(%rbp), %eax
	cltq
	movzbl	-64(%rbp,%rax), %eax
	cmpb	$65, %al
	jne	.L10
	addl	$1, -68(%rbp)
.L10:
	movl	-68(%rbp), %eax
	leal	1(%rax), %edx
	movl	%edx, -68(%rbp)
	cltq
	movzbl	-64(%rbp,%rax), %eax
	testb	%al, %al
	je	.L11
	movl	$0, -72(%rbp)
.L11:
	cmpl	$0, -72(%rbp)
	je	.L12
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L13
.L12:
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
.L13:
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L15
	call	__stack_chk_fail@PLT
.L15:
	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	%dl
	sete	%al
	leal	1(%rdx), %esi
	movzbl	%al, %eax
	leal	2(%rdx), %ecx
	movslq	%esi, %rsi
	movzbl	(%rsp,%rax), %edi
	xorl	%eax, %eax
	cmpb	$73, (%rsp,%rsi)
	jne	.L2
	xorl	%eax, %eax
	cmpb	$75, %dil
	sete	%al
.L2:
	movslq	%ecx, %rcx
	leal	3(%rdx), %esi
	cmpb	$72, (%rsp,%rcx)
	movslq	%esi, %rdi
	movl	$0, %ecx
	cmovne	%ecx, %eax
	cmpb	$65, (%rsp,%rdi)
	jne	.L4
	leal	4(%rdx), %esi
	movslq	%esi, %rdi
.L4:
	leal	1(%rsi), %ecx
	xorl	%edx, %edx
	cmpb	$66, (%rsp,%rdi)
	movslq	%ecx, %rdi
	cmovne	%edx, %eax
	cmpb	$65, (%rsp,%rdi)
	jne	.L6
	leal	2(%rsi), %ecx
	movslq	%ecx, %rdi
.L6:
	leal	1(%rcx), %edx
	cmpb	$82, (%rsp,%rdi)
	movslq	%edx, %rdx
	movzbl	(%rsp,%rdx), %esi
	je	.L25
	cmpb	$65, %sil
	je	.L26
.L9:
	leaq	.LC2(%rip), %rdi
	call	puts@PLT
.L10:
	movq	56(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L27
	xorl	%eax, %eax
	addq	$72, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
.L26:
	.cfi_restore_state
	xorl	%eax, %eax
.L11:
	leal	2(%rcx), %edx
	movslq	%edx, %rdx
.L8:
	cmpb	$0, (%rsp,%rdx)
	jne	.L9
	testb	$1, %al
	je	.L9
	leaq	.LC1(%rip), %rdi
	call	puts@PLT
	jmp	.L10
.L25:
	cmpb	$65, %sil
	jne	.L8
	jmp	.L11
.L27:
	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	%dl
	sete	%al
	leal	1(%rdx), %esi
	movzbl	%al, %eax
	leal	2(%rdx), %ecx
	movslq	%esi, %rsi
	movzbl	(%rsp,%rax), %edi
	xorl	%eax, %eax
	cmpb	$73, (%rsp,%rsi)
	jne	.L2
	xorl	%eax, %eax
	cmpb	$75, %dil
	sete	%al
.L2:
	movslq	%ecx, %rcx
	leal	3(%rdx), %esi
	cmpb	$72, (%rsp,%rcx)
	movslq	%esi, %rdi
	movl	$0, %ecx
	cmovne	%ecx, %eax
	cmpb	$65, (%rsp,%rdi)
	jne	.L4
	leal	4(%rdx), %esi
	movslq	%esi, %rdi
.L4:
	leal	1(%rsi), %ecx
	xorl	%edx, %edx
	cmpb	$66, (%rsp,%rdi)
	movslq	%ecx, %rdi
	cmovne	%edx, %eax
	cmpb	$65, (%rsp,%rdi)
	jne	.L6
	leal	2(%rsi), %ecx
	movslq	%ecx, %rdi
.L6:
	leal	1(%rcx), %edx
	cmpb	$82, (%rsp,%rdi)
	movslq	%edx, %rdx
	movzbl	(%rsp,%rdx), %esi
	je	.L25
	cmpb	$65, %sil
	je	.L26
.L9:
	leaq	.LC2(%rip), %rdi
	call	puts@PLT
.L10:
	movq	56(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L27
	xorl	%eax, %eax
	addq	$72, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
.L26:
	.cfi_restore_state
	xorl	%eax, %eax
.L11:
	leal	2(%rcx), %edx
	movslq	%edx, %rdx
.L8:
	cmpb	$0, (%rsp,%rdx)
	jne	.L9
	testb	$1, %al
	je	.L9
	leaq	.LC1(%rip), %rdi
	call	puts@PLT
	jmp	.L10
.L25:
	cmpb	$65, %sil
	jne	.L8
	jmp	.L11
.L27:
	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(void){
  char S[50];
  scanf("%s", S);

  int ans = 1, num = 0;
  if(S[num] == 'A') num++;
  if(S[num++] != 'K') ans = 0;
  if(S[num++] != 'I') ans = 0;
  if(S[num++] != 'H') ans = 0;
  if(S[num] == 'A') num++;
  if(S[num++] != 'B') ans = 0;
  if(S[num] == 'A') num++;
  if(S[num++] != 'R') ans = 0;
  if(S[num] == 'A') num++;
  if(S[num++] != '\0') ans = 0;

  if(ans) printf("YES\n");
  else printf("NO\n");

  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(void){
  char S[50];
  scanf("%s", S);

  int ans = 1, num = 0;
  if(S[num] == 'A') num++;
  if(S[num++] != 'K') ans = 0;
  if(S[num++] != 'I') ans = 0;
  if(S[num++] != 'H') ans = 0;
  if(S[num] == 'A') num++;
  if(S[num++] != 'B') ans = 0;
  if(S[num] == 'A') num++;
  if(S[num++] != 'R') ans = 0;
  if(S[num] == 'A') num++;
  if(S[num++] != '\0') ans = 0;

  if(ans) printf("YES\n");
  else printf("NO\n");

  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	$1, -72(%rbp)
	movl	$0, -68(%rbp)
	movl	-68(%rbp), %eax
	cltq
	movzbl	-64(%rbp,%rax), %eax
	cmpb	$65, %al
	jne	.L2
	addl	$1, -68(%rbp)
.L2:
	movl	-68(%rbp), %eax
	leal	1(%rax), %edx
	movl	%edx, -68(%rbp)
	cltq
	movzbl	-64(%rbp,%rax), %eax
	cmpb	$75, %al
	je	.L3
	movl	$0, -72(%rbp)
.L3:
	movl	-68(%rbp), %eax
	leal	1(%rax), %edx
	movl	%edx, -68(%rbp)
	cltq
	movzbl	-64(%rbp,%rax), %eax
	cmpb	$73, %al
	je	.L4
	movl	$0, -72(%rbp)
.L4:
	movl	-68(%rbp), %eax
	leal	1(%rax), %edx
	movl	%edx, -68(%rbp)
	cltq
	movzbl	-64(%rbp,%rax), %eax
	cmpb	$72, %al
	je	.L5
	movl	$0, -72(%rbp)
.L5:
	movl	-68(%rbp), %eax
	cltq
	movzbl	-64(%rbp,%rax), %eax
	cmpb	$65, %al
	jne	.L6
	addl	$1, -68(%rbp)
.L6:
	movl	-68(%rbp), %eax
	leal	1(%rax), %edx
	movl	%edx, -68(%rbp)
	cltq
	movzbl	-64(%rbp,%rax), %eax
	cmpb	$66, %al
	je	.L7
	movl	$0, -72(%rbp)
.L7:
	movl	-68(%rbp), %eax
	cltq
	movzbl	-64(%rbp,%rax), %eax
	cmpb	$65, %al
	jne	.L8
	addl	$1, -68(%rbp)
.L8:
	movl	-68(%rbp), %eax
	leal	1(%rax), %edx
	movl	%edx, -68(%rbp)
	cltq
	movzbl	-64(%rbp,%rax), %eax
	cmpb	$82, %al
	je	.L9
	movl	$0, -72(%rbp)
.L9:
	movl	-68(%rbp), %eax
	cltq
	movzbl	-64(%rbp,%rax), %eax
	cmpb	$65, %al
	jne	.L10
	addl	$1, -68(%rbp)
.L10:
	movl	-68(%rbp), %eax
	leal	1(%rax), %edx
	movl	%edx, -68(%rbp)
	cltq
	movzbl	-64(%rbp,%rax), %eax
	testb	%al, %al
	je	.L11
	movl	$0, -72(%rbp)
.L11:
	cmpl	$0, -72(%rbp)
	je	.L12
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L13
.L12:
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
.L13:
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L15
	call	__stack_chk_fail@PLT
.L15:
	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	$1, -72(%rbp)
	movl	$0, -68(%rbp)
	movl	-68(%rbp), %eax
	cltq
	movzbl	-64(%rbp,%rax), %eax
	cmpb	$65, %al
	jne	.L2
	addl	$1, -68(%rbp)
.L2:
	movl	-68(%rbp), %eax
	leal	1(%rax), %edx
	movl	%edx, -68(%rbp)
	cltq
	movzbl	-64(%rbp,%rax), %eax
	cmpb	$75, %al
	je	.L3
	movl	$0, -72(%rbp)
.L3:
	movl	-68(%rbp), %eax
	leal	1(%rax), %edx
	movl	%edx, -68(%rbp)
	cltq
	movzbl	-64(%rbp,%rax), %eax
	cmpb	$73, %al
	je	.L4
	movl	$0, -72(%rbp)
.L4:
	movl	-68(%rbp), %eax
	leal	1(%rax), %edx
	movl	%edx, -68(%rbp)
	cltq
	movzbl	-64(%rbp,%rax), %eax
	cmpb	$72, %al
	je	.L5
	movl	$0, -72(%rbp)
.L5:
	movl	-68(%rbp), %eax
	cltq
	movzbl	-64(%rbp,%rax), %eax
	cmpb	$65, %al
	jne	.L6
	addl	$1, -68(%rbp)
.L6:
	movl	-68(%rbp), %eax
	leal	1(%rax), %edx
	movl	%edx, -68(%rbp)
	cltq
	movzbl	-64(%rbp,%rax), %eax
	cmpb	$66, %al
	je	.L7
	movl	$0, -72(%rbp)
.L7:
	movl	-68(%rbp), %eax
	cltq
	movzbl	-64(%rbp,%rax), %eax
	cmpb	$65, %al
	jne	.L8
	addl	$1, -68(%rbp)
.L8:
	movl	-68(%rbp), %eax
	leal	1(%rax), %edx
	movl	%edx, -68(%rbp)
	cltq
	movzbl	-64(%rbp,%rax), %eax
	cmpb	$82, %al
	je	.L9
	movl	$0, -72(%rbp)
.L9:
	movl	-68(%rbp), %eax
	cltq
	movzbl	-64(%rbp,%rax), %eax
	cmpb	$65, %al
	jne	.L10
	addl	$1, -68(%rbp)
.L10:
	movl	-68(%rbp), %eax
	leal	1(%rax), %edx
	movl	%edx, -68(%rbp)
	cltq
	movzbl	-64(%rbp,%rax), %eax
	testb	%al, %al
	je	.L11
	movl	$0, -72(%rbp)
.L11:
	cmpl	$0, -72(%rbp)
	je	.L12
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L13
.L12:
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
.L13:
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L15
	call	__stack_chk_fail@PLT
.L15:
	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:
