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

```c
#include <stdio.h>
#include <stdlib.h>

typedef struct List {
	struct List *next;
	char *str;
	long long count;
} list;

int hash_string(char* s)
{
	long long x = 0;
	int i;
	for (i = 0; s[i] != 0; i++)	x += 1 << ((s[i] - 'a') * 2);
	return x % 10007;
}

int anagram(char* s1, char* s2)
{
	int i, count[2][26] = {}, flag = 1;
	for (i = 0; s1[i] != 0; i++) count[0][s1[i] - 'a']++;
	for (i = 0; s2[i] != 0; i++) count[1][s2[i] - 'a']++;
	for (i = 0; i < 26; i++) if (count[0][i] != count[1][i]) break;
	if (i == 26) return 1;
	else return 0;
}

int main()
{
	int i, N;
	char s[100001][11] = {};
	scanf("%d", &N);
	for (i = 1; i <= N; i++) scanf("%s", s[i]);

	int k;
	long long sum = 0;
	list *p, *hash[10007] = {}, data[100001];
	for (i = 1; i <= N; i++) {
		k = hash_string(s[i]);
		for (p = hash[k]; p != NULL; p = p->next) {
			if (anagram(s[i], p->str) == 1) break;
		}
		if (p == NULL) {
			data[i].str = s[i];
			data[i].count = 1;
			data[i].next = hash[k];
			hash[k] = &(data[i]);
		} else (p->count)++;
	}
	for (k = 0; k < 10007; k++) {
		for (p = hash[k]; p != NULL; p = p->next) sum += p->count * (p->count - 1) / 2;
	} 
	printf("%lld\n", sum);
	fflush(stdout);
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	hash_string
	.type	hash_string, @function
hash_string:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -24(%rbp)
	movq	$0, -8(%rbp)
	movl	$0, -12(%rbp)
	jmp	.L2
.L3:
	movl	-12(%rbp), %eax
	movslq	%eax, %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	subl	$97, %eax
	addl	%eax, %eax
	movl	$1, %edx
	movl	%eax, %ecx
	sall	%cl, %edx
	movl	%edx, %eax
	cltq
	addq	%rax, -8(%rbp)
	addl	$1, -12(%rbp)
.L2:
	movl	-12(%rbp), %eax
	movslq	%eax, %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	testb	%al, %al
	jne	.L3
	movq	-8(%rbp), %rcx
	movabsq	$7550501021876119059, %rdx
	movq	%rcx, %rax
	imulq	%rdx
	movq	%rdx, %rax
	sarq	$12, %rax
	movq	%rcx, %rdx
	sarq	$63, %rdx
	subq	%rdx, %rax
	imulq	$10007, %rax, %rdx
	movq	%rcx, %rax
	subq	%rdx, %rax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	hash_string, .-hash_string
	.globl	anagram
	.type	anagram, @function
anagram:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$256, %rsp
	movq	%rdi, -248(%rbp)
	movq	%rsi, -256(%rbp)
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-224(%rbp), %rdx
	movl	$0, %eax
	movl	$26, %ecx
	movq	%rdx, %rdi
	rep stosq
	movl	$1, -228(%rbp)
	movl	$0, -232(%rbp)
	jmp	.L6
.L7:
	movl	-232(%rbp), %eax
	movslq	%eax, %rdx
	movq	-248(%rbp), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	subl	$97, %eax
	movslq	%eax, %rdx
	movl	-224(%rbp,%rdx,4), %edx
	addl	$1, %edx
	cltq
	movl	%edx, -224(%rbp,%rax,4)
	addl	$1, -232(%rbp)
.L6:
	movl	-232(%rbp), %eax
	movslq	%eax, %rdx
	movq	-248(%rbp), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	testb	%al, %al
	jne	.L7
	movl	$0, -232(%rbp)
	jmp	.L8
.L9:
	movl	-232(%rbp), %eax
	movslq	%eax, %rdx
	movq	-256(%rbp), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	subl	$97, %eax
	movslq	%eax, %rdx
	addq	$26, %rdx
	movl	-224(%rbp,%rdx,4), %edx
	addl	$1, %edx
	cltq
	addq	$26, %rax
	movl	%edx, -224(%rbp,%rax,4)
	addl	$1, -232(%rbp)
.L8:
	movl	-232(%rbp), %eax
	movslq	%eax, %rdx
	movq	-256(%rbp), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	testb	%al, %al
	jne	.L9
	movl	$0, -232(%rbp)
	jmp	.L10
.L13:
	movl	-232(%rbp), %eax
	cltq
	movl	-224(%rbp,%rax,4), %edx
	movl	-232(%rbp), %eax
	cltq
	addq	$26, %rax
	movl	-224(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	jne	.L18
	addl	$1, -232(%rbp)
.L10:
	cmpl	$25, -232(%rbp)
	jle	.L13
	jmp	.L12
.L18:
	nop
.L12:
	cmpl	$26, -232(%rbp)
	jne	.L14
	movl	$1, %eax
	jmp	.L16
.L14:
	movl	$0, %eax
.L16:
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L17
	call	__stack_chk_fail@PLT
.L17:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	anagram, .-anagram
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%s"
.LC2:
	.string	"%lld\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	leaq	-3579904(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$240, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-3500048(%rbp), %rax
	movl	$1100011, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	leaq	-3580140(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$1, -3580136(%rbp)
	jmp	.L20
.L21:
	leaq	-3500048(%rbp), %rcx
	movl	-3580136(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -3580136(%rbp)
.L20:
	movl	-3580140(%rbp), %eax
	cmpl	%eax, -3580136(%rbp)
	jle	.L21
	movq	$0, -3580128(%rbp)
	leaq	-3580112(%rbp), %rax
	movl	$80056, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	movl	$1, -3580136(%rbp)
	jmp	.L22
.L29:
	leaq	-3500048(%rbp), %rcx
	movl	-3580136(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	addq	%rcx, %rax
	movq	%rax, %rdi
	call	hash_string
	movl	%eax, -3580132(%rbp)
	movl	-3580132(%rbp), %eax
	cltq
	movq	-3580112(%rbp,%rax,8), %rax
	movq	%rax, -3580120(%rbp)
	jmp	.L23
.L26:
	movq	-3580120(%rbp), %rax
	movq	8(%rax), %rcx
	leaq	-3500048(%rbp), %rsi
	movl	-3580136(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	addq	%rsi, %rax
	movq	%rcx, %rsi
	movq	%rax, %rdi
	call	anagram
	cmpl	$1, %eax
	je	.L36
	movq	-3580120(%rbp), %rax
	movq	(%rax), %rax
	movq	%rax, -3580120(%rbp)
.L23:
	cmpq	$0, -3580120(%rbp)
	jne	.L26
	jmp	.L25
.L36:
	nop
.L25:
	cmpq	$0, -3580120(%rbp)
	jne	.L27
	leaq	-3500048(%rbp), %rcx
	movl	-3580136(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	addq	%rax, %rcx
	movl	-3580136(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	addq	%rbp, %rax
	subq	$2400024, %rax
	movq	%rcx, (%rax)
	movl	-3580136(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	addq	%rbp, %rax
	subq	$2400016, %rax
	movq	$1, (%rax)
	movl	-3580132(%rbp), %eax
	cltq
	movq	-3580112(%rbp,%rax,8), %rdx
	movl	-3580136(%rbp), %eax
	movslq	%eax, %rcx
	movq	%rcx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	salq	$3, %rax
	addq	%rbp, %rax
	subq	$2400032, %rax
	movq	%rdx, (%rax)
	leaq	-2400032(%rbp), %rcx
	movl	-3580136(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	leaq	(%rcx,%rax), %rdx
	movl	-3580132(%rbp), %eax
	cltq
	movq	%rdx, -3580112(%rbp,%rax,8)
	jmp	.L28
.L27:
	movq	-3580120(%rbp), %rax
	movq	16(%rax), %rax
	leaq	1(%rax), %rdx
	movq	-3580120(%rbp), %rax
	movq	%rdx, 16(%rax)
.L28:
	addl	$1, -3580136(%rbp)
.L22:
	movl	-3580140(%rbp), %eax
	cmpl	%eax, -3580136(%rbp)
	jle	.L29
	movl	$0, -3580132(%rbp)
	jmp	.L30
.L33:
	movl	-3580132(%rbp), %eax
	cltq
	movq	-3580112(%rbp,%rax,8), %rax
	movq	%rax, -3580120(%rbp)
	jmp	.L31
.L32:
	movq	-3580120(%rbp), %rax
	movq	16(%rax), %rdx
	movq	-3580120(%rbp), %rax
	movq	16(%rax), %rax
	subq	$1, %rax
	imulq	%rdx, %rax
	movq	%rax, %rdx
	shrq	$63, %rdx
	addq	%rdx, %rax
	sarq	%rax
	addq	%rax, -3580128(%rbp)
	movq	-3580120(%rbp), %rax
	movq	(%rax), %rax
	movq	%rax, -3580120(%rbp)
.L31:
	cmpq	$0, -3580120(%rbp)
	jne	.L32
	addl	$1, -3580132(%rbp)
.L30:
	cmpl	$10006, -3580132(%rbp)
	jle	.L33
	movq	-3580128(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movq	stdout(%rip), %rax
	movq	%rax, %rdi
	call	fflush@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L35
	call	__stack_chk_fail@PLT
.L35:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.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	hash_string
	.type	hash_string, @function
hash_string:
.LFB39:
	.cfi_startproc
	endbr64
	movzbl	(%rdi), %ecx
	testb	%cl, %cl
	je	.L4
	addq	$1, %rdi
	xorl	%esi, %esi
	movl	$1, %edx
	.p2align 4,,10
	.p2align 3
.L3:
	leal	62(%rcx,%rcx), %ecx
	movl	%edx, %eax
	addq	$1, %rdi
	sall	%cl, %eax
	movzbl	-1(%rdi), %ecx
	cltq
	addq	%rax, %rsi
	testb	%cl, %cl
	jne	.L3
	movabsq	$7550501021876119059, %rdx
	movq	%rsi, %rax
	imulq	%rdx
	movq	%rsi, %rax
	sarq	$63, %rax
	sarq	$12, %rdx
	subq	%rax, %rdx
	movl	%esi, %eax
	imulq	$10007, %rdx, %rdx
	subl	%edx, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L4:
	xorl	%eax, %eax
	ret
	.cfi_endproc
.LFE39:
	.size	hash_string, .-hash_string
	.p2align 4
	.globl	anagram
	.type	anagram, @function
anagram:
.LFB40:
	.cfi_startproc
	endbr64
	subq	$232, %rsp
	.cfi_def_cfa_offset 240
	movq	%rdi, %r8
	movl	$26, %ecx
	movq	%fs:40, %rax
	movq	%rax, 216(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rdx
	movq	%rdx, %rdi
	rep stosq
	movsbl	(%r8), %eax
	testb	%al, %al
	je	.L8
	leaq	1(%r8), %rdi
	.p2align 4,,10
	.p2align 3
.L9:
	subl	$97, %eax
	addq	$1, %rdi
	cltq
	addl	$1, (%rsp,%rax,4)
	movsbl	-1(%rdi), %eax
	testb	%al, %al
	jne	.L9
.L8:
	movsbl	(%rsi), %eax
	testb	%al, %al
	je	.L10
	leaq	1(%rsi), %rcx
	.p2align 4,,10
	.p2align 3
.L11:
	subl	$97, %eax
	addq	$1, %rcx
	cltq
	addl	$1, 104(%rsp,%rax,4)
	movsbl	-1(%rcx), %eax
	testb	%al, %al
	jne	.L11
.L10:
	movq	%rdx, %rdi
	leaq	104(%rsp), %rax
	jmp	.L13
	.p2align 4,,10
	.p2align 3
.L27:
	addq	$4, %rdi
	cmpq	%rdi, %rax
	je	.L26
.L13:
	movl	104(%rdi), %edx
	cmpl	%edx, (%rdi)
	je	.L27
	xorl	%eax, %eax
.L7:
	movq	216(%rsp), %rdx
	subq	%fs:40, %rdx
	jne	.L28
	addq	$232, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L26:
	.cfi_restore_state
	movl	$1, %eax
	jmp	.L7
.L28:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE40:
	.size	anagram, .-anagram
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%s"
.LC2:
	.string	"%lld\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
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	-3579904(%rsp), %r11
	.cfi_def_cfa 11, 3579960
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$264, %rsp
	.cfi_def_cfa_offset 3580224
	movl	$1100011, %edx
	xorl	%esi, %esi
	movq	%fs:40, %rax
	movq	%rax, 3580152(%rsp)
	xorl	%eax, %eax
	leaq	80112(%rsp), %rdi
	call	memset@PLT
	leaq	44(%rsp), %rsi
	leaq	.LC0(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	44(%rsp), %eax
	testl	%eax, %eax
	jle	.L30
	leaq	80123(%rsp), %rbp
	movl	$1, %ebx
	leaq	.LC1(%rip), %r13
	movq	%rbp, %r12
.L31:
	movq	%r12, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	movl	44(%rsp), %r14d
	addq	$11, %r12
	cmpl	%ebx, %r14d
	jge	.L31
	leaq	48(%rsp), %rax
	xorl	%esi, %esi
	movl	$80056, %edx
	movq	%rax, %rdi
	movq	%rax, 24(%rsp)
	call	memset@PLT
	testl	%r14d, %r14d
	jle	.L33
	leal	-1(%r14), %eax
	leaq	1180152(%rsp), %r13
	movl	$1, %r12d
	leaq	(%rax,%rax,4), %rdx
	leaq	(%rax,%rdx,2), %rax
	leaq	80134(%rsp,%rax), %r14
.L39:
	movzbl	0(%rbp), %ecx
	testb	%cl, %cl
	je	.L46
	leaq	1(%rbp), %rdx
	xorl	%ebx, %ebx
	.p2align 4,,10
	.p2align 3
.L35:
	leal	62(%rcx,%rcx), %ecx
	movl	%r12d, %eax
	addq	$1, %rdx
	sall	%cl, %eax
	movzbl	-1(%rdx), %ecx
	cltq
	addq	%rax, %rbx
	testb	%cl, %cl
	jne	.L35
	movabsq	$7550501021876119059, %rax
	imulq	%rbx
	movq	%rbx, %rax
	sarq	$63, %rax
	sarq	$12, %rdx
	subq	%rax, %rdx
	imulq	$10007, %rdx, %rax
	subl	%eax, %ebx
.L34:
	movslq	%ebx, %rbx
	movq	%rbp, %xmm1
	movq	48(%rsp,%rbx,8), %r15
	movq	%r15, %xmm0
	punpcklqdq	%xmm1, %xmm0
	movaps	%xmm0, (%rsp)
	testq	%r15, %r15
	jne	.L38
	jmp	.L36
	.p2align 4,,10
	.p2align 3
.L61:
	movq	(%r15), %r15
	testq	%r15, %r15
	je	.L36
.L38:
	movq	8(%r15), %rsi
	movq	%rbp, %rdi
	call	anagram
	cmpl	$1, %eax
	jne	.L61
	addq	$1, 16(%r15)
.L44:
	addq	$11, %rbp
	addq	$24, %r13
	cmpq	%rbp, %r14
	jne	.L39
.L33:
	movq	24(%rsp), %rsi
	leaq	80104(%rsp), %rdi
	xorl	%r8d, %r8d
	.p2align 4,,10
	.p2align 3
.L43:
	movq	(%rsi), %rcx
	testq	%rcx, %rcx
	je	.L41
	.p2align 4,,10
	.p2align 3
.L42:
	movq	16(%rcx), %rax
	movq	(%rcx), %rcx
	leaq	-1(%rax), %rdx
	imulq	%rax, %rdx
	movq	%rdx, %rax
	shrq	$63, %rax
	addq	%rdx, %rax
	sarq	%rax
	addq	%rax, %r8
	testq	%rcx, %rcx
	jne	.L42
.L41:
	addq	$8, %rsi
	cmpq	%rdi, %rsi
	jne	.L43
	movl	$1, %edi
	xorl	%eax, %eax
	movq	%r8, %rdx
	leaq	.LC2(%rip), %rsi
	call	__printf_chk@PLT
	movq	stdout(%rip), %rdi
	call	fflush@PLT
	movq	3580152(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L62
	addq	$3580168, %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
.L36:
	.cfi_restore_state
	movdqa	(%rsp), %xmm2
	movq	$1, 16(%r13)
	movq	%r13, 48(%rsp,%rbx,8)
	movups	%xmm2, 0(%r13)
	jmp	.L44
.L46:
	xorl	%ebx, %ebx
	jmp	.L34
.L30:
	leaq	48(%rsp), %rax
	movl	$80056, %edx
	xorl	%esi, %esi
	movq	%rax, %rdi
	movq	%rax, 24(%rsp)
	call	memset@PLT
	jmp	.L33
.L62:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE41:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:

rule
	.file	"temp.c"
	.text
	.p2align 4
	.globl	hash_string
	.type	hash_string, @function
hash_string:
.LFB39:
	.cfi_startproc
	endbr64
	movzbl	(%rdi), %ecx
	testb	%cl, %cl
	je	.L4
	addq	$1, %rdi
	xorl	%esi, %esi
	movl	$1, %edx
	.p2align 4,,10
	.p2align 3
.L3:
	leal	62(%rcx,%rcx), %ecx
	movl	%edx, %eax
	addq	$1, %rdi
	sall	%cl, %eax
	movzbl	-1(%rdi), %ecx
	cltq
	addq	%rax, %rsi
	testb	%cl, %cl
	jne	.L3
	movabsq	$7550501021876119059, %rdx
	movq	%rsi, %rax
	imulq	%rdx
	movq	%rsi, %rax
	sarq	$63, %rax
	sarq	$12, %rdx
	subq	%rax, %rdx
	movl	%esi, %eax
	imulq	$10007, %rdx, %rdx
	subl	%edx, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L4:
	xorl	%eax, %eax
	ret
	.cfi_endproc
.LFE39:
	.size	hash_string, .-hash_string
	.p2align 4
	.globl	anagram
	.type	anagram, @function
anagram:
.LFB40:
	.cfi_startproc
	endbr64
	subq	$232, %rsp
	.cfi_def_cfa_offset 240
	movq	%rdi, %r8
	movl	$26, %ecx
	movq	%fs:40, %rax
	movq	%rax, 216(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rdx
	movq	%rdx, %rdi
	rep stosq
	movsbl	(%r8), %eax
	testb	%al, %al
	je	.L8
	leaq	1(%r8), %rdi
	.p2align 4,,10
	.p2align 3
.L9:
	subl	$97, %eax
	addq	$1, %rdi
	cltq
	addl	$1, (%rsp,%rax,4)
	movsbl	-1(%rdi), %eax
	testb	%al, %al
	jne	.L9
.L8:
	movsbl	(%rsi), %eax
	testb	%al, %al
	je	.L10
	leaq	1(%rsi), %rcx
	.p2align 4,,10
	.p2align 3
.L11:
	subl	$97, %eax
	addq	$1, %rcx
	cltq
	addl	$1, 104(%rsp,%rax,4)
	movsbl	-1(%rcx), %eax
	testb	%al, %al
	jne	.L11
.L10:
	movq	%rdx, %rdi
	leaq	104(%rsp), %rax
	jmp	.L13
	.p2align 4,,10
	.p2align 3
.L27:
	addq	$4, %rdi
	cmpq	%rdi, %rax
	je	.L26
.L13:
	movl	104(%rdi), %edx
	cmpl	%edx, (%rdi)
	je	.L27
	xorl	%eax, %eax
.L7:
	movq	216(%rsp), %rdx
	subq	%fs:40, %rdx
	jne	.L28
	addq	$232, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L26:
	.cfi_restore_state
	movl	$1, %eax
	jmp	.L7
.L28:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE40:
	.size	anagram, .-anagram
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%s"
.LC2:
	.string	"%lld\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
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	-3579904(%rsp), %r11
	.cfi_def_cfa 11, 3579960
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$264, %rsp
	.cfi_def_cfa_offset 3580224
	movl	$1100011, %edx
	xorl	%esi, %esi
	movq	%fs:40, %rax
	movq	%rax, 3580152(%rsp)
	xorl	%eax, %eax
	leaq	80112(%rsp), %rdi
	call	memset@PLT
	leaq	44(%rsp), %rsi
	leaq	.LC0(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	44(%rsp), %eax
	testl	%eax, %eax
	jle	.L30
	leaq	80123(%rsp), %rbp
	movl	$1, %ebx
	leaq	.LC1(%rip), %r13
	movq	%rbp, %r12
.L31:
	movq	%r12, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	movl	44(%rsp), %r14d
	addq	$11, %r12
	cmpl	%ebx, %r14d
	jge	.L31
	leaq	48(%rsp), %rax
	xorl	%esi, %esi
	movl	$80056, %edx
	movq	%rax, %rdi
	movq	%rax, 24(%rsp)
	call	memset@PLT
	testl	%r14d, %r14d
	jle	.L33
	leal	-1(%r14), %eax
	leaq	1180152(%rsp), %r13
	movl	$1, %r12d
	leaq	(%rax,%rax,4), %rdx
	leaq	(%rax,%rdx,2), %rax
	leaq	80134(%rsp,%rax), %r14
.L39:
	movzbl	0(%rbp), %ecx
	testb	%cl, %cl
	je	.L46
	leaq	1(%rbp), %rdx
	xorl	%ebx, %ebx
	.p2align 4,,10
	.p2align 3
.L35:
	leal	62(%rcx,%rcx), %ecx
	movl	%r12d, %eax
	addq	$1, %rdx
	sall	%cl, %eax
	movzbl	-1(%rdx), %ecx
	cltq
	addq	%rax, %rbx
	testb	%cl, %cl
	jne	.L35
	movabsq	$7550501021876119059, %rax
	imulq	%rbx
	movq	%rbx, %rax
	sarq	$63, %rax
	sarq	$12, %rdx
	subq	%rax, %rdx
	imulq	$10007, %rdx, %rax
	subl	%eax, %ebx
.L34:
	movslq	%ebx, %rbx
	movq	%rbp, %xmm1
	movq	48(%rsp,%rbx,8), %r15
	movq	%r15, %xmm0
	punpcklqdq	%xmm1, %xmm0
	movaps	%xmm0, (%rsp)
	testq	%r15, %r15
	jne	.L38
	jmp	.L36
	.p2align 4,,10
	.p2align 3
.L61:
	movq	(%r15), %r15
	testq	%r15, %r15
	je	.L36
.L38:
	movq	8(%r15), %rsi
	movq	%rbp, %rdi
	call	anagram
	cmpl	$1, %eax
	jne	.L61
	addq	$1, 16(%r15)
.L44:
	addq	$11, %rbp
	addq	$24, %r13
	cmpq	%rbp, %r14
	jne	.L39
.L33:
	movq	24(%rsp), %rsi
	leaq	80104(%rsp), %rdi
	xorl	%r8d, %r8d
	.p2align 4,,10
	.p2align 3
.L43:
	movq	(%rsi), %rcx
	testq	%rcx, %rcx
	je	.L41
	.p2align 4,,10
	.p2align 3
.L42:
	movq	16(%rcx), %rax
	movq	(%rcx), %rcx
	leaq	-1(%rax), %rdx
	imulq	%rax, %rdx
	movq	%rdx, %rax
	shrq	$63, %rax
	addq	%rdx, %rax
	sarq	%rax
	addq	%rax, %r8
	testq	%rcx, %rcx
	jne	.L42
.L41:
	addq	$8, %rsi
	cmpq	%rdi, %rsi
	jne	.L43
	movl	$1, %edi
	xorl	%eax, %eax
	movq	%r8, %rdx
	leaq	.LC2(%rip), %rsi
	call	__printf_chk@PLT
	movq	stdout(%rip), %rdi
	call	fflush@PLT
	movq	3580152(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L62
	addq	$3580168, %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
.L36:
	.cfi_restore_state
	movdqa	(%rsp), %xmm2
	movq	$1, 16(%r13)
	movq	%r13, 48(%rsp,%rbx,8)
	movups	%xmm2, 0(%r13)
	jmp	.L44
.L46:
	xorl	%ebx, %ebx
	jmp	.L34
.L30:
	leaq	48(%rsp), %rax
	movl	$80056, %edx
	xorl	%esi, %esi
	movq	%rax, %rdi
	movq	%rax, 24(%rsp)
	call	memset@PLT
	jmp	.L33
.L62:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE41:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:

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

typedef struct List {
	struct List *next;
	char *str;
	long long count;
} list;

int hash_string(char* s)
{
	long long x = 0;
	int i;
	for (i = 0; s[i] != 0; i++)	x += 1 << ((s[i] - 'a') * 2);
	return x % 10007;
}

int anagram(char* s1, char* s2)
{
	int i, count[2][26] = {}, flag = 1;
	for (i = 0; s1[i] != 0; i++) count[0][s1[i] - 'a']++;
	for (i = 0; s2[i] != 0; i++) count[1][s2[i] - 'a']++;
	for (i = 0; i < 26; i++) if (count[0][i] != count[1][i]) break;
	if (i == 26) return 1;
	else return 0;
}

int main()
{
	int i, N;
	char s[100001][11] = {};
	scanf("%d", &N);
	for (i = 1; i <= N; i++) scanf("%s", s[i]);

	int k;
	long long sum = 0;
	list *p, *hash[10007] = {}, data[100001];
	for (i = 1; i <= N; i++) {
		k = hash_string(s[i]);
		for (p = hash[k]; p != NULL; p = p->next) {
			if (anagram(s[i], p->str) == 1) break;
		}
		if (p == NULL) {
			data[i].str = s[i];
			data[i].count = 1;
			data[i].next = hash[k];
			hash[k] = &(data[i]);
		} else (p->count)++;
	}
	for (k = 0; k < 10007; k++) {
		for (p = hash[k]; p != NULL; p = p->next) sum += p->count * (p->count - 1) / 2;
	} 
	printf("%lld\n", sum);
	fflush(stdout);
	return 0;
}
5
abaaaaaaaa
oweplustno
aaaaaaaaba
twoplusone
aaaabaaaaa
 2
oneplustwo
nioemodsix
 3
acornistnt
peaoutbnmb
constraint
 5
abaaaaaaaa
oweplustmo
aaaaaaaaba
unoselpowt
aaaaaaaaba
 5
abaaaaaaaa
oweplustno
aaaaaaaaba
twoplusone
aaaaaaaaba
 2
onepltsuwo
nioemodsix
 3
acornistnt
peaoutbnmb
nonstraict
 5
abaaaaaaaa
oweplustno
aaaaaaaaba
enosulpowt
aaaaaaaaba
 2
owustlpeno
nioemodsix
 3
acornistnt
bmnbtuoaep
nonstraict

4
 0
 1
 3
 4
 0
 1
 4
 0
 1

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

```c
#include <stdio.h>
#include <stdlib.h>

typedef struct List {
	struct List *next;
	char *str;
	long long count;
} list;

int hash_string(char* s)
{
	long long x = 0;
	int i;
	for (i = 0; s[i] != 0; i++)	x += 1 << ((s[i] - 'a') * 2);
	return x % 10007;
}

int anagram(char* s1, char* s2)
{
	int i, count[2][26] = {}, flag = 1;
	for (i = 0; s1[i] != 0; i++) count[0][s1[i] - 'a']++;
	for (i = 0; s2[i] != 0; i++) count[1][s2[i] - 'a']++;
	for (i = 0; i < 26; i++) if (count[0][i] != count[1][i]) break;
	if (i == 26) return 1;
	else return 0;
}

int main()
{
	int i, N;
	char s[100001][11] = {};
	scanf("%d", &N);
	for (i = 1; i <= N; i++) scanf("%s", s[i]);

	int k;
	long long sum = 0;
	list *p, *hash[10007] = {}, data[100001];
	for (i = 1; i <= N; i++) {
		k = hash_string(s[i]);
		for (p = hash[k]; p != NULL; p = p->next) {
			if (anagram(s[i], p->str) == 1) break;
		}
		if (p == NULL) {
			data[i].str = s[i];
			data[i].count = 1;
			data[i].next = hash[k];
			hash[k] = &(data[i]);
		} else (p->count)++;
	}
	for (k = 0; k < 10007; k++) {
		for (p = hash[k]; p != NULL; p = p->next) sum += p->count * (p->count - 1) / 2;
	} 
	printf("%lld\n", sum);
	fflush(stdout);
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	hash_string
	.type	hash_string, @function
hash_string:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -24(%rbp)
	movq	$0, -8(%rbp)
	movl	$0, -12(%rbp)
	jmp	.L2
.L3:
	movl	-12(%rbp), %eax
	movslq	%eax, %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	subl	$97, %eax
	addl	%eax, %eax
	movl	$1, %edx
	movl	%eax, %ecx
	sall	%cl, %edx
	movl	%edx, %eax
	cltq
	addq	%rax, -8(%rbp)
	addl	$1, -12(%rbp)
.L2:
	movl	-12(%rbp), %eax
	movslq	%eax, %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	testb	%al, %al
	jne	.L3
	movq	-8(%rbp), %rcx
	movabsq	$7550501021876119059, %rdx
	movq	%rcx, %rax
	imulq	%rdx
	movq	%rdx, %rax
	sarq	$12, %rax
	movq	%rcx, %rdx
	sarq	$63, %rdx
	subq	%rdx, %rax
	imulq	$10007, %rax, %rdx
	movq	%rcx, %rax
	subq	%rdx, %rax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	hash_string, .-hash_string
	.globl	anagram
	.type	anagram, @function
anagram:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$256, %rsp
	movq	%rdi, -248(%rbp)
	movq	%rsi, -256(%rbp)
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-224(%rbp), %rdx
	movl	$0, %eax
	movl	$26, %ecx
	movq	%rdx, %rdi
	rep stosq
	movl	$1, -228(%rbp)
	movl	$0, -232(%rbp)
	jmp	.L6
.L7:
	movl	-232(%rbp), %eax
	movslq	%eax, %rdx
	movq	-248(%rbp), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	subl	$97, %eax
	movslq	%eax, %rdx
	movl	-224(%rbp,%rdx,4), %edx
	addl	$1, %edx
	cltq
	movl	%edx, -224(%rbp,%rax,4)
	addl	$1, -232(%rbp)
.L6:
	movl	-232(%rbp), %eax
	movslq	%eax, %rdx
	movq	-248(%rbp), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	testb	%al, %al
	jne	.L7
	movl	$0, -232(%rbp)
	jmp	.L8
.L9:
	movl	-232(%rbp), %eax
	movslq	%eax, %rdx
	movq	-256(%rbp), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	subl	$97, %eax
	movslq	%eax, %rdx
	addq	$26, %rdx
	movl	-224(%rbp,%rdx,4), %edx
	addl	$1, %edx
	cltq
	addq	$26, %rax
	movl	%edx, -224(%rbp,%rax,4)
	addl	$1, -232(%rbp)
.L8:
	movl	-232(%rbp), %eax
	movslq	%eax, %rdx
	movq	-256(%rbp), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	testb	%al, %al
	jne	.L9
	movl	$0, -232(%rbp)
	jmp	.L10
.L13:
	movl	-232(%rbp), %eax
	cltq
	movl	-224(%rbp,%rax,4), %edx
	movl	-232(%rbp), %eax
	cltq
	addq	$26, %rax
	movl	-224(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	jne	.L18
	addl	$1, -232(%rbp)
.L10:
	cmpl	$25, -232(%rbp)
	jle	.L13
	jmp	.L12
.L18:
	nop
.L12:
	cmpl	$26, -232(%rbp)
	jne	.L14
	movl	$1, %eax
	jmp	.L16
.L14:
	movl	$0, %eax
.L16:
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L17
	call	__stack_chk_fail@PLT
.L17:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	anagram, .-anagram
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%s"
.LC2:
	.string	"%lld\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	leaq	-3579904(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$240, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-3500048(%rbp), %rax
	movl	$1100011, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	leaq	-3580140(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$1, -3580136(%rbp)
	jmp	.L20
.L21:
	leaq	-3500048(%rbp), %rcx
	movl	-3580136(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -3580136(%rbp)
.L20:
	movl	-3580140(%rbp), %eax
	cmpl	%eax, -3580136(%rbp)
	jle	.L21
	movq	$0, -3580128(%rbp)
	leaq	-3580112(%rbp), %rax
	movl	$80056, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	movl	$1, -3580136(%rbp)
	jmp	.L22
.L29:
	leaq	-3500048(%rbp), %rcx
	movl	-3580136(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	addq	%rcx, %rax
	movq	%rax, %rdi
	call	hash_string
	movl	%eax, -3580132(%rbp)
	movl	-3580132(%rbp), %eax
	cltq
	movq	-3580112(%rbp,%rax,8), %rax
	movq	%rax, -3580120(%rbp)
	jmp	.L23
.L26:
	movq	-3580120(%rbp), %rax
	movq	8(%rax), %rcx
	leaq	-3500048(%rbp), %rsi
	movl	-3580136(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	addq	%rsi, %rax
	movq	%rcx, %rsi
	movq	%rax, %rdi
	call	anagram
	cmpl	$1, %eax
	je	.L36
	movq	-3580120(%rbp), %rax
	movq	(%rax), %rax
	movq	%rax, -3580120(%rbp)
.L23:
	cmpq	$0, -3580120(%rbp)
	jne	.L26
	jmp	.L25
.L36:
	nop
.L25:
	cmpq	$0, -3580120(%rbp)
	jne	.L27
	leaq	-3500048(%rbp), %rcx
	movl	-3580136(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	addq	%rax, %rcx
	movl	-3580136(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	addq	%rbp, %rax
	subq	$2400024, %rax
	movq	%rcx, (%rax)
	movl	-3580136(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	addq	%rbp, %rax
	subq	$2400016, %rax
	movq	$1, (%rax)
	movl	-3580132(%rbp), %eax
	cltq
	movq	-3580112(%rbp,%rax,8), %rdx
	movl	-3580136(%rbp), %eax
	movslq	%eax, %rcx
	movq	%rcx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	salq	$3, %rax
	addq	%rbp, %rax
	subq	$2400032, %rax
	movq	%rdx, (%rax)
	leaq	-2400032(%rbp), %rcx
	movl	-3580136(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	leaq	(%rcx,%rax), %rdx
	movl	-3580132(%rbp), %eax
	cltq
	movq	%rdx, -3580112(%rbp,%rax,8)
	jmp	.L28
.L27:
	movq	-3580120(%rbp), %rax
	movq	16(%rax), %rax
	leaq	1(%rax), %rdx
	movq	-3580120(%rbp), %rax
	movq	%rdx, 16(%rax)
.L28:
	addl	$1, -3580136(%rbp)
.L22:
	movl	-3580140(%rbp), %eax
	cmpl	%eax, -3580136(%rbp)
	jle	.L29
	movl	$0, -3580132(%rbp)
	jmp	.L30
.L33:
	movl	-3580132(%rbp), %eax
	cltq
	movq	-3580112(%rbp,%rax,8), %rax
	movq	%rax, -3580120(%rbp)
	jmp	.L31
.L32:
	movq	-3580120(%rbp), %rax
	movq	16(%rax), %rdx
	movq	-3580120(%rbp), %rax
	movq	16(%rax), %rax
	subq	$1, %rax
	imulq	%rdx, %rax
	movq	%rax, %rdx
	shrq	$63, %rdx
	addq	%rdx, %rax
	sarq	%rax
	addq	%rax, -3580128(%rbp)
	movq	-3580120(%rbp), %rax
	movq	(%rax), %rax
	movq	%rax, -3580120(%rbp)
.L31:
	cmpq	$0, -3580120(%rbp)
	jne	.L32
	addl	$1, -3580132(%rbp)
.L30:
	cmpl	$10006, -3580132(%rbp)
	jle	.L33
	movq	-3580128(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movq	stdout(%rip), %rax
	movq	%rax, %rdi
	call	fflush@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L35
	call	__stack_chk_fail@PLT
.L35:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.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	hash_string
	.type	hash_string, @function
hash_string:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -24(%rbp)
	movq	$0, -8(%rbp)
	movl	$0, -12(%rbp)
	jmp	.L2
.L3:
	movl	-12(%rbp), %eax
	movslq	%eax, %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	subl	$97, %eax
	addl	%eax, %eax
	movl	$1, %edx
	movl	%eax, %ecx
	sall	%cl, %edx
	movl	%edx, %eax
	cltq
	addq	%rax, -8(%rbp)
	addl	$1, -12(%rbp)
.L2:
	movl	-12(%rbp), %eax
	movslq	%eax, %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	testb	%al, %al
	jne	.L3
	movq	-8(%rbp), %rcx
	movabsq	$7550501021876119059, %rdx
	movq	%rcx, %rax
	imulq	%rdx
	movq	%rdx, %rax
	sarq	$12, %rax
	movq	%rcx, %rdx
	sarq	$63, %rdx
	subq	%rdx, %rax
	imulq	$10007, %rax, %rdx
	movq	%rcx, %rax
	subq	%rdx, %rax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	hash_string, .-hash_string
	.globl	anagram
	.type	anagram, @function
anagram:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$256, %rsp
	movq	%rdi, -248(%rbp)
	movq	%rsi, -256(%rbp)
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-224(%rbp), %rdx
	movl	$0, %eax
	movl	$26, %ecx
	movq	%rdx, %rdi
	rep stosq
	movl	$1, -228(%rbp)
	movl	$0, -232(%rbp)
	jmp	.L6
.L7:
	movl	-232(%rbp), %eax
	movslq	%eax, %rdx
	movq	-248(%rbp), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	subl	$97, %eax
	movslq	%eax, %rdx
	movl	-224(%rbp,%rdx,4), %edx
	addl	$1, %edx
	cltq
	movl	%edx, -224(%rbp,%rax,4)
	addl	$1, -232(%rbp)
.L6:
	movl	-232(%rbp), %eax
	movslq	%eax, %rdx
	movq	-248(%rbp), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	testb	%al, %al
	jne	.L7
	movl	$0, -232(%rbp)
	jmp	.L8
.L9:
	movl	-232(%rbp), %eax
	movslq	%eax, %rdx
	movq	-256(%rbp), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	subl	$97, %eax
	movslq	%eax, %rdx
	addq	$26, %rdx
	movl	-224(%rbp,%rdx,4), %edx
	addl	$1, %edx
	cltq
	addq	$26, %rax
	movl	%edx, -224(%rbp,%rax,4)
	addl	$1, -232(%rbp)
.L8:
	movl	-232(%rbp), %eax
	movslq	%eax, %rdx
	movq	-256(%rbp), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	testb	%al, %al
	jne	.L9
	movl	$0, -232(%rbp)
	jmp	.L10
.L13:
	movl	-232(%rbp), %eax
	cltq
	movl	-224(%rbp,%rax,4), %edx
	movl	-232(%rbp), %eax
	cltq
	addq	$26, %rax
	movl	-224(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	jne	.L18
	addl	$1, -232(%rbp)
.L10:
	cmpl	$25, -232(%rbp)
	jle	.L13
	jmp	.L12
.L18:
	nop
.L12:
	cmpl	$26, -232(%rbp)
	jne	.L14
	movl	$1, %eax
	jmp	.L16
.L14:
	movl	$0, %eax
.L16:
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L17
	call	__stack_chk_fail@PLT
.L17:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	anagram, .-anagram
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%s"
.LC2:
	.string	"%lld\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	leaq	-3579904(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$240, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-3500048(%rbp), %rax
	movl	$1100011, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	leaq	-3580140(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$1, -3580136(%rbp)
	jmp	.L20
.L21:
	leaq	-3500048(%rbp), %rcx
	movl	-3580136(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -3580136(%rbp)
.L20:
	movl	-3580140(%rbp), %eax
	cmpl	%eax, -3580136(%rbp)
	jle	.L21
	movq	$0, -3580128(%rbp)
	leaq	-3580112(%rbp), %rax
	movl	$80056, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	movl	$1, -3580136(%rbp)
	jmp	.L22
.L29:
	leaq	-3500048(%rbp), %rcx
	movl	-3580136(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	addq	%rcx, %rax
	movq	%rax, %rdi
	call	hash_string
	movl	%eax, -3580132(%rbp)
	movl	-3580132(%rbp), %eax
	cltq
	movq	-3580112(%rbp,%rax,8), %rax
	movq	%rax, -3580120(%rbp)
	jmp	.L23
.L26:
	movq	-3580120(%rbp), %rax
	movq	8(%rax), %rcx
	leaq	-3500048(%rbp), %rsi
	movl	-3580136(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	addq	%rsi, %rax
	movq	%rcx, %rsi
	movq	%rax, %rdi
	call	anagram
	cmpl	$1, %eax
	je	.L36
	movq	-3580120(%rbp), %rax
	movq	(%rax), %rax
	movq	%rax, -3580120(%rbp)
.L23:
	cmpq	$0, -3580120(%rbp)
	jne	.L26
	jmp	.L25
.L36:
	nop
.L25:
	cmpq	$0, -3580120(%rbp)
	jne	.L27
	leaq	-3500048(%rbp), %rcx
	movl	-3580136(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	addq	%rax, %rcx
	movl	-3580136(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	addq	%rbp, %rax
	subq	$2400024, %rax
	movq	%rcx, (%rax)
	movl	-3580136(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	addq	%rbp, %rax
	subq	$2400016, %rax
	movq	$1, (%rax)
	movl	-3580132(%rbp), %eax
	cltq
	movq	-3580112(%rbp,%rax,8), %rdx
	movl	-3580136(%rbp), %eax
	movslq	%eax, %rcx
	movq	%rcx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	salq	$3, %rax
	addq	%rbp, %rax
	subq	$2400032, %rax
	movq	%rdx, (%rax)
	leaq	-2400032(%rbp), %rcx
	movl	-3580136(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	leaq	(%rcx,%rax), %rdx
	movl	-3580132(%rbp), %eax
	cltq
	movq	%rdx, -3580112(%rbp,%rax,8)
	jmp	.L28
.L27:
	movq	-3580120(%rbp), %rax
	movq	16(%rax), %rax
	leaq	1(%rax), %rdx
	movq	-3580120(%rbp), %rax
	movq	%rdx, 16(%rax)
.L28:
	addl	$1, -3580136(%rbp)
.L22:
	movl	-3580140(%rbp), %eax
	cmpl	%eax, -3580136(%rbp)
	jle	.L29
	movl	$0, -3580132(%rbp)
	jmp	.L30
.L33:
	movl	-3580132(%rbp), %eax
	cltq
	movq	-3580112(%rbp,%rax,8), %rax
	movq	%rax, -3580120(%rbp)
	jmp	.L31
.L32:
	movq	-3580120(%rbp), %rax
	movq	16(%rax), %rdx
	movq	-3580120(%rbp), %rax
	movq	16(%rax), %rax
	subq	$1, %rax
	imulq	%rdx, %rax
	movq	%rax, %rdx
	shrq	$63, %rdx
	addq	%rdx, %rax
	sarq	%rax
	addq	%rax, -3580128(%rbp)
	movq	-3580120(%rbp), %rax
	movq	(%rax), %rax
	movq	%rax, -3580120(%rbp)
.L31:
	cmpq	$0, -3580120(%rbp)
	jne	.L32
	addl	$1, -3580132(%rbp)
.L30:
	cmpl	$10006, -3580132(%rbp)
	jle	.L33
	movq	-3580128(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movq	stdout(%rip), %rax
	movq	%rax, %rdi
	call	fflush@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L35
	call	__stack_chk_fail@PLT
.L35:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.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:
