Given the following C code and assembly code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
#include <stdio.h>
#define max 100000

int z[100010];

int main(){

    int a,b,c,n,q,i;

    scanf("%d",&n);

    for(i=0;i<n;i++){
        scanf("%d",&a);
        z[a] ++;
    }    
    
    long int ans = 0;

    for(i=1;i<=max;i++){
        ans += i*z[i];
    }

    scanf("%d",&q);

    for(i=0;i<q;i++){
        scanf("%d %d", &b, &c);

        ans += z[b]*c - z[b]*b;
        
        z[c] += z[b];
        z[b] = 0;    
        
        printf("%ld\n",ans);
    }
    

    return 0;

}```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC1:
	.string	"%d"
.LC3:
	.string	"%d %d"
.LC4:
	.string	"%ld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	leaq	.LC1(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movq	%r12, %rdi
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$40, %rsp
	.cfi_def_cfa_offset 96
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	leaq	16(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	16(%rsp), %edx
	testl	%edx, %edx
	jle	.L2
	xorl	%ebx, %ebx
	leaq	4(%rsp), %r13
	leaq	z(%rip), %rbp
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%r13, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	movslq	4(%rsp), %rax
	addl	$1, 0(%rbp,%rax,4)
	cmpl	%ebx, 16(%rsp)
	jg	.L3
.L2:
	leaq	4+z(%rip), %rax
	movdqa	.LC0(%rip), %xmm4
	pxor	%xmm3, %xmm3
	pxor	%xmm5, %xmm5
	movdqa	.LC2(%rip), %xmm6
	leaq	400000(%rax), %rdx
	.p2align 4,,10
	.p2align 3
.L4:
	movdqu	(%rax), %xmm0
	movdqu	(%rax), %xmm1
	movdqa	%xmm4, %xmm2
	addq	$16, %rax
	paddd	%xmm6, %xmm4
	pmuludq	%xmm2, %xmm0
	psrlq	$32, %xmm1
	psrlq	$32, %xmm2
	pmuludq	%xmm2, %xmm1
	pshufd	$8, %xmm0, %xmm0
	pshufd	$8, %xmm1, %xmm1
	punpckldq	%xmm1, %xmm0
	movdqa	%xmm5, %xmm1
	pcmpgtd	%xmm0, %xmm1
	movdqa	%xmm0, %xmm2
	punpckldq	%xmm1, %xmm2
	punpckhdq	%xmm1, %xmm0
	paddq	%xmm2, %xmm3
	paddq	%xmm0, %xmm3
	cmpq	%rax, %rdx
	jne	.L4
	movdqa	%xmm3, %xmm0
	leaq	20(%rsp), %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	psrldq	$8, %xmm0
	paddq	%xmm0, %xmm3
	movq	%xmm3, %rbx
	call	__isoc99_scanf@PLT
	movl	20(%rsp), %eax
	testl	%eax, %eax
	jle	.L5
	xorl	%r12d, %r12d
	leaq	12(%rsp), %r15
	leaq	z(%rip), %rbp
	leaq	8(%rsp), %r14
	leaq	.LC3(%rip), %r13
	.p2align 4,,10
	.p2align 3
.L6:
	movq	%r15, %rdx
	movq	%r14, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	8(%rsp), %rsi
	movslq	12(%rsp), %rax
	addl	$1, %r12d
	movl	0(%rbp,%rsi,4), %edi
	movl	%eax, %edx
	addl	%edi, 0(%rbp,%rax,4)
	xorl	%eax, %eax
	subl	%esi, %edx
	movl	$0, 0(%rbp,%rsi,4)
	leaq	.LC4(%rip), %rsi
	imull	%edi, %edx
	movl	$1, %edi
	movslq	%edx, %rdx
	addq	%rdx, %rbx
	movq	%rbx, %rdx
	call	__printf_chk@PLT
	cmpl	%r12d, 20(%rsp)
	jg	.L6
.L5:
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L13
	addq	$40, %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
.L13:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.globl	z
	.bss
	.align 32
	.type	z, @object
	.size	z, 400040
z:
	.zero	400040
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC0:
	.long	1
	.long	2
	.long	3
	.long	4
	.align 16
.LC2:
	.long	4
	.long	4
	.long	4
	.long	4
	.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.
Optimized Assembly Code:

user
```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC1:
	.string	"%d"
.LC3:
	.string	"%d %d"
.LC4:
	.string	"%ld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	leaq	.LC1(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movq	%r12, %rdi
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$40, %rsp
	.cfi_def_cfa_offset 96
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	leaq	16(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	16(%rsp), %edx
	testl	%edx, %edx
	jle	.L2
	xorl	%ebx, %ebx
	leaq	4(%rsp), %r13
	leaq	z(%rip), %rbp
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%r13, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	movslq	4(%rsp), %rax
	addl	$1, 0(%rbp,%rax,4)
	cmpl	%ebx, 16(%rsp)
	jg	.L3
.L2:
	leaq	4+z(%rip), %rax
	movdqa	.LC0(%rip), %xmm4
	pxor	%xmm3, %xmm3
	pxor	%xmm5, %xmm5
	movdqa	.LC2(%rip), %xmm6
	leaq	400000(%rax), %rdx
	.p2align 4,,10
	.p2align 3
.L4:
	movdqu	(%rax), %xmm0
	movdqu	(%rax), %xmm1
	movdqa	%xmm4, %xmm2
	addq	$16, %rax
	paddd	%xmm6, %xmm4
	pmuludq	%xmm2, %xmm0
	psrlq	$32, %xmm1
	psrlq	$32, %xmm2
	pmuludq	%xmm2, %xmm1
	pshufd	$8, %xmm0, %xmm0
	pshufd	$8, %xmm1, %xmm1
	punpckldq	%xmm1, %xmm0
	movdqa	%xmm5, %xmm1
	pcmpgtd	%xmm0, %xmm1
	movdqa	%xmm0, %xmm2
	punpckldq	%xmm1, %xmm2
	punpckhdq	%xmm1, %xmm0
	paddq	%xmm2, %xmm3
	paddq	%xmm0, %xmm3
	cmpq	%rax, %rdx
	jne	.L4
	movdqa	%xmm3, %xmm0
	leaq	20(%rsp), %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	psrldq	$8, %xmm0
	paddq	%xmm0, %xmm3
	movq	%xmm3, %rbx
	call	__isoc99_scanf@PLT
	movl	20(%rsp), %eax
	testl	%eax, %eax
	jle	.L5
	xorl	%r12d, %r12d
	leaq	12(%rsp), %r15
	leaq	z(%rip), %rbp
	leaq	8(%rsp), %r14
	leaq	.LC3(%rip), %r13
	.p2align 4,,10
	.p2align 3
.L6:
	movq	%r15, %rdx
	movq	%r14, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	8(%rsp), %rsi
	movslq	12(%rsp), %rax
	addl	$1, %r12d
	movl	0(%rbp,%rsi,4), %edi
	movl	%eax, %edx
	addl	%edi, 0(%rbp,%rax,4)
	xorl	%eax, %eax
	subl	%esi, %edx
	movl	$0, 0(%rbp,%rsi,4)
	leaq	.LC4(%rip), %rsi
	imull	%edi, %edx
	movl	$1, %edi
	movslq	%edx, %rdx
	addq	%rdx, %rbx
	movq	%rbx, %rdx
	call	__printf_chk@PLT
	cmpl	%r12d, 20(%rsp)
	jg	.L6
.L5:
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L13
	addq	$40, %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
.L13:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.globl	z
	.bss
	.align 32
	.type	z, @object
	.size	z, 400040
z:
	.zero	400040
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC0:
	.long	1
	.long	2
	.long	3
	.long	4
	.align 16
.LC2:
	.long	4
	.long	4
	.long	4
	.long	4
	.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
```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC1:
	.string	"%d"
.LC3:
	.string	"%d %d"
.LC4:
	.string	"%ld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	leaq	.LC1(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movq	%r12, %rdi
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$40, %rsp
	.cfi_def_cfa_offset 96
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	leaq	16(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	16(%rsp), %edx
	testl	%edx, %edx
	jle	.L2
	xorl	%ebx, %ebx
	leaq	4(%rsp), %r13
	leaq	z(%rip), %rbp
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%r13, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	movslq	4(%rsp), %rax
	addl	$1, 0(%rbp,%rax,4)
	cmpl	%ebx, 16(%rsp)
	jg	.L3
.L2:
	leaq	4+z(%rip), %rax
	movdqa	.LC0(%rip), %xmm4
	pxor	%xmm3, %xmm3
	pxor	%xmm5, %xmm5
	movdqa	.LC2(%rip), %xmm6
	leaq	400000(%rax), %rdx
	.p2align 4,,10
	.p2align 3
.L4:
	movdqu	(%rax), %xmm0
	movdqu	(%rax), %xmm1
	movdqa	%xmm4, %xmm2
	addq	$16, %rax
	paddd	%xmm6, %xmm4
	pmuludq	%xmm2, %xmm0
	psrlq	$32, %xmm1
	psrlq	$32, %xmm2
	pmuludq	%xmm2, %xmm1
	pshufd	$8, %xmm0, %xmm0
	pshufd	$8, %xmm1, %xmm1
	punpckldq	%xmm1, %xmm0
	movdqa	%xmm5, %xmm1
	pcmpgtd	%xmm0, %xmm1
	movdqa	%xmm0, %xmm2
	punpckldq	%xmm1, %xmm2
	punpckhdq	%xmm1, %xmm0
	paddq	%xmm2, %xmm3
	paddq	%xmm0, %xmm3
	cmpq	%rax, %rdx
	jne	.L4
	movdqa	%xmm3, %xmm0
	leaq	20(%rsp), %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	psrldq	$8, %xmm0
	paddq	%xmm0, %xmm3
	movq	%xmm3, %rbx
	call	__isoc99_scanf@PLT
	movl	20(%rsp), %eax
	testl	%eax, %eax
	jle	.L5
	xorl	%r12d, %r12d
	leaq	12(%rsp), %r15
	leaq	z(%rip), %rbp
	leaq	8(%rsp), %r14
	leaq	.LC3(%rip), %r13
	.p2align 4,,10
	.p2align 3
.L6:
	movq	%r15, %rdx
	movq	%r14, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	8(%rsp), %rsi
	movslq	12(%rsp), %rax
	addl	$1, %r12d
	movl	0(%rbp,%rsi,4), %edi
	movl	%eax, %edx
	addl	%edi, 0(%rbp,%rax,4)
	xorl	%eax, %eax
	subl	%esi, %edx
	movl	$0, 0(%rbp,%rsi,4)
	leaq	.LC4(%rip), %rsi
	imull	%edi, %edx
	movl	$1, %edi
	movslq	%edx, %rdx
	addq	%rdx, %rbx
	movq	%rbx, %rdx
	call	__printf_chk@PLT
	cmpl	%r12d, 20(%rsp)
	jg	.L6
.L5:
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L13
	addq	$40, %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
.L13:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.globl	z
	.bss
	.align 32
	.type	z, @object
	.size	z, 400040
z:
	.zero	400040
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC0:
	.long	1
	.long	2
	.long	3
	.long	4
	.align 16
.LC2:
	.long	4
	.long	4
	.long	4
	.long	4
	.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:
```
```c
#include <stdio.h>
#define max 100000

int z[100010];

int main(){

    int a,b,c,n,q,i;

    scanf("%d",&n);

    for(i=0;i<n;i++){
        scanf("%d",&a);
        z[a] ++;
    }    
    
    long int ans = 0;

    for(i=1;i<=max;i++){
        ans += i*z[i];
    }

    scanf("%d",&q);

    for(i=0;i<q;i++){
        scanf("%d %d", &b, &c);

        ans += z[b]*c - z[b]*b;
        
        z[c] += z[b];
        z[b] = 0;    
        
        printf("%ld\n",ans);
    }
    

    return 0;

}```
Given the following C code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
#include <stdio.h>
#define max 100000

int z[100010];

int main(){

    int a,b,c,n,q,i;

    scanf("%d",&n);

    for(i=0;i<n;i++){
        scanf("%d",&a);
        z[a] ++;
    }    
    
    long int ans = 0;

    for(i=1;i<=max;i++){
        ans += i*z[i];
    }

    scanf("%d",&q);

    for(i=0;i<q;i++){
        scanf("%d %d", &b, &c);

        ans += z[b]*c - z[b]*b;
        
        z[c] += z[b];
        z[b] = 0;    
        
        printf("%ld\n",ans);
    }
    

    return 0;

}```

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.
Optimized Assembly Code:

4
1 2 3 3
3
1 2
3 4
2 4
 4
2 1 1 1
3
1 2
2 1
3 5
 4
1 2 3 3
3
1 2
3 4
0 4
 4
0 1 1 1
3
1 2
2 1
3 5
 4
1 3 3 3
3
1 2
3 4
0 4
 4
1 3 4 3
3
1 2
3 4
0 4
 4
0 1 1 1
3
1 4
2 1
5 10
 4
0 2 4 3
3
1 2
3 4
0 4
 4
0 1 1 1
3
1 0
2 1
5 10
 4
0 2 1 1
3
1 0
2 1
5 10

10
12
16
 8
4
4
 10
12
12
 6
3
3
 11
14
14
 12
14
14
 12
12
12
 9
10
14
 0
0
0
 2
1
1

Given the following C code and assembly code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
#include <stdio.h>
#define max 100000

int z[100010];

int main(){

    int a,b,c,n,q,i;

    scanf("%d",&n);

    for(i=0;i<n;i++){
        scanf("%d",&a);
        z[a] ++;
    }    
    
    long int ans = 0;

    for(i=1;i<=max;i++){
        ans += i*z[i];
    }

    scanf("%d",&q);

    for(i=0;i<q;i++){
        scanf("%d %d", &b, &c);

        ans += z[b]*c - z[b]*b;
        
        z[c] += z[b];
        z[b] = 0;    
        
        printf("%ld\n",ans);
    }
    

    return 0;

}```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC1:
	.string	"%d"
.LC3:
	.string	"%d %d"
.LC4:
	.string	"%ld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	leaq	.LC1(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movq	%r12, %rdi
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$40, %rsp
	.cfi_def_cfa_offset 96
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	leaq	16(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	16(%rsp), %edx
	testl	%edx, %edx
	jle	.L2
	xorl	%ebx, %ebx
	leaq	4(%rsp), %r13
	leaq	z(%rip), %rbp
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%r13, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	movslq	4(%rsp), %rax
	addl	$1, 0(%rbp,%rax,4)
	cmpl	%ebx, 16(%rsp)
	jg	.L3
.L2:
	leaq	4+z(%rip), %rax
	movdqa	.LC0(%rip), %xmm4
	pxor	%xmm3, %xmm3
	pxor	%xmm5, %xmm5
	movdqa	.LC2(%rip), %xmm6
	leaq	400000(%rax), %rdx
	.p2align 4,,10
	.p2align 3
.L4:
	movdqu	(%rax), %xmm0
	movdqu	(%rax), %xmm1
	movdqa	%xmm4, %xmm2
	addq	$16, %rax
	paddd	%xmm6, %xmm4
	pmuludq	%xmm2, %xmm0
	psrlq	$32, %xmm1
	psrlq	$32, %xmm2
	pmuludq	%xmm2, %xmm1
	pshufd	$8, %xmm0, %xmm0
	pshufd	$8, %xmm1, %xmm1
	punpckldq	%xmm1, %xmm0
	movdqa	%xmm5, %xmm1
	pcmpgtd	%xmm0, %xmm1
	movdqa	%xmm0, %xmm2
	punpckldq	%xmm1, %xmm2
	punpckhdq	%xmm1, %xmm0
	paddq	%xmm2, %xmm3
	paddq	%xmm0, %xmm3
	cmpq	%rax, %rdx
	jne	.L4
	movdqa	%xmm3, %xmm0
	leaq	20(%rsp), %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	psrldq	$8, %xmm0
	paddq	%xmm0, %xmm3
	movq	%xmm3, %rbx
	call	__isoc99_scanf@PLT
	movl	20(%rsp), %eax
	testl	%eax, %eax
	jle	.L5
	xorl	%r12d, %r12d
	leaq	12(%rsp), %r15
	leaq	z(%rip), %rbp
	leaq	8(%rsp), %r14
	leaq	.LC3(%rip), %r13
	.p2align 4,,10
	.p2align 3
.L6:
	movq	%r15, %rdx
	movq	%r14, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	8(%rsp), %rsi
	movslq	12(%rsp), %rax
	addl	$1, %r12d
	movl	0(%rbp,%rsi,4), %edi
	movl	%eax, %edx
	addl	%edi, 0(%rbp,%rax,4)
	xorl	%eax, %eax
	subl	%esi, %edx
	movl	$0, 0(%rbp,%rsi,4)
	leaq	.LC4(%rip), %rsi
	imull	%edi, %edx
	movl	$1, %edi
	movslq	%edx, %rdx
	addq	%rdx, %rbx
	movq	%rbx, %rdx
	call	__printf_chk@PLT
	cmpl	%r12d, 20(%rsp)
	jg	.L6
.L5:
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L13
	addq	$40, %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
.L13:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.globl	z
	.bss
	.align 32
	.type	z, @object
	.size	z, 400040
z:
	.zero	400040
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC0:
	.long	1
	.long	2
	.long	3
	.long	4
	.align 16
.LC2:
	.long	4
	.long	4
	.long	4
	.long	4
	.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.
Optimized Assembly Code:

train
```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC1:
	.string	"%d"
.LC3:
	.string	"%d %d"
.LC4:
	.string	"%ld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	leaq	.LC1(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movq	%r12, %rdi
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$40, %rsp
	.cfi_def_cfa_offset 96
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	leaq	16(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	16(%rsp), %edx
	testl	%edx, %edx
	jle	.L2
	xorl	%ebx, %ebx
	leaq	4(%rsp), %r13
	leaq	z(%rip), %rbp
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%r13, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	movslq	4(%rsp), %rax
	addl	$1, 0(%rbp,%rax,4)
	cmpl	%ebx, 16(%rsp)
	jg	.L3
.L2:
	leaq	4+z(%rip), %rax
	movdqa	.LC0(%rip), %xmm4
	pxor	%xmm3, %xmm3
	pxor	%xmm5, %xmm5
	movdqa	.LC2(%rip), %xmm6
	leaq	400000(%rax), %rdx
	.p2align 4,,10
	.p2align 3
.L4:
	movdqu	(%rax), %xmm0
	movdqu	(%rax), %xmm1
	movdqa	%xmm4, %xmm2
	addq	$16, %rax
	paddd	%xmm6, %xmm4
	pmuludq	%xmm2, %xmm0
	psrlq	$32, %xmm1
	psrlq	$32, %xmm2
	pmuludq	%xmm2, %xmm1
	pshufd	$8, %xmm0, %xmm0
	pshufd	$8, %xmm1, %xmm1
	punpckldq	%xmm1, %xmm0
	movdqa	%xmm5, %xmm1
	pcmpgtd	%xmm0, %xmm1
	movdqa	%xmm0, %xmm2
	punpckldq	%xmm1, %xmm2
	punpckhdq	%xmm1, %xmm0
	paddq	%xmm2, %xmm3
	paddq	%xmm0, %xmm3
	cmpq	%rax, %rdx
	jne	.L4
	movdqa	%xmm3, %xmm0
	leaq	20(%rsp), %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	psrldq	$8, %xmm0
	paddq	%xmm0, %xmm3
	movq	%xmm3, %rbx
	call	__isoc99_scanf@PLT
	movl	20(%rsp), %eax
	testl	%eax, %eax
	jle	.L5
	xorl	%r12d, %r12d
	leaq	12(%rsp), %r15
	leaq	z(%rip), %rbp
	leaq	8(%rsp), %r14
	leaq	.LC3(%rip), %r13
	.p2align 4,,10
	.p2align 3
.L6:
	movq	%r15, %rdx
	movq	%r14, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	8(%rsp), %rsi
	movslq	12(%rsp), %rax
	addl	$1, %r12d
	movl	0(%rbp,%rsi,4), %edi
	movl	%eax, %edx
	addl	%edi, 0(%rbp,%rax,4)
	xorl	%eax, %eax
	subl	%esi, %edx
	movl	$0, 0(%rbp,%rsi,4)
	leaq	.LC4(%rip), %rsi
	imull	%edi, %edx
	movl	$1, %edi
	movslq	%edx, %rdx
	addq	%rdx, %rbx
	movq	%rbx, %rdx
	call	__printf_chk@PLT
	cmpl	%r12d, 20(%rsp)
	jg	.L6
.L5:
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L13
	addq	$40, %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
.L13:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.globl	z
	.bss
	.align 32
	.type	z, @object
	.size	z, 400040
z:
	.zero	400040
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC0:
	.long	1
	.long	2
	.long	3
	.long	4
	.align 16
.LC2:
	.long	4
	.long	4
	.long	4
	.long	4
	.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:
```