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>

int max(int a,int b){
  if(a>b) return a;
  return b;
}

int main(void){
  int n,i,j,ans=0,tmp;
  char s[101];
  
  scanf("%d %s",&n,s);

  for(i=1;i<n;i++){
    int alpha[26] = {};
    for(j=0;j<i;j++) alpha[s[j]-'a']++;
  
    tmp = 0;
    for(j=i;j<n;j++){
      if(alpha[s[j]-'a']>0){
        tmp++;
        alpha[s[j]-'a']=0;
      }
    }
    
    ans = max(ans,tmp);
  }
  
  printf("%d\n",ans);
  
  return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	max
	.type	max, @function
max:
.LFB0:
	.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	%esi, -8(%rbp)
	movl	-4(%rbp), %eax
	cmpl	-8(%rbp), %eax
	jle	.L2
	movl	-4(%rbp), %eax
	jmp	.L3
.L2:
	movl	-8(%rbp), %eax
.L3:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	max, .-max
	.section	.rodata
.LC0:
	.string	"%d %s"
.LC1:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$256, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, -232(%rbp)
	leaq	-112(%rbp), %rdx
	leaq	-244(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$1, -240(%rbp)
	jmp	.L5
.L11:
	leaq	-224(%rbp), %rdx
	movl	$0, %eax
	movl	$13, %ecx
	movq	%rdx, %rdi
	rep stosq
	movl	$0, -236(%rbp)
	jmp	.L6
.L7:
	movl	-236(%rbp), %eax
	cltq
	movzbl	-112(%rbp,%rax), %eax
	movsbl	%al, %eax
	subl	$97, %eax
	movslq	%eax, %rdx
	movl	-224(%rbp,%rdx,4), %edx
	addl	$1, %edx
	cltq
	movl	%edx, -224(%rbp,%rax,4)
	addl	$1, -236(%rbp)
.L6:
	movl	-236(%rbp), %eax
	cmpl	-240(%rbp), %eax
	jl	.L7
	movl	$0, -228(%rbp)
	movl	-240(%rbp), %eax
	movl	%eax, -236(%rbp)
	jmp	.L8
.L10:
	movl	-236(%rbp), %eax
	cltq
	movzbl	-112(%rbp,%rax), %eax
	movsbl	%al, %eax
	subl	$97, %eax
	cltq
	movl	-224(%rbp,%rax,4), %eax
	testl	%eax, %eax
	jle	.L9
	addl	$1, -228(%rbp)
	movl	-236(%rbp), %eax
	cltq
	movzbl	-112(%rbp,%rax), %eax
	movsbl	%al, %eax
	subl	$97, %eax
	cltq
	movl	$0, -224(%rbp,%rax,4)
.L9:
	addl	$1, -236(%rbp)
.L8:
	movl	-244(%rbp), %eax
	cmpl	%eax, -236(%rbp)
	jl	.L10
	movl	-228(%rbp), %edx
	movl	-232(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	max
	movl	%eax, -232(%rbp)
	addl	$1, -240(%rbp)
.L5:
	movl	-244(%rbp), %eax
	cmpl	%eax, -240(%rbp)
	jl	.L11
	movl	-232(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L13
	call	__stack_chk_fail@PLT
.L13:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.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	max
	.type	max, @function
max:
.LFB23:
	.cfi_startproc
	endbr64
	cmpl	%esi, %edi
	movl	%esi, %eax
	cmovge	%edi, %eax
	ret
	.cfi_endproc
.LFE23:
	.size	max, .-max
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d %s"
.LC1:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB24:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	leaq	.LC0(%rip), %rdi
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	subq	$248, %rsp
	.cfi_def_cfa_offset 272
	movq	%fs:40, %rax
	movq	%rax, 232(%rsp)
	xorl	%eax, %eax
	leaq	128(%rsp), %rbx
	leaq	12(%rsp), %rsi
	movq	%rbx, %rdx
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %r8d
	cmpl	$1, %r8d
	jle	.L10
	leaq	129(%rsp), %rsi
	movslq	%r8d, %rbp
	xorl	%r10d, %r10d
	xorl	%eax, %eax
	movl	$1, %r9d
	leaq	16(%rsp), %r11
	.p2align 4,,10
	.p2align 3
.L8:
	movl	$13, %ecx
	movq	%r11, %rdi
	rep stosq
	movq	%rbx, %rcx
	.p2align 4,,10
	.p2align 3
.L5:
	movsbl	(%rcx), %edx
	addq	$1, %rcx
	subl	$97, %edx
	movslq	%edx, %rdx
	addl	$1, 16(%rsp,%rdx,4)
	cmpq	%rcx, %rsi
	jne	.L5
	movq	%r9, %rcx
	xorl	%edi, %edi
	.p2align 4,,10
	.p2align 3
.L7:
	movsbl	(%rbx,%rcx), %edx
	subl	$97, %edx
	movslq	%edx, %rdx
	cmpl	$0, 16(%rsp,%rdx,4)
	jle	.L6
	movl	$0, 16(%rsp,%rdx,4)
	addl	$1, %edi
.L6:
	addq	$1, %rcx
	cmpl	%ecx, %r8d
	jg	.L7
	cmpl	%edi, %r10d
	cmovl	%edi, %r10d
	addq	$1, %r9
	addq	$1, %rsi
	cmpq	%rbp, %r9
	jne	.L8
.L4:
	xorl	%eax, %eax
	movl	%r10d, %edx
	movl	$1, %edi
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	232(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L15
	addq	$248, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
.L10:
	.cfi_restore_state
	xorl	%r10d, %r10d
	jmp	.L4
.L15:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE24:
	.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
	.p2align 4
	.globl	max
	.type	max, @function
max:
.LFB23:
	.cfi_startproc
	endbr64
	cmpl	%esi, %edi
	movl	%esi, %eax
	cmovge	%edi, %eax
	ret
	.cfi_endproc
.LFE23:
	.size	max, .-max
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d %s"
.LC1:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB24:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	leaq	.LC0(%rip), %rdi
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	subq	$248, %rsp
	.cfi_def_cfa_offset 272
	movq	%fs:40, %rax
	movq	%rax, 232(%rsp)
	xorl	%eax, %eax
	leaq	128(%rsp), %rbx
	leaq	12(%rsp), %rsi
	movq	%rbx, %rdx
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %r8d
	cmpl	$1, %r8d
	jle	.L10
	leaq	129(%rsp), %rsi
	movslq	%r8d, %rbp
	xorl	%r10d, %r10d
	xorl	%eax, %eax
	movl	$1, %r9d
	leaq	16(%rsp), %r11
	.p2align 4,,10
	.p2align 3
.L8:
	movl	$13, %ecx
	movq	%r11, %rdi
	rep stosq
	movq	%rbx, %rcx
	.p2align 4,,10
	.p2align 3
.L5:
	movsbl	(%rcx), %edx
	addq	$1, %rcx
	subl	$97, %edx
	movslq	%edx, %rdx
	addl	$1, 16(%rsp,%rdx,4)
	cmpq	%rcx, %rsi
	jne	.L5
	movq	%r9, %rcx
	xorl	%edi, %edi
	.p2align 4,,10
	.p2align 3
.L7:
	movsbl	(%rbx,%rcx), %edx
	subl	$97, %edx
	movslq	%edx, %rdx
	cmpl	$0, 16(%rsp,%rdx,4)
	jle	.L6
	movl	$0, 16(%rsp,%rdx,4)
	addl	$1, %edi
.L6:
	addq	$1, %rcx
	cmpl	%ecx, %r8d
	jg	.L7
	cmpl	%edi, %r10d
	cmovl	%edi, %r10d
	addq	$1, %r9
	addq	$1, %rsi
	cmpq	%rbp, %r9
	jne	.L8
.L4:
	xorl	%eax, %eax
	movl	%r10d, %edx
	movl	$1, %edi
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	232(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L15
	addq	$248, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
.L10:
	.cfi_restore_state
	xorl	%r10d, %r10d
	jmp	.L4
.L15:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE24:
	.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>

int max(int a,int b){
  if(a>b) return a;
  return b;
}

int main(void){
  int n,i,j,ans=0,tmp;
  char s[101];
  
  scanf("%d %s",&n,s);

  for(i=1;i<n;i++){
    int alpha[26] = {};
    for(j=0;j<i;j++) alpha[s[j]-'a']++;
  
    tmp = 0;
    for(j=i;j<n;j++){
      if(alpha[s[j]-'a']>0){
        tmp++;
        alpha[s[j]-'a']=0;
      }
    }
    
    ans = max(ans,tmp);
  }
  
  printf("%d\n",ans);
  
  return 0;
}
10
aaabaaaaaa
 6
`abbca
 45
tgxgdqkyjphyzutjjtllptdfxocrylqfqjynmfbfucbir
 45
tgxgtqkyjfhyzutjjdllptdpxrbrylqfqjynmfbfucbio
 45
bnxgtqkykfhyzutjjdllptdpxrtrylqfqjygmfbftcbio
 10
aba`ab`bbb
 10
`bcca_ba_`
 45
blxhtqkyjehxzutkjdmlpidpurtrzlbfribgmhqfzcyto
 45
twhhbqkztehxjvukjdjioldpurzrzlbfribgmnqfzcytn

1
 2
 9
 10
 11
 1
 2
 12
 8

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>

int max(int a,int b){
  if(a>b) return a;
  return b;
}

int main(void){
  int n,i,j,ans=0,tmp;
  char s[101];
  
  scanf("%d %s",&n,s);

  for(i=1;i<n;i++){
    int alpha[26] = {};
    for(j=0;j<i;j++) alpha[s[j]-'a']++;
  
    tmp = 0;
    for(j=i;j<n;j++){
      if(alpha[s[j]-'a']>0){
        tmp++;
        alpha[s[j]-'a']=0;
      }
    }
    
    ans = max(ans,tmp);
  }
  
  printf("%d\n",ans);
  
  return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	max
	.type	max, @function
max:
.LFB0:
	.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	%esi, -8(%rbp)
	movl	-4(%rbp), %eax
	cmpl	-8(%rbp), %eax
	jle	.L2
	movl	-4(%rbp), %eax
	jmp	.L3
.L2:
	movl	-8(%rbp), %eax
.L3:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	max, .-max
	.section	.rodata
.LC0:
	.string	"%d %s"
.LC1:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$256, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, -232(%rbp)
	leaq	-112(%rbp), %rdx
	leaq	-244(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$1, -240(%rbp)
	jmp	.L5
.L11:
	leaq	-224(%rbp), %rdx
	movl	$0, %eax
	movl	$13, %ecx
	movq	%rdx, %rdi
	rep stosq
	movl	$0, -236(%rbp)
	jmp	.L6
.L7:
	movl	-236(%rbp), %eax
	cltq
	movzbl	-112(%rbp,%rax), %eax
	movsbl	%al, %eax
	subl	$97, %eax
	movslq	%eax, %rdx
	movl	-224(%rbp,%rdx,4), %edx
	addl	$1, %edx
	cltq
	movl	%edx, -224(%rbp,%rax,4)
	addl	$1, -236(%rbp)
.L6:
	movl	-236(%rbp), %eax
	cmpl	-240(%rbp), %eax
	jl	.L7
	movl	$0, -228(%rbp)
	movl	-240(%rbp), %eax
	movl	%eax, -236(%rbp)
	jmp	.L8
.L10:
	movl	-236(%rbp), %eax
	cltq
	movzbl	-112(%rbp,%rax), %eax
	movsbl	%al, %eax
	subl	$97, %eax
	cltq
	movl	-224(%rbp,%rax,4), %eax
	testl	%eax, %eax
	jle	.L9
	addl	$1, -228(%rbp)
	movl	-236(%rbp), %eax
	cltq
	movzbl	-112(%rbp,%rax), %eax
	movsbl	%al, %eax
	subl	$97, %eax
	cltq
	movl	$0, -224(%rbp,%rax,4)
.L9:
	addl	$1, -236(%rbp)
.L8:
	movl	-244(%rbp), %eax
	cmpl	%eax, -236(%rbp)
	jl	.L10
	movl	-228(%rbp), %edx
	movl	-232(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	max
	movl	%eax, -232(%rbp)
	addl	$1, -240(%rbp)
.L5:
	movl	-244(%rbp), %eax
	cmpl	%eax, -240(%rbp)
	jl	.L11
	movl	-232(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L13
	call	__stack_chk_fail@PLT
.L13:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.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	max
	.type	max, @function
max:
.LFB0:
	.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	%esi, -8(%rbp)
	movl	-4(%rbp), %eax
	cmpl	-8(%rbp), %eax
	jle	.L2
	movl	-4(%rbp), %eax
	jmp	.L3
.L2:
	movl	-8(%rbp), %eax
.L3:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	max, .-max
	.section	.rodata
.LC0:
	.string	"%d %s"
.LC1:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$256, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, -232(%rbp)
	leaq	-112(%rbp), %rdx
	leaq	-244(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$1, -240(%rbp)
	jmp	.L5
.L11:
	leaq	-224(%rbp), %rdx
	movl	$0, %eax
	movl	$13, %ecx
	movq	%rdx, %rdi
	rep stosq
	movl	$0, -236(%rbp)
	jmp	.L6
.L7:
	movl	-236(%rbp), %eax
	cltq
	movzbl	-112(%rbp,%rax), %eax
	movsbl	%al, %eax
	subl	$97, %eax
	movslq	%eax, %rdx
	movl	-224(%rbp,%rdx,4), %edx
	addl	$1, %edx
	cltq
	movl	%edx, -224(%rbp,%rax,4)
	addl	$1, -236(%rbp)
.L6:
	movl	-236(%rbp), %eax
	cmpl	-240(%rbp), %eax
	jl	.L7
	movl	$0, -228(%rbp)
	movl	-240(%rbp), %eax
	movl	%eax, -236(%rbp)
	jmp	.L8
.L10:
	movl	-236(%rbp), %eax
	cltq
	movzbl	-112(%rbp,%rax), %eax
	movsbl	%al, %eax
	subl	$97, %eax
	cltq
	movl	-224(%rbp,%rax,4), %eax
	testl	%eax, %eax
	jle	.L9
	addl	$1, -228(%rbp)
	movl	-236(%rbp), %eax
	cltq
	movzbl	-112(%rbp,%rax), %eax
	movsbl	%al, %eax
	subl	$97, %eax
	cltq
	movl	$0, -224(%rbp,%rax,4)
.L9:
	addl	$1, -236(%rbp)
.L8:
	movl	-244(%rbp), %eax
	cmpl	%eax, -236(%rbp)
	jl	.L10
	movl	-228(%rbp), %edx
	movl	-232(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	max
	movl	%eax, -232(%rbp)
	addl	$1, -240(%rbp)
.L5:
	movl	-244(%rbp), %eax
	cmpl	%eax, -240(%rbp)
	jl	.L11
	movl	-232(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L13
	call	__stack_chk_fail@PLT
.L13:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.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:
