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>
#include<string.h>
int main(){
  int i;
  int a[3][3];
  char s[4];
  for(;;){
    scanf("%s",s);
    if(strcmp(s,"0")==0)
      break;
    for(i=0;i<3;i++){
      if(s[i]=='b')
	a[i][0]='b';
      else if(s[i]=='w')
	a[i][0]='w';
      else if(s[i]=='+')
	a[i][0]=0;
    }
    scanf("%s",s);
    for(i=0;i<3;i++){
      if(s[i]=='b')
	a[i][1]='b';
      else if(s[i]=='w')
	a[i][1]='w';
      else if(s[i]=='+')
	a[i][1]=0;
    }
    scanf("%s",s);
    for(i=0;i<3;i++){
      if(s[i]=='b')
	a[i][2]='b';
      else if(s[i]=='w')
	a[i][2]='w';
      else if(s[i]=='+')
	a[i][2]=0;
    }
    for(i=0;i<3;i++){
      if(a[i][0]&&a[i][0]==a[i][1]&&a[i][1]==a[i][2]){
	printf("%c\n",a[i][0]);
	break;
      }
      if(a[0][i]&&a[0][i]==a[1][i]&&a[1][i]==a[2][i]){
	printf("%c\n",a[0][i]);
	break;
      }
    }
    if(i==3){
      if(a[0][0]&&a[0][0]==a[1][1]&&a[1][1]==a[2][2]){
	printf("%c\n",a[0][0]);
	continue;
      }
      if(a[2][0]&&a[2][0]==a[1][1]&&a[1][1]==a[0][2]){
	printf("%c\n",a[2][0]);
	continue;
      }
    }else
      continue;
    puts("NA");
  }
  return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%s"
.LC1:
	.string	"0"
.LC2:
	.string	"%c\n"
.LC3:
	.string	"NA"
	.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	$64, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
.L28:
	leaq	-12(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-12(%rbp), %rax
	leaq	.LC1(%rip), %rdx
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	je	.L32
	movl	$0, -52(%rbp)
	jmp	.L4
.L8:
	movl	-52(%rbp), %eax
	cltq
	movzbl	-12(%rbp,%rax), %eax
	cmpb	$98, %al
	jne	.L5
	movl	-52(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$48, %rax
	movl	$98, (%rax)
	jmp	.L6
.L5:
	movl	-52(%rbp), %eax
	cltq
	movzbl	-12(%rbp,%rax), %eax
	cmpb	$119, %al
	jne	.L7
	movl	-52(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$48, %rax
	movl	$119, (%rax)
	jmp	.L6
.L7:
	movl	-52(%rbp), %eax
	cltq
	movzbl	-12(%rbp,%rax), %eax
	cmpb	$43, %al
	jne	.L6
	movl	-52(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$48, %rax
	movl	$0, (%rax)
.L6:
	addl	$1, -52(%rbp)
.L4:
	cmpl	$2, -52(%rbp)
	jle	.L8
	leaq	-12(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -52(%rbp)
	jmp	.L9
.L13:
	movl	-52(%rbp), %eax
	cltq
	movzbl	-12(%rbp,%rax), %eax
	cmpb	$98, %al
	jne	.L10
	movl	-52(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$44, %rax
	movl	$98, (%rax)
	jmp	.L11
.L10:
	movl	-52(%rbp), %eax
	cltq
	movzbl	-12(%rbp,%rax), %eax
	cmpb	$119, %al
	jne	.L12
	movl	-52(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$44, %rax
	movl	$119, (%rax)
	jmp	.L11
.L12:
	movl	-52(%rbp), %eax
	cltq
	movzbl	-12(%rbp,%rax), %eax
	cmpb	$43, %al
	jne	.L11
	movl	-52(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$44, %rax
	movl	$0, (%rax)
.L11:
	addl	$1, -52(%rbp)
.L9:
	cmpl	$2, -52(%rbp)
	jle	.L13
	leaq	-12(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -52(%rbp)
	jmp	.L14
.L18:
	movl	-52(%rbp), %eax
	cltq
	movzbl	-12(%rbp,%rax), %eax
	cmpb	$98, %al
	jne	.L15
	movl	-52(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$40, %rax
	movl	$98, (%rax)
	jmp	.L16
.L15:
	movl	-52(%rbp), %eax
	cltq
	movzbl	-12(%rbp,%rax), %eax
	cmpb	$119, %al
	jne	.L17
	movl	-52(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$40, %rax
	movl	$119, (%rax)
	jmp	.L16
.L17:
	movl	-52(%rbp), %eax
	cltq
	movzbl	-12(%rbp,%rax), %eax
	cmpb	$43, %al
	jne	.L16
	movl	-52(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$40, %rax
	movl	$0, (%rax)
.L16:
	addl	$1, -52(%rbp)
.L14:
	cmpl	$2, -52(%rbp)
	jle	.L18
	movl	$0, -52(%rbp)
	jmp	.L19
.L23:
	movl	-52(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$48, %rax
	movl	(%rax), %eax
	testl	%eax, %eax
	je	.L20
	movl	-52(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$48, %rax
	movl	(%rax), %ecx
	movl	-52(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$44, %rax
	movl	(%rax), %eax
	cmpl	%eax, %ecx
	jne	.L20
	movl	-52(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$44, %rax
	movl	(%rax), %ecx
	movl	-52(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$40, %rax
	movl	(%rax), %eax
	cmpl	%eax, %ecx
	jne	.L20
	movl	-52(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$48, %rax
	movl	(%rax), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L21
.L20:
	movl	-52(%rbp), %eax
	cltq
	movl	-48(%rbp,%rax,4), %eax
	testl	%eax, %eax
	je	.L22
	movl	-52(%rbp), %eax
	cltq
	movl	-48(%rbp,%rax,4), %edx
	movl	-52(%rbp), %eax
	cltq
	addq	$3, %rax
	movl	-48(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	jne	.L22
	movl	-52(%rbp), %eax
	cltq
	addq	$3, %rax
	movl	-48(%rbp,%rax,4), %edx
	movl	-52(%rbp), %eax
	cltq
	addq	$6, %rax
	movl	-48(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	jne	.L22
	movl	-52(%rbp), %eax
	cltq
	movl	-48(%rbp,%rax,4), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L21
.L22:
	addl	$1, -52(%rbp)
.L19:
	cmpl	$2, -52(%rbp)
	jle	.L23
.L21:
	cmpl	$3, -52(%rbp)
	jne	.L33
	movl	-48(%rbp), %eax
	testl	%eax, %eax
	je	.L25
	movl	-48(%rbp), %edx
	movl	-32(%rbp), %eax
	cmpl	%eax, %edx
	jne	.L25
	movl	-32(%rbp), %edx
	movl	-16(%rbp), %eax
	cmpl	%eax, %edx
	jne	.L25
	movl	-48(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L26
.L25:
	movl	-24(%rbp), %eax
	testl	%eax, %eax
	je	.L27
	movl	-24(%rbp), %edx
	movl	-32(%rbp), %eax
	cmpl	%eax, %edx
	jne	.L27
	movl	-32(%rbp), %edx
	movl	-40(%rbp), %eax
	cmpl	%eax, %edx
	jne	.L27
	movl	-24(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L26
.L27:
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L28
.L33:
	nop
.L26:
	jmp	.L28
.L32:
	nop
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L30
	call	__stack_chk_fail@PLT
.L30:
	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	"0"
.LC2:
	.string	"%c\n"
.LC3:
	.string	"NA"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB35:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	.LC0(%rip), %r15
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	xorl	%r13d, %r13d
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$56, %rsp
	.cfi_def_cfa_offset 112
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	leaq	36(%rsp), %rbp
	.p2align 4,,10
	.p2align 3
.L3:
	xorl	%eax, %eax
	movq	%rbp, %rsi
	movq	%r15, %rdi
	call	__isoc99_scanf@PLT
	cmpw	$48, 0(%rbp)
	je	.L78
	movzbl	36(%rsp), %eax
	cmpb	$98, %al
	je	.L34
	cmpb	$119, %al
	je	.L35
	cmpb	$43, %al
	cmove	%r13d, %ebx
.L7:
	movzbl	37(%rsp), %eax
	cmpb	$98, %al
	je	.L36
.L87:
	cmpb	$119, %al
	je	.L37
	cmpb	$43, %al
	movl	8(%rsp), %eax
	cmove	%r13d, %eax
	movl	%eax, 8(%rsp)
.L8:
	movzbl	38(%rsp), %eax
	cmpb	$98, %al
	je	.L38
.L88:
	cmpb	$119, %al
	je	.L39
	cmpb	$43, %al
	cmove	%r13d, %r12d
.L9:
	movq	%rbp, %rsi
	movq	%r15, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movzbl	36(%rsp), %eax
	cmpb	$98, %al
	je	.L40
	cmpb	$119, %al
	je	.L41
	cmpb	$43, %al
	cmove	%r13d, %r14d
.L10:
	movzbl	37(%rsp), %eax
	cmpb	$98, %al
	je	.L42
	cmpb	$119, %al
	je	.L43
	cmpb	$43, %al
	movl	12(%rsp), %eax
	cmove	%r13d, %eax
	movl	%eax, 12(%rsp)
.L11:
	movzbl	38(%rsp), %eax
	cmpb	$98, %al
	je	.L44
	cmpb	$119, %al
	je	.L45
	cmpb	$43, %al
	movl	20(%rsp), %eax
	cmove	%r13d, %eax
	movl	%eax, 20(%rsp)
.L12:
	movq	%rbp, %rsi
	movq	%r15, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movzbl	36(%rsp), %eax
	cmpb	$98, %al
	je	.L46
	cmpb	$119, %al
	je	.L47
	cmpb	$43, %al
	movl	16(%rsp), %eax
	cmove	%r13d, %eax
	movl	%eax, 16(%rsp)
.L13:
	movzbl	37(%rsp), %eax
	cmpb	$98, %al
	je	.L48
	cmpb	$119, %al
	je	.L49
	cmpb	$43, %al
	movl	24(%rsp), %eax
	cmove	%r13d, %eax
	movl	%eax, 24(%rsp)
.L14:
	movzbl	38(%rsp), %eax
	cmpb	$98, %al
	je	.L50
	cmpb	$119, %al
	je	.L51
	cmpb	$43, %al
	movl	28(%rsp), %eax
	cmove	%r13d, %eax
	movl	%eax, 28(%rsp)
.L15:
	testl	%ebx, %ebx
	je	.L16
	cmpl	%ebx, %r14d
	je	.L79
.L17:
	cmpl	8(%rsp), %ebx
	je	.L80
.L16:
	movl	8(%rsp), %eax
	testl	%eax, %eax
	jne	.L20
.L21:
	testl	%r14d, %r14d
	je	.L23
	cmpl	12(%rsp), %r14d
	je	.L81
.L23:
	testl	%r12d, %r12d
	je	.L25
	cmpl	20(%rsp), %r12d
	je	.L82
.L25:
	movl	16(%rsp), %eax
	testl	%eax, %eax
	je	.L27
	movl	24(%rsp), %edx
	cmpl	%edx, %eax
	je	.L83
.L27:
	testl	%ebx, %ebx
	je	.L30
	cmpl	12(%rsp), %ebx
	je	.L84
.L30:
	testl	%r12d, %r12d
	je	.L32
	cmpl	12(%rsp), %r12d
	je	.L85
.L32:
	leaq	.LC3(%rip), %rdi
	call	puts@PLT
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L80:
	cmpl	%ebx, %r12d
	je	.L75
.L20:
	movl	8(%rsp), %ecx
	cmpl	%ecx, 12(%rsp)
	jne	.L21
	movl	24(%rsp), %ecx
	cmpl	%ecx, 12(%rsp)
	jne	.L21
	movl	12(%rsp), %edx
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L78:
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L86
	addq	$56, %rsp
	.cfi_remember_state
	.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
	.p2align 4,,10
	.p2align 3
.L34:
	.cfi_restore_state
	movzbl	37(%rsp), %eax
	movl	$98, %ebx
	cmpb	$98, %al
	jne	.L87
.L36:
	movzbl	38(%rsp), %eax
	movl	$98, 8(%rsp)
	cmpb	$98, %al
	jne	.L88
.L38:
	movl	$98, %r12d
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L50:
	movl	$98, 28(%rsp)
	jmp	.L15
	.p2align 4,,10
	.p2align 3
.L48:
	movl	$98, 24(%rsp)
	jmp	.L14
	.p2align 4,,10
	.p2align 3
.L46:
	movl	$98, 16(%rsp)
	jmp	.L13
	.p2align 4,,10
	.p2align 3
.L44:
	movl	$98, 20(%rsp)
	jmp	.L12
	.p2align 4,,10
	.p2align 3
.L42:
	movl	$98, 12(%rsp)
	jmp	.L11
	.p2align 4,,10
	.p2align 3
.L40:
	movl	$98, %r14d
	jmp	.L10
	.p2align 4,,10
	.p2align 3
.L41:
	movl	$119, %r14d
	jmp	.L10
	.p2align 4,,10
	.p2align 3
.L39:
	movl	$119, %r12d
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L45:
	movl	$119, 20(%rsp)
	jmp	.L12
	.p2align 4,,10
	.p2align 3
.L43:
	movl	$119, 12(%rsp)
	jmp	.L11
	.p2align 4,,10
	.p2align 3
.L51:
	movl	$119, 28(%rsp)
	jmp	.L15
	.p2align 4,,10
	.p2align 3
.L37:
	movl	$119, 8(%rsp)
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L35:
	movl	$119, %ebx
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L49:
	movl	$119, 24(%rsp)
	jmp	.L14
	.p2align 4,,10
	.p2align 3
.L47:
	movl	$119, 16(%rsp)
	jmp	.L13
	.p2align 4,,10
	.p2align 3
.L79:
	cmpl	16(%rsp), %r14d
	jne	.L17
	movl	%r14d, %edx
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L81:
	cmpl	%r14d, 20(%rsp)
	jne	.L23
	movl	20(%rsp), %edx
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L82:
	cmpl	%r12d, 28(%rsp)
	jne	.L25
.L76:
	movl	28(%rsp), %edx
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L83:
	cmpl	%eax, 28(%rsp)
	jne	.L27
	jmp	.L76
	.p2align 4,,10
	.p2align 3
.L85:
	cmpl	16(%rsp), %r12d
	jne	.L32
.L75:
	movl	%r12d, %edx
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L84:
	cmpl	%ebx, 28(%rsp)
	jne	.L30
	jmp	.L76
.L86:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE35:
	.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	"0"
.LC2:
	.string	"%c\n"
.LC3:
	.string	"NA"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB35:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	.LC0(%rip), %r15
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	xorl	%r13d, %r13d
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$56, %rsp
	.cfi_def_cfa_offset 112
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	leaq	36(%rsp), %rbp
	.p2align 4,,10
	.p2align 3
.L3:
	xorl	%eax, %eax
	movq	%rbp, %rsi
	movq	%r15, %rdi
	call	__isoc99_scanf@PLT
	cmpw	$48, 0(%rbp)
	je	.L78
	movzbl	36(%rsp), %eax
	cmpb	$98, %al
	je	.L34
	cmpb	$119, %al
	je	.L35
	cmpb	$43, %al
	cmove	%r13d, %ebx
.L7:
	movzbl	37(%rsp), %eax
	cmpb	$98, %al
	je	.L36
.L87:
	cmpb	$119, %al
	je	.L37
	cmpb	$43, %al
	movl	8(%rsp), %eax
	cmove	%r13d, %eax
	movl	%eax, 8(%rsp)
.L8:
	movzbl	38(%rsp), %eax
	cmpb	$98, %al
	je	.L38
.L88:
	cmpb	$119, %al
	je	.L39
	cmpb	$43, %al
	cmove	%r13d, %r12d
.L9:
	movq	%rbp, %rsi
	movq	%r15, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movzbl	36(%rsp), %eax
	cmpb	$98, %al
	je	.L40
	cmpb	$119, %al
	je	.L41
	cmpb	$43, %al
	cmove	%r13d, %r14d
.L10:
	movzbl	37(%rsp), %eax
	cmpb	$98, %al
	je	.L42
	cmpb	$119, %al
	je	.L43
	cmpb	$43, %al
	movl	12(%rsp), %eax
	cmove	%r13d, %eax
	movl	%eax, 12(%rsp)
.L11:
	movzbl	38(%rsp), %eax
	cmpb	$98, %al
	je	.L44
	cmpb	$119, %al
	je	.L45
	cmpb	$43, %al
	movl	20(%rsp), %eax
	cmove	%r13d, %eax
	movl	%eax, 20(%rsp)
.L12:
	movq	%rbp, %rsi
	movq	%r15, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movzbl	36(%rsp), %eax
	cmpb	$98, %al
	je	.L46
	cmpb	$119, %al
	je	.L47
	cmpb	$43, %al
	movl	16(%rsp), %eax
	cmove	%r13d, %eax
	movl	%eax, 16(%rsp)
.L13:
	movzbl	37(%rsp), %eax
	cmpb	$98, %al
	je	.L48
	cmpb	$119, %al
	je	.L49
	cmpb	$43, %al
	movl	24(%rsp), %eax
	cmove	%r13d, %eax
	movl	%eax, 24(%rsp)
.L14:
	movzbl	38(%rsp), %eax
	cmpb	$98, %al
	je	.L50
	cmpb	$119, %al
	je	.L51
	cmpb	$43, %al
	movl	28(%rsp), %eax
	cmove	%r13d, %eax
	movl	%eax, 28(%rsp)
.L15:
	testl	%ebx, %ebx
	je	.L16
	cmpl	%ebx, %r14d
	je	.L79
.L17:
	cmpl	8(%rsp), %ebx
	je	.L80
.L16:
	movl	8(%rsp), %eax
	testl	%eax, %eax
	jne	.L20
.L21:
	testl	%r14d, %r14d
	je	.L23
	cmpl	12(%rsp), %r14d
	je	.L81
.L23:
	testl	%r12d, %r12d
	je	.L25
	cmpl	20(%rsp), %r12d
	je	.L82
.L25:
	movl	16(%rsp), %eax
	testl	%eax, %eax
	je	.L27
	movl	24(%rsp), %edx
	cmpl	%edx, %eax
	je	.L83
.L27:
	testl	%ebx, %ebx
	je	.L30
	cmpl	12(%rsp), %ebx
	je	.L84
.L30:
	testl	%r12d, %r12d
	je	.L32
	cmpl	12(%rsp), %r12d
	je	.L85
.L32:
	leaq	.LC3(%rip), %rdi
	call	puts@PLT
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L80:
	cmpl	%ebx, %r12d
	je	.L75
.L20:
	movl	8(%rsp), %ecx
	cmpl	%ecx, 12(%rsp)
	jne	.L21
	movl	24(%rsp), %ecx
	cmpl	%ecx, 12(%rsp)
	jne	.L21
	movl	12(%rsp), %edx
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L78:
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L86
	addq	$56, %rsp
	.cfi_remember_state
	.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
	.p2align 4,,10
	.p2align 3
.L34:
	.cfi_restore_state
	movzbl	37(%rsp), %eax
	movl	$98, %ebx
	cmpb	$98, %al
	jne	.L87
.L36:
	movzbl	38(%rsp), %eax
	movl	$98, 8(%rsp)
	cmpb	$98, %al
	jne	.L88
.L38:
	movl	$98, %r12d
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L50:
	movl	$98, 28(%rsp)
	jmp	.L15
	.p2align 4,,10
	.p2align 3
.L48:
	movl	$98, 24(%rsp)
	jmp	.L14
	.p2align 4,,10
	.p2align 3
.L46:
	movl	$98, 16(%rsp)
	jmp	.L13
	.p2align 4,,10
	.p2align 3
.L44:
	movl	$98, 20(%rsp)
	jmp	.L12
	.p2align 4,,10
	.p2align 3
.L42:
	movl	$98, 12(%rsp)
	jmp	.L11
	.p2align 4,,10
	.p2align 3
.L40:
	movl	$98, %r14d
	jmp	.L10
	.p2align 4,,10
	.p2align 3
.L41:
	movl	$119, %r14d
	jmp	.L10
	.p2align 4,,10
	.p2align 3
.L39:
	movl	$119, %r12d
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L45:
	movl	$119, 20(%rsp)
	jmp	.L12
	.p2align 4,,10
	.p2align 3
.L43:
	movl	$119, 12(%rsp)
	jmp	.L11
	.p2align 4,,10
	.p2align 3
.L51:
	movl	$119, 28(%rsp)
	jmp	.L15
	.p2align 4,,10
	.p2align 3
.L37:
	movl	$119, 8(%rsp)
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L35:
	movl	$119, %ebx
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L49:
	movl	$119, 24(%rsp)
	jmp	.L14
	.p2align 4,,10
	.p2align 3
.L47:
	movl	$119, 16(%rsp)
	jmp	.L13
	.p2align 4,,10
	.p2align 3
.L79:
	cmpl	16(%rsp), %r14d
	jne	.L17
	movl	%r14d, %edx
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L81:
	cmpl	%r14d, 20(%rsp)
	jne	.L23
	movl	20(%rsp), %edx
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L82:
	cmpl	%r12d, 28(%rsp)
	jne	.L25
.L76:
	movl	28(%rsp), %edx
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L83:
	cmpl	%eax, 28(%rsp)
	jne	.L27
	jmp	.L76
	.p2align 4,,10
	.p2align 3
.L85:
	cmpl	16(%rsp), %r12d
	jne	.L32
.L75:
	movl	%r12d, %edx
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L84:
	cmpl	%ebx, 28(%rsp)
	jne	.L30
	jmp	.L76
.L86:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE35:
	.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>
#include<string.h>
int main(){
  int i;
  int a[3][3];
  char s[4];
  for(;;){
    scanf("%s",s);
    if(strcmp(s,"0")==0)
      break;
    for(i=0;i<3;i++){
      if(s[i]=='b')
	a[i][0]='b';
      else if(s[i]=='w')
	a[i][0]='w';
      else if(s[i]=='+')
	a[i][0]=0;
    }
    scanf("%s",s);
    for(i=0;i<3;i++){
      if(s[i]=='b')
	a[i][1]='b';
      else if(s[i]=='w')
	a[i][1]='w';
      else if(s[i]=='+')
	a[i][1]=0;
    }
    scanf("%s",s);
    for(i=0;i<3;i++){
      if(s[i]=='b')
	a[i][2]='b';
      else if(s[i]=='w')
	a[i][2]='w';
      else if(s[i]=='+')
	a[i][2]=0;
    }
    for(i=0;i<3;i++){
      if(a[i][0]&&a[i][0]==a[i][1]&&a[i][1]==a[i][2]){
	printf("%c\n",a[i][0]);
	break;
      }
      if(a[0][i]&&a[0][i]==a[1][i]&&a[1][i]==a[2][i]){
	printf("%c\n",a[0][i]);
	break;
      }
    }
    if(i==3){
      if(a[0][0]&&a[0][0]==a[1][1]&&a[1][1]==a[2][2]){
	printf("%c\n",a[0][0]);
	continue;
      }
      if(a[2][0]&&a[2][0]==a[1][1]&&a[1][1]==a[0][2]){
	printf("%c\n",a[2][0]);
	continue;
      }
    }else
      continue;
    puts("NA");
  }
  return 0;
}
bbw
wbw
+b+
bwb
wbx
wbw
0
 bbw
bww
+b+
bwb
wbx
wbw
0
 bbw
wwb
+a+
bwb
xbw
wvb
0
 bbw
wbw
+b+
bbw
wcw
bww
0
 bbw
wcw
+c+
wbb
wcw
wwb
0
 cwb
wwb
++b
bwb
wbw
xyb
0
 bbw
wbw
+b+
bwb
wcw
wbw
0
 cbw
wbw
+b+
bwb
wbx
wbw
0
 cbw
wbw
+b+
bwb
wxb
wbw
0
 caw
wbw
+b+
bwb
wxb
wbw
0

b
NA
 NA
NA
 NA
b
 b
w
 NA
w
 b
b
 b
NA
 b
NA
 b
NA
 NA
NA

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>
#include<string.h>
int main(){
  int i;
  int a[3][3];
  char s[4];
  for(;;){
    scanf("%s",s);
    if(strcmp(s,"0")==0)
      break;
    for(i=0;i<3;i++){
      if(s[i]=='b')
	a[i][0]='b';
      else if(s[i]=='w')
	a[i][0]='w';
      else if(s[i]=='+')
	a[i][0]=0;
    }
    scanf("%s",s);
    for(i=0;i<3;i++){
      if(s[i]=='b')
	a[i][1]='b';
      else if(s[i]=='w')
	a[i][1]='w';
      else if(s[i]=='+')
	a[i][1]=0;
    }
    scanf("%s",s);
    for(i=0;i<3;i++){
      if(s[i]=='b')
	a[i][2]='b';
      else if(s[i]=='w')
	a[i][2]='w';
      else if(s[i]=='+')
	a[i][2]=0;
    }
    for(i=0;i<3;i++){
      if(a[i][0]&&a[i][0]==a[i][1]&&a[i][1]==a[i][2]){
	printf("%c\n",a[i][0]);
	break;
      }
      if(a[0][i]&&a[0][i]==a[1][i]&&a[1][i]==a[2][i]){
	printf("%c\n",a[0][i]);
	break;
      }
    }
    if(i==3){
      if(a[0][0]&&a[0][0]==a[1][1]&&a[1][1]==a[2][2]){
	printf("%c\n",a[0][0]);
	continue;
      }
      if(a[2][0]&&a[2][0]==a[1][1]&&a[1][1]==a[0][2]){
	printf("%c\n",a[2][0]);
	continue;
      }
    }else
      continue;
    puts("NA");
  }
  return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%s"
.LC1:
	.string	"0"
.LC2:
	.string	"%c\n"
.LC3:
	.string	"NA"
	.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	$64, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
.L28:
	leaq	-12(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-12(%rbp), %rax
	leaq	.LC1(%rip), %rdx
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	je	.L32
	movl	$0, -52(%rbp)
	jmp	.L4
.L8:
	movl	-52(%rbp), %eax
	cltq
	movzbl	-12(%rbp,%rax), %eax
	cmpb	$98, %al
	jne	.L5
	movl	-52(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$48, %rax
	movl	$98, (%rax)
	jmp	.L6
.L5:
	movl	-52(%rbp), %eax
	cltq
	movzbl	-12(%rbp,%rax), %eax
	cmpb	$119, %al
	jne	.L7
	movl	-52(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$48, %rax
	movl	$119, (%rax)
	jmp	.L6
.L7:
	movl	-52(%rbp), %eax
	cltq
	movzbl	-12(%rbp,%rax), %eax
	cmpb	$43, %al
	jne	.L6
	movl	-52(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$48, %rax
	movl	$0, (%rax)
.L6:
	addl	$1, -52(%rbp)
.L4:
	cmpl	$2, -52(%rbp)
	jle	.L8
	leaq	-12(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -52(%rbp)
	jmp	.L9
.L13:
	movl	-52(%rbp), %eax
	cltq
	movzbl	-12(%rbp,%rax), %eax
	cmpb	$98, %al
	jne	.L10
	movl	-52(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$44, %rax
	movl	$98, (%rax)
	jmp	.L11
.L10:
	movl	-52(%rbp), %eax
	cltq
	movzbl	-12(%rbp,%rax), %eax
	cmpb	$119, %al
	jne	.L12
	movl	-52(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$44, %rax
	movl	$119, (%rax)
	jmp	.L11
.L12:
	movl	-52(%rbp), %eax
	cltq
	movzbl	-12(%rbp,%rax), %eax
	cmpb	$43, %al
	jne	.L11
	movl	-52(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$44, %rax
	movl	$0, (%rax)
.L11:
	addl	$1, -52(%rbp)
.L9:
	cmpl	$2, -52(%rbp)
	jle	.L13
	leaq	-12(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -52(%rbp)
	jmp	.L14
.L18:
	movl	-52(%rbp), %eax
	cltq
	movzbl	-12(%rbp,%rax), %eax
	cmpb	$98, %al
	jne	.L15
	movl	-52(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$40, %rax
	movl	$98, (%rax)
	jmp	.L16
.L15:
	movl	-52(%rbp), %eax
	cltq
	movzbl	-12(%rbp,%rax), %eax
	cmpb	$119, %al
	jne	.L17
	movl	-52(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$40, %rax
	movl	$119, (%rax)
	jmp	.L16
.L17:
	movl	-52(%rbp), %eax
	cltq
	movzbl	-12(%rbp,%rax), %eax
	cmpb	$43, %al
	jne	.L16
	movl	-52(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$40, %rax
	movl	$0, (%rax)
.L16:
	addl	$1, -52(%rbp)
.L14:
	cmpl	$2, -52(%rbp)
	jle	.L18
	movl	$0, -52(%rbp)
	jmp	.L19
.L23:
	movl	-52(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$48, %rax
	movl	(%rax), %eax
	testl	%eax, %eax
	je	.L20
	movl	-52(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$48, %rax
	movl	(%rax), %ecx
	movl	-52(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$44, %rax
	movl	(%rax), %eax
	cmpl	%eax, %ecx
	jne	.L20
	movl	-52(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$44, %rax
	movl	(%rax), %ecx
	movl	-52(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$40, %rax
	movl	(%rax), %eax
	cmpl	%eax, %ecx
	jne	.L20
	movl	-52(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$48, %rax
	movl	(%rax), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L21
.L20:
	movl	-52(%rbp), %eax
	cltq
	movl	-48(%rbp,%rax,4), %eax
	testl	%eax, %eax
	je	.L22
	movl	-52(%rbp), %eax
	cltq
	movl	-48(%rbp,%rax,4), %edx
	movl	-52(%rbp), %eax
	cltq
	addq	$3, %rax
	movl	-48(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	jne	.L22
	movl	-52(%rbp), %eax
	cltq
	addq	$3, %rax
	movl	-48(%rbp,%rax,4), %edx
	movl	-52(%rbp), %eax
	cltq
	addq	$6, %rax
	movl	-48(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	jne	.L22
	movl	-52(%rbp), %eax
	cltq
	movl	-48(%rbp,%rax,4), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L21
.L22:
	addl	$1, -52(%rbp)
.L19:
	cmpl	$2, -52(%rbp)
	jle	.L23
.L21:
	cmpl	$3, -52(%rbp)
	jne	.L33
	movl	-48(%rbp), %eax
	testl	%eax, %eax
	je	.L25
	movl	-48(%rbp), %edx
	movl	-32(%rbp), %eax
	cmpl	%eax, %edx
	jne	.L25
	movl	-32(%rbp), %edx
	movl	-16(%rbp), %eax
	cmpl	%eax, %edx
	jne	.L25
	movl	-48(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L26
.L25:
	movl	-24(%rbp), %eax
	testl	%eax, %eax
	je	.L27
	movl	-24(%rbp), %edx
	movl	-32(%rbp), %eax
	cmpl	%eax, %edx
	jne	.L27
	movl	-32(%rbp), %edx
	movl	-40(%rbp), %eax
	cmpl	%eax, %edx
	jne	.L27
	movl	-24(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L26
.L27:
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L28
.L33:
	nop
.L26:
	jmp	.L28
.L32:
	nop
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L30
	call	__stack_chk_fail@PLT
.L30:
	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	"0"
.LC2:
	.string	"%c\n"
.LC3:
	.string	"NA"
	.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	$64, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
.L28:
	leaq	-12(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-12(%rbp), %rax
	leaq	.LC1(%rip), %rdx
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	je	.L32
	movl	$0, -52(%rbp)
	jmp	.L4
.L8:
	movl	-52(%rbp), %eax
	cltq
	movzbl	-12(%rbp,%rax), %eax
	cmpb	$98, %al
	jne	.L5
	movl	-52(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$48, %rax
	movl	$98, (%rax)
	jmp	.L6
.L5:
	movl	-52(%rbp), %eax
	cltq
	movzbl	-12(%rbp,%rax), %eax
	cmpb	$119, %al
	jne	.L7
	movl	-52(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$48, %rax
	movl	$119, (%rax)
	jmp	.L6
.L7:
	movl	-52(%rbp), %eax
	cltq
	movzbl	-12(%rbp,%rax), %eax
	cmpb	$43, %al
	jne	.L6
	movl	-52(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$48, %rax
	movl	$0, (%rax)
.L6:
	addl	$1, -52(%rbp)
.L4:
	cmpl	$2, -52(%rbp)
	jle	.L8
	leaq	-12(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -52(%rbp)
	jmp	.L9
.L13:
	movl	-52(%rbp), %eax
	cltq
	movzbl	-12(%rbp,%rax), %eax
	cmpb	$98, %al
	jne	.L10
	movl	-52(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$44, %rax
	movl	$98, (%rax)
	jmp	.L11
.L10:
	movl	-52(%rbp), %eax
	cltq
	movzbl	-12(%rbp,%rax), %eax
	cmpb	$119, %al
	jne	.L12
	movl	-52(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$44, %rax
	movl	$119, (%rax)
	jmp	.L11
.L12:
	movl	-52(%rbp), %eax
	cltq
	movzbl	-12(%rbp,%rax), %eax
	cmpb	$43, %al
	jne	.L11
	movl	-52(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$44, %rax
	movl	$0, (%rax)
.L11:
	addl	$1, -52(%rbp)
.L9:
	cmpl	$2, -52(%rbp)
	jle	.L13
	leaq	-12(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -52(%rbp)
	jmp	.L14
.L18:
	movl	-52(%rbp), %eax
	cltq
	movzbl	-12(%rbp,%rax), %eax
	cmpb	$98, %al
	jne	.L15
	movl	-52(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$40, %rax
	movl	$98, (%rax)
	jmp	.L16
.L15:
	movl	-52(%rbp), %eax
	cltq
	movzbl	-12(%rbp,%rax), %eax
	cmpb	$119, %al
	jne	.L17
	movl	-52(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$40, %rax
	movl	$119, (%rax)
	jmp	.L16
.L17:
	movl	-52(%rbp), %eax
	cltq
	movzbl	-12(%rbp,%rax), %eax
	cmpb	$43, %al
	jne	.L16
	movl	-52(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$40, %rax
	movl	$0, (%rax)
.L16:
	addl	$1, -52(%rbp)
.L14:
	cmpl	$2, -52(%rbp)
	jle	.L18
	movl	$0, -52(%rbp)
	jmp	.L19
.L23:
	movl	-52(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$48, %rax
	movl	(%rax), %eax
	testl	%eax, %eax
	je	.L20
	movl	-52(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$48, %rax
	movl	(%rax), %ecx
	movl	-52(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$44, %rax
	movl	(%rax), %eax
	cmpl	%eax, %ecx
	jne	.L20
	movl	-52(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$44, %rax
	movl	(%rax), %ecx
	movl	-52(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$40, %rax
	movl	(%rax), %eax
	cmpl	%eax, %ecx
	jne	.L20
	movl	-52(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$48, %rax
	movl	(%rax), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L21
.L20:
	movl	-52(%rbp), %eax
	cltq
	movl	-48(%rbp,%rax,4), %eax
	testl	%eax, %eax
	je	.L22
	movl	-52(%rbp), %eax
	cltq
	movl	-48(%rbp,%rax,4), %edx
	movl	-52(%rbp), %eax
	cltq
	addq	$3, %rax
	movl	-48(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	jne	.L22
	movl	-52(%rbp), %eax
	cltq
	addq	$3, %rax
	movl	-48(%rbp,%rax,4), %edx
	movl	-52(%rbp), %eax
	cltq
	addq	$6, %rax
	movl	-48(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	jne	.L22
	movl	-52(%rbp), %eax
	cltq
	movl	-48(%rbp,%rax,4), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L21
.L22:
	addl	$1, -52(%rbp)
.L19:
	cmpl	$2, -52(%rbp)
	jle	.L23
.L21:
	cmpl	$3, -52(%rbp)
	jne	.L33
	movl	-48(%rbp), %eax
	testl	%eax, %eax
	je	.L25
	movl	-48(%rbp), %edx
	movl	-32(%rbp), %eax
	cmpl	%eax, %edx
	jne	.L25
	movl	-32(%rbp), %edx
	movl	-16(%rbp), %eax
	cmpl	%eax, %edx
	jne	.L25
	movl	-48(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L26
.L25:
	movl	-24(%rbp), %eax
	testl	%eax, %eax
	je	.L27
	movl	-24(%rbp), %edx
	movl	-32(%rbp), %eax
	cmpl	%eax, %edx
	jne	.L27
	movl	-32(%rbp), %edx
	movl	-40(%rbp), %eax
	cmpl	%eax, %edx
	jne	.L27
	movl	-24(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L26
.L27:
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L28
.L33:
	nop
.L26:
	jmp	.L28
.L32:
	nop
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L30
	call	__stack_chk_fail@PLT
.L30:
	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:
