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 g[26][26];
int dfs(int a,int n)
{
  int i;
  if(n==0)return 1;
  for(i=0;i<26;i++){
    if(g[a][i]){
      g[a][i]--;
      if(dfs(i,n-1))return 1;
      g[a][i]++;
    }
  }
  return 0;
}
int main(void)
{
  int n,i,t[26],l,f;
  char s[33];
  for(;;){
    scanf("%d",&n); if(!n)break;
    memset(t,0,sizeof(t));
    memset(g,0,sizeof(g));
    for(i=0;i<n;i++){
      scanf("%s",s);
      l=strlen(s)-1;
      t[s[0]-'a']++;
      t[s[l]-'a']--;
      g[s[0]-'a'][s[l]-'a']++;
    }
    f=1;
    for(i=0;i<26;i++){
      if(t[i])f=0;
    }
    if(f)f=dfs(s[0]-'a',n);
    puts(f?"OK":"NG");
  }
  return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	g
	.bss
	.align 32
	.type	g, @object
	.size	g, 2704
g:
	.zero	2704
	.text
	.globl	dfs
	.type	dfs, @function
dfs:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movl	%edi, -20(%rbp)
	movl	%esi, -24(%rbp)
	cmpl	$0, -24(%rbp)
	jne	.L2
	movl	$1, %eax
	jmp	.L3
.L2:
	movl	$0, -4(%rbp)
	jmp	.L4
.L7:
	movl	-4(%rbp), %eax
	movslq	%eax, %rcx
	movl	-20(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	g(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	je	.L5
	movl	-4(%rbp), %eax
	movslq	%eax, %rcx
	movl	-20(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	g(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	-1(%rax), %ecx
	movl	-4(%rbp), %eax
	movslq	%eax, %rsi
	movl	-20(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,4), %rdx
	leaq	g(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	-24(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-4(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	dfs
	testl	%eax, %eax
	je	.L6
	movl	$1, %eax
	jmp	.L3
.L6:
	movl	-4(%rbp), %eax
	movslq	%eax, %rcx
	movl	-20(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	g(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	1(%rax), %ecx
	movl	-4(%rbp), %eax
	movslq	%eax, %rsi
	movl	-20(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,4), %rdx
	leaq	g(%rip), %rax
	movl	%ecx, (%rdx,%rax)
.L5:
	addl	$1, -4(%rbp)
.L4:
	cmpl	$25, -4(%rbp)
	jle	.L7
	movl	$0, %eax
.L3:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	dfs, .-dfs
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%s"
.LC2:
	.string	"OK"
.LC3:
	.string	"NG"
	.text
	.globl	main
	.type	main, @function
main:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$176, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
.L19:
	leaq	-176(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-176(%rbp), %eax
	testl	%eax, %eax
	je	.L23
	leaq	-160(%rbp), %rax
	movl	$104, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	movl	$2704, %edx
	movl	$0, %esi
	leaq	g(%rip), %rax
	movq	%rax, %rdi
	call	memset@PLT
	movl	$0, -172(%rbp)
	jmp	.L11
.L12:
	leaq	-48(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-48(%rbp), %rax
	movq	%rax, %rdi
	call	strlen@PLT
	subl	$1, %eax
	movl	%eax, -164(%rbp)
	movzbl	-48(%rbp), %eax
	movsbl	%al, %eax
	subl	$97, %eax
	movslq	%eax, %rdx
	movl	-160(%rbp,%rdx,4), %edx
	addl	$1, %edx
	cltq
	movl	%edx, -160(%rbp,%rax,4)
	movl	-164(%rbp), %eax
	cltq
	movzbl	-48(%rbp,%rax), %eax
	movsbl	%al, %eax
	subl	$97, %eax
	movslq	%eax, %rdx
	movl	-160(%rbp,%rdx,4), %edx
	subl	$1, %edx
	cltq
	movl	%edx, -160(%rbp,%rax,4)
	movzbl	-48(%rbp), %eax
	movsbl	%al, %eax
	leal	-97(%rax), %ecx
	movl	-164(%rbp), %eax
	cltq
	movzbl	-48(%rbp,%rax), %eax
	movsbl	%al, %eax
	leal	-97(%rax), %esi
	movslq	%esi, %rdi
	movslq	%ecx, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdi, %rax
	leaq	0(,%rax,4), %rdx
	leaq	g(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	1(%rax), %edi
	movslq	%esi, %rsi
	movslq	%ecx, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,4), %rdx
	leaq	g(%rip), %rax
	movl	%edi, (%rdx,%rax)
	addl	$1, -172(%rbp)
.L11:
	movl	-176(%rbp), %eax
	cmpl	%eax, -172(%rbp)
	jl	.L12
	movl	$1, -168(%rbp)
	movl	$0, -172(%rbp)
	jmp	.L13
.L15:
	movl	-172(%rbp), %eax
	cltq
	movl	-160(%rbp,%rax,4), %eax
	testl	%eax, %eax
	je	.L14
	movl	$0, -168(%rbp)
.L14:
	addl	$1, -172(%rbp)
.L13:
	cmpl	$25, -172(%rbp)
	jle	.L15
	cmpl	$0, -168(%rbp)
	je	.L16
	movl	-176(%rbp), %eax
	movzbl	-48(%rbp), %edx
	movsbl	%dl, %edx
	subl	$97, %edx
	movl	%eax, %esi
	movl	%edx, %edi
	call	dfs
	movl	%eax, -168(%rbp)
.L16:
	cmpl	$0, -168(%rbp)
	je	.L17
	leaq	.LC2(%rip), %rax
	jmp	.L18
.L17:
	leaq	.LC3(%rip), %rax
.L18:
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L19
.L23:
	nop
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L21
	call	__stack_chk_fail@PLT
.L21:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.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
	.p2align 4
	.type	dfs.part.0, @function
dfs.part.0:
.LFB37:
	.cfi_startproc
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movslq	%edi, %rax
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	leaq	(%rax,%rax,2), %rdx
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	leaq	(%rax,%rdx,4), %rax
	leal	-5(%rsi), %r13d
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movl	%r13d, %r15d
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$72, %rsp
	.cfi_def_cfa_offset 128
	movl	%esi, 28(%rsp)
	leaq	g(%rip), %rsi
	leaq	(%rsi,%rax,8), %rax
	movq	%rsi, 48(%rsp)
	movq	%rax, 56(%rsp)
	jmp	.L18
	.p2align 4,,10
	.p2align 3
.L2:
	addq	$104, 48(%rsp)
	movq	48(%rsp), %rax
	leaq	2704+g(%rip), %rsi
	addq	$4, 56(%rsp)
	cmpq	%rsi, %rax
	je	.L59
.L18:
	movq	56(%rsp), %rax
	movl	(%rax), %eax
	testl	%eax, %eax
	je	.L2
	movq	56(%rsp), %rdi
	subl	$1, %eax
	cmpl	$1, 28(%rsp)
	movl	%eax, (%rdi)
	je	.L3
	leaq	g(%rip), %rax
	movl	%r15d, %r13d
	movq	%rax, 32(%rsp)
	movq	48(%rsp), %rax
	movq	%rax, 40(%rsp)
	jmp	.L16
	.p2align 4,,10
	.p2align 3
.L4:
	addq	$104, 32(%rsp)
	movq	32(%rsp), %rax
	leaq	2704+g(%rip), %rsi
	addq	$4, 40(%rsp)
	cmpq	%rsi, %rax
	je	.L60
.L16:
	movq	40(%rsp), %rax
	movl	(%rax), %eax
	testl	%eax, %eax
	je	.L4
	movq	40(%rsp), %rdi
	subl	$1, %eax
	cmpl	$2, 28(%rsp)
	movl	%eax, (%rdi)
	je	.L3
	leaq	g(%rip), %rax
	movq	%rax, 8(%rsp)
	movq	32(%rsp), %rax
	movq	%rax, 16(%rsp)
	jmp	.L14
	.p2align 4,,10
	.p2align 3
.L5:
	addq	$104, 8(%rsp)
	movq	8(%rsp), %rax
	leaq	2704+g(%rip), %rsi
	addq	$4, 16(%rsp)
	cmpq	%rsi, %rax
	je	.L61
.L14:
	movq	16(%rsp), %rax
	movl	(%rax), %eax
	testl	%eax, %eax
	je	.L5
	movq	16(%rsp), %rdi
	subl	$1, %eax
	cmpl	$3, 28(%rsp)
	movl	%eax, (%rdi)
	je	.L3
	leaq	g(%rip), %r12
	movq	8(%rsp), %r14
	xorl	%r15d, %r15d
	movq	%r12, %rax
	movl	%r13d, %r12d
	movq	%rax, %r13
	jmp	.L12
	.p2align 4,,10
	.p2align 3
.L6:
	addl	$1, %r15d
	addq	$4, %r14
	addq	$104, %r13
	cmpl	$26, %r15d
	je	.L62
.L12:
	movl	(%r14), %eax
	testl	%eax, %eax
	je	.L6
	subl	$1, %eax
	cmpl	$4, 28(%rsp)
	movl	%eax, (%r14)
	je	.L3
	testl	%r12d, %r12d
	je	.L20
	movq	%r13, %rbx
	xorl	%ebp, %ebp
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L8:
	addl	$1, %ebp
	addq	$4, %rbx
	cmpl	$26, %ebp
	je	.L10
.L9:
	movl	(%rbx), %eax
	testl	%eax, %eax
	je	.L8
	subl	$1, %eax
	movl	%r12d, %esi
	movl	%ebp, %edi
	movl	%eax, (%rbx)
	call	dfs.part.0
	testl	%eax, %eax
	jne	.L3
	addl	$1, %ebp
	addl	$1, (%rbx)
	addq	$4, %rbx
	cmpl	$26, %ebp
	jne	.L9
.L10:
	addl	$1, (%r14)
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L20:
	xorl	%eax, %eax
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L11:
	addq	$1, %rax
	cmpq	$26, %rax
	je	.L10
.L7:
	movl	0(%r13,%rax,4), %edx
	movslq	%eax, %rcx
	testl	%edx, %edx
	je	.L11
	movslq	%r15d, %r8
	subl	$1, %edx
	leaq	g(%rip), %rdi
	leaq	(%r8,%r8,2), %rax
	leaq	(%r8,%rax,4), %rax
	leaq	(%rcx,%rax,2), %rax
	movl	%edx, (%rdi,%rax,4)
.L3:
	addq	$72, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	movl	$1, %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
.L62:
	.cfi_restore_state
	movq	16(%rsp), %rax
	movl	%r12d, %r13d
	addl	$1, (%rax)
	jmp	.L5
.L61:
	movq	40(%rsp), %rax
	addl	$1, (%rax)
	jmp	.L4
.L60:
	movq	56(%rsp), %rax
	movl	%r13d, %r15d
	addl	$1, (%rax)
	jmp	.L2
.L59:
	addq	$72, %rsp
	.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
	.cfi_endproc
.LFE37:
	.size	dfs.part.0, .-dfs.part.0
	.p2align 4
	.globl	dfs
	.type	dfs, @function
dfs:
.LFB35:
	.cfi_startproc
	endbr64
	testl	%esi, %esi
	je	.L81
	subl	$1, %esi
	movl	%esi, %r11d
	je	.L65
	movslq	%edi, %rdi
	xorl	%r10d, %r10d
	leaq	(%rdi,%rdi,2), %rax
	leaq	(%rdi,%rax,4), %rdx
	leaq	g(%rip), %rax
	leaq	(%rax,%rdx,8), %r9
	jmp	.L82
	.p2align 4,,10
	.p2align 3
.L89:
	addl	$1, %r10d
	addq	$4, %r9
	cmpl	$26, %r10d
	je	.L86
.L82:
	movl	(%r9), %eax
	testl	%eax, %eax
	je	.L89
	subq	$8, %rsp
	.cfi_def_cfa_offset 16
.L83:
	subl	$1, %eax
	movl	%r11d, %esi
	movl	%r10d, %edi
	movl	%eax, (%r9)
	call	dfs.part.0
	testl	%eax, %eax
	jne	.L64
	addl	$1, (%r9)
.L66:
	addl	$1, %r10d
	addq	$4, %r9
	cmpl	$26, %r10d
	je	.L90
	movl	(%r9), %eax
	testl	%eax, %eax
	je	.L66
	jmp	.L83
	.p2align 4,,10
	.p2align 3
.L65:
	.cfi_def_cfa_offset 8
	movslq	%edi, %rdx
	leaq	g(%rip), %r8
	leaq	(%rdx,%rdx,2), %rax
	leaq	(%rdx,%rax,4), %rax
	leaq	(%r8,%rax,8), %rdi
	xorl	%eax, %eax
	jmp	.L70
	.p2align 4,,10
	.p2align 3
.L69:
	addq	$1, %rax
	cmpq	$26, %rax
	je	.L86
.L70:
	movl	(%rdi,%rax,4), %ecx
	movslq	%eax, %rsi
	testl	%ecx, %ecx
	je	.L69
	leaq	(%rdx,%rdx,2), %rax
	subl	$1, %ecx
	leaq	(%rdx,%rax,4), %rax
	leaq	(%rsi,%rax,2), %rax
	movl	%ecx, (%r8,%rax,4)
.L81:
	movl	$1, %eax
	ret
.L64:
	.cfi_def_cfa_offset 16
	movl	$1, %eax
	addq	$8, %rsp
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L86:
	xorl	%eax, %eax
	ret
.L90:
	.cfi_def_cfa_offset 16
	xorl	%eax, %eax
	addq	$8, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE35:
	.size	dfs, .-dfs
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"OK"
.LC1:
	.string	"NG"
.LC2:
	.string	"%d"
.LC3:
	.string	"%s"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB36:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	leaq	.LC2(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	leaq	.LC3(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	g(%rip), %rbx
	subq	$184, %rsp
	.cfi_def_cfa_offset 240
	movq	%fs:40, %rax
	movq	%rax, 168(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %r14
	.p2align 4,,10
	.p2align 3
.L105:
	movq	%r14, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %edx
	testl	%edx, %edx
	je	.L92
	leaq	16(%rsp), %rsi
	movl	$0, %eax
	movl	$13, %ecx
	movq	%rsi, %rdi
	rep stosq
	movl	$338, %ecx
	movq	%rbx, %rdi
	rep stosq
	jle	.L93
	xorl	%r15d, %r15d
	leaq	128(%rsp), %rbp
	.p2align 4,,10
	.p2align 3
.L94:
	movq	%rbp, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	addl	$1, %r15d
	call	__isoc99_scanf@PLT
	movq	%rbp, %rdi
	call	strlen@PLT
	movsbl	128(%rsp), %edx
	subl	$1, %eax
	cltq
	subl	$97, %edx
	movsbl	128(%rsp,%rax), %eax
	movslq	%edx, %rdx
	leaq	(%rdx,%rdx,2), %rsi
	addl	$1, 16(%rsp,%rdx,4)
	subl	$97, %eax
	leaq	(%rdx,%rsi,4), %rdx
	cltq
	subl	$1, 16(%rsp,%rax,4)
	leaq	(%rax,%rdx,2), %rax
	movl	12(%rsp), %edx
	addl	$1, (%rbx,%rax,4)
	cmpl	%r15d, %edx
	jg	.L94
.L93:
	pxor	%xmm0, %xmm0
	movl	112(%rsp), %ecx
	movdqa	%xmm0, %xmm2
	movdqa	%xmm0, %xmm1
	pcmpeqd	32(%rsp), %xmm2
	pcmpeqd	16(%rsp), %xmm1
	pand	.LC4(%rip), %xmm1
	pand	%xmm1, %xmm2
	movdqa	%xmm0, %xmm1
	pcmpeqd	48(%rsp), %xmm1
	pand	%xmm2, %xmm1
	movdqa	%xmm0, %xmm2
	pcmpeqd	64(%rsp), %xmm2
	pand	%xmm1, %xmm2
	movdqa	%xmm0, %xmm1
	pcmpeqd	80(%rsp), %xmm1
	pcmpeqd	96(%rsp), %xmm0
	pand	%xmm2, %xmm1
	pand	%xmm1, %xmm0
	movdqa	%xmm0, %xmm2
	psrldq	$8, %xmm2
	movdqa	%xmm2, %xmm1
	pcmpgtd	%xmm0, %xmm1
	pand	%xmm1, %xmm0
	pandn	%xmm2, %xmm1
	por	%xmm1, %xmm0
	movdqa	%xmm0, %xmm2
	psrldq	$4, %xmm2
	movdqa	%xmm2, %xmm1
	pcmpgtd	%xmm0, %xmm1
	pand	%xmm1, %xmm0
	pandn	%xmm2, %xmm1
	por	%xmm0, %xmm1
	movd	%xmm1, %eax
	testl	%ecx, %ecx
	jne	.L95
	movl	116(%rsp), %r11d
	testl	%r11d, %r11d
	jne	.L95
	testl	%eax, %eax
	je	.L95
	movsbl	128(%rsp), %eax
	testl	%edx, %edx
	je	.L100
	subl	$97, %eax
	subl	$1, %edx
	movl	%edx, %r9d
	je	.L98
	cltq
	leaq	(%rax,%rax,2), %rdx
	leaq	(%rax,%rdx,4), %rax
	leaq	(%rbx,%rax,8), %r10
	jmp	.L101
	.p2align 4,,10
	.p2align 3
.L99:
	addl	$1, %r11d
	addq	$4, %r10
	cmpl	$26, %r11d
	je	.L95
.L101:
	movl	(%r10), %eax
	testl	%eax, %eax
	je	.L99
	subl	$1, %eax
	movl	%r9d, %esi
	movl	%r11d, %edi
	movl	%eax, (%r10)
	call	dfs.part.0
	testl	%eax, %eax
	jne	.L100
	addl	$1, %r11d
	addl	$1, (%r10)
	addq	$4, %r10
	cmpl	$26, %r11d
	jne	.L101
	.p2align 4,,10
	.p2align 3
.L95:
	leaq	.LC1(%rip), %rdi
	jmp	.L97
.L98:
	movslq	%eax, %rdx
	leaq	(%rdx,%rdx,2), %rax
	leaq	(%rdx,%rax,4), %rax
	leaq	(%rbx,%rax,8), %rdi
	xorl	%eax, %eax
	jmp	.L104
	.p2align 4,,10
	.p2align 3
.L103:
	addq	$1, %rax
	cmpq	$26, %rax
	je	.L95
.L104:
	movl	(%rdi,%rax,4), %ecx
	movslq	%eax, %rsi
	testl	%ecx, %ecx
	je	.L103
	leaq	(%rdx,%rdx,2), %rax
	subl	$1, %ecx
	leaq	(%rdx,%rax,4), %rax
	leaq	(%rsi,%rax,2), %rax
	movl	%ecx, (%rbx,%rax,4)
.L100:
	leaq	.LC0(%rip), %rdi
.L97:
	call	puts@PLT
	jmp	.L105
.L92:
	movq	168(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L117
	addq	$184, %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
.L117:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE36:
	.size	main, .-main
	.globl	g
	.bss
	.align 32
	.type	g, @object
	.size	g, 2704
g:
	.zero	2704
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC4:
	.long	1
	.long	1
	.long	1
	.long	1
	.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
	.p2align 4
	.type	dfs.part.0, @function
dfs.part.0:
.LFB37:
	.cfi_startproc
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movslq	%edi, %rax
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	leaq	(%rax,%rax,2), %rdx
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	leaq	(%rax,%rdx,4), %rax
	leal	-5(%rsi), %r13d
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movl	%r13d, %r15d
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$72, %rsp
	.cfi_def_cfa_offset 128
	movl	%esi, 28(%rsp)
	leaq	g(%rip), %rsi
	leaq	(%rsi,%rax,8), %rax
	movq	%rsi, 48(%rsp)
	movq	%rax, 56(%rsp)
	jmp	.L18
	.p2align 4,,10
	.p2align 3
.L2:
	addq	$104, 48(%rsp)
	movq	48(%rsp), %rax
	leaq	2704+g(%rip), %rsi
	addq	$4, 56(%rsp)
	cmpq	%rsi, %rax
	je	.L59
.L18:
	movq	56(%rsp), %rax
	movl	(%rax), %eax
	testl	%eax, %eax
	je	.L2
	movq	56(%rsp), %rdi
	subl	$1, %eax
	cmpl	$1, 28(%rsp)
	movl	%eax, (%rdi)
	je	.L3
	leaq	g(%rip), %rax
	movl	%r15d, %r13d
	movq	%rax, 32(%rsp)
	movq	48(%rsp), %rax
	movq	%rax, 40(%rsp)
	jmp	.L16
	.p2align 4,,10
	.p2align 3
.L4:
	addq	$104, 32(%rsp)
	movq	32(%rsp), %rax
	leaq	2704+g(%rip), %rsi
	addq	$4, 40(%rsp)
	cmpq	%rsi, %rax
	je	.L60
.L16:
	movq	40(%rsp), %rax
	movl	(%rax), %eax
	testl	%eax, %eax
	je	.L4
	movq	40(%rsp), %rdi
	subl	$1, %eax
	cmpl	$2, 28(%rsp)
	movl	%eax, (%rdi)
	je	.L3
	leaq	g(%rip), %rax
	movq	%rax, 8(%rsp)
	movq	32(%rsp), %rax
	movq	%rax, 16(%rsp)
	jmp	.L14
	.p2align 4,,10
	.p2align 3
.L5:
	addq	$104, 8(%rsp)
	movq	8(%rsp), %rax
	leaq	2704+g(%rip), %rsi
	addq	$4, 16(%rsp)
	cmpq	%rsi, %rax
	je	.L61
.L14:
	movq	16(%rsp), %rax
	movl	(%rax), %eax
	testl	%eax, %eax
	je	.L5
	movq	16(%rsp), %rdi
	subl	$1, %eax
	cmpl	$3, 28(%rsp)
	movl	%eax, (%rdi)
	je	.L3
	leaq	g(%rip), %r12
	movq	8(%rsp), %r14
	xorl	%r15d, %r15d
	movq	%r12, %rax
	movl	%r13d, %r12d
	movq	%rax, %r13
	jmp	.L12
	.p2align 4,,10
	.p2align 3
.L6:
	addl	$1, %r15d
	addq	$4, %r14
	addq	$104, %r13
	cmpl	$26, %r15d
	je	.L62
.L12:
	movl	(%r14), %eax
	testl	%eax, %eax
	je	.L6
	subl	$1, %eax
	cmpl	$4, 28(%rsp)
	movl	%eax, (%r14)
	je	.L3
	testl	%r12d, %r12d
	je	.L20
	movq	%r13, %rbx
	xorl	%ebp, %ebp
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L8:
	addl	$1, %ebp
	addq	$4, %rbx
	cmpl	$26, %ebp
	je	.L10
.L9:
	movl	(%rbx), %eax
	testl	%eax, %eax
	je	.L8
	subl	$1, %eax
	movl	%r12d, %esi
	movl	%ebp, %edi
	movl	%eax, (%rbx)
	call	dfs.part.0
	testl	%eax, %eax
	jne	.L3
	addl	$1, %ebp
	addl	$1, (%rbx)
	addq	$4, %rbx
	cmpl	$26, %ebp
	jne	.L9
.L10:
	addl	$1, (%r14)
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L20:
	xorl	%eax, %eax
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L11:
	addq	$1, %rax
	cmpq	$26, %rax
	je	.L10
.L7:
	movl	0(%r13,%rax,4), %edx
	movslq	%eax, %rcx
	testl	%edx, %edx
	je	.L11
	movslq	%r15d, %r8
	subl	$1, %edx
	leaq	g(%rip), %rdi
	leaq	(%r8,%r8,2), %rax
	leaq	(%r8,%rax,4), %rax
	leaq	(%rcx,%rax,2), %rax
	movl	%edx, (%rdi,%rax,4)
.L3:
	addq	$72, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	movl	$1, %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
.L62:
	.cfi_restore_state
	movq	16(%rsp), %rax
	movl	%r12d, %r13d
	addl	$1, (%rax)
	jmp	.L5
.L61:
	movq	40(%rsp), %rax
	addl	$1, (%rax)
	jmp	.L4
.L60:
	movq	56(%rsp), %rax
	movl	%r13d, %r15d
	addl	$1, (%rax)
	jmp	.L2
.L59:
	addq	$72, %rsp
	.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
	.cfi_endproc
.LFE37:
	.size	dfs.part.0, .-dfs.part.0
	.p2align 4
	.globl	dfs
	.type	dfs, @function
dfs:
.LFB35:
	.cfi_startproc
	endbr64
	testl	%esi, %esi
	je	.L81
	subl	$1, %esi
	movl	%esi, %r11d
	je	.L65
	movslq	%edi, %rdi
	xorl	%r10d, %r10d
	leaq	(%rdi,%rdi,2), %rax
	leaq	(%rdi,%rax,4), %rdx
	leaq	g(%rip), %rax
	leaq	(%rax,%rdx,8), %r9
	jmp	.L82
	.p2align 4,,10
	.p2align 3
.L89:
	addl	$1, %r10d
	addq	$4, %r9
	cmpl	$26, %r10d
	je	.L86
.L82:
	movl	(%r9), %eax
	testl	%eax, %eax
	je	.L89
	subq	$8, %rsp
	.cfi_def_cfa_offset 16
.L83:
	subl	$1, %eax
	movl	%r11d, %esi
	movl	%r10d, %edi
	movl	%eax, (%r9)
	call	dfs.part.0
	testl	%eax, %eax
	jne	.L64
	addl	$1, (%r9)
.L66:
	addl	$1, %r10d
	addq	$4, %r9
	cmpl	$26, %r10d
	je	.L90
	movl	(%r9), %eax
	testl	%eax, %eax
	je	.L66
	jmp	.L83
	.p2align 4,,10
	.p2align 3
.L65:
	.cfi_def_cfa_offset 8
	movslq	%edi, %rdx
	leaq	g(%rip), %r8
	leaq	(%rdx,%rdx,2), %rax
	leaq	(%rdx,%rax,4), %rax
	leaq	(%r8,%rax,8), %rdi
	xorl	%eax, %eax
	jmp	.L70
	.p2align 4,,10
	.p2align 3
.L69:
	addq	$1, %rax
	cmpq	$26, %rax
	je	.L86
.L70:
	movl	(%rdi,%rax,4), %ecx
	movslq	%eax, %rsi
	testl	%ecx, %ecx
	je	.L69
	leaq	(%rdx,%rdx,2), %rax
	subl	$1, %ecx
	leaq	(%rdx,%rax,4), %rax
	leaq	(%rsi,%rax,2), %rax
	movl	%ecx, (%r8,%rax,4)
.L81:
	movl	$1, %eax
	ret
.L64:
	.cfi_def_cfa_offset 16
	movl	$1, %eax
	addq	$8, %rsp
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L86:
	xorl	%eax, %eax
	ret
.L90:
	.cfi_def_cfa_offset 16
	xorl	%eax, %eax
	addq	$8, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE35:
	.size	dfs, .-dfs
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"OK"
.LC1:
	.string	"NG"
.LC2:
	.string	"%d"
.LC3:
	.string	"%s"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB36:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	leaq	.LC2(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	leaq	.LC3(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	g(%rip), %rbx
	subq	$184, %rsp
	.cfi_def_cfa_offset 240
	movq	%fs:40, %rax
	movq	%rax, 168(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %r14
	.p2align 4,,10
	.p2align 3
.L105:
	movq	%r14, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %edx
	testl	%edx, %edx
	je	.L92
	leaq	16(%rsp), %rsi
	movl	$0, %eax
	movl	$13, %ecx
	movq	%rsi, %rdi
	rep stosq
	movl	$338, %ecx
	movq	%rbx, %rdi
	rep stosq
	jle	.L93
	xorl	%r15d, %r15d
	leaq	128(%rsp), %rbp
	.p2align 4,,10
	.p2align 3
.L94:
	movq	%rbp, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	addl	$1, %r15d
	call	__isoc99_scanf@PLT
	movq	%rbp, %rdi
	call	strlen@PLT
	movsbl	128(%rsp), %edx
	subl	$1, %eax
	cltq
	subl	$97, %edx
	movsbl	128(%rsp,%rax), %eax
	movslq	%edx, %rdx
	leaq	(%rdx,%rdx,2), %rsi
	addl	$1, 16(%rsp,%rdx,4)
	subl	$97, %eax
	leaq	(%rdx,%rsi,4), %rdx
	cltq
	subl	$1, 16(%rsp,%rax,4)
	leaq	(%rax,%rdx,2), %rax
	movl	12(%rsp), %edx
	addl	$1, (%rbx,%rax,4)
	cmpl	%r15d, %edx
	jg	.L94
.L93:
	pxor	%xmm0, %xmm0
	movl	112(%rsp), %ecx
	movdqa	%xmm0, %xmm2
	movdqa	%xmm0, %xmm1
	pcmpeqd	32(%rsp), %xmm2
	pcmpeqd	16(%rsp), %xmm1
	pand	.LC4(%rip), %xmm1
	pand	%xmm1, %xmm2
	movdqa	%xmm0, %xmm1
	pcmpeqd	48(%rsp), %xmm1
	pand	%xmm2, %xmm1
	movdqa	%xmm0, %xmm2
	pcmpeqd	64(%rsp), %xmm2
	pand	%xmm1, %xmm2
	movdqa	%xmm0, %xmm1
	pcmpeqd	80(%rsp), %xmm1
	pcmpeqd	96(%rsp), %xmm0
	pand	%xmm2, %xmm1
	pand	%xmm1, %xmm0
	movdqa	%xmm0, %xmm2
	psrldq	$8, %xmm2
	movdqa	%xmm2, %xmm1
	pcmpgtd	%xmm0, %xmm1
	pand	%xmm1, %xmm0
	pandn	%xmm2, %xmm1
	por	%xmm1, %xmm0
	movdqa	%xmm0, %xmm2
	psrldq	$4, %xmm2
	movdqa	%xmm2, %xmm1
	pcmpgtd	%xmm0, %xmm1
	pand	%xmm1, %xmm0
	pandn	%xmm2, %xmm1
	por	%xmm0, %xmm1
	movd	%xmm1, %eax
	testl	%ecx, %ecx
	jne	.L95
	movl	116(%rsp), %r11d
	testl	%r11d, %r11d
	jne	.L95
	testl	%eax, %eax
	je	.L95
	movsbl	128(%rsp), %eax
	testl	%edx, %edx
	je	.L100
	subl	$97, %eax
	subl	$1, %edx
	movl	%edx, %r9d
	je	.L98
	cltq
	leaq	(%rax,%rax,2), %rdx
	leaq	(%rax,%rdx,4), %rax
	leaq	(%rbx,%rax,8), %r10
	jmp	.L101
	.p2align 4,,10
	.p2align 3
.L99:
	addl	$1, %r11d
	addq	$4, %r10
	cmpl	$26, %r11d
	je	.L95
.L101:
	movl	(%r10), %eax
	testl	%eax, %eax
	je	.L99
	subl	$1, %eax
	movl	%r9d, %esi
	movl	%r11d, %edi
	movl	%eax, (%r10)
	call	dfs.part.0
	testl	%eax, %eax
	jne	.L100
	addl	$1, %r11d
	addl	$1, (%r10)
	addq	$4, %r10
	cmpl	$26, %r11d
	jne	.L101
	.p2align 4,,10
	.p2align 3
.L95:
	leaq	.LC1(%rip), %rdi
	jmp	.L97
.L98:
	movslq	%eax, %rdx
	leaq	(%rdx,%rdx,2), %rax
	leaq	(%rdx,%rax,4), %rax
	leaq	(%rbx,%rax,8), %rdi
	xorl	%eax, %eax
	jmp	.L104
	.p2align 4,,10
	.p2align 3
.L103:
	addq	$1, %rax
	cmpq	$26, %rax
	je	.L95
.L104:
	movl	(%rdi,%rax,4), %ecx
	movslq	%eax, %rsi
	testl	%ecx, %ecx
	je	.L103
	leaq	(%rdx,%rdx,2), %rax
	subl	$1, %ecx
	leaq	(%rdx,%rax,4), %rax
	leaq	(%rsi,%rax,2), %rax
	movl	%ecx, (%rbx,%rax,4)
.L100:
	leaq	.LC0(%rip), %rdi
.L97:
	call	puts@PLT
	jmp	.L105
.L92:
	movq	168(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L117
	addq	$184, %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
.L117:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE36:
	.size	main, .-main
	.globl	g
	.bss
	.align 32
	.type	g, @object
	.size	g, 2704
g:
	.zero	2704
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC4:
	.long	1
	.long	1
	.long	1
	.long	1
	.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 g[26][26];
int dfs(int a,int n)
{
  int i;
  if(n==0)return 1;
  for(i=0;i<26;i++){
    if(g[a][i]){
      g[a][i]--;
      if(dfs(i,n-1))return 1;
      g[a][i]++;
    }
  }
  return 0;
}
int main(void)
{
  int n,i,t[26],l,f;
  char s[33];
  for(;;){
    scanf("%d",&n); if(!n)break;
    memset(t,0,sizeof(t));
    memset(g,0,sizeof(g));
    for(i=0;i<n;i++){
      scanf("%s",s);
      l=strlen(s)-1;
      t[s[0]-'a']++;
      t[s[l]-'a']--;
      g[s[0]-'a'][s[l]-'a']++;
    }
    f=1;
    for(i=0;i<26;i++){
      if(t[i])f=0;
    }
    if(f)f=dfs(s[0]-'a',n);
    puts(f?"OK":"NG");
  }
  return 0;
}
5
apple
yellow
georgia
gnik
email
7
apple
yellow
georgia
king
email
wink
lucky
0
 5
apple
yellow
georgia
gnik
email
7
apple
zellow
georgia
king
email
wink
lucky
0
 5
apple
oellyw
georgia
gink
libme
0
applf
zelmow
georgia
kgnj
embil
xink
lkcuy
0
 5
apple
yellow
georgia
gnik
email
7
apple
zellow
georgia
king
email
xink
lucky
0
 5
apple
yellow
georgia
gnik
email
7
applf
zellow
georgia
king
email
xink
lucky
0
 5
apple
yellow
georgia
gnik
email
7
applf
zellow
georgia
king
embil
xink
lucky
0
 5
apple
yellow
georgia
gnik
liame
7
applf
zellow
georgia
king
embil
xink
lucky
0
 5
apple
yellow
georgia
gnik
email
7
apple
yellow
georgia
king
email
wjnk
lucky
0
 5
apple
yellow
georgia
gnik
email
7
apple
zellow
georgia
king
emial
wink
lucky
0
 5
apple
yellow
georgia
gnik
emlia
7
apple
zellow
georgia
king
email
xink
lucky
0

NG
OK
 NG
NG
 NG
 NG
NG
 NG
NG
 NG
NG
 NG
NG
 NG
OK
 NG
NG
 NG
NG

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 g[26][26];
int dfs(int a,int n)
{
  int i;
  if(n==0)return 1;
  for(i=0;i<26;i++){
    if(g[a][i]){
      g[a][i]--;
      if(dfs(i,n-1))return 1;
      g[a][i]++;
    }
  }
  return 0;
}
int main(void)
{
  int n,i,t[26],l,f;
  char s[33];
  for(;;){
    scanf("%d",&n); if(!n)break;
    memset(t,0,sizeof(t));
    memset(g,0,sizeof(g));
    for(i=0;i<n;i++){
      scanf("%s",s);
      l=strlen(s)-1;
      t[s[0]-'a']++;
      t[s[l]-'a']--;
      g[s[0]-'a'][s[l]-'a']++;
    }
    f=1;
    for(i=0;i<26;i++){
      if(t[i])f=0;
    }
    if(f)f=dfs(s[0]-'a',n);
    puts(f?"OK":"NG");
  }
  return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	g
	.bss
	.align 32
	.type	g, @object
	.size	g, 2704
g:
	.zero	2704
	.text
	.globl	dfs
	.type	dfs, @function
dfs:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movl	%edi, -20(%rbp)
	movl	%esi, -24(%rbp)
	cmpl	$0, -24(%rbp)
	jne	.L2
	movl	$1, %eax
	jmp	.L3
.L2:
	movl	$0, -4(%rbp)
	jmp	.L4
.L7:
	movl	-4(%rbp), %eax
	movslq	%eax, %rcx
	movl	-20(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	g(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	je	.L5
	movl	-4(%rbp), %eax
	movslq	%eax, %rcx
	movl	-20(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	g(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	-1(%rax), %ecx
	movl	-4(%rbp), %eax
	movslq	%eax, %rsi
	movl	-20(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,4), %rdx
	leaq	g(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	-24(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-4(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	dfs
	testl	%eax, %eax
	je	.L6
	movl	$1, %eax
	jmp	.L3
.L6:
	movl	-4(%rbp), %eax
	movslq	%eax, %rcx
	movl	-20(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	g(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	1(%rax), %ecx
	movl	-4(%rbp), %eax
	movslq	%eax, %rsi
	movl	-20(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,4), %rdx
	leaq	g(%rip), %rax
	movl	%ecx, (%rdx,%rax)
.L5:
	addl	$1, -4(%rbp)
.L4:
	cmpl	$25, -4(%rbp)
	jle	.L7
	movl	$0, %eax
.L3:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	dfs, .-dfs
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%s"
.LC2:
	.string	"OK"
.LC3:
	.string	"NG"
	.text
	.globl	main
	.type	main, @function
main:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$176, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
.L19:
	leaq	-176(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-176(%rbp), %eax
	testl	%eax, %eax
	je	.L23
	leaq	-160(%rbp), %rax
	movl	$104, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	movl	$2704, %edx
	movl	$0, %esi
	leaq	g(%rip), %rax
	movq	%rax, %rdi
	call	memset@PLT
	movl	$0, -172(%rbp)
	jmp	.L11
.L12:
	leaq	-48(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-48(%rbp), %rax
	movq	%rax, %rdi
	call	strlen@PLT
	subl	$1, %eax
	movl	%eax, -164(%rbp)
	movzbl	-48(%rbp), %eax
	movsbl	%al, %eax
	subl	$97, %eax
	movslq	%eax, %rdx
	movl	-160(%rbp,%rdx,4), %edx
	addl	$1, %edx
	cltq
	movl	%edx, -160(%rbp,%rax,4)
	movl	-164(%rbp), %eax
	cltq
	movzbl	-48(%rbp,%rax), %eax
	movsbl	%al, %eax
	subl	$97, %eax
	movslq	%eax, %rdx
	movl	-160(%rbp,%rdx,4), %edx
	subl	$1, %edx
	cltq
	movl	%edx, -160(%rbp,%rax,4)
	movzbl	-48(%rbp), %eax
	movsbl	%al, %eax
	leal	-97(%rax), %ecx
	movl	-164(%rbp), %eax
	cltq
	movzbl	-48(%rbp,%rax), %eax
	movsbl	%al, %eax
	leal	-97(%rax), %esi
	movslq	%esi, %rdi
	movslq	%ecx, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdi, %rax
	leaq	0(,%rax,4), %rdx
	leaq	g(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	1(%rax), %edi
	movslq	%esi, %rsi
	movslq	%ecx, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,4), %rdx
	leaq	g(%rip), %rax
	movl	%edi, (%rdx,%rax)
	addl	$1, -172(%rbp)
.L11:
	movl	-176(%rbp), %eax
	cmpl	%eax, -172(%rbp)
	jl	.L12
	movl	$1, -168(%rbp)
	movl	$0, -172(%rbp)
	jmp	.L13
.L15:
	movl	-172(%rbp), %eax
	cltq
	movl	-160(%rbp,%rax,4), %eax
	testl	%eax, %eax
	je	.L14
	movl	$0, -168(%rbp)
.L14:
	addl	$1, -172(%rbp)
.L13:
	cmpl	$25, -172(%rbp)
	jle	.L15
	cmpl	$0, -168(%rbp)
	je	.L16
	movl	-176(%rbp), %eax
	movzbl	-48(%rbp), %edx
	movsbl	%dl, %edx
	subl	$97, %edx
	movl	%eax, %esi
	movl	%edx, %edi
	call	dfs
	movl	%eax, -168(%rbp)
.L16:
	cmpl	$0, -168(%rbp)
	je	.L17
	leaq	.LC2(%rip), %rax
	jmp	.L18
.L17:
	leaq	.LC3(%rip), %rax
.L18:
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L19
.L23:
	nop
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L21
	call	__stack_chk_fail@PLT
.L21:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.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	g
	.bss
	.align 32
	.type	g, @object
	.size	g, 2704
g:
	.zero	2704
	.text
	.globl	dfs
	.type	dfs, @function
dfs:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movl	%edi, -20(%rbp)
	movl	%esi, -24(%rbp)
	cmpl	$0, -24(%rbp)
	jne	.L2
	movl	$1, %eax
	jmp	.L3
.L2:
	movl	$0, -4(%rbp)
	jmp	.L4
.L7:
	movl	-4(%rbp), %eax
	movslq	%eax, %rcx
	movl	-20(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	g(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	je	.L5
	movl	-4(%rbp), %eax
	movslq	%eax, %rcx
	movl	-20(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	g(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	-1(%rax), %ecx
	movl	-4(%rbp), %eax
	movslq	%eax, %rsi
	movl	-20(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,4), %rdx
	leaq	g(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	-24(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-4(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	dfs
	testl	%eax, %eax
	je	.L6
	movl	$1, %eax
	jmp	.L3
.L6:
	movl	-4(%rbp), %eax
	movslq	%eax, %rcx
	movl	-20(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	g(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	1(%rax), %ecx
	movl	-4(%rbp), %eax
	movslq	%eax, %rsi
	movl	-20(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,4), %rdx
	leaq	g(%rip), %rax
	movl	%ecx, (%rdx,%rax)
.L5:
	addl	$1, -4(%rbp)
.L4:
	cmpl	$25, -4(%rbp)
	jle	.L7
	movl	$0, %eax
.L3:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	dfs, .-dfs
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%s"
.LC2:
	.string	"OK"
.LC3:
	.string	"NG"
	.text
	.globl	main
	.type	main, @function
main:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$176, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
.L19:
	leaq	-176(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-176(%rbp), %eax
	testl	%eax, %eax
	je	.L23
	leaq	-160(%rbp), %rax
	movl	$104, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	movl	$2704, %edx
	movl	$0, %esi
	leaq	g(%rip), %rax
	movq	%rax, %rdi
	call	memset@PLT
	movl	$0, -172(%rbp)
	jmp	.L11
.L12:
	leaq	-48(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-48(%rbp), %rax
	movq	%rax, %rdi
	call	strlen@PLT
	subl	$1, %eax
	movl	%eax, -164(%rbp)
	movzbl	-48(%rbp), %eax
	movsbl	%al, %eax
	subl	$97, %eax
	movslq	%eax, %rdx
	movl	-160(%rbp,%rdx,4), %edx
	addl	$1, %edx
	cltq
	movl	%edx, -160(%rbp,%rax,4)
	movl	-164(%rbp), %eax
	cltq
	movzbl	-48(%rbp,%rax), %eax
	movsbl	%al, %eax
	subl	$97, %eax
	movslq	%eax, %rdx
	movl	-160(%rbp,%rdx,4), %edx
	subl	$1, %edx
	cltq
	movl	%edx, -160(%rbp,%rax,4)
	movzbl	-48(%rbp), %eax
	movsbl	%al, %eax
	leal	-97(%rax), %ecx
	movl	-164(%rbp), %eax
	cltq
	movzbl	-48(%rbp,%rax), %eax
	movsbl	%al, %eax
	leal	-97(%rax), %esi
	movslq	%esi, %rdi
	movslq	%ecx, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdi, %rax
	leaq	0(,%rax,4), %rdx
	leaq	g(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	1(%rax), %edi
	movslq	%esi, %rsi
	movslq	%ecx, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,4), %rdx
	leaq	g(%rip), %rax
	movl	%edi, (%rdx,%rax)
	addl	$1, -172(%rbp)
.L11:
	movl	-176(%rbp), %eax
	cmpl	%eax, -172(%rbp)
	jl	.L12
	movl	$1, -168(%rbp)
	movl	$0, -172(%rbp)
	jmp	.L13
.L15:
	movl	-172(%rbp), %eax
	cltq
	movl	-160(%rbp,%rax,4), %eax
	testl	%eax, %eax
	je	.L14
	movl	$0, -168(%rbp)
.L14:
	addl	$1, -172(%rbp)
.L13:
	cmpl	$25, -172(%rbp)
	jle	.L15
	cmpl	$0, -168(%rbp)
	je	.L16
	movl	-176(%rbp), %eax
	movzbl	-48(%rbp), %edx
	movsbl	%dl, %edx
	subl	$97, %edx
	movl	%eax, %esi
	movl	%edx, %edi
	call	dfs
	movl	%eax, -168(%rbp)
.L16:
	cmpl	$0, -168(%rbp)
	je	.L17
	leaq	.LC2(%rip), %rax
	jmp	.L18
.L17:
	leaq	.LC3(%rip), %rax
.L18:
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L19
.L23:
	nop
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L21
	call	__stack_chk_fail@PLT
.L21:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.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:
