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>
#include <stdlib.h>
#include <string.h>
int main()
{
    int i,k,a,b,c,sum;
    char s[4];
    while(~scanf("%s",s))
    {
        sum=0;
        b=0;
        a=0;

        for(i=0; i<4; i++)
        {
            if(s[i]=='+')
            {
                a++;
            }
            if(s[i]=='-')
            {
                b--;
            }

        }
        sum=a+b;
        printf("%d\n",sum);
    }
    return 0;
}
```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%s"
.LC1:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB51:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	leaq	.LC1(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	leaq	.LC0(%rip), %rbx
	subq	$16, %rsp
	.cfi_def_cfa_offset 48
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rbp
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L17:
	cmpb	$45, %al
	movzbl	5(%rsp), %ecx
	movl	$1, %esi
	sete	%al
	xorl	%edx, %edx
	movzbl	%al, %eax
	negl	%eax
	cmpb	$43, %cl
	je	.L12
.L18:
	cmpb	$45, %cl
	sete	%cl
	movzbl	%cl, %ecx
	subl	%ecx, %eax
	movzbl	6(%rsp), %ecx
	cmpb	$43, %cl
	je	.L15
.L5:
	cmpb	$45, %cl
	sete	%cl
	movzbl	%cl, %ecx
	subl	%ecx, %eax
	movzbl	7(%rsp), %ecx
	cmpb	$43, %cl
	je	.L16
.L7:
	cmpb	$45, %cl
	sete	%cl
	movzbl	%cl, %ecx
	subl	%ecx, %eax
.L8:
	addl	%eax, %edx
	movq	%r12, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L9:
	xorl	%eax, %eax
	movq	%rbp, %rsi
	movq	%rbx, %rdi
	call	__isoc99_scanf@PLT
	cmpl	$-1, %eax
	je	.L2
	movzbl	4(%rsp), %eax
	cmpb	$43, %al
	jne	.L17
	movzbl	5(%rsp), %ecx
	movl	$2, %esi
	movl	$1, %edx
	xorl	%eax, %eax
	cmpb	$43, %cl
	jne	.L18
.L12:
	movzbl	6(%rsp), %ecx
	movl	%esi, %edx
	cmpb	$43, %cl
	jne	.L5
.L15:
	movzbl	7(%rsp), %ecx
	addl	$1, %edx
	cmpb	$43, %cl
	jne	.L7
.L16:
	addl	$1, %edx
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L2:
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L19
	addq	$16, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 32
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
.L19:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE51:
	.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	"%s"
.LC1:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB51:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	leaq	.LC1(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	leaq	.LC0(%rip), %rbx
	subq	$16, %rsp
	.cfi_def_cfa_offset 48
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rbp
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L17:
	cmpb	$45, %al
	movzbl	5(%rsp), %ecx
	movl	$1, %esi
	sete	%al
	xorl	%edx, %edx
	movzbl	%al, %eax
	negl	%eax
	cmpb	$43, %cl
	je	.L12
.L18:
	cmpb	$45, %cl
	sete	%cl
	movzbl	%cl, %ecx
	subl	%ecx, %eax
	movzbl	6(%rsp), %ecx
	cmpb	$43, %cl
	je	.L15
.L5:
	cmpb	$45, %cl
	sete	%cl
	movzbl	%cl, %ecx
	subl	%ecx, %eax
	movzbl	7(%rsp), %ecx
	cmpb	$43, %cl
	je	.L16
.L7:
	cmpb	$45, %cl
	sete	%cl
	movzbl	%cl, %ecx
	subl	%ecx, %eax
.L8:
	addl	%eax, %edx
	movq	%r12, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L9:
	xorl	%eax, %eax
	movq	%rbp, %rsi
	movq	%rbx, %rdi
	call	__isoc99_scanf@PLT
	cmpl	$-1, %eax
	je	.L2
	movzbl	4(%rsp), %eax
	cmpb	$43, %al
	jne	.L17
	movzbl	5(%rsp), %ecx
	movl	$2, %esi
	movl	$1, %edx
	xorl	%eax, %eax
	cmpb	$43, %cl
	jne	.L18
.L12:
	movzbl	6(%rsp), %ecx
	movl	%esi, %edx
	cmpb	$43, %cl
	jne	.L5
.L15:
	movzbl	7(%rsp), %ecx
	addl	$1, %edx
	cmpb	$43, %cl
	jne	.L7
.L16:
	addl	$1, %edx
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L2:
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L19
	addq	$16, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 32
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
.L19:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE51:
	.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	"%s"
.LC1:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB51:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	leaq	.LC1(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	leaq	.LC0(%rip), %rbx
	subq	$16, %rsp
	.cfi_def_cfa_offset 48
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rbp
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L17:
	cmpb	$45, %al
	movzbl	5(%rsp), %ecx
	movl	$1, %esi
	sete	%al
	xorl	%edx, %edx
	movzbl	%al, %eax
	negl	%eax
	cmpb	$43, %cl
	je	.L12
.L18:
	cmpb	$45, %cl
	sete	%cl
	movzbl	%cl, %ecx
	subl	%ecx, %eax
	movzbl	6(%rsp), %ecx
	cmpb	$43, %cl
	je	.L15
.L5:
	cmpb	$45, %cl
	sete	%cl
	movzbl	%cl, %ecx
	subl	%ecx, %eax
	movzbl	7(%rsp), %ecx
	cmpb	$43, %cl
	je	.L16
.L7:
	cmpb	$45, %cl
	sete	%cl
	movzbl	%cl, %ecx
	subl	%ecx, %eax
.L8:
	addl	%eax, %edx
	movq	%r12, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L9:
	xorl	%eax, %eax
	movq	%rbp, %rsi
	movq	%rbx, %rdi
	call	__isoc99_scanf@PLT
	cmpl	$-1, %eax
	je	.L2
	movzbl	4(%rsp), %eax
	cmpb	$43, %al
	jne	.L17
	movzbl	5(%rsp), %ecx
	movl	$2, %esi
	movl	$1, %edx
	xorl	%eax, %eax
	cmpb	$43, %cl
	jne	.L18
.L12:
	movzbl	6(%rsp), %ecx
	movl	%esi, %edx
	cmpb	$43, %cl
	jne	.L5
.L15:
	movzbl	7(%rsp), %ecx
	addl	$1, %edx
	cmpb	$43, %cl
	jne	.L7
.L16:
	addl	$1, %edx
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L2:
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L19
	addq	$16, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 32
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
.L19:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE51:
	.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>
#include <stdlib.h>
#include <string.h>
int main()
{
    int i,k,a,b,c,sum;
    char s[4];
    while(~scanf("%s",s))
    {
        sum=0;
        b=0;
        a=0;

        for(i=0; i<4; i++)
        {
            if(s[i]=='+')
            {
                a++;
            }
            if(s[i]=='-')
            {
                b--;
            }

        }
        sum=a+b;
        printf("%d\n",sum);
    }
    return 0;
}
```
Given the following C code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
    int i,k,a,b,c,sum;
    char s[4];
    while(~scanf("%s",s))
    {
        sum=0;
        b=0;
        a=0;

        for(i=0; i<4; i++)
        {
            if(s[i]=='+')
            {
                a++;
            }
            if(s[i]=='-')
            {
                b--;
            }

        }
        sum=a+b;
        printf("%d\n",sum);
    }
    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:

--+-
 ++-+
 ++++
 -+-+
 ---+
 +---
 -+++
 +++-
 ++--
 +--+

-2
 2
 4
 0
 -2
 -2
 2
 2
 0
 0

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>
#include <stdlib.h>
#include <string.h>
int main()
{
    int i,k,a,b,c,sum;
    char s[4];
    while(~scanf("%s",s))
    {
        sum=0;
        b=0;
        a=0;

        for(i=0; i<4; i++)
        {
            if(s[i]=='+')
            {
                a++;
            }
            if(s[i]=='-')
            {
                b--;
            }

        }
        sum=a+b;
        printf("%d\n",sum);
    }
    return 0;
}
```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%s"
.LC1:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB51:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	leaq	.LC1(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	leaq	.LC0(%rip), %rbx
	subq	$16, %rsp
	.cfi_def_cfa_offset 48
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rbp
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L17:
	cmpb	$45, %al
	movzbl	5(%rsp), %ecx
	movl	$1, %esi
	sete	%al
	xorl	%edx, %edx
	movzbl	%al, %eax
	negl	%eax
	cmpb	$43, %cl
	je	.L12
.L18:
	cmpb	$45, %cl
	sete	%cl
	movzbl	%cl, %ecx
	subl	%ecx, %eax
	movzbl	6(%rsp), %ecx
	cmpb	$43, %cl
	je	.L15
.L5:
	cmpb	$45, %cl
	sete	%cl
	movzbl	%cl, %ecx
	subl	%ecx, %eax
	movzbl	7(%rsp), %ecx
	cmpb	$43, %cl
	je	.L16
.L7:
	cmpb	$45, %cl
	sete	%cl
	movzbl	%cl, %ecx
	subl	%ecx, %eax
.L8:
	addl	%eax, %edx
	movq	%r12, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L9:
	xorl	%eax, %eax
	movq	%rbp, %rsi
	movq	%rbx, %rdi
	call	__isoc99_scanf@PLT
	cmpl	$-1, %eax
	je	.L2
	movzbl	4(%rsp), %eax
	cmpb	$43, %al
	jne	.L17
	movzbl	5(%rsp), %ecx
	movl	$2, %esi
	movl	$1, %edx
	xorl	%eax, %eax
	cmpb	$43, %cl
	jne	.L18
.L12:
	movzbl	6(%rsp), %ecx
	movl	%esi, %edx
	cmpb	$43, %cl
	jne	.L5
.L15:
	movzbl	7(%rsp), %ecx
	addl	$1, %edx
	cmpb	$43, %cl
	jne	.L7
.L16:
	addl	$1, %edx
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L2:
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L19
	addq	$16, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 32
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
.L19:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE51:
	.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	"%s"
.LC1:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB51:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	leaq	.LC1(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	leaq	.LC0(%rip), %rbx
	subq	$16, %rsp
	.cfi_def_cfa_offset 48
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rbp
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L17:
	cmpb	$45, %al
	movzbl	5(%rsp), %ecx
	movl	$1, %esi
	sete	%al
	xorl	%edx, %edx
	movzbl	%al, %eax
	negl	%eax
	cmpb	$43, %cl
	je	.L12
.L18:
	cmpb	$45, %cl
	sete	%cl
	movzbl	%cl, %ecx
	subl	%ecx, %eax
	movzbl	6(%rsp), %ecx
	cmpb	$43, %cl
	je	.L15
.L5:
	cmpb	$45, %cl
	sete	%cl
	movzbl	%cl, %ecx
	subl	%ecx, %eax
	movzbl	7(%rsp), %ecx
	cmpb	$43, %cl
	je	.L16
.L7:
	cmpb	$45, %cl
	sete	%cl
	movzbl	%cl, %ecx
	subl	%ecx, %eax
.L8:
	addl	%eax, %edx
	movq	%r12, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L9:
	xorl	%eax, %eax
	movq	%rbp, %rsi
	movq	%rbx, %rdi
	call	__isoc99_scanf@PLT
	cmpl	$-1, %eax
	je	.L2
	movzbl	4(%rsp), %eax
	cmpb	$43, %al
	jne	.L17
	movzbl	5(%rsp), %ecx
	movl	$2, %esi
	movl	$1, %edx
	xorl	%eax, %eax
	cmpb	$43, %cl
	jne	.L18
.L12:
	movzbl	6(%rsp), %ecx
	movl	%esi, %edx
	cmpb	$43, %cl
	jne	.L5
.L15:
	movzbl	7(%rsp), %ecx
	addl	$1, %edx
	cmpb	$43, %cl
	jne	.L7
.L16:
	addl	$1, %edx
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L2:
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L19
	addq	$16, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 32
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
.L19:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE51:
	.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:
```