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

```c
#include<stdio.h>

int N, M;	
int a, b, c;
int i;
int sum, max;

int main()
{	
	scanf("%d %d", &N, &M);

	for (i = 0; i < M; i++) {
		scanf("%d %d", &a, &b);
		c = N - a;
		if (c>0) {
			sum += c;
		}
		if(c>=max){
			max = c;
		}
	}
	printf("%d\n", sum - max);

	return 0;
}```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	leaq	M(%rip), %rdx
	leaq	N(%rip), %rsi
	xorl	%eax, %eax
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	leaq	.LC0(%rip), %rbx
	movq	%rbx, %rdi
	call	__isoc99_scanf@PLT
	movl	M(%rip), %eax
	movl	$0, i(%rip)
	testl	%eax, %eax
	jle	.L2
	leaq	b(%rip), %r12
	leaq	a(%rip), %rbp
	.p2align 4,,10
	.p2align 3
.L7:
	movq	%r12, %rdx
	movq	%rbp, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	N(%rip), %eax
	subl	a(%rip), %eax
	movl	%eax, c(%rip)
	testl	%eax, %eax
	jle	.L3
	addl	%eax, sum(%rip)
.L3:
	movl	max(%rip), %edx
	cmpl	%edx, %eax
	jl	.L4
	movl	i(%rip), %ecx
	movl	%eax, max(%rip)
	leal	1(%rcx), %edx
	cmpl	M(%rip), %edx
	movl	%edx, i(%rip)
	jl	.L7
	movl	%eax, %edx
.L6:
	movl	sum(%rip), %r8d
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	subl	%edx, %r8d
	movl	%r8d, %edx
	call	__printf_chk@PLT
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	xorl	%eax, %eax
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L4:
	.cfi_restore_state
	movl	i(%rip), %eax
	addl	$1, %eax
	cmpl	M(%rip), %eax
	movl	%eax, i(%rip)
	jl	.L7
	jmp	.L6
.L2:
	movl	max(%rip), %edx
	jmp	.L6
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.globl	max
	.bss
	.align 4
	.type	max, @object
	.size	max, 4
max:
	.zero	4
	.globl	sum
	.align 4
	.type	sum, @object
	.size	sum, 4
sum:
	.zero	4
	.globl	i
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.globl	c
	.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	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
	.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.
Optimized Assembly Code:

user
```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	leaq	M(%rip), %rdx
	leaq	N(%rip), %rsi
	xorl	%eax, %eax
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	leaq	.LC0(%rip), %rbx
	movq	%rbx, %rdi
	call	__isoc99_scanf@PLT
	movl	M(%rip), %eax
	movl	$0, i(%rip)
	testl	%eax, %eax
	jle	.L2
	leaq	b(%rip), %r12
	leaq	a(%rip), %rbp
	.p2align 4,,10
	.p2align 3
.L7:
	movq	%r12, %rdx
	movq	%rbp, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	N(%rip), %eax
	subl	a(%rip), %eax
	movl	%eax, c(%rip)
	testl	%eax, %eax
	jle	.L3
	addl	%eax, sum(%rip)
.L3:
	movl	max(%rip), %edx
	cmpl	%edx, %eax
	jl	.L4
	movl	i(%rip), %ecx
	movl	%eax, max(%rip)
	leal	1(%rcx), %edx
	cmpl	M(%rip), %edx
	movl	%edx, i(%rip)
	jl	.L7
	movl	%eax, %edx
.L6:
	movl	sum(%rip), %r8d
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	subl	%edx, %r8d
	movl	%r8d, %edx
	call	__printf_chk@PLT
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	xorl	%eax, %eax
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L4:
	.cfi_restore_state
	movl	i(%rip), %eax
	addl	$1, %eax
	cmpl	M(%rip), %eax
	movl	%eax, i(%rip)
	jl	.L7
	jmp	.L6
.L2:
	movl	max(%rip), %edx
	jmp	.L6
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.globl	max
	.bss
	.align 4
	.type	max, @object
	.size	max, 4
max:
	.zero	4
	.globl	sum
	.align 4
	.type	sum, @object
	.size	sum, 4
sum:
	.zero	4
	.globl	i
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.globl	c
	.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	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
	.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
```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	leaq	M(%rip), %rdx
	leaq	N(%rip), %rsi
	xorl	%eax, %eax
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	leaq	.LC0(%rip), %rbx
	movq	%rbx, %rdi
	call	__isoc99_scanf@PLT
	movl	M(%rip), %eax
	movl	$0, i(%rip)
	testl	%eax, %eax
	jle	.L2
	leaq	b(%rip), %r12
	leaq	a(%rip), %rbp
	.p2align 4,,10
	.p2align 3
.L7:
	movq	%r12, %rdx
	movq	%rbp, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	N(%rip), %eax
	subl	a(%rip), %eax
	movl	%eax, c(%rip)
	testl	%eax, %eax
	jle	.L3
	addl	%eax, sum(%rip)
.L3:
	movl	max(%rip), %edx
	cmpl	%edx, %eax
	jl	.L4
	movl	i(%rip), %ecx
	movl	%eax, max(%rip)
	leal	1(%rcx), %edx
	cmpl	M(%rip), %edx
	movl	%edx, i(%rip)
	jl	.L7
	movl	%eax, %edx
.L6:
	movl	sum(%rip), %r8d
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	subl	%edx, %r8d
	movl	%r8d, %edx
	call	__printf_chk@PLT
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	xorl	%eax, %eax
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L4:
	.cfi_restore_state
	movl	i(%rip), %eax
	addl	$1, %eax
	cmpl	M(%rip), %eax
	movl	%eax, i(%rip)
	jl	.L7
	jmp	.L6
.L2:
	movl	max(%rip), %edx
	jmp	.L6
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.globl	max
	.bss
	.align 4
	.type	max, @object
	.size	max, 4
max:
	.zero	4
	.globl	sum
	.align 4
	.type	sum, @object
	.size	sum, 4
sum:
	.zero	4
	.globl	i
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.globl	c
	.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	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
	.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:
```
```c
#include<stdio.h>

int N, M;	
int a, b, c;
int i;
int sum, max;

int main()
{	
	scanf("%d %d", &N, &M);

	for (i = 0; i < M; i++) {
		scanf("%d %d", &a, &b);
		c = N - a;
		if (c>0) {
			sum += c;
		}
		if(c>=max){
			max = c;
		}
	}
	printf("%d\n", sum - max);

	return 0;
}```
Given the following C code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
#include<stdio.h>

int N, M;	
int a, b, c;
int i;
int sum, max;

int main()
{	
	scanf("%d %d", &N, &M);

	for (i = 0; i < M; i++) {
		scanf("%d %d", &a, &b);
		c = N - a;
		if (c>0) {
			sum += c;
		}
		if(c>=max){
			max = c;
		}
	}
	printf("%d\n", sum - max);

	return 0;
}```

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.
Optimized Assembly Code:

4 5
1 7
6 2
3 5
4 4
0 8

4

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

```c
#include<stdio.h>

int N, M;	
int a, b, c;
int i;
int sum, max;

int main()
{	
	scanf("%d %d", &N, &M);

	for (i = 0; i < M; i++) {
		scanf("%d %d", &a, &b);
		c = N - a;
		if (c>0) {
			sum += c;
		}
		if(c>=max){
			max = c;
		}
	}
	printf("%d\n", sum - max);

	return 0;
}```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	leaq	M(%rip), %rdx
	leaq	N(%rip), %rsi
	xorl	%eax, %eax
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	leaq	.LC0(%rip), %rbx
	movq	%rbx, %rdi
	call	__isoc99_scanf@PLT
	movl	M(%rip), %eax
	movl	$0, i(%rip)
	testl	%eax, %eax
	jle	.L2
	leaq	b(%rip), %r12
	leaq	a(%rip), %rbp
	.p2align 4,,10
	.p2align 3
.L7:
	movq	%r12, %rdx
	movq	%rbp, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	N(%rip), %eax
	subl	a(%rip), %eax
	movl	%eax, c(%rip)
	testl	%eax, %eax
	jle	.L3
	addl	%eax, sum(%rip)
.L3:
	movl	max(%rip), %edx
	cmpl	%edx, %eax
	jl	.L4
	movl	i(%rip), %ecx
	movl	%eax, max(%rip)
	leal	1(%rcx), %edx
	cmpl	M(%rip), %edx
	movl	%edx, i(%rip)
	jl	.L7
	movl	%eax, %edx
.L6:
	movl	sum(%rip), %r8d
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	subl	%edx, %r8d
	movl	%r8d, %edx
	call	__printf_chk@PLT
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	xorl	%eax, %eax
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L4:
	.cfi_restore_state
	movl	i(%rip), %eax
	addl	$1, %eax
	cmpl	M(%rip), %eax
	movl	%eax, i(%rip)
	jl	.L7
	jmp	.L6
.L2:
	movl	max(%rip), %edx
	jmp	.L6
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.globl	max
	.bss
	.align 4
	.type	max, @object
	.size	max, 4
max:
	.zero	4
	.globl	sum
	.align 4
	.type	sum, @object
	.size	sum, 4
sum:
	.zero	4
	.globl	i
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.globl	c
	.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	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
	.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.
Optimized Assembly Code:

train
```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	leaq	M(%rip), %rdx
	leaq	N(%rip), %rsi
	xorl	%eax, %eax
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	leaq	.LC0(%rip), %rbx
	movq	%rbx, %rdi
	call	__isoc99_scanf@PLT
	movl	M(%rip), %eax
	movl	$0, i(%rip)
	testl	%eax, %eax
	jle	.L2
	leaq	b(%rip), %r12
	leaq	a(%rip), %rbp
	.p2align 4,,10
	.p2align 3
.L7:
	movq	%r12, %rdx
	movq	%rbp, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	N(%rip), %eax
	subl	a(%rip), %eax
	movl	%eax, c(%rip)
	testl	%eax, %eax
	jle	.L3
	addl	%eax, sum(%rip)
.L3:
	movl	max(%rip), %edx
	cmpl	%edx, %eax
	jl	.L4
	movl	i(%rip), %ecx
	movl	%eax, max(%rip)
	leal	1(%rcx), %edx
	cmpl	M(%rip), %edx
	movl	%edx, i(%rip)
	jl	.L7
	movl	%eax, %edx
.L6:
	movl	sum(%rip), %r8d
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	subl	%edx, %r8d
	movl	%r8d, %edx
	call	__printf_chk@PLT
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	xorl	%eax, %eax
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L4:
	.cfi_restore_state
	movl	i(%rip), %eax
	addl	$1, %eax
	cmpl	M(%rip), %eax
	movl	%eax, i(%rip)
	jl	.L7
	jmp	.L6
.L2:
	movl	max(%rip), %edx
	jmp	.L6
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.globl	max
	.bss
	.align 4
	.type	max, @object
	.size	max, 4
max:
	.zero	4
	.globl	sum
	.align 4
	.type	sum, @object
	.size	sum, 4
sum:
	.zero	4
	.globl	i
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.globl	c
	.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	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
	.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:
```