Given the following C code and unoptimized assembly code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
// Aizu Vol-2 0225: Kobutanukitsuneko
// 2017.8.7

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

char *gets();
char buf[50];

#define MAX 26

/* UNION-FIND library */
int p[MAX], rank[MAX];

void make_set(int x) { p[x] = x, rank[x] = 0; }
void link(int x, int y) {
	if (rank[x] > rank[y]) p[y] = x;
	else { p[x] = y; if (rank[x] == rank[y]) rank[y] = rank[y] + 1;	}
}
int find_set(int x) { if (x != p[x]) p[x] = find_set(p[x]);	return p[x]; }
void union_set(int x, int y) { link(find_set(x), find_set(y)); }

int s[MAX], e[MAX];

int main()
{
	int n, a, b, k;
	
	while (1) {
		gets(buf), n = atoi(buf);
		if (n == 0) break;
		memset(s, 0, sizeof(s)), memset(e, 0, sizeof(e));
		memset(p, 0, sizeof(p)), memset(rank, 0, sizeof(rank));
		while (n-- > 0) {
			gets(buf);
			a = buf[0] - 'a', b = buf[strlen(buf)-1] - 'a';
			if (!s[a] && !e[a]) make_set(a);
			if (!s[b] && !e[b]) make_set(b);
			if (find_set(a) != find_set(b)) union_set(a, b);
			s[a]++, e[b]++;
		}

		for (k = -1, n = 0; n < 26; n++) {
			if (s[n] || e[n]) {
				if (k < 0) k = find_set(n);
				else if (find_set(n) != k) break;
			}
			if (s[n] != e[n]) break;
		}
		puts(n >= 26 ? "OK" : "NG");
	}
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	buf
	.bss
	.align 32
	.type	buf, @object
	.size	buf, 50
buf:
	.zero	50
	.globl	p
	.align 32
	.type	p, @object
	.size	p, 104
p:
	.zero	104
	.globl	rank
	.align 32
	.type	rank, @object
	.size	rank, 104
rank:
	.zero	104
	.text
	.globl	make_set
	.type	make_set, @function
make_set:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -4(%rbp)
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	p(%rip), %rdx
	movl	-4(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	rank(%rip), %rax
	movl	$0, (%rdx,%rax)
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	make_set, .-make_set
	.globl	link
	.type	link, @function
link:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -4(%rbp)
	movl	%esi, -8(%rbp)
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	rank(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	rank(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jle	.L3
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	p(%rip), %rdx
	movl	-4(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	jmp	.L5
.L3:
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	p(%rip), %rdx
	movl	-8(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	rank(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	rank(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jne	.L5
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	rank(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	1(%rax), %ecx
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	rank(%rip), %rax
	movl	%ecx, (%rdx,%rax)
.L5:
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	link, .-link
	.globl	find_set
	.type	find_set, @function
find_set:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movl	%edi, -4(%rbp)
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	p(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -4(%rbp)
	je	.L7
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	p(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, %edi
	call	find_set
	movl	-4(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	p(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
.L7:
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	p(%rip), %rax
	movl	(%rdx,%rax), %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	find_set, .-find_set
	.globl	union_set
	.type	union_set, @function
union_set:
.LFB9:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%rbx
	subq	$24, %rsp
	.cfi_offset 3, -24
	movl	%edi, -20(%rbp)
	movl	%esi, -24(%rbp)
	movl	-24(%rbp), %eax
	movl	%eax, %edi
	call	find_set
	movl	%eax, %ebx
	movl	-20(%rbp), %eax
	movl	%eax, %edi
	call	find_set
	movl	%ebx, %esi
	movl	%eax, %edi
	call	link
	nop
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.size	union_set, .-union_set
	.globl	s
	.bss
	.align 32
	.type	s, @object
	.size	s, 104
s:
	.zero	104
	.globl	e
	.align 32
	.type	e, @object
	.size	e, 104
e:
	.zero	104
	.section	.rodata
.LC0:
	.string	"OK"
.LC1:
	.string	"NG"
	.text
	.globl	main
	.type	main, @function
main:
.LFB10:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%rbx
	subq	$24, %rsp
	.cfi_offset 3, -24
.L27:
	leaq	buf(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	gets@PLT
	leaq	buf(%rip), %rax
	movq	%rax, %rdi
	call	atoi@PLT
	movl	%eax, -32(%rbp)
	cmpl	$0, -32(%rbp)
	je	.L30
	movl	$104, %edx
	movl	$0, %esi
	leaq	s(%rip), %rax
	movq	%rax, %rdi
	call	memset@PLT
	movl	$104, %edx
	movl	$0, %esi
	leaq	e(%rip), %rax
	movq	%rax, %rdi
	call	memset@PLT
	movl	$104, %edx
	movl	$0, %esi
	leaq	p(%rip), %rax
	movq	%rax, %rdi
	call	memset@PLT
	movl	$104, %edx
	movl	$0, %esi
	leaq	rank(%rip), %rax
	movq	%rax, %rdi
	call	memset@PLT
	jmp	.L13
.L17:
	leaq	buf(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	gets@PLT
	movzbl	buf(%rip), %eax
	movsbl	%al, %eax
	subl	$97, %eax
	movl	%eax, -24(%rbp)
	leaq	buf(%rip), %rax
	movq	%rax, %rdi
	call	strlen@PLT
	leaq	-1(%rax), %rdx
	leaq	buf(%rip), %rax
	movzbl	(%rdx,%rax), %eax
	movsbl	%al, %eax
	subl	$97, %eax
	movl	%eax, -20(%rbp)
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	s(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	jne	.L14
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	e(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	jne	.L14
	movl	-24(%rbp), %eax
	movl	%eax, %edi
	call	make_set
.L14:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	s(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	jne	.L15
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	e(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	jne	.L15
	movl	-20(%rbp), %eax
	movl	%eax, %edi
	call	make_set
.L15:
	movl	-24(%rbp), %eax
	movl	%eax, %edi
	call	find_set
	movl	%eax, %ebx
	movl	-20(%rbp), %eax
	movl	%eax, %edi
	call	find_set
	cmpl	%eax, %ebx
	je	.L16
	movl	-20(%rbp), %edx
	movl	-24(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	union_set
.L16:
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	s(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	1(%rax), %ecx
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	s(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	e(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	1(%rax), %ecx
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	e(%rip), %rax
	movl	%ecx, (%rdx,%rax)
.L13:
	movl	-32(%rbp), %eax
	leal	-1(%rax), %edx
	movl	%edx, -32(%rbp)
	testl	%eax, %eax
	jg	.L17
	movl	$-1, -28(%rbp)
	movl	$0, -32(%rbp)
	jmp	.L18
.L24:
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	s(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	jne	.L19
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	e(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	je	.L20
.L19:
	cmpl	$0, -28(%rbp)
	jns	.L21
	movl	-32(%rbp), %eax
	movl	%eax, %edi
	call	find_set
	movl	%eax, -28(%rbp)
	jmp	.L20
.L21:
	movl	-32(%rbp), %eax
	movl	%eax, %edi
	call	find_set
	cmpl	%eax, -28(%rbp)
	jne	.L31
.L20:
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	s(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	e(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jne	.L32
	addl	$1, -32(%rbp)
.L18:
	cmpl	$25, -32(%rbp)
	jle	.L24
	jmp	.L22
.L31:
	nop
	jmp	.L22
.L32:
	nop
.L22:
	cmpl	$25, -32(%rbp)
	jle	.L25
	leaq	.LC0(%rip), %rax
	jmp	.L26
.L25:
	leaq	.LC1(%rip), %rax
.L26:
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L27
.L30:
	nop
	movl	$0, %eax
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE10:
	.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
	.globl	make_set
	.type	make_set, @function
make_set:
.LFB51:
	.cfi_startproc
	endbr64
	movslq	%edi, %rax
	leaq	p(%rip), %rdx
	movl	%edi, (%rdx,%rax,4)
	leaq	rank(%rip), %rdx
	movl	$0, (%rdx,%rax,4)
	ret
	.cfi_endproc
.LFE51:
	.size	make_set, .-make_set
	.p2align 4
	.globl	link
	.type	link, @function
link:
.LFB52:
	.cfi_startproc
	endbr64
	leaq	rank(%rip), %rax
	movslq	%edi, %r8
	movslq	%esi, %rdx
	movl	(%rax,%r8,4), %ecx
	cmpl	(%rax,%rdx,4), %ecx
	jle	.L4
	leaq	p(%rip), %rax
	movl	%edi, (%rax,%rdx,4)
	ret
	.p2align 4,,10
	.p2align 3
.L4:
	leaq	p(%rip), %rdi
	movl	%esi, (%rdi,%r8,4)
	je	.L6
	ret
	.p2align 4,,10
	.p2align 3
.L6:
	addl	$1, %ecx
	movl	%ecx, (%rax,%rdx,4)
	ret
	.cfi_endproc
.LFE52:
	.size	link, .-link
	.p2align 4
	.globl	find_set
	.type	find_set, @function
find_set:
.LFB53:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	movslq	%edi, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	leaq	p(%rip), %rbx
	movq	%rbp, %rax
	movl	(%rbx,%rbp,4), %edx
	cmpl	%ebp, %edx
	jne	.L14
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L14:
	.cfi_restore_state
	movslq	%edx, %r12
	movl	(%rbx,%r12,4), %eax
	cmpl	%eax, %edx
	je	.L9
	movslq	%eax, %r13
	movl	(%rbx,%r13,4), %edx
	cmpl	%edx, %eax
	jne	.L15
.L10:
	movl	%edx, (%rbx,%r12,4)
	movl	%edx, %eax
.L9:
	movl	%eax, (%rbx,%rbp,4)
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L15:
	.cfi_restore_state
	movslq	%edx, %r14
	movl	(%rbx,%r14,4), %edi
	cmpl	%edi, %edx
	je	.L11
	call	find_set
	movl	%eax, (%rbx,%r14,4)
	movl	%eax, %edi
.L11:
	movl	%edi, (%rbx,%r13,4)
	movl	%edi, %edx
	jmp	.L10
	.cfi_endproc
.LFE53:
	.size	find_set, .-find_set
	.p2align 4
	.globl	union_set
	.type	union_set, @function
union_set:
.LFB54:
	.cfi_startproc
	endbr64
	leaq	p(%rip), %rcx
	movslq	%esi, %r9
	subq	$8, %rsp
	.cfi_def_cfa_offset 16
	movl	%edi, %r8d
	movl	(%rcx,%r9,4), %r10d
	cmpl	%r10d, %esi
	jne	.L27
.L17:
	movslq	%r8d, %rsi
	movl	(%rcx,%rsi,4), %eax
	cmpl	%eax, %r8d
	jne	.L28
.L21:
	leaq	rank(%rip), %rdx
	movslq	%eax, %r8
	movslq	%r10d, %rsi
	movl	(%rdx,%r8,4), %edi
	cmpl	(%rdx,%rsi,4), %edi
	jle	.L24
	movl	%eax, (%rcx,%rsi,4)
.L16:
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L24:
	.cfi_restore_state
	movl	%r10d, (%rcx,%r8,4)
	jne	.L16
	addl	$1, %edi
	movl	%edi, (%rdx,%rsi,4)
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L28:
	.cfi_restore_state
	movslq	%eax, %r8
	movl	(%rcx,%r8,4), %edx
	cmpl	%edx, %eax
	je	.L22
	movslq	%edx, %r9
	movl	(%rcx,%r9,4), %edi
	cmpl	%edi, %edx
	jne	.L29
.L23:
	movl	%edi, (%rcx,%r8,4)
	movl	%edi, %edx
.L22:
	movl	%edx, (%rcx,%rsi,4)
	movl	%edx, %eax
	jmp	.L21
	.p2align 4,,10
	.p2align 3
.L27:
	movslq	%r10d, %rsi
	movl	(%rcx,%rsi,4), %eax
	cmpl	%eax, %r10d
	je	.L18
	movslq	%eax, %r10
	movl	(%rcx,%r10,4), %edx
	cmpl	%edx, %eax
	jne	.L30
.L19:
	movl	%edx, (%rcx,%rsi,4)
	movl	%edx, %eax
.L18:
	movl	%eax, (%rcx,%r9,4)
	movl	%eax, %r10d
	jmp	.L17
	.p2align 4,,10
	.p2align 3
.L30:
	movslq	%edx, %r11
	movl	(%rcx,%r11,4), %edi
	cmpl	%edi, %edx
	je	.L20
	call	find_set
	movl	%eax, (%rcx,%r11,4)
	movl	%eax, %edi
.L20:
	movl	%edi, (%rcx,%r10,4)
	movl	%edi, %edx
	jmp	.L19
	.p2align 4,,10
	.p2align 3
.L29:
	call	find_set
	movl	%eax, (%rcx,%r9,4)
	movl	%eax, %edi
	jmp	.L23
	.cfi_endproc
.LFE54:
	.size	union_set, .-union_set
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"NG"
.LC1:
	.string	"OK"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB55:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	s(%rip), %r15
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	leaq	e(%rip), %r14
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	leaq	buf(%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	p(%rip), %rbx
	subq	$40, %rsp
	.cfi_def_cfa_offset 96
	.p2align 4,,10
	.p2align 3
.L91:
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	gets@PLT
	movl	$10, %edx
	xorl	%esi, %esi
	movq	%r12, %rdi
	call	strtol@PLT
	movq	%rax, %rdx
	testl	%eax, %eax
	je	.L95
	movl	$0, %eax
	movl	$13, %ecx
	leal	-1(%rdx), %r13d
	movq	%r15, %rdi
	rep stosq
	movl	$13, %ecx
	movq	%r14, %rdi
	rep stosq
	movl	$13, %ecx
	movq	%rbx, %rdi
	rep stosq
	movl	$13, %ecx
	leaq	rank(%rip), %rdi
	rep stosq
	jle	.L92
	.p2align 4,,10
	.p2align 3
.L71:
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	gets@PLT
	movsbl	(%r12), %ebp
	movq	%r12, %rdi
	call	strlen@PLT
	subl	$97, %ebp
	movsbl	-1(%r12,%rax), %r9d
	movslq	%ebp, %rsi
	movl	(%r15,%rsi,4), %r11d
	subl	$97, %r9d
	movslq	%r9d, %r8
	testl	%r11d, %r11d
	jne	.L34
	movl	(%r14,%rsi,4), %r10d
	testl	%r10d, %r10d
	jne	.L34
	movl	(%r15,%r8,4), %edi
	leaq	rank(%rip), %rax
	movl	%ebp, (%rbx,%rsi,4)
	movl	$0, (%rax,%rsi,4)
	testl	%edi, %edi
	je	.L38
	movl	%ebp, %ecx
.L35:
	movl	(%rbx,%r8,4), %r11d
	cmpl	%r11d, %r9d
	je	.L47
.L105:
	movslq	%r11d, %r10
	movl	(%rbx,%r10,4), %eax
	cmpl	%eax, %r11d
	je	.L48
	movslq	%eax, %r11
	movl	(%rbx,%r11,4), %edi
	cmpl	%edi, %eax
	je	.L49
	movslq	%edi, %rdx
	movl	(%rbx,%rdx,4), %eax
	cmpl	%eax, %edi
	je	.L50
	movslq	%eax, %rdi
	movq	%rdi, (%rsp)
	movl	(%rbx,%rdi,4), %edi
	cmpl	%edi, %eax
	je	.L51
	movslq	%edi, %rax
	movq	%rax, 8(%rsp)
	movl	(%rbx,%rax,4), %eax
	cmpl	%eax, %edi
	je	.L52
	movslq	%eax, %rdi
	movq	%rdi, 16(%rsp)
	movl	(%rbx,%rdi,4), %edi
	cmpl	%edi, %eax
	jne	.L99
.L53:
	movq	16(%rsp), %rax
	movq	8(%rsp), %rdi
	movl	(%rbx,%rax,4), %eax
	movl	%eax, (%rbx,%rdi,4)
.L52:
	movq	(%rsp), %rdi
	movl	%eax, (%rbx,%rdi,4)
	movl	%eax, %edi
.L51:
	movl	%edi, (%rbx,%rdx,4)
	movl	%edi, %eax
.L50:
	movl	%eax, (%rbx,%r11,4)
	movl	%eax, %edi
.L49:
	movl	%edi, (%rbx,%r10,4)
	movl	%edi, %eax
.L48:
	movl	%eax, (%rbx,%r8,4)
	cmpl	%eax, %ecx
	je	.L55
	cmpl	%eax, %r9d
	je	.L100
	movslq	%eax, %r11
	movl	(%rbx,%r11,4), %edx
	cmpl	%eax, %edx
	je	.L58
	movslq	%edx, %rcx
	movl	(%rbx,%rcx,4), %eax
	cmpl	%eax, %edx
	je	.L59
	movslq	%eax, %r9
	movl	(%rbx,%r9,4), %edx
	cmpl	%edx, %eax
	je	.L60
	movslq	%edx, %r10
	movl	(%rbx,%r10,4), %eax
	cmpl	%eax, %edx
	je	.L61
	movslq	%eax, %rdx
	movl	(%rbx,%rdx,4), %edi
	cmpl	%edi, %eax
	jne	.L101
.L62:
	movl	(%rbx,%rdx,4), %eax
	movl	%eax, (%rbx,%r10,4)
.L61:
	movl	%eax, (%rbx,%r9,4)
	movl	%eax, %edx
.L60:
	movl	%edx, (%rbx,%rcx,4)
	movl	%edx, %eax
.L59:
	movl	%eax, (%rbx,%r11,4)
.L58:
	movl	%eax, (%rbx,%r8,4)
	movl	(%rbx,%rsi,4), %ecx
	movl	%eax, %r11d
.L57:
	movslq	%ecx, %r10
	cmpl	%ecx, %ebp
	je	.L63
	movl	(%rbx,%r10,4), %eax
	cmpl	%ecx, %eax
	je	.L64
	movslq	%eax, %r9
	movl	(%rbx,%r9,4), %ecx
	cmpl	%ecx, %eax
	je	.L65
	movslq	%ecx, %rbp
	movl	(%rbx,%rbp,4), %eax
	cmpl	%eax, %ecx
	je	.L66
	movslq	%eax, %rcx
	movl	(%rbx,%rcx,4), %edi
	cmpl	%edi, %eax
	je	.L67
	movslq	%edi, %rdx
	movl	(%rbx,%rdx,4), %eax
	cmpl	%eax, %edi
	jne	.L102
.L68:
	movl	(%rbx,%rdx,4), %edi
	movl	%edi, (%rbx,%rcx,4)
.L67:
	movl	%edi, (%rbx,%rbp,4)
	movl	%edi, %eax
.L66:
	movl	%eax, (%rbx,%r9,4)
	movl	%eax, %ecx
.L65:
	movl	%ecx, (%rbx,%r10,4)
	movslq	%ecx, %r10
.L64:
	movl	%ecx, (%rbx,%rsi,4)
.L63:
	leaq	rank(%rip), %rdi
	movslq	%r11d, %rax
	movl	(%rdi,%r10,4), %edx
	cmpl	(%rdi,%rax,4), %edx
	jle	.L69
	movl	%ecx, (%rbx,%rax,4)
.L55:
	addl	$1, (%r15,%rsi,4)
	addl	$1, (%r14,%r8,4)
	subl	$1, %r13d
	jnb	.L71
	movl	(%r15), %edx
.L33:
	leaq	s(%rip), %rsi
	leaq	p(%rip), %r8
	xorl	%ecx, %ecx
	movl	$-1, %r9d
	jmp	.L90
	.p2align 4,,10
	.p2align 3
.L74:
	cmpl	%ecx, %eax
	je	.L82
	movslq	%eax, %r10
	movl	(%rbx,%r10,4), %edx
	cmpl	%eax, %edx
	je	.L83
	movslq	%edx, %r11
	movl	(%rbx,%r11,4), %eax
	cmpl	%eax, %edx
	je	.L84
	movslq	%eax, %rbp
	movl	(%rbx,%rbp,4), %edx
	cmpl	%edx, %eax
	je	.L85
	movslq	%edx, %r13
	movl	(%rbx,%r13,4), %eax
	cmpl	%eax, %edx
	je	.L86
	movslq	%eax, %rdx
	movl	(%rbx,%rdx,4), %edi
	cmpl	%edi, %eax
	je	.L87
	movq	%rdx, (%rsp)
	call	find_set
	movq	(%rsp), %rdx
	movl	%eax, (%rbx,%rdx,4)
.L87:
	movl	(%rbx,%rdx,4), %eax
	movl	%eax, (%rbx,%r13,4)
.L86:
	movl	%eax, (%rbx,%rbp,4)
	movl	%eax, %edx
.L85:
	movl	%edx, (%rbx,%r11,4)
	movl	%edx, %eax
.L84:
	movl	%eax, (%rbx,%r10,4)
.L83:
	movl	%eax, (%r8)
.L82:
	cmpl	%eax, %r9d
	jne	.L88
	movl	(%rsi), %edx
	cmpl	%edx, (%r14,%rcx,4)
	jne	.L88
.L73:
	addq	$1, %rcx
	addq	$4, %rsi
	addq	$4, %r8
	cmpq	$26, %rcx
	je	.L94
	movl	(%rsi), %edx
.L90:
	testl	%edx, %edx
	jne	.L72
	movl	(%r14,%rcx,4), %eax
	testl	%eax, %eax
	je	.L73
.L72:
	movl	(%r8), %eax
	testl	%r9d, %r9d
	jns	.L74
	cmpl	%ecx, %eax
	je	.L75
	movslq	%eax, %r10
	movl	(%rbx,%r10,4), %edi
	cmpl	%eax, %edi
	je	.L76
	movslq	%edi, %r9
	movl	(%rbx,%r9,4), %eax
	cmpl	%eax, %edi
	je	.L77
	movslq	%eax, %r11
	movl	(%rbx,%r11,4), %edi
	cmpl	%edi, %eax
	je	.L78
	movslq	%edi, %rbp
	movl	(%rbx,%rbp,4), %eax
	cmpl	%eax, %edi
	je	.L79
	movslq	%eax, %r13
	movl	(%rbx,%r13,4), %edi
	cmpl	%edi, %eax
	jne	.L103
.L80:
	movl	(%rbx,%r13,4), %eax
	movl	(%rsi), %edx
	movl	%eax, (%rbx,%rbp,4)
.L79:
	movl	%eax, (%rbx,%r11,4)
	movl	%eax, %edi
.L78:
	movl	%edi, (%rbx,%r9,4)
	movl	%edi, %eax
.L77:
	movl	%eax, (%rbx,%r10,4)
.L76:
	movl	%eax, (%r8)
.L75:
	movl	%eax, %r9d
	cmpl	%edx, (%r14,%rcx,4)
	je	.L73
.L88:
	leaq	.LC0(%rip), %rdi
.L89:
	call	puts@PLT
	jmp	.L91
	.p2align 4,,10
	.p2align 3
.L34:
	movl	(%r15,%r8,4), %edx
	testl	%edx, %edx
	jne	.L37
.L38:
	movl	(%r14,%r8,4), %ecx
	testl	%ecx, %ecx
	jne	.L37
	movl	%r9d, (%rbx,%r8,4)
	movl	(%rbx,%rsi,4), %ecx
	leaq	rank(%rip), %rax
	movl	$0, (%rax,%r8,4)
	cmpl	%ecx, %ebp
	je	.L40
.L39:
	movslq	%ecx, %r10
	movl	(%rbx,%r10,4), %eax
	cmpl	%ecx, %eax
	je	.L41
	movslq	%eax, %rcx
	movl	(%rbx,%rcx,4), %edx
	cmpl	%edx, %eax
	je	.L42
	movslq	%edx, %r11
	movl	(%rbx,%r11,4), %eax
	cmpl	%eax, %edx
	je	.L43
	movslq	%eax, %rdx
	movl	(%rbx,%rdx,4), %edi
	cmpl	%edi, %eax
	je	.L44
	movslq	%edi, %rax
	movq	%rax, (%rsp)
	movl	(%rbx,%rax,4), %eax
	cmpl	%eax, %edi
	je	.L45
	movslq	%eax, %rdi
	movq	%rdi, 8(%rsp)
	movl	(%rbx,%rdi,4), %edi
	cmpl	%edi, %eax
	jne	.L104
.L46:
	movq	8(%rsp), %rax
	movq	(%rsp), %rdi
	movl	(%rbx,%rax,4), %eax
	movl	%eax, (%rbx,%rdi,4)
.L45:
	movl	%eax, (%rbx,%rdx,4)
	movl	%eax, %edi
.L44:
	movl	%edi, (%rbx,%r11,4)
	movl	%edi, %eax
.L43:
	movl	%eax, (%rbx,%rcx,4)
	movl	%eax, %edx
.L42:
	movl	%edx, (%rbx,%r10,4)
	movl	%edx, %eax
.L41:
	movl	%eax, (%rbx,%rsi,4)
	movl	(%rbx,%r8,4), %r11d
	movl	%eax, %ecx
	cmpl	%r11d, %r9d
	jne	.L105
.L47:
	cmpl	%ecx, %r11d
	je	.L55
	jmp	.L57
	.p2align 4,,10
	.p2align 3
.L37:
	movl	(%rbx,%rsi,4), %ecx
	cmpl	%ecx, %ebp
	jne	.L39
	jmp	.L35
	.p2align 4,,10
	.p2align 3
.L69:
	movl	%r11d, (%rbx,%r10,4)
	jne	.L55
	addl	$1, %edx
	leaq	rank(%rip), %rdi
	movl	%edx, (%rdi,%rax,4)
	jmp	.L55
	.p2align 4,,10
	.p2align 3
.L40:
	movl	%r9d, %r11d
	cmpl	%ecx, %r11d
	je	.L55
	jmp	.L57
	.p2align 4,,10
	.p2align 3
.L94:
	leaq	.LC1(%rip), %rdi
	jmp	.L89
	.p2align 4,,10
	.p2align 3
.L95:
	addq	$40, %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
.L92:
	.cfi_restore_state
	xorl	%edx, %edx
	jmp	.L33
.L104:
	movq	%rdx, 16(%rsp)
	call	find_set
	movq	8(%rsp), %rdi
	movq	16(%rsp), %rdx
	movl	%eax, (%rbx,%rdi,4)
	jmp	.L46
.L102:
	movl	%eax, %edi
	movq	%rdx, (%rsp)
	call	find_set
	movq	(%rsp), %rdx
	movl	%eax, (%rbx,%rdx,4)
	jmp	.L68
.L101:
	movq	%rdx, (%rsp)
	call	find_set
	movq	(%rsp), %rdx
	movl	%eax, (%rbx,%rdx,4)
	jmp	.L62
.L99:
	movq	%rdx, 24(%rsp)
	call	find_set
	movq	16(%rsp), %rdi
	movq	24(%rsp), %rdx
	movl	%eax, (%rbx,%rdi,4)
	jmp	.L53
.L103:
	call	find_set
	movl	%eax, (%rbx,%r13,4)
	jmp	.L80
.L100:
	movl	(%rbx,%rsi,4), %ecx
	movl	%r9d, %r11d
	jmp	.L57
	.cfi_endproc
.LFE55:
	.size	main, .-main
	.globl	e
	.bss
	.align 32
	.type	e, @object
	.size	e, 104
e:
	.zero	104
	.globl	s
	.align 32
	.type	s, @object
	.size	s, 104
s:
	.zero	104
	.globl	rank
	.align 32
	.type	rank, @object
	.size	rank, 104
rank:
	.zero	104
	.globl	p
	.align 32
	.type	p, @object
	.size	p, 104
p:
	.zero	104
	.globl	buf
	.align 32
	.type	buf, @object
	.size	buf, 50
buf:
	.zero	50
	.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
	.globl	make_set
	.type	make_set, @function
make_set:
.LFB51:
	.cfi_startproc
	endbr64
	movslq	%edi, %rax
	leaq	p(%rip), %rdx
	movl	%edi, (%rdx,%rax,4)
	leaq	rank(%rip), %rdx
	movl	$0, (%rdx,%rax,4)
	ret
	.cfi_endproc
.LFE51:
	.size	make_set, .-make_set
	.p2align 4
	.globl	link
	.type	link, @function
link:
.LFB52:
	.cfi_startproc
	endbr64
	leaq	rank(%rip), %rax
	movslq	%edi, %r8
	movslq	%esi, %rdx
	movl	(%rax,%r8,4), %ecx
	cmpl	(%rax,%rdx,4), %ecx
	jle	.L4
	leaq	p(%rip), %rax
	movl	%edi, (%rax,%rdx,4)
	ret
	.p2align 4,,10
	.p2align 3
.L4:
	leaq	p(%rip), %rdi
	movl	%esi, (%rdi,%r8,4)
	je	.L6
	ret
	.p2align 4,,10
	.p2align 3
.L6:
	addl	$1, %ecx
	movl	%ecx, (%rax,%rdx,4)
	ret
	.cfi_endproc
.LFE52:
	.size	link, .-link
	.p2align 4
	.globl	find_set
	.type	find_set, @function
find_set:
.LFB53:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	movslq	%edi, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	leaq	p(%rip), %rbx
	movq	%rbp, %rax
	movl	(%rbx,%rbp,4), %edx
	cmpl	%ebp, %edx
	jne	.L14
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L14:
	.cfi_restore_state
	movslq	%edx, %r12
	movl	(%rbx,%r12,4), %eax
	cmpl	%eax, %edx
	je	.L9
	movslq	%eax, %r13
	movl	(%rbx,%r13,4), %edx
	cmpl	%edx, %eax
	jne	.L15
.L10:
	movl	%edx, (%rbx,%r12,4)
	movl	%edx, %eax
.L9:
	movl	%eax, (%rbx,%rbp,4)
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L15:
	.cfi_restore_state
	movslq	%edx, %r14
	movl	(%rbx,%r14,4), %edi
	cmpl	%edi, %edx
	je	.L11
	call	find_set
	movl	%eax, (%rbx,%r14,4)
	movl	%eax, %edi
.L11:
	movl	%edi, (%rbx,%r13,4)
	movl	%edi, %edx
	jmp	.L10
	.cfi_endproc
.LFE53:
	.size	find_set, .-find_set
	.p2align 4
	.globl	union_set
	.type	union_set, @function
union_set:
.LFB54:
	.cfi_startproc
	endbr64
	leaq	p(%rip), %rcx
	movslq	%esi, %r9
	subq	$8, %rsp
	.cfi_def_cfa_offset 16
	movl	%edi, %r8d
	movl	(%rcx,%r9,4), %r10d
	cmpl	%r10d, %esi
	jne	.L27
.L17:
	movslq	%r8d, %rsi
	movl	(%rcx,%rsi,4), %eax
	cmpl	%eax, %r8d
	jne	.L28
.L21:
	leaq	rank(%rip), %rdx
	movslq	%eax, %r8
	movslq	%r10d, %rsi
	movl	(%rdx,%r8,4), %edi
	cmpl	(%rdx,%rsi,4), %edi
	jle	.L24
	movl	%eax, (%rcx,%rsi,4)
.L16:
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L24:
	.cfi_restore_state
	movl	%r10d, (%rcx,%r8,4)
	jne	.L16
	addl	$1, %edi
	movl	%edi, (%rdx,%rsi,4)
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L28:
	.cfi_restore_state
	movslq	%eax, %r8
	movl	(%rcx,%r8,4), %edx
	cmpl	%edx, %eax
	je	.L22
	movslq	%edx, %r9
	movl	(%rcx,%r9,4), %edi
	cmpl	%edi, %edx
	jne	.L29
.L23:
	movl	%edi, (%rcx,%r8,4)
	movl	%edi, %edx
.L22:
	movl	%edx, (%rcx,%rsi,4)
	movl	%edx, %eax
	jmp	.L21
	.p2align 4,,10
	.p2align 3
.L27:
	movslq	%r10d, %rsi
	movl	(%rcx,%rsi,4), %eax
	cmpl	%eax, %r10d
	je	.L18
	movslq	%eax, %r10
	movl	(%rcx,%r10,4), %edx
	cmpl	%edx, %eax
	jne	.L30
.L19:
	movl	%edx, (%rcx,%rsi,4)
	movl	%edx, %eax
.L18:
	movl	%eax, (%rcx,%r9,4)
	movl	%eax, %r10d
	jmp	.L17
	.p2align 4,,10
	.p2align 3
.L30:
	movslq	%edx, %r11
	movl	(%rcx,%r11,4), %edi
	cmpl	%edi, %edx
	je	.L20
	call	find_set
	movl	%eax, (%rcx,%r11,4)
	movl	%eax, %edi
.L20:
	movl	%edi, (%rcx,%r10,4)
	movl	%edi, %edx
	jmp	.L19
	.p2align 4,,10
	.p2align 3
.L29:
	call	find_set
	movl	%eax, (%rcx,%r9,4)
	movl	%eax, %edi
	jmp	.L23
	.cfi_endproc
.LFE54:
	.size	union_set, .-union_set
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"NG"
.LC1:
	.string	"OK"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB55:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	s(%rip), %r15
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	leaq	e(%rip), %r14
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	leaq	buf(%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	p(%rip), %rbx
	subq	$40, %rsp
	.cfi_def_cfa_offset 96
	.p2align 4,,10
	.p2align 3
.L91:
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	gets@PLT
	movl	$10, %edx
	xorl	%esi, %esi
	movq	%r12, %rdi
	call	strtol@PLT
	movq	%rax, %rdx
	testl	%eax, %eax
	je	.L95
	movl	$0, %eax
	movl	$13, %ecx
	leal	-1(%rdx), %r13d
	movq	%r15, %rdi
	rep stosq
	movl	$13, %ecx
	movq	%r14, %rdi
	rep stosq
	movl	$13, %ecx
	movq	%rbx, %rdi
	rep stosq
	movl	$13, %ecx
	leaq	rank(%rip), %rdi
	rep stosq
	jle	.L92
	.p2align 4,,10
	.p2align 3
.L71:
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	gets@PLT
	movsbl	(%r12), %ebp
	movq	%r12, %rdi
	call	strlen@PLT
	subl	$97, %ebp
	movsbl	-1(%r12,%rax), %r9d
	movslq	%ebp, %rsi
	movl	(%r15,%rsi,4), %r11d
	subl	$97, %r9d
	movslq	%r9d, %r8
	testl	%r11d, %r11d
	jne	.L34
	movl	(%r14,%rsi,4), %r10d
	testl	%r10d, %r10d
	jne	.L34
	movl	(%r15,%r8,4), %edi
	leaq	rank(%rip), %rax
	movl	%ebp, (%rbx,%rsi,4)
	movl	$0, (%rax,%rsi,4)
	testl	%edi, %edi
	je	.L38
	movl	%ebp, %ecx
.L35:
	movl	(%rbx,%r8,4), %r11d
	cmpl	%r11d, %r9d
	je	.L47
.L105:
	movslq	%r11d, %r10
	movl	(%rbx,%r10,4), %eax
	cmpl	%eax, %r11d
	je	.L48
	movslq	%eax, %r11
	movl	(%rbx,%r11,4), %edi
	cmpl	%edi, %eax
	je	.L49
	movslq	%edi, %rdx
	movl	(%rbx,%rdx,4), %eax
	cmpl	%eax, %edi
	je	.L50
	movslq	%eax, %rdi
	movq	%rdi, (%rsp)
	movl	(%rbx,%rdi,4), %edi
	cmpl	%edi, %eax
	je	.L51
	movslq	%edi, %rax
	movq	%rax, 8(%rsp)
	movl	(%rbx,%rax,4), %eax
	cmpl	%eax, %edi
	je	.L52
	movslq	%eax, %rdi
	movq	%rdi, 16(%rsp)
	movl	(%rbx,%rdi,4), %edi
	cmpl	%edi, %eax
	jne	.L99
.L53:
	movq	16(%rsp), %rax
	movq	8(%rsp), %rdi
	movl	(%rbx,%rax,4), %eax
	movl	%eax, (%rbx,%rdi,4)
.L52:
	movq	(%rsp), %rdi
	movl	%eax, (%rbx,%rdi,4)
	movl	%eax, %edi
.L51:
	movl	%edi, (%rbx,%rdx,4)
	movl	%edi, %eax
.L50:
	movl	%eax, (%rbx,%r11,4)
	movl	%eax, %edi
.L49:
	movl	%edi, (%rbx,%r10,4)
	movl	%edi, %eax
.L48:
	movl	%eax, (%rbx,%r8,4)
	cmpl	%eax, %ecx
	je	.L55
	cmpl	%eax, %r9d
	je	.L100
	movslq	%eax, %r11
	movl	(%rbx,%r11,4), %edx
	cmpl	%eax, %edx
	je	.L58
	movslq	%edx, %rcx
	movl	(%rbx,%rcx,4), %eax
	cmpl	%eax, %edx
	je	.L59
	movslq	%eax, %r9
	movl	(%rbx,%r9,4), %edx
	cmpl	%edx, %eax
	je	.L60
	movslq	%edx, %r10
	movl	(%rbx,%r10,4), %eax
	cmpl	%eax, %edx
	je	.L61
	movslq	%eax, %rdx
	movl	(%rbx,%rdx,4), %edi
	cmpl	%edi, %eax
	jne	.L101
.L62:
	movl	(%rbx,%rdx,4), %eax
	movl	%eax, (%rbx,%r10,4)
.L61:
	movl	%eax, (%rbx,%r9,4)
	movl	%eax, %edx
.L60:
	movl	%edx, (%rbx,%rcx,4)
	movl	%edx, %eax
.L59:
	movl	%eax, (%rbx,%r11,4)
.L58:
	movl	%eax, (%rbx,%r8,4)
	movl	(%rbx,%rsi,4), %ecx
	movl	%eax, %r11d
.L57:
	movslq	%ecx, %r10
	cmpl	%ecx, %ebp
	je	.L63
	movl	(%rbx,%r10,4), %eax
	cmpl	%ecx, %eax
	je	.L64
	movslq	%eax, %r9
	movl	(%rbx,%r9,4), %ecx
	cmpl	%ecx, %eax
	je	.L65
	movslq	%ecx, %rbp
	movl	(%rbx,%rbp,4), %eax
	cmpl	%eax, %ecx
	je	.L66
	movslq	%eax, %rcx
	movl	(%rbx,%rcx,4), %edi
	cmpl	%edi, %eax
	je	.L67
	movslq	%edi, %rdx
	movl	(%rbx,%rdx,4), %eax
	cmpl	%eax, %edi
	jne	.L102
.L68:
	movl	(%rbx,%rdx,4), %edi
	movl	%edi, (%rbx,%rcx,4)
.L67:
	movl	%edi, (%rbx,%rbp,4)
	movl	%edi, %eax
.L66:
	movl	%eax, (%rbx,%r9,4)
	movl	%eax, %ecx
.L65:
	movl	%ecx, (%rbx,%r10,4)
	movslq	%ecx, %r10
.L64:
	movl	%ecx, (%rbx,%rsi,4)
.L63:
	leaq	rank(%rip), %rdi
	movslq	%r11d, %rax
	movl	(%rdi,%r10,4), %edx
	cmpl	(%rdi,%rax,4), %edx
	jle	.L69
	movl	%ecx, (%rbx,%rax,4)
.L55:
	addl	$1, (%r15,%rsi,4)
	addl	$1, (%r14,%r8,4)
	subl	$1, %r13d
	jnb	.L71
	movl	(%r15), %edx
.L33:
	leaq	s(%rip), %rsi
	leaq	p(%rip), %r8
	xorl	%ecx, %ecx
	movl	$-1, %r9d
	jmp	.L90
	.p2align 4,,10
	.p2align 3
.L74:
	cmpl	%ecx, %eax
	je	.L82
	movslq	%eax, %r10
	movl	(%rbx,%r10,4), %edx
	cmpl	%eax, %edx
	je	.L83
	movslq	%edx, %r11
	movl	(%rbx,%r11,4), %eax
	cmpl	%eax, %edx
	je	.L84
	movslq	%eax, %rbp
	movl	(%rbx,%rbp,4), %edx
	cmpl	%edx, %eax
	je	.L85
	movslq	%edx, %r13
	movl	(%rbx,%r13,4), %eax
	cmpl	%eax, %edx
	je	.L86
	movslq	%eax, %rdx
	movl	(%rbx,%rdx,4), %edi
	cmpl	%edi, %eax
	je	.L87
	movq	%rdx, (%rsp)
	call	find_set
	movq	(%rsp), %rdx
	movl	%eax, (%rbx,%rdx,4)
.L87:
	movl	(%rbx,%rdx,4), %eax
	movl	%eax, (%rbx,%r13,4)
.L86:
	movl	%eax, (%rbx,%rbp,4)
	movl	%eax, %edx
.L85:
	movl	%edx, (%rbx,%r11,4)
	movl	%edx, %eax
.L84:
	movl	%eax, (%rbx,%r10,4)
.L83:
	movl	%eax, (%r8)
.L82:
	cmpl	%eax, %r9d
	jne	.L88
	movl	(%rsi), %edx
	cmpl	%edx, (%r14,%rcx,4)
	jne	.L88
.L73:
	addq	$1, %rcx
	addq	$4, %rsi
	addq	$4, %r8
	cmpq	$26, %rcx
	je	.L94
	movl	(%rsi), %edx
.L90:
	testl	%edx, %edx
	jne	.L72
	movl	(%r14,%rcx,4), %eax
	testl	%eax, %eax
	je	.L73
.L72:
	movl	(%r8), %eax
	testl	%r9d, %r9d
	jns	.L74
	cmpl	%ecx, %eax
	je	.L75
	movslq	%eax, %r10
	movl	(%rbx,%r10,4), %edi
	cmpl	%eax, %edi
	je	.L76
	movslq	%edi, %r9
	movl	(%rbx,%r9,4), %eax
	cmpl	%eax, %edi
	je	.L77
	movslq	%eax, %r11
	movl	(%rbx,%r11,4), %edi
	cmpl	%edi, %eax
	je	.L78
	movslq	%edi, %rbp
	movl	(%rbx,%rbp,4), %eax
	cmpl	%eax, %edi
	je	.L79
	movslq	%eax, %r13
	movl	(%rbx,%r13,4), %edi
	cmpl	%edi, %eax
	jne	.L103
.L80:
	movl	(%rbx,%r13,4), %eax
	movl	(%rsi), %edx
	movl	%eax, (%rbx,%rbp,4)
.L79:
	movl	%eax, (%rbx,%r11,4)
	movl	%eax, %edi
.L78:
	movl	%edi, (%rbx,%r9,4)
	movl	%edi, %eax
.L77:
	movl	%eax, (%rbx,%r10,4)
.L76:
	movl	%eax, (%r8)
.L75:
	movl	%eax, %r9d
	cmpl	%edx, (%r14,%rcx,4)
	je	.L73
.L88:
	leaq	.LC0(%rip), %rdi
.L89:
	call	puts@PLT
	jmp	.L91
	.p2align 4,,10
	.p2align 3
.L34:
	movl	(%r15,%r8,4), %edx
	testl	%edx, %edx
	jne	.L37
.L38:
	movl	(%r14,%r8,4), %ecx
	testl	%ecx, %ecx
	jne	.L37
	movl	%r9d, (%rbx,%r8,4)
	movl	(%rbx,%rsi,4), %ecx
	leaq	rank(%rip), %rax
	movl	$0, (%rax,%r8,4)
	cmpl	%ecx, %ebp
	je	.L40
.L39:
	movslq	%ecx, %r10
	movl	(%rbx,%r10,4), %eax
	cmpl	%ecx, %eax
	je	.L41
	movslq	%eax, %rcx
	movl	(%rbx,%rcx,4), %edx
	cmpl	%edx, %eax
	je	.L42
	movslq	%edx, %r11
	movl	(%rbx,%r11,4), %eax
	cmpl	%eax, %edx
	je	.L43
	movslq	%eax, %rdx
	movl	(%rbx,%rdx,4), %edi
	cmpl	%edi, %eax
	je	.L44
	movslq	%edi, %rax
	movq	%rax, (%rsp)
	movl	(%rbx,%rax,4), %eax
	cmpl	%eax, %edi
	je	.L45
	movslq	%eax, %rdi
	movq	%rdi, 8(%rsp)
	movl	(%rbx,%rdi,4), %edi
	cmpl	%edi, %eax
	jne	.L104
.L46:
	movq	8(%rsp), %rax
	movq	(%rsp), %rdi
	movl	(%rbx,%rax,4), %eax
	movl	%eax, (%rbx,%rdi,4)
.L45:
	movl	%eax, (%rbx,%rdx,4)
	movl	%eax, %edi
.L44:
	movl	%edi, (%rbx,%r11,4)
	movl	%edi, %eax
.L43:
	movl	%eax, (%rbx,%rcx,4)
	movl	%eax, %edx
.L42:
	movl	%edx, (%rbx,%r10,4)
	movl	%edx, %eax
.L41:
	movl	%eax, (%rbx,%rsi,4)
	movl	(%rbx,%r8,4), %r11d
	movl	%eax, %ecx
	cmpl	%r11d, %r9d
	jne	.L105
.L47:
	cmpl	%ecx, %r11d
	je	.L55
	jmp	.L57
	.p2align 4,,10
	.p2align 3
.L37:
	movl	(%rbx,%rsi,4), %ecx
	cmpl	%ecx, %ebp
	jne	.L39
	jmp	.L35
	.p2align 4,,10
	.p2align 3
.L69:
	movl	%r11d, (%rbx,%r10,4)
	jne	.L55
	addl	$1, %edx
	leaq	rank(%rip), %rdi
	movl	%edx, (%rdi,%rax,4)
	jmp	.L55
	.p2align 4,,10
	.p2align 3
.L40:
	movl	%r9d, %r11d
	cmpl	%ecx, %r11d
	je	.L55
	jmp	.L57
	.p2align 4,,10
	.p2align 3
.L94:
	leaq	.LC1(%rip), %rdi
	jmp	.L89
	.p2align 4,,10
	.p2align 3
.L95:
	addq	$40, %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
.L92:
	.cfi_restore_state
	xorl	%edx, %edx
	jmp	.L33
.L104:
	movq	%rdx, 16(%rsp)
	call	find_set
	movq	8(%rsp), %rdi
	movq	16(%rsp), %rdx
	movl	%eax, (%rbx,%rdi,4)
	jmp	.L46
.L102:
	movl	%eax, %edi
	movq	%rdx, (%rsp)
	call	find_set
	movq	(%rsp), %rdx
	movl	%eax, (%rbx,%rdx,4)
	jmp	.L68
.L101:
	movq	%rdx, (%rsp)
	call	find_set
	movq	(%rsp), %rdx
	movl	%eax, (%rbx,%rdx,4)
	jmp	.L62
.L99:
	movq	%rdx, 24(%rsp)
	call	find_set
	movq	16(%rsp), %rdi
	movq	24(%rsp), %rdx
	movl	%eax, (%rbx,%rdi,4)
	jmp	.L53
.L103:
	call	find_set
	movl	%eax, (%rbx,%r13,4)
	jmp	.L80
.L100:
	movl	(%rbx,%rsi,4), %ecx
	movl	%r9d, %r11d
	jmp	.L57
	.cfi_endproc
.LFE55:
	.size	main, .-main
	.globl	e
	.bss
	.align 32
	.type	e, @object
	.size	e, 104
e:
	.zero	104
	.globl	s
	.align 32
	.type	s, @object
	.size	s, 104
s:
	.zero	104
	.globl	rank
	.align 32
	.type	rank, @object
	.size	rank, 104
rank:
	.zero	104
	.globl	p
	.align 32
	.type	p, @object
	.size	p, 104
p:
	.zero	104
	.globl	buf
	.align 32
	.type	buf, @object
	.size	buf, 50
buf:
	.zero	50
	.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:

// Aizu Vol-2 0225: Kobutanukitsuneko
// 2017.8.7

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

char *gets();
char buf[50];

#define MAX 26

/* UNION-FIND library */
int p[MAX], rank[MAX];

void make_set(int x) { p[x] = x, rank[x] = 0; }
void link(int x, int y) {
	if (rank[x] > rank[y]) p[y] = x;
	else { p[x] = y; if (rank[x] == rank[y]) rank[y] = rank[y] + 1;	}
}
int find_set(int x) { if (x != p[x]) p[x] = find_set(p[x]);	return p[x]; }
void union_set(int x, int y) { link(find_set(x), find_set(y)); }

int s[MAX], e[MAX];

int main()
{
	int n, a, b, k;
	
	while (1) {
		gets(buf), n = atoi(buf);
		if (n == 0) break;
		memset(s, 0, sizeof(s)), memset(e, 0, sizeof(e));
		memset(p, 0, sizeof(p)), memset(rank, 0, sizeof(rank));
		while (n-- > 0) {
			gets(buf);
			a = buf[0] - 'a', b = buf[strlen(buf)-1] - 'a';
			if (!s[a] && !e[a]) make_set(a);
			if (!s[b] && !e[b]) make_set(b);
			if (find_set(a) != find_set(b)) union_set(a, b);
			s[a]++, e[b]++;
		}

		for (k = -1, n = 0; n < 26; n++) {
			if (s[n] || e[n]) {
				if (k < 0) k = find_set(n);
				else if (find_set(n) != k) break;
			}
			if (s[n] != e[n]) break;
		}
		puts(n >= 26 ? "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
// Aizu Vol-2 0225: Kobutanukitsuneko
// 2017.8.7

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

char *gets();
char buf[50];

#define MAX 26

/* UNION-FIND library */
int p[MAX], rank[MAX];

void make_set(int x) { p[x] = x, rank[x] = 0; }
void link(int x, int y) {
	if (rank[x] > rank[y]) p[y] = x;
	else { p[x] = y; if (rank[x] == rank[y]) rank[y] = rank[y] + 1;	}
}
int find_set(int x) { if (x != p[x]) p[x] = find_set(p[x]);	return p[x]; }
void union_set(int x, int y) { link(find_set(x), find_set(y)); }

int s[MAX], e[MAX];

int main()
{
	int n, a, b, k;
	
	while (1) {
		gets(buf), n = atoi(buf);
		if (n == 0) break;
		memset(s, 0, sizeof(s)), memset(e, 0, sizeof(e));
		memset(p, 0, sizeof(p)), memset(rank, 0, sizeof(rank));
		while (n-- > 0) {
			gets(buf);
			a = buf[0] - 'a', b = buf[strlen(buf)-1] - 'a';
			if (!s[a] && !e[a]) make_set(a);
			if (!s[b] && !e[b]) make_set(b);
			if (find_set(a) != find_set(b)) union_set(a, b);
			s[a]++, e[b]++;
		}

		for (k = -1, n = 0; n < 26; n++) {
			if (s[n] || e[n]) {
				if (k < 0) k = find_set(n);
				else if (find_set(n) != k) break;
			}
			if (s[n] != e[n]) break;
		}
		puts(n >= 26 ? "OK" : "NG");
	}
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	buf
	.bss
	.align 32
	.type	buf, @object
	.size	buf, 50
buf:
	.zero	50
	.globl	p
	.align 32
	.type	p, @object
	.size	p, 104
p:
	.zero	104
	.globl	rank
	.align 32
	.type	rank, @object
	.size	rank, 104
rank:
	.zero	104
	.text
	.globl	make_set
	.type	make_set, @function
make_set:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -4(%rbp)
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	p(%rip), %rdx
	movl	-4(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	rank(%rip), %rax
	movl	$0, (%rdx,%rax)
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	make_set, .-make_set
	.globl	link
	.type	link, @function
link:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -4(%rbp)
	movl	%esi, -8(%rbp)
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	rank(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	rank(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jle	.L3
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	p(%rip), %rdx
	movl	-4(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	jmp	.L5
.L3:
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	p(%rip), %rdx
	movl	-8(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	rank(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	rank(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jne	.L5
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	rank(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	1(%rax), %ecx
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	rank(%rip), %rax
	movl	%ecx, (%rdx,%rax)
.L5:
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	link, .-link
	.globl	find_set
	.type	find_set, @function
find_set:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movl	%edi, -4(%rbp)
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	p(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -4(%rbp)
	je	.L7
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	p(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, %edi
	call	find_set
	movl	-4(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	p(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
.L7:
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	p(%rip), %rax
	movl	(%rdx,%rax), %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	find_set, .-find_set
	.globl	union_set
	.type	union_set, @function
union_set:
.LFB9:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%rbx
	subq	$24, %rsp
	.cfi_offset 3, -24
	movl	%edi, -20(%rbp)
	movl	%esi, -24(%rbp)
	movl	-24(%rbp), %eax
	movl	%eax, %edi
	call	find_set
	movl	%eax, %ebx
	movl	-20(%rbp), %eax
	movl	%eax, %edi
	call	find_set
	movl	%ebx, %esi
	movl	%eax, %edi
	call	link
	nop
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.size	union_set, .-union_set
	.globl	s
	.bss
	.align 32
	.type	s, @object
	.size	s, 104
s:
	.zero	104
	.globl	e
	.align 32
	.type	e, @object
	.size	e, 104
e:
	.zero	104
	.section	.rodata
.LC0:
	.string	"OK"
.LC1:
	.string	"NG"
	.text
	.globl	main
	.type	main, @function
main:
.LFB10:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%rbx
	subq	$24, %rsp
	.cfi_offset 3, -24
.L27:
	leaq	buf(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	gets@PLT
	leaq	buf(%rip), %rax
	movq	%rax, %rdi
	call	atoi@PLT
	movl	%eax, -32(%rbp)
	cmpl	$0, -32(%rbp)
	je	.L30
	movl	$104, %edx
	movl	$0, %esi
	leaq	s(%rip), %rax
	movq	%rax, %rdi
	call	memset@PLT
	movl	$104, %edx
	movl	$0, %esi
	leaq	e(%rip), %rax
	movq	%rax, %rdi
	call	memset@PLT
	movl	$104, %edx
	movl	$0, %esi
	leaq	p(%rip), %rax
	movq	%rax, %rdi
	call	memset@PLT
	movl	$104, %edx
	movl	$0, %esi
	leaq	rank(%rip), %rax
	movq	%rax, %rdi
	call	memset@PLT
	jmp	.L13
.L17:
	leaq	buf(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	gets@PLT
	movzbl	buf(%rip), %eax
	movsbl	%al, %eax
	subl	$97, %eax
	movl	%eax, -24(%rbp)
	leaq	buf(%rip), %rax
	movq	%rax, %rdi
	call	strlen@PLT
	leaq	-1(%rax), %rdx
	leaq	buf(%rip), %rax
	movzbl	(%rdx,%rax), %eax
	movsbl	%al, %eax
	subl	$97, %eax
	movl	%eax, -20(%rbp)
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	s(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	jne	.L14
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	e(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	jne	.L14
	movl	-24(%rbp), %eax
	movl	%eax, %edi
	call	make_set
.L14:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	s(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	jne	.L15
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	e(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	jne	.L15
	movl	-20(%rbp), %eax
	movl	%eax, %edi
	call	make_set
.L15:
	movl	-24(%rbp), %eax
	movl	%eax, %edi
	call	find_set
	movl	%eax, %ebx
	movl	-20(%rbp), %eax
	movl	%eax, %edi
	call	find_set
	cmpl	%eax, %ebx
	je	.L16
	movl	-20(%rbp), %edx
	movl	-24(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	union_set
.L16:
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	s(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	1(%rax), %ecx
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	s(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	e(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	1(%rax), %ecx
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	e(%rip), %rax
	movl	%ecx, (%rdx,%rax)
.L13:
	movl	-32(%rbp), %eax
	leal	-1(%rax), %edx
	movl	%edx, -32(%rbp)
	testl	%eax, %eax
	jg	.L17
	movl	$-1, -28(%rbp)
	movl	$0, -32(%rbp)
	jmp	.L18
.L24:
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	s(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	jne	.L19
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	e(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	je	.L20
.L19:
	cmpl	$0, -28(%rbp)
	jns	.L21
	movl	-32(%rbp), %eax
	movl	%eax, %edi
	call	find_set
	movl	%eax, -28(%rbp)
	jmp	.L20
.L21:
	movl	-32(%rbp), %eax
	movl	%eax, %edi
	call	find_set
	cmpl	%eax, -28(%rbp)
	jne	.L31
.L20:
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	s(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	e(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jne	.L32
	addl	$1, -32(%rbp)
.L18:
	cmpl	$25, -32(%rbp)
	jle	.L24
	jmp	.L22
.L31:
	nop
	jmp	.L22
.L32:
	nop
.L22:
	cmpl	$25, -32(%rbp)
	jle	.L25
	leaq	.LC0(%rip), %rax
	jmp	.L26
.L25:
	leaq	.LC1(%rip), %rax
.L26:
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L27
.L30:
	nop
	movl	$0, %eax
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE10:
	.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	buf
	.bss
	.align 32
	.type	buf, @object
	.size	buf, 50
buf:
	.zero	50
	.globl	p
	.align 32
	.type	p, @object
	.size	p, 104
p:
	.zero	104
	.globl	rank
	.align 32
	.type	rank, @object
	.size	rank, 104
rank:
	.zero	104
	.text
	.globl	make_set
	.type	make_set, @function
make_set:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -4(%rbp)
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	p(%rip), %rdx
	movl	-4(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	rank(%rip), %rax
	movl	$0, (%rdx,%rax)
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	make_set, .-make_set
	.globl	link
	.type	link, @function
link:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -4(%rbp)
	movl	%esi, -8(%rbp)
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	rank(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	rank(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jle	.L3
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	p(%rip), %rdx
	movl	-4(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	jmp	.L5
.L3:
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	p(%rip), %rdx
	movl	-8(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	rank(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	rank(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jne	.L5
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	rank(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	1(%rax), %ecx
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	rank(%rip), %rax
	movl	%ecx, (%rdx,%rax)
.L5:
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	link, .-link
	.globl	find_set
	.type	find_set, @function
find_set:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movl	%edi, -4(%rbp)
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	p(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -4(%rbp)
	je	.L7
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	p(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, %edi
	call	find_set
	movl	-4(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	p(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
.L7:
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	p(%rip), %rax
	movl	(%rdx,%rax), %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	find_set, .-find_set
	.globl	union_set
	.type	union_set, @function
union_set:
.LFB9:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%rbx
	subq	$24, %rsp
	.cfi_offset 3, -24
	movl	%edi, -20(%rbp)
	movl	%esi, -24(%rbp)
	movl	-24(%rbp), %eax
	movl	%eax, %edi
	call	find_set
	movl	%eax, %ebx
	movl	-20(%rbp), %eax
	movl	%eax, %edi
	call	find_set
	movl	%ebx, %esi
	movl	%eax, %edi
	call	link
	nop
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.size	union_set, .-union_set
	.globl	s
	.bss
	.align 32
	.type	s, @object
	.size	s, 104
s:
	.zero	104
	.globl	e
	.align 32
	.type	e, @object
	.size	e, 104
e:
	.zero	104
	.section	.rodata
.LC0:
	.string	"OK"
.LC1:
	.string	"NG"
	.text
	.globl	main
	.type	main, @function
main:
.LFB10:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%rbx
	subq	$24, %rsp
	.cfi_offset 3, -24
.L27:
	leaq	buf(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	gets@PLT
	leaq	buf(%rip), %rax
	movq	%rax, %rdi
	call	atoi@PLT
	movl	%eax, -32(%rbp)
	cmpl	$0, -32(%rbp)
	je	.L30
	movl	$104, %edx
	movl	$0, %esi
	leaq	s(%rip), %rax
	movq	%rax, %rdi
	call	memset@PLT
	movl	$104, %edx
	movl	$0, %esi
	leaq	e(%rip), %rax
	movq	%rax, %rdi
	call	memset@PLT
	movl	$104, %edx
	movl	$0, %esi
	leaq	p(%rip), %rax
	movq	%rax, %rdi
	call	memset@PLT
	movl	$104, %edx
	movl	$0, %esi
	leaq	rank(%rip), %rax
	movq	%rax, %rdi
	call	memset@PLT
	jmp	.L13
.L17:
	leaq	buf(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	gets@PLT
	movzbl	buf(%rip), %eax
	movsbl	%al, %eax
	subl	$97, %eax
	movl	%eax, -24(%rbp)
	leaq	buf(%rip), %rax
	movq	%rax, %rdi
	call	strlen@PLT
	leaq	-1(%rax), %rdx
	leaq	buf(%rip), %rax
	movzbl	(%rdx,%rax), %eax
	movsbl	%al, %eax
	subl	$97, %eax
	movl	%eax, -20(%rbp)
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	s(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	jne	.L14
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	e(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	jne	.L14
	movl	-24(%rbp), %eax
	movl	%eax, %edi
	call	make_set
.L14:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	s(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	jne	.L15
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	e(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	jne	.L15
	movl	-20(%rbp), %eax
	movl	%eax, %edi
	call	make_set
.L15:
	movl	-24(%rbp), %eax
	movl	%eax, %edi
	call	find_set
	movl	%eax, %ebx
	movl	-20(%rbp), %eax
	movl	%eax, %edi
	call	find_set
	cmpl	%eax, %ebx
	je	.L16
	movl	-20(%rbp), %edx
	movl	-24(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	union_set
.L16:
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	s(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	1(%rax), %ecx
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	s(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	e(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	1(%rax), %ecx
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	e(%rip), %rax
	movl	%ecx, (%rdx,%rax)
.L13:
	movl	-32(%rbp), %eax
	leal	-1(%rax), %edx
	movl	%edx, -32(%rbp)
	testl	%eax, %eax
	jg	.L17
	movl	$-1, -28(%rbp)
	movl	$0, -32(%rbp)
	jmp	.L18
.L24:
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	s(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	jne	.L19
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	e(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	je	.L20
.L19:
	cmpl	$0, -28(%rbp)
	jns	.L21
	movl	-32(%rbp), %eax
	movl	%eax, %edi
	call	find_set
	movl	%eax, -28(%rbp)
	jmp	.L20
.L21:
	movl	-32(%rbp), %eax
	movl	%eax, %edi
	call	find_set
	cmpl	%eax, -28(%rbp)
	jne	.L31
.L20:
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	s(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	e(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jne	.L32
	addl	$1, -32(%rbp)
.L18:
	cmpl	$25, -32(%rbp)
	jle	.L24
	jmp	.L22
.L31:
	nop
	jmp	.L22
.L32:
	nop
.L22:
	cmpl	$25, -32(%rbp)
	jle	.L25
	leaq	.LC0(%rip), %rax
	jmp	.L26
.L25:
	leaq	.LC1(%rip), %rax
.L26:
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L27
.L30:
	nop
	movl	$0, %eax
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE10:
	.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:
