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(){
  int n, tmp=0, cnt[10000+1]={0};
  scanf("%d", &n);
  for(int x=1; x<=100; x++){
    for(int y=1; y<=100; y++){
      for(int z=1; z<=100; z++){
        tmp = x*x + y*y + z*z + x*y + y*z + z*x;
        if( tmp <= 10000 ){ cnt[tmp]++; }
      }
    }
  }
  for(int i=1; i<=n; i++){ printf("%d\n",cnt[i]); }
  return 0;
}
```

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
	leaq	-36864(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$3184, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, -40020(%rbp)
	leaq	-40016(%rbp), %rax
	movl	$40004, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	leaq	-40040(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$1, -40036(%rbp)
	jmp	.L2
.L8:
	movl	$1, -40032(%rbp)
	jmp	.L3
.L7:
	movl	$1, -40028(%rbp)
	jmp	.L4
.L6:
	movl	-40036(%rbp), %eax
	imull	%eax, %eax
	movl	%eax, %edx
	movl	-40032(%rbp), %eax
	imull	%eax, %eax
	addl	%eax, %edx
	movl	-40028(%rbp), %eax
	imull	%eax, %eax
	addl	%eax, %edx
	movl	-40036(%rbp), %eax
	imull	-40032(%rbp), %eax
	addl	%eax, %edx
	movl	-40032(%rbp), %eax
	imull	-40028(%rbp), %eax
	addl	%eax, %edx
	movl	-40028(%rbp), %eax
	imull	-40036(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -40020(%rbp)
	cmpl	$10000, -40020(%rbp)
	jg	.L5
	movl	-40020(%rbp), %eax
	cltq
	movl	-40016(%rbp,%rax,4), %eax
	leal	1(%rax), %edx
	movl	-40020(%rbp), %eax
	cltq
	movl	%edx, -40016(%rbp,%rax,4)
.L5:
	addl	$1, -40028(%rbp)
.L4:
	cmpl	$100, -40028(%rbp)
	jle	.L6
	addl	$1, -40032(%rbp)
.L3:
	cmpl	$100, -40032(%rbp)
	jle	.L7
	addl	$1, -40036(%rbp)
.L2:
	cmpl	$100, -40036(%rbp)
	jle	.L8
	movl	$1, -40024(%rbp)
	jmp	.L9
.L10:
	movl	-40024(%rbp), %eax
	cltq
	movl	-40016(%rbp,%rax,4), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -40024(%rbp)
.L9:
	movl	-40040(%rbp), %eax
	cmpl	%eax, -40024(%rbp)
	jle	.L10
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L12
	call	__stack_chk_fail@PLT
.L12:
	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\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	leaq	-36864(%rsp), %r11
	.cfi_def_cfa 11, 36896
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$3168, %rsp
	.cfi_def_cfa_offset 40064
	movl	$40004, %edx
	xorl	%esi, %esi
	movq	%fs:40, %rax
	movq	%rax, 40024(%rsp)
	xorl	%eax, %eax
	leaq	16(%rsp), %rbx
	movq	%rbx, %rdi
	call	memset@PLT
	leaq	12(%rsp), %rsi
	leaq	.LC0(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	$1, %r9d
.L2:
	movl	%r9d, %r11d
	movl	%r9d, %r10d
	movl	$1, %edi
	imull	%r9d, %r11d
.L8:
	movl	%edi, %r8d
	movl	%r9d, %esi
	movl	%edi, %ecx
	movl	$1, %edx
	imull	%edi, %r8d
	addl	%r11d, %r8d
	.p2align 4,,10
	.p2align 3
.L4:
	movl	%edx, %eax
	imull	%edx, %eax
	addl	%r8d, %eax
	addl	%r10d, %eax
	addl	%ecx, %eax
	addl	%esi, %eax
	cmpl	$10000, %eax
	jg	.L3
	cltq
	addl	$1, 16(%rsp,%rax,4)
.L3:
	addl	$1, %edx
	addl	%edi, %ecx
	addl	%r9d, %esi
	cmpl	$101, %edx
	jne	.L4
	addl	$1, %edi
	addl	%r9d, %r10d
	cmpl	$101, %edi
	jne	.L8
	addl	$1, %r9d
	cmpl	$101, %r9d
	jne	.L2
	movl	12(%rsp), %eax
	movl	$1, %ebp
	leaq	.LC1(%rip), %r12
	testl	%eax, %eax
	jle	.L7
.L6:
	movl	(%rbx,%rbp,4), %edx
	movq	%r12, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	addq	$1, %rbp
	call	__printf_chk@PLT
	cmpl	%ebp, 12(%rsp)
	jge	.L6
.L7:
	movq	40024(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L17
	addq	$40032, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 32
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
.L17:
	.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\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	leaq	-36864(%rsp), %r11
	.cfi_def_cfa 11, 36896
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$3168, %rsp
	.cfi_def_cfa_offset 40064
	movl	$40004, %edx
	xorl	%esi, %esi
	movq	%fs:40, %rax
	movq	%rax, 40024(%rsp)
	xorl	%eax, %eax
	leaq	16(%rsp), %rbx
	movq	%rbx, %rdi
	call	memset@PLT
	leaq	12(%rsp), %rsi
	leaq	.LC0(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	$1, %r9d
.L2:
	movl	%r9d, %r11d
	movl	%r9d, %r10d
	movl	$1, %edi
	imull	%r9d, %r11d
.L8:
	movl	%edi, %r8d
	movl	%r9d, %esi
	movl	%edi, %ecx
	movl	$1, %edx
	imull	%edi, %r8d
	addl	%r11d, %r8d
	.p2align 4,,10
	.p2align 3
.L4:
	movl	%edx, %eax
	imull	%edx, %eax
	addl	%r8d, %eax
	addl	%r10d, %eax
	addl	%ecx, %eax
	addl	%esi, %eax
	cmpl	$10000, %eax
	jg	.L3
	cltq
	addl	$1, 16(%rsp,%rax,4)
.L3:
	addl	$1, %edx
	addl	%edi, %ecx
	addl	%r9d, %esi
	cmpl	$101, %edx
	jne	.L4
	addl	$1, %edi
	addl	%r9d, %r10d
	cmpl	$101, %edi
	jne	.L8
	addl	$1, %r9d
	cmpl	$101, %r9d
	jne	.L2
	movl	12(%rsp), %eax
	movl	$1, %ebp
	leaq	.LC1(%rip), %r12
	testl	%eax, %eax
	jle	.L7
.L6:
	movl	(%rbx,%rbp,4), %edx
	movq	%r12, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	addq	$1, %rbp
	call	__printf_chk@PLT
	cmpl	%ebp, 12(%rsp)
	jge	.L6
.L7:
	movq	40024(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L17
	addq	$40032, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 32
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
.L17:
	.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(){
  int n, tmp=0, cnt[10000+1]={0};
  scanf("%d", &n);
  for(int x=1; x<=100; x++){
    for(int y=1; y<=100; y++){
      for(int z=1; z<=100; z++){
        tmp = x*x + y*y + z*z + x*y + y*z + z*x;
        if( tmp <= 10000 ){ cnt[tmp]++; }
      }
    }
  }
  for(int i=1; i<=n; i++){ printf("%d\n",cnt[i]); }
  return 0;
}

27
 13
 3
 2
 4
 8
 14
 1
 31
 53

0
0
0
0
0
1
0
0
0
0
3
0
0
0
0
0
3
3
0
0
0
0
0
1
6
0
3
 0
0
0
0
0
1
0
0
0
0
3
0
0
 0
0
0
 0
0
 0
0
0
0
 0
0
0
0
0
1
0
0
 0
0
0
0
0
1
0
0
0
0
3
0
0
0
 0
 0
0
0
0
0
1
0
0
0
0
3
0
0
0
0
0
3
3
0
0
0
0
0
1
6
0
3
0
0
0
0
 0
0
0
0
0
1
0
0
0
0
3
0
0
0
0
0
3
3
0
0
0
0
0
1
6
0
3
0
0
0
0
0
3
3
6
0
0
3
0
0
0
0
3
3
6
0
6
0
0
0
3
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>
int main(){
  int n, tmp=0, cnt[10000+1]={0};
  scanf("%d", &n);
  for(int x=1; x<=100; x++){
    for(int y=1; y<=100; y++){
      for(int z=1; z<=100; z++){
        tmp = x*x + y*y + z*z + x*y + y*z + z*x;
        if( tmp <= 10000 ){ cnt[tmp]++; }
      }
    }
  }
  for(int i=1; i<=n; i++){ printf("%d\n",cnt[i]); }
  return 0;
}
```

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
	leaq	-36864(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$3184, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, -40020(%rbp)
	leaq	-40016(%rbp), %rax
	movl	$40004, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	leaq	-40040(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$1, -40036(%rbp)
	jmp	.L2
.L8:
	movl	$1, -40032(%rbp)
	jmp	.L3
.L7:
	movl	$1, -40028(%rbp)
	jmp	.L4
.L6:
	movl	-40036(%rbp), %eax
	imull	%eax, %eax
	movl	%eax, %edx
	movl	-40032(%rbp), %eax
	imull	%eax, %eax
	addl	%eax, %edx
	movl	-40028(%rbp), %eax
	imull	%eax, %eax
	addl	%eax, %edx
	movl	-40036(%rbp), %eax
	imull	-40032(%rbp), %eax
	addl	%eax, %edx
	movl	-40032(%rbp), %eax
	imull	-40028(%rbp), %eax
	addl	%eax, %edx
	movl	-40028(%rbp), %eax
	imull	-40036(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -40020(%rbp)
	cmpl	$10000, -40020(%rbp)
	jg	.L5
	movl	-40020(%rbp), %eax
	cltq
	movl	-40016(%rbp,%rax,4), %eax
	leal	1(%rax), %edx
	movl	-40020(%rbp), %eax
	cltq
	movl	%edx, -40016(%rbp,%rax,4)
.L5:
	addl	$1, -40028(%rbp)
.L4:
	cmpl	$100, -40028(%rbp)
	jle	.L6
	addl	$1, -40032(%rbp)
.L3:
	cmpl	$100, -40032(%rbp)
	jle	.L7
	addl	$1, -40036(%rbp)
.L2:
	cmpl	$100, -40036(%rbp)
	jle	.L8
	movl	$1, -40024(%rbp)
	jmp	.L9
.L10:
	movl	-40024(%rbp), %eax
	cltq
	movl	-40016(%rbp,%rax,4), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -40024(%rbp)
.L9:
	movl	-40040(%rbp), %eax
	cmpl	%eax, -40024(%rbp)
	jle	.L10
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L12
	call	__stack_chk_fail@PLT
.L12:
	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"
	.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
	leaq	-36864(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$3184, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, -40020(%rbp)
	leaq	-40016(%rbp), %rax
	movl	$40004, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	leaq	-40040(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$1, -40036(%rbp)
	jmp	.L2
.L8:
	movl	$1, -40032(%rbp)
	jmp	.L3
.L7:
	movl	$1, -40028(%rbp)
	jmp	.L4
.L6:
	movl	-40036(%rbp), %eax
	imull	%eax, %eax
	movl	%eax, %edx
	movl	-40032(%rbp), %eax
	imull	%eax, %eax
	addl	%eax, %edx
	movl	-40028(%rbp), %eax
	imull	%eax, %eax
	addl	%eax, %edx
	movl	-40036(%rbp), %eax
	imull	-40032(%rbp), %eax
	addl	%eax, %edx
	movl	-40032(%rbp), %eax
	imull	-40028(%rbp), %eax
	addl	%eax, %edx
	movl	-40028(%rbp), %eax
	imull	-40036(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -40020(%rbp)
	cmpl	$10000, -40020(%rbp)
	jg	.L5
	movl	-40020(%rbp), %eax
	cltq
	movl	-40016(%rbp,%rax,4), %eax
	leal	1(%rax), %edx
	movl	-40020(%rbp), %eax
	cltq
	movl	%edx, -40016(%rbp,%rax,4)
.L5:
	addl	$1, -40028(%rbp)
.L4:
	cmpl	$100, -40028(%rbp)
	jle	.L6
	addl	$1, -40032(%rbp)
.L3:
	cmpl	$100, -40032(%rbp)
	jle	.L7
	addl	$1, -40036(%rbp)
.L2:
	cmpl	$100, -40036(%rbp)
	jle	.L8
	movl	$1, -40024(%rbp)
	jmp	.L9
.L10:
	movl	-40024(%rbp), %eax
	cltq
	movl	-40016(%rbp,%rax,4), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -40024(%rbp)
.L9:
	movl	-40040(%rbp), %eax
	cmpl	%eax, -40024(%rbp)
	jle	.L10
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L12
	call	__stack_chk_fail@PLT
.L12:
	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:
