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>
#include<string.h>

long ship[100][100];

int main(){
  int k,r,i,a,b,n,j,ii;
  long p;
  while(1){
    scanf("%d %d",&n,&k);
    if(n==0) break;
    memset(ship,8,sizeof(ship));
    for(i=0;i<n;i++){
    	ship[i][i]=0;
    }
    for(i=0;i<k;i++){
      scanf("%d",&r);
      if(r==0){
        scanf("%d %d",&a,&b);
        printf("%ld\n",(ship[a-1][b-1]>100000001)?-1:ship[a-1][b-1]);
      }else{
        scanf("%d %d %ld",&a,&b,&p);
        for(j=0;j<n;j++){
        	for(ii=0;ii<n;ii++){
        		if(ship[j][b-1]+p+ship[a-1][ii]<ship[j][ii]){
        			ship[j][ii]=ship[j][b-1]+p+ship[a-1][ii];
        			ship[ii][j]=ship[j][b-1]+p+ship[a-1][ii];
        		}
        		if(ship[j][a-1]+p+ship[b-1][ii]<ship[j][ii]){
        			ship[j][ii]=ship[j][a-1]+p+ship[b-1][ii];
        			ship[ii][j]=ship[j][a-1]+p+ship[b-1][ii];
        		}
        	}
        }
      }
    }
  }
  return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	ship
	.bss
	.align 32
	.type	ship, @object
	.size	ship, 80000
ship:
	.zero	80000
	.section	.rodata
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%ld\n"
.LC3:
	.string	"%d %d %ld"
	.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	$48, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
.L18:
	leaq	-48(%rbp), %rdx
	leaq	-32(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-32(%rbp), %eax
	testl	%eax, %eax
	je	.L22
	movl	$80000, %edx
	movl	$8, %esi
	leaq	ship(%rip), %rax
	movq	%rax, %rdi
	call	memset@PLT
	movl	$0, -28(%rbp)
	jmp	.L4
.L5:
	movl	-28(%rbp), %eax
	cltq
	imulq	$808, %rax, %rax
	leaq	ship(%rip), %rdx
	movq	$0, (%rax,%rdx)
	addl	$1, -28(%rbp)
.L4:
	movl	-32(%rbp), %eax
	cmpl	%eax, -28(%rbp)
	jl	.L5
	movl	$0, -28(%rbp)
	jmp	.L6
.L17:
	leaq	-44(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-44(%rbp), %eax
	testl	%eax, %eax
	jne	.L7
	leaq	-36(%rbp), %rdx
	leaq	-40(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-40(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-36(%rbp), %eax
	subl	$1, %eax
	movslq	%eax, %rcx
	movslq	%edx, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,8), %rdx
	leaq	ship(%rip), %rax
	movq	(%rdx,%rax), %rax
	cmpq	$100000001, %rax
	jg	.L8
	movl	-40(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-36(%rbp), %eax
	subl	$1, %eax
	movslq	%eax, %rcx
	movslq	%edx, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,8), %rdx
	leaq	ship(%rip), %rax
	movq	(%rdx,%rax), %rax
	jmp	.L9
.L8:
	movq	$-1, %rax
.L9:
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L10
.L7:
	leaq	-16(%rbp), %rcx
	leaq	-36(%rbp), %rdx
	leaq	-40(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -24(%rbp)
	jmp	.L11
.L16:
	movl	$0, -20(%rbp)
	jmp	.L12
.L15:
	movl	-36(%rbp), %eax
	subl	$1, %eax
	movslq	%eax, %rcx
	movl	-24(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,8), %rdx
	leaq	ship(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movq	-16(%rbp), %rax
	leaq	(%rdx,%rax), %rsi
	movl	-40(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-20(%rbp), %eax
	movslq	%eax, %rcx
	movslq	%edx, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,8), %rdx
	leaq	ship(%rip), %rax
	movq	(%rdx,%rax), %rax
	leaq	(%rsi,%rax), %rcx
	movl	-20(%rbp), %eax
	movslq	%eax, %rsi
	movl	-24(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,8), %rdx
	leaq	ship(%rip), %rax
	movq	(%rdx,%rax), %rax
	cmpq	%rax, %rcx
	jge	.L13
	movl	-36(%rbp), %eax
	subl	$1, %eax
	movslq	%eax, %rcx
	movl	-24(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,8), %rdx
	leaq	ship(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movq	-16(%rbp), %rax
	leaq	(%rdx,%rax), %rsi
	movl	-40(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-20(%rbp), %eax
	movslq	%eax, %rcx
	movslq	%edx, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,8), %rdx
	leaq	ship(%rip), %rax
	movq	(%rdx,%rax), %rax
	leaq	(%rsi,%rax), %rcx
	movl	-20(%rbp), %eax
	movslq	%eax, %rsi
	movl	-24(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,8), %rdx
	leaq	ship(%rip), %rax
	movq	%rcx, (%rdx,%rax)
	movl	-36(%rbp), %eax
	subl	$1, %eax
	movslq	%eax, %rcx
	movl	-24(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,8), %rdx
	leaq	ship(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movq	-16(%rbp), %rax
	leaq	(%rdx,%rax), %rsi
	movl	-40(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-20(%rbp), %eax
	movslq	%eax, %rcx
	movslq	%edx, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,8), %rdx
	leaq	ship(%rip), %rax
	movq	(%rdx,%rax), %rax
	leaq	(%rsi,%rax), %rcx
	movl	-24(%rbp), %eax
	movslq	%eax, %rsi
	movl	-20(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,8), %rdx
	leaq	ship(%rip), %rax
	movq	%rcx, (%rdx,%rax)
.L13:
	movl	-40(%rbp), %eax
	subl	$1, %eax
	movslq	%eax, %rcx
	movl	-24(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,8), %rdx
	leaq	ship(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movq	-16(%rbp), %rax
	leaq	(%rdx,%rax), %rsi
	movl	-36(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-20(%rbp), %eax
	movslq	%eax, %rcx
	movslq	%edx, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,8), %rdx
	leaq	ship(%rip), %rax
	movq	(%rdx,%rax), %rax
	leaq	(%rsi,%rax), %rcx
	movl	-20(%rbp), %eax
	movslq	%eax, %rsi
	movl	-24(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,8), %rdx
	leaq	ship(%rip), %rax
	movq	(%rdx,%rax), %rax
	cmpq	%rax, %rcx
	jge	.L14
	movl	-40(%rbp), %eax
	subl	$1, %eax
	movslq	%eax, %rcx
	movl	-24(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,8), %rdx
	leaq	ship(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movq	-16(%rbp), %rax
	leaq	(%rdx,%rax), %rsi
	movl	-36(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-20(%rbp), %eax
	movslq	%eax, %rcx
	movslq	%edx, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,8), %rdx
	leaq	ship(%rip), %rax
	movq	(%rdx,%rax), %rax
	leaq	(%rsi,%rax), %rcx
	movl	-20(%rbp), %eax
	movslq	%eax, %rsi
	movl	-24(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,8), %rdx
	leaq	ship(%rip), %rax
	movq	%rcx, (%rdx,%rax)
	movl	-40(%rbp), %eax
	subl	$1, %eax
	movslq	%eax, %rcx
	movl	-24(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,8), %rdx
	leaq	ship(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movq	-16(%rbp), %rax
	leaq	(%rdx,%rax), %rsi
	movl	-36(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-20(%rbp), %eax
	movslq	%eax, %rcx
	movslq	%edx, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,8), %rdx
	leaq	ship(%rip), %rax
	movq	(%rdx,%rax), %rax
	leaq	(%rsi,%rax), %rcx
	movl	-24(%rbp), %eax
	movslq	%eax, %rsi
	movl	-20(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,8), %rdx
	leaq	ship(%rip), %rax
	movq	%rcx, (%rdx,%rax)
.L14:
	addl	$1, -20(%rbp)
.L12:
	movl	-32(%rbp), %eax
	cmpl	%eax, -20(%rbp)
	jl	.L15
	addl	$1, -24(%rbp)
.L11:
	movl	-32(%rbp), %eax
	cmpl	%eax, -24(%rbp)
	jl	.L16
.L10:
	addl	$1, -28(%rbp)
.L6:
	movl	-48(%rbp), %eax
	cmpl	%eax, -28(%rbp)
	jl	.L17
	jmp	.L18
.L22:
	nop
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L20
	call	__stack_chk_fail@PLT
.L20:
	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"
.LC2:
	.string	"%ld\n"
.LC3:
	.string	"%d %d %ld"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB35:
	.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
	subq	$104, %rsp
	.cfi_def_cfa_offset 160
	movq	%fs:40, %rax
	movq	%rax, 88(%rsp)
	xorl	%eax, %eax
	leaq	60(%rsp), %rax
	movq	%rax, 40(%rsp)
	leaq	76(%rsp), %rax
	movq	%rax, 32(%rsp)
.L8:
	movq	40(%rsp), %rdx
	movq	32(%rsp), %rsi
	leaq	.LC0(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	76(%rsp), %ebx
	testl	%ebx, %ebx
	je	.L2
	movl	$80000, %edx
	movl	$8, %esi
	leaq	ship(%rip), %rdi
	call	memset@PLT
	testl	%ebx, %ebx
	jle	.L7
	leal	-1(%rbx), %edx
	leaq	ship(%rip), %rax
	imulq	$808, %rdx, %rdx
	leaq	808(%rax), %rbx
	addq	%rbx, %rdx
	.p2align 4,,10
	.p2align 3
.L6:
	movq	$0, (%rax)
	addq	$808, %rax
	cmpq	%rdx, %rax
	jne	.L6
.L7:
	movl	60(%rsp), %edx
	testl	%edx, %edx
	jle	.L8
	leaq	64(%rsp), %rax
	xorl	%r15d, %r15d
	movq	%rax, (%rsp)
	leaq	72(%rsp), %rax
	movq	%rax, 16(%rsp)
	leaq	68(%rsp), %rax
	movq	%rax, 8(%rsp)
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L27:
	movq	16(%rsp), %rdx
	movq	8(%rsp), %rsi
	leaq	.LC0(%rip), %rdi
	xorl	%eax, %eax
	leaq	ship(%rip), %rbx
	call	__isoc99_scanf@PLT
	movl	72(%rsp), %eax
	movl	$1, %edi
	leaq	.LC2(%rip), %rsi
	leal	-1(%rax), %edx
	movl	68(%rsp), %eax
	movslq	%edx, %rdx
	subl	$1, %eax
	cltq
	leaq	(%rax,%rax,4), %rax
	leaq	(%rax,%rax,4), %rax
	leaq	(%rdx,%rax,4), %rax
	movq	(%rbx,%rax,8), %rdx
	movq	$-1, %rax
	cmpq	$100000002, %rdx
	cmovge	%rax, %rdx
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L11:
	addl	$1, %r15d
	cmpl	%r15d, 60(%rsp)
	jle	.L8
.L4:
	movq	(%rsp), %rsi
	leaq	.LC1(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	64(%rsp), %eax
	testl	%eax, %eax
	je	.L27
	movq	16(%rsp), %rdx
	movq	8(%rsp), %rsi
	leaq	80(%rsp), %rcx
	xorl	%eax, %eax
	leaq	.LC3(%rip), %rdi
	call	__isoc99_scanf@PLT
	movl	76(%rsp), %eax
	testl	%eax, %eax
	jle	.L11
	leal	-1(%rax), %ecx
	movq	80(%rsp), %r8
	movl	%r15d, 28(%rsp)
	xorl	%r12d, %r12d
	leaq	(%rcx,%rcx,4), %rax
	leaq	ship(%rip), %r13
	leaq	(%rax,%rax,4), %rbp
	leaq	800(%r13), %rax
	movq	%r13, %rbx
	salq	$5, %rbp
	addq	$8, %rbx
	addq	%rax, %rbp
	movl	68(%rsp), %eax
	leaq	(%rbx,%rcx,8), %rcx
	movq	%rcx, %r15
	leal	-1(%rax), %edx
	movl	72(%rsp), %eax
	movslq	%edx, %rdx
	subl	$1, %eax
	leaq	0(,%rdx,8), %r14
	leaq	(%rdx,%rdx,4), %rdx
	cltq
	leaq	(%rdx,%rdx,4), %rbx
	leaq	(%r14,%r13), %r9
	leaq	0(%r13,%rax,8), %r10
	leaq	(%rax,%rax,4), %rax
	salq	$5, %rbx
	leaq	(%rax,%rax,4), %r11
	salq	$5, %r11
	.p2align 4,,10
	.p2align 3
.L16:
	movq	%r9, %rax
	movq	%r13, %rcx
	subq	%r14, %rax
	.p2align 4,,10
	.p2align 3
.L15:
	movq	(%r10), %rdx
	leaq	(%rax,%r12), %rsi
	movq	(%rax), %rdi
	addq	%r8, %rdx
	addq	(%rsi,%rbx), %rdx
	cmpq	%rdi, %rdx
	jge	.L13
	movq	%rdx, (%rax)
	movq	(%r10), %rdx
	addq	%r8, %rdx
	addq	(%rsi,%rbx), %rdx
	movq	%rdx, (%rcx)
	movq	(%rax), %rdi
.L13:
	movq	(%r9), %rdx
	addq	%r8, %rdx
	addq	(%rsi,%r11), %rdx
	cmpq	%rdi, %rdx
	jge	.L14
	movq	%rdx, (%rax)
	movq	(%r9), %rdx
	addq	%r8, %rdx
	addq	(%rsi,%r11), %rdx
	movq	%rdx, (%rcx)
.L14:
	addq	$800, %rcx
	addq	$8, %rax
	cmpq	%rbp, %rcx
	jne	.L15
	addq	$8, %r13
	addq	$8, %rbp
	addq	$800, %r9
	subq	$800, %r12
	addq	$800, %r10
	cmpq	%r15, %r13
	jne	.L16
	movl	28(%rsp), %r15d
	jmp	.L11
.L2:
	movq	88(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L28
	addq	$104, %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
.L28:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE35:
	.size	main, .-main
	.globl	ship
	.bss
	.align 32
	.type	ship, @object
	.size	ship, 80000
ship:
	.zero	80000
	.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"
.LC2:
	.string	"%ld\n"
.LC3:
	.string	"%d %d %ld"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB35:
	.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
	subq	$104, %rsp
	.cfi_def_cfa_offset 160
	movq	%fs:40, %rax
	movq	%rax, 88(%rsp)
	xorl	%eax, %eax
	leaq	60(%rsp), %rax
	movq	%rax, 40(%rsp)
	leaq	76(%rsp), %rax
	movq	%rax, 32(%rsp)
.L8:
	movq	40(%rsp), %rdx
	movq	32(%rsp), %rsi
	leaq	.LC0(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	76(%rsp), %ebx
	testl	%ebx, %ebx
	je	.L2
	movl	$80000, %edx
	movl	$8, %esi
	leaq	ship(%rip), %rdi
	call	memset@PLT
	testl	%ebx, %ebx
	jle	.L7
	leal	-1(%rbx), %edx
	leaq	ship(%rip), %rax
	imulq	$808, %rdx, %rdx
	leaq	808(%rax), %rbx
	addq	%rbx, %rdx
	.p2align 4,,10
	.p2align 3
.L6:
	movq	$0, (%rax)
	addq	$808, %rax
	cmpq	%rdx, %rax
	jne	.L6
.L7:
	movl	60(%rsp), %edx
	testl	%edx, %edx
	jle	.L8
	leaq	64(%rsp), %rax
	xorl	%r15d, %r15d
	movq	%rax, (%rsp)
	leaq	72(%rsp), %rax
	movq	%rax, 16(%rsp)
	leaq	68(%rsp), %rax
	movq	%rax, 8(%rsp)
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L27:
	movq	16(%rsp), %rdx
	movq	8(%rsp), %rsi
	leaq	.LC0(%rip), %rdi
	xorl	%eax, %eax
	leaq	ship(%rip), %rbx
	call	__isoc99_scanf@PLT
	movl	72(%rsp), %eax
	movl	$1, %edi
	leaq	.LC2(%rip), %rsi
	leal	-1(%rax), %edx
	movl	68(%rsp), %eax
	movslq	%edx, %rdx
	subl	$1, %eax
	cltq
	leaq	(%rax,%rax,4), %rax
	leaq	(%rax,%rax,4), %rax
	leaq	(%rdx,%rax,4), %rax
	movq	(%rbx,%rax,8), %rdx
	movq	$-1, %rax
	cmpq	$100000002, %rdx
	cmovge	%rax, %rdx
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L11:
	addl	$1, %r15d
	cmpl	%r15d, 60(%rsp)
	jle	.L8
.L4:
	movq	(%rsp), %rsi
	leaq	.LC1(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	64(%rsp), %eax
	testl	%eax, %eax
	je	.L27
	movq	16(%rsp), %rdx
	movq	8(%rsp), %rsi
	leaq	80(%rsp), %rcx
	xorl	%eax, %eax
	leaq	.LC3(%rip), %rdi
	call	__isoc99_scanf@PLT
	movl	76(%rsp), %eax
	testl	%eax, %eax
	jle	.L11
	leal	-1(%rax), %ecx
	movq	80(%rsp), %r8
	movl	%r15d, 28(%rsp)
	xorl	%r12d, %r12d
	leaq	(%rcx,%rcx,4), %rax
	leaq	ship(%rip), %r13
	leaq	(%rax,%rax,4), %rbp
	leaq	800(%r13), %rax
	movq	%r13, %rbx
	salq	$5, %rbp
	addq	$8, %rbx
	addq	%rax, %rbp
	movl	68(%rsp), %eax
	leaq	(%rbx,%rcx,8), %rcx
	movq	%rcx, %r15
	leal	-1(%rax), %edx
	movl	72(%rsp), %eax
	movslq	%edx, %rdx
	subl	$1, %eax
	leaq	0(,%rdx,8), %r14
	leaq	(%rdx,%rdx,4), %rdx
	cltq
	leaq	(%rdx,%rdx,4), %rbx
	leaq	(%r14,%r13), %r9
	leaq	0(%r13,%rax,8), %r10
	leaq	(%rax,%rax,4), %rax
	salq	$5, %rbx
	leaq	(%rax,%rax,4), %r11
	salq	$5, %r11
	.p2align 4,,10
	.p2align 3
.L16:
	movq	%r9, %rax
	movq	%r13, %rcx
	subq	%r14, %rax
	.p2align 4,,10
	.p2align 3
.L15:
	movq	(%r10), %rdx
	leaq	(%rax,%r12), %rsi
	movq	(%rax), %rdi
	addq	%r8, %rdx
	addq	(%rsi,%rbx), %rdx
	cmpq	%rdi, %rdx
	jge	.L13
	movq	%rdx, (%rax)
	movq	(%r10), %rdx
	addq	%r8, %rdx
	addq	(%rsi,%rbx), %rdx
	movq	%rdx, (%rcx)
	movq	(%rax), %rdi
.L13:
	movq	(%r9), %rdx
	addq	%r8, %rdx
	addq	(%rsi,%r11), %rdx
	cmpq	%rdi, %rdx
	jge	.L14
	movq	%rdx, (%rax)
	movq	(%r9), %rdx
	addq	%r8, %rdx
	addq	(%rsi,%r11), %rdx
	movq	%rdx, (%rcx)
.L14:
	addq	$800, %rcx
	addq	$8, %rax
	cmpq	%rbp, %rcx
	jne	.L15
	addq	$8, %r13
	addq	$8, %rbp
	addq	$800, %r9
	subq	$800, %r12
	addq	$800, %r10
	cmpq	%r15, %r13
	jne	.L16
	movl	28(%rsp), %r15d
	jmp	.L11
.L2:
	movq	88(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L28
	addq	$104, %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
.L28:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE35:
	.size	main, .-main
	.globl	ship
	.bss
	.align 32
	.type	ship, @object
	.size	ship, 80000
ship:
	.zero	80000
	.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>
#include<string.h>

long ship[100][100];

int main(){
  int k,r,i,a,b,n,j,ii;
  long p;
  while(1){
    scanf("%d %d",&n,&k);
    if(n==0) break;
    memset(ship,8,sizeof(ship));
    for(i=0;i<n;i++){
    	ship[i][i]=0;
    }
    for(i=0;i<k;i++){
      scanf("%d",&r);
      if(r==0){
        scanf("%d %d",&a,&b);
        printf("%ld\n",(ship[a-1][b-1]>100000001)?-1:ship[a-1][b-1]);
      }else{
        scanf("%d %d %ld",&a,&b,&p);
        for(j=0;j<n;j++){
        	for(ii=0;ii<n;ii++){
        		if(ship[j][b-1]+p+ship[a-1][ii]<ship[j][ii]){
        			ship[j][ii]=ship[j][b-1]+p+ship[a-1][ii];
        			ship[ii][j]=ship[j][b-1]+p+ship[a-1][ii];
        		}
        		if(ship[j][a-1]+p+ship[b-1][ii]<ship[j][ii]){
        			ship[j][ii]=ship[j][a-1]+p+ship[b-1][ii];
        			ship[ii][j]=ship[j][a-1]+p+ship[b-1][ii];
        		}
        	}
        }
      }
    }
  }
  return 0;
}
3 8
1 3 1 10
0 2 3
1 2 2 20
1 1 2 5
0 3 2
1 1 3 7
1 2 1 9
0 2 3
5 16
1 1 2 343750
1 1 3 3343
1 1 4 347392
1 1 5 5497
1 2 3 123394
1 2 4 545492
1 2 5 458
1 3 4 343983
1 3 5 843468
1 4 5 15934
0 2 1
0 4 1
0 3 2
0 4 2
0 4 3
0 5 3
0 0
 3 8
1 3 1 10
0 2 3
1 2 2 20
1 1 1 5
0 3 2
1 1 3 7
1 2 1 9
0 2 3
5 16
1 1 2 343750
1 1 3 3343
1 1 4 347392
1 1 5 5497
1 2 3 212055
1 2 4 545492
1 2 5 458
1 3 4 343983
1 3 5 843468
1 4 5 15934
0 2 1
0 4 1
0 3 2
0 4 2
0 4 3
0 5 3
0 0
 3 8
1 3 1 10
0 2 3
1 2 2 20
1 1 2 5
0 3 2
1 1 3 7
1 2 1 9
0 2 3
5 16
1 1 2 343750
1 1 3 3343
1 1 4 150117
1 1 5 5497
1 2 3 123394
1 2 4 545492
1 2 5 458
1 3 4 343983
1 3 5 843468
1 4 5 15934
0 2 1
0 4 2
0 3 2
0 4 2
0 4 3
0 5 3
0 0
 3 8
1 3 1 10
0 2 3
1 2 3 20
1 1 2 5
0 3 2
1 1 3 7
1 2 1 9
0 2 3
5 16
1 1 2 343750
1 1 3 3343
1 1 4 347392
1 1 5 5497
1 2 3 123394
1 2 4 545492
1 2 5 458
1 3 4 343983
1 3 5 843468
1 4 5 15934
0 2 1
0 4 1
0 1 2
0 4 2
0 4 3
0 5 3
0 0
 3 8
1 3 1 10
0 2 3
1 2 3 20
1 1 2 5
0 3 2
1 1 3 7
1 2 1 9
0 2 3
5 16
1 1 2 85440
1 1 3 3343
1 1 4 347392
1 1 5 5497
1 2 3 123394
1 2 4 545492
1 2 5 458
1 3 4 343983
1 3 1 843468
1 4 5 15934
0 2 1
0 4 2
0 1 2
0 4 2
0 4 3
0 5 3
0 0
 3 8
1 3 1 10
0 2 3
1 2 3 20
1 1 2 5
0 3 2
1 1 3 7
1 2 1 9
0 2 3
5 16
1 1 2 343750
1 1 3 3343
1 1 4 347392
1 1 5 5497
1 2 3 123394
1 2 4 545492
1 2 5 458
1 3 4 343983
1 3 5 843468
1 4 5 2780
0 2 1
0 4 1
0 3 2
0 4 2
0 4 3
0 5 3
0 0
 3 8
1 3 1 10
0 2 3
1 2 3 20
1 1 2 5
0 3 2
1 1 3 7
1 2 1 9
0 1 3
5 16
1 1 2 343750
1 1 3 3343
1 1 4 347392
1 1 5 5497
1 2 3 123394
1 2 4 545492
1 2 5 458
1 3 4 343983
1 3 5 843468
1 4 5 15934
0 2 1
0 4 1
0 3 2
0 4 2
0 4 3
0 5 3
0 0
 3 8
1 3 1 10
0 2 3
1 2 3 20
1 1 2 5
0 3 2
1 1 3 7
1 2 1 9
0 2 3
5 16
1 1 2 85440
1 1 3 3343
1 1 4 347392
1 1 5 5497
1 2 3 123394
1 2 4 545492
1 2 5 458
1 3 4 343983
1 3 1 843468
1 4 5 2961
0 2 1
0 4 1
0 1 2
0 4 2
0 4 3
0 5 3
0 0
 3 8
1 3 1 10
0 2 3
1 2 3 20
1 1 2 5
0 3 2
1 1 3 7
1 2 1 9
0 2 3
5 16
1 1 2 85440
1 1 3 3343
1 1 4 347392
1 1 5 2257
1 2 3 123394
1 2 4 545492
1 2 5 458
1 3 4 343983
1 3 1 843468
1 4 5 2961
0 2 1
0 4 1
0 1 2
0 4 2
0 4 3
0 5 3
0 0
 3 8
1 3 1 10
0 2 3
1 2 3 1
1 1 2 5
0 3 2
1 1 3 7
1 2 1 9
0 2 3
5 16
1 1 2 85440
1 1 3 3343
1 1 4 347392
1 1 5 2257
1 2 3 123394
1 2 4 545492
1 2 5 458
1 3 4 343983
1 3 1 843468
1 4 5 2961
0 2 1
0 4 1
0 1 2
0 4 2
0 4 3
0 5 3
0 0

-1
15
12
5955
21431
9298
16392
24774
8840
 -1
-1
16
5955
21431
9298
16392
24774
8840
 -1
15
12
5955
16392
9298
16392
24774
8840
 -1
15
12
5955
21431
5955
16392
24774
8840
 -1
15
12
5955
16392
5955
16392
24774
8840
 -1
15
12
5955
8277
9298
3238
11620
8840
 -1
15
7
5955
21431
9298
16392
24774
8840
 -1
15
12
5955
8458
5955
3419
11801
8840
 -1
15
12
2715
5218
2715
3419
8561
5600
 -1
1
1
2715
5218
2715
3419
8561
5600

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>
#include<string.h>

long ship[100][100];

int main(){
  int k,r,i,a,b,n,j,ii;
  long p;
  while(1){
    scanf("%d %d",&n,&k);
    if(n==0) break;
    memset(ship,8,sizeof(ship));
    for(i=0;i<n;i++){
    	ship[i][i]=0;
    }
    for(i=0;i<k;i++){
      scanf("%d",&r);
      if(r==0){
        scanf("%d %d",&a,&b);
        printf("%ld\n",(ship[a-1][b-1]>100000001)?-1:ship[a-1][b-1]);
      }else{
        scanf("%d %d %ld",&a,&b,&p);
        for(j=0;j<n;j++){
        	for(ii=0;ii<n;ii++){
        		if(ship[j][b-1]+p+ship[a-1][ii]<ship[j][ii]){
        			ship[j][ii]=ship[j][b-1]+p+ship[a-1][ii];
        			ship[ii][j]=ship[j][b-1]+p+ship[a-1][ii];
        		}
        		if(ship[j][a-1]+p+ship[b-1][ii]<ship[j][ii]){
        			ship[j][ii]=ship[j][a-1]+p+ship[b-1][ii];
        			ship[ii][j]=ship[j][a-1]+p+ship[b-1][ii];
        		}
        	}
        }
      }
    }
  }
  return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	ship
	.bss
	.align 32
	.type	ship, @object
	.size	ship, 80000
ship:
	.zero	80000
	.section	.rodata
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%ld\n"
.LC3:
	.string	"%d %d %ld"
	.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	$48, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
.L18:
	leaq	-48(%rbp), %rdx
	leaq	-32(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-32(%rbp), %eax
	testl	%eax, %eax
	je	.L22
	movl	$80000, %edx
	movl	$8, %esi
	leaq	ship(%rip), %rax
	movq	%rax, %rdi
	call	memset@PLT
	movl	$0, -28(%rbp)
	jmp	.L4
.L5:
	movl	-28(%rbp), %eax
	cltq
	imulq	$808, %rax, %rax
	leaq	ship(%rip), %rdx
	movq	$0, (%rax,%rdx)
	addl	$1, -28(%rbp)
.L4:
	movl	-32(%rbp), %eax
	cmpl	%eax, -28(%rbp)
	jl	.L5
	movl	$0, -28(%rbp)
	jmp	.L6
.L17:
	leaq	-44(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-44(%rbp), %eax
	testl	%eax, %eax
	jne	.L7
	leaq	-36(%rbp), %rdx
	leaq	-40(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-40(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-36(%rbp), %eax
	subl	$1, %eax
	movslq	%eax, %rcx
	movslq	%edx, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,8), %rdx
	leaq	ship(%rip), %rax
	movq	(%rdx,%rax), %rax
	cmpq	$100000001, %rax
	jg	.L8
	movl	-40(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-36(%rbp), %eax
	subl	$1, %eax
	movslq	%eax, %rcx
	movslq	%edx, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,8), %rdx
	leaq	ship(%rip), %rax
	movq	(%rdx,%rax), %rax
	jmp	.L9
.L8:
	movq	$-1, %rax
.L9:
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L10
.L7:
	leaq	-16(%rbp), %rcx
	leaq	-36(%rbp), %rdx
	leaq	-40(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -24(%rbp)
	jmp	.L11
.L16:
	movl	$0, -20(%rbp)
	jmp	.L12
.L15:
	movl	-36(%rbp), %eax
	subl	$1, %eax
	movslq	%eax, %rcx
	movl	-24(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,8), %rdx
	leaq	ship(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movq	-16(%rbp), %rax
	leaq	(%rdx,%rax), %rsi
	movl	-40(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-20(%rbp), %eax
	movslq	%eax, %rcx
	movslq	%edx, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,8), %rdx
	leaq	ship(%rip), %rax
	movq	(%rdx,%rax), %rax
	leaq	(%rsi,%rax), %rcx
	movl	-20(%rbp), %eax
	movslq	%eax, %rsi
	movl	-24(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,8), %rdx
	leaq	ship(%rip), %rax
	movq	(%rdx,%rax), %rax
	cmpq	%rax, %rcx
	jge	.L13
	movl	-36(%rbp), %eax
	subl	$1, %eax
	movslq	%eax, %rcx
	movl	-24(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,8), %rdx
	leaq	ship(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movq	-16(%rbp), %rax
	leaq	(%rdx,%rax), %rsi
	movl	-40(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-20(%rbp), %eax
	movslq	%eax, %rcx
	movslq	%edx, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,8), %rdx
	leaq	ship(%rip), %rax
	movq	(%rdx,%rax), %rax
	leaq	(%rsi,%rax), %rcx
	movl	-20(%rbp), %eax
	movslq	%eax, %rsi
	movl	-24(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,8), %rdx
	leaq	ship(%rip), %rax
	movq	%rcx, (%rdx,%rax)
	movl	-36(%rbp), %eax
	subl	$1, %eax
	movslq	%eax, %rcx
	movl	-24(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,8), %rdx
	leaq	ship(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movq	-16(%rbp), %rax
	leaq	(%rdx,%rax), %rsi
	movl	-40(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-20(%rbp), %eax
	movslq	%eax, %rcx
	movslq	%edx, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,8), %rdx
	leaq	ship(%rip), %rax
	movq	(%rdx,%rax), %rax
	leaq	(%rsi,%rax), %rcx
	movl	-24(%rbp), %eax
	movslq	%eax, %rsi
	movl	-20(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,8), %rdx
	leaq	ship(%rip), %rax
	movq	%rcx, (%rdx,%rax)
.L13:
	movl	-40(%rbp), %eax
	subl	$1, %eax
	movslq	%eax, %rcx
	movl	-24(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,8), %rdx
	leaq	ship(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movq	-16(%rbp), %rax
	leaq	(%rdx,%rax), %rsi
	movl	-36(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-20(%rbp), %eax
	movslq	%eax, %rcx
	movslq	%edx, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,8), %rdx
	leaq	ship(%rip), %rax
	movq	(%rdx,%rax), %rax
	leaq	(%rsi,%rax), %rcx
	movl	-20(%rbp), %eax
	movslq	%eax, %rsi
	movl	-24(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,8), %rdx
	leaq	ship(%rip), %rax
	movq	(%rdx,%rax), %rax
	cmpq	%rax, %rcx
	jge	.L14
	movl	-40(%rbp), %eax
	subl	$1, %eax
	movslq	%eax, %rcx
	movl	-24(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,8), %rdx
	leaq	ship(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movq	-16(%rbp), %rax
	leaq	(%rdx,%rax), %rsi
	movl	-36(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-20(%rbp), %eax
	movslq	%eax, %rcx
	movslq	%edx, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,8), %rdx
	leaq	ship(%rip), %rax
	movq	(%rdx,%rax), %rax
	leaq	(%rsi,%rax), %rcx
	movl	-20(%rbp), %eax
	movslq	%eax, %rsi
	movl	-24(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,8), %rdx
	leaq	ship(%rip), %rax
	movq	%rcx, (%rdx,%rax)
	movl	-40(%rbp), %eax
	subl	$1, %eax
	movslq	%eax, %rcx
	movl	-24(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,8), %rdx
	leaq	ship(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movq	-16(%rbp), %rax
	leaq	(%rdx,%rax), %rsi
	movl	-36(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-20(%rbp), %eax
	movslq	%eax, %rcx
	movslq	%edx, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,8), %rdx
	leaq	ship(%rip), %rax
	movq	(%rdx,%rax), %rax
	leaq	(%rsi,%rax), %rcx
	movl	-24(%rbp), %eax
	movslq	%eax, %rsi
	movl	-20(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,8), %rdx
	leaq	ship(%rip), %rax
	movq	%rcx, (%rdx,%rax)
.L14:
	addl	$1, -20(%rbp)
.L12:
	movl	-32(%rbp), %eax
	cmpl	%eax, -20(%rbp)
	jl	.L15
	addl	$1, -24(%rbp)
.L11:
	movl	-32(%rbp), %eax
	cmpl	%eax, -24(%rbp)
	jl	.L16
.L10:
	addl	$1, -28(%rbp)
.L6:
	movl	-48(%rbp), %eax
	cmpl	%eax, -28(%rbp)
	jl	.L17
	jmp	.L18
.L22:
	nop
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L20
	call	__stack_chk_fail@PLT
.L20:
	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	ship
	.bss
	.align 32
	.type	ship, @object
	.size	ship, 80000
ship:
	.zero	80000
	.section	.rodata
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%ld\n"
.LC3:
	.string	"%d %d %ld"
	.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	$48, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
.L18:
	leaq	-48(%rbp), %rdx
	leaq	-32(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-32(%rbp), %eax
	testl	%eax, %eax
	je	.L22
	movl	$80000, %edx
	movl	$8, %esi
	leaq	ship(%rip), %rax
	movq	%rax, %rdi
	call	memset@PLT
	movl	$0, -28(%rbp)
	jmp	.L4
.L5:
	movl	-28(%rbp), %eax
	cltq
	imulq	$808, %rax, %rax
	leaq	ship(%rip), %rdx
	movq	$0, (%rax,%rdx)
	addl	$1, -28(%rbp)
.L4:
	movl	-32(%rbp), %eax
	cmpl	%eax, -28(%rbp)
	jl	.L5
	movl	$0, -28(%rbp)
	jmp	.L6
.L17:
	leaq	-44(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-44(%rbp), %eax
	testl	%eax, %eax
	jne	.L7
	leaq	-36(%rbp), %rdx
	leaq	-40(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-40(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-36(%rbp), %eax
	subl	$1, %eax
	movslq	%eax, %rcx
	movslq	%edx, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,8), %rdx
	leaq	ship(%rip), %rax
	movq	(%rdx,%rax), %rax
	cmpq	$100000001, %rax
	jg	.L8
	movl	-40(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-36(%rbp), %eax
	subl	$1, %eax
	movslq	%eax, %rcx
	movslq	%edx, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,8), %rdx
	leaq	ship(%rip), %rax
	movq	(%rdx,%rax), %rax
	jmp	.L9
.L8:
	movq	$-1, %rax
.L9:
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L10
.L7:
	leaq	-16(%rbp), %rcx
	leaq	-36(%rbp), %rdx
	leaq	-40(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -24(%rbp)
	jmp	.L11
.L16:
	movl	$0, -20(%rbp)
	jmp	.L12
.L15:
	movl	-36(%rbp), %eax
	subl	$1, %eax
	movslq	%eax, %rcx
	movl	-24(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,8), %rdx
	leaq	ship(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movq	-16(%rbp), %rax
	leaq	(%rdx,%rax), %rsi
	movl	-40(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-20(%rbp), %eax
	movslq	%eax, %rcx
	movslq	%edx, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,8), %rdx
	leaq	ship(%rip), %rax
	movq	(%rdx,%rax), %rax
	leaq	(%rsi,%rax), %rcx
	movl	-20(%rbp), %eax
	movslq	%eax, %rsi
	movl	-24(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,8), %rdx
	leaq	ship(%rip), %rax
	movq	(%rdx,%rax), %rax
	cmpq	%rax, %rcx
	jge	.L13
	movl	-36(%rbp), %eax
	subl	$1, %eax
	movslq	%eax, %rcx
	movl	-24(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,8), %rdx
	leaq	ship(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movq	-16(%rbp), %rax
	leaq	(%rdx,%rax), %rsi
	movl	-40(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-20(%rbp), %eax
	movslq	%eax, %rcx
	movslq	%edx, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,8), %rdx
	leaq	ship(%rip), %rax
	movq	(%rdx,%rax), %rax
	leaq	(%rsi,%rax), %rcx
	movl	-20(%rbp), %eax
	movslq	%eax, %rsi
	movl	-24(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,8), %rdx
	leaq	ship(%rip), %rax
	movq	%rcx, (%rdx,%rax)
	movl	-36(%rbp), %eax
	subl	$1, %eax
	movslq	%eax, %rcx
	movl	-24(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,8), %rdx
	leaq	ship(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movq	-16(%rbp), %rax
	leaq	(%rdx,%rax), %rsi
	movl	-40(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-20(%rbp), %eax
	movslq	%eax, %rcx
	movslq	%edx, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,8), %rdx
	leaq	ship(%rip), %rax
	movq	(%rdx,%rax), %rax
	leaq	(%rsi,%rax), %rcx
	movl	-24(%rbp), %eax
	movslq	%eax, %rsi
	movl	-20(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,8), %rdx
	leaq	ship(%rip), %rax
	movq	%rcx, (%rdx,%rax)
.L13:
	movl	-40(%rbp), %eax
	subl	$1, %eax
	movslq	%eax, %rcx
	movl	-24(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,8), %rdx
	leaq	ship(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movq	-16(%rbp), %rax
	leaq	(%rdx,%rax), %rsi
	movl	-36(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-20(%rbp), %eax
	movslq	%eax, %rcx
	movslq	%edx, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,8), %rdx
	leaq	ship(%rip), %rax
	movq	(%rdx,%rax), %rax
	leaq	(%rsi,%rax), %rcx
	movl	-20(%rbp), %eax
	movslq	%eax, %rsi
	movl	-24(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,8), %rdx
	leaq	ship(%rip), %rax
	movq	(%rdx,%rax), %rax
	cmpq	%rax, %rcx
	jge	.L14
	movl	-40(%rbp), %eax
	subl	$1, %eax
	movslq	%eax, %rcx
	movl	-24(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,8), %rdx
	leaq	ship(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movq	-16(%rbp), %rax
	leaq	(%rdx,%rax), %rsi
	movl	-36(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-20(%rbp), %eax
	movslq	%eax, %rcx
	movslq	%edx, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,8), %rdx
	leaq	ship(%rip), %rax
	movq	(%rdx,%rax), %rax
	leaq	(%rsi,%rax), %rcx
	movl	-20(%rbp), %eax
	movslq	%eax, %rsi
	movl	-24(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,8), %rdx
	leaq	ship(%rip), %rax
	movq	%rcx, (%rdx,%rax)
	movl	-40(%rbp), %eax
	subl	$1, %eax
	movslq	%eax, %rcx
	movl	-24(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,8), %rdx
	leaq	ship(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movq	-16(%rbp), %rax
	leaq	(%rdx,%rax), %rsi
	movl	-36(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-20(%rbp), %eax
	movslq	%eax, %rcx
	movslq	%edx, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,8), %rdx
	leaq	ship(%rip), %rax
	movq	(%rdx,%rax), %rax
	leaq	(%rsi,%rax), %rcx
	movl	-24(%rbp), %eax
	movslq	%eax, %rsi
	movl	-20(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,8), %rdx
	leaq	ship(%rip), %rax
	movq	%rcx, (%rdx,%rax)
.L14:
	addl	$1, -20(%rbp)
.L12:
	movl	-32(%rbp), %eax
	cmpl	%eax, -20(%rbp)
	jl	.L15
	addl	$1, -24(%rbp)
.L11:
	movl	-32(%rbp), %eax
	cmpl	%eax, -24(%rbp)
	jl	.L16
.L10:
	addl	$1, -28(%rbp)
.L6:
	movl	-48(%rbp), %eax
	cmpl	%eax, -28(%rbp)
	jl	.L17
	jmp	.L18
.L22:
	nop
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L20
	call	__stack_chk_fail@PLT
.L20:
	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:
