Given the following C code and 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;
}```

Assembly Code:

```assembly
	.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:
```

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.
Optimized Assembly Code:

user
```assembly
	.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
```assembly
	.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:
```
```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;
}```
Given the following C 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;
}```

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.
Optimized Assembly Code:

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 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;
}```

Assembly Code:

```assembly
	.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:
```

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.
Optimized Assembly Code:

train
```assembly
	.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:
```