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>
main(){
  int i,N,fx[200],fy[200],num,xmax,xmin,ymax,ymin,d;
  int dx[4] = {-1,0,1,0};
  int dy[4] = {0,1,0,-1};
  fx[0] = 0;
  fy[0] = 0;

  while(1){
    scanf("%d",&N);
    if(N == 0) break;
    
    for(i=1;i<N;i++){
      scanf("%d%d",&num,&d);
      fx[i] = fx[num] + dx[d];
      fy[i] = fy[num] + dy[d];
    }

    xmax = 0;
    xmin = 0;
    ymax = 0;
    ymin = 0;

    for(i=0;i<N;i++){
      if(fx[i] > xmax) xmax = fx[i];
      if(fx[i] < xmin) xmin = fx[i];
      if(fy[i] > ymax) ymax = fy[i];
      if(fy[i] < ymin) ymin = fy[i];
    }

    printf("%d %d\n",xmax-xmin+1,ymax-ymin+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	$1680, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$-1, -1648(%rbp)
	movl	$0, -1644(%rbp)
	movl	$1, -1640(%rbp)
	movl	$0, -1636(%rbp)
	movl	$0, -1632(%rbp)
	movl	$1, -1628(%rbp)
	movl	$0, -1624(%rbp)
	movl	$-1, -1620(%rbp)
	movl	$0, -1616(%rbp)
	movl	$0, -816(%rbp)
.L12:
	leaq	-1680(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-1680(%rbp), %eax
	testl	%eax, %eax
	je	.L16
	movl	$1, -1668(%rbp)
	jmp	.L4
.L5:
	leaq	-1672(%rbp), %rdx
	leaq	-1676(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-1676(%rbp), %eax
	cltq
	movl	-1616(%rbp,%rax,4), %edx
	movl	-1672(%rbp), %eax
	cltq
	movl	-1648(%rbp,%rax,4), %eax
	addl	%eax, %edx
	movl	-1668(%rbp), %eax
	cltq
	movl	%edx, -1616(%rbp,%rax,4)
	movl	-1676(%rbp), %eax
	cltq
	movl	-816(%rbp,%rax,4), %edx
	movl	-1672(%rbp), %eax
	cltq
	movl	-1632(%rbp,%rax,4), %eax
	addl	%eax, %edx
	movl	-1668(%rbp), %eax
	cltq
	movl	%edx, -816(%rbp,%rax,4)
	addl	$1, -1668(%rbp)
.L4:
	movl	-1680(%rbp), %eax
	cmpl	%eax, -1668(%rbp)
	jl	.L5
	movl	$0, -1664(%rbp)
	movl	$0, -1660(%rbp)
	movl	$0, -1656(%rbp)
	movl	$0, -1652(%rbp)
	movl	$0, -1668(%rbp)
	jmp	.L6
.L11:
	movl	-1668(%rbp), %eax
	cltq
	movl	-1616(%rbp,%rax,4), %eax
	cmpl	%eax, -1664(%rbp)
	jge	.L7
	movl	-1668(%rbp), %eax
	cltq
	movl	-1616(%rbp,%rax,4), %eax
	movl	%eax, -1664(%rbp)
.L7:
	movl	-1668(%rbp), %eax
	cltq
	movl	-1616(%rbp,%rax,4), %eax
	cmpl	%eax, -1660(%rbp)
	jle	.L8
	movl	-1668(%rbp), %eax
	cltq
	movl	-1616(%rbp,%rax,4), %eax
	movl	%eax, -1660(%rbp)
.L8:
	movl	-1668(%rbp), %eax
	cltq
	movl	-816(%rbp,%rax,4), %eax
	cmpl	%eax, -1656(%rbp)
	jge	.L9
	movl	-1668(%rbp), %eax
	cltq
	movl	-816(%rbp,%rax,4), %eax
	movl	%eax, -1656(%rbp)
.L9:
	movl	-1668(%rbp), %eax
	cltq
	movl	-816(%rbp,%rax,4), %eax
	cmpl	%eax, -1652(%rbp)
	jle	.L10
	movl	-1668(%rbp), %eax
	cltq
	movl	-816(%rbp,%rax,4), %eax
	movl	%eax, -1652(%rbp)
.L10:
	addl	$1, -1668(%rbp)
.L6:
	movl	-1680(%rbp), %eax
	cmpl	%eax, -1668(%rbp)
	jl	.L11
	movl	-1656(%rbp), %eax
	subl	-1652(%rbp), %eax
	leal	1(%rax), %edx
	movl	-1664(%rbp), %eax
	subl	-1660(%rbp), %eax
	addl	$1, %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L12
.L16:
	nop
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L14
	call	__stack_chk_fail@PLT
.L14:
	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
	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
	leaq	.LC3(%rip), %rbx
	subq	$1688, %rsp
	.cfi_def_cfa_offset 1744
	movdqa	.LC0(%rip), %xmm0
	movq	%fs:40, %rax
	movq	%rax, 1672(%rsp)
	xorl	%eax, %eax
	leaq	20(%rsp), %rax
	movl	$0, 64(%rsp)
	leaq	28(%rsp), %r12
	movaps	%xmm0, 32(%rsp)
	movdqa	.LC1(%rip), %xmm0
	leaq	24(%rsp), %rbp
	movl	$0, 864(%rsp)
	movq	%rax, 8(%rsp)
	movaps	%xmm0, 48(%rsp)
	.p2align 4,,10
	.p2align 3
.L9:
	movq	8(%rsp), %rsi
	leaq	.LC2(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	20(%rsp), %eax
	testl	%eax, %eax
	je	.L2
	cmpl	$1, %eax
	jle	.L3
	movl	$1, %r14d
	leaq	64(%rsp), %r13
	leaq	864(%rsp), %r15
	.p2align 4,,10
	.p2align 3
.L4:
	movq	%r12, %rdx
	movq	%rbp, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	24(%rsp), %rdx
	movslq	28(%rsp), %rsi
	movl	32(%rsp,%rsi,4), %eax
	addl	64(%rsp,%rdx,4), %eax
	movl	%eax, 0(%r13,%r14,4)
	movl	48(%rsp,%rsi,4), %eax
	addl	864(%rsp,%rdx,4), %eax
	movl	%eax, (%r15,%r14,4)
	movl	20(%rsp), %eax
	addq	$1, %r14
	cmpl	%r14d, %eax
	jg	.L4
.L3:
	testl	%eax, %eax
	jle	.L11
	leal	-1(%rax), %edx
	cmpl	$2, %edx
	jbe	.L12
	movl	%eax, %ecx
	pxor	%xmm5, %xmm5
	leaq	64(%rsp), %r13
	xorl	%edx, %edx
	movdqa	%xmm5, %xmm2
	shrl	$2, %ecx
	movdqa	%xmm5, %xmm4
	movdqa	%xmm5, %xmm1
	salq	$4, %rcx
	leaq	864(%rsp), %r15
	.p2align 4,,10
	.p2align 3
.L7:
	movdqa	0(%r13,%rdx), %xmm0
	movdqa	%xmm1, %xmm3
	pcmpgtd	%xmm0, %xmm3
	pand	%xmm3, %xmm1
	pandn	%xmm0, %xmm3
	por	%xmm3, %xmm1
	movdqa	%xmm4, %xmm3
	pcmpgtd	%xmm0, %xmm3
	pand	%xmm3, %xmm0
	pandn	%xmm4, %xmm3
	movdqa	%xmm3, %xmm4
	movdqa	%xmm2, %xmm3
	por	%xmm0, %xmm4
	movdqa	(%r15,%rdx), %xmm0
	addq	$16, %rdx
	pcmpgtd	%xmm0, %xmm3
	pand	%xmm3, %xmm2
	pandn	%xmm0, %xmm3
	por	%xmm3, %xmm2
	movdqa	%xmm5, %xmm3
	pcmpgtd	%xmm0, %xmm3
	pand	%xmm3, %xmm0
	pandn	%xmm5, %xmm3
	movdqa	%xmm3, %xmm5
	por	%xmm0, %xmm5
	cmpq	%rdx, %rcx
	jne	.L7
	movdqa	%xmm5, %xmm3
	movl	%eax, %edi
	psrldq	$8, %xmm3
	andl	$-4, %edi
	movdqa	%xmm3, %xmm0
	pcmpgtd	%xmm5, %xmm0
	pand	%xmm0, %xmm5
	pandn	%xmm3, %xmm0
	por	%xmm5, %xmm0
	movdqa	%xmm0, %xmm5
	psrldq	$4, %xmm5
	movdqa	%xmm5, %xmm3
	pcmpgtd	%xmm0, %xmm3
	pand	%xmm3, %xmm0
	pandn	%xmm5, %xmm3
	por	%xmm0, %xmm3
	movd	%xmm3, %r8d
	movdqa	%xmm2, %xmm3
	psrldq	$8, %xmm3
	movdqa	%xmm3, %xmm0
	pcmpgtd	%xmm2, %xmm0
	pand	%xmm0, %xmm3
	pandn	%xmm2, %xmm0
	por	%xmm3, %xmm0
	movdqa	%xmm0, %xmm3
	psrldq	$4, %xmm3
	movdqa	%xmm3, %xmm2
	pcmpgtd	%xmm0, %xmm2
	pand	%xmm2, %xmm3
	pandn	%xmm0, %xmm2
	por	%xmm3, %xmm2
	movd	%xmm2, %ecx
	movdqa	%xmm4, %xmm2
	psrldq	$8, %xmm2
	movdqa	%xmm2, %xmm0
	pcmpgtd	%xmm4, %xmm0
	pand	%xmm0, %xmm4
	pandn	%xmm2, %xmm0
	por	%xmm4, %xmm0
	movdqa	%xmm0, %xmm3
	psrldq	$4, %xmm3
	movdqa	%xmm3, %xmm2
	pcmpgtd	%xmm0, %xmm2
	pand	%xmm2, %xmm0
	pandn	%xmm3, %xmm2
	por	%xmm0, %xmm2
	movd	%xmm2, %esi
	movdqa	%xmm1, %xmm2
	psrldq	$8, %xmm2
	movdqa	%xmm2, %xmm0
	pcmpgtd	%xmm1, %xmm0
	pand	%xmm0, %xmm2
	pandn	%xmm1, %xmm0
	por	%xmm2, %xmm0
	movdqa	%xmm0, %xmm2
	psrldq	$4, %xmm2
	movdqa	%xmm2, %xmm1
	pcmpgtd	%xmm0, %xmm1
	pand	%xmm1, %xmm2
	pandn	%xmm0, %xmm1
	por	%xmm2, %xmm1
	movd	%xmm1, %edx
	testb	$3, %al
	je	.L8
.L6:
	movslq	%edi, %r10
	movl	64(%rsp,%r10,4), %r9d
	cmpl	%r9d, %edx
	cmovl	%r9d, %edx
	cmpl	%r9d, %esi
	cmovg	%r9d, %esi
	movl	864(%rsp,%r10,4), %r9d
	cmpl	%r9d, %ecx
	cmovl	%r9d, %ecx
	cmpl	%r9d, %r8d
	cmovg	%r9d, %r8d
	leal	1(%rdi), %r9d
	cmpl	%eax, %r9d
	jge	.L8
	movslq	%r9d, %r9
	movl	64(%rsp,%r9,4), %r10d
	movl	864(%rsp,%r9,4), %r9d
	cmpl	%r10d, %edx
	cmovl	%r10d, %edx
	cmpl	%r10d, %esi
	cmovg	%r10d, %esi
	cmpl	%r9d, %ecx
	cmovl	%r9d, %ecx
	cmpl	%r9d, %r8d
	cmovg	%r9d, %r8d
	addl	$2, %edi
	cmpl	%edi, %eax
	jle	.L8
	movslq	%edi, %rdi
	movl	64(%rsp,%rdi,4), %eax
	cmpl	%eax, %edx
	cmovl	%eax, %edx
	cmpl	%eax, %esi
	cmovg	%eax, %esi
	movl	864(%rsp,%rdi,4), %eax
	cmpl	%eax, %ecx
	cmovl	%eax, %ecx
	cmpl	%eax, %r8d
	cmovg	%eax, %r8d
.L8:
	subl	%r8d, %ecx
	subl	%esi, %edx
	addl	$1, %ecx
	addl	$1, %edx
.L5:
	leaq	.LC4(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L2:
	movq	1672(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L17
	addq	$1688, %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
.L11:
	.cfi_restore_state
	movl	$1, %edx
	movl	$1, %ecx
	jmp	.L5
.L12:
	xorl	%r8d, %r8d
	xorl	%ecx, %ecx
	xorl	%esi, %esi
	xorl	%edx, %edx
	xorl	%edi, %edi
	jmp	.L6
.L17:
	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	1
	.long	0
	.align 16
.LC1:
	.long	0
	.long	1
	.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
	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
	leaq	.LC3(%rip), %rbx
	subq	$1688, %rsp
	.cfi_def_cfa_offset 1744
	movdqa	.LC0(%rip), %xmm0
	movq	%fs:40, %rax
	movq	%rax, 1672(%rsp)
	xorl	%eax, %eax
	leaq	20(%rsp), %rax
	movl	$0, 64(%rsp)
	leaq	28(%rsp), %r12
	movaps	%xmm0, 32(%rsp)
	movdqa	.LC1(%rip), %xmm0
	leaq	24(%rsp), %rbp
	movl	$0, 864(%rsp)
	movq	%rax, 8(%rsp)
	movaps	%xmm0, 48(%rsp)
	.p2align 4,,10
	.p2align 3
.L9:
	movq	8(%rsp), %rsi
	leaq	.LC2(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	20(%rsp), %eax
	testl	%eax, %eax
	je	.L2
	cmpl	$1, %eax
	jle	.L3
	movl	$1, %r14d
	leaq	64(%rsp), %r13
	leaq	864(%rsp), %r15
	.p2align 4,,10
	.p2align 3
.L4:
	movq	%r12, %rdx
	movq	%rbp, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	24(%rsp), %rdx
	movslq	28(%rsp), %rsi
	movl	32(%rsp,%rsi,4), %eax
	addl	64(%rsp,%rdx,4), %eax
	movl	%eax, 0(%r13,%r14,4)
	movl	48(%rsp,%rsi,4), %eax
	addl	864(%rsp,%rdx,4), %eax
	movl	%eax, (%r15,%r14,4)
	movl	20(%rsp), %eax
	addq	$1, %r14
	cmpl	%r14d, %eax
	jg	.L4
.L3:
	testl	%eax, %eax
	jle	.L11
	leal	-1(%rax), %edx
	cmpl	$2, %edx
	jbe	.L12
	movl	%eax, %ecx
	pxor	%xmm5, %xmm5
	leaq	64(%rsp), %r13
	xorl	%edx, %edx
	movdqa	%xmm5, %xmm2
	shrl	$2, %ecx
	movdqa	%xmm5, %xmm4
	movdqa	%xmm5, %xmm1
	salq	$4, %rcx
	leaq	864(%rsp), %r15
	.p2align 4,,10
	.p2align 3
.L7:
	movdqa	0(%r13,%rdx), %xmm0
	movdqa	%xmm1, %xmm3
	pcmpgtd	%xmm0, %xmm3
	pand	%xmm3, %xmm1
	pandn	%xmm0, %xmm3
	por	%xmm3, %xmm1
	movdqa	%xmm4, %xmm3
	pcmpgtd	%xmm0, %xmm3
	pand	%xmm3, %xmm0
	pandn	%xmm4, %xmm3
	movdqa	%xmm3, %xmm4
	movdqa	%xmm2, %xmm3
	por	%xmm0, %xmm4
	movdqa	(%r15,%rdx), %xmm0
	addq	$16, %rdx
	pcmpgtd	%xmm0, %xmm3
	pand	%xmm3, %xmm2
	pandn	%xmm0, %xmm3
	por	%xmm3, %xmm2
	movdqa	%xmm5, %xmm3
	pcmpgtd	%xmm0, %xmm3
	pand	%xmm3, %xmm0
	pandn	%xmm5, %xmm3
	movdqa	%xmm3, %xmm5
	por	%xmm0, %xmm5
	cmpq	%rdx, %rcx
	jne	.L7
	movdqa	%xmm5, %xmm3
	movl	%eax, %edi
	psrldq	$8, %xmm3
	andl	$-4, %edi
	movdqa	%xmm3, %xmm0
	pcmpgtd	%xmm5, %xmm0
	pand	%xmm0, %xmm5
	pandn	%xmm3, %xmm0
	por	%xmm5, %xmm0
	movdqa	%xmm0, %xmm5
	psrldq	$4, %xmm5
	movdqa	%xmm5, %xmm3
	pcmpgtd	%xmm0, %xmm3
	pand	%xmm3, %xmm0
	pandn	%xmm5, %xmm3
	por	%xmm0, %xmm3
	movd	%xmm3, %r8d
	movdqa	%xmm2, %xmm3
	psrldq	$8, %xmm3
	movdqa	%xmm3, %xmm0
	pcmpgtd	%xmm2, %xmm0
	pand	%xmm0, %xmm3
	pandn	%xmm2, %xmm0
	por	%xmm3, %xmm0
	movdqa	%xmm0, %xmm3
	psrldq	$4, %xmm3
	movdqa	%xmm3, %xmm2
	pcmpgtd	%xmm0, %xmm2
	pand	%xmm2, %xmm3
	pandn	%xmm0, %xmm2
	por	%xmm3, %xmm2
	movd	%xmm2, %ecx
	movdqa	%xmm4, %xmm2
	psrldq	$8, %xmm2
	movdqa	%xmm2, %xmm0
	pcmpgtd	%xmm4, %xmm0
	pand	%xmm0, %xmm4
	pandn	%xmm2, %xmm0
	por	%xmm4, %xmm0
	movdqa	%xmm0, %xmm3
	psrldq	$4, %xmm3
	movdqa	%xmm3, %xmm2
	pcmpgtd	%xmm0, %xmm2
	pand	%xmm2, %xmm0
	pandn	%xmm3, %xmm2
	por	%xmm0, %xmm2
	movd	%xmm2, %esi
	movdqa	%xmm1, %xmm2
	psrldq	$8, %xmm2
	movdqa	%xmm2, %xmm0
	pcmpgtd	%xmm1, %xmm0
	pand	%xmm0, %xmm2
	pandn	%xmm1, %xmm0
	por	%xmm2, %xmm0
	movdqa	%xmm0, %xmm2
	psrldq	$4, %xmm2
	movdqa	%xmm2, %xmm1
	pcmpgtd	%xmm0, %xmm1
	pand	%xmm1, %xmm2
	pandn	%xmm0, %xmm1
	por	%xmm2, %xmm1
	movd	%xmm1, %edx
	testb	$3, %al
	je	.L8
.L6:
	movslq	%edi, %r10
	movl	64(%rsp,%r10,4), %r9d
	cmpl	%r9d, %edx
	cmovl	%r9d, %edx
	cmpl	%r9d, %esi
	cmovg	%r9d, %esi
	movl	864(%rsp,%r10,4), %r9d
	cmpl	%r9d, %ecx
	cmovl	%r9d, %ecx
	cmpl	%r9d, %r8d
	cmovg	%r9d, %r8d
	leal	1(%rdi), %r9d
	cmpl	%eax, %r9d
	jge	.L8
	movslq	%r9d, %r9
	movl	64(%rsp,%r9,4), %r10d
	movl	864(%rsp,%r9,4), %r9d
	cmpl	%r10d, %edx
	cmovl	%r10d, %edx
	cmpl	%r10d, %esi
	cmovg	%r10d, %esi
	cmpl	%r9d, %ecx
	cmovl	%r9d, %ecx
	cmpl	%r9d, %r8d
	cmovg	%r9d, %r8d
	addl	$2, %edi
	cmpl	%edi, %eax
	jle	.L8
	movslq	%edi, %rdi
	movl	64(%rsp,%rdi,4), %eax
	cmpl	%eax, %edx
	cmovl	%eax, %edx
	cmpl	%eax, %esi
	cmovg	%eax, %esi
	movl	864(%rsp,%rdi,4), %eax
	cmpl	%eax, %ecx
	cmovl	%eax, %ecx
	cmpl	%eax, %r8d
	cmovg	%eax, %r8d
.L8:
	subl	%r8d, %ecx
	subl	%esi, %edx
	addl	$1, %ecx
	addl	$1, %edx
.L5:
	leaq	.LC4(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L2:
	movq	1672(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L17
	addq	$1688, %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
.L11:
	.cfi_restore_state
	movl	$1, %edx
	movl	$1, %ecx
	jmp	.L5
.L12:
	xorl	%r8d, %r8d
	xorl	%ecx, %ecx
	xorl	%esi, %esi
	xorl	%edx, %edx
	xorl	%edi, %edi
	jmp	.L6
.L17:
	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	1
	.long	0
	.align 16
.LC1:
	.long	0
	.long	1
	.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>
main(){
  int i,N,fx[200],fy[200],num,xmax,xmin,ymax,ymin,d;
  int dx[4] = {-1,0,1,0};
  int dy[4] = {0,1,0,-1};
  fx[0] = 0;
  fy[0] = 0;

  while(1){
    scanf("%d",&N);
    if(N == 0) break;
    
    for(i=1;i<N;i++){
      scanf("%d%d",&num,&d);
      fx[i] = fx[num] + dx[d];
      fy[i] = fy[num] + dy[d];
    }

    xmax = 0;
    xmin = 0;
    ymax = 0;
    ymin = 0;

    for(i=0;i<N;i++){
      if(fx[i] > xmax) xmax = fx[i];
      if(fx[i] < xmin) xmin = fx[i];
      if(fy[i] > ymax) ymax = fy[i];
      if(fy[i] < ymin) ymin = fy[i];
    }

    printf("%d %d\n",xmax-xmin+1,ymax-ymin+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>
main(){
  int i,N,fx[200],fy[200],num,xmax,xmin,ymax,ymin,d;
  int dx[4] = {-1,0,1,0};
  int dy[4] = {0,1,0,-1};
  fx[0] = 0;
  fy[0] = 0;

  while(1){
    scanf("%d",&N);
    if(N == 0) break;
    
    for(i=1;i<N;i++){
      scanf("%d%d",&num,&d);
      fx[i] = fx[num] + dx[d];
      fy[i] = fy[num] + dy[d];
    }

    xmax = 0;
    xmin = 0;
    ymax = 0;
    ymin = 0;

    for(i=0;i<N;i++){
      if(fx[i] > xmax) xmax = fx[i];
      if(fx[i] < xmin) xmin = fx[i];
      if(fy[i] > ymax) ymax = fy[i];
      if(fy[i] < ymin) ymin = fy[i];
    }

    printf("%d %d\n",xmax-xmin+1,ymax-ymin+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	$1680, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$-1, -1648(%rbp)
	movl	$0, -1644(%rbp)
	movl	$1, -1640(%rbp)
	movl	$0, -1636(%rbp)
	movl	$0, -1632(%rbp)
	movl	$1, -1628(%rbp)
	movl	$0, -1624(%rbp)
	movl	$-1, -1620(%rbp)
	movl	$0, -1616(%rbp)
	movl	$0, -816(%rbp)
.L12:
	leaq	-1680(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-1680(%rbp), %eax
	testl	%eax, %eax
	je	.L16
	movl	$1, -1668(%rbp)
	jmp	.L4
.L5:
	leaq	-1672(%rbp), %rdx
	leaq	-1676(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-1676(%rbp), %eax
	cltq
	movl	-1616(%rbp,%rax,4), %edx
	movl	-1672(%rbp), %eax
	cltq
	movl	-1648(%rbp,%rax,4), %eax
	addl	%eax, %edx
	movl	-1668(%rbp), %eax
	cltq
	movl	%edx, -1616(%rbp,%rax,4)
	movl	-1676(%rbp), %eax
	cltq
	movl	-816(%rbp,%rax,4), %edx
	movl	-1672(%rbp), %eax
	cltq
	movl	-1632(%rbp,%rax,4), %eax
	addl	%eax, %edx
	movl	-1668(%rbp), %eax
	cltq
	movl	%edx, -816(%rbp,%rax,4)
	addl	$1, -1668(%rbp)
.L4:
	movl	-1680(%rbp), %eax
	cmpl	%eax, -1668(%rbp)
	jl	.L5
	movl	$0, -1664(%rbp)
	movl	$0, -1660(%rbp)
	movl	$0, -1656(%rbp)
	movl	$0, -1652(%rbp)
	movl	$0, -1668(%rbp)
	jmp	.L6
.L11:
	movl	-1668(%rbp), %eax
	cltq
	movl	-1616(%rbp,%rax,4), %eax
	cmpl	%eax, -1664(%rbp)
	jge	.L7
	movl	-1668(%rbp), %eax
	cltq
	movl	-1616(%rbp,%rax,4), %eax
	movl	%eax, -1664(%rbp)
.L7:
	movl	-1668(%rbp), %eax
	cltq
	movl	-1616(%rbp,%rax,4), %eax
	cmpl	%eax, -1660(%rbp)
	jle	.L8
	movl	-1668(%rbp), %eax
	cltq
	movl	-1616(%rbp,%rax,4), %eax
	movl	%eax, -1660(%rbp)
.L8:
	movl	-1668(%rbp), %eax
	cltq
	movl	-816(%rbp,%rax,4), %eax
	cmpl	%eax, -1656(%rbp)
	jge	.L9
	movl	-1668(%rbp), %eax
	cltq
	movl	-816(%rbp,%rax,4), %eax
	movl	%eax, -1656(%rbp)
.L9:
	movl	-1668(%rbp), %eax
	cltq
	movl	-816(%rbp,%rax,4), %eax
	cmpl	%eax, -1652(%rbp)
	jle	.L10
	movl	-1668(%rbp), %eax
	cltq
	movl	-816(%rbp,%rax,4), %eax
	movl	%eax, -1652(%rbp)
.L10:
	addl	$1, -1668(%rbp)
.L6:
	movl	-1680(%rbp), %eax
	cmpl	%eax, -1668(%rbp)
	jl	.L11
	movl	-1656(%rbp), %eax
	subl	-1652(%rbp), %eax
	leal	1(%rax), %edx
	movl	-1664(%rbp), %eax
	subl	-1660(%rbp), %eax
	addl	$1, %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L12
.L16:
	nop
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L14
	call	__stack_chk_fail@PLT
.L14:
	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	$1680, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$-1, -1648(%rbp)
	movl	$0, -1644(%rbp)
	movl	$1, -1640(%rbp)
	movl	$0, -1636(%rbp)
	movl	$0, -1632(%rbp)
	movl	$1, -1628(%rbp)
	movl	$0, -1624(%rbp)
	movl	$-1, -1620(%rbp)
	movl	$0, -1616(%rbp)
	movl	$0, -816(%rbp)
.L12:
	leaq	-1680(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-1680(%rbp), %eax
	testl	%eax, %eax
	je	.L16
	movl	$1, -1668(%rbp)
	jmp	.L4
.L5:
	leaq	-1672(%rbp), %rdx
	leaq	-1676(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-1676(%rbp), %eax
	cltq
	movl	-1616(%rbp,%rax,4), %edx
	movl	-1672(%rbp), %eax
	cltq
	movl	-1648(%rbp,%rax,4), %eax
	addl	%eax, %edx
	movl	-1668(%rbp), %eax
	cltq
	movl	%edx, -1616(%rbp,%rax,4)
	movl	-1676(%rbp), %eax
	cltq
	movl	-816(%rbp,%rax,4), %edx
	movl	-1672(%rbp), %eax
	cltq
	movl	-1632(%rbp,%rax,4), %eax
	addl	%eax, %edx
	movl	-1668(%rbp), %eax
	cltq
	movl	%edx, -816(%rbp,%rax,4)
	addl	$1, -1668(%rbp)
.L4:
	movl	-1680(%rbp), %eax
	cmpl	%eax, -1668(%rbp)
	jl	.L5
	movl	$0, -1664(%rbp)
	movl	$0, -1660(%rbp)
	movl	$0, -1656(%rbp)
	movl	$0, -1652(%rbp)
	movl	$0, -1668(%rbp)
	jmp	.L6
.L11:
	movl	-1668(%rbp), %eax
	cltq
	movl	-1616(%rbp,%rax,4), %eax
	cmpl	%eax, -1664(%rbp)
	jge	.L7
	movl	-1668(%rbp), %eax
	cltq
	movl	-1616(%rbp,%rax,4), %eax
	movl	%eax, -1664(%rbp)
.L7:
	movl	-1668(%rbp), %eax
	cltq
	movl	-1616(%rbp,%rax,4), %eax
	cmpl	%eax, -1660(%rbp)
	jle	.L8
	movl	-1668(%rbp), %eax
	cltq
	movl	-1616(%rbp,%rax,4), %eax
	movl	%eax, -1660(%rbp)
.L8:
	movl	-1668(%rbp), %eax
	cltq
	movl	-816(%rbp,%rax,4), %eax
	cmpl	%eax, -1656(%rbp)
	jge	.L9
	movl	-1668(%rbp), %eax
	cltq
	movl	-816(%rbp,%rax,4), %eax
	movl	%eax, -1656(%rbp)
.L9:
	movl	-1668(%rbp), %eax
	cltq
	movl	-816(%rbp,%rax,4), %eax
	cmpl	%eax, -1652(%rbp)
	jle	.L10
	movl	-1668(%rbp), %eax
	cltq
	movl	-816(%rbp,%rax,4), %eax
	movl	%eax, -1652(%rbp)
.L10:
	addl	$1, -1668(%rbp)
.L6:
	movl	-1680(%rbp), %eax
	cmpl	%eax, -1668(%rbp)
	jl	.L11
	movl	-1656(%rbp), %eax
	subl	-1652(%rbp), %eax
	leal	1(%rax), %edx
	movl	-1664(%rbp), %eax
	subl	-1660(%rbp), %eax
	addl	$1, %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L12
.L16:
	nop
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L14
	call	__stack_chk_fail@PLT
.L14:
	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:
