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>
#include<stdlib.h>

int connect[100000];

int topreturn(int n){
	while(connect[n]!=n){
		n=connect[n];
	}
	return n;
}

int main(void){
	int n,m,x,y,i,tmp;
	int p[100000];
	int j;

	scanf("%d %d",&n,&m);

	for(i=0;i<n;i++){
		scanf("%d",&p[i]);
		connect[i]=i;
	}

	for(i=0;i<m;i++){
		scanf("%d %d",&x,&y);
		x=topreturn(x-1);
		y=topreturn(y-1);
		if(x>y){tmp=x; x=y; y=tmp;}
		connect[y]=connect[x];
	}

	tmp=0;
	for(i=0;i<n;i++){
		if(topreturn(i)==topreturn(p[i]-1)){
			tmp++;
		}
	}
	printf("%d\n",tmp);

	return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	connect
	.bss
	.align 32
	.type	connect, @object
	.size	connect, 400000
connect:
	.zero	400000
	.text
	.globl	topreturn
	.type	topreturn, @function
topreturn:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -4(%rbp)
	jmp	.L2
.L3:
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	connect(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -4(%rbp)
.L2:
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	connect(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -4(%rbp)
	jne	.L3
	movl	-4(%rbp), %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	topreturn, .-topreturn
	.section	.rodata
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%rbx
	leaq	-397312(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$2744, %rsp
	.cfi_offset 3, -24
	movq	%fs:40, %rax
	movq	%rax, -24(%rbp)
	xorl	%eax, %eax
	leaq	-400052(%rbp), %rdx
	leaq	-400056(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -400040(%rbp)
	jmp	.L6
.L7:
	leaq	-400032(%rbp), %rdx
	movl	-400040(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-400040(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	connect(%rip), %rdx
	movl	-400040(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	addl	$1, -400040(%rbp)
.L6:
	movl	-400056(%rbp), %eax
	cmpl	%eax, -400040(%rbp)
	jl	.L7
	movl	$0, -400040(%rbp)
	jmp	.L8
.L10:
	leaq	-400044(%rbp), %rdx
	leaq	-400048(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-400048(%rbp), %eax
	subl	$1, %eax
	movl	%eax, %edi
	call	topreturn
	movl	%eax, -400048(%rbp)
	movl	-400044(%rbp), %eax
	subl	$1, %eax
	movl	%eax, %edi
	call	topreturn
	movl	%eax, -400044(%rbp)
	movl	-400048(%rbp), %edx
	movl	-400044(%rbp), %eax
	cmpl	%eax, %edx
	jle	.L9
	movl	-400048(%rbp), %eax
	movl	%eax, -400036(%rbp)
	movl	-400044(%rbp), %eax
	movl	%eax, -400048(%rbp)
	movl	-400036(%rbp), %eax
	movl	%eax, -400044(%rbp)
.L9:
	movl	-400048(%rbp), %eax
	movl	-400044(%rbp), %edx
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	connect(%rip), %rax
	movl	(%rcx,%rax), %eax
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	connect(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	addl	$1, -400040(%rbp)
.L8:
	movl	-400052(%rbp), %eax
	cmpl	%eax, -400040(%rbp)
	jl	.L10
	movl	$0, -400036(%rbp)
	movl	$0, -400040(%rbp)
	jmp	.L11
.L13:
	movl	-400040(%rbp), %eax
	movl	%eax, %edi
	call	topreturn
	movl	%eax, %ebx
	movl	-400040(%rbp), %eax
	cltq
	movl	-400032(%rbp,%rax,4), %eax
	subl	$1, %eax
	movl	%eax, %edi
	call	topreturn
	cmpl	%eax, %ebx
	jne	.L12
	addl	$1, -400036(%rbp)
.L12:
	addl	$1, -400040(%rbp)
.L11:
	movl	-400056(%rbp), %eax
	cmpl	%eax, -400040(%rbp)
	jl	.L13
	movl	-400036(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-24(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L15
	call	__stack_chk_fail@PLT
.L15:
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.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	topreturn
	.type	topreturn, @function
topreturn:
.LFB39:
	.cfi_startproc
	endbr64
	movl	%edi, %eax
	leaq	connect(%rip), %rcx
	.p2align 4,,10
	.p2align 3
.L2:
	cltq
	movq	%rax, %rdx
	movl	(%rcx,%rax,4), %eax
	cmpl	%edx, %eax
	jne	.L2
	ret
	.cfi_endproc
.LFE39:
	.size	topreturn, .-topreturn
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB40:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	leaq	-397312(%rsp), %r11
	.cfi_def_cfa 11, 397360
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$2720, %rsp
	.cfi_def_cfa_offset 400080
	leaq	.LC0(%rip), %rbp
	movq	%rbp, %rdi
	movq	%fs:40, %rax
	movq	%rax, 400024(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rdx
	movq	%rsp, %rsi
	call	__isoc99_scanf@PLT
	movl	(%rsp), %edx
	testl	%edx, %edx
	jle	.L6
	xorl	%r12d, %r12d
	leaq	16(%rsp), %r13
	leaq	.LC1(%rip), %r14
	leaq	connect(%rip), %rbx
	.p2align 4,,10
	.p2align 3
.L7:
	leaq	0(%r13,%r12,4), %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	%r12d, (%rbx,%r12,4)
	addq	$1, %r12
	cmpl	%r12d, (%rsp)
	jg	.L7
	movl	4(%rsp), %eax
	testl	%eax, %eax
	jle	.L15
.L8:
	xorl	%r14d, %r14d
	leaq	12(%rsp), %r13
	leaq	8(%rsp), %r12
	.p2align 4,,10
	.p2align 3
.L16:
	movq	%r13, %rdx
	movq	%r12, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	8(%rsp), %eax
	leal	-1(%rax), %edx
	.p2align 4,,10
	.p2align 3
.L11:
	movslq	%edx, %rax
	movl	(%rbx,%rax,4), %edx
	movq	%rax, %rcx
	cmpl	%edx, %eax
	jne	.L11
	movl	12(%rsp), %eax
	movl	%edx, 8(%rsp)
	subl	$1, %eax
	.p2align 4,,10
	.p2align 3
.L12:
	cltq
	movq	%rax, %rsi
	movslq	(%rbx,%rax,4), %rax
	cmpl	%eax, %esi
	jne	.L12
	movl	%eax, 12(%rsp)
	cmpl	%ecx, %eax
	jge	.L13
	movl	%eax, 8(%rsp)
	addl	$1, %r14d
	movl	%ecx, 12(%rsp)
	movl	%eax, (%rbx,%rcx,4)
	cmpl	4(%rsp), %r14d
	jl	.L16
.L15:
	movslq	(%rsp), %rdi
	xorl	%esi, %esi
	xorl	%r8d, %r8d
	leaq	16(%rsp), %r13
	testl	%edi, %edi
	jle	.L10
	.p2align 4,,10
	.p2align 3
.L21:
	movl	%esi, %eax
	.p2align 4,,10
	.p2align 3
.L18:
	cltq
	movq	%rax, %rdx
	movl	(%rbx,%rax,4), %eax
	cmpl	%eax, %edx
	jne	.L18
	movl	0(%r13,%rsi,4), %eax
	subl	$1, %eax
	.p2align 4,,10
	.p2align 3
.L19:
	cltq
	movq	%rax, %rcx
	movl	(%rbx,%rax,4), %eax
	cmpl	%eax, %ecx
	jne	.L19
	cmpl	%edx, %eax
	sete	%al
	addq	$1, %rsi
	movzbl	%al, %eax
	addl	%eax, %r8d
	cmpq	%rsi, %rdi
	jne	.L21
.L17:
	xorl	%eax, %eax
	movl	%r8d, %edx
	movl	$1, %edi
	leaq	.LC2(%rip), %rsi
	call	__printf_chk@PLT
	movq	400024(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L32
	addq	$400032, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 48
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L13:
	.cfi_restore_state
	movl	%edx, (%rbx,%rax,4)
	addl	$1, %r14d
	cmpl	%r14d, 4(%rsp)
	jg	.L16
	jmp	.L15
.L6:
	cmpl	$0, 4(%rsp)
	leaq	connect(%rip), %rbx
	jg	.L8
.L10:
	xorl	%r8d, %r8d
	jmp	.L17
.L32:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE40:
	.size	main, .-main
	.globl	connect
	.bss
	.align 32
	.type	connect, @object
	.size	connect, 400000
connect:
	.zero	400000
	.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	topreturn
	.type	topreturn, @function
topreturn:
.LFB39:
	.cfi_startproc
	endbr64
	movl	%edi, %eax
	leaq	connect(%rip), %rcx
	.p2align 4,,10
	.p2align 3
.L2:
	cltq
	movq	%rax, %rdx
	movl	(%rcx,%rax,4), %eax
	cmpl	%edx, %eax
	jne	.L2
	ret
	.cfi_endproc
.LFE39:
	.size	topreturn, .-topreturn
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB40:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	leaq	-397312(%rsp), %r11
	.cfi_def_cfa 11, 397360
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$2720, %rsp
	.cfi_def_cfa_offset 400080
	leaq	.LC0(%rip), %rbp
	movq	%rbp, %rdi
	movq	%fs:40, %rax
	movq	%rax, 400024(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rdx
	movq	%rsp, %rsi
	call	__isoc99_scanf@PLT
	movl	(%rsp), %edx
	testl	%edx, %edx
	jle	.L6
	xorl	%r12d, %r12d
	leaq	16(%rsp), %r13
	leaq	.LC1(%rip), %r14
	leaq	connect(%rip), %rbx
	.p2align 4,,10
	.p2align 3
.L7:
	leaq	0(%r13,%r12,4), %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	%r12d, (%rbx,%r12,4)
	addq	$1, %r12
	cmpl	%r12d, (%rsp)
	jg	.L7
	movl	4(%rsp), %eax
	testl	%eax, %eax
	jle	.L15
.L8:
	xorl	%r14d, %r14d
	leaq	12(%rsp), %r13
	leaq	8(%rsp), %r12
	.p2align 4,,10
	.p2align 3
.L16:
	movq	%r13, %rdx
	movq	%r12, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	8(%rsp), %eax
	leal	-1(%rax), %edx
	.p2align 4,,10
	.p2align 3
.L11:
	movslq	%edx, %rax
	movl	(%rbx,%rax,4), %edx
	movq	%rax, %rcx
	cmpl	%edx, %eax
	jne	.L11
	movl	12(%rsp), %eax
	movl	%edx, 8(%rsp)
	subl	$1, %eax
	.p2align 4,,10
	.p2align 3
.L12:
	cltq
	movq	%rax, %rsi
	movslq	(%rbx,%rax,4), %rax
	cmpl	%eax, %esi
	jne	.L12
	movl	%eax, 12(%rsp)
	cmpl	%ecx, %eax
	jge	.L13
	movl	%eax, 8(%rsp)
	addl	$1, %r14d
	movl	%ecx, 12(%rsp)
	movl	%eax, (%rbx,%rcx,4)
	cmpl	4(%rsp), %r14d
	jl	.L16
.L15:
	movslq	(%rsp), %rdi
	xorl	%esi, %esi
	xorl	%r8d, %r8d
	leaq	16(%rsp), %r13
	testl	%edi, %edi
	jle	.L10
	.p2align 4,,10
	.p2align 3
.L21:
	movl	%esi, %eax
	.p2align 4,,10
	.p2align 3
.L18:
	cltq
	movq	%rax, %rdx
	movl	(%rbx,%rax,4), %eax
	cmpl	%eax, %edx
	jne	.L18
	movl	0(%r13,%rsi,4), %eax
	subl	$1, %eax
	.p2align 4,,10
	.p2align 3
.L19:
	cltq
	movq	%rax, %rcx
	movl	(%rbx,%rax,4), %eax
	cmpl	%eax, %ecx
	jne	.L19
	cmpl	%edx, %eax
	sete	%al
	addq	$1, %rsi
	movzbl	%al, %eax
	addl	%eax, %r8d
	cmpq	%rsi, %rdi
	jne	.L21
.L17:
	xorl	%eax, %eax
	movl	%r8d, %edx
	movl	$1, %edi
	leaq	.LC2(%rip), %rsi
	call	__printf_chk@PLT
	movq	400024(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L32
	addq	$400032, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 48
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L13:
	.cfi_restore_state
	movl	%edx, (%rbx,%rax,4)
	addl	$1, %r14d
	cmpl	%r14d, 4(%rsp)
	jg	.L16
	jmp	.L15
.L6:
	cmpl	$0, 4(%rsp)
	leaq	connect(%rip), %rbx
	jg	.L8
.L10:
	xorl	%r8d, %r8d
	jmp	.L17
.L32:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE40:
	.size	main, .-main
	.globl	connect
	.bss
	.align 32
	.type	connect, @object
	.size	connect, 400000
connect:
	.zero	400000
	.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>
#include<stdlib.h>

int connect[100000];

int topreturn(int n){
	while(connect[n]!=n){
		n=connect[n];
	}
	return n;
}

int main(void){
	int n,m,x,y,i,tmp;
	int p[100000];
	int j;

	scanf("%d %d",&n,&m);

	for(i=0;i<n;i++){
		scanf("%d",&p[i]);
		connect[i]=i;
	}

	for(i=0;i<m;i++){
		scanf("%d %d",&x,&y);
		x=topreturn(x-1);
		y=topreturn(y-1);
		if(x>y){tmp=x; x=y; y=tmp;}
		connect[y]=connect[x];
	}

	tmp=0;
	for(i=0;i<n;i++){
		if(topreturn(i)==topreturn(p[i]-1)){
			tmp++;
		}
	}
	printf("%d\n",tmp);

	return 0;
}

5 2
5 3 1 4 2
1 3
5 4

2

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>
#include<stdlib.h>

int connect[100000];

int topreturn(int n){
	while(connect[n]!=n){
		n=connect[n];
	}
	return n;
}

int main(void){
	int n,m,x,y,i,tmp;
	int p[100000];
	int j;

	scanf("%d %d",&n,&m);

	for(i=0;i<n;i++){
		scanf("%d",&p[i]);
		connect[i]=i;
	}

	for(i=0;i<m;i++){
		scanf("%d %d",&x,&y);
		x=topreturn(x-1);
		y=topreturn(y-1);
		if(x>y){tmp=x; x=y; y=tmp;}
		connect[y]=connect[x];
	}

	tmp=0;
	for(i=0;i<n;i++){
		if(topreturn(i)==topreturn(p[i]-1)){
			tmp++;
		}
	}
	printf("%d\n",tmp);

	return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	connect
	.bss
	.align 32
	.type	connect, @object
	.size	connect, 400000
connect:
	.zero	400000
	.text
	.globl	topreturn
	.type	topreturn, @function
topreturn:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -4(%rbp)
	jmp	.L2
.L3:
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	connect(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -4(%rbp)
.L2:
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	connect(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -4(%rbp)
	jne	.L3
	movl	-4(%rbp), %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	topreturn, .-topreturn
	.section	.rodata
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%rbx
	leaq	-397312(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$2744, %rsp
	.cfi_offset 3, -24
	movq	%fs:40, %rax
	movq	%rax, -24(%rbp)
	xorl	%eax, %eax
	leaq	-400052(%rbp), %rdx
	leaq	-400056(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -400040(%rbp)
	jmp	.L6
.L7:
	leaq	-400032(%rbp), %rdx
	movl	-400040(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-400040(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	connect(%rip), %rdx
	movl	-400040(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	addl	$1, -400040(%rbp)
.L6:
	movl	-400056(%rbp), %eax
	cmpl	%eax, -400040(%rbp)
	jl	.L7
	movl	$0, -400040(%rbp)
	jmp	.L8
.L10:
	leaq	-400044(%rbp), %rdx
	leaq	-400048(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-400048(%rbp), %eax
	subl	$1, %eax
	movl	%eax, %edi
	call	topreturn
	movl	%eax, -400048(%rbp)
	movl	-400044(%rbp), %eax
	subl	$1, %eax
	movl	%eax, %edi
	call	topreturn
	movl	%eax, -400044(%rbp)
	movl	-400048(%rbp), %edx
	movl	-400044(%rbp), %eax
	cmpl	%eax, %edx
	jle	.L9
	movl	-400048(%rbp), %eax
	movl	%eax, -400036(%rbp)
	movl	-400044(%rbp), %eax
	movl	%eax, -400048(%rbp)
	movl	-400036(%rbp), %eax
	movl	%eax, -400044(%rbp)
.L9:
	movl	-400048(%rbp), %eax
	movl	-400044(%rbp), %edx
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	connect(%rip), %rax
	movl	(%rcx,%rax), %eax
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	connect(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	addl	$1, -400040(%rbp)
.L8:
	movl	-400052(%rbp), %eax
	cmpl	%eax, -400040(%rbp)
	jl	.L10
	movl	$0, -400036(%rbp)
	movl	$0, -400040(%rbp)
	jmp	.L11
.L13:
	movl	-400040(%rbp), %eax
	movl	%eax, %edi
	call	topreturn
	movl	%eax, %ebx
	movl	-400040(%rbp), %eax
	cltq
	movl	-400032(%rbp,%rax,4), %eax
	subl	$1, %eax
	movl	%eax, %edi
	call	topreturn
	cmpl	%eax, %ebx
	jne	.L12
	addl	$1, -400036(%rbp)
.L12:
	addl	$1, -400040(%rbp)
.L11:
	movl	-400056(%rbp), %eax
	cmpl	%eax, -400040(%rbp)
	jl	.L13
	movl	-400036(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-24(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L15
	call	__stack_chk_fail@PLT
.L15:
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.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	connect
	.bss
	.align 32
	.type	connect, @object
	.size	connect, 400000
connect:
	.zero	400000
	.text
	.globl	topreturn
	.type	topreturn, @function
topreturn:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -4(%rbp)
	jmp	.L2
.L3:
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	connect(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -4(%rbp)
.L2:
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	connect(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -4(%rbp)
	jne	.L3
	movl	-4(%rbp), %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	topreturn, .-topreturn
	.section	.rodata
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%rbx
	leaq	-397312(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$2744, %rsp
	.cfi_offset 3, -24
	movq	%fs:40, %rax
	movq	%rax, -24(%rbp)
	xorl	%eax, %eax
	leaq	-400052(%rbp), %rdx
	leaq	-400056(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -400040(%rbp)
	jmp	.L6
.L7:
	leaq	-400032(%rbp), %rdx
	movl	-400040(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-400040(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	connect(%rip), %rdx
	movl	-400040(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	addl	$1, -400040(%rbp)
.L6:
	movl	-400056(%rbp), %eax
	cmpl	%eax, -400040(%rbp)
	jl	.L7
	movl	$0, -400040(%rbp)
	jmp	.L8
.L10:
	leaq	-400044(%rbp), %rdx
	leaq	-400048(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-400048(%rbp), %eax
	subl	$1, %eax
	movl	%eax, %edi
	call	topreturn
	movl	%eax, -400048(%rbp)
	movl	-400044(%rbp), %eax
	subl	$1, %eax
	movl	%eax, %edi
	call	topreturn
	movl	%eax, -400044(%rbp)
	movl	-400048(%rbp), %edx
	movl	-400044(%rbp), %eax
	cmpl	%eax, %edx
	jle	.L9
	movl	-400048(%rbp), %eax
	movl	%eax, -400036(%rbp)
	movl	-400044(%rbp), %eax
	movl	%eax, -400048(%rbp)
	movl	-400036(%rbp), %eax
	movl	%eax, -400044(%rbp)
.L9:
	movl	-400048(%rbp), %eax
	movl	-400044(%rbp), %edx
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	connect(%rip), %rax
	movl	(%rcx,%rax), %eax
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	connect(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	addl	$1, -400040(%rbp)
.L8:
	movl	-400052(%rbp), %eax
	cmpl	%eax, -400040(%rbp)
	jl	.L10
	movl	$0, -400036(%rbp)
	movl	$0, -400040(%rbp)
	jmp	.L11
.L13:
	movl	-400040(%rbp), %eax
	movl	%eax, %edi
	call	topreturn
	movl	%eax, %ebx
	movl	-400040(%rbp), %eax
	cltq
	movl	-400032(%rbp,%rax,4), %eax
	subl	$1, %eax
	movl	%eax, %edi
	call	topreturn
	cmpl	%eax, %ebx
	jne	.L12
	addl	$1, -400036(%rbp)
.L12:
	addl	$1, -400040(%rbp)
.L11:
	movl	-400056(%rbp), %eax
	cmpl	%eax, -400040(%rbp)
	jl	.L13
	movl	-400036(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-24(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L15
	call	__stack_chk_fail@PLT
.L15:
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.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:
