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>

int cost[101][101];

int main(void){
	int n,k,a,b,c,i,j,z;
	const int def = 1000000000;
	for(;scanf("%d%d",&n,&k),n|k;){
		for(i=1;i<=n;i++)for(j=1;j<=n;j++)cost[i][j]=def;
		z=0;
		for(;k--;){
			scanf("%d",&a);
			if(a){
				scanf("%d%d%d",&a,&b,&c);
				if(cost[a][b]>c){
					cost[a][b] = cost[b][a] = c;
					z = 1;
				}
			}else{
				if(z)
					for(a=1;a<=n;a++)
						for(i=1;i<n;i++)
							for(j=i+1;j<=n;j++){
								c=cost[i][a]+cost[a][j];
								if(cost[i][j]>c)
									cost[i][j] = cost[j][i] = c;
							}
				scanf("%d%d",&a,&b);
				printf("%d\n",cost[a][b]<def?cost[a][b]:-1);
				z = 0;
			}
		}
	}
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	cost
	.bss
	.align 32
	.type	cost, @object
	.size	cost, 40804
cost:
	.zero	40804
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d%d%d"
.LC2:
	.string	"%d%d"
.LC3:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$48, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$1000000000, -12(%rbp)
	jmp	.L2
.L20:
	movl	$1, -24(%rbp)
	jmp	.L3
.L6:
	movl	$1, -20(%rbp)
	jmp	.L4
.L5:
	movl	-20(%rbp), %eax
	movslq	%eax, %rcx
	movl	-24(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rsi
	addq	%rsi, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rcx
	leaq	cost(%rip), %rdx
	movl	-12(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	addl	$1, -20(%rbp)
.L4:
	movl	-44(%rbp), %eax
	cmpl	%eax, -20(%rbp)
	jle	.L5
	addl	$1, -24(%rbp)
.L3:
	movl	-44(%rbp), %eax
	cmpl	%eax, -24(%rbp)
	jle	.L6
	movl	$0, -16(%rbp)
	jmp	.L7
.L19:
	leaq	-36(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-36(%rbp), %eax
	testl	%eax, %eax
	je	.L8
	leaq	-28(%rbp), %rcx
	leaq	-32(%rbp), %rdx
	leaq	-36(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-36(%rbp), %eax
	movl	-32(%rbp), %edx
	movslq	%edx, %rcx
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rsi
	addq	%rsi, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	cost(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-28(%rbp), %eax
	cmpl	%eax, %edx
	jle	.L7
	movl	-32(%rbp), %ecx
	movl	-36(%rbp), %esi
	movl	-28(%rbp), %edi
	movslq	%esi, %r8
	movslq	%ecx, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %r9
	addq	%r9, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%r8, %rax
	leaq	0(,%rax,4), %rdx
	leaq	cost(%rip), %rax
	movl	%edi, (%rdx,%rax)
	movl	-36(%rbp), %edi
	movl	-32(%rbp), %r8d
	movslq	%esi, %rsi
	movslq	%ecx, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rcx
	addq	%rcx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,4), %rdx
	leaq	cost(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movslq	%r8d, %rsi
	movslq	%edi, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdi
	addq	%rdi, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,4), %rdx
	leaq	cost(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	$1, -16(%rbp)
	jmp	.L7
.L8:
	cmpl	$0, -16(%rbp)
	je	.L9
	movl	$1, -36(%rbp)
	jmp	.L10
.L16:
	movl	$1, -24(%rbp)
	jmp	.L11
.L15:
	movl	-24(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -20(%rbp)
	jmp	.L12
.L14:
	movl	-36(%rbp), %eax
	movslq	%eax, %rcx
	movl	-24(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rsi
	addq	%rsi, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	cost(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	-36(%rbp), %eax
	movl	-20(%rbp), %edx
	movslq	%edx, %rsi
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdi
	addq	%rdi, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,4), %rdx
	leaq	cost(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%ecx, %eax
	movl	%eax, -28(%rbp)
	movl	-20(%rbp), %eax
	movslq	%eax, %rcx
	movl	-24(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rsi
	addq	%rsi, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	cost(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-28(%rbp), %eax
	cmpl	%eax, %edx
	jle	.L13
	movl	-28(%rbp), %ecx
	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), %rdi
	addq	%rdi, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,4), %rdx
	leaq	cost(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	-24(%rbp), %eax
	movslq	%eax, %rcx
	movl	-20(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rsi
	addq	%rsi, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	cost(%rip), %rax
	movl	(%rdx,%rax), %ecx
	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), %rdi
	addq	%rdi, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,4), %rdx
	leaq	cost(%rip), %rax
	movl	%ecx, (%rdx,%rax)
.L13:
	addl	$1, -20(%rbp)
.L12:
	movl	-44(%rbp), %eax
	cmpl	%eax, -20(%rbp)
	jle	.L14
	addl	$1, -24(%rbp)
.L11:
	movl	-44(%rbp), %eax
	cmpl	%eax, -24(%rbp)
	jl	.L15
	movl	-36(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -36(%rbp)
.L10:
	movl	-36(%rbp), %edx
	movl	-44(%rbp), %eax
	cmpl	%eax, %edx
	jle	.L16
.L9:
	leaq	-32(%rbp), %rdx
	leaq	-36(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-36(%rbp), %eax
	movl	-32(%rbp), %edx
	movslq	%edx, %rcx
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rsi
	addq	%rsi, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	cost(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -12(%rbp)
	jle	.L17
	movl	-36(%rbp), %eax
	movl	-32(%rbp), %edx
	movslq	%edx, %rcx
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rsi
	addq	%rsi, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	cost(%rip), %rax
	movl	(%rdx,%rax), %eax
	jmp	.L18
.L17:
	movl	$-1, %eax
.L18:
	movl	%eax, %esi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, -16(%rbp)
.L7:
	movl	-40(%rbp), %eax
	leal	-1(%rax), %edx
	movl	%edx, -40(%rbp)
	testl	%eax, %eax
	jne	.L19
.L2:
	leaq	-40(%rbp), %rdx
	leaq	-44(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-44(%rbp), %edx
	movl	-40(%rbp), %eax
	orl	%edx, %eax
	testl	%eax, %eax
	jne	.L20
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L22
	call	__stack_chk_fail@PLT
.L22:
	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
.LC1:
	.string	"%d"
.LC2:
	.string	"%d%d%d"
.LC3:
	.string	"%d%d"
.LC4:
	.string	"%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
	subq	$72, %rsp
	.cfi_def_cfa_offset 128
	movq	%fs:40, %rax
	movq	%rax, 56(%rsp)
	xorl	%eax, %eax
	leaq	40(%rsp), %rax
	movq	%rax, 16(%rsp)
	leaq	36(%rsp), %rax
	movq	%rax, 8(%rsp)
.L2:
	movq	16(%rsp), %rdx
	movq	8(%rsp), %rsi
	leaq	.LC3(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	36(%rsp), %edi
	movl	40(%rsp), %r13d
	movl	%edi, %eax
	orl	%r13d, %eax
	je	.L23
	testl	%edi, %edi
	movdqa	.LC0(%rip), %xmm0
	jle	.L25
	movl	%edi, %eax
	movl	%edi, %r10d
	leal	1(%rdi), %ebp
	movl	$1, %ecx
	shrl	$2, %eax
	leaq	408+cost(%rip), %rsi
	leal	-1(%rdi), %r11d
	andl	$-4, %r10d
	leal	-1(%rax), %r9d
	leal	1(%r10), %r12d
	addq	$1, %r9
	leaq	-408(%rsi), %r8
	salq	$4, %r9
.L6:
	cmpl	$2, %r11d
	jbe	.L28
	leaq	(%r9,%rsi), %rdx
	movq	%rsi, %rax
	.p2align 4,,10
	.p2align 3
.L4:
	movups	%xmm0, (%rax)
	addq	$16, %rax
	cmpq	%rdx, %rax
	jne	.L4
	movl	%r12d, %eax
	cmpl	%edi, %r10d
	je	.L5
.L3:
	movslq	%ecx, %rdx
	movslq	%eax, %r14
	leaq	(%rdx,%rdx,4), %r15
	leaq	(%r15,%r15,4), %r15
	leaq	(%rdx,%r15,4), %rdx
	addq	%rdx, %r14
	movl	$1000000000, (%r8,%r14,4)
	leal	1(%rax), %r14d
	cmpl	%r14d, %edi
	jl	.L5
	movslq	%r14d, %r14
	addl	$2, %eax
	addq	%rdx, %r14
	movl	$1000000000, (%r8,%r14,4)
	cmpl	%eax, %edi
	jl	.L5
	cltq
	addq	%rax, %rdx
	movl	$1000000000, (%r8,%rdx,4)
.L5:
	addl	$1, %ecx
	addq	$404, %rsi
	cmpl	%ebp, %ecx
	jne	.L6
.L25:
	leal	-1(%r13), %eax
	movl	%eax, 40(%rsp)
	testl	%r13d, %r13d
	je	.L2
	leaq	48(%rsp), %rax
	xorl	%r15d, %r15d
	leaq	44(%rsp), %rbp
	movq	%rax, (%rsp)
	leaq	8+cost(%rip), %r12
	jmp	.L7
.L8:
	testl	%r15d, %r15d
	jne	.L42
.L11:
	movq	(%rsp), %rdx
	movq	%rbp, %rsi
	leaq	.LC3(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	44(%rsp), %rax
	movslq	48(%rsp), %rcx
	leaq	.LC4(%rip), %rsi
	movl	$1, %edi
	leaq	(%rax,%rax,4), %rdx
	leaq	(%rdx,%rdx,4), %rdx
	leaq	(%rax,%rdx,4), %rax
	addq	%rcx, %rax
	leaq	cost(%rip), %rcx
	movl	(%rcx,%rax,4), %edx
	movl	$-1, %eax
	cmpl	$1000000000, %edx
	cmovge	%eax, %edx
	xorl	%eax, %eax
	xorl	%r15d, %r15d
	call	__printf_chk@PLT
.L9:
	movl	40(%rsp), %eax
	leal	-1(%rax), %edx
	movl	%edx, 40(%rsp)
	testl	%eax, %eax
	je	.L2
.L7:
	movq	%rbp, %rsi
	leaq	.LC1(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	44(%rsp), %eax
	testl	%eax, %eax
	je	.L8
	movq	(%rsp), %rdx
	leaq	52(%rsp), %rcx
	movq	%rbp, %rsi
	xorl	%eax, %eax
	leaq	.LC2(%rip), %rdi
	leaq	cost(%rip), %r14
	call	__isoc99_scanf@PLT
	movslq	44(%rsp), %rdx
	movslq	48(%rsp), %rcx
	movl	52(%rsp), %esi
	leaq	(%rdx,%rdx,4), %rax
	leaq	(%rax,%rax,4), %rax
	leaq	(%rdx,%rax,4), %rax
	addq	%rcx, %rax
	cmpl	%esi, (%r14,%rax,4)
	jle	.L9
	leaq	(%rcx,%rcx,4), %rdi
	movl	$1, %r15d
	leaq	(%rdi,%rdi,4), %rdi
	leaq	(%rcx,%rdi,4), %rcx
	addq	%rcx, %rdx
	movl	%esi, (%r14,%rdx,4)
	movl	%esi, (%r14,%rax,4)
	jmp	.L9
.L42:
	movl	36(%rsp), %r13d
	movl	$1, 44(%rsp)
	testl	%r13d, %r13d
	jle	.L11
	leal	-1(%r13), %eax
	movq	%rbp, 24(%rsp)
	leaq	4+cost(%rip), %r14
	movl	$404, %r8d
	leaq	(%r12,%rax,4), %rsi
	xorl	%eax, %eax
	movq	%rsi, %rbp
	.p2align 4,,10
	.p2align 3
.L13:
	cmpl	$1, %r13d
	je	.L17
	leaq	412+cost(%rip), %r10
	movq	%r14, %rsi
	movl	%r15d, %r9d
	movl	$102, %r11d
	movq	$-404, %rcx
	.p2align 4,,10
	.p2align 3
.L18:
	addl	$1, %r9d
	cmpl	%r13d, %r9d
	jg	.L14
	movl	%r13d, %eax
	leaq	400(%r10), %rdx
	subl	%r9d, %eax
	addq	%r11, %rax
	leaq	(%r12,%rax,4), %rbx
	movq	%r10, %rax
	.p2align 4,,10
	.p2align 3
.L16:
	leaq	(%rax,%rcx), %rdi
	movl	(%rdi,%r8), %edi
	addl	404(%rsi), %edi
	cmpl	(%rax), %edi
	jge	.L15
	movl	%edi, (%rdx)
	movl	%edi, (%rax)
.L15:
	addq	$4, %rax
	addq	$404, %rdx
	cmpq	%rbx, %rax
	jne	.L16
	addq	$408, %r10
	addq	$404, %rsi
	subq	$404, %rcx
	addq	$102, %r11
	cmpl	%r13d, %r9d
	jne	.L18
	movl	%edi, %ebx
	movl	$1, %eax
.L17:
	addq	$4, %r14
	addq	$404, %r8
	cmpq	%rbp, %r14
	jne	.L13
	addl	$1, %r13d
	movq	24(%rsp), %rbp
	movl	%r13d, 44(%rsp)
	testb	%al, %al
	je	.L11
	movl	%ebx, 52(%rsp)
	jmp	.L11
	.p2align 4,,10
	.p2align 3
.L14:
	addq	$408, %r10
	addq	$404, %rsi
	subq	$404, %rcx
	addq	$102, %r11
	jmp	.L18
.L28:
	movl	$1, %eax
	jmp	.L3
.L23:
	movq	56(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L43
	addq	$72, %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
.L43:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.globl	cost
	.bss
	.align 32
	.type	cost, @object
	.size	cost, 40804
cost:
	.zero	40804
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC0:
	.long	1000000000
	.long	1000000000
	.long	1000000000
	.long	1000000000
	.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
.LC1:
	.string	"%d"
.LC2:
	.string	"%d%d%d"
.LC3:
	.string	"%d%d"
.LC4:
	.string	"%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
	subq	$72, %rsp
	.cfi_def_cfa_offset 128
	movq	%fs:40, %rax
	movq	%rax, 56(%rsp)
	xorl	%eax, %eax
	leaq	40(%rsp), %rax
	movq	%rax, 16(%rsp)
	leaq	36(%rsp), %rax
	movq	%rax, 8(%rsp)
.L2:
	movq	16(%rsp), %rdx
	movq	8(%rsp), %rsi
	leaq	.LC3(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	36(%rsp), %edi
	movl	40(%rsp), %r13d
	movl	%edi, %eax
	orl	%r13d, %eax
	je	.L23
	testl	%edi, %edi
	movdqa	.LC0(%rip), %xmm0
	jle	.L25
	movl	%edi, %eax
	movl	%edi, %r10d
	leal	1(%rdi), %ebp
	movl	$1, %ecx
	shrl	$2, %eax
	leaq	408+cost(%rip), %rsi
	leal	-1(%rdi), %r11d
	andl	$-4, %r10d
	leal	-1(%rax), %r9d
	leal	1(%r10), %r12d
	addq	$1, %r9
	leaq	-408(%rsi), %r8
	salq	$4, %r9
.L6:
	cmpl	$2, %r11d
	jbe	.L28
	leaq	(%r9,%rsi), %rdx
	movq	%rsi, %rax
	.p2align 4,,10
	.p2align 3
.L4:
	movups	%xmm0, (%rax)
	addq	$16, %rax
	cmpq	%rdx, %rax
	jne	.L4
	movl	%r12d, %eax
	cmpl	%edi, %r10d
	je	.L5
.L3:
	movslq	%ecx, %rdx
	movslq	%eax, %r14
	leaq	(%rdx,%rdx,4), %r15
	leaq	(%r15,%r15,4), %r15
	leaq	(%rdx,%r15,4), %rdx
	addq	%rdx, %r14
	movl	$1000000000, (%r8,%r14,4)
	leal	1(%rax), %r14d
	cmpl	%r14d, %edi
	jl	.L5
	movslq	%r14d, %r14
	addl	$2, %eax
	addq	%rdx, %r14
	movl	$1000000000, (%r8,%r14,4)
	cmpl	%eax, %edi
	jl	.L5
	cltq
	addq	%rax, %rdx
	movl	$1000000000, (%r8,%rdx,4)
.L5:
	addl	$1, %ecx
	addq	$404, %rsi
	cmpl	%ebp, %ecx
	jne	.L6
.L25:
	leal	-1(%r13), %eax
	movl	%eax, 40(%rsp)
	testl	%r13d, %r13d
	je	.L2
	leaq	48(%rsp), %rax
	xorl	%r15d, %r15d
	leaq	44(%rsp), %rbp
	movq	%rax, (%rsp)
	leaq	8+cost(%rip), %r12
	jmp	.L7
.L8:
	testl	%r15d, %r15d
	jne	.L42
.L11:
	movq	(%rsp), %rdx
	movq	%rbp, %rsi
	leaq	.LC3(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	44(%rsp), %rax
	movslq	48(%rsp), %rcx
	leaq	.LC4(%rip), %rsi
	movl	$1, %edi
	leaq	(%rax,%rax,4), %rdx
	leaq	(%rdx,%rdx,4), %rdx
	leaq	(%rax,%rdx,4), %rax
	addq	%rcx, %rax
	leaq	cost(%rip), %rcx
	movl	(%rcx,%rax,4), %edx
	movl	$-1, %eax
	cmpl	$1000000000, %edx
	cmovge	%eax, %edx
	xorl	%eax, %eax
	xorl	%r15d, %r15d
	call	__printf_chk@PLT
.L9:
	movl	40(%rsp), %eax
	leal	-1(%rax), %edx
	movl	%edx, 40(%rsp)
	testl	%eax, %eax
	je	.L2
.L7:
	movq	%rbp, %rsi
	leaq	.LC1(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	44(%rsp), %eax
	testl	%eax, %eax
	je	.L8
	movq	(%rsp), %rdx
	leaq	52(%rsp), %rcx
	movq	%rbp, %rsi
	xorl	%eax, %eax
	leaq	.LC2(%rip), %rdi
	leaq	cost(%rip), %r14
	call	__isoc99_scanf@PLT
	movslq	44(%rsp), %rdx
	movslq	48(%rsp), %rcx
	movl	52(%rsp), %esi
	leaq	(%rdx,%rdx,4), %rax
	leaq	(%rax,%rax,4), %rax
	leaq	(%rdx,%rax,4), %rax
	addq	%rcx, %rax
	cmpl	%esi, (%r14,%rax,4)
	jle	.L9
	leaq	(%rcx,%rcx,4), %rdi
	movl	$1, %r15d
	leaq	(%rdi,%rdi,4), %rdi
	leaq	(%rcx,%rdi,4), %rcx
	addq	%rcx, %rdx
	movl	%esi, (%r14,%rdx,4)
	movl	%esi, (%r14,%rax,4)
	jmp	.L9
.L42:
	movl	36(%rsp), %r13d
	movl	$1, 44(%rsp)
	testl	%r13d, %r13d
	jle	.L11
	leal	-1(%r13), %eax
	movq	%rbp, 24(%rsp)
	leaq	4+cost(%rip), %r14
	movl	$404, %r8d
	leaq	(%r12,%rax,4), %rsi
	xorl	%eax, %eax
	movq	%rsi, %rbp
	.p2align 4,,10
	.p2align 3
.L13:
	cmpl	$1, %r13d
	je	.L17
	leaq	412+cost(%rip), %r10
	movq	%r14, %rsi
	movl	%r15d, %r9d
	movl	$102, %r11d
	movq	$-404, %rcx
	.p2align 4,,10
	.p2align 3
.L18:
	addl	$1, %r9d
	cmpl	%r13d, %r9d
	jg	.L14
	movl	%r13d, %eax
	leaq	400(%r10), %rdx
	subl	%r9d, %eax
	addq	%r11, %rax
	leaq	(%r12,%rax,4), %rbx
	movq	%r10, %rax
	.p2align 4,,10
	.p2align 3
.L16:
	leaq	(%rax,%rcx), %rdi
	movl	(%rdi,%r8), %edi
	addl	404(%rsi), %edi
	cmpl	(%rax), %edi
	jge	.L15
	movl	%edi, (%rdx)
	movl	%edi, (%rax)
.L15:
	addq	$4, %rax
	addq	$404, %rdx
	cmpq	%rbx, %rax
	jne	.L16
	addq	$408, %r10
	addq	$404, %rsi
	subq	$404, %rcx
	addq	$102, %r11
	cmpl	%r13d, %r9d
	jne	.L18
	movl	%edi, %ebx
	movl	$1, %eax
.L17:
	addq	$4, %r14
	addq	$404, %r8
	cmpq	%rbp, %r14
	jne	.L13
	addl	$1, %r13d
	movq	24(%rsp), %rbp
	movl	%r13d, 44(%rsp)
	testb	%al, %al
	je	.L11
	movl	%ebx, 52(%rsp)
	jmp	.L11
	.p2align 4,,10
	.p2align 3
.L14:
	addq	$408, %r10
	addq	$404, %rsi
	subq	$404, %rcx
	addq	$102, %r11
	jmp	.L18
.L28:
	movl	$1, %eax
	jmp	.L3
.L23:
	movq	56(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L43
	addq	$72, %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
.L43:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.globl	cost
	.bss
	.align 32
	.type	cost, @object
	.size	cost, 40804
cost:
	.zero	40804
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC0:
	.long	1000000000
	.long	1000000000
	.long	1000000000
	.long	1000000000
	.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>

int cost[101][101];

int main(void){
	int n,k,a,b,c,i,j,z;
	const int def = 1000000000;
	for(;scanf("%d%d",&n,&k),n|k;){
		for(i=1;i<=n;i++)for(j=1;j<=n;j++)cost[i][j]=def;
		z=0;
		for(;k--;){
			scanf("%d",&a);
			if(a){
				scanf("%d%d%d",&a,&b,&c);
				if(cost[a][b]>c){
					cost[a][b] = cost[b][a] = c;
					z = 1;
				}
			}else{
				if(z)
					for(a=1;a<=n;a++)
						for(i=1;i<n;i++)
							for(j=i+1;j<=n;j++){
								c=cost[i][a]+cost[a][j];
								if(cost[i][j]>c)
									cost[i][j] = cost[j][i] = c;
							}
				scanf("%d%d",&a,&b);
				printf("%d\n",cost[a][b]<def?cost[a][b]:-1);
				z = 0;
			}
		}
	}
	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>

int cost[101][101];

int main(void){
	int n,k,a,b,c,i,j,z;
	const int def = 1000000000;
	for(;scanf("%d%d",&n,&k),n|k;){
		for(i=1;i<=n;i++)for(j=1;j<=n;j++)cost[i][j]=def;
		z=0;
		for(;k--;){
			scanf("%d",&a);
			if(a){
				scanf("%d%d%d",&a,&b,&c);
				if(cost[a][b]>c){
					cost[a][b] = cost[b][a] = c;
					z = 1;
				}
			}else{
				if(z)
					for(a=1;a<=n;a++)
						for(i=1;i<n;i++)
							for(j=i+1;j<=n;j++){
								c=cost[i][a]+cost[a][j];
								if(cost[i][j]>c)
									cost[i][j] = cost[j][i] = c;
							}
				scanf("%d%d",&a,&b);
				printf("%d\n",cost[a][b]<def?cost[a][b]:-1);
				z = 0;
			}
		}
	}
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	cost
	.bss
	.align 32
	.type	cost, @object
	.size	cost, 40804
cost:
	.zero	40804
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d%d%d"
.LC2:
	.string	"%d%d"
.LC3:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$48, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$1000000000, -12(%rbp)
	jmp	.L2
.L20:
	movl	$1, -24(%rbp)
	jmp	.L3
.L6:
	movl	$1, -20(%rbp)
	jmp	.L4
.L5:
	movl	-20(%rbp), %eax
	movslq	%eax, %rcx
	movl	-24(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rsi
	addq	%rsi, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rcx
	leaq	cost(%rip), %rdx
	movl	-12(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	addl	$1, -20(%rbp)
.L4:
	movl	-44(%rbp), %eax
	cmpl	%eax, -20(%rbp)
	jle	.L5
	addl	$1, -24(%rbp)
.L3:
	movl	-44(%rbp), %eax
	cmpl	%eax, -24(%rbp)
	jle	.L6
	movl	$0, -16(%rbp)
	jmp	.L7
.L19:
	leaq	-36(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-36(%rbp), %eax
	testl	%eax, %eax
	je	.L8
	leaq	-28(%rbp), %rcx
	leaq	-32(%rbp), %rdx
	leaq	-36(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-36(%rbp), %eax
	movl	-32(%rbp), %edx
	movslq	%edx, %rcx
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rsi
	addq	%rsi, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	cost(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-28(%rbp), %eax
	cmpl	%eax, %edx
	jle	.L7
	movl	-32(%rbp), %ecx
	movl	-36(%rbp), %esi
	movl	-28(%rbp), %edi
	movslq	%esi, %r8
	movslq	%ecx, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %r9
	addq	%r9, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%r8, %rax
	leaq	0(,%rax,4), %rdx
	leaq	cost(%rip), %rax
	movl	%edi, (%rdx,%rax)
	movl	-36(%rbp), %edi
	movl	-32(%rbp), %r8d
	movslq	%esi, %rsi
	movslq	%ecx, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rcx
	addq	%rcx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,4), %rdx
	leaq	cost(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movslq	%r8d, %rsi
	movslq	%edi, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdi
	addq	%rdi, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,4), %rdx
	leaq	cost(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	$1, -16(%rbp)
	jmp	.L7
.L8:
	cmpl	$0, -16(%rbp)
	je	.L9
	movl	$1, -36(%rbp)
	jmp	.L10
.L16:
	movl	$1, -24(%rbp)
	jmp	.L11
.L15:
	movl	-24(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -20(%rbp)
	jmp	.L12
.L14:
	movl	-36(%rbp), %eax
	movslq	%eax, %rcx
	movl	-24(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rsi
	addq	%rsi, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	cost(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	-36(%rbp), %eax
	movl	-20(%rbp), %edx
	movslq	%edx, %rsi
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdi
	addq	%rdi, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,4), %rdx
	leaq	cost(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%ecx, %eax
	movl	%eax, -28(%rbp)
	movl	-20(%rbp), %eax
	movslq	%eax, %rcx
	movl	-24(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rsi
	addq	%rsi, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	cost(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-28(%rbp), %eax
	cmpl	%eax, %edx
	jle	.L13
	movl	-28(%rbp), %ecx
	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), %rdi
	addq	%rdi, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,4), %rdx
	leaq	cost(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	-24(%rbp), %eax
	movslq	%eax, %rcx
	movl	-20(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rsi
	addq	%rsi, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	cost(%rip), %rax
	movl	(%rdx,%rax), %ecx
	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), %rdi
	addq	%rdi, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,4), %rdx
	leaq	cost(%rip), %rax
	movl	%ecx, (%rdx,%rax)
.L13:
	addl	$1, -20(%rbp)
.L12:
	movl	-44(%rbp), %eax
	cmpl	%eax, -20(%rbp)
	jle	.L14
	addl	$1, -24(%rbp)
.L11:
	movl	-44(%rbp), %eax
	cmpl	%eax, -24(%rbp)
	jl	.L15
	movl	-36(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -36(%rbp)
.L10:
	movl	-36(%rbp), %edx
	movl	-44(%rbp), %eax
	cmpl	%eax, %edx
	jle	.L16
.L9:
	leaq	-32(%rbp), %rdx
	leaq	-36(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-36(%rbp), %eax
	movl	-32(%rbp), %edx
	movslq	%edx, %rcx
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rsi
	addq	%rsi, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	cost(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -12(%rbp)
	jle	.L17
	movl	-36(%rbp), %eax
	movl	-32(%rbp), %edx
	movslq	%edx, %rcx
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rsi
	addq	%rsi, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	cost(%rip), %rax
	movl	(%rdx,%rax), %eax
	jmp	.L18
.L17:
	movl	$-1, %eax
.L18:
	movl	%eax, %esi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, -16(%rbp)
.L7:
	movl	-40(%rbp), %eax
	leal	-1(%rax), %edx
	movl	%edx, -40(%rbp)
	testl	%eax, %eax
	jne	.L19
.L2:
	leaq	-40(%rbp), %rdx
	leaq	-44(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-44(%rbp), %edx
	movl	-40(%rbp), %eax
	orl	%edx, %eax
	testl	%eax, %eax
	jne	.L20
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L22
	call	__stack_chk_fail@PLT
.L22:
	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	cost
	.bss
	.align 32
	.type	cost, @object
	.size	cost, 40804
cost:
	.zero	40804
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d%d%d"
.LC2:
	.string	"%d%d"
.LC3:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$48, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$1000000000, -12(%rbp)
	jmp	.L2
.L20:
	movl	$1, -24(%rbp)
	jmp	.L3
.L6:
	movl	$1, -20(%rbp)
	jmp	.L4
.L5:
	movl	-20(%rbp), %eax
	movslq	%eax, %rcx
	movl	-24(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rsi
	addq	%rsi, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rcx
	leaq	cost(%rip), %rdx
	movl	-12(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	addl	$1, -20(%rbp)
.L4:
	movl	-44(%rbp), %eax
	cmpl	%eax, -20(%rbp)
	jle	.L5
	addl	$1, -24(%rbp)
.L3:
	movl	-44(%rbp), %eax
	cmpl	%eax, -24(%rbp)
	jle	.L6
	movl	$0, -16(%rbp)
	jmp	.L7
.L19:
	leaq	-36(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-36(%rbp), %eax
	testl	%eax, %eax
	je	.L8
	leaq	-28(%rbp), %rcx
	leaq	-32(%rbp), %rdx
	leaq	-36(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-36(%rbp), %eax
	movl	-32(%rbp), %edx
	movslq	%edx, %rcx
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rsi
	addq	%rsi, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	cost(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-28(%rbp), %eax
	cmpl	%eax, %edx
	jle	.L7
	movl	-32(%rbp), %ecx
	movl	-36(%rbp), %esi
	movl	-28(%rbp), %edi
	movslq	%esi, %r8
	movslq	%ecx, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %r9
	addq	%r9, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%r8, %rax
	leaq	0(,%rax,4), %rdx
	leaq	cost(%rip), %rax
	movl	%edi, (%rdx,%rax)
	movl	-36(%rbp), %edi
	movl	-32(%rbp), %r8d
	movslq	%esi, %rsi
	movslq	%ecx, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rcx
	addq	%rcx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,4), %rdx
	leaq	cost(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movslq	%r8d, %rsi
	movslq	%edi, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdi
	addq	%rdi, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,4), %rdx
	leaq	cost(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	$1, -16(%rbp)
	jmp	.L7
.L8:
	cmpl	$0, -16(%rbp)
	je	.L9
	movl	$1, -36(%rbp)
	jmp	.L10
.L16:
	movl	$1, -24(%rbp)
	jmp	.L11
.L15:
	movl	-24(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -20(%rbp)
	jmp	.L12
.L14:
	movl	-36(%rbp), %eax
	movslq	%eax, %rcx
	movl	-24(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rsi
	addq	%rsi, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	cost(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	-36(%rbp), %eax
	movl	-20(%rbp), %edx
	movslq	%edx, %rsi
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdi
	addq	%rdi, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,4), %rdx
	leaq	cost(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%ecx, %eax
	movl	%eax, -28(%rbp)
	movl	-20(%rbp), %eax
	movslq	%eax, %rcx
	movl	-24(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rsi
	addq	%rsi, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	cost(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-28(%rbp), %eax
	cmpl	%eax, %edx
	jle	.L13
	movl	-28(%rbp), %ecx
	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), %rdi
	addq	%rdi, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,4), %rdx
	leaq	cost(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	-24(%rbp), %eax
	movslq	%eax, %rcx
	movl	-20(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rsi
	addq	%rsi, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	cost(%rip), %rax
	movl	(%rdx,%rax), %ecx
	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), %rdi
	addq	%rdi, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,4), %rdx
	leaq	cost(%rip), %rax
	movl	%ecx, (%rdx,%rax)
.L13:
	addl	$1, -20(%rbp)
.L12:
	movl	-44(%rbp), %eax
	cmpl	%eax, -20(%rbp)
	jle	.L14
	addl	$1, -24(%rbp)
.L11:
	movl	-44(%rbp), %eax
	cmpl	%eax, -24(%rbp)
	jl	.L15
	movl	-36(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -36(%rbp)
.L10:
	movl	-36(%rbp), %edx
	movl	-44(%rbp), %eax
	cmpl	%eax, %edx
	jle	.L16
.L9:
	leaq	-32(%rbp), %rdx
	leaq	-36(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-36(%rbp), %eax
	movl	-32(%rbp), %edx
	movslq	%edx, %rcx
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rsi
	addq	%rsi, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	cost(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -12(%rbp)
	jle	.L17
	movl	-36(%rbp), %eax
	movl	-32(%rbp), %edx
	movslq	%edx, %rcx
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rsi
	addq	%rsi, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	cost(%rip), %rax
	movl	(%rdx,%rax), %eax
	jmp	.L18
.L17:
	movl	$-1, %eax
.L18:
	movl	%eax, %esi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, -16(%rbp)
.L7:
	movl	-40(%rbp), %eax
	leal	-1(%rax), %edx
	movl	%edx, -40(%rbp)
	testl	%eax, %eax
	jne	.L19
.L2:
	leaq	-40(%rbp), %rdx
	leaq	-44(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-44(%rbp), %edx
	movl	-40(%rbp), %eax
	orl	%edx, %eax
	testl	%eax, %eax
	jne	.L20
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L22
	call	__stack_chk_fail@PLT
.L22:
	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:
