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>

long long N,M;
long long a[2000],b[2000],c[2000];
long long d[1001];
long long neg[1001];

long long main(){
	
	scanf("%lld%lld",&N,&M);
	for(long long i=0;i<M;i++){
		scanf("%lld%lld%lld",&a[i],&b[i],&c[i]);
		c[i]*=-1;
	}
	
	for(long long i=2;i<=1000;i++)d[i]=99999999999999999;

	for(int j=0;j<N*2;j++){
		for(long long i=0;i<M;i++){
		
			if(neg[a[i]]==1)neg[b[i]]=1;
			if(d[a[i]]!=99999999999999999 && d[b[i]]>d[a[i]]+c[i]){
				d[b[i]]=d[a[i]]+c[i];
				if(j>=N)neg[b[i]]=1;
			}
		}
	}
	if(neg[N])printf("inf\n");
	else printf("%lld",-d[N]);
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	N
	.bss
	.align 8
	.type	N, @object
	.size	N, 8
N:
	.zero	8
	.globl	M
	.align 8
	.type	M, @object
	.size	M, 8
M:
	.zero	8
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 16000
a:
	.zero	16000
	.globl	b
	.align 32
	.type	b, @object
	.size	b, 16000
b:
	.zero	16000
	.globl	c
	.align 32
	.type	c, @object
	.size	c, 16000
c:
	.zero	16000
	.globl	d
	.align 32
	.type	d, @object
	.size	d, 8008
d:
	.zero	8008
	.globl	neg
	.align 32
	.type	neg, @object
	.size	neg, 8008
neg:
	.zero	8008
	.section	.rodata
.LC0:
	.string	"%lld%lld"
.LC1:
	.string	"%lld%lld%lld"
.LC2:
	.string	"inf"
.LC3:
	.string	"%lld"
	.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	$32, %rsp
	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	__isoc99_scanf@PLT
	movq	$0, -24(%rbp)
	jmp	.L2
.L3:
	movq	-24(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	c(%rip), %rax
	leaq	(%rdx,%rax), %rcx
	movq	-24(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	b(%rip), %rax
	addq	%rax, %rdx
	movq	-24(%rbp), %rax
	leaq	0(,%rax,8), %rsi
	leaq	a(%rip), %rax
	addq	%rsi, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	-24(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	c(%rip), %rax
	movq	(%rdx,%rax), %rax
	negq	%rax
	movq	%rax, %rcx
	movq	-24(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	c(%rip), %rax
	movq	%rcx, (%rdx,%rax)
	addq	$1, -24(%rbp)
.L2:
	movq	M(%rip), %rax
	cmpq	%rax, -24(%rbp)
	jl	.L3
	movq	$2, -16(%rbp)
	jmp	.L4
.L5:
	movq	-16(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	d(%rip), %rax
	movabsq	$99999999999999999, %rdi
	movq	%rdi, (%rdx,%rax)
	addq	$1, -16(%rbp)
.L4:
	cmpq	$1000, -16(%rbp)
	jle	.L5
	movl	$0, -28(%rbp)
	jmp	.L6
.L11:
	movq	$0, -8(%rbp)
	jmp	.L7
.L10:
	movq	-8(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rax
	leaq	0(,%rax,8), %rdx
	leaq	neg(%rip), %rax
	movq	(%rdx,%rax), %rax
	cmpq	$1, %rax
	jne	.L8
	movq	-8(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	b(%rip), %rax
	movq	(%rdx,%rax), %rax
	leaq	0(,%rax,8), %rdx
	leaq	neg(%rip), %rax
	movq	$1, (%rdx,%rax)
.L8:
	movq	-8(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rax
	leaq	0(,%rax,8), %rdx
	leaq	d(%rip), %rax
	movq	(%rdx,%rax), %rax
	movabsq	$99999999999999999, %rdx
	cmpq	%rdx, %rax
	je	.L9
	movq	-8(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	b(%rip), %rax
	movq	(%rdx,%rax), %rax
	leaq	0(,%rax,8), %rdx
	leaq	d(%rip), %rax
	movq	(%rdx,%rax), %rax
	movq	-8(%rbp), %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	a(%rip), %rdx
	movq	(%rcx,%rdx), %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	d(%rip), %rdx
	movq	(%rcx,%rdx), %rsi
	movq	-8(%rbp), %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	c(%rip), %rdx
	movq	(%rcx,%rdx), %rdx
	addq	%rsi, %rdx
	cmpq	%rdx, %rax
	jle	.L9
	movq	-8(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rax
	leaq	0(,%rax,8), %rdx
	leaq	d(%rip), %rax
	movq	(%rdx,%rax), %rsi
	movq	-8(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	c(%rip), %rax
	movq	(%rdx,%rax), %rcx
	movq	-8(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	b(%rip), %rax
	movq	(%rdx,%rax), %rax
	addq	%rsi, %rcx
	leaq	0(,%rax,8), %rdx
	leaq	d(%rip), %rax
	movq	%rcx, (%rdx,%rax)
	movl	-28(%rbp), %eax
	movslq	%eax, %rdx
	movq	N(%rip), %rax
	cmpq	%rax, %rdx
	jl	.L9
	movq	-8(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	b(%rip), %rax
	movq	(%rdx,%rax), %rax
	leaq	0(,%rax,8), %rdx
	leaq	neg(%rip), %rax
	movq	$1, (%rdx,%rax)
.L9:
	addq	$1, -8(%rbp)
.L7:
	movq	M(%rip), %rax
	cmpq	%rax, -8(%rbp)
	jl	.L10
	addl	$1, -28(%rbp)
.L6:
	movl	-28(%rbp), %eax
	cltq
	movq	N(%rip), %rdx
	addq	%rdx, %rdx
	cmpq	%rdx, %rax
	jl	.L11
	movq	N(%rip), %rax
	leaq	0(,%rax,8), %rdx
	leaq	neg(%rip), %rax
	movq	(%rdx,%rax), %rax
	testq	%rax, %rax
	je	.L12
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L13
.L12:
	movq	N(%rip), %rax
	leaq	0(,%rax,8), %rdx
	leaq	d(%rip), %rax
	movq	(%rdx,%rax), %rax
	negq	%rax
	movq	%rax, %rsi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L13:
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```

Only output the optimized assembly code. Do not include any other text. Do not write any comments in the assembly code. Wrap the assembly code in ```assembly``` tags.
user
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%lld%lld"
.LC1:
	.string	"%lld%lld%lld"
.LC3:
	.string	"inf"
.LC4:
	.string	"%lld"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	leaq	M(%rip), %rdx
	leaq	N(%rip), %rsi
	xorl	%eax, %eax
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	leaq	.LC0(%rip), %rdi
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	call	__isoc99_scanf@PLT
	movq	M(%rip), %r9
	testq	%r9, %r9
	jle	.L2
	leaq	c(%rip), %rbp
	xorl	%r14d, %r14d
	leaq	b(%rip), %r13
	leaq	a(%rip), %rbx
	leaq	.LC1(%rip), %r12
	.p2align 4,,10
	.p2align 3
.L3:
	leaq	0(,%r14,8), %rsi
	movq	%rbp, %rcx
	movq	%r12, %rdi
	xorl	%eax, %eax
	leaq	0(%r13,%rsi), %rdx
	addq	%rbx, %rsi
	addq	$1, %r14
	call	__isoc99_scanf@PLT
	movq	M(%rip), %r9
	negq	0(%rbp)
	addq	$8, %rbp
	cmpq	%r14, %r9
	jg	.L3
.L2:
	leaq	16+d(%rip), %rax
	movdqa	.LC2(%rip), %xmm0
	leaq	7984(%rax), %rdx
	.p2align 4,,10
	.p2align 3
.L4:
	movaps	%xmm0, (%rax)
	addq	$16, %rax
	cmpq	%rax, %rdx
	jne	.L4
	movq	N(%rip), %rcx
	leaq	neg(%rip), %rsi
	movabsq	$99999999999999999, %rax
	movq	%rax, 8000+d(%rip)
	leaq	(%rcx,%rcx), %rdx
	testq	%rdx, %rdx
	jle	.L5
	testq	%rcx, %rcx
	jg	.L6
	xorl	%edi, %edi
.L7:
	movslq	%edi, %r11
	leaq	a(%rip), %r12
	leaq	d(%rip), %r8
	movabsq	$99999999999999999, %rbx
	leaq	b(%rip), %rbp
	leaq	c(%rip), %r13
	.p2align 4,,10
	.p2align 3
.L17:
	testq	%r9, %r9
	jle	.L13
	xorl	%eax, %eax
	.p2align 4,,10
	.p2align 3
.L16:
	movq	(%r12,%rax,8), %rdi
	cmpq	$1, (%rsi,%rdi,8)
	jne	.L14
	movq	0(%rbp,%rax,8), %r10
	movq	$1, (%rsi,%r10,8)
.L14:
	movq	(%r8,%rdi,8), %rdi
	cmpq	%rbx, %rdi
	je	.L15
	movq	0(%rbp,%rax,8), %r10
	addq	0(%r13,%rax,8), %rdi
	cmpq	%rdi, (%r8,%r10,8)
	jle	.L15
	movq	%rdi, (%r8,%r10,8)
	movq	$1, (%rsi,%r10,8)
.L15:
	addq	$1, %rax
	cmpq	%rax, %r9
	jne	.L16
.L13:
	addq	$1, %r11
	cmpq	%r11, %rdx
	jg	.L17
	.p2align 4,,10
	.p2align 3
.L5:
	cmpq	$0, (%rsi,%rcx,8)
	je	.L20
	leaq	.LC3(%rip), %rdi
	call	puts@PLT
.L21:
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
.L6:
	.cfi_restore_state
	cmpq	%rcx, %rdx
	movq	%rcx, %r13
	movl	$1, %ebp
	cmovle	%rdx, %r13
	leaq	a(%rip), %rbx
	leaq	d(%rip), %r10
	leaq	b(%rip), %r11
	leaq	c(%rip), %r12
	.p2align 4,,10
	.p2align 3
.L12:
	xorl	%edi, %edi
	testq	%r9, %r9
	jle	.L19
	.p2align 4,,10
	.p2align 3
.L10:
	movq	(%rbx,%rdi,8), %r8
	cmpq	$1, (%rsi,%r8,8)
	jne	.L8
	movq	(%r11,%rdi,8), %r14
	movq	$1, (%rsi,%r14,8)
.L8:
	movq	(%r10,%r8,8), %r8
	cmpq	%rax, %r8
	je	.L9
	movq	(%r11,%rdi,8), %r14
	addq	(%r12,%rdi,8), %r8
	cmpq	(%r10,%r14,8), %r8
	jge	.L9
	movq	%r8, (%r10,%r14,8)
.L9:
	addq	$1, %rdi
	cmpq	%r9, %rdi
	jne	.L10
.L19:
	movq	%rbp, %r8
	movl	%ebp, %edi
	addq	$1, %rbp
	cmpq	%r13, %r8
	jl	.L12
	cmpq	%rdx, %r8
	jl	.L7
	jmp	.L5
.L20:
	leaq	d(%rip), %rax
	leaq	.LC4(%rip), %rsi
	movl	$1, %edi
	movq	(%rax,%rcx,8), %rdx
	xorl	%eax, %eax
	negq	%rdx
	call	__printf_chk@PLT
	jmp	.L21
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.globl	neg
	.bss
	.align 32
	.type	neg, @object
	.size	neg, 8008
neg:
	.zero	8008
	.globl	d
	.align 32
	.type	d, @object
	.size	d, 8008
d:
	.zero	8008
	.globl	c
	.align 32
	.type	c, @object
	.size	c, 16000
c:
	.zero	16000
	.globl	b
	.align 32
	.type	b, @object
	.size	b, 16000
b:
	.zero	16000
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 16000
a:
	.zero	16000
	.globl	M
	.align 8
	.type	M, @object
	.size	M, 8
M:
	.zero	8
	.globl	N
	.align 8
	.type	N, @object
	.size	N, 8
N:
	.zero	8
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC2:
	.quad	99999999999999999
	.quad	99999999999999999
	.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	"%lld%lld"
.LC1:
	.string	"%lld%lld%lld"
.LC3:
	.string	"inf"
.LC4:
	.string	"%lld"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	leaq	M(%rip), %rdx
	leaq	N(%rip), %rsi
	xorl	%eax, %eax
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	leaq	.LC0(%rip), %rdi
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	call	__isoc99_scanf@PLT
	movq	M(%rip), %r9
	testq	%r9, %r9
	jle	.L2
	leaq	c(%rip), %rbp
	xorl	%r14d, %r14d
	leaq	b(%rip), %r13
	leaq	a(%rip), %rbx
	leaq	.LC1(%rip), %r12
	.p2align 4,,10
	.p2align 3
.L3:
	leaq	0(,%r14,8), %rsi
	movq	%rbp, %rcx
	movq	%r12, %rdi
	xorl	%eax, %eax
	leaq	0(%r13,%rsi), %rdx
	addq	%rbx, %rsi
	addq	$1, %r14
	call	__isoc99_scanf@PLT
	movq	M(%rip), %r9
	negq	0(%rbp)
	addq	$8, %rbp
	cmpq	%r14, %r9
	jg	.L3
.L2:
	leaq	16+d(%rip), %rax
	movdqa	.LC2(%rip), %xmm0
	leaq	7984(%rax), %rdx
	.p2align 4,,10
	.p2align 3
.L4:
	movaps	%xmm0, (%rax)
	addq	$16, %rax
	cmpq	%rax, %rdx
	jne	.L4
	movq	N(%rip), %rcx
	leaq	neg(%rip), %rsi
	movabsq	$99999999999999999, %rax
	movq	%rax, 8000+d(%rip)
	leaq	(%rcx,%rcx), %rdx
	testq	%rdx, %rdx
	jle	.L5
	testq	%rcx, %rcx
	jg	.L6
	xorl	%edi, %edi
.L7:
	movslq	%edi, %r11
	leaq	a(%rip), %r12
	leaq	d(%rip), %r8
	movabsq	$99999999999999999, %rbx
	leaq	b(%rip), %rbp
	leaq	c(%rip), %r13
	.p2align 4,,10
	.p2align 3
.L17:
	testq	%r9, %r9
	jle	.L13
	xorl	%eax, %eax
	.p2align 4,,10
	.p2align 3
.L16:
	movq	(%r12,%rax,8), %rdi
	cmpq	$1, (%rsi,%rdi,8)
	jne	.L14
	movq	0(%rbp,%rax,8), %r10
	movq	$1, (%rsi,%r10,8)
.L14:
	movq	(%r8,%rdi,8), %rdi
	cmpq	%rbx, %rdi
	je	.L15
	movq	0(%rbp,%rax,8), %r10
	addq	0(%r13,%rax,8), %rdi
	cmpq	%rdi, (%r8,%r10,8)
	jle	.L15
	movq	%rdi, (%r8,%r10,8)
	movq	$1, (%rsi,%r10,8)
.L15:
	addq	$1, %rax
	cmpq	%rax, %r9
	jne	.L16
.L13:
	addq	$1, %r11
	cmpq	%r11, %rdx
	jg	.L17
	.p2align 4,,10
	.p2align 3
.L5:
	cmpq	$0, (%rsi,%rcx,8)
	je	.L20
	leaq	.LC3(%rip), %rdi
	call	puts@PLT
.L21:
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
.L6:
	.cfi_restore_state
	cmpq	%rcx, %rdx
	movq	%rcx, %r13
	movl	$1, %ebp
	cmovle	%rdx, %r13
	leaq	a(%rip), %rbx
	leaq	d(%rip), %r10
	leaq	b(%rip), %r11
	leaq	c(%rip), %r12
	.p2align 4,,10
	.p2align 3
.L12:
	xorl	%edi, %edi
	testq	%r9, %r9
	jle	.L19
	.p2align 4,,10
	.p2align 3
.L10:
	movq	(%rbx,%rdi,8), %r8
	cmpq	$1, (%rsi,%r8,8)
	jne	.L8
	movq	(%r11,%rdi,8), %r14
	movq	$1, (%rsi,%r14,8)
.L8:
	movq	(%r10,%r8,8), %r8
	cmpq	%rax, %r8
	je	.L9
	movq	(%r11,%rdi,8), %r14
	addq	(%r12,%rdi,8), %r8
	cmpq	(%r10,%r14,8), %r8
	jge	.L9
	movq	%r8, (%r10,%r14,8)
.L9:
	addq	$1, %rdi
	cmpq	%r9, %rdi
	jne	.L10
.L19:
	movq	%rbp, %r8
	movl	%ebp, %edi
	addq	$1, %rbp
	cmpq	%r13, %r8
	jl	.L12
	cmpq	%rdx, %r8
	jl	.L7
	jmp	.L5
.L20:
	leaq	d(%rip), %rax
	leaq	.LC4(%rip), %rsi
	movl	$1, %edi
	movq	(%rax,%rcx,8), %rdx
	xorl	%eax, %eax
	negq	%rdx
	call	__printf_chk@PLT
	jmp	.L21
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.globl	neg
	.bss
	.align 32
	.type	neg, @object
	.size	neg, 8008
neg:
	.zero	8008
	.globl	d
	.align 32
	.type	d, @object
	.size	d, 8008
d:
	.zero	8008
	.globl	c
	.align 32
	.type	c, @object
	.size	c, 16000
c:
	.zero	16000
	.globl	b
	.align 32
	.type	b, @object
	.size	b, 16000
b:
	.zero	16000
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 16000
a:
	.zero	16000
	.globl	M
	.align 8
	.type	M, @object
	.size	M, 8
M:
	.zero	8
	.globl	N
	.align 8
	.type	N, @object
	.size	N, 8
N:
	.zero	8
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC2:
	.quad	99999999999999999
	.quad	99999999999999999
	.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>

long long N,M;
long long a[2000],b[2000],c[2000];
long long d[1001];
long long neg[1001];

long long main(){
	
	scanf("%lld%lld",&N,&M);
	for(long long i=0;i<M;i++){
		scanf("%lld%lld%lld",&a[i],&b[i],&c[i]);
		c[i]*=-1;
	}
	
	for(long long i=2;i<=1000;i++)d[i]=99999999999999999;

	for(int j=0;j<N*2;j++){
		for(long long i=0;i<M;i++){
		
			if(neg[a[i]]==1)neg[b[i]]=1;
			if(d[a[i]]!=99999999999999999 && d[b[i]]>d[a[i]]+c[i]){
				d[b[i]]=d[a[i]]+c[i];
				if(j>=N)neg[b[i]]=1;
			}
		}
	}
	if(neg[N])printf("inf\n");
	else printf("%lld",-d[N]);
	return 0;
}
3 3
1 2 4
2 2 3
1 3 5
 6 5
1 2 -1000000000
2 3 -1000000000
3 5 -1000000000
4 5 -1000000000
5 6 -1000000000
 6 5
1 2 -1000000000
2 3 -798288204
3 5 -1000000000
4 5 -1000000000
5 6 -1000000000
 2 2
1 2 2
2 1 1
 6 5
1 2 -1000000000
2 3 -798288204
3 5 -672240474
4 5 -1000000000
5 6 -1000000000
 6 5
1 2 -1000000000
2 3 -798288204
3 5 -672240474
4 5 -378110944
1 6 -1000000000
 6 5
1 2 -1000000000
3 6 -798288204
3 1 -544098556
4 5 -372194891
1 6 -1131281113
 6 5
1 2 -1000000000
3 6 -798288204
3 1 -544098556
4 5 -372194891
1 6 -7948408
 6 5
1 2 -1000000000
2 3 -798288204
3 5 -908858863
4 5 -378110944
5 6 -1000000000
 6 5
1 2 -1000000000
3 6 -798288204
3 1 -544098556
4 5 -372194891
1 6 -678095

5 -4000000000 -3798288204 inf
 -3470528678 -1000000000 -1131281113 -7948408 -3707147067 -678095
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>

long long N,M;
long long a[2000],b[2000],c[2000];
long long d[1001];
long long neg[1001];

long long main(){
	
	scanf("%lld%lld",&N,&M);
	for(long long i=0;i<M;i++){
		scanf("%lld%lld%lld",&a[i],&b[i],&c[i]);
		c[i]*=-1;
	}
	
	for(long long i=2;i<=1000;i++)d[i]=99999999999999999;

	for(int j=0;j<N*2;j++){
		for(long long i=0;i<M;i++){
		
			if(neg[a[i]]==1)neg[b[i]]=1;
			if(d[a[i]]!=99999999999999999 && d[b[i]]>d[a[i]]+c[i]){
				d[b[i]]=d[a[i]]+c[i];
				if(j>=N)neg[b[i]]=1;
			}
		}
	}
	if(neg[N])printf("inf\n");
	else printf("%lld",-d[N]);
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	N
	.bss
	.align 8
	.type	N, @object
	.size	N, 8
N:
	.zero	8
	.globl	M
	.align 8
	.type	M, @object
	.size	M, 8
M:
	.zero	8
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 16000
a:
	.zero	16000
	.globl	b
	.align 32
	.type	b, @object
	.size	b, 16000
b:
	.zero	16000
	.globl	c
	.align 32
	.type	c, @object
	.size	c, 16000
c:
	.zero	16000
	.globl	d
	.align 32
	.type	d, @object
	.size	d, 8008
d:
	.zero	8008
	.globl	neg
	.align 32
	.type	neg, @object
	.size	neg, 8008
neg:
	.zero	8008
	.section	.rodata
.LC0:
	.string	"%lld%lld"
.LC1:
	.string	"%lld%lld%lld"
.LC2:
	.string	"inf"
.LC3:
	.string	"%lld"
	.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	$32, %rsp
	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	__isoc99_scanf@PLT
	movq	$0, -24(%rbp)
	jmp	.L2
.L3:
	movq	-24(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	c(%rip), %rax
	leaq	(%rdx,%rax), %rcx
	movq	-24(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	b(%rip), %rax
	addq	%rax, %rdx
	movq	-24(%rbp), %rax
	leaq	0(,%rax,8), %rsi
	leaq	a(%rip), %rax
	addq	%rsi, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	-24(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	c(%rip), %rax
	movq	(%rdx,%rax), %rax
	negq	%rax
	movq	%rax, %rcx
	movq	-24(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	c(%rip), %rax
	movq	%rcx, (%rdx,%rax)
	addq	$1, -24(%rbp)
.L2:
	movq	M(%rip), %rax
	cmpq	%rax, -24(%rbp)
	jl	.L3
	movq	$2, -16(%rbp)
	jmp	.L4
.L5:
	movq	-16(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	d(%rip), %rax
	movabsq	$99999999999999999, %rdi
	movq	%rdi, (%rdx,%rax)
	addq	$1, -16(%rbp)
.L4:
	cmpq	$1000, -16(%rbp)
	jle	.L5
	movl	$0, -28(%rbp)
	jmp	.L6
.L11:
	movq	$0, -8(%rbp)
	jmp	.L7
.L10:
	movq	-8(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rax
	leaq	0(,%rax,8), %rdx
	leaq	neg(%rip), %rax
	movq	(%rdx,%rax), %rax
	cmpq	$1, %rax
	jne	.L8
	movq	-8(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	b(%rip), %rax
	movq	(%rdx,%rax), %rax
	leaq	0(,%rax,8), %rdx
	leaq	neg(%rip), %rax
	movq	$1, (%rdx,%rax)
.L8:
	movq	-8(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rax
	leaq	0(,%rax,8), %rdx
	leaq	d(%rip), %rax
	movq	(%rdx,%rax), %rax
	movabsq	$99999999999999999, %rdx
	cmpq	%rdx, %rax
	je	.L9
	movq	-8(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	b(%rip), %rax
	movq	(%rdx,%rax), %rax
	leaq	0(,%rax,8), %rdx
	leaq	d(%rip), %rax
	movq	(%rdx,%rax), %rax
	movq	-8(%rbp), %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	a(%rip), %rdx
	movq	(%rcx,%rdx), %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	d(%rip), %rdx
	movq	(%rcx,%rdx), %rsi
	movq	-8(%rbp), %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	c(%rip), %rdx
	movq	(%rcx,%rdx), %rdx
	addq	%rsi, %rdx
	cmpq	%rdx, %rax
	jle	.L9
	movq	-8(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rax
	leaq	0(,%rax,8), %rdx
	leaq	d(%rip), %rax
	movq	(%rdx,%rax), %rsi
	movq	-8(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	c(%rip), %rax
	movq	(%rdx,%rax), %rcx
	movq	-8(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	b(%rip), %rax
	movq	(%rdx,%rax), %rax
	addq	%rsi, %rcx
	leaq	0(,%rax,8), %rdx
	leaq	d(%rip), %rax
	movq	%rcx, (%rdx,%rax)
	movl	-28(%rbp), %eax
	movslq	%eax, %rdx
	movq	N(%rip), %rax
	cmpq	%rax, %rdx
	jl	.L9
	movq	-8(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	b(%rip), %rax
	movq	(%rdx,%rax), %rax
	leaq	0(,%rax,8), %rdx
	leaq	neg(%rip), %rax
	movq	$1, (%rdx,%rax)
.L9:
	addq	$1, -8(%rbp)
.L7:
	movq	M(%rip), %rax
	cmpq	%rax, -8(%rbp)
	jl	.L10
	addl	$1, -28(%rbp)
.L6:
	movl	-28(%rbp), %eax
	cltq
	movq	N(%rip), %rdx
	addq	%rdx, %rdx
	cmpq	%rdx, %rax
	jl	.L11
	movq	N(%rip), %rax
	leaq	0(,%rax,8), %rdx
	leaq	neg(%rip), %rax
	movq	(%rdx,%rax), %rax
	testq	%rax, %rax
	je	.L12
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L13
.L12:
	movq	N(%rip), %rax
	leaq	0(,%rax,8), %rdx
	leaq	d(%rip), %rax
	movq	(%rdx,%rax), %rax
	negq	%rax
	movq	%rax, %rsi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L13:
	movl	$0, %eax
	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	N
	.bss
	.align 8
	.type	N, @object
	.size	N, 8
N:
	.zero	8
	.globl	M
	.align 8
	.type	M, @object
	.size	M, 8
M:
	.zero	8
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 16000
a:
	.zero	16000
	.globl	b
	.align 32
	.type	b, @object
	.size	b, 16000
b:
	.zero	16000
	.globl	c
	.align 32
	.type	c, @object
	.size	c, 16000
c:
	.zero	16000
	.globl	d
	.align 32
	.type	d, @object
	.size	d, 8008
d:
	.zero	8008
	.globl	neg
	.align 32
	.type	neg, @object
	.size	neg, 8008
neg:
	.zero	8008
	.section	.rodata
.LC0:
	.string	"%lld%lld"
.LC1:
	.string	"%lld%lld%lld"
.LC2:
	.string	"inf"
.LC3:
	.string	"%lld"
	.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	$32, %rsp
	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	__isoc99_scanf@PLT
	movq	$0, -24(%rbp)
	jmp	.L2
.L3:
	movq	-24(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	c(%rip), %rax
	leaq	(%rdx,%rax), %rcx
	movq	-24(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	b(%rip), %rax
	addq	%rax, %rdx
	movq	-24(%rbp), %rax
	leaq	0(,%rax,8), %rsi
	leaq	a(%rip), %rax
	addq	%rsi, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	-24(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	c(%rip), %rax
	movq	(%rdx,%rax), %rax
	negq	%rax
	movq	%rax, %rcx
	movq	-24(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	c(%rip), %rax
	movq	%rcx, (%rdx,%rax)
	addq	$1, -24(%rbp)
.L2:
	movq	M(%rip), %rax
	cmpq	%rax, -24(%rbp)
	jl	.L3
	movq	$2, -16(%rbp)
	jmp	.L4
.L5:
	movq	-16(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	d(%rip), %rax
	movabsq	$99999999999999999, %rdi
	movq	%rdi, (%rdx,%rax)
	addq	$1, -16(%rbp)
.L4:
	cmpq	$1000, -16(%rbp)
	jle	.L5
	movl	$0, -28(%rbp)
	jmp	.L6
.L11:
	movq	$0, -8(%rbp)
	jmp	.L7
.L10:
	movq	-8(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rax
	leaq	0(,%rax,8), %rdx
	leaq	neg(%rip), %rax
	movq	(%rdx,%rax), %rax
	cmpq	$1, %rax
	jne	.L8
	movq	-8(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	b(%rip), %rax
	movq	(%rdx,%rax), %rax
	leaq	0(,%rax,8), %rdx
	leaq	neg(%rip), %rax
	movq	$1, (%rdx,%rax)
.L8:
	movq	-8(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rax
	leaq	0(,%rax,8), %rdx
	leaq	d(%rip), %rax
	movq	(%rdx,%rax), %rax
	movabsq	$99999999999999999, %rdx
	cmpq	%rdx, %rax
	je	.L9
	movq	-8(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	b(%rip), %rax
	movq	(%rdx,%rax), %rax
	leaq	0(,%rax,8), %rdx
	leaq	d(%rip), %rax
	movq	(%rdx,%rax), %rax
	movq	-8(%rbp), %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	a(%rip), %rdx
	movq	(%rcx,%rdx), %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	d(%rip), %rdx
	movq	(%rcx,%rdx), %rsi
	movq	-8(%rbp), %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	c(%rip), %rdx
	movq	(%rcx,%rdx), %rdx
	addq	%rsi, %rdx
	cmpq	%rdx, %rax
	jle	.L9
	movq	-8(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rax
	leaq	0(,%rax,8), %rdx
	leaq	d(%rip), %rax
	movq	(%rdx,%rax), %rsi
	movq	-8(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	c(%rip), %rax
	movq	(%rdx,%rax), %rcx
	movq	-8(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	b(%rip), %rax
	movq	(%rdx,%rax), %rax
	addq	%rsi, %rcx
	leaq	0(,%rax,8), %rdx
	leaq	d(%rip), %rax
	movq	%rcx, (%rdx,%rax)
	movl	-28(%rbp), %eax
	movslq	%eax, %rdx
	movq	N(%rip), %rax
	cmpq	%rax, %rdx
	jl	.L9
	movq	-8(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	b(%rip), %rax
	movq	(%rdx,%rax), %rax
	leaq	0(,%rax,8), %rdx
	leaq	neg(%rip), %rax
	movq	$1, (%rdx,%rax)
.L9:
	addq	$1, -8(%rbp)
.L7:
	movq	M(%rip), %rax
	cmpq	%rax, -8(%rbp)
	jl	.L10
	addl	$1, -28(%rbp)
.L6:
	movl	-28(%rbp), %eax
	cltq
	movq	N(%rip), %rdx
	addq	%rdx, %rdx
	cmpq	%rdx, %rax
	jl	.L11
	movq	N(%rip), %rax
	leaq	0(,%rax,8), %rdx
	leaq	neg(%rip), %rax
	movq	(%rdx,%rax), %rax
	testq	%rax, %rax
	je	.L12
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L13
.L12:
	movq	N(%rip), %rax
	leaq	0(,%rax,8), %rdx
	leaq	d(%rip), %rax
	movq	(%rdx,%rax), %rax
	negq	%rax
	movq	%rax, %rsi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L13:
	movl	$0, %eax
	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:
