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 n;
long wfs(int a,int b){
  //dijstra
  long graph[100],min;
  int f[100],i,s,c,next;
  memset(f,0,sizeof(f));
  memset(graph,9,sizeof(graph));
  graph[a]=0;
  s=0;
  c=a;
  while(1){
  	next=-1;
  	f[c]=2;
  	min=100000001;
  	if(c==b){
  		return graph[c];
  	}
  	for(i=0;i<n;i++){
  		if(ship[c][i]>0){
  			if(f[i]<2){
  				if(graph[i]>graph[c]+ship[c][i]){
  					graph[i]=graph[c]+ship[c][i];
  				}
  				f[i]=1;
  			}
  		}
  	}
  	for(i=0;i<n;i++){
  		if(f[i]<2){
  			if(min>graph[i]){
  				min=graph[i];
  				next=i;
  			}
  		}
  	}
  	if(next==-1) return -1;
  	c=next;
  }
}
int main(){
  int k,r,i,a,b;
  long p;
  while(1){
    scanf("%d %d",&n,&k);
    if(n==0) break;
    memset(ship,0,sizeof(ship));
    for(i=0;i<k;i++){
      scanf("%d",&r);
      if(r==0){
        scanf("%d %d",&a,&b);
        printf("%ld\n",wfs(a-1,b-1));
      }else{
        scanf("%d %d %ld",&a,&b,&p);
        if(ship[a-1][b-1]>p || ship[a-1][b-1]==0){
          ship[a-1][b-1]=p;
          ship[b-1][a-1]=p;
        }
      }
    }
  }
  return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	ship
	.bss
	.align 32
	.type	ship, @object
	.size	ship, 80000
ship:
	.zero	80000
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.text
	.globl	wfs
	.type	wfs, @function
wfs:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$1264, %rsp
	movl	%edi, -1252(%rbp)
	movl	%esi, -1256(%rbp)
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-1216(%rbp), %rax
	movl	$400, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	leaq	-816(%rbp), %rax
	movl	$800, %edx
	movl	$9, %esi
	movq	%rax, %rdi
	call	memset@PLT
	movl	-1252(%rbp), %eax
	cltq
	movq	$0, -816(%rbp,%rax,8)
	movl	$0, -1228(%rbp)
	movl	-1252(%rbp), %eax
	movl	%eax, -1236(%rbp)
.L12:
	movl	$-1, -1232(%rbp)
	movl	-1236(%rbp), %eax
	cltq
	movl	$2, -1216(%rbp,%rax,4)
	movq	$100000001, -1224(%rbp)
	movl	-1236(%rbp), %eax
	cmpl	-1256(%rbp), %eax
	jne	.L2
	movl	-1236(%rbp), %eax
	cltq
	movq	-816(%rbp,%rax,8), %rax
	jmp	.L13
.L2:
	movl	$0, -1240(%rbp)
	jmp	.L4
.L7:
	movl	-1240(%rbp), %eax
	movslq	%eax, %rcx
	movl	-1236(%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), %rax
	testq	%rax, %rax
	jle	.L5
	movl	-1240(%rbp), %eax
	cltq
	movl	-1216(%rbp,%rax,4), %eax
	cmpl	$1, %eax
	jg	.L5
	movl	-1240(%rbp), %eax
	cltq
	movq	-816(%rbp,%rax,8), %rcx
	movl	-1236(%rbp), %eax
	cltq
	movq	-816(%rbp,%rax,8), %rsi
	movl	-1240(%rbp), %eax
	movslq	%eax, %rdi
	movl	-1236(%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	%rdi, %rax
	leaq	0(,%rax,8), %rdx
	leaq	ship(%rip), %rax
	movq	(%rdx,%rax), %rax
	addq	%rsi, %rax
	cmpq	%rax, %rcx
	jle	.L6
	movl	-1236(%rbp), %eax
	cltq
	movq	-816(%rbp,%rax,8), %rcx
	movl	-1240(%rbp), %eax
	movslq	%eax, %rsi
	movl	-1236(%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
	leaq	(%rcx,%rax), %rdx
	movl	-1240(%rbp), %eax
	cltq
	movq	%rdx, -816(%rbp,%rax,8)
.L6:
	movl	-1240(%rbp), %eax
	cltq
	movl	$1, -1216(%rbp,%rax,4)
.L5:
	addl	$1, -1240(%rbp)
.L4:
	movl	n(%rip), %eax
	cmpl	%eax, -1240(%rbp)
	jl	.L7
	movl	$0, -1240(%rbp)
	jmp	.L8
.L10:
	movl	-1240(%rbp), %eax
	cltq
	movl	-1216(%rbp,%rax,4), %eax
	cmpl	$1, %eax
	jg	.L9
	movl	-1240(%rbp), %eax
	cltq
	movq	-816(%rbp,%rax,8), %rax
	cmpq	%rax, -1224(%rbp)
	jle	.L9
	movl	-1240(%rbp), %eax
	cltq
	movq	-816(%rbp,%rax,8), %rax
	movq	%rax, -1224(%rbp)
	movl	-1240(%rbp), %eax
	movl	%eax, -1232(%rbp)
.L9:
	addl	$1, -1240(%rbp)
.L8:
	movl	n(%rip), %eax
	cmpl	%eax, -1240(%rbp)
	jl	.L10
	cmpl	$-1, -1232(%rbp)
	jne	.L11
	movq	$-1, %rax
	jmp	.L13
.L11:
	movl	-1232(%rbp), %eax
	movl	%eax, -1236(%rbp)
	jmp	.L12
.L13:
	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	wfs, .-wfs
	.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:
.LFB1:
	.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
.L23:
	leaq	-36(%rbp), %rax
	movq	%rax, %rdx
	leaq	n(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	n(%rip), %eax
	testl	%eax, %eax
	je	.L27
	movl	$80000, %edx
	movl	$0, %esi
	leaq	ship(%rip), %rax
	movq	%rax, %rdi
	call	memset@PLT
	movl	$0, -20(%rbp)
	jmp	.L18
.L22:
	leaq	-32(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-32(%rbp), %eax
	testl	%eax, %eax
	jne	.L19
	leaq	-24(%rbp), %rdx
	leaq	-28(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-24(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-28(%rbp), %eax
	subl	$1, %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	wfs
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L20
.L19:
	leaq	-16(%rbp), %rcx
	leaq	-24(%rbp), %rdx
	leaq	-28(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-28(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-24(%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), %rdx
	movq	-16(%rbp), %rax
	cmpq	%rax, %rdx
	jg	.L21
	movl	-28(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-24(%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
	testq	%rax, %rax
	jne	.L20
.L21:
	movl	-28(%rbp), %eax
	leal	-1(%rax), %ecx
	movl	-24(%rbp), %eax
	subl	$1, %eax
	movq	-16(%rbp), %rdx
	movslq	%eax, %rsi
	movslq	%ecx, %rcx
	movq	%rcx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rcx
	addq	%rcx, %rax
	salq	$2, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,8), %rcx
	leaq	ship(%rip), %rax
	movq	%rdx, (%rcx,%rax)
	movl	-24(%rbp), %eax
	leal	-1(%rax), %ecx
	movl	-28(%rbp), %eax
	subl	$1, %eax
	movq	-16(%rbp), %rdx
	movslq	%eax, %rsi
	movslq	%ecx, %rcx
	movq	%rcx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rcx
	addq	%rcx, %rax
	salq	$2, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,8), %rcx
	leaq	ship(%rip), %rax
	movq	%rdx, (%rcx,%rax)
.L20:
	addl	$1, -20(%rbp)
.L18:
	movl	-36(%rbp), %eax
	cmpl	%eax, -20(%rbp)
	jl	.L22
	jmp	.L23
.L27:
	nop
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L25
	call	__stack_chk_fail@PLT
.L25:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.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
	.p2align 4
	.globl	wfs
	.type	wfs, @function
wfs:
.LFB35:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	movl	$50, %ecx
	movl	%esi, %r10d
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	movslq	%edi, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	movq	%r12, %r13
	leaq	ship(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	subq	$1224, %rsp
	.cfi_def_cfa_offset 1264
	movl	n(%rip), %ebx
	movq	%fs:40, %rax
	movq	%rax, 1208(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %r8
	leaq	400(%rsp), %r9
	movq	%r8, %rdi
	rep stosq
	movl	$100, %ecx
	movq	%r9, %rdi
	movabsq	$651061555542690057, %rax
	rep stosq
	leal	-1(%rbx), %edi
	movl	$2, (%rsp,%r12,4)
	movq	$0, 400(%rsp,%r12,8)
	leaq	4(%rsp,%rdi,4), %r11
	cmpl	%r10d, %r13d
	je	.L2
	.p2align 4,,10
	.p2align 3
.L20:
	testl	%ebx, %ebx
	jle	.L4
	leaq	(%r12,%r12,4), %rax
	movq	%r9, %rsi
	leaq	(%rax,%rax,4), %rdx
	movq	%r8, %rax
	salq	$5, %rdx
	addq	%rbp, %rdx
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L6:
	addq	$4, %rax
	addq	$8, %rdx
	addq	$8, %rsi
	cmpq	%rax, %r11
	je	.L18
.L8:
	movq	(%rdx), %rcx
	testq	%rcx, %rcx
	jle	.L6
	cmpl	$1, (%rax)
	jg	.L6
	addq	400(%rsp,%r12,8), %rcx
	cmpq	%rcx, (%rsi)
	jle	.L7
	movq	%rcx, (%rsi)
.L7:
	movl	$1, (%rax)
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L18:
	xorl	%eax, %eax
	movl	$-1, %r13d
	movl	$100000001, %ecx
	jmp	.L10
	.p2align 4,,10
	.p2align 3
.L9:
	leaq	1(%rax), %rdx
	cmpq	%rdi, %rax
	je	.L19
.L13:
	movq	%rdx, %rax
.L10:
	cmpl	$1, (%r8,%rax,4)
	jg	.L9
	movq	(%r9,%rax,8), %rdx
	cmpq	%rdx, %rcx
	jle	.L9
	movq	%rdx, %rcx
	movl	%eax, %r13d
	leaq	1(%rax), %rdx
	cmpq	%rdi, %rax
	jne	.L13
.L19:
	cmpl	$-1, %r13d
	je	.L4
	movslq	%r13d, %r12
	movl	$2, (%rsp,%r12,4)
	cmpl	%r10d, %r13d
	jne	.L20
.L2:
	movq	400(%rsp,%r12,8), %rax
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L4:
	movq	$-1, %rax
.L1:
	movq	1208(%rsp), %rdx
	subq	%fs:40, %rdx
	jne	.L21
	addq	$1224, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
.L21:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE35:
	.size	wfs, .-wfs
	.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:
.LFB36:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	ship(%rip), %r15
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	leaq	.LC1(%rip), %r14
	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	$56, %rsp
	.cfi_def_cfa_offset 112
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	leaq	16(%rsp), %rax
	movq	%rax, 8(%rsp)
	.p2align 4,,10
	.p2align 3
.L29:
	movq	8(%rsp), %rdx
	leaq	n(%rip), %rsi
	leaq	.LC0(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	n(%rip), %ecx
	testl	%ecx, %ecx
	je	.L23
	movl	$80000, %edx
	xorl	%esi, %esi
	movq	%r15, %rdi
	call	memset@PLT
	movl	16(%rsp), %edx
	testl	%edx, %edx
	jle	.L29
	leaq	32(%rsp), %rax
	xorl	%ebx, %ebx
	leaq	20(%rsp), %r13
	movq	%rax, (%rsp)
	leaq	28(%rsp), %r12
	leaq	24(%rsp), %rbp
	jmp	.L28
	.p2align 4,,10
	.p2align 3
.L37:
	movq	%r12, %rdx
	movq	%rbp, %rsi
	leaq	.LC0(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	28(%rsp), %eax
	leal	-1(%rax), %esi
	movl	24(%rsp), %eax
	leal	-1(%rax), %edi
	call	wfs
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	movq	%rax, %rdx
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L26:
	addl	$1, %ebx
	cmpl	%ebx, 16(%rsp)
	jle	.L29
.L28:
	movq	%r13, %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	20(%rsp), %eax
	testl	%eax, %eax
	je	.L37
	movq	(%rsp), %rcx
	movq	%r12, %rdx
	movq	%rbp, %rsi
	xorl	%eax, %eax
	leaq	.LC3(%rip), %rdi
	call	__isoc99_scanf@PLT
	movl	24(%rsp), %eax
	movl	28(%rsp), %edi
	subl	$1, %eax
	leal	-1(%rdi), %edx
	cltq
	movslq	%edx, %rdx
	leaq	(%rax,%rax,4), %rcx
	leaq	(%rcx,%rcx,4), %rcx
	leaq	(%rdx,%rcx,4), %rcx
	movq	(%r15,%rcx,8), %rsi
	movq	32(%rsp), %rcx
	cmpq	%rcx, %rsi
	jg	.L31
	testq	%rsi, %rsi
	jne	.L26
.L31:
	leaq	(%rax,%rax,4), %rsi
	leaq	(%rsi,%rsi,4), %rsi
	leaq	(%rdx,%rsi,4), %rsi
	leaq	(%rdx,%rdx,4), %rdx
	leaq	(%rdx,%rdx,4), %rdx
	movq	%rcx, (%r15,%rsi,8)
	leaq	(%rax,%rdx,4), %rax
	movq	%rcx, (%r15,%rax,8)
	jmp	.L26
	.p2align 4,,10
	.p2align 3
.L23:
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L38
	addq	$56, %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
.L38:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE36:
	.size	main, .-main
	.globl	n
	.bss
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	ship
	.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
	.p2align 4
	.globl	wfs
	.type	wfs, @function
wfs:
.LFB35:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	movl	$50, %ecx
	movl	%esi, %r10d
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	movslq	%edi, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	movq	%r12, %r13
	leaq	ship(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	subq	$1224, %rsp
	.cfi_def_cfa_offset 1264
	movl	n(%rip), %ebx
	movq	%fs:40, %rax
	movq	%rax, 1208(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %r8
	leaq	400(%rsp), %r9
	movq	%r8, %rdi
	rep stosq
	movl	$100, %ecx
	movq	%r9, %rdi
	movabsq	$651061555542690057, %rax
	rep stosq
	leal	-1(%rbx), %edi
	movl	$2, (%rsp,%r12,4)
	movq	$0, 400(%rsp,%r12,8)
	leaq	4(%rsp,%rdi,4), %r11
	cmpl	%r10d, %r13d
	je	.L2
	.p2align 4,,10
	.p2align 3
.L20:
	testl	%ebx, %ebx
	jle	.L4
	leaq	(%r12,%r12,4), %rax
	movq	%r9, %rsi
	leaq	(%rax,%rax,4), %rdx
	movq	%r8, %rax
	salq	$5, %rdx
	addq	%rbp, %rdx
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L6:
	addq	$4, %rax
	addq	$8, %rdx
	addq	$8, %rsi
	cmpq	%rax, %r11
	je	.L18
.L8:
	movq	(%rdx), %rcx
	testq	%rcx, %rcx
	jle	.L6
	cmpl	$1, (%rax)
	jg	.L6
	addq	400(%rsp,%r12,8), %rcx
	cmpq	%rcx, (%rsi)
	jle	.L7
	movq	%rcx, (%rsi)
.L7:
	movl	$1, (%rax)
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L18:
	xorl	%eax, %eax
	movl	$-1, %r13d
	movl	$100000001, %ecx
	jmp	.L10
	.p2align 4,,10
	.p2align 3
.L9:
	leaq	1(%rax), %rdx
	cmpq	%rdi, %rax
	je	.L19
.L13:
	movq	%rdx, %rax
.L10:
	cmpl	$1, (%r8,%rax,4)
	jg	.L9
	movq	(%r9,%rax,8), %rdx
	cmpq	%rdx, %rcx
	jle	.L9
	movq	%rdx, %rcx
	movl	%eax, %r13d
	leaq	1(%rax), %rdx
	cmpq	%rdi, %rax
	jne	.L13
.L19:
	cmpl	$-1, %r13d
	je	.L4
	movslq	%r13d, %r12
	movl	$2, (%rsp,%r12,4)
	cmpl	%r10d, %r13d
	jne	.L20
.L2:
	movq	400(%rsp,%r12,8), %rax
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L4:
	movq	$-1, %rax
.L1:
	movq	1208(%rsp), %rdx
	subq	%fs:40, %rdx
	jne	.L21
	addq	$1224, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
.L21:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE35:
	.size	wfs, .-wfs
	.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:
.LFB36:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	ship(%rip), %r15
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	leaq	.LC1(%rip), %r14
	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	$56, %rsp
	.cfi_def_cfa_offset 112
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	leaq	16(%rsp), %rax
	movq	%rax, 8(%rsp)
	.p2align 4,,10
	.p2align 3
.L29:
	movq	8(%rsp), %rdx
	leaq	n(%rip), %rsi
	leaq	.LC0(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	n(%rip), %ecx
	testl	%ecx, %ecx
	je	.L23
	movl	$80000, %edx
	xorl	%esi, %esi
	movq	%r15, %rdi
	call	memset@PLT
	movl	16(%rsp), %edx
	testl	%edx, %edx
	jle	.L29
	leaq	32(%rsp), %rax
	xorl	%ebx, %ebx
	leaq	20(%rsp), %r13
	movq	%rax, (%rsp)
	leaq	28(%rsp), %r12
	leaq	24(%rsp), %rbp
	jmp	.L28
	.p2align 4,,10
	.p2align 3
.L37:
	movq	%r12, %rdx
	movq	%rbp, %rsi
	leaq	.LC0(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	28(%rsp), %eax
	leal	-1(%rax), %esi
	movl	24(%rsp), %eax
	leal	-1(%rax), %edi
	call	wfs
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	movq	%rax, %rdx
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L26:
	addl	$1, %ebx
	cmpl	%ebx, 16(%rsp)
	jle	.L29
.L28:
	movq	%r13, %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	20(%rsp), %eax
	testl	%eax, %eax
	je	.L37
	movq	(%rsp), %rcx
	movq	%r12, %rdx
	movq	%rbp, %rsi
	xorl	%eax, %eax
	leaq	.LC3(%rip), %rdi
	call	__isoc99_scanf@PLT
	movl	24(%rsp), %eax
	movl	28(%rsp), %edi
	subl	$1, %eax
	leal	-1(%rdi), %edx
	cltq
	movslq	%edx, %rdx
	leaq	(%rax,%rax,4), %rcx
	leaq	(%rcx,%rcx,4), %rcx
	leaq	(%rdx,%rcx,4), %rcx
	movq	(%r15,%rcx,8), %rsi
	movq	32(%rsp), %rcx
	cmpq	%rcx, %rsi
	jg	.L31
	testq	%rsi, %rsi
	jne	.L26
.L31:
	leaq	(%rax,%rax,4), %rsi
	leaq	(%rsi,%rsi,4), %rsi
	leaq	(%rdx,%rsi,4), %rsi
	leaq	(%rdx,%rdx,4), %rdx
	leaq	(%rdx,%rdx,4), %rdx
	movq	%rcx, (%r15,%rsi,8)
	leaq	(%rax,%rdx,4), %rax
	movq	%rcx, (%r15,%rax,8)
	jmp	.L26
	.p2align 4,,10
	.p2align 3
.L23:
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L38
	addq	$56, %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
.L38:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE36:
	.size	main, .-main
	.globl	n
	.bss
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	ship
	.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 n;
long wfs(int a,int b){
  //dijstra
  long graph[100],min;
  int f[100],i,s,c,next;
  memset(f,0,sizeof(f));
  memset(graph,9,sizeof(graph));
  graph[a]=0;
  s=0;
  c=a;
  while(1){
  	next=-1;
  	f[c]=2;
  	min=100000001;
  	if(c==b){
  		return graph[c];
  	}
  	for(i=0;i<n;i++){
  		if(ship[c][i]>0){
  			if(f[i]<2){
  				if(graph[i]>graph[c]+ship[c][i]){
  					graph[i]=graph[c]+ship[c][i];
  				}
  				f[i]=1;
  			}
  		}
  	}
  	for(i=0;i<n;i++){
  		if(f[i]<2){
  			if(min>graph[i]){
  				min=graph[i];
  				next=i;
  			}
  		}
  	}
  	if(next==-1) return -1;
  	c=next;
  }
}
int main(){
  int k,r,i,a,b;
  long p;
  while(1){
    scanf("%d %d",&n,&k);
    if(n==0) break;
    memset(ship,0,sizeof(ship));
    for(i=0;i<k;i++){
      scanf("%d",&r);
      if(r==0){
        scanf("%d %d",&a,&b);
        printf("%ld\n",wfs(a-1,b-1));
      }else{
        scanf("%d %d %ld",&a,&b,&p);
        if(ship[a-1][b-1]>p || ship[a-1][b-1]==0){
          ship[a-1][b-1]=p;
          ship[b-1][a-1]=p;
        }
      }
    }
  }
  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 n;
long wfs(int a,int b){
  //dijstra
  long graph[100],min;
  int f[100],i,s,c,next;
  memset(f,0,sizeof(f));
  memset(graph,9,sizeof(graph));
  graph[a]=0;
  s=0;
  c=a;
  while(1){
  	next=-1;
  	f[c]=2;
  	min=100000001;
  	if(c==b){
  		return graph[c];
  	}
  	for(i=0;i<n;i++){
  		if(ship[c][i]>0){
  			if(f[i]<2){
  				if(graph[i]>graph[c]+ship[c][i]){
  					graph[i]=graph[c]+ship[c][i];
  				}
  				f[i]=1;
  			}
  		}
  	}
  	for(i=0;i<n;i++){
  		if(f[i]<2){
  			if(min>graph[i]){
  				min=graph[i];
  				next=i;
  			}
  		}
  	}
  	if(next==-1) return -1;
  	c=next;
  }
}
int main(){
  int k,r,i,a,b;
  long p;
  while(1){
    scanf("%d %d",&n,&k);
    if(n==0) break;
    memset(ship,0,sizeof(ship));
    for(i=0;i<k;i++){
      scanf("%d",&r);
      if(r==0){
        scanf("%d %d",&a,&b);
        printf("%ld\n",wfs(a-1,b-1));
      }else{
        scanf("%d %d %ld",&a,&b,&p);
        if(ship[a-1][b-1]>p || ship[a-1][b-1]==0){
          ship[a-1][b-1]=p;
          ship[b-1][a-1]=p;
        }
      }
    }
  }
  return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	ship
	.bss
	.align 32
	.type	ship, @object
	.size	ship, 80000
ship:
	.zero	80000
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.text
	.globl	wfs
	.type	wfs, @function
wfs:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$1264, %rsp
	movl	%edi, -1252(%rbp)
	movl	%esi, -1256(%rbp)
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-1216(%rbp), %rax
	movl	$400, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	leaq	-816(%rbp), %rax
	movl	$800, %edx
	movl	$9, %esi
	movq	%rax, %rdi
	call	memset@PLT
	movl	-1252(%rbp), %eax
	cltq
	movq	$0, -816(%rbp,%rax,8)
	movl	$0, -1228(%rbp)
	movl	-1252(%rbp), %eax
	movl	%eax, -1236(%rbp)
.L12:
	movl	$-1, -1232(%rbp)
	movl	-1236(%rbp), %eax
	cltq
	movl	$2, -1216(%rbp,%rax,4)
	movq	$100000001, -1224(%rbp)
	movl	-1236(%rbp), %eax
	cmpl	-1256(%rbp), %eax
	jne	.L2
	movl	-1236(%rbp), %eax
	cltq
	movq	-816(%rbp,%rax,8), %rax
	jmp	.L13
.L2:
	movl	$0, -1240(%rbp)
	jmp	.L4
.L7:
	movl	-1240(%rbp), %eax
	movslq	%eax, %rcx
	movl	-1236(%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), %rax
	testq	%rax, %rax
	jle	.L5
	movl	-1240(%rbp), %eax
	cltq
	movl	-1216(%rbp,%rax,4), %eax
	cmpl	$1, %eax
	jg	.L5
	movl	-1240(%rbp), %eax
	cltq
	movq	-816(%rbp,%rax,8), %rcx
	movl	-1236(%rbp), %eax
	cltq
	movq	-816(%rbp,%rax,8), %rsi
	movl	-1240(%rbp), %eax
	movslq	%eax, %rdi
	movl	-1236(%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	%rdi, %rax
	leaq	0(,%rax,8), %rdx
	leaq	ship(%rip), %rax
	movq	(%rdx,%rax), %rax
	addq	%rsi, %rax
	cmpq	%rax, %rcx
	jle	.L6
	movl	-1236(%rbp), %eax
	cltq
	movq	-816(%rbp,%rax,8), %rcx
	movl	-1240(%rbp), %eax
	movslq	%eax, %rsi
	movl	-1236(%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
	leaq	(%rcx,%rax), %rdx
	movl	-1240(%rbp), %eax
	cltq
	movq	%rdx, -816(%rbp,%rax,8)
.L6:
	movl	-1240(%rbp), %eax
	cltq
	movl	$1, -1216(%rbp,%rax,4)
.L5:
	addl	$1, -1240(%rbp)
.L4:
	movl	n(%rip), %eax
	cmpl	%eax, -1240(%rbp)
	jl	.L7
	movl	$0, -1240(%rbp)
	jmp	.L8
.L10:
	movl	-1240(%rbp), %eax
	cltq
	movl	-1216(%rbp,%rax,4), %eax
	cmpl	$1, %eax
	jg	.L9
	movl	-1240(%rbp), %eax
	cltq
	movq	-816(%rbp,%rax,8), %rax
	cmpq	%rax, -1224(%rbp)
	jle	.L9
	movl	-1240(%rbp), %eax
	cltq
	movq	-816(%rbp,%rax,8), %rax
	movq	%rax, -1224(%rbp)
	movl	-1240(%rbp), %eax
	movl	%eax, -1232(%rbp)
.L9:
	addl	$1, -1240(%rbp)
.L8:
	movl	n(%rip), %eax
	cmpl	%eax, -1240(%rbp)
	jl	.L10
	cmpl	$-1, -1232(%rbp)
	jne	.L11
	movq	$-1, %rax
	jmp	.L13
.L11:
	movl	-1232(%rbp), %eax
	movl	%eax, -1236(%rbp)
	jmp	.L12
.L13:
	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	wfs, .-wfs
	.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:
.LFB1:
	.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
.L23:
	leaq	-36(%rbp), %rax
	movq	%rax, %rdx
	leaq	n(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	n(%rip), %eax
	testl	%eax, %eax
	je	.L27
	movl	$80000, %edx
	movl	$0, %esi
	leaq	ship(%rip), %rax
	movq	%rax, %rdi
	call	memset@PLT
	movl	$0, -20(%rbp)
	jmp	.L18
.L22:
	leaq	-32(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-32(%rbp), %eax
	testl	%eax, %eax
	jne	.L19
	leaq	-24(%rbp), %rdx
	leaq	-28(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-24(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-28(%rbp), %eax
	subl	$1, %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	wfs
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L20
.L19:
	leaq	-16(%rbp), %rcx
	leaq	-24(%rbp), %rdx
	leaq	-28(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-28(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-24(%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), %rdx
	movq	-16(%rbp), %rax
	cmpq	%rax, %rdx
	jg	.L21
	movl	-28(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-24(%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
	testq	%rax, %rax
	jne	.L20
.L21:
	movl	-28(%rbp), %eax
	leal	-1(%rax), %ecx
	movl	-24(%rbp), %eax
	subl	$1, %eax
	movq	-16(%rbp), %rdx
	movslq	%eax, %rsi
	movslq	%ecx, %rcx
	movq	%rcx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rcx
	addq	%rcx, %rax
	salq	$2, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,8), %rcx
	leaq	ship(%rip), %rax
	movq	%rdx, (%rcx,%rax)
	movl	-24(%rbp), %eax
	leal	-1(%rax), %ecx
	movl	-28(%rbp), %eax
	subl	$1, %eax
	movq	-16(%rbp), %rdx
	movslq	%eax, %rsi
	movslq	%ecx, %rcx
	movq	%rcx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rcx
	addq	%rcx, %rax
	salq	$2, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,8), %rcx
	leaq	ship(%rip), %rax
	movq	%rdx, (%rcx,%rax)
.L20:
	addl	$1, -20(%rbp)
.L18:
	movl	-36(%rbp), %eax
	cmpl	%eax, -20(%rbp)
	jl	.L22
	jmp	.L23
.L27:
	nop
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L25
	call	__stack_chk_fail@PLT
.L25:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.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
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.text
	.globl	wfs
	.type	wfs, @function
wfs:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$1264, %rsp
	movl	%edi, -1252(%rbp)
	movl	%esi, -1256(%rbp)
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-1216(%rbp), %rax
	movl	$400, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	leaq	-816(%rbp), %rax
	movl	$800, %edx
	movl	$9, %esi
	movq	%rax, %rdi
	call	memset@PLT
	movl	-1252(%rbp), %eax
	cltq
	movq	$0, -816(%rbp,%rax,8)
	movl	$0, -1228(%rbp)
	movl	-1252(%rbp), %eax
	movl	%eax, -1236(%rbp)
.L12:
	movl	$-1, -1232(%rbp)
	movl	-1236(%rbp), %eax
	cltq
	movl	$2, -1216(%rbp,%rax,4)
	movq	$100000001, -1224(%rbp)
	movl	-1236(%rbp), %eax
	cmpl	-1256(%rbp), %eax
	jne	.L2
	movl	-1236(%rbp), %eax
	cltq
	movq	-816(%rbp,%rax,8), %rax
	jmp	.L13
.L2:
	movl	$0, -1240(%rbp)
	jmp	.L4
.L7:
	movl	-1240(%rbp), %eax
	movslq	%eax, %rcx
	movl	-1236(%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), %rax
	testq	%rax, %rax
	jle	.L5
	movl	-1240(%rbp), %eax
	cltq
	movl	-1216(%rbp,%rax,4), %eax
	cmpl	$1, %eax
	jg	.L5
	movl	-1240(%rbp), %eax
	cltq
	movq	-816(%rbp,%rax,8), %rcx
	movl	-1236(%rbp), %eax
	cltq
	movq	-816(%rbp,%rax,8), %rsi
	movl	-1240(%rbp), %eax
	movslq	%eax, %rdi
	movl	-1236(%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	%rdi, %rax
	leaq	0(,%rax,8), %rdx
	leaq	ship(%rip), %rax
	movq	(%rdx,%rax), %rax
	addq	%rsi, %rax
	cmpq	%rax, %rcx
	jle	.L6
	movl	-1236(%rbp), %eax
	cltq
	movq	-816(%rbp,%rax,8), %rcx
	movl	-1240(%rbp), %eax
	movslq	%eax, %rsi
	movl	-1236(%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
	leaq	(%rcx,%rax), %rdx
	movl	-1240(%rbp), %eax
	cltq
	movq	%rdx, -816(%rbp,%rax,8)
.L6:
	movl	-1240(%rbp), %eax
	cltq
	movl	$1, -1216(%rbp,%rax,4)
.L5:
	addl	$1, -1240(%rbp)
.L4:
	movl	n(%rip), %eax
	cmpl	%eax, -1240(%rbp)
	jl	.L7
	movl	$0, -1240(%rbp)
	jmp	.L8
.L10:
	movl	-1240(%rbp), %eax
	cltq
	movl	-1216(%rbp,%rax,4), %eax
	cmpl	$1, %eax
	jg	.L9
	movl	-1240(%rbp), %eax
	cltq
	movq	-816(%rbp,%rax,8), %rax
	cmpq	%rax, -1224(%rbp)
	jle	.L9
	movl	-1240(%rbp), %eax
	cltq
	movq	-816(%rbp,%rax,8), %rax
	movq	%rax, -1224(%rbp)
	movl	-1240(%rbp), %eax
	movl	%eax, -1232(%rbp)
.L9:
	addl	$1, -1240(%rbp)
.L8:
	movl	n(%rip), %eax
	cmpl	%eax, -1240(%rbp)
	jl	.L10
	cmpl	$-1, -1232(%rbp)
	jne	.L11
	movq	$-1, %rax
	jmp	.L13
.L11:
	movl	-1232(%rbp), %eax
	movl	%eax, -1236(%rbp)
	jmp	.L12
.L13:
	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	wfs, .-wfs
	.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:
.LFB1:
	.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
.L23:
	leaq	-36(%rbp), %rax
	movq	%rax, %rdx
	leaq	n(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	n(%rip), %eax
	testl	%eax, %eax
	je	.L27
	movl	$80000, %edx
	movl	$0, %esi
	leaq	ship(%rip), %rax
	movq	%rax, %rdi
	call	memset@PLT
	movl	$0, -20(%rbp)
	jmp	.L18
.L22:
	leaq	-32(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-32(%rbp), %eax
	testl	%eax, %eax
	jne	.L19
	leaq	-24(%rbp), %rdx
	leaq	-28(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-24(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-28(%rbp), %eax
	subl	$1, %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	wfs
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L20
.L19:
	leaq	-16(%rbp), %rcx
	leaq	-24(%rbp), %rdx
	leaq	-28(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-28(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-24(%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), %rdx
	movq	-16(%rbp), %rax
	cmpq	%rax, %rdx
	jg	.L21
	movl	-28(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-24(%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
	testq	%rax, %rax
	jne	.L20
.L21:
	movl	-28(%rbp), %eax
	leal	-1(%rax), %ecx
	movl	-24(%rbp), %eax
	subl	$1, %eax
	movq	-16(%rbp), %rdx
	movslq	%eax, %rsi
	movslq	%ecx, %rcx
	movq	%rcx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rcx
	addq	%rcx, %rax
	salq	$2, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,8), %rcx
	leaq	ship(%rip), %rax
	movq	%rdx, (%rcx,%rax)
	movl	-24(%rbp), %eax
	leal	-1(%rax), %ecx
	movl	-28(%rbp), %eax
	subl	$1, %eax
	movq	-16(%rbp), %rdx
	movslq	%eax, %rsi
	movslq	%ecx, %rcx
	movq	%rcx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rcx
	addq	%rcx, %rax
	salq	$2, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,8), %rcx
	leaq	ship(%rip), %rax
	movq	%rdx, (%rcx,%rax)
.L20:
	addl	$1, -20(%rbp)
.L18:
	movl	-36(%rbp), %eax
	cmpl	%eax, -20(%rbp)
	jl	.L22
	jmp	.L23
.L27:
	nop
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L25
	call	__stack_chk_fail@PLT
.L25:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.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:
