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

```c
v,c,s,a;
main(){
	for(;scanf("%d%c",&v,&c),v;){
		s+=v>10?10:v;
		a|=v==1;
		if(c=='\n'){
			printf("%d\n",a&&s+10<22?s+10:s>21?0:s);
			s=a=0;
		}
	}
	exit(0);
}```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d\n"
.LC1:
	.string	"%d%c"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	leaq	.LC0(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	leaq	c(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	leaq	v(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	leaq	.LC1(%rip), %rbx
	subq	$8, %rsp
	.cfi_def_cfa_offset 48
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L6:
	movl	$10, %esi
	cmpl	%esi, %eax
	cmovle	%eax, %esi
	addl	s(%rip), %esi
	cmpl	$1, %eax
	sete	%al
	movl	%esi, s(%rip)
	movzbl	%al, %eax
	orl	a(%rip), %eax
	cmpl	$10, c(%rip)
	movl	%eax, a(%rip)
	je	.L17
.L3:
	movq	%r12, %rdx
	movq	%rbp, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	scanf@PLT
	movl	v(%rip), %eax
	testl	%eax, %eax
	jne	.L6
	xorl	%edi, %edi
	call	exit@PLT
	.p2align 4,,10
	.p2align 3
.L17:
	cmpl	$11, %esi
	jg	.L4
	testl	%eax, %eax
	jne	.L18
.L4:
	xorl	%eax, %eax
	cmpl	$22, %esi
	cmovge	%eax, %esi
.L5:
	movq	%r13, %rdi
	xorl	%eax, %eax
	call	printf@PLT
	movl	$0, a(%rip)
	movl	$0, s(%rip)
	jmp	.L3
.L18:
	addl	$10, %esi
	jmp	.L5
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	a
	.bss
	.align 4
	.type	a, @object
	.size	a, 4
a:
	.zero	4
	.globl	s
	.align 4
	.type	s, @object
	.size	s, 4
s:
	.zero	4
	.globl	c
	.align 4
	.type	c, @object
	.size	c, 4
c:
	.zero	4
	.globl	v
	.align 4
	.type	v, @object
	.size	v, 4
v:
	.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\n"
.LC1:
	.string	"%d%c"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	leaq	.LC0(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	leaq	c(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	leaq	v(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	leaq	.LC1(%rip), %rbx
	subq	$8, %rsp
	.cfi_def_cfa_offset 48
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L6:
	movl	$10, %esi
	cmpl	%esi, %eax
	cmovle	%eax, %esi
	addl	s(%rip), %esi
	cmpl	$1, %eax
	sete	%al
	movl	%esi, s(%rip)
	movzbl	%al, %eax
	orl	a(%rip), %eax
	cmpl	$10, c(%rip)
	movl	%eax, a(%rip)
	je	.L17
.L3:
	movq	%r12, %rdx
	movq	%rbp, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	scanf@PLT
	movl	v(%rip), %eax
	testl	%eax, %eax
	jne	.L6
	xorl	%edi, %edi
	call	exit@PLT
	.p2align 4,,10
	.p2align 3
.L17:
	cmpl	$11, %esi
	jg	.L4
	testl	%eax, %eax
	jne	.L18
.L4:
	xorl	%eax, %eax
	cmpl	$22, %esi
	cmovge	%eax, %esi
.L5:
	movq	%r13, %rdi
	xorl	%eax, %eax
	call	printf@PLT
	movl	$0, a(%rip)
	movl	$0, s(%rip)
	jmp	.L3
.L18:
	addl	$10, %esi
	jmp	.L5
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	a
	.bss
	.align 4
	.type	a, @object
	.size	a, 4
a:
	.zero	4
	.globl	s
	.align 4
	.type	s, @object
	.size	s, 4
s:
	.zero	4
	.globl	c
	.align 4
	.type	c, @object
	.size	c, 4
c:
	.zero	4
	.globl	v
	.align 4
	.type	v, @object
	.size	v, 4
v:
	.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\n"
.LC1:
	.string	"%d%c"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	leaq	.LC0(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	leaq	c(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	leaq	v(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	leaq	.LC1(%rip), %rbx
	subq	$8, %rsp
	.cfi_def_cfa_offset 48
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L6:
	movl	$10, %esi
	cmpl	%esi, %eax
	cmovle	%eax, %esi
	addl	s(%rip), %esi
	cmpl	$1, %eax
	sete	%al
	movl	%esi, s(%rip)
	movzbl	%al, %eax
	orl	a(%rip), %eax
	cmpl	$10, c(%rip)
	movl	%eax, a(%rip)
	je	.L17
.L3:
	movq	%r12, %rdx
	movq	%rbp, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	scanf@PLT
	movl	v(%rip), %eax
	testl	%eax, %eax
	jne	.L6
	xorl	%edi, %edi
	call	exit@PLT
	.p2align 4,,10
	.p2align 3
.L17:
	cmpl	$11, %esi
	jg	.L4
	testl	%eax, %eax
	jne	.L18
.L4:
	xorl	%eax, %eax
	cmpl	$22, %esi
	cmovge	%eax, %esi
.L5:
	movq	%r13, %rdi
	xorl	%eax, %eax
	call	printf@PLT
	movl	$0, a(%rip)
	movl	$0, s(%rip)
	jmp	.L3
.L18:
	addl	$10, %esi
	jmp	.L5
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	a
	.bss
	.align 4
	.type	a, @object
	.size	a, 4
a:
	.zero	4
	.globl	s
	.align 4
	.type	s, @object
	.size	s, 4
s:
	.zero	4
	.globl	c
	.align 4
	.type	c, @object
	.size	c, 4
c:
	.zero	4
	.globl	v
	.align 4
	.type	v, @object
	.size	v, 4
v:
	.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
v,c,s,a;
main(){
	for(;scanf("%d%c",&v,&c),v;){
		s+=v>10?10:v;
		a|=v==1;
		if(c=='\n'){
			printf("%d\n",a&&s+10<22?s+10:s>21?0:s);
			s=a=0;
		}
	}
	exit(0);
}```
Given the following C code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
v,c,s,a;
main(){
	for(;scanf("%d%c",&v,&c),v;){
		s+=v>10?10:v;
		a|=v==1;
		if(c=='\n'){
			printf("%d\n",a&&s+10<22?s+10:s>21?0:s);
			s=a=0;
		}
	}
	exit(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:

1
7 7 7
7 7 8
12 1
10 1 2
0
 1
7 7 7
7 7 8
10 1
10 1 1
0
 1
7 7 7
7 7 8
2 1
10 2 1
0
 1
7 9 7
7 7 8
2 1
10 2 1
0
 1
7 9 7
1 9 8
2 1
10 2 1
0
 1
7 4 7
1 9 8
2 1
10 2 1
0
 1
7 4 2
1 9 8
2 1
10 2 1
0
 1
7 3 2
1 9 8
2 1
10 2 1
0
 1
7 3 4
1 9 8
2 1
10 2 1
0
 1
7 3 4
1 9 8
2 1
10 3 1
0

11
21
0
21
13
 11
21
0
21
12
 11
21
0
13
13
 11
0
0
13
13
 11
0
18
13
13
 11
18
18
13
13
 11
13
18
13
13
 11
12
18
13
13
 11
14
18
13
13
 11
14
18
13
14

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

```c
v,c,s,a;
main(){
	for(;scanf("%d%c",&v,&c),v;){
		s+=v>10?10:v;
		a|=v==1;
		if(c=='\n'){
			printf("%d\n",a&&s+10<22?s+10:s>21?0:s);
			s=a=0;
		}
	}
	exit(0);
}```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d\n"
.LC1:
	.string	"%d%c"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	leaq	.LC0(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	leaq	c(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	leaq	v(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	leaq	.LC1(%rip), %rbx
	subq	$8, %rsp
	.cfi_def_cfa_offset 48
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L6:
	movl	$10, %esi
	cmpl	%esi, %eax
	cmovle	%eax, %esi
	addl	s(%rip), %esi
	cmpl	$1, %eax
	sete	%al
	movl	%esi, s(%rip)
	movzbl	%al, %eax
	orl	a(%rip), %eax
	cmpl	$10, c(%rip)
	movl	%eax, a(%rip)
	je	.L17
.L3:
	movq	%r12, %rdx
	movq	%rbp, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	scanf@PLT
	movl	v(%rip), %eax
	testl	%eax, %eax
	jne	.L6
	xorl	%edi, %edi
	call	exit@PLT
	.p2align 4,,10
	.p2align 3
.L17:
	cmpl	$11, %esi
	jg	.L4
	testl	%eax, %eax
	jne	.L18
.L4:
	xorl	%eax, %eax
	cmpl	$22, %esi
	cmovge	%eax, %esi
.L5:
	movq	%r13, %rdi
	xorl	%eax, %eax
	call	printf@PLT
	movl	$0, a(%rip)
	movl	$0, s(%rip)
	jmp	.L3
.L18:
	addl	$10, %esi
	jmp	.L5
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	a
	.bss
	.align 4
	.type	a, @object
	.size	a, 4
a:
	.zero	4
	.globl	s
	.align 4
	.type	s, @object
	.size	s, 4
s:
	.zero	4
	.globl	c
	.align 4
	.type	c, @object
	.size	c, 4
c:
	.zero	4
	.globl	v
	.align 4
	.type	v, @object
	.size	v, 4
v:
	.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\n"
.LC1:
	.string	"%d%c"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	leaq	.LC0(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	leaq	c(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	leaq	v(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	leaq	.LC1(%rip), %rbx
	subq	$8, %rsp
	.cfi_def_cfa_offset 48
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L6:
	movl	$10, %esi
	cmpl	%esi, %eax
	cmovle	%eax, %esi
	addl	s(%rip), %esi
	cmpl	$1, %eax
	sete	%al
	movl	%esi, s(%rip)
	movzbl	%al, %eax
	orl	a(%rip), %eax
	cmpl	$10, c(%rip)
	movl	%eax, a(%rip)
	je	.L17
.L3:
	movq	%r12, %rdx
	movq	%rbp, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	scanf@PLT
	movl	v(%rip), %eax
	testl	%eax, %eax
	jne	.L6
	xorl	%edi, %edi
	call	exit@PLT
	.p2align 4,,10
	.p2align 3
.L17:
	cmpl	$11, %esi
	jg	.L4
	testl	%eax, %eax
	jne	.L18
.L4:
	xorl	%eax, %eax
	cmpl	$22, %esi
	cmovge	%eax, %esi
.L5:
	movq	%r13, %rdi
	xorl	%eax, %eax
	call	printf@PLT
	movl	$0, a(%rip)
	movl	$0, s(%rip)
	jmp	.L3
.L18:
	addl	$10, %esi
	jmp	.L5
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	a
	.bss
	.align 4
	.type	a, @object
	.size	a, 4
a:
	.zero	4
	.globl	s
	.align 4
	.type	s, @object
	.size	s, 4
s:
	.zero	4
	.globl	c
	.align 4
	.type	c, @object
	.size	c, 4
c:
	.zero	4
	.globl	v
	.align 4
	.type	v, @object
	.size	v, 4
v:
	.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:
```