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>
#define NMAX 10
#define FMAX 3628800
#define min(a, b) ((a) < (b) ? (a) : (b))

int hash(int *a, int asize);
void rev_sort(int l, int r, int *a, int asize);
void bfs(int *a, int asize, char *memo, int depth, int maxdepth);
int main (void)
{
  int i, n, maxdepth, fact = 1, res = 9, a[NMAX], b[NMAX];
  char memo1[FMAX], memo2[FMAX];
  scanf("%d", &n);
  maxdepth = (n - 1) / 2;
  for (i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    fact *= i + 1;
    b[i] = i + 1;
  }
  for (i = 0; i < fact; i++) memo1[i] = memo2[i] = n;
  memo1[hash(a, n)] = memo2[hash(b, n)] = 0;
  bfs(a, n, memo1, 0, maxdepth);
  bfs(b, n, memo2, 0, maxdepth);
  for (i = 0; i < fact; i++) res = min(res, memo1[i] + memo2[i]);
  printf("%d\n", res);
}

int hash(int *a, int asize)
{
  int i, j, res = 0, fact = 1;
  for (i = 0; i < asize; i++) {
    int grade = 0;
    for (j = i + 1; j < asize; j++) if (a[i] < a[j]) grade++;
    res += grade * fact;
    fact *= asize - i;
  }
  return res;
}

void rev_sort(int l, int r, int *a, int asize)
{
  int i;
  for (i = 0; i < asize; i++) {
    int temp;
    if (l + i >= r - i) break;
    temp = a[l+i];
    a[l+i] = a[r-i];
    a[r-i] = temp;
  }
}

void bfs(int *a, int asize, char *memo, int depth, int maxdepth)
{
  int i, j;
  if (depth >= maxdepth) return;
  for (i = 0; i < asize; i++) {
    for (j = i + 1; j < asize; j++) {
      int h;
      rev_sort(i, j, a, asize);
      h = hash(a, asize);
      if (memo[h] > depth + 1) {
        memo[h] = depth + 1;
        bfs(a, asize, memo, depth + 1, maxdepth);
      }
      rev_sort(i, j, a, asize);
    }
  }
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%rbx
	leaq	-7254016(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$3736, %rsp
	.cfi_offset 3, -24
	movq	%fs:40, %rax
	movq	%rax, -24(%rbp)
	xorl	%eax, %eax
	movl	$1, -7257740(%rbp)
	movl	$9, -7257736(%rbp)
	leaq	-7257748(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-7257748(%rbp), %eax
	subl	$1, %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, -7257732(%rbp)
	movl	$0, -7257744(%rbp)
	jmp	.L2
.L3:
	leaq	-7257728(%rbp), %rdx
	movl	-7257744(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-7257744(%rbp), %eax
	leal	1(%rax), %edx
	movl	-7257740(%rbp), %eax
	imull	%edx, %eax
	movl	%eax, -7257740(%rbp)
	movl	-7257744(%rbp), %eax
	leal	1(%rax), %edx
	movl	-7257744(%rbp), %eax
	cltq
	movl	%edx, -7257680(%rbp,%rax,4)
	addl	$1, -7257744(%rbp)
.L2:
	movl	-7257748(%rbp), %eax
	cmpl	%eax, -7257744(%rbp)
	jl	.L3
	movl	$0, -7257744(%rbp)
	jmp	.L4
.L5:
	movl	-7257748(%rbp), %eax
	movl	%eax, %edx
	movl	-7257744(%rbp), %eax
	cltq
	movb	%dl, -3628832(%rbp,%rax)
	movl	-7257744(%rbp), %eax
	cltq
	movzbl	-3628832(%rbp,%rax), %edx
	movl	-7257744(%rbp), %eax
	cltq
	movb	%dl, -7257632(%rbp,%rax)
	addl	$1, -7257744(%rbp)
.L4:
	movl	-7257744(%rbp), %eax
	cmpl	-7257740(%rbp), %eax
	jl	.L5
	movl	-7257748(%rbp), %edx
	leaq	-7257680(%rbp), %rax
	movl	%edx, %esi
	movq	%rax, %rdi
	call	hash
	movl	%eax, %ebx
	movslq	%ebx, %rax
	movb	$0, -3628832(%rbp,%rax)
	movl	-7257748(%rbp), %edx
	leaq	-7257728(%rbp), %rax
	movl	%edx, %esi
	movq	%rax, %rdi
	call	hash
	movslq	%ebx, %rdx
	movzbl	-3628832(%rbp,%rdx), %edx
	cltq
	movb	%dl, -7257632(%rbp,%rax)
	movl	-7257748(%rbp), %esi
	movl	-7257732(%rbp), %ecx
	leaq	-7257632(%rbp), %rdx
	leaq	-7257728(%rbp), %rax
	movl	%ecx, %r8d
	movl	$0, %ecx
	movq	%rax, %rdi
	call	bfs
	movl	-7257748(%rbp), %esi
	movl	-7257732(%rbp), %ecx
	leaq	-3628832(%rbp), %rdx
	leaq	-7257680(%rbp), %rax
	movl	%ecx, %r8d
	movl	$0, %ecx
	movq	%rax, %rdi
	call	bfs
	movl	$0, -7257744(%rbp)
	jmp	.L6
.L7:
	movl	-7257744(%rbp), %eax
	cltq
	movzbl	-7257632(%rbp,%rax), %eax
	movsbl	%al, %edx
	movl	-7257744(%rbp), %eax
	cltq
	movzbl	-3628832(%rbp,%rax), %eax
	movsbl	%al, %eax
	addl	%eax, %edx
	movl	-7257736(%rbp), %eax
	cmpl	%edx, %eax
	cmovg	%edx, %eax
	movl	%eax, -7257736(%rbp)
	addl	$1, -7257744(%rbp)
.L6:
	movl	-7257744(%rbp), %eax
	cmpl	-7257740(%rbp), %eax
	jl	.L7
	movl	-7257736(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-24(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L9
	call	__stack_chk_fail@PLT
.L9:
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	hash
	.type	hash, @function
hash:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -40(%rbp)
	movl	%esi, -44(%rbp)
	movl	$0, -12(%rbp)
	movl	$1, -8(%rbp)
	movl	$0, -20(%rbp)
	jmp	.L11
.L15:
	movl	$0, -4(%rbp)
	movl	-20(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -16(%rbp)
	jmp	.L12
.L14:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	movq	-40(%rbp), %rax
	addq	%rcx, %rax
	movl	(%rax), %eax
	cmpl	%eax, %edx
	jge	.L13
	addl	$1, -4(%rbp)
.L13:
	addl	$1, -16(%rbp)
.L12:
	movl	-16(%rbp), %eax
	cmpl	-44(%rbp), %eax
	jl	.L14
	movl	-4(%rbp), %eax
	imull	-8(%rbp), %eax
	addl	%eax, -12(%rbp)
	movl	-44(%rbp), %eax
	subl	-20(%rbp), %eax
	movl	-8(%rbp), %edx
	imull	%edx, %eax
	movl	%eax, -8(%rbp)
	addl	$1, -20(%rbp)
.L11:
	movl	-20(%rbp), %eax
	cmpl	-44(%rbp), %eax
	jl	.L15
	movl	-12(%rbp), %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	hash, .-hash
	.globl	rev_sort
	.type	rev_sort, @function
rev_sort:
.LFB2:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -20(%rbp)
	movl	%esi, -24(%rbp)
	movq	%rdx, -32(%rbp)
	movl	%ecx, -36(%rbp)
	movl	$0, -8(%rbp)
	jmp	.L18
.L21:
	movl	-20(%rbp), %edx
	movl	-8(%rbp), %eax
	addl	%eax, %edx
	movl	-24(%rbp), %eax
	subl	-8(%rbp), %eax
	cmpl	%eax, %edx
	jge	.L22
	movl	-20(%rbp), %edx
	movl	-8(%rbp), %eax
	addl	%edx, %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	%eax, -4(%rbp)
	movl	-24(%rbp), %eax
	subl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movl	-20(%rbp), %ecx
	movl	-8(%rbp), %edx
	addl	%ecx, %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	movq	-32(%rbp), %rdx
	addq	%rcx, %rdx
	movl	(%rax), %eax
	movl	%eax, (%rdx)
	movl	-24(%rbp), %eax
	subl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-32(%rbp), %rax
	addq	%rax, %rdx
	movl	-4(%rbp), %eax
	movl	%eax, (%rdx)
	addl	$1, -8(%rbp)
.L18:
	movl	-8(%rbp), %eax
	cmpl	-36(%rbp), %eax
	jl	.L21
	jmp	.L23
.L22:
	nop
.L23:
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	rev_sort, .-rev_sort
	.globl	bfs
	.type	bfs, @function
bfs:
.LFB3:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$48, %rsp
	movq	%rdi, -24(%rbp)
	movl	%esi, -28(%rbp)
	movq	%rdx, -40(%rbp)
	movl	%ecx, -32(%rbp)
	movl	%r8d, -44(%rbp)
	movl	-32(%rbp), %eax
	cmpl	-44(%rbp), %eax
	jge	.L32
	movl	$0, -12(%rbp)
	jmp	.L27
.L31:
	movl	-12(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -8(%rbp)
	jmp	.L28
.L30:
	movl	-28(%rbp), %ecx
	movq	-24(%rbp), %rdx
	movl	-8(%rbp), %esi
	movl	-12(%rbp), %eax
	movl	%eax, %edi
	call	rev_sort
	movl	-28(%rbp), %edx
	movq	-24(%rbp), %rax
	movl	%edx, %esi
	movq	%rax, %rdi
	call	hash
	movl	%eax, -4(%rbp)
	movl	-4(%rbp), %eax
	movslq	%eax, %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	movl	-32(%rbp), %edx
	addl	$1, %edx
	cmpl	%edx, %eax
	jle	.L29
	movl	-32(%rbp), %eax
	leal	1(%rax), %ecx
	movl	-4(%rbp), %eax
	movslq	%eax, %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	%ecx, %edx
	movb	%dl, (%rax)
	movl	-32(%rbp), %eax
	leal	1(%rax), %ecx
	movl	-44(%rbp), %edi
	movq	-40(%rbp), %rdx
	movl	-28(%rbp), %esi
	movq	-24(%rbp), %rax
	movl	%edi, %r8d
	movq	%rax, %rdi
	call	bfs
.L29:
	movl	-28(%rbp), %ecx
	movq	-24(%rbp), %rdx
	movl	-8(%rbp), %esi
	movl	-12(%rbp), %eax
	movl	%eax, %edi
	call	rev_sort
	addl	$1, -8(%rbp)
.L28:
	movl	-8(%rbp), %eax
	cmpl	-28(%rbp), %eax
	jl	.L30
	addl	$1, -12(%rbp)
.L27:
	movl	-12(%rbp), %eax
	cmpl	-28(%rbp), %eax
	jl	.L31
	jmp	.L24
.L32:
	nop
.L24:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE3:
	.size	bfs, .-bfs
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```

Only output the optimized assembly code. Do not include any other text. Do not write any comments in the assembly code. Wrap the assembly code in ```assembly``` tags.
user
	.file	"temp.c"
	.text
	.p2align 4
	.type	bfs.part.0, @function
bfs.part.0:
.LFB27:
	.cfi_startproc
	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
	subq	$88, %rsp
	.cfi_def_cfa_offset 144
	movq	%rdx, 16(%rsp)
	movl	%r8d, 64(%rsp)
	testl	%esi, %esi
	jle	.L1
	movq	%rdi, %r13
	leal	1(%rcx), %edi
	movl	%esi, %r14d
	movl	%ecx, %eax
	movl	%edi, 40(%rsp)
	cmpl	$1, %esi
	je	.L1
	addl	$1, %eax
	leal	-1(%rsi), %edi
	leal	1(%rsi), %r15d
	movl	%esi, %r12d
	movq	$0, 8(%rsp)
	movb	%al, 71(%rsp)
	movl	%edi, 60(%rsp)
	movq	%rdi, 72(%rsp)
	leaq	4(%r13), %rdi
	movq	%rdi, 24(%rsp)
	movq	%r13, %rdi
.L10:
	movq	8(%rsp), %rax
	movl	%eax, %ebx
	movl	%eax, 56(%rsp)
	movl	%eax, %ebp
	addl	$1, %ebx
	movl	%ebx, 44(%rsp)
	movl	%ebx, (%rsp)
	cmpl	%ebx, %eax
	jge	.L3
.L4:
	movslq	(%rsp), %rax
	leaq	(%rdi,%rax,4), %r13
	addl	%eax, %ebp
	movq	8(%rsp), %rax
	leaq	(%rdi,%rax,4), %rax
	movq	%rax, 32(%rsp)
.L25:
	movq	8(%rsp), %rbx
	movl	0(%r13), %edx
	movq	%r13, %rcx
	movl	(%rdi,%rbx,4), %eax
	movl	%edx, (%rdi,%rbx,4)
	movq	32(%rsp), %rdx
	movl	%eax, 0(%r13)
	movl	44(%rsp), %eax
	.p2align 4,,10
	.p2align 3
.L12:
	movl	%ebp, %esi
	subl	%eax, %esi
	cmpl	%eax, %esi
	jle	.L11
	movl	4(%rdx), %esi
	movl	-4(%rcx), %r8d
	addl	$1, %eax
	addq	$4, %rdx
	subq	$4, %rcx
	movl	%r8d, (%rdx)
	movl	%esi, (%rcx)
	cmpl	%r12d, %eax
	jne	.L12
.L11:
	movl	%ebp, 48(%rsp)
	movq	24(%rsp), %rcx
	xorl	%r11d, %r11d
	movl	$1, %r9d
	movl	60(%rsp), %ebp
	movl	$1, %ebx
	.p2align 4,,10
	.p2align 3
.L20:
	movl	%r14d, %edx
	movl	$1, %eax
	movl	-4(%rcx), %r8d
	subl	%ebx, %edx
	cmpl	%ebx, %r14d
	cmovle	%eax, %edx
	movl	%ebp, %eax
	subl	%ebx, %eax
	cmpl	$2, %eax
	jbe	.L30
	cmpl	%ebx, %r14d
	jle	.L30
	movl	%edx, %eax
	movd	%r8d, %xmm3
	pxor	%xmm1, %xmm1
	shrl	$2, %eax
	pshufd	$0, %xmm3, %xmm2
	subl	$1, %eax
	salq	$4, %rax
	leaq	16(%rcx,%rax), %rsi
	movq	%rcx, %rax
	.p2align 4,,10
	.p2align 3
.L14:
	movdqu	(%rax), %xmm0
	addq	$16, %rax
	pcmpgtd	%xmm2, %xmm0
	psubd	%xmm0, %xmm1
	cmpq	%rax, %rsi
	jne	.L14
	movdqa	%xmm1, %xmm0
	movl	%edx, %r10d
	psrldq	$8, %xmm0
	andl	$-4, %r10d
	paddd	%xmm0, %xmm1
	leal	(%r10,%rbx), %esi
	movdqa	%xmm1, %xmm0
	psrldq	$4, %xmm0
	paddd	%xmm0, %xmm1
	movd	%xmm1, %eax
	cmpl	%r10d, %edx
	je	.L15
.L13:
	movslq	%esi, %rdx
	cmpl	%r8d, (%rdi,%rdx,4)
	leaq	0(,%rdx,4), %r10
	setg	%dl
	movzbl	%dl, %edx
	addl	%edx, %eax
	leal	1(%rsi), %edx
	cmpl	%edx, %r14d
	jle	.L15
	cmpl	%r8d, 4(%rdi,%r10)
	jle	.L17
	addl	$1, %eax
.L17:
	addl	$2, %esi
	cmpl	%esi, %r14d
	jle	.L15
	cmpl	8(%rdi,%r10), %r8d
	jge	.L15
	addl	$1, %eax
.L15:
	imull	%r9d, %eax
	addq	$4, %rcx
	addl	%eax, %r11d
	movl	%r15d, %eax
	subl	%ebx, %eax
	imull	%eax, %r9d
	leal	1(%rbx), %eax
	cmpl	%eax, %r14d
	je	.L43
	movl	%eax, %ebx
	jmp	.L20
.L3:
	movl	(%rdi), %r8d
	movq	24(%rsp), %rdx
	movl	%r14d, %eax
	xorl	%r9d, %r9d
	movl	$1, %esi
	jmp	.L27
	.p2align 4,,10
	.p2align 3
.L6:
	movl	%ecx, %r8d
.L27:
	movl	(%rdx), %ecx
	cmpl	%ecx, %r8d
	jge	.L5
	addl	%esi, %r9d
.L5:
	imull	%eax, %esi
	subl	$1, %eax
	addq	$4, %rdx
	cmpl	$1, %eax
	jne	.L6
	movslq	%r9d, %rax
	addq	16(%rsp), %rax
	movsbl	(%rax), %edx
	cmpl	40(%rsp), %edx
	jg	.L44
.L9:
	leal	2(%rbp), %eax
	movl	%eax, (%rsp)
	cmpl	%eax, %r14d
	jg	.L4
.L26:
	addq	$1, 8(%rsp)
	addl	$1, %r12d
	movq	8(%rsp), %rax
	cmpq	72(%rsp), %rax
	jne	.L10
.L1:
	addq	$88, %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
.L43:
	.cfi_restore_state
	movslq	%r11d, %rax
	addq	16(%rsp), %rax
	movl	48(%rsp), %ebp
	movsbl	(%rax), %edx
	cmpl	%edx, 40(%rsp)
	jl	.L45
.L22:
	movl	56(%rsp), %ecx
	cmpl	%ecx, (%rsp)
	jle	.L23
	movq	8(%rsp), %rsi
	movl	0(%r13), %edx
	movq	%r13, %rcx
	movl	(%rdi,%rsi,4), %eax
	movl	%edx, (%rdi,%rsi,4)
	movq	32(%rsp), %rdx
	movl	%eax, 0(%r13)
	movl	44(%rsp), %eax
	.p2align 4,,10
	.p2align 3
.L24:
	movl	%ebp, %esi
	subl	%eax, %esi
	cmpl	%eax, %esi
	jle	.L23
	movl	4(%rdx), %esi
	movl	-4(%rcx), %r8d
	addl	$1, %eax
	addq	$4, %rdx
	subq	$4, %rcx
	movl	%r8d, (%rdx)
	movl	%esi, (%rcx)
	cmpl	%r12d, %eax
	jne	.L24
.L23:
	movl	(%rsp), %ecx
	addq	$4, %r13
	addl	$1, %ebp
	leal	1(%rcx), %eax
	cmpl	%ecx, %ebx
	jle	.L26
	movl	%eax, (%rsp)
	jmp	.L25
.L30:
	movl	%ebx, %esi
	xorl	%eax, %eax
	jmp	.L13
.L45:
	movzbl	71(%rsp), %ecx
	movb	%cl, (%rax)
	movl	40(%rsp), %eax
	movl	64(%rsp), %ecx
	cmpl	%ecx, %eax
	jge	.L22
	movq	16(%rsp), %rdx
	movl	%ecx, %r8d
	movl	%r14d, %esi
	movl	%eax, %ecx
	movq	%rdi, 48(%rsp)
	call	bfs.part.0
	movq	48(%rsp), %rdi
	jmp	.L22
.L44:
	movzbl	71(%rsp), %ebx
	movb	%bl, (%rax)
	movl	40(%rsp), %eax
	movl	64(%rsp), %ebx
	cmpl	%ebx, %eax
	jge	.L9
	movq	16(%rsp), %rdx
	movl	%ebx, %r8d
	movl	%eax, %ecx
	movl	%r14d, %esi
	movq	%rdi, (%rsp)
	call	bfs.part.0
	movq	(%rsp), %rdi
	jmp	.L9
	.cfi_endproc
.LFE27:
	.size	bfs.part.0, .-bfs.part.0
	.p2align 4
	.globl	hash
	.type	hash, @function
hash:
.LFB24:
	.cfi_startproc
	endbr64
	testl	%esi, %esi
	jle	.L58
	movl	%esi, %ecx
	cmpl	$1, %esi
	je	.L58
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	movq	%rdi, %r10
	leaq	4(%rdi), %r8
	movl	$1, %r9d
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	xorl	%r11d, %r11d
	movl	$1, %edx
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	leal	-1(%rsi), %r12d
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	movl	$1, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	leal	1(%rsi), %ebx
	.p2align 4,,10
	.p2align 3
.L56:
	movl	%ecx, %edi
	movl	%r12d, %eax
	movl	-4(%r8), %r13d
	subl	%edx, %edi
	cmpl	%edx, %ecx
	cmovle	%ebp, %edi
	subl	%edx, %eax
	cmpl	$2, %eax
	jbe	.L59
	cmpl	%edx, %ecx
	jle	.L59
	movl	%edi, %eax
	movd	%r13d, %xmm3
	pxor	%xmm1, %xmm1
	shrl	$2, %eax
	pshufd	$0, %xmm3, %xmm2
	subl	$1, %eax
	salq	$4, %rax
	leaq	16(%r8,%rax), %rsi
	movq	%r8, %rax
	.p2align 4,,10
	.p2align 3
.L50:
	movdqu	(%rax), %xmm0
	addq	$16, %rax
	pcmpgtd	%xmm2, %xmm0
	psubd	%xmm0, %xmm1
	cmpq	%rax, %rsi
	jne	.L50
	movdqa	%xmm1, %xmm0
	movl	%edi, %r14d
	psrldq	$8, %xmm0
	andl	$-4, %r14d
	paddd	%xmm0, %xmm1
	leal	(%r14,%rdx), %esi
	movdqa	%xmm1, %xmm0
	psrldq	$4, %xmm0
	paddd	%xmm0, %xmm1
	movd	%xmm1, %eax
	cmpl	%r14d, %edi
	je	.L51
.L49:
	movslq	%esi, %rdi
	cmpl	%r13d, (%r10,%rdi,4)
	leaq	0(,%rdi,4), %r14
	setg	%dil
	movzbl	%dil, %edi
	addl	%edi, %eax
	leal	1(%rsi), %edi
	cmpl	%edi, %ecx
	jle	.L51
	cmpl	4(%r10,%r14), %r13d
	jge	.L53
	addl	$1, %eax
.L53:
	addl	$2, %esi
	cmpl	%esi, %ecx
	jle	.L51
	cmpl	8(%r10,%r14), %r13d
	jge	.L51
	addl	$1, %eax
.L51:
	imull	%r9d, %eax
	addq	$4, %r8
	addl	%eax, %r11d
	movl	%ebx, %eax
	subl	%edx, %eax
	addl	$1, %edx
	imull	%eax, %r9d
	cmpl	%edx, %ecx
	jne	.L56
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	movl	%r11d, %eax
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
.L59:
	.cfi_restore_state
	movl	%edx, %esi
	xorl	%eax, %eax
	jmp	.L49
.L58:
	.cfi_def_cfa_offset 8
	.cfi_restore 3
	.cfi_restore 6
	.cfi_restore 12
	.cfi_restore 13
	.cfi_restore 14
	xorl	%r11d, %r11d
	movl	%r11d, %eax
	ret
	.cfi_endproc
.LFE24:
	.size	hash, .-hash
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC1:
	.string	"%d"
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	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	-7254016(%rsp), %r11
	.cfi_def_cfa 11, 7254072
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$3736, %rsp
	.cfi_def_cfa_offset 7257808
	leaq	.LC1(%rip), %r14
	movq	%r14, %rdi
	movq	%fs:40, %rax
	movq	%rax, 7257736(%rsp)
	xorl	%eax, %eax
	leaq	28(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	28(%rsp), %r15d
	testl	%r15d, %r15d
	jle	.L67
	xorl	%ebx, %ebx
	movl	$1, %ebp
	leaq	32(%rsp), %r13
	leaq	80(%rsp), %r12
	.p2align 4,,10
	.p2align 3
.L68:
	leaq	0(%r13,%rbx,4), %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	leal	1(%rbx), %eax
	movl	28(%rsp), %r9d
	movl	%eax, (%r12,%rbx,4)
	addq	$1, %rbx
	imull	%eax, %ebp
	cmpl	%ebx, %r9d
	jg	.L68
	leaq	3628928(%rsp), %r14
	movsbl	%r9b, %esi
	movslq	%ebp, %rdx
	movl	%r9d, 12(%rsp)
	movq	%r14, %rdi
	movq	%rdx, (%rsp)
	leaq	128(%rsp), %rbx
	movl	%esi, 8(%rsp)
	call	memset@PLT
	movq	(%rsp), %rdx
	movl	8(%rsp), %esi
	movq	%rbx, %rdi
	call	memset@PLT
	movl	12(%rsp), %r9d
	movq	%r12, %rdi
	movl	%r9d, %esi
	movl	%r9d, 8(%rsp)
	call	hash
	movl	8(%rsp), %esi
	movq	%r13, %rdi
	cltq
	movb	$0, 3628928(%rsp,%rax)
	call	hash
	cltq
	movb	$0, 128(%rsp,%rax)
	cmpl	$2, %r15d
	jle	.L69
	subl	$1, %r15d
	movl	8(%rsp), %esi
	xorl	%ecx, %ecx
	movq	%rbx, %rdx
	sarl	%r15d
	movq	%r13, %rdi
	movl	%r15d, %r8d
	call	bfs.part.0
	movl	28(%rsp), %esi
	movl	%r15d, %r8d
	xorl	%ecx, %ecx
	movq	%r14, %rdx
	movq	%r12, %rdi
	call	bfs.part.0
.L69:
	leal	-1(%rbp), %eax
	cmpl	$14, %eax
	jbe	.L74
	movl	%ebp, %edx
	movdqa	.LC0(%rip), %xmm2
	xorl	%eax, %eax
	pxor	%xmm4, %xmm4
	shrl	$4, %edx
	pxor	%xmm3, %xmm3
	salq	$4, %rdx
	.p2align 4,,10
	.p2align 3
.L72:
	movdqa	(%rbx,%rax), %xmm5
	movdqa	(%r14,%rax), %xmm0
	movdqa	%xmm4, %xmm7
	movdqa	%xmm4, %xmm6
	addq	$16, %rax
	pcmpgtb	%xmm0, %xmm6
	pcmpgtb	%xmm5, %xmm7
	movdqa	%xmm5, %xmm8
	movdqa	%xmm0, %xmm1
	punpcklbw	%xmm6, %xmm1
	punpckhbw	%xmm7, %xmm5
	punpckhbw	%xmm6, %xmm0
	punpcklbw	%xmm7, %xmm8
	paddw	%xmm5, %xmm0
	movdqa	%xmm3, %xmm5
	paddw	%xmm8, %xmm1
	pcmpgtw	%xmm1, %xmm5
	movdqa	%xmm1, %xmm6
	punpcklwd	%xmm5, %xmm6
	punpckhwd	%xmm5, %xmm1
	movdqa	%xmm6, %xmm5
	pcmpgtd	%xmm1, %xmm5
	pand	%xmm5, %xmm1
	pandn	%xmm6, %xmm5
	movdqa	%xmm0, %xmm6
	por	%xmm1, %xmm5
	movdqa	%xmm3, %xmm1
	pcmpgtw	%xmm0, %xmm1
	punpcklwd	%xmm1, %xmm6
	punpckhwd	%xmm1, %xmm0
	movdqa	%xmm6, %xmm1
	pcmpgtd	%xmm0, %xmm1
	pand	%xmm1, %xmm0
	pandn	%xmm6, %xmm1
	por	%xmm1, %xmm0
	movdqa	%xmm5, %xmm1
	pcmpgtd	%xmm0, %xmm1
	pand	%xmm1, %xmm0
	pandn	%xmm5, %xmm1
	por	%xmm1, %xmm0
	movdqa	%xmm0, %xmm1
	pcmpgtd	%xmm2, %xmm1
	pand	%xmm1, %xmm2
	pandn	%xmm0, %xmm1
	por	%xmm1, %xmm2
	cmpq	%rdx, %rax
	jne	.L72
	movdqa	%xmm2, %xmm1
	movl	%ebp, %eax
	psrldq	$8, %xmm1
	andl	$-16, %eax
	movdqa	%xmm1, %xmm0
	pcmpgtd	%xmm2, %xmm0
	pand	%xmm0, %xmm2
	pandn	%xmm1, %xmm0
	por	%xmm2, %xmm0
	movdqa	%xmm0, %xmm2
	psrldq	$4, %xmm2
	movdqa	%xmm2, %xmm1
	pcmpgtd	%xmm0, %xmm1
	pand	%xmm1, %xmm0
	pandn	%xmm2, %xmm1
	por	%xmm0, %xmm1
	movd	%xmm1, %edx
	testb	$15, %bpl
	je	.L73
.L71:
	movslq	%eax, %rsi
	movsbl	128(%rsp,%rsi), %ecx
	movsbl	3628928(%rsp,%rsi), %esi
	addl	%esi, %ecx
	cmpl	%ecx, %edx
	cmovg	%ecx, %edx
	leal	1(%rax), %ecx
	cmpl	%ebp, %ecx
	jge	.L73
	movslq	%ecx, %rcx
	movsbl	128(%rsp,%rcx), %esi
	movsbl	3628928(%rsp,%rcx), %ecx
	addl	%esi, %ecx
	cmpl	%ecx, %edx
	cmovg	%ecx, %edx
	leal	2(%rax), %ecx
	cmpl	%ebp, %ecx
	jge	.L73
	movslq	%ecx, %rcx
	movsbl	128(%rsp,%rcx), %esi
	movsbl	3628928(%rsp,%rcx), %ecx
	addl	%esi, %ecx
	cmpl	%ecx, %edx
	cmovg	%ecx, %edx
	leal	3(%rax), %ecx
	cmpl	%ebp, %ecx
	jge	.L73
	movslq	%ecx, %rcx
	movsbl	128(%rsp,%rcx), %esi
	movsbl	3628928(%rsp,%rcx), %ecx
	addl	%esi, %ecx
	cmpl	%ecx, %edx
	cmovg	%ecx, %edx
	leal	4(%rax), %ecx
	cmpl	%ebp, %ecx
	jge	.L73
	movslq	%ecx, %rcx
	movsbl	128(%rsp,%rcx), %esi
	movsbl	3628928(%rsp,%rcx), %ecx
	addl	%esi, %ecx
	cmpl	%ecx, %edx
	cmovg	%ecx, %edx
	leal	5(%rax), %ecx
	cmpl	%ebp, %ecx
	jge	.L73
	movslq	%ecx, %rcx
	movsbl	128(%rsp,%rcx), %esi
	movsbl	3628928(%rsp,%rcx), %ecx
	addl	%esi, %ecx
	cmpl	%ecx, %edx
	cmovg	%ecx, %edx
	leal	6(%rax), %ecx
	cmpl	%ebp, %ecx
	jge	.L73
	movslq	%ecx, %rcx
	movsbl	128(%rsp,%rcx), %esi
	movsbl	3628928(%rsp,%rcx), %ecx
	addl	%esi, %ecx
	cmpl	%ecx, %edx
	cmovg	%ecx, %edx
	leal	7(%rax), %ecx
	cmpl	%ebp, %ecx
	jge	.L73
	movslq	%ecx, %rcx
	movsbl	128(%rsp,%rcx), %esi
	movsbl	3628928(%rsp,%rcx), %ecx
	addl	%esi, %ecx
	cmpl	%ecx, %edx
	cmovg	%ecx, %edx
	leal	8(%rax), %ecx
	cmpl	%ebp, %ecx
	jge	.L73
	movslq	%ecx, %rcx
	movsbl	128(%rsp,%rcx), %esi
	movsbl	3628928(%rsp,%rcx), %ecx
	addl	%esi, %ecx
	cmpl	%ecx, %edx
	cmovg	%ecx, %edx
	leal	9(%rax), %ecx
	cmpl	%ebp, %ecx
	jge	.L73
	movslq	%ecx, %rcx
	movsbl	128(%rsp,%rcx), %esi
	movsbl	3628928(%rsp,%rcx), %ecx
	addl	%esi, %ecx
	cmpl	%ecx, %edx
	cmovg	%ecx, %edx
	leal	10(%rax), %ecx
	cmpl	%ebp, %ecx
	jge	.L73
	movslq	%ecx, %rcx
	movsbl	128(%rsp,%rcx), %esi
	movsbl	3628928(%rsp,%rcx), %ecx
	addl	%esi, %ecx
	cmpl	%ecx, %edx
	cmovg	%ecx, %edx
	leal	11(%rax), %ecx
	cmpl	%ebp, %ecx
	jge	.L73
	movslq	%ecx, %rcx
	movsbl	128(%rsp,%rcx), %esi
	movsbl	3628928(%rsp,%rcx), %ecx
	addl	%esi, %ecx
	cmpl	%ecx, %edx
	cmovg	%ecx, %edx
	leal	12(%rax), %ecx
	cmpl	%ebp, %ecx
	jge	.L73
	movslq	%ecx, %rcx
	movsbl	128(%rsp,%rcx), %esi
	movsbl	3628928(%rsp,%rcx), %ecx
	addl	%esi, %ecx
	cmpl	%ecx, %edx
	cmovg	%ecx, %edx
	leal	13(%rax), %ecx
	cmpl	%ebp, %ecx
	jge	.L73
	movslq	%ecx, %rcx
	movsbl	128(%rsp,%rcx), %esi
	movsbl	3628928(%rsp,%rcx), %ecx
	addl	%esi, %ecx
	cmpl	%ecx, %edx
	cmovg	%ecx, %edx
	addl	$14, %eax
	cmpl	%ebp, %eax
	jge	.L73
	cltq
	movsbl	3628928(%rsp,%rax), %ecx
	movsbl	128(%rsp,%rax), %eax
	addl	%ecx, %eax
	cmpl	%eax, %edx
	cmovg	%eax, %edx
	.p2align 4,,10
	.p2align 3
.L73:
	xorl	%eax, %eax
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	7257736(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L80
	addq	$7257752, %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
.L67:
	.cfi_restore_state
	leaq	80(%rsp), %rdi
	movl	%r15d, %esi
	movb	%r15b, 3628928(%rsp)
	movl	$1, %ebp
	movb	%r15b, 128(%rsp)
	call	hash
	leaq	32(%rsp), %rdi
	movl	%r15d, %esi
	cltq
	movb	$0, 3628928(%rsp,%rax)
	call	hash
	cltq
	movb	$0, 128(%rsp,%rax)
.L74:
	movl	$9, %edx
	xorl	%eax, %eax
	jmp	.L71
.L80:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.text
	.p2align 4
	.globl	rev_sort
	.type	rev_sort, @function
rev_sort:
.LFB25:
	.cfi_startproc
	endbr64
	testl	%ecx, %ecx
	jle	.L81
	cmpl	%esi, %edi
	jge	.L81
	movslq	%edi, %rdi
	leal	-1(%rcx), %r8d
	movslq	%esi, %rsi
	addq	%rdi, %r8
	jmp	.L84
	.p2align 4,,10
	.p2align 3
.L85:
	addq	$1, %rdi
	subq	$1, %rsi
	cmpl	%edi, %esi
	jle	.L81
.L84:
	movl	(%rdx,%rdi,4), %eax
	movl	(%rdx,%rsi,4), %ecx
	movl	%ecx, (%rdx,%rdi,4)
	movl	%eax, (%rdx,%rsi,4)
	cmpq	%r8, %rdi
	jne	.L85
.L81:
	ret
	.cfi_endproc
.LFE25:
	.size	rev_sort, .-rev_sort
	.p2align 4
	.globl	bfs
	.type	bfs, @function
bfs:
.LFB26:
	.cfi_startproc
	endbr64
	cmpl	%r8d, %ecx
	jge	.L86
	jmp	bfs.part.0
.L86:
	ret
	.cfi_endproc
.LFE26:
	.size	bfs, .-bfs
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC0:
	.long	9
	.long	9
	.long	9
	.long	9
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:

rule
	.file	"temp.c"
	.text
	.p2align 4
	.type	bfs.part.0, @function
bfs.part.0:
.LFB27:
	.cfi_startproc
	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
	subq	$88, %rsp
	.cfi_def_cfa_offset 144
	movq	%rdx, 16(%rsp)
	movl	%r8d, 64(%rsp)
	testl	%esi, %esi
	jle	.L1
	movq	%rdi, %r13
	leal	1(%rcx), %edi
	movl	%esi, %r14d
	movl	%ecx, %eax
	movl	%edi, 40(%rsp)
	cmpl	$1, %esi
	je	.L1
	addl	$1, %eax
	leal	-1(%rsi), %edi
	leal	1(%rsi), %r15d
	movl	%esi, %r12d
	movq	$0, 8(%rsp)
	movb	%al, 71(%rsp)
	movl	%edi, 60(%rsp)
	movq	%rdi, 72(%rsp)
	leaq	4(%r13), %rdi
	movq	%rdi, 24(%rsp)
	movq	%r13, %rdi
.L10:
	movq	8(%rsp), %rax
	movl	%eax, %ebx
	movl	%eax, 56(%rsp)
	movl	%eax, %ebp
	addl	$1, %ebx
	movl	%ebx, 44(%rsp)
	movl	%ebx, (%rsp)
	cmpl	%ebx, %eax
	jge	.L3
.L4:
	movslq	(%rsp), %rax
	leaq	(%rdi,%rax,4), %r13
	addl	%eax, %ebp
	movq	8(%rsp), %rax
	leaq	(%rdi,%rax,4), %rax
	movq	%rax, 32(%rsp)
.L25:
	movq	8(%rsp), %rbx
	movl	0(%r13), %edx
	movq	%r13, %rcx
	movl	(%rdi,%rbx,4), %eax
	movl	%edx, (%rdi,%rbx,4)
	movq	32(%rsp), %rdx
	movl	%eax, 0(%r13)
	movl	44(%rsp), %eax
	.p2align 4,,10
	.p2align 3
.L12:
	movl	%ebp, %esi
	subl	%eax, %esi
	cmpl	%eax, %esi
	jle	.L11
	movl	4(%rdx), %esi
	movl	-4(%rcx), %r8d
	addl	$1, %eax
	addq	$4, %rdx
	subq	$4, %rcx
	movl	%r8d, (%rdx)
	movl	%esi, (%rcx)
	cmpl	%r12d, %eax
	jne	.L12
.L11:
	movl	%ebp, 48(%rsp)
	movq	24(%rsp), %rcx
	xorl	%r11d, %r11d
	movl	$1, %r9d
	movl	60(%rsp), %ebp
	movl	$1, %ebx
	.p2align 4,,10
	.p2align 3
.L20:
	movl	%r14d, %edx
	movl	$1, %eax
	movl	-4(%rcx), %r8d
	subl	%ebx, %edx
	cmpl	%ebx, %r14d
	cmovle	%eax, %edx
	movl	%ebp, %eax
	subl	%ebx, %eax
	cmpl	$2, %eax
	jbe	.L30
	cmpl	%ebx, %r14d
	jle	.L30
	movl	%edx, %eax
	movd	%r8d, %xmm3
	pxor	%xmm1, %xmm1
	shrl	$2, %eax
	pshufd	$0, %xmm3, %xmm2
	subl	$1, %eax
	salq	$4, %rax
	leaq	16(%rcx,%rax), %rsi
	movq	%rcx, %rax
	.p2align 4,,10
	.p2align 3
.L14:
	movdqu	(%rax), %xmm0
	addq	$16, %rax
	pcmpgtd	%xmm2, %xmm0
	psubd	%xmm0, %xmm1
	cmpq	%rax, %rsi
	jne	.L14
	movdqa	%xmm1, %xmm0
	movl	%edx, %r10d
	psrldq	$8, %xmm0
	andl	$-4, %r10d
	paddd	%xmm0, %xmm1
	leal	(%r10,%rbx), %esi
	movdqa	%xmm1, %xmm0
	psrldq	$4, %xmm0
	paddd	%xmm0, %xmm1
	movd	%xmm1, %eax
	cmpl	%r10d, %edx
	je	.L15
.L13:
	movslq	%esi, %rdx
	cmpl	%r8d, (%rdi,%rdx,4)
	leaq	0(,%rdx,4), %r10
	setg	%dl
	movzbl	%dl, %edx
	addl	%edx, %eax
	leal	1(%rsi), %edx
	cmpl	%edx, %r14d
	jle	.L15
	cmpl	%r8d, 4(%rdi,%r10)
	jle	.L17
	addl	$1, %eax
.L17:
	addl	$2, %esi
	cmpl	%esi, %r14d
	jle	.L15
	cmpl	8(%rdi,%r10), %r8d
	jge	.L15
	addl	$1, %eax
.L15:
	imull	%r9d, %eax
	addq	$4, %rcx
	addl	%eax, %r11d
	movl	%r15d, %eax
	subl	%ebx, %eax
	imull	%eax, %r9d
	leal	1(%rbx), %eax
	cmpl	%eax, %r14d
	je	.L43
	movl	%eax, %ebx
	jmp	.L20
.L3:
	movl	(%rdi), %r8d
	movq	24(%rsp), %rdx
	movl	%r14d, %eax
	xorl	%r9d, %r9d
	movl	$1, %esi
	jmp	.L27
	.p2align 4,,10
	.p2align 3
.L6:
	movl	%ecx, %r8d
.L27:
	movl	(%rdx), %ecx
	cmpl	%ecx, %r8d
	jge	.L5
	addl	%esi, %r9d
.L5:
	imull	%eax, %esi
	subl	$1, %eax
	addq	$4, %rdx
	cmpl	$1, %eax
	jne	.L6
	movslq	%r9d, %rax
	addq	16(%rsp), %rax
	movsbl	(%rax), %edx
	cmpl	40(%rsp), %edx
	jg	.L44
.L9:
	leal	2(%rbp), %eax
	movl	%eax, (%rsp)
	cmpl	%eax, %r14d
	jg	.L4
.L26:
	addq	$1, 8(%rsp)
	addl	$1, %r12d
	movq	8(%rsp), %rax
	cmpq	72(%rsp), %rax
	jne	.L10
.L1:
	addq	$88, %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
.L43:
	.cfi_restore_state
	movslq	%r11d, %rax
	addq	16(%rsp), %rax
	movl	48(%rsp), %ebp
	movsbl	(%rax), %edx
	cmpl	%edx, 40(%rsp)
	jl	.L45
.L22:
	movl	56(%rsp), %ecx
	cmpl	%ecx, (%rsp)
	jle	.L23
	movq	8(%rsp), %rsi
	movl	0(%r13), %edx
	movq	%r13, %rcx
	movl	(%rdi,%rsi,4), %eax
	movl	%edx, (%rdi,%rsi,4)
	movq	32(%rsp), %rdx
	movl	%eax, 0(%r13)
	movl	44(%rsp), %eax
	.p2align 4,,10
	.p2align 3
.L24:
	movl	%ebp, %esi
	subl	%eax, %esi
	cmpl	%eax, %esi
	jle	.L23
	movl	4(%rdx), %esi
	movl	-4(%rcx), %r8d
	addl	$1, %eax
	addq	$4, %rdx
	subq	$4, %rcx
	movl	%r8d, (%rdx)
	movl	%esi, (%rcx)
	cmpl	%r12d, %eax
	jne	.L24
.L23:
	movl	(%rsp), %ecx
	addq	$4, %r13
	addl	$1, %ebp
	leal	1(%rcx), %eax
	cmpl	%ecx, %ebx
	jle	.L26
	movl	%eax, (%rsp)
	jmp	.L25
.L30:
	movl	%ebx, %esi
	xorl	%eax, %eax
	jmp	.L13
.L45:
	movzbl	71(%rsp), %ecx
	movb	%cl, (%rax)
	movl	40(%rsp), %eax
	movl	64(%rsp), %ecx
	cmpl	%ecx, %eax
	jge	.L22
	movq	16(%rsp), %rdx
	movl	%ecx, %r8d
	movl	%r14d, %esi
	movl	%eax, %ecx
	movq	%rdi, 48(%rsp)
	call	bfs.part.0
	movq	48(%rsp), %rdi
	jmp	.L22
.L44:
	movzbl	71(%rsp), %ebx
	movb	%bl, (%rax)
	movl	40(%rsp), %eax
	movl	64(%rsp), %ebx
	cmpl	%ebx, %eax
	jge	.L9
	movq	16(%rsp), %rdx
	movl	%ebx, %r8d
	movl	%eax, %ecx
	movl	%r14d, %esi
	movq	%rdi, (%rsp)
	call	bfs.part.0
	movq	(%rsp), %rdi
	jmp	.L9
	.cfi_endproc
.LFE27:
	.size	bfs.part.0, .-bfs.part.0
	.p2align 4
	.globl	hash
	.type	hash, @function
hash:
.LFB24:
	.cfi_startproc
	endbr64
	testl	%esi, %esi
	jle	.L58
	movl	%esi, %ecx
	cmpl	$1, %esi
	je	.L58
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	movq	%rdi, %r10
	leaq	4(%rdi), %r8
	movl	$1, %r9d
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	xorl	%r11d, %r11d
	movl	$1, %edx
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	leal	-1(%rsi), %r12d
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	movl	$1, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	leal	1(%rsi), %ebx
	.p2align 4,,10
	.p2align 3
.L56:
	movl	%ecx, %edi
	movl	%r12d, %eax
	movl	-4(%r8), %r13d
	subl	%edx, %edi
	cmpl	%edx, %ecx
	cmovle	%ebp, %edi
	subl	%edx, %eax
	cmpl	$2, %eax
	jbe	.L59
	cmpl	%edx, %ecx
	jle	.L59
	movl	%edi, %eax
	movd	%r13d, %xmm3
	pxor	%xmm1, %xmm1
	shrl	$2, %eax
	pshufd	$0, %xmm3, %xmm2
	subl	$1, %eax
	salq	$4, %rax
	leaq	16(%r8,%rax), %rsi
	movq	%r8, %rax
	.p2align 4,,10
	.p2align 3
.L50:
	movdqu	(%rax), %xmm0
	addq	$16, %rax
	pcmpgtd	%xmm2, %xmm0
	psubd	%xmm0, %xmm1
	cmpq	%rax, %rsi
	jne	.L50
	movdqa	%xmm1, %xmm0
	movl	%edi, %r14d
	psrldq	$8, %xmm0
	andl	$-4, %r14d
	paddd	%xmm0, %xmm1
	leal	(%r14,%rdx), %esi
	movdqa	%xmm1, %xmm0
	psrldq	$4, %xmm0
	paddd	%xmm0, %xmm1
	movd	%xmm1, %eax
	cmpl	%r14d, %edi
	je	.L51
.L49:
	movslq	%esi, %rdi
	cmpl	%r13d, (%r10,%rdi,4)
	leaq	0(,%rdi,4), %r14
	setg	%dil
	movzbl	%dil, %edi
	addl	%edi, %eax
	leal	1(%rsi), %edi
	cmpl	%edi, %ecx
	jle	.L51
	cmpl	4(%r10,%r14), %r13d
	jge	.L53
	addl	$1, %eax
.L53:
	addl	$2, %esi
	cmpl	%esi, %ecx
	jle	.L51
	cmpl	8(%r10,%r14), %r13d
	jge	.L51
	addl	$1, %eax
.L51:
	imull	%r9d, %eax
	addq	$4, %r8
	addl	%eax, %r11d
	movl	%ebx, %eax
	subl	%edx, %eax
	addl	$1, %edx
	imull	%eax, %r9d
	cmpl	%edx, %ecx
	jne	.L56
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	movl	%r11d, %eax
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
.L59:
	.cfi_restore_state
	movl	%edx, %esi
	xorl	%eax, %eax
	jmp	.L49
.L58:
	.cfi_def_cfa_offset 8
	.cfi_restore 3
	.cfi_restore 6
	.cfi_restore 12
	.cfi_restore 13
	.cfi_restore 14
	xorl	%r11d, %r11d
	movl	%r11d, %eax
	ret
	.cfi_endproc
.LFE24:
	.size	hash, .-hash
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC1:
	.string	"%d"
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	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	-7254016(%rsp), %r11
	.cfi_def_cfa 11, 7254072
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$3736, %rsp
	.cfi_def_cfa_offset 7257808
	leaq	.LC1(%rip), %r14
	movq	%r14, %rdi
	movq	%fs:40, %rax
	movq	%rax, 7257736(%rsp)
	xorl	%eax, %eax
	leaq	28(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	28(%rsp), %r15d
	testl	%r15d, %r15d
	jle	.L67
	xorl	%ebx, %ebx
	movl	$1, %ebp
	leaq	32(%rsp), %r13
	leaq	80(%rsp), %r12
	.p2align 4,,10
	.p2align 3
.L68:
	leaq	0(%r13,%rbx,4), %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	leal	1(%rbx), %eax
	movl	28(%rsp), %r9d
	movl	%eax, (%r12,%rbx,4)
	addq	$1, %rbx
	imull	%eax, %ebp
	cmpl	%ebx, %r9d
	jg	.L68
	leaq	3628928(%rsp), %r14
	movsbl	%r9b, %esi
	movslq	%ebp, %rdx
	movl	%r9d, 12(%rsp)
	movq	%r14, %rdi
	movq	%rdx, (%rsp)
	leaq	128(%rsp), %rbx
	movl	%esi, 8(%rsp)
	call	memset@PLT
	movq	(%rsp), %rdx
	movl	8(%rsp), %esi
	movq	%rbx, %rdi
	call	memset@PLT
	movl	12(%rsp), %r9d
	movq	%r12, %rdi
	movl	%r9d, %esi
	movl	%r9d, 8(%rsp)
	call	hash
	movl	8(%rsp), %esi
	movq	%r13, %rdi
	cltq
	movb	$0, 3628928(%rsp,%rax)
	call	hash
	cltq
	movb	$0, 128(%rsp,%rax)
	cmpl	$2, %r15d
	jle	.L69
	subl	$1, %r15d
	movl	8(%rsp), %esi
	xorl	%ecx, %ecx
	movq	%rbx, %rdx
	sarl	%r15d
	movq	%r13, %rdi
	movl	%r15d, %r8d
	call	bfs.part.0
	movl	28(%rsp), %esi
	movl	%r15d, %r8d
	xorl	%ecx, %ecx
	movq	%r14, %rdx
	movq	%r12, %rdi
	call	bfs.part.0
.L69:
	leal	-1(%rbp), %eax
	cmpl	$14, %eax
	jbe	.L74
	movl	%ebp, %edx
	movdqa	.LC0(%rip), %xmm2
	xorl	%eax, %eax
	pxor	%xmm4, %xmm4
	shrl	$4, %edx
	pxor	%xmm3, %xmm3
	salq	$4, %rdx
	.p2align 4,,10
	.p2align 3
.L72:
	movdqa	(%rbx,%rax), %xmm5
	movdqa	(%r14,%rax), %xmm0
	movdqa	%xmm4, %xmm7
	movdqa	%xmm4, %xmm6
	addq	$16, %rax
	pcmpgtb	%xmm0, %xmm6
	pcmpgtb	%xmm5, %xmm7
	movdqa	%xmm5, %xmm8
	movdqa	%xmm0, %xmm1
	punpcklbw	%xmm6, %xmm1
	punpckhbw	%xmm7, %xmm5
	punpckhbw	%xmm6, %xmm0
	punpcklbw	%xmm7, %xmm8
	paddw	%xmm5, %xmm0
	movdqa	%xmm3, %xmm5
	paddw	%xmm8, %xmm1
	pcmpgtw	%xmm1, %xmm5
	movdqa	%xmm1, %xmm6
	punpcklwd	%xmm5, %xmm6
	punpckhwd	%xmm5, %xmm1
	movdqa	%xmm6, %xmm5
	pcmpgtd	%xmm1, %xmm5
	pand	%xmm5, %xmm1
	pandn	%xmm6, %xmm5
	movdqa	%xmm0, %xmm6
	por	%xmm1, %xmm5
	movdqa	%xmm3, %xmm1
	pcmpgtw	%xmm0, %xmm1
	punpcklwd	%xmm1, %xmm6
	punpckhwd	%xmm1, %xmm0
	movdqa	%xmm6, %xmm1
	pcmpgtd	%xmm0, %xmm1
	pand	%xmm1, %xmm0
	pandn	%xmm6, %xmm1
	por	%xmm1, %xmm0
	movdqa	%xmm5, %xmm1
	pcmpgtd	%xmm0, %xmm1
	pand	%xmm1, %xmm0
	pandn	%xmm5, %xmm1
	por	%xmm1, %xmm0
	movdqa	%xmm0, %xmm1
	pcmpgtd	%xmm2, %xmm1
	pand	%xmm1, %xmm2
	pandn	%xmm0, %xmm1
	por	%xmm1, %xmm2
	cmpq	%rdx, %rax
	jne	.L72
	movdqa	%xmm2, %xmm1
	movl	%ebp, %eax
	psrldq	$8, %xmm1
	andl	$-16, %eax
	movdqa	%xmm1, %xmm0
	pcmpgtd	%xmm2, %xmm0
	pand	%xmm0, %xmm2
	pandn	%xmm1, %xmm0
	por	%xmm2, %xmm0
	movdqa	%xmm0, %xmm2
	psrldq	$4, %xmm2
	movdqa	%xmm2, %xmm1
	pcmpgtd	%xmm0, %xmm1
	pand	%xmm1, %xmm0
	pandn	%xmm2, %xmm1
	por	%xmm0, %xmm1
	movd	%xmm1, %edx
	testb	$15, %bpl
	je	.L73
.L71:
	movslq	%eax, %rsi
	movsbl	128(%rsp,%rsi), %ecx
	movsbl	3628928(%rsp,%rsi), %esi
	addl	%esi, %ecx
	cmpl	%ecx, %edx
	cmovg	%ecx, %edx
	leal	1(%rax), %ecx
	cmpl	%ebp, %ecx
	jge	.L73
	movslq	%ecx, %rcx
	movsbl	128(%rsp,%rcx), %esi
	movsbl	3628928(%rsp,%rcx), %ecx
	addl	%esi, %ecx
	cmpl	%ecx, %edx
	cmovg	%ecx, %edx
	leal	2(%rax), %ecx
	cmpl	%ebp, %ecx
	jge	.L73
	movslq	%ecx, %rcx
	movsbl	128(%rsp,%rcx), %esi
	movsbl	3628928(%rsp,%rcx), %ecx
	addl	%esi, %ecx
	cmpl	%ecx, %edx
	cmovg	%ecx, %edx
	leal	3(%rax), %ecx
	cmpl	%ebp, %ecx
	jge	.L73
	movslq	%ecx, %rcx
	movsbl	128(%rsp,%rcx), %esi
	movsbl	3628928(%rsp,%rcx), %ecx
	addl	%esi, %ecx
	cmpl	%ecx, %edx
	cmovg	%ecx, %edx
	leal	4(%rax), %ecx
	cmpl	%ebp, %ecx
	jge	.L73
	movslq	%ecx, %rcx
	movsbl	128(%rsp,%rcx), %esi
	movsbl	3628928(%rsp,%rcx), %ecx
	addl	%esi, %ecx
	cmpl	%ecx, %edx
	cmovg	%ecx, %edx
	leal	5(%rax), %ecx
	cmpl	%ebp, %ecx
	jge	.L73
	movslq	%ecx, %rcx
	movsbl	128(%rsp,%rcx), %esi
	movsbl	3628928(%rsp,%rcx), %ecx
	addl	%esi, %ecx
	cmpl	%ecx, %edx
	cmovg	%ecx, %edx
	leal	6(%rax), %ecx
	cmpl	%ebp, %ecx
	jge	.L73
	movslq	%ecx, %rcx
	movsbl	128(%rsp,%rcx), %esi
	movsbl	3628928(%rsp,%rcx), %ecx
	addl	%esi, %ecx
	cmpl	%ecx, %edx
	cmovg	%ecx, %edx
	leal	7(%rax), %ecx
	cmpl	%ebp, %ecx
	jge	.L73
	movslq	%ecx, %rcx
	movsbl	128(%rsp,%rcx), %esi
	movsbl	3628928(%rsp,%rcx), %ecx
	addl	%esi, %ecx
	cmpl	%ecx, %edx
	cmovg	%ecx, %edx
	leal	8(%rax), %ecx
	cmpl	%ebp, %ecx
	jge	.L73
	movslq	%ecx, %rcx
	movsbl	128(%rsp,%rcx), %esi
	movsbl	3628928(%rsp,%rcx), %ecx
	addl	%esi, %ecx
	cmpl	%ecx, %edx
	cmovg	%ecx, %edx
	leal	9(%rax), %ecx
	cmpl	%ebp, %ecx
	jge	.L73
	movslq	%ecx, %rcx
	movsbl	128(%rsp,%rcx), %esi
	movsbl	3628928(%rsp,%rcx), %ecx
	addl	%esi, %ecx
	cmpl	%ecx, %edx
	cmovg	%ecx, %edx
	leal	10(%rax), %ecx
	cmpl	%ebp, %ecx
	jge	.L73
	movslq	%ecx, %rcx
	movsbl	128(%rsp,%rcx), %esi
	movsbl	3628928(%rsp,%rcx), %ecx
	addl	%esi, %ecx
	cmpl	%ecx, %edx
	cmovg	%ecx, %edx
	leal	11(%rax), %ecx
	cmpl	%ebp, %ecx
	jge	.L73
	movslq	%ecx, %rcx
	movsbl	128(%rsp,%rcx), %esi
	movsbl	3628928(%rsp,%rcx), %ecx
	addl	%esi, %ecx
	cmpl	%ecx, %edx
	cmovg	%ecx, %edx
	leal	12(%rax), %ecx
	cmpl	%ebp, %ecx
	jge	.L73
	movslq	%ecx, %rcx
	movsbl	128(%rsp,%rcx), %esi
	movsbl	3628928(%rsp,%rcx), %ecx
	addl	%esi, %ecx
	cmpl	%ecx, %edx
	cmovg	%ecx, %edx
	leal	13(%rax), %ecx
	cmpl	%ebp, %ecx
	jge	.L73
	movslq	%ecx, %rcx
	movsbl	128(%rsp,%rcx), %esi
	movsbl	3628928(%rsp,%rcx), %ecx
	addl	%esi, %ecx
	cmpl	%ecx, %edx
	cmovg	%ecx, %edx
	addl	$14, %eax
	cmpl	%ebp, %eax
	jge	.L73
	cltq
	movsbl	3628928(%rsp,%rax), %ecx
	movsbl	128(%rsp,%rax), %eax
	addl	%ecx, %eax
	cmpl	%eax, %edx
	cmovg	%eax, %edx
	.p2align 4,,10
	.p2align 3
.L73:
	xorl	%eax, %eax
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	7257736(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L80
	addq	$7257752, %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
.L67:
	.cfi_restore_state
	leaq	80(%rsp), %rdi
	movl	%r15d, %esi
	movb	%r15b, 3628928(%rsp)
	movl	$1, %ebp
	movb	%r15b, 128(%rsp)
	call	hash
	leaq	32(%rsp), %rdi
	movl	%r15d, %esi
	cltq
	movb	$0, 3628928(%rsp,%rax)
	call	hash
	cltq
	movb	$0, 128(%rsp,%rax)
.L74:
	movl	$9, %edx
	xorl	%eax, %eax
	jmp	.L71
.L80:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.text
	.p2align 4
	.globl	rev_sort
	.type	rev_sort, @function
rev_sort:
.LFB25:
	.cfi_startproc
	endbr64
	testl	%ecx, %ecx
	jle	.L81
	cmpl	%esi, %edi
	jge	.L81
	movslq	%edi, %rdi
	leal	-1(%rcx), %r8d
	movslq	%esi, %rsi
	addq	%rdi, %r8
	jmp	.L84
	.p2align 4,,10
	.p2align 3
.L85:
	addq	$1, %rdi
	subq	$1, %rsi
	cmpl	%edi, %esi
	jle	.L81
.L84:
	movl	(%rdx,%rdi,4), %eax
	movl	(%rdx,%rsi,4), %ecx
	movl	%ecx, (%rdx,%rdi,4)
	movl	%eax, (%rdx,%rsi,4)
	cmpq	%r8, %rdi
	jne	.L85
.L81:
	ret
	.cfi_endproc
.LFE25:
	.size	rev_sort, .-rev_sort
	.p2align 4
	.globl	bfs
	.type	bfs, @function
bfs:
.LFB26:
	.cfi_startproc
	endbr64
	cmpl	%r8d, %ecx
	jge	.L86
	jmp	bfs.part.0
.L86:
	ret
	.cfi_endproc
.LFE26:
	.size	bfs, .-bfs
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC0:
	.long	9
	.long	9
	.long	9
	.long	9
	.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>
#define NMAX 10
#define FMAX 3628800
#define min(a, b) ((a) < (b) ? (a) : (b))

int hash(int *a, int asize);
void rev_sort(int l, int r, int *a, int asize);
void bfs(int *a, int asize, char *memo, int depth, int maxdepth);
int main (void)
{
  int i, n, maxdepth, fact = 1, res = 9, a[NMAX], b[NMAX];
  char memo1[FMAX], memo2[FMAX];
  scanf("%d", &n);
  maxdepth = (n - 1) / 2;
  for (i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    fact *= i + 1;
    b[i] = i + 1;
  }
  for (i = 0; i < fact; i++) memo1[i] = memo2[i] = n;
  memo1[hash(a, n)] = memo2[hash(b, n)] = 0;
  bfs(a, n, memo1, 0, maxdepth);
  bfs(b, n, memo2, 0, maxdepth);
  for (i = 0; i < fact; i++) res = min(res, memo1[i] + memo2[i]);
  printf("%d\n", res);
}

int hash(int *a, int asize)
{
  int i, j, res = 0, fact = 1;
  for (i = 0; i < asize; i++) {
    int grade = 0;
    for (j = i + 1; j < asize; j++) if (a[i] < a[j]) grade++;
    res += grade * fact;
    fact *= asize - i;
  }
  return res;
}

void rev_sort(int l, int r, int *a, int asize)
{
  int i;
  for (i = 0; i < asize; i++) {
    int temp;
    if (l + i >= r - i) break;
    temp = a[l+i];
    a[l+i] = a[r-i];
    a[r-i] = temp;
  }
}

void bfs(int *a, int asize, char *memo, int depth, int maxdepth)
{
  int i, j;
  if (depth >= maxdepth) return;
  for (i = 0; i < asize; i++) {
    for (j = i + 1; j < asize; j++) {
      int h;
      rev_sort(i, j, a, asize);
      h = hash(a, asize);
      if (memo[h] > depth + 1) {
        memo[h] = depth + 1;
        bfs(a, asize, memo, depth + 1, maxdepth);
      }
      rev_sort(i, j, a, asize);
    }
  }
}

10
3 0 5 2 7 4 9 6 10 8
 5
3 1 5 4 2
 3
1 3 2
 10
3 0 5 2 7 4 9 6 17 8
 10
3 0 5 1 7 4 9 6 17 8
 10
3 0 5 1 7 4 12 6 17 8
 10
3 0 5 2 7 4 9 6 11 8
 10
3 0 5 2 7 4 10 6 17 8
 10
3 0 5 1 7 4 9 6 12 8
 10
2 0 5 1 7 4 12 6 17 8

9
 3
 1
 9
 9
 9
 9
 9
 9
 9

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>
#define NMAX 10
#define FMAX 3628800
#define min(a, b) ((a) < (b) ? (a) : (b))

int hash(int *a, int asize);
void rev_sort(int l, int r, int *a, int asize);
void bfs(int *a, int asize, char *memo, int depth, int maxdepth);
int main (void)
{
  int i, n, maxdepth, fact = 1, res = 9, a[NMAX], b[NMAX];
  char memo1[FMAX], memo2[FMAX];
  scanf("%d", &n);
  maxdepth = (n - 1) / 2;
  for (i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    fact *= i + 1;
    b[i] = i + 1;
  }
  for (i = 0; i < fact; i++) memo1[i] = memo2[i] = n;
  memo1[hash(a, n)] = memo2[hash(b, n)] = 0;
  bfs(a, n, memo1, 0, maxdepth);
  bfs(b, n, memo2, 0, maxdepth);
  for (i = 0; i < fact; i++) res = min(res, memo1[i] + memo2[i]);
  printf("%d\n", res);
}

int hash(int *a, int asize)
{
  int i, j, res = 0, fact = 1;
  for (i = 0; i < asize; i++) {
    int grade = 0;
    for (j = i + 1; j < asize; j++) if (a[i] < a[j]) grade++;
    res += grade * fact;
    fact *= asize - i;
  }
  return res;
}

void rev_sort(int l, int r, int *a, int asize)
{
  int i;
  for (i = 0; i < asize; i++) {
    int temp;
    if (l + i >= r - i) break;
    temp = a[l+i];
    a[l+i] = a[r-i];
    a[r-i] = temp;
  }
}

void bfs(int *a, int asize, char *memo, int depth, int maxdepth)
{
  int i, j;
  if (depth >= maxdepth) return;
  for (i = 0; i < asize; i++) {
    for (j = i + 1; j < asize; j++) {
      int h;
      rev_sort(i, j, a, asize);
      h = hash(a, asize);
      if (memo[h] > depth + 1) {
        memo[h] = depth + 1;
        bfs(a, asize, memo, depth + 1, maxdepth);
      }
      rev_sort(i, j, a, asize);
    }
  }
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%rbx
	leaq	-7254016(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$3736, %rsp
	.cfi_offset 3, -24
	movq	%fs:40, %rax
	movq	%rax, -24(%rbp)
	xorl	%eax, %eax
	movl	$1, -7257740(%rbp)
	movl	$9, -7257736(%rbp)
	leaq	-7257748(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-7257748(%rbp), %eax
	subl	$1, %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, -7257732(%rbp)
	movl	$0, -7257744(%rbp)
	jmp	.L2
.L3:
	leaq	-7257728(%rbp), %rdx
	movl	-7257744(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-7257744(%rbp), %eax
	leal	1(%rax), %edx
	movl	-7257740(%rbp), %eax
	imull	%edx, %eax
	movl	%eax, -7257740(%rbp)
	movl	-7257744(%rbp), %eax
	leal	1(%rax), %edx
	movl	-7257744(%rbp), %eax
	cltq
	movl	%edx, -7257680(%rbp,%rax,4)
	addl	$1, -7257744(%rbp)
.L2:
	movl	-7257748(%rbp), %eax
	cmpl	%eax, -7257744(%rbp)
	jl	.L3
	movl	$0, -7257744(%rbp)
	jmp	.L4
.L5:
	movl	-7257748(%rbp), %eax
	movl	%eax, %edx
	movl	-7257744(%rbp), %eax
	cltq
	movb	%dl, -3628832(%rbp,%rax)
	movl	-7257744(%rbp), %eax
	cltq
	movzbl	-3628832(%rbp,%rax), %edx
	movl	-7257744(%rbp), %eax
	cltq
	movb	%dl, -7257632(%rbp,%rax)
	addl	$1, -7257744(%rbp)
.L4:
	movl	-7257744(%rbp), %eax
	cmpl	-7257740(%rbp), %eax
	jl	.L5
	movl	-7257748(%rbp), %edx
	leaq	-7257680(%rbp), %rax
	movl	%edx, %esi
	movq	%rax, %rdi
	call	hash
	movl	%eax, %ebx
	movslq	%ebx, %rax
	movb	$0, -3628832(%rbp,%rax)
	movl	-7257748(%rbp), %edx
	leaq	-7257728(%rbp), %rax
	movl	%edx, %esi
	movq	%rax, %rdi
	call	hash
	movslq	%ebx, %rdx
	movzbl	-3628832(%rbp,%rdx), %edx
	cltq
	movb	%dl, -7257632(%rbp,%rax)
	movl	-7257748(%rbp), %esi
	movl	-7257732(%rbp), %ecx
	leaq	-7257632(%rbp), %rdx
	leaq	-7257728(%rbp), %rax
	movl	%ecx, %r8d
	movl	$0, %ecx
	movq	%rax, %rdi
	call	bfs
	movl	-7257748(%rbp), %esi
	movl	-7257732(%rbp), %ecx
	leaq	-3628832(%rbp), %rdx
	leaq	-7257680(%rbp), %rax
	movl	%ecx, %r8d
	movl	$0, %ecx
	movq	%rax, %rdi
	call	bfs
	movl	$0, -7257744(%rbp)
	jmp	.L6
.L7:
	movl	-7257744(%rbp), %eax
	cltq
	movzbl	-7257632(%rbp,%rax), %eax
	movsbl	%al, %edx
	movl	-7257744(%rbp), %eax
	cltq
	movzbl	-3628832(%rbp,%rax), %eax
	movsbl	%al, %eax
	addl	%eax, %edx
	movl	-7257736(%rbp), %eax
	cmpl	%edx, %eax
	cmovg	%edx, %eax
	movl	%eax, -7257736(%rbp)
	addl	$1, -7257744(%rbp)
.L6:
	movl	-7257744(%rbp), %eax
	cmpl	-7257740(%rbp), %eax
	jl	.L7
	movl	-7257736(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-24(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L9
	call	__stack_chk_fail@PLT
.L9:
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	hash
	.type	hash, @function
hash:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -40(%rbp)
	movl	%esi, -44(%rbp)
	movl	$0, -12(%rbp)
	movl	$1, -8(%rbp)
	movl	$0, -20(%rbp)
	jmp	.L11
.L15:
	movl	$0, -4(%rbp)
	movl	-20(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -16(%rbp)
	jmp	.L12
.L14:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	movq	-40(%rbp), %rax
	addq	%rcx, %rax
	movl	(%rax), %eax
	cmpl	%eax, %edx
	jge	.L13
	addl	$1, -4(%rbp)
.L13:
	addl	$1, -16(%rbp)
.L12:
	movl	-16(%rbp), %eax
	cmpl	-44(%rbp), %eax
	jl	.L14
	movl	-4(%rbp), %eax
	imull	-8(%rbp), %eax
	addl	%eax, -12(%rbp)
	movl	-44(%rbp), %eax
	subl	-20(%rbp), %eax
	movl	-8(%rbp), %edx
	imull	%edx, %eax
	movl	%eax, -8(%rbp)
	addl	$1, -20(%rbp)
.L11:
	movl	-20(%rbp), %eax
	cmpl	-44(%rbp), %eax
	jl	.L15
	movl	-12(%rbp), %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	hash, .-hash
	.globl	rev_sort
	.type	rev_sort, @function
rev_sort:
.LFB2:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -20(%rbp)
	movl	%esi, -24(%rbp)
	movq	%rdx, -32(%rbp)
	movl	%ecx, -36(%rbp)
	movl	$0, -8(%rbp)
	jmp	.L18
.L21:
	movl	-20(%rbp), %edx
	movl	-8(%rbp), %eax
	addl	%eax, %edx
	movl	-24(%rbp), %eax
	subl	-8(%rbp), %eax
	cmpl	%eax, %edx
	jge	.L22
	movl	-20(%rbp), %edx
	movl	-8(%rbp), %eax
	addl	%edx, %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	%eax, -4(%rbp)
	movl	-24(%rbp), %eax
	subl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movl	-20(%rbp), %ecx
	movl	-8(%rbp), %edx
	addl	%ecx, %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	movq	-32(%rbp), %rdx
	addq	%rcx, %rdx
	movl	(%rax), %eax
	movl	%eax, (%rdx)
	movl	-24(%rbp), %eax
	subl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-32(%rbp), %rax
	addq	%rax, %rdx
	movl	-4(%rbp), %eax
	movl	%eax, (%rdx)
	addl	$1, -8(%rbp)
.L18:
	movl	-8(%rbp), %eax
	cmpl	-36(%rbp), %eax
	jl	.L21
	jmp	.L23
.L22:
	nop
.L23:
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	rev_sort, .-rev_sort
	.globl	bfs
	.type	bfs, @function
bfs:
.LFB3:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$48, %rsp
	movq	%rdi, -24(%rbp)
	movl	%esi, -28(%rbp)
	movq	%rdx, -40(%rbp)
	movl	%ecx, -32(%rbp)
	movl	%r8d, -44(%rbp)
	movl	-32(%rbp), %eax
	cmpl	-44(%rbp), %eax
	jge	.L32
	movl	$0, -12(%rbp)
	jmp	.L27
.L31:
	movl	-12(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -8(%rbp)
	jmp	.L28
.L30:
	movl	-28(%rbp), %ecx
	movq	-24(%rbp), %rdx
	movl	-8(%rbp), %esi
	movl	-12(%rbp), %eax
	movl	%eax, %edi
	call	rev_sort
	movl	-28(%rbp), %edx
	movq	-24(%rbp), %rax
	movl	%edx, %esi
	movq	%rax, %rdi
	call	hash
	movl	%eax, -4(%rbp)
	movl	-4(%rbp), %eax
	movslq	%eax, %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	movl	-32(%rbp), %edx
	addl	$1, %edx
	cmpl	%edx, %eax
	jle	.L29
	movl	-32(%rbp), %eax
	leal	1(%rax), %ecx
	movl	-4(%rbp), %eax
	movslq	%eax, %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	%ecx, %edx
	movb	%dl, (%rax)
	movl	-32(%rbp), %eax
	leal	1(%rax), %ecx
	movl	-44(%rbp), %edi
	movq	-40(%rbp), %rdx
	movl	-28(%rbp), %esi
	movq	-24(%rbp), %rax
	movl	%edi, %r8d
	movq	%rax, %rdi
	call	bfs
.L29:
	movl	-28(%rbp), %ecx
	movq	-24(%rbp), %rdx
	movl	-8(%rbp), %esi
	movl	-12(%rbp), %eax
	movl	%eax, %edi
	call	rev_sort
	addl	$1, -8(%rbp)
.L28:
	movl	-8(%rbp), %eax
	cmpl	-28(%rbp), %eax
	jl	.L30
	addl	$1, -12(%rbp)
.L27:
	movl	-12(%rbp), %eax
	cmpl	-28(%rbp), %eax
	jl	.L31
	jmp	.L24
.L32:
	nop
.L24:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE3:
	.size	bfs, .-bfs
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```

Only output the optimized assembly code. Do not include any other text. Do not write any comments in the assembly code. Wrap the assembly code in ```assembly``` tags.
train
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%rbx
	leaq	-7254016(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$3736, %rsp
	.cfi_offset 3, -24
	movq	%fs:40, %rax
	movq	%rax, -24(%rbp)
	xorl	%eax, %eax
	movl	$1, -7257740(%rbp)
	movl	$9, -7257736(%rbp)
	leaq	-7257748(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-7257748(%rbp), %eax
	subl	$1, %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, -7257732(%rbp)
	movl	$0, -7257744(%rbp)
	jmp	.L2
.L3:
	leaq	-7257728(%rbp), %rdx
	movl	-7257744(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-7257744(%rbp), %eax
	leal	1(%rax), %edx
	movl	-7257740(%rbp), %eax
	imull	%edx, %eax
	movl	%eax, -7257740(%rbp)
	movl	-7257744(%rbp), %eax
	leal	1(%rax), %edx
	movl	-7257744(%rbp), %eax
	cltq
	movl	%edx, -7257680(%rbp,%rax,4)
	addl	$1, -7257744(%rbp)
.L2:
	movl	-7257748(%rbp), %eax
	cmpl	%eax, -7257744(%rbp)
	jl	.L3
	movl	$0, -7257744(%rbp)
	jmp	.L4
.L5:
	movl	-7257748(%rbp), %eax
	movl	%eax, %edx
	movl	-7257744(%rbp), %eax
	cltq
	movb	%dl, -3628832(%rbp,%rax)
	movl	-7257744(%rbp), %eax
	cltq
	movzbl	-3628832(%rbp,%rax), %edx
	movl	-7257744(%rbp), %eax
	cltq
	movb	%dl, -7257632(%rbp,%rax)
	addl	$1, -7257744(%rbp)
.L4:
	movl	-7257744(%rbp), %eax
	cmpl	-7257740(%rbp), %eax
	jl	.L5
	movl	-7257748(%rbp), %edx
	leaq	-7257680(%rbp), %rax
	movl	%edx, %esi
	movq	%rax, %rdi
	call	hash
	movl	%eax, %ebx
	movslq	%ebx, %rax
	movb	$0, -3628832(%rbp,%rax)
	movl	-7257748(%rbp), %edx
	leaq	-7257728(%rbp), %rax
	movl	%edx, %esi
	movq	%rax, %rdi
	call	hash
	movslq	%ebx, %rdx
	movzbl	-3628832(%rbp,%rdx), %edx
	cltq
	movb	%dl, -7257632(%rbp,%rax)
	movl	-7257748(%rbp), %esi
	movl	-7257732(%rbp), %ecx
	leaq	-7257632(%rbp), %rdx
	leaq	-7257728(%rbp), %rax
	movl	%ecx, %r8d
	movl	$0, %ecx
	movq	%rax, %rdi
	call	bfs
	movl	-7257748(%rbp), %esi
	movl	-7257732(%rbp), %ecx
	leaq	-3628832(%rbp), %rdx
	leaq	-7257680(%rbp), %rax
	movl	%ecx, %r8d
	movl	$0, %ecx
	movq	%rax, %rdi
	call	bfs
	movl	$0, -7257744(%rbp)
	jmp	.L6
.L7:
	movl	-7257744(%rbp), %eax
	cltq
	movzbl	-7257632(%rbp,%rax), %eax
	movsbl	%al, %edx
	movl	-7257744(%rbp), %eax
	cltq
	movzbl	-3628832(%rbp,%rax), %eax
	movsbl	%al, %eax
	addl	%eax, %edx
	movl	-7257736(%rbp), %eax
	cmpl	%edx, %eax
	cmovg	%edx, %eax
	movl	%eax, -7257736(%rbp)
	addl	$1, -7257744(%rbp)
.L6:
	movl	-7257744(%rbp), %eax
	cmpl	-7257740(%rbp), %eax
	jl	.L7
	movl	-7257736(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-24(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L9
	call	__stack_chk_fail@PLT
.L9:
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	hash
	.type	hash, @function
hash:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -40(%rbp)
	movl	%esi, -44(%rbp)
	movl	$0, -12(%rbp)
	movl	$1, -8(%rbp)
	movl	$0, -20(%rbp)
	jmp	.L11
.L15:
	movl	$0, -4(%rbp)
	movl	-20(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -16(%rbp)
	jmp	.L12
.L14:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	movq	-40(%rbp), %rax
	addq	%rcx, %rax
	movl	(%rax), %eax
	cmpl	%eax, %edx
	jge	.L13
	addl	$1, -4(%rbp)
.L13:
	addl	$1, -16(%rbp)
.L12:
	movl	-16(%rbp), %eax
	cmpl	-44(%rbp), %eax
	jl	.L14
	movl	-4(%rbp), %eax
	imull	-8(%rbp), %eax
	addl	%eax, -12(%rbp)
	movl	-44(%rbp), %eax
	subl	-20(%rbp), %eax
	movl	-8(%rbp), %edx
	imull	%edx, %eax
	movl	%eax, -8(%rbp)
	addl	$1, -20(%rbp)
.L11:
	movl	-20(%rbp), %eax
	cmpl	-44(%rbp), %eax
	jl	.L15
	movl	-12(%rbp), %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	hash, .-hash
	.globl	rev_sort
	.type	rev_sort, @function
rev_sort:
.LFB2:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -20(%rbp)
	movl	%esi, -24(%rbp)
	movq	%rdx, -32(%rbp)
	movl	%ecx, -36(%rbp)
	movl	$0, -8(%rbp)
	jmp	.L18
.L21:
	movl	-20(%rbp), %edx
	movl	-8(%rbp), %eax
	addl	%eax, %edx
	movl	-24(%rbp), %eax
	subl	-8(%rbp), %eax
	cmpl	%eax, %edx
	jge	.L22
	movl	-20(%rbp), %edx
	movl	-8(%rbp), %eax
	addl	%edx, %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	%eax, -4(%rbp)
	movl	-24(%rbp), %eax
	subl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movl	-20(%rbp), %ecx
	movl	-8(%rbp), %edx
	addl	%ecx, %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	movq	-32(%rbp), %rdx
	addq	%rcx, %rdx
	movl	(%rax), %eax
	movl	%eax, (%rdx)
	movl	-24(%rbp), %eax
	subl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-32(%rbp), %rax
	addq	%rax, %rdx
	movl	-4(%rbp), %eax
	movl	%eax, (%rdx)
	addl	$1, -8(%rbp)
.L18:
	movl	-8(%rbp), %eax
	cmpl	-36(%rbp), %eax
	jl	.L21
	jmp	.L23
.L22:
	nop
.L23:
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	rev_sort, .-rev_sort
	.globl	bfs
	.type	bfs, @function
bfs:
.LFB3:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$48, %rsp
	movq	%rdi, -24(%rbp)
	movl	%esi, -28(%rbp)
	movq	%rdx, -40(%rbp)
	movl	%ecx, -32(%rbp)
	movl	%r8d, -44(%rbp)
	movl	-32(%rbp), %eax
	cmpl	-44(%rbp), %eax
	jge	.L32
	movl	$0, -12(%rbp)
	jmp	.L27
.L31:
	movl	-12(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -8(%rbp)
	jmp	.L28
.L30:
	movl	-28(%rbp), %ecx
	movq	-24(%rbp), %rdx
	movl	-8(%rbp), %esi
	movl	-12(%rbp), %eax
	movl	%eax, %edi
	call	rev_sort
	movl	-28(%rbp), %edx
	movq	-24(%rbp), %rax
	movl	%edx, %esi
	movq	%rax, %rdi
	call	hash
	movl	%eax, -4(%rbp)
	movl	-4(%rbp), %eax
	movslq	%eax, %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	movl	-32(%rbp), %edx
	addl	$1, %edx
	cmpl	%edx, %eax
	jle	.L29
	movl	-32(%rbp), %eax
	leal	1(%rax), %ecx
	movl	-4(%rbp), %eax
	movslq	%eax, %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	%ecx, %edx
	movb	%dl, (%rax)
	movl	-32(%rbp), %eax
	leal	1(%rax), %ecx
	movl	-44(%rbp), %edi
	movq	-40(%rbp), %rdx
	movl	-28(%rbp), %esi
	movq	-24(%rbp), %rax
	movl	%edi, %r8d
	movq	%rax, %rdi
	call	bfs
.L29:
	movl	-28(%rbp), %ecx
	movq	-24(%rbp), %rdx
	movl	-8(%rbp), %esi
	movl	-12(%rbp), %eax
	movl	%eax, %edi
	call	rev_sort
	addl	$1, -8(%rbp)
.L28:
	movl	-8(%rbp), %eax
	cmpl	-28(%rbp), %eax
	jl	.L30
	addl	$1, -12(%rbp)
.L27:
	movl	-12(%rbp), %eax
	cmpl	-28(%rbp), %eax
	jl	.L31
	jmp	.L24
.L32:
	nop
.L24:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE3:
	.size	bfs, .-bfs
	.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:
