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 main(){
    int n,m,max,min,a,b;
    scanf("%d %d",&n,&m);
    min=0;
    max=100000;
    for(int i=0;i<m;i++){
        scanf("%d %d",&a,&b);
        if(a>min){
            min=a;
        }
        if(b<max){
            max=b;
        }
        if(min>max){
            break;
        }
    }
    if(min>max){
        printf("0\n");
    }
    else{
        printf("%d\n",max-min+1);
    }
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d %d"
.LC1:
	.string	"0"
.LC2:
	.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
	leaq	-32(%rbp), %rdx
	leaq	-36(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -16(%rbp)
	movl	$100000, -20(%rbp)
	movl	$0, -12(%rbp)
	jmp	.L2
.L7:
	leaq	-24(%rbp), %rdx
	leaq	-28(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-28(%rbp), %eax
	cmpl	%eax, -16(%rbp)
	jge	.L3
	movl	-28(%rbp), %eax
	movl	%eax, -16(%rbp)
.L3:
	movl	-24(%rbp), %eax
	cmpl	%eax, -20(%rbp)
	jle	.L4
	movl	-24(%rbp), %eax
	movl	%eax, -20(%rbp)
.L4:
	movl	-16(%rbp), %eax
	cmpl	-20(%rbp), %eax
	jg	.L12
	addl	$1, -12(%rbp)
.L2:
	movl	-32(%rbp), %eax
	cmpl	%eax, -12(%rbp)
	jl	.L7
	jmp	.L6
.L12:
	nop
.L6:
	movl	-16(%rbp), %eax
	cmpl	-20(%rbp), %eax
	jle	.L8
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L9
.L8:
	movl	-20(%rbp), %eax
	subl	-16(%rbp), %eax
	addl	$1, %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L9:
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L11
	call	__stack_chk_fail@PLT
.L11:
	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	"%d %d"
.LC1:
	.string	"0"
.LC2:
	.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
	leaq	.LC0(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movq	%r12, %rdi
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$40, %rsp
	.cfi_def_cfa_offset 96
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rdx
	leaq	8(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	testl	%eax, %eax
	jle	.L7
	xorl	%r15d, %r15d
	xorl	%ebp, %ebp
	leaq	20(%rsp), %r14
	movl	$100000, %ebx
	leaq	16(%rsp), %r13
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L12:
	addl	$1, %r15d
	cmpl	%r15d, 12(%rsp)
	jle	.L2
.L4:
	xorl	%eax, %eax
	movq	%r14, %rdx
	movq	%r13, %rsi
	movq	%r12, %rdi
	call	__isoc99_scanf@PLT
	movl	16(%rsp), %eax
	cmpl	%eax, %ebp
	cmovl	%eax, %ebp
	movl	20(%rsp), %eax
	cmpl	%eax, %ebx
	cmovg	%eax, %ebx
	cmpl	%ebx, %ebp
	jle	.L12
	leaq	.LC1(%rip), %rdi
	call	puts@PLT
.L5:
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L13
	addq	$40, %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
.L7:
	.cfi_restore_state
	xorl	%ebp, %ebp
	movl	$100000, %ebx
.L2:
	subl	%ebp, %ebx
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	leal	1(%rbx), %edx
	call	__printf_chk@PLT
	jmp	.L5
.L13:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.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:

rule
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d %d"
.LC1:
	.string	"0"
.LC2:
	.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
	leaq	.LC0(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movq	%r12, %rdi
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$40, %rsp
	.cfi_def_cfa_offset 96
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rdx
	leaq	8(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	testl	%eax, %eax
	jle	.L7
	xorl	%r15d, %r15d
	xorl	%ebp, %ebp
	leaq	20(%rsp), %r14
	movl	$100000, %ebx
	leaq	16(%rsp), %r13
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L12:
	addl	$1, %r15d
	cmpl	%r15d, 12(%rsp)
	jle	.L2
.L4:
	xorl	%eax, %eax
	movq	%r14, %rdx
	movq	%r13, %rsi
	movq	%r12, %rdi
	call	__isoc99_scanf@PLT
	movl	16(%rsp), %eax
	cmpl	%eax, %ebp
	cmovl	%eax, %ebp
	movl	20(%rsp), %eax
	cmpl	%eax, %ebx
	cmovg	%eax, %ebx
	cmpl	%ebx, %ebp
	jle	.L12
	leaq	.LC1(%rip), %rdi
	call	puts@PLT
.L5:
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L13
	addq	$40, %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
.L7:
	.cfi_restore_state
	xorl	%ebp, %ebp
	movl	$100000, %ebx
.L2:
	subl	%ebp, %ebx
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	leal	1(%rbx), %edx
	call	__printf_chk@PLT
	jmp	.L5
.L13:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.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:

#include<stdio.h>

int main(){
    int n,m,max,min,a,b;
    scanf("%d %d",&n,&m);
    min=0;
    max=100000;
    for(int i=0;i<m;i++){
        scanf("%d %d",&a,&b);
        if(a>min){
            min=a;
        }
        if(b<max){
            max=b;
        }
        if(min>max){
            break;
        }
    }
    if(min>max){
        printf("0\n");
    }
    else{
        printf("%d\n",max-min+1);
    }
}

101000 1
1 100000
 4 2
1 6
2 4
 10 3
3 6
7 7
6 9
 101000 1
1 100100
 101000 1
1 100110
 101000 1
1 100010
 101100 1
2 100110
 8 3
1 7
7 7
1 11
 8 1
1 7
7 7
2 11
 4 1
1 4
2 4

100000
 3
 0
 100000
 100000
 100000
 99999
 1
 7
 4

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 main(){
    int n,m,max,min,a,b;
    scanf("%d %d",&n,&m);
    min=0;
    max=100000;
    for(int i=0;i<m;i++){
        scanf("%d %d",&a,&b);
        if(a>min){
            min=a;
        }
        if(b<max){
            max=b;
        }
        if(min>max){
            break;
        }
    }
    if(min>max){
        printf("0\n");
    }
    else{
        printf("%d\n",max-min+1);
    }
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d %d"
.LC1:
	.string	"0"
.LC2:
	.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
	leaq	-32(%rbp), %rdx
	leaq	-36(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -16(%rbp)
	movl	$100000, -20(%rbp)
	movl	$0, -12(%rbp)
	jmp	.L2
.L7:
	leaq	-24(%rbp), %rdx
	leaq	-28(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-28(%rbp), %eax
	cmpl	%eax, -16(%rbp)
	jge	.L3
	movl	-28(%rbp), %eax
	movl	%eax, -16(%rbp)
.L3:
	movl	-24(%rbp), %eax
	cmpl	%eax, -20(%rbp)
	jle	.L4
	movl	-24(%rbp), %eax
	movl	%eax, -20(%rbp)
.L4:
	movl	-16(%rbp), %eax
	cmpl	-20(%rbp), %eax
	jg	.L12
	addl	$1, -12(%rbp)
.L2:
	movl	-32(%rbp), %eax
	cmpl	%eax, -12(%rbp)
	jl	.L7
	jmp	.L6
.L12:
	nop
.L6:
	movl	-16(%rbp), %eax
	cmpl	-20(%rbp), %eax
	jle	.L8
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L9
.L8:
	movl	-20(%rbp), %eax
	subl	-16(%rbp), %eax
	addl	$1, %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L9:
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L11
	call	__stack_chk_fail@PLT
.L11:
	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
	.section	.rodata
.LC0:
	.string	"%d %d"
.LC1:
	.string	"0"
.LC2:
	.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
	leaq	-32(%rbp), %rdx
	leaq	-36(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -16(%rbp)
	movl	$100000, -20(%rbp)
	movl	$0, -12(%rbp)
	jmp	.L2
.L7:
	leaq	-24(%rbp), %rdx
	leaq	-28(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-28(%rbp), %eax
	cmpl	%eax, -16(%rbp)
	jge	.L3
	movl	-28(%rbp), %eax
	movl	%eax, -16(%rbp)
.L3:
	movl	-24(%rbp), %eax
	cmpl	%eax, -20(%rbp)
	jle	.L4
	movl	-24(%rbp), %eax
	movl	%eax, -20(%rbp)
.L4:
	movl	-16(%rbp), %eax
	cmpl	-20(%rbp), %eax
	jg	.L12
	addl	$1, -12(%rbp)
.L2:
	movl	-32(%rbp), %eax
	cmpl	%eax, -12(%rbp)
	jl	.L7
	jmp	.L6
.L12:
	nop
.L6:
	movl	-16(%rbp), %eax
	cmpl	-20(%rbp), %eax
	jle	.L8
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L9
.L8:
	movl	-20(%rbp), %eax
	subl	-16(%rbp), %eax
	addl	$1, %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L9:
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L11
	call	__stack_chk_fail@PLT
.L11:
	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:
