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>
#include <stdint.h>
#include <limits.h>

#define INT(X) \
  ( *( (const int *)(X) ) )

static int
compare (
  const void * a,
  const void * b
  )
{
  return ( INT( b ) - INT( a ) );
}

static uint64_t
factorial (
  uint64_t n
  )
{
  uint64_t res = 1;
  uint64_t i;

  for ( i = 2; i <= n; ++i )
  {
    res *= i;
  }

  return ( res );
}

/** Application main entry point. */
int
main (
  int     argc,
  char  * argv[ ]
  )
{
  int h[ CHAR_MAX + 1 ] = { 0 };
  int64_t res = 0, dv = 1;
  int dl = 0;
  int i, j;

  for ( ; ; )
  {
    const char ch = getchar ( );

    if ( ch == '\n' ) break ;

    ++h[ ch ];
  }

  qsort ( h, CHAR_MAX + 1, sizeof ( int ), compare );
  for ( i = 0; i <= CHAR_MAX; ++i )
  {
    if ( !( h[ i ] ) ) break ;
    if ( h[ i ] % 2 )
    {
      if ( dl )
      {
        puts ( "0" );
        goto CONTT;
      }

      --h[ i ];
      ++dl;
    }

    h[ i ] /= 2;
    res += h[ i ];
    dv *= factorial ( h[ i ] );
  }

  printf ( "%llu\n", factorial ( res ) / dv );
CONTT: ;

  return ( 0 );
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.type	compare, @function
compare:
.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, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-16(%rbp), %rax
	movl	(%rax), %edx
	movq	-8(%rbp), %rax
	movl	(%rax), %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	compare, .-compare
	.type	factorial, @function
factorial:
.LFB7:
	.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	$1, -16(%rbp)
	movq	$2, -8(%rbp)
	jmp	.L4
.L5:
	movq	-16(%rbp), %rax
	imulq	-8(%rbp), %rax
	movq	%rax, -16(%rbp)
	addq	$1, -8(%rbp)
.L4:
	movq	-8(%rbp), %rax
	cmpq	-24(%rbp), %rax
	jbe	.L5
	movq	-16(%rbp), %rax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	factorial, .-factorial
	.section	.rodata
.LC0:
	.string	"0"
.LC1:
	.string	"%llu\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
	subq	$576, %rsp
	movl	%edi, -564(%rbp)
	movq	%rsi, -576(%rbp)
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-528(%rbp), %rdx
	movl	$0, %eax
	movl	$64, %ecx
	movq	%rdx, %rdi
	rep stosq
	movq	$0, -544(%rbp)
	movq	$1, -536(%rbp)
	movl	$0, -552(%rbp)
.L10:
	call	getchar@PLT
	movb	%al, -553(%rbp)
	cmpb	$10, -553(%rbp)
	je	.L21
	movsbl	-553(%rbp), %eax
	movslq	%eax, %rdx
	movl	-528(%rbp,%rdx,4), %edx
	addl	$1, %edx
	cltq
	movl	%edx, -528(%rbp,%rax,4)
	jmp	.L10
.L21:
	nop
	leaq	-528(%rbp), %rax
	leaq	compare(%rip), %rdx
	movq	%rdx, %rcx
	movl	$4, %edx
	movl	$128, %esi
	movq	%rax, %rdi
	call	qsort@PLT
	movl	$0, -548(%rbp)
	jmp	.L11
.L17:
	movl	-548(%rbp), %eax
	cltq
	movl	-528(%rbp,%rax,4), %eax
	testl	%eax, %eax
	je	.L22
	movl	-548(%rbp), %eax
	cltq
	movl	-528(%rbp,%rax,4), %eax
	andl	$1, %eax
	testl	%eax, %eax
	je	.L14
	cmpl	$0, -552(%rbp)
	je	.L15
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L16
.L15:
	movl	-548(%rbp), %eax
	cltq
	movl	-528(%rbp,%rax,4), %eax
	leal	-1(%rax), %edx
	movl	-548(%rbp), %eax
	cltq
	movl	%edx, -528(%rbp,%rax,4)
	addl	$1, -552(%rbp)
.L14:
	movl	-548(%rbp), %eax
	cltq
	movl	-528(%rbp,%rax,4), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, %edx
	movl	-548(%rbp), %eax
	cltq
	movl	%edx, -528(%rbp,%rax,4)
	movl	-548(%rbp), %eax
	cltq
	movl	-528(%rbp,%rax,4), %eax
	cltq
	addq	%rax, -544(%rbp)
	movl	-548(%rbp), %eax
	cltq
	movl	-528(%rbp,%rax,4), %eax
	cltq
	movq	%rax, %rdi
	call	factorial
	movq	-536(%rbp), %rdx
	imulq	%rdx, %rax
	movq	%rax, -536(%rbp)
	addl	$1, -548(%rbp)
.L11:
	cmpl	$127, -548(%rbp)
	jle	.L17
	jmp	.L13
.L22:
	nop
.L13:
	movq	-544(%rbp), %rax
	movq	%rax, %rdi
	call	factorial
	movq	-536(%rbp), %rcx
	movl	$0, %edx
	divq	%rcx
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L16:
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L19
	call	__stack_chk_fail@PLT
.L19:
	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
	.type	compare, @function
compare:
.LFB39:
	.cfi_startproc
	endbr64
	movl	(%rsi), %eax
	subl	(%rdi), %eax
	ret
	.cfi_endproc
.LFE39:
	.size	compare, .-compare
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"0"
.LC1:
	.string	"%llu\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB41:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movl	$64, %ecx
	subq	$528, %rsp
	.cfi_def_cfa_offset 544
	movq	%fs:40, %rax
	movq	%rax, 520(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rbp
	movq	%rbp, %rdi
	rep stosq
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L28:
	movsbq	%al, %rax
	addl	$1, (%rsp,%rax,4)
.L5:
	movq	stdin(%rip), %rdi
	call	getc@PLT
	cmpb	$10, %al
	jne	.L28
	movl	$128, %esi
	movq	%rbp, %rdi
	movl	$4, %edx
	leaq	compare(%rip), %rcx
	call	qsort@PLT
	movq	%rbp, %rdi
	xorl	%r9d, %r9d
	xorl	%esi, %esi
	leaq	512(%rsp), %r10
	movl	$1, %r8d
	.p2align 4,,10
	.p2align 3
.L12:
	movl	(%rdi), %eax
	testl	%eax, %eax
	je	.L6
	testb	$1, %al
	je	.L7
	testl	%r9d, %r9d
	jne	.L29
	subl	$1, %eax
	movl	$1, %r9d
.L7:
	movl	%eax, %ecx
	shrl	$31, %ecx
	addl	%eax, %ecx
	sarl	%ecx
	movl	%ecx, (%rdi)
	movslq	%ecx, %rcx
	addq	%rcx, %rsi
	cmpq	$1, %rcx
	jbe	.L16
	movl	$2, %eax
	movl	$1, %edx
	.p2align 4,,10
	.p2align 3
.L11:
	imulq	%rax, %rdx
	addq	$1, %rax
	cmpq	%rax, %rcx
	jnb	.L11
	addq	$4, %rdi
	imulq	%rdx, %r8
	cmpq	%rdi, %r10
	jne	.L12
.L6:
	cmpq	$1, %rsi
	jbe	.L17
	movl	$2, %ecx
	movl	$1, %eax
	.p2align 4,,10
	.p2align 3
.L14:
	imulq	%rcx, %rax
	addq	$1, %rcx
	cmpq	%rcx, %rsi
	jnb	.L14
.L13:
	xorl	%edx, %edx
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	divq	%r8
	movq	%rax, %rdx
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L9:
	movq	520(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L30
	addq	$528, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 16
	xorl	%eax, %eax
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L16:
	.cfi_restore_state
	movl	$1, %edx
	addq	$4, %rdi
	imulq	%rdx, %r8
	cmpq	%rdi, %r10
	jne	.L12
	jmp	.L6
.L29:
	leaq	.LC0(%rip), %rdi
	call	puts@PLT
	jmp	.L9
.L17:
	movl	$1, %eax
	jmp	.L13
.L30:
	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
	.type	compare, @function
compare:
.LFB39:
	.cfi_startproc
	endbr64
	movl	(%rsi), %eax
	subl	(%rdi), %eax
	ret
	.cfi_endproc
.LFE39:
	.size	compare, .-compare
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"0"
.LC1:
	.string	"%llu\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB41:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movl	$64, %ecx
	subq	$528, %rsp
	.cfi_def_cfa_offset 544
	movq	%fs:40, %rax
	movq	%rax, 520(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rbp
	movq	%rbp, %rdi
	rep stosq
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L28:
	movsbq	%al, %rax
	addl	$1, (%rsp,%rax,4)
.L5:
	movq	stdin(%rip), %rdi
	call	getc@PLT
	cmpb	$10, %al
	jne	.L28
	movl	$128, %esi
	movq	%rbp, %rdi
	movl	$4, %edx
	leaq	compare(%rip), %rcx
	call	qsort@PLT
	movq	%rbp, %rdi
	xorl	%r9d, %r9d
	xorl	%esi, %esi
	leaq	512(%rsp), %r10
	movl	$1, %r8d
	.p2align 4,,10
	.p2align 3
.L12:
	movl	(%rdi), %eax
	testl	%eax, %eax
	je	.L6
	testb	$1, %al
	je	.L7
	testl	%r9d, %r9d
	jne	.L29
	subl	$1, %eax
	movl	$1, %r9d
.L7:
	movl	%eax, %ecx
	shrl	$31, %ecx
	addl	%eax, %ecx
	sarl	%ecx
	movl	%ecx, (%rdi)
	movslq	%ecx, %rcx
	addq	%rcx, %rsi
	cmpq	$1, %rcx
	jbe	.L16
	movl	$2, %eax
	movl	$1, %edx
	.p2align 4,,10
	.p2align 3
.L11:
	imulq	%rax, %rdx
	addq	$1, %rax
	cmpq	%rax, %rcx
	jnb	.L11
	addq	$4, %rdi
	imulq	%rdx, %r8
	cmpq	%rdi, %r10
	jne	.L12
.L6:
	cmpq	$1, %rsi
	jbe	.L17
	movl	$2, %ecx
	movl	$1, %eax
	.p2align 4,,10
	.p2align 3
.L14:
	imulq	%rcx, %rax
	addq	$1, %rcx
	cmpq	%rcx, %rsi
	jnb	.L14
.L13:
	xorl	%edx, %edx
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	divq	%r8
	movq	%rax, %rdx
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L9:
	movq	520(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L30
	addq	$528, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 16
	xorl	%eax, %eax
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L16:
	.cfi_restore_state
	movl	$1, %edx
	addq	$4, %rdi
	imulq	%rdx, %r8
	cmpq	%rdi, %r10
	jne	.L12
	jmp	.L6
.L29:
	leaq	.LC0(%rip), %rdi
	call	puts@PLT
	jmp	.L9
.L17:
	movl	$1, %eax
	jmp	.L13
.L30:
	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>
#include <stdint.h>
#include <limits.h>

#define INT(X) \
  ( *( (const int *)(X) ) )

static int
compare (
  const void * a,
  const void * b
  )
{
  return ( INT( b ) - INT( a ) );
}

static uint64_t
factorial (
  uint64_t n
  )
{
  uint64_t res = 1;
  uint64_t i;

  for ( i = 2; i <= n; ++i )
  {
    res *= i;
  }

  return ( res );
}

/** Application main entry point. */
int
main (
  int     argc,
  char  * argv[ ]
  )
{
  int h[ CHAR_MAX + 1 ] = { 0 };
  int64_t res = 0, dv = 1;
  int dl = 0;
  int i, j;

  for ( ; ; )
  {
    const char ch = getchar ( );

    if ( ch == '\n' ) break ;

    ++h[ ch ];
  }

  qsort ( h, CHAR_MAX + 1, sizeof ( int ), compare );
  for ( i = 0; i <= CHAR_MAX; ++i )
  {
    if ( !( h[ i ] ) ) break ;
    if ( h[ i ] % 2 )
    {
      if ( dl )
      {
        puts ( "0" );
        goto CONTT;
      }

      --h[ i ];
      ++dl;
    }

    h[ i ] /= 2;
    res += h[ i ];
    dv *= factorial ( h[ i ] );
  }

  printf ( "%llu\n", factorial ( res ) / dv );
CONTT: ;

  return ( 0 );
}
ac
 cbcb
 cc
 abca
 bc
 aaca
 cb
 aacb
 ca
 bacb

0
 2
 1
 0
 0
 0
 0
 0
 0
 0

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>
#include <stdint.h>
#include <limits.h>

#define INT(X) \
  ( *( (const int *)(X) ) )

static int
compare (
  const void * a,
  const void * b
  )
{
  return ( INT( b ) - INT( a ) );
}

static uint64_t
factorial (
  uint64_t n
  )
{
  uint64_t res = 1;
  uint64_t i;

  for ( i = 2; i <= n; ++i )
  {
    res *= i;
  }

  return ( res );
}

/** Application main entry point. */
int
main (
  int     argc,
  char  * argv[ ]
  )
{
  int h[ CHAR_MAX + 1 ] = { 0 };
  int64_t res = 0, dv = 1;
  int dl = 0;
  int i, j;

  for ( ; ; )
  {
    const char ch = getchar ( );

    if ( ch == '\n' ) break ;

    ++h[ ch ];
  }

  qsort ( h, CHAR_MAX + 1, sizeof ( int ), compare );
  for ( i = 0; i <= CHAR_MAX; ++i )
  {
    if ( !( h[ i ] ) ) break ;
    if ( h[ i ] % 2 )
    {
      if ( dl )
      {
        puts ( "0" );
        goto CONTT;
      }

      --h[ i ];
      ++dl;
    }

    h[ i ] /= 2;
    res += h[ i ];
    dv *= factorial ( h[ i ] );
  }

  printf ( "%llu\n", factorial ( res ) / dv );
CONTT: ;

  return ( 0 );
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.type	compare, @function
compare:
.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, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-16(%rbp), %rax
	movl	(%rax), %edx
	movq	-8(%rbp), %rax
	movl	(%rax), %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	compare, .-compare
	.type	factorial, @function
factorial:
.LFB7:
	.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	$1, -16(%rbp)
	movq	$2, -8(%rbp)
	jmp	.L4
.L5:
	movq	-16(%rbp), %rax
	imulq	-8(%rbp), %rax
	movq	%rax, -16(%rbp)
	addq	$1, -8(%rbp)
.L4:
	movq	-8(%rbp), %rax
	cmpq	-24(%rbp), %rax
	jbe	.L5
	movq	-16(%rbp), %rax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	factorial, .-factorial
	.section	.rodata
.LC0:
	.string	"0"
.LC1:
	.string	"%llu\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
	subq	$576, %rsp
	movl	%edi, -564(%rbp)
	movq	%rsi, -576(%rbp)
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-528(%rbp), %rdx
	movl	$0, %eax
	movl	$64, %ecx
	movq	%rdx, %rdi
	rep stosq
	movq	$0, -544(%rbp)
	movq	$1, -536(%rbp)
	movl	$0, -552(%rbp)
.L10:
	call	getchar@PLT
	movb	%al, -553(%rbp)
	cmpb	$10, -553(%rbp)
	je	.L21
	movsbl	-553(%rbp), %eax
	movslq	%eax, %rdx
	movl	-528(%rbp,%rdx,4), %edx
	addl	$1, %edx
	cltq
	movl	%edx, -528(%rbp,%rax,4)
	jmp	.L10
.L21:
	nop
	leaq	-528(%rbp), %rax
	leaq	compare(%rip), %rdx
	movq	%rdx, %rcx
	movl	$4, %edx
	movl	$128, %esi
	movq	%rax, %rdi
	call	qsort@PLT
	movl	$0, -548(%rbp)
	jmp	.L11
.L17:
	movl	-548(%rbp), %eax
	cltq
	movl	-528(%rbp,%rax,4), %eax
	testl	%eax, %eax
	je	.L22
	movl	-548(%rbp), %eax
	cltq
	movl	-528(%rbp,%rax,4), %eax
	andl	$1, %eax
	testl	%eax, %eax
	je	.L14
	cmpl	$0, -552(%rbp)
	je	.L15
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L16
.L15:
	movl	-548(%rbp), %eax
	cltq
	movl	-528(%rbp,%rax,4), %eax
	leal	-1(%rax), %edx
	movl	-548(%rbp), %eax
	cltq
	movl	%edx, -528(%rbp,%rax,4)
	addl	$1, -552(%rbp)
.L14:
	movl	-548(%rbp), %eax
	cltq
	movl	-528(%rbp,%rax,4), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, %edx
	movl	-548(%rbp), %eax
	cltq
	movl	%edx, -528(%rbp,%rax,4)
	movl	-548(%rbp), %eax
	cltq
	movl	-528(%rbp,%rax,4), %eax
	cltq
	addq	%rax, -544(%rbp)
	movl	-548(%rbp), %eax
	cltq
	movl	-528(%rbp,%rax,4), %eax
	cltq
	movq	%rax, %rdi
	call	factorial
	movq	-536(%rbp), %rdx
	imulq	%rdx, %rax
	movq	%rax, -536(%rbp)
	addl	$1, -548(%rbp)
.L11:
	cmpl	$127, -548(%rbp)
	jle	.L17
	jmp	.L13
.L22:
	nop
.L13:
	movq	-544(%rbp), %rax
	movq	%rax, %rdi
	call	factorial
	movq	-536(%rbp), %rcx
	movl	$0, %edx
	divq	%rcx
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L16:
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L19
	call	__stack_chk_fail@PLT
.L19:
	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
	.type	compare, @function
compare:
.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, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-16(%rbp), %rax
	movl	(%rax), %edx
	movq	-8(%rbp), %rax
	movl	(%rax), %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	compare, .-compare
	.type	factorial, @function
factorial:
.LFB7:
	.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	$1, -16(%rbp)
	movq	$2, -8(%rbp)
	jmp	.L4
.L5:
	movq	-16(%rbp), %rax
	imulq	-8(%rbp), %rax
	movq	%rax, -16(%rbp)
	addq	$1, -8(%rbp)
.L4:
	movq	-8(%rbp), %rax
	cmpq	-24(%rbp), %rax
	jbe	.L5
	movq	-16(%rbp), %rax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	factorial, .-factorial
	.section	.rodata
.LC0:
	.string	"0"
.LC1:
	.string	"%llu\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
	subq	$576, %rsp
	movl	%edi, -564(%rbp)
	movq	%rsi, -576(%rbp)
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-528(%rbp), %rdx
	movl	$0, %eax
	movl	$64, %ecx
	movq	%rdx, %rdi
	rep stosq
	movq	$0, -544(%rbp)
	movq	$1, -536(%rbp)
	movl	$0, -552(%rbp)
.L10:
	call	getchar@PLT
	movb	%al, -553(%rbp)
	cmpb	$10, -553(%rbp)
	je	.L21
	movsbl	-553(%rbp), %eax
	movslq	%eax, %rdx
	movl	-528(%rbp,%rdx,4), %edx
	addl	$1, %edx
	cltq
	movl	%edx, -528(%rbp,%rax,4)
	jmp	.L10
.L21:
	nop
	leaq	-528(%rbp), %rax
	leaq	compare(%rip), %rdx
	movq	%rdx, %rcx
	movl	$4, %edx
	movl	$128, %esi
	movq	%rax, %rdi
	call	qsort@PLT
	movl	$0, -548(%rbp)
	jmp	.L11
.L17:
	movl	-548(%rbp), %eax
	cltq
	movl	-528(%rbp,%rax,4), %eax
	testl	%eax, %eax
	je	.L22
	movl	-548(%rbp), %eax
	cltq
	movl	-528(%rbp,%rax,4), %eax
	andl	$1, %eax
	testl	%eax, %eax
	je	.L14
	cmpl	$0, -552(%rbp)
	je	.L15
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L16
.L15:
	movl	-548(%rbp), %eax
	cltq
	movl	-528(%rbp,%rax,4), %eax
	leal	-1(%rax), %edx
	movl	-548(%rbp), %eax
	cltq
	movl	%edx, -528(%rbp,%rax,4)
	addl	$1, -552(%rbp)
.L14:
	movl	-548(%rbp), %eax
	cltq
	movl	-528(%rbp,%rax,4), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, %edx
	movl	-548(%rbp), %eax
	cltq
	movl	%edx, -528(%rbp,%rax,4)
	movl	-548(%rbp), %eax
	cltq
	movl	-528(%rbp,%rax,4), %eax
	cltq
	addq	%rax, -544(%rbp)
	movl	-548(%rbp), %eax
	cltq
	movl	-528(%rbp,%rax,4), %eax
	cltq
	movq	%rax, %rdi
	call	factorial
	movq	-536(%rbp), %rdx
	imulq	%rdx, %rax
	movq	%rax, -536(%rbp)
	addl	$1, -548(%rbp)
.L11:
	cmpl	$127, -548(%rbp)
	jle	.L17
	jmp	.L13
.L22:
	nop
.L13:
	movq	-544(%rbp), %rax
	movq	%rax, %rdi
	call	factorial
	movq	-536(%rbp), %rcx
	movl	$0, %edx
	divq	%rcx
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L16:
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L19
	call	__stack_chk_fail@PLT
.L19:
	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:
