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 main(void){
  int N,R;
  scanf("%d",&N);
  while(N > 1000){
    N = N - 1000;
  }
  R = 1000 - N;
  printf("%d",R);
  return 0;
}```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
	.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
	leaq	.LC0(%rip), %rbp
	movq	%rbp, %rdi
	subq	$16, %rsp
	.cfi_def_cfa_offset 32
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %ecx
	cmpl	$1000, %ecx
	jle	.L2
	leal	-1001(%rcx), %edx
	movq	%rdx, %rax
	imulq	$274877907, %rdx, %rdx
	shrq	$38, %rdx
	addl	$1, %edx
	cmpl	$2999, %eax
	jbe	.L7
	movd	%ecx, %xmm4
	movl	%edx, %esi
	movdqa	.LC2(%rip), %xmm3
	xorl	%eax, %eax
	pshufd	$0, %xmm4, %xmm1
	movdqa	.LC3(%rip), %xmm2
	paddd	.LC1(%rip), %xmm1
	shrl	$2, %esi
	.p2align 4,,10
	.p2align 3
.L4:
	movdqa	%xmm1, %xmm0
	addl	$1, %eax
	paddd	%xmm3, %xmm1
	paddd	%xmm2, %xmm0
	cmpl	%esi, %eax
	jne	.L4
	movl	%edx, %esi
	pshufd	$255, %xmm0, %xmm0
	andl	$-4, %esi
	imull	$-1000, %esi, %eax
	addl	%ecx, %eax
	movd	%xmm0, %ecx
	cmpl	%esi, %edx
	je	.L5
.L3:
	leal	-1000(%rax), %ecx
	cmpl	$1000, %ecx
	jle	.L5
	leal	-2000(%rax), %ecx
	cmpl	$1000, %ecx
	jle	.L5
	leal	-3000(%rax), %ecx
.L5:
	movl	%ecx, 4(%rsp)
.L2:
	movl	$1000, %edx
	xorl	%eax, %eax
	movq	%rbp, %rsi
	movl	$1, %edi
	subl	%ecx, %edx
	call	__printf_chk@PLT
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L12
	addq	$16, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 16
	xorl	%eax, %eax
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
.L7:
	.cfi_restore_state
	movl	%ecx, %eax
	jmp	.L3
.L12:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC1:
	.long	0
	.long	-1000
	.long	-2000
	.long	-3000
	.align 16
.LC2:
	.long	-4000
	.long	-4000
	.long	-4000
	.long	-4000
	.align 16
.LC3:
	.long	-1000
	.long	-1000
	.long	-1000
	.long	-1000
	.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"
	.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
	leaq	.LC0(%rip), %rbp
	movq	%rbp, %rdi
	subq	$16, %rsp
	.cfi_def_cfa_offset 32
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %ecx
	cmpl	$1000, %ecx
	jle	.L2
	leal	-1001(%rcx), %edx
	movq	%rdx, %rax
	imulq	$274877907, %rdx, %rdx
	shrq	$38, %rdx
	addl	$1, %edx
	cmpl	$2999, %eax
	jbe	.L7
	movd	%ecx, %xmm4
	movl	%edx, %esi
	movdqa	.LC2(%rip), %xmm3
	xorl	%eax, %eax
	pshufd	$0, %xmm4, %xmm1
	movdqa	.LC3(%rip), %xmm2
	paddd	.LC1(%rip), %xmm1
	shrl	$2, %esi
	.p2align 4,,10
	.p2align 3
.L4:
	movdqa	%xmm1, %xmm0
	addl	$1, %eax
	paddd	%xmm3, %xmm1
	paddd	%xmm2, %xmm0
	cmpl	%esi, %eax
	jne	.L4
	movl	%edx, %esi
	pshufd	$255, %xmm0, %xmm0
	andl	$-4, %esi
	imull	$-1000, %esi, %eax
	addl	%ecx, %eax
	movd	%xmm0, %ecx
	cmpl	%esi, %edx
	je	.L5
.L3:
	leal	-1000(%rax), %ecx
	cmpl	$1000, %ecx
	jle	.L5
	leal	-2000(%rax), %ecx
	cmpl	$1000, %ecx
	jle	.L5
	leal	-3000(%rax), %ecx
.L5:
	movl	%ecx, 4(%rsp)
.L2:
	movl	$1000, %edx
	xorl	%eax, %eax
	movq	%rbp, %rsi
	movl	$1, %edi
	subl	%ecx, %edx
	call	__printf_chk@PLT
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L12
	addq	$16, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 16
	xorl	%eax, %eax
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
.L7:
	.cfi_restore_state
	movl	%ecx, %eax
	jmp	.L3
.L12:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC1:
	.long	0
	.long	-1000
	.long	-2000
	.long	-3000
	.align 16
.LC2:
	.long	-4000
	.long	-4000
	.long	-4000
	.long	-4000
	.align 16
.LC3:
	.long	-1000
	.long	-1000
	.long	-1000
	.long	-1000
	.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"
	.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
	leaq	.LC0(%rip), %rbp
	movq	%rbp, %rdi
	subq	$16, %rsp
	.cfi_def_cfa_offset 32
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %ecx
	cmpl	$1000, %ecx
	jle	.L2
	leal	-1001(%rcx), %edx
	movq	%rdx, %rax
	imulq	$274877907, %rdx, %rdx
	shrq	$38, %rdx
	addl	$1, %edx
	cmpl	$2999, %eax
	jbe	.L7
	movd	%ecx, %xmm4
	movl	%edx, %esi
	movdqa	.LC2(%rip), %xmm3
	xorl	%eax, %eax
	pshufd	$0, %xmm4, %xmm1
	movdqa	.LC3(%rip), %xmm2
	paddd	.LC1(%rip), %xmm1
	shrl	$2, %esi
	.p2align 4,,10
	.p2align 3
.L4:
	movdqa	%xmm1, %xmm0
	addl	$1, %eax
	paddd	%xmm3, %xmm1
	paddd	%xmm2, %xmm0
	cmpl	%esi, %eax
	jne	.L4
	movl	%edx, %esi
	pshufd	$255, %xmm0, %xmm0
	andl	$-4, %esi
	imull	$-1000, %esi, %eax
	addl	%ecx, %eax
	movd	%xmm0, %ecx
	cmpl	%esi, %edx
	je	.L5
.L3:
	leal	-1000(%rax), %ecx
	cmpl	$1000, %ecx
	jle	.L5
	leal	-2000(%rax), %ecx
	cmpl	$1000, %ecx
	jle	.L5
	leal	-3000(%rax), %ecx
.L5:
	movl	%ecx, 4(%rsp)
.L2:
	movl	$1000, %edx
	xorl	%eax, %eax
	movq	%rbp, %rsi
	movl	$1, %edi
	subl	%ecx, %edx
	call	__printf_chk@PLT
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L12
	addq	$16, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 16
	xorl	%eax, %eax
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
.L7:
	.cfi_restore_state
	movl	%ecx, %eax
	jmp	.L3
.L12:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC1:
	.long	0
	.long	-1000
	.long	-2000
	.long	-3000
	.align 16
.LC2:
	.long	-4000
	.long	-4000
	.long	-4000
	.long	-4000
	.align 16
.LC3:
	.long	-1000
	.long	-1000
	.long	-1000
	.long	-1000
	.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 main(void){
  int N,R;
  scanf("%d",&N);
  while(N > 1000){
    N = N - 1000;
  }
  R = 1000 - N;
  printf("%d",R);
  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 main(void){
  int N,R;
  scanf("%d",&N);
  while(N > 1000){
    N = N - 1000;
  }
  R = 1000 - N;
  printf("%d",R);
  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:

5614
 2651
 636
 975
 860
 1858
 541
 209
 1054
 89

386 349 364 25 140 142 459 791 946 911
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 main(void){
  int N,R;
  scanf("%d",&N);
  while(N > 1000){
    N = N - 1000;
  }
  R = 1000 - N;
  printf("%d",R);
  return 0;
}```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
	.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
	leaq	.LC0(%rip), %rbp
	movq	%rbp, %rdi
	subq	$16, %rsp
	.cfi_def_cfa_offset 32
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %ecx
	cmpl	$1000, %ecx
	jle	.L2
	leal	-1001(%rcx), %edx
	movq	%rdx, %rax
	imulq	$274877907, %rdx, %rdx
	shrq	$38, %rdx
	addl	$1, %edx
	cmpl	$2999, %eax
	jbe	.L7
	movd	%ecx, %xmm4
	movl	%edx, %esi
	movdqa	.LC2(%rip), %xmm3
	xorl	%eax, %eax
	pshufd	$0, %xmm4, %xmm1
	movdqa	.LC3(%rip), %xmm2
	paddd	.LC1(%rip), %xmm1
	shrl	$2, %esi
	.p2align 4,,10
	.p2align 3
.L4:
	movdqa	%xmm1, %xmm0
	addl	$1, %eax
	paddd	%xmm3, %xmm1
	paddd	%xmm2, %xmm0
	cmpl	%esi, %eax
	jne	.L4
	movl	%edx, %esi
	pshufd	$255, %xmm0, %xmm0
	andl	$-4, %esi
	imull	$-1000, %esi, %eax
	addl	%ecx, %eax
	movd	%xmm0, %ecx
	cmpl	%esi, %edx
	je	.L5
.L3:
	leal	-1000(%rax), %ecx
	cmpl	$1000, %ecx
	jle	.L5
	leal	-2000(%rax), %ecx
	cmpl	$1000, %ecx
	jle	.L5
	leal	-3000(%rax), %ecx
.L5:
	movl	%ecx, 4(%rsp)
.L2:
	movl	$1000, %edx
	xorl	%eax, %eax
	movq	%rbp, %rsi
	movl	$1, %edi
	subl	%ecx, %edx
	call	__printf_chk@PLT
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L12
	addq	$16, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 16
	xorl	%eax, %eax
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
.L7:
	.cfi_restore_state
	movl	%ecx, %eax
	jmp	.L3
.L12:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC1:
	.long	0
	.long	-1000
	.long	-2000
	.long	-3000
	.align 16
.LC2:
	.long	-4000
	.long	-4000
	.long	-4000
	.long	-4000
	.align 16
.LC3:
	.long	-1000
	.long	-1000
	.long	-1000
	.long	-1000
	.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"
	.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
	leaq	.LC0(%rip), %rbp
	movq	%rbp, %rdi
	subq	$16, %rsp
	.cfi_def_cfa_offset 32
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %ecx
	cmpl	$1000, %ecx
	jle	.L2
	leal	-1001(%rcx), %edx
	movq	%rdx, %rax
	imulq	$274877907, %rdx, %rdx
	shrq	$38, %rdx
	addl	$1, %edx
	cmpl	$2999, %eax
	jbe	.L7
	movd	%ecx, %xmm4
	movl	%edx, %esi
	movdqa	.LC2(%rip), %xmm3
	xorl	%eax, %eax
	pshufd	$0, %xmm4, %xmm1
	movdqa	.LC3(%rip), %xmm2
	paddd	.LC1(%rip), %xmm1
	shrl	$2, %esi
	.p2align 4,,10
	.p2align 3
.L4:
	movdqa	%xmm1, %xmm0
	addl	$1, %eax
	paddd	%xmm3, %xmm1
	paddd	%xmm2, %xmm0
	cmpl	%esi, %eax
	jne	.L4
	movl	%edx, %esi
	pshufd	$255, %xmm0, %xmm0
	andl	$-4, %esi
	imull	$-1000, %esi, %eax
	addl	%ecx, %eax
	movd	%xmm0, %ecx
	cmpl	%esi, %edx
	je	.L5
.L3:
	leal	-1000(%rax), %ecx
	cmpl	$1000, %ecx
	jle	.L5
	leal	-2000(%rax), %ecx
	cmpl	$1000, %ecx
	jle	.L5
	leal	-3000(%rax), %ecx
.L5:
	movl	%ecx, 4(%rsp)
.L2:
	movl	$1000, %edx
	xorl	%eax, %eax
	movq	%rbp, %rsi
	movl	$1, %edi
	subl	%ecx, %edx
	call	__printf_chk@PLT
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L12
	addq	$16, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 16
	xorl	%eax, %eax
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
.L7:
	.cfi_restore_state
	movl	%ecx, %eax
	jmp	.L3
.L12:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC1:
	.long	0
	.long	-1000
	.long	-2000
	.long	-3000
	.align 16
.LC2:
	.long	-4000
	.long	-4000
	.long	-4000
	.long	-4000
	.align 16
.LC3:
	.long	-1000
	.long	-1000
	.long	-1000
	.long	-1000
	.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:
```