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,a[110],b[110],g,max,i,j;
  scanf("%d %d",&n,&m);
  for(i=0;i<m;i++)scanf("%d %d",&a[i],&b[i]);
  g=0;
  for(i=0;i<n;i++){
    for(j=max=0;j<m;j++){
      if(g+1<a[j]||b[j]<g+1)continue;
      if(max<b[j])max=b[j];
    }
    if(max==0){
      printf("Impossible\n");
      return 0;
    }
    g=max;
    if(g==n)break;
  }
  printf("%d\n",i+1);
  return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d %d"
.LC1:
	.string	"Impossible"
.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	$928, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-916(%rbp), %rdx
	leaq	-920(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -904(%rbp)
	jmp	.L2
.L3:
	leaq	-448(%rbp), %rdx
	movl	-904(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rax, %rdx
	leaq	-896(%rbp), %rcx
	movl	-904(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -904(%rbp)
.L2:
	movl	-916(%rbp), %eax
	cmpl	%eax, -904(%rbp)
	jl	.L3
	movl	$0, -912(%rbp)
	movl	$0, -904(%rbp)
	jmp	.L4
.L14:
	movl	$0, -908(%rbp)
	movl	-908(%rbp), %eax
	movl	%eax, -900(%rbp)
	jmp	.L5
.L9:
	movl	-912(%rbp), %eax
	leal	1(%rax), %edx
	movl	-900(%rbp), %eax
	cltq
	movl	-896(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	jl	.L17
	movl	-900(%rbp), %eax
	cltq
	movl	-448(%rbp,%rax,4), %eax
	cmpl	%eax, -912(%rbp)
	jge	.L17
	movl	-900(%rbp), %eax
	cltq
	movl	-448(%rbp,%rax,4), %eax
	cmpl	%eax, -908(%rbp)
	jge	.L8
	movl	-900(%rbp), %eax
	cltq
	movl	-448(%rbp,%rax,4), %eax
	movl	%eax, -908(%rbp)
	jmp	.L8
.L17:
	nop
.L8:
	addl	$1, -900(%rbp)
.L5:
	movl	-916(%rbp), %eax
	cmpl	%eax, -900(%rbp)
	jl	.L9
	cmpl	$0, -908(%rbp)
	jne	.L10
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	movl	$0, %eax
	jmp	.L15
.L10:
	movl	-908(%rbp), %eax
	movl	%eax, -912(%rbp)
	movl	-920(%rbp), %eax
	cmpl	%eax, -912(%rbp)
	je	.L18
	addl	$1, -904(%rbp)
.L4:
	movl	-920(%rbp), %eax
	cmpl	%eax, -904(%rbp)
	jl	.L14
	jmp	.L13
.L18:
	nop
.L13:
	movl	-904(%rbp), %eax
	addl	$1, %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
.L15:
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L16
	call	__stack_chk_fail@PLT
.L16:
	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	"Impossible"
.LC2:
	.string	"%d\n"
	.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	.LC0(%rip), %r14
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	movq	%r14, %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
	subq	$912, %rsp
	.cfi_def_cfa_offset 960
	movq	%fs:40, %rax
	movq	%rax, 904(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rdx
	leaq	8(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	testl	%eax, %eax
	jle	.L2
	leaq	16(%rsp), %rbx
	xorl	%r12d, %r12d
	leaq	464(%rsp), %rbp
	movq	%rbx, %r13
	.p2align 4,,10
	.p2align 3
.L3:
	leaq	0(%rbp,%r12,4), %rdx
	movq	%r13, %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %r10d
	addq	$1, %r12
	addq	$4, %r13
	cmpl	%r12d, %r10d
	jg	.L3
	movl	8(%rsp), %r11d
	xorl	%r12d, %r12d
	xorl	%r9d, %r9d
	movslq	%r10d, %r8
	testl	%r11d, %r11d
	jle	.L5
	testl	%r10d, %r10d
	jle	.L10
	.p2align 4,,10
	.p2align 3
.L12:
	leal	1(%r9), %edi
	xorl	%eax, %eax
	xorl	%edx, %edx
	.p2align 4,,10
	.p2align 3
.L7:
	cmpl	(%rbx,%rax,4), %edi
	jl	.L6
	movl	0(%rbp,%rax,4), %ecx
	cmpl	%ecx, %edx
	movl	%ecx, %esi
	cmovge	%edx, %esi
	cmpl	%ecx, %r9d
	cmovl	%esi, %edx
.L6:
	addq	$1, %rax
	cmpq	%rax, %r8
	jne	.L7
	testl	%edx, %edx
	je	.L10
	leal	1(%r12), %r9d
	cmpl	%edx, %r11d
	je	.L11
	cmpl	%r9d, %r11d
	je	.L16
	movl	%r9d, %r12d
	movl	%edx, %r9d
	testl	%r10d, %r10d
	jg	.L12
.L10:
	leaq	.LC1(%rip), %rdi
	call	puts@PLT
.L9:
	movq	904(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L27
	addq	$912, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 48
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 40
	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
.L16:
	.cfi_restore_state
	leal	2(%r12), %r9d
.L11:
	movl	%r9d, %edx
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L9
.L2:
	cmpl	$0, 8(%rsp)
	jg	.L10
.L5:
	movl	$1, %r9d
	jmp	.L11
.L27:
	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	"Impossible"
.LC2:
	.string	"%d\n"
	.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	.LC0(%rip), %r14
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	movq	%r14, %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
	subq	$912, %rsp
	.cfi_def_cfa_offset 960
	movq	%fs:40, %rax
	movq	%rax, 904(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rdx
	leaq	8(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	testl	%eax, %eax
	jle	.L2
	leaq	16(%rsp), %rbx
	xorl	%r12d, %r12d
	leaq	464(%rsp), %rbp
	movq	%rbx, %r13
	.p2align 4,,10
	.p2align 3
.L3:
	leaq	0(%rbp,%r12,4), %rdx
	movq	%r13, %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %r10d
	addq	$1, %r12
	addq	$4, %r13
	cmpl	%r12d, %r10d
	jg	.L3
	movl	8(%rsp), %r11d
	xorl	%r12d, %r12d
	xorl	%r9d, %r9d
	movslq	%r10d, %r8
	testl	%r11d, %r11d
	jle	.L5
	testl	%r10d, %r10d
	jle	.L10
	.p2align 4,,10
	.p2align 3
.L12:
	leal	1(%r9), %edi
	xorl	%eax, %eax
	xorl	%edx, %edx
	.p2align 4,,10
	.p2align 3
.L7:
	cmpl	(%rbx,%rax,4), %edi
	jl	.L6
	movl	0(%rbp,%rax,4), %ecx
	cmpl	%ecx, %edx
	movl	%ecx, %esi
	cmovge	%edx, %esi
	cmpl	%ecx, %r9d
	cmovl	%esi, %edx
.L6:
	addq	$1, %rax
	cmpq	%rax, %r8
	jne	.L7
	testl	%edx, %edx
	je	.L10
	leal	1(%r12), %r9d
	cmpl	%edx, %r11d
	je	.L11
	cmpl	%r9d, %r11d
	je	.L16
	movl	%r9d, %r12d
	movl	%edx, %r9d
	testl	%r10d, %r10d
	jg	.L12
.L10:
	leaq	.LC1(%rip), %rdi
	call	puts@PLT
.L9:
	movq	904(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L27
	addq	$912, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 48
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 40
	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
.L16:
	.cfi_restore_state
	leal	2(%r12), %r9d
.L11:
	movl	%r9d, %edx
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L9
.L2:
	cmpl	$0, 8(%rsp)
	jg	.L10
.L5:
	movl	$1, %r9d
	jmp	.L11
.L27:
	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,a[110],b[110],g,max,i,j;
  scanf("%d %d",&n,&m);
  for(i=0;i<m;i++)scanf("%d %d",&a[i],&b[i]);
  g=0;
  for(i=0;i<n;i++){
    for(j=max=0;j<m;j++){
      if(g+1<a[j]||b[j]<g+1)continue;
      if(max<b[j])max=b[j];
    }
    if(max==0){
      printf("Impossible\n");
      return 0;
    }
    g=max;
    if(g==n)break;
  }
  printf("%d\n",i+1);
  return 0;
}
8 4
3 7
1 5
2 5
4 8

2

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,a[110],b[110],g,max,i,j;
  scanf("%d %d",&n,&m);
  for(i=0;i<m;i++)scanf("%d %d",&a[i],&b[i]);
  g=0;
  for(i=0;i<n;i++){
    for(j=max=0;j<m;j++){
      if(g+1<a[j]||b[j]<g+1)continue;
      if(max<b[j])max=b[j];
    }
    if(max==0){
      printf("Impossible\n");
      return 0;
    }
    g=max;
    if(g==n)break;
  }
  printf("%d\n",i+1);
  return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d %d"
.LC1:
	.string	"Impossible"
.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	$928, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-916(%rbp), %rdx
	leaq	-920(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -904(%rbp)
	jmp	.L2
.L3:
	leaq	-448(%rbp), %rdx
	movl	-904(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rax, %rdx
	leaq	-896(%rbp), %rcx
	movl	-904(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -904(%rbp)
.L2:
	movl	-916(%rbp), %eax
	cmpl	%eax, -904(%rbp)
	jl	.L3
	movl	$0, -912(%rbp)
	movl	$0, -904(%rbp)
	jmp	.L4
.L14:
	movl	$0, -908(%rbp)
	movl	-908(%rbp), %eax
	movl	%eax, -900(%rbp)
	jmp	.L5
.L9:
	movl	-912(%rbp), %eax
	leal	1(%rax), %edx
	movl	-900(%rbp), %eax
	cltq
	movl	-896(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	jl	.L17
	movl	-900(%rbp), %eax
	cltq
	movl	-448(%rbp,%rax,4), %eax
	cmpl	%eax, -912(%rbp)
	jge	.L17
	movl	-900(%rbp), %eax
	cltq
	movl	-448(%rbp,%rax,4), %eax
	cmpl	%eax, -908(%rbp)
	jge	.L8
	movl	-900(%rbp), %eax
	cltq
	movl	-448(%rbp,%rax,4), %eax
	movl	%eax, -908(%rbp)
	jmp	.L8
.L17:
	nop
.L8:
	addl	$1, -900(%rbp)
.L5:
	movl	-916(%rbp), %eax
	cmpl	%eax, -900(%rbp)
	jl	.L9
	cmpl	$0, -908(%rbp)
	jne	.L10
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	movl	$0, %eax
	jmp	.L15
.L10:
	movl	-908(%rbp), %eax
	movl	%eax, -912(%rbp)
	movl	-920(%rbp), %eax
	cmpl	%eax, -912(%rbp)
	je	.L18
	addl	$1, -904(%rbp)
.L4:
	movl	-920(%rbp), %eax
	cmpl	%eax, -904(%rbp)
	jl	.L14
	jmp	.L13
.L18:
	nop
.L13:
	movl	-904(%rbp), %eax
	addl	$1, %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
.L15:
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L16
	call	__stack_chk_fail@PLT
.L16:
	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	"Impossible"
.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	$928, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-916(%rbp), %rdx
	leaq	-920(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -904(%rbp)
	jmp	.L2
.L3:
	leaq	-448(%rbp), %rdx
	movl	-904(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rax, %rdx
	leaq	-896(%rbp), %rcx
	movl	-904(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -904(%rbp)
.L2:
	movl	-916(%rbp), %eax
	cmpl	%eax, -904(%rbp)
	jl	.L3
	movl	$0, -912(%rbp)
	movl	$0, -904(%rbp)
	jmp	.L4
.L14:
	movl	$0, -908(%rbp)
	movl	-908(%rbp), %eax
	movl	%eax, -900(%rbp)
	jmp	.L5
.L9:
	movl	-912(%rbp), %eax
	leal	1(%rax), %edx
	movl	-900(%rbp), %eax
	cltq
	movl	-896(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	jl	.L17
	movl	-900(%rbp), %eax
	cltq
	movl	-448(%rbp,%rax,4), %eax
	cmpl	%eax, -912(%rbp)
	jge	.L17
	movl	-900(%rbp), %eax
	cltq
	movl	-448(%rbp,%rax,4), %eax
	cmpl	%eax, -908(%rbp)
	jge	.L8
	movl	-900(%rbp), %eax
	cltq
	movl	-448(%rbp,%rax,4), %eax
	movl	%eax, -908(%rbp)
	jmp	.L8
.L17:
	nop
.L8:
	addl	$1, -900(%rbp)
.L5:
	movl	-916(%rbp), %eax
	cmpl	%eax, -900(%rbp)
	jl	.L9
	cmpl	$0, -908(%rbp)
	jne	.L10
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	movl	$0, %eax
	jmp	.L15
.L10:
	movl	-908(%rbp), %eax
	movl	%eax, -912(%rbp)
	movl	-920(%rbp), %eax
	cmpl	%eax, -912(%rbp)
	je	.L18
	addl	$1, -904(%rbp)
.L4:
	movl	-920(%rbp), %eax
	cmpl	%eax, -904(%rbp)
	jl	.L14
	jmp	.L13
.L18:
	nop
.L13:
	movl	-904(%rbp), %eax
	addl	$1, %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
.L15:
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L16
	call	__stack_chk_fail@PLT
.L16:
	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:
