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>

/** Application main entry point. */
int main (
  int     argc,
  char  * argv[ ]
  )
{
  for ( ; ; )
  {
    char d[ 4 ][ 8 ];

    scanf ( " %s", d[ 0 ] );
    if ( d[ 0 ][ 0 ] == '0' )  break ;
    scanf ( " %s", d[ 1 ] );
    scanf ( " %s", d[ 2 ] );

    if ( d[ 0 ][ 0 ] != '+'
      && ( ( d[ 0 ][ 0 ] == d[ 0 ][ 1 ] && d[ 0 ][ 0 ] == d[ 0 ][ 2 ] )
        || ( d[ 0 ][ 0 ] == d[ 1 ][ 0 ] && d[ 0 ][ 0 ] == d[ 2 ][ 0 ] ) ) )
    {
      printf ( "%c\n", d[ 0 ][ 0 ] );
    }
    else if ( d[ 2 ][ 2 ] != '+'
      && ( ( d[ 2 ][ 2 ] == d[ 2 ][ 1 ] && d[ 2 ][ 2 ] == d[ 2 ][ 0 ] )
        || ( d[ 2 ][ 2 ] == d[ 1 ][ 2 ] && d[ 2 ][ 2 ] == d[ 0 ][ 2 ] ) ) )
    {
      printf ( "%c\n", d[ 2 ][ 2 ] );
    }
    else if ( d[ 1 ][ 1 ] != '+'
           && ( ( d[ 1 ][ 1 ] == d[ 1 ][ 0 ] && d[ 1 ][ 1 ] == d[ 1 ][ 2 ] )
             || ( d[ 1 ][ 1 ] == d[ 0 ][ 1 ] && d[ 1 ][ 1 ] == d[ 2 ][ 1 ] )
             || ( d[ 1 ][ 1 ] == d[ 0 ][ 0 ] && d[ 1 ][ 1 ] == d[ 2 ][ 2 ] )
             || ( d[ 1 ][ 1 ] == d[ 0 ][ 2 ] && d[ 1 ][ 1 ] == d[ 2 ][ 0 ] ) ) )
    {
      printf ( "%c\n", d[ 1 ][ 1 ] );
    }
    else
    {
      puts ( "NA" );
    }
  }

  return ( 0 );
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	" %s"
.LC1:
	.string	"%c\n"
.LC2:
	.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
	movl	%edi, -52(%rbp)
	movq	%rsi, -64(%rbp)
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
.L16:
	leaq	-48(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movzbl	-48(%rbp), %eax
	cmpb	$48, %al
	jne	.L2
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L17
	jmp	.L18
.L2:
	leaq	-48(%rbp), %rax
	addq	$8, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-48(%rbp), %rax
	addq	$16, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movzbl	-48(%rbp), %eax
	cmpb	$43, %al
	je	.L4
	movzbl	-48(%rbp), %edx
	movzbl	-47(%rbp), %eax
	cmpb	%al, %dl
	jne	.L5
	movzbl	-48(%rbp), %edx
	movzbl	-46(%rbp), %eax
	cmpb	%al, %dl
	je	.L6
.L5:
	movzbl	-48(%rbp), %edx
	movzbl	-40(%rbp), %eax
	cmpb	%al, %dl
	jne	.L4
	movzbl	-48(%rbp), %edx
	movzbl	-32(%rbp), %eax
	cmpb	%al, %dl
	jne	.L4
.L6:
	movzbl	-48(%rbp), %eax
	movsbl	%al, %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L7
.L4:
	movzbl	-30(%rbp), %eax
	cmpb	$43, %al
	je	.L8
	movzbl	-30(%rbp), %edx
	movzbl	-31(%rbp), %eax
	cmpb	%al, %dl
	jne	.L9
	movzbl	-30(%rbp), %edx
	movzbl	-32(%rbp), %eax
	cmpb	%al, %dl
	je	.L10
.L9:
	movzbl	-30(%rbp), %edx
	movzbl	-38(%rbp), %eax
	cmpb	%al, %dl
	jne	.L8
	movzbl	-30(%rbp), %edx
	movzbl	-46(%rbp), %eax
	cmpb	%al, %dl
	jne	.L8
.L10:
	movzbl	-30(%rbp), %eax
	movsbl	%al, %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L7
.L8:
	movzbl	-39(%rbp), %eax
	cmpb	$43, %al
	je	.L11
	movzbl	-39(%rbp), %edx
	movzbl	-40(%rbp), %eax
	cmpb	%al, %dl
	jne	.L12
	movzbl	-39(%rbp), %edx
	movzbl	-38(%rbp), %eax
	cmpb	%al, %dl
	je	.L13
.L12:
	movzbl	-39(%rbp), %edx
	movzbl	-47(%rbp), %eax
	cmpb	%al, %dl
	jne	.L14
	movzbl	-39(%rbp), %edx
	movzbl	-31(%rbp), %eax
	cmpb	%al, %dl
	je	.L13
.L14:
	movzbl	-39(%rbp), %edx
	movzbl	-48(%rbp), %eax
	cmpb	%al, %dl
	jne	.L15
	movzbl	-39(%rbp), %edx
	movzbl	-30(%rbp), %eax
	cmpb	%al, %dl
	je	.L13
.L15:
	movzbl	-39(%rbp), %edx
	movzbl	-46(%rbp), %eax
	cmpb	%al, %dl
	jne	.L11
	movzbl	-39(%rbp), %edx
	movzbl	-32(%rbp), %eax
	cmpb	%al, %dl
	jne	.L11
.L13:
	movzbl	-39(%rbp), %eax
	movsbl	%al, %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L7
.L11:
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
.L7:
	jmp	.L16
.L18:
	call	__stack_chk_fail@PLT
.L17:
	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	"%c\n"
.LC2:
	.string	"NA"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	.LC1(%rip), %r15
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	leaq	.LC2(%rip), %r14
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	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
	leaq	.LC0(%rip), %rbx
	subq	$56, %rsp
	.cfi_def_cfa_offset 112
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rbp
	leaq	8(%rsp), %r13
	leaq	16(%rsp), %r12
	.p2align 4,,10
	.p2align 3
.L15:
	xorl	%eax, %eax
	movq	%rbp, %rsi
	movq	%rbx, %rdi
	call	__isoc99_scanf@PLT
	cmpb	$48, (%rsp)
	je	.L2
	movq	%r13, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movq	%r12, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movsbl	(%rsp), %edx
	cmpb	$43, %dl
	je	.L3
	cmpb	1(%rsp), %dl
	je	.L33
	cmpb	8(%rsp), %dl
	je	.L34
.L3:
	movzbl	18(%rsp), %ecx
	cmpb	$43, %cl
	je	.L7
	cmpb	17(%rsp), %cl
	je	.L35
.L8:
	cmpb	10(%rsp), %cl
	je	.L36
.L7:
	movzbl	9(%rsp), %eax
	cmpb	$43, %al
	je	.L10
	cmpb	8(%rsp), %al
	je	.L37
.L11:
	cmpb	1(%rsp), %al
	je	.L38
.L13:
	cmpb	%al, %dl
	jne	.L17
	cmpb	%al, %cl
	je	.L12
.L17:
	cmpb	2(%rsp), %al
	je	.L39
.L10:
	movq	%r14, %rdi
	call	puts@PLT
	jmp	.L15
	.p2align 4,,10
	.p2align 3
.L37:
	cmpb	10(%rsp), %al
	jne	.L11
.L12:
	movsbl	%al, %edx
.L31:
	movq	%r15, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L15
	.p2align 4,,10
	.p2align 3
.L33:
	cmpb	2(%rsp), %dl
	je	.L31
	cmpb	8(%rsp), %dl
	jne	.L3
.L34:
	cmpb	16(%rsp), %dl
	jne	.L3
	jmp	.L31
	.p2align 4,,10
	.p2align 3
.L35:
	cmpb	16(%rsp), %cl
	jne	.L8
.L9:
	movsbl	%cl, %edx
	movq	%r15, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L15
	.p2align 4,,10
	.p2align 3
.L38:
	cmpb	17(%rsp), %al
	jne	.L13
	jmp	.L12
	.p2align 4,,10
	.p2align 3
.L36:
	cmpb	2(%rsp), %cl
	jne	.L7
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L39:
	cmpb	16(%rsp), %al
	jne	.L10
	jmp	.L12
	.p2align 4,,10
	.p2align 3
.L2:
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L40
	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
.L40:
	.cfi_restore_state
	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	"%c\n"
.LC2:
	.string	"NA"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	.LC1(%rip), %r15
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	leaq	.LC2(%rip), %r14
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	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
	leaq	.LC0(%rip), %rbx
	subq	$56, %rsp
	.cfi_def_cfa_offset 112
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rbp
	leaq	8(%rsp), %r13
	leaq	16(%rsp), %r12
	.p2align 4,,10
	.p2align 3
.L15:
	xorl	%eax, %eax
	movq	%rbp, %rsi
	movq	%rbx, %rdi
	call	__isoc99_scanf@PLT
	cmpb	$48, (%rsp)
	je	.L2
	movq	%r13, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movq	%r12, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movsbl	(%rsp), %edx
	cmpb	$43, %dl
	je	.L3
	cmpb	1(%rsp), %dl
	je	.L33
	cmpb	8(%rsp), %dl
	je	.L34
.L3:
	movzbl	18(%rsp), %ecx
	cmpb	$43, %cl
	je	.L7
	cmpb	17(%rsp), %cl
	je	.L35
.L8:
	cmpb	10(%rsp), %cl
	je	.L36
.L7:
	movzbl	9(%rsp), %eax
	cmpb	$43, %al
	je	.L10
	cmpb	8(%rsp), %al
	je	.L37
.L11:
	cmpb	1(%rsp), %al
	je	.L38
.L13:
	cmpb	%al, %dl
	jne	.L17
	cmpb	%al, %cl
	je	.L12
.L17:
	cmpb	2(%rsp), %al
	je	.L39
.L10:
	movq	%r14, %rdi
	call	puts@PLT
	jmp	.L15
	.p2align 4,,10
	.p2align 3
.L37:
	cmpb	10(%rsp), %al
	jne	.L11
.L12:
	movsbl	%al, %edx
.L31:
	movq	%r15, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L15
	.p2align 4,,10
	.p2align 3
.L33:
	cmpb	2(%rsp), %dl
	je	.L31
	cmpb	8(%rsp), %dl
	jne	.L3
.L34:
	cmpb	16(%rsp), %dl
	jne	.L3
	jmp	.L31
	.p2align 4,,10
	.p2align 3
.L35:
	cmpb	16(%rsp), %cl
	jne	.L8
.L9:
	movsbl	%cl, %edx
	movq	%r15, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L15
	.p2align 4,,10
	.p2align 3
.L38:
	cmpb	17(%rsp), %al
	jne	.L13
	jmp	.L12
	.p2align 4,,10
	.p2align 3
.L36:
	cmpb	2(%rsp), %cl
	jne	.L7
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L39:
	cmpb	16(%rsp), %al
	jne	.L10
	jmp	.L12
	.p2align 4,,10
	.p2align 3
.L2:
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L40
	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
.L40:
	.cfi_restore_state
	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>

/** Application main entry point. */
int main (
  int     argc,
  char  * argv[ ]
  )
{
  for ( ; ; )
  {
    char d[ 4 ][ 8 ];

    scanf ( " %s", d[ 0 ] );
    if ( d[ 0 ][ 0 ] == '0' )  break ;
    scanf ( " %s", d[ 1 ] );
    scanf ( " %s", d[ 2 ] );

    if ( d[ 0 ][ 0 ] != '+'
      && ( ( d[ 0 ][ 0 ] == d[ 0 ][ 1 ] && d[ 0 ][ 0 ] == d[ 0 ][ 2 ] )
        || ( d[ 0 ][ 0 ] == d[ 1 ][ 0 ] && d[ 0 ][ 0 ] == d[ 2 ][ 0 ] ) ) )
    {
      printf ( "%c\n", d[ 0 ][ 0 ] );
    }
    else if ( d[ 2 ][ 2 ] != '+'
      && ( ( d[ 2 ][ 2 ] == d[ 2 ][ 1 ] && d[ 2 ][ 2 ] == d[ 2 ][ 0 ] )
        || ( d[ 2 ][ 2 ] == d[ 1 ][ 2 ] && d[ 2 ][ 2 ] == d[ 0 ][ 2 ] ) ) )
    {
      printf ( "%c\n", d[ 2 ][ 2 ] );
    }
    else if ( d[ 1 ][ 1 ] != '+'
           && ( ( d[ 1 ][ 1 ] == d[ 1 ][ 0 ] && d[ 1 ][ 1 ] == d[ 1 ][ 2 ] )
             || ( d[ 1 ][ 1 ] == d[ 0 ][ 1 ] && d[ 1 ][ 1 ] == d[ 2 ][ 1 ] )
             || ( d[ 1 ][ 1 ] == d[ 0 ][ 0 ] && d[ 1 ][ 1 ] == d[ 2 ][ 2 ] )
             || ( d[ 1 ][ 1 ] == d[ 0 ][ 2 ] && d[ 1 ][ 1 ] == d[ 2 ][ 0 ] ) ) )
    {
      printf ( "%c\n", d[ 1 ][ 1 ] );
    }
    else
    {
      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>

/** Application main entry point. */
int main (
  int     argc,
  char  * argv[ ]
  )
{
  for ( ; ; )
  {
    char d[ 4 ][ 8 ];

    scanf ( " %s", d[ 0 ] );
    if ( d[ 0 ][ 0 ] == '0' )  break ;
    scanf ( " %s", d[ 1 ] );
    scanf ( " %s", d[ 2 ] );

    if ( d[ 0 ][ 0 ] != '+'
      && ( ( d[ 0 ][ 0 ] == d[ 0 ][ 1 ] && d[ 0 ][ 0 ] == d[ 0 ][ 2 ] )
        || ( d[ 0 ][ 0 ] == d[ 1 ][ 0 ] && d[ 0 ][ 0 ] == d[ 2 ][ 0 ] ) ) )
    {
      printf ( "%c\n", d[ 0 ][ 0 ] );
    }
    else if ( d[ 2 ][ 2 ] != '+'
      && ( ( d[ 2 ][ 2 ] == d[ 2 ][ 1 ] && d[ 2 ][ 2 ] == d[ 2 ][ 0 ] )
        || ( d[ 2 ][ 2 ] == d[ 1 ][ 2 ] && d[ 2 ][ 2 ] == d[ 0 ][ 2 ] ) ) )
    {
      printf ( "%c\n", d[ 2 ][ 2 ] );
    }
    else if ( d[ 1 ][ 1 ] != '+'
           && ( ( d[ 1 ][ 1 ] == d[ 1 ][ 0 ] && d[ 1 ][ 1 ] == d[ 1 ][ 2 ] )
             || ( d[ 1 ][ 1 ] == d[ 0 ][ 1 ] && d[ 1 ][ 1 ] == d[ 2 ][ 1 ] )
             || ( d[ 1 ][ 1 ] == d[ 0 ][ 0 ] && d[ 1 ][ 1 ] == d[ 2 ][ 2 ] )
             || ( d[ 1 ][ 1 ] == d[ 0 ][ 2 ] && d[ 1 ][ 1 ] == d[ 2 ][ 0 ] ) ) )
    {
      printf ( "%c\n", d[ 1 ][ 1 ] );
    }
    else
    {
      puts ( "NA" );
    }
  }

  return ( 0 );
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	" %s"
.LC1:
	.string	"%c\n"
.LC2:
	.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
	movl	%edi, -52(%rbp)
	movq	%rsi, -64(%rbp)
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
.L16:
	leaq	-48(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movzbl	-48(%rbp), %eax
	cmpb	$48, %al
	jne	.L2
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L17
	jmp	.L18
.L2:
	leaq	-48(%rbp), %rax
	addq	$8, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-48(%rbp), %rax
	addq	$16, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movzbl	-48(%rbp), %eax
	cmpb	$43, %al
	je	.L4
	movzbl	-48(%rbp), %edx
	movzbl	-47(%rbp), %eax
	cmpb	%al, %dl
	jne	.L5
	movzbl	-48(%rbp), %edx
	movzbl	-46(%rbp), %eax
	cmpb	%al, %dl
	je	.L6
.L5:
	movzbl	-48(%rbp), %edx
	movzbl	-40(%rbp), %eax
	cmpb	%al, %dl
	jne	.L4
	movzbl	-48(%rbp), %edx
	movzbl	-32(%rbp), %eax
	cmpb	%al, %dl
	jne	.L4
.L6:
	movzbl	-48(%rbp), %eax
	movsbl	%al, %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L7
.L4:
	movzbl	-30(%rbp), %eax
	cmpb	$43, %al
	je	.L8
	movzbl	-30(%rbp), %edx
	movzbl	-31(%rbp), %eax
	cmpb	%al, %dl
	jne	.L9
	movzbl	-30(%rbp), %edx
	movzbl	-32(%rbp), %eax
	cmpb	%al, %dl
	je	.L10
.L9:
	movzbl	-30(%rbp), %edx
	movzbl	-38(%rbp), %eax
	cmpb	%al, %dl
	jne	.L8
	movzbl	-30(%rbp), %edx
	movzbl	-46(%rbp), %eax
	cmpb	%al, %dl
	jne	.L8
.L10:
	movzbl	-30(%rbp), %eax
	movsbl	%al, %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L7
.L8:
	movzbl	-39(%rbp), %eax
	cmpb	$43, %al
	je	.L11
	movzbl	-39(%rbp), %edx
	movzbl	-40(%rbp), %eax
	cmpb	%al, %dl
	jne	.L12
	movzbl	-39(%rbp), %edx
	movzbl	-38(%rbp), %eax
	cmpb	%al, %dl
	je	.L13
.L12:
	movzbl	-39(%rbp), %edx
	movzbl	-47(%rbp), %eax
	cmpb	%al, %dl
	jne	.L14
	movzbl	-39(%rbp), %edx
	movzbl	-31(%rbp), %eax
	cmpb	%al, %dl
	je	.L13
.L14:
	movzbl	-39(%rbp), %edx
	movzbl	-48(%rbp), %eax
	cmpb	%al, %dl
	jne	.L15
	movzbl	-39(%rbp), %edx
	movzbl	-30(%rbp), %eax
	cmpb	%al, %dl
	je	.L13
.L15:
	movzbl	-39(%rbp), %edx
	movzbl	-46(%rbp), %eax
	cmpb	%al, %dl
	jne	.L11
	movzbl	-39(%rbp), %edx
	movzbl	-32(%rbp), %eax
	cmpb	%al, %dl
	jne	.L11
.L13:
	movzbl	-39(%rbp), %eax
	movsbl	%al, %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L7
.L11:
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
.L7:
	jmp	.L16
.L18:
	call	__stack_chk_fail@PLT
.L17:
	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	"%c\n"
.LC2:
	.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
	movl	%edi, -52(%rbp)
	movq	%rsi, -64(%rbp)
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
.L16:
	leaq	-48(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movzbl	-48(%rbp), %eax
	cmpb	$48, %al
	jne	.L2
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L17
	jmp	.L18
.L2:
	leaq	-48(%rbp), %rax
	addq	$8, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-48(%rbp), %rax
	addq	$16, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movzbl	-48(%rbp), %eax
	cmpb	$43, %al
	je	.L4
	movzbl	-48(%rbp), %edx
	movzbl	-47(%rbp), %eax
	cmpb	%al, %dl
	jne	.L5
	movzbl	-48(%rbp), %edx
	movzbl	-46(%rbp), %eax
	cmpb	%al, %dl
	je	.L6
.L5:
	movzbl	-48(%rbp), %edx
	movzbl	-40(%rbp), %eax
	cmpb	%al, %dl
	jne	.L4
	movzbl	-48(%rbp), %edx
	movzbl	-32(%rbp), %eax
	cmpb	%al, %dl
	jne	.L4
.L6:
	movzbl	-48(%rbp), %eax
	movsbl	%al, %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L7
.L4:
	movzbl	-30(%rbp), %eax
	cmpb	$43, %al
	je	.L8
	movzbl	-30(%rbp), %edx
	movzbl	-31(%rbp), %eax
	cmpb	%al, %dl
	jne	.L9
	movzbl	-30(%rbp), %edx
	movzbl	-32(%rbp), %eax
	cmpb	%al, %dl
	je	.L10
.L9:
	movzbl	-30(%rbp), %edx
	movzbl	-38(%rbp), %eax
	cmpb	%al, %dl
	jne	.L8
	movzbl	-30(%rbp), %edx
	movzbl	-46(%rbp), %eax
	cmpb	%al, %dl
	jne	.L8
.L10:
	movzbl	-30(%rbp), %eax
	movsbl	%al, %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L7
.L8:
	movzbl	-39(%rbp), %eax
	cmpb	$43, %al
	je	.L11
	movzbl	-39(%rbp), %edx
	movzbl	-40(%rbp), %eax
	cmpb	%al, %dl
	jne	.L12
	movzbl	-39(%rbp), %edx
	movzbl	-38(%rbp), %eax
	cmpb	%al, %dl
	je	.L13
.L12:
	movzbl	-39(%rbp), %edx
	movzbl	-47(%rbp), %eax
	cmpb	%al, %dl
	jne	.L14
	movzbl	-39(%rbp), %edx
	movzbl	-31(%rbp), %eax
	cmpb	%al, %dl
	je	.L13
.L14:
	movzbl	-39(%rbp), %edx
	movzbl	-48(%rbp), %eax
	cmpb	%al, %dl
	jne	.L15
	movzbl	-39(%rbp), %edx
	movzbl	-30(%rbp), %eax
	cmpb	%al, %dl
	je	.L13
.L15:
	movzbl	-39(%rbp), %edx
	movzbl	-46(%rbp), %eax
	cmpb	%al, %dl
	jne	.L11
	movzbl	-39(%rbp), %edx
	movzbl	-32(%rbp), %eax
	cmpb	%al, %dl
	jne	.L11
.L13:
	movzbl	-39(%rbp), %eax
	movsbl	%al, %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L7
.L11:
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
.L7:
	jmp	.L16
.L18:
	call	__stack_chk_fail@PLT
.L17:
	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:
