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() {
    char c;
    int i, s = 0;

    while(1) {
        c = getchar();
        if (c == '\n') {
            if (s <= 0) break;
            printf("%d\n", s);
            s = 0;
        }else{
            i = c - '0';
            s += i;
        }
    }
    return 0;
}
```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	xorl	%r12d, %r12d
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	leaq	.LC0(%rip), %rbx
	subq	$8, %rsp
	.cfi_def_cfa_offset 32
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L2:
	leal	-48(%r12,%rdx), %r12d
.L4:
	movq	stdin(%rip), %rdi
	call	getc@PLT
	movsbl	%al, %edx
	cmpb	$10, %al
	jne	.L2
	testl	%r12d, %r12d
	jle	.L3
	movl	%r12d, %edx
	movq	%rbx, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	stdin(%rip), %rdi
	call	getc@PLT
	movsbl	%al, %edx
	cmpb	$10, %al
	je	.L3
	xorl	%r12d, %r12d
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L3:
	addq	$8, %rsp
	.cfi_def_cfa_offset 24
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.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:
```

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"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	xorl	%r12d, %r12d
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	leaq	.LC0(%rip), %rbx
	subq	$8, %rsp
	.cfi_def_cfa_offset 32
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L2:
	leal	-48(%r12,%rdx), %r12d
.L4:
	movq	stdin(%rip), %rdi
	call	getc@PLT
	movsbl	%al, %edx
	cmpb	$10, %al
	jne	.L2
	testl	%r12d, %r12d
	jle	.L3
	movl	%r12d, %edx
	movq	%rbx, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	stdin(%rip), %rdi
	call	getc@PLT
	movsbl	%al, %edx
	cmpb	$10, %al
	je	.L3
	xorl	%r12d, %r12d
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L3:
	addq	$8, %rsp
	.cfi_def_cfa_offset 24
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.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
```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	xorl	%r12d, %r12d
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	leaq	.LC0(%rip), %rbx
	subq	$8, %rsp
	.cfi_def_cfa_offset 32
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L2:
	leal	-48(%r12,%rdx), %r12d
.L4:
	movq	stdin(%rip), %rdi
	call	getc@PLT
	movsbl	%al, %edx
	cmpb	$10, %al
	jne	.L2
	testl	%r12d, %r12d
	jle	.L3
	movl	%r12d, %edx
	movq	%rbx, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	stdin(%rip), %rdi
	call	getc@PLT
	movsbl	%al, %edx
	cmpb	$10, %al
	je	.L3
	xorl	%r12d, %r12d
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L3:
	addq	$8, %rsp
	.cfi_def_cfa_offset 24
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.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:
```
```c
#include <stdio.h>

int main() {
    char c;
    int i, s = 0;

    while(1) {
        c = getchar();
        if (c == '\n') {
            if (s <= 0) break;
            printf("%d\n", s);
            s = 0;
        }else{
            i = c - '0';
            s += i;
        }
    }
    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() {
    char c;
    int i, s = 0;

    while(1) {
        c = getchar();
        if (c == '\n') {
            if (s <= 0) break;
            printf("%d\n", s);
            s = 0;
        }else{
            i = c - '0';
            s += i;
        }
    }
    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:

123
55
1001
0
 123
69
1000
0
 123
69
1010
0
 123
69
1110
0
 123
55
0001
0
 123
55
1101
0
 123
69
1111
0
 123
23
1001
0
 123
65
0001
0
 123
151
1101
0

6
10
2
 6
15
1
 6
15
2
 6
15
3
 6
10
1
 6
10
3
 6
15
4
 6
5
2
 6
11
1
 6
7
3

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() {
    char c;
    int i, s = 0;

    while(1) {
        c = getchar();
        if (c == '\n') {
            if (s <= 0) break;
            printf("%d\n", s);
            s = 0;
        }else{
            i = c - '0';
            s += i;
        }
    }
    return 0;
}
```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	xorl	%r12d, %r12d
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	leaq	.LC0(%rip), %rbx
	subq	$8, %rsp
	.cfi_def_cfa_offset 32
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L2:
	leal	-48(%r12,%rdx), %r12d
.L4:
	movq	stdin(%rip), %rdi
	call	getc@PLT
	movsbl	%al, %edx
	cmpb	$10, %al
	jne	.L2
	testl	%r12d, %r12d
	jle	.L3
	movl	%r12d, %edx
	movq	%rbx, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	stdin(%rip), %rdi
	call	getc@PLT
	movsbl	%al, %edx
	cmpb	$10, %al
	je	.L3
	xorl	%r12d, %r12d
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L3:
	addq	$8, %rsp
	.cfi_def_cfa_offset 24
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.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:
```

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"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	xorl	%r12d, %r12d
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	leaq	.LC0(%rip), %rbx
	subq	$8, %rsp
	.cfi_def_cfa_offset 32
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L2:
	leal	-48(%r12,%rdx), %r12d
.L4:
	movq	stdin(%rip), %rdi
	call	getc@PLT
	movsbl	%al, %edx
	cmpb	$10, %al
	jne	.L2
	testl	%r12d, %r12d
	jle	.L3
	movl	%r12d, %edx
	movq	%rbx, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	stdin(%rip), %rdi
	call	getc@PLT
	movsbl	%al, %edx
	cmpb	$10, %al
	je	.L3
	xorl	%r12d, %r12d
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L3:
	addq	$8, %rsp
	.cfi_def_cfa_offset 24
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.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:
```