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>

#define D(X,F) \
  ( ( (X) / (F) ) % 10 )
#define INT(X) \
  ( *( (const int *)(X) ) )

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

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

int
main (
  int   argc,
  char *argv[ ]
  )
{
  for ( ; ; )
  {
    int res;
    int n;

    scanf ( "%d", &n );
    if ( n == 0 )
      break ;

    if ( D( n, 1 ) == D( n, 10 )
      && D( n, 1 ) == D( n, 100 )
      && D( n, 1 ) == D( n, 1000 ) )
    {
      puts ( "NA" );
      continue ;
    }
 
    for ( res = 0; ; ++res )
    {
      int la[ 4 ], ga[ 4 ];

      if ( n == 6174 )
        break ;

      la[ 0 ] = ga[ 0 ] = D( n, 1000 );
      la[ 1 ] = ga[ 1 ] = D( n, 100 );
      la[ 2 ] = ga[ 2 ] = D( n, 10 );
      la[ 3 ] = ga[ 3 ] = D( n, 1 );
      qsort ( la, 4, sizeof ( int ), lcmp );
      qsort ( ga, 4, sizeof ( int ), gcmp );

      n = 1000 * ga[ 0 ] + 100 * ga[ 1 ] + 10 * ga[ 2 ] + ga[ 3 ]
        - 1000 * la[ 0 ] - 100 * la[ 1 ] - 10 * la[ 2 ] - la[ 3 ];
    }
    printf ( "%d\n", res );
  }

  return ( EXIT_SUCCESS );
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.type	lcmp, @function
lcmp:
.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	-8(%rbp), %rax
	movl	(%rax), %edx
	movq	-16(%rbp), %rax
	movl	(%rax), %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	lcmp, .-lcmp
	.type	gcmp, @function
gcmp:
.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, -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
.LFE7:
	.size	gcmp, .-gcmp
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"NA"
.LC2:
	.string	"%d\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	$80, %rsp
	movl	%edi, -68(%rbp)
	movq	%rsi, -80(%rbp)
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
.L12:
	leaq	-56(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-56(%rbp), %eax
	testl	%eax, %eax
	jne	.L6
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L13
	jmp	.L14
.L6:
	movl	-56(%rbp), %edx
	movslq	%edx, %rax
	imulq	$1717986919, %rax, %rax
	shrq	$32, %rax
	sarl	$2, %eax
	movl	%edx, %esi
	sarl	$31, %esi
	subl	%esi, %eax
	movl	%eax, %ecx
	movl	%ecx, %eax
	sall	$2, %eax
	addl	%ecx, %eax
	addl	%eax, %eax
	movl	%edx, %ecx
	subl	%eax, %ecx
	movl	-56(%rbp), %eax
	movslq	%eax, %rdx
	imulq	$1717986919, %rdx, %rdx
	shrq	$32, %rdx
	sarl	$2, %edx
	sarl	$31, %eax
	movl	%edx, %esi
	subl	%eax, %esi
	movslq	%esi, %rax
	imulq	$1717986919, %rax, %rax
	shrq	$32, %rax
	sarl	$2, %eax
	movl	%esi, %edi
	sarl	$31, %edi
	subl	%edi, %eax
	movl	%eax, %edx
	movl	%edx, %eax
	sall	$2, %eax
	addl	%edx, %eax
	addl	%eax, %eax
	subl	%eax, %esi
	movl	%esi, %edx
	cmpl	%edx, %ecx
	jne	.L8
	movl	-56(%rbp), %edx
	movslq	%edx, %rax
	imulq	$1717986919, %rax, %rax
	shrq	$32, %rax
	sarl	$2, %eax
	movl	%edx, %esi
	sarl	$31, %esi
	subl	%esi, %eax
	movl	%eax, %ecx
	movl	%ecx, %eax
	sall	$2, %eax
	addl	%ecx, %eax
	addl	%eax, %eax
	movl	%edx, %ecx
	subl	%eax, %ecx
	movl	-56(%rbp), %eax
	movslq	%eax, %rdx
	imulq	$1374389535, %rdx, %rdx
	shrq	$32, %rdx
	sarl	$5, %edx
	sarl	$31, %eax
	movl	%edx, %esi
	subl	%eax, %esi
	movslq	%esi, %rax
	imulq	$1717986919, %rax, %rax
	shrq	$32, %rax
	sarl	$2, %eax
	movl	%esi, %edi
	sarl	$31, %edi
	subl	%edi, %eax
	movl	%eax, %edx
	movl	%edx, %eax
	sall	$2, %eax
	addl	%edx, %eax
	addl	%eax, %eax
	subl	%eax, %esi
	movl	%esi, %edx
	cmpl	%edx, %ecx
	jne	.L8
	movl	-56(%rbp), %edx
	movslq	%edx, %rax
	imulq	$1717986919, %rax, %rax
	shrq	$32, %rax
	sarl	$2, %eax
	movl	%edx, %esi
	sarl	$31, %esi
	subl	%esi, %eax
	movl	%eax, %ecx
	movl	%ecx, %eax
	sall	$2, %eax
	addl	%ecx, %eax
	addl	%eax, %eax
	movl	%edx, %ecx
	subl	%eax, %ecx
	movl	-56(%rbp), %eax
	movslq	%eax, %rdx
	imulq	$274877907, %rdx, %rdx
	shrq	$32, %rdx
	sarl	$6, %edx
	sarl	$31, %eax
	movl	%edx, %esi
	subl	%eax, %esi
	movslq	%esi, %rax
	imulq	$1717986919, %rax, %rax
	shrq	$32, %rax
	sarl	$2, %eax
	movl	%esi, %edi
	sarl	$31, %edi
	subl	%edi, %eax
	movl	%eax, %edx
	movl	%edx, %eax
	sall	$2, %eax
	addl	%edx, %eax
	addl	%eax, %eax
	subl	%eax, %esi
	movl	%esi, %edx
	cmpl	%edx, %ecx
	jne	.L8
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L12
.L8:
	movl	$0, -52(%rbp)
.L11:
	movl	-56(%rbp), %eax
	cmpl	$6174, %eax
	jne	.L10
	movl	-52(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L12
.L10:
	movl	-56(%rbp), %eax
	movslq	%eax, %rdx
	imulq	$274877907, %rdx, %rdx
	shrq	$32, %rdx
	sarl	$6, %edx
	sarl	$31, %eax
	movl	%edx, %ecx
	subl	%eax, %ecx
	movslq	%ecx, %rax
	imulq	$1717986919, %rax, %rax
	shrq	$32, %rax
	sarl	$2, %eax
	movl	%ecx, %esi
	sarl	$31, %esi
	subl	%esi, %eax
	movl	%eax, %edx
	movl	%edx, %eax
	sall	$2, %eax
	addl	%edx, %eax
	addl	%eax, %eax
	subl	%eax, %ecx
	movl	%ecx, %edx
	movl	%edx, -32(%rbp)
	movl	-32(%rbp), %eax
	movl	%eax, -48(%rbp)
	movl	-56(%rbp), %eax
	movslq	%eax, %rdx
	imulq	$1374389535, %rdx, %rdx
	shrq	$32, %rdx
	sarl	$5, %edx
	sarl	$31, %eax
	movl	%edx, %ecx
	subl	%eax, %ecx
	movslq	%ecx, %rax
	imulq	$1717986919, %rax, %rax
	shrq	$32, %rax
	sarl	$2, %eax
	movl	%ecx, %esi
	sarl	$31, %esi
	subl	%esi, %eax
	movl	%eax, %edx
	movl	%edx, %eax
	sall	$2, %eax
	addl	%edx, %eax
	addl	%eax, %eax
	subl	%eax, %ecx
	movl	%ecx, %edx
	movl	%edx, -28(%rbp)
	movl	-28(%rbp), %eax
	movl	%eax, -44(%rbp)
	movl	-56(%rbp), %eax
	movslq	%eax, %rdx
	imulq	$1717986919, %rdx, %rdx
	shrq	$32, %rdx
	sarl	$2, %edx
	sarl	$31, %eax
	movl	%edx, %ecx
	subl	%eax, %ecx
	movslq	%ecx, %rax
	imulq	$1717986919, %rax, %rax
	shrq	$32, %rax
	sarl	$2, %eax
	movl	%ecx, %esi
	sarl	$31, %esi
	subl	%esi, %eax
	movl	%eax, %edx
	movl	%edx, %eax
	sall	$2, %eax
	addl	%edx, %eax
	addl	%eax, %eax
	subl	%eax, %ecx
	movl	%ecx, %edx
	movl	%edx, -24(%rbp)
	movl	-24(%rbp), %eax
	movl	%eax, -40(%rbp)
	movl	-56(%rbp), %ecx
	movslq	%ecx, %rax
	imulq	$1717986919, %rax, %rax
	shrq	$32, %rax
	sarl	$2, %eax
	movl	%ecx, %esi
	sarl	$31, %esi
	subl	%esi, %eax
	movl	%eax, %edx
	movl	%edx, %eax
	sall	$2, %eax
	addl	%edx, %eax
	addl	%eax, %eax
	subl	%eax, %ecx
	movl	%ecx, %edx
	movl	%edx, -20(%rbp)
	movl	-20(%rbp), %eax
	movl	%eax, -36(%rbp)
	leaq	-48(%rbp), %rax
	leaq	lcmp(%rip), %rdx
	movq	%rdx, %rcx
	movl	$4, %edx
	movl	$4, %esi
	movq	%rax, %rdi
	call	qsort@PLT
	leaq	-32(%rbp), %rax
	leaq	gcmp(%rip), %rdx
	movq	%rdx, %rcx
	movl	$4, %edx
	movl	$4, %esi
	movq	%rax, %rdi
	call	qsort@PLT
	movl	-32(%rbp), %eax
	imull	$1000, %eax, %edx
	movl	-28(%rbp), %eax
	imull	$100, %eax, %eax
	leal	(%rdx,%rax), %ecx
	movl	-24(%rbp), %edx
	movl	%edx, %eax
	sall	$2, %eax
	addl	%edx, %eax
	addl	%eax, %eax
	leal	(%rcx,%rax), %edx
	movl	-20(%rbp), %eax
	addl	%eax, %edx
	movl	-48(%rbp), %eax
	imull	$-1000, %eax, %eax
	addl	%eax, %edx
	movl	-44(%rbp), %eax
	imull	$-100, %eax, %eax
	addl	%eax, %edx
	movl	-40(%rbp), %eax
	imull	$-10, %eax, %eax
	addl	%edx, %eax
	movl	-36(%rbp), %edx
	subl	%edx, %eax
	movl	%eax, -56(%rbp)
	addl	$1, -52(%rbp)
	jmp	.L11
.L14:
	call	__stack_chk_fail@PLT
.L13:
	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	lcmp, @function
lcmp:
.LFB39:
	.cfi_startproc
	endbr64
	movl	(%rdi), %eax
	subl	(%rsi), %eax
	ret
	.cfi_endproc
.LFE39:
	.size	lcmp, .-lcmp
	.p2align 4
	.type	gcmp, @function
gcmp:
.LFB40:
	.cfi_startproc
	endbr64
	movl	(%rsi), %eax
	subl	(%rdi), %eax
	ret
	.cfi_endproc
.LFE40:
	.size	gcmp, .-gcmp
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"NA"
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB41:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	leaq	lcmp(%rip), %r14
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	leaq	gcmp(%rip), %r13
	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	$72, %rsp
	.cfi_def_cfa_offset 128
	movq	%fs:40, %rax
	movq	%rax, 56(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %r15
	.p2align 4,,10
	.p2align 3
.L5:
	movq	%r15, %rsi
	leaq	.LC0(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	testl	%eax, %eax
	je	.L6
	movslq	%eax, %rcx
	movl	%eax, %r8d
	imulq	$1717986919, %rcx, %rsi
	sarl	$31, %r8d
	sarq	$34, %rsi
	subl	%r8d, %esi
	leal	(%rsi,%rsi,4), %edx
	movl	%esi, %edi
	movl	%eax, %esi
	addl	%edx, %edx
	movl	%edi, %r9d
	subl	%edx, %esi
	movslq	%edi, %rdx
	sarl	$31, %r9d
	imulq	$1717986919, %rdx, %rdx
	sarq	$34, %rdx
	subl	%r9d, %edx
	leal	(%rdx,%rdx,4), %edx
	addl	%edx, %edx
	subl	%edx, %edi
	cmpl	%edi, %esi
	jne	.L10
	imulq	$1374389535, %rcx, %rdx
	sarq	$37, %rdx
	subl	%r8d, %edx
	movslq	%edx, %rdi
	movl	%edx, %r9d
	imulq	$1717986919, %rdi, %rdi
	sarl	$31, %r9d
	sarq	$34, %rdi
	subl	%r9d, %edi
	leal	(%rdi,%rdi,4), %edi
	addl	%edi, %edi
	subl	%edi, %edx
	cmpl	%edx, %esi
	jne	.L10
	imulq	$274877907, %rcx, %rdx
	sarq	$38, %rdx
	subl	%r8d, %edx
	movslq	%edx, %rdi
	movl	%edx, %r8d
	imulq	$1717986919, %rdi, %rdi
	sarl	$31, %r8d
	sarq	$34, %rdi
	subl	%r8d, %edi
	leal	(%rdi,%rdi,4), %edi
	addl	%edi, %edi
	subl	%edi, %edx
	cmpl	%edx, %esi
	je	.L17
.L10:
	xorl	%r12d, %r12d
	cmpl	$6174, %eax
	je	.L8
	leaq	16(%rsp), %rbp
	leaq	32(%rsp), %rbx
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L18:
	movslq	%eax, %rcx
.L9:
	imulq	$274877907, %rcx, %rdx
	movl	%eax, %r8d
	sarl	$31, %r8d
	sarq	$38, %rdx
	subl	%r8d, %edx
	movslq	%edx, %rsi
	movl	%edx, %edi
	imulq	$1717986919, %rsi, %rsi
	sarl	$31, %edi
	sarq	$34, %rsi
	subl	%edi, %esi
	leal	(%rsi,%rsi,4), %edi
	movl	%edx, %esi
	imulq	$1374389535, %rcx, %rdx
	addl	%edi, %edi
	subl	%edi, %esi
	imulq	$1717986919, %rcx, %rcx
	movd	%esi, %xmm0
	movl	%esi, 32(%rsp)
	movl	$4, %esi
	sarq	$37, %rdx
	subl	%r8d, %edx
	sarq	$34, %rcx
	movslq	%edx, %rdi
	movl	%edx, %r9d
	subl	%r8d, %ecx
	imulq	$1717986919, %rdi, %rdi
	sarl	$31, %r9d
	movl	%ecx, %r8d
	sarl	$31, %r8d
	sarq	$34, %rdi
	subl	%r9d, %edi
	leal	(%rdi,%rdi,4), %r9d
	movl	%edx, %edi
	movslq	%ecx, %rdx
	imulq	$1717986919, %rdx, %rdx
	addl	%r9d, %r9d
	subl	%r9d, %edi
	movd	%edi, %xmm3
	movl	%edi, 36(%rsp)
	movq	%rbp, %rdi
	sarq	$34, %rdx
	punpckldq	%xmm3, %xmm0
	subl	%r8d, %edx
	leal	(%rdx,%rdx,4), %r8d
	movl	%ecx, %edx
	leal	(%rcx,%rcx,4), %ecx
	addl	%r8d, %r8d
	addl	%ecx, %ecx
	subl	%r8d, %edx
	subl	%ecx, %eax
	movq	%r14, %rcx
	movd	%eax, %xmm2
	movd	%edx, %xmm1
	movl	%edx, 40(%rsp)
	movl	$4, %edx
	punpckldq	%xmm2, %xmm1
	movl	%eax, 44(%rsp)
	punpcklqdq	%xmm1, %xmm0
	movaps	%xmm0, 16(%rsp)
	call	qsort@PLT
	movl	$4, %edx
	movq	%r13, %rcx
	movq	%rbx, %rdi
	movl	$4, %esi
	call	qsort@PLT
	imull	$1000, 32(%rsp), %eax
	addl	$1, %r12d
	imull	$100, 36(%rsp), %edx
	addl	%edx, %eax
	movl	40(%rsp), %edx
	leal	(%rdx,%rdx,4), %edx
	leal	(%rax,%rdx,2), %eax
	addl	44(%rsp), %eax
	imull	$-1000, 16(%rsp), %edx
	addl	%edx, %eax
	imull	$-100, 20(%rsp), %edx
	addl	%edx, %eax
	imull	$-10, 24(%rsp), %edx
	addl	%edx, %eax
	subl	28(%rsp), %eax
	movl	%eax, 12(%rsp)
	cmpl	$6174, %eax
	jne	.L18
.L8:
	movl	%r12d, %edx
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L6:
	movq	56(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L19
	addq	$72, %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
	.p2align 4,,10
	.p2align 3
.L17:
	.cfi_restore_state
	leaq	.LC1(%rip), %rdi
	call	puts@PLT
	jmp	.L5
.L19:
	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	lcmp, @function
lcmp:
.LFB39:
	.cfi_startproc
	endbr64
	movl	(%rdi), %eax
	subl	(%rsi), %eax
	ret
	.cfi_endproc
.LFE39:
	.size	lcmp, .-lcmp
	.p2align 4
	.type	gcmp, @function
gcmp:
.LFB40:
	.cfi_startproc
	endbr64
	movl	(%rsi), %eax
	subl	(%rdi), %eax
	ret
	.cfi_endproc
.LFE40:
	.size	gcmp, .-gcmp
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"NA"
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB41:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	leaq	lcmp(%rip), %r14
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	leaq	gcmp(%rip), %r13
	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	$72, %rsp
	.cfi_def_cfa_offset 128
	movq	%fs:40, %rax
	movq	%rax, 56(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %r15
	.p2align 4,,10
	.p2align 3
.L5:
	movq	%r15, %rsi
	leaq	.LC0(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	testl	%eax, %eax
	je	.L6
	movslq	%eax, %rcx
	movl	%eax, %r8d
	imulq	$1717986919, %rcx, %rsi
	sarl	$31, %r8d
	sarq	$34, %rsi
	subl	%r8d, %esi
	leal	(%rsi,%rsi,4), %edx
	movl	%esi, %edi
	movl	%eax, %esi
	addl	%edx, %edx
	movl	%edi, %r9d
	subl	%edx, %esi
	movslq	%edi, %rdx
	sarl	$31, %r9d
	imulq	$1717986919, %rdx, %rdx
	sarq	$34, %rdx
	subl	%r9d, %edx
	leal	(%rdx,%rdx,4), %edx
	addl	%edx, %edx
	subl	%edx, %edi
	cmpl	%edi, %esi
	jne	.L10
	imulq	$1374389535, %rcx, %rdx
	sarq	$37, %rdx
	subl	%r8d, %edx
	movslq	%edx, %rdi
	movl	%edx, %r9d
	imulq	$1717986919, %rdi, %rdi
	sarl	$31, %r9d
	sarq	$34, %rdi
	subl	%r9d, %edi
	leal	(%rdi,%rdi,4), %edi
	addl	%edi, %edi
	subl	%edi, %edx
	cmpl	%edx, %esi
	jne	.L10
	imulq	$274877907, %rcx, %rdx
	sarq	$38, %rdx
	subl	%r8d, %edx
	movslq	%edx, %rdi
	movl	%edx, %r8d
	imulq	$1717986919, %rdi, %rdi
	sarl	$31, %r8d
	sarq	$34, %rdi
	subl	%r8d, %edi
	leal	(%rdi,%rdi,4), %edi
	addl	%edi, %edi
	subl	%edi, %edx
	cmpl	%edx, %esi
	je	.L17
.L10:
	xorl	%r12d, %r12d
	cmpl	$6174, %eax
	je	.L8
	leaq	16(%rsp), %rbp
	leaq	32(%rsp), %rbx
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L18:
	movslq	%eax, %rcx
.L9:
	imulq	$274877907, %rcx, %rdx
	movl	%eax, %r8d
	sarl	$31, %r8d
	sarq	$38, %rdx
	subl	%r8d, %edx
	movslq	%edx, %rsi
	movl	%edx, %edi
	imulq	$1717986919, %rsi, %rsi
	sarl	$31, %edi
	sarq	$34, %rsi
	subl	%edi, %esi
	leal	(%rsi,%rsi,4), %edi
	movl	%edx, %esi
	imulq	$1374389535, %rcx, %rdx
	addl	%edi, %edi
	subl	%edi, %esi
	imulq	$1717986919, %rcx, %rcx
	movd	%esi, %xmm0
	movl	%esi, 32(%rsp)
	movl	$4, %esi
	sarq	$37, %rdx
	subl	%r8d, %edx
	sarq	$34, %rcx
	movslq	%edx, %rdi
	movl	%edx, %r9d
	subl	%r8d, %ecx
	imulq	$1717986919, %rdi, %rdi
	sarl	$31, %r9d
	movl	%ecx, %r8d
	sarl	$31, %r8d
	sarq	$34, %rdi
	subl	%r9d, %edi
	leal	(%rdi,%rdi,4), %r9d
	movl	%edx, %edi
	movslq	%ecx, %rdx
	imulq	$1717986919, %rdx, %rdx
	addl	%r9d, %r9d
	subl	%r9d, %edi
	movd	%edi, %xmm3
	movl	%edi, 36(%rsp)
	movq	%rbp, %rdi
	sarq	$34, %rdx
	punpckldq	%xmm3, %xmm0
	subl	%r8d, %edx
	leal	(%rdx,%rdx,4), %r8d
	movl	%ecx, %edx
	leal	(%rcx,%rcx,4), %ecx
	addl	%r8d, %r8d
	addl	%ecx, %ecx
	subl	%r8d, %edx
	subl	%ecx, %eax
	movq	%r14, %rcx
	movd	%eax, %xmm2
	movd	%edx, %xmm1
	movl	%edx, 40(%rsp)
	movl	$4, %edx
	punpckldq	%xmm2, %xmm1
	movl	%eax, 44(%rsp)
	punpcklqdq	%xmm1, %xmm0
	movaps	%xmm0, 16(%rsp)
	call	qsort@PLT
	movl	$4, %edx
	movq	%r13, %rcx
	movq	%rbx, %rdi
	movl	$4, %esi
	call	qsort@PLT
	imull	$1000, 32(%rsp), %eax
	addl	$1, %r12d
	imull	$100, 36(%rsp), %edx
	addl	%edx, %eax
	movl	40(%rsp), %edx
	leal	(%rdx,%rdx,4), %edx
	leal	(%rax,%rdx,2), %eax
	addl	44(%rsp), %eax
	imull	$-1000, 16(%rsp), %edx
	addl	%edx, %eax
	imull	$-100, 20(%rsp), %edx
	addl	%edx, %eax
	imull	$-10, 24(%rsp), %edx
	addl	%edx, %eax
	subl	28(%rsp), %eax
	movl	%eax, 12(%rsp)
	cmpl	$6174, %eax
	jne	.L18
.L8:
	movl	%r12d, %edx
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L6:
	movq	56(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L19
	addq	$72, %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
	.p2align 4,,10
	.p2align 3
.L17:
	.cfi_restore_state
	leaq	.LC1(%rip), %rdi
	call	puts@PLT
	jmp	.L5
.L19:
	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>

#define D(X,F) \
  ( ( (X) / (F) ) % 10 )
#define INT(X) \
  ( *( (const int *)(X) ) )

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

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

int
main (
  int   argc,
  char *argv[ ]
  )
{
  for ( ; ; )
  {
    int res;
    int n;

    scanf ( "%d", &n );
    if ( n == 0 )
      break ;

    if ( D( n, 1 ) == D( n, 10 )
      && D( n, 1 ) == D( n, 100 )
      && D( n, 1 ) == D( n, 1000 ) )
    {
      puts ( "NA" );
      continue ;
    }
 
    for ( res = 0; ; ++res )
    {
      int la[ 4 ], ga[ 4 ];

      if ( n == 6174 )
        break ;

      la[ 0 ] = ga[ 0 ] = D( n, 1000 );
      la[ 1 ] = ga[ 1 ] = D( n, 100 );
      la[ 2 ] = ga[ 2 ] = D( n, 10 );
      la[ 3 ] = ga[ 3 ] = D( n, 1 );
      qsort ( la, 4, sizeof ( int ), lcmp );
      qsort ( ga, 4, sizeof ( int ), gcmp );

      n = 1000 * ga[ 0 ] + 100 * ga[ 1 ] + 10 * ga[ 2 ] + ga[ 3 ]
        - 1000 * la[ 0 ] - 100 * la[ 1 ] - 10 * la[ 2 ] - la[ 3 ];
    }
    printf ( "%d\n", res );
  }

  return ( EXIT_SUCCESS );
}
6174
3985
3333
0000
 6174
1779
3333
0000
 6174
1779
2211
0000
 6174
2012
3078
0000
 6174
3985
5889
0000
 6174
2012
3639
0000
 6174
1794
3333
0000
 6174
1779
1275
0000
 6174
1289
3078
0000
 6174
3985
4510
0000

0
3
NA
 0
6
NA
 0
6
4
 0
3
2
 0
3
4
 0
3
3
 0
5
NA
 0
6
3
 0
2
2
 0
3
5

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>

#define D(X,F) \
  ( ( (X) / (F) ) % 10 )
#define INT(X) \
  ( *( (const int *)(X) ) )

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

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

int
main (
  int   argc,
  char *argv[ ]
  )
{
  for ( ; ; )
  {
    int res;
    int n;

    scanf ( "%d", &n );
    if ( n == 0 )
      break ;

    if ( D( n, 1 ) == D( n, 10 )
      && D( n, 1 ) == D( n, 100 )
      && D( n, 1 ) == D( n, 1000 ) )
    {
      puts ( "NA" );
      continue ;
    }
 
    for ( res = 0; ; ++res )
    {
      int la[ 4 ], ga[ 4 ];

      if ( n == 6174 )
        break ;

      la[ 0 ] = ga[ 0 ] = D( n, 1000 );
      la[ 1 ] = ga[ 1 ] = D( n, 100 );
      la[ 2 ] = ga[ 2 ] = D( n, 10 );
      la[ 3 ] = ga[ 3 ] = D( n, 1 );
      qsort ( la, 4, sizeof ( int ), lcmp );
      qsort ( ga, 4, sizeof ( int ), gcmp );

      n = 1000 * ga[ 0 ] + 100 * ga[ 1 ] + 10 * ga[ 2 ] + ga[ 3 ]
        - 1000 * la[ 0 ] - 100 * la[ 1 ] - 10 * la[ 2 ] - la[ 3 ];
    }
    printf ( "%d\n", res );
  }

  return ( EXIT_SUCCESS );
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.type	lcmp, @function
lcmp:
.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	-8(%rbp), %rax
	movl	(%rax), %edx
	movq	-16(%rbp), %rax
	movl	(%rax), %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	lcmp, .-lcmp
	.type	gcmp, @function
gcmp:
.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, -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
.LFE7:
	.size	gcmp, .-gcmp
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"NA"
.LC2:
	.string	"%d\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	$80, %rsp
	movl	%edi, -68(%rbp)
	movq	%rsi, -80(%rbp)
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
.L12:
	leaq	-56(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-56(%rbp), %eax
	testl	%eax, %eax
	jne	.L6
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L13
	jmp	.L14
.L6:
	movl	-56(%rbp), %edx
	movslq	%edx, %rax
	imulq	$1717986919, %rax, %rax
	shrq	$32, %rax
	sarl	$2, %eax
	movl	%edx, %esi
	sarl	$31, %esi
	subl	%esi, %eax
	movl	%eax, %ecx
	movl	%ecx, %eax
	sall	$2, %eax
	addl	%ecx, %eax
	addl	%eax, %eax
	movl	%edx, %ecx
	subl	%eax, %ecx
	movl	-56(%rbp), %eax
	movslq	%eax, %rdx
	imulq	$1717986919, %rdx, %rdx
	shrq	$32, %rdx
	sarl	$2, %edx
	sarl	$31, %eax
	movl	%edx, %esi
	subl	%eax, %esi
	movslq	%esi, %rax
	imulq	$1717986919, %rax, %rax
	shrq	$32, %rax
	sarl	$2, %eax
	movl	%esi, %edi
	sarl	$31, %edi
	subl	%edi, %eax
	movl	%eax, %edx
	movl	%edx, %eax
	sall	$2, %eax
	addl	%edx, %eax
	addl	%eax, %eax
	subl	%eax, %esi
	movl	%esi, %edx
	cmpl	%edx, %ecx
	jne	.L8
	movl	-56(%rbp), %edx
	movslq	%edx, %rax
	imulq	$1717986919, %rax, %rax
	shrq	$32, %rax
	sarl	$2, %eax
	movl	%edx, %esi
	sarl	$31, %esi
	subl	%esi, %eax
	movl	%eax, %ecx
	movl	%ecx, %eax
	sall	$2, %eax
	addl	%ecx, %eax
	addl	%eax, %eax
	movl	%edx, %ecx
	subl	%eax, %ecx
	movl	-56(%rbp), %eax
	movslq	%eax, %rdx
	imulq	$1374389535, %rdx, %rdx
	shrq	$32, %rdx
	sarl	$5, %edx
	sarl	$31, %eax
	movl	%edx, %esi
	subl	%eax, %esi
	movslq	%esi, %rax
	imulq	$1717986919, %rax, %rax
	shrq	$32, %rax
	sarl	$2, %eax
	movl	%esi, %edi
	sarl	$31, %edi
	subl	%edi, %eax
	movl	%eax, %edx
	movl	%edx, %eax
	sall	$2, %eax
	addl	%edx, %eax
	addl	%eax, %eax
	subl	%eax, %esi
	movl	%esi, %edx
	cmpl	%edx, %ecx
	jne	.L8
	movl	-56(%rbp), %edx
	movslq	%edx, %rax
	imulq	$1717986919, %rax, %rax
	shrq	$32, %rax
	sarl	$2, %eax
	movl	%edx, %esi
	sarl	$31, %esi
	subl	%esi, %eax
	movl	%eax, %ecx
	movl	%ecx, %eax
	sall	$2, %eax
	addl	%ecx, %eax
	addl	%eax, %eax
	movl	%edx, %ecx
	subl	%eax, %ecx
	movl	-56(%rbp), %eax
	movslq	%eax, %rdx
	imulq	$274877907, %rdx, %rdx
	shrq	$32, %rdx
	sarl	$6, %edx
	sarl	$31, %eax
	movl	%edx, %esi
	subl	%eax, %esi
	movslq	%esi, %rax
	imulq	$1717986919, %rax, %rax
	shrq	$32, %rax
	sarl	$2, %eax
	movl	%esi, %edi
	sarl	$31, %edi
	subl	%edi, %eax
	movl	%eax, %edx
	movl	%edx, %eax
	sall	$2, %eax
	addl	%edx, %eax
	addl	%eax, %eax
	subl	%eax, %esi
	movl	%esi, %edx
	cmpl	%edx, %ecx
	jne	.L8
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L12
.L8:
	movl	$0, -52(%rbp)
.L11:
	movl	-56(%rbp), %eax
	cmpl	$6174, %eax
	jne	.L10
	movl	-52(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L12
.L10:
	movl	-56(%rbp), %eax
	movslq	%eax, %rdx
	imulq	$274877907, %rdx, %rdx
	shrq	$32, %rdx
	sarl	$6, %edx
	sarl	$31, %eax
	movl	%edx, %ecx
	subl	%eax, %ecx
	movslq	%ecx, %rax
	imulq	$1717986919, %rax, %rax
	shrq	$32, %rax
	sarl	$2, %eax
	movl	%ecx, %esi
	sarl	$31, %esi
	subl	%esi, %eax
	movl	%eax, %edx
	movl	%edx, %eax
	sall	$2, %eax
	addl	%edx, %eax
	addl	%eax, %eax
	subl	%eax, %ecx
	movl	%ecx, %edx
	movl	%edx, -32(%rbp)
	movl	-32(%rbp), %eax
	movl	%eax, -48(%rbp)
	movl	-56(%rbp), %eax
	movslq	%eax, %rdx
	imulq	$1374389535, %rdx, %rdx
	shrq	$32, %rdx
	sarl	$5, %edx
	sarl	$31, %eax
	movl	%edx, %ecx
	subl	%eax, %ecx
	movslq	%ecx, %rax
	imulq	$1717986919, %rax, %rax
	shrq	$32, %rax
	sarl	$2, %eax
	movl	%ecx, %esi
	sarl	$31, %esi
	subl	%esi, %eax
	movl	%eax, %edx
	movl	%edx, %eax
	sall	$2, %eax
	addl	%edx, %eax
	addl	%eax, %eax
	subl	%eax, %ecx
	movl	%ecx, %edx
	movl	%edx, -28(%rbp)
	movl	-28(%rbp), %eax
	movl	%eax, -44(%rbp)
	movl	-56(%rbp), %eax
	movslq	%eax, %rdx
	imulq	$1717986919, %rdx, %rdx
	shrq	$32, %rdx
	sarl	$2, %edx
	sarl	$31, %eax
	movl	%edx, %ecx
	subl	%eax, %ecx
	movslq	%ecx, %rax
	imulq	$1717986919, %rax, %rax
	shrq	$32, %rax
	sarl	$2, %eax
	movl	%ecx, %esi
	sarl	$31, %esi
	subl	%esi, %eax
	movl	%eax, %edx
	movl	%edx, %eax
	sall	$2, %eax
	addl	%edx, %eax
	addl	%eax, %eax
	subl	%eax, %ecx
	movl	%ecx, %edx
	movl	%edx, -24(%rbp)
	movl	-24(%rbp), %eax
	movl	%eax, -40(%rbp)
	movl	-56(%rbp), %ecx
	movslq	%ecx, %rax
	imulq	$1717986919, %rax, %rax
	shrq	$32, %rax
	sarl	$2, %eax
	movl	%ecx, %esi
	sarl	$31, %esi
	subl	%esi, %eax
	movl	%eax, %edx
	movl	%edx, %eax
	sall	$2, %eax
	addl	%edx, %eax
	addl	%eax, %eax
	subl	%eax, %ecx
	movl	%ecx, %edx
	movl	%edx, -20(%rbp)
	movl	-20(%rbp), %eax
	movl	%eax, -36(%rbp)
	leaq	-48(%rbp), %rax
	leaq	lcmp(%rip), %rdx
	movq	%rdx, %rcx
	movl	$4, %edx
	movl	$4, %esi
	movq	%rax, %rdi
	call	qsort@PLT
	leaq	-32(%rbp), %rax
	leaq	gcmp(%rip), %rdx
	movq	%rdx, %rcx
	movl	$4, %edx
	movl	$4, %esi
	movq	%rax, %rdi
	call	qsort@PLT
	movl	-32(%rbp), %eax
	imull	$1000, %eax, %edx
	movl	-28(%rbp), %eax
	imull	$100, %eax, %eax
	leal	(%rdx,%rax), %ecx
	movl	-24(%rbp), %edx
	movl	%edx, %eax
	sall	$2, %eax
	addl	%edx, %eax
	addl	%eax, %eax
	leal	(%rcx,%rax), %edx
	movl	-20(%rbp), %eax
	addl	%eax, %edx
	movl	-48(%rbp), %eax
	imull	$-1000, %eax, %eax
	addl	%eax, %edx
	movl	-44(%rbp), %eax
	imull	$-100, %eax, %eax
	addl	%eax, %edx
	movl	-40(%rbp), %eax
	imull	$-10, %eax, %eax
	addl	%edx, %eax
	movl	-36(%rbp), %edx
	subl	%edx, %eax
	movl	%eax, -56(%rbp)
	addl	$1, -52(%rbp)
	jmp	.L11
.L14:
	call	__stack_chk_fail@PLT
.L13:
	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	lcmp, @function
lcmp:
.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	-8(%rbp), %rax
	movl	(%rax), %edx
	movq	-16(%rbp), %rax
	movl	(%rax), %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	lcmp, .-lcmp
	.type	gcmp, @function
gcmp:
.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, -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
.LFE7:
	.size	gcmp, .-gcmp
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"NA"
.LC2:
	.string	"%d\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	$80, %rsp
	movl	%edi, -68(%rbp)
	movq	%rsi, -80(%rbp)
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
.L12:
	leaq	-56(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-56(%rbp), %eax
	testl	%eax, %eax
	jne	.L6
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L13
	jmp	.L14
.L6:
	movl	-56(%rbp), %edx
	movslq	%edx, %rax
	imulq	$1717986919, %rax, %rax
	shrq	$32, %rax
	sarl	$2, %eax
	movl	%edx, %esi
	sarl	$31, %esi
	subl	%esi, %eax
	movl	%eax, %ecx
	movl	%ecx, %eax
	sall	$2, %eax
	addl	%ecx, %eax
	addl	%eax, %eax
	movl	%edx, %ecx
	subl	%eax, %ecx
	movl	-56(%rbp), %eax
	movslq	%eax, %rdx
	imulq	$1717986919, %rdx, %rdx
	shrq	$32, %rdx
	sarl	$2, %edx
	sarl	$31, %eax
	movl	%edx, %esi
	subl	%eax, %esi
	movslq	%esi, %rax
	imulq	$1717986919, %rax, %rax
	shrq	$32, %rax
	sarl	$2, %eax
	movl	%esi, %edi
	sarl	$31, %edi
	subl	%edi, %eax
	movl	%eax, %edx
	movl	%edx, %eax
	sall	$2, %eax
	addl	%edx, %eax
	addl	%eax, %eax
	subl	%eax, %esi
	movl	%esi, %edx
	cmpl	%edx, %ecx
	jne	.L8
	movl	-56(%rbp), %edx
	movslq	%edx, %rax
	imulq	$1717986919, %rax, %rax
	shrq	$32, %rax
	sarl	$2, %eax
	movl	%edx, %esi
	sarl	$31, %esi
	subl	%esi, %eax
	movl	%eax, %ecx
	movl	%ecx, %eax
	sall	$2, %eax
	addl	%ecx, %eax
	addl	%eax, %eax
	movl	%edx, %ecx
	subl	%eax, %ecx
	movl	-56(%rbp), %eax
	movslq	%eax, %rdx
	imulq	$1374389535, %rdx, %rdx
	shrq	$32, %rdx
	sarl	$5, %edx
	sarl	$31, %eax
	movl	%edx, %esi
	subl	%eax, %esi
	movslq	%esi, %rax
	imulq	$1717986919, %rax, %rax
	shrq	$32, %rax
	sarl	$2, %eax
	movl	%esi, %edi
	sarl	$31, %edi
	subl	%edi, %eax
	movl	%eax, %edx
	movl	%edx, %eax
	sall	$2, %eax
	addl	%edx, %eax
	addl	%eax, %eax
	subl	%eax, %esi
	movl	%esi, %edx
	cmpl	%edx, %ecx
	jne	.L8
	movl	-56(%rbp), %edx
	movslq	%edx, %rax
	imulq	$1717986919, %rax, %rax
	shrq	$32, %rax
	sarl	$2, %eax
	movl	%edx, %esi
	sarl	$31, %esi
	subl	%esi, %eax
	movl	%eax, %ecx
	movl	%ecx, %eax
	sall	$2, %eax
	addl	%ecx, %eax
	addl	%eax, %eax
	movl	%edx, %ecx
	subl	%eax, %ecx
	movl	-56(%rbp), %eax
	movslq	%eax, %rdx
	imulq	$274877907, %rdx, %rdx
	shrq	$32, %rdx
	sarl	$6, %edx
	sarl	$31, %eax
	movl	%edx, %esi
	subl	%eax, %esi
	movslq	%esi, %rax
	imulq	$1717986919, %rax, %rax
	shrq	$32, %rax
	sarl	$2, %eax
	movl	%esi, %edi
	sarl	$31, %edi
	subl	%edi, %eax
	movl	%eax, %edx
	movl	%edx, %eax
	sall	$2, %eax
	addl	%edx, %eax
	addl	%eax, %eax
	subl	%eax, %esi
	movl	%esi, %edx
	cmpl	%edx, %ecx
	jne	.L8
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L12
.L8:
	movl	$0, -52(%rbp)
.L11:
	movl	-56(%rbp), %eax
	cmpl	$6174, %eax
	jne	.L10
	movl	-52(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L12
.L10:
	movl	-56(%rbp), %eax
	movslq	%eax, %rdx
	imulq	$274877907, %rdx, %rdx
	shrq	$32, %rdx
	sarl	$6, %edx
	sarl	$31, %eax
	movl	%edx, %ecx
	subl	%eax, %ecx
	movslq	%ecx, %rax
	imulq	$1717986919, %rax, %rax
	shrq	$32, %rax
	sarl	$2, %eax
	movl	%ecx, %esi
	sarl	$31, %esi
	subl	%esi, %eax
	movl	%eax, %edx
	movl	%edx, %eax
	sall	$2, %eax
	addl	%edx, %eax
	addl	%eax, %eax
	subl	%eax, %ecx
	movl	%ecx, %edx
	movl	%edx, -32(%rbp)
	movl	-32(%rbp), %eax
	movl	%eax, -48(%rbp)
	movl	-56(%rbp), %eax
	movslq	%eax, %rdx
	imulq	$1374389535, %rdx, %rdx
	shrq	$32, %rdx
	sarl	$5, %edx
	sarl	$31, %eax
	movl	%edx, %ecx
	subl	%eax, %ecx
	movslq	%ecx, %rax
	imulq	$1717986919, %rax, %rax
	shrq	$32, %rax
	sarl	$2, %eax
	movl	%ecx, %esi
	sarl	$31, %esi
	subl	%esi, %eax
	movl	%eax, %edx
	movl	%edx, %eax
	sall	$2, %eax
	addl	%edx, %eax
	addl	%eax, %eax
	subl	%eax, %ecx
	movl	%ecx, %edx
	movl	%edx, -28(%rbp)
	movl	-28(%rbp), %eax
	movl	%eax, -44(%rbp)
	movl	-56(%rbp), %eax
	movslq	%eax, %rdx
	imulq	$1717986919, %rdx, %rdx
	shrq	$32, %rdx
	sarl	$2, %edx
	sarl	$31, %eax
	movl	%edx, %ecx
	subl	%eax, %ecx
	movslq	%ecx, %rax
	imulq	$1717986919, %rax, %rax
	shrq	$32, %rax
	sarl	$2, %eax
	movl	%ecx, %esi
	sarl	$31, %esi
	subl	%esi, %eax
	movl	%eax, %edx
	movl	%edx, %eax
	sall	$2, %eax
	addl	%edx, %eax
	addl	%eax, %eax
	subl	%eax, %ecx
	movl	%ecx, %edx
	movl	%edx, -24(%rbp)
	movl	-24(%rbp), %eax
	movl	%eax, -40(%rbp)
	movl	-56(%rbp), %ecx
	movslq	%ecx, %rax
	imulq	$1717986919, %rax, %rax
	shrq	$32, %rax
	sarl	$2, %eax
	movl	%ecx, %esi
	sarl	$31, %esi
	subl	%esi, %eax
	movl	%eax, %edx
	movl	%edx, %eax
	sall	$2, %eax
	addl	%edx, %eax
	addl	%eax, %eax
	subl	%eax, %ecx
	movl	%ecx, %edx
	movl	%edx, -20(%rbp)
	movl	-20(%rbp), %eax
	movl	%eax, -36(%rbp)
	leaq	-48(%rbp), %rax
	leaq	lcmp(%rip), %rdx
	movq	%rdx, %rcx
	movl	$4, %edx
	movl	$4, %esi
	movq	%rax, %rdi
	call	qsort@PLT
	leaq	-32(%rbp), %rax
	leaq	gcmp(%rip), %rdx
	movq	%rdx, %rcx
	movl	$4, %edx
	movl	$4, %esi
	movq	%rax, %rdi
	call	qsort@PLT
	movl	-32(%rbp), %eax
	imull	$1000, %eax, %edx
	movl	-28(%rbp), %eax
	imull	$100, %eax, %eax
	leal	(%rdx,%rax), %ecx
	movl	-24(%rbp), %edx
	movl	%edx, %eax
	sall	$2, %eax
	addl	%edx, %eax
	addl	%eax, %eax
	leal	(%rcx,%rax), %edx
	movl	-20(%rbp), %eax
	addl	%eax, %edx
	movl	-48(%rbp), %eax
	imull	$-1000, %eax, %eax
	addl	%eax, %edx
	movl	-44(%rbp), %eax
	imull	$-100, %eax, %eax
	addl	%eax, %edx
	movl	-40(%rbp), %eax
	imull	$-10, %eax, %eax
	addl	%edx, %eax
	movl	-36(%rbp), %edx
	subl	%edx, %eax
	movl	%eax, -56(%rbp)
	addl	$1, -52(%rbp)
	jmp	.L11
.L14:
	call	__stack_chk_fail@PLT
.L13:
	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:
