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(void) {
	while(1){
		int t;
		scanf("%d",&t);
		if(t==0) break;
		int n;
		scanf("%d",&n);
		int i,s[n],f[n];
		for(i=0;i<n;i++){
			scanf("%d %d",&s[i],&f[i]);
		}
		int a[n],sum=0;
		for(i=0;i<n;i++){
			a[i]=f[i]-s[i];
		}
		for(i=0;i<n;i++){
			sum=sum+a[i];
		}
		if(sum>=t){
			printf("OK\n");
		}
		else{
			printf("%d\n",t-sum);
		}
	}
	return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d %d"
.LC2:
	.string	"OK"
.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
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$152, %rsp
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
.L21:
	movq	%rsp, %rax
	movq	%rax, %rbx
	leaq	-120(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-120(%rbp), %eax
	testl	%eax, %eax
	jne	.L2
	movq	%rbx, %rsp
	movl	$0, %eax
	movq	-56(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L22
	jmp	.L23
.L2:
	leaq	-116(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-116(%rbp), %edx
	movslq	%edx, %rax
	subq	$1, %rax
	movq	%rax, -104(%rbp)
	movslq	%edx, %rax
	movq	%rax, %r12
	movl	$0, %r13d
	movslq	%edx, %rax
	movq	%rax, %r14
	movl	$0, %r15d
	movslq	%edx, %rax
	leaq	0(,%rax,4), %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %esi
	movl	$0, %edx
	divq	%rsi
	imulq	$16, %rax, %rdx
	movq	%rdx, %rax
	andq	$-4096, %rax
	movq	%rsp, %rcx
	subq	%rax, %rcx
.L4:
	cmpq	%rcx, %rsp
	je	.L5
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L4
.L5:
	movq	%rdx, %rax
	andl	$4095, %eax
	subq	%rax, %rsp
	movq	%rdx, %rax
	andl	$4095, %eax
	testq	%rax, %rax
	je	.L6
	movq	%rdx, %rax
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L6:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -96(%rbp)
	movl	-116(%rbp), %edx
	movslq	%edx, %rax
	subq	$1, %rax
	movq	%rax, -88(%rbp)
	movslq	%edx, %rax
	movq	%rax, -144(%rbp)
	movq	$0, -136(%rbp)
	movslq	%edx, %rax
	movq	%rax, -160(%rbp)
	movq	$0, -152(%rbp)
	movslq	%edx, %rax
	leaq	0(,%rax,4), %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %edi
	movl	$0, %edx
	divq	%rdi
	imulq	$16, %rax, %rdx
	movq	%rdx, %rax
	andq	$-4096, %rax
	movq	%rsp, %rcx
	subq	%rax, %rcx
.L7:
	cmpq	%rcx, %rsp
	je	.L8
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L7
.L8:
	movq	%rdx, %rax
	andl	$4095, %eax
	subq	%rax, %rsp
	movq	%rdx, %rax
	andl	$4095, %eax
	testq	%rax, %rax
	je	.L9
	movq	%rdx, %rax
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L9:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -80(%rbp)
	movl	$0, -112(%rbp)
	jmp	.L10
.L11:
	movl	-112(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-80(%rbp), %rax
	leaq	(%rdx,%rax), %rcx
	movl	-112(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-96(%rbp), %rax
	addq	%rdx, %rax
	movq	%rcx, %rdx
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -112(%rbp)
.L10:
	movl	-116(%rbp), %eax
	cmpl	%eax, -112(%rbp)
	jl	.L11
	movl	-116(%rbp), %edx
	movslq	%edx, %rax
	subq	$1, %rax
	movq	%rax, -72(%rbp)
	movslq	%edx, %rax
	movq	%rax, -176(%rbp)
	movq	$0, -168(%rbp)
	movslq	%edx, %rax
	movq	%rax, -192(%rbp)
	movq	$0, -184(%rbp)
	movslq	%edx, %rax
	leaq	0(,%rax,4), %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %esi
	movl	$0, %edx
	divq	%rsi
	imulq	$16, %rax, %rdx
	movq	%rdx, %rax
	andq	$-4096, %rax
	movq	%rsp, %rcx
	subq	%rax, %rcx
.L12:
	cmpq	%rcx, %rsp
	je	.L13
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L12
.L13:
	movq	%rdx, %rax
	andl	$4095, %eax
	subq	%rax, %rsp
	movq	%rdx, %rax
	andl	$4095, %eax
	testq	%rax, %rax
	je	.L14
	movq	%rdx, %rax
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L14:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -64(%rbp)
	movl	$0, -108(%rbp)
	movl	$0, -112(%rbp)
	jmp	.L15
.L16:
	movq	-80(%rbp), %rdx
	movl	-112(%rbp), %eax
	cltq
	movl	(%rdx,%rax,4), %ecx
	movq	-96(%rbp), %rdx
	movl	-112(%rbp), %eax
	cltq
	movl	(%rdx,%rax,4), %eax
	subl	%eax, %ecx
	movq	-64(%rbp), %rdx
	movl	-112(%rbp), %eax
	cltq
	movl	%ecx, (%rdx,%rax,4)
	addl	$1, -112(%rbp)
.L15:
	movl	-116(%rbp), %eax
	cmpl	%eax, -112(%rbp)
	jl	.L16
	movl	$0, -112(%rbp)
	jmp	.L17
.L18:
	movq	-64(%rbp), %rdx
	movl	-112(%rbp), %eax
	cltq
	movl	(%rdx,%rax,4), %eax
	addl	%eax, -108(%rbp)
	addl	$1, -112(%rbp)
.L17:
	movl	-116(%rbp), %eax
	cmpl	%eax, -112(%rbp)
	jl	.L18
	movl	-120(%rbp), %eax
	cmpl	%eax, -108(%rbp)
	jl	.L19
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L20
.L19:
	movl	-120(%rbp), %eax
	subl	-108(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L20:
	movq	%rbx, %rsp
	jmp	.L21
.L23:
	call	__stack_chk_fail@PLT
.L22:
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	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"
.LC1:
	.string	"%d %d"
.LC2:
	.string	"OK"
.LC3:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$56, %rsp
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	leaq	-64(%rbp), %rax
	movq	%rax, -80(%rbp)
	leaq	-60(%rbp), %rax
	movq	%rax, -88(%rbp)
	.p2align 4,,10
	.p2align 3
.L24:
	movq	-80(%rbp), %rsi
	leaq	.LC0(%rip), %rdi
	xorl	%eax, %eax
	movq	%rsp, -72(%rbp)
	call	__isoc99_scanf@PLT
	movl	-64(%rbp), %eax
	testl	%eax, %eax
	je	.L2
	movq	-88(%rbp), %rsi
	leaq	.LC0(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	-60(%rbp), %rax
	movq	%rsp, %rcx
	movq	%rax, %rsi
	leaq	15(,%rax,4), %rax
	movq	%rax, %rdi
	movq	%rax, %rdx
	andq	$-4096, %rdi
	andq	$-16, %rdx
	subq	%rdi, %rcx
	cmpq	%rcx, %rsp
	je	.L4
.L47:
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	cmpq	%rcx, %rsp
	jne	.L47
.L4:
	andl	$4095, %edx
	subq	%rdx, %rsp
	testq	%rdx, %rdx
	je	.L5
	orq	$0, -8(%rsp,%rdx)
.L5:
	movq	%rax, %rdx
	movq	%rsp, %rdi
	andq	$-4096, %rax
	movq	%rsp, %r13
	subq	%rax, %rdi
	andq	$-16, %rdx
	cmpq	%rdi, %rsp
	je	.L7
.L48:
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	cmpq	%rdi, %rsp
	jne	.L48
.L7:
	andl	$4095, %edx
	subq	%rdx, %rsp
	testq	%rdx, %rdx
	jne	.L49
.L8:
	movq	%rsp, %r12
	testl	%esi, %esi
	jle	.L9
	movq	%r13, %rbx
	movq	%r12, %r15
	xorl	%r14d, %r14d
	.p2align 4,,10
	.p2align 3
.L10:
	movq	%r15, %rdx
	movq	%rbx, %rsi
	leaq	.LC1(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	-60(%rbp), %edx
	addl	$1, %r14d
	addq	$4, %rbx
	addq	$4, %r15
	cmpl	%r14d, %edx
	jg	.L10
	movslq	%edx, %rax
	movq	%rsp, %rdi
	leaq	15(,%rax,4), %rax
	movq	%rax, %rsi
	andq	$-4096, %rax
	subq	%rax, %rdi
	andq	$-16, %rsi
	cmpq	%rdi, %rsp
	je	.L12
.L50:
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	cmpq	%rdi, %rsp
	jne	.L50
.L12:
	andl	$4095, %esi
	subq	%rsi, %rsp
	testq	%rsi, %rsi
	je	.L13
	orq	$0, -8(%rsp,%rsi)
.L13:
	movq	%rsp, %rdi
	testl	%edx, %edx
	jle	.L9
	leal	-1(%rdx), %r9d
	cmpl	$2, %r9d
	jbe	.L27
	movl	%edx, %esi
	xorl	%eax, %eax
	shrl	$2, %esi
	salq	$4, %rsi
	.p2align 4,,10
	.p2align 3
.L15:
	movdqu	(%r12,%rax), %xmm0
	movdqu	0(%r13,%rax), %xmm2
	psubd	%xmm2, %xmm0
	movups	%xmm0, (%rdi,%rax)
	addq	$16, %rax
	cmpq	%rsi, %rax
	jne	.L15
	movl	%edx, %esi
	andl	$-4, %esi
	movl	%esi, %eax
	cmpl	%esi, %edx
	je	.L16
.L14:
	movl	%edx, %r10d
	subl	%esi, %r10d
	cmpl	$1, %r10d
	je	.L17
	movl	%esi, %esi
	movq	(%r12,%rsi,4), %xmm0
	movq	0(%r13,%rsi,4), %xmm1
	psubd	%xmm1, %xmm0
	movq	%xmm0, (%rdi,%rsi,4)
	movl	%r10d, %esi
	andl	$-2, %esi
	addl	%esi, %eax
	cmpl	%esi, %r10d
	je	.L18
.L17:
	cltq
	movl	(%r12,%rax,4), %ecx
	subl	0(%r13,%rax,4), %ecx
	movl	%ecx, (%rdi,%rax,4)
.L18:
	cmpl	$2, %r9d
	jbe	.L28
.L16:
	movl	%edx, %ecx
	movq	%rdi, %rax
	pxor	%xmm0, %xmm0
	shrl	$2, %ecx
	salq	$4, %rcx
	addq	%rdi, %rcx
	.p2align 4,,10
	.p2align 3
.L20:
	movdqu	(%rax), %xmm3
	addq	$16, %rax
	paddd	%xmm3, %xmm0
	cmpq	%rcx, %rax
	jne	.L20
	movdqa	%xmm0, %xmm1
	movl	%edx, %ecx
	psrldq	$8, %xmm1
	andl	$-4, %ecx
	paddd	%xmm1, %xmm0
	movdqa	%xmm0, %xmm1
	psrldq	$4, %xmm1
	paddd	%xmm1, %xmm0
	movd	%xmm0, %eax
	testb	$3, %dl
	je	.L25
.L19:
	movslq	%ecx, %rsi
	leaq	(%rdi,%rsi,4), %rsi
	leal	1(%rcx), %edi
	addl	(%rsi), %eax
	cmpl	%edi, %edx
	jle	.L25
	addl	$2, %ecx
	addl	4(%rsi), %eax
	cmpl	%ecx, %edx
	jle	.L25
	addl	8(%rsi), %eax
.L25:
	movl	-64(%rbp), %edx
	cmpl	%eax, %edx
	jg	.L22
	leaq	.LC2(%rip), %rdi
	call	puts@PLT
.L23:
	movq	-72(%rbp), %rsp
	jmp	.L24
	.p2align 4,,10
	.p2align 3
.L22:
	subl	%eax, %edx
	leaq	.LC3(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L23
	.p2align 4,,10
	.p2align 3
.L2:
	movq	-56(%rbp), %rax
	subq	%fs:40, %rax
	jne	.L51
	leaq	-40(%rbp), %rsp
	xorl	%eax, %eax
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.cfi_remember_state
	.cfi_def_cfa 7, 8
	ret
.L9:
	.cfi_restore_state
	xorl	%eax, %eax
	jmp	.L25
.L27:
	xorl	%esi, %esi
	xorl	%eax, %eax
	jmp	.L14
.L28:
	xorl	%eax, %eax
	xorl	%ecx, %ecx
	jmp	.L19
.L49:
	orq	$0, -8(%rsp,%rdx)
	jmp	.L8
.L51:
	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"
.LC1:
	.string	"%d %d"
.LC2:
	.string	"OK"
.LC3:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$56, %rsp
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	leaq	-64(%rbp), %rax
	movq	%rax, -80(%rbp)
	leaq	-60(%rbp), %rax
	movq	%rax, -88(%rbp)
	.p2align 4,,10
	.p2align 3
.L24:
	movq	-80(%rbp), %rsi
	leaq	.LC0(%rip), %rdi
	xorl	%eax, %eax
	movq	%rsp, -72(%rbp)
	call	__isoc99_scanf@PLT
	movl	-64(%rbp), %eax
	testl	%eax, %eax
	je	.L2
	movq	-88(%rbp), %rsi
	leaq	.LC0(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	-60(%rbp), %rax
	movq	%rsp, %rcx
	movq	%rax, %rsi
	leaq	15(,%rax,4), %rax
	movq	%rax, %rdi
	movq	%rax, %rdx
	andq	$-4096, %rdi
	andq	$-16, %rdx
	subq	%rdi, %rcx
	cmpq	%rcx, %rsp
	je	.L4
.L47:
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	cmpq	%rcx, %rsp
	jne	.L47
.L4:
	andl	$4095, %edx
	subq	%rdx, %rsp
	testq	%rdx, %rdx
	je	.L5
	orq	$0, -8(%rsp,%rdx)
.L5:
	movq	%rax, %rdx
	movq	%rsp, %rdi
	andq	$-4096, %rax
	movq	%rsp, %r13
	subq	%rax, %rdi
	andq	$-16, %rdx
	cmpq	%rdi, %rsp
	je	.L7
.L48:
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	cmpq	%rdi, %rsp
	jne	.L48
.L7:
	andl	$4095, %edx
	subq	%rdx, %rsp
	testq	%rdx, %rdx
	jne	.L49
.L8:
	movq	%rsp, %r12
	testl	%esi, %esi
	jle	.L9
	movq	%r13, %rbx
	movq	%r12, %r15
	xorl	%r14d, %r14d
	.p2align 4,,10
	.p2align 3
.L10:
	movq	%r15, %rdx
	movq	%rbx, %rsi
	leaq	.LC1(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	-60(%rbp), %edx
	addl	$1, %r14d
	addq	$4, %rbx
	addq	$4, %r15
	cmpl	%r14d, %edx
	jg	.L10
	movslq	%edx, %rax
	movq	%rsp, %rdi
	leaq	15(,%rax,4), %rax
	movq	%rax, %rsi
	andq	$-4096, %rax
	subq	%rax, %rdi
	andq	$-16, %rsi
	cmpq	%rdi, %rsp
	je	.L12
.L50:
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	cmpq	%rdi, %rsp
	jne	.L50
.L12:
	andl	$4095, %esi
	subq	%rsi, %rsp
	testq	%rsi, %rsi
	je	.L13
	orq	$0, -8(%rsp,%rsi)
.L13:
	movq	%rsp, %rdi
	testl	%edx, %edx
	jle	.L9
	leal	-1(%rdx), %r9d
	cmpl	$2, %r9d
	jbe	.L27
	movl	%edx, %esi
	xorl	%eax, %eax
	shrl	$2, %esi
	salq	$4, %rsi
	.p2align 4,,10
	.p2align 3
.L15:
	movdqu	(%r12,%rax), %xmm0
	movdqu	0(%r13,%rax), %xmm2
	psubd	%xmm2, %xmm0
	movups	%xmm0, (%rdi,%rax)
	addq	$16, %rax
	cmpq	%rsi, %rax
	jne	.L15
	movl	%edx, %esi
	andl	$-4, %esi
	movl	%esi, %eax
	cmpl	%esi, %edx
	je	.L16
.L14:
	movl	%edx, %r10d
	subl	%esi, %r10d
	cmpl	$1, %r10d
	je	.L17
	movl	%esi, %esi
	movq	(%r12,%rsi,4), %xmm0
	movq	0(%r13,%rsi,4), %xmm1
	psubd	%xmm1, %xmm0
	movq	%xmm0, (%rdi,%rsi,4)
	movl	%r10d, %esi
	andl	$-2, %esi
	addl	%esi, %eax
	cmpl	%esi, %r10d
	je	.L18
.L17:
	cltq
	movl	(%r12,%rax,4), %ecx
	subl	0(%r13,%rax,4), %ecx
	movl	%ecx, (%rdi,%rax,4)
.L18:
	cmpl	$2, %r9d
	jbe	.L28
.L16:
	movl	%edx, %ecx
	movq	%rdi, %rax
	pxor	%xmm0, %xmm0
	shrl	$2, %ecx
	salq	$4, %rcx
	addq	%rdi, %rcx
	.p2align 4,,10
	.p2align 3
.L20:
	movdqu	(%rax), %xmm3
	addq	$16, %rax
	paddd	%xmm3, %xmm0
	cmpq	%rcx, %rax
	jne	.L20
	movdqa	%xmm0, %xmm1
	movl	%edx, %ecx
	psrldq	$8, %xmm1
	andl	$-4, %ecx
	paddd	%xmm1, %xmm0
	movdqa	%xmm0, %xmm1
	psrldq	$4, %xmm1
	paddd	%xmm1, %xmm0
	movd	%xmm0, %eax
	testb	$3, %dl
	je	.L25
.L19:
	movslq	%ecx, %rsi
	leaq	(%rdi,%rsi,4), %rsi
	leal	1(%rcx), %edi
	addl	(%rsi), %eax
	cmpl	%edi, %edx
	jle	.L25
	addl	$2, %ecx
	addl	4(%rsi), %eax
	cmpl	%ecx, %edx
	jle	.L25
	addl	8(%rsi), %eax
.L25:
	movl	-64(%rbp), %edx
	cmpl	%eax, %edx
	jg	.L22
	leaq	.LC2(%rip), %rdi
	call	puts@PLT
.L23:
	movq	-72(%rbp), %rsp
	jmp	.L24
	.p2align 4,,10
	.p2align 3
.L22:
	subl	%eax, %edx
	leaq	.LC3(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L23
	.p2align 4,,10
	.p2align 3
.L2:
	movq	-56(%rbp), %rax
	subq	%fs:40, %rax
	jne	.L51
	leaq	-40(%rbp), %rsp
	xorl	%eax, %eax
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.cfi_remember_state
	.cfi_def_cfa 7, 8
	ret
.L9:
	.cfi_restore_state
	xorl	%eax, %eax
	jmp	.L25
.L27:
	xorl	%esi, %esi
	xorl	%eax, %eax
	jmp	.L14
.L28:
	xorl	%eax, %eax
	xorl	%ecx, %ecx
	jmp	.L19
.L49:
	orq	$0, -8(%rsp,%rdx)
	jmp	.L8
.L51:
	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(void) {
	while(1){
		int t;
		scanf("%d",&t);
		if(t==0) break;
		int n;
		scanf("%d",&n);
		int i,s[n],f[n];
		for(i=0;i<n;i++){
			scanf("%d %d",&s[i],&f[i]);
		}
		int a[n],sum=0;
		for(i=0;i<n;i++){
			a[i]=f[i]-s[i];
		}
		for(i=0;i<n;i++){
			sum=sum+a[i];
		}
		if(sum>=t){
			printf("OK\n");
		}
		else{
			printf("%d\n",t-sum);
		}
	}
	return 0;
}

10
3
6 11
12 15
18 22
14
2
6 14
13 20
0
 10
3
8 11
12 19
18 38
14
2
6 14
5 6
0
 10
3
8 11
12 19
18 38
8
2
6 6
5 6
0
 10
3
6 11
12 15
18 22
14
2
6 1
13 20
0
 10
3
6 11
12 15
34 22
14
2
6 14
13 20
0
 10
3
8 11
12 19
18 9
8
2
6 6
5 6
0
 10
3
10 11
12 15
18 22
14
2
6 1
13 20
0
 10
3
6 11
2 15
34 22
14
2
6 14
13 20
0
 10
3
8 11
1 27
18 22
14
2
6 14
13 18
0
 10
3
6 11
2 15
34 22
22
2
4 14
13 20
0

OK
OK
 OK
5
 OK
7
 OK
12
 14
OK
 9
7
 2
12
 4
OK
 OK
1
 4
5

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(void) {
	while(1){
		int t;
		scanf("%d",&t);
		if(t==0) break;
		int n;
		scanf("%d",&n);
		int i,s[n],f[n];
		for(i=0;i<n;i++){
			scanf("%d %d",&s[i],&f[i]);
		}
		int a[n],sum=0;
		for(i=0;i<n;i++){
			a[i]=f[i]-s[i];
		}
		for(i=0;i<n;i++){
			sum=sum+a[i];
		}
		if(sum>=t){
			printf("OK\n");
		}
		else{
			printf("%d\n",t-sum);
		}
	}
	return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d %d"
.LC2:
	.string	"OK"
.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
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$152, %rsp
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
.L21:
	movq	%rsp, %rax
	movq	%rax, %rbx
	leaq	-120(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-120(%rbp), %eax
	testl	%eax, %eax
	jne	.L2
	movq	%rbx, %rsp
	movl	$0, %eax
	movq	-56(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L22
	jmp	.L23
.L2:
	leaq	-116(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-116(%rbp), %edx
	movslq	%edx, %rax
	subq	$1, %rax
	movq	%rax, -104(%rbp)
	movslq	%edx, %rax
	movq	%rax, %r12
	movl	$0, %r13d
	movslq	%edx, %rax
	movq	%rax, %r14
	movl	$0, %r15d
	movslq	%edx, %rax
	leaq	0(,%rax,4), %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %esi
	movl	$0, %edx
	divq	%rsi
	imulq	$16, %rax, %rdx
	movq	%rdx, %rax
	andq	$-4096, %rax
	movq	%rsp, %rcx
	subq	%rax, %rcx
.L4:
	cmpq	%rcx, %rsp
	je	.L5
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L4
.L5:
	movq	%rdx, %rax
	andl	$4095, %eax
	subq	%rax, %rsp
	movq	%rdx, %rax
	andl	$4095, %eax
	testq	%rax, %rax
	je	.L6
	movq	%rdx, %rax
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L6:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -96(%rbp)
	movl	-116(%rbp), %edx
	movslq	%edx, %rax
	subq	$1, %rax
	movq	%rax, -88(%rbp)
	movslq	%edx, %rax
	movq	%rax, -144(%rbp)
	movq	$0, -136(%rbp)
	movslq	%edx, %rax
	movq	%rax, -160(%rbp)
	movq	$0, -152(%rbp)
	movslq	%edx, %rax
	leaq	0(,%rax,4), %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %edi
	movl	$0, %edx
	divq	%rdi
	imulq	$16, %rax, %rdx
	movq	%rdx, %rax
	andq	$-4096, %rax
	movq	%rsp, %rcx
	subq	%rax, %rcx
.L7:
	cmpq	%rcx, %rsp
	je	.L8
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L7
.L8:
	movq	%rdx, %rax
	andl	$4095, %eax
	subq	%rax, %rsp
	movq	%rdx, %rax
	andl	$4095, %eax
	testq	%rax, %rax
	je	.L9
	movq	%rdx, %rax
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L9:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -80(%rbp)
	movl	$0, -112(%rbp)
	jmp	.L10
.L11:
	movl	-112(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-80(%rbp), %rax
	leaq	(%rdx,%rax), %rcx
	movl	-112(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-96(%rbp), %rax
	addq	%rdx, %rax
	movq	%rcx, %rdx
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -112(%rbp)
.L10:
	movl	-116(%rbp), %eax
	cmpl	%eax, -112(%rbp)
	jl	.L11
	movl	-116(%rbp), %edx
	movslq	%edx, %rax
	subq	$1, %rax
	movq	%rax, -72(%rbp)
	movslq	%edx, %rax
	movq	%rax, -176(%rbp)
	movq	$0, -168(%rbp)
	movslq	%edx, %rax
	movq	%rax, -192(%rbp)
	movq	$0, -184(%rbp)
	movslq	%edx, %rax
	leaq	0(,%rax,4), %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %esi
	movl	$0, %edx
	divq	%rsi
	imulq	$16, %rax, %rdx
	movq	%rdx, %rax
	andq	$-4096, %rax
	movq	%rsp, %rcx
	subq	%rax, %rcx
.L12:
	cmpq	%rcx, %rsp
	je	.L13
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L12
.L13:
	movq	%rdx, %rax
	andl	$4095, %eax
	subq	%rax, %rsp
	movq	%rdx, %rax
	andl	$4095, %eax
	testq	%rax, %rax
	je	.L14
	movq	%rdx, %rax
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L14:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -64(%rbp)
	movl	$0, -108(%rbp)
	movl	$0, -112(%rbp)
	jmp	.L15
.L16:
	movq	-80(%rbp), %rdx
	movl	-112(%rbp), %eax
	cltq
	movl	(%rdx,%rax,4), %ecx
	movq	-96(%rbp), %rdx
	movl	-112(%rbp), %eax
	cltq
	movl	(%rdx,%rax,4), %eax
	subl	%eax, %ecx
	movq	-64(%rbp), %rdx
	movl	-112(%rbp), %eax
	cltq
	movl	%ecx, (%rdx,%rax,4)
	addl	$1, -112(%rbp)
.L15:
	movl	-116(%rbp), %eax
	cmpl	%eax, -112(%rbp)
	jl	.L16
	movl	$0, -112(%rbp)
	jmp	.L17
.L18:
	movq	-64(%rbp), %rdx
	movl	-112(%rbp), %eax
	cltq
	movl	(%rdx,%rax,4), %eax
	addl	%eax, -108(%rbp)
	addl	$1, -112(%rbp)
.L17:
	movl	-116(%rbp), %eax
	cmpl	%eax, -112(%rbp)
	jl	.L18
	movl	-120(%rbp), %eax
	cmpl	%eax, -108(%rbp)
	jl	.L19
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L20
.L19:
	movl	-120(%rbp), %eax
	subl	-108(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L20:
	movq	%rbx, %rsp
	jmp	.L21
.L23:
	call	__stack_chk_fail@PLT
.L22:
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	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
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d %d"
.LC2:
	.string	"OK"
.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
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$152, %rsp
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
.L21:
	movq	%rsp, %rax
	movq	%rax, %rbx
	leaq	-120(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-120(%rbp), %eax
	testl	%eax, %eax
	jne	.L2
	movq	%rbx, %rsp
	movl	$0, %eax
	movq	-56(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L22
	jmp	.L23
.L2:
	leaq	-116(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-116(%rbp), %edx
	movslq	%edx, %rax
	subq	$1, %rax
	movq	%rax, -104(%rbp)
	movslq	%edx, %rax
	movq	%rax, %r12
	movl	$0, %r13d
	movslq	%edx, %rax
	movq	%rax, %r14
	movl	$0, %r15d
	movslq	%edx, %rax
	leaq	0(,%rax,4), %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %esi
	movl	$0, %edx
	divq	%rsi
	imulq	$16, %rax, %rdx
	movq	%rdx, %rax
	andq	$-4096, %rax
	movq	%rsp, %rcx
	subq	%rax, %rcx
.L4:
	cmpq	%rcx, %rsp
	je	.L5
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L4
.L5:
	movq	%rdx, %rax
	andl	$4095, %eax
	subq	%rax, %rsp
	movq	%rdx, %rax
	andl	$4095, %eax
	testq	%rax, %rax
	je	.L6
	movq	%rdx, %rax
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L6:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -96(%rbp)
	movl	-116(%rbp), %edx
	movslq	%edx, %rax
	subq	$1, %rax
	movq	%rax, -88(%rbp)
	movslq	%edx, %rax
	movq	%rax, -144(%rbp)
	movq	$0, -136(%rbp)
	movslq	%edx, %rax
	movq	%rax, -160(%rbp)
	movq	$0, -152(%rbp)
	movslq	%edx, %rax
	leaq	0(,%rax,4), %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %edi
	movl	$0, %edx
	divq	%rdi
	imulq	$16, %rax, %rdx
	movq	%rdx, %rax
	andq	$-4096, %rax
	movq	%rsp, %rcx
	subq	%rax, %rcx
.L7:
	cmpq	%rcx, %rsp
	je	.L8
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L7
.L8:
	movq	%rdx, %rax
	andl	$4095, %eax
	subq	%rax, %rsp
	movq	%rdx, %rax
	andl	$4095, %eax
	testq	%rax, %rax
	je	.L9
	movq	%rdx, %rax
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L9:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -80(%rbp)
	movl	$0, -112(%rbp)
	jmp	.L10
.L11:
	movl	-112(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-80(%rbp), %rax
	leaq	(%rdx,%rax), %rcx
	movl	-112(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-96(%rbp), %rax
	addq	%rdx, %rax
	movq	%rcx, %rdx
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -112(%rbp)
.L10:
	movl	-116(%rbp), %eax
	cmpl	%eax, -112(%rbp)
	jl	.L11
	movl	-116(%rbp), %edx
	movslq	%edx, %rax
	subq	$1, %rax
	movq	%rax, -72(%rbp)
	movslq	%edx, %rax
	movq	%rax, -176(%rbp)
	movq	$0, -168(%rbp)
	movslq	%edx, %rax
	movq	%rax, -192(%rbp)
	movq	$0, -184(%rbp)
	movslq	%edx, %rax
	leaq	0(,%rax,4), %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %esi
	movl	$0, %edx
	divq	%rsi
	imulq	$16, %rax, %rdx
	movq	%rdx, %rax
	andq	$-4096, %rax
	movq	%rsp, %rcx
	subq	%rax, %rcx
.L12:
	cmpq	%rcx, %rsp
	je	.L13
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L12
.L13:
	movq	%rdx, %rax
	andl	$4095, %eax
	subq	%rax, %rsp
	movq	%rdx, %rax
	andl	$4095, %eax
	testq	%rax, %rax
	je	.L14
	movq	%rdx, %rax
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L14:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -64(%rbp)
	movl	$0, -108(%rbp)
	movl	$0, -112(%rbp)
	jmp	.L15
.L16:
	movq	-80(%rbp), %rdx
	movl	-112(%rbp), %eax
	cltq
	movl	(%rdx,%rax,4), %ecx
	movq	-96(%rbp), %rdx
	movl	-112(%rbp), %eax
	cltq
	movl	(%rdx,%rax,4), %eax
	subl	%eax, %ecx
	movq	-64(%rbp), %rdx
	movl	-112(%rbp), %eax
	cltq
	movl	%ecx, (%rdx,%rax,4)
	addl	$1, -112(%rbp)
.L15:
	movl	-116(%rbp), %eax
	cmpl	%eax, -112(%rbp)
	jl	.L16
	movl	$0, -112(%rbp)
	jmp	.L17
.L18:
	movq	-64(%rbp), %rdx
	movl	-112(%rbp), %eax
	cltq
	movl	(%rdx,%rax,4), %eax
	addl	%eax, -108(%rbp)
	addl	$1, -112(%rbp)
.L17:
	movl	-116(%rbp), %eax
	cmpl	%eax, -112(%rbp)
	jl	.L18
	movl	-120(%rbp), %eax
	cmpl	%eax, -108(%rbp)
	jl	.L19
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L20
.L19:
	movl	-120(%rbp), %eax
	subl	-108(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L20:
	movq	%rbx, %rsp
	jmp	.L21
.L23:
	call	__stack_chk_fail@PLT
.L22:
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	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:
