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>

typedef enum {false, true} bool;

int main(void)
{
    char S[101];
    int K;
    char c;
    int i;
    int ctr, ctr2;
    int index;
    bool single, parity;
    long long ans;
    
    
    scanf("%s", S);
    scanf("%d%c", &K, &c);
    
    
    ctr = 0;
    index = -1;
    
    single = true;
    
    for(i=1; S[i] != '\0'; i++)
    {
        if(S[i-1] == S[i])
        {
            ctr++;
            
            index = i++;
            
            if(S[i] == '\0')
                break;
        }
        else
            single = false;
    }
    
    
    if(S[i-1] == S[0])
    {
        if(index == i-1)
        {
            ctr2 = 0;
            
            i = 1;
        }
        else
        {
            ctr2 = 1;
            
            i = 2;
        }
        
        for(; S[i] != '\0'; i++)
        {
            if(S[i-1] == S[i])
            {
                ctr2++;
                
                i++;
                
                if(S[i] == '\0')
                    break;
            }
        }
    }
    else
        ctr2 = ctr;
    
    
    if(ctr == ctr2)
        parity = false;
    else
        parity = true;
    
    
    if(single)
    {
        if(parity)
            ans = (long long)K*ctr+K/2;
        else
            ans = (long long)K*ctr;
    }
    else
    {
        if(parity)
            ans = (long long)K*ctr+K-1;
        else
            ans = (long long)K*ctr;
    }
    
    
    printf("%lld\n", ans);
    
    
    //system("pause");
    
    return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%s"
.LC1:
	.string	"%d%c"
.LC2:
	.string	"%lld\n"
	.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
	subq	$160, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-112(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-149(%rbp), %rdx
	leaq	-148(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -140(%rbp)
	movl	$-1, -132(%rbp)
	movl	$1, -128(%rbp)
	movl	$1, -144(%rbp)
	jmp	.L2
.L6:
	movl	-144(%rbp), %eax
	subl	$1, %eax
	cltq
	movzbl	-112(%rbp,%rax), %edx
	movl	-144(%rbp), %eax
	cltq
	movzbl	-112(%rbp,%rax), %eax
	cmpb	%al, %dl
	jne	.L3
	addl	$1, -140(%rbp)
	movl	-144(%rbp), %eax
	leal	1(%rax), %edx
	movl	%edx, -144(%rbp)
	movl	%eax, -132(%rbp)
	movl	-144(%rbp), %eax
	cltq
	movzbl	-112(%rbp,%rax), %eax
	testb	%al, %al
	jne	.L4
	jmp	.L5
.L3:
	movl	$0, -128(%rbp)
.L4:
	addl	$1, -144(%rbp)
.L2:
	movl	-144(%rbp), %eax
	cltq
	movzbl	-112(%rbp,%rax), %eax
	testb	%al, %al
	jne	.L6
.L5:
	movl	-144(%rbp), %eax
	subl	$1, %eax
	cltq
	movzbl	-112(%rbp,%rax), %edx
	movzbl	-112(%rbp), %eax
	cmpb	%al, %dl
	jne	.L7
	movl	-144(%rbp), %eax
	subl	$1, %eax
	cmpl	%eax, -132(%rbp)
	jne	.L8
	movl	$0, -136(%rbp)
	movl	$1, -144(%rbp)
	jmp	.L10
.L8:
	movl	$1, -136(%rbp)
	movl	$2, -144(%rbp)
	jmp	.L10
.L13:
	movl	-144(%rbp), %eax
	subl	$1, %eax
	cltq
	movzbl	-112(%rbp,%rax), %edx
	movl	-144(%rbp), %eax
	cltq
	movzbl	-112(%rbp,%rax), %eax
	cmpb	%al, %dl
	jne	.L11
	addl	$1, -136(%rbp)
	addl	$1, -144(%rbp)
	movl	-144(%rbp), %eax
	cltq
	movzbl	-112(%rbp,%rax), %eax
	testb	%al, %al
	je	.L23
.L11:
	addl	$1, -144(%rbp)
.L10:
	movl	-144(%rbp), %eax
	cltq
	movzbl	-112(%rbp,%rax), %eax
	testb	%al, %al
	jne	.L13
	jmp	.L14
.L7:
	movl	-140(%rbp), %eax
	movl	%eax, -136(%rbp)
	jmp	.L14
.L23:
	nop
.L14:
	movl	-140(%rbp), %eax
	cmpl	-136(%rbp), %eax
	jne	.L15
	movl	$0, -124(%rbp)
	jmp	.L16
.L15:
	movl	$1, -124(%rbp)
.L16:
	cmpl	$0, -128(%rbp)
	je	.L17
	cmpl	$0, -124(%rbp)
	je	.L18
	movl	-148(%rbp), %eax
	movslq	%eax, %rdx
	movl	-140(%rbp), %eax
	cltq
	imulq	%rax, %rdx
	movl	-148(%rbp), %eax
	movl	%eax, %ecx
	shrl	$31, %ecx
	addl	%ecx, %eax
	sarl	%eax
	cltq
	addq	%rdx, %rax
	movq	%rax, -120(%rbp)
	jmp	.L19
.L18:
	movl	-148(%rbp), %eax
	movslq	%eax, %rdx
	movl	-140(%rbp), %eax
	cltq
	imulq	%rdx, %rax
	movq	%rax, -120(%rbp)
	jmp	.L19
.L17:
	cmpl	$0, -124(%rbp)
	je	.L20
	movl	-148(%rbp), %eax
	movslq	%eax, %rdx
	movl	-140(%rbp), %eax
	cltq
	imulq	%rax, %rdx
	movl	-148(%rbp), %eax
	cltq
	addq	%rdx, %rax
	subq	$1, %rax
	movq	%rax, -120(%rbp)
	jmp	.L19
.L20:
	movl	-148(%rbp), %eax
	movslq	%eax, %rdx
	movl	-140(%rbp), %eax
	cltq
	imulq	%rdx, %rax
	movq	%rax, -120(%rbp)
.L19:
	movq	-120(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L22
	call	__stack_chk_fail@PLT
.L22:
	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%c"
.LC2:
	.string	"%lld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	subq	$136, %rsp
	.cfi_def_cfa_offset 144
	leaq	.LC0(%rip), %rdi
	movq	%fs:40, %rax
	movq	%rax, 120(%rsp)
	xorl	%eax, %eax
	leaq	16(%rsp), %rsi
	call	__isoc99_scanf@PLT
	leaq	.LC1(%rip), %rdi
	leaq	11(%rsp), %rdx
	xorl	%eax, %eax
	leaq	12(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movzbl	17(%rsp), %edi
	testb	%dil, %dil
	je	.L2
	movl	%edi, %ecx
	movl	$1, %r9d
	xorl	%r8d, %r8d
	movl	$1, %eax
	movl	$-1, %r10d
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L19:
	movl	%eax, %edx
	movl	%ecx, %esi
	xorl	%r9d, %r9d
	leal	1(%rdx), %eax
	movslq	%eax, %rcx
	movzbl	16(%rsp,%rcx), %ecx
	testb	%cl, %cl
	je	.L31
.L5:
	leal	-1(%rax), %edx
	movslq	%edx, %rdx
	cmpb	%cl, 16(%rsp,%rdx)
	jne	.L19
	leal	1(%rax), %edx
	addl	$1, %r8d
	movslq	%edx, %rsi
	movzbl	16(%rsp,%rsi), %esi
	testb	%sil, %sil
	je	.L4
	movl	%eax, %r10d
	leal	1(%rdx), %eax
	movslq	%eax, %rcx
	movzbl	16(%rsp,%rcx), %ecx
	testb	%cl, %cl
	jne	.L5
.L31:
	cmpb	%sil, 16(%rsp)
	je	.L25
.L29:
	movslq	12(%rsp), %rdx
	movslq	%r8d, %rcx
.L6:
	imulq	%rcx, %rdx
.L12:
	xorl	%eax, %eax
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	120(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L32
	xorl	%eax, %eax
	addq	$136, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
.L25:
	.cfi_restore_state
	cmpl	%r10d, %edx
	je	.L7
	movzbl	18(%rsp), %ecx
	testb	%cl, %cl
	je	.L20
.L16:
	movl	$1, %esi
	movl	$2, %eax
	jmp	.L10
	.p2align 4,,10
	.p2align 3
.L9:
	addl	$1, %eax
	movslq	%eax, %rdx
	movzbl	16(%rsp,%rdx), %ecx
	testb	%cl, %cl
	je	.L8
.L10:
	leal	-1(%rax), %edx
	movslq	%edx, %rdx
	cmpb	%cl, 16(%rsp,%rdx)
	jne	.L9
	addl	$1, %eax
	addl	$1, %esi
	movslq	%eax, %rdx
	cmpb	$0, 16(%rsp,%rdx)
	jne	.L9
.L8:
	movslq	12(%rsp), %rdi
	movslq	%r8d, %rcx
	movq	%rcx, %r10
	movq	%rdi, %rdx
	movl	%edi, %eax
	cmpl	%r8d, %esi
	je	.L6
	testl	%r9d, %r9d
	je	.L13
.L15:
	movl	$2, %ecx
	imulq	%r10, %rdi
	cltd
	idivl	%ecx
	cltq
	leaq	(%rdi,%rax), %rdx
	jmp	.L12
.L13:
	addq	$1, %rcx
	imulq	%rdi, %rcx
	leaq	-1(%rcx), %rdx
	jmp	.L12
.L4:
	cmpb	16(%rsp), %cl
	jne	.L29
.L7:
	movl	%edi, %ecx
	xorl	%esi, %esi
	movl	$1, %eax
	jmp	.L10
.L2:
	movzbl	18(%rsp), %ecx
	movl	$1, %r9d
	xorl	%r8d, %r8d
	testb	%cl, %cl
	jne	.L16
	movslq	12(%rsp), %rdi
	xorl	%r10d, %r10d
	movq	%rdi, %rax
	jmp	.L15
.L20:
	movl	$1, %esi
	jmp	.L8
.L32:
	call	__stack_chk_fail@PLT
	.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
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%s"
.LC1:
	.string	"%d%c"
.LC2:
	.string	"%lld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	subq	$136, %rsp
	.cfi_def_cfa_offset 144
	leaq	.LC0(%rip), %rdi
	movq	%fs:40, %rax
	movq	%rax, 120(%rsp)
	xorl	%eax, %eax
	leaq	16(%rsp), %rsi
	call	__isoc99_scanf@PLT
	leaq	.LC1(%rip), %rdi
	leaq	11(%rsp), %rdx
	xorl	%eax, %eax
	leaq	12(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movzbl	17(%rsp), %edi
	testb	%dil, %dil
	je	.L2
	movl	%edi, %ecx
	movl	$1, %r9d
	xorl	%r8d, %r8d
	movl	$1, %eax
	movl	$-1, %r10d
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L19:
	movl	%eax, %edx
	movl	%ecx, %esi
	xorl	%r9d, %r9d
	leal	1(%rdx), %eax
	movslq	%eax, %rcx
	movzbl	16(%rsp,%rcx), %ecx
	testb	%cl, %cl
	je	.L31
.L5:
	leal	-1(%rax), %edx
	movslq	%edx, %rdx
	cmpb	%cl, 16(%rsp,%rdx)
	jne	.L19
	leal	1(%rax), %edx
	addl	$1, %r8d
	movslq	%edx, %rsi
	movzbl	16(%rsp,%rsi), %esi
	testb	%sil, %sil
	je	.L4
	movl	%eax, %r10d
	leal	1(%rdx), %eax
	movslq	%eax, %rcx
	movzbl	16(%rsp,%rcx), %ecx
	testb	%cl, %cl
	jne	.L5
.L31:
	cmpb	%sil, 16(%rsp)
	je	.L25
.L29:
	movslq	12(%rsp), %rdx
	movslq	%r8d, %rcx
.L6:
	imulq	%rcx, %rdx
.L12:
	xorl	%eax, %eax
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	120(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L32
	xorl	%eax, %eax
	addq	$136, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
.L25:
	.cfi_restore_state
	cmpl	%r10d, %edx
	je	.L7
	movzbl	18(%rsp), %ecx
	testb	%cl, %cl
	je	.L20
.L16:
	movl	$1, %esi
	movl	$2, %eax
	jmp	.L10
	.p2align 4,,10
	.p2align 3
.L9:
	addl	$1, %eax
	movslq	%eax, %rdx
	movzbl	16(%rsp,%rdx), %ecx
	testb	%cl, %cl
	je	.L8
.L10:
	leal	-1(%rax), %edx
	movslq	%edx, %rdx
	cmpb	%cl, 16(%rsp,%rdx)
	jne	.L9
	addl	$1, %eax
	addl	$1, %esi
	movslq	%eax, %rdx
	cmpb	$0, 16(%rsp,%rdx)
	jne	.L9
.L8:
	movslq	12(%rsp), %rdi
	movslq	%r8d, %rcx
	movq	%rcx, %r10
	movq	%rdi, %rdx
	movl	%edi, %eax
	cmpl	%r8d, %esi
	je	.L6
	testl	%r9d, %r9d
	je	.L13
.L15:
	movl	$2, %ecx
	imulq	%r10, %rdi
	cltd
	idivl	%ecx
	cltq
	leaq	(%rdi,%rax), %rdx
	jmp	.L12
.L13:
	addq	$1, %rcx
	imulq	%rdi, %rcx
	leaq	-1(%rcx), %rdx
	jmp	.L12
.L4:
	cmpb	16(%rsp), %cl
	jne	.L29
.L7:
	movl	%edi, %ecx
	xorl	%esi, %esi
	movl	$1, %eax
	jmp	.L10
.L2:
	movzbl	18(%rsp), %ecx
	movl	$1, %r9d
	xorl	%r8d, %r8d
	testb	%cl, %cl
	jne	.L16
	movslq	12(%rsp), %rdi
	xorl	%r10d, %r10d
	movq	%rdi, %rax
	jmp	.L15
.L20:
	movl	$1, %esi
	jmp	.L8
.L32:
	call	__stack_chk_fail@PLT
	.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:

#include <stdio.h>

typedef enum {false, true} bool;

int main(void)
{
    char S[101];
    int K;
    char c;
    int i;
    int ctr, ctr2;
    int index;
    bool single, parity;
    long long ans;
    
    
    scanf("%s", S);
    scanf("%d%c", &K, &c);
    
    
    ctr = 0;
    index = -1;
    
    single = true;
    
    for(i=1; S[i] != '\0'; i++)
    {
        if(S[i-1] == S[i])
        {
            ctr++;
            
            index = i++;
            
            if(S[i] == '\0')
                break;
        }
        else
            single = false;
    }
    
    
    if(S[i-1] == S[0])
    {
        if(index == i-1)
        {
            ctr2 = 0;
            
            i = 1;
        }
        else
        {
            ctr2 = 1;
            
            i = 2;
        }
        
        for(; S[i] != '\0'; i++)
        {
            if(S[i-1] == S[i])
            {
                ctr2++;
                
                i++;
                
                if(S[i] == '\0')
                    break;
            }
        }
    }
    else
        ctr2 = ctr;
    
    
    if(ctr == ctr2)
        parity = false;
    else
        parity = true;
    
    
    if(single)
    {
        if(parity)
            ans = (long long)K*ctr+K/2;
        else
            ans = (long long)K*ctr;
    }
    else
    {
        if(parity)
            ans = (long long)K*ctr+K-1;
        else
            ans = (long long)K*ctr;
    }
    
    
    printf("%lld\n", ans);
    
    
    //system("pause");
    
    return 0;
}

cooooooooonteeeeeeeedest
999993333
 issih
2
 rq
81
 hssih
2
 cooooooooonteeeeeeeedest
1894324309
 hssih
3
 hssih
6
 tsedeeeeeeeetnoooooonooc
54816478
 tsedeeeeeeeetnoooooonooc
93364260
 rr
552

7999946664
 2
 0
 3
 15154594472
 5
 11
 438531824
 746914080
 552

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>

typedef enum {false, true} bool;

int main(void)
{
    char S[101];
    int K;
    char c;
    int i;
    int ctr, ctr2;
    int index;
    bool single, parity;
    long long ans;
    
    
    scanf("%s", S);
    scanf("%d%c", &K, &c);
    
    
    ctr = 0;
    index = -1;
    
    single = true;
    
    for(i=1; S[i] != '\0'; i++)
    {
        if(S[i-1] == S[i])
        {
            ctr++;
            
            index = i++;
            
            if(S[i] == '\0')
                break;
        }
        else
            single = false;
    }
    
    
    if(S[i-1] == S[0])
    {
        if(index == i-1)
        {
            ctr2 = 0;
            
            i = 1;
        }
        else
        {
            ctr2 = 1;
            
            i = 2;
        }
        
        for(; S[i] != '\0'; i++)
        {
            if(S[i-1] == S[i])
            {
                ctr2++;
                
                i++;
                
                if(S[i] == '\0')
                    break;
            }
        }
    }
    else
        ctr2 = ctr;
    
    
    if(ctr == ctr2)
        parity = false;
    else
        parity = true;
    
    
    if(single)
    {
        if(parity)
            ans = (long long)K*ctr+K/2;
        else
            ans = (long long)K*ctr;
    }
    else
    {
        if(parity)
            ans = (long long)K*ctr+K-1;
        else
            ans = (long long)K*ctr;
    }
    
    
    printf("%lld\n", ans);
    
    
    //system("pause");
    
    return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%s"
.LC1:
	.string	"%d%c"
.LC2:
	.string	"%lld\n"
	.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
	subq	$160, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-112(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-149(%rbp), %rdx
	leaq	-148(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -140(%rbp)
	movl	$-1, -132(%rbp)
	movl	$1, -128(%rbp)
	movl	$1, -144(%rbp)
	jmp	.L2
.L6:
	movl	-144(%rbp), %eax
	subl	$1, %eax
	cltq
	movzbl	-112(%rbp,%rax), %edx
	movl	-144(%rbp), %eax
	cltq
	movzbl	-112(%rbp,%rax), %eax
	cmpb	%al, %dl
	jne	.L3
	addl	$1, -140(%rbp)
	movl	-144(%rbp), %eax
	leal	1(%rax), %edx
	movl	%edx, -144(%rbp)
	movl	%eax, -132(%rbp)
	movl	-144(%rbp), %eax
	cltq
	movzbl	-112(%rbp,%rax), %eax
	testb	%al, %al
	jne	.L4
	jmp	.L5
.L3:
	movl	$0, -128(%rbp)
.L4:
	addl	$1, -144(%rbp)
.L2:
	movl	-144(%rbp), %eax
	cltq
	movzbl	-112(%rbp,%rax), %eax
	testb	%al, %al
	jne	.L6
.L5:
	movl	-144(%rbp), %eax
	subl	$1, %eax
	cltq
	movzbl	-112(%rbp,%rax), %edx
	movzbl	-112(%rbp), %eax
	cmpb	%al, %dl
	jne	.L7
	movl	-144(%rbp), %eax
	subl	$1, %eax
	cmpl	%eax, -132(%rbp)
	jne	.L8
	movl	$0, -136(%rbp)
	movl	$1, -144(%rbp)
	jmp	.L10
.L8:
	movl	$1, -136(%rbp)
	movl	$2, -144(%rbp)
	jmp	.L10
.L13:
	movl	-144(%rbp), %eax
	subl	$1, %eax
	cltq
	movzbl	-112(%rbp,%rax), %edx
	movl	-144(%rbp), %eax
	cltq
	movzbl	-112(%rbp,%rax), %eax
	cmpb	%al, %dl
	jne	.L11
	addl	$1, -136(%rbp)
	addl	$1, -144(%rbp)
	movl	-144(%rbp), %eax
	cltq
	movzbl	-112(%rbp,%rax), %eax
	testb	%al, %al
	je	.L23
.L11:
	addl	$1, -144(%rbp)
.L10:
	movl	-144(%rbp), %eax
	cltq
	movzbl	-112(%rbp,%rax), %eax
	testb	%al, %al
	jne	.L13
	jmp	.L14
.L7:
	movl	-140(%rbp), %eax
	movl	%eax, -136(%rbp)
	jmp	.L14
.L23:
	nop
.L14:
	movl	-140(%rbp), %eax
	cmpl	-136(%rbp), %eax
	jne	.L15
	movl	$0, -124(%rbp)
	jmp	.L16
.L15:
	movl	$1, -124(%rbp)
.L16:
	cmpl	$0, -128(%rbp)
	je	.L17
	cmpl	$0, -124(%rbp)
	je	.L18
	movl	-148(%rbp), %eax
	movslq	%eax, %rdx
	movl	-140(%rbp), %eax
	cltq
	imulq	%rax, %rdx
	movl	-148(%rbp), %eax
	movl	%eax, %ecx
	shrl	$31, %ecx
	addl	%ecx, %eax
	sarl	%eax
	cltq
	addq	%rdx, %rax
	movq	%rax, -120(%rbp)
	jmp	.L19
.L18:
	movl	-148(%rbp), %eax
	movslq	%eax, %rdx
	movl	-140(%rbp), %eax
	cltq
	imulq	%rdx, %rax
	movq	%rax, -120(%rbp)
	jmp	.L19
.L17:
	cmpl	$0, -124(%rbp)
	je	.L20
	movl	-148(%rbp), %eax
	movslq	%eax, %rdx
	movl	-140(%rbp), %eax
	cltq
	imulq	%rax, %rdx
	movl	-148(%rbp), %eax
	cltq
	addq	%rdx, %rax
	subq	$1, %rax
	movq	%rax, -120(%rbp)
	jmp	.L19
.L20:
	movl	-148(%rbp), %eax
	movslq	%eax, %rdx
	movl	-140(%rbp), %eax
	cltq
	imulq	%rdx, %rax
	movq	%rax, -120(%rbp)
.L19:
	movq	-120(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L22
	call	__stack_chk_fail@PLT
.L22:
	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%c"
.LC2:
	.string	"%lld\n"
	.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
	subq	$160, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-112(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-149(%rbp), %rdx
	leaq	-148(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -140(%rbp)
	movl	$-1, -132(%rbp)
	movl	$1, -128(%rbp)
	movl	$1, -144(%rbp)
	jmp	.L2
.L6:
	movl	-144(%rbp), %eax
	subl	$1, %eax
	cltq
	movzbl	-112(%rbp,%rax), %edx
	movl	-144(%rbp), %eax
	cltq
	movzbl	-112(%rbp,%rax), %eax
	cmpb	%al, %dl
	jne	.L3
	addl	$1, -140(%rbp)
	movl	-144(%rbp), %eax
	leal	1(%rax), %edx
	movl	%edx, -144(%rbp)
	movl	%eax, -132(%rbp)
	movl	-144(%rbp), %eax
	cltq
	movzbl	-112(%rbp,%rax), %eax
	testb	%al, %al
	jne	.L4
	jmp	.L5
.L3:
	movl	$0, -128(%rbp)
.L4:
	addl	$1, -144(%rbp)
.L2:
	movl	-144(%rbp), %eax
	cltq
	movzbl	-112(%rbp,%rax), %eax
	testb	%al, %al
	jne	.L6
.L5:
	movl	-144(%rbp), %eax
	subl	$1, %eax
	cltq
	movzbl	-112(%rbp,%rax), %edx
	movzbl	-112(%rbp), %eax
	cmpb	%al, %dl
	jne	.L7
	movl	-144(%rbp), %eax
	subl	$1, %eax
	cmpl	%eax, -132(%rbp)
	jne	.L8
	movl	$0, -136(%rbp)
	movl	$1, -144(%rbp)
	jmp	.L10
.L8:
	movl	$1, -136(%rbp)
	movl	$2, -144(%rbp)
	jmp	.L10
.L13:
	movl	-144(%rbp), %eax
	subl	$1, %eax
	cltq
	movzbl	-112(%rbp,%rax), %edx
	movl	-144(%rbp), %eax
	cltq
	movzbl	-112(%rbp,%rax), %eax
	cmpb	%al, %dl
	jne	.L11
	addl	$1, -136(%rbp)
	addl	$1, -144(%rbp)
	movl	-144(%rbp), %eax
	cltq
	movzbl	-112(%rbp,%rax), %eax
	testb	%al, %al
	je	.L23
.L11:
	addl	$1, -144(%rbp)
.L10:
	movl	-144(%rbp), %eax
	cltq
	movzbl	-112(%rbp,%rax), %eax
	testb	%al, %al
	jne	.L13
	jmp	.L14
.L7:
	movl	-140(%rbp), %eax
	movl	%eax, -136(%rbp)
	jmp	.L14
.L23:
	nop
.L14:
	movl	-140(%rbp), %eax
	cmpl	-136(%rbp), %eax
	jne	.L15
	movl	$0, -124(%rbp)
	jmp	.L16
.L15:
	movl	$1, -124(%rbp)
.L16:
	cmpl	$0, -128(%rbp)
	je	.L17
	cmpl	$0, -124(%rbp)
	je	.L18
	movl	-148(%rbp), %eax
	movslq	%eax, %rdx
	movl	-140(%rbp), %eax
	cltq
	imulq	%rax, %rdx
	movl	-148(%rbp), %eax
	movl	%eax, %ecx
	shrl	$31, %ecx
	addl	%ecx, %eax
	sarl	%eax
	cltq
	addq	%rdx, %rax
	movq	%rax, -120(%rbp)
	jmp	.L19
.L18:
	movl	-148(%rbp), %eax
	movslq	%eax, %rdx
	movl	-140(%rbp), %eax
	cltq
	imulq	%rdx, %rax
	movq	%rax, -120(%rbp)
	jmp	.L19
.L17:
	cmpl	$0, -124(%rbp)
	je	.L20
	movl	-148(%rbp), %eax
	movslq	%eax, %rdx
	movl	-140(%rbp), %eax
	cltq
	imulq	%rax, %rdx
	movl	-148(%rbp), %eax
	cltq
	addq	%rdx, %rax
	subq	$1, %rax
	movq	%rax, -120(%rbp)
	jmp	.L19
.L20:
	movl	-148(%rbp), %eax
	movslq	%eax, %rdx
	movl	-140(%rbp), %eax
	cltq
	imulq	%rdx, %rax
	movq	%rax, -120(%rbp)
.L19:
	movq	-120(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L22
	call	__stack_chk_fail@PLT
.L22:
	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:
