Given the following C code and unoptimized assembly code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
N,M,L,Q;
D[301][301];
i,j,k;
a,b,c;
main()
{
	scanf("%d%d%d",&N,&M,&L);
	for(i=1;i<=N;i++)for(j=i+1;j<=N;j++)D[i][j]=D[j][i]=1000000001;
	for(i=0;i<M;i++)
	{
		scanf("%d%d%d",&a,&b,&c);
		D[a][b]=D[b][a]=c;
	}
	for(k=1;k<=N;k++)for(i=1;i<=N;i++)for(j=1;j<=N;j++)
		if(D[i][j]>D[i][k]+D[k][j])D[i][j]=D[i][k]+D[k][j];
	for(i=1;i<=N;i++)for(j=1;j<=N;j++)
	{
		if(i!=j)D[i][j]=D[i][j]>L?1000000000:1;
	}
	for(k=1;k<=N;k++)for(i=1;i<=N;i++)for(j=1;j<=N;j++)
		if(D[i][j]>D[i][k]+D[k][j])D[i][j]=D[i][k]+D[k][j];
	scanf("%d",&Q);
	for(i=0;i<Q;i++)
	{
		scanf("%d%d",&a,&b);
		printf("%d\n",D[a][b]<1000000000?D[a][b]-1:-1);
	}
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	N
	.bss
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	4
	.globl	M
	.align 4
	.type	M, @object
	.size	M, 4
M:
	.zero	4
	.globl	L
	.align 4
	.type	L, @object
	.size	L, 4
L:
	.zero	4
	.globl	Q
	.align 4
	.type	Q, @object
	.size	Q, 4
Q:
	.zero	4
	.globl	D
	.align 32
	.type	D, @object
	.size	D, 362404
D:
	.zero	362404
	.globl	i
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.globl	j
	.align 4
	.type	j, @object
	.size	j, 4
j:
	.zero	4
	.globl	k
	.align 4
	.type	k, @object
	.size	k, 4
k:
	.zero	4
	.globl	a
	.align 4
	.type	a, @object
	.size	a, 4
a:
	.zero	4
	.globl	b
	.align 4
	.type	b, @object
	.size	b, 4
b:
	.zero	4
	.globl	c
	.align 4
	.type	c, @object
	.size	c, 4
c:
	.zero	4
	.section	.rodata
.LC0:
	.string	"%d%d%d"
.LC1:
	.string	"%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
	leaq	L(%rip), %rax
	movq	%rax, %rcx
	leaq	M(%rip), %rax
	movq	%rax, %rdx
	leaq	N(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movl	$1, i(%rip)
	jmp	.L2
.L5:
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, j(%rip)
	jmp	.L3
.L4:
	movl	j(%rip), %eax
	movl	i(%rip), %edx
	movslq	%edx, %rsi
	movslq	%eax, %rcx
	imulq	$301, %rcx, %rcx
	addq	%rsi, %rcx
	leaq	0(,%rcx,4), %rsi
	leaq	D(%rip), %rcx
	movl	$1000000001, (%rsi,%rcx)
	movl	i(%rip), %ecx
	movl	j(%rip), %esi
	movslq	%edx, %rdx
	cltq
	imulq	$301, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	D(%rip), %rax
	movl	(%rdx,%rax), %eax
	movslq	%esi, %rsi
	movslq	%ecx, %rdx
	imulq	$301, %rdx, %rdx
	addq	%rsi, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	D(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	j(%rip), %eax
	addl	$1, %eax
	movl	%eax, j(%rip)
.L3:
	movl	j(%rip), %edx
	movl	N(%rip), %eax
	cmpl	%eax, %edx
	jle	.L4
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L2:
	movl	i(%rip), %edx
	movl	N(%rip), %eax
	cmpl	%eax, %edx
	jle	.L5
	movl	$0, i(%rip)
	jmp	.L6
.L7:
	leaq	c(%rip), %rax
	movq	%rax, %rcx
	leaq	b(%rip), %rax
	movq	%rax, %rdx
	leaq	a(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movl	b(%rip), %eax
	movl	a(%rip), %edx
	movl	c(%rip), %ecx
	movslq	%edx, %rdi
	movslq	%eax, %rsi
	imulq	$301, %rsi, %rsi
	addq	%rdi, %rsi
	leaq	0(,%rsi,4), %rdi
	leaq	D(%rip), %rsi
	movl	%ecx, (%rdi,%rsi)
	movl	a(%rip), %ecx
	movl	b(%rip), %esi
	movslq	%edx, %rdx
	cltq
	imulq	$301, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	D(%rip), %rax
	movl	(%rdx,%rax), %eax
	movslq	%esi, %rsi
	movslq	%ecx, %rdx
	imulq	$301, %rdx, %rdx
	addq	%rsi, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	D(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L6:
	movl	i(%rip), %edx
	movl	M(%rip), %eax
	cmpl	%eax, %edx
	jl	.L7
	movl	$1, k(%rip)
	jmp	.L8
.L14:
	movl	$1, i(%rip)
	jmp	.L9
.L13:
	movl	$1, j(%rip)
	jmp	.L10
.L12:
	movl	i(%rip), %eax
	movl	j(%rip), %edx
	movslq	%edx, %rdx
	cltq
	imulq	$301, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	D(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	i(%rip), %edx
	movl	k(%rip), %ecx
	movslq	%ecx, %rcx
	movslq	%edx, %rdx
	imulq	$301, %rdx, %rdx
	addq	%rcx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	D(%rip), %rdx
	movl	(%rcx,%rdx), %esi
	movl	k(%rip), %edx
	movl	j(%rip), %ecx
	movslq	%ecx, %rcx
	movslq	%edx, %rdx
	imulq	$301, %rdx, %rdx
	addq	%rcx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	D(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	addl	%esi, %edx
	cmpl	%edx, %eax
	jle	.L11
	movl	i(%rip), %eax
	movl	k(%rip), %edx
	movslq	%edx, %rdx
	cltq
	imulq	$301, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	D(%rip), %rax
	movl	(%rdx,%rax), %esi
	movl	k(%rip), %eax
	movl	j(%rip), %edx
	movslq	%edx, %rdx
	cltq
	imulq	$301, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	D(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	i(%rip), %eax
	movl	j(%rip), %edx
	addl	%esi, %ecx
	movslq	%edx, %rdx
	cltq
	imulq	$301, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	D(%rip), %rax
	movl	%ecx, (%rdx,%rax)
.L11:
	movl	j(%rip), %eax
	addl	$1, %eax
	movl	%eax, j(%rip)
.L10:
	movl	j(%rip), %edx
	movl	N(%rip), %eax
	cmpl	%eax, %edx
	jle	.L12
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L9:
	movl	i(%rip), %edx
	movl	N(%rip), %eax
	cmpl	%eax, %edx
	jle	.L13
	movl	k(%rip), %eax
	addl	$1, %eax
	movl	%eax, k(%rip)
.L8:
	movl	k(%rip), %edx
	movl	N(%rip), %eax
	cmpl	%eax, %edx
	jle	.L14
	movl	$1, i(%rip)
	jmp	.L15
.L21:
	movl	$1, j(%rip)
	jmp	.L16
.L20:
	movl	i(%rip), %edx
	movl	j(%rip), %eax
	cmpl	%eax, %edx
	je	.L17
	movl	i(%rip), %eax
	movl	j(%rip), %edx
	movslq	%edx, %rdx
	cltq
	imulq	$301, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	D(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	L(%rip), %eax
	cmpl	%eax, %edx
	jle	.L18
	movl	$1000000000, %ecx
	jmp	.L19
.L18:
	movl	$1, %ecx
.L19:
	movl	i(%rip), %eax
	movl	j(%rip), %edx
	movslq	%edx, %rdx
	cltq
	imulq	$301, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	D(%rip), %rax
	movl	%ecx, (%rdx,%rax)
.L17:
	movl	j(%rip), %eax
	addl	$1, %eax
	movl	%eax, j(%rip)
.L16:
	movl	j(%rip), %edx
	movl	N(%rip), %eax
	cmpl	%eax, %edx
	jle	.L20
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L15:
	movl	i(%rip), %edx
	movl	N(%rip), %eax
	cmpl	%eax, %edx
	jle	.L21
	movl	$1, k(%rip)
	jmp	.L22
.L28:
	movl	$1, i(%rip)
	jmp	.L23
.L27:
	movl	$1, j(%rip)
	jmp	.L24
.L26:
	movl	i(%rip), %eax
	movl	j(%rip), %edx
	movslq	%edx, %rdx
	cltq
	imulq	$301, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	D(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	i(%rip), %edx
	movl	k(%rip), %ecx
	movslq	%ecx, %rcx
	movslq	%edx, %rdx
	imulq	$301, %rdx, %rdx
	addq	%rcx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	D(%rip), %rdx
	movl	(%rcx,%rdx), %esi
	movl	k(%rip), %edx
	movl	j(%rip), %ecx
	movslq	%ecx, %rcx
	movslq	%edx, %rdx
	imulq	$301, %rdx, %rdx
	addq	%rcx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	D(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	addl	%esi, %edx
	cmpl	%edx, %eax
	jle	.L25
	movl	i(%rip), %eax
	movl	k(%rip), %edx
	movslq	%edx, %rdx
	cltq
	imulq	$301, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	D(%rip), %rax
	movl	(%rdx,%rax), %esi
	movl	k(%rip), %eax
	movl	j(%rip), %edx
	movslq	%edx, %rdx
	cltq
	imulq	$301, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	D(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	i(%rip), %eax
	movl	j(%rip), %edx
	addl	%esi, %ecx
	movslq	%edx, %rdx
	cltq
	imulq	$301, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	D(%rip), %rax
	movl	%ecx, (%rdx,%rax)
.L25:
	movl	j(%rip), %eax
	addl	$1, %eax
	movl	%eax, j(%rip)
.L24:
	movl	j(%rip), %edx
	movl	N(%rip), %eax
	cmpl	%eax, %edx
	jle	.L26
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L23:
	movl	i(%rip), %edx
	movl	N(%rip), %eax
	cmpl	%eax, %edx
	jle	.L27
	movl	k(%rip), %eax
	addl	$1, %eax
	movl	%eax, k(%rip)
.L22:
	movl	k(%rip), %edx
	movl	N(%rip), %eax
	cmpl	%eax, %edx
	jle	.L28
	leaq	Q(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movl	$0, i(%rip)
	jmp	.L29
.L32:
	leaq	b(%rip), %rax
	movq	%rax, %rdx
	leaq	a(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movl	a(%rip), %eax
	movl	b(%rip), %edx
	movslq	%edx, %rdx
	cltq
	imulq	$301, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	D(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	$999999999, %eax
	jg	.L30
	movl	a(%rip), %eax
	movl	b(%rip), %edx
	movslq	%edx, %rdx
	cltq
	imulq	$301, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	D(%rip), %rax
	movl	(%rdx,%rax), %eax
	subl	$1, %eax
	jmp	.L31
.L30:
	movl	$-1, %eax
.L31:
	movl	%eax, %esi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L29:
	movl	i(%rip), %edx
	movl	Q(%rip), %eax
	cmpl	%eax, %edx
	jl	.L32
	movl	$0, %eax
	popq	%rbp
	.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%d"
.LC2:
	.string	"%d"
.LC3:
	.string	"%d%d"
.LC4:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	N(%rip), %rsi
	xorl	%eax, %eax
	leaq	L(%rip), %rcx
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	leaq	M(%rip), %rdx
	leaq	.LC0(%rip), %rdi
	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	$24, %rsp
	.cfi_def_cfa_offset 80
	call	scanf@PLT
	movl	N(%rip), %esi
	testl	%esi, %esi
	jle	.L2
	leal	2(%rsi), %eax
	leal	-1(%rsi), %edi
	movl	$302, %ebp
	movl	$2, %ecx
	leaq	2412+D(%rip), %r15
	movq	%rax, 8(%rsp)
	movdqa	.LC1(%rip), %xmm0
	movl	$1208, %r9d
	leaq	-1208(%r15), %r10
	leaq	8(%r10), %rbx
	leaq	-1212(%rbx), %r12
	.p2align 4,,10
	.p2align 3
.L8:
	leal	-1(%rcx), %eax
	movl	%ecx, %r13d
	movl	%ecx, %edx
	movl	%eax, 4(%rsp)
	cmpl	%ecx, %esi
	jl	.L3
	movl	%edi, %eax
	leaq	1204(%r9), %r14
	leaq	4(%r9), %r11
	leaq	1(%rax,%rbp), %r8
	salq	$2, %r8
	cmpq	%r14, %r8
	setle	%r8b
	imulq	$1204, %rax, %rax
	addq	%r11, %rax
	cmpq	%r11, %rax
	setle	%al
	orb	%r8b, %al
	je	.L30
	movl	%esi, %eax
	subl	%ecx, %eax
	cmpl	$8, %eax
	jbe	.L30
	movl	%edi, %eax
	movq	%rbx, %r8
	shrl	$2, %eax
	subl	$1, %eax
	salq	$4, %rax
	leaq	16(%rbx,%rax), %r11
	movq	%r15, %rax
	.p2align 4,,10
	.p2align 3
.L5:
	movl	$1000000001, (%rax)
	addq	$16, %r8
	addq	$4816, %rax
	movl	$1000000001, -3612(%rax)
	movl	$1000000001, -2408(%rax)
	movl	$1000000001, -1204(%rax)
	movups	%xmm0, -16(%r8)
	cmpq	%r11, %r8
	jne	.L5
	movl	%edi, %eax
	andl	$-4, %eax
	addl	%eax, %edx
	cmpl	%edi, %eax
	je	.L7
	movslq	%edx, %rax
	movslq	4(%rsp), %r11
	imulq	$301, %rax, %r8
	addq	%r11, %r8
	movl	$1000000001, (%r12,%r8,4)
	imulq	$301, %r11, %r8
	addq	%r8, %rax
	movl	$1000000001, (%r12,%rax,4)
	leal	1(%rdx), %eax
	cmpl	%esi, %eax
	jg	.L7
	cltq
	addl	$2, %edx
	imulq	$301, %rax, %r14
	addq	%r8, %rax
	addq	%r11, %r14
	movl	$1000000001, (%r12,%r14,4)
	movl	$1000000001, (%r12,%rax,4)
	cmpl	%edx, %esi
	jl	.L7
	movslq	%edx, %rdx
	imulq	$301, %rdx, %rax
	addq	%rdx, %r8
	addq	%r11, %rax
	movl	$1000000001, (%r12,%rax,4)
	movl	$1000000001, (%r12,%r8,4)
.L7:
	leal	(%rdi,%r13), %edx
.L3:
	addq	$1, %rcx
	subl	$1, %edi
	addq	$1208, %r15
	addq	$1204, %r10
	addq	$1208, %r9
	addq	$302, %rbp
	addq	$1208, %rbx
	cmpq	8(%rsp), %rcx
	jne	.L8
	movl	%edx, j(%rip)
.L2:
	movl	M(%rip), %edx
	leaq	D(%rip), %rbx
	movl	$0, i(%rip)
	leaq	c(%rip), %r13
	leaq	b(%rip), %r12
	leaq	a(%rip), %rbp
	testl	%edx, %edx
	jle	.L12
	.p2align 4,,10
	.p2align 3
.L9:
	movq	%r13, %rcx
	movq	%r12, %rdx
	movq	%rbp, %rsi
	xorl	%eax, %eax
	leaq	.LC0(%rip), %rdi
	call	scanf@PLT
	movslq	b(%rip), %rsi
	movslq	a(%rip), %rax
	movl	c(%rip), %ecx
	imulq	$301, %rsi, %rdx
	addq	%rax, %rdx
	imulq	$301, %rax, %rax
	movl	%ecx, (%rbx,%rdx,4)
	addq	%rsi, %rax
	movl	%ecx, (%rbx,%rax,4)
	movl	i(%rip), %eax
	addl	$1, %eax
	cmpl	M(%rip), %eax
	movl	%eax, i(%rip)
	jl	.L9
	movl	N(%rip), %esi
.L12:
	movl	$1, k(%rip)
	testl	%esi, %esi
	jle	.L59
	leal	-1(%rsi), %r14d
	leaq	4+D(%rip), %r10
	movl	$1204, %r12d
	imulq	$-1204, %r14, %r8
	leaq	4(%r10), %rax
	movq	%r10, %r13
	movq	%r10, %r9
	leaq	(%rax,%r14,4), %rbx
	leaq	1204(%rax,%r14,4), %r11
	subq	$2408, %r8
	.p2align 4,,10
	.p2align 3
.L16:
	movq	%r13, %rdi
	movq	%r11, %rbp
	movq	$-1204, %rcx
	.p2align 4,,10
	.p2align 3
.L15:
	movq	%r9, %rax
	subq	%rcx, %rax
	.p2align 4,,10
	.p2align 3
.L14:
	leaq	(%rax,%rcx), %r15
	movl	1204(%rdi), %edx
	addl	(%r15,%r12), %edx
	cmpl	%edx, (%rax)
	jle	.L13
	movl	%edx, (%rax)
.L13:
	addq	$4, %rax
	cmpq	%rbp, %rax
	jne	.L14
	subq	$1204, %rcx
	leaq	1204(%rax), %rbp
	addq	$1204, %rdi
	cmpq	%r8, %rcx
	jne	.L15
	addq	$4, %r13
	addq	$1204, %r12
	cmpq	%rbx, %r13
	jne	.L16
	addl	$1, %esi
	leaq	2(%r14), %rbp
	movl	L(%rip), %r13d
	leaq	1208+D(%rip), %r15
	movl	%esi, j(%rip)
	movl	$1, %ecx
	movl	$1000000000, %r14d
	movl	$1, %r12d
	.p2align 4,,10
	.p2align 3
.L20:
	movq	%r15, %rdx
	movl	$1, %eax
	.p2align 4,,10
	.p2align 3
.L19:
	cmpl	%eax, %ecx
	je	.L17
	cmpl	%r13d, (%rdx)
	movl	%r12d, %edi
	cmovg	%r14d, %edi
	movl	%edi, (%rdx)
.L17:
	addq	$1, %rax
	addq	$4, %rdx
	cmpq	%rbp, %rax
	jne	.L19
	addl	$1, %ecx
	addq	$1204, %r15
	cmpl	%esi, %ecx
	jne	.L20
	movl	%esi, i(%rip)
	movl	$1204, %r13d
	.p2align 4,,10
	.p2align 3
.L24:
	movq	%r10, %rbp
	movq	%r11, %r12
	movq	$-1204, %rdi
	.p2align 4,,10
	.p2align 3
.L23:
	movq	%r9, %rax
	subq	%rdi, %rax
	.p2align 4,,10
	.p2align 3
.L22:
	leaq	(%rax,%rdi), %rcx
	movl	1204(%rbp), %edx
	addl	(%rcx,%r13), %edx
	cmpl	%edx, (%rax)
	jle	.L21
	movl	%edx, (%rax)
.L21:
	addq	$4, %rax
	cmpq	%r12, %rax
	jne	.L22
	subq	$1204, %rdi
	leaq	1204(%rax), %r12
	addq	$1204, %rbp
	cmpq	%r8, %rdi
	jne	.L23
	addq	$4, %r10
	addq	$1204, %r13
	cmpq	%rbx, %r10
	jne	.L24
	movl	%esi, k(%rip)
.L29:
	leaq	Q(%rip), %rsi
	leaq	.LC2(%rip), %rdi
	xorl	%eax, %eax
	call	scanf@PLT
	movl	Q(%rip), %eax
	movl	$0, i(%rip)
	leaq	D(%rip), %rbx
	leaq	b(%rip), %r12
	leaq	a(%rip), %rbp
	leaq	.LC3(%rip), %r13
	leaq	.LC4(%rip), %r14
	testl	%eax, %eax
	jle	.L34
	.p2align 4,,10
	.p2align 3
.L25:
	movq	%r12, %rdx
	movq	%rbp, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	call	scanf@PLT
	movslq	a(%rip), %rax
	movslq	b(%rip), %rdx
	imulq	$301, %rax, %rax
	addq	%rdx, %rax
	movl	(%rbx,%rax,4), %eax
	cmpl	$999999999, %eax
	jg	.L26
	leal	-1(%rax), %esi
	movq	%r14, %rdi
	xorl	%eax, %eax
	call	printf@PLT
	movl	i(%rip), %eax
	addl	$1, %eax
	cmpl	%eax, Q(%rip)
	movl	%eax, i(%rip)
	jg	.L25
.L34:
	addq	$24, %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
.L26:
	.cfi_restore_state
	xorl	%eax, %eax
	movl	$-1, %esi
	movq	%r14, %rdi
	call	printf@PLT
	movl	i(%rip), %eax
	addl	$1, %eax
	cmpl	Q(%rip), %eax
	movl	%eax, i(%rip)
	jl	.L25
	jmp	.L34
.L30:
	movq	%r15, %rdx
	movq	%rcx, %rax
	.p2align 4,,10
	.p2align 3
.L4:
	movl	$1000000001, (%rdx)
	addq	$1204, %rdx
	movl	$1000000001, (%r10,%rax,4)
	addq	$1, %rax
	cmpl	%eax, %esi
	jge	.L4
	jmp	.L7
.L59:
	movl	$1, i(%rip)
	jmp	.L29
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	c
	.bss
	.align 4
	.type	c, @object
	.size	c, 4
c:
	.zero	4
	.globl	b
	.align 4
	.type	b, @object
	.size	b, 4
b:
	.zero	4
	.globl	a
	.align 4
	.type	a, @object
	.size	a, 4
a:
	.zero	4
	.globl	k
	.align 4
	.type	k, @object
	.size	k, 4
k:
	.zero	4
	.globl	j
	.align 4
	.type	j, @object
	.size	j, 4
j:
	.zero	4
	.globl	i
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.globl	D
	.align 32
	.type	D, @object
	.size	D, 362404
D:
	.zero	362404
	.globl	Q
	.align 4
	.type	Q, @object
	.size	Q, 4
Q:
	.zero	4
	.globl	L
	.align 4
	.type	L, @object
	.size	L, 4
L:
	.zero	4
	.globl	M
	.align 4
	.type	M, @object
	.size	M, 4
M:
	.zero	4
	.globl	N
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	4
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC1:
	.long	1000000001
	.long	1000000001
	.long	1000000001
	.long	1000000001
	.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%d"
.LC2:
	.string	"%d"
.LC3:
	.string	"%d%d"
.LC4:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	N(%rip), %rsi
	xorl	%eax, %eax
	leaq	L(%rip), %rcx
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	leaq	M(%rip), %rdx
	leaq	.LC0(%rip), %rdi
	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	$24, %rsp
	.cfi_def_cfa_offset 80
	call	scanf@PLT
	movl	N(%rip), %esi
	testl	%esi, %esi
	jle	.L2
	leal	2(%rsi), %eax
	leal	-1(%rsi), %edi
	movl	$302, %ebp
	movl	$2, %ecx
	leaq	2412+D(%rip), %r15
	movq	%rax, 8(%rsp)
	movdqa	.LC1(%rip), %xmm0
	movl	$1208, %r9d
	leaq	-1208(%r15), %r10
	leaq	8(%r10), %rbx
	leaq	-1212(%rbx), %r12
	.p2align 4,,10
	.p2align 3
.L8:
	leal	-1(%rcx), %eax
	movl	%ecx, %r13d
	movl	%ecx, %edx
	movl	%eax, 4(%rsp)
	cmpl	%ecx, %esi
	jl	.L3
	movl	%edi, %eax
	leaq	1204(%r9), %r14
	leaq	4(%r9), %r11
	leaq	1(%rax,%rbp), %r8
	salq	$2, %r8
	cmpq	%r14, %r8
	setle	%r8b
	imulq	$1204, %rax, %rax
	addq	%r11, %rax
	cmpq	%r11, %rax
	setle	%al
	orb	%r8b, %al
	je	.L30
	movl	%esi, %eax
	subl	%ecx, %eax
	cmpl	$8, %eax
	jbe	.L30
	movl	%edi, %eax
	movq	%rbx, %r8
	shrl	$2, %eax
	subl	$1, %eax
	salq	$4, %rax
	leaq	16(%rbx,%rax), %r11
	movq	%r15, %rax
	.p2align 4,,10
	.p2align 3
.L5:
	movl	$1000000001, (%rax)
	addq	$16, %r8
	addq	$4816, %rax
	movl	$1000000001, -3612(%rax)
	movl	$1000000001, -2408(%rax)
	movl	$1000000001, -1204(%rax)
	movups	%xmm0, -16(%r8)
	cmpq	%r11, %r8
	jne	.L5
	movl	%edi, %eax
	andl	$-4, %eax
	addl	%eax, %edx
	cmpl	%edi, %eax
	je	.L7
	movslq	%edx, %rax
	movslq	4(%rsp), %r11
	imulq	$301, %rax, %r8
	addq	%r11, %r8
	movl	$1000000001, (%r12,%r8,4)
	imulq	$301, %r11, %r8
	addq	%r8, %rax
	movl	$1000000001, (%r12,%rax,4)
	leal	1(%rdx), %eax
	cmpl	%esi, %eax
	jg	.L7
	cltq
	addl	$2, %edx
	imulq	$301, %rax, %r14
	addq	%r8, %rax
	addq	%r11, %r14
	movl	$1000000001, (%r12,%r14,4)
	movl	$1000000001, (%r12,%rax,4)
	cmpl	%edx, %esi
	jl	.L7
	movslq	%edx, %rdx
	imulq	$301, %rdx, %rax
	addq	%rdx, %r8
	addq	%r11, %rax
	movl	$1000000001, (%r12,%rax,4)
	movl	$1000000001, (%r12,%r8,4)
.L7:
	leal	(%rdi,%r13), %edx
.L3:
	addq	$1, %rcx
	subl	$1, %edi
	addq	$1208, %r15
	addq	$1204, %r10
	addq	$1208, %r9
	addq	$302, %rbp
	addq	$1208, %rbx
	cmpq	8(%rsp), %rcx
	jne	.L8
	movl	%edx, j(%rip)
.L2:
	movl	M(%rip), %edx
	leaq	D(%rip), %rbx
	movl	$0, i(%rip)
	leaq	c(%rip), %r13
	leaq	b(%rip), %r12
	leaq	a(%rip), %rbp
	testl	%edx, %edx
	jle	.L12
	.p2align 4,,10
	.p2align 3
.L9:
	movq	%r13, %rcx
	movq	%r12, %rdx
	movq	%rbp, %rsi
	xorl	%eax, %eax
	leaq	.LC0(%rip), %rdi
	call	scanf@PLT
	movslq	b(%rip), %rsi
	movslq	a(%rip), %rax
	movl	c(%rip), %ecx
	imulq	$301, %rsi, %rdx
	addq	%rax, %rdx
	imulq	$301, %rax, %rax
	movl	%ecx, (%rbx,%rdx,4)
	addq	%rsi, %rax
	movl	%ecx, (%rbx,%rax,4)
	movl	i(%rip), %eax
	addl	$1, %eax
	cmpl	M(%rip), %eax
	movl	%eax, i(%rip)
	jl	.L9
	movl	N(%rip), %esi
.L12:
	movl	$1, k(%rip)
	testl	%esi, %esi
	jle	.L59
	leal	-1(%rsi), %r14d
	leaq	4+D(%rip), %r10
	movl	$1204, %r12d
	imulq	$-1204, %r14, %r8
	leaq	4(%r10), %rax
	movq	%r10, %r13
	movq	%r10, %r9
	leaq	(%rax,%r14,4), %rbx
	leaq	1204(%rax,%r14,4), %r11
	subq	$2408, %r8
	.p2align 4,,10
	.p2align 3
.L16:
	movq	%r13, %rdi
	movq	%r11, %rbp
	movq	$-1204, %rcx
	.p2align 4,,10
	.p2align 3
.L15:
	movq	%r9, %rax
	subq	%rcx, %rax
	.p2align 4,,10
	.p2align 3
.L14:
	leaq	(%rax,%rcx), %r15
	movl	1204(%rdi), %edx
	addl	(%r15,%r12), %edx
	cmpl	%edx, (%rax)
	jle	.L13
	movl	%edx, (%rax)
.L13:
	addq	$4, %rax
	cmpq	%rbp, %rax
	jne	.L14
	subq	$1204, %rcx
	leaq	1204(%rax), %rbp
	addq	$1204, %rdi
	cmpq	%r8, %rcx
	jne	.L15
	addq	$4, %r13
	addq	$1204, %r12
	cmpq	%rbx, %r13
	jne	.L16
	addl	$1, %esi
	leaq	2(%r14), %rbp
	movl	L(%rip), %r13d
	leaq	1208+D(%rip), %r15
	movl	%esi, j(%rip)
	movl	$1, %ecx
	movl	$1000000000, %r14d
	movl	$1, %r12d
	.p2align 4,,10
	.p2align 3
.L20:
	movq	%r15, %rdx
	movl	$1, %eax
	.p2align 4,,10
	.p2align 3
.L19:
	cmpl	%eax, %ecx
	je	.L17
	cmpl	%r13d, (%rdx)
	movl	%r12d, %edi
	cmovg	%r14d, %edi
	movl	%edi, (%rdx)
.L17:
	addq	$1, %rax
	addq	$4, %rdx
	cmpq	%rbp, %rax
	jne	.L19
	addl	$1, %ecx
	addq	$1204, %r15
	cmpl	%esi, %ecx
	jne	.L20
	movl	%esi, i(%rip)
	movl	$1204, %r13d
	.p2align 4,,10
	.p2align 3
.L24:
	movq	%r10, %rbp
	movq	%r11, %r12
	movq	$-1204, %rdi
	.p2align 4,,10
	.p2align 3
.L23:
	movq	%r9, %rax
	subq	%rdi, %rax
	.p2align 4,,10
	.p2align 3
.L22:
	leaq	(%rax,%rdi), %rcx
	movl	1204(%rbp), %edx
	addl	(%rcx,%r13), %edx
	cmpl	%edx, (%rax)
	jle	.L21
	movl	%edx, (%rax)
.L21:
	addq	$4, %rax
	cmpq	%r12, %rax
	jne	.L22
	subq	$1204, %rdi
	leaq	1204(%rax), %r12
	addq	$1204, %rbp
	cmpq	%r8, %rdi
	jne	.L23
	addq	$4, %r10
	addq	$1204, %r13
	cmpq	%rbx, %r10
	jne	.L24
	movl	%esi, k(%rip)
.L29:
	leaq	Q(%rip), %rsi
	leaq	.LC2(%rip), %rdi
	xorl	%eax, %eax
	call	scanf@PLT
	movl	Q(%rip), %eax
	movl	$0, i(%rip)
	leaq	D(%rip), %rbx
	leaq	b(%rip), %r12
	leaq	a(%rip), %rbp
	leaq	.LC3(%rip), %r13
	leaq	.LC4(%rip), %r14
	testl	%eax, %eax
	jle	.L34
	.p2align 4,,10
	.p2align 3
.L25:
	movq	%r12, %rdx
	movq	%rbp, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	call	scanf@PLT
	movslq	a(%rip), %rax
	movslq	b(%rip), %rdx
	imulq	$301, %rax, %rax
	addq	%rdx, %rax
	movl	(%rbx,%rax,4), %eax
	cmpl	$999999999, %eax
	jg	.L26
	leal	-1(%rax), %esi
	movq	%r14, %rdi
	xorl	%eax, %eax
	call	printf@PLT
	movl	i(%rip), %eax
	addl	$1, %eax
	cmpl	%eax, Q(%rip)
	movl	%eax, i(%rip)
	jg	.L25
.L34:
	addq	$24, %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
.L26:
	.cfi_restore_state
	xorl	%eax, %eax
	movl	$-1, %esi
	movq	%r14, %rdi
	call	printf@PLT
	movl	i(%rip), %eax
	addl	$1, %eax
	cmpl	Q(%rip), %eax
	movl	%eax, i(%rip)
	jl	.L25
	jmp	.L34
.L30:
	movq	%r15, %rdx
	movq	%rcx, %rax
	.p2align 4,,10
	.p2align 3
.L4:
	movl	$1000000001, (%rdx)
	addq	$1204, %rdx
	movl	$1000000001, (%r10,%rax,4)
	addq	$1, %rax
	cmpl	%eax, %esi
	jge	.L4
	jmp	.L7
.L59:
	movl	$1, i(%rip)
	jmp	.L29
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	c
	.bss
	.align 4
	.type	c, @object
	.size	c, 4
c:
	.zero	4
	.globl	b
	.align 4
	.type	b, @object
	.size	b, 4
b:
	.zero	4
	.globl	a
	.align 4
	.type	a, @object
	.size	a, 4
a:
	.zero	4
	.globl	k
	.align 4
	.type	k, @object
	.size	k, 4
k:
	.zero	4
	.globl	j
	.align 4
	.type	j, @object
	.size	j, 4
j:
	.zero	4
	.globl	i
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.globl	D
	.align 32
	.type	D, @object
	.size	D, 362404
D:
	.zero	362404
	.globl	Q
	.align 4
	.type	Q, @object
	.size	Q, 4
Q:
	.zero	4
	.globl	L
	.align 4
	.type	L, @object
	.size	L, 4
L:
	.zero	4
	.globl	M
	.align 4
	.type	M, @object
	.size	M, 4
M:
	.zero	4
	.globl	N
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	4
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC1:
	.long	1000000001
	.long	1000000001
	.long	1000000001
	.long	1000000001
	.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:

N,M,L,Q;
D[301][301];
i,j,k;
a,b,c;
main()
{
	scanf("%d%d%d",&N,&M,&L);
	for(i=1;i<=N;i++)for(j=i+1;j<=N;j++)D[i][j]=D[j][i]=1000000001;
	for(i=0;i<M;i++)
	{
		scanf("%d%d%d",&a,&b,&c);
		D[a][b]=D[b][a]=c;
	}
	for(k=1;k<=N;k++)for(i=1;i<=N;i++)for(j=1;j<=N;j++)
		if(D[i][j]>D[i][k]+D[k][j])D[i][j]=D[i][k]+D[k][j];
	for(i=1;i<=N;i++)for(j=1;j<=N;j++)
	{
		if(i!=j)D[i][j]=D[i][j]>L?1000000000:1;
	}
	for(k=1;k<=N;k++)for(i=1;i<=N;i++)for(j=1;j<=N;j++)
		if(D[i][j]>D[i][k]+D[k][j])D[i][j]=D[i][k]+D[k][j];
	scanf("%d",&Q);
	for(i=0;i<Q;i++)
	{
		scanf("%d%d",&a,&b);
		printf("%d\n",D[a][b]<1000000000?D[a][b]-1:-1);
	}
}
4 0 0
1
2 1
 5 4 4
1 2 2
2 3 2
3 4 3
4 5 2
20
2 1
3 1
4 1
5 1
1 2
3 2
4 2
5 2
1 3
2 4
4 3
5 3
1 4
2 4
3 4
5 4
1 5
2 5
3 5
4 5
 5 4 4
1 2 2
2 3 2
3 4 3
4 5 2
20
2 1
3 1
3 1
5 1
1 2
3 2
4 2
5 2
1 3
2 3
4 3
5 3
1 4
2 4
3 4
5 4
1 5
2 5
3 5
4 5
 3 2 5
1 2 3
2 2 3
2
3 2
1 3
 5 4 4
1 2 4
2 3 2
3 4 3
4 5 2
20
2 1
3 1
4 1
5 1
1 2
3 2
4 2
5 2
1 3
2 4
4 3
5 3
1 4
2 4
3 4
5 4
1 5
2 5
3 5
4 5
 5 4 4
1 2 2
2 3 0
3 4 3
4 5 2
20
2 1
3 1
4 1
5 1
1 2
3 2
4 2
5 2
1 3
2 3
4 3
5 3
1 4
2 4
3 4
5 4
1 5
2 5
3 5
4 5
 5 4 4
1 2 4
2 3 2
3 4 3
4 5 2
20
2 1
3 1
4 1
5 1
1 4
3 2
4 2
5 2
1 3
2 4
4 3
5 3
1 4
2 4
3 4
5 4
1 5
2 5
3 5
4 5
 5 4 4
2 2 2
2 3 0
3 4 3
4 5 2
20
2 1
3 1
4 1
5 1
1 2
3 2
4 2
5 2
1 3
2 3
4 3
5 3
1 4
2 4
3 4
5 4
1 5
2 5
3 5
4 5
 5 4 4
2 2 2
2 3 0
3 4 3
4 5 2
20
2 1
3 1
4 1
5 1
1 2
3 2
4 2
5 2
1 3
2 5
4 3
5 3
1 4
2 4
3 4
5 4
1 5
2 5
3 5
4 5
 5 4 4
1 2 2
2 3 2
3 4 3
4 5 2
20
2 1
3 1
4 1
5 1
1 2
5 2
4 2
5 2
1 3
2 3
4 3
5 3
1 4
2 4
3 4
5 4
1 5
2 5
3 5
4 5

-1
 0
0
1
2
0
0
1
2
0
1
0
1
1
1
0
0
2
2
1
0
 0
0
0
2
0
0
1
2
0
0
0
1
1
1
0
0
2
2
1
0
 -1
-1
 0
1
2
3
0
0
1
2
1
1
0
1
2
1
0
0
3
2
1
0
 0
0
1
2
0
0
0
1
0
0
0
1
1
0
0
0
2
1
1
0
 0
1
2
3
2
0
1
2
1
1
0
1
2
1
0
0
3
2
1
0
 -1
-1
-1
-1
-1
0
0
1
-1
0
0
1
-1
0
0
0
-1
1
1
0
 -1
-1
-1
-1
-1
0
0
1
-1
1
0
1
-1
0
0
0
-1
1
1
0
 0
0
1
2
0
2
1
2
0
0
0
1
1
1
0
0
2
2
1
0

Given the following C code and unoptimized assembly code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
N,M,L,Q;
D[301][301];
i,j,k;
a,b,c;
main()
{
	scanf("%d%d%d",&N,&M,&L);
	for(i=1;i<=N;i++)for(j=i+1;j<=N;j++)D[i][j]=D[j][i]=1000000001;
	for(i=0;i<M;i++)
	{
		scanf("%d%d%d",&a,&b,&c);
		D[a][b]=D[b][a]=c;
	}
	for(k=1;k<=N;k++)for(i=1;i<=N;i++)for(j=1;j<=N;j++)
		if(D[i][j]>D[i][k]+D[k][j])D[i][j]=D[i][k]+D[k][j];
	for(i=1;i<=N;i++)for(j=1;j<=N;j++)
	{
		if(i!=j)D[i][j]=D[i][j]>L?1000000000:1;
	}
	for(k=1;k<=N;k++)for(i=1;i<=N;i++)for(j=1;j<=N;j++)
		if(D[i][j]>D[i][k]+D[k][j])D[i][j]=D[i][k]+D[k][j];
	scanf("%d",&Q);
	for(i=0;i<Q;i++)
	{
		scanf("%d%d",&a,&b);
		printf("%d\n",D[a][b]<1000000000?D[a][b]-1:-1);
	}
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	N
	.bss
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	4
	.globl	M
	.align 4
	.type	M, @object
	.size	M, 4
M:
	.zero	4
	.globl	L
	.align 4
	.type	L, @object
	.size	L, 4
L:
	.zero	4
	.globl	Q
	.align 4
	.type	Q, @object
	.size	Q, 4
Q:
	.zero	4
	.globl	D
	.align 32
	.type	D, @object
	.size	D, 362404
D:
	.zero	362404
	.globl	i
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.globl	j
	.align 4
	.type	j, @object
	.size	j, 4
j:
	.zero	4
	.globl	k
	.align 4
	.type	k, @object
	.size	k, 4
k:
	.zero	4
	.globl	a
	.align 4
	.type	a, @object
	.size	a, 4
a:
	.zero	4
	.globl	b
	.align 4
	.type	b, @object
	.size	b, 4
b:
	.zero	4
	.globl	c
	.align 4
	.type	c, @object
	.size	c, 4
c:
	.zero	4
	.section	.rodata
.LC0:
	.string	"%d%d%d"
.LC1:
	.string	"%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
	leaq	L(%rip), %rax
	movq	%rax, %rcx
	leaq	M(%rip), %rax
	movq	%rax, %rdx
	leaq	N(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movl	$1, i(%rip)
	jmp	.L2
.L5:
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, j(%rip)
	jmp	.L3
.L4:
	movl	j(%rip), %eax
	movl	i(%rip), %edx
	movslq	%edx, %rsi
	movslq	%eax, %rcx
	imulq	$301, %rcx, %rcx
	addq	%rsi, %rcx
	leaq	0(,%rcx,4), %rsi
	leaq	D(%rip), %rcx
	movl	$1000000001, (%rsi,%rcx)
	movl	i(%rip), %ecx
	movl	j(%rip), %esi
	movslq	%edx, %rdx
	cltq
	imulq	$301, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	D(%rip), %rax
	movl	(%rdx,%rax), %eax
	movslq	%esi, %rsi
	movslq	%ecx, %rdx
	imulq	$301, %rdx, %rdx
	addq	%rsi, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	D(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	j(%rip), %eax
	addl	$1, %eax
	movl	%eax, j(%rip)
.L3:
	movl	j(%rip), %edx
	movl	N(%rip), %eax
	cmpl	%eax, %edx
	jle	.L4
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L2:
	movl	i(%rip), %edx
	movl	N(%rip), %eax
	cmpl	%eax, %edx
	jle	.L5
	movl	$0, i(%rip)
	jmp	.L6
.L7:
	leaq	c(%rip), %rax
	movq	%rax, %rcx
	leaq	b(%rip), %rax
	movq	%rax, %rdx
	leaq	a(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movl	b(%rip), %eax
	movl	a(%rip), %edx
	movl	c(%rip), %ecx
	movslq	%edx, %rdi
	movslq	%eax, %rsi
	imulq	$301, %rsi, %rsi
	addq	%rdi, %rsi
	leaq	0(,%rsi,4), %rdi
	leaq	D(%rip), %rsi
	movl	%ecx, (%rdi,%rsi)
	movl	a(%rip), %ecx
	movl	b(%rip), %esi
	movslq	%edx, %rdx
	cltq
	imulq	$301, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	D(%rip), %rax
	movl	(%rdx,%rax), %eax
	movslq	%esi, %rsi
	movslq	%ecx, %rdx
	imulq	$301, %rdx, %rdx
	addq	%rsi, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	D(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L6:
	movl	i(%rip), %edx
	movl	M(%rip), %eax
	cmpl	%eax, %edx
	jl	.L7
	movl	$1, k(%rip)
	jmp	.L8
.L14:
	movl	$1, i(%rip)
	jmp	.L9
.L13:
	movl	$1, j(%rip)
	jmp	.L10
.L12:
	movl	i(%rip), %eax
	movl	j(%rip), %edx
	movslq	%edx, %rdx
	cltq
	imulq	$301, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	D(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	i(%rip), %edx
	movl	k(%rip), %ecx
	movslq	%ecx, %rcx
	movslq	%edx, %rdx
	imulq	$301, %rdx, %rdx
	addq	%rcx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	D(%rip), %rdx
	movl	(%rcx,%rdx), %esi
	movl	k(%rip), %edx
	movl	j(%rip), %ecx
	movslq	%ecx, %rcx
	movslq	%edx, %rdx
	imulq	$301, %rdx, %rdx
	addq	%rcx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	D(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	addl	%esi, %edx
	cmpl	%edx, %eax
	jle	.L11
	movl	i(%rip), %eax
	movl	k(%rip), %edx
	movslq	%edx, %rdx
	cltq
	imulq	$301, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	D(%rip), %rax
	movl	(%rdx,%rax), %esi
	movl	k(%rip), %eax
	movl	j(%rip), %edx
	movslq	%edx, %rdx
	cltq
	imulq	$301, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	D(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	i(%rip), %eax
	movl	j(%rip), %edx
	addl	%esi, %ecx
	movslq	%edx, %rdx
	cltq
	imulq	$301, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	D(%rip), %rax
	movl	%ecx, (%rdx,%rax)
.L11:
	movl	j(%rip), %eax
	addl	$1, %eax
	movl	%eax, j(%rip)
.L10:
	movl	j(%rip), %edx
	movl	N(%rip), %eax
	cmpl	%eax, %edx
	jle	.L12
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L9:
	movl	i(%rip), %edx
	movl	N(%rip), %eax
	cmpl	%eax, %edx
	jle	.L13
	movl	k(%rip), %eax
	addl	$1, %eax
	movl	%eax, k(%rip)
.L8:
	movl	k(%rip), %edx
	movl	N(%rip), %eax
	cmpl	%eax, %edx
	jle	.L14
	movl	$1, i(%rip)
	jmp	.L15
.L21:
	movl	$1, j(%rip)
	jmp	.L16
.L20:
	movl	i(%rip), %edx
	movl	j(%rip), %eax
	cmpl	%eax, %edx
	je	.L17
	movl	i(%rip), %eax
	movl	j(%rip), %edx
	movslq	%edx, %rdx
	cltq
	imulq	$301, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	D(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	L(%rip), %eax
	cmpl	%eax, %edx
	jle	.L18
	movl	$1000000000, %ecx
	jmp	.L19
.L18:
	movl	$1, %ecx
.L19:
	movl	i(%rip), %eax
	movl	j(%rip), %edx
	movslq	%edx, %rdx
	cltq
	imulq	$301, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	D(%rip), %rax
	movl	%ecx, (%rdx,%rax)
.L17:
	movl	j(%rip), %eax
	addl	$1, %eax
	movl	%eax, j(%rip)
.L16:
	movl	j(%rip), %edx
	movl	N(%rip), %eax
	cmpl	%eax, %edx
	jle	.L20
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L15:
	movl	i(%rip), %edx
	movl	N(%rip), %eax
	cmpl	%eax, %edx
	jle	.L21
	movl	$1, k(%rip)
	jmp	.L22
.L28:
	movl	$1, i(%rip)
	jmp	.L23
.L27:
	movl	$1, j(%rip)
	jmp	.L24
.L26:
	movl	i(%rip), %eax
	movl	j(%rip), %edx
	movslq	%edx, %rdx
	cltq
	imulq	$301, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	D(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	i(%rip), %edx
	movl	k(%rip), %ecx
	movslq	%ecx, %rcx
	movslq	%edx, %rdx
	imulq	$301, %rdx, %rdx
	addq	%rcx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	D(%rip), %rdx
	movl	(%rcx,%rdx), %esi
	movl	k(%rip), %edx
	movl	j(%rip), %ecx
	movslq	%ecx, %rcx
	movslq	%edx, %rdx
	imulq	$301, %rdx, %rdx
	addq	%rcx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	D(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	addl	%esi, %edx
	cmpl	%edx, %eax
	jle	.L25
	movl	i(%rip), %eax
	movl	k(%rip), %edx
	movslq	%edx, %rdx
	cltq
	imulq	$301, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	D(%rip), %rax
	movl	(%rdx,%rax), %esi
	movl	k(%rip), %eax
	movl	j(%rip), %edx
	movslq	%edx, %rdx
	cltq
	imulq	$301, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	D(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	i(%rip), %eax
	movl	j(%rip), %edx
	addl	%esi, %ecx
	movslq	%edx, %rdx
	cltq
	imulq	$301, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	D(%rip), %rax
	movl	%ecx, (%rdx,%rax)
.L25:
	movl	j(%rip), %eax
	addl	$1, %eax
	movl	%eax, j(%rip)
.L24:
	movl	j(%rip), %edx
	movl	N(%rip), %eax
	cmpl	%eax, %edx
	jle	.L26
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L23:
	movl	i(%rip), %edx
	movl	N(%rip), %eax
	cmpl	%eax, %edx
	jle	.L27
	movl	k(%rip), %eax
	addl	$1, %eax
	movl	%eax, k(%rip)
.L22:
	movl	k(%rip), %edx
	movl	N(%rip), %eax
	cmpl	%eax, %edx
	jle	.L28
	leaq	Q(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movl	$0, i(%rip)
	jmp	.L29
.L32:
	leaq	b(%rip), %rax
	movq	%rax, %rdx
	leaq	a(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movl	a(%rip), %eax
	movl	b(%rip), %edx
	movslq	%edx, %rdx
	cltq
	imulq	$301, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	D(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	$999999999, %eax
	jg	.L30
	movl	a(%rip), %eax
	movl	b(%rip), %edx
	movslq	%edx, %rdx
	cltq
	imulq	$301, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	D(%rip), %rax
	movl	(%rdx,%rax), %eax
	subl	$1, %eax
	jmp	.L31
.L30:
	movl	$-1, %eax
.L31:
	movl	%eax, %esi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L29:
	movl	i(%rip), %edx
	movl	Q(%rip), %eax
	cmpl	%eax, %edx
	jl	.L32
	movl	$0, %eax
	popq	%rbp
	.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	N
	.bss
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	4
	.globl	M
	.align 4
	.type	M, @object
	.size	M, 4
M:
	.zero	4
	.globl	L
	.align 4
	.type	L, @object
	.size	L, 4
L:
	.zero	4
	.globl	Q
	.align 4
	.type	Q, @object
	.size	Q, 4
Q:
	.zero	4
	.globl	D
	.align 32
	.type	D, @object
	.size	D, 362404
D:
	.zero	362404
	.globl	i
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.globl	j
	.align 4
	.type	j, @object
	.size	j, 4
j:
	.zero	4
	.globl	k
	.align 4
	.type	k, @object
	.size	k, 4
k:
	.zero	4
	.globl	a
	.align 4
	.type	a, @object
	.size	a, 4
a:
	.zero	4
	.globl	b
	.align 4
	.type	b, @object
	.size	b, 4
b:
	.zero	4
	.globl	c
	.align 4
	.type	c, @object
	.size	c, 4
c:
	.zero	4
	.section	.rodata
.LC0:
	.string	"%d%d%d"
.LC1:
	.string	"%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
	leaq	L(%rip), %rax
	movq	%rax, %rcx
	leaq	M(%rip), %rax
	movq	%rax, %rdx
	leaq	N(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movl	$1, i(%rip)
	jmp	.L2
.L5:
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, j(%rip)
	jmp	.L3
.L4:
	movl	j(%rip), %eax
	movl	i(%rip), %edx
	movslq	%edx, %rsi
	movslq	%eax, %rcx
	imulq	$301, %rcx, %rcx
	addq	%rsi, %rcx
	leaq	0(,%rcx,4), %rsi
	leaq	D(%rip), %rcx
	movl	$1000000001, (%rsi,%rcx)
	movl	i(%rip), %ecx
	movl	j(%rip), %esi
	movslq	%edx, %rdx
	cltq
	imulq	$301, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	D(%rip), %rax
	movl	(%rdx,%rax), %eax
	movslq	%esi, %rsi
	movslq	%ecx, %rdx
	imulq	$301, %rdx, %rdx
	addq	%rsi, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	D(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	j(%rip), %eax
	addl	$1, %eax
	movl	%eax, j(%rip)
.L3:
	movl	j(%rip), %edx
	movl	N(%rip), %eax
	cmpl	%eax, %edx
	jle	.L4
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L2:
	movl	i(%rip), %edx
	movl	N(%rip), %eax
	cmpl	%eax, %edx
	jle	.L5
	movl	$0, i(%rip)
	jmp	.L6
.L7:
	leaq	c(%rip), %rax
	movq	%rax, %rcx
	leaq	b(%rip), %rax
	movq	%rax, %rdx
	leaq	a(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movl	b(%rip), %eax
	movl	a(%rip), %edx
	movl	c(%rip), %ecx
	movslq	%edx, %rdi
	movslq	%eax, %rsi
	imulq	$301, %rsi, %rsi
	addq	%rdi, %rsi
	leaq	0(,%rsi,4), %rdi
	leaq	D(%rip), %rsi
	movl	%ecx, (%rdi,%rsi)
	movl	a(%rip), %ecx
	movl	b(%rip), %esi
	movslq	%edx, %rdx
	cltq
	imulq	$301, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	D(%rip), %rax
	movl	(%rdx,%rax), %eax
	movslq	%esi, %rsi
	movslq	%ecx, %rdx
	imulq	$301, %rdx, %rdx
	addq	%rsi, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	D(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L6:
	movl	i(%rip), %edx
	movl	M(%rip), %eax
	cmpl	%eax, %edx
	jl	.L7
	movl	$1, k(%rip)
	jmp	.L8
.L14:
	movl	$1, i(%rip)
	jmp	.L9
.L13:
	movl	$1, j(%rip)
	jmp	.L10
.L12:
	movl	i(%rip), %eax
	movl	j(%rip), %edx
	movslq	%edx, %rdx
	cltq
	imulq	$301, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	D(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	i(%rip), %edx
	movl	k(%rip), %ecx
	movslq	%ecx, %rcx
	movslq	%edx, %rdx
	imulq	$301, %rdx, %rdx
	addq	%rcx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	D(%rip), %rdx
	movl	(%rcx,%rdx), %esi
	movl	k(%rip), %edx
	movl	j(%rip), %ecx
	movslq	%ecx, %rcx
	movslq	%edx, %rdx
	imulq	$301, %rdx, %rdx
	addq	%rcx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	D(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	addl	%esi, %edx
	cmpl	%edx, %eax
	jle	.L11
	movl	i(%rip), %eax
	movl	k(%rip), %edx
	movslq	%edx, %rdx
	cltq
	imulq	$301, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	D(%rip), %rax
	movl	(%rdx,%rax), %esi
	movl	k(%rip), %eax
	movl	j(%rip), %edx
	movslq	%edx, %rdx
	cltq
	imulq	$301, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	D(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	i(%rip), %eax
	movl	j(%rip), %edx
	addl	%esi, %ecx
	movslq	%edx, %rdx
	cltq
	imulq	$301, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	D(%rip), %rax
	movl	%ecx, (%rdx,%rax)
.L11:
	movl	j(%rip), %eax
	addl	$1, %eax
	movl	%eax, j(%rip)
.L10:
	movl	j(%rip), %edx
	movl	N(%rip), %eax
	cmpl	%eax, %edx
	jle	.L12
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L9:
	movl	i(%rip), %edx
	movl	N(%rip), %eax
	cmpl	%eax, %edx
	jle	.L13
	movl	k(%rip), %eax
	addl	$1, %eax
	movl	%eax, k(%rip)
.L8:
	movl	k(%rip), %edx
	movl	N(%rip), %eax
	cmpl	%eax, %edx
	jle	.L14
	movl	$1, i(%rip)
	jmp	.L15
.L21:
	movl	$1, j(%rip)
	jmp	.L16
.L20:
	movl	i(%rip), %edx
	movl	j(%rip), %eax
	cmpl	%eax, %edx
	je	.L17
	movl	i(%rip), %eax
	movl	j(%rip), %edx
	movslq	%edx, %rdx
	cltq
	imulq	$301, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	D(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	L(%rip), %eax
	cmpl	%eax, %edx
	jle	.L18
	movl	$1000000000, %ecx
	jmp	.L19
.L18:
	movl	$1, %ecx
.L19:
	movl	i(%rip), %eax
	movl	j(%rip), %edx
	movslq	%edx, %rdx
	cltq
	imulq	$301, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	D(%rip), %rax
	movl	%ecx, (%rdx,%rax)
.L17:
	movl	j(%rip), %eax
	addl	$1, %eax
	movl	%eax, j(%rip)
.L16:
	movl	j(%rip), %edx
	movl	N(%rip), %eax
	cmpl	%eax, %edx
	jle	.L20
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L15:
	movl	i(%rip), %edx
	movl	N(%rip), %eax
	cmpl	%eax, %edx
	jle	.L21
	movl	$1, k(%rip)
	jmp	.L22
.L28:
	movl	$1, i(%rip)
	jmp	.L23
.L27:
	movl	$1, j(%rip)
	jmp	.L24
.L26:
	movl	i(%rip), %eax
	movl	j(%rip), %edx
	movslq	%edx, %rdx
	cltq
	imulq	$301, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	D(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	i(%rip), %edx
	movl	k(%rip), %ecx
	movslq	%ecx, %rcx
	movslq	%edx, %rdx
	imulq	$301, %rdx, %rdx
	addq	%rcx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	D(%rip), %rdx
	movl	(%rcx,%rdx), %esi
	movl	k(%rip), %edx
	movl	j(%rip), %ecx
	movslq	%ecx, %rcx
	movslq	%edx, %rdx
	imulq	$301, %rdx, %rdx
	addq	%rcx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	D(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	addl	%esi, %edx
	cmpl	%edx, %eax
	jle	.L25
	movl	i(%rip), %eax
	movl	k(%rip), %edx
	movslq	%edx, %rdx
	cltq
	imulq	$301, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	D(%rip), %rax
	movl	(%rdx,%rax), %esi
	movl	k(%rip), %eax
	movl	j(%rip), %edx
	movslq	%edx, %rdx
	cltq
	imulq	$301, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	D(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	i(%rip), %eax
	movl	j(%rip), %edx
	addl	%esi, %ecx
	movslq	%edx, %rdx
	cltq
	imulq	$301, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	D(%rip), %rax
	movl	%ecx, (%rdx,%rax)
.L25:
	movl	j(%rip), %eax
	addl	$1, %eax
	movl	%eax, j(%rip)
.L24:
	movl	j(%rip), %edx
	movl	N(%rip), %eax
	cmpl	%eax, %edx
	jle	.L26
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L23:
	movl	i(%rip), %edx
	movl	N(%rip), %eax
	cmpl	%eax, %edx
	jle	.L27
	movl	k(%rip), %eax
	addl	$1, %eax
	movl	%eax, k(%rip)
.L22:
	movl	k(%rip), %edx
	movl	N(%rip), %eax
	cmpl	%eax, %edx
	jle	.L28
	leaq	Q(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movl	$0, i(%rip)
	jmp	.L29
.L32:
	leaq	b(%rip), %rax
	movq	%rax, %rdx
	leaq	a(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movl	a(%rip), %eax
	movl	b(%rip), %edx
	movslq	%edx, %rdx
	cltq
	imulq	$301, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	D(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	$999999999, %eax
	jg	.L30
	movl	a(%rip), %eax
	movl	b(%rip), %edx
	movslq	%edx, %rdx
	cltq
	imulq	$301, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	D(%rip), %rax
	movl	(%rdx,%rax), %eax
	subl	$1, %eax
	jmp	.L31
.L30:
	movl	$-1, %eax
.L31:
	movl	%eax, %esi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L29:
	movl	i(%rip), %edx
	movl	Q(%rip), %eax
	cmpl	%eax, %edx
	jl	.L32
	movl	$0, %eax
	popq	%rbp
	.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:
