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>

int main()
{
  int aa[4][2]={{-1,0},{0,-1},{1,0},{0,1}};
  int seihou[200][2],an[100][2],i,n,m=0,ten,muki;
  int minx=0,maxx=0,miny=0,maxy=0;
  while(1){
    scanf("%d",&n);
    if(n==0)break;
    seihou[0][0]=0;
    seihou[0][1]=0;
    for(i=1;i<n;i++){
      scanf("%d%d",&ten,&muki);
      seihou[i][0]=seihou[ten][0]+aa[muki][0];
      seihou[i][1]=seihou[ten][1]+aa[muki][1];
    }
    for(i=0;i<n;i++){
      if(minx>seihou[i][0])minx=seihou[i][0];
      else if(maxx<seihou[i][0])maxx=seihou[i][0];
      else if(miny>seihou[i][1])miny=seihou[i][1];
      else if(maxy<seihou[i][1])maxy=seihou[i][1];
    }
    an[m][0]=maxx-minx+1;
    an[m][1]=maxy-miny+1;
    m++;
    maxx=0;minx=0,miny=0,maxy=0;
  }
  for(i=0;i<m;i++){
    printf("%d %d\n",an[i][0],an[i][1]);
  }
  return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d%d"
.LC2:
	.string	"%d %d\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
	subq	$2496, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$-1, -2448(%rbp)
	movl	$0, -2444(%rbp)
	movl	$0, -2440(%rbp)
	movl	$-1, -2436(%rbp)
	movl	$1, -2432(%rbp)
	movl	$0, -2428(%rbp)
	movl	$0, -2424(%rbp)
	movl	$1, -2420(%rbp)
	movl	$0, -2468(%rbp)
	movl	$0, -2464(%rbp)
	movl	$0, -2460(%rbp)
	movl	$0, -2456(%rbp)
	movl	$0, -2452(%rbp)
.L12:
	leaq	-2484(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-2484(%rbp), %eax
	testl	%eax, %eax
	je	.L18
	movl	$0, -1616(%rbp)
	movl	$0, -1612(%rbp)
	movl	$1, -2472(%rbp)
	jmp	.L4
.L5:
	leaq	-2476(%rbp), %rdx
	leaq	-2480(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-2480(%rbp), %eax
	cltq
	movl	-1616(%rbp,%rax,8), %edx
	movl	-2476(%rbp), %eax
	cltq
	movl	-2448(%rbp,%rax,8), %eax
	addl	%eax, %edx
	movl	-2472(%rbp), %eax
	cltq
	movl	%edx, -1616(%rbp,%rax,8)
	movl	-2480(%rbp), %eax
	cltq
	movl	-1612(%rbp,%rax,8), %edx
	movl	-2476(%rbp), %eax
	cltq
	movl	-2444(%rbp,%rax,8), %eax
	addl	%eax, %edx
	movl	-2472(%rbp), %eax
	cltq
	movl	%edx, -1612(%rbp,%rax,8)
	addl	$1, -2472(%rbp)
.L4:
	movl	-2484(%rbp), %eax
	cmpl	%eax, -2472(%rbp)
	jl	.L5
	movl	$0, -2472(%rbp)
	jmp	.L6
.L11:
	movl	-2472(%rbp), %eax
	cltq
	movl	-1616(%rbp,%rax,8), %eax
	cmpl	%eax, -2464(%rbp)
	jle	.L7
	movl	-2472(%rbp), %eax
	cltq
	movl	-1616(%rbp,%rax,8), %eax
	movl	%eax, -2464(%rbp)
	jmp	.L8
.L7:
	movl	-2472(%rbp), %eax
	cltq
	movl	-1616(%rbp,%rax,8), %eax
	cmpl	%eax, -2460(%rbp)
	jge	.L9
	movl	-2472(%rbp), %eax
	cltq
	movl	-1616(%rbp,%rax,8), %eax
	movl	%eax, -2460(%rbp)
	jmp	.L8
.L9:
	movl	-2472(%rbp), %eax
	cltq
	movl	-1612(%rbp,%rax,8), %eax
	cmpl	%eax, -2456(%rbp)
	jle	.L10
	movl	-2472(%rbp), %eax
	cltq
	movl	-1612(%rbp,%rax,8), %eax
	movl	%eax, -2456(%rbp)
	jmp	.L8
.L10:
	movl	-2472(%rbp), %eax
	cltq
	movl	-1612(%rbp,%rax,8), %eax
	cmpl	%eax, -2452(%rbp)
	jge	.L8
	movl	-2472(%rbp), %eax
	cltq
	movl	-1612(%rbp,%rax,8), %eax
	movl	%eax, -2452(%rbp)
.L8:
	addl	$1, -2472(%rbp)
.L6:
	movl	-2484(%rbp), %eax
	cmpl	%eax, -2472(%rbp)
	jl	.L11
	movl	-2460(%rbp), %eax
	subl	-2464(%rbp), %eax
	leal	1(%rax), %edx
	movl	-2468(%rbp), %eax
	cltq
	movl	%edx, -2416(%rbp,%rax,8)
	movl	-2452(%rbp), %eax
	subl	-2456(%rbp), %eax
	leal	1(%rax), %edx
	movl	-2468(%rbp), %eax
	cltq
	movl	%edx, -2412(%rbp,%rax,8)
	addl	$1, -2468(%rbp)
	movl	$0, -2460(%rbp)
	movl	$0, -2464(%rbp)
	movl	$0, -2456(%rbp)
	movl	$0, -2452(%rbp)
	jmp	.L12
.L18:
	nop
	movl	$0, -2472(%rbp)
	jmp	.L13
.L14:
	movl	-2472(%rbp), %eax
	cltq
	movl	-2412(%rbp,%rax,8), %edx
	movl	-2472(%rbp), %eax
	cltq
	movl	-2416(%rbp,%rax,8), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -2472(%rbp)
.L13:
	movl	-2472(%rbp), %eax
	cmpl	-2468(%rbp), %eax
	jl	.L14
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L16
	call	__stack_chk_fail@PLT
.L16:
	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
.LC2:
	.string	"%d"
.LC3:
	.string	"%d%d"
.LC4:
	.string	"%d %d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	leaq	.LC3(%rip), %r13
	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	$2504, %rsp
	.cfi_def_cfa_offset 2560
	movdqa	.LC0(%rip), %xmm0
	movq	%fs:40, %rax
	movq	%rax, 2488(%rsp)
	xorl	%eax, %eax
	leaq	80(%rsp), %rax
	movl	$0, 20(%rsp)
	movq	%rax, (%rsp)
	movq	%rax, 8(%rsp)
	leaq	36(%rsp), %rax
	movaps	%xmm0, 48(%rsp)
	movdqa	.LC1(%rip), %xmm0
	movq	%rax, 24(%rsp)
	movaps	%xmm0, 64(%rsp)
	.p2align 4,,10
	.p2align 3
.L9:
	movq	24(%rsp), %rsi
	leaq	.LC2(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	36(%rsp), %edx
	testl	%edx, %edx
	je	.L23
	movq	$0, 880(%rsp)
	cmpl	$1, %edx
	jle	.L4
	movl	$1, %r15d
	leaq	44(%rsp), %r12
	leaq	40(%rsp), %rbp
	leaq	880(%rsp), %r14
	leaq	48(%rsp), %rbx
	.p2align 4,,10
	.p2align 3
.L5:
	movq	%r12, %rdx
	movq	%rbp, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	40(%rsp), %rdx
	movslq	44(%rsp), %rax
	movq	(%r14,%rdx,8), %xmm0
	movq	(%rbx,%rax,8), %xmm1
	movl	36(%rsp), %edx
	paddd	%xmm1, %xmm0
	movq	%xmm0, (%r14,%r15,8)
	addq	$1, %r15
	cmpl	%r15d, %edx
	jg	.L5
.L4:
	testl	%edx, %edx
	jle	.L13
	subl	$1, %edx
	leaq	880(%rsp), %rax
	xorl	%r8d, %r8d
	xorl	%esi, %esi
	leaq	888(%rsp,%rdx,8), %rdi
	xorl	%r9d, %r9d
	xorl	%ecx, %ecx
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L25:
	cmpl	%esi, %edx
	jg	.L15
	movl	4(%rax), %edx
	cmpl	%r9d, %edx
	jl	.L16
	cmpl	%edx, %r8d
	cmovl	%edx, %r8d
.L7:
	addq	$8, %rax
	cmpq	%rax, %rdi
	je	.L24
.L8:
	movl	(%rax), %edx
	cmpl	%ecx, %edx
	jge	.L25
	addq	$8, %rax
	movl	%edx, %ecx
	cmpq	%rax, %rdi
	jne	.L8
.L24:
	subl	%ecx, %esi
	subl	%r9d, %r8d
	addl	$1, %esi
	addl	$1, %r8d
.L6:
	movq	8(%rsp), %rax
	addl	$1, 20(%rsp)
	movl	%esi, (%rax)
	addq	$8, %rax
	movl	%r8d, -4(%rax)
	movq	%rax, 8(%rsp)
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L15:
	movl	%edx, %esi
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L16:
	movl	%edx, %r9d
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L23:
	movl	20(%rsp), %eax
	testl	%eax, %eax
	je	.L11
	movl	20(%rsp), %eax
	movq	(%rsp), %rbx
	leaq	.LC4(%rip), %rbp
	subl	$1, %eax
	addq	$8, %rbx
	leaq	(%rbx,%rax,8), %r12
	jmp	.L10
	.p2align 4,,10
	.p2align 3
.L26:
	addq	$8, %rbx
.L10:
	movq	(%rsp), %rax
	movq	%rbp, %rsi
	movl	$1, %edi
	movl	4(%rax), %ecx
	movl	(%rax), %edx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	%rbx, (%rsp)
	cmpq	%rbx, %r12
	jne	.L26
.L11:
	movq	2488(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L27
	addq	$2504, %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
.L13:
	.cfi_restore_state
	movl	$1, %r8d
	movl	$1, %esi
	jmp	.L6
.L27:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC0:
	.long	-1
	.long	0
	.long	0
	.long	-1
	.align 16
.LC1:
	.long	1
	.long	0
	.long	0
	.long	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
.LC2:
	.string	"%d"
.LC3:
	.string	"%d%d"
.LC4:
	.string	"%d %d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	leaq	.LC3(%rip), %r13
	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	$2504, %rsp
	.cfi_def_cfa_offset 2560
	movdqa	.LC0(%rip), %xmm0
	movq	%fs:40, %rax
	movq	%rax, 2488(%rsp)
	xorl	%eax, %eax
	leaq	80(%rsp), %rax
	movl	$0, 20(%rsp)
	movq	%rax, (%rsp)
	movq	%rax, 8(%rsp)
	leaq	36(%rsp), %rax
	movaps	%xmm0, 48(%rsp)
	movdqa	.LC1(%rip), %xmm0
	movq	%rax, 24(%rsp)
	movaps	%xmm0, 64(%rsp)
	.p2align 4,,10
	.p2align 3
.L9:
	movq	24(%rsp), %rsi
	leaq	.LC2(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	36(%rsp), %edx
	testl	%edx, %edx
	je	.L23
	movq	$0, 880(%rsp)
	cmpl	$1, %edx
	jle	.L4
	movl	$1, %r15d
	leaq	44(%rsp), %r12
	leaq	40(%rsp), %rbp
	leaq	880(%rsp), %r14
	leaq	48(%rsp), %rbx
	.p2align 4,,10
	.p2align 3
.L5:
	movq	%r12, %rdx
	movq	%rbp, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	40(%rsp), %rdx
	movslq	44(%rsp), %rax
	movq	(%r14,%rdx,8), %xmm0
	movq	(%rbx,%rax,8), %xmm1
	movl	36(%rsp), %edx
	paddd	%xmm1, %xmm0
	movq	%xmm0, (%r14,%r15,8)
	addq	$1, %r15
	cmpl	%r15d, %edx
	jg	.L5
.L4:
	testl	%edx, %edx
	jle	.L13
	subl	$1, %edx
	leaq	880(%rsp), %rax
	xorl	%r8d, %r8d
	xorl	%esi, %esi
	leaq	888(%rsp,%rdx,8), %rdi
	xorl	%r9d, %r9d
	xorl	%ecx, %ecx
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L25:
	cmpl	%esi, %edx
	jg	.L15
	movl	4(%rax), %edx
	cmpl	%r9d, %edx
	jl	.L16
	cmpl	%edx, %r8d
	cmovl	%edx, %r8d
.L7:
	addq	$8, %rax
	cmpq	%rax, %rdi
	je	.L24
.L8:
	movl	(%rax), %edx
	cmpl	%ecx, %edx
	jge	.L25
	addq	$8, %rax
	movl	%edx, %ecx
	cmpq	%rax, %rdi
	jne	.L8
.L24:
	subl	%ecx, %esi
	subl	%r9d, %r8d
	addl	$1, %esi
	addl	$1, %r8d
.L6:
	movq	8(%rsp), %rax
	addl	$1, 20(%rsp)
	movl	%esi, (%rax)
	addq	$8, %rax
	movl	%r8d, -4(%rax)
	movq	%rax, 8(%rsp)
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L15:
	movl	%edx, %esi
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L16:
	movl	%edx, %r9d
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L23:
	movl	20(%rsp), %eax
	testl	%eax, %eax
	je	.L11
	movl	20(%rsp), %eax
	movq	(%rsp), %rbx
	leaq	.LC4(%rip), %rbp
	subl	$1, %eax
	addq	$8, %rbx
	leaq	(%rbx,%rax,8), %r12
	jmp	.L10
	.p2align 4,,10
	.p2align 3
.L26:
	addq	$8, %rbx
.L10:
	movq	(%rsp), %rax
	movq	%rbp, %rsi
	movl	$1, %edi
	movl	4(%rax), %ecx
	movl	(%rax), %edx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	%rbx, (%rsp)
	cmpq	%rbx, %r12
	jne	.L26
.L11:
	movq	2488(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L27
	addq	$2504, %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
.L13:
	.cfi_restore_state
	movl	$1, %r8d
	movl	$1, %esi
	jmp	.L6
.L27:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC0:
	.long	-1
	.long	0
	.long	0
	.long	-1
	.align 16
.LC1:
	.long	1
	.long	0
	.long	0
	.long	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>

int main()
{
  int aa[4][2]={{-1,0},{0,-1},{1,0},{0,1}};
  int seihou[200][2],an[100][2],i,n,m=0,ten,muki;
  int minx=0,maxx=0,miny=0,maxy=0;
  while(1){
    scanf("%d",&n);
    if(n==0)break;
    seihou[0][0]=0;
    seihou[0][1]=0;
    for(i=1;i<n;i++){
      scanf("%d%d",&ten,&muki);
      seihou[i][0]=seihou[ten][0]+aa[muki][0];
      seihou[i][1]=seihou[ten][1]+aa[muki][1];
    }
    for(i=0;i<n;i++){
      if(minx>seihou[i][0])minx=seihou[i][0];
      else if(maxx<seihou[i][0])maxx=seihou[i][0];
      else if(miny>seihou[i][1])miny=seihou[i][1];
      else if(maxy<seihou[i][1])maxy=seihou[i][1];
    }
    an[m][0]=maxx-minx+1;
    an[m][1]=maxy-miny+1;
    m++;
    maxx=0;minx=0,miny=0,maxy=0;
  }
  for(i=0;i<m;i++){
    printf("%d %d\n",an[i][0],an[i][1]);
  }
  return 0;
}
1
5
0 0
0 1
0 2
0 3
12
0 0
1 1
2 0
3 1
4 1
5 1
6 2
7 2
8 2
9 3
10 3
10
0 2
1 2
2 2
3 2
2 1
5 1
6 1
7 1
8 1
0
 1
5
0 0
0 1
0 2
0 3
12
0 0
1 0
2 0
3 1
4 1
5 1
6 2
7 2
8 2
9 3
10 3
10
0 2
1 3
2 2
3 2
2 1
5 1
6 1
7 1
8 1
0
 1
5
0 0
0 0
0 2
0 3
12
0 0
1 0
2 0
3 1
4 1
5 1
6 2
7 2
8 2
9 3
10 3
10
0 2
1 3
2 2
3 2
2 1
5 1
6 1
7 1
8 1
0
 1
5
0 0
0 0
0 2
0 3
12
0 0
1 0
2 0
3 0
4 1
5 1
6 2
7 2
8 2
9 3
10 3
10
0 2
1 3
2 2
3 2
2 1
5 1
6 1
7 1
8 1
0
 1
5
0 0
0 0
0 2
0 3
12
0 0
1 0
2 0
3 0
4 1
5 1
6 2
3 2
8 2
9 3
10 3
10
0 2
1 3
2 2
3 2
2 1
5 1
6 1
7 1
8 1
0
 1
5
0 0
0 1
0 2
0 3
12
0 0
1 0
2 0
3 1
4 1
5 1
6 2
7 2
8 2
9 3
10 3
10
0 2
1 2
2 2
3 2
2 1
5 1
6 1
7 1
8 2
0
 1
5
0 0
0 1
0 2
0 3
12
0 0
1 0
2 0
3 1
4 2
5 1
6 2
7 2
8 2
9 3
10 3
10
0 2
1 3
2 2
3 2
2 1
5 1
6 1
7 1
8 1
0
 1
5
0 0
0 1
0 2
0 3
12
0 0
1 0
2 0
3 1
4 1
5 1
6 2
7 2
8 2
9 3
10 3
10
0 2
1 2
2 1
3 2
2 1
5 1
6 1
7 1
8 2
0
 1
5
0 0
0 1
0 2
0 3
12
0 0
1 0
2 0
3 1
4 2
5 1
6 2
7 1
8 1
9 3
10 3
10
0 2
1 3
2 2
3 2
2 1
5 1
6 1
7 1
8 1
0
 1
5
0 0
0 1
0 2
0 3
12
0 1
1 0
2 0
3 1
4 2
5 1
6 2
7 1
8 1
9 3
10 3
10
0 2
1 3
2 2
3 2
2 1
5 1
6 1
7 1
8 1
0

1 1
3 3
4 5
5 6
 1 1
3 3
4 4
4 6
 1 1
3 2
4 4
4 6
 1 1
3 2
5 3
4 6
 1 1
3 2
5 5
4 6
 1 1
3 3
4 4
5 5
 1 1
3 3
5 3
4 6
 1 1
3 3
4 4
4 5
 1 1
3 3
4 5
4 6
 1 1
3 3
3 6
4 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>

int main()
{
  int aa[4][2]={{-1,0},{0,-1},{1,0},{0,1}};
  int seihou[200][2],an[100][2],i,n,m=0,ten,muki;
  int minx=0,maxx=0,miny=0,maxy=0;
  while(1){
    scanf("%d",&n);
    if(n==0)break;
    seihou[0][0]=0;
    seihou[0][1]=0;
    for(i=1;i<n;i++){
      scanf("%d%d",&ten,&muki);
      seihou[i][0]=seihou[ten][0]+aa[muki][0];
      seihou[i][1]=seihou[ten][1]+aa[muki][1];
    }
    for(i=0;i<n;i++){
      if(minx>seihou[i][0])minx=seihou[i][0];
      else if(maxx<seihou[i][0])maxx=seihou[i][0];
      else if(miny>seihou[i][1])miny=seihou[i][1];
      else if(maxy<seihou[i][1])maxy=seihou[i][1];
    }
    an[m][0]=maxx-minx+1;
    an[m][1]=maxy-miny+1;
    m++;
    maxx=0;minx=0,miny=0,maxy=0;
  }
  for(i=0;i<m;i++){
    printf("%d %d\n",an[i][0],an[i][1]);
  }
  return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d%d"
.LC2:
	.string	"%d %d\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
	subq	$2496, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$-1, -2448(%rbp)
	movl	$0, -2444(%rbp)
	movl	$0, -2440(%rbp)
	movl	$-1, -2436(%rbp)
	movl	$1, -2432(%rbp)
	movl	$0, -2428(%rbp)
	movl	$0, -2424(%rbp)
	movl	$1, -2420(%rbp)
	movl	$0, -2468(%rbp)
	movl	$0, -2464(%rbp)
	movl	$0, -2460(%rbp)
	movl	$0, -2456(%rbp)
	movl	$0, -2452(%rbp)
.L12:
	leaq	-2484(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-2484(%rbp), %eax
	testl	%eax, %eax
	je	.L18
	movl	$0, -1616(%rbp)
	movl	$0, -1612(%rbp)
	movl	$1, -2472(%rbp)
	jmp	.L4
.L5:
	leaq	-2476(%rbp), %rdx
	leaq	-2480(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-2480(%rbp), %eax
	cltq
	movl	-1616(%rbp,%rax,8), %edx
	movl	-2476(%rbp), %eax
	cltq
	movl	-2448(%rbp,%rax,8), %eax
	addl	%eax, %edx
	movl	-2472(%rbp), %eax
	cltq
	movl	%edx, -1616(%rbp,%rax,8)
	movl	-2480(%rbp), %eax
	cltq
	movl	-1612(%rbp,%rax,8), %edx
	movl	-2476(%rbp), %eax
	cltq
	movl	-2444(%rbp,%rax,8), %eax
	addl	%eax, %edx
	movl	-2472(%rbp), %eax
	cltq
	movl	%edx, -1612(%rbp,%rax,8)
	addl	$1, -2472(%rbp)
.L4:
	movl	-2484(%rbp), %eax
	cmpl	%eax, -2472(%rbp)
	jl	.L5
	movl	$0, -2472(%rbp)
	jmp	.L6
.L11:
	movl	-2472(%rbp), %eax
	cltq
	movl	-1616(%rbp,%rax,8), %eax
	cmpl	%eax, -2464(%rbp)
	jle	.L7
	movl	-2472(%rbp), %eax
	cltq
	movl	-1616(%rbp,%rax,8), %eax
	movl	%eax, -2464(%rbp)
	jmp	.L8
.L7:
	movl	-2472(%rbp), %eax
	cltq
	movl	-1616(%rbp,%rax,8), %eax
	cmpl	%eax, -2460(%rbp)
	jge	.L9
	movl	-2472(%rbp), %eax
	cltq
	movl	-1616(%rbp,%rax,8), %eax
	movl	%eax, -2460(%rbp)
	jmp	.L8
.L9:
	movl	-2472(%rbp), %eax
	cltq
	movl	-1612(%rbp,%rax,8), %eax
	cmpl	%eax, -2456(%rbp)
	jle	.L10
	movl	-2472(%rbp), %eax
	cltq
	movl	-1612(%rbp,%rax,8), %eax
	movl	%eax, -2456(%rbp)
	jmp	.L8
.L10:
	movl	-2472(%rbp), %eax
	cltq
	movl	-1612(%rbp,%rax,8), %eax
	cmpl	%eax, -2452(%rbp)
	jge	.L8
	movl	-2472(%rbp), %eax
	cltq
	movl	-1612(%rbp,%rax,8), %eax
	movl	%eax, -2452(%rbp)
.L8:
	addl	$1, -2472(%rbp)
.L6:
	movl	-2484(%rbp), %eax
	cmpl	%eax, -2472(%rbp)
	jl	.L11
	movl	-2460(%rbp), %eax
	subl	-2464(%rbp), %eax
	leal	1(%rax), %edx
	movl	-2468(%rbp), %eax
	cltq
	movl	%edx, -2416(%rbp,%rax,8)
	movl	-2452(%rbp), %eax
	subl	-2456(%rbp), %eax
	leal	1(%rax), %edx
	movl	-2468(%rbp), %eax
	cltq
	movl	%edx, -2412(%rbp,%rax,8)
	addl	$1, -2468(%rbp)
	movl	$0, -2460(%rbp)
	movl	$0, -2464(%rbp)
	movl	$0, -2456(%rbp)
	movl	$0, -2452(%rbp)
	jmp	.L12
.L18:
	nop
	movl	$0, -2472(%rbp)
	jmp	.L13
.L14:
	movl	-2472(%rbp), %eax
	cltq
	movl	-2412(%rbp,%rax,8), %edx
	movl	-2472(%rbp), %eax
	cltq
	movl	-2416(%rbp,%rax,8), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -2472(%rbp)
.L13:
	movl	-2472(%rbp), %eax
	cmpl	-2468(%rbp), %eax
	jl	.L14
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L16
	call	__stack_chk_fail@PLT
.L16:
	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"
.LC1:
	.string	"%d%d"
.LC2:
	.string	"%d %d\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
	subq	$2496, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$-1, -2448(%rbp)
	movl	$0, -2444(%rbp)
	movl	$0, -2440(%rbp)
	movl	$-1, -2436(%rbp)
	movl	$1, -2432(%rbp)
	movl	$0, -2428(%rbp)
	movl	$0, -2424(%rbp)
	movl	$1, -2420(%rbp)
	movl	$0, -2468(%rbp)
	movl	$0, -2464(%rbp)
	movl	$0, -2460(%rbp)
	movl	$0, -2456(%rbp)
	movl	$0, -2452(%rbp)
.L12:
	leaq	-2484(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-2484(%rbp), %eax
	testl	%eax, %eax
	je	.L18
	movl	$0, -1616(%rbp)
	movl	$0, -1612(%rbp)
	movl	$1, -2472(%rbp)
	jmp	.L4
.L5:
	leaq	-2476(%rbp), %rdx
	leaq	-2480(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-2480(%rbp), %eax
	cltq
	movl	-1616(%rbp,%rax,8), %edx
	movl	-2476(%rbp), %eax
	cltq
	movl	-2448(%rbp,%rax,8), %eax
	addl	%eax, %edx
	movl	-2472(%rbp), %eax
	cltq
	movl	%edx, -1616(%rbp,%rax,8)
	movl	-2480(%rbp), %eax
	cltq
	movl	-1612(%rbp,%rax,8), %edx
	movl	-2476(%rbp), %eax
	cltq
	movl	-2444(%rbp,%rax,8), %eax
	addl	%eax, %edx
	movl	-2472(%rbp), %eax
	cltq
	movl	%edx, -1612(%rbp,%rax,8)
	addl	$1, -2472(%rbp)
.L4:
	movl	-2484(%rbp), %eax
	cmpl	%eax, -2472(%rbp)
	jl	.L5
	movl	$0, -2472(%rbp)
	jmp	.L6
.L11:
	movl	-2472(%rbp), %eax
	cltq
	movl	-1616(%rbp,%rax,8), %eax
	cmpl	%eax, -2464(%rbp)
	jle	.L7
	movl	-2472(%rbp), %eax
	cltq
	movl	-1616(%rbp,%rax,8), %eax
	movl	%eax, -2464(%rbp)
	jmp	.L8
.L7:
	movl	-2472(%rbp), %eax
	cltq
	movl	-1616(%rbp,%rax,8), %eax
	cmpl	%eax, -2460(%rbp)
	jge	.L9
	movl	-2472(%rbp), %eax
	cltq
	movl	-1616(%rbp,%rax,8), %eax
	movl	%eax, -2460(%rbp)
	jmp	.L8
.L9:
	movl	-2472(%rbp), %eax
	cltq
	movl	-1612(%rbp,%rax,8), %eax
	cmpl	%eax, -2456(%rbp)
	jle	.L10
	movl	-2472(%rbp), %eax
	cltq
	movl	-1612(%rbp,%rax,8), %eax
	movl	%eax, -2456(%rbp)
	jmp	.L8
.L10:
	movl	-2472(%rbp), %eax
	cltq
	movl	-1612(%rbp,%rax,8), %eax
	cmpl	%eax, -2452(%rbp)
	jge	.L8
	movl	-2472(%rbp), %eax
	cltq
	movl	-1612(%rbp,%rax,8), %eax
	movl	%eax, -2452(%rbp)
.L8:
	addl	$1, -2472(%rbp)
.L6:
	movl	-2484(%rbp), %eax
	cmpl	%eax, -2472(%rbp)
	jl	.L11
	movl	-2460(%rbp), %eax
	subl	-2464(%rbp), %eax
	leal	1(%rax), %edx
	movl	-2468(%rbp), %eax
	cltq
	movl	%edx, -2416(%rbp,%rax,8)
	movl	-2452(%rbp), %eax
	subl	-2456(%rbp), %eax
	leal	1(%rax), %edx
	movl	-2468(%rbp), %eax
	cltq
	movl	%edx, -2412(%rbp,%rax,8)
	addl	$1, -2468(%rbp)
	movl	$0, -2460(%rbp)
	movl	$0, -2464(%rbp)
	movl	$0, -2456(%rbp)
	movl	$0, -2452(%rbp)
	jmp	.L12
.L18:
	nop
	movl	$0, -2472(%rbp)
	jmp	.L13
.L14:
	movl	-2472(%rbp), %eax
	cltq
	movl	-2412(%rbp,%rax,8), %edx
	movl	-2472(%rbp), %eax
	cltq
	movl	-2416(%rbp,%rax,8), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -2472(%rbp)
.L13:
	movl	-2472(%rbp), %eax
	cmpl	-2468(%rbp), %eax
	jl	.L14
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L16
	call	__stack_chk_fail@PLT
.L16:
	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:
