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>
#include<string.h>
int main(void)
{
    char s[100000]={};
    scanf("%s",s);
    int a[100000]={};
    int count=0;
    int p=0;
    int po=0;
    char c=s[0];
    int len=strlen(s);
    //printf("%d",len);
    while(po<len)
    {
        if(c==s[po])
        {
            count++;
            po++;
        }
        else
        {
            a[p]=count;
            p++;
            count=1;
            c=s[po];
            po++;
        }
    }
    a[p]=count;
    int leng=0;
    while(a[leng]!=NULL)leng++;
    //printf("%d\n",leng);
    int minki=111111;
    int mingu=111111;
    int rightsum=0;
    int leftsum=0;
    for(int pp=0;pp<leng;pp+=2)
    {
        rightsum=0;
        leftsum=0;
        for(int q=pp+1;q<leng;q++)rightsum+=a[q];
        for(int r=pp-1;r>=0;r--)leftsum+=a[r];
        if(minki>rightsum && rightsum>=leftsum)minki=rightsum;
        if(minki>leftsum&&rightsum<=leftsum)minki=leftsum;
    }
    for(int ss=1;ss<leng;ss+=2)
    {
        rightsum=0;
        leftsum=0;
        for(int t=ss+1;t<leng;t++)rightsum+=a[t];
        for(int u=ss-1;u>=0;u--)leftsum+=a[u];
        if(mingu>rightsum&& rightsum>=leftsum)mingu=rightsum;
        if(mingu>leftsum&&rightsum<=leftsum)mingu=leftsum;
    }
    //printf("%d%d",minki,mingu);
    if(a[1]==0)printf("%d",len);
    else if(mingu>minki)printf("%d",mingu);
    else printf("%d",minki);
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%s"
.LC1:
	.string	"%d"
	.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
	leaq	-499712(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$368, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movq	$0, -100016(%rbp)
	movq	$0, -100008(%rbp)
	leaq	-100000(%rbp), %rax
	movl	$99984, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	leaq	-100016(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-500016(%rbp), %rax
	movl	$400000, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	movl	$0, -500076(%rbp)
	movl	$0, -500072(%rbp)
	movl	$0, -500068(%rbp)
	movzbl	-100016(%rbp), %eax
	movb	%al, -500077(%rbp)
	leaq	-100016(%rbp), %rax
	movq	%rax, %rdi
	call	strlen@PLT
	movl	%eax, -500020(%rbp)
	jmp	.L2
.L4:
	movl	-500068(%rbp), %eax
	cltq
	movzbl	-100016(%rbp,%rax), %eax
	cmpb	%al, -500077(%rbp)
	jne	.L3
	addl	$1, -500076(%rbp)
	addl	$1, -500068(%rbp)
	jmp	.L2
.L3:
	movl	-500072(%rbp), %eax
	cltq
	movl	-500076(%rbp), %edx
	movl	%edx, -500016(%rbp,%rax,4)
	addl	$1, -500072(%rbp)
	movl	$1, -500076(%rbp)
	movl	-500068(%rbp), %eax
	cltq
	movzbl	-100016(%rbp,%rax), %eax
	movb	%al, -500077(%rbp)
	addl	$1, -500068(%rbp)
.L2:
	movl	-500068(%rbp), %eax
	cmpl	-500020(%rbp), %eax
	jl	.L4
	movl	-500072(%rbp), %eax
	cltq
	movl	-500076(%rbp), %edx
	movl	%edx, -500016(%rbp,%rax,4)
	movl	$0, -500064(%rbp)
	jmp	.L5
.L6:
	addl	$1, -500064(%rbp)
.L5:
	movl	-500064(%rbp), %eax
	cltq
	movl	-500016(%rbp,%rax,4), %eax
	testl	%eax, %eax
	jne	.L6
	movl	$111111, -500060(%rbp)
	movl	$111111, -500056(%rbp)
	movl	$0, -500052(%rbp)
	movl	$0, -500048(%rbp)
	movl	$0, -500044(%rbp)
	jmp	.L7
.L14:
	movl	$0, -500052(%rbp)
	movl	$0, -500048(%rbp)
	movl	-500044(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -500040(%rbp)
	jmp	.L8
.L9:
	movl	-500040(%rbp), %eax
	cltq
	movl	-500016(%rbp,%rax,4), %eax
	addl	%eax, -500052(%rbp)
	addl	$1, -500040(%rbp)
.L8:
	movl	-500040(%rbp), %eax
	cmpl	-500064(%rbp), %eax
	jl	.L9
	movl	-500044(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -500036(%rbp)
	jmp	.L10
.L11:
	movl	-500036(%rbp), %eax
	cltq
	movl	-500016(%rbp,%rax,4), %eax
	addl	%eax, -500048(%rbp)
	subl	$1, -500036(%rbp)
.L10:
	cmpl	$0, -500036(%rbp)
	jns	.L11
	movl	-500060(%rbp), %eax
	cmpl	-500052(%rbp), %eax
	jle	.L12
	movl	-500052(%rbp), %eax
	cmpl	-500048(%rbp), %eax
	jl	.L12
	movl	-500052(%rbp), %eax
	movl	%eax, -500060(%rbp)
.L12:
	movl	-500060(%rbp), %eax
	cmpl	-500048(%rbp), %eax
	jle	.L13
	movl	-500052(%rbp), %eax
	cmpl	-500048(%rbp), %eax
	jg	.L13
	movl	-500048(%rbp), %eax
	movl	%eax, -500060(%rbp)
.L13:
	addl	$2, -500044(%rbp)
.L7:
	movl	-500044(%rbp), %eax
	cmpl	-500064(%rbp), %eax
	jl	.L14
	movl	$1, -500032(%rbp)
	jmp	.L15
.L22:
	movl	$0, -500052(%rbp)
	movl	$0, -500048(%rbp)
	movl	-500032(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -500028(%rbp)
	jmp	.L16
.L17:
	movl	-500028(%rbp), %eax
	cltq
	movl	-500016(%rbp,%rax,4), %eax
	addl	%eax, -500052(%rbp)
	addl	$1, -500028(%rbp)
.L16:
	movl	-500028(%rbp), %eax
	cmpl	-500064(%rbp), %eax
	jl	.L17
	movl	-500032(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -500024(%rbp)
	jmp	.L18
.L19:
	movl	-500024(%rbp), %eax
	cltq
	movl	-500016(%rbp,%rax,4), %eax
	addl	%eax, -500048(%rbp)
	subl	$1, -500024(%rbp)
.L18:
	cmpl	$0, -500024(%rbp)
	jns	.L19
	movl	-500056(%rbp), %eax
	cmpl	-500052(%rbp), %eax
	jle	.L20
	movl	-500052(%rbp), %eax
	cmpl	-500048(%rbp), %eax
	jl	.L20
	movl	-500052(%rbp), %eax
	movl	%eax, -500056(%rbp)
.L20:
	movl	-500056(%rbp), %eax
	cmpl	-500048(%rbp), %eax
	jle	.L21
	movl	-500052(%rbp), %eax
	cmpl	-500048(%rbp), %eax
	jg	.L21
	movl	-500048(%rbp), %eax
	movl	%eax, -500056(%rbp)
.L21:
	addl	$2, -500032(%rbp)
.L15:
	movl	-500032(%rbp), %eax
	cmpl	-500064(%rbp), %eax
	jl	.L22
	movl	-500012(%rbp), %eax
	testl	%eax, %eax
	jne	.L23
	movl	-500020(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L24
.L23:
	movl	-500056(%rbp), %eax
	cmpl	-500060(%rbp), %eax
	jle	.L25
	movl	-500056(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L24
.L25:
	movl	-500060(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L24:
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L27
	call	__stack_chk_fail@PLT
.L27:
	leave
	.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	"%s"
.LC1:
	.string	"%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB35:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	-499712(%rsp), %r11
	.cfi_def_cfa 11, 499768
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$328, %rsp
	.cfi_def_cfa_offset 500096
	pxor	%xmm0, %xmm0
	movl	$99984, %edx
	xorl	%esi, %esi
	movq	%fs:40, %rax
	movq	%rax, 500024(%rsp)
	xorl	%eax, %eax
	leaq	400032(%rsp), %rdi
	leaq	400016(%rsp), %rbp
	movaps	%xmm0, 400016(%rsp)
	call	memset@PLT
	leaq	16(%rsp), %rbx
	movq	%rbp, %rsi
	xorl	%eax, %eax
	leaq	.LC0(%rip), %rdi
	call	__isoc99_scanf@PLT
	movl	$400000, %edx
	xorl	%esi, %esi
	movq	%rbx, %rdi
	call	memset@PLT
	movq	%rbp, %rdi
	movzbl	400016(%rsp), %r12d
	call	strlen@PLT
	movl	%eax, 12(%rsp)
	testq	%rax, %rax
	je	.L62
	subl	$1, %eax
	movq	%rbp, %rdx
	xorl	%ecx, %ecx
	xorl	%esi, %esi
	leaq	400017(%rsp,%rax), %r8
.L5:
	movzbl	(%rdx), %eax
	cmpb	%r12b, %al
	je	.L147
.L3:
	movslq	%ecx, %rdi
	addq	$1, %rdx
	addl	$1, %ecx
	movl	%esi, 16(%rsp,%rdi,4)
	cmpq	%r8, %rdx
	je	.L63
	movl	%eax, %r12d
	movzbl	(%rdx), %eax
	movl	$1, %esi
	cmpb	%r12b, %al
	jne	.L3
.L147:
	addq	$1, %rdx
	addl	$1, %esi
	cmpq	%r8, %rdx
	jne	.L5
.L2:
	movslq	%ecx, %rcx
	movl	%esi, 16(%rsp,%rcx,4)
	movl	16(%rsp), %ecx
	testl	%ecx, %ecx
	je	.L6
	leaq	20(%rsp), %r10
	xorl	%edi, %edi
	movq	%r10, %rax
	.p2align 4,,10
	.p2align 3
.L7:
	movl	(%rax), %edx
	movl	%edi, %esi
	addq	$4, %rax
	addl	$1, %edi
	testl	%edx, %edx
	jne	.L7
	testl	%esi, %esi
	je	.L64
	movq	%rsp, %r11
	xorl	%ecx, %ecx
	movl	$-1, %r9d
	movl	$1, %ebp
	movl	$111111, %r8d
	leal	-1(%rsi), %r12d
	.p2align 4,,10
	.p2align 3
.L23:
	movl	%esi, %r14d
	movl	%r12d, %eax
	leal	1(%rcx), %r13d
	subl	%ecx, %r14d
	cmpl	%esi, %ecx
	cmovge	%ebp, %r14d
	subl	%ecx, %eax
	cmpl	$2, %eax
	jbe	.L65
	cmpl	%esi, %ecx
	jge	.L65
	movl	%r14d, %eax
	pxor	%xmm0, %xmm0
	shrl	$2, %eax
	subl	$1, %eax
	salq	$4, %rax
	leaq	16(%r10,%rax), %rdx
	movq	%r10, %rax
	.p2align 4,,10
	.p2align 3
.L10:
	movdqu	(%rax), %xmm2
	addq	$16, %rax
	paddd	%xmm2, %xmm0
	cmpq	%rdx, %rax
	jne	.L10
	movdqa	%xmm0, %xmm1
	movl	%r14d, %eax
	psrldq	$8, %xmm1
	andl	$-4, %eax
	paddd	%xmm1, %xmm0
	addl	%eax, %r13d
	movdqa	%xmm0, %xmm1
	psrldq	$4, %xmm1
	paddd	%xmm1, %xmm0
	movd	%xmm0, %edx
	cmpl	%eax, %r14d
	je	.L14
.L9:
	movslq	%r13d, %rax
	addl	16(%rsp,%rax,4), %edx
	leal	1(%r13), %eax
	cmpl	%r13d, %esi
	jle	.L14
	movslq	%eax, %r14
	addl	$2, %r13d
	addl	16(%rsp,%r14,4), %edx
	cmpl	%eax, %esi
	jle	.L14
	movslq	%r13d, %r13
	addl	16(%rsp,%r13,4), %edx
.L14:
	movl	%r9d, %r13d
	xorl	%eax, %eax
	cmpl	$-1, %r9d
	je	.L13
	cmpl	$2, %r9d
	jbe	.L66
	movl	%ecx, %eax
	leaq	-16(%r11), %r13
	pxor	%xmm1, %xmm1
	shrl	$2, %eax
	subl	$1, %eax
	salq	$4, %rax
	subq	%rax, %r13
	movq	%r11, %rax
	.p2align 4,,10
	.p2align 3
.L16:
	movdqu	(%rax), %xmm6
	subq	$16, %rax
	pshufd	$27, %xmm6, %xmm0
	paddd	%xmm0, %xmm1
	cmpq	%r13, %rax
	jne	.L16
	movdqa	%xmm1, %xmm0
	movl	%ecx, %r14d
	movl	%r9d, %r13d
	psrldq	$8, %xmm0
	andl	$-4, %r14d
	paddd	%xmm0, %xmm1
	subl	%r14d, %r13d
	movdqa	%xmm1, %xmm0
	psrldq	$4, %xmm0
	paddd	%xmm0, %xmm1
	movd	%xmm1, %eax
	cmpl	%ecx, %r14d
	je	.L13
.L15:
	movslq	%r13d, %r14
	addl	16(%rsp,%r14,4), %eax
	leal	-1(%r13), %r14d
	testl	%r13d, %r13d
	je	.L13
	movslq	%r14d, %r14
	addl	16(%rsp,%r14,4), %eax
	leal	-2(%r13), %r14d
	cmpl	$1, %r13d
	je	.L13
	movslq	%r14d, %r14
	addl	16(%rsp,%r14,4), %eax
.L13:
	cmpl	%edx, %r8d
	jle	.L19
	cmpl	%edx, %eax
	cmovle	%edx, %r8d
.L19:
	cmpl	%eax, %r8d
	jle	.L21
	cmpl	%edx, %eax
	cmovge	%eax, %r8d
.L21:
	addl	$2, %ecx
	addl	$2, %r9d
	addq	$8, %r10
	addq	$8, %r11
	cmpl	%esi, %ecx
	jl	.L23
	cmpl	%edi, %ecx
	jge	.L33
.L8:
	movslq	%ecx, %rax
	leal	-1(%rcx), %r9d
	leaq	-16(%rbx,%rax,4), %r10
	.p2align 4,,10
	.p2align 3
.L32:
	movl	%r9d, %edx
	cmpl	$-1, %r9d
	je	.L69
	cmpl	$2, %r9d
	jbe	.L70
	movl	%ecx, %eax
	leaq	-16(%r10), %rdx
	pxor	%xmm1, %xmm1
	shrl	$2, %eax
	subl	$1, %eax
	salq	$4, %rax
	subq	%rax, %rdx
	movq	%r10, %rax
	.p2align 4,,10
	.p2align 3
.L27:
	movdqu	(%rax), %xmm7
	subq	$16, %rax
	pshufd	$27, %xmm7, %xmm0
	paddd	%xmm0, %xmm1
	cmpq	%rdx, %rax
	jne	.L27
	movdqa	%xmm1, %xmm0
	movl	%ecx, %r11d
	movl	%r9d, %edx
	psrldq	$8, %xmm0
	andl	$-4, %r11d
	paddd	%xmm0, %xmm1
	subl	%r11d, %edx
	movdqa	%xmm1, %xmm0
	psrldq	$4, %xmm0
	paddd	%xmm0, %xmm1
	movd	%xmm1, %eax
	cmpl	%ecx, %r11d
	je	.L25
.L26:
	movslq	%edx, %r11
	addl	16(%rsp,%r11,4), %eax
	leal	-1(%rdx), %r11d
	testl	%edx, %edx
	je	.L25
	movslq	%r11d, %r11
	addl	16(%rsp,%r11,4), %eax
	leal	-2(%rdx), %r11d
	cmpl	$1, %edx
	je	.L25
	movslq	%r11d, %r11
	addl	16(%rsp,%r11,4), %eax
.L25:
	testl	%r8d, %r8d
	jle	.L82
	testl	%eax, %eax
	jg	.L82
	xorl	%r8d, %r8d
.L29:
	addl	$2, %ecx
	addl	$2, %r9d
	addq	$8, %r10
	cmpl	%edi, %ecx
	jl	.L32
.L33:
	cmpl	$1, %edi
	je	.L73
	cmpl	$1, %esi
	jle	.L74
	leaq	24(%rsp), %rbp
	leaq	4(%rsp), %r11
	xorl	%r10d, %r10d
	movl	$1, %ecx
	movl	$111111, %r9d
	leal	-1(%rsi), %r12d
	movl	$1, %r13d
	.p2align 4,,10
	.p2align 3
.L48:
	movl	%esi, %r15d
	movl	%r12d, %eax
	leal	1(%rcx), %r14d
	subl	%ecx, %r15d
	cmpl	%ecx, %esi
	cmovle	%r13d, %r15d
	subl	%ecx, %eax
	cmpl	$2, %eax
	jbe	.L75
	cmpl	%ecx, %esi
	jle	.L75
	movl	%r15d, %eax
	pxor	%xmm0, %xmm0
	shrl	$2, %eax
	subl	$1, %eax
	salq	$4, %rax
	leaq	16(%rbp,%rax), %rdx
	movq	%rbp, %rax
	.p2align 4,,10
	.p2align 3
.L37:
	movdqu	(%rax), %xmm3
	addq	$16, %rax
	paddd	%xmm3, %xmm0
	cmpq	%rax, %rdx
	jne	.L37
	movdqa	%xmm0, %xmm1
	movl	%r15d, %eax
	psrldq	$8, %xmm1
	andl	$-4, %eax
	paddd	%xmm1, %xmm0
	addl	%eax, %r14d
	movdqa	%xmm0, %xmm1
	psrldq	$4, %xmm1
	paddd	%xmm1, %xmm0
	movd	%xmm0, %edx
	cmpl	%eax, %r15d
	je	.L41
.L36:
	movslq	%r14d, %rax
	addl	16(%rsp,%rax,4), %edx
	leal	1(%r14), %eax
	cmpl	%r14d, %esi
	jle	.L41
	movslq	%eax, %r15
	addl	$2, %r14d
	addl	16(%rsp,%r15,4), %edx
	cmpl	%esi, %eax
	jge	.L41
	movslq	%r14d, %r14
	addl	16(%rsp,%r14,4), %edx
.L41:
	movl	%r10d, %r14d
	cmpl	$2, %r10d
	jbe	.L148
	movl	%ecx, %eax
	leaq	-16(%r11), %r14
	pxor	%xmm1, %xmm1
	shrl	$2, %eax
	subl	$1, %eax
	salq	$4, %rax
	subq	%rax, %r14
	movq	%r11, %rax
	.p2align 4,,10
	.p2align 3
.L42:
	movdqu	(%rax), %xmm4
	subq	$16, %rax
	pshufd	$27, %xmm4, %xmm0
	paddd	%xmm0, %xmm1
	cmpq	%r14, %rax
	jne	.L42
	movdqa	%xmm1, %xmm0
	movl	%ecx, %r15d
	movl	%r10d, %r14d
	psrldq	$8, %xmm0
	andl	$-4, %r15d
	paddd	%xmm0, %xmm1
	subl	%r15d, %r14d
	movdqa	%xmm1, %xmm0
	psrldq	$4, %xmm0
	paddd	%xmm0, %xmm1
	movd	%xmm1, %eax
	cmpl	%ecx, %r15d
	je	.L43
.L39:
	movslq	%r14d, %r15
	addl	16(%rsp,%r15,4), %eax
	leal	-1(%r14), %r15d
	testl	%r14d, %r14d
	je	.L43
	movslq	%r15d, %r15
	addl	16(%rsp,%r15,4), %eax
	leal	-2(%r14), %r15d
	cmpl	$1, %r14d
	je	.L43
	movslq	%r15d, %r15
	addl	16(%rsp,%r15,4), %eax
.L43:
	cmpl	%edx, %r9d
	jle	.L44
	cmpl	%edx, %eax
	cmovle	%edx, %r9d
.L44:
	cmpl	%eax, %r9d
	jle	.L46
	cmpl	%edx, %eax
	cmovge	%eax, %r9d
.L46:
	addl	$2, %ecx
	addl	$2, %r10d
	addq	$8, %rbp
	addq	$8, %r11
	cmpl	%esi, %ecx
	jl	.L48
	cmpl	%edi, %ecx
	jge	.L34
.L35:
	movslq	%ecx, %rax
	leal	-1(%rcx), %esi
	leaq	-16(%rbx,%rax,4), %r10
	.p2align 4,,10
	.p2align 3
.L55:
	movl	%esi, %edx
	cmpl	$2, %esi
	jbe	.L79
	movl	%ecx, %eax
	leaq	-16(%r10), %rdx
	pxor	%xmm0, %xmm0
	shrl	$2, %eax
	subl	$1, %eax
	salq	$4, %rax
	subq	%rax, %rdx
	movq	%r10, %rax
	.p2align 4,,10
	.p2align 3
.L50:
	movdqu	(%rax), %xmm5
	subq	$16, %rax
	pshufd	$27, %xmm5, %xmm1
	paddd	%xmm1, %xmm0
	cmpq	%rax, %rdx
	jne	.L50
	movdqa	%xmm0, %xmm1
	movl	%ecx, %r11d
	movl	%esi, %edx
	psrldq	$8, %xmm1
	andl	$-4, %r11d
	paddd	%xmm1, %xmm0
	subl	%r11d, %edx
	movdqa	%xmm0, %xmm1
	psrldq	$4, %xmm1
	paddd	%xmm1, %xmm0
	movd	%xmm0, %eax
	cmpl	%ecx, %r11d
	je	.L51
.L49:
	movslq	%edx, %r11
	addl	16(%rsp,%r11,4), %eax
	leal	-1(%rdx), %r11d
	testl	%edx, %edx
	je	.L51
	movslq	%r11d, %r11
	addl	16(%rsp,%r11,4), %eax
	leal	-2(%rdx), %r11d
	cmpl	$1, %edx
	je	.L51
	movslq	%r11d, %r11
	addl	16(%rsp,%r11,4), %eax
.L51:
	testl	%eax, %eax
	jg	.L83
	testl	%r9d, %r9d
	jle	.L83
	xorl	%r9d, %r9d
.L52:
	addl	$2, %ecx
	addl	$2, %esi
	addq	$8, %r10
	cmpl	%edi, %ecx
	jl	.L55
.L34:
	movl	20(%rsp), %eax
	testl	%eax, %eax
	je	.L60
	cmpl	%r8d, %r9d
	jle	.L59
	movl	%r9d, %edx
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L58:
	movq	500024(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L149
	addq	$500040, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L83:
	.cfi_restore_state
	testl	%eax, %eax
	js	.L52
	cmpl	%r9d, %eax
	cmovle	%eax, %r9d
	jmp	.L52
	.p2align 4,,10
	.p2align 3
.L82:
	cmpl	%eax, %r8d
	jle	.L29
	testl	%eax, %eax
	cmovns	%eax, %r8d
	jmp	.L29
	.p2align 4,,10
	.p2align 3
.L74:
	movl	$1, %ecx
	movl	$111111, %r9d
	jmp	.L35
	.p2align 4,,10
	.p2align 3
.L69:
	xorl	%eax, %eax
	jmp	.L25
	.p2align 4,,10
	.p2align 3
.L64:
	xorl	%ecx, %ecx
	movl	$111111, %r8d
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L65:
	xorl	%edx, %edx
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L79:
	xorl	%eax, %eax
	jmp	.L49
	.p2align 4,,10
	.p2align 3
.L148:
	xorl	%eax, %eax
	jmp	.L39
	.p2align 4,,10
	.p2align 3
.L75:
	xorl	%edx, %edx
	jmp	.L36
.L70:
	xorl	%eax, %eax
	jmp	.L26
.L66:
	xorl	%eax, %eax
	jmp	.L15
.L63:
	movl	$1, %esi
	jmp	.L2
.L6:
	cmpl	$0, 20(%rsp)
	je	.L60
	movl	$111111, %r8d
.L59:
	movl	%r8d, %edx
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L58
.L60:
	movl	12(%rsp), %edx
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L58
.L62:
	xorl	%ecx, %ecx
	xorl	%esi, %esi
	jmp	.L2
.L149:
	call	__stack_chk_fail@PLT
.L73:
	movl	$111111, %r9d
	jmp	.L34
	.cfi_endproc
.LFE35:
	.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	"%s"
.LC1:
	.string	"%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB35:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	-499712(%rsp), %r11
	.cfi_def_cfa 11, 499768
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$328, %rsp
	.cfi_def_cfa_offset 500096
	pxor	%xmm0, %xmm0
	movl	$99984, %edx
	xorl	%esi, %esi
	movq	%fs:40, %rax
	movq	%rax, 500024(%rsp)
	xorl	%eax, %eax
	leaq	400032(%rsp), %rdi
	leaq	400016(%rsp), %rbp
	movaps	%xmm0, 400016(%rsp)
	call	memset@PLT
	leaq	16(%rsp), %rbx
	movq	%rbp, %rsi
	xorl	%eax, %eax
	leaq	.LC0(%rip), %rdi
	call	__isoc99_scanf@PLT
	movl	$400000, %edx
	xorl	%esi, %esi
	movq	%rbx, %rdi
	call	memset@PLT
	movq	%rbp, %rdi
	movzbl	400016(%rsp), %r12d
	call	strlen@PLT
	movl	%eax, 12(%rsp)
	testq	%rax, %rax
	je	.L62
	subl	$1, %eax
	movq	%rbp, %rdx
	xorl	%ecx, %ecx
	xorl	%esi, %esi
	leaq	400017(%rsp,%rax), %r8
.L5:
	movzbl	(%rdx), %eax
	cmpb	%r12b, %al
	je	.L147
.L3:
	movslq	%ecx, %rdi
	addq	$1, %rdx
	addl	$1, %ecx
	movl	%esi, 16(%rsp,%rdi,4)
	cmpq	%r8, %rdx
	je	.L63
	movl	%eax, %r12d
	movzbl	(%rdx), %eax
	movl	$1, %esi
	cmpb	%r12b, %al
	jne	.L3
.L147:
	addq	$1, %rdx
	addl	$1, %esi
	cmpq	%r8, %rdx
	jne	.L5
.L2:
	movslq	%ecx, %rcx
	movl	%esi, 16(%rsp,%rcx,4)
	movl	16(%rsp), %ecx
	testl	%ecx, %ecx
	je	.L6
	leaq	20(%rsp), %r10
	xorl	%edi, %edi
	movq	%r10, %rax
	.p2align 4,,10
	.p2align 3
.L7:
	movl	(%rax), %edx
	movl	%edi, %esi
	addq	$4, %rax
	addl	$1, %edi
	testl	%edx, %edx
	jne	.L7
	testl	%esi, %esi
	je	.L64
	movq	%rsp, %r11
	xorl	%ecx, %ecx
	movl	$-1, %r9d
	movl	$1, %ebp
	movl	$111111, %r8d
	leal	-1(%rsi), %r12d
	.p2align 4,,10
	.p2align 3
.L23:
	movl	%esi, %r14d
	movl	%r12d, %eax
	leal	1(%rcx), %r13d
	subl	%ecx, %r14d
	cmpl	%esi, %ecx
	cmovge	%ebp, %r14d
	subl	%ecx, %eax
	cmpl	$2, %eax
	jbe	.L65
	cmpl	%esi, %ecx
	jge	.L65
	movl	%r14d, %eax
	pxor	%xmm0, %xmm0
	shrl	$2, %eax
	subl	$1, %eax
	salq	$4, %rax
	leaq	16(%r10,%rax), %rdx
	movq	%r10, %rax
	.p2align 4,,10
	.p2align 3
.L10:
	movdqu	(%rax), %xmm2
	addq	$16, %rax
	paddd	%xmm2, %xmm0
	cmpq	%rdx, %rax
	jne	.L10
	movdqa	%xmm0, %xmm1
	movl	%r14d, %eax
	psrldq	$8, %xmm1
	andl	$-4, %eax
	paddd	%xmm1, %xmm0
	addl	%eax, %r13d
	movdqa	%xmm0, %xmm1
	psrldq	$4, %xmm1
	paddd	%xmm1, %xmm0
	movd	%xmm0, %edx
	cmpl	%eax, %r14d
	je	.L14
.L9:
	movslq	%r13d, %rax
	addl	16(%rsp,%rax,4), %edx
	leal	1(%r13), %eax
	cmpl	%r13d, %esi
	jle	.L14
	movslq	%eax, %r14
	addl	$2, %r13d
	addl	16(%rsp,%r14,4), %edx
	cmpl	%eax, %esi
	jle	.L14
	movslq	%r13d, %r13
	addl	16(%rsp,%r13,4), %edx
.L14:
	movl	%r9d, %r13d
	xorl	%eax, %eax
	cmpl	$-1, %r9d
	je	.L13
	cmpl	$2, %r9d
	jbe	.L66
	movl	%ecx, %eax
	leaq	-16(%r11), %r13
	pxor	%xmm1, %xmm1
	shrl	$2, %eax
	subl	$1, %eax
	salq	$4, %rax
	subq	%rax, %r13
	movq	%r11, %rax
	.p2align 4,,10
	.p2align 3
.L16:
	movdqu	(%rax), %xmm6
	subq	$16, %rax
	pshufd	$27, %xmm6, %xmm0
	paddd	%xmm0, %xmm1
	cmpq	%r13, %rax
	jne	.L16
	movdqa	%xmm1, %xmm0
	movl	%ecx, %r14d
	movl	%r9d, %r13d
	psrldq	$8, %xmm0
	andl	$-4, %r14d
	paddd	%xmm0, %xmm1
	subl	%r14d, %r13d
	movdqa	%xmm1, %xmm0
	psrldq	$4, %xmm0
	paddd	%xmm0, %xmm1
	movd	%xmm1, %eax
	cmpl	%ecx, %r14d
	je	.L13
.L15:
	movslq	%r13d, %r14
	addl	16(%rsp,%r14,4), %eax
	leal	-1(%r13), %r14d
	testl	%r13d, %r13d
	je	.L13
	movslq	%r14d, %r14
	addl	16(%rsp,%r14,4), %eax
	leal	-2(%r13), %r14d
	cmpl	$1, %r13d
	je	.L13
	movslq	%r14d, %r14
	addl	16(%rsp,%r14,4), %eax
.L13:
	cmpl	%edx, %r8d
	jle	.L19
	cmpl	%edx, %eax
	cmovle	%edx, %r8d
.L19:
	cmpl	%eax, %r8d
	jle	.L21
	cmpl	%edx, %eax
	cmovge	%eax, %r8d
.L21:
	addl	$2, %ecx
	addl	$2, %r9d
	addq	$8, %r10
	addq	$8, %r11
	cmpl	%esi, %ecx
	jl	.L23
	cmpl	%edi, %ecx
	jge	.L33
.L8:
	movslq	%ecx, %rax
	leal	-1(%rcx), %r9d
	leaq	-16(%rbx,%rax,4), %r10
	.p2align 4,,10
	.p2align 3
.L32:
	movl	%r9d, %edx
	cmpl	$-1, %r9d
	je	.L69
	cmpl	$2, %r9d
	jbe	.L70
	movl	%ecx, %eax
	leaq	-16(%r10), %rdx
	pxor	%xmm1, %xmm1
	shrl	$2, %eax
	subl	$1, %eax
	salq	$4, %rax
	subq	%rax, %rdx
	movq	%r10, %rax
	.p2align 4,,10
	.p2align 3
.L27:
	movdqu	(%rax), %xmm7
	subq	$16, %rax
	pshufd	$27, %xmm7, %xmm0
	paddd	%xmm0, %xmm1
	cmpq	%rdx, %rax
	jne	.L27
	movdqa	%xmm1, %xmm0
	movl	%ecx, %r11d
	movl	%r9d, %edx
	psrldq	$8, %xmm0
	andl	$-4, %r11d
	paddd	%xmm0, %xmm1
	subl	%r11d, %edx
	movdqa	%xmm1, %xmm0
	psrldq	$4, %xmm0
	paddd	%xmm0, %xmm1
	movd	%xmm1, %eax
	cmpl	%ecx, %r11d
	je	.L25
.L26:
	movslq	%edx, %r11
	addl	16(%rsp,%r11,4), %eax
	leal	-1(%rdx), %r11d
	testl	%edx, %edx
	je	.L25
	movslq	%r11d, %r11
	addl	16(%rsp,%r11,4), %eax
	leal	-2(%rdx), %r11d
	cmpl	$1, %edx
	je	.L25
	movslq	%r11d, %r11
	addl	16(%rsp,%r11,4), %eax
.L25:
	testl	%r8d, %r8d
	jle	.L82
	testl	%eax, %eax
	jg	.L82
	xorl	%r8d, %r8d
.L29:
	addl	$2, %ecx
	addl	$2, %r9d
	addq	$8, %r10
	cmpl	%edi, %ecx
	jl	.L32
.L33:
	cmpl	$1, %edi
	je	.L73
	cmpl	$1, %esi
	jle	.L74
	leaq	24(%rsp), %rbp
	leaq	4(%rsp), %r11
	xorl	%r10d, %r10d
	movl	$1, %ecx
	movl	$111111, %r9d
	leal	-1(%rsi), %r12d
	movl	$1, %r13d
	.p2align 4,,10
	.p2align 3
.L48:
	movl	%esi, %r15d
	movl	%r12d, %eax
	leal	1(%rcx), %r14d
	subl	%ecx, %r15d
	cmpl	%ecx, %esi
	cmovle	%r13d, %r15d
	subl	%ecx, %eax
	cmpl	$2, %eax
	jbe	.L75
	cmpl	%ecx, %esi
	jle	.L75
	movl	%r15d, %eax
	pxor	%xmm0, %xmm0
	shrl	$2, %eax
	subl	$1, %eax
	salq	$4, %rax
	leaq	16(%rbp,%rax), %rdx
	movq	%rbp, %rax
	.p2align 4,,10
	.p2align 3
.L37:
	movdqu	(%rax), %xmm3
	addq	$16, %rax
	paddd	%xmm3, %xmm0
	cmpq	%rax, %rdx
	jne	.L37
	movdqa	%xmm0, %xmm1
	movl	%r15d, %eax
	psrldq	$8, %xmm1
	andl	$-4, %eax
	paddd	%xmm1, %xmm0
	addl	%eax, %r14d
	movdqa	%xmm0, %xmm1
	psrldq	$4, %xmm1
	paddd	%xmm1, %xmm0
	movd	%xmm0, %edx
	cmpl	%eax, %r15d
	je	.L41
.L36:
	movslq	%r14d, %rax
	addl	16(%rsp,%rax,4), %edx
	leal	1(%r14), %eax
	cmpl	%r14d, %esi
	jle	.L41
	movslq	%eax, %r15
	addl	$2, %r14d
	addl	16(%rsp,%r15,4), %edx
	cmpl	%esi, %eax
	jge	.L41
	movslq	%r14d, %r14
	addl	16(%rsp,%r14,4), %edx
.L41:
	movl	%r10d, %r14d
	cmpl	$2, %r10d
	jbe	.L148
	movl	%ecx, %eax
	leaq	-16(%r11), %r14
	pxor	%xmm1, %xmm1
	shrl	$2, %eax
	subl	$1, %eax
	salq	$4, %rax
	subq	%rax, %r14
	movq	%r11, %rax
	.p2align 4,,10
	.p2align 3
.L42:
	movdqu	(%rax), %xmm4
	subq	$16, %rax
	pshufd	$27, %xmm4, %xmm0
	paddd	%xmm0, %xmm1
	cmpq	%r14, %rax
	jne	.L42
	movdqa	%xmm1, %xmm0
	movl	%ecx, %r15d
	movl	%r10d, %r14d
	psrldq	$8, %xmm0
	andl	$-4, %r15d
	paddd	%xmm0, %xmm1
	subl	%r15d, %r14d
	movdqa	%xmm1, %xmm0
	psrldq	$4, %xmm0
	paddd	%xmm0, %xmm1
	movd	%xmm1, %eax
	cmpl	%ecx, %r15d
	je	.L43
.L39:
	movslq	%r14d, %r15
	addl	16(%rsp,%r15,4), %eax
	leal	-1(%r14), %r15d
	testl	%r14d, %r14d
	je	.L43
	movslq	%r15d, %r15
	addl	16(%rsp,%r15,4), %eax
	leal	-2(%r14), %r15d
	cmpl	$1, %r14d
	je	.L43
	movslq	%r15d, %r15
	addl	16(%rsp,%r15,4), %eax
.L43:
	cmpl	%edx, %r9d
	jle	.L44
	cmpl	%edx, %eax
	cmovle	%edx, %r9d
.L44:
	cmpl	%eax, %r9d
	jle	.L46
	cmpl	%edx, %eax
	cmovge	%eax, %r9d
.L46:
	addl	$2, %ecx
	addl	$2, %r10d
	addq	$8, %rbp
	addq	$8, %r11
	cmpl	%esi, %ecx
	jl	.L48
	cmpl	%edi, %ecx
	jge	.L34
.L35:
	movslq	%ecx, %rax
	leal	-1(%rcx), %esi
	leaq	-16(%rbx,%rax,4), %r10
	.p2align 4,,10
	.p2align 3
.L55:
	movl	%esi, %edx
	cmpl	$2, %esi
	jbe	.L79
	movl	%ecx, %eax
	leaq	-16(%r10), %rdx
	pxor	%xmm0, %xmm0
	shrl	$2, %eax
	subl	$1, %eax
	salq	$4, %rax
	subq	%rax, %rdx
	movq	%r10, %rax
	.p2align 4,,10
	.p2align 3
.L50:
	movdqu	(%rax), %xmm5
	subq	$16, %rax
	pshufd	$27, %xmm5, %xmm1
	paddd	%xmm1, %xmm0
	cmpq	%rax, %rdx
	jne	.L50
	movdqa	%xmm0, %xmm1
	movl	%ecx, %r11d
	movl	%esi, %edx
	psrldq	$8, %xmm1
	andl	$-4, %r11d
	paddd	%xmm1, %xmm0
	subl	%r11d, %edx
	movdqa	%xmm0, %xmm1
	psrldq	$4, %xmm1
	paddd	%xmm1, %xmm0
	movd	%xmm0, %eax
	cmpl	%ecx, %r11d
	je	.L51
.L49:
	movslq	%edx, %r11
	addl	16(%rsp,%r11,4), %eax
	leal	-1(%rdx), %r11d
	testl	%edx, %edx
	je	.L51
	movslq	%r11d, %r11
	addl	16(%rsp,%r11,4), %eax
	leal	-2(%rdx), %r11d
	cmpl	$1, %edx
	je	.L51
	movslq	%r11d, %r11
	addl	16(%rsp,%r11,4), %eax
.L51:
	testl	%eax, %eax
	jg	.L83
	testl	%r9d, %r9d
	jle	.L83
	xorl	%r9d, %r9d
.L52:
	addl	$2, %ecx
	addl	$2, %esi
	addq	$8, %r10
	cmpl	%edi, %ecx
	jl	.L55
.L34:
	movl	20(%rsp), %eax
	testl	%eax, %eax
	je	.L60
	cmpl	%r8d, %r9d
	jle	.L59
	movl	%r9d, %edx
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L58:
	movq	500024(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L149
	addq	$500040, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L83:
	.cfi_restore_state
	testl	%eax, %eax
	js	.L52
	cmpl	%r9d, %eax
	cmovle	%eax, %r9d
	jmp	.L52
	.p2align 4,,10
	.p2align 3
.L82:
	cmpl	%eax, %r8d
	jle	.L29
	testl	%eax, %eax
	cmovns	%eax, %r8d
	jmp	.L29
	.p2align 4,,10
	.p2align 3
.L74:
	movl	$1, %ecx
	movl	$111111, %r9d
	jmp	.L35
	.p2align 4,,10
	.p2align 3
.L69:
	xorl	%eax, %eax
	jmp	.L25
	.p2align 4,,10
	.p2align 3
.L64:
	xorl	%ecx, %ecx
	movl	$111111, %r8d
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L65:
	xorl	%edx, %edx
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L79:
	xorl	%eax, %eax
	jmp	.L49
	.p2align 4,,10
	.p2align 3
.L148:
	xorl	%eax, %eax
	jmp	.L39
	.p2align 4,,10
	.p2align 3
.L75:
	xorl	%edx, %edx
	jmp	.L36
.L70:
	xorl	%eax, %eax
	jmp	.L26
.L66:
	xorl	%eax, %eax
	jmp	.L15
.L63:
	movl	$1, %esi
	jmp	.L2
.L6:
	cmpl	$0, 20(%rsp)
	je	.L60
	movl	$111111, %r8d
.L59:
	movl	%r8d, %edx
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L58
.L60:
	movl	12(%rsp), %edx
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L58
.L62:
	xorl	%ecx, %ecx
	xorl	%esi, %esi
	jmp	.L2
.L149:
	call	__stack_chk_fail@PLT
.L73:
	movl	$111111, %r9d
	jmp	.L34
	.cfi_endproc
.LFE35:
	.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>
#include<string.h>
int main(void)
{
    char s[100000]={};
    scanf("%s",s);
    int a[100000]={};
    int count=0;
    int p=0;
    int po=0;
    char c=s[0];
    int len=strlen(s);
    //printf("%d",len);
    while(po<len)
    {
        if(c==s[po])
        {
            count++;
            po++;
        }
        else
        {
            a[p]=count;
            p++;
            count=1;
            c=s[po];
            po++;
        }
    }
    a[p]=count;
    int leng=0;
    while(a[leng]!=NULL)leng++;
    //printf("%d\n",leng);
    int minki=111111;
    int mingu=111111;
    int rightsum=0;
    int leftsum=0;
    for(int pp=0;pp<leng;pp+=2)
    {
        rightsum=0;
        leftsum=0;
        for(int q=pp+1;q<leng;q++)rightsum+=a[q];
        for(int r=pp-1;r>=0;r--)leftsum+=a[r];
        if(minki>rightsum && rightsum>=leftsum)minki=rightsum;
        if(minki>leftsum&&rightsum<=leftsum)minki=leftsum;
    }
    for(int ss=1;ss<leng;ss+=2)
    {
        rightsum=0;
        leftsum=0;
        for(int t=ss+1;t<leng;t++)rightsum+=a[t];
        for(int u=ss-1;u>=0;u--)leftsum+=a[u];
        if(mingu>rightsum&& rightsum>=leftsum)mingu=rightsum;
        if(mingu>leftsum&&rightsum<=leftsum)mingu=leftsum;
    }
    //printf("%d%d",minki,mingu);
    if(a[1]==0)printf("%d",len);
    else if(mingu>minki)printf("%d",mingu);
    else printf("%d",minki);
}

010

2
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>
#include<string.h>
int main(void)
{
    char s[100000]={};
    scanf("%s",s);
    int a[100000]={};
    int count=0;
    int p=0;
    int po=0;
    char c=s[0];
    int len=strlen(s);
    //printf("%d",len);
    while(po<len)
    {
        if(c==s[po])
        {
            count++;
            po++;
        }
        else
        {
            a[p]=count;
            p++;
            count=1;
            c=s[po];
            po++;
        }
    }
    a[p]=count;
    int leng=0;
    while(a[leng]!=NULL)leng++;
    //printf("%d\n",leng);
    int minki=111111;
    int mingu=111111;
    int rightsum=0;
    int leftsum=0;
    for(int pp=0;pp<leng;pp+=2)
    {
        rightsum=0;
        leftsum=0;
        for(int q=pp+1;q<leng;q++)rightsum+=a[q];
        for(int r=pp-1;r>=0;r--)leftsum+=a[r];
        if(minki>rightsum && rightsum>=leftsum)minki=rightsum;
        if(minki>leftsum&&rightsum<=leftsum)minki=leftsum;
    }
    for(int ss=1;ss<leng;ss+=2)
    {
        rightsum=0;
        leftsum=0;
        for(int t=ss+1;t<leng;t++)rightsum+=a[t];
        for(int u=ss-1;u>=0;u--)leftsum+=a[u];
        if(mingu>rightsum&& rightsum>=leftsum)mingu=rightsum;
        if(mingu>leftsum&&rightsum<=leftsum)mingu=leftsum;
    }
    //printf("%d%d",minki,mingu);
    if(a[1]==0)printf("%d",len);
    else if(mingu>minki)printf("%d",mingu);
    else printf("%d",minki);
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%s"
.LC1:
	.string	"%d"
	.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
	leaq	-499712(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$368, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movq	$0, -100016(%rbp)
	movq	$0, -100008(%rbp)
	leaq	-100000(%rbp), %rax
	movl	$99984, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	leaq	-100016(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-500016(%rbp), %rax
	movl	$400000, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	movl	$0, -500076(%rbp)
	movl	$0, -500072(%rbp)
	movl	$0, -500068(%rbp)
	movzbl	-100016(%rbp), %eax
	movb	%al, -500077(%rbp)
	leaq	-100016(%rbp), %rax
	movq	%rax, %rdi
	call	strlen@PLT
	movl	%eax, -500020(%rbp)
	jmp	.L2
.L4:
	movl	-500068(%rbp), %eax
	cltq
	movzbl	-100016(%rbp,%rax), %eax
	cmpb	%al, -500077(%rbp)
	jne	.L3
	addl	$1, -500076(%rbp)
	addl	$1, -500068(%rbp)
	jmp	.L2
.L3:
	movl	-500072(%rbp), %eax
	cltq
	movl	-500076(%rbp), %edx
	movl	%edx, -500016(%rbp,%rax,4)
	addl	$1, -500072(%rbp)
	movl	$1, -500076(%rbp)
	movl	-500068(%rbp), %eax
	cltq
	movzbl	-100016(%rbp,%rax), %eax
	movb	%al, -500077(%rbp)
	addl	$1, -500068(%rbp)
.L2:
	movl	-500068(%rbp), %eax
	cmpl	-500020(%rbp), %eax
	jl	.L4
	movl	-500072(%rbp), %eax
	cltq
	movl	-500076(%rbp), %edx
	movl	%edx, -500016(%rbp,%rax,4)
	movl	$0, -500064(%rbp)
	jmp	.L5
.L6:
	addl	$1, -500064(%rbp)
.L5:
	movl	-500064(%rbp), %eax
	cltq
	movl	-500016(%rbp,%rax,4), %eax
	testl	%eax, %eax
	jne	.L6
	movl	$111111, -500060(%rbp)
	movl	$111111, -500056(%rbp)
	movl	$0, -500052(%rbp)
	movl	$0, -500048(%rbp)
	movl	$0, -500044(%rbp)
	jmp	.L7
.L14:
	movl	$0, -500052(%rbp)
	movl	$0, -500048(%rbp)
	movl	-500044(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -500040(%rbp)
	jmp	.L8
.L9:
	movl	-500040(%rbp), %eax
	cltq
	movl	-500016(%rbp,%rax,4), %eax
	addl	%eax, -500052(%rbp)
	addl	$1, -500040(%rbp)
.L8:
	movl	-500040(%rbp), %eax
	cmpl	-500064(%rbp), %eax
	jl	.L9
	movl	-500044(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -500036(%rbp)
	jmp	.L10
.L11:
	movl	-500036(%rbp), %eax
	cltq
	movl	-500016(%rbp,%rax,4), %eax
	addl	%eax, -500048(%rbp)
	subl	$1, -500036(%rbp)
.L10:
	cmpl	$0, -500036(%rbp)
	jns	.L11
	movl	-500060(%rbp), %eax
	cmpl	-500052(%rbp), %eax
	jle	.L12
	movl	-500052(%rbp), %eax
	cmpl	-500048(%rbp), %eax
	jl	.L12
	movl	-500052(%rbp), %eax
	movl	%eax, -500060(%rbp)
.L12:
	movl	-500060(%rbp), %eax
	cmpl	-500048(%rbp), %eax
	jle	.L13
	movl	-500052(%rbp), %eax
	cmpl	-500048(%rbp), %eax
	jg	.L13
	movl	-500048(%rbp), %eax
	movl	%eax, -500060(%rbp)
.L13:
	addl	$2, -500044(%rbp)
.L7:
	movl	-500044(%rbp), %eax
	cmpl	-500064(%rbp), %eax
	jl	.L14
	movl	$1, -500032(%rbp)
	jmp	.L15
.L22:
	movl	$0, -500052(%rbp)
	movl	$0, -500048(%rbp)
	movl	-500032(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -500028(%rbp)
	jmp	.L16
.L17:
	movl	-500028(%rbp), %eax
	cltq
	movl	-500016(%rbp,%rax,4), %eax
	addl	%eax, -500052(%rbp)
	addl	$1, -500028(%rbp)
.L16:
	movl	-500028(%rbp), %eax
	cmpl	-500064(%rbp), %eax
	jl	.L17
	movl	-500032(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -500024(%rbp)
	jmp	.L18
.L19:
	movl	-500024(%rbp), %eax
	cltq
	movl	-500016(%rbp,%rax,4), %eax
	addl	%eax, -500048(%rbp)
	subl	$1, -500024(%rbp)
.L18:
	cmpl	$0, -500024(%rbp)
	jns	.L19
	movl	-500056(%rbp), %eax
	cmpl	-500052(%rbp), %eax
	jle	.L20
	movl	-500052(%rbp), %eax
	cmpl	-500048(%rbp), %eax
	jl	.L20
	movl	-500052(%rbp), %eax
	movl	%eax, -500056(%rbp)
.L20:
	movl	-500056(%rbp), %eax
	cmpl	-500048(%rbp), %eax
	jle	.L21
	movl	-500052(%rbp), %eax
	cmpl	-500048(%rbp), %eax
	jg	.L21
	movl	-500048(%rbp), %eax
	movl	%eax, -500056(%rbp)
.L21:
	addl	$2, -500032(%rbp)
.L15:
	movl	-500032(%rbp), %eax
	cmpl	-500064(%rbp), %eax
	jl	.L22
	movl	-500012(%rbp), %eax
	testl	%eax, %eax
	jne	.L23
	movl	-500020(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L24
.L23:
	movl	-500056(%rbp), %eax
	cmpl	-500060(%rbp), %eax
	jle	.L25
	movl	-500056(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L24
.L25:
	movl	-500060(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L24:
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L27
	call	__stack_chk_fail@PLT
.L27:
	leave
	.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	"%s"
.LC1:
	.string	"%d"
	.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
	leaq	-499712(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$368, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movq	$0, -100016(%rbp)
	movq	$0, -100008(%rbp)
	leaq	-100000(%rbp), %rax
	movl	$99984, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	leaq	-100016(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-500016(%rbp), %rax
	movl	$400000, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	movl	$0, -500076(%rbp)
	movl	$0, -500072(%rbp)
	movl	$0, -500068(%rbp)
	movzbl	-100016(%rbp), %eax
	movb	%al, -500077(%rbp)
	leaq	-100016(%rbp), %rax
	movq	%rax, %rdi
	call	strlen@PLT
	movl	%eax, -500020(%rbp)
	jmp	.L2
.L4:
	movl	-500068(%rbp), %eax
	cltq
	movzbl	-100016(%rbp,%rax), %eax
	cmpb	%al, -500077(%rbp)
	jne	.L3
	addl	$1, -500076(%rbp)
	addl	$1, -500068(%rbp)
	jmp	.L2
.L3:
	movl	-500072(%rbp), %eax
	cltq
	movl	-500076(%rbp), %edx
	movl	%edx, -500016(%rbp,%rax,4)
	addl	$1, -500072(%rbp)
	movl	$1, -500076(%rbp)
	movl	-500068(%rbp), %eax
	cltq
	movzbl	-100016(%rbp,%rax), %eax
	movb	%al, -500077(%rbp)
	addl	$1, -500068(%rbp)
.L2:
	movl	-500068(%rbp), %eax
	cmpl	-500020(%rbp), %eax
	jl	.L4
	movl	-500072(%rbp), %eax
	cltq
	movl	-500076(%rbp), %edx
	movl	%edx, -500016(%rbp,%rax,4)
	movl	$0, -500064(%rbp)
	jmp	.L5
.L6:
	addl	$1, -500064(%rbp)
.L5:
	movl	-500064(%rbp), %eax
	cltq
	movl	-500016(%rbp,%rax,4), %eax
	testl	%eax, %eax
	jne	.L6
	movl	$111111, -500060(%rbp)
	movl	$111111, -500056(%rbp)
	movl	$0, -500052(%rbp)
	movl	$0, -500048(%rbp)
	movl	$0, -500044(%rbp)
	jmp	.L7
.L14:
	movl	$0, -500052(%rbp)
	movl	$0, -500048(%rbp)
	movl	-500044(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -500040(%rbp)
	jmp	.L8
.L9:
	movl	-500040(%rbp), %eax
	cltq
	movl	-500016(%rbp,%rax,4), %eax
	addl	%eax, -500052(%rbp)
	addl	$1, -500040(%rbp)
.L8:
	movl	-500040(%rbp), %eax
	cmpl	-500064(%rbp), %eax
	jl	.L9
	movl	-500044(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -500036(%rbp)
	jmp	.L10
.L11:
	movl	-500036(%rbp), %eax
	cltq
	movl	-500016(%rbp,%rax,4), %eax
	addl	%eax, -500048(%rbp)
	subl	$1, -500036(%rbp)
.L10:
	cmpl	$0, -500036(%rbp)
	jns	.L11
	movl	-500060(%rbp), %eax
	cmpl	-500052(%rbp), %eax
	jle	.L12
	movl	-500052(%rbp), %eax
	cmpl	-500048(%rbp), %eax
	jl	.L12
	movl	-500052(%rbp), %eax
	movl	%eax, -500060(%rbp)
.L12:
	movl	-500060(%rbp), %eax
	cmpl	-500048(%rbp), %eax
	jle	.L13
	movl	-500052(%rbp), %eax
	cmpl	-500048(%rbp), %eax
	jg	.L13
	movl	-500048(%rbp), %eax
	movl	%eax, -500060(%rbp)
.L13:
	addl	$2, -500044(%rbp)
.L7:
	movl	-500044(%rbp), %eax
	cmpl	-500064(%rbp), %eax
	jl	.L14
	movl	$1, -500032(%rbp)
	jmp	.L15
.L22:
	movl	$0, -500052(%rbp)
	movl	$0, -500048(%rbp)
	movl	-500032(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -500028(%rbp)
	jmp	.L16
.L17:
	movl	-500028(%rbp), %eax
	cltq
	movl	-500016(%rbp,%rax,4), %eax
	addl	%eax, -500052(%rbp)
	addl	$1, -500028(%rbp)
.L16:
	movl	-500028(%rbp), %eax
	cmpl	-500064(%rbp), %eax
	jl	.L17
	movl	-500032(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -500024(%rbp)
	jmp	.L18
.L19:
	movl	-500024(%rbp), %eax
	cltq
	movl	-500016(%rbp,%rax,4), %eax
	addl	%eax, -500048(%rbp)
	subl	$1, -500024(%rbp)
.L18:
	cmpl	$0, -500024(%rbp)
	jns	.L19
	movl	-500056(%rbp), %eax
	cmpl	-500052(%rbp), %eax
	jle	.L20
	movl	-500052(%rbp), %eax
	cmpl	-500048(%rbp), %eax
	jl	.L20
	movl	-500052(%rbp), %eax
	movl	%eax, -500056(%rbp)
.L20:
	movl	-500056(%rbp), %eax
	cmpl	-500048(%rbp), %eax
	jle	.L21
	movl	-500052(%rbp), %eax
	cmpl	-500048(%rbp), %eax
	jg	.L21
	movl	-500048(%rbp), %eax
	movl	%eax, -500056(%rbp)
.L21:
	addl	$2, -500032(%rbp)
.L15:
	movl	-500032(%rbp), %eax
	cmpl	-500064(%rbp), %eax
	jl	.L22
	movl	-500012(%rbp), %eax
	testl	%eax, %eax
	jne	.L23
	movl	-500020(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L24
.L23:
	movl	-500056(%rbp), %eax
	cmpl	-500060(%rbp), %eax
	jle	.L25
	movl	-500056(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L24
.L25:
	movl	-500060(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L24:
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L27
	call	__stack_chk_fail@PLT
.L27:
	leave
	.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:
