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 n, i, j, dx, dy, x, y, count;
  int map[1001][1001], dist, temp, ans[2];

  scanf("%d", &n);

  for(count=0;count<n;count++){
    x=y=0;
    for(i=0;i<1001;i++){
      for(j=0;j<1001;j++){
        map[i][j]=0;
      }
    }
    while(1){
      scanf("%d %d", &dx, &dy);
      if(dx==0 && dy==0) break;

      x+=dx;
      y+=dy;

      map[y][x]=1;
    }

    dist=-1;
    ans[0]=ans[1]=0;
    for(i=0;i<1001;i++){
      for(j=0;j<1001;j++){
        if(map[i][j]==1){
          temp=i*i+j*j;
          if(dist<temp){
	    dist=temp;
            ans[0]=j;
            ans[1]=i;
          }
          else if(dist==temp){
            if(ans[0]<j){
              dist=temp;
              ans[0]=j;
              ans[1]=i;
            }
          }
        }
      }
    }
    printf("%d %d\n", ans[0], ans[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
	leaq	-4005888(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$2176, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-4008064(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -4008036(%rbp)
	jmp	.L2
.L16:
	movl	$0, -4008040(%rbp)
	movl	-4008040(%rbp), %eax
	movl	%eax, -4008044(%rbp)
	movl	$0, -4008052(%rbp)
	jmp	.L3
.L6:
	movl	$0, -4008048(%rbp)
	jmp	.L4
.L5:
	movl	-4008048(%rbp), %eax
	movslq	%eax, %rdx
	movl	-4008052(%rbp), %eax
	cltq
	imulq	$1001, %rax, %rax
	addq	%rdx, %rax
	movl	$0, -4008016(%rbp,%rax,4)
	addl	$1, -4008048(%rbp)
.L4:
	cmpl	$1000, -4008048(%rbp)
	jle	.L5
	addl	$1, -4008052(%rbp)
.L3:
	cmpl	$1000, -4008052(%rbp)
	jle	.L6
.L9:
	leaq	-4008056(%rbp), %rdx
	leaq	-4008060(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-4008060(%rbp), %eax
	testl	%eax, %eax
	jne	.L7
	movl	-4008056(%rbp), %eax
	testl	%eax, %eax
	je	.L20
.L7:
	movl	-4008060(%rbp), %eax
	addl	%eax, -4008044(%rbp)
	movl	-4008056(%rbp), %eax
	addl	%eax, -4008040(%rbp)
	movl	-4008044(%rbp), %eax
	movslq	%eax, %rdx
	movl	-4008040(%rbp), %eax
	cltq
	imulq	$1001, %rax, %rax
	addq	%rdx, %rax
	movl	$1, -4008016(%rbp,%rax,4)
	jmp	.L9
.L20:
	nop
	movl	$-1, -4008032(%rbp)
	movl	$0, -4008020(%rbp)
	movl	-4008020(%rbp), %eax
	movl	%eax, -4008024(%rbp)
	movl	$0, -4008052(%rbp)
	jmp	.L10
.L15:
	movl	$0, -4008048(%rbp)
	jmp	.L11
.L14:
	movl	-4008048(%rbp), %eax
	movslq	%eax, %rdx
	movl	-4008052(%rbp), %eax
	cltq
	imulq	$1001, %rax, %rax
	addq	%rdx, %rax
	movl	-4008016(%rbp,%rax,4), %eax
	cmpl	$1, %eax
	jne	.L12
	movl	-4008052(%rbp), %eax
	imull	%eax, %eax
	movl	%eax, %edx
	movl	-4008048(%rbp), %eax
	imull	%eax, %eax
	addl	%edx, %eax
	movl	%eax, -4008028(%rbp)
	movl	-4008032(%rbp), %eax
	cmpl	-4008028(%rbp), %eax
	jge	.L13
	movl	-4008028(%rbp), %eax
	movl	%eax, -4008032(%rbp)
	movl	-4008048(%rbp), %eax
	movl	%eax, -4008024(%rbp)
	movl	-4008052(%rbp), %eax
	movl	%eax, -4008020(%rbp)
	jmp	.L12
.L13:
	movl	-4008032(%rbp), %eax
	cmpl	-4008028(%rbp), %eax
	jne	.L12
	movl	-4008024(%rbp), %eax
	cmpl	%eax, -4008048(%rbp)
	jle	.L12
	movl	-4008028(%rbp), %eax
	movl	%eax, -4008032(%rbp)
	movl	-4008048(%rbp), %eax
	movl	%eax, -4008024(%rbp)
	movl	-4008052(%rbp), %eax
	movl	%eax, -4008020(%rbp)
.L12:
	addl	$1, -4008048(%rbp)
.L11:
	cmpl	$1000, -4008048(%rbp)
	jle	.L14
	addl	$1, -4008052(%rbp)
.L10:
	cmpl	$1000, -4008052(%rbp)
	jle	.L15
	movl	-4008020(%rbp), %edx
	movl	-4008024(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -4008036(%rbp)
.L2:
	movl	-4008064(%rbp), %eax
	cmpl	%eax, -4008036(%rbp)
	jl	.L16
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L18
	call	__stack_chk_fail@PLT
.L18:
	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"
.LC1:
	.string	"%d %d"
.LC2:
	.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	-4005888(%rsp), %r11
	.cfi_def_cfa 11, 4005944
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$2168, %rsp
	.cfi_def_cfa_offset 4008112
	leaq	.LC0(%rip), %rdi
	movq	%fs:40, %rax
	movq	%rax, 4008040(%rsp)
	xorl	%eax, %eax
	leaq	20(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	20(%rsp), %eax
	testl	%eax, %eax
	jle	.L9
	xorl	%ebx, %ebx
	leaq	32(%rsp), %rbp
	leaq	28(%rsp), %r15
	leaq	24(%rsp), %r14
	leaq	.LC1(%rip), %r13
	leaq	.LC2(%rip), %r12
.L2:
	movl	$4008004, %edx
	xorl	%esi, %esi
	movq	%rbp, %rdi
	call	memset@PLT
	xorl	%r9d, %r9d
	xorl	%ecx, %ecx
	jmp	.L5
.L3:
	addl	%eax, %r9d
	addl	%edx, %ecx
	movslq	%r9d, %rax
	movslq	%ecx, %rdx
	imulq	$1001, %rax, %rax
	addq	%rdx, %rax
	movl	$1, 32(%rsp,%rax,4)
.L5:
	movq	%r15, %rdx
	xorl	%eax, %eax
	movq	%r14, %rsi
	movq	%r13, %rdi
	movl	%r9d, 12(%rsp)
	movl	%ecx, 8(%rsp)
	call	__isoc99_scanf@PLT
	movl	24(%rsp), %edx
	movl	28(%rsp), %eax
	movl	8(%rsp), %ecx
	movl	12(%rsp), %r9d
	movl	%edx, %r8d
	orl	%eax, %r8d
	jne	.L3
	movq	%rbp, %rcx
	xorl	%r9d, %r9d
	xorl	%edi, %edi
	movl	$-1, %esi
	.p2align 4,,10
	.p2align 3
.L4:
	movl	%edi, %r10d
	xorl	%eax, %eax
	imull	%edi, %r10d
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L6:
	addq	$1, %rax
	cmpq	$1001, %rax
	je	.L23
.L8:
	cmpl	$1, (%rcx,%rax,4)
	jne	.L6
	movl	%eax, %edx
	imull	%eax, %edx
	addl	%r10d, %edx
	cmpl	%edx, %esi
	jl	.L12
	cmpl	%eax, %r8d
	jge	.L6
	cmpl	%edx, %esi
	sete	%dl
	testb	%dl, %dl
	cmovne	%edi, %r9d
	cmovne	%eax, %r8d
	addq	$1, %rax
	cmpq	$1001, %rax
	jne	.L8
.L23:
	addl	$1, %edi
	addq	$4004, %rcx
	cmpl	$1001, %edi
	jne	.L4
	movl	%r9d, %ecx
	movl	%r8d, %edx
	movq	%r12, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__printf_chk@PLT
	cmpl	%ebx, 20(%rsp)
	jg	.L2
.L9:
	movq	4008040(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L24
	addq	$4008056, %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
.L12:
	.cfi_restore_state
	movl	%edi, %r9d
	movl	%eax, %r8d
	movl	%edx, %esi
	jmp	.L6
.L24:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.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:

rule
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%d %d"
.LC2:
	.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	-4005888(%rsp), %r11
	.cfi_def_cfa 11, 4005944
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$2168, %rsp
	.cfi_def_cfa_offset 4008112
	leaq	.LC0(%rip), %rdi
	movq	%fs:40, %rax
	movq	%rax, 4008040(%rsp)
	xorl	%eax, %eax
	leaq	20(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	20(%rsp), %eax
	testl	%eax, %eax
	jle	.L9
	xorl	%ebx, %ebx
	leaq	32(%rsp), %rbp
	leaq	28(%rsp), %r15
	leaq	24(%rsp), %r14
	leaq	.LC1(%rip), %r13
	leaq	.LC2(%rip), %r12
.L2:
	movl	$4008004, %edx
	xorl	%esi, %esi
	movq	%rbp, %rdi
	call	memset@PLT
	xorl	%r9d, %r9d
	xorl	%ecx, %ecx
	jmp	.L5
.L3:
	addl	%eax, %r9d
	addl	%edx, %ecx
	movslq	%r9d, %rax
	movslq	%ecx, %rdx
	imulq	$1001, %rax, %rax
	addq	%rdx, %rax
	movl	$1, 32(%rsp,%rax,4)
.L5:
	movq	%r15, %rdx
	xorl	%eax, %eax
	movq	%r14, %rsi
	movq	%r13, %rdi
	movl	%r9d, 12(%rsp)
	movl	%ecx, 8(%rsp)
	call	__isoc99_scanf@PLT
	movl	24(%rsp), %edx
	movl	28(%rsp), %eax
	movl	8(%rsp), %ecx
	movl	12(%rsp), %r9d
	movl	%edx, %r8d
	orl	%eax, %r8d
	jne	.L3
	movq	%rbp, %rcx
	xorl	%r9d, %r9d
	xorl	%edi, %edi
	movl	$-1, %esi
	.p2align 4,,10
	.p2align 3
.L4:
	movl	%edi, %r10d
	xorl	%eax, %eax
	imull	%edi, %r10d
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L6:
	addq	$1, %rax
	cmpq	$1001, %rax
	je	.L23
.L8:
	cmpl	$1, (%rcx,%rax,4)
	jne	.L6
	movl	%eax, %edx
	imull	%eax, %edx
	addl	%r10d, %edx
	cmpl	%edx, %esi
	jl	.L12
	cmpl	%eax, %r8d
	jge	.L6
	cmpl	%edx, %esi
	sete	%dl
	testb	%dl, %dl
	cmovne	%edi, %r9d
	cmovne	%eax, %r8d
	addq	$1, %rax
	cmpq	$1001, %rax
	jne	.L8
.L23:
	addl	$1, %edi
	addq	$4004, %rcx
	cmpl	$1001, %edi
	jne	.L4
	movl	%r9d, %ecx
	movl	%r8d, %edx
	movq	%r12, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__printf_chk@PLT
	cmpl	%ebx, 20(%rsp)
	jg	.L2
.L9:
	movq	4008040(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L24
	addq	$4008056, %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
.L12:
	.cfi_restore_state
	movl	%edi, %r9d
	movl	%eax, %r8d
	movl	%edx, %esi
	jmp	.L6
.L24:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.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:

#include <stdio.h>

main(){
  int n, i, j, dx, dy, x, y, count;
  int map[1001][1001], dist, temp, ans[2];

  scanf("%d", &n);

  for(count=0;count<n;count++){
    x=y=0;
    for(i=0;i<1001;i++){
      for(j=0;j<1001;j++){
        map[i][j]=0;
      }
    }
    while(1){
      scanf("%d %d", &dx, &dy);
      if(dx==0 && dy==0) break;

      x+=dx;
      y+=dy;

      map[y][x]=1;
    }

    dist=-1;
    ans[0]=ans[1]=0;
    for(i=0;i<1001;i++){
      for(j=0;j<1001;j++){
        if(map[i][j]==1){
          temp=i*i+j*j;
          if(dist<temp){
	    dist=temp;
            ans[0]=j;
            ans[1]=i;
          }
          else if(dist==temp){
            if(ans[0]<j){
              dist=temp;
              ans[0]=j;
              ans[1]=i;
            }
          }
        }
      }
    }
    printf("%d %d\n", ans[0], ans[1]);
  }
  return 0;
}
3
1 0
0 1
-1 0
1 0
0 5
-1 0
0 -1
5 0
0 1
0 -1
1 0
0 -4
-3 0
0 3
0 0
0 -2
-1 0
0 1
0 -1
1 0
0 2
-2 0
0 -3
3 0
0 4
-4 0
0 -5
-2 0
0 0
1 0
-1 0
0 0
2 0
0 1
-1 0
0 1
-1 0
0 -2
0 0
 3
1 0
0 1
-1 0
1 0
0 5
-1 0
0 -1
5 0
0 1
0 -1
1 0
0 -4
-3 0
0 3
0 0
0 -2
-1 0
0 1
0 -1
1 0
0 1
-2 0
0 -3
3 0
0 4
-4 0
0 -5
-2 0
0 0
1 0
-1 0
0 0
2 0
0 1
-1 0
0 1
-1 0
0 -2
0 0
 3
1 0
0 1
-1 0
1 0
0 5
-1 0
0 -1
5 0
0 1
0 -1
1 0
0 -4
-3 0
0 3
2 0
0 -2
-1 0
0 1
0 -1
1 0
0 2
-2 0
0 -3
3 0
0 4
-4 0
0 -5
-2 0
0 0
1 0
-2 0
0 0
2 0
0 1
-1 0
0 1
-1 0
0 -2
0 0
 3
1 0
0 1
0 0
1 0
0 5
-1 0
0 -1
5 0
0 1
0 -1
1 0
0 -4
-3 0
0 3
0 0
0 -2
-1 0
0 1
0 -1
1 0
0 1
-2 0
0 -3
3 0
0 4
-4 0
0 -5
-2 0
0 0
1 0
-1 0
0 0
2 0
0 1
-1 0
0 1
-1 0
0 -2
0 0
 3
1 0
0 1
-1 0
1 0
0 5
-1 0
0 -1
5 0
0 1
0 -1
1 0
0 -4
-3 0
0 3
2 0
0 -2
-1 0
0 1
0 -1
1 0
0 2
-2 0
0 -3
3 0
0 4
-4 0
0 -5
-2 0
0 0
1 0
-3 0
0 0
2 0
0 1
-1 0
0 1
-1 0
0 -2
0 0
 3
1 0
0 1
0 0
1 0
0 4
-1 0
0 -1
5 0
0 1
0 -1
1 0
0 -4
-3 0
0 4
0 0
0 -2
-1 0
0 1
0 -1
1 0
0 1
-2 0
0 -3
3 0
0 4
-4 0
0 -5
-2 0
0 0
1 0
-1 0
0 0
2 0
0 1
-1 0
0 1
-1 0
0 -2
0 0
 3
1 0
0 1
-1 0
1 0
0 5
-1 0
0 -1
5 0
0 1
0 -2
1 0
0 -5
-3 0
0 3
2 0
0 -2
-2 0
0 1
0 -1
1 0
0 2
-2 0
0 -3
3 0
-1 4
-4 0
0 -5
-2 0
0 0
1 0
-3 0
0 0
2 0
0 1
-1 0
0 1
-1 0
0 -2
0 0
 3
1 0
0 1
-1 0
1 0
0 5
0 0
0 -1
5 0
0 1
0 -1
1 0
0 -4
-3 0
0 3
0 0
0 -2
-1 0
0 1
0 -1
1 0
0 1
-2 0
0 -3
3 0
0 4
-4 0
0 -5
-2 0
0 0
1 0
-1 0
0 0
2 0
0 1
-1 0
0 1
-1 0
0 -2
0 0
 3
1 0
0 1
0 0
1 0
0 5
-1 0
0 -1
5 0
0 1
0 -1
1 0
0 -4
-3 0
0 3
0 0
0 -2
-1 0
0 1
0 -1
1 0
0 1
-2 0
0 -3
4 0
0 4
-4 0
0 -5
-2 0
0 0
1 0
-1 0
0 0
2 0
0 1
-1 0
0 1
-1 0
0 -2
0 0
 3
1 0
0 1
-1 0
1 0
0 5
-1 0
0 -1
5 0
0 1
0 -1
1 0
0 -4
-3 0
0 3
2 0
0 -2
-1 0
0 1
0 -1
1 0
0 2
-1 0
0 -3
3 0
0 4
-4 0
0 -3
-2 0
0 0
1 0
-1 0
0 0
2 0
0 1
-1 0
0 1
-1 0
0 -2
0 0

6 5
998 0
1 0
 6 5
1 0
1 0
 6 5
1 0
2 1
 1 1
6 4
1 0
 6 5
1 0
2 1
 1 1
6 3
1 0
 5 6
1 0
2 1
 1 6
5 0
1 0
 1 1
6 4
2 0
 7 5
1 0
2 1

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 n, i, j, dx, dy, x, y, count;
  int map[1001][1001], dist, temp, ans[2];

  scanf("%d", &n);

  for(count=0;count<n;count++){
    x=y=0;
    for(i=0;i<1001;i++){
      for(j=0;j<1001;j++){
        map[i][j]=0;
      }
    }
    while(1){
      scanf("%d %d", &dx, &dy);
      if(dx==0 && dy==0) break;

      x+=dx;
      y+=dy;

      map[y][x]=1;
    }

    dist=-1;
    ans[0]=ans[1]=0;
    for(i=0;i<1001;i++){
      for(j=0;j<1001;j++){
        if(map[i][j]==1){
          temp=i*i+j*j;
          if(dist<temp){
	    dist=temp;
            ans[0]=j;
            ans[1]=i;
          }
          else if(dist==temp){
            if(ans[0]<j){
              dist=temp;
              ans[0]=j;
              ans[1]=i;
            }
          }
        }
      }
    }
    printf("%d %d\n", ans[0], ans[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
	leaq	-4005888(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$2176, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-4008064(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -4008036(%rbp)
	jmp	.L2
.L16:
	movl	$0, -4008040(%rbp)
	movl	-4008040(%rbp), %eax
	movl	%eax, -4008044(%rbp)
	movl	$0, -4008052(%rbp)
	jmp	.L3
.L6:
	movl	$0, -4008048(%rbp)
	jmp	.L4
.L5:
	movl	-4008048(%rbp), %eax
	movslq	%eax, %rdx
	movl	-4008052(%rbp), %eax
	cltq
	imulq	$1001, %rax, %rax
	addq	%rdx, %rax
	movl	$0, -4008016(%rbp,%rax,4)
	addl	$1, -4008048(%rbp)
.L4:
	cmpl	$1000, -4008048(%rbp)
	jle	.L5
	addl	$1, -4008052(%rbp)
.L3:
	cmpl	$1000, -4008052(%rbp)
	jle	.L6
.L9:
	leaq	-4008056(%rbp), %rdx
	leaq	-4008060(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-4008060(%rbp), %eax
	testl	%eax, %eax
	jne	.L7
	movl	-4008056(%rbp), %eax
	testl	%eax, %eax
	je	.L20
.L7:
	movl	-4008060(%rbp), %eax
	addl	%eax, -4008044(%rbp)
	movl	-4008056(%rbp), %eax
	addl	%eax, -4008040(%rbp)
	movl	-4008044(%rbp), %eax
	movslq	%eax, %rdx
	movl	-4008040(%rbp), %eax
	cltq
	imulq	$1001, %rax, %rax
	addq	%rdx, %rax
	movl	$1, -4008016(%rbp,%rax,4)
	jmp	.L9
.L20:
	nop
	movl	$-1, -4008032(%rbp)
	movl	$0, -4008020(%rbp)
	movl	-4008020(%rbp), %eax
	movl	%eax, -4008024(%rbp)
	movl	$0, -4008052(%rbp)
	jmp	.L10
.L15:
	movl	$0, -4008048(%rbp)
	jmp	.L11
.L14:
	movl	-4008048(%rbp), %eax
	movslq	%eax, %rdx
	movl	-4008052(%rbp), %eax
	cltq
	imulq	$1001, %rax, %rax
	addq	%rdx, %rax
	movl	-4008016(%rbp,%rax,4), %eax
	cmpl	$1, %eax
	jne	.L12
	movl	-4008052(%rbp), %eax
	imull	%eax, %eax
	movl	%eax, %edx
	movl	-4008048(%rbp), %eax
	imull	%eax, %eax
	addl	%edx, %eax
	movl	%eax, -4008028(%rbp)
	movl	-4008032(%rbp), %eax
	cmpl	-4008028(%rbp), %eax
	jge	.L13
	movl	-4008028(%rbp), %eax
	movl	%eax, -4008032(%rbp)
	movl	-4008048(%rbp), %eax
	movl	%eax, -4008024(%rbp)
	movl	-4008052(%rbp), %eax
	movl	%eax, -4008020(%rbp)
	jmp	.L12
.L13:
	movl	-4008032(%rbp), %eax
	cmpl	-4008028(%rbp), %eax
	jne	.L12
	movl	-4008024(%rbp), %eax
	cmpl	%eax, -4008048(%rbp)
	jle	.L12
	movl	-4008028(%rbp), %eax
	movl	%eax, -4008032(%rbp)
	movl	-4008048(%rbp), %eax
	movl	%eax, -4008024(%rbp)
	movl	-4008052(%rbp), %eax
	movl	%eax, -4008020(%rbp)
.L12:
	addl	$1, -4008048(%rbp)
.L11:
	cmpl	$1000, -4008048(%rbp)
	jle	.L14
	addl	$1, -4008052(%rbp)
.L10:
	cmpl	$1000, -4008052(%rbp)
	jle	.L15
	movl	-4008020(%rbp), %edx
	movl	-4008024(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -4008036(%rbp)
.L2:
	movl	-4008064(%rbp), %eax
	cmpl	%eax, -4008036(%rbp)
	jl	.L16
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L18
	call	__stack_chk_fail@PLT
.L18:
	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
	leaq	-4005888(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$2176, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-4008064(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -4008036(%rbp)
	jmp	.L2
.L16:
	movl	$0, -4008040(%rbp)
	movl	-4008040(%rbp), %eax
	movl	%eax, -4008044(%rbp)
	movl	$0, -4008052(%rbp)
	jmp	.L3
.L6:
	movl	$0, -4008048(%rbp)
	jmp	.L4
.L5:
	movl	-4008048(%rbp), %eax
	movslq	%eax, %rdx
	movl	-4008052(%rbp), %eax
	cltq
	imulq	$1001, %rax, %rax
	addq	%rdx, %rax
	movl	$0, -4008016(%rbp,%rax,4)
	addl	$1, -4008048(%rbp)
.L4:
	cmpl	$1000, -4008048(%rbp)
	jle	.L5
	addl	$1, -4008052(%rbp)
.L3:
	cmpl	$1000, -4008052(%rbp)
	jle	.L6
.L9:
	leaq	-4008056(%rbp), %rdx
	leaq	-4008060(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-4008060(%rbp), %eax
	testl	%eax, %eax
	jne	.L7
	movl	-4008056(%rbp), %eax
	testl	%eax, %eax
	je	.L20
.L7:
	movl	-4008060(%rbp), %eax
	addl	%eax, -4008044(%rbp)
	movl	-4008056(%rbp), %eax
	addl	%eax, -4008040(%rbp)
	movl	-4008044(%rbp), %eax
	movslq	%eax, %rdx
	movl	-4008040(%rbp), %eax
	cltq
	imulq	$1001, %rax, %rax
	addq	%rdx, %rax
	movl	$1, -4008016(%rbp,%rax,4)
	jmp	.L9
.L20:
	nop
	movl	$-1, -4008032(%rbp)
	movl	$0, -4008020(%rbp)
	movl	-4008020(%rbp), %eax
	movl	%eax, -4008024(%rbp)
	movl	$0, -4008052(%rbp)
	jmp	.L10
.L15:
	movl	$0, -4008048(%rbp)
	jmp	.L11
.L14:
	movl	-4008048(%rbp), %eax
	movslq	%eax, %rdx
	movl	-4008052(%rbp), %eax
	cltq
	imulq	$1001, %rax, %rax
	addq	%rdx, %rax
	movl	-4008016(%rbp,%rax,4), %eax
	cmpl	$1, %eax
	jne	.L12
	movl	-4008052(%rbp), %eax
	imull	%eax, %eax
	movl	%eax, %edx
	movl	-4008048(%rbp), %eax
	imull	%eax, %eax
	addl	%edx, %eax
	movl	%eax, -4008028(%rbp)
	movl	-4008032(%rbp), %eax
	cmpl	-4008028(%rbp), %eax
	jge	.L13
	movl	-4008028(%rbp), %eax
	movl	%eax, -4008032(%rbp)
	movl	-4008048(%rbp), %eax
	movl	%eax, -4008024(%rbp)
	movl	-4008052(%rbp), %eax
	movl	%eax, -4008020(%rbp)
	jmp	.L12
.L13:
	movl	-4008032(%rbp), %eax
	cmpl	-4008028(%rbp), %eax
	jne	.L12
	movl	-4008024(%rbp), %eax
	cmpl	%eax, -4008048(%rbp)
	jle	.L12
	movl	-4008028(%rbp), %eax
	movl	%eax, -4008032(%rbp)
	movl	-4008048(%rbp), %eax
	movl	%eax, -4008024(%rbp)
	movl	-4008052(%rbp), %eax
	movl	%eax, -4008020(%rbp)
.L12:
	addl	$1, -4008048(%rbp)
.L11:
	cmpl	$1000, -4008048(%rbp)
	jle	.L14
	addl	$1, -4008052(%rbp)
.L10:
	cmpl	$1000, -4008052(%rbp)
	jle	.L15
	movl	-4008020(%rbp), %edx
	movl	-4008024(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -4008036(%rbp)
.L2:
	movl	-4008064(%rbp), %eax
	cmpl	%eax, -4008036(%rbp)
	jl	.L16
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L18
	call	__stack_chk_fail@PLT
.L18:
	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:
