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>
typedef long long ll;

int
main(int argc, char *argv[])
{
  int n, m;
  scanf("%d%d", &n, &m);
  int a[100000], b[100000];
  for(int i = 0; i < m; i++){
    scanf("%d%d", &a[i], &b[i]);
    a[i]--; b[i]--;
  }

  int r[100000]; ll t[100000];
  for(int i = 0; i < n; i++){
    r[i] = i; t[i] = 1;
  }
 

  ll c[100000];
  c[m - 1] = ((long long)n * ((long long)n - 1)) / 2; 

  
  for(int i = m - 1; i > 0; i--){
    int temp;
    temp = a[i];
    while(r[temp] != temp){
      temp = r[temp];
    }
    r[a[i]] = temp;
    temp = b[i];
    while(r[temp] != temp){
      temp = r[temp];
    }
    r[b[i]] = temp;
    if(r[a[i]] != r[b[i]]){
      c[i - 1] = c[i] - t[r[a[i]]] * t[r[b[i]]];
      t[r[a[i]]] += t[r[b[i]]];
      r[r[b[i]]] = r[a[i]];
    }else{
      c[i - 1] = c[i];
    }
  }
  for(int i = 0; i < m; i++){
    printf("%lld\n", c[i]);
  }
  return 0;
}

  
  
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%lld\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	-2797568(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$2496, %rsp
	movl	%edi, -2800052(%rbp)
	movq	%rsi, -2800064(%rbp)
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-2800040(%rbp), %rdx
	leaq	-2800044(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -2800036(%rbp)
	jmp	.L2
.L3:
	leaq	-2400016(%rbp), %rdx
	movl	-2800036(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rax, %rdx
	leaq	-2800016(%rbp), %rcx
	movl	-2800036(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-2800036(%rbp), %eax
	cltq
	movl	-2800016(%rbp,%rax,4), %eax
	leal	-1(%rax), %edx
	movl	-2800036(%rbp), %eax
	cltq
	movl	%edx, -2800016(%rbp,%rax,4)
	movl	-2800036(%rbp), %eax
	cltq
	movl	-2400016(%rbp,%rax,4), %eax
	leal	-1(%rax), %edx
	movl	-2800036(%rbp), %eax
	cltq
	movl	%edx, -2400016(%rbp,%rax,4)
	addl	$1, -2800036(%rbp)
.L2:
	movl	-2800040(%rbp), %eax
	cmpl	%eax, -2800036(%rbp)
	jl	.L3
	movl	$0, -2800032(%rbp)
	jmp	.L4
.L5:
	movl	-2800032(%rbp), %eax
	cltq
	movl	-2800032(%rbp), %edx
	movl	%edx, -2000016(%rbp,%rax,4)
	movl	-2800032(%rbp), %eax
	cltq
	movq	$1, -1600016(%rbp,%rax,8)
	addl	$1, -2800032(%rbp)
.L4:
	movl	-2800044(%rbp), %eax
	cmpl	%eax, -2800032(%rbp)
	jl	.L5
	movl	-2800044(%rbp), %eax
	cltq
	movl	-2800044(%rbp), %edx
	movslq	%edx, %rdx
	subq	$1, %rdx
	imulq	%rdx, %rax
	movl	-2800040(%rbp), %edx
	subl	$1, %edx
	movq	%rax, %rcx
	shrq	$63, %rcx
	addq	%rcx, %rax
	sarq	%rax
	movq	%rax, %rcx
	movslq	%edx, %rax
	movq	%rcx, -800016(%rbp,%rax,8)
	movl	-2800040(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -2800028(%rbp)
	jmp	.L6
.L13:
	movl	-2800028(%rbp), %eax
	cltq
	movl	-2800016(%rbp,%rax,4), %eax
	movl	%eax, -2800024(%rbp)
	jmp	.L7
.L8:
	movl	-2800024(%rbp), %eax
	cltq
	movl	-2000016(%rbp,%rax,4), %eax
	movl	%eax, -2800024(%rbp)
.L7:
	movl	-2800024(%rbp), %eax
	cltq
	movl	-2000016(%rbp,%rax,4), %eax
	cmpl	%eax, -2800024(%rbp)
	jne	.L8
	movl	-2800028(%rbp), %eax
	cltq
	movl	-2800016(%rbp,%rax,4), %eax
	cltq
	movl	-2800024(%rbp), %edx
	movl	%edx, -2000016(%rbp,%rax,4)
	movl	-2800028(%rbp), %eax
	cltq
	movl	-2400016(%rbp,%rax,4), %eax
	movl	%eax, -2800024(%rbp)
	jmp	.L9
.L10:
	movl	-2800024(%rbp), %eax
	cltq
	movl	-2000016(%rbp,%rax,4), %eax
	movl	%eax, -2800024(%rbp)
.L9:
	movl	-2800024(%rbp), %eax
	cltq
	movl	-2000016(%rbp,%rax,4), %eax
	cmpl	%eax, -2800024(%rbp)
	jne	.L10
	movl	-2800028(%rbp), %eax
	cltq
	movl	-2400016(%rbp,%rax,4), %eax
	cltq
	movl	-2800024(%rbp), %edx
	movl	%edx, -2000016(%rbp,%rax,4)
	movl	-2800028(%rbp), %eax
	cltq
	movl	-2800016(%rbp,%rax,4), %eax
	cltq
	movl	-2000016(%rbp,%rax,4), %edx
	movl	-2800028(%rbp), %eax
	cltq
	movl	-2400016(%rbp,%rax,4), %eax
	cltq
	movl	-2000016(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	je	.L11
	movl	-2800028(%rbp), %eax
	cltq
	movq	-800016(%rbp,%rax,8), %rdx
	movl	-2800028(%rbp), %eax
	cltq
	movl	-2800016(%rbp,%rax,4), %eax
	cltq
	movl	-2000016(%rbp,%rax,4), %eax
	cltq
	movq	-1600016(%rbp,%rax,8), %rcx
	movl	-2800028(%rbp), %eax
	cltq
	movl	-2400016(%rbp,%rax,4), %eax
	cltq
	movl	-2000016(%rbp,%rax,4), %eax
	cltq
	movq	-1600016(%rbp,%rax,8), %rax
	imulq	%rax, %rcx
	movl	-2800028(%rbp), %eax
	subl	$1, %eax
	subq	%rcx, %rdx
	cltq
	movq	%rdx, -800016(%rbp,%rax,8)
	movl	-2800028(%rbp), %eax
	cltq
	movl	-2800016(%rbp,%rax,4), %eax
	cltq
	movl	-2000016(%rbp,%rax,4), %eax
	cltq
	movq	-1600016(%rbp,%rax,8), %rcx
	movl	-2800028(%rbp), %eax
	cltq
	movl	-2400016(%rbp,%rax,4), %eax
	cltq
	movl	-2000016(%rbp,%rax,4), %eax
	cltq
	movq	-1600016(%rbp,%rax,8), %rdx
	movl	-2800028(%rbp), %eax
	cltq
	movl	-2800016(%rbp,%rax,4), %eax
	cltq
	movl	-2000016(%rbp,%rax,4), %eax
	addq	%rcx, %rdx
	cltq
	movq	%rdx, -1600016(%rbp,%rax,8)
	movl	-2800028(%rbp), %eax
	cltq
	movl	-2800016(%rbp,%rax,4), %edx
	movl	-2800028(%rbp), %eax
	cltq
	movl	-2400016(%rbp,%rax,4), %eax
	cltq
	movl	-2000016(%rbp,%rax,4), %ecx
	movslq	%edx, %rax
	movl	-2000016(%rbp,%rax,4), %edx
	movslq	%ecx, %rax
	movl	%edx, -2000016(%rbp,%rax,4)
	jmp	.L12
.L11:
	movl	-2800028(%rbp), %eax
	leal	-1(%rax), %ecx
	movl	-2800028(%rbp), %eax
	cltq
	movq	-800016(%rbp,%rax,8), %rdx
	movslq	%ecx, %rax
	movq	%rdx, -800016(%rbp,%rax,8)
.L12:
	subl	$1, -2800028(%rbp)
.L6:
	cmpl	$0, -2800028(%rbp)
	jg	.L13
	movl	$0, -2800020(%rbp)
	jmp	.L14
.L15:
	movl	-2800020(%rbp), %eax
	cltq
	movq	-800016(%rbp,%rax,8), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -2800020(%rbp)
.L14:
	movl	-2800040(%rbp), %eax
	cmpl	%eax, -2800020(%rbp)
	jl	.L15
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L17
	call	__stack_chk_fail@PLT
.L17:
	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
.LC1:
	.string	"%d%d"
.LC4:
	.string	"%lld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	leaq	-2797568(%rsp), %r11
	.cfi_def_cfa 11, 2797608
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$2472, %rsp
	.cfi_def_cfa_offset 2800080
	leaq	.LC1(%rip), %r13
	movq	%r13, %rdi
	movq	%fs:40, %rax
	movq	%rax, 2800024(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rdx
	leaq	8(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %r8d
	testl	%r8d, %r8d
	jle	.L2
	leaq	16(%rsp), %rbp
	leaq	400016(%rsp), %rbx
	xorl	%r12d, %r12d
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%rbx, %rdx
	movq	%rbp, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %r8d
	addl	$1, %r12d
	subl	$1, 0(%rbp)
	subl	$1, (%rbx)
	addq	$4, %rbp
	addq	$4, %rbx
	cmpl	%r12d, %r8d
	jg	.L3
.L2:
	movslq	8(%rsp), %rcx
	testl	%ecx, %ecx
	jle	.L10
	leal	-1(%rcx), %eax
	cmpl	$2, %eax
	jbe	.L20
	movl	%ecx, %esi
	movdqa	.LC0(%rip), %xmm0
	movdqa	.LC2(%rip), %xmm3
	leaq	1200016(%rsp), %rax
	shrl	$2, %esi
	movdqa	.LC3(%rip), %xmm1
	leaq	800016(%rsp), %rdx
	subl	$1, %esi
	salq	$5, %rsi
	leaq	1200048(%rsp,%rsi), %rsi
	.p2align 4,,10
	.p2align 3
.L8:
	movdqa	%xmm0, %xmm2
	addq	$32, %rax
	paddd	%xmm3, %xmm0
	addq	$16, %rdx
	movaps	%xmm2, -16(%rdx)
	movaps	%xmm1, -32(%rax)
	movaps	%xmm1, -16(%rax)
	cmpq	%rsi, %rax
	jne	.L8
	movl	%ecx, %eax
	andl	$-4, %eax
	testb	$3, %cl
	je	.L10
.L7:
	movslq	%eax, %rdx
	movl	%eax, 800016(%rsp,%rdx,4)
	movq	$1, 1200016(%rsp,%rdx,8)
	leal	1(%rax), %edx
	cmpl	%ecx, %edx
	jge	.L10
	movslq	%edx, %rsi
	addl	$2, %eax
	movl	%edx, 800016(%rsp,%rsi,4)
	movq	$1, 1200016(%rsp,%rsi,8)
	cmpl	%eax, %ecx
	jle	.L10
	movslq	%eax, %rdx
	movl	%eax, 800016(%rsp,%rdx,4)
	movq	$1, 1200016(%rsp,%rdx,8)
.L10:
	leaq	-1(%rcx), %rax
	leal	-1(%r8), %edx
	imulq	%rcx, %rax
	movslq	%edx, %rcx
	leaq	16(%rsp), %r10
	leaq	400016(%rsp), %r9
	leaq	2000016(%rsp), %rbx
	movq	%rax, %rdi
	shrq	$63, %rdi
	addq	%rax, %rdi
	sarq	%rdi
	movq	%rdi, 2000016(%rsp,%rcx,8)
	testl	%edx, %edx
	jle	.L6
	.p2align 4,,10
	.p2align 3
.L18:
	movslq	(%r10,%rcx,4), %rsi
	movl	%esi, %eax
	.p2align 4,,10
	.p2align 3
.L14:
	cltq
	movq	%rax, %rdx
	movl	800016(%rsp,%rax,4), %eax
	cmpl	%edx, %eax
	jne	.L14
	movslq	(%r9,%rcx,4), %r11
	movl	%eax, 800016(%rsp,%rsi,4)
	movl	%r11d, %eax
	.p2align 4,,10
	.p2align 3
.L15:
	cltq
	movq	%rax, %rdx
	movslq	800016(%rsp,%rax,4), %rax
	cmpl	%edx, %eax
	jne	.L15
	movl	%eax, 800016(%rsp,%r11,4)
	movl	800016(%rsp,%rsi,4), %edx
	cmpl	%eax, %edx
	je	.L16
	movslq	%edx, %r11
	movq	1200016(%rsp,%rax,8), %rbp
	movl	%edx, 800016(%rsp,%rax,4)
	movq	1200016(%rsp,%r11,8), %rsi
	movq	%rsi, %r12
	addq	%rbp, %rsi
	imulq	%rbp, %r12
	movq	%rsi, 1200016(%rsp,%r11,8)
	subq	%r12, %rdi
	movq	%rdi, -8(%rbx,%rcx,8)
.L17:
	subq	$1, %rcx
	testl	%ecx, %ecx
	jg	.L18
.L6:
	xorl	%ebp, %ebp
	leaq	2000016(%rsp), %rbx
	leaq	.LC4(%rip), %r12
	testl	%r8d, %r8d
	jle	.L13
	.p2align 4,,10
	.p2align 3
.L12:
	movq	(%rbx,%rbp,8), %rdx
	movq	%r12, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	addq	$1, %rbp
	call	__printf_chk@PLT
	cmpl	%ebp, 12(%rsp)
	jg	.L12
.L13:
	movq	2800024(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L32
	addq	$2800040, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L16:
	.cfi_restore_state
	movq	%rdi, -8(%rbx,%rcx,8)
	jmp	.L17
.L20:
	xorl	%eax, %eax
	jmp	.L7
.L32:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC0:
	.long	0
	.long	1
	.long	2
	.long	3
	.align 16
.LC2:
	.long	4
	.long	4
	.long	4
	.long	4
	.align 16
.LC3:
	.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
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC1:
	.string	"%d%d"
.LC4:
	.string	"%lld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	leaq	-2797568(%rsp), %r11
	.cfi_def_cfa 11, 2797608
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$2472, %rsp
	.cfi_def_cfa_offset 2800080
	leaq	.LC1(%rip), %r13
	movq	%r13, %rdi
	movq	%fs:40, %rax
	movq	%rax, 2800024(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rdx
	leaq	8(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %r8d
	testl	%r8d, %r8d
	jle	.L2
	leaq	16(%rsp), %rbp
	leaq	400016(%rsp), %rbx
	xorl	%r12d, %r12d
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%rbx, %rdx
	movq	%rbp, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %r8d
	addl	$1, %r12d
	subl	$1, 0(%rbp)
	subl	$1, (%rbx)
	addq	$4, %rbp
	addq	$4, %rbx
	cmpl	%r12d, %r8d
	jg	.L3
.L2:
	movslq	8(%rsp), %rcx
	testl	%ecx, %ecx
	jle	.L10
	leal	-1(%rcx), %eax
	cmpl	$2, %eax
	jbe	.L20
	movl	%ecx, %esi
	movdqa	.LC0(%rip), %xmm0
	movdqa	.LC2(%rip), %xmm3
	leaq	1200016(%rsp), %rax
	shrl	$2, %esi
	movdqa	.LC3(%rip), %xmm1
	leaq	800016(%rsp), %rdx
	subl	$1, %esi
	salq	$5, %rsi
	leaq	1200048(%rsp,%rsi), %rsi
	.p2align 4,,10
	.p2align 3
.L8:
	movdqa	%xmm0, %xmm2
	addq	$32, %rax
	paddd	%xmm3, %xmm0
	addq	$16, %rdx
	movaps	%xmm2, -16(%rdx)
	movaps	%xmm1, -32(%rax)
	movaps	%xmm1, -16(%rax)
	cmpq	%rsi, %rax
	jne	.L8
	movl	%ecx, %eax
	andl	$-4, %eax
	testb	$3, %cl
	je	.L10
.L7:
	movslq	%eax, %rdx
	movl	%eax, 800016(%rsp,%rdx,4)
	movq	$1, 1200016(%rsp,%rdx,8)
	leal	1(%rax), %edx
	cmpl	%ecx, %edx
	jge	.L10
	movslq	%edx, %rsi
	addl	$2, %eax
	movl	%edx, 800016(%rsp,%rsi,4)
	movq	$1, 1200016(%rsp,%rsi,8)
	cmpl	%eax, %ecx
	jle	.L10
	movslq	%eax, %rdx
	movl	%eax, 800016(%rsp,%rdx,4)
	movq	$1, 1200016(%rsp,%rdx,8)
.L10:
	leaq	-1(%rcx), %rax
	leal	-1(%r8), %edx
	imulq	%rcx, %rax
	movslq	%edx, %rcx
	leaq	16(%rsp), %r10
	leaq	400016(%rsp), %r9
	leaq	2000016(%rsp), %rbx
	movq	%rax, %rdi
	shrq	$63, %rdi
	addq	%rax, %rdi
	sarq	%rdi
	movq	%rdi, 2000016(%rsp,%rcx,8)
	testl	%edx, %edx
	jle	.L6
	.p2align 4,,10
	.p2align 3
.L18:
	movslq	(%r10,%rcx,4), %rsi
	movl	%esi, %eax
	.p2align 4,,10
	.p2align 3
.L14:
	cltq
	movq	%rax, %rdx
	movl	800016(%rsp,%rax,4), %eax
	cmpl	%edx, %eax
	jne	.L14
	movslq	(%r9,%rcx,4), %r11
	movl	%eax, 800016(%rsp,%rsi,4)
	movl	%r11d, %eax
	.p2align 4,,10
	.p2align 3
.L15:
	cltq
	movq	%rax, %rdx
	movslq	800016(%rsp,%rax,4), %rax
	cmpl	%edx, %eax
	jne	.L15
	movl	%eax, 800016(%rsp,%r11,4)
	movl	800016(%rsp,%rsi,4), %edx
	cmpl	%eax, %edx
	je	.L16
	movslq	%edx, %r11
	movq	1200016(%rsp,%rax,8), %rbp
	movl	%edx, 800016(%rsp,%rax,4)
	movq	1200016(%rsp,%r11,8), %rsi
	movq	%rsi, %r12
	addq	%rbp, %rsi
	imulq	%rbp, %r12
	movq	%rsi, 1200016(%rsp,%r11,8)
	subq	%r12, %rdi
	movq	%rdi, -8(%rbx,%rcx,8)
.L17:
	subq	$1, %rcx
	testl	%ecx, %ecx
	jg	.L18
.L6:
	xorl	%ebp, %ebp
	leaq	2000016(%rsp), %rbx
	leaq	.LC4(%rip), %r12
	testl	%r8d, %r8d
	jle	.L13
	.p2align 4,,10
	.p2align 3
.L12:
	movq	(%rbx,%rbp,8), %rdx
	movq	%r12, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	addq	$1, %rbp
	call	__printf_chk@PLT
	cmpl	%ebp, 12(%rsp)
	jg	.L12
.L13:
	movq	2800024(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L32
	addq	$2800040, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L16:
	.cfi_restore_state
	movq	%rdi, -8(%rbx,%rcx,8)
	jmp	.L17
.L20:
	xorl	%eax, %eax
	jmp	.L7
.L32:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC0:
	.long	0
	.long	1
	.long	2
	.long	3
	.align 16
.LC2:
	.long	4
	.long	4
	.long	4
	.long	4
	.align 16
.LC3:
	.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:

#include <stdio.h>
typedef long long ll;

int
main(int argc, char *argv[])
{
  int n, m;
  scanf("%d%d", &n, &m);
  int a[100000], b[100000];
  for(int i = 0; i < m; i++){
    scanf("%d%d", &a[i], &b[i]);
    a[i]--; b[i]--;
  }

  int r[100000]; ll t[100000];
  for(int i = 0; i < n; i++){
    r[i] = i; t[i] = 1;
  }
 

  ll c[100000];
  c[m - 1] = ((long long)n * ((long long)n - 1)) / 2; 

  
  for(int i = m - 1; i > 0; i--){
    int temp;
    temp = a[i];
    while(r[temp] != temp){
      temp = r[temp];
    }
    r[a[i]] = temp;
    temp = b[i];
    while(r[temp] != temp){
      temp = r[temp];
    }
    r[b[i]] = temp;
    if(r[a[i]] != r[b[i]]){
      c[i - 1] = c[i] - t[r[a[i]]] * t[r[b[i]]];
      t[r[a[i]]] += t[r[b[i]]];
      r[r[b[i]]] = r[a[i]];
    }else{
      c[i - 1] = c[i];
    }
  }
  for(int i = 0; i < m; i++){
    printf("%lld\n", c[i]);
  }
  return 0;
}

  
  

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
#include <stdio.h>
typedef long long ll;

int
main(int argc, char *argv[])
{
  int n, m;
  scanf("%d%d", &n, &m);
  int a[100000], b[100000];
  for(int i = 0; i < m; i++){
    scanf("%d%d", &a[i], &b[i]);
    a[i]--; b[i]--;
  }

  int r[100000]; ll t[100000];
  for(int i = 0; i < n; i++){
    r[i] = i; t[i] = 1;
  }
 

  ll c[100000];
  c[m - 1] = ((long long)n * ((long long)n - 1)) / 2; 

  
  for(int i = m - 1; i > 0; i--){
    int temp;
    temp = a[i];
    while(r[temp] != temp){
      temp = r[temp];
    }
    r[a[i]] = temp;
    temp = b[i];
    while(r[temp] != temp){
      temp = r[temp];
    }
    r[b[i]] = temp;
    if(r[a[i]] != r[b[i]]){
      c[i - 1] = c[i] - t[r[a[i]]] * t[r[b[i]]];
      t[r[a[i]]] += t[r[b[i]]];
      r[r[b[i]]] = r[a[i]];
    }else{
      c[i - 1] = c[i];
    }
  }
  for(int i = 0; i < m; i++){
    printf("%lld\n", c[i]);
  }
  return 0;
}

  
  
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%lld\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	-2797568(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$2496, %rsp
	movl	%edi, -2800052(%rbp)
	movq	%rsi, -2800064(%rbp)
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-2800040(%rbp), %rdx
	leaq	-2800044(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -2800036(%rbp)
	jmp	.L2
.L3:
	leaq	-2400016(%rbp), %rdx
	movl	-2800036(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rax, %rdx
	leaq	-2800016(%rbp), %rcx
	movl	-2800036(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-2800036(%rbp), %eax
	cltq
	movl	-2800016(%rbp,%rax,4), %eax
	leal	-1(%rax), %edx
	movl	-2800036(%rbp), %eax
	cltq
	movl	%edx, -2800016(%rbp,%rax,4)
	movl	-2800036(%rbp), %eax
	cltq
	movl	-2400016(%rbp,%rax,4), %eax
	leal	-1(%rax), %edx
	movl	-2800036(%rbp), %eax
	cltq
	movl	%edx, -2400016(%rbp,%rax,4)
	addl	$1, -2800036(%rbp)
.L2:
	movl	-2800040(%rbp), %eax
	cmpl	%eax, -2800036(%rbp)
	jl	.L3
	movl	$0, -2800032(%rbp)
	jmp	.L4
.L5:
	movl	-2800032(%rbp), %eax
	cltq
	movl	-2800032(%rbp), %edx
	movl	%edx, -2000016(%rbp,%rax,4)
	movl	-2800032(%rbp), %eax
	cltq
	movq	$1, -1600016(%rbp,%rax,8)
	addl	$1, -2800032(%rbp)
.L4:
	movl	-2800044(%rbp), %eax
	cmpl	%eax, -2800032(%rbp)
	jl	.L5
	movl	-2800044(%rbp), %eax
	cltq
	movl	-2800044(%rbp), %edx
	movslq	%edx, %rdx
	subq	$1, %rdx
	imulq	%rdx, %rax
	movl	-2800040(%rbp), %edx
	subl	$1, %edx
	movq	%rax, %rcx
	shrq	$63, %rcx
	addq	%rcx, %rax
	sarq	%rax
	movq	%rax, %rcx
	movslq	%edx, %rax
	movq	%rcx, -800016(%rbp,%rax,8)
	movl	-2800040(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -2800028(%rbp)
	jmp	.L6
.L13:
	movl	-2800028(%rbp), %eax
	cltq
	movl	-2800016(%rbp,%rax,4), %eax
	movl	%eax, -2800024(%rbp)
	jmp	.L7
.L8:
	movl	-2800024(%rbp), %eax
	cltq
	movl	-2000016(%rbp,%rax,4), %eax
	movl	%eax, -2800024(%rbp)
.L7:
	movl	-2800024(%rbp), %eax
	cltq
	movl	-2000016(%rbp,%rax,4), %eax
	cmpl	%eax, -2800024(%rbp)
	jne	.L8
	movl	-2800028(%rbp), %eax
	cltq
	movl	-2800016(%rbp,%rax,4), %eax
	cltq
	movl	-2800024(%rbp), %edx
	movl	%edx, -2000016(%rbp,%rax,4)
	movl	-2800028(%rbp), %eax
	cltq
	movl	-2400016(%rbp,%rax,4), %eax
	movl	%eax, -2800024(%rbp)
	jmp	.L9
.L10:
	movl	-2800024(%rbp), %eax
	cltq
	movl	-2000016(%rbp,%rax,4), %eax
	movl	%eax, -2800024(%rbp)
.L9:
	movl	-2800024(%rbp), %eax
	cltq
	movl	-2000016(%rbp,%rax,4), %eax
	cmpl	%eax, -2800024(%rbp)
	jne	.L10
	movl	-2800028(%rbp), %eax
	cltq
	movl	-2400016(%rbp,%rax,4), %eax
	cltq
	movl	-2800024(%rbp), %edx
	movl	%edx, -2000016(%rbp,%rax,4)
	movl	-2800028(%rbp), %eax
	cltq
	movl	-2800016(%rbp,%rax,4), %eax
	cltq
	movl	-2000016(%rbp,%rax,4), %edx
	movl	-2800028(%rbp), %eax
	cltq
	movl	-2400016(%rbp,%rax,4), %eax
	cltq
	movl	-2000016(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	je	.L11
	movl	-2800028(%rbp), %eax
	cltq
	movq	-800016(%rbp,%rax,8), %rdx
	movl	-2800028(%rbp), %eax
	cltq
	movl	-2800016(%rbp,%rax,4), %eax
	cltq
	movl	-2000016(%rbp,%rax,4), %eax
	cltq
	movq	-1600016(%rbp,%rax,8), %rcx
	movl	-2800028(%rbp), %eax
	cltq
	movl	-2400016(%rbp,%rax,4), %eax
	cltq
	movl	-2000016(%rbp,%rax,4), %eax
	cltq
	movq	-1600016(%rbp,%rax,8), %rax
	imulq	%rax, %rcx
	movl	-2800028(%rbp), %eax
	subl	$1, %eax
	subq	%rcx, %rdx
	cltq
	movq	%rdx, -800016(%rbp,%rax,8)
	movl	-2800028(%rbp), %eax
	cltq
	movl	-2800016(%rbp,%rax,4), %eax
	cltq
	movl	-2000016(%rbp,%rax,4), %eax
	cltq
	movq	-1600016(%rbp,%rax,8), %rcx
	movl	-2800028(%rbp), %eax
	cltq
	movl	-2400016(%rbp,%rax,4), %eax
	cltq
	movl	-2000016(%rbp,%rax,4), %eax
	cltq
	movq	-1600016(%rbp,%rax,8), %rdx
	movl	-2800028(%rbp), %eax
	cltq
	movl	-2800016(%rbp,%rax,4), %eax
	cltq
	movl	-2000016(%rbp,%rax,4), %eax
	addq	%rcx, %rdx
	cltq
	movq	%rdx, -1600016(%rbp,%rax,8)
	movl	-2800028(%rbp), %eax
	cltq
	movl	-2800016(%rbp,%rax,4), %edx
	movl	-2800028(%rbp), %eax
	cltq
	movl	-2400016(%rbp,%rax,4), %eax
	cltq
	movl	-2000016(%rbp,%rax,4), %ecx
	movslq	%edx, %rax
	movl	-2000016(%rbp,%rax,4), %edx
	movslq	%ecx, %rax
	movl	%edx, -2000016(%rbp,%rax,4)
	jmp	.L12
.L11:
	movl	-2800028(%rbp), %eax
	leal	-1(%rax), %ecx
	movl	-2800028(%rbp), %eax
	cltq
	movq	-800016(%rbp,%rax,8), %rdx
	movslq	%ecx, %rax
	movq	%rdx, -800016(%rbp,%rax,8)
.L12:
	subl	$1, -2800028(%rbp)
.L6:
	cmpl	$0, -2800028(%rbp)
	jg	.L13
	movl	$0, -2800020(%rbp)
	jmp	.L14
.L15:
	movl	-2800020(%rbp), %eax
	cltq
	movq	-800016(%rbp,%rax,8), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -2800020(%rbp)
.L14:
	movl	-2800040(%rbp), %eax
	cmpl	%eax, -2800020(%rbp)
	jl	.L15
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L17
	call	__stack_chk_fail@PLT
.L17:
	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%d"
.LC1:
	.string	"%lld\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	-2797568(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$2496, %rsp
	movl	%edi, -2800052(%rbp)
	movq	%rsi, -2800064(%rbp)
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-2800040(%rbp), %rdx
	leaq	-2800044(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -2800036(%rbp)
	jmp	.L2
.L3:
	leaq	-2400016(%rbp), %rdx
	movl	-2800036(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rax, %rdx
	leaq	-2800016(%rbp), %rcx
	movl	-2800036(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-2800036(%rbp), %eax
	cltq
	movl	-2800016(%rbp,%rax,4), %eax
	leal	-1(%rax), %edx
	movl	-2800036(%rbp), %eax
	cltq
	movl	%edx, -2800016(%rbp,%rax,4)
	movl	-2800036(%rbp), %eax
	cltq
	movl	-2400016(%rbp,%rax,4), %eax
	leal	-1(%rax), %edx
	movl	-2800036(%rbp), %eax
	cltq
	movl	%edx, -2400016(%rbp,%rax,4)
	addl	$1, -2800036(%rbp)
.L2:
	movl	-2800040(%rbp), %eax
	cmpl	%eax, -2800036(%rbp)
	jl	.L3
	movl	$0, -2800032(%rbp)
	jmp	.L4
.L5:
	movl	-2800032(%rbp), %eax
	cltq
	movl	-2800032(%rbp), %edx
	movl	%edx, -2000016(%rbp,%rax,4)
	movl	-2800032(%rbp), %eax
	cltq
	movq	$1, -1600016(%rbp,%rax,8)
	addl	$1, -2800032(%rbp)
.L4:
	movl	-2800044(%rbp), %eax
	cmpl	%eax, -2800032(%rbp)
	jl	.L5
	movl	-2800044(%rbp), %eax
	cltq
	movl	-2800044(%rbp), %edx
	movslq	%edx, %rdx
	subq	$1, %rdx
	imulq	%rdx, %rax
	movl	-2800040(%rbp), %edx
	subl	$1, %edx
	movq	%rax, %rcx
	shrq	$63, %rcx
	addq	%rcx, %rax
	sarq	%rax
	movq	%rax, %rcx
	movslq	%edx, %rax
	movq	%rcx, -800016(%rbp,%rax,8)
	movl	-2800040(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -2800028(%rbp)
	jmp	.L6
.L13:
	movl	-2800028(%rbp), %eax
	cltq
	movl	-2800016(%rbp,%rax,4), %eax
	movl	%eax, -2800024(%rbp)
	jmp	.L7
.L8:
	movl	-2800024(%rbp), %eax
	cltq
	movl	-2000016(%rbp,%rax,4), %eax
	movl	%eax, -2800024(%rbp)
.L7:
	movl	-2800024(%rbp), %eax
	cltq
	movl	-2000016(%rbp,%rax,4), %eax
	cmpl	%eax, -2800024(%rbp)
	jne	.L8
	movl	-2800028(%rbp), %eax
	cltq
	movl	-2800016(%rbp,%rax,4), %eax
	cltq
	movl	-2800024(%rbp), %edx
	movl	%edx, -2000016(%rbp,%rax,4)
	movl	-2800028(%rbp), %eax
	cltq
	movl	-2400016(%rbp,%rax,4), %eax
	movl	%eax, -2800024(%rbp)
	jmp	.L9
.L10:
	movl	-2800024(%rbp), %eax
	cltq
	movl	-2000016(%rbp,%rax,4), %eax
	movl	%eax, -2800024(%rbp)
.L9:
	movl	-2800024(%rbp), %eax
	cltq
	movl	-2000016(%rbp,%rax,4), %eax
	cmpl	%eax, -2800024(%rbp)
	jne	.L10
	movl	-2800028(%rbp), %eax
	cltq
	movl	-2400016(%rbp,%rax,4), %eax
	cltq
	movl	-2800024(%rbp), %edx
	movl	%edx, -2000016(%rbp,%rax,4)
	movl	-2800028(%rbp), %eax
	cltq
	movl	-2800016(%rbp,%rax,4), %eax
	cltq
	movl	-2000016(%rbp,%rax,4), %edx
	movl	-2800028(%rbp), %eax
	cltq
	movl	-2400016(%rbp,%rax,4), %eax
	cltq
	movl	-2000016(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	je	.L11
	movl	-2800028(%rbp), %eax
	cltq
	movq	-800016(%rbp,%rax,8), %rdx
	movl	-2800028(%rbp), %eax
	cltq
	movl	-2800016(%rbp,%rax,4), %eax
	cltq
	movl	-2000016(%rbp,%rax,4), %eax
	cltq
	movq	-1600016(%rbp,%rax,8), %rcx
	movl	-2800028(%rbp), %eax
	cltq
	movl	-2400016(%rbp,%rax,4), %eax
	cltq
	movl	-2000016(%rbp,%rax,4), %eax
	cltq
	movq	-1600016(%rbp,%rax,8), %rax
	imulq	%rax, %rcx
	movl	-2800028(%rbp), %eax
	subl	$1, %eax
	subq	%rcx, %rdx
	cltq
	movq	%rdx, -800016(%rbp,%rax,8)
	movl	-2800028(%rbp), %eax
	cltq
	movl	-2800016(%rbp,%rax,4), %eax
	cltq
	movl	-2000016(%rbp,%rax,4), %eax
	cltq
	movq	-1600016(%rbp,%rax,8), %rcx
	movl	-2800028(%rbp), %eax
	cltq
	movl	-2400016(%rbp,%rax,4), %eax
	cltq
	movl	-2000016(%rbp,%rax,4), %eax
	cltq
	movq	-1600016(%rbp,%rax,8), %rdx
	movl	-2800028(%rbp), %eax
	cltq
	movl	-2800016(%rbp,%rax,4), %eax
	cltq
	movl	-2000016(%rbp,%rax,4), %eax
	addq	%rcx, %rdx
	cltq
	movq	%rdx, -1600016(%rbp,%rax,8)
	movl	-2800028(%rbp), %eax
	cltq
	movl	-2800016(%rbp,%rax,4), %edx
	movl	-2800028(%rbp), %eax
	cltq
	movl	-2400016(%rbp,%rax,4), %eax
	cltq
	movl	-2000016(%rbp,%rax,4), %ecx
	movslq	%edx, %rax
	movl	-2000016(%rbp,%rax,4), %edx
	movslq	%ecx, %rax
	movl	%edx, -2000016(%rbp,%rax,4)
	jmp	.L12
.L11:
	movl	-2800028(%rbp), %eax
	leal	-1(%rax), %ecx
	movl	-2800028(%rbp), %eax
	cltq
	movq	-800016(%rbp,%rax,8), %rdx
	movslq	%ecx, %rax
	movq	%rdx, -800016(%rbp,%rax,8)
.L12:
	subl	$1, -2800028(%rbp)
.L6:
	cmpl	$0, -2800028(%rbp)
	jg	.L13
	movl	$0, -2800020(%rbp)
	jmp	.L14
.L15:
	movl	-2800020(%rbp), %eax
	cltq
	movq	-800016(%rbp,%rax,8), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -2800020(%rbp)
.L14:
	movl	-2800040(%rbp), %eax
	cmpl	%eax, -2800020(%rbp)
	jl	.L15
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L17
	call	__stack_chk_fail@PLT
.L17:
	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:
