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>

int main(void)
{
    int n;
    int s[16];
    int tmp[16];
    int bucket[128];
    int cnt;
    int i;

    while (scanf("%d", &n) * n != 0){
        for (i = 0; i < n; i++){
            scanf("%d", &s[i]);
        }

        cnt = 0;
        while (1){
            for (i = 0; i < 128; i++){
                bucket[i] = 0;
            }

            for (i = 0; i < n; i++){
                bucket[s[i]]++;
            }
            for (i = 0; i < n; i++){
                tmp[i] = bucket[s[i]];
            }

            for (i = 0; i < n; i++){
                if (tmp[i] != s[i]){
                    break;
                }
            }
            if (i < n){
                for (i = 0; i < n; i++){
                    s[i] = tmp[i];
                }
                cnt++;
            }
            else {
                break;
            }
        }

        printf("%d\n", cnt);
        printf("%d", s[0]);
        for (i = 1; i < n; i++){
            printf(" %d", s[i]);
        }
        printf("\n");
    }

    return (0);
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d\n"
.LC2:
	.string	" %d"
	.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
	subq	$672, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	jmp	.L2
.L23:
	movl	$0, -660(%rbp)
	jmp	.L3
.L4:
	leaq	-656(%rbp), %rdx
	movl	-660(%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
	addl	$1, -660(%rbp)
.L3:
	movl	-668(%rbp), %eax
	cmpl	%eax, -660(%rbp)
	jl	.L4
	movl	$0, -664(%rbp)
.L20:
	movl	$0, -660(%rbp)
	jmp	.L5
.L6:
	movl	-660(%rbp), %eax
	cltq
	movl	$0, -528(%rbp,%rax,4)
	addl	$1, -660(%rbp)
.L5:
	cmpl	$127, -660(%rbp)
	jle	.L6
	movl	$0, -660(%rbp)
	jmp	.L7
.L8:
	movl	-660(%rbp), %eax
	cltq
	movl	-656(%rbp,%rax,4), %eax
	movslq	%eax, %rdx
	movl	-528(%rbp,%rdx,4), %edx
	addl	$1, %edx
	cltq
	movl	%edx, -528(%rbp,%rax,4)
	addl	$1, -660(%rbp)
.L7:
	movl	-668(%rbp), %eax
	cmpl	%eax, -660(%rbp)
	jl	.L8
	movl	$0, -660(%rbp)
	jmp	.L9
.L10:
	movl	-660(%rbp), %eax
	cltq
	movl	-656(%rbp,%rax,4), %eax
	cltq
	movl	-528(%rbp,%rax,4), %edx
	movl	-660(%rbp), %eax
	cltq
	movl	%edx, -592(%rbp,%rax,4)
	addl	$1, -660(%rbp)
.L9:
	movl	-668(%rbp), %eax
	cmpl	%eax, -660(%rbp)
	jl	.L10
	movl	$0, -660(%rbp)
	jmp	.L11
.L14:
	movl	-660(%rbp), %eax
	cltq
	movl	-592(%rbp,%rax,4), %edx
	movl	-660(%rbp), %eax
	cltq
	movl	-656(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	jne	.L26
	addl	$1, -660(%rbp)
.L11:
	movl	-668(%rbp), %eax
	cmpl	%eax, -660(%rbp)
	jl	.L14
	jmp	.L13
.L26:
	nop
.L13:
	movl	-668(%rbp), %eax
	cmpl	%eax, -660(%rbp)
	jge	.L27
	movl	$0, -660(%rbp)
	jmp	.L16
.L17:
	movl	-660(%rbp), %eax
	cltq
	movl	-592(%rbp,%rax,4), %edx
	movl	-660(%rbp), %eax
	cltq
	movl	%edx, -656(%rbp,%rax,4)
	addl	$1, -660(%rbp)
.L16:
	movl	-668(%rbp), %eax
	cmpl	%eax, -660(%rbp)
	jl	.L17
	addl	$1, -664(%rbp)
	jmp	.L20
.L27:
	nop
	movl	-664(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	-656(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$1, -660(%rbp)
	jmp	.L21
.L22:
	movl	-660(%rbp), %eax
	cltq
	movl	-656(%rbp,%rax,4), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -660(%rbp)
.L21:
	movl	-668(%rbp), %eax
	cmpl	%eax, -660(%rbp)
	jl	.L22
	movl	$10, %edi
	call	putchar@PLT
.L2:
	leaq	-668(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-668(%rbp), %edx
	imull	%edx, %eax
	testl	%eax, %eax
	jne	.L23
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L25
	call	__stack_chk_fail@PLT
.L25:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.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
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.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
	leaq	.LC1(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	leaq	.LC0(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$696, %rsp
	.cfi_def_cfa_offset 752
	movq	%fs:40, %rax
	movq	%rax, 680(%rsp)
	xorl	%eax, %eax
	leaq	28(%rsp), %rax
	leaq	32(%rsp), %rbx
	movq	%rax, 8(%rsp)
	leaq	160(%rsp), %rax
	movq	%rax, (%rsp)
.L2:
	movq	8(%rsp), %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	28(%rsp), %r15d
	imull	%r15d, %eax
	testl	%eax, %eax
	je	.L10
	movq	%rbx, %r14
	xorl	%r12d, %r12d
	testl	%r15d, %r15d
	jle	.L12
.L3:
	movq	%r14, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	addl	$1, %r12d
	call	__isoc99_scanf@PLT
	movl	28(%rsp), %r15d
	addq	$4, %r14
	cmpl	%r12d, %r15d
	jg	.L3
.L12:
	leal	-1(%r15), %eax
	xorl	%r12d, %r12d
	leaq	4(,%rax,4), %r14
.L14:
	movq	(%rsp), %rdi
	movl	$64, %ecx
	xorl	%eax, %eax
	rep stosq
	testl	%r15d, %r15d
	jle	.L4
	movslq	32(%rsp), %rcx
	movl	$1, 160(%rsp,%rcx,4)
	movq	%rcx, %rdx
	cmpl	$1, %r15d
	je	.L5
	movslq	36(%rsp), %rsi
	addl	$1, 160(%rsp,%rsi,4)
	movq	%rsi, %rax
	cmpl	$2, %r15d
	je	.L6
	movslq	40(%rsp), %rsi
	addl	$1, 160(%rsp,%rsi,4)
	cmpl	$3, %r15d
	je	.L6
	movslq	44(%rsp), %rsi
	addl	$1, 160(%rsp,%rsi,4)
	cmpl	$4, %r15d
	je	.L6
	movslq	48(%rsp), %rsi
	addl	$1, 160(%rsp,%rsi,4)
	cmpl	$5, %r15d
	je	.L6
	movslq	52(%rsp), %rsi
	addl	$1, 160(%rsp,%rsi,4)
	cmpl	$6, %r15d
	je	.L6
	movslq	56(%rsp), %rsi
	addl	$1, 160(%rsp,%rsi,4)
	cmpl	$7, %r15d
	je	.L6
	movslq	60(%rsp), %rsi
	addl	$1, 160(%rsp,%rsi,4)
	cmpl	$8, %r15d
	je	.L6
	movslq	64(%rsp), %rsi
	addl	$1, 160(%rsp,%rsi,4)
	cmpl	$9, %r15d
	je	.L6
	movslq	68(%rsp), %rsi
	addl	$1, 160(%rsp,%rsi,4)
	cmpl	$10, %r15d
	je	.L6
	movslq	72(%rsp), %rsi
	addl	$1, 160(%rsp,%rsi,4)
	cmpl	$11, %r15d
	je	.L6
	movslq	76(%rsp), %rsi
	addl	$1, 160(%rsp,%rsi,4)
	cmpl	$12, %r15d
	je	.L6
	movslq	80(%rsp), %rsi
	addl	$1, 160(%rsp,%rsi,4)
	cmpl	$13, %r15d
	je	.L6
	movslq	84(%rsp), %rsi
	addl	$1, 160(%rsp,%rsi,4)
	cmpl	$14, %r15d
	je	.L6
	movslq	88(%rsp), %rsi
	addl	$1, 160(%rsp,%rsi,4)
	cmpl	$15, %r15d
	je	.L6
	movslq	92(%rsp), %rsi
	addl	$1, 160(%rsp,%rsi,4)
.L6:
	movslq	%eax, %rsi
	movl	160(%rsp,%rcx,4), %ecx
	movl	160(%rsp,%rsi,4), %esi
	movl	%ecx, 96(%rsp)
	movl	%esi, 100(%rsp)
	cmpl	$2, %r15d
	je	.L7
	movslq	40(%rsp), %rsi
	movl	160(%rsp,%rsi,4), %esi
	movl	%esi, 104(%rsp)
	cmpl	$3, %r15d
	je	.L7
	movslq	44(%rsp), %rsi
	movl	160(%rsp,%rsi,4), %esi
	movl	%esi, 108(%rsp)
	cmpl	$4, %r15d
	je	.L7
	movslq	48(%rsp), %rsi
	movl	160(%rsp,%rsi,4), %esi
	movl	%esi, 112(%rsp)
	cmpl	$5, %r15d
	je	.L7
	movslq	52(%rsp), %rsi
	movl	160(%rsp,%rsi,4), %esi
	movl	%esi, 116(%rsp)
	cmpl	$6, %r15d
	je	.L7
	movslq	56(%rsp), %rsi
	movl	160(%rsp,%rsi,4), %esi
	movl	%esi, 120(%rsp)
	cmpl	$7, %r15d
	je	.L7
	movslq	60(%rsp), %rsi
	movl	160(%rsp,%rsi,4), %esi
	movl	%esi, 124(%rsp)
	cmpl	$8, %r15d
	je	.L7
	movslq	64(%rsp), %rsi
	movl	160(%rsp,%rsi,4), %esi
	movl	%esi, 128(%rsp)
	cmpl	$9, %r15d
	je	.L7
	movslq	68(%rsp), %rsi
	movl	160(%rsp,%rsi,4), %esi
	movl	%esi, 132(%rsp)
	cmpl	$10, %r15d
	je	.L7
	movslq	72(%rsp), %rsi
	movl	160(%rsp,%rsi,4), %esi
	movl	%esi, 136(%rsp)
	cmpl	$11, %r15d
	je	.L7
	movslq	76(%rsp), %rsi
	movl	160(%rsp,%rsi,4), %esi
	movl	%esi, 140(%rsp)
	cmpl	$12, %r15d
	je	.L7
	movslq	80(%rsp), %rsi
	movl	160(%rsp,%rsi,4), %esi
	movl	%esi, 144(%rsp)
	cmpl	$13, %r15d
	je	.L7
	movslq	84(%rsp), %rsi
	movl	160(%rsp,%rsi,4), %esi
	movl	%esi, 148(%rsp)
	cmpl	$14, %r15d
	je	.L7
	movslq	88(%rsp), %rsi
	movl	160(%rsp,%rsi,4), %esi
	movl	%esi, 152(%rsp)
	cmpl	$15, %r15d
	je	.L7
	movslq	92(%rsp), %rsi
	movl	160(%rsp,%rsi,4), %esi
	movl	%esi, 156(%rsp)
.L7:
	cmpl	%ecx, %edx
	jne	.L8
	cmpl	100(%rsp), %eax
	jne	.L8
	cmpl	$2, %r15d
	je	.L4
	movl	40(%rsp), %eax
	cmpl	%eax, 104(%rsp)
	jne	.L8
	cmpl	$3, %r15d
	je	.L4
	movl	108(%rsp), %eax
	cmpl	%eax, 44(%rsp)
	jne	.L8
	cmpl	$4, %r15d
	je	.L4
	movl	48(%rsp), %eax
	cmpl	%eax, 112(%rsp)
	jne	.L8
	cmpl	$5, %r15d
	je	.L4
	movl	52(%rsp), %eax
	cmpl	%eax, 116(%rsp)
	jne	.L8
	cmpl	$6, %r15d
	je	.L4
	movl	56(%rsp), %eax
	cmpl	%eax, 120(%rsp)
	jne	.L8
	cmpl	$7, %r15d
	je	.L4
	movl	60(%rsp), %eax
	cmpl	%eax, 124(%rsp)
	jne	.L8
	cmpl	$8, %r15d
	je	.L4
	movl	64(%rsp), %eax
	cmpl	%eax, 128(%rsp)
	jne	.L8
	cmpl	$9, %r15d
	je	.L4
	movl	68(%rsp), %eax
	cmpl	%eax, 132(%rsp)
	jne	.L8
	cmpl	$10, %r15d
	je	.L4
	movl	72(%rsp), %eax
	cmpl	%eax, 136(%rsp)
	jne	.L8
	cmpl	$11, %r15d
	je	.L4
	movl	76(%rsp), %eax
	cmpl	%eax, 140(%rsp)
	jne	.L8
	cmpl	$12, %r15d
	je	.L4
	movl	80(%rsp), %eax
	cmpl	%eax, 144(%rsp)
	jne	.L8
	cmpl	$13, %r15d
	je	.L4
	movl	84(%rsp), %eax
	cmpl	%eax, 148(%rsp)
	jne	.L8
	cmpl	$14, %r15d
	je	.L4
	movl	88(%rsp), %eax
	cmpl	%eax, 152(%rsp)
	jne	.L8
	cmpl	$15, %r15d
	je	.L4
	movl	92(%rsp), %eax
	cmpl	%eax, 156(%rsp)
	jne	.L8
.L4:
	movl	%r12d, %edx
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movl	32(%rsp), %edx
	xorl	%eax, %eax
	movq	%rbp, %rsi
	movl	$1, %edi
	movl	$1, %r12d
	call	__printf_chk@PLT
	cmpl	$1, 28(%rsp)
	jle	.L13
.L9:
	movl	(%rbx,%r12,4), %edx
	movq	%r13, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	addq	$1, %r12
	call	__printf_chk@PLT
	cmpl	%r12d, 28(%rsp)
	jg	.L9
.L13:
	movl	$10, %edi
	call	putchar@PLT
	jmp	.L2
.L5:
	movl	$1, 96(%rsp)
	cmpl	%ecx, %r15d
	je	.L4
.L8:
	leaq	96(%rsp), %rsi
	movq	%r14, %rdx
	movq	%rbx, %rdi
	addl	$1, %r12d
	call	memcpy@PLT
	jmp	.L14
.L10:
	movq	680(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L150
	addq	$696, %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
.L150:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.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
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.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
	leaq	.LC1(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	leaq	.LC0(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$696, %rsp
	.cfi_def_cfa_offset 752
	movq	%fs:40, %rax
	movq	%rax, 680(%rsp)
	xorl	%eax, %eax
	leaq	28(%rsp), %rax
	leaq	32(%rsp), %rbx
	movq	%rax, 8(%rsp)
	leaq	160(%rsp), %rax
	movq	%rax, (%rsp)
.L2:
	movq	8(%rsp), %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	28(%rsp), %r15d
	imull	%r15d, %eax
	testl	%eax, %eax
	je	.L10
	movq	%rbx, %r14
	xorl	%r12d, %r12d
	testl	%r15d, %r15d
	jle	.L12
.L3:
	movq	%r14, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	addl	$1, %r12d
	call	__isoc99_scanf@PLT
	movl	28(%rsp), %r15d
	addq	$4, %r14
	cmpl	%r12d, %r15d
	jg	.L3
.L12:
	leal	-1(%r15), %eax
	xorl	%r12d, %r12d
	leaq	4(,%rax,4), %r14
.L14:
	movq	(%rsp), %rdi
	movl	$64, %ecx
	xorl	%eax, %eax
	rep stosq
	testl	%r15d, %r15d
	jle	.L4
	movslq	32(%rsp), %rcx
	movl	$1, 160(%rsp,%rcx,4)
	movq	%rcx, %rdx
	cmpl	$1, %r15d
	je	.L5
	movslq	36(%rsp), %rsi
	addl	$1, 160(%rsp,%rsi,4)
	movq	%rsi, %rax
	cmpl	$2, %r15d
	je	.L6
	movslq	40(%rsp), %rsi
	addl	$1, 160(%rsp,%rsi,4)
	cmpl	$3, %r15d
	je	.L6
	movslq	44(%rsp), %rsi
	addl	$1, 160(%rsp,%rsi,4)
	cmpl	$4, %r15d
	je	.L6
	movslq	48(%rsp), %rsi
	addl	$1, 160(%rsp,%rsi,4)
	cmpl	$5, %r15d
	je	.L6
	movslq	52(%rsp), %rsi
	addl	$1, 160(%rsp,%rsi,4)
	cmpl	$6, %r15d
	je	.L6
	movslq	56(%rsp), %rsi
	addl	$1, 160(%rsp,%rsi,4)
	cmpl	$7, %r15d
	je	.L6
	movslq	60(%rsp), %rsi
	addl	$1, 160(%rsp,%rsi,4)
	cmpl	$8, %r15d
	je	.L6
	movslq	64(%rsp), %rsi
	addl	$1, 160(%rsp,%rsi,4)
	cmpl	$9, %r15d
	je	.L6
	movslq	68(%rsp), %rsi
	addl	$1, 160(%rsp,%rsi,4)
	cmpl	$10, %r15d
	je	.L6
	movslq	72(%rsp), %rsi
	addl	$1, 160(%rsp,%rsi,4)
	cmpl	$11, %r15d
	je	.L6
	movslq	76(%rsp), %rsi
	addl	$1, 160(%rsp,%rsi,4)
	cmpl	$12, %r15d
	je	.L6
	movslq	80(%rsp), %rsi
	addl	$1, 160(%rsp,%rsi,4)
	cmpl	$13, %r15d
	je	.L6
	movslq	84(%rsp), %rsi
	addl	$1, 160(%rsp,%rsi,4)
	cmpl	$14, %r15d
	je	.L6
	movslq	88(%rsp), %rsi
	addl	$1, 160(%rsp,%rsi,4)
	cmpl	$15, %r15d
	je	.L6
	movslq	92(%rsp), %rsi
	addl	$1, 160(%rsp,%rsi,4)
.L6:
	movslq	%eax, %rsi
	movl	160(%rsp,%rcx,4), %ecx
	movl	160(%rsp,%rsi,4), %esi
	movl	%ecx, 96(%rsp)
	movl	%esi, 100(%rsp)
	cmpl	$2, %r15d
	je	.L7
	movslq	40(%rsp), %rsi
	movl	160(%rsp,%rsi,4), %esi
	movl	%esi, 104(%rsp)
	cmpl	$3, %r15d
	je	.L7
	movslq	44(%rsp), %rsi
	movl	160(%rsp,%rsi,4), %esi
	movl	%esi, 108(%rsp)
	cmpl	$4, %r15d
	je	.L7
	movslq	48(%rsp), %rsi
	movl	160(%rsp,%rsi,4), %esi
	movl	%esi, 112(%rsp)
	cmpl	$5, %r15d
	je	.L7
	movslq	52(%rsp), %rsi
	movl	160(%rsp,%rsi,4), %esi
	movl	%esi, 116(%rsp)
	cmpl	$6, %r15d
	je	.L7
	movslq	56(%rsp), %rsi
	movl	160(%rsp,%rsi,4), %esi
	movl	%esi, 120(%rsp)
	cmpl	$7, %r15d
	je	.L7
	movslq	60(%rsp), %rsi
	movl	160(%rsp,%rsi,4), %esi
	movl	%esi, 124(%rsp)
	cmpl	$8, %r15d
	je	.L7
	movslq	64(%rsp), %rsi
	movl	160(%rsp,%rsi,4), %esi
	movl	%esi, 128(%rsp)
	cmpl	$9, %r15d
	je	.L7
	movslq	68(%rsp), %rsi
	movl	160(%rsp,%rsi,4), %esi
	movl	%esi, 132(%rsp)
	cmpl	$10, %r15d
	je	.L7
	movslq	72(%rsp), %rsi
	movl	160(%rsp,%rsi,4), %esi
	movl	%esi, 136(%rsp)
	cmpl	$11, %r15d
	je	.L7
	movslq	76(%rsp), %rsi
	movl	160(%rsp,%rsi,4), %esi
	movl	%esi, 140(%rsp)
	cmpl	$12, %r15d
	je	.L7
	movslq	80(%rsp), %rsi
	movl	160(%rsp,%rsi,4), %esi
	movl	%esi, 144(%rsp)
	cmpl	$13, %r15d
	je	.L7
	movslq	84(%rsp), %rsi
	movl	160(%rsp,%rsi,4), %esi
	movl	%esi, 148(%rsp)
	cmpl	$14, %r15d
	je	.L7
	movslq	88(%rsp), %rsi
	movl	160(%rsp,%rsi,4), %esi
	movl	%esi, 152(%rsp)
	cmpl	$15, %r15d
	je	.L7
	movslq	92(%rsp), %rsi
	movl	160(%rsp,%rsi,4), %esi
	movl	%esi, 156(%rsp)
.L7:
	cmpl	%ecx, %edx
	jne	.L8
	cmpl	100(%rsp), %eax
	jne	.L8
	cmpl	$2, %r15d
	je	.L4
	movl	40(%rsp), %eax
	cmpl	%eax, 104(%rsp)
	jne	.L8
	cmpl	$3, %r15d
	je	.L4
	movl	108(%rsp), %eax
	cmpl	%eax, 44(%rsp)
	jne	.L8
	cmpl	$4, %r15d
	je	.L4
	movl	48(%rsp), %eax
	cmpl	%eax, 112(%rsp)
	jne	.L8
	cmpl	$5, %r15d
	je	.L4
	movl	52(%rsp), %eax
	cmpl	%eax, 116(%rsp)
	jne	.L8
	cmpl	$6, %r15d
	je	.L4
	movl	56(%rsp), %eax
	cmpl	%eax, 120(%rsp)
	jne	.L8
	cmpl	$7, %r15d
	je	.L4
	movl	60(%rsp), %eax
	cmpl	%eax, 124(%rsp)
	jne	.L8
	cmpl	$8, %r15d
	je	.L4
	movl	64(%rsp), %eax
	cmpl	%eax, 128(%rsp)
	jne	.L8
	cmpl	$9, %r15d
	je	.L4
	movl	68(%rsp), %eax
	cmpl	%eax, 132(%rsp)
	jne	.L8
	cmpl	$10, %r15d
	je	.L4
	movl	72(%rsp), %eax
	cmpl	%eax, 136(%rsp)
	jne	.L8
	cmpl	$11, %r15d
	je	.L4
	movl	76(%rsp), %eax
	cmpl	%eax, 140(%rsp)
	jne	.L8
	cmpl	$12, %r15d
	je	.L4
	movl	80(%rsp), %eax
	cmpl	%eax, 144(%rsp)
	jne	.L8
	cmpl	$13, %r15d
	je	.L4
	movl	84(%rsp), %eax
	cmpl	%eax, 148(%rsp)
	jne	.L8
	cmpl	$14, %r15d
	je	.L4
	movl	88(%rsp), %eax
	cmpl	%eax, 152(%rsp)
	jne	.L8
	cmpl	$15, %r15d
	je	.L4
	movl	92(%rsp), %eax
	cmpl	%eax, 156(%rsp)
	jne	.L8
.L4:
	movl	%r12d, %edx
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movl	32(%rsp), %edx
	xorl	%eax, %eax
	movq	%rbp, %rsi
	movl	$1, %edi
	movl	$1, %r12d
	call	__printf_chk@PLT
	cmpl	$1, 28(%rsp)
	jle	.L13
.L9:
	movl	(%rbx,%r12,4), %edx
	movq	%r13, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	addq	$1, %r12
	call	__printf_chk@PLT
	cmpl	%r12d, 28(%rsp)
	jg	.L9
.L13:
	movl	$10, %edi
	call	putchar@PLT
	jmp	.L2
.L5:
	movl	$1, 96(%rsp)
	cmpl	%ecx, %r15d
	je	.L4
.L8:
	leaq	96(%rsp), %rsi
	movq	%r14, %rdx
	movq	%rbx, %rdi
	addl	$1, %r12d
	call	memcpy@PLT
	jmp	.L14
.L10:
	movq	680(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L150
	addq	$696, %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
.L150:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.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>

int main(void)
{
    int n;
    int s[16];
    int tmp[16];
    int bucket[128];
    int cnt;
    int i;

    while (scanf("%d", &n) * n != 0){
        for (i = 0; i < n; i++){
            scanf("%d", &s[i]);
        }

        cnt = 0;
        while (1){
            for (i = 0; i < 128; i++){
                bucket[i] = 0;
            }

            for (i = 0; i < n; i++){
                bucket[s[i]]++;
            }
            for (i = 0; i < n; i++){
                tmp[i] = bucket[s[i]];
            }

            for (i = 0; i < n; i++){
                if (tmp[i] != s[i]){
                    break;
                }
            }
            if (i < n){
                for (i = 0; i < n; i++){
                    s[i] = tmp[i];
                }
                cnt++;
            }
            else {
                break;
            }
        }

        printf("%d\n", cnt);
        printf("%d", s[0]);
        for (i = 1; i < n; i++){
            printf(" %d", s[i]);
        }
        printf("\n");
    }

    return (0);
}
10
4 5 1 1 4 5 12 3 6 4
0
 10
4 5 1 1 4 5 12 3 0 5
0
 10
4 5 1 1 3 5 14 3 0 5
0
 10
4 5 1 1 3 10 14 3 0 5
0
 10
4 5 1 0 3 10 14 3 0 5
0
 10
1 5 1 0 3 10 14 3 0 5
0
 10
1 5 1 0 3 4 27 0 0 5
0
 10
2 5 1 0 3 4 27 0 0 5
0
 10
2 5 1 0 3 4 27 0 -1 5
0

3
6 4 4 4 6 4 6 6 6 6
 3
4 6 4 4 4 6 6 6 6 6
 3
6 6 4 4 4 6 6 4 6 6
 2
4 6 6 6 6 4 4 6 4 6
 2
4 6 4 6 6 4 4 6 6 6
 2
8 8 8 8 8 2 2 8 8 8
 3
4 4 4 6 6 6 6 6 6 4
 2
5 2 5 3 5 5 5 3 3 2
 2
6 4 6 4 6 6 6 4 6 4

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>

int main(void)
{
    int n;
    int s[16];
    int tmp[16];
    int bucket[128];
    int cnt;
    int i;

    while (scanf("%d", &n) * n != 0){
        for (i = 0; i < n; i++){
            scanf("%d", &s[i]);
        }

        cnt = 0;
        while (1){
            for (i = 0; i < 128; i++){
                bucket[i] = 0;
            }

            for (i = 0; i < n; i++){
                bucket[s[i]]++;
            }
            for (i = 0; i < n; i++){
                tmp[i] = bucket[s[i]];
            }

            for (i = 0; i < n; i++){
                if (tmp[i] != s[i]){
                    break;
                }
            }
            if (i < n){
                for (i = 0; i < n; i++){
                    s[i] = tmp[i];
                }
                cnt++;
            }
            else {
                break;
            }
        }

        printf("%d\n", cnt);
        printf("%d", s[0]);
        for (i = 1; i < n; i++){
            printf(" %d", s[i]);
        }
        printf("\n");
    }

    return (0);
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d\n"
.LC2:
	.string	" %d"
	.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
	subq	$672, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	jmp	.L2
.L23:
	movl	$0, -660(%rbp)
	jmp	.L3
.L4:
	leaq	-656(%rbp), %rdx
	movl	-660(%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
	addl	$1, -660(%rbp)
.L3:
	movl	-668(%rbp), %eax
	cmpl	%eax, -660(%rbp)
	jl	.L4
	movl	$0, -664(%rbp)
.L20:
	movl	$0, -660(%rbp)
	jmp	.L5
.L6:
	movl	-660(%rbp), %eax
	cltq
	movl	$0, -528(%rbp,%rax,4)
	addl	$1, -660(%rbp)
.L5:
	cmpl	$127, -660(%rbp)
	jle	.L6
	movl	$0, -660(%rbp)
	jmp	.L7
.L8:
	movl	-660(%rbp), %eax
	cltq
	movl	-656(%rbp,%rax,4), %eax
	movslq	%eax, %rdx
	movl	-528(%rbp,%rdx,4), %edx
	addl	$1, %edx
	cltq
	movl	%edx, -528(%rbp,%rax,4)
	addl	$1, -660(%rbp)
.L7:
	movl	-668(%rbp), %eax
	cmpl	%eax, -660(%rbp)
	jl	.L8
	movl	$0, -660(%rbp)
	jmp	.L9
.L10:
	movl	-660(%rbp), %eax
	cltq
	movl	-656(%rbp,%rax,4), %eax
	cltq
	movl	-528(%rbp,%rax,4), %edx
	movl	-660(%rbp), %eax
	cltq
	movl	%edx, -592(%rbp,%rax,4)
	addl	$1, -660(%rbp)
.L9:
	movl	-668(%rbp), %eax
	cmpl	%eax, -660(%rbp)
	jl	.L10
	movl	$0, -660(%rbp)
	jmp	.L11
.L14:
	movl	-660(%rbp), %eax
	cltq
	movl	-592(%rbp,%rax,4), %edx
	movl	-660(%rbp), %eax
	cltq
	movl	-656(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	jne	.L26
	addl	$1, -660(%rbp)
.L11:
	movl	-668(%rbp), %eax
	cmpl	%eax, -660(%rbp)
	jl	.L14
	jmp	.L13
.L26:
	nop
.L13:
	movl	-668(%rbp), %eax
	cmpl	%eax, -660(%rbp)
	jge	.L27
	movl	$0, -660(%rbp)
	jmp	.L16
.L17:
	movl	-660(%rbp), %eax
	cltq
	movl	-592(%rbp,%rax,4), %edx
	movl	-660(%rbp), %eax
	cltq
	movl	%edx, -656(%rbp,%rax,4)
	addl	$1, -660(%rbp)
.L16:
	movl	-668(%rbp), %eax
	cmpl	%eax, -660(%rbp)
	jl	.L17
	addl	$1, -664(%rbp)
	jmp	.L20
.L27:
	nop
	movl	-664(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	-656(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$1, -660(%rbp)
	jmp	.L21
.L22:
	movl	-660(%rbp), %eax
	cltq
	movl	-656(%rbp,%rax,4), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -660(%rbp)
.L21:
	movl	-668(%rbp), %eax
	cmpl	%eax, -660(%rbp)
	jl	.L22
	movl	$10, %edi
	call	putchar@PLT
.L2:
	leaq	-668(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-668(%rbp), %edx
	imull	%edx, %eax
	testl	%eax, %eax
	jne	.L23
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L25
	call	__stack_chk_fail@PLT
.L25:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.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
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d\n"
.LC2:
	.string	" %d"
	.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
	subq	$672, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	jmp	.L2
.L23:
	movl	$0, -660(%rbp)
	jmp	.L3
.L4:
	leaq	-656(%rbp), %rdx
	movl	-660(%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
	addl	$1, -660(%rbp)
.L3:
	movl	-668(%rbp), %eax
	cmpl	%eax, -660(%rbp)
	jl	.L4
	movl	$0, -664(%rbp)
.L20:
	movl	$0, -660(%rbp)
	jmp	.L5
.L6:
	movl	-660(%rbp), %eax
	cltq
	movl	$0, -528(%rbp,%rax,4)
	addl	$1, -660(%rbp)
.L5:
	cmpl	$127, -660(%rbp)
	jle	.L6
	movl	$0, -660(%rbp)
	jmp	.L7
.L8:
	movl	-660(%rbp), %eax
	cltq
	movl	-656(%rbp,%rax,4), %eax
	movslq	%eax, %rdx
	movl	-528(%rbp,%rdx,4), %edx
	addl	$1, %edx
	cltq
	movl	%edx, -528(%rbp,%rax,4)
	addl	$1, -660(%rbp)
.L7:
	movl	-668(%rbp), %eax
	cmpl	%eax, -660(%rbp)
	jl	.L8
	movl	$0, -660(%rbp)
	jmp	.L9
.L10:
	movl	-660(%rbp), %eax
	cltq
	movl	-656(%rbp,%rax,4), %eax
	cltq
	movl	-528(%rbp,%rax,4), %edx
	movl	-660(%rbp), %eax
	cltq
	movl	%edx, -592(%rbp,%rax,4)
	addl	$1, -660(%rbp)
.L9:
	movl	-668(%rbp), %eax
	cmpl	%eax, -660(%rbp)
	jl	.L10
	movl	$0, -660(%rbp)
	jmp	.L11
.L14:
	movl	-660(%rbp), %eax
	cltq
	movl	-592(%rbp,%rax,4), %edx
	movl	-660(%rbp), %eax
	cltq
	movl	-656(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	jne	.L26
	addl	$1, -660(%rbp)
.L11:
	movl	-668(%rbp), %eax
	cmpl	%eax, -660(%rbp)
	jl	.L14
	jmp	.L13
.L26:
	nop
.L13:
	movl	-668(%rbp), %eax
	cmpl	%eax, -660(%rbp)
	jge	.L27
	movl	$0, -660(%rbp)
	jmp	.L16
.L17:
	movl	-660(%rbp), %eax
	cltq
	movl	-592(%rbp,%rax,4), %edx
	movl	-660(%rbp), %eax
	cltq
	movl	%edx, -656(%rbp,%rax,4)
	addl	$1, -660(%rbp)
.L16:
	movl	-668(%rbp), %eax
	cmpl	%eax, -660(%rbp)
	jl	.L17
	addl	$1, -664(%rbp)
	jmp	.L20
.L27:
	nop
	movl	-664(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	-656(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$1, -660(%rbp)
	jmp	.L21
.L22:
	movl	-660(%rbp), %eax
	cltq
	movl	-656(%rbp,%rax,4), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -660(%rbp)
.L21:
	movl	-668(%rbp), %eax
	cmpl	%eax, -660(%rbp)
	jl	.L22
	movl	$10, %edi
	call	putchar@PLT
.L2:
	leaq	-668(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-668(%rbp), %edx
	imull	%edx, %eax
	testl	%eax, %eax
	jne	.L23
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L25
	call	__stack_chk_fail@PLT
.L25:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.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:
