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

```c
#define N 100001 
long p[N],r[N],n,m,i,b[N],a[N][2],c,d;int f(int x){if(p[x]==x)return x;return f(p[x]);}int u(int x,int y){x=f(x);y=f(y);if(r[x]<r[y])p[x]=y;else p[y]=x;r[y]+=r[x];r[x]=r[y];}int main(){scanf("%ld%ld",&n,&m);for(i=0;i<m;i++)scanf("%d%d",a[i],&a[i][1]);b[m]=n*(n-1)/2;for(i=0;i<N;i++){p[i]=i;r[i]=1;};for(i=m-1;i>0;i--){c=a[i][0],d=a[i][1];if(f(c)==f(d))b[i]=b[i+1];else{b[i]=b[i+1]-r[f(c)]*r[f(d)];u(c,d);}}for(i=1;i<=m;i++)printf("%ld\n",b[i]);}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	p
	.bss
	.align 32
	.type	p, @object
	.size	p, 800008
p:
	.zero	800008
	.globl	r
	.align 32
	.type	r, @object
	.size	r, 800008
r:
	.zero	800008
	.globl	n
	.align 8
	.type	n, @object
	.size	n, 8
n:
	.zero	8
	.globl	m
	.align 8
	.type	m, @object
	.size	m, 8
m:
	.zero	8
	.globl	i
	.align 8
	.type	i, @object
	.size	i, 8
i:
	.zero	8
	.globl	b
	.align 32
	.type	b, @object
	.size	b, 800008
b:
	.zero	800008
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 1600016
a:
	.zero	1600016
	.globl	c
	.align 8
	.type	c, @object
	.size	c, 8
c:
	.zero	8
	.globl	d
	.align 8
	.type	d, @object
	.size	d, 8
d:
	.zero	8
	.text
	.globl	f
	.type	f, @function
f:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movl	%edi, -4(%rbp)
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	p(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movl	-4(%rbp), %eax
	cltq
	cmpq	%rax, %rdx
	jne	.L2
	movl	-4(%rbp), %eax
	jmp	.L3
.L2:
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	p(%rip), %rax
	movq	(%rdx,%rax), %rax
	movl	%eax, %edi
	call	f
.L3:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	f, .-f
	.globl	u
	.type	u, @function
u:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movl	%edi, -4(%rbp)
	movl	%esi, -8(%rbp)
	movl	-4(%rbp), %eax
	movl	%eax, %edi
	call	f
	movl	%eax, -4(%rbp)
	movl	-8(%rbp), %eax
	movl	%eax, %edi
	call	f
	movl	%eax, -8(%rbp)
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	r(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	r(%rip), %rax
	movq	(%rcx,%rax), %rax
	cmpq	%rax, %rdx
	jge	.L5
	movl	-8(%rbp), %eax
	cltq
	movl	-4(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	p(%rip), %rdx
	movq	%rax, (%rcx,%rdx)
	jmp	.L6
.L5:
	movl	-4(%rbp), %eax
	cltq
	movl	-8(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	p(%rip), %rdx
	movq	%rax, (%rcx,%rdx)
.L6:
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	r(%rip), %rax
	movq	(%rdx,%rax), %rcx
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	r(%rip), %rax
	movq	(%rdx,%rax), %rax
	addq	%rax, %rcx
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	r(%rip), %rax
	movq	%rcx, (%rdx,%rax)
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	r(%rip), %rax
	movq	(%rdx,%rax), %rax
	movl	-4(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	r(%rip), %rdx
	movq	%rax, (%rcx,%rdx)
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	u, .-u
	.section	.rodata
.LC0:
	.string	"%ld%ld"
.LC1:
	.string	"%d%d"
.LC2:
	.string	"%ld\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB2:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r12
	pushq	%rbx
	.cfi_offset 12, -24
	.cfi_offset 3, -32
	leaq	m(%rip), %rax
	movq	%rax, %rdx
	leaq	n(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movq	$0, i(%rip)
	jmp	.L8
.L9:
	movq	i(%rip), %rax
	salq	$4, %rax
	leaq	8(%rax), %rdx
	leaq	a(%rip), %rax
	addq	%rax, %rdx
	movq	i(%rip), %rax
	salq	$4, %rax
	movq	%rax, %rcx
	leaq	a(%rip), %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movq	i(%rip), %rax
	addq	$1, %rax
	movq	%rax, i(%rip)
.L8:
	movq	i(%rip), %rdx
	movq	m(%rip), %rax
	cmpq	%rax, %rdx
	jl	.L9
	movq	n(%rip), %rax
	leaq	-1(%rax), %rdx
	movq	n(%rip), %rax
	imulq	%rdx, %rax
	movq	m(%rip), %rdx
	movq	%rax, %rcx
	shrq	$63, %rcx
	addq	%rcx, %rax
	sarq	%rax
	movq	%rax, %rcx
	salq	$3, %rdx
	leaq	b(%rip), %rax
	movq	%rcx, (%rdx,%rax)
	movq	$0, i(%rip)
	jmp	.L10
.L11:
	movq	i(%rip), %rdx
	movq	i(%rip), %rax
	leaq	0(,%rdx,8), %rcx
	leaq	p(%rip), %rdx
	movq	%rax, (%rcx,%rdx)
	movq	i(%rip), %rax
	leaq	0(,%rax,8), %rdx
	leaq	r(%rip), %rax
	movq	$1, (%rdx,%rax)
	movq	i(%rip), %rax
	addq	$1, %rax
	movq	%rax, i(%rip)
.L10:
	movq	i(%rip), %rax
	cmpq	$100000, %rax
	jle	.L11
	movq	m(%rip), %rax
	subq	$1, %rax
	movq	%rax, i(%rip)
	jmp	.L12
.L15:
	movq	i(%rip), %rax
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rax
	movq	%rax, c(%rip)
	movq	i(%rip), %rax
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	8+a(%rip), %rax
	movq	(%rdx,%rax), %rax
	movq	%rax, d(%rip)
	movq	c(%rip), %rax
	movl	%eax, %edi
	call	f
	movl	%eax, %ebx
	movq	d(%rip), %rax
	movl	%eax, %edi
	call	f
	cmpl	%eax, %ebx
	jne	.L13
	movq	i(%rip), %rax
	addq	$1, %rax
	movq	i(%rip), %rdx
	leaq	0(,%rax,8), %rcx
	leaq	b(%rip), %rax
	movq	(%rcx,%rax), %rax
	leaq	0(,%rdx,8), %rcx
	leaq	b(%rip), %rdx
	movq	%rax, (%rcx,%rdx)
	jmp	.L14
.L13:
	movq	i(%rip), %rax
	addq	$1, %rax
	leaq	0(,%rax,8), %rdx
	leaq	b(%rip), %rax
	movq	(%rdx,%rax), %rbx
	movq	c(%rip), %rax
	movl	%eax, %edi
	call	f
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	r(%rip), %rax
	movq	(%rdx,%rax), %r12
	movq	d(%rip), %rax
	movl	%eax, %edi
	call	f
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	r(%rip), %rax
	movq	(%rdx,%rax), %rax
	movq	%r12, %rdx
	imulq	%rax, %rdx
	movq	i(%rip), %rax
	subq	%rdx, %rbx
	movq	%rbx, %rcx
	leaq	0(,%rax,8), %rdx
	leaq	b(%rip), %rax
	movq	%rcx, (%rdx,%rax)
	movq	d(%rip), %rax
	movl	%eax, %edx
	movq	c(%rip), %rax
	movl	%edx, %esi
	movl	%eax, %edi
	call	u
.L14:
	movq	i(%rip), %rax
	subq	$1, %rax
	movq	%rax, i(%rip)
.L12:
	movq	i(%rip), %rax
	testq	%rax, %rax
	jg	.L15
	movq	$1, i(%rip)
	jmp	.L16
.L17:
	movq	i(%rip), %rax
	leaq	0(,%rax,8), %rdx
	leaq	b(%rip), %rax
	movq	(%rdx,%rax), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movq	i(%rip), %rax
	addq	$1, %rax
	movq	%rax, i(%rip)
.L16:
	movq	i(%rip), %rdx
	movq	m(%rip), %rax
	cmpq	%rax, %rdx
	jle	.L17
	movl	$0, %eax
	popq	%rbx
	popq	%r12
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.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
	.globl	f
	.type	f, @function
f:
.LFB0:
	.cfi_startproc
	endbr64
	leaq	p(%rip), %rcx
	movslq	%edi, %rax
	movl	%edi, %r8d
	movq	(%rcx,%rax,8), %rdx
	cmpq	%rax, %rdx
	je	.L1
	.p2align 4,,10
	.p2align 3
.L2:
	movslq	%edx, %rax
	movl	%edx, %r8d
	movq	(%rcx,%rax,8), %rdx
	cmpq	%rax, %rdx
	jne	.L2
.L1:
	movl	%r8d, %eax
	ret
	.cfi_endproc
.LFE0:
	.size	f, .-f
	.p2align 4
	.globl	u
	.type	u, @function
u:
.LFB1:
	.cfi_startproc
	endbr64
	leaq	p(%rip), %r8
	movslq	%edi, %rdi
	movq	(%r8,%rdi,8), %rcx
	cmpq	%rcx, %rdi
	je	.L18
	.p2align 4,,10
	.p2align 3
.L7:
	movslq	%ecx, %rax
	movq	(%r8,%rax,8), %rcx
	movq	%rax, %rdx
	cmpq	%rax, %rcx
	jne	.L7
	movq	%rax, %rdi
.L10:
	movslq	%esi, %rsi
	movq	(%r8,%rsi,8), %rcx
	movq	%rsi, %rax
	cmpq	%rsi, %rcx
	je	.L8
	.p2align 4,,10
	.p2align 3
.L9:
	movslq	%ecx, %rax
	movq	(%r8,%rax,8), %rcx
	cmpq	%rax, %rcx
	jne	.L9
	movq	%rax, %rsi
.L8:
	leaq	r(%rip), %r9
	movq	(%r9,%rdi,8), %rcx
	movq	(%r9,%rsi,8), %r10
	cmpq	%r10, %rcx
	jge	.L19
	movq	%rax, (%r8,%rdi,8)
	leaq	(%rcx,%r10), %rax
	movq	%rax, (%r9,%rsi,8)
	movq	%rax, (%r9,%rdi,8)
	ret
	.p2align 4,,10
	.p2align 3
.L19:
	leaq	(%rcx,%r10), %rax
	movq	%rdx, (%r8,%rsi,8)
	movq	%rax, (%r9,%rsi,8)
	movq	%rax, (%r9,%rdi,8)
	ret
	.p2align 4,,10
	.p2align 3
.L18:
	movq	%rdi, %rdx
	jmp	.L10
	.cfi_endproc
.LFE1:
	.size	u, .-u
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC1:
	.string	"%ld%ld"
.LC2:
	.string	"%d%d"
.LC5:
	.string	"%ld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB2:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	m(%rip), %rdx
	leaq	n(%rip), %rsi
	xorl	%eax, %eax
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	leaq	.LC1(%rip), %rdi
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	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	$24, %rsp
	.cfi_def_cfa_offset 80
	call	scanf@PLT
	movq	m(%rip), %r12
	movq	$0, i(%rip)
	testq	%r12, %r12
	jle	.L21
	xorl	%eax, %eax
	leaq	a(%rip), %rbx
	leaq	.LC2(%rip), %rbp
	.p2align 4,,10
	.p2align 3
.L22:
	salq	$4, %rax
	movq	%rbp, %rdi
	leaq	8(%rbx,%rax), %rdx
	leaq	(%rbx,%rax), %rsi
	xorl	%eax, %eax
	call	scanf@PLT
	movq	i(%rip), %rax
	movq	m(%rip), %r12
	addq	$1, %rax
	movq	%rax, i(%rip)
	cmpq	%r12, %rax
	jl	.L22
.L21:
	movq	n(%rip), %rax
	leaq	b(%rip), %rbx
	movdqa	.LC0(%rip), %xmm0
	leaq	r(%rip), %r13
	movdqa	.LC3(%rip), %xmm3
	movdqa	.LC4(%rip), %xmm2
	leaq	-1(%rax), %rdx
	imulq	%rax, %rdx
	movq	%rdx, %rax
	shrq	$63, %rax
	addq	%rdx, %rax
	leaq	p(%rip), %rdx
	sarq	%rax
	movq	%rax, (%rbx,%r12,8)
	xorl	%eax, %eax
	.p2align 4,,10
	.p2align 3
.L23:
	movdqa	%xmm0, %xmm1
	movaps	%xmm2, 0(%r13,%rax)
	paddq	%xmm3, %xmm0
	movaps	%xmm1, (%rdx,%rax)
	addq	$16, %rax
	cmpq	$800000, %rax
	jne	.L23
	movq	$100000, 800000+p(%rip)
	leaq	-1(%r12), %rax
	movq	$1, 800000+r(%rip)
	testq	%rax, %rax
	jle	.L24
	movq	%r12, %rax
	leaq	a(%rip), %rcx
	movq	%r12, 8(%rsp)
	salq	$4, %rax
	leaq	-16(%rcx,%rax), %rbp
	leaq	b(%rip), %rax
	leaq	(%rax,%r12,8), %rbx
	.p2align 4,,10
	.p2align 3
.L45:
	movq	0(%rbp), %rax
	movq	8(%rbp), %r15
	movslq	%eax, %rsi
	movq	%rax, (%rsp)
	movslq	%eax, %r14
	movq	(%rdx,%rsi,8), %r8
	movq	%r8, %rax
	cmpq	%r8, %rsi
	je	.L70
	.p2align 4,,10
	.p2align 3
.L25:
	movslq	%eax, %rcx
	movl	%eax, %r11d
	movq	(%rdx,%rcx,8), %rax
	cmpq	%rcx, %rax
	jne	.L25
	movslq	%r15d, %rdi
	movslq	%r15d, %r12
	movq	(%rdx,%rdi,8), %r9
	cmpq	%r9, %rdi
	je	.L53
.L74:
	movq	%r9, %rax
	.p2align 4,,10
	.p2align 3
.L27:
	movslq	%eax, %rcx
	movl	%eax, %r10d
	movq	(%rdx,%rcx,8), %rax
	cmpq	%rax, %rcx
	jne	.L27
.L26:
	cmpl	%r11d, %r10d
	jne	.L71
	movq	(%rbx), %rax
	movq	%rax, -8(%rbx)
.L31:
	subq	$8, %rbx
	leaq	8+b(%rip), %rax
	subq	$16, %rbp
	cmpq	%rbx, %rax
	jne	.L45
	movq	(%rsp), %rax
	movq	8(%rsp), %r12
	movq	%r15, d(%rip)
	movq	%rax, c(%rip)
.L24:
	movq	$1, i(%rip)
	movl	$1, %eax
	leaq	.LC5(%rip), %rbx
	testq	%r12, %r12
	jle	.L65
	.p2align 4,,10
	.p2align 3
.L46:
	leaq	b(%rip), %rdi
	movq	(%rdi,%rax,8), %rsi
	xorl	%eax, %eax
	movq	%rbx, %rdi
	call	printf@PLT
	movq	i(%rip), %rax
	addq	$1, %rax
	cmpq	m(%rip), %rax
	movq	%rax, i(%rip)
	jle	.L46
.L65:
	addq	$24, %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
.L71:
	.cfi_restore_state
	movq	(%rbx), %r11
	cmpq	%r8, %rsi
	je	.L32
	movq	%r8, %rax
	.p2align 4,,10
	.p2align 3
.L34:
	movslq	%eax, %rcx
	movq	(%rdx,%rcx,8), %rax
	cmpq	%rcx, %rax
	jne	.L34
	movq	0(%r13,%rax,8), %r10
	cmpq	%r9, %rdi
	je	.L72
.L50:
	movq	%r9, %rax
	.p2align 4,,10
	.p2align 3
.L44:
	movslq	%eax, %rcx
	movq	(%rdx,%rcx,8), %rax
	cmpq	%rcx, %rax
	jne	.L44
	imulq	0(%r13,%rax,8), %r10
	movq	%r11, %rax
	subq	%r10, %rax
	movq	%rax, -8(%rbx)
	cmpq	%r8, %rsi
	je	.L41
	.p2align 4,,10
	.p2align 3
.L38:
	movslq	%r8d, %rsi
	movslq	%r8d, %r14
	movq	(%rdx,%rsi,8), %r8
	cmpq	%rsi, %r8
	jne	.L38
	cmpq	%r9, %rdi
	je	.L35
	.p2align 4,,10
	.p2align 3
.L41:
	movslq	%r9d, %rdi
	movslq	%r9d, %r12
	movq	(%rdx,%rdi,8), %r9
	cmpq	%rdi, %r9
	jne	.L41
.L35:
	movq	0(%r13,%r14,8), %rax
	movq	0(%r13,%r12,8), %rcx
	cmpq	%rcx, %rax
	jge	.L73
	movq	%rdi, (%rdx,%r14,8)
.L42:
	addq	%rcx, %rax
	movq	%rax, 0(%r13,%r12,8)
	movq	%rax, 0(%r13,%r14,8)
	jmp	.L31
	.p2align 4,,10
	.p2align 3
.L73:
	movq	%rsi, (%rdx,%r12,8)
	jmp	.L42
	.p2align 4,,10
	.p2align 3
.L70:
	movslq	%r15d, %rdi
	movl	(%rsp), %r11d
	movslq	%r15d, %r12
	movq	(%rdx,%rdi,8), %r9
	cmpq	%r9, %rdi
	jne	.L74
	.p2align 4,,10
	.p2align 3
.L53:
	movl	%r15d, %r10d
	jmp	.L26
.L32:
	movq	0(%r13,%rsi,8), %r10
	cmpq	%r9, %rdi
	jne	.L50
	imulq	0(%r13,%rdi,8), %r10
	movq	%r11, %rax
	subq	%r10, %rax
	movq	%rax, -8(%rbx)
	jmp	.L35
.L72:
	imulq	0(%r13,%rdi,8), %r10
	movq	%r11, %rax
	subq	%r10, %rax
	movq	%rax, -8(%rbx)
	jmp	.L38
	.cfi_endproc
.LFE2:
	.size	main, .-main
	.globl	d
	.bss
	.align 8
	.type	d, @object
	.size	d, 8
d:
	.zero	8
	.globl	c
	.align 8
	.type	c, @object
	.size	c, 8
c:
	.zero	8
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 1600016
a:
	.zero	1600016
	.globl	b
	.align 32
	.type	b, @object
	.size	b, 800008
b:
	.zero	800008
	.globl	i
	.align 8
	.type	i, @object
	.size	i, 8
i:
	.zero	8
	.globl	m
	.align 8
	.type	m, @object
	.size	m, 8
m:
	.zero	8
	.globl	n
	.align 8
	.type	n, @object
	.size	n, 8
n:
	.zero	8
	.globl	r
	.align 32
	.type	r, @object
	.size	r, 800008
r:
	.zero	800008
	.globl	p
	.align 32
	.type	p, @object
	.size	p, 800008
p:
	.zero	800008
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC0:
	.quad	0
	.quad	1
	.align 16
.LC3:
	.quad	2
	.quad	2
	.align 16
.LC4:
	.quad	1
	.quad	1
	.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
	.globl	f
	.type	f, @function
f:
.LFB0:
	.cfi_startproc
	endbr64
	leaq	p(%rip), %rcx
	movslq	%edi, %rax
	movl	%edi, %r8d
	movq	(%rcx,%rax,8), %rdx
	cmpq	%rax, %rdx
	je	.L1
	.p2align 4,,10
	.p2align 3
.L2:
	movslq	%edx, %rax
	movl	%edx, %r8d
	movq	(%rcx,%rax,8), %rdx
	cmpq	%rax, %rdx
	jne	.L2
.L1:
	movl	%r8d, %eax
	ret
	.cfi_endproc
.LFE0:
	.size	f, .-f
	.p2align 4
	.globl	u
	.type	u, @function
u:
.LFB1:
	.cfi_startproc
	endbr64
	leaq	p(%rip), %r8
	movslq	%edi, %rdi
	movq	(%r8,%rdi,8), %rcx
	cmpq	%rcx, %rdi
	je	.L18
	.p2align 4,,10
	.p2align 3
.L7:
	movslq	%ecx, %rax
	movq	(%r8,%rax,8), %rcx
	movq	%rax, %rdx
	cmpq	%rax, %rcx
	jne	.L7
	movq	%rax, %rdi
.L10:
	movslq	%esi, %rsi
	movq	(%r8,%rsi,8), %rcx
	movq	%rsi, %rax
	cmpq	%rsi, %rcx
	je	.L8
	.p2align 4,,10
	.p2align 3
.L9:
	movslq	%ecx, %rax
	movq	(%r8,%rax,8), %rcx
	cmpq	%rax, %rcx
	jne	.L9
	movq	%rax, %rsi
.L8:
	leaq	r(%rip), %r9
	movq	(%r9,%rdi,8), %rcx
	movq	(%r9,%rsi,8), %r10
	cmpq	%r10, %rcx
	jge	.L19
	movq	%rax, (%r8,%rdi,8)
	leaq	(%rcx,%r10), %rax
	movq	%rax, (%r9,%rsi,8)
	movq	%rax, (%r9,%rdi,8)
	ret
	.p2align 4,,10
	.p2align 3
.L19:
	leaq	(%rcx,%r10), %rax
	movq	%rdx, (%r8,%rsi,8)
	movq	%rax, (%r9,%rsi,8)
	movq	%rax, (%r9,%rdi,8)
	ret
	.p2align 4,,10
	.p2align 3
.L18:
	movq	%rdi, %rdx
	jmp	.L10
	.cfi_endproc
.LFE1:
	.size	u, .-u
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC1:
	.string	"%ld%ld"
.LC2:
	.string	"%d%d"
.LC5:
	.string	"%ld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB2:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	m(%rip), %rdx
	leaq	n(%rip), %rsi
	xorl	%eax, %eax
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	leaq	.LC1(%rip), %rdi
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	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	$24, %rsp
	.cfi_def_cfa_offset 80
	call	scanf@PLT
	movq	m(%rip), %r12
	movq	$0, i(%rip)
	testq	%r12, %r12
	jle	.L21
	xorl	%eax, %eax
	leaq	a(%rip), %rbx
	leaq	.LC2(%rip), %rbp
	.p2align 4,,10
	.p2align 3
.L22:
	salq	$4, %rax
	movq	%rbp, %rdi
	leaq	8(%rbx,%rax), %rdx
	leaq	(%rbx,%rax), %rsi
	xorl	%eax, %eax
	call	scanf@PLT
	movq	i(%rip), %rax
	movq	m(%rip), %r12
	addq	$1, %rax
	movq	%rax, i(%rip)
	cmpq	%r12, %rax
	jl	.L22
.L21:
	movq	n(%rip), %rax
	leaq	b(%rip), %rbx
	movdqa	.LC0(%rip), %xmm0
	leaq	r(%rip), %r13
	movdqa	.LC3(%rip), %xmm3
	movdqa	.LC4(%rip), %xmm2
	leaq	-1(%rax), %rdx
	imulq	%rax, %rdx
	movq	%rdx, %rax
	shrq	$63, %rax
	addq	%rdx, %rax
	leaq	p(%rip), %rdx
	sarq	%rax
	movq	%rax, (%rbx,%r12,8)
	xorl	%eax, %eax
	.p2align 4,,10
	.p2align 3
.L23:
	movdqa	%xmm0, %xmm1
	movaps	%xmm2, 0(%r13,%rax)
	paddq	%xmm3, %xmm0
	movaps	%xmm1, (%rdx,%rax)
	addq	$16, %rax
	cmpq	$800000, %rax
	jne	.L23
	movq	$100000, 800000+p(%rip)
	leaq	-1(%r12), %rax
	movq	$1, 800000+r(%rip)
	testq	%rax, %rax
	jle	.L24
	movq	%r12, %rax
	leaq	a(%rip), %rcx
	movq	%r12, 8(%rsp)
	salq	$4, %rax
	leaq	-16(%rcx,%rax), %rbp
	leaq	b(%rip), %rax
	leaq	(%rax,%r12,8), %rbx
	.p2align 4,,10
	.p2align 3
.L45:
	movq	0(%rbp), %rax
	movq	8(%rbp), %r15
	movslq	%eax, %rsi
	movq	%rax, (%rsp)
	movslq	%eax, %r14
	movq	(%rdx,%rsi,8), %r8
	movq	%r8, %rax
	cmpq	%r8, %rsi
	je	.L70
	.p2align 4,,10
	.p2align 3
.L25:
	movslq	%eax, %rcx
	movl	%eax, %r11d
	movq	(%rdx,%rcx,8), %rax
	cmpq	%rcx, %rax
	jne	.L25
	movslq	%r15d, %rdi
	movslq	%r15d, %r12
	movq	(%rdx,%rdi,8), %r9
	cmpq	%r9, %rdi
	je	.L53
.L74:
	movq	%r9, %rax
	.p2align 4,,10
	.p2align 3
.L27:
	movslq	%eax, %rcx
	movl	%eax, %r10d
	movq	(%rdx,%rcx,8), %rax
	cmpq	%rax, %rcx
	jne	.L27
.L26:
	cmpl	%r11d, %r10d
	jne	.L71
	movq	(%rbx), %rax
	movq	%rax, -8(%rbx)
.L31:
	subq	$8, %rbx
	leaq	8+b(%rip), %rax
	subq	$16, %rbp
	cmpq	%rbx, %rax
	jne	.L45
	movq	(%rsp), %rax
	movq	8(%rsp), %r12
	movq	%r15, d(%rip)
	movq	%rax, c(%rip)
.L24:
	movq	$1, i(%rip)
	movl	$1, %eax
	leaq	.LC5(%rip), %rbx
	testq	%r12, %r12
	jle	.L65
	.p2align 4,,10
	.p2align 3
.L46:
	leaq	b(%rip), %rdi
	movq	(%rdi,%rax,8), %rsi
	xorl	%eax, %eax
	movq	%rbx, %rdi
	call	printf@PLT
	movq	i(%rip), %rax
	addq	$1, %rax
	cmpq	m(%rip), %rax
	movq	%rax, i(%rip)
	jle	.L46
.L65:
	addq	$24, %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
.L71:
	.cfi_restore_state
	movq	(%rbx), %r11
	cmpq	%r8, %rsi
	je	.L32
	movq	%r8, %rax
	.p2align 4,,10
	.p2align 3
.L34:
	movslq	%eax, %rcx
	movq	(%rdx,%rcx,8), %rax
	cmpq	%rcx, %rax
	jne	.L34
	movq	0(%r13,%rax,8), %r10
	cmpq	%r9, %rdi
	je	.L72
.L50:
	movq	%r9, %rax
	.p2align 4,,10
	.p2align 3
.L44:
	movslq	%eax, %rcx
	movq	(%rdx,%rcx,8), %rax
	cmpq	%rcx, %rax
	jne	.L44
	imulq	0(%r13,%rax,8), %r10
	movq	%r11, %rax
	subq	%r10, %rax
	movq	%rax, -8(%rbx)
	cmpq	%r8, %rsi
	je	.L41
	.p2align 4,,10
	.p2align 3
.L38:
	movslq	%r8d, %rsi
	movslq	%r8d, %r14
	movq	(%rdx,%rsi,8), %r8
	cmpq	%rsi, %r8
	jne	.L38
	cmpq	%r9, %rdi
	je	.L35
	.p2align 4,,10
	.p2align 3
.L41:
	movslq	%r9d, %rdi
	movslq	%r9d, %r12
	movq	(%rdx,%rdi,8), %r9
	cmpq	%rdi, %r9
	jne	.L41
.L35:
	movq	0(%r13,%r14,8), %rax
	movq	0(%r13,%r12,8), %rcx
	cmpq	%rcx, %rax
	jge	.L73
	movq	%rdi, (%rdx,%r14,8)
.L42:
	addq	%rcx, %rax
	movq	%rax, 0(%r13,%r12,8)
	movq	%rax, 0(%r13,%r14,8)
	jmp	.L31
	.p2align 4,,10
	.p2align 3
.L73:
	movq	%rsi, (%rdx,%r12,8)
	jmp	.L42
	.p2align 4,,10
	.p2align 3
.L70:
	movslq	%r15d, %rdi
	movl	(%rsp), %r11d
	movslq	%r15d, %r12
	movq	(%rdx,%rdi,8), %r9
	cmpq	%r9, %rdi
	jne	.L74
	.p2align 4,,10
	.p2align 3
.L53:
	movl	%r15d, %r10d
	jmp	.L26
.L32:
	movq	0(%r13,%rsi,8), %r10
	cmpq	%r9, %rdi
	jne	.L50
	imulq	0(%r13,%rdi,8), %r10
	movq	%r11, %rax
	subq	%r10, %rax
	movq	%rax, -8(%rbx)
	jmp	.L35
.L72:
	imulq	0(%r13,%rdi,8), %r10
	movq	%r11, %rax
	subq	%r10, %rax
	movq	%rax, -8(%rbx)
	jmp	.L38
	.cfi_endproc
.LFE2:
	.size	main, .-main
	.globl	d
	.bss
	.align 8
	.type	d, @object
	.size	d, 8
d:
	.zero	8
	.globl	c
	.align 8
	.type	c, @object
	.size	c, 8
c:
	.zero	8
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 1600016
a:
	.zero	1600016
	.globl	b
	.align 32
	.type	b, @object
	.size	b, 800008
b:
	.zero	800008
	.globl	i
	.align 8
	.type	i, @object
	.size	i, 8
i:
	.zero	8
	.globl	m
	.align 8
	.type	m, @object
	.size	m, 8
m:
	.zero	8
	.globl	n
	.align 8
	.type	n, @object
	.size	n, 8
n:
	.zero	8
	.globl	r
	.align 32
	.type	r, @object
	.size	r, 800008
r:
	.zero	800008
	.globl	p
	.align 32
	.type	p, @object
	.size	p, 800008
p:
	.zero	800008
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC0:
	.quad	0
	.quad	1
	.align 16
.LC3:
	.quad	2
	.quad	2
	.align 16
.LC4:
	.quad	1
	.quad	1
	.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:

#define N 100001 
long p[N],r[N],n,m,i,b[N],a[N][2],c,d;int f(int x){if(p[x]==x)return x;return f(p[x]);}int u(int x,int y){x=f(x);y=f(y);if(r[x]<r[y])p[x]=y;else p[y]=x;r[y]+=r[x];r[x]=r[y];}int main(){scanf("%ld%ld",&n,&m);for(i=0;i<m;i++)scanf("%d%d",a[i],&a[i][1]);b[m]=n*(n-1)/2;for(i=0;i<N;i++){p[i]=i;r[i]=1;};for(i=m-1;i>0;i--){c=a[i][0],d=a[i][1];if(f(c)==f(d))b[i]=b[i+1];else{b[i]=b[i+1]-r[f(c)]*r[f(d)];u(c,d);}}for(i=1;i<=m;i++)printf("%ld\n",b[i]);}
6 5
3 3
1 2
5 6
3 4
4 5
 4 5
1 2
3 4
1 3
3 3
1 4
 2 1
2 2
 6 5
3 3
1 2
5 6
3 4
2 5
 4 5
1 2
3 4
1 3
3 3
1 1
 6 5
2 3
1 2
5 6
3 4
4 3
 4 5
1 0
3 4
1 3
2 3
1 4
 6 5
3 3
1 1
5 6
3 4
4 5
 4 5
1 2
3 4
1 3
3 2
1 1
 4 1
1 3
3 4
1 3
3 3
1 1

8
9
12
14
15
 3
3
5
5
6
 1
 8
11
13
14
15
 3
5
6
6
6
 12
13
14
14
15
 0
0
4
5
6
 9
9
12
14
15
 0
3
5
6
6
 6

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

```c
#define N 100001 
long p[N],r[N],n,m,i,b[N],a[N][2],c,d;int f(int x){if(p[x]==x)return x;return f(p[x]);}int u(int x,int y){x=f(x);y=f(y);if(r[x]<r[y])p[x]=y;else p[y]=x;r[y]+=r[x];r[x]=r[y];}int main(){scanf("%ld%ld",&n,&m);for(i=0;i<m;i++)scanf("%d%d",a[i],&a[i][1]);b[m]=n*(n-1)/2;for(i=0;i<N;i++){p[i]=i;r[i]=1;};for(i=m-1;i>0;i--){c=a[i][0],d=a[i][1];if(f(c)==f(d))b[i]=b[i+1];else{b[i]=b[i+1]-r[f(c)]*r[f(d)];u(c,d);}}for(i=1;i<=m;i++)printf("%ld\n",b[i]);}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	p
	.bss
	.align 32
	.type	p, @object
	.size	p, 800008
p:
	.zero	800008
	.globl	r
	.align 32
	.type	r, @object
	.size	r, 800008
r:
	.zero	800008
	.globl	n
	.align 8
	.type	n, @object
	.size	n, 8
n:
	.zero	8
	.globl	m
	.align 8
	.type	m, @object
	.size	m, 8
m:
	.zero	8
	.globl	i
	.align 8
	.type	i, @object
	.size	i, 8
i:
	.zero	8
	.globl	b
	.align 32
	.type	b, @object
	.size	b, 800008
b:
	.zero	800008
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 1600016
a:
	.zero	1600016
	.globl	c
	.align 8
	.type	c, @object
	.size	c, 8
c:
	.zero	8
	.globl	d
	.align 8
	.type	d, @object
	.size	d, 8
d:
	.zero	8
	.text
	.globl	f
	.type	f, @function
f:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movl	%edi, -4(%rbp)
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	p(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movl	-4(%rbp), %eax
	cltq
	cmpq	%rax, %rdx
	jne	.L2
	movl	-4(%rbp), %eax
	jmp	.L3
.L2:
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	p(%rip), %rax
	movq	(%rdx,%rax), %rax
	movl	%eax, %edi
	call	f
.L3:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	f, .-f
	.globl	u
	.type	u, @function
u:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movl	%edi, -4(%rbp)
	movl	%esi, -8(%rbp)
	movl	-4(%rbp), %eax
	movl	%eax, %edi
	call	f
	movl	%eax, -4(%rbp)
	movl	-8(%rbp), %eax
	movl	%eax, %edi
	call	f
	movl	%eax, -8(%rbp)
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	r(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	r(%rip), %rax
	movq	(%rcx,%rax), %rax
	cmpq	%rax, %rdx
	jge	.L5
	movl	-8(%rbp), %eax
	cltq
	movl	-4(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	p(%rip), %rdx
	movq	%rax, (%rcx,%rdx)
	jmp	.L6
.L5:
	movl	-4(%rbp), %eax
	cltq
	movl	-8(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	p(%rip), %rdx
	movq	%rax, (%rcx,%rdx)
.L6:
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	r(%rip), %rax
	movq	(%rdx,%rax), %rcx
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	r(%rip), %rax
	movq	(%rdx,%rax), %rax
	addq	%rax, %rcx
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	r(%rip), %rax
	movq	%rcx, (%rdx,%rax)
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	r(%rip), %rax
	movq	(%rdx,%rax), %rax
	movl	-4(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	r(%rip), %rdx
	movq	%rax, (%rcx,%rdx)
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	u, .-u
	.section	.rodata
.LC0:
	.string	"%ld%ld"
.LC1:
	.string	"%d%d"
.LC2:
	.string	"%ld\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB2:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r12
	pushq	%rbx
	.cfi_offset 12, -24
	.cfi_offset 3, -32
	leaq	m(%rip), %rax
	movq	%rax, %rdx
	leaq	n(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movq	$0, i(%rip)
	jmp	.L8
.L9:
	movq	i(%rip), %rax
	salq	$4, %rax
	leaq	8(%rax), %rdx
	leaq	a(%rip), %rax
	addq	%rax, %rdx
	movq	i(%rip), %rax
	salq	$4, %rax
	movq	%rax, %rcx
	leaq	a(%rip), %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movq	i(%rip), %rax
	addq	$1, %rax
	movq	%rax, i(%rip)
.L8:
	movq	i(%rip), %rdx
	movq	m(%rip), %rax
	cmpq	%rax, %rdx
	jl	.L9
	movq	n(%rip), %rax
	leaq	-1(%rax), %rdx
	movq	n(%rip), %rax
	imulq	%rdx, %rax
	movq	m(%rip), %rdx
	movq	%rax, %rcx
	shrq	$63, %rcx
	addq	%rcx, %rax
	sarq	%rax
	movq	%rax, %rcx
	salq	$3, %rdx
	leaq	b(%rip), %rax
	movq	%rcx, (%rdx,%rax)
	movq	$0, i(%rip)
	jmp	.L10
.L11:
	movq	i(%rip), %rdx
	movq	i(%rip), %rax
	leaq	0(,%rdx,8), %rcx
	leaq	p(%rip), %rdx
	movq	%rax, (%rcx,%rdx)
	movq	i(%rip), %rax
	leaq	0(,%rax,8), %rdx
	leaq	r(%rip), %rax
	movq	$1, (%rdx,%rax)
	movq	i(%rip), %rax
	addq	$1, %rax
	movq	%rax, i(%rip)
.L10:
	movq	i(%rip), %rax
	cmpq	$100000, %rax
	jle	.L11
	movq	m(%rip), %rax
	subq	$1, %rax
	movq	%rax, i(%rip)
	jmp	.L12
.L15:
	movq	i(%rip), %rax
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rax
	movq	%rax, c(%rip)
	movq	i(%rip), %rax
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	8+a(%rip), %rax
	movq	(%rdx,%rax), %rax
	movq	%rax, d(%rip)
	movq	c(%rip), %rax
	movl	%eax, %edi
	call	f
	movl	%eax, %ebx
	movq	d(%rip), %rax
	movl	%eax, %edi
	call	f
	cmpl	%eax, %ebx
	jne	.L13
	movq	i(%rip), %rax
	addq	$1, %rax
	movq	i(%rip), %rdx
	leaq	0(,%rax,8), %rcx
	leaq	b(%rip), %rax
	movq	(%rcx,%rax), %rax
	leaq	0(,%rdx,8), %rcx
	leaq	b(%rip), %rdx
	movq	%rax, (%rcx,%rdx)
	jmp	.L14
.L13:
	movq	i(%rip), %rax
	addq	$1, %rax
	leaq	0(,%rax,8), %rdx
	leaq	b(%rip), %rax
	movq	(%rdx,%rax), %rbx
	movq	c(%rip), %rax
	movl	%eax, %edi
	call	f
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	r(%rip), %rax
	movq	(%rdx,%rax), %r12
	movq	d(%rip), %rax
	movl	%eax, %edi
	call	f
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	r(%rip), %rax
	movq	(%rdx,%rax), %rax
	movq	%r12, %rdx
	imulq	%rax, %rdx
	movq	i(%rip), %rax
	subq	%rdx, %rbx
	movq	%rbx, %rcx
	leaq	0(,%rax,8), %rdx
	leaq	b(%rip), %rax
	movq	%rcx, (%rdx,%rax)
	movq	d(%rip), %rax
	movl	%eax, %edx
	movq	c(%rip), %rax
	movl	%edx, %esi
	movl	%eax, %edi
	call	u
.L14:
	movq	i(%rip), %rax
	subq	$1, %rax
	movq	%rax, i(%rip)
.L12:
	movq	i(%rip), %rax
	testq	%rax, %rax
	jg	.L15
	movq	$1, i(%rip)
	jmp	.L16
.L17:
	movq	i(%rip), %rax
	leaq	0(,%rax,8), %rdx
	leaq	b(%rip), %rax
	movq	(%rdx,%rax), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movq	i(%rip), %rax
	addq	$1, %rax
	movq	%rax, i(%rip)
.L16:
	movq	i(%rip), %rdx
	movq	m(%rip), %rax
	cmpq	%rax, %rdx
	jle	.L17
	movl	$0, %eax
	popq	%rbx
	popq	%r12
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.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
	.globl	p
	.bss
	.align 32
	.type	p, @object
	.size	p, 800008
p:
	.zero	800008
	.globl	r
	.align 32
	.type	r, @object
	.size	r, 800008
r:
	.zero	800008
	.globl	n
	.align 8
	.type	n, @object
	.size	n, 8
n:
	.zero	8
	.globl	m
	.align 8
	.type	m, @object
	.size	m, 8
m:
	.zero	8
	.globl	i
	.align 8
	.type	i, @object
	.size	i, 8
i:
	.zero	8
	.globl	b
	.align 32
	.type	b, @object
	.size	b, 800008
b:
	.zero	800008
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 1600016
a:
	.zero	1600016
	.globl	c
	.align 8
	.type	c, @object
	.size	c, 8
c:
	.zero	8
	.globl	d
	.align 8
	.type	d, @object
	.size	d, 8
d:
	.zero	8
	.text
	.globl	f
	.type	f, @function
f:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movl	%edi, -4(%rbp)
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	p(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movl	-4(%rbp), %eax
	cltq
	cmpq	%rax, %rdx
	jne	.L2
	movl	-4(%rbp), %eax
	jmp	.L3
.L2:
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	p(%rip), %rax
	movq	(%rdx,%rax), %rax
	movl	%eax, %edi
	call	f
.L3:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	f, .-f
	.globl	u
	.type	u, @function
u:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movl	%edi, -4(%rbp)
	movl	%esi, -8(%rbp)
	movl	-4(%rbp), %eax
	movl	%eax, %edi
	call	f
	movl	%eax, -4(%rbp)
	movl	-8(%rbp), %eax
	movl	%eax, %edi
	call	f
	movl	%eax, -8(%rbp)
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	r(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	r(%rip), %rax
	movq	(%rcx,%rax), %rax
	cmpq	%rax, %rdx
	jge	.L5
	movl	-8(%rbp), %eax
	cltq
	movl	-4(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	p(%rip), %rdx
	movq	%rax, (%rcx,%rdx)
	jmp	.L6
.L5:
	movl	-4(%rbp), %eax
	cltq
	movl	-8(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	p(%rip), %rdx
	movq	%rax, (%rcx,%rdx)
.L6:
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	r(%rip), %rax
	movq	(%rdx,%rax), %rcx
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	r(%rip), %rax
	movq	(%rdx,%rax), %rax
	addq	%rax, %rcx
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	r(%rip), %rax
	movq	%rcx, (%rdx,%rax)
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	r(%rip), %rax
	movq	(%rdx,%rax), %rax
	movl	-4(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	r(%rip), %rdx
	movq	%rax, (%rcx,%rdx)
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	u, .-u
	.section	.rodata
.LC0:
	.string	"%ld%ld"
.LC1:
	.string	"%d%d"
.LC2:
	.string	"%ld\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB2:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r12
	pushq	%rbx
	.cfi_offset 12, -24
	.cfi_offset 3, -32
	leaq	m(%rip), %rax
	movq	%rax, %rdx
	leaq	n(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movq	$0, i(%rip)
	jmp	.L8
.L9:
	movq	i(%rip), %rax
	salq	$4, %rax
	leaq	8(%rax), %rdx
	leaq	a(%rip), %rax
	addq	%rax, %rdx
	movq	i(%rip), %rax
	salq	$4, %rax
	movq	%rax, %rcx
	leaq	a(%rip), %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movq	i(%rip), %rax
	addq	$1, %rax
	movq	%rax, i(%rip)
.L8:
	movq	i(%rip), %rdx
	movq	m(%rip), %rax
	cmpq	%rax, %rdx
	jl	.L9
	movq	n(%rip), %rax
	leaq	-1(%rax), %rdx
	movq	n(%rip), %rax
	imulq	%rdx, %rax
	movq	m(%rip), %rdx
	movq	%rax, %rcx
	shrq	$63, %rcx
	addq	%rcx, %rax
	sarq	%rax
	movq	%rax, %rcx
	salq	$3, %rdx
	leaq	b(%rip), %rax
	movq	%rcx, (%rdx,%rax)
	movq	$0, i(%rip)
	jmp	.L10
.L11:
	movq	i(%rip), %rdx
	movq	i(%rip), %rax
	leaq	0(,%rdx,8), %rcx
	leaq	p(%rip), %rdx
	movq	%rax, (%rcx,%rdx)
	movq	i(%rip), %rax
	leaq	0(,%rax,8), %rdx
	leaq	r(%rip), %rax
	movq	$1, (%rdx,%rax)
	movq	i(%rip), %rax
	addq	$1, %rax
	movq	%rax, i(%rip)
.L10:
	movq	i(%rip), %rax
	cmpq	$100000, %rax
	jle	.L11
	movq	m(%rip), %rax
	subq	$1, %rax
	movq	%rax, i(%rip)
	jmp	.L12
.L15:
	movq	i(%rip), %rax
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rax
	movq	%rax, c(%rip)
	movq	i(%rip), %rax
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	8+a(%rip), %rax
	movq	(%rdx,%rax), %rax
	movq	%rax, d(%rip)
	movq	c(%rip), %rax
	movl	%eax, %edi
	call	f
	movl	%eax, %ebx
	movq	d(%rip), %rax
	movl	%eax, %edi
	call	f
	cmpl	%eax, %ebx
	jne	.L13
	movq	i(%rip), %rax
	addq	$1, %rax
	movq	i(%rip), %rdx
	leaq	0(,%rax,8), %rcx
	leaq	b(%rip), %rax
	movq	(%rcx,%rax), %rax
	leaq	0(,%rdx,8), %rcx
	leaq	b(%rip), %rdx
	movq	%rax, (%rcx,%rdx)
	jmp	.L14
.L13:
	movq	i(%rip), %rax
	addq	$1, %rax
	leaq	0(,%rax,8), %rdx
	leaq	b(%rip), %rax
	movq	(%rdx,%rax), %rbx
	movq	c(%rip), %rax
	movl	%eax, %edi
	call	f
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	r(%rip), %rax
	movq	(%rdx,%rax), %r12
	movq	d(%rip), %rax
	movl	%eax, %edi
	call	f
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	r(%rip), %rax
	movq	(%rdx,%rax), %rax
	movq	%r12, %rdx
	imulq	%rax, %rdx
	movq	i(%rip), %rax
	subq	%rdx, %rbx
	movq	%rbx, %rcx
	leaq	0(,%rax,8), %rdx
	leaq	b(%rip), %rax
	movq	%rcx, (%rdx,%rax)
	movq	d(%rip), %rax
	movl	%eax, %edx
	movq	c(%rip), %rax
	movl	%edx, %esi
	movl	%eax, %edi
	call	u
.L14:
	movq	i(%rip), %rax
	subq	$1, %rax
	movq	%rax, i(%rip)
.L12:
	movq	i(%rip), %rax
	testq	%rax, %rax
	jg	.L15
	movq	$1, i(%rip)
	jmp	.L16
.L17:
	movq	i(%rip), %rax
	leaq	0(,%rax,8), %rdx
	leaq	b(%rip), %rax
	movq	(%rdx,%rax), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movq	i(%rip), %rax
	addq	$1, %rax
	movq	%rax, i(%rip)
.L16:
	movq	i(%rip), %rdx
	movq	m(%rip), %rax
	cmpq	%rax, %rdx
	jle	.L17
	movl	$0, %eax
	popq	%rbx
	popq	%r12
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.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:
