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

```c
G[9999],v[9999],i,a,b;main(N){for(;scanf("%d",&N)*N;printf("%d\n",b)){for(i=0;b=i<N*N;G[i++]=a+b*N)v[i]=-scanf("%d%d",&a,&b);for(;i--;b+=v[a]==i)for(a=i;v[a]<0;a=G[a])v[a]=i;}}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	G
	.bss
	.align 32
	.type	G, @object
	.size	G, 39996
G:
	.zero	39996
	.globl	v
	.align 32
	.type	v, @object
	.size	v, 39996
v:
	.zero	39996
	.globl	i
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.globl	a
	.align 4
	.type	a, @object
	.size	a, 4
a:
	.zero	4
	.globl	b
	.align 4
	.type	b, @object
	.size	b, 4
b:
	.zero	4
	.section	.rodata
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d\n"
.LC2:
	.string	"%d"
	.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
	subq	$16, %rsp
	movl	%edi, -4(%rbp)
	jmp	.L2
.L9:
	movl	$0, i(%rip)
	jmp	.L3
.L4:
	leaq	b(%rip), %rax
	movq	%rax, %rdx
	leaq	a(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movl	i(%rip), %edx
	negl	%eax
	movl	%eax, %ecx
	movslq	%edx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	v(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	b(%rip), %edx
	movl	-4(%rbp), %eax
	movl	%edx, %esi
	imull	%eax, %esi
	movl	a(%rip), %ecx
	movl	i(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, i(%rip)
	addl	%esi, %ecx
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	G(%rip), %rax
	movl	%ecx, (%rdx,%rax)
.L3:
	movl	-4(%rbp), %edx
	movl	-4(%rbp), %eax
	imull	%eax, %edx
	movl	i(%rip), %eax
	cmpl	%eax, %edx
	setg	%al
	movzbl	%al, %eax
	movl	%eax, b(%rip)
	movl	b(%rip), %eax
	testl	%eax, %eax
	jne	.L4
	jmp	.L5
.L8:
	movl	i(%rip), %eax
	movl	%eax, a(%rip)
	jmp	.L6
.L7:
	movl	a(%rip), %edx
	movl	i(%rip), %eax
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	v(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	a(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	G(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, a(%rip)
.L6:
	movl	a(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	v(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	js	.L7
	movl	a(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	v(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	i(%rip), %eax
	cmpl	%eax, %edx
	sete	%al
	movzbl	%al, %edx
	movl	b(%rip), %eax
	addl	%edx, %eax
	movl	%eax, b(%rip)
.L5:
	movl	i(%rip), %eax
	leal	-1(%rax), %edx
	movl	%edx, i(%rip)
	testl	%eax, %eax
	jne	.L8
	movl	b(%rip), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L2:
	leaq	-4(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movl	-4(%rbp), %edx
	imull	%edx, %eax
	testl	%eax, %eax
	jne	.L9
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```

Only output the optimized assembly code. Do not include any other text. Do not write any comments in the assembly code. Wrap the assembly code in ```assembly``` tags.
user
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d\n"
.LC2:
	.string	"%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB0:
	.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	-4+v(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	leaq	b(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	a(%rip), %rbx
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	leaq	12(%rsp), %rax
	movl	%edi, 12(%rsp)
	movq	%rax, (%rsp)
	.p2align 4,,10
	.p2align 3
.L2:
	movq	(%rsp), %rsi
	leaq	.LC2(%rip), %rdi
	xorl	%eax, %eax
	call	scanf@PLT
	movl	12(%rsp), %edx
	imull	%edx, %eax
	testl	%eax, %eax
	je	.L20
	movl	$0, i(%rip)
	imull	%edx, %edx
	xorl	%eax, %eax
	testl	%edx, %edx
	setg	%al
	movl	%eax, b(%rip)
	jle	.L3
	leaq	.LC0(%rip), %r15
	leaq	v(%rip), %r13
	leaq	G(%rip), %r14
	.p2align 4,,10
	.p2align 3
.L4:
	movq	%rbp, %rdx
	movq	%r15, %rdi
	xorl	%eax, %eax
	movq	%rbx, %rsi
	call	scanf@PLT
	movslq	i(%rip), %r10
	movl	b(%rip), %edi
	negl	%eax
	movl	%eax, 0(%r13,%r10,4)
	movl	%eax, %edx
	movl	12(%rsp), %eax
	leal	1(%r10), %r9d
	movl	%r9d, i(%rip)
	imull	%eax, %edi
	addl	a(%rip), %edi
	imull	%eax, %eax
	movl	%edi, (%r14,%r10,4)
	cmpl	%eax, %r9d
	setl	%al
	movzbl	%al, %eax
	movl	%eax, b(%rip)
	jl	.L4
	movl	%r10d, i(%rip)
	testl	%r9d, %r9d
	je	.L5
	movl	%r10d, %esi
	movq	%r10, %r11
	xorl	%r9d, %r9d
	movl	%r10d, %edi
	subq	%rsi, %r11
	testl	%edx, %edx
	jns	.L11
	.p2align 4,,10
	.p2align 3
.L21:
	movslq	%r10d, %rax
	.p2align 4,,10
	.p2align 3
.L7:
	movl	%edi, 0(%r13,%rax,4)
	movslq	(%r14,%rax,4), %rax
	movl	0(%r13,%rax,4), %edx
	movq	%rax, %rsi
	testl	%edx, %edx
	js	.L7
	xorl	%eax, %eax
	cmpl	%r10d, %edx
	sete	%al
	addl	%eax, %r9d
	cmpq	%r11, %r10
	je	.L8
.L22:
	movl	(%r12,%r10,4), %edx
	subq	$1, %r10
	movl	%r10d, %edi
	testl	%edx, %edx
	js	.L21
.L11:
	xorl	%eax, %eax
	cmpl	%r10d, %edx
	movl	%r10d, %esi
	sete	%al
	addl	%eax, %r9d
	cmpq	%r11, %r10
	jne	.L22
	.p2align 4,,10
	.p2align 3
.L8:
	movl	%esi, a(%rip)
	movl	%r9d, b(%rip)
	movl	$-1, i(%rip)
.L5:
	movl	%r9d, %esi
	leaq	.LC1(%rip), %rdi
	xorl	%eax, %eax
	call	printf@PLT
	jmp	.L2
.L20:
	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
.L3:
	.cfi_restore_state
	movl	$-1, i(%rip)
	xorl	%r9d, %r9d
	jmp	.L5
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	b
	.bss
	.align 4
	.type	b, @object
	.size	b, 4
b:
	.zero	4
	.globl	a
	.align 4
	.type	a, @object
	.size	a, 4
a:
	.zero	4
	.globl	i
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.globl	v
	.align 32
	.type	v, @object
	.size	v, 39996
v:
	.zero	39996
	.globl	G
	.align 32
	.type	G, @object
	.size	G, 39996
G:
	.zero	39996
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:

rule
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d\n"
.LC2:
	.string	"%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB0:
	.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	-4+v(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	leaq	b(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	a(%rip), %rbx
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	leaq	12(%rsp), %rax
	movl	%edi, 12(%rsp)
	movq	%rax, (%rsp)
	.p2align 4,,10
	.p2align 3
.L2:
	movq	(%rsp), %rsi
	leaq	.LC2(%rip), %rdi
	xorl	%eax, %eax
	call	scanf@PLT
	movl	12(%rsp), %edx
	imull	%edx, %eax
	testl	%eax, %eax
	je	.L20
	movl	$0, i(%rip)
	imull	%edx, %edx
	xorl	%eax, %eax
	testl	%edx, %edx
	setg	%al
	movl	%eax, b(%rip)
	jle	.L3
	leaq	.LC0(%rip), %r15
	leaq	v(%rip), %r13
	leaq	G(%rip), %r14
	.p2align 4,,10
	.p2align 3
.L4:
	movq	%rbp, %rdx
	movq	%r15, %rdi
	xorl	%eax, %eax
	movq	%rbx, %rsi
	call	scanf@PLT
	movslq	i(%rip), %r10
	movl	b(%rip), %edi
	negl	%eax
	movl	%eax, 0(%r13,%r10,4)
	movl	%eax, %edx
	movl	12(%rsp), %eax
	leal	1(%r10), %r9d
	movl	%r9d, i(%rip)
	imull	%eax, %edi
	addl	a(%rip), %edi
	imull	%eax, %eax
	movl	%edi, (%r14,%r10,4)
	cmpl	%eax, %r9d
	setl	%al
	movzbl	%al, %eax
	movl	%eax, b(%rip)
	jl	.L4
	movl	%r10d, i(%rip)
	testl	%r9d, %r9d
	je	.L5
	movl	%r10d, %esi
	movq	%r10, %r11
	xorl	%r9d, %r9d
	movl	%r10d, %edi
	subq	%rsi, %r11
	testl	%edx, %edx
	jns	.L11
	.p2align 4,,10
	.p2align 3
.L21:
	movslq	%r10d, %rax
	.p2align 4,,10
	.p2align 3
.L7:
	movl	%edi, 0(%r13,%rax,4)
	movslq	(%r14,%rax,4), %rax
	movl	0(%r13,%rax,4), %edx
	movq	%rax, %rsi
	testl	%edx, %edx
	js	.L7
	xorl	%eax, %eax
	cmpl	%r10d, %edx
	sete	%al
	addl	%eax, %r9d
	cmpq	%r11, %r10
	je	.L8
.L22:
	movl	(%r12,%r10,4), %edx
	subq	$1, %r10
	movl	%r10d, %edi
	testl	%edx, %edx
	js	.L21
.L11:
	xorl	%eax, %eax
	cmpl	%r10d, %edx
	movl	%r10d, %esi
	sete	%al
	addl	%eax, %r9d
	cmpq	%r11, %r10
	jne	.L22
	.p2align 4,,10
	.p2align 3
.L8:
	movl	%esi, a(%rip)
	movl	%r9d, b(%rip)
	movl	$-1, i(%rip)
.L5:
	movl	%r9d, %esi
	leaq	.LC1(%rip), %rdi
	xorl	%eax, %eax
	call	printf@PLT
	jmp	.L2
.L20:
	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
.L3:
	.cfi_restore_state
	movl	$-1, i(%rip)
	xorl	%r9d, %r9d
	jmp	.L5
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	b
	.bss
	.align 4
	.type	b, @object
	.size	b, 4
b:
	.zero	4
	.globl	a
	.align 4
	.type	a, @object
	.size	a, 4
a:
	.zero	4
	.globl	i
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.globl	v
	.align 32
	.type	v, @object
	.size	v, 39996
v:
	.zero	39996
	.globl	G
	.align 32
	.type	G, @object
	.size	G, 39996
G:
	.zero	39996
	.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:

G[9999],v[9999],i,a,b;main(N){for(;scanf("%d",&N)*N;printf("%d\n",b)){for(i=0;b=i<N*N;G[i++]=a+b*N)v[i]=-scanf("%d%d",&a,&b);for(;i--;b+=v[a]==i)for(a=i;v[a]<0;a=G[a])v[a]=i;}}
1
0 0
2
1 1 0 1
1 0 0 0
2
1 1 0 1
1 1 1 0
3
0 1 2 2 2 0
0 2 1 2 2 1
0 0 0 1 1 1
4
3 2 2 0 3 2 2 1
1 1 0 3 1 1 3 1
0 3 2 3 3 0 2 3
1 1 1 1 3 2 1 3
0
 1
0 0
2
1 1 0 1
1 0 0 0
2
1 1 0 1
1 1 1 0
3
0 1 2 2 2 0
0 2 1 2 2 1
0 0 0 1 1 0
4
3 2 2 0 3 2 2 1
1 1 0 3 1 1 3 1
0 3 2 3 3 0 2 3
1 1 1 1 3 2 1 3
0
 1
0 0
2
1 1 0 1
1 0 0 0
2
1 1 0 1
1 1 1 0
3
0 1 2 2 2 2
0 2 1 2 2 1
0 0 0 1 1 0
4
3 2 2 0 3 2 2 1
1 1 0 3 1 1 3 0
0 3 2 3 3 0 2 3
1 1 1 1 3 2 1 3
0
 1
0 0
2
1 1 0 1
1 1 0 0
2
1 1 0 1
1 1 1 0
3
0 1 2 2 2 1
0 2 1 2 2 1
0 0 0 1 1 1
4
3 2 2 0 3 2 2 1
1 1 0 3 1 1 3 1
0 3 2 3 3 0 2 3
1 1 1 1 3 2 1 3
0
 1
0 0
2
1 1 0 1
1 0 0 0
2
1 1 0 1
1 1 1 0
3
0 1 2 2 2 2
0 2 1 2 2 1
0 0 0 1 1 1
4
3 2 2 0 3 2 2 1
1 1 0 3 1 1 3 0
0 3 2 3 3 0 2 3
1 1 1 1 3 2 1 3
0
 1
0 0
2
1 1 0 1
0 0 0 0
2
1 1 0 1
1 1 1 0
3
0 1 2 2 2 2
0 2 1 2 2 1
0 0 0 1 1 0
4
3 2 2 0 3 2 2 1
1 1 0 3 1 2 3 0
0 3 2 3 3 0 2 3
1 1 1 1 3 2 1 3
0
 1
0 0
0
1 1 0 1
1 0 0 0
2
1 1 0 1
1 1 1 0
3
0 1 2 2 2 0
0 2 1 2 2 1
0 1 0 1 1 0
4
3 2 2 0 3 2 2 1
1 2 0 3 1 1 3 1
0 3 2 3 3 0 2 3
1 1 1 1 3 2 1 3
0
 1
0 0
2
1 1 0 1
1 0 0 0
2
1 1 0 1
1 1 1 0
3
0 1 2 2 2 2
0 2 1 2 2 1
0 0 0 1 1 0
4
3 2 2 0 3 2 2 1
1 1 0 3 1 2 3 0
0 3 1 3 3 0 3 3
1 1 1 1 3 2 1 3
0
 1
0 0
2
1 1 1 1
1 0 0 0
2
1 1 0 1
1 1 1 0
3
0 1 2 2 2 0
0 2 1 2 2 1
0 0 0 1 1 0
4
3 2 2 0 3 2 2 1
1 1 0 3 1 1 3 1
0 3 2 3 3 0 2 3
1 1 0 1 3 2 1 3
0
 1
0 0
2
1 1 1 1
1 0 0 0
2
1 1 0 1
1 1 1 0
3
0 1 2 2 2 0
0 2 1 2 2 1
0 0 0 1 1 0
4
3 2 2 0 3 2 2 1
1 1 0 3 1 1 3 1
0 3 2 3 1 0 0 3
1 1 0 2 3 2 1 3
0

1
2
1
3
3
 1
2
1
4
3
 1
2
1
3
2
 1
1
1
2
3
 1
2
1
2
2
 1
1
1
3
2
 1
 1
2
1
3
1
 1
1
1
4
3
 1
1
1
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
G[9999],v[9999],i,a,b;main(N){for(;scanf("%d",&N)*N;printf("%d\n",b)){for(i=0;b=i<N*N;G[i++]=a+b*N)v[i]=-scanf("%d%d",&a,&b);for(;i--;b+=v[a]==i)for(a=i;v[a]<0;a=G[a])v[a]=i;}}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	G
	.bss
	.align 32
	.type	G, @object
	.size	G, 39996
G:
	.zero	39996
	.globl	v
	.align 32
	.type	v, @object
	.size	v, 39996
v:
	.zero	39996
	.globl	i
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.globl	a
	.align 4
	.type	a, @object
	.size	a, 4
a:
	.zero	4
	.globl	b
	.align 4
	.type	b, @object
	.size	b, 4
b:
	.zero	4
	.section	.rodata
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d\n"
.LC2:
	.string	"%d"
	.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
	subq	$16, %rsp
	movl	%edi, -4(%rbp)
	jmp	.L2
.L9:
	movl	$0, i(%rip)
	jmp	.L3
.L4:
	leaq	b(%rip), %rax
	movq	%rax, %rdx
	leaq	a(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movl	i(%rip), %edx
	negl	%eax
	movl	%eax, %ecx
	movslq	%edx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	v(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	b(%rip), %edx
	movl	-4(%rbp), %eax
	movl	%edx, %esi
	imull	%eax, %esi
	movl	a(%rip), %ecx
	movl	i(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, i(%rip)
	addl	%esi, %ecx
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	G(%rip), %rax
	movl	%ecx, (%rdx,%rax)
.L3:
	movl	-4(%rbp), %edx
	movl	-4(%rbp), %eax
	imull	%eax, %edx
	movl	i(%rip), %eax
	cmpl	%eax, %edx
	setg	%al
	movzbl	%al, %eax
	movl	%eax, b(%rip)
	movl	b(%rip), %eax
	testl	%eax, %eax
	jne	.L4
	jmp	.L5
.L8:
	movl	i(%rip), %eax
	movl	%eax, a(%rip)
	jmp	.L6
.L7:
	movl	a(%rip), %edx
	movl	i(%rip), %eax
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	v(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	a(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	G(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, a(%rip)
.L6:
	movl	a(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	v(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	js	.L7
	movl	a(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	v(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	i(%rip), %eax
	cmpl	%eax, %edx
	sete	%al
	movzbl	%al, %edx
	movl	b(%rip), %eax
	addl	%edx, %eax
	movl	%eax, b(%rip)
.L5:
	movl	i(%rip), %eax
	leal	-1(%rax), %edx
	movl	%edx, i(%rip)
	testl	%eax, %eax
	jne	.L8
	movl	b(%rip), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L2:
	leaq	-4(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movl	-4(%rbp), %edx
	imull	%edx, %eax
	testl	%eax, %eax
	jne	.L9
	movl	$0, %eax
	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
	.globl	G
	.bss
	.align 32
	.type	G, @object
	.size	G, 39996
G:
	.zero	39996
	.globl	v
	.align 32
	.type	v, @object
	.size	v, 39996
v:
	.zero	39996
	.globl	i
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.globl	a
	.align 4
	.type	a, @object
	.size	a, 4
a:
	.zero	4
	.globl	b
	.align 4
	.type	b, @object
	.size	b, 4
b:
	.zero	4
	.section	.rodata
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d\n"
.LC2:
	.string	"%d"
	.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
	subq	$16, %rsp
	movl	%edi, -4(%rbp)
	jmp	.L2
.L9:
	movl	$0, i(%rip)
	jmp	.L3
.L4:
	leaq	b(%rip), %rax
	movq	%rax, %rdx
	leaq	a(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movl	i(%rip), %edx
	negl	%eax
	movl	%eax, %ecx
	movslq	%edx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	v(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	b(%rip), %edx
	movl	-4(%rbp), %eax
	movl	%edx, %esi
	imull	%eax, %esi
	movl	a(%rip), %ecx
	movl	i(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, i(%rip)
	addl	%esi, %ecx
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	G(%rip), %rax
	movl	%ecx, (%rdx,%rax)
.L3:
	movl	-4(%rbp), %edx
	movl	-4(%rbp), %eax
	imull	%eax, %edx
	movl	i(%rip), %eax
	cmpl	%eax, %edx
	setg	%al
	movzbl	%al, %eax
	movl	%eax, b(%rip)
	movl	b(%rip), %eax
	testl	%eax, %eax
	jne	.L4
	jmp	.L5
.L8:
	movl	i(%rip), %eax
	movl	%eax, a(%rip)
	jmp	.L6
.L7:
	movl	a(%rip), %edx
	movl	i(%rip), %eax
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	v(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	a(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	G(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, a(%rip)
.L6:
	movl	a(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	v(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	js	.L7
	movl	a(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	v(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	i(%rip), %eax
	cmpl	%eax, %edx
	sete	%al
	movzbl	%al, %edx
	movl	b(%rip), %eax
	addl	%edx, %eax
	movl	%eax, b(%rip)
.L5:
	movl	i(%rip), %eax
	leal	-1(%rax), %edx
	movl	%edx, i(%rip)
	testl	%eax, %eax
	jne	.L8
	movl	b(%rip), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L2:
	leaq	-4(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movl	-4(%rbp), %edx
	imull	%edx, %eax
	testl	%eax, %eax
	jne	.L9
	movl	$0, %eax
	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:
