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 <stdlib.h>
#include <string.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)


//セグ木ここから
//*
//↓ここを変える
typedef struct atai{ll a;}atai;
atai xx(atai x,atai y){
	atai r;
	r.a=x.a+y.a;//sum
	return r;
}
//↑ここを変える

int segNUM;
atai segN[1<<18],*seg;
void seguse(int n){segNUM=n;seg=segN+segNUM;}

//seg[]に値を与えてから初期化
void seginit(){for(int node=segNUM-1;node;node--)segN[node]=xx(segN[node*2],segN[node*2+1]);}
void segupdate(int node,atai x){
	//seg[node]をxに更新
	node+=segNUM;
	segN[node]=x;
	while(node/=2)segN[node]=xx(segN[node*2],segN[node*2+1]);
}

atai segcalcsub(int l,int r,int k,int cl,int cr){
	//完全に含むとき
	if(l<=cl&&cr<=r)return segN[k];

	int cm=(cl+cr)/2;
	//左側だけ
	if(r<=cm)return segcalcsub(l,r,2*k  ,cl,cm);
	//右側だけ
	if(cm<=l)return segcalcsub(l,r,2*k+1,cm,cr);
	//両方
	return xx(segcalcsub(l,r,2*k,cl,cm),segcalcsub(l,r,2*k+1,cm,cr));
}
atai segcalc(int l,int r){return segcalcsub(l,r,1,0,segNUM);}
//セグ木ここまで

char s[200010];
int c[30];
int a[200010];
int p[200010];

ll ans;
int main(){
	scanf("%s",s);
	ll n=strlen(s);
	rep(i,0,n)c[s[i]-'a']++;
	
	int idx=-1;
	rep(i,0,26)if(c[i]%2){
		if(idx==-1)idx=i;
		else{
			puts("-1");
			return 0;
		}
	}
	
	rep(i,0,26)c[i]/=2;
	c[idx]++;

	rep(i,0,n){
		int t=s[i]-'a';
		if(c[t]){
			if(c[t]==1&&t==idx)a[i]=-2;
			else a[i]=-1;
			c[t]--;
		}else a[i]=-3;
	}
	
	//前半パート
	{
		int cnt=0;
		rep(i,0,n){
			if(a[i]==-1||a[i]==-2)ans+=cnt;
			if(a[i]==-2||a[i]==-3)cnt++;
		}
	}
	
	int cnt=0;
	rep(i,0,n)if(a[i]==-1)a[i]=cnt++;
	cnt=0;
	for(int i=n-1;i>=0;i--)if(a[i]==-3)a[i]=cnt++;
	
	//数列の構成
	rep(i,0,26){
		for(int l=0,r=n-1;l<r;l++,r--){
			while(l<r&&s[l]-'a'!=i)l++;
			if(l==r)break;
			while(s[r]-'a'!=i)r--;
			p[a[l]]=a[r];
		}
	}
	
	//転倒数の計算
	seguse(1<<17);
	rep(i,0,n/2){
		ans+=segcalc(p[i],n/2).a;
		atai r={1};
		segupdate(p[i],r);
	}
	
	printf("%lld",ans);
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	xx
	.type	xx, @function
xx:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -24(%rbp)
	movq	%rsi, -32(%rbp)
	movq	-24(%rbp), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, -8(%rbp)
	movq	-8(%rbp), %rax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	xx, .-xx
	.globl	segNUM
	.bss
	.align 4
	.type	segNUM, @object
	.size	segNUM, 4
segNUM:
	.zero	4
	.globl	segN
	.align 32
	.type	segN, @object
	.size	segN, 2097152
segN:
	.zero	2097152
	.globl	seg
	.align 8
	.type	seg, @object
	.size	seg, 8
seg:
	.zero	8
	.text
	.globl	seguse
	.type	seguse, @function
seguse:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -4(%rbp)
	movl	-4(%rbp), %eax
	movl	%eax, segNUM(%rip)
	movl	segNUM(%rip), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	segN(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, seg(%rip)
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	seguse, .-seguse
	.globl	seginit
	.type	seginit, @function
seginit:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r12
	pushq	%rbx
	subq	$16, %rsp
	.cfi_offset 12, -24
	.cfi_offset 3, -32
	movl	segNUM(%rip), %eax
	subl	$1, %eax
	movl	%eax, -20(%rbp)
	jmp	.L5
.L6:
	movl	-20(%rbp), %eax
	addl	%eax, %eax
	leal	1(%rax), %edx
	movl	-20(%rbp), %eax
	leal	(%rax,%rax), %ecx
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %r12
	leaq	segN(%rip), %rbx
	movslq	%edx, %rax
	leaq	0(,%rax,8), %rdx
	leaq	segN(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movslq	%ecx, %rax
	leaq	0(,%rax,8), %rcx
	leaq	segN(%rip), %rax
	movq	(%rcx,%rax), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	xx
	movq	%rax, (%r12,%rbx)
	subl	$1, -20(%rbp)
.L5:
	cmpl	$0, -20(%rbp)
	jne	.L6
	nop
	nop
	addq	$16, %rsp
	popq	%rbx
	popq	%r12
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	seginit, .-seginit
	.globl	segupdate
	.type	segupdate, @function
segupdate:
.LFB9:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r12
	pushq	%rbx
	subq	$16, %rsp
	.cfi_offset 12, -24
	.cfi_offset 3, -32
	movl	%edi, -20(%rbp)
	movq	%rsi, -32(%rbp)
	movl	segNUM(%rip), %eax
	addl	%eax, -20(%rbp)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	segN(%rip), %rdx
	movq	-32(%rbp), %rax
	movq	%rax, (%rcx,%rdx)
	jmp	.L8
.L9:
	movl	-20(%rbp), %eax
	addl	%eax, %eax
	leal	1(%rax), %edx
	movl	-20(%rbp), %eax
	leal	(%rax,%rax), %ecx
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %r12
	leaq	segN(%rip), %rbx
	movslq	%edx, %rax
	leaq	0(,%rax,8), %rdx
	leaq	segN(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movslq	%ecx, %rax
	leaq	0(,%rax,8), %rcx
	leaq	segN(%rip), %rax
	movq	(%rcx,%rax), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	xx
	movq	%rax, (%r12,%rbx)
.L8:
	movl	-20(%rbp), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, -20(%rbp)
	cmpl	$0, -20(%rbp)
	jne	.L9
	nop
	nop
	addq	$16, %rsp
	popq	%rbx
	popq	%r12
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.size	segupdate, .-segupdate
	.globl	segcalcsub
	.type	segcalcsub, @function
segcalcsub:
.LFB10:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%rbx
	subq	$56, %rsp
	.cfi_offset 3, -24
	movl	%edi, -36(%rbp)
	movl	%esi, -40(%rbp)
	movl	%edx, -44(%rbp)
	movl	%ecx, -48(%rbp)
	movl	%r8d, -52(%rbp)
	movl	-36(%rbp), %eax
	cmpl	-48(%rbp), %eax
	jg	.L11
	movl	-52(%rbp), %eax
	cmpl	-40(%rbp), %eax
	jg	.L11
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	segN(%rip), %rax
	movq	(%rdx,%rax), %rax
	jmp	.L12
.L11:
	movl	-48(%rbp), %edx
	movl	-52(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, -20(%rbp)
	movl	-40(%rbp), %eax
	cmpl	-20(%rbp), %eax
	jg	.L13
	movl	-44(%rbp), %eax
	leal	(%rax,%rax), %edi
	movl	-20(%rbp), %ecx
	movl	-48(%rbp), %edx
	movl	-40(%rbp), %esi
	movl	-36(%rbp), %eax
	movl	%ecx, %r8d
	movl	%edx, %ecx
	movl	%edi, %edx
	movl	%eax, %edi
	call	segcalcsub
	jmp	.L12
.L13:
	movl	-20(%rbp), %eax
	cmpl	-36(%rbp), %eax
	jg	.L14
	movl	-44(%rbp), %eax
	addl	%eax, %eax
	leal	1(%rax), %edi
	movl	-52(%rbp), %ecx
	movl	-20(%rbp), %edx
	movl	-40(%rbp), %esi
	movl	-36(%rbp), %eax
	movl	%ecx, %r8d
	movl	%edx, %ecx
	movl	%edi, %edx
	movl	%eax, %edi
	call	segcalcsub
	jmp	.L12
.L14:
	movl	-44(%rbp), %eax
	addl	%eax, %eax
	leal	1(%rax), %edi
	movl	-52(%rbp), %ecx
	movl	-20(%rbp), %edx
	movl	-40(%rbp), %esi
	movl	-36(%rbp), %eax
	movl	%ecx, %r8d
	movl	%edx, %ecx
	movl	%edi, %edx
	movl	%eax, %edi
	call	segcalcsub
	movq	%rax, %rbx
	movl	-44(%rbp), %eax
	leal	(%rax,%rax), %edi
	movl	-20(%rbp), %ecx
	movl	-48(%rbp), %edx
	movl	-40(%rbp), %esi
	movl	-36(%rbp), %eax
	movl	%ecx, %r8d
	movl	%edx, %ecx
	movl	%edi, %edx
	movl	%eax, %edi
	call	segcalcsub
	movq	%rbx, %rsi
	movq	%rax, %rdi
	call	xx
.L12:
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE10:
	.size	segcalcsub, .-segcalcsub
	.globl	segcalc
	.type	segcalc, @function
segcalc:
.LFB11:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movl	%edi, -4(%rbp)
	movl	%esi, -8(%rbp)
	movl	segNUM(%rip), %edx
	movl	-8(%rbp), %esi
	movl	-4(%rbp), %eax
	movl	%edx, %r8d
	movl	$0, %ecx
	movl	$1, %edx
	movl	%eax, %edi
	call	segcalcsub
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE11:
	.size	segcalc, .-segcalc
	.globl	s
	.bss
	.align 32
	.type	s, @object
	.size	s, 200010
s:
	.zero	200010
	.globl	c
	.align 32
	.type	c, @object
	.size	c, 120
c:
	.zero	120
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 800040
a:
	.zero	800040
	.globl	p
	.align 32
	.type	p, @object
	.size	p, 800040
p:
	.zero	800040
	.globl	ans
	.align 8
	.type	ans, @object
	.size	ans, 8
ans:
	.zero	8
	.section	.rodata
.LC0:
	.string	"%s"
.LC1:
	.string	"-1"
.LC2:
	.string	"%lld"
	.text
	.globl	main
	.type	main, @function
main:
.LFB12:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$112, %rsp
	leaq	s(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	s(%rip), %rax
	movq	%rax, %rdi
	call	strlen@PLT
	movq	%rax, -8(%rbp)
	movq	$0, -72(%rbp)
	jmp	.L18
.L19:
	leaq	s(%rip), %rdx
	movq	-72(%rbp), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	subl	$97, %eax
	movslq	%eax, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	c(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	leal	1(%rdx), %ecx
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	c(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	addq	$1, -72(%rbp)
.L18:
	movq	-72(%rbp), %rax
	cmpq	-8(%rbp), %rax
	jl	.L19
	movl	$-1, -108(%rbp)
	movq	$0, -64(%rbp)
	jmp	.L20
.L24:
	movq	-64(%rbp), %rax
	leaq	0(,%rax,4), %rdx
	leaq	c(%rip), %rax
	movl	(%rdx,%rax), %eax
	andl	$1, %eax
	testl	%eax, %eax
	je	.L21
	cmpl	$-1, -108(%rbp)
	jne	.L22
	movq	-64(%rbp), %rax
	movl	%eax, -108(%rbp)
	jmp	.L21
.L22:
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	movl	$0, %eax
	jmp	.L23
.L21:
	addq	$1, -64(%rbp)
.L20:
	cmpq	$25, -64(%rbp)
	jle	.L24
	movq	$0, -56(%rbp)
	jmp	.L25
.L26:
	movq	-56(%rbp), %rax
	leaq	0(,%rax,4), %rdx
	leaq	c(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, %ecx
	movq	-56(%rbp), %rax
	leaq	0(,%rax,4), %rdx
	leaq	c(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	addq	$1, -56(%rbp)
.L25:
	cmpq	$25, -56(%rbp)
	jle	.L26
	movl	-108(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	c(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	1(%rax), %ecx
	movl	-108(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	c(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movq	$0, -48(%rbp)
	jmp	.L27
.L32:
	leaq	s(%rip), %rdx
	movq	-48(%rbp), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	subl	$97, %eax
	movl	%eax, -84(%rbp)
	movl	-84(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	c(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	je	.L28
	movl	-84(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	c(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	$1, %eax
	jne	.L29
	movl	-84(%rbp), %eax
	cmpl	-108(%rbp), %eax
	jne	.L29
	movq	-48(%rbp), %rax
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	$-2, (%rdx,%rax)
	jmp	.L30
.L29:
	movq	-48(%rbp), %rax
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	$-1, (%rdx,%rax)
.L30:
	movl	-84(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	c(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	-1(%rax), %ecx
	movl	-84(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	c(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	jmp	.L31
.L28:
	movq	-48(%rbp), %rax
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	$-3, (%rdx,%rax)
.L31:
	addq	$1, -48(%rbp)
.L27:
	movq	-48(%rbp), %rax
	cmpq	-8(%rbp), %rax
	jl	.L32
	movl	$0, -104(%rbp)
	movq	$0, -40(%rbp)
	jmp	.L33
.L38:
	movq	-40(%rbp), %rax
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	$-1, %eax
	je	.L34
	movq	-40(%rbp), %rax
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	$-2, %eax
	jne	.L35
.L34:
	movl	-104(%rbp), %eax
	movslq	%eax, %rdx
	movq	ans(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, ans(%rip)
.L35:
	movq	-40(%rbp), %rax
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	$-2, %eax
	je	.L36
	movq	-40(%rbp), %rax
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	$-3, %eax
	jne	.L37
.L36:
	addl	$1, -104(%rbp)
.L37:
	addq	$1, -40(%rbp)
.L33:
	movq	-40(%rbp), %rax
	cmpq	-8(%rbp), %rax
	jl	.L38
	movl	$0, -100(%rbp)
	movq	$0, -32(%rbp)
	jmp	.L39
.L41:
	movq	-32(%rbp), %rax
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	$-1, %eax
	jne	.L40
	movl	-100(%rbp), %eax
	leal	1(%rax), %edx
	movl	%edx, -100(%rbp)
	movq	-32(%rbp), %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	a(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
.L40:
	addq	$1, -32(%rbp)
.L39:
	movq	-32(%rbp), %rax
	cmpq	-8(%rbp), %rax
	jl	.L41
	movl	$0, -100(%rbp)
	movq	-8(%rbp), %rax
	subl	$1, %eax
	movl	%eax, -96(%rbp)
	jmp	.L42
.L44:
	movl	-96(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	$-3, %eax
	jne	.L43
	movl	-100(%rbp), %eax
	leal	1(%rax), %edx
	movl	%edx, -100(%rbp)
	movl	-96(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	a(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
.L43:
	subl	$1, -96(%rbp)
.L42:
	cmpl	$0, -96(%rbp)
	jns	.L44
	movq	$0, -24(%rbp)
	jmp	.L45
.L55:
	movl	$0, -92(%rbp)
	movq	-8(%rbp), %rax
	subl	$1, %eax
	movl	%eax, -88(%rbp)
	jmp	.L46
.L49:
	addl	$1, -92(%rbp)
.L47:
	movl	-92(%rbp), %eax
	cmpl	-88(%rbp), %eax
	jge	.L48
	movl	-92(%rbp), %eax
	cltq
	leaq	s(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	movsbl	%al, %eax
	subl	$97, %eax
	cltq
	cmpq	%rax, -24(%rbp)
	jne	.L49
.L48:
	movl	-92(%rbp), %eax
	cmpl	-88(%rbp), %eax
	je	.L58
	jmp	.L52
.L53:
	subl	$1, -88(%rbp)
.L52:
	movl	-88(%rbp), %eax
	cltq
	leaq	s(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	movsbl	%al, %eax
	subl	$97, %eax
	cltq
	cmpq	%rax, -24(%rbp)
	jne	.L53
	movl	-92(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-88(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	a(%rip), %rax
	movl	(%rcx,%rax), %eax
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	p(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	addl	$1, -92(%rbp)
	subl	$1, -88(%rbp)
.L46:
	movl	-92(%rbp), %eax
	cmpl	-88(%rbp), %eax
	jl	.L47
	jmp	.L51
.L58:
	nop
.L51:
	addq	$1, -24(%rbp)
.L45:
	cmpq	$25, -24(%rbp)
	jle	.L55
	movl	$131072, %edi
	call	seguse
	movq	$0, -16(%rbp)
	jmp	.L56
.L57:
	movq	-8(%rbp), %rax
	movq	%rax, %rdx
	shrq	$63, %rdx
	addq	%rdx, %rax
	sarq	%rax
	movl	%eax, %ecx
	movq	-16(%rbp), %rax
	leaq	0(,%rax,4), %rdx
	leaq	p(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%ecx, %esi
	movl	%eax, %edi
	call	segcalc
	movq	%rax, %rdx
	movq	ans(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, ans(%rip)
	movq	$1, -80(%rbp)
	movq	-16(%rbp), %rax
	leaq	0(,%rax,4), %rdx
	leaq	p(%rip), %rax
	movl	(%rdx,%rax), %eax
	movq	-80(%rbp), %rdx
	movq	%rdx, %rsi
	movl	%eax, %edi
	call	segupdate
	addq	$1, -16(%rbp)
.L56:
	movq	-8(%rbp), %rax
	movq	%rax, %rdx
	shrq	$63, %rdx
	addq	%rdx, %rax
	sarq	%rax
	cmpq	%rax, -16(%rbp)
	jl	.L57
	movq	ans(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
.L23:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE12:
	.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
	.p2align 4
	.globl	xx
	.type	xx, @function
xx:
.LFB51:
	.cfi_startproc
	endbr64
	leaq	(%rdi,%rsi), %rax
	ret
	.cfi_endproc
.LFE51:
	.size	xx, .-xx
	.p2align 4
	.globl	seguse
	.type	seguse, @function
seguse:
.LFB52:
	.cfi_startproc
	endbr64
	movl	%edi, segNUM(%rip)
	leaq	segN(%rip), %rax
	movslq	%edi, %rdi
	leaq	(%rax,%rdi,8), %rax
	movq	%rax, seg(%rip)
	ret
	.cfi_endproc
.LFE52:
	.size	seguse, .-seguse
	.p2align 4
	.globl	seginit
	.type	seginit, @function
seginit:
.LFB53:
	.cfi_startproc
	endbr64
	movl	segNUM(%rip), %edx
	cmpl	$1, %edx
	je	.L4
	movslq	%edx, %rsi
	leaq	segN(%rip), %rcx
	subl	$2, %edx
	movq	%rsi, %rax
	salq	$4, %rax
	leaq	-16(%rcx,%rax), %rax
	leaq	(%rcx,%rsi,8), %rcx
	subq	%rdx, %rsi
	salq	$4, %rsi
	leaq	-32+segN(%rip), %rdx
	addq	%rdx, %rsi
	.p2align 4,,10
	.p2align 3
.L6:
	movq	8(%rax), %rdx
	subq	$16, %rax
	addq	16(%rax), %rdx
	subq	$8, %rcx
	movq	%rdx, (%rcx)
	cmpq	%rsi, %rax
	jne	.L6
.L4:
	ret
	.cfi_endproc
.LFE53:
	.size	seginit, .-seginit
	.p2align 4
	.globl	segupdate
	.type	segupdate, @function
segupdate:
.LFB54:
	.cfi_startproc
	endbr64
	addl	segNUM(%rip), %edi
	movq	%rsi, %r8
	leaq	segN(%rip), %rsi
	movslq	%edi, %rax
	movq	%r8, (%rsi,%rax,8)
	movl	%edi, %eax
	shrl	$31, %eax
	addl	%edi, %eax
	sarl	%eax
	je	.L11
	.p2align 4,,10
	.p2align 3
.L13:
	leal	(%rax,%rax), %edx
	movslq	%eax, %rdi
	leal	1(%rdx), %ecx
	movslq	%edx, %rdx
	movslq	%ecx, %rcx
	movq	(%rsi,%rdx,8), %rdx
	addq	(%rsi,%rcx,8), %rdx
	movq	%rdx, (%rsi,%rdi,8)
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	jne	.L13
.L11:
	ret
	.cfi_endproc
.LFE54:
	.size	segupdate, .-segupdate
	.p2align 4
	.globl	segcalcsub
	.type	segcalcsub, @function
segcalcsub:
.LFB55:
	.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
	movl	%edi, %r14d
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	movl	%ecx, %r13d
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movl	%edx, %r12d
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movl	%esi, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$8, %rsp
	.cfi_def_cfa_offset 64
	cmpl	%r8d, %esi
	jl	.L31
	cmpl	%ecx, %edi
	jle	.L19
	.p2align 4,,10
	.p2align 3
.L31:
	leal	0(%r13,%r8), %eax
	addl	%r12d, %r12d
	movl	%eax, %ebx
	shrl	$31, %ebx
	addl	%eax, %ebx
	sarl	%ebx
	cmpl	%ebx, %ebp
	jle	.L24
	leal	1(%r12), %edx
	cmpl	%ebx, %r14d
	jl	.L36
	movl	%ebx, %r13d
	movl	%edx, %r12d
.L23:
	cmpl	%r13d, %r14d
	jg	.L31
	cmpl	%r8d, %ebp
	jl	.L31
.L19:
	movslq	%r12d, %r12
	leaq	segN(%rip), %rax
	movq	(%rax,%r12,8), %rax
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	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
.L24:
	.cfi_restore_state
	movl	%ebx, %r8d
	jmp	.L23
	.p2align 4,,10
	.p2align 3
.L36:
	movl	%ebx, %ecx
	movl	%ebp, %esi
	movl	%r14d, %edi
	call	segcalcsub
	movl	%ebx, %r8d
	movl	%r13d, %ecx
	movl	%r12d, %edx
	movl	%ebp, %esi
	movl	%r14d, %edi
	movq	%rax, %r15
	call	segcalcsub
	addq	$8, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	addq	%r15, %rax
	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
	.cfi_endproc
.LFE55:
	.size	segcalcsub, .-segcalcsub
	.p2align 4
	.globl	segcalc
	.type	segcalc, @function
segcalc:
.LFB56:
	.cfi_startproc
	endbr64
	movl	segNUM(%rip), %r8d
	xorl	%ecx, %ecx
	movl	$1, %edx
	jmp	segcalcsub
	.cfi_endproc
.LFE56:
	.size	segcalc, .-segcalc
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%s"
.LC1:
	.string	"-1"
.LC2:
	.string	"%lld"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB57:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	leaq	.LC0(%rip), %rdi
	xorl	%eax, %eax
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	leaq	s(%rip), %rbx
	movq	%rbx, %rsi
	call	__isoc99_scanf@PLT
	movq	%rbx, %rdi
	call	strlen@PLT
	leaq	c(%rip), %rcx
	movq	%rbx, %rdx
	movq	%rax, %r9
	leaq	(%rbx,%rax), %rsi
	testq	%rax, %rax
	je	.L42
.L41:
	movsbl	(%rdx), %eax
	addq	$1, %rdx
	subl	$97, %eax
	cltq
	addl	$1, (%rcx,%rax,4)
	cmpq	%rdx, %rsi
	jne	.L41
.L42:
	xorl	%eax, %eax
	movl	$-1, %esi
	.p2align 4,,10
	.p2align 3
.L40:
	testb	$1, (%rcx,%rax,4)
	je	.L43
	cmpl	$-1, %esi
	jne	.L44
	movl	%eax, %esi
.L43:
	addq	$1, %rax
	cmpq	$26, %rax
	jne	.L40
	movl	96+c(%rip), %eax
	pxor	%xmm0, %xmm0
	leal	-1(%r9), %r10d
	movl	$2, %edi
	movdqa	%xmm0, %xmm2
	movdqa	c(%rip), %xmm1
	cltd
	pcmpgtd	c(%rip), %xmm2
	idivl	%edi
	psubd	%xmm2, %xmm1
	movdqa	%xmm0, %xmm2
	pcmpgtd	16+c(%rip), %xmm2
	psrad	$1, %xmm1
	movaps	%xmm1, c(%rip)
	movdqa	16+c(%rip), %xmm1
	psubd	%xmm2, %xmm1
	movdqa	%xmm0, %xmm2
	pcmpgtd	32+c(%rip), %xmm2
	psrad	$1, %xmm1
	movaps	%xmm1, 16+c(%rip)
	movdqa	32+c(%rip), %xmm1
	psubd	%xmm2, %xmm1
	movdqa	%xmm0, %xmm2
	pcmpgtd	48+c(%rip), %xmm2
	psrad	$1, %xmm1
	movaps	%xmm1, 32+c(%rip)
	movdqa	48+c(%rip), %xmm1
	psubd	%xmm2, %xmm1
	movdqa	%xmm0, %xmm2
	pcmpgtd	64+c(%rip), %xmm2
	psrad	$1, %xmm1
	movl	%eax, 96+c(%rip)
	movl	100+c(%rip), %eax
	pcmpgtd	80+c(%rip), %xmm0
	movaps	%xmm1, 48+c(%rip)
	movdqa	64+c(%rip), %xmm1
	cltd
	idivl	%edi
	psubd	%xmm2, %xmm1
	psrad	$1, %xmm1
	movaps	%xmm1, 64+c(%rip)
	movdqa	80+c(%rip), %xmm1
	psubd	%xmm0, %xmm1
	movdqa	%xmm1, %xmm0
	psrad	$1, %xmm0
	movaps	%xmm0, 80+c(%rip)
	movl	%eax, 100+c(%rip)
	movslq	%esi, %rax
	addl	$1, (%rcx,%rax,4)
	testq	%r9, %r9
	je	.L46
	leaq	a(%rip), %rax
	leaq	s(%rip), %rdx
	leaq	(%rbx,%r9), %r13
	movq	%rax, %rdi
	movq	%rax, %rbp
	jmp	.L49
.L101:
	cmpl	%r8d, %esi
	sete	%r14b
	xorl	%r8d, %r8d
	cmpl	$1, %r11d
	sete	%r8b
	subl	$1, %r11d
	addq	$1, %rdx
	addq	$4, %rbp
	andl	%r14d, %r8d
	movl	%r11d, (%rcx,%r12,4)
	notl	%r8d
	movl	%r8d, -4(%rbp)
	cmpq	%r13, %rdx
	je	.L100
.L49:
	movsbl	(%rdx), %r8d
	subl	$97, %r8d
	movslq	%r8d, %r12
	movl	(%rcx,%r12,4), %r11d
	testl	%r11d, %r11d
	jne	.L101
	addq	$1, %rdx
	movl	$-3, 0(%rbp)
	addq	$4, %rbp
	cmpq	%r13, %rdx
	jne	.L49
.L100:
	movq	ans(%rip), %r11
	leaq	(%rax,%r9,4), %r8
	xorl	%r12d, %r12d
	xorl	%esi, %esi
	leaq	a(%rip), %rcx
	movq	%r11, %rbp
.L52:
	movl	(%rcx), %edx
	cmpl	$-2, %edx
	jb	.L50
	movslq	%esi, %r12
	addq	%r12, %rbp
	movl	$1, %r12d
.L50:
	addl	$3, %edx
	cmpl	$2, %edx
	adcl	$0, %esi
	addq	$4, %rcx
	cmpq	%rcx, %r8
	jne	.L52
	testb	%r12b, %r12b
	je	.L53
	movq	%rbp, ans(%rip)
	movq	%rbp, %r11
.L53:
	xorl	%edx, %edx
.L55:
	cmpl	$-1, (%rax)
	jne	.L54
	movl	%edx, (%rax)
	addl	$1, %edx
.L54:
	addq	$4, %rax
	cmpq	%r8, %rax
	jne	.L55
.L73:
	movslq	%r10d, %rdx
	movl	%r10d, %ecx
	leaq	(%rdi,%rdx,4), %rax
	subq	%rcx, %rdx
	leaq	-4+a(%rip), %rcx
	leaq	(%rcx,%rdx,4), %rcx
	xorl	%edx, %edx
.L57:
	cmpl	$-3, (%rax)
	jne	.L56
	movl	%edx, (%rax)
	addl	$1, %edx
.L56:
	subq	$4, %rax
	cmpq	%rax, %rcx
	jne	.L57
	xorl	%esi, %esi
	leaq	p(%rip), %r8
	testl	%r10d, %r10d
	jle	.L59
	.p2align 4,,10
	.p2align 3
.L58:
	movl	%r10d, %edx
	xorl	%ebp, %ebp
	.p2align 4,,10
	.p2align 3
.L67:
	movslq	%ebp, %r12
	addq	%rbx, %r12
	.p2align 4,,10
	.p2align 3
.L66:
	movsbl	(%r12), %eax
	movl	%ebp, %ecx
	leal	1(%rbp), %ebp
	subl	$97, %eax
	cltq
	cmpq	%rsi, %rax
	je	.L62
	addq	$1, %r12
	cmpl	%ebp, %edx
	jg	.L66
	je	.L63
	movl	%ebp, %ecx
.L62:
	movslq	%edx, %rbp
	movsbl	(%rbx,%rbp), %eax
	subl	$97, %eax
	cltq
	cmpq	%rsi, %rax
	je	.L64
	leal	-1(%rdx), %ebp
	movslq	%ebp, %rbp
	.p2align 4,,10
	.p2align 3
.L65:
	movsbl	(%rbx,%rbp), %eax
	movl	%ebp, %edx
	subq	$1, %rbp
	subl	$97, %eax
	cltq
	cmpq	%rsi, %rax
	jne	.L65
	movslq	%edx, %rbp
.L64:
	movslq	%ecx, %rax
	movl	(%rdi,%rbp,4), %ebp
	subl	$1, %edx
	movslq	(%rdi,%rax,4), %rax
	movl	%ebp, (%r8,%rax,4)
	leal	1(%rcx), %ebp
	cmpl	%edx, %ebp
	jl	.L67
.L63:
	addq	$1, %rsi
	cmpq	$26, %rsi
	jne	.L58
.L59:
	leaq	1048576+segN(%rip), %rax
	sarq	%r9
	movq	%r11, %r10
	movl	$131072, segNUM(%rip)
	movq	%rax, seg(%rip)
	je	.L71
	leaq	p(%rip), %r11
	movl	%r9d, %ebp
	leaq	(%r11,%r9,4), %rbx
	leaq	segN(%rip), %r9
.L70:
	movl	(%r11), %r12d
	xorl	%ecx, %ecx
	movl	$1, %edx
	movl	$131072, %r8d
	movl	%ebp, %esi
	movl	%r12d, %edi
	call	segcalcsub
	leal	131072(%r12), %edx
	addq	%rax, %r10
	movslq	%edx, %rax
	movq	$1, (%r9,%rax,8)
	movl	%edx, %eax
	shrl	$31, %eax
	movq	%r10, ans(%rip)
	addl	%edx, %eax
	sarl	%eax
	je	.L72
	.p2align 4,,10
	.p2align 3
.L69:
	leal	(%rax,%rax), %edx
	movslq	%eax, %rsi
	leal	1(%rdx), %ecx
	movslq	%edx, %rdx
	movslq	%ecx, %rcx
	movq	(%r9,%rdx,8), %rdx
	addq	(%r9,%rcx,8), %rdx
	movq	%rdx, (%r9,%rsi,8)
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	jne	.L69
.L72:
	addq	$4, %r11
	cmpq	%r11, %rbx
	jne	.L70
	movq	ans(%rip), %r11
.L71:
	movq	%r11, %rdx
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L97:
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
.L44:
	.cfi_restore_state
	leaq	.LC1(%rip), %rdi
	call	puts@PLT
	jmp	.L97
.L46:
	cmpl	$-1, %r10d
	jne	.L78
	movq	ans(%rip), %r11
	jmp	.L59
.L78:
	movq	ans(%rip), %r11
	leaq	a(%rip), %rdi
	jmp	.L73
	.cfi_endproc
.LFE57:
	.size	main, .-main
	.globl	ans
	.bss
	.align 8
	.type	ans, @object
	.size	ans, 8
ans:
	.zero	8
	.globl	p
	.align 32
	.type	p, @object
	.size	p, 800040
p:
	.zero	800040
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 800040
a:
	.zero	800040
	.globl	c
	.align 32
	.type	c, @object
	.size	c, 120
c:
	.zero	120
	.globl	s
	.align 32
	.type	s, @object
	.size	s, 200010
s:
	.zero	200010
	.globl	seg
	.align 8
	.type	seg, @object
	.size	seg, 8
seg:
	.zero	8
	.globl	segN
	.align 32
	.type	segN, @object
	.size	segN, 2097152
segN:
	.zero	2097152
	.globl	segNUM
	.align 4
	.type	segNUM, @object
	.size	segNUM, 4
segNUM:
	.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
	.file	"temp.c"
	.text
	.p2align 4
	.globl	xx
	.type	xx, @function
xx:
.LFB51:
	.cfi_startproc
	endbr64
	leaq	(%rdi,%rsi), %rax
	ret
	.cfi_endproc
.LFE51:
	.size	xx, .-xx
	.p2align 4
	.globl	seguse
	.type	seguse, @function
seguse:
.LFB52:
	.cfi_startproc
	endbr64
	movl	%edi, segNUM(%rip)
	leaq	segN(%rip), %rax
	movslq	%edi, %rdi
	leaq	(%rax,%rdi,8), %rax
	movq	%rax, seg(%rip)
	ret
	.cfi_endproc
.LFE52:
	.size	seguse, .-seguse
	.p2align 4
	.globl	seginit
	.type	seginit, @function
seginit:
.LFB53:
	.cfi_startproc
	endbr64
	movl	segNUM(%rip), %edx
	cmpl	$1, %edx
	je	.L4
	movslq	%edx, %rsi
	leaq	segN(%rip), %rcx
	subl	$2, %edx
	movq	%rsi, %rax
	salq	$4, %rax
	leaq	-16(%rcx,%rax), %rax
	leaq	(%rcx,%rsi,8), %rcx
	subq	%rdx, %rsi
	salq	$4, %rsi
	leaq	-32+segN(%rip), %rdx
	addq	%rdx, %rsi
	.p2align 4,,10
	.p2align 3
.L6:
	movq	8(%rax), %rdx
	subq	$16, %rax
	addq	16(%rax), %rdx
	subq	$8, %rcx
	movq	%rdx, (%rcx)
	cmpq	%rsi, %rax
	jne	.L6
.L4:
	ret
	.cfi_endproc
.LFE53:
	.size	seginit, .-seginit
	.p2align 4
	.globl	segupdate
	.type	segupdate, @function
segupdate:
.LFB54:
	.cfi_startproc
	endbr64
	addl	segNUM(%rip), %edi
	movq	%rsi, %r8
	leaq	segN(%rip), %rsi
	movslq	%edi, %rax
	movq	%r8, (%rsi,%rax,8)
	movl	%edi, %eax
	shrl	$31, %eax
	addl	%edi, %eax
	sarl	%eax
	je	.L11
	.p2align 4,,10
	.p2align 3
.L13:
	leal	(%rax,%rax), %edx
	movslq	%eax, %rdi
	leal	1(%rdx), %ecx
	movslq	%edx, %rdx
	movslq	%ecx, %rcx
	movq	(%rsi,%rdx,8), %rdx
	addq	(%rsi,%rcx,8), %rdx
	movq	%rdx, (%rsi,%rdi,8)
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	jne	.L13
.L11:
	ret
	.cfi_endproc
.LFE54:
	.size	segupdate, .-segupdate
	.p2align 4
	.globl	segcalcsub
	.type	segcalcsub, @function
segcalcsub:
.LFB55:
	.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
	movl	%edi, %r14d
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	movl	%ecx, %r13d
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movl	%edx, %r12d
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movl	%esi, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$8, %rsp
	.cfi_def_cfa_offset 64
	cmpl	%r8d, %esi
	jl	.L31
	cmpl	%ecx, %edi
	jle	.L19
	.p2align 4,,10
	.p2align 3
.L31:
	leal	0(%r13,%r8), %eax
	addl	%r12d, %r12d
	movl	%eax, %ebx
	shrl	$31, %ebx
	addl	%eax, %ebx
	sarl	%ebx
	cmpl	%ebx, %ebp
	jle	.L24
	leal	1(%r12), %edx
	cmpl	%ebx, %r14d
	jl	.L36
	movl	%ebx, %r13d
	movl	%edx, %r12d
.L23:
	cmpl	%r13d, %r14d
	jg	.L31
	cmpl	%r8d, %ebp
	jl	.L31
.L19:
	movslq	%r12d, %r12
	leaq	segN(%rip), %rax
	movq	(%rax,%r12,8), %rax
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	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
.L24:
	.cfi_restore_state
	movl	%ebx, %r8d
	jmp	.L23
	.p2align 4,,10
	.p2align 3
.L36:
	movl	%ebx, %ecx
	movl	%ebp, %esi
	movl	%r14d, %edi
	call	segcalcsub
	movl	%ebx, %r8d
	movl	%r13d, %ecx
	movl	%r12d, %edx
	movl	%ebp, %esi
	movl	%r14d, %edi
	movq	%rax, %r15
	call	segcalcsub
	addq	$8, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	addq	%r15, %rax
	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
	.cfi_endproc
.LFE55:
	.size	segcalcsub, .-segcalcsub
	.p2align 4
	.globl	segcalc
	.type	segcalc, @function
segcalc:
.LFB56:
	.cfi_startproc
	endbr64
	movl	segNUM(%rip), %r8d
	xorl	%ecx, %ecx
	movl	$1, %edx
	jmp	segcalcsub
	.cfi_endproc
.LFE56:
	.size	segcalc, .-segcalc
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%s"
.LC1:
	.string	"-1"
.LC2:
	.string	"%lld"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB57:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	leaq	.LC0(%rip), %rdi
	xorl	%eax, %eax
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	leaq	s(%rip), %rbx
	movq	%rbx, %rsi
	call	__isoc99_scanf@PLT
	movq	%rbx, %rdi
	call	strlen@PLT
	leaq	c(%rip), %rcx
	movq	%rbx, %rdx
	movq	%rax, %r9
	leaq	(%rbx,%rax), %rsi
	testq	%rax, %rax
	je	.L42
.L41:
	movsbl	(%rdx), %eax
	addq	$1, %rdx
	subl	$97, %eax
	cltq
	addl	$1, (%rcx,%rax,4)
	cmpq	%rdx, %rsi
	jne	.L41
.L42:
	xorl	%eax, %eax
	movl	$-1, %esi
	.p2align 4,,10
	.p2align 3
.L40:
	testb	$1, (%rcx,%rax,4)
	je	.L43
	cmpl	$-1, %esi
	jne	.L44
	movl	%eax, %esi
.L43:
	addq	$1, %rax
	cmpq	$26, %rax
	jne	.L40
	movl	96+c(%rip), %eax
	pxor	%xmm0, %xmm0
	leal	-1(%r9), %r10d
	movl	$2, %edi
	movdqa	%xmm0, %xmm2
	movdqa	c(%rip), %xmm1
	cltd
	pcmpgtd	c(%rip), %xmm2
	idivl	%edi
	psubd	%xmm2, %xmm1
	movdqa	%xmm0, %xmm2
	pcmpgtd	16+c(%rip), %xmm2
	psrad	$1, %xmm1
	movaps	%xmm1, c(%rip)
	movdqa	16+c(%rip), %xmm1
	psubd	%xmm2, %xmm1
	movdqa	%xmm0, %xmm2
	pcmpgtd	32+c(%rip), %xmm2
	psrad	$1, %xmm1
	movaps	%xmm1, 16+c(%rip)
	movdqa	32+c(%rip), %xmm1
	psubd	%xmm2, %xmm1
	movdqa	%xmm0, %xmm2
	pcmpgtd	48+c(%rip), %xmm2
	psrad	$1, %xmm1
	movaps	%xmm1, 32+c(%rip)
	movdqa	48+c(%rip), %xmm1
	psubd	%xmm2, %xmm1
	movdqa	%xmm0, %xmm2
	pcmpgtd	64+c(%rip), %xmm2
	psrad	$1, %xmm1
	movl	%eax, 96+c(%rip)
	movl	100+c(%rip), %eax
	pcmpgtd	80+c(%rip), %xmm0
	movaps	%xmm1, 48+c(%rip)
	movdqa	64+c(%rip), %xmm1
	cltd
	idivl	%edi
	psubd	%xmm2, %xmm1
	psrad	$1, %xmm1
	movaps	%xmm1, 64+c(%rip)
	movdqa	80+c(%rip), %xmm1
	psubd	%xmm0, %xmm1
	movdqa	%xmm1, %xmm0
	psrad	$1, %xmm0
	movaps	%xmm0, 80+c(%rip)
	movl	%eax, 100+c(%rip)
	movslq	%esi, %rax
	addl	$1, (%rcx,%rax,4)
	testq	%r9, %r9
	je	.L46
	leaq	a(%rip), %rax
	leaq	s(%rip), %rdx
	leaq	(%rbx,%r9), %r13
	movq	%rax, %rdi
	movq	%rax, %rbp
	jmp	.L49
.L101:
	cmpl	%r8d, %esi
	sete	%r14b
	xorl	%r8d, %r8d
	cmpl	$1, %r11d
	sete	%r8b
	subl	$1, %r11d
	addq	$1, %rdx
	addq	$4, %rbp
	andl	%r14d, %r8d
	movl	%r11d, (%rcx,%r12,4)
	notl	%r8d
	movl	%r8d, -4(%rbp)
	cmpq	%r13, %rdx
	je	.L100
.L49:
	movsbl	(%rdx), %r8d
	subl	$97, %r8d
	movslq	%r8d, %r12
	movl	(%rcx,%r12,4), %r11d
	testl	%r11d, %r11d
	jne	.L101
	addq	$1, %rdx
	movl	$-3, 0(%rbp)
	addq	$4, %rbp
	cmpq	%r13, %rdx
	jne	.L49
.L100:
	movq	ans(%rip), %r11
	leaq	(%rax,%r9,4), %r8
	xorl	%r12d, %r12d
	xorl	%esi, %esi
	leaq	a(%rip), %rcx
	movq	%r11, %rbp
.L52:
	movl	(%rcx), %edx
	cmpl	$-2, %edx
	jb	.L50
	movslq	%esi, %r12
	addq	%r12, %rbp
	movl	$1, %r12d
.L50:
	addl	$3, %edx
	cmpl	$2, %edx
	adcl	$0, %esi
	addq	$4, %rcx
	cmpq	%rcx, %r8
	jne	.L52
	testb	%r12b, %r12b
	je	.L53
	movq	%rbp, ans(%rip)
	movq	%rbp, %r11
.L53:
	xorl	%edx, %edx
.L55:
	cmpl	$-1, (%rax)
	jne	.L54
	movl	%edx, (%rax)
	addl	$1, %edx
.L54:
	addq	$4, %rax
	cmpq	%r8, %rax
	jne	.L55
.L73:
	movslq	%r10d, %rdx
	movl	%r10d, %ecx
	leaq	(%rdi,%rdx,4), %rax
	subq	%rcx, %rdx
	leaq	-4+a(%rip), %rcx
	leaq	(%rcx,%rdx,4), %rcx
	xorl	%edx, %edx
.L57:
	cmpl	$-3, (%rax)
	jne	.L56
	movl	%edx, (%rax)
	addl	$1, %edx
.L56:
	subq	$4, %rax
	cmpq	%rax, %rcx
	jne	.L57
	xorl	%esi, %esi
	leaq	p(%rip), %r8
	testl	%r10d, %r10d
	jle	.L59
	.p2align 4,,10
	.p2align 3
.L58:
	movl	%r10d, %edx
	xorl	%ebp, %ebp
	.p2align 4,,10
	.p2align 3
.L67:
	movslq	%ebp, %r12
	addq	%rbx, %r12
	.p2align 4,,10
	.p2align 3
.L66:
	movsbl	(%r12), %eax
	movl	%ebp, %ecx
	leal	1(%rbp), %ebp
	subl	$97, %eax
	cltq
	cmpq	%rsi, %rax
	je	.L62
	addq	$1, %r12
	cmpl	%ebp, %edx
	jg	.L66
	je	.L63
	movl	%ebp, %ecx
.L62:
	movslq	%edx, %rbp
	movsbl	(%rbx,%rbp), %eax
	subl	$97, %eax
	cltq
	cmpq	%rsi, %rax
	je	.L64
	leal	-1(%rdx), %ebp
	movslq	%ebp, %rbp
	.p2align 4,,10
	.p2align 3
.L65:
	movsbl	(%rbx,%rbp), %eax
	movl	%ebp, %edx
	subq	$1, %rbp
	subl	$97, %eax
	cltq
	cmpq	%rsi, %rax
	jne	.L65
	movslq	%edx, %rbp
.L64:
	movslq	%ecx, %rax
	movl	(%rdi,%rbp,4), %ebp
	subl	$1, %edx
	movslq	(%rdi,%rax,4), %rax
	movl	%ebp, (%r8,%rax,4)
	leal	1(%rcx), %ebp
	cmpl	%edx, %ebp
	jl	.L67
.L63:
	addq	$1, %rsi
	cmpq	$26, %rsi
	jne	.L58
.L59:
	leaq	1048576+segN(%rip), %rax
	sarq	%r9
	movq	%r11, %r10
	movl	$131072, segNUM(%rip)
	movq	%rax, seg(%rip)
	je	.L71
	leaq	p(%rip), %r11
	movl	%r9d, %ebp
	leaq	(%r11,%r9,4), %rbx
	leaq	segN(%rip), %r9
.L70:
	movl	(%r11), %r12d
	xorl	%ecx, %ecx
	movl	$1, %edx
	movl	$131072, %r8d
	movl	%ebp, %esi
	movl	%r12d, %edi
	call	segcalcsub
	leal	131072(%r12), %edx
	addq	%rax, %r10
	movslq	%edx, %rax
	movq	$1, (%r9,%rax,8)
	movl	%edx, %eax
	shrl	$31, %eax
	movq	%r10, ans(%rip)
	addl	%edx, %eax
	sarl	%eax
	je	.L72
	.p2align 4,,10
	.p2align 3
.L69:
	leal	(%rax,%rax), %edx
	movslq	%eax, %rsi
	leal	1(%rdx), %ecx
	movslq	%edx, %rdx
	movslq	%ecx, %rcx
	movq	(%r9,%rdx,8), %rdx
	addq	(%r9,%rcx,8), %rdx
	movq	%rdx, (%r9,%rsi,8)
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	jne	.L69
.L72:
	addq	$4, %r11
	cmpq	%r11, %rbx
	jne	.L70
	movq	ans(%rip), %r11
.L71:
	movq	%r11, %rdx
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L97:
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
.L44:
	.cfi_restore_state
	leaq	.LC1(%rip), %rdi
	call	puts@PLT
	jmp	.L97
.L46:
	cmpl	$-1, %r10d
	jne	.L78
	movq	ans(%rip), %r11
	jmp	.L59
.L78:
	movq	ans(%rip), %r11
	leaq	a(%rip), %rdi
	jmp	.L73
	.cfi_endproc
.LFE57:
	.size	main, .-main
	.globl	ans
	.bss
	.align 8
	.type	ans, @object
	.size	ans, 8
ans:
	.zero	8
	.globl	p
	.align 32
	.type	p, @object
	.size	p, 800040
p:
	.zero	800040
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 800040
a:
	.zero	800040
	.globl	c
	.align 32
	.type	c, @object
	.size	c, 120
c:
	.zero	120
	.globl	s
	.align 32
	.type	s, @object
	.size	s, 200010
s:
	.zero	200010
	.globl	seg
	.align 8
	.type	seg, @object
	.size	seg, 8
seg:
	.zero	8
	.globl	segN
	.align 32
	.type	segN, @object
	.size	segN, 2097152
segN:
	.zero	2097152
	.globl	segNUM
	.align 4
	.type	segNUM, @object
	.size	segNUM, 4
segNUM:
	.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:

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)


//セグ木ここから
//*
//↓ここを変える
typedef struct atai{ll a;}atai;
atai xx(atai x,atai y){
	atai r;
	r.a=x.a+y.a;//sum
	return r;
}
//↑ここを変える

int segNUM;
atai segN[1<<18],*seg;
void seguse(int n){segNUM=n;seg=segN+segNUM;}

//seg[]に値を与えてから初期化
void seginit(){for(int node=segNUM-1;node;node--)segN[node]=xx(segN[node*2],segN[node*2+1]);}
void segupdate(int node,atai x){
	//seg[node]をxに更新
	node+=segNUM;
	segN[node]=x;
	while(node/=2)segN[node]=xx(segN[node*2],segN[node*2+1]);
}

atai segcalcsub(int l,int r,int k,int cl,int cr){
	//完全に含むとき
	if(l<=cl&&cr<=r)return segN[k];

	int cm=(cl+cr)/2;
	//左側だけ
	if(r<=cm)return segcalcsub(l,r,2*k  ,cl,cm);
	//右側だけ
	if(cm<=l)return segcalcsub(l,r,2*k+1,cm,cr);
	//両方
	return xx(segcalcsub(l,r,2*k,cl,cm),segcalcsub(l,r,2*k+1,cm,cr));
}
atai segcalc(int l,int r){return segcalcsub(l,r,1,0,segNUM);}
//セグ木ここまで

char s[200010];
int c[30];
int a[200010];
int p[200010];

ll ans;
int main(){
	scanf("%s",s);
	ll n=strlen(s);
	rep(i,0,n)c[s[i]-'a']++;
	
	int idx=-1;
	rep(i,0,26)if(c[i]%2){
		if(idx==-1)idx=i;
		else{
			puts("-1");
			return 0;
		}
	}
	
	rep(i,0,26)c[i]/=2;
	c[idx]++;

	rep(i,0,n){
		int t=s[i]-'a';
		if(c[t]){
			if(c[t]==1&&t==idx)a[i]=-2;
			else a[i]=-1;
			c[t]--;
		}else a[i]=-3;
	}
	
	//前半パート
	{
		int cnt=0;
		rep(i,0,n){
			if(a[i]==-1||a[i]==-2)ans+=cnt;
			if(a[i]==-2||a[i]==-3)cnt++;
		}
	}
	
	int cnt=0;
	rep(i,0,n)if(a[i]==-1)a[i]=cnt++;
	cnt=0;
	for(int i=n-1;i>=0;i--)if(a[i]==-3)a[i]=cnt++;
	
	//数列の構成
	rep(i,0,26){
		for(int l=0,r=n-1;l<r;l++,r--){
			while(l<r&&s[l]-'a'!=i)l++;
			if(l==r)break;
			while(s[r]-'a'!=i)r--;
			p[a[l]]=a[r];
		}
	}
	
	//転倒数の計算
	seguse(1<<17);
	rep(i,0,n/2){
		ans+=segcalc(p[i],n/2).a;
		atai r={1};
		segupdate(p[i],r);
	}
	
	printf("%lld",ans);
}
snkue
 aatatmma
 aatmtmaa
 eoe
 efl
 snkuf
 lfe
 fnkus
 aatltmaa
 fle

-1
 5 1 0 -1
 -1
 -1
 -1
 -1
 -1

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 <stdlib.h>
#include <string.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)


//セグ木ここから
//*
//↓ここを変える
typedef struct atai{ll a;}atai;
atai xx(atai x,atai y){
	atai r;
	r.a=x.a+y.a;//sum
	return r;
}
//↑ここを変える

int segNUM;
atai segN[1<<18],*seg;
void seguse(int n){segNUM=n;seg=segN+segNUM;}

//seg[]に値を与えてから初期化
void seginit(){for(int node=segNUM-1;node;node--)segN[node]=xx(segN[node*2],segN[node*2+1]);}
void segupdate(int node,atai x){
	//seg[node]をxに更新
	node+=segNUM;
	segN[node]=x;
	while(node/=2)segN[node]=xx(segN[node*2],segN[node*2+1]);
}

atai segcalcsub(int l,int r,int k,int cl,int cr){
	//完全に含むとき
	if(l<=cl&&cr<=r)return segN[k];

	int cm=(cl+cr)/2;
	//左側だけ
	if(r<=cm)return segcalcsub(l,r,2*k  ,cl,cm);
	//右側だけ
	if(cm<=l)return segcalcsub(l,r,2*k+1,cm,cr);
	//両方
	return xx(segcalcsub(l,r,2*k,cl,cm),segcalcsub(l,r,2*k+1,cm,cr));
}
atai segcalc(int l,int r){return segcalcsub(l,r,1,0,segNUM);}
//セグ木ここまで

char s[200010];
int c[30];
int a[200010];
int p[200010];

ll ans;
int main(){
	scanf("%s",s);
	ll n=strlen(s);
	rep(i,0,n)c[s[i]-'a']++;
	
	int idx=-1;
	rep(i,0,26)if(c[i]%2){
		if(idx==-1)idx=i;
		else{
			puts("-1");
			return 0;
		}
	}
	
	rep(i,0,26)c[i]/=2;
	c[idx]++;

	rep(i,0,n){
		int t=s[i]-'a';
		if(c[t]){
			if(c[t]==1&&t==idx)a[i]=-2;
			else a[i]=-1;
			c[t]--;
		}else a[i]=-3;
	}
	
	//前半パート
	{
		int cnt=0;
		rep(i,0,n){
			if(a[i]==-1||a[i]==-2)ans+=cnt;
			if(a[i]==-2||a[i]==-3)cnt++;
		}
	}
	
	int cnt=0;
	rep(i,0,n)if(a[i]==-1)a[i]=cnt++;
	cnt=0;
	for(int i=n-1;i>=0;i--)if(a[i]==-3)a[i]=cnt++;
	
	//数列の構成
	rep(i,0,26){
		for(int l=0,r=n-1;l<r;l++,r--){
			while(l<r&&s[l]-'a'!=i)l++;
			if(l==r)break;
			while(s[r]-'a'!=i)r--;
			p[a[l]]=a[r];
		}
	}
	
	//転倒数の計算
	seguse(1<<17);
	rep(i,0,n/2){
		ans+=segcalc(p[i],n/2).a;
		atai r={1};
		segupdate(p[i],r);
	}
	
	printf("%lld",ans);
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	xx
	.type	xx, @function
xx:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -24(%rbp)
	movq	%rsi, -32(%rbp)
	movq	-24(%rbp), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, -8(%rbp)
	movq	-8(%rbp), %rax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	xx, .-xx
	.globl	segNUM
	.bss
	.align 4
	.type	segNUM, @object
	.size	segNUM, 4
segNUM:
	.zero	4
	.globl	segN
	.align 32
	.type	segN, @object
	.size	segN, 2097152
segN:
	.zero	2097152
	.globl	seg
	.align 8
	.type	seg, @object
	.size	seg, 8
seg:
	.zero	8
	.text
	.globl	seguse
	.type	seguse, @function
seguse:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -4(%rbp)
	movl	-4(%rbp), %eax
	movl	%eax, segNUM(%rip)
	movl	segNUM(%rip), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	segN(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, seg(%rip)
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	seguse, .-seguse
	.globl	seginit
	.type	seginit, @function
seginit:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r12
	pushq	%rbx
	subq	$16, %rsp
	.cfi_offset 12, -24
	.cfi_offset 3, -32
	movl	segNUM(%rip), %eax
	subl	$1, %eax
	movl	%eax, -20(%rbp)
	jmp	.L5
.L6:
	movl	-20(%rbp), %eax
	addl	%eax, %eax
	leal	1(%rax), %edx
	movl	-20(%rbp), %eax
	leal	(%rax,%rax), %ecx
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %r12
	leaq	segN(%rip), %rbx
	movslq	%edx, %rax
	leaq	0(,%rax,8), %rdx
	leaq	segN(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movslq	%ecx, %rax
	leaq	0(,%rax,8), %rcx
	leaq	segN(%rip), %rax
	movq	(%rcx,%rax), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	xx
	movq	%rax, (%r12,%rbx)
	subl	$1, -20(%rbp)
.L5:
	cmpl	$0, -20(%rbp)
	jne	.L6
	nop
	nop
	addq	$16, %rsp
	popq	%rbx
	popq	%r12
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	seginit, .-seginit
	.globl	segupdate
	.type	segupdate, @function
segupdate:
.LFB9:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r12
	pushq	%rbx
	subq	$16, %rsp
	.cfi_offset 12, -24
	.cfi_offset 3, -32
	movl	%edi, -20(%rbp)
	movq	%rsi, -32(%rbp)
	movl	segNUM(%rip), %eax
	addl	%eax, -20(%rbp)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	segN(%rip), %rdx
	movq	-32(%rbp), %rax
	movq	%rax, (%rcx,%rdx)
	jmp	.L8
.L9:
	movl	-20(%rbp), %eax
	addl	%eax, %eax
	leal	1(%rax), %edx
	movl	-20(%rbp), %eax
	leal	(%rax,%rax), %ecx
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %r12
	leaq	segN(%rip), %rbx
	movslq	%edx, %rax
	leaq	0(,%rax,8), %rdx
	leaq	segN(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movslq	%ecx, %rax
	leaq	0(,%rax,8), %rcx
	leaq	segN(%rip), %rax
	movq	(%rcx,%rax), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	xx
	movq	%rax, (%r12,%rbx)
.L8:
	movl	-20(%rbp), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, -20(%rbp)
	cmpl	$0, -20(%rbp)
	jne	.L9
	nop
	nop
	addq	$16, %rsp
	popq	%rbx
	popq	%r12
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.size	segupdate, .-segupdate
	.globl	segcalcsub
	.type	segcalcsub, @function
segcalcsub:
.LFB10:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%rbx
	subq	$56, %rsp
	.cfi_offset 3, -24
	movl	%edi, -36(%rbp)
	movl	%esi, -40(%rbp)
	movl	%edx, -44(%rbp)
	movl	%ecx, -48(%rbp)
	movl	%r8d, -52(%rbp)
	movl	-36(%rbp), %eax
	cmpl	-48(%rbp), %eax
	jg	.L11
	movl	-52(%rbp), %eax
	cmpl	-40(%rbp), %eax
	jg	.L11
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	segN(%rip), %rax
	movq	(%rdx,%rax), %rax
	jmp	.L12
.L11:
	movl	-48(%rbp), %edx
	movl	-52(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, -20(%rbp)
	movl	-40(%rbp), %eax
	cmpl	-20(%rbp), %eax
	jg	.L13
	movl	-44(%rbp), %eax
	leal	(%rax,%rax), %edi
	movl	-20(%rbp), %ecx
	movl	-48(%rbp), %edx
	movl	-40(%rbp), %esi
	movl	-36(%rbp), %eax
	movl	%ecx, %r8d
	movl	%edx, %ecx
	movl	%edi, %edx
	movl	%eax, %edi
	call	segcalcsub
	jmp	.L12
.L13:
	movl	-20(%rbp), %eax
	cmpl	-36(%rbp), %eax
	jg	.L14
	movl	-44(%rbp), %eax
	addl	%eax, %eax
	leal	1(%rax), %edi
	movl	-52(%rbp), %ecx
	movl	-20(%rbp), %edx
	movl	-40(%rbp), %esi
	movl	-36(%rbp), %eax
	movl	%ecx, %r8d
	movl	%edx, %ecx
	movl	%edi, %edx
	movl	%eax, %edi
	call	segcalcsub
	jmp	.L12
.L14:
	movl	-44(%rbp), %eax
	addl	%eax, %eax
	leal	1(%rax), %edi
	movl	-52(%rbp), %ecx
	movl	-20(%rbp), %edx
	movl	-40(%rbp), %esi
	movl	-36(%rbp), %eax
	movl	%ecx, %r8d
	movl	%edx, %ecx
	movl	%edi, %edx
	movl	%eax, %edi
	call	segcalcsub
	movq	%rax, %rbx
	movl	-44(%rbp), %eax
	leal	(%rax,%rax), %edi
	movl	-20(%rbp), %ecx
	movl	-48(%rbp), %edx
	movl	-40(%rbp), %esi
	movl	-36(%rbp), %eax
	movl	%ecx, %r8d
	movl	%edx, %ecx
	movl	%edi, %edx
	movl	%eax, %edi
	call	segcalcsub
	movq	%rbx, %rsi
	movq	%rax, %rdi
	call	xx
.L12:
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE10:
	.size	segcalcsub, .-segcalcsub
	.globl	segcalc
	.type	segcalc, @function
segcalc:
.LFB11:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movl	%edi, -4(%rbp)
	movl	%esi, -8(%rbp)
	movl	segNUM(%rip), %edx
	movl	-8(%rbp), %esi
	movl	-4(%rbp), %eax
	movl	%edx, %r8d
	movl	$0, %ecx
	movl	$1, %edx
	movl	%eax, %edi
	call	segcalcsub
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE11:
	.size	segcalc, .-segcalc
	.globl	s
	.bss
	.align 32
	.type	s, @object
	.size	s, 200010
s:
	.zero	200010
	.globl	c
	.align 32
	.type	c, @object
	.size	c, 120
c:
	.zero	120
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 800040
a:
	.zero	800040
	.globl	p
	.align 32
	.type	p, @object
	.size	p, 800040
p:
	.zero	800040
	.globl	ans
	.align 8
	.type	ans, @object
	.size	ans, 8
ans:
	.zero	8
	.section	.rodata
.LC0:
	.string	"%s"
.LC1:
	.string	"-1"
.LC2:
	.string	"%lld"
	.text
	.globl	main
	.type	main, @function
main:
.LFB12:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$112, %rsp
	leaq	s(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	s(%rip), %rax
	movq	%rax, %rdi
	call	strlen@PLT
	movq	%rax, -8(%rbp)
	movq	$0, -72(%rbp)
	jmp	.L18
.L19:
	leaq	s(%rip), %rdx
	movq	-72(%rbp), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	subl	$97, %eax
	movslq	%eax, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	c(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	leal	1(%rdx), %ecx
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	c(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	addq	$1, -72(%rbp)
.L18:
	movq	-72(%rbp), %rax
	cmpq	-8(%rbp), %rax
	jl	.L19
	movl	$-1, -108(%rbp)
	movq	$0, -64(%rbp)
	jmp	.L20
.L24:
	movq	-64(%rbp), %rax
	leaq	0(,%rax,4), %rdx
	leaq	c(%rip), %rax
	movl	(%rdx,%rax), %eax
	andl	$1, %eax
	testl	%eax, %eax
	je	.L21
	cmpl	$-1, -108(%rbp)
	jne	.L22
	movq	-64(%rbp), %rax
	movl	%eax, -108(%rbp)
	jmp	.L21
.L22:
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	movl	$0, %eax
	jmp	.L23
.L21:
	addq	$1, -64(%rbp)
.L20:
	cmpq	$25, -64(%rbp)
	jle	.L24
	movq	$0, -56(%rbp)
	jmp	.L25
.L26:
	movq	-56(%rbp), %rax
	leaq	0(,%rax,4), %rdx
	leaq	c(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, %ecx
	movq	-56(%rbp), %rax
	leaq	0(,%rax,4), %rdx
	leaq	c(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	addq	$1, -56(%rbp)
.L25:
	cmpq	$25, -56(%rbp)
	jle	.L26
	movl	-108(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	c(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	1(%rax), %ecx
	movl	-108(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	c(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movq	$0, -48(%rbp)
	jmp	.L27
.L32:
	leaq	s(%rip), %rdx
	movq	-48(%rbp), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	subl	$97, %eax
	movl	%eax, -84(%rbp)
	movl	-84(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	c(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	je	.L28
	movl	-84(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	c(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	$1, %eax
	jne	.L29
	movl	-84(%rbp), %eax
	cmpl	-108(%rbp), %eax
	jne	.L29
	movq	-48(%rbp), %rax
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	$-2, (%rdx,%rax)
	jmp	.L30
.L29:
	movq	-48(%rbp), %rax
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	$-1, (%rdx,%rax)
.L30:
	movl	-84(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	c(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	-1(%rax), %ecx
	movl	-84(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	c(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	jmp	.L31
.L28:
	movq	-48(%rbp), %rax
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	$-3, (%rdx,%rax)
.L31:
	addq	$1, -48(%rbp)
.L27:
	movq	-48(%rbp), %rax
	cmpq	-8(%rbp), %rax
	jl	.L32
	movl	$0, -104(%rbp)
	movq	$0, -40(%rbp)
	jmp	.L33
.L38:
	movq	-40(%rbp), %rax
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	$-1, %eax
	je	.L34
	movq	-40(%rbp), %rax
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	$-2, %eax
	jne	.L35
.L34:
	movl	-104(%rbp), %eax
	movslq	%eax, %rdx
	movq	ans(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, ans(%rip)
.L35:
	movq	-40(%rbp), %rax
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	$-2, %eax
	je	.L36
	movq	-40(%rbp), %rax
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	$-3, %eax
	jne	.L37
.L36:
	addl	$1, -104(%rbp)
.L37:
	addq	$1, -40(%rbp)
.L33:
	movq	-40(%rbp), %rax
	cmpq	-8(%rbp), %rax
	jl	.L38
	movl	$0, -100(%rbp)
	movq	$0, -32(%rbp)
	jmp	.L39
.L41:
	movq	-32(%rbp), %rax
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	$-1, %eax
	jne	.L40
	movl	-100(%rbp), %eax
	leal	1(%rax), %edx
	movl	%edx, -100(%rbp)
	movq	-32(%rbp), %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	a(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
.L40:
	addq	$1, -32(%rbp)
.L39:
	movq	-32(%rbp), %rax
	cmpq	-8(%rbp), %rax
	jl	.L41
	movl	$0, -100(%rbp)
	movq	-8(%rbp), %rax
	subl	$1, %eax
	movl	%eax, -96(%rbp)
	jmp	.L42
.L44:
	movl	-96(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	$-3, %eax
	jne	.L43
	movl	-100(%rbp), %eax
	leal	1(%rax), %edx
	movl	%edx, -100(%rbp)
	movl	-96(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	a(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
.L43:
	subl	$1, -96(%rbp)
.L42:
	cmpl	$0, -96(%rbp)
	jns	.L44
	movq	$0, -24(%rbp)
	jmp	.L45
.L55:
	movl	$0, -92(%rbp)
	movq	-8(%rbp), %rax
	subl	$1, %eax
	movl	%eax, -88(%rbp)
	jmp	.L46
.L49:
	addl	$1, -92(%rbp)
.L47:
	movl	-92(%rbp), %eax
	cmpl	-88(%rbp), %eax
	jge	.L48
	movl	-92(%rbp), %eax
	cltq
	leaq	s(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	movsbl	%al, %eax
	subl	$97, %eax
	cltq
	cmpq	%rax, -24(%rbp)
	jne	.L49
.L48:
	movl	-92(%rbp), %eax
	cmpl	-88(%rbp), %eax
	je	.L58
	jmp	.L52
.L53:
	subl	$1, -88(%rbp)
.L52:
	movl	-88(%rbp), %eax
	cltq
	leaq	s(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	movsbl	%al, %eax
	subl	$97, %eax
	cltq
	cmpq	%rax, -24(%rbp)
	jne	.L53
	movl	-92(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-88(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	a(%rip), %rax
	movl	(%rcx,%rax), %eax
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	p(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	addl	$1, -92(%rbp)
	subl	$1, -88(%rbp)
.L46:
	movl	-92(%rbp), %eax
	cmpl	-88(%rbp), %eax
	jl	.L47
	jmp	.L51
.L58:
	nop
.L51:
	addq	$1, -24(%rbp)
.L45:
	cmpq	$25, -24(%rbp)
	jle	.L55
	movl	$131072, %edi
	call	seguse
	movq	$0, -16(%rbp)
	jmp	.L56
.L57:
	movq	-8(%rbp), %rax
	movq	%rax, %rdx
	shrq	$63, %rdx
	addq	%rdx, %rax
	sarq	%rax
	movl	%eax, %ecx
	movq	-16(%rbp), %rax
	leaq	0(,%rax,4), %rdx
	leaq	p(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%ecx, %esi
	movl	%eax, %edi
	call	segcalc
	movq	%rax, %rdx
	movq	ans(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, ans(%rip)
	movq	$1, -80(%rbp)
	movq	-16(%rbp), %rax
	leaq	0(,%rax,4), %rdx
	leaq	p(%rip), %rax
	movl	(%rdx,%rax), %eax
	movq	-80(%rbp), %rdx
	movq	%rdx, %rsi
	movl	%eax, %edi
	call	segupdate
	addq	$1, -16(%rbp)
.L56:
	movq	-8(%rbp), %rax
	movq	%rax, %rdx
	shrq	$63, %rdx
	addq	%rdx, %rax
	sarq	%rax
	cmpq	%rax, -16(%rbp)
	jl	.L57
	movq	ans(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
.L23:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE12:
	.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
	.globl	xx
	.type	xx, @function
xx:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -24(%rbp)
	movq	%rsi, -32(%rbp)
	movq	-24(%rbp), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, -8(%rbp)
	movq	-8(%rbp), %rax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	xx, .-xx
	.globl	segNUM
	.bss
	.align 4
	.type	segNUM, @object
	.size	segNUM, 4
segNUM:
	.zero	4
	.globl	segN
	.align 32
	.type	segN, @object
	.size	segN, 2097152
segN:
	.zero	2097152
	.globl	seg
	.align 8
	.type	seg, @object
	.size	seg, 8
seg:
	.zero	8
	.text
	.globl	seguse
	.type	seguse, @function
seguse:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -4(%rbp)
	movl	-4(%rbp), %eax
	movl	%eax, segNUM(%rip)
	movl	segNUM(%rip), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	segN(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, seg(%rip)
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	seguse, .-seguse
	.globl	seginit
	.type	seginit, @function
seginit:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r12
	pushq	%rbx
	subq	$16, %rsp
	.cfi_offset 12, -24
	.cfi_offset 3, -32
	movl	segNUM(%rip), %eax
	subl	$1, %eax
	movl	%eax, -20(%rbp)
	jmp	.L5
.L6:
	movl	-20(%rbp), %eax
	addl	%eax, %eax
	leal	1(%rax), %edx
	movl	-20(%rbp), %eax
	leal	(%rax,%rax), %ecx
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %r12
	leaq	segN(%rip), %rbx
	movslq	%edx, %rax
	leaq	0(,%rax,8), %rdx
	leaq	segN(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movslq	%ecx, %rax
	leaq	0(,%rax,8), %rcx
	leaq	segN(%rip), %rax
	movq	(%rcx,%rax), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	xx
	movq	%rax, (%r12,%rbx)
	subl	$1, -20(%rbp)
.L5:
	cmpl	$0, -20(%rbp)
	jne	.L6
	nop
	nop
	addq	$16, %rsp
	popq	%rbx
	popq	%r12
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	seginit, .-seginit
	.globl	segupdate
	.type	segupdate, @function
segupdate:
.LFB9:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r12
	pushq	%rbx
	subq	$16, %rsp
	.cfi_offset 12, -24
	.cfi_offset 3, -32
	movl	%edi, -20(%rbp)
	movq	%rsi, -32(%rbp)
	movl	segNUM(%rip), %eax
	addl	%eax, -20(%rbp)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	segN(%rip), %rdx
	movq	-32(%rbp), %rax
	movq	%rax, (%rcx,%rdx)
	jmp	.L8
.L9:
	movl	-20(%rbp), %eax
	addl	%eax, %eax
	leal	1(%rax), %edx
	movl	-20(%rbp), %eax
	leal	(%rax,%rax), %ecx
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %r12
	leaq	segN(%rip), %rbx
	movslq	%edx, %rax
	leaq	0(,%rax,8), %rdx
	leaq	segN(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movslq	%ecx, %rax
	leaq	0(,%rax,8), %rcx
	leaq	segN(%rip), %rax
	movq	(%rcx,%rax), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	xx
	movq	%rax, (%r12,%rbx)
.L8:
	movl	-20(%rbp), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, -20(%rbp)
	cmpl	$0, -20(%rbp)
	jne	.L9
	nop
	nop
	addq	$16, %rsp
	popq	%rbx
	popq	%r12
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.size	segupdate, .-segupdate
	.globl	segcalcsub
	.type	segcalcsub, @function
segcalcsub:
.LFB10:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%rbx
	subq	$56, %rsp
	.cfi_offset 3, -24
	movl	%edi, -36(%rbp)
	movl	%esi, -40(%rbp)
	movl	%edx, -44(%rbp)
	movl	%ecx, -48(%rbp)
	movl	%r8d, -52(%rbp)
	movl	-36(%rbp), %eax
	cmpl	-48(%rbp), %eax
	jg	.L11
	movl	-52(%rbp), %eax
	cmpl	-40(%rbp), %eax
	jg	.L11
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	segN(%rip), %rax
	movq	(%rdx,%rax), %rax
	jmp	.L12
.L11:
	movl	-48(%rbp), %edx
	movl	-52(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, -20(%rbp)
	movl	-40(%rbp), %eax
	cmpl	-20(%rbp), %eax
	jg	.L13
	movl	-44(%rbp), %eax
	leal	(%rax,%rax), %edi
	movl	-20(%rbp), %ecx
	movl	-48(%rbp), %edx
	movl	-40(%rbp), %esi
	movl	-36(%rbp), %eax
	movl	%ecx, %r8d
	movl	%edx, %ecx
	movl	%edi, %edx
	movl	%eax, %edi
	call	segcalcsub
	jmp	.L12
.L13:
	movl	-20(%rbp), %eax
	cmpl	-36(%rbp), %eax
	jg	.L14
	movl	-44(%rbp), %eax
	addl	%eax, %eax
	leal	1(%rax), %edi
	movl	-52(%rbp), %ecx
	movl	-20(%rbp), %edx
	movl	-40(%rbp), %esi
	movl	-36(%rbp), %eax
	movl	%ecx, %r8d
	movl	%edx, %ecx
	movl	%edi, %edx
	movl	%eax, %edi
	call	segcalcsub
	jmp	.L12
.L14:
	movl	-44(%rbp), %eax
	addl	%eax, %eax
	leal	1(%rax), %edi
	movl	-52(%rbp), %ecx
	movl	-20(%rbp), %edx
	movl	-40(%rbp), %esi
	movl	-36(%rbp), %eax
	movl	%ecx, %r8d
	movl	%edx, %ecx
	movl	%edi, %edx
	movl	%eax, %edi
	call	segcalcsub
	movq	%rax, %rbx
	movl	-44(%rbp), %eax
	leal	(%rax,%rax), %edi
	movl	-20(%rbp), %ecx
	movl	-48(%rbp), %edx
	movl	-40(%rbp), %esi
	movl	-36(%rbp), %eax
	movl	%ecx, %r8d
	movl	%edx, %ecx
	movl	%edi, %edx
	movl	%eax, %edi
	call	segcalcsub
	movq	%rbx, %rsi
	movq	%rax, %rdi
	call	xx
.L12:
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE10:
	.size	segcalcsub, .-segcalcsub
	.globl	segcalc
	.type	segcalc, @function
segcalc:
.LFB11:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movl	%edi, -4(%rbp)
	movl	%esi, -8(%rbp)
	movl	segNUM(%rip), %edx
	movl	-8(%rbp), %esi
	movl	-4(%rbp), %eax
	movl	%edx, %r8d
	movl	$0, %ecx
	movl	$1, %edx
	movl	%eax, %edi
	call	segcalcsub
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE11:
	.size	segcalc, .-segcalc
	.globl	s
	.bss
	.align 32
	.type	s, @object
	.size	s, 200010
s:
	.zero	200010
	.globl	c
	.align 32
	.type	c, @object
	.size	c, 120
c:
	.zero	120
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 800040
a:
	.zero	800040
	.globl	p
	.align 32
	.type	p, @object
	.size	p, 800040
p:
	.zero	800040
	.globl	ans
	.align 8
	.type	ans, @object
	.size	ans, 8
ans:
	.zero	8
	.section	.rodata
.LC0:
	.string	"%s"
.LC1:
	.string	"-1"
.LC2:
	.string	"%lld"
	.text
	.globl	main
	.type	main, @function
main:
.LFB12:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$112, %rsp
	leaq	s(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	s(%rip), %rax
	movq	%rax, %rdi
	call	strlen@PLT
	movq	%rax, -8(%rbp)
	movq	$0, -72(%rbp)
	jmp	.L18
.L19:
	leaq	s(%rip), %rdx
	movq	-72(%rbp), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	subl	$97, %eax
	movslq	%eax, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	c(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	leal	1(%rdx), %ecx
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	c(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	addq	$1, -72(%rbp)
.L18:
	movq	-72(%rbp), %rax
	cmpq	-8(%rbp), %rax
	jl	.L19
	movl	$-1, -108(%rbp)
	movq	$0, -64(%rbp)
	jmp	.L20
.L24:
	movq	-64(%rbp), %rax
	leaq	0(,%rax,4), %rdx
	leaq	c(%rip), %rax
	movl	(%rdx,%rax), %eax
	andl	$1, %eax
	testl	%eax, %eax
	je	.L21
	cmpl	$-1, -108(%rbp)
	jne	.L22
	movq	-64(%rbp), %rax
	movl	%eax, -108(%rbp)
	jmp	.L21
.L22:
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	movl	$0, %eax
	jmp	.L23
.L21:
	addq	$1, -64(%rbp)
.L20:
	cmpq	$25, -64(%rbp)
	jle	.L24
	movq	$0, -56(%rbp)
	jmp	.L25
.L26:
	movq	-56(%rbp), %rax
	leaq	0(,%rax,4), %rdx
	leaq	c(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, %ecx
	movq	-56(%rbp), %rax
	leaq	0(,%rax,4), %rdx
	leaq	c(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	addq	$1, -56(%rbp)
.L25:
	cmpq	$25, -56(%rbp)
	jle	.L26
	movl	-108(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	c(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	1(%rax), %ecx
	movl	-108(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	c(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movq	$0, -48(%rbp)
	jmp	.L27
.L32:
	leaq	s(%rip), %rdx
	movq	-48(%rbp), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	subl	$97, %eax
	movl	%eax, -84(%rbp)
	movl	-84(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	c(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	je	.L28
	movl	-84(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	c(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	$1, %eax
	jne	.L29
	movl	-84(%rbp), %eax
	cmpl	-108(%rbp), %eax
	jne	.L29
	movq	-48(%rbp), %rax
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	$-2, (%rdx,%rax)
	jmp	.L30
.L29:
	movq	-48(%rbp), %rax
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	$-1, (%rdx,%rax)
.L30:
	movl	-84(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	c(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	-1(%rax), %ecx
	movl	-84(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	c(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	jmp	.L31
.L28:
	movq	-48(%rbp), %rax
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	$-3, (%rdx,%rax)
.L31:
	addq	$1, -48(%rbp)
.L27:
	movq	-48(%rbp), %rax
	cmpq	-8(%rbp), %rax
	jl	.L32
	movl	$0, -104(%rbp)
	movq	$0, -40(%rbp)
	jmp	.L33
.L38:
	movq	-40(%rbp), %rax
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	$-1, %eax
	je	.L34
	movq	-40(%rbp), %rax
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	$-2, %eax
	jne	.L35
.L34:
	movl	-104(%rbp), %eax
	movslq	%eax, %rdx
	movq	ans(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, ans(%rip)
.L35:
	movq	-40(%rbp), %rax
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	$-2, %eax
	je	.L36
	movq	-40(%rbp), %rax
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	$-3, %eax
	jne	.L37
.L36:
	addl	$1, -104(%rbp)
.L37:
	addq	$1, -40(%rbp)
.L33:
	movq	-40(%rbp), %rax
	cmpq	-8(%rbp), %rax
	jl	.L38
	movl	$0, -100(%rbp)
	movq	$0, -32(%rbp)
	jmp	.L39
.L41:
	movq	-32(%rbp), %rax
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	$-1, %eax
	jne	.L40
	movl	-100(%rbp), %eax
	leal	1(%rax), %edx
	movl	%edx, -100(%rbp)
	movq	-32(%rbp), %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	a(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
.L40:
	addq	$1, -32(%rbp)
.L39:
	movq	-32(%rbp), %rax
	cmpq	-8(%rbp), %rax
	jl	.L41
	movl	$0, -100(%rbp)
	movq	-8(%rbp), %rax
	subl	$1, %eax
	movl	%eax, -96(%rbp)
	jmp	.L42
.L44:
	movl	-96(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	$-3, %eax
	jne	.L43
	movl	-100(%rbp), %eax
	leal	1(%rax), %edx
	movl	%edx, -100(%rbp)
	movl	-96(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	a(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
.L43:
	subl	$1, -96(%rbp)
.L42:
	cmpl	$0, -96(%rbp)
	jns	.L44
	movq	$0, -24(%rbp)
	jmp	.L45
.L55:
	movl	$0, -92(%rbp)
	movq	-8(%rbp), %rax
	subl	$1, %eax
	movl	%eax, -88(%rbp)
	jmp	.L46
.L49:
	addl	$1, -92(%rbp)
.L47:
	movl	-92(%rbp), %eax
	cmpl	-88(%rbp), %eax
	jge	.L48
	movl	-92(%rbp), %eax
	cltq
	leaq	s(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	movsbl	%al, %eax
	subl	$97, %eax
	cltq
	cmpq	%rax, -24(%rbp)
	jne	.L49
.L48:
	movl	-92(%rbp), %eax
	cmpl	-88(%rbp), %eax
	je	.L58
	jmp	.L52
.L53:
	subl	$1, -88(%rbp)
.L52:
	movl	-88(%rbp), %eax
	cltq
	leaq	s(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	movsbl	%al, %eax
	subl	$97, %eax
	cltq
	cmpq	%rax, -24(%rbp)
	jne	.L53
	movl	-92(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-88(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	a(%rip), %rax
	movl	(%rcx,%rax), %eax
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	p(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	addl	$1, -92(%rbp)
	subl	$1, -88(%rbp)
.L46:
	movl	-92(%rbp), %eax
	cmpl	-88(%rbp), %eax
	jl	.L47
	jmp	.L51
.L58:
	nop
.L51:
	addq	$1, -24(%rbp)
.L45:
	cmpq	$25, -24(%rbp)
	jle	.L55
	movl	$131072, %edi
	call	seguse
	movq	$0, -16(%rbp)
	jmp	.L56
.L57:
	movq	-8(%rbp), %rax
	movq	%rax, %rdx
	shrq	$63, %rdx
	addq	%rdx, %rax
	sarq	%rax
	movl	%eax, %ecx
	movq	-16(%rbp), %rax
	leaq	0(,%rax,4), %rdx
	leaq	p(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%ecx, %esi
	movl	%eax, %edi
	call	segcalc
	movq	%rax, %rdx
	movq	ans(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, ans(%rip)
	movq	$1, -80(%rbp)
	movq	-16(%rbp), %rax
	leaq	0(,%rax,4), %rdx
	leaq	p(%rip), %rax
	movl	(%rdx,%rax), %eax
	movq	-80(%rbp), %rdx
	movq	%rdx, %rsi
	movl	%eax, %edi
	call	segupdate
	addq	$1, -16(%rbp)
.L56:
	movq	-8(%rbp), %rax
	movq	%rax, %rdx
	shrq	$63, %rdx
	addq	%rdx, %rax
	sarq	%rax
	cmpq	%rax, -16(%rbp)
	jl	.L57
	movq	ans(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
.L23:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE12:
	.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:
