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

```c
// AOJ 1330: Never Wait for Weights
// 2017.12.3 bal4u@uu

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

// <????????????Union Find>
#define MAX 100003

int par[MAX], ws[MAX];

#if 0
void initWeightedUnionFind()
{
	int i;
	for (i = 0; i < n; i++) par[i] = -1;
}
#endif

int find(int x)
{
	int p;
	if (par[x] < 0) return x;
    p = find(par[x]), ws[x] += ws[par[x]];
    return par[x] = p;
}
    
int weight(int x)
{
    find(x); 
    return ws[x];
}
    
int unite(int x, int y, int w)  // x <-(w)- y (x + w = y)
{
	int tmp;

    w += weight(x), w -= weight(y);
    x = find(x), y = find(y);
    if (x == y) return 0;
    if (par[y] < par[x]) // ???????????????????????????????????????????????????.
        tmp = x, x = y, y = tmp, w = -w;
    
    par[x] += par[y], par[y] = x;
    ws[y] = w;
    return 1;
}
    
int same(int x, int y)
{
	return find(x) == find(y);
}

// *ans = x - y. ?????????????????? return 0.
int diff(int *ans, int x, int y)
{
    if (find(x) != find(y)) return 0;
	*ans = ws[x] - ws[y];
	return 1;
}
// </????????????Union Find>

char buf[40], *p;
int getint()
{
	int n = 0;
	while (*p >= '0') n = (n<<3) + (n<<1) + (*p++ & 0xf);
	p++;
	return n;
}

int main()
{
	int n, m, q, a, b;

	while (fgets(p=buf, 40, stdin) && *p != '0') {
		n = getint(), m = getint();
		memset(par, 0xff, (n+1)*sizeof(int));
		memset(ws, 0, (n+1)*sizeof(int));
		while (m--) {
			fgets(p=buf, 40, stdin);
			q = *p, p += 2, a = getint(), b = getint();
			if (q == '!') unite(b, a, getint());
			else {
				if (find(a) != find(b)) puts("UNKNOWN");
				else printf("%d\n", ws[a] - ws[b]);
			}
		}
	}
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	par
	.bss
	.align 32
	.type	par, @object
	.size	par, 400012
par:
	.zero	400012
	.globl	ws
	.align 32
	.type	ws, @object
	.size	ws, 400012
ws:
	.zero	400012
	.text
	.globl	find
	.type	find, @function
find:
.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	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	par(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	jns	.L2
	movl	-20(%rbp), %eax
	jmp	.L3
.L2:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	par(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, %edi
	call	find
	movl	%eax, -4(%rbp)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	ws(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	par(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	ws(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, %ecx
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	ws(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	par(%rip), %rdx
	movl	-4(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	par(%rip), %rax
	movl	(%rdx,%rax), %eax
.L3:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	find, .-find
	.globl	weight
	.type	weight, @function
weight:
.LFB1:
	.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
	movl	%eax, %edi
	call	find
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	ws(%rip), %rax
	movl	(%rdx,%rax), %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	weight, .-weight
	.globl	unite
	.type	unite, @function
unite:
.LFB2:
	.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)
	movl	%edx, -28(%rbp)
	movl	-20(%rbp), %eax
	movl	%eax, %edi
	call	weight
	addl	%eax, -28(%rbp)
	movl	-24(%rbp), %eax
	movl	%eax, %edi
	call	weight
	subl	%eax, -28(%rbp)
	movl	-20(%rbp), %eax
	movl	%eax, %edi
	call	find
	movl	%eax, -20(%rbp)
	movl	-24(%rbp), %eax
	movl	%eax, %edi
	call	find
	movl	%eax, -24(%rbp)
	movl	-20(%rbp), %eax
	cmpl	-24(%rbp), %eax
	jne	.L7
	movl	$0, %eax
	jmp	.L8
.L7:
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	par(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	par(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jge	.L9
	movl	-20(%rbp), %eax
	movl	%eax, -4(%rbp)
	movl	-24(%rbp), %eax
	movl	%eax, -20(%rbp)
	movl	-4(%rbp), %eax
	movl	%eax, -24(%rbp)
	negl	-28(%rbp)
.L9:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	par(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	par(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, %ecx
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	par(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	par(%rip), %rdx
	movl	-20(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	ws(%rip), %rdx
	movl	-28(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	$1, %eax
.L8:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	unite, .-unite
	.globl	same
	.type	same, @function
same:
.LFB3:
	.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	-20(%rbp), %eax
	movl	%eax, %edi
	call	find
	movl	%eax, %ebx
	movl	-24(%rbp), %eax
	movl	%eax, %edi
	call	find
	cmpl	%eax, %ebx
	sete	%al
	movzbl	%al, %eax
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE3:
	.size	same, .-same
	.globl	diff
	.type	diff, @function
diff:
.LFB4:
	.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
	movq	%rdi, -24(%rbp)
	movl	%esi, -28(%rbp)
	movl	%edx, -32(%rbp)
	movl	-28(%rbp), %eax
	movl	%eax, %edi
	call	find
	movl	%eax, %ebx
	movl	-32(%rbp), %eax
	movl	%eax, %edi
	call	find
	cmpl	%eax, %ebx
	je	.L13
	movl	$0, %eax
	jmp	.L14
.L13:
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	ws(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-32(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	ws(%rip), %rdx
	movl	(%rcx,%rdx), %ecx
	subl	%ecx, %eax
	movl	%eax, %edx
	movq	-24(%rbp), %rax
	movl	%edx, (%rax)
	movl	$1, %eax
.L14:
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE4:
	.size	diff, .-diff
	.globl	buf
	.bss
	.align 32
	.type	buf, @object
	.size	buf, 40
buf:
	.zero	40
	.globl	p
	.align 8
	.type	p, @object
	.size	p, 8
p:
	.zero	8
	.text
	.globl	getint
	.type	getint, @function
getint:
.LFB5:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	$0, -4(%rbp)
	jmp	.L16
.L17:
	movl	-4(%rbp), %eax
	leal	0(,%rax,8), %edx
	movl	-4(%rbp), %eax
	addl	%eax, %eax
	leal	(%rdx,%rax), %ecx
	movq	p(%rip), %rax
	leaq	1(%rax), %rdx
	movq	%rdx, p(%rip)
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	andl	$15, %eax
	addl	%ecx, %eax
	movl	%eax, -4(%rbp)
.L16:
	movq	p(%rip), %rax
	movzbl	(%rax), %eax
	cmpb	$47, %al
	jg	.L17
	movq	p(%rip), %rax
	addq	$1, %rax
	movq	%rax, p(%rip)
	movl	-4(%rbp), %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE5:
	.size	getint, .-getint
	.section	.rodata
.LC0:
	.string	"UNKNOWN"
.LC1:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%rbx
	subq	$40, %rsp
	.cfi_offset 3, -24
	jmp	.L20
.L26:
	movl	$0, %eax
	call	getint
	movl	%eax, -32(%rbp)
	movl	$0, %eax
	call	getint
	movl	%eax, -36(%rbp)
	movl	-32(%rbp), %eax
	addl	$1, %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdx
	movl	$255, %esi
	leaq	par(%rip), %rax
	movq	%rax, %rdi
	call	memset@PLT
	movl	-32(%rbp), %eax
	addl	$1, %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdx
	movl	$0, %esi
	leaq	ws(%rip), %rax
	movq	%rax, %rdi
	call	memset@PLT
	jmp	.L21
.L24:
	movq	stdin(%rip), %rdx
	leaq	buf(%rip), %rax
	movq	%rax, p(%rip)
	movq	p(%rip), %rax
	movl	$40, %esi
	movq	%rax, %rdi
	call	fgets@PLT
	movq	p(%rip), %rax
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	movl	%eax, -28(%rbp)
	movq	p(%rip), %rax
	addq	$2, %rax
	movq	%rax, p(%rip)
	movl	$0, %eax
	call	getint
	movl	%eax, -24(%rbp)
	movl	$0, %eax
	call	getint
	movl	%eax, -20(%rbp)
	cmpl	$33, -28(%rbp)
	jne	.L22
	movl	$0, %eax
	call	getint
	movl	%eax, %edx
	movl	-24(%rbp), %ecx
	movl	-20(%rbp), %eax
	movl	%ecx, %esi
	movl	%eax, %edi
	call	unite
	jmp	.L21
.L22:
	movl	-24(%rbp), %eax
	movl	%eax, %edi
	call	find
	movl	%eax, %ebx
	movl	-20(%rbp), %eax
	movl	%eax, %edi
	call	find
	cmpl	%eax, %ebx
	je	.L23
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L21
.L23:
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	ws(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-20(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	ws(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	subl	%edx, %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L21:
	movl	-36(%rbp), %eax
	leal	-1(%rax), %edx
	movl	%edx, -36(%rbp)
	testl	%eax, %eax
	jne	.L24
.L20:
	movq	stdin(%rip), %rdx
	leaq	buf(%rip), %rax
	movq	%rax, p(%rip)
	movq	p(%rip), %rax
	movl	$40, %esi
	movq	%rax, %rdi
	call	fgets@PLT
	testq	%rax, %rax
	je	.L25
	movq	p(%rip), %rax
	movzbl	(%rax), %eax
	cmpb	$48, %al
	jne	.L26
.L25:
	movl	$0, %eax
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```

Only output the optimized assembly code. Do not include any other text. Do not write any comments in the assembly code. Wrap the assembly code in ```assembly``` tags.
user
	.file	"temp.c"
	.text
	.p2align 4
	.globl	find
	.type	find, @function
find:
.LFB35:
	.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
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movslq	%edi, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	par(%rip), %rbx
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	movl	(%rbx,%r12,4), %eax
	testl	%eax, %eax
	js	.L7
	movslq	%eax, %r13
	movslq	%eax, %rdx
	leaq	ws(%rip), %rbp
	movl	(%rbx,%r13,4), %ecx
	testl	%ecx, %ecx
	js	.L3
	movslq	%ecx, %r14
	movl	%ecx, %eax
	movl	(%rbx,%r14,4), %edx
	testl	%edx, %edx
	js	.L4
	movslq	%edx, %r15
	movl	%edx, %eax
	movl	(%rbx,%r15,4), %ecx
	testl	%ecx, %ecx
	js	.L5
	movslq	%ecx, %rdx
	movl	%ecx, %eax
	movl	(%rbx,%rdx,4), %edi
	testl	%edi, %edi
	js	.L6
	movq	%rdx, 8(%rsp)
	call	find
	movq	8(%rsp), %rdx
	movslq	(%rbx,%rdx,4), %rcx
	movl	%eax, (%rbx,%rdx,4)
	movl	0(%rbp,%rcx,4), %ecx
	addl	%ecx, 0(%rbp,%rdx,4)
	movslq	(%rbx,%r15,4), %rdx
.L6:
	movl	%eax, (%rbx,%r15,4)
	movl	0(%rbp,%rdx,4), %edx
	addl	%edx, 0(%rbp,%r15,4)
	movslq	(%rbx,%r14,4), %r15
.L5:
	movl	%eax, (%rbx,%r14,4)
	movl	0(%rbp,%r15,4), %edx
	addl	%edx, 0(%rbp,%r14,4)
	movslq	(%rbx,%r13,4), %r14
.L4:
	movl	0(%rbp,%r14,4), %edx
	movl	%eax, (%rbx,%r13,4)
	addl	%edx, 0(%rbp,%r13,4)
	movslq	(%rbx,%r12,4), %rdx
.L3:
	movl	%eax, (%rbx,%r12,4)
	movl	0(%rbp,%rdx,4), %edx
	addl	%edx, 0(%rbp,%r12,4)
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	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
.L7:
	.cfi_restore_state
	addq	$24, %rsp
	.cfi_def_cfa_offset 56
	movl	%edi, %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
.LFE35:
	.size	find, .-find
	.p2align 4
	.globl	weight
	.type	weight, @function
weight:
.LFB36:
	.cfi_startproc
	endbr64
	leaq	par(%rip), %r10
	movslq	%edi, %rsi
	movl	(%r10,%rsi,4), %edx
	testl	%edx, %edx
	js	.L31
	movslq	%edx, %r9
	movslq	%edx, %rax
	leaq	ws(%rip), %r8
	movl	(%r10,%r9,4), %ecx
	testl	%ecx, %ecx
	js	.L27
	movslq	%ecx, %r11
	movl	%ecx, %edx
	movl	(%r10,%r11,4), %eax
	testl	%eax, %eax
	js	.L28
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movl	%eax, %edx
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	movslq	%eax, %rbx
	subq	$8, %rsp
	.cfi_def_cfa_offset 32
	movl	(%r10,%rbx,4), %ecx
	testl	%ecx, %ecx
	js	.L19
	movslq	%ecx, %rbp
	movl	%ecx, %edx
	movl	(%r10,%rbp,4), %edi
	testl	%edi, %edi
	js	.L20
	call	find
	movl	%eax, %edx
	movslq	(%r10,%rbp,4), %rax
	movl	%edx, (%r10,%rbp,4)
	movl	(%r8,%rax,4), %eax
	addl	%eax, (%r8,%rbp,4)
	movslq	(%r10,%rbx,4), %rbp
.L20:
	movl	%edx, (%r10,%rbx,4)
	movl	(%r8,%rbp,4), %eax
	addl	%eax, (%r8,%rbx,4)
	movslq	(%r10,%r11,4), %rbx
.L19:
	movl	(%r8,%rbx,4), %eax
	movl	%edx, (%r10,%r11,4)
	addl	%eax, (%r8,%r11,4)
	movslq	(%r10,%r9,4), %r11
	movl	%edx, (%r10,%r9,4)
	movl	(%r8,%r11,4), %eax
	addl	%eax, (%r8,%r9,4)
	movslq	(%r10,%rsi,4), %rax
	movl	%edx, (%r10,%rsi,4)
	movl	(%r8,%rax,4), %eax
	addl	(%r8,%rsi,4), %eax
	movl	%eax, (%r8,%rsi,4)
	addq	$8, %rsp
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L28:
	.cfi_restore 3
	.cfi_restore 6
	movl	(%r8,%r11,4), %eax
	movl	%ecx, (%r10,%r9,4)
	addl	%eax, (%r8,%r9,4)
	movslq	(%r10,%rsi,4), %rax
.L27:
	movl	(%r8,%rax,4), %eax
	addl	(%r8,%rsi,4), %eax
	movl	%edx, (%r10,%rsi,4)
	movl	%eax, (%r8,%rsi,4)
	ret
	.p2align 4,,10
	.p2align 3
.L31:
	leaq	ws(%rip), %rax
	movl	(%rax,%rsi,4), %eax
	ret
	.cfi_endproc
.LFE36:
	.size	weight, .-weight
	.p2align 4
	.globl	unite
	.type	unite, @function
unite:
.LFB37:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movslq	%edi, %r11
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	movq	%r11, %r10
	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
	movl	%edx, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movl	%esi, %ebx
	leaq	par(%rip), %rsi
	subq	$8, %rsp
	.cfi_def_cfa_offset 64
	movl	(%rsi,%r11,4), %ecx
	testl	%ecx, %ecx
	js	.L65
	movslq	%ecx, %r9
	movl	(%rsi,%r9,4), %eax
	testl	%eax, %eax
	js	.L36
	movslq	%eax, %r12
	leaq	ws(%rip), %r8
	movl	(%rsi,%r12,4), %edi
	testl	%edi, %edi
	js	.L37
	call	find
	movslq	(%rsi,%r12,4), %rdx
	movl	%eax, (%rsi,%r12,4)
	movl	(%r8,%rdx,4), %edx
	addl	%edx, (%r8,%r12,4)
	movslq	(%rsi,%r9,4), %r12
.L37:
	movl	%eax, (%rsi,%r9,4)
	movslq	(%rsi,%r11,4), %rcx
	movl	(%r8,%r12,4), %edx
	addl	%edx, (%r8,%r9,4)
	movslq	%ebx, %r9
	movl	(%r8,%r11,4), %edx
	addl	(%r8,%rcx,4), %edx
	movl	%eax, (%rsi,%r11,4)
	movl	%edx, (%r8,%r11,4)
	addl	%edx, %ebp
	movl	(%rsi,%r9,4), %edx
	testl	%edx, %edx
	js	.L38
.L35:
	movslq	%edx, %r13
	movl	(%rsi,%r13,4), %eax
	testl	%eax, %eax
	js	.L39
	movslq	%eax, %r12
	movl	%eax, %edx
	movl	(%rsi,%r12,4), %edi
	testl	%edi, %edi
	js	.L40
	call	find
	movl	%eax, %edx
	movslq	(%rsi,%r12,4), %rax
	movl	%edx, (%rsi,%r12,4)
	movl	(%r8,%rax,4), %eax
	addl	%eax, (%r8,%r12,4)
	movslq	(%rsi,%r13,4), %r12
.L40:
	movl	%edx, (%rsi,%r13,4)
	movl	(%r8,%r12,4), %eax
	addl	%eax, (%r8,%r13,4)
	movslq	(%rsi,%r9,4), %rax
	movl	%ebp, %r13d
	movl	(%r8,%r9,4), %r12d
	movl	%edx, (%rsi,%r9,4)
	addl	(%r8,%rax,4), %r12d
	movl	(%rsi,%r11,4), %eax
	movl	%r12d, (%r8,%r9,4)
	subl	%r12d, %r13d
	testl	%eax, %eax
	js	.L41
.L49:
	movslq	%eax, %r14
	movl	%eax, %r10d
	movl	(%rsi,%r14,4), %edx
	testl	%edx, %edx
	js	.L42
	movslq	%edx, %r15
	movl	%edx, %r10d
	movl	(%rsi,%r15,4), %edi
	testl	%edi, %edi
	js	.L43
	call	find
	movl	%eax, %r10d
	movslq	(%rsi,%r15,4), %rax
	movl	%r10d, (%rsi,%r15,4)
	movl	(%r8,%rax,4), %eax
	addl	%eax, (%r8,%r15,4)
	movslq	(%rsi,%r14,4), %r15
.L43:
	movl	%r10d, (%rsi,%r14,4)
	movl	(%r8,%r15,4), %eax
	addl	%eax, (%r8,%r14,4)
	movslq	(%rsi,%r11,4), %r14
.L42:
	movl	(%r8,%r14,4), %eax
	addl	%eax, (%r8,%r11,4)
	movl	%r10d, (%rsi,%r11,4)
	movl	(%rsi,%r9,4), %edx
.L41:
	testl	%edx, %edx
	js	.L44
.L50:
	movslq	%edx, %r11
	movslq	%edx, %rcx
	movl	(%rsi,%r11,4), %eax
	testl	%eax, %eax
	js	.L45
	movslq	%eax, %rbx
	movl	(%rsi,%rbx,4), %edi
	testl	%edi, %edi
	js	.L46
	call	find
	movslq	(%rsi,%rbx,4), %rdx
	movl	%eax, (%rsi,%rbx,4)
	movl	(%r8,%rdx,4), %edx
	addl	%edx, (%r8,%rbx,4)
	movslq	(%rsi,%r11,4), %rbx
.L46:
	movl	%eax, (%rsi,%r11,4)
	movslq	(%rsi,%r9,4), %rcx
	movl	(%r8,%rbx,4), %edx
	addl	%edx, (%r8,%r11,4)
	movl	%eax, %edx
.L45:
	movl	(%r8,%rcx,4), %eax
	addl	%eax, (%r8,%r9,4)
	movl	%edx, %ebx
	movl	%edx, (%rsi,%r9,4)
.L44:
	xorl	%eax, %eax
	cmpl	%r10d, %ebx
	je	.L32
	movslq	%ebx, %r9
	movslq	%r10d, %rcx
	movl	(%rsi,%r9,4), %edx
	movl	(%rsi,%rcx,4), %eax
	cmpl	%eax, %edx
	jge	.L48
	movl	%eax, %ecx
	movl	%r12d, %r13d
	movl	%edx, %eax
	movslq	%r10d, %r9
	movl	%ecx, %edx
	movslq	%ebx, %rcx
	subl	%ebp, %r13d
	movq	%rcx, %r10
.L48:
	addl	%edx, %eax
	movl	%r13d, (%r8,%r9,4)
	movl	%eax, (%rsi,%rcx,4)
	movl	$1, %eax
	movl	%r10d, (%rsi,%r9,4)
.L32:
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	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
.L36:
	.cfi_restore_state
	leaq	ws(%rip), %r8
	movl	(%r8,%r11,4), %eax
	addl	(%r8,%r9,4), %eax
	movslq	%ebx, %r9
	movl	(%rsi,%r9,4), %edx
	movl	%eax, (%r8,%r11,4)
	addl	%eax, %ebp
	testl	%edx, %edx
	jns	.L35
	movl	(%r8,%r9,4), %r12d
	movl	%ebp, %r13d
	movl	%ecx, %eax
	subl	%r12d, %r13d
	jmp	.L49
	.p2align 4,,10
	.p2align 3
.L65:
	movslq	%ebx, %r9
	leaq	ws(%rip), %r8
	movl	(%rsi,%r9,4), %edx
	addl	(%r8,%r11,4), %ebp
	testl	%edx, %edx
	jns	.L35
	movl	(%r8,%r9,4), %r12d
	movl	%ebp, %r13d
	subl	%r12d, %r13d
	jmp	.L44
	.p2align 4,,10
	.p2align 3
.L39:
	movl	%edx, (%rsi,%r9,4)
	movl	(%rsi,%r11,4), %eax
	movl	(%r8,%r9,4), %r12d
	addl	(%r8,%r13,4), %r12d
	movl	%ebp, %r13d
	movl	%r12d, (%r8,%r9,4)
	subl	%r12d, %r13d
	testl	%eax, %eax
	jns	.L49
	jmp	.L50
	.p2align 4,,10
	.p2align 3
.L38:
	movl	(%r8,%r9,4), %r12d
	movl	%ebp, %r13d
	subl	%r12d, %r13d
	testl	%eax, %eax
	jns	.L49
	jmp	.L44
	.cfi_endproc
.LFE37:
	.size	unite, .-unite
	.p2align 4
	.globl	same
	.type	same, @function
same:
.LFB38:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movslq	%edi, %r11
	movl	%esi, %r10d
	leaq	par(%rip), %rsi
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	movq	%r11, %r9
	subq	$8, %rsp
	.cfi_def_cfa_offset 32
	movl	(%rsi,%r11,4), %eax
	testl	%eax, %eax
	js	.L67
	movslq	%eax, %r9
	movslq	%eax, %rdx
	leaq	ws(%rip), %r8
	movl	(%rsi,%r9,4), %ecx
	testl	%ecx, %ecx
	js	.L68
	movslq	%ecx, %rbx
	movl	%ecx, %eax
	movl	(%rsi,%rbx,4), %edx
	testl	%edx, %edx
	js	.L69
	movslq	%edx, %rbp
	movl	%edx, %eax
	movl	(%rsi,%rbp,4), %edi
	testl	%edi, %edi
	js	.L70
	call	find
	movslq	(%rsi,%rbp,4), %rdx
	movl	%eax, (%rsi,%rbp,4)
	movl	(%r8,%rdx,4), %edx
	addl	%edx, (%r8,%rbp,4)
	movslq	(%rsi,%rbx,4), %rbp
.L70:
	movl	%eax, (%rsi,%rbx,4)
	movl	(%r8,%rbp,4), %edx
	addl	%edx, (%r8,%rbx,4)
	movslq	(%rsi,%r9,4), %rbx
.L69:
	movl	(%r8,%rbx,4), %edx
	movl	%eax, (%rsi,%r9,4)
	addl	%edx, (%r8,%r9,4)
	movslq	(%rsi,%r11,4), %rdx
.L68:
	movl	(%r8,%rdx,4), %edx
	addl	%edx, (%r8,%r11,4)
	movl	%eax, %r9d
	movl	%eax, (%rsi,%r11,4)
.L67:
	movslq	%r10d, %r11
	movl	(%rsi,%r11,4), %eax
	testl	%eax, %eax
	js	.L71
	movslq	%eax, %r10
	movslq	%eax, %rdx
	leaq	ws(%rip), %r8
	movl	(%rsi,%r10,4), %ecx
	testl	%ecx, %ecx
	js	.L72
	movslq	%ecx, %rbx
	movl	%ecx, %eax
	movl	(%rsi,%rbx,4), %edx
	testl	%edx, %edx
	js	.L73
	movslq	%edx, %rbp
	movl	%edx, %eax
	movl	(%rsi,%rbp,4), %edi
	testl	%edi, %edi
	js	.L74
	call	find
	movslq	(%rsi,%rbp,4), %rdx
	movl	%eax, (%rsi,%rbp,4)
	movl	(%r8,%rdx,4), %edx
	addl	%edx, (%r8,%rbp,4)
	movslq	(%rsi,%rbx,4), %rbp
.L74:
	movl	%eax, (%rsi,%rbx,4)
	movl	(%r8,%rbp,4), %edx
	addl	%edx, (%r8,%rbx,4)
	movslq	(%rsi,%r10,4), %rbx
.L73:
	movl	(%r8,%rbx,4), %edx
	movl	%eax, (%rsi,%r10,4)
	addl	%edx, (%r8,%r10,4)
	movslq	(%rsi,%r11,4), %rdx
.L72:
	movl	(%r8,%rdx,4), %edx
	addl	%edx, (%r8,%r11,4)
	movl	%eax, %r10d
	movl	%eax, (%rsi,%r11,4)
.L71:
	xorl	%eax, %eax
	cmpl	%r9d, %r10d
	sete	%al
	addq	$8, %rsp
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE38:
	.size	same, .-same
	.p2align 4
	.globl	diff
	.type	diff, @function
diff:
.LFB39:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	leaq	par(%rip), %r8
	movslq	%esi, %r11
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	movq	%rdi, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	movl	%edx, %ebx
	subq	$8, %rsp
	.cfi_def_cfa_offset 48
	movl	(%r8,%r11,4), %r9d
	testl	%r9d, %r9d
	js	.L93
	movslq	%r9d, %r10
	movslq	%r9d, %rax
	leaq	ws(%rip), %rsi
	movl	(%r8,%r10,4), %edx
	testl	%edx, %edx
	js	.L85
	movslq	%edx, %r9
	movl	(%r8,%r9,4), %eax
	testl	%eax, %eax
	js	.L86
	movslq	%eax, %r12
	movl	%eax, %edx
	movl	(%r8,%r12,4), %edi
	testl	%edi, %edi
	js	.L87
	call	find
	movl	%eax, %edx
	movslq	(%r8,%r12,4), %rax
	movl	%edx, (%r8,%r12,4)
	movl	(%rsi,%rax,4), %eax
	addl	%eax, (%rsi,%r12,4)
	movslq	(%r8,%r9,4), %r12
.L87:
	movl	%edx, (%r8,%r9,4)
	movl	(%rsi,%r12,4), %eax
	addl	%eax, (%rsi,%r9,4)
	movslq	(%r8,%r10,4), %r9
.L86:
	movl	(%rsi,%r9,4), %eax
	movl	%edx, (%r8,%r10,4)
	movl	%edx, %r9d
	addl	%eax, (%rsi,%r10,4)
	movslq	(%r8,%r11,4), %rax
.L85:
	movl	(%rsi,%rax,4), %eax
	addl	%eax, (%rsi,%r11,4)
	movl	%r9d, (%r8,%r11,4)
.L84:
	movslq	%ebx, %r10
	movl	(%r8,%r10,4), %eax
	testl	%eax, %eax
	js	.L97
	movslq	%eax, %rbx
	movslq	%eax, %rdx
	leaq	ws(%rip), %rsi
	movl	(%r8,%rbx,4), %ecx
	testl	%ecx, %ecx
	js	.L89
	movslq	%ecx, %r12
	movl	%ecx, %eax
	movl	(%r8,%r12,4), %edx
	testl	%edx, %edx
	js	.L90
	movslq	%edx, %r13
	movl	%edx, %eax
	movl	(%r8,%r13,4), %edi
	testl	%edi, %edi
	js	.L91
	call	find
	movslq	(%r8,%r13,4), %rdx
	movl	%eax, (%r8,%r13,4)
	movl	(%rsi,%rdx,4), %edx
	addl	%edx, (%rsi,%r13,4)
	movslq	(%r8,%r12,4), %r13
.L91:
	movl	%eax, (%r8,%r12,4)
	movl	(%rsi,%r13,4), %edx
	addl	%edx, (%rsi,%r12,4)
	movslq	(%r8,%rbx,4), %r12
.L90:
	movl	(%rsi,%r12,4), %edx
	movl	%eax, (%r8,%rbx,4)
	addl	%edx, (%rsi,%rbx,4)
	movslq	(%r8,%r10,4), %rdx
.L89:
	movl	(%rsi,%rdx,4), %edx
	addl	%edx, (%rsi,%r10,4)
	movl	%eax, (%r8,%r10,4)
.L88:
	xorl	%r8d, %r8d
	cmpl	%r9d, %eax
	jne	.L83
	leaq	ws(%rip), %rdx
	movl	$1, %r8d
	movl	(%rdx,%r11,4), %eax
	subl	(%rdx,%r10,4), %eax
	movl	%eax, 0(%rbp)
.L83:
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	movl	%r8d, %eax
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L97:
	.cfi_restore_state
	movl	%ebx, %eax
	jmp	.L88
	.p2align 4,,10
	.p2align 3
.L93:
	movl	%esi, %r9d
	jmp	.L84
	.cfi_endproc
.LFE39:
	.size	diff, .-diff
	.p2align 4
	.globl	getint
	.type	getint, @function
getint:
.LFB40:
	.cfi_startproc
	endbr64
	movq	p(%rip), %rsi
	cmpb	$47, (%rsi)
	jle	.L106
	leaq	1(%rsi), %rax
	xorl	%r8d, %r8d
	.p2align 4,,10
	.p2align 3
.L105:
	movq	%rax, p(%rip)
	movzbl	-1(%rax), %edx
	movq	%rax, %rsi
	addq	$1, %rax
	leal	(%r8,%r8,4), %ecx
	andl	$15, %edx
	cmpb	$47, -1(%rax)
	leal	(%rdx,%rcx,2), %r8d
	jg	.L105
	addq	$1, %rsi
	movl	%r8d, %eax
	movq	%rsi, p(%rip)
	ret
	.p2align 4,,10
	.p2align 3
.L106:
	xorl	%r8d, %r8d
	addq	$1, %rsi
	movq	%rsi, p(%rip)
	movl	%r8d, %eax
	ret
	.cfi_endproc
.LFE40:
	.size	getint, .-getint
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"UNKNOWN"
.LC1:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB41:
	.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	buf(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	leaq	ws(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	leaq	par(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	.p2align 4,,10
	.p2align 3
.L109:
	movq	stdin(%rip), %rdx
	movl	$40, %esi
	movq	%r13, %rdi
	movq	%r13, p(%rip)
	call	fgets@PLT
	testq	%rax, %rax
	je	.L158
	movq	p(%rip), %rax
	movzbl	(%rax), %esi
	cmpb	$48, %sil
	je	.L158
	leaq	1(%rax), %rcx
	xorl	%edx, %edx
	movl	$4, %r14d
	cmpb	$47, %sil
	jle	.L140
	.p2align 4,,10
	.p2align 3
.L110:
	movq	%rcx, p(%rip)
	leal	(%rdx,%rdx,4), %esi
	movzbl	-1(%rcx), %edx
	movq	%rcx, %rax
	leaq	1(%rcx), %rcx
	andl	$15, %edx
	cmpb	$47, (%rax)
	leal	(%rdx,%rsi,2), %edx
	jg	.L110
	leal	1(%rdx), %r14d
	movslq	%r14d, %r14
	salq	$2, %r14
.L140:
	leaq	1(%rax), %rdx
	movq	%rdx, p(%rip)
	cmpb	$47, 1(%rax)
	jle	.L111
	addq	$2, %rax
	xorl	%ebx, %ebx
	.p2align 4,,10
	.p2align 3
.L112:
	movq	%rax, p(%rip)
	movzbl	-1(%rax), %edx
	addq	$1, %rax
	leal	(%rbx,%rbx,4), %ecx
	andl	$15, %edx
	cmpb	$47, -1(%rax)
	leal	(%rdx,%rcx,2), %ebx
	jg	.L112
	movl	$400012, %ecx
	movq	%r14, %rdx
	movl	$255, %esi
	movq	%rbp, %rdi
	call	__memset_chk@PLT
	xorl	%esi, %esi
	movl	$400012, %ecx
	movq	%r14, %rdx
	movq	%r12, %rdi
	call	__memset_chk@PLT
	testl	%ebx, %ebx
	je	.L109
	leaq	.LC0(%rip), %r15
	.p2align 4,,10
	.p2align 3
.L136:
	movq	stdin(%rip), %rdx
	movl	$40, %esi
	movq	%r13, %rdi
	movq	%r13, p(%rip)
	call	fgets@PLT
	movq	p(%rip), %rdx
	leaq	2(%rdx), %rax
	movzbl	(%rdx), %esi
	movq	%rax, p(%rip)
	cmpb	$47, 2(%rdx)
	jle	.L141
	addq	$3, %rdx
	xorl	%r8d, %r8d
	.p2align 4,,10
	.p2align 3
.L116:
	movq	%rdx, p(%rip)
	movzbl	-1(%rdx), %ecx
	movq	%rdx, %rax
	addq	$1, %rdx
	leal	(%r8,%r8,4), %edi
	andl	$15, %ecx
	cmpb	$47, -1(%rdx)
	leal	(%rcx,%rdi,2), %r8d
	jg	.L116
.L115:
	leaq	1(%rax), %rcx
	movq	%rcx, p(%rip)
	cmpb	$47, 1(%rax)
	jle	.L142
	addq	$2, %rax
	xorl	%r10d, %r10d
	.p2align 4,,10
	.p2align 3
.L118:
	movq	%rax, p(%rip)
	movzbl	-1(%rax), %edx
	movq	%rax, %rcx
	addq	$1, %rax
	leal	(%r10,%r10,4), %edi
	andl	$15, %edx
	cmpb	$47, -1(%rax)
	leal	(%rdx,%rdi,2), %r10d
	jg	.L118
.L117:
	leaq	1(%rcx), %rax
	movq	%rax, p(%rip)
	cmpb	$33, %sil
	je	.L172
	movslq	%r8d, %r9
	movl	0(%rbp,%r9,4), %esi
	testl	%esi, %esi
	js	.L144
	movslq	%esi, %r8
	movslq	%esi, %rax
	movl	0(%rbp,%r8,4), %edx
	testl	%edx, %edx
	js	.L124
	movslq	%edx, %rsi
	movl	0(%rbp,%rsi,4), %eax
	testl	%eax, %eax
	js	.L125
	movslq	%eax, %r11
	movl	%eax, %edx
	movl	0(%rbp,%r11,4), %ecx
	testl	%ecx, %ecx
	js	.L126
	movslq	%ecx, %r14
	movl	%ecx, %edx
	movl	0(%rbp,%r14,4), %eax
	testl	%eax, %eax
	js	.L127
	movslq	%eax, %rcx
	movl	%eax, %edx
	movl	0(%rbp,%rcx,4), %edi
	testl	%edi, %edi
	js	.L128
	movq	%rcx, (%rsp)
	call	find
	movq	(%rsp), %rcx
	movl	%eax, %edx
	movslq	0(%rbp,%rcx,4), %rax
	movl	%edx, 0(%rbp,%rcx,4)
	movl	(%r12,%rax,4), %eax
	addl	%eax, (%r12,%rcx,4)
	movslq	0(%rbp,%r14,4), %rcx
.L128:
	movl	%edx, 0(%rbp,%r14,4)
	movl	(%r12,%rcx,4), %eax
	addl	%eax, (%r12,%r14,4)
	movslq	0(%rbp,%r11,4), %r14
.L127:
	movl	%edx, 0(%rbp,%r11,4)
	movl	(%r12,%r14,4), %eax
	addl	%eax, (%r12,%r11,4)
	movslq	0(%rbp,%rsi,4), %r11
.L126:
	movl	%edx, 0(%rbp,%rsi,4)
	movl	(%r12,%r11,4), %eax
	addl	%eax, (%r12,%rsi,4)
	movslq	0(%rbp,%r8,4), %rsi
.L125:
	movl	(%r12,%rsi,4), %eax
	movl	%edx, 0(%rbp,%r8,4)
	movl	%edx, %esi
	addl	%eax, (%r12,%r8,4)
	movslq	0(%rbp,%r9,4), %rax
.L124:
	movl	(%r12,%rax,4), %eax
	addl	%eax, (%r12,%r9,4)
	movl	%esi, 0(%rbp,%r9,4)
.L123:
	movslq	%r10d, %r8
	movl	0(%rbp,%r8,4), %eax
	testl	%eax, %eax
	js	.L150
	movslq	%eax, %r10
	movslq	%eax, %rdx
	movl	0(%rbp,%r10,4), %ecx
	testl	%ecx, %ecx
	js	.L130
	movslq	%ecx, %r11
	movl	%ecx, %eax
	movl	0(%rbp,%r11,4), %edx
	testl	%edx, %edx
	js	.L131
	movslq	%edx, %r14
	movl	%edx, %eax
	movl	0(%rbp,%r14,4), %ecx
	testl	%ecx, %ecx
	js	.L132
	movslq	%ecx, %rdx
	movl	%ecx, %eax
	movl	0(%rbp,%rdx,4), %edi
	testl	%edi, %edi
	js	.L133
	movslq	%edi, %rcx
	movl	0(%rbp,%rcx,4), %eax
	movl	%eax, (%rsp)
	movl	%edi, %eax
	movl	(%rsp), %edi
	testl	%edi, %edi
	js	.L134
	movq	%rcx, 8(%rsp)
	movq	%rdx, (%rsp)
	call	find
	movq	8(%rsp), %rcx
	movq	(%rsp), %rdx
	movslq	0(%rbp,%rcx,4), %rdi
	movl	%eax, 0(%rbp,%rcx,4)
	movl	(%r12,%rdi,4), %edi
	addl	%edi, (%r12,%rcx,4)
	movslq	0(%rbp,%rdx,4), %rcx
.L134:
	movl	%eax, 0(%rbp,%rdx,4)
	movl	(%r12,%rcx,4), %ecx
	addl	%ecx, (%r12,%rdx,4)
	movslq	0(%rbp,%r14,4), %rdx
.L133:
	movl	%eax, 0(%rbp,%r14,4)
	movl	(%r12,%rdx,4), %edx
	addl	%edx, (%r12,%r14,4)
	movslq	0(%rbp,%r11,4), %r14
.L132:
	movl	%eax, 0(%rbp,%r11,4)
	movl	(%r12,%r14,4), %edx
	addl	%edx, (%r12,%r11,4)
	movslq	0(%rbp,%r10,4), %r11
.L131:
	movl	(%r12,%r11,4), %edx
	movl	%eax, 0(%rbp,%r10,4)
	addl	%edx, (%r12,%r10,4)
	movslq	0(%rbp,%r8,4), %rdx
.L130:
	movl	(%r12,%rdx,4), %edx
	movl	%eax, 0(%rbp,%r8,4)
	addl	%edx, (%r12,%r8,4)
	cmpl	%esi, %eax
	je	.L135
.L173:
	movq	%r15, %rdi
	call	puts@PLT
.L122:
	subl	$1, %ebx
	jne	.L136
	jmp	.L109
	.p2align 4,,10
	.p2align 3
.L150:
	movl	%r10d, %eax
	cmpl	%esi, %eax
	jne	.L173
.L135:
	movl	(%r12,%r9,4), %edx
	leaq	.LC1(%rip), %rsi
	subl	(%r12,%r8,4), %edx
	xorl	%eax, %eax
	movl	$1, %edi
	call	__printf_chk@PLT
	jmp	.L122
	.p2align 4,,10
	.p2align 3
.L144:
	movl	%r8d, %esi
	jmp	.L123
	.p2align 4,,10
	.p2align 3
.L172:
	cmpb	$47, 1(%rcx)
	jle	.L143
	addq	$2, %rcx
	xorl	%edx, %edx
	.p2align 4,,10
	.p2align 3
.L121:
	movq	%rcx, p(%rip)
	movzbl	-1(%rcx), %eax
	addq	$1, %rcx
	leal	(%rdx,%rdx,4), %edx
	andl	$15, %eax
	cmpb	$47, -1(%rcx)
	leal	(%rax,%rdx,2), %edx
	jg	.L121
	movl	%r8d, %esi
	movl	%r10d, %edi
	call	unite
	jmp	.L122
	.p2align 4,,10
	.p2align 3
.L142:
	xorl	%r10d, %r10d
	jmp	.L117
	.p2align 4,,10
	.p2align 3
.L141:
	xorl	%r8d, %r8d
	jmp	.L115
.L143:
	xorl	%edx, %edx
	movl	%r8d, %esi
	movl	%r10d, %edi
	call	unite
	jmp	.L122
.L158:
	addq	$24, %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
.L111:
	.cfi_restore_state
	movq	%r14, %rdx
	movq	%rbp, %rdi
	movl	$400012, %ecx
	movl	$255, %esi
	call	__memset_chk@PLT
	movl	$400012, %ecx
	movq	%r14, %rdx
	xorl	%esi, %esi
	movq	%r12, %rdi
	call	__memset_chk@PLT
	jmp	.L109
	.cfi_endproc
.LFE41:
	.size	main, .-main
	.globl	p
	.bss
	.align 8
	.type	p, @object
	.size	p, 8
p:
	.zero	8
	.globl	buf
	.align 32
	.type	buf, @object
	.size	buf, 40
buf:
	.zero	40
	.globl	ws
	.align 32
	.type	ws, @object
	.size	ws, 400012
ws:
	.zero	400012
	.globl	par
	.align 32
	.type	par, @object
	.size	par, 400012
par:
	.zero	400012
	.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	find
	.type	find, @function
find:
.LFB35:
	.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
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movslq	%edi, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	par(%rip), %rbx
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	movl	(%rbx,%r12,4), %eax
	testl	%eax, %eax
	js	.L7
	movslq	%eax, %r13
	movslq	%eax, %rdx
	leaq	ws(%rip), %rbp
	movl	(%rbx,%r13,4), %ecx
	testl	%ecx, %ecx
	js	.L3
	movslq	%ecx, %r14
	movl	%ecx, %eax
	movl	(%rbx,%r14,4), %edx
	testl	%edx, %edx
	js	.L4
	movslq	%edx, %r15
	movl	%edx, %eax
	movl	(%rbx,%r15,4), %ecx
	testl	%ecx, %ecx
	js	.L5
	movslq	%ecx, %rdx
	movl	%ecx, %eax
	movl	(%rbx,%rdx,4), %edi
	testl	%edi, %edi
	js	.L6
	movq	%rdx, 8(%rsp)
	call	find
	movq	8(%rsp), %rdx
	movslq	(%rbx,%rdx,4), %rcx
	movl	%eax, (%rbx,%rdx,4)
	movl	0(%rbp,%rcx,4), %ecx
	addl	%ecx, 0(%rbp,%rdx,4)
	movslq	(%rbx,%r15,4), %rdx
.L6:
	movl	%eax, (%rbx,%r15,4)
	movl	0(%rbp,%rdx,4), %edx
	addl	%edx, 0(%rbp,%r15,4)
	movslq	(%rbx,%r14,4), %r15
.L5:
	movl	%eax, (%rbx,%r14,4)
	movl	0(%rbp,%r15,4), %edx
	addl	%edx, 0(%rbp,%r14,4)
	movslq	(%rbx,%r13,4), %r14
.L4:
	movl	0(%rbp,%r14,4), %edx
	movl	%eax, (%rbx,%r13,4)
	addl	%edx, 0(%rbp,%r13,4)
	movslq	(%rbx,%r12,4), %rdx
.L3:
	movl	%eax, (%rbx,%r12,4)
	movl	0(%rbp,%rdx,4), %edx
	addl	%edx, 0(%rbp,%r12,4)
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	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
.L7:
	.cfi_restore_state
	addq	$24, %rsp
	.cfi_def_cfa_offset 56
	movl	%edi, %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
.LFE35:
	.size	find, .-find
	.p2align 4
	.globl	weight
	.type	weight, @function
weight:
.LFB36:
	.cfi_startproc
	endbr64
	leaq	par(%rip), %r10
	movslq	%edi, %rsi
	movl	(%r10,%rsi,4), %edx
	testl	%edx, %edx
	js	.L31
	movslq	%edx, %r9
	movslq	%edx, %rax
	leaq	ws(%rip), %r8
	movl	(%r10,%r9,4), %ecx
	testl	%ecx, %ecx
	js	.L27
	movslq	%ecx, %r11
	movl	%ecx, %edx
	movl	(%r10,%r11,4), %eax
	testl	%eax, %eax
	js	.L28
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movl	%eax, %edx
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	movslq	%eax, %rbx
	subq	$8, %rsp
	.cfi_def_cfa_offset 32
	movl	(%r10,%rbx,4), %ecx
	testl	%ecx, %ecx
	js	.L19
	movslq	%ecx, %rbp
	movl	%ecx, %edx
	movl	(%r10,%rbp,4), %edi
	testl	%edi, %edi
	js	.L20
	call	find
	movl	%eax, %edx
	movslq	(%r10,%rbp,4), %rax
	movl	%edx, (%r10,%rbp,4)
	movl	(%r8,%rax,4), %eax
	addl	%eax, (%r8,%rbp,4)
	movslq	(%r10,%rbx,4), %rbp
.L20:
	movl	%edx, (%r10,%rbx,4)
	movl	(%r8,%rbp,4), %eax
	addl	%eax, (%r8,%rbx,4)
	movslq	(%r10,%r11,4), %rbx
.L19:
	movl	(%r8,%rbx,4), %eax
	movl	%edx, (%r10,%r11,4)
	addl	%eax, (%r8,%r11,4)
	movslq	(%r10,%r9,4), %r11
	movl	%edx, (%r10,%r9,4)
	movl	(%r8,%r11,4), %eax
	addl	%eax, (%r8,%r9,4)
	movslq	(%r10,%rsi,4), %rax
	movl	%edx, (%r10,%rsi,4)
	movl	(%r8,%rax,4), %eax
	addl	(%r8,%rsi,4), %eax
	movl	%eax, (%r8,%rsi,4)
	addq	$8, %rsp
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L28:
	.cfi_restore 3
	.cfi_restore 6
	movl	(%r8,%r11,4), %eax
	movl	%ecx, (%r10,%r9,4)
	addl	%eax, (%r8,%r9,4)
	movslq	(%r10,%rsi,4), %rax
.L27:
	movl	(%r8,%rax,4), %eax
	addl	(%r8,%rsi,4), %eax
	movl	%edx, (%r10,%rsi,4)
	movl	%eax, (%r8,%rsi,4)
	ret
	.p2align 4,,10
	.p2align 3
.L31:
	leaq	ws(%rip), %rax
	movl	(%rax,%rsi,4), %eax
	ret
	.cfi_endproc
.LFE36:
	.size	weight, .-weight
	.p2align 4
	.globl	unite
	.type	unite, @function
unite:
.LFB37:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movslq	%edi, %r11
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	movq	%r11, %r10
	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
	movl	%edx, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movl	%esi, %ebx
	leaq	par(%rip), %rsi
	subq	$8, %rsp
	.cfi_def_cfa_offset 64
	movl	(%rsi,%r11,4), %ecx
	testl	%ecx, %ecx
	js	.L65
	movslq	%ecx, %r9
	movl	(%rsi,%r9,4), %eax
	testl	%eax, %eax
	js	.L36
	movslq	%eax, %r12
	leaq	ws(%rip), %r8
	movl	(%rsi,%r12,4), %edi
	testl	%edi, %edi
	js	.L37
	call	find
	movslq	(%rsi,%r12,4), %rdx
	movl	%eax, (%rsi,%r12,4)
	movl	(%r8,%rdx,4), %edx
	addl	%edx, (%r8,%r12,4)
	movslq	(%rsi,%r9,4), %r12
.L37:
	movl	%eax, (%rsi,%r9,4)
	movslq	(%rsi,%r11,4), %rcx
	movl	(%r8,%r12,4), %edx
	addl	%edx, (%r8,%r9,4)
	movslq	%ebx, %r9
	movl	(%r8,%r11,4), %edx
	addl	(%r8,%rcx,4), %edx
	movl	%eax, (%rsi,%r11,4)
	movl	%edx, (%r8,%r11,4)
	addl	%edx, %ebp
	movl	(%rsi,%r9,4), %edx
	testl	%edx, %edx
	js	.L38
.L35:
	movslq	%edx, %r13
	movl	(%rsi,%r13,4), %eax
	testl	%eax, %eax
	js	.L39
	movslq	%eax, %r12
	movl	%eax, %edx
	movl	(%rsi,%r12,4), %edi
	testl	%edi, %edi
	js	.L40
	call	find
	movl	%eax, %edx
	movslq	(%rsi,%r12,4), %rax
	movl	%edx, (%rsi,%r12,4)
	movl	(%r8,%rax,4), %eax
	addl	%eax, (%r8,%r12,4)
	movslq	(%rsi,%r13,4), %r12
.L40:
	movl	%edx, (%rsi,%r13,4)
	movl	(%r8,%r12,4), %eax
	addl	%eax, (%r8,%r13,4)
	movslq	(%rsi,%r9,4), %rax
	movl	%ebp, %r13d
	movl	(%r8,%r9,4), %r12d
	movl	%edx, (%rsi,%r9,4)
	addl	(%r8,%rax,4), %r12d
	movl	(%rsi,%r11,4), %eax
	movl	%r12d, (%r8,%r9,4)
	subl	%r12d, %r13d
	testl	%eax, %eax
	js	.L41
.L49:
	movslq	%eax, %r14
	movl	%eax, %r10d
	movl	(%rsi,%r14,4), %edx
	testl	%edx, %edx
	js	.L42
	movslq	%edx, %r15
	movl	%edx, %r10d
	movl	(%rsi,%r15,4), %edi
	testl	%edi, %edi
	js	.L43
	call	find
	movl	%eax, %r10d
	movslq	(%rsi,%r15,4), %rax
	movl	%r10d, (%rsi,%r15,4)
	movl	(%r8,%rax,4), %eax
	addl	%eax, (%r8,%r15,4)
	movslq	(%rsi,%r14,4), %r15
.L43:
	movl	%r10d, (%rsi,%r14,4)
	movl	(%r8,%r15,4), %eax
	addl	%eax, (%r8,%r14,4)
	movslq	(%rsi,%r11,4), %r14
.L42:
	movl	(%r8,%r14,4), %eax
	addl	%eax, (%r8,%r11,4)
	movl	%r10d, (%rsi,%r11,4)
	movl	(%rsi,%r9,4), %edx
.L41:
	testl	%edx, %edx
	js	.L44
.L50:
	movslq	%edx, %r11
	movslq	%edx, %rcx
	movl	(%rsi,%r11,4), %eax
	testl	%eax, %eax
	js	.L45
	movslq	%eax, %rbx
	movl	(%rsi,%rbx,4), %edi
	testl	%edi, %edi
	js	.L46
	call	find
	movslq	(%rsi,%rbx,4), %rdx
	movl	%eax, (%rsi,%rbx,4)
	movl	(%r8,%rdx,4), %edx
	addl	%edx, (%r8,%rbx,4)
	movslq	(%rsi,%r11,4), %rbx
.L46:
	movl	%eax, (%rsi,%r11,4)
	movslq	(%rsi,%r9,4), %rcx
	movl	(%r8,%rbx,4), %edx
	addl	%edx, (%r8,%r11,4)
	movl	%eax, %edx
.L45:
	movl	(%r8,%rcx,4), %eax
	addl	%eax, (%r8,%r9,4)
	movl	%edx, %ebx
	movl	%edx, (%rsi,%r9,4)
.L44:
	xorl	%eax, %eax
	cmpl	%r10d, %ebx
	je	.L32
	movslq	%ebx, %r9
	movslq	%r10d, %rcx
	movl	(%rsi,%r9,4), %edx
	movl	(%rsi,%rcx,4), %eax
	cmpl	%eax, %edx
	jge	.L48
	movl	%eax, %ecx
	movl	%r12d, %r13d
	movl	%edx, %eax
	movslq	%r10d, %r9
	movl	%ecx, %edx
	movslq	%ebx, %rcx
	subl	%ebp, %r13d
	movq	%rcx, %r10
.L48:
	addl	%edx, %eax
	movl	%r13d, (%r8,%r9,4)
	movl	%eax, (%rsi,%rcx,4)
	movl	$1, %eax
	movl	%r10d, (%rsi,%r9,4)
.L32:
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	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
.L36:
	.cfi_restore_state
	leaq	ws(%rip), %r8
	movl	(%r8,%r11,4), %eax
	addl	(%r8,%r9,4), %eax
	movslq	%ebx, %r9
	movl	(%rsi,%r9,4), %edx
	movl	%eax, (%r8,%r11,4)
	addl	%eax, %ebp
	testl	%edx, %edx
	jns	.L35
	movl	(%r8,%r9,4), %r12d
	movl	%ebp, %r13d
	movl	%ecx, %eax
	subl	%r12d, %r13d
	jmp	.L49
	.p2align 4,,10
	.p2align 3
.L65:
	movslq	%ebx, %r9
	leaq	ws(%rip), %r8
	movl	(%rsi,%r9,4), %edx
	addl	(%r8,%r11,4), %ebp
	testl	%edx, %edx
	jns	.L35
	movl	(%r8,%r9,4), %r12d
	movl	%ebp, %r13d
	subl	%r12d, %r13d
	jmp	.L44
	.p2align 4,,10
	.p2align 3
.L39:
	movl	%edx, (%rsi,%r9,4)
	movl	(%rsi,%r11,4), %eax
	movl	(%r8,%r9,4), %r12d
	addl	(%r8,%r13,4), %r12d
	movl	%ebp, %r13d
	movl	%r12d, (%r8,%r9,4)
	subl	%r12d, %r13d
	testl	%eax, %eax
	jns	.L49
	jmp	.L50
	.p2align 4,,10
	.p2align 3
.L38:
	movl	(%r8,%r9,4), %r12d
	movl	%ebp, %r13d
	subl	%r12d, %r13d
	testl	%eax, %eax
	jns	.L49
	jmp	.L44
	.cfi_endproc
.LFE37:
	.size	unite, .-unite
	.p2align 4
	.globl	same
	.type	same, @function
same:
.LFB38:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movslq	%edi, %r11
	movl	%esi, %r10d
	leaq	par(%rip), %rsi
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	movq	%r11, %r9
	subq	$8, %rsp
	.cfi_def_cfa_offset 32
	movl	(%rsi,%r11,4), %eax
	testl	%eax, %eax
	js	.L67
	movslq	%eax, %r9
	movslq	%eax, %rdx
	leaq	ws(%rip), %r8
	movl	(%rsi,%r9,4), %ecx
	testl	%ecx, %ecx
	js	.L68
	movslq	%ecx, %rbx
	movl	%ecx, %eax
	movl	(%rsi,%rbx,4), %edx
	testl	%edx, %edx
	js	.L69
	movslq	%edx, %rbp
	movl	%edx, %eax
	movl	(%rsi,%rbp,4), %edi
	testl	%edi, %edi
	js	.L70
	call	find
	movslq	(%rsi,%rbp,4), %rdx
	movl	%eax, (%rsi,%rbp,4)
	movl	(%r8,%rdx,4), %edx
	addl	%edx, (%r8,%rbp,4)
	movslq	(%rsi,%rbx,4), %rbp
.L70:
	movl	%eax, (%rsi,%rbx,4)
	movl	(%r8,%rbp,4), %edx
	addl	%edx, (%r8,%rbx,4)
	movslq	(%rsi,%r9,4), %rbx
.L69:
	movl	(%r8,%rbx,4), %edx
	movl	%eax, (%rsi,%r9,4)
	addl	%edx, (%r8,%r9,4)
	movslq	(%rsi,%r11,4), %rdx
.L68:
	movl	(%r8,%rdx,4), %edx
	addl	%edx, (%r8,%r11,4)
	movl	%eax, %r9d
	movl	%eax, (%rsi,%r11,4)
.L67:
	movslq	%r10d, %r11
	movl	(%rsi,%r11,4), %eax
	testl	%eax, %eax
	js	.L71
	movslq	%eax, %r10
	movslq	%eax, %rdx
	leaq	ws(%rip), %r8
	movl	(%rsi,%r10,4), %ecx
	testl	%ecx, %ecx
	js	.L72
	movslq	%ecx, %rbx
	movl	%ecx, %eax
	movl	(%rsi,%rbx,4), %edx
	testl	%edx, %edx
	js	.L73
	movslq	%edx, %rbp
	movl	%edx, %eax
	movl	(%rsi,%rbp,4), %edi
	testl	%edi, %edi
	js	.L74
	call	find
	movslq	(%rsi,%rbp,4), %rdx
	movl	%eax, (%rsi,%rbp,4)
	movl	(%r8,%rdx,4), %edx
	addl	%edx, (%r8,%rbp,4)
	movslq	(%rsi,%rbx,4), %rbp
.L74:
	movl	%eax, (%rsi,%rbx,4)
	movl	(%r8,%rbp,4), %edx
	addl	%edx, (%r8,%rbx,4)
	movslq	(%rsi,%r10,4), %rbx
.L73:
	movl	(%r8,%rbx,4), %edx
	movl	%eax, (%rsi,%r10,4)
	addl	%edx, (%r8,%r10,4)
	movslq	(%rsi,%r11,4), %rdx
.L72:
	movl	(%r8,%rdx,4), %edx
	addl	%edx, (%r8,%r11,4)
	movl	%eax, %r10d
	movl	%eax, (%rsi,%r11,4)
.L71:
	xorl	%eax, %eax
	cmpl	%r9d, %r10d
	sete	%al
	addq	$8, %rsp
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE38:
	.size	same, .-same
	.p2align 4
	.globl	diff
	.type	diff, @function
diff:
.LFB39:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	leaq	par(%rip), %r8
	movslq	%esi, %r11
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	movq	%rdi, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	movl	%edx, %ebx
	subq	$8, %rsp
	.cfi_def_cfa_offset 48
	movl	(%r8,%r11,4), %r9d
	testl	%r9d, %r9d
	js	.L93
	movslq	%r9d, %r10
	movslq	%r9d, %rax
	leaq	ws(%rip), %rsi
	movl	(%r8,%r10,4), %edx
	testl	%edx, %edx
	js	.L85
	movslq	%edx, %r9
	movl	(%r8,%r9,4), %eax
	testl	%eax, %eax
	js	.L86
	movslq	%eax, %r12
	movl	%eax, %edx
	movl	(%r8,%r12,4), %edi
	testl	%edi, %edi
	js	.L87
	call	find
	movl	%eax, %edx
	movslq	(%r8,%r12,4), %rax
	movl	%edx, (%r8,%r12,4)
	movl	(%rsi,%rax,4), %eax
	addl	%eax, (%rsi,%r12,4)
	movslq	(%r8,%r9,4), %r12
.L87:
	movl	%edx, (%r8,%r9,4)
	movl	(%rsi,%r12,4), %eax
	addl	%eax, (%rsi,%r9,4)
	movslq	(%r8,%r10,4), %r9
.L86:
	movl	(%rsi,%r9,4), %eax
	movl	%edx, (%r8,%r10,4)
	movl	%edx, %r9d
	addl	%eax, (%rsi,%r10,4)
	movslq	(%r8,%r11,4), %rax
.L85:
	movl	(%rsi,%rax,4), %eax
	addl	%eax, (%rsi,%r11,4)
	movl	%r9d, (%r8,%r11,4)
.L84:
	movslq	%ebx, %r10
	movl	(%r8,%r10,4), %eax
	testl	%eax, %eax
	js	.L97
	movslq	%eax, %rbx
	movslq	%eax, %rdx
	leaq	ws(%rip), %rsi
	movl	(%r8,%rbx,4), %ecx
	testl	%ecx, %ecx
	js	.L89
	movslq	%ecx, %r12
	movl	%ecx, %eax
	movl	(%r8,%r12,4), %edx
	testl	%edx, %edx
	js	.L90
	movslq	%edx, %r13
	movl	%edx, %eax
	movl	(%r8,%r13,4), %edi
	testl	%edi, %edi
	js	.L91
	call	find
	movslq	(%r8,%r13,4), %rdx
	movl	%eax, (%r8,%r13,4)
	movl	(%rsi,%rdx,4), %edx
	addl	%edx, (%rsi,%r13,4)
	movslq	(%r8,%r12,4), %r13
.L91:
	movl	%eax, (%r8,%r12,4)
	movl	(%rsi,%r13,4), %edx
	addl	%edx, (%rsi,%r12,4)
	movslq	(%r8,%rbx,4), %r12
.L90:
	movl	(%rsi,%r12,4), %edx
	movl	%eax, (%r8,%rbx,4)
	addl	%edx, (%rsi,%rbx,4)
	movslq	(%r8,%r10,4), %rdx
.L89:
	movl	(%rsi,%rdx,4), %edx
	addl	%edx, (%rsi,%r10,4)
	movl	%eax, (%r8,%r10,4)
.L88:
	xorl	%r8d, %r8d
	cmpl	%r9d, %eax
	jne	.L83
	leaq	ws(%rip), %rdx
	movl	$1, %r8d
	movl	(%rdx,%r11,4), %eax
	subl	(%rdx,%r10,4), %eax
	movl	%eax, 0(%rbp)
.L83:
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	movl	%r8d, %eax
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L97:
	.cfi_restore_state
	movl	%ebx, %eax
	jmp	.L88
	.p2align 4,,10
	.p2align 3
.L93:
	movl	%esi, %r9d
	jmp	.L84
	.cfi_endproc
.LFE39:
	.size	diff, .-diff
	.p2align 4
	.globl	getint
	.type	getint, @function
getint:
.LFB40:
	.cfi_startproc
	endbr64
	movq	p(%rip), %rsi
	cmpb	$47, (%rsi)
	jle	.L106
	leaq	1(%rsi), %rax
	xorl	%r8d, %r8d
	.p2align 4,,10
	.p2align 3
.L105:
	movq	%rax, p(%rip)
	movzbl	-1(%rax), %edx
	movq	%rax, %rsi
	addq	$1, %rax
	leal	(%r8,%r8,4), %ecx
	andl	$15, %edx
	cmpb	$47, -1(%rax)
	leal	(%rdx,%rcx,2), %r8d
	jg	.L105
	addq	$1, %rsi
	movl	%r8d, %eax
	movq	%rsi, p(%rip)
	ret
	.p2align 4,,10
	.p2align 3
.L106:
	xorl	%r8d, %r8d
	addq	$1, %rsi
	movq	%rsi, p(%rip)
	movl	%r8d, %eax
	ret
	.cfi_endproc
.LFE40:
	.size	getint, .-getint
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"UNKNOWN"
.LC1:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB41:
	.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	buf(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	leaq	ws(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	leaq	par(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	.p2align 4,,10
	.p2align 3
.L109:
	movq	stdin(%rip), %rdx
	movl	$40, %esi
	movq	%r13, %rdi
	movq	%r13, p(%rip)
	call	fgets@PLT
	testq	%rax, %rax
	je	.L158
	movq	p(%rip), %rax
	movzbl	(%rax), %esi
	cmpb	$48, %sil
	je	.L158
	leaq	1(%rax), %rcx
	xorl	%edx, %edx
	movl	$4, %r14d
	cmpb	$47, %sil
	jle	.L140
	.p2align 4,,10
	.p2align 3
.L110:
	movq	%rcx, p(%rip)
	leal	(%rdx,%rdx,4), %esi
	movzbl	-1(%rcx), %edx
	movq	%rcx, %rax
	leaq	1(%rcx), %rcx
	andl	$15, %edx
	cmpb	$47, (%rax)
	leal	(%rdx,%rsi,2), %edx
	jg	.L110
	leal	1(%rdx), %r14d
	movslq	%r14d, %r14
	salq	$2, %r14
.L140:
	leaq	1(%rax), %rdx
	movq	%rdx, p(%rip)
	cmpb	$47, 1(%rax)
	jle	.L111
	addq	$2, %rax
	xorl	%ebx, %ebx
	.p2align 4,,10
	.p2align 3
.L112:
	movq	%rax, p(%rip)
	movzbl	-1(%rax), %edx
	addq	$1, %rax
	leal	(%rbx,%rbx,4), %ecx
	andl	$15, %edx
	cmpb	$47, -1(%rax)
	leal	(%rdx,%rcx,2), %ebx
	jg	.L112
	movl	$400012, %ecx
	movq	%r14, %rdx
	movl	$255, %esi
	movq	%rbp, %rdi
	call	__memset_chk@PLT
	xorl	%esi, %esi
	movl	$400012, %ecx
	movq	%r14, %rdx
	movq	%r12, %rdi
	call	__memset_chk@PLT
	testl	%ebx, %ebx
	je	.L109
	leaq	.LC0(%rip), %r15
	.p2align 4,,10
	.p2align 3
.L136:
	movq	stdin(%rip), %rdx
	movl	$40, %esi
	movq	%r13, %rdi
	movq	%r13, p(%rip)
	call	fgets@PLT
	movq	p(%rip), %rdx
	leaq	2(%rdx), %rax
	movzbl	(%rdx), %esi
	movq	%rax, p(%rip)
	cmpb	$47, 2(%rdx)
	jle	.L141
	addq	$3, %rdx
	xorl	%r8d, %r8d
	.p2align 4,,10
	.p2align 3
.L116:
	movq	%rdx, p(%rip)
	movzbl	-1(%rdx), %ecx
	movq	%rdx, %rax
	addq	$1, %rdx
	leal	(%r8,%r8,4), %edi
	andl	$15, %ecx
	cmpb	$47, -1(%rdx)
	leal	(%rcx,%rdi,2), %r8d
	jg	.L116
.L115:
	leaq	1(%rax), %rcx
	movq	%rcx, p(%rip)
	cmpb	$47, 1(%rax)
	jle	.L142
	addq	$2, %rax
	xorl	%r10d, %r10d
	.p2align 4,,10
	.p2align 3
.L118:
	movq	%rax, p(%rip)
	movzbl	-1(%rax), %edx
	movq	%rax, %rcx
	addq	$1, %rax
	leal	(%r10,%r10,4), %edi
	andl	$15, %edx
	cmpb	$47, -1(%rax)
	leal	(%rdx,%rdi,2), %r10d
	jg	.L118
.L117:
	leaq	1(%rcx), %rax
	movq	%rax, p(%rip)
	cmpb	$33, %sil
	je	.L172
	movslq	%r8d, %r9
	movl	0(%rbp,%r9,4), %esi
	testl	%esi, %esi
	js	.L144
	movslq	%esi, %r8
	movslq	%esi, %rax
	movl	0(%rbp,%r8,4), %edx
	testl	%edx, %edx
	js	.L124
	movslq	%edx, %rsi
	movl	0(%rbp,%rsi,4), %eax
	testl	%eax, %eax
	js	.L125
	movslq	%eax, %r11
	movl	%eax, %edx
	movl	0(%rbp,%r11,4), %ecx
	testl	%ecx, %ecx
	js	.L126
	movslq	%ecx, %r14
	movl	%ecx, %edx
	movl	0(%rbp,%r14,4), %eax
	testl	%eax, %eax
	js	.L127
	movslq	%eax, %rcx
	movl	%eax, %edx
	movl	0(%rbp,%rcx,4), %edi
	testl	%edi, %edi
	js	.L128
	movq	%rcx, (%rsp)
	call	find
	movq	(%rsp), %rcx
	movl	%eax, %edx
	movslq	0(%rbp,%rcx,4), %rax
	movl	%edx, 0(%rbp,%rcx,4)
	movl	(%r12,%rax,4), %eax
	addl	%eax, (%r12,%rcx,4)
	movslq	0(%rbp,%r14,4), %rcx
.L128:
	movl	%edx, 0(%rbp,%r14,4)
	movl	(%r12,%rcx,4), %eax
	addl	%eax, (%r12,%r14,4)
	movslq	0(%rbp,%r11,4), %r14
.L127:
	movl	%edx, 0(%rbp,%r11,4)
	movl	(%r12,%r14,4), %eax
	addl	%eax, (%r12,%r11,4)
	movslq	0(%rbp,%rsi,4), %r11
.L126:
	movl	%edx, 0(%rbp,%rsi,4)
	movl	(%r12,%r11,4), %eax
	addl	%eax, (%r12,%rsi,4)
	movslq	0(%rbp,%r8,4), %rsi
.L125:
	movl	(%r12,%rsi,4), %eax
	movl	%edx, 0(%rbp,%r8,4)
	movl	%edx, %esi
	addl	%eax, (%r12,%r8,4)
	movslq	0(%rbp,%r9,4), %rax
.L124:
	movl	(%r12,%rax,4), %eax
	addl	%eax, (%r12,%r9,4)
	movl	%esi, 0(%rbp,%r9,4)
.L123:
	movslq	%r10d, %r8
	movl	0(%rbp,%r8,4), %eax
	testl	%eax, %eax
	js	.L150
	movslq	%eax, %r10
	movslq	%eax, %rdx
	movl	0(%rbp,%r10,4), %ecx
	testl	%ecx, %ecx
	js	.L130
	movslq	%ecx, %r11
	movl	%ecx, %eax
	movl	0(%rbp,%r11,4), %edx
	testl	%edx, %edx
	js	.L131
	movslq	%edx, %r14
	movl	%edx, %eax
	movl	0(%rbp,%r14,4), %ecx
	testl	%ecx, %ecx
	js	.L132
	movslq	%ecx, %rdx
	movl	%ecx, %eax
	movl	0(%rbp,%rdx,4), %edi
	testl	%edi, %edi
	js	.L133
	movslq	%edi, %rcx
	movl	0(%rbp,%rcx,4), %eax
	movl	%eax, (%rsp)
	movl	%edi, %eax
	movl	(%rsp), %edi
	testl	%edi, %edi
	js	.L134
	movq	%rcx, 8(%rsp)
	movq	%rdx, (%rsp)
	call	find
	movq	8(%rsp), %rcx
	movq	(%rsp), %rdx
	movslq	0(%rbp,%rcx,4), %rdi
	movl	%eax, 0(%rbp,%rcx,4)
	movl	(%r12,%rdi,4), %edi
	addl	%edi, (%r12,%rcx,4)
	movslq	0(%rbp,%rdx,4), %rcx
.L134:
	movl	%eax, 0(%rbp,%rdx,4)
	movl	(%r12,%rcx,4), %ecx
	addl	%ecx, (%r12,%rdx,4)
	movslq	0(%rbp,%r14,4), %rdx
.L133:
	movl	%eax, 0(%rbp,%r14,4)
	movl	(%r12,%rdx,4), %edx
	addl	%edx, (%r12,%r14,4)
	movslq	0(%rbp,%r11,4), %r14
.L132:
	movl	%eax, 0(%rbp,%r11,4)
	movl	(%r12,%r14,4), %edx
	addl	%edx, (%r12,%r11,4)
	movslq	0(%rbp,%r10,4), %r11
.L131:
	movl	(%r12,%r11,4), %edx
	movl	%eax, 0(%rbp,%r10,4)
	addl	%edx, (%r12,%r10,4)
	movslq	0(%rbp,%r8,4), %rdx
.L130:
	movl	(%r12,%rdx,4), %edx
	movl	%eax, 0(%rbp,%r8,4)
	addl	%edx, (%r12,%r8,4)
	cmpl	%esi, %eax
	je	.L135
.L173:
	movq	%r15, %rdi
	call	puts@PLT
.L122:
	subl	$1, %ebx
	jne	.L136
	jmp	.L109
	.p2align 4,,10
	.p2align 3
.L150:
	movl	%r10d, %eax
	cmpl	%esi, %eax
	jne	.L173
.L135:
	movl	(%r12,%r9,4), %edx
	leaq	.LC1(%rip), %rsi
	subl	(%r12,%r8,4), %edx
	xorl	%eax, %eax
	movl	$1, %edi
	call	__printf_chk@PLT
	jmp	.L122
	.p2align 4,,10
	.p2align 3
.L144:
	movl	%r8d, %esi
	jmp	.L123
	.p2align 4,,10
	.p2align 3
.L172:
	cmpb	$47, 1(%rcx)
	jle	.L143
	addq	$2, %rcx
	xorl	%edx, %edx
	.p2align 4,,10
	.p2align 3
.L121:
	movq	%rcx, p(%rip)
	movzbl	-1(%rcx), %eax
	addq	$1, %rcx
	leal	(%rdx,%rdx,4), %edx
	andl	$15, %eax
	cmpb	$47, -1(%rcx)
	leal	(%rax,%rdx,2), %edx
	jg	.L121
	movl	%r8d, %esi
	movl	%r10d, %edi
	call	unite
	jmp	.L122
	.p2align 4,,10
	.p2align 3
.L142:
	xorl	%r10d, %r10d
	jmp	.L117
	.p2align 4,,10
	.p2align 3
.L141:
	xorl	%r8d, %r8d
	jmp	.L115
.L143:
	xorl	%edx, %edx
	movl	%r8d, %esi
	movl	%r10d, %edi
	call	unite
	jmp	.L122
.L158:
	addq	$24, %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
.L111:
	.cfi_restore_state
	movq	%r14, %rdx
	movq	%rbp, %rdi
	movl	$400012, %ecx
	movl	$255, %esi
	call	__memset_chk@PLT
	movl	$400012, %ecx
	movq	%r14, %rdx
	xorl	%esi, %esi
	movq	%r12, %rdi
	call	__memset_chk@PLT
	jmp	.L109
	.cfi_endproc
.LFE41:
	.size	main, .-main
	.globl	p
	.bss
	.align 8
	.type	p, @object
	.size	p, 8
p:
	.zero	8
	.globl	buf
	.align 32
	.type	buf, @object
	.size	buf, 40
buf:
	.zero	40
	.globl	ws
	.align 32
	.type	ws, @object
	.size	ws, 400012
ws:
	.zero	400012
	.globl	par
	.align 32
	.type	par, @object
	.size	par, 400012
par:
	.zero	400012
	.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:

// AOJ 1330: Never Wait for Weights
// 2017.12.3 bal4u@uu

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

// <????????????Union Find>
#define MAX 100003

int par[MAX], ws[MAX];

#if 0
void initWeightedUnionFind()
{
	int i;
	for (i = 0; i < n; i++) par[i] = -1;
}
#endif

int find(int x)
{
	int p;
	if (par[x] < 0) return x;
    p = find(par[x]), ws[x] += ws[par[x]];
    return par[x] = p;
}
    
int weight(int x)
{
    find(x); 
    return ws[x];
}
    
int unite(int x, int y, int w)  // x <-(w)- y (x + w = y)
{
	int tmp;

    w += weight(x), w -= weight(y);
    x = find(x), y = find(y);
    if (x == y) return 0;
    if (par[y] < par[x]) // ???????????????????????????????????????????????????.
        tmp = x, x = y, y = tmp, w = -w;
    
    par[x] += par[y], par[y] = x;
    ws[y] = w;
    return 1;
}
    
int same(int x, int y)
{
	return find(x) == find(y);
}

// *ans = x - y. ?????????????????? return 0.
int diff(int *ans, int x, int y)
{
    if (find(x) != find(y)) return 0;
	*ans = ws[x] - ws[y];
	return 1;
}
// </????????????Union Find>

char buf[40], *p;
int getint()
{
	int n = 0;
	while (*p >= '0') n = (n<<3) + (n<<1) + (*p++ & 0xf);
	p++;
	return n;
}

int main()
{
	int n, m, q, a, b;

	while (fgets(p=buf, 40, stdin) && *p != '0') {
		n = getint(), m = getint();
		memset(par, 0xff, (n+1)*sizeof(int));
		memset(ws, 0, (n+1)*sizeof(int));
		while (m--) {
			fgets(p=buf, 40, stdin);
			q = *p, p += 2, a = getint(), b = getint();
			if (q == '!') unite(b, a, getint());
			else {
				if (find(a) != find(b)) puts("UNKNOWN");
				else printf("%d\n", ws[a] - ws[b]);
			}
		}
	}
	return 0;
}
2 2
! 1 2 1
? 1 2
2 2
! 2 2 1
? 2 1
4 7
! 1 2 100
? 2 3
! 2 3 100
? 2 3
? 1 3
! 4 3 150
? 4 1
0 0
 2 2
! 2 2 1
? 1 2
2 2
! 2 2 1
? 2 1
4 7
! 1 2 100
? 2 3
! 2 3 100
? 2 3
? 1 3
! 4 3 150
? 4 1
0 0
 2 2
! 2 2 1
? 1 2
2 2
! 2 2 1
? 2 1
4 7
! 1 2 100
? 2 3
! 2 3 100
? 2 4
? 1 3
! 4 3 150
? 4 1
0 0
 2 2
! 2 2 1
? 1 2
3 2
! 2 2 1
? 2 1
4 7
! 1 2 100
? 2 3
! 2 3 100
? 2 4
? 2 3
! 4 3 150
? 4 1
0 0
 2 2
! 2 2 1
? 1 2
3 2
! 2 2 1
? 2 1
4 7
! 1 2 101
? 2 3
! 2 3 100
? 2 4
? 2 3
! 4 3 150
? 4 1
0 0
 2 2
! 1 2 1
? 1 2
2 2
! 1 2 1
? 2 1
6 7
! 1 2 100
? 2 3
! 2 3 100
? 2 3
? 1 3
! 4 3 150
? 4 1
0 0
 2 2
! 2 2 1
? 1 2
3 2
! 2 2 1
? 2 1
4 7
! 1 2 101
? 2 3
! 2 3 100
? 2 4
? 2 3
! 3 3 150
? 4 1
0 0
 2 2
! 2 2 1
? 0 2
2 2
! 2 2 1
? 2 1
4 7
! 1 2 100
? 2 3
! 2 3 100
? 1 3
? 1 3
! 4 3 150
? 4 1
0 0
 2 2
! 2 2 1
? 1 2
2 2
! 2 2 1
? 2 1
4 7
! 1 2 100
? 2 3
! 2 3 100
? 2 4
? 1 3
! 4 1 150
? 4 1
0 0
 2 2
! 2 2 1
? 1 2
3 2
! 2 2 1
? 2 1
4 7
! 1 2 100
? 2 3
! 2 3 100
? 2 4
? 3 3
! 4 3 150
? 4 1
0 0

1
UNKNOWN
UNKNOWN
100
200
-50
 UNKNOWN
UNKNOWN
UNKNOWN
100
200
-50
 UNKNOWN
UNKNOWN
UNKNOWN
UNKNOWN
200
-50
 UNKNOWN
UNKNOWN
UNKNOWN
UNKNOWN
100
-50
 UNKNOWN
UNKNOWN
UNKNOWN
UNKNOWN
100
-51
 1
-1
UNKNOWN
100
200
-50
 UNKNOWN
UNKNOWN
UNKNOWN
UNKNOWN
100
UNKNOWN
 UNKNOWN
UNKNOWN
UNKNOWN
200
200
-50
 UNKNOWN
UNKNOWN
UNKNOWN
UNKNOWN
200
150
 UNKNOWN
UNKNOWN
UNKNOWN
UNKNOWN
0
-50

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

```c
// AOJ 1330: Never Wait for Weights
// 2017.12.3 bal4u@uu

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

// <????????????Union Find>
#define MAX 100003

int par[MAX], ws[MAX];

#if 0
void initWeightedUnionFind()
{
	int i;
	for (i = 0; i < n; i++) par[i] = -1;
}
#endif

int find(int x)
{
	int p;
	if (par[x] < 0) return x;
    p = find(par[x]), ws[x] += ws[par[x]];
    return par[x] = p;
}
    
int weight(int x)
{
    find(x); 
    return ws[x];
}
    
int unite(int x, int y, int w)  // x <-(w)- y (x + w = y)
{
	int tmp;

    w += weight(x), w -= weight(y);
    x = find(x), y = find(y);
    if (x == y) return 0;
    if (par[y] < par[x]) // ???????????????????????????????????????????????????.
        tmp = x, x = y, y = tmp, w = -w;
    
    par[x] += par[y], par[y] = x;
    ws[y] = w;
    return 1;
}
    
int same(int x, int y)
{
	return find(x) == find(y);
}

// *ans = x - y. ?????????????????? return 0.
int diff(int *ans, int x, int y)
{
    if (find(x) != find(y)) return 0;
	*ans = ws[x] - ws[y];
	return 1;
}
// </????????????Union Find>

char buf[40], *p;
int getint()
{
	int n = 0;
	while (*p >= '0') n = (n<<3) + (n<<1) + (*p++ & 0xf);
	p++;
	return n;
}

int main()
{
	int n, m, q, a, b;

	while (fgets(p=buf, 40, stdin) && *p != '0') {
		n = getint(), m = getint();
		memset(par, 0xff, (n+1)*sizeof(int));
		memset(ws, 0, (n+1)*sizeof(int));
		while (m--) {
			fgets(p=buf, 40, stdin);
			q = *p, p += 2, a = getint(), b = getint();
			if (q == '!') unite(b, a, getint());
			else {
				if (find(a) != find(b)) puts("UNKNOWN");
				else printf("%d\n", ws[a] - ws[b]);
			}
		}
	}
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	par
	.bss
	.align 32
	.type	par, @object
	.size	par, 400012
par:
	.zero	400012
	.globl	ws
	.align 32
	.type	ws, @object
	.size	ws, 400012
ws:
	.zero	400012
	.text
	.globl	find
	.type	find, @function
find:
.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	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	par(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	jns	.L2
	movl	-20(%rbp), %eax
	jmp	.L3
.L2:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	par(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, %edi
	call	find
	movl	%eax, -4(%rbp)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	ws(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	par(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	ws(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, %ecx
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	ws(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	par(%rip), %rdx
	movl	-4(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	par(%rip), %rax
	movl	(%rdx,%rax), %eax
.L3:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	find, .-find
	.globl	weight
	.type	weight, @function
weight:
.LFB1:
	.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
	movl	%eax, %edi
	call	find
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	ws(%rip), %rax
	movl	(%rdx,%rax), %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	weight, .-weight
	.globl	unite
	.type	unite, @function
unite:
.LFB2:
	.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)
	movl	%edx, -28(%rbp)
	movl	-20(%rbp), %eax
	movl	%eax, %edi
	call	weight
	addl	%eax, -28(%rbp)
	movl	-24(%rbp), %eax
	movl	%eax, %edi
	call	weight
	subl	%eax, -28(%rbp)
	movl	-20(%rbp), %eax
	movl	%eax, %edi
	call	find
	movl	%eax, -20(%rbp)
	movl	-24(%rbp), %eax
	movl	%eax, %edi
	call	find
	movl	%eax, -24(%rbp)
	movl	-20(%rbp), %eax
	cmpl	-24(%rbp), %eax
	jne	.L7
	movl	$0, %eax
	jmp	.L8
.L7:
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	par(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	par(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jge	.L9
	movl	-20(%rbp), %eax
	movl	%eax, -4(%rbp)
	movl	-24(%rbp), %eax
	movl	%eax, -20(%rbp)
	movl	-4(%rbp), %eax
	movl	%eax, -24(%rbp)
	negl	-28(%rbp)
.L9:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	par(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	par(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, %ecx
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	par(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	par(%rip), %rdx
	movl	-20(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	ws(%rip), %rdx
	movl	-28(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	$1, %eax
.L8:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	unite, .-unite
	.globl	same
	.type	same, @function
same:
.LFB3:
	.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	-20(%rbp), %eax
	movl	%eax, %edi
	call	find
	movl	%eax, %ebx
	movl	-24(%rbp), %eax
	movl	%eax, %edi
	call	find
	cmpl	%eax, %ebx
	sete	%al
	movzbl	%al, %eax
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE3:
	.size	same, .-same
	.globl	diff
	.type	diff, @function
diff:
.LFB4:
	.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
	movq	%rdi, -24(%rbp)
	movl	%esi, -28(%rbp)
	movl	%edx, -32(%rbp)
	movl	-28(%rbp), %eax
	movl	%eax, %edi
	call	find
	movl	%eax, %ebx
	movl	-32(%rbp), %eax
	movl	%eax, %edi
	call	find
	cmpl	%eax, %ebx
	je	.L13
	movl	$0, %eax
	jmp	.L14
.L13:
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	ws(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-32(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	ws(%rip), %rdx
	movl	(%rcx,%rdx), %ecx
	subl	%ecx, %eax
	movl	%eax, %edx
	movq	-24(%rbp), %rax
	movl	%edx, (%rax)
	movl	$1, %eax
.L14:
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE4:
	.size	diff, .-diff
	.globl	buf
	.bss
	.align 32
	.type	buf, @object
	.size	buf, 40
buf:
	.zero	40
	.globl	p
	.align 8
	.type	p, @object
	.size	p, 8
p:
	.zero	8
	.text
	.globl	getint
	.type	getint, @function
getint:
.LFB5:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	$0, -4(%rbp)
	jmp	.L16
.L17:
	movl	-4(%rbp), %eax
	leal	0(,%rax,8), %edx
	movl	-4(%rbp), %eax
	addl	%eax, %eax
	leal	(%rdx,%rax), %ecx
	movq	p(%rip), %rax
	leaq	1(%rax), %rdx
	movq	%rdx, p(%rip)
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	andl	$15, %eax
	addl	%ecx, %eax
	movl	%eax, -4(%rbp)
.L16:
	movq	p(%rip), %rax
	movzbl	(%rax), %eax
	cmpb	$47, %al
	jg	.L17
	movq	p(%rip), %rax
	addq	$1, %rax
	movq	%rax, p(%rip)
	movl	-4(%rbp), %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE5:
	.size	getint, .-getint
	.section	.rodata
.LC0:
	.string	"UNKNOWN"
.LC1:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%rbx
	subq	$40, %rsp
	.cfi_offset 3, -24
	jmp	.L20
.L26:
	movl	$0, %eax
	call	getint
	movl	%eax, -32(%rbp)
	movl	$0, %eax
	call	getint
	movl	%eax, -36(%rbp)
	movl	-32(%rbp), %eax
	addl	$1, %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdx
	movl	$255, %esi
	leaq	par(%rip), %rax
	movq	%rax, %rdi
	call	memset@PLT
	movl	-32(%rbp), %eax
	addl	$1, %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdx
	movl	$0, %esi
	leaq	ws(%rip), %rax
	movq	%rax, %rdi
	call	memset@PLT
	jmp	.L21
.L24:
	movq	stdin(%rip), %rdx
	leaq	buf(%rip), %rax
	movq	%rax, p(%rip)
	movq	p(%rip), %rax
	movl	$40, %esi
	movq	%rax, %rdi
	call	fgets@PLT
	movq	p(%rip), %rax
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	movl	%eax, -28(%rbp)
	movq	p(%rip), %rax
	addq	$2, %rax
	movq	%rax, p(%rip)
	movl	$0, %eax
	call	getint
	movl	%eax, -24(%rbp)
	movl	$0, %eax
	call	getint
	movl	%eax, -20(%rbp)
	cmpl	$33, -28(%rbp)
	jne	.L22
	movl	$0, %eax
	call	getint
	movl	%eax, %edx
	movl	-24(%rbp), %ecx
	movl	-20(%rbp), %eax
	movl	%ecx, %esi
	movl	%eax, %edi
	call	unite
	jmp	.L21
.L22:
	movl	-24(%rbp), %eax
	movl	%eax, %edi
	call	find
	movl	%eax, %ebx
	movl	-20(%rbp), %eax
	movl	%eax, %edi
	call	find
	cmpl	%eax, %ebx
	je	.L23
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L21
.L23:
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	ws(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-20(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	ws(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	subl	%edx, %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L21:
	movl	-36(%rbp), %eax
	leal	-1(%rax), %edx
	movl	%edx, -36(%rbp)
	testl	%eax, %eax
	jne	.L24
.L20:
	movq	stdin(%rip), %rdx
	leaq	buf(%rip), %rax
	movq	%rax, p(%rip)
	movq	p(%rip), %rax
	movl	$40, %esi
	movq	%rax, %rdi
	call	fgets@PLT
	testq	%rax, %rax
	je	.L25
	movq	p(%rip), %rax
	movzbl	(%rax), %eax
	cmpb	$48, %al
	jne	.L26
.L25:
	movl	$0, %eax
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```

Only output the optimized assembly code. Do not include any other text. Do not write any comments in the assembly code. Wrap the assembly code in ```assembly``` tags.
train
	.file	"temp.c"
	.text
	.globl	par
	.bss
	.align 32
	.type	par, @object
	.size	par, 400012
par:
	.zero	400012
	.globl	ws
	.align 32
	.type	ws, @object
	.size	ws, 400012
ws:
	.zero	400012
	.text
	.globl	find
	.type	find, @function
find:
.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	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	par(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	jns	.L2
	movl	-20(%rbp), %eax
	jmp	.L3
.L2:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	par(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, %edi
	call	find
	movl	%eax, -4(%rbp)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	ws(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	par(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	ws(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, %ecx
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	ws(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	par(%rip), %rdx
	movl	-4(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	par(%rip), %rax
	movl	(%rdx,%rax), %eax
.L3:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	find, .-find
	.globl	weight
	.type	weight, @function
weight:
.LFB1:
	.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
	movl	%eax, %edi
	call	find
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	ws(%rip), %rax
	movl	(%rdx,%rax), %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	weight, .-weight
	.globl	unite
	.type	unite, @function
unite:
.LFB2:
	.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)
	movl	%edx, -28(%rbp)
	movl	-20(%rbp), %eax
	movl	%eax, %edi
	call	weight
	addl	%eax, -28(%rbp)
	movl	-24(%rbp), %eax
	movl	%eax, %edi
	call	weight
	subl	%eax, -28(%rbp)
	movl	-20(%rbp), %eax
	movl	%eax, %edi
	call	find
	movl	%eax, -20(%rbp)
	movl	-24(%rbp), %eax
	movl	%eax, %edi
	call	find
	movl	%eax, -24(%rbp)
	movl	-20(%rbp), %eax
	cmpl	-24(%rbp), %eax
	jne	.L7
	movl	$0, %eax
	jmp	.L8
.L7:
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	par(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	par(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jge	.L9
	movl	-20(%rbp), %eax
	movl	%eax, -4(%rbp)
	movl	-24(%rbp), %eax
	movl	%eax, -20(%rbp)
	movl	-4(%rbp), %eax
	movl	%eax, -24(%rbp)
	negl	-28(%rbp)
.L9:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	par(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	par(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, %ecx
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	par(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	par(%rip), %rdx
	movl	-20(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	ws(%rip), %rdx
	movl	-28(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	$1, %eax
.L8:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	unite, .-unite
	.globl	same
	.type	same, @function
same:
.LFB3:
	.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	-20(%rbp), %eax
	movl	%eax, %edi
	call	find
	movl	%eax, %ebx
	movl	-24(%rbp), %eax
	movl	%eax, %edi
	call	find
	cmpl	%eax, %ebx
	sete	%al
	movzbl	%al, %eax
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE3:
	.size	same, .-same
	.globl	diff
	.type	diff, @function
diff:
.LFB4:
	.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
	movq	%rdi, -24(%rbp)
	movl	%esi, -28(%rbp)
	movl	%edx, -32(%rbp)
	movl	-28(%rbp), %eax
	movl	%eax, %edi
	call	find
	movl	%eax, %ebx
	movl	-32(%rbp), %eax
	movl	%eax, %edi
	call	find
	cmpl	%eax, %ebx
	je	.L13
	movl	$0, %eax
	jmp	.L14
.L13:
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	ws(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-32(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	ws(%rip), %rdx
	movl	(%rcx,%rdx), %ecx
	subl	%ecx, %eax
	movl	%eax, %edx
	movq	-24(%rbp), %rax
	movl	%edx, (%rax)
	movl	$1, %eax
.L14:
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE4:
	.size	diff, .-diff
	.globl	buf
	.bss
	.align 32
	.type	buf, @object
	.size	buf, 40
buf:
	.zero	40
	.globl	p
	.align 8
	.type	p, @object
	.size	p, 8
p:
	.zero	8
	.text
	.globl	getint
	.type	getint, @function
getint:
.LFB5:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	$0, -4(%rbp)
	jmp	.L16
.L17:
	movl	-4(%rbp), %eax
	leal	0(,%rax,8), %edx
	movl	-4(%rbp), %eax
	addl	%eax, %eax
	leal	(%rdx,%rax), %ecx
	movq	p(%rip), %rax
	leaq	1(%rax), %rdx
	movq	%rdx, p(%rip)
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	andl	$15, %eax
	addl	%ecx, %eax
	movl	%eax, -4(%rbp)
.L16:
	movq	p(%rip), %rax
	movzbl	(%rax), %eax
	cmpb	$47, %al
	jg	.L17
	movq	p(%rip), %rax
	addq	$1, %rax
	movq	%rax, p(%rip)
	movl	-4(%rbp), %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE5:
	.size	getint, .-getint
	.section	.rodata
.LC0:
	.string	"UNKNOWN"
.LC1:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%rbx
	subq	$40, %rsp
	.cfi_offset 3, -24
	jmp	.L20
.L26:
	movl	$0, %eax
	call	getint
	movl	%eax, -32(%rbp)
	movl	$0, %eax
	call	getint
	movl	%eax, -36(%rbp)
	movl	-32(%rbp), %eax
	addl	$1, %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdx
	movl	$255, %esi
	leaq	par(%rip), %rax
	movq	%rax, %rdi
	call	memset@PLT
	movl	-32(%rbp), %eax
	addl	$1, %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdx
	movl	$0, %esi
	leaq	ws(%rip), %rax
	movq	%rax, %rdi
	call	memset@PLT
	jmp	.L21
.L24:
	movq	stdin(%rip), %rdx
	leaq	buf(%rip), %rax
	movq	%rax, p(%rip)
	movq	p(%rip), %rax
	movl	$40, %esi
	movq	%rax, %rdi
	call	fgets@PLT
	movq	p(%rip), %rax
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	movl	%eax, -28(%rbp)
	movq	p(%rip), %rax
	addq	$2, %rax
	movq	%rax, p(%rip)
	movl	$0, %eax
	call	getint
	movl	%eax, -24(%rbp)
	movl	$0, %eax
	call	getint
	movl	%eax, -20(%rbp)
	cmpl	$33, -28(%rbp)
	jne	.L22
	movl	$0, %eax
	call	getint
	movl	%eax, %edx
	movl	-24(%rbp), %ecx
	movl	-20(%rbp), %eax
	movl	%ecx, %esi
	movl	%eax, %edi
	call	unite
	jmp	.L21
.L22:
	movl	-24(%rbp), %eax
	movl	%eax, %edi
	call	find
	movl	%eax, %ebx
	movl	-20(%rbp), %eax
	movl	%eax, %edi
	call	find
	cmpl	%eax, %ebx
	je	.L23
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L21
.L23:
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	ws(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-20(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	ws(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	subl	%edx, %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L21:
	movl	-36(%rbp), %eax
	leal	-1(%rax), %edx
	movl	%edx, -36(%rbp)
	testl	%eax, %eax
	jne	.L24
.L20:
	movq	stdin(%rip), %rdx
	leaq	buf(%rip), %rax
	movq	%rax, p(%rip)
	movq	p(%rip), %rax
	movl	$40, %esi
	movq	%rax, %rdi
	call	fgets@PLT
	testq	%rax, %rax
	je	.L25
	movq	p(%rip), %rax
	movzbl	(%rax), %eax
	cmpb	$48, %al
	jne	.L26
.L25:
	movl	$0, %eax
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
