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>
#include <stdlib.h>

int i,j,ppp,line[9];
char row[9];

int main(){
	while(1){
		for(i=0;i<3;i++){
			scanf("%s",row);
			if(row[0]=='0')return 0;
			for(j=0;j<3;j++){
				if(row[j]=='w')ppp=1;
				else if(row[j]=='b')ppp=-1;
				else continue;
				line[j]+=ppp;
				line[3+i]+=ppp;
				if(i==j)line[6]+=ppp;
				if(i==2-j)line[7]+=ppp;
			}
		}
		for(i=0;i<8;i++){
			if(line[i]==3){printf("w\n");break;}
			if(line[i]==-3){printf("b\n");break;}
			line[i]=0;
		}
		if(i==8)printf("NA\n");
		for(;i<8;i++)line[i]=0;
	}
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	i
	.bss
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.globl	j
	.align 4
	.type	j, @object
	.size	j, 4
j:
	.zero	4
	.globl	ppp
	.align 4
	.type	ppp, @object
	.size	ppp, 4
ppp:
	.zero	4
	.globl	line
	.align 32
	.type	line, @object
	.size	line, 36
line:
	.zero	36
	.globl	row
	.align 8
	.type	row, @object
	.size	row, 9
row:
	.zero	9
	.section	.rodata
.LC0:
	.string	"%s"
.LC1:
	.string	"w"
.LC2:
	.string	"b"
.LC3:
	.string	"NA"
	.text
	.globl	main
	.type	main, @function
main:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
.L21:
	movl	$0, i(%rip)
	jmp	.L2
.L12:
	leaq	row(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movzbl	row(%rip), %eax
	cmpb	$48, %al
	jne	.L3
	movl	$0, %eax
	jmp	.L22
.L3:
	movl	$0, j(%rip)
	jmp	.L5
.L11:
	movl	j(%rip), %eax
	cltq
	leaq	row(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	cmpb	$119, %al
	jne	.L6
	movl	$1, ppp(%rip)
	jmp	.L7
.L6:
	movl	j(%rip), %eax
	cltq
	leaq	row(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	cmpb	$98, %al
	jne	.L23
	movl	$-1, ppp(%rip)
.L7:
	movl	j(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	line(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	ppp(%rip), %edx
	movl	j(%rip), %eax
	addl	%edx, %ecx
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	line(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	i(%rip), %eax
	addl	$3, %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	line(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	ppp(%rip), %edx
	movl	i(%rip), %eax
	addl	$3, %eax
	addl	%edx, %ecx
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	line(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	i(%rip), %edx
	movl	j(%rip), %eax
	cmpl	%eax, %edx
	jne	.L10
	movl	24+line(%rip), %edx
	movl	ppp(%rip), %eax
	addl	%edx, %eax
	movl	%eax, 24+line(%rip)
.L10:
	movl	j(%rip), %eax
	movl	$2, %edx
	subl	%eax, %edx
	movl	i(%rip), %eax
	cmpl	%eax, %edx
	jne	.L9
	movl	28+line(%rip), %edx
	movl	ppp(%rip), %eax
	addl	%edx, %eax
	movl	%eax, 28+line(%rip)
	jmp	.L9
.L23:
	nop
.L9:
	movl	j(%rip), %eax
	addl	$1, %eax
	movl	%eax, j(%rip)
.L5:
	movl	j(%rip), %eax
	cmpl	$2, %eax
	jle	.L11
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L2:
	movl	i(%rip), %eax
	cmpl	$2, %eax
	jle	.L12
	movl	$0, i(%rip)
	jmp	.L13
.L17:
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	line(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	$3, %eax
	jne	.L14
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L15
.L14:
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	line(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	$-3, %eax
	jne	.L16
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L15
.L16:
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	line(%rip), %rax
	movl	$0, (%rdx,%rax)
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L13:
	movl	i(%rip), %eax
	cmpl	$7, %eax
	jle	.L17
.L15:
	movl	i(%rip), %eax
	cmpl	$8, %eax
	jne	.L19
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L19
.L20:
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	line(%rip), %rax
	movl	$0, (%rdx,%rax)
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L19:
	movl	i(%rip), %eax
	cmpl	$7, %eax
	jle	.L20
	jmp	.L21
.L22:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.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	"w"
.LC2:
	.string	"b"
.LC3:
	.string	"NA"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB51:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	row(%rip), %r15
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	leaq	line(%rip), %r14
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	leaq	.LC3(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	leaq	.LC1(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	leaq	.LC2(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	.LC0(%rip), %rbx
	subq	$8, %rsp
	.cfi_def_cfa_offset 64
.L32:
	movl	$0, i(%rip)
	.p2align 4,,10
	.p2align 3
.L21:
	movq	%r15, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movzbl	(%r15), %esi
	cmpb	$48, %sil
	je	.L59
	movl	i(%rip), %edx
	movl	ppp(%rip), %eax
	leal	3(%rdx), %ecx
	cmpb	$119, %sil
	je	.L62
	cmpb	$98, %sil
	je	.L35
	xorl	%edi, %edi
.L5:
	movzbl	1+row(%rip), %esi
	cmpb	$119, %sil
	je	.L63
	cmpb	$98, %sil
	jne	.L8
	movl	$-1, %eax
.L12:
	movslq	%ecx, %rsi
	addl	%eax, 4+line(%rip)
	movl	$1, %edi
	addl	%eax, (%r14,%rsi,4)
	cmpl	$1, %edx
	je	.L64
.L8:
	movzbl	2+row(%rip), %esi
	cmpb	$119, %sil
	je	.L38
	cmpb	$98, %sil
	jne	.L14
	movl	$-1, %eax
.L13:
	movslq	%ecx, %rcx
	addl	%eax, 8+line(%rip)
	addl	%eax, (%r14,%rcx,4)
	cmpl	$2, %edx
	je	.L65
	testl	%edx, %edx
	jne	.L16
	addl	%eax, 28+line(%rip)
	movl	$3, j(%rip)
	movl	%eax, ppp(%rip)
	movl	$1, i(%rip)
	jmp	.L21
	.p2align 4,,10
	.p2align 3
.L65:
	addl	%eax, 24+line(%rip)
.L16:
	movl	$3, j(%rip)
.L11:
	addl	$1, %edx
	movl	%eax, ppp(%rip)
	movl	%edx, i(%rip)
	cmpl	$2, %edx
	jle	.L21
.L20:
	movl	$0, i(%rip)
	movl	(%r14), %eax
	cmpl	$3, %eax
	je	.L22
	cmpl	$-3, %eax
	je	.L23
	movl	$0, line(%rip)
	movl	4+line(%rip), %eax
	cmpl	$3, %eax
	je	.L39
	cmpl	$-3, %eax
	je	.L40
	movl	$0, 4+line(%rip)
	movl	8+line(%rip), %eax
	cmpl	$3, %eax
	je	.L41
	cmpl	$-3, %eax
	je	.L42
	movl	$0, 8+line(%rip)
	movl	12+line(%rip), %eax
	cmpl	$3, %eax
	je	.L24
	cmpl	$-3, %eax
	je	.L43
	movl	$0, 12+line(%rip)
	movl	16+line(%rip), %eax
	cmpl	$3, %eax
	je	.L44
	cmpl	$-3, %eax
	je	.L45
	movl	$0, 16+line(%rip)
	movl	20+line(%rip), %eax
	cmpl	$3, %eax
	je	.L46
	cmpl	$-3, %eax
	je	.L47
	movl	$0, 20+line(%rip)
	movl	24+line(%rip), %eax
	cmpl	$3, %eax
	je	.L48
	cmpl	$-3, %eax
	je	.L49
	movl	$0, 24+line(%rip)
	movl	28+line(%rip), %eax
	cmpl	$3, %eax
	je	.L66
	cmpl	$-3, %eax
	je	.L67
	movl	$0, 28+line(%rip)
	movl	$8, i(%rip)
.L29:
	movq	%r13, %rdi
	call	puts@PLT
	movslq	i(%rip), %rax
.L30:
	cmpl	$7, %eax
	jg	.L32
	movl	$8, %edx
	leaq	(%r14,%rax,4), %rdi
	xorl	%esi, %esi
	subl	%eax, %edx
	salq	$2, %rdx
	call	memset@PLT
	jmp	.L32
	.p2align 4,,10
	.p2align 3
.L63:
	movl	$1, %eax
	jmp	.L12
	.p2align 4,,10
	.p2align 3
.L62:
	movslq	%ecx, %rsi
	movl	$1, %eax
	addl	%eax, (%r14)
	addl	%eax, (%r14,%rsi,4)
	testl	%edx, %edx
	je	.L4
.L68:
	movl	$1, %edi
	cmpl	$2, %edx
	jne	.L5
	addl	%eax, 28+line(%rip)
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L35:
	movslq	%ecx, %rsi
	movl	$-1, %eax
	addl	%eax, (%r14)
	addl	%eax, (%r14,%rsi,4)
	testl	%edx, %edx
	jne	.L68
.L4:
	addl	%eax, 24+line(%rip)
	movl	$1, %edi
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L38:
	movl	$1, %eax
	jmp	.L13
	.p2align 4,,10
	.p2align 3
.L14:
	movl	$3, j(%rip)
	testb	%dil, %dil
	jne	.L11
	addl	$1, %edx
	movl	%edx, i(%rip)
	cmpl	$2, %edx
	jle	.L21
	jmp	.L20
	.p2align 4,,10
	.p2align 3
.L64:
	movzbl	2+row(%rip), %ecx
	addl	%eax, 24+line(%rip)
	addl	%eax, 28+line(%rip)
	cmpb	$119, %cl
	je	.L9
	cmpb	$98, %cl
	jne	.L16
	subl	$1, 8+line(%rip)
	movl	$-1, %eax
	subl	$1, (%r14,%rsi,4)
	jmp	.L16
.L9:
	addl	$1, 8+line(%rip)
	movl	$1, %eax
	addl	$1, (%r14,%rsi,4)
	jmp	.L16
.L59:
	addq	$8, %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
.L39:
	.cfi_restore_state
	movl	$1, %eax
.L24:
	movl	%eax, i(%rip)
.L22:
	movq	%r12, %rdi
	call	puts@PLT
.L27:
	movslq	i(%rip), %rax
	cmpl	$8, %eax
	jne	.L30
	jmp	.L29
.L42:
	movl	$2, %eax
.L25:
	movl	%eax, i(%rip)
.L23:
	movq	%rbp, %rdi
	call	puts@PLT
	jmp	.L27
.L48:
	movl	$6, %eax
	jmp	.L24
.L47:
	movl	$5, %eax
	jmp	.L25
.L46:
	movl	$5, %eax
	jmp	.L24
.L45:
	movl	$4, %eax
	jmp	.L25
.L49:
	movl	$6, %eax
	jmp	.L25
.L44:
	movl	$4, %eax
	jmp	.L24
.L43:
	movl	$3, %eax
	jmp	.L25
.L41:
	movl	$2, %eax
	jmp	.L24
.L40:
	movl	$1, %eax
	jmp	.L25
.L66:
	movl	$7, %eax
	jmp	.L24
.L67:
	movl	$7, %eax
	jmp	.L25
	.cfi_endproc
.LFE51:
	.size	main, .-main
	.globl	row
	.bss
	.align 8
	.type	row, @object
	.size	row, 9
row:
	.zero	9
	.globl	line
	.align 32
	.type	line, @object
	.size	line, 36
line:
	.zero	36
	.globl	ppp
	.align 4
	.type	ppp, @object
	.size	ppp, 4
ppp:
	.zero	4
	.globl	j
	.align 4
	.type	j, @object
	.size	j, 4
j:
	.zero	4
	.globl	i
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.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	"w"
.LC2:
	.string	"b"
.LC3:
	.string	"NA"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB51:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	row(%rip), %r15
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	leaq	line(%rip), %r14
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	leaq	.LC3(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	leaq	.LC1(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	leaq	.LC2(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	.LC0(%rip), %rbx
	subq	$8, %rsp
	.cfi_def_cfa_offset 64
.L32:
	movl	$0, i(%rip)
	.p2align 4,,10
	.p2align 3
.L21:
	movq	%r15, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movzbl	(%r15), %esi
	cmpb	$48, %sil
	je	.L59
	movl	i(%rip), %edx
	movl	ppp(%rip), %eax
	leal	3(%rdx), %ecx
	cmpb	$119, %sil
	je	.L62
	cmpb	$98, %sil
	je	.L35
	xorl	%edi, %edi
.L5:
	movzbl	1+row(%rip), %esi
	cmpb	$119, %sil
	je	.L63
	cmpb	$98, %sil
	jne	.L8
	movl	$-1, %eax
.L12:
	movslq	%ecx, %rsi
	addl	%eax, 4+line(%rip)
	movl	$1, %edi
	addl	%eax, (%r14,%rsi,4)
	cmpl	$1, %edx
	je	.L64
.L8:
	movzbl	2+row(%rip), %esi
	cmpb	$119, %sil
	je	.L38
	cmpb	$98, %sil
	jne	.L14
	movl	$-1, %eax
.L13:
	movslq	%ecx, %rcx
	addl	%eax, 8+line(%rip)
	addl	%eax, (%r14,%rcx,4)
	cmpl	$2, %edx
	je	.L65
	testl	%edx, %edx
	jne	.L16
	addl	%eax, 28+line(%rip)
	movl	$3, j(%rip)
	movl	%eax, ppp(%rip)
	movl	$1, i(%rip)
	jmp	.L21
	.p2align 4,,10
	.p2align 3
.L65:
	addl	%eax, 24+line(%rip)
.L16:
	movl	$3, j(%rip)
.L11:
	addl	$1, %edx
	movl	%eax, ppp(%rip)
	movl	%edx, i(%rip)
	cmpl	$2, %edx
	jle	.L21
.L20:
	movl	$0, i(%rip)
	movl	(%r14), %eax
	cmpl	$3, %eax
	je	.L22
	cmpl	$-3, %eax
	je	.L23
	movl	$0, line(%rip)
	movl	4+line(%rip), %eax
	cmpl	$3, %eax
	je	.L39
	cmpl	$-3, %eax
	je	.L40
	movl	$0, 4+line(%rip)
	movl	8+line(%rip), %eax
	cmpl	$3, %eax
	je	.L41
	cmpl	$-3, %eax
	je	.L42
	movl	$0, 8+line(%rip)
	movl	12+line(%rip), %eax
	cmpl	$3, %eax
	je	.L24
	cmpl	$-3, %eax
	je	.L43
	movl	$0, 12+line(%rip)
	movl	16+line(%rip), %eax
	cmpl	$3, %eax
	je	.L44
	cmpl	$-3, %eax
	je	.L45
	movl	$0, 16+line(%rip)
	movl	20+line(%rip), %eax
	cmpl	$3, %eax
	je	.L46
	cmpl	$-3, %eax
	je	.L47
	movl	$0, 20+line(%rip)
	movl	24+line(%rip), %eax
	cmpl	$3, %eax
	je	.L48
	cmpl	$-3, %eax
	je	.L49
	movl	$0, 24+line(%rip)
	movl	28+line(%rip), %eax
	cmpl	$3, %eax
	je	.L66
	cmpl	$-3, %eax
	je	.L67
	movl	$0, 28+line(%rip)
	movl	$8, i(%rip)
.L29:
	movq	%r13, %rdi
	call	puts@PLT
	movslq	i(%rip), %rax
.L30:
	cmpl	$7, %eax
	jg	.L32
	movl	$8, %edx
	leaq	(%r14,%rax,4), %rdi
	xorl	%esi, %esi
	subl	%eax, %edx
	salq	$2, %rdx
	call	memset@PLT
	jmp	.L32
	.p2align 4,,10
	.p2align 3
.L63:
	movl	$1, %eax
	jmp	.L12
	.p2align 4,,10
	.p2align 3
.L62:
	movslq	%ecx, %rsi
	movl	$1, %eax
	addl	%eax, (%r14)
	addl	%eax, (%r14,%rsi,4)
	testl	%edx, %edx
	je	.L4
.L68:
	movl	$1, %edi
	cmpl	$2, %edx
	jne	.L5
	addl	%eax, 28+line(%rip)
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L35:
	movslq	%ecx, %rsi
	movl	$-1, %eax
	addl	%eax, (%r14)
	addl	%eax, (%r14,%rsi,4)
	testl	%edx, %edx
	jne	.L68
.L4:
	addl	%eax, 24+line(%rip)
	movl	$1, %edi
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L38:
	movl	$1, %eax
	jmp	.L13
	.p2align 4,,10
	.p2align 3
.L14:
	movl	$3, j(%rip)
	testb	%dil, %dil
	jne	.L11
	addl	$1, %edx
	movl	%edx, i(%rip)
	cmpl	$2, %edx
	jle	.L21
	jmp	.L20
	.p2align 4,,10
	.p2align 3
.L64:
	movzbl	2+row(%rip), %ecx
	addl	%eax, 24+line(%rip)
	addl	%eax, 28+line(%rip)
	cmpb	$119, %cl
	je	.L9
	cmpb	$98, %cl
	jne	.L16
	subl	$1, 8+line(%rip)
	movl	$-1, %eax
	subl	$1, (%r14,%rsi,4)
	jmp	.L16
.L9:
	addl	$1, 8+line(%rip)
	movl	$1, %eax
	addl	$1, (%r14,%rsi,4)
	jmp	.L16
.L59:
	addq	$8, %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
.L39:
	.cfi_restore_state
	movl	$1, %eax
.L24:
	movl	%eax, i(%rip)
.L22:
	movq	%r12, %rdi
	call	puts@PLT
.L27:
	movslq	i(%rip), %rax
	cmpl	$8, %eax
	jne	.L30
	jmp	.L29
.L42:
	movl	$2, %eax
.L25:
	movl	%eax, i(%rip)
.L23:
	movq	%rbp, %rdi
	call	puts@PLT
	jmp	.L27
.L48:
	movl	$6, %eax
	jmp	.L24
.L47:
	movl	$5, %eax
	jmp	.L25
.L46:
	movl	$5, %eax
	jmp	.L24
.L45:
	movl	$4, %eax
	jmp	.L25
.L49:
	movl	$6, %eax
	jmp	.L25
.L44:
	movl	$4, %eax
	jmp	.L24
.L43:
	movl	$3, %eax
	jmp	.L25
.L41:
	movl	$2, %eax
	jmp	.L24
.L40:
	movl	$1, %eax
	jmp	.L25
.L66:
	movl	$7, %eax
	jmp	.L24
.L67:
	movl	$7, %eax
	jmp	.L25
	.cfi_endproc
.LFE51:
	.size	main, .-main
	.globl	row
	.bss
	.align 8
	.type	row, @object
	.size	row, 9
row:
	.zero	9
	.globl	line
	.align 32
	.type	line, @object
	.size	line, 36
line:
	.zero	36
	.globl	ppp
	.align 4
	.type	ppp, @object
	.size	ppp, 4
ppp:
	.zero	4
	.globl	j
	.align 4
	.type	j, @object
	.size	j, 4
j:
	.zero	4
	.globl	i
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.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>
#include <stdlib.h>

int i,j,ppp,line[9];
char row[9];

int main(){
	while(1){
		for(i=0;i<3;i++){
			scanf("%s",row);
			if(row[0]=='0')return 0;
			for(j=0;j<3;j++){
				if(row[j]=='w')ppp=1;
				else if(row[j]=='b')ppp=-1;
				else continue;
				line[j]+=ppp;
				line[3+i]+=ppp;
				if(i==j)line[6]+=ppp;
				if(i==2-j)line[7]+=ppp;
			}
		}
		for(i=0;i<8;i++){
			if(line[i]==3){printf("w\n");break;}
			if(line[i]==-3){printf("b\n");break;}
			line[i]=0;
		}
		if(i==8)printf("NA\n");
		for(;i<8;i++)line[i]=0;
	}
	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>
#include <stdlib.h>

int i,j,ppp,line[9];
char row[9];

int main(){
	while(1){
		for(i=0;i<3;i++){
			scanf("%s",row);
			if(row[0]=='0')return 0;
			for(j=0;j<3;j++){
				if(row[j]=='w')ppp=1;
				else if(row[j]=='b')ppp=-1;
				else continue;
				line[j]+=ppp;
				line[3+i]+=ppp;
				if(i==j)line[6]+=ppp;
				if(i==2-j)line[7]+=ppp;
			}
		}
		for(i=0;i<8;i++){
			if(line[i]==3){printf("w\n");break;}
			if(line[i]==-3){printf("b\n");break;}
			line[i]=0;
		}
		if(i==8)printf("NA\n");
		for(;i<8;i++)line[i]=0;
	}
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	i
	.bss
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.globl	j
	.align 4
	.type	j, @object
	.size	j, 4
j:
	.zero	4
	.globl	ppp
	.align 4
	.type	ppp, @object
	.size	ppp, 4
ppp:
	.zero	4
	.globl	line
	.align 32
	.type	line, @object
	.size	line, 36
line:
	.zero	36
	.globl	row
	.align 8
	.type	row, @object
	.size	row, 9
row:
	.zero	9
	.section	.rodata
.LC0:
	.string	"%s"
.LC1:
	.string	"w"
.LC2:
	.string	"b"
.LC3:
	.string	"NA"
	.text
	.globl	main
	.type	main, @function
main:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
.L21:
	movl	$0, i(%rip)
	jmp	.L2
.L12:
	leaq	row(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movzbl	row(%rip), %eax
	cmpb	$48, %al
	jne	.L3
	movl	$0, %eax
	jmp	.L22
.L3:
	movl	$0, j(%rip)
	jmp	.L5
.L11:
	movl	j(%rip), %eax
	cltq
	leaq	row(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	cmpb	$119, %al
	jne	.L6
	movl	$1, ppp(%rip)
	jmp	.L7
.L6:
	movl	j(%rip), %eax
	cltq
	leaq	row(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	cmpb	$98, %al
	jne	.L23
	movl	$-1, ppp(%rip)
.L7:
	movl	j(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	line(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	ppp(%rip), %edx
	movl	j(%rip), %eax
	addl	%edx, %ecx
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	line(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	i(%rip), %eax
	addl	$3, %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	line(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	ppp(%rip), %edx
	movl	i(%rip), %eax
	addl	$3, %eax
	addl	%edx, %ecx
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	line(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	i(%rip), %edx
	movl	j(%rip), %eax
	cmpl	%eax, %edx
	jne	.L10
	movl	24+line(%rip), %edx
	movl	ppp(%rip), %eax
	addl	%edx, %eax
	movl	%eax, 24+line(%rip)
.L10:
	movl	j(%rip), %eax
	movl	$2, %edx
	subl	%eax, %edx
	movl	i(%rip), %eax
	cmpl	%eax, %edx
	jne	.L9
	movl	28+line(%rip), %edx
	movl	ppp(%rip), %eax
	addl	%edx, %eax
	movl	%eax, 28+line(%rip)
	jmp	.L9
.L23:
	nop
.L9:
	movl	j(%rip), %eax
	addl	$1, %eax
	movl	%eax, j(%rip)
.L5:
	movl	j(%rip), %eax
	cmpl	$2, %eax
	jle	.L11
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L2:
	movl	i(%rip), %eax
	cmpl	$2, %eax
	jle	.L12
	movl	$0, i(%rip)
	jmp	.L13
.L17:
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	line(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	$3, %eax
	jne	.L14
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L15
.L14:
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	line(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	$-3, %eax
	jne	.L16
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L15
.L16:
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	line(%rip), %rax
	movl	$0, (%rdx,%rax)
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L13:
	movl	i(%rip), %eax
	cmpl	$7, %eax
	jle	.L17
.L15:
	movl	i(%rip), %eax
	cmpl	$8, %eax
	jne	.L19
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L19
.L20:
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	line(%rip), %rax
	movl	$0, (%rdx,%rax)
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L19:
	movl	i(%rip), %eax
	cmpl	$7, %eax
	jle	.L20
	jmp	.L21
.L22:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.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	i
	.bss
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.globl	j
	.align 4
	.type	j, @object
	.size	j, 4
j:
	.zero	4
	.globl	ppp
	.align 4
	.type	ppp, @object
	.size	ppp, 4
ppp:
	.zero	4
	.globl	line
	.align 32
	.type	line, @object
	.size	line, 36
line:
	.zero	36
	.globl	row
	.align 8
	.type	row, @object
	.size	row, 9
row:
	.zero	9
	.section	.rodata
.LC0:
	.string	"%s"
.LC1:
	.string	"w"
.LC2:
	.string	"b"
.LC3:
	.string	"NA"
	.text
	.globl	main
	.type	main, @function
main:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
.L21:
	movl	$0, i(%rip)
	jmp	.L2
.L12:
	leaq	row(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movzbl	row(%rip), %eax
	cmpb	$48, %al
	jne	.L3
	movl	$0, %eax
	jmp	.L22
.L3:
	movl	$0, j(%rip)
	jmp	.L5
.L11:
	movl	j(%rip), %eax
	cltq
	leaq	row(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	cmpb	$119, %al
	jne	.L6
	movl	$1, ppp(%rip)
	jmp	.L7
.L6:
	movl	j(%rip), %eax
	cltq
	leaq	row(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	cmpb	$98, %al
	jne	.L23
	movl	$-1, ppp(%rip)
.L7:
	movl	j(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	line(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	ppp(%rip), %edx
	movl	j(%rip), %eax
	addl	%edx, %ecx
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	line(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	i(%rip), %eax
	addl	$3, %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	line(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	ppp(%rip), %edx
	movl	i(%rip), %eax
	addl	$3, %eax
	addl	%edx, %ecx
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	line(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	i(%rip), %edx
	movl	j(%rip), %eax
	cmpl	%eax, %edx
	jne	.L10
	movl	24+line(%rip), %edx
	movl	ppp(%rip), %eax
	addl	%edx, %eax
	movl	%eax, 24+line(%rip)
.L10:
	movl	j(%rip), %eax
	movl	$2, %edx
	subl	%eax, %edx
	movl	i(%rip), %eax
	cmpl	%eax, %edx
	jne	.L9
	movl	28+line(%rip), %edx
	movl	ppp(%rip), %eax
	addl	%edx, %eax
	movl	%eax, 28+line(%rip)
	jmp	.L9
.L23:
	nop
.L9:
	movl	j(%rip), %eax
	addl	$1, %eax
	movl	%eax, j(%rip)
.L5:
	movl	j(%rip), %eax
	cmpl	$2, %eax
	jle	.L11
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L2:
	movl	i(%rip), %eax
	cmpl	$2, %eax
	jle	.L12
	movl	$0, i(%rip)
	jmp	.L13
.L17:
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	line(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	$3, %eax
	jne	.L14
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L15
.L14:
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	line(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	$-3, %eax
	jne	.L16
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L15
.L16:
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	line(%rip), %rax
	movl	$0, (%rdx,%rax)
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L13:
	movl	i(%rip), %eax
	cmpl	$7, %eax
	jle	.L17
.L15:
	movl	i(%rip), %eax
	cmpl	$8, %eax
	jne	.L19
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L19
.L20:
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	line(%rip), %rax
	movl	$0, (%rdx,%rax)
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L19:
	movl	i(%rip), %eax
	cmpl	$7, %eax
	jle	.L20
	jmp	.L21
.L22:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.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:
