Given the following C code and unoptimized assembly code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
#include <stdio.h>
#include <string.h>
typedef long long ll;
#define rep(i,l,r) for(int i=l; i<(int)(r); i++)
#define max(a,b) (a>b?a:b)
#define min(a,b) (a<b?a:b)

int main(){
    int N;
    char S[30101];
    scanf("%d%s", &N, S);

    int ans = 0;
    rep(i,0,10){
        int idxi = 0;
        while(idxi < N && S[idxi] != ('0'+i)) idxi++;
        if(idxi >= N-2) continue;
        rep(j,0,10){
            int idxj = idxi+1;
            while(idxj < N && S[idxj] != ('0'+j)) idxj++;
            if(idxj >= N-1) continue;
            int cnt[10] = {0};
            rep(idxk,idxj+1,N) cnt[S[idxk]-'0']++;
            rep(k,0,10) if(cnt[k] > 0) ans++;
        }
    }

    printf("%d\n", ans);
    return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d%s"
.LC1:
	.string	"%d\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
	leaq	-28672(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$1520, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-30112(%rbp), %rdx
	leaq	-30192(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -30188(%rbp)
	movl	$0, -30184(%rbp)
	jmp	.L2
.L20:
	movl	$0, -30180(%rbp)
	jmp	.L3
.L5:
	addl	$1, -30180(%rbp)
.L3:
	movl	-30192(%rbp), %eax
	cmpl	%eax, -30180(%rbp)
	jge	.L4
	movl	-30180(%rbp), %eax
	cltq
	movzbl	-30112(%rbp,%rax), %eax
	movsbl	%al, %eax
	movl	-30184(%rbp), %edx
	addl	$48, %edx
	cmpl	%edx, %eax
	jne	.L5
.L4:
	movl	-30192(%rbp), %eax
	subl	$2, %eax
	cmpl	%eax, -30180(%rbp)
	jge	.L23
	movl	$0, -30176(%rbp)
	jmp	.L8
.L19:
	movl	-30180(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -30172(%rbp)
	jmp	.L9
.L11:
	addl	$1, -30172(%rbp)
.L9:
	movl	-30192(%rbp), %eax
	cmpl	%eax, -30172(%rbp)
	jge	.L10
	movl	-30172(%rbp), %eax
	cltq
	movzbl	-30112(%rbp,%rax), %eax
	movsbl	%al, %eax
	movl	-30176(%rbp), %edx
	addl	$48, %edx
	cmpl	%edx, %eax
	jne	.L11
.L10:
	movl	-30192(%rbp), %eax
	subl	$1, %eax
	cmpl	%eax, -30172(%rbp)
	jge	.L24
	movq	$0, -30160(%rbp)
	movq	$0, -30152(%rbp)
	movq	$0, -30144(%rbp)
	movq	$0, -30136(%rbp)
	movq	$0, -30128(%rbp)
	movl	-30172(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -30168(%rbp)
	jmp	.L14
.L15:
	movl	-30168(%rbp), %eax
	cltq
	movzbl	-30112(%rbp,%rax), %eax
	movsbl	%al, %eax
	subl	$48, %eax
	movslq	%eax, %rdx
	movl	-30160(%rbp,%rdx,4), %edx
	addl	$1, %edx
	cltq
	movl	%edx, -30160(%rbp,%rax,4)
	addl	$1, -30168(%rbp)
.L14:
	movl	-30192(%rbp), %eax
	cmpl	%eax, -30168(%rbp)
	jl	.L15
	movl	$0, -30164(%rbp)
	jmp	.L16
.L18:
	movl	-30164(%rbp), %eax
	cltq
	movl	-30160(%rbp,%rax,4), %eax
	testl	%eax, %eax
	jle	.L17
	addl	$1, -30188(%rbp)
.L17:
	addl	$1, -30164(%rbp)
.L16:
	cmpl	$9, -30164(%rbp)
	jle	.L18
	jmp	.L13
.L24:
	nop
.L13:
	addl	$1, -30176(%rbp)
.L8:
	cmpl	$9, -30176(%rbp)
	jle	.L19
	jmp	.L7
.L23:
	nop
.L7:
	addl	$1, -30184(%rbp)
.L2:
	cmpl	$9, -30184(%rbp)
	jle	.L20
	movl	-30188(%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	.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	"%d%s"
.LC1:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB35:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	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	-28672(%rsp), %r11
	.cfi_def_cfa 11, 28720
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$1504, %rsp
	.cfi_def_cfa_offset 30224
	leaq	.LC0(%rip), %rdi
	movq	%fs:40, %rax
	movq	%rax, 30168(%rsp)
	xorl	%eax, %eax
	leaq	64(%rsp), %rbx
	leaq	12(%rsp), %rsi
	movq	%rbx, %rdx
	leaq	65(%rsp), %r12
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %ecx
	movl	$48, %r9d
	xorl	%r8d, %r8d
	leal	-2(%rcx), %ebp
	leal	-1(%rcx), %r11d
	.p2align 4,,10
	.p2align 3
.L2:
	testl	%ecx, %ecx
	jle	.L29
	movq	%rbx, %rax
	xorl	%edi, %edi
	jmp	.L23
	.p2align 4,,10
	.p2align 3
.L4:
	addl	$1, %edi
	addq	$1, %rax
	cmpl	%ecx, %edi
	je	.L3
.L23:
	movsbl	(%rax), %edx
	cmpl	%r9d, %edx
	jne	.L4
.L3:
	cmpl	%ebp, %edi
	jl	.L35
.L5:
	addl	$1, %r9d
	cmpl	$58, %r9d
	jne	.L2
	xorl	%eax, %eax
	movl	%r8d, %edx
	movl	$1, %edi
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	30168(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L36
	addq	$30176, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 48
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 40
	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
	.p2align 4,,10
	.p2align 3
.L35:
	.cfi_restore_state
	leal	1(%rdi), %r10d
	movl	$48, %esi
	movslq	%edi, %rdi
	cmpl	%ecx, %r10d
	jge	.L26
	.p2align 4,,10
	.p2align 3
.L38:
	leaq	(%rbx,%rdi), %rdx
	movl	%r10d, %eax
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L8:
	addl	$1, %eax
	addq	$1, %rdx
	cmpl	%ecx, %eax
	je	.L6
.L7:
	movsbl	1(%rdx), %r13d
	cmpl	%esi, %r13d
	jne	.L8
.L6:
	cmpl	%r11d, %eax
	jl	.L37
.L9:
	addl	$1, %esi
	cmpl	$58, %esi
	je	.L5
	cmpl	%ecx, %r10d
	jl	.L38
.L26:
	movl	%r10d, %eax
	cmpl	%r11d, %eax
	jge	.L9
	.p2align 4,,10
	.p2align 3
.L37:
	movq	$0, 48(%rsp)
	pxor	%xmm0, %xmm0
	leal	1(%rax), %edx
	movaps	%xmm0, 16(%rsp)
	movaps	%xmm0, 32(%rsp)
	cmpl	%ecx, %edx
	jge	.L9
	movslq	%eax, %r13
	movl	%ebp, %r14d
	leaq	(%rbx,%r13), %rdx
	subl	%eax, %r14d
	addq	%r12, %r13
	addq	%r14, %r13
	.p2align 4,,10
	.p2align 3
.L11:
	movsbl	1(%rdx), %eax
	addq	$1, %rdx
	subl	$48, %eax
	cltq
	addl	$1, 16(%rsp,%rax,4)
	cmpq	%rdx, %r13
	jne	.L11
	movl	16(%rsp), %edx
	movl	20(%rsp), %r13d
	xorl	%eax, %eax
	movl	24(%rsp), %r14d
	testl	%edx, %edx
	movl	28(%rsp), %edx
	setg	%al
	addl	%eax, %r8d
	xorl	%eax, %eax
	testl	%r13d, %r13d
	movl	32(%rsp), %r13d
	setg	%al
	addl	%eax, %r8d
	xorl	%eax, %eax
	testl	%r14d, %r14d
	movl	36(%rsp), %r14d
	setg	%al
	addl	%eax, %r8d
	xorl	%eax, %eax
	testl	%edx, %edx
	movl	40(%rsp), %edx
	setg	%al
	addl	%eax, %r8d
	xorl	%eax, %eax
	testl	%r13d, %r13d
	movl	44(%rsp), %r13d
	setg	%al
	addl	%eax, %r8d
	xorl	%eax, %eax
	testl	%r14d, %r14d
	movl	48(%rsp), %r14d
	setg	%al
	addl	%eax, %r8d
	xorl	%eax, %eax
	testl	%edx, %edx
	movl	52(%rsp), %edx
	setg	%al
	addl	%eax, %r8d
	xorl	%eax, %eax
	testl	%r13d, %r13d
	setg	%al
	addl	%eax, %r8d
	xorl	%eax, %eax
	testl	%r14d, %r14d
	setg	%al
	addl	%eax, %r8d
	xorl	%eax, %eax
	testl	%edx, %edx
	setg	%al
	addl	%eax, %r8d
	jmp	.L9
.L29:
	xorl	%edi, %edi
	jmp	.L3
.L36:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE35:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:

rule
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d%s"
.LC1:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB35:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	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	-28672(%rsp), %r11
	.cfi_def_cfa 11, 28720
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$1504, %rsp
	.cfi_def_cfa_offset 30224
	leaq	.LC0(%rip), %rdi
	movq	%fs:40, %rax
	movq	%rax, 30168(%rsp)
	xorl	%eax, %eax
	leaq	64(%rsp), %rbx
	leaq	12(%rsp), %rsi
	movq	%rbx, %rdx
	leaq	65(%rsp), %r12
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %ecx
	movl	$48, %r9d
	xorl	%r8d, %r8d
	leal	-2(%rcx), %ebp
	leal	-1(%rcx), %r11d
	.p2align 4,,10
	.p2align 3
.L2:
	testl	%ecx, %ecx
	jle	.L29
	movq	%rbx, %rax
	xorl	%edi, %edi
	jmp	.L23
	.p2align 4,,10
	.p2align 3
.L4:
	addl	$1, %edi
	addq	$1, %rax
	cmpl	%ecx, %edi
	je	.L3
.L23:
	movsbl	(%rax), %edx
	cmpl	%r9d, %edx
	jne	.L4
.L3:
	cmpl	%ebp, %edi
	jl	.L35
.L5:
	addl	$1, %r9d
	cmpl	$58, %r9d
	jne	.L2
	xorl	%eax, %eax
	movl	%r8d, %edx
	movl	$1, %edi
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	30168(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L36
	addq	$30176, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 48
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 40
	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
	.p2align 4,,10
	.p2align 3
.L35:
	.cfi_restore_state
	leal	1(%rdi), %r10d
	movl	$48, %esi
	movslq	%edi, %rdi
	cmpl	%ecx, %r10d
	jge	.L26
	.p2align 4,,10
	.p2align 3
.L38:
	leaq	(%rbx,%rdi), %rdx
	movl	%r10d, %eax
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L8:
	addl	$1, %eax
	addq	$1, %rdx
	cmpl	%ecx, %eax
	je	.L6
.L7:
	movsbl	1(%rdx), %r13d
	cmpl	%esi, %r13d
	jne	.L8
.L6:
	cmpl	%r11d, %eax
	jl	.L37
.L9:
	addl	$1, %esi
	cmpl	$58, %esi
	je	.L5
	cmpl	%ecx, %r10d
	jl	.L38
.L26:
	movl	%r10d, %eax
	cmpl	%r11d, %eax
	jge	.L9
	.p2align 4,,10
	.p2align 3
.L37:
	movq	$0, 48(%rsp)
	pxor	%xmm0, %xmm0
	leal	1(%rax), %edx
	movaps	%xmm0, 16(%rsp)
	movaps	%xmm0, 32(%rsp)
	cmpl	%ecx, %edx
	jge	.L9
	movslq	%eax, %r13
	movl	%ebp, %r14d
	leaq	(%rbx,%r13), %rdx
	subl	%eax, %r14d
	addq	%r12, %r13
	addq	%r14, %r13
	.p2align 4,,10
	.p2align 3
.L11:
	movsbl	1(%rdx), %eax
	addq	$1, %rdx
	subl	$48, %eax
	cltq
	addl	$1, 16(%rsp,%rax,4)
	cmpq	%rdx, %r13
	jne	.L11
	movl	16(%rsp), %edx
	movl	20(%rsp), %r13d
	xorl	%eax, %eax
	movl	24(%rsp), %r14d
	testl	%edx, %edx
	movl	28(%rsp), %edx
	setg	%al
	addl	%eax, %r8d
	xorl	%eax, %eax
	testl	%r13d, %r13d
	movl	32(%rsp), %r13d
	setg	%al
	addl	%eax, %r8d
	xorl	%eax, %eax
	testl	%r14d, %r14d
	movl	36(%rsp), %r14d
	setg	%al
	addl	%eax, %r8d
	xorl	%eax, %eax
	testl	%edx, %edx
	movl	40(%rsp), %edx
	setg	%al
	addl	%eax, %r8d
	xorl	%eax, %eax
	testl	%r13d, %r13d
	movl	44(%rsp), %r13d
	setg	%al
	addl	%eax, %r8d
	xorl	%eax, %eax
	testl	%r14d, %r14d
	movl	48(%rsp), %r14d
	setg	%al
	addl	%eax, %r8d
	xorl	%eax, %eax
	testl	%edx, %edx
	movl	52(%rsp), %edx
	setg	%al
	addl	%eax, %r8d
	xorl	%eax, %eax
	testl	%r13d, %r13d
	setg	%al
	addl	%eax, %r8d
	xorl	%eax, %eax
	testl	%r14d, %r14d
	setg	%al
	addl	%eax, %r8d
	xorl	%eax, %eax
	testl	%edx, %edx
	setg	%al
	addl	%eax, %r8d
	jmp	.L9
.L29:
	xorl	%edi, %edi
	jmp	.L3
.L36:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE35:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:

#include <stdio.h>
#include <string.h>
typedef long long ll;
#define rep(i,l,r) for(int i=l; i<(int)(r); i++)
#define max(a,b) (a>b?a:b)
#define min(a,b) (a<b?a:b)

int main(){
    int N;
    char S[30101];
    scanf("%d%s", &N, S);

    int ans = 0;
    rep(i,0,10){
        int idxi = 0;
        while(idxi < N && S[idxi] != ('0'+i)) idxi++;
        if(idxi >= N-2) continue;
        rep(j,0,10){
            int idxj = idxi+1;
            while(idxj < N && S[idxj] != ('0'+j)) idxj++;
            if(idxj >= N-1) continue;
            int cnt[10] = {0};
            rep(idxk,idxj+1,N) cnt[S[idxk]-'0']++;
            rep(k,0,10) if(cnt[k] > 0) ans++;
        }
    }

    printf("%d\n", ans);
    return 0;
}
19
5546189040285140044
 19
4753841743850076999
 19
9039528710159876563
 19
3616863455241776042
 19
2785343766571511696
 19
2922045480066417189
 19
7230040539071200180
 19
1036710694297327965
 19
1455506616048969060
 19
3356521006821128568

273
 311
 412
 322
 239
 281
 292
 364
 172
 210

Given the following C code and unoptimized assembly code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
#include <stdio.h>
#include <string.h>
typedef long long ll;
#define rep(i,l,r) for(int i=l; i<(int)(r); i++)
#define max(a,b) (a>b?a:b)
#define min(a,b) (a<b?a:b)

int main(){
    int N;
    char S[30101];
    scanf("%d%s", &N, S);

    int ans = 0;
    rep(i,0,10){
        int idxi = 0;
        while(idxi < N && S[idxi] != ('0'+i)) idxi++;
        if(idxi >= N-2) continue;
        rep(j,0,10){
            int idxj = idxi+1;
            while(idxj < N && S[idxj] != ('0'+j)) idxj++;
            if(idxj >= N-1) continue;
            int cnt[10] = {0};
            rep(idxk,idxj+1,N) cnt[S[idxk]-'0']++;
            rep(k,0,10) if(cnt[k] > 0) ans++;
        }
    }

    printf("%d\n", ans);
    return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d%s"
.LC1:
	.string	"%d\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
	leaq	-28672(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$1520, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-30112(%rbp), %rdx
	leaq	-30192(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -30188(%rbp)
	movl	$0, -30184(%rbp)
	jmp	.L2
.L20:
	movl	$0, -30180(%rbp)
	jmp	.L3
.L5:
	addl	$1, -30180(%rbp)
.L3:
	movl	-30192(%rbp), %eax
	cmpl	%eax, -30180(%rbp)
	jge	.L4
	movl	-30180(%rbp), %eax
	cltq
	movzbl	-30112(%rbp,%rax), %eax
	movsbl	%al, %eax
	movl	-30184(%rbp), %edx
	addl	$48, %edx
	cmpl	%edx, %eax
	jne	.L5
.L4:
	movl	-30192(%rbp), %eax
	subl	$2, %eax
	cmpl	%eax, -30180(%rbp)
	jge	.L23
	movl	$0, -30176(%rbp)
	jmp	.L8
.L19:
	movl	-30180(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -30172(%rbp)
	jmp	.L9
.L11:
	addl	$1, -30172(%rbp)
.L9:
	movl	-30192(%rbp), %eax
	cmpl	%eax, -30172(%rbp)
	jge	.L10
	movl	-30172(%rbp), %eax
	cltq
	movzbl	-30112(%rbp,%rax), %eax
	movsbl	%al, %eax
	movl	-30176(%rbp), %edx
	addl	$48, %edx
	cmpl	%edx, %eax
	jne	.L11
.L10:
	movl	-30192(%rbp), %eax
	subl	$1, %eax
	cmpl	%eax, -30172(%rbp)
	jge	.L24
	movq	$0, -30160(%rbp)
	movq	$0, -30152(%rbp)
	movq	$0, -30144(%rbp)
	movq	$0, -30136(%rbp)
	movq	$0, -30128(%rbp)
	movl	-30172(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -30168(%rbp)
	jmp	.L14
.L15:
	movl	-30168(%rbp), %eax
	cltq
	movzbl	-30112(%rbp,%rax), %eax
	movsbl	%al, %eax
	subl	$48, %eax
	movslq	%eax, %rdx
	movl	-30160(%rbp,%rdx,4), %edx
	addl	$1, %edx
	cltq
	movl	%edx, -30160(%rbp,%rax,4)
	addl	$1, -30168(%rbp)
.L14:
	movl	-30192(%rbp), %eax
	cmpl	%eax, -30168(%rbp)
	jl	.L15
	movl	$0, -30164(%rbp)
	jmp	.L16
.L18:
	movl	-30164(%rbp), %eax
	cltq
	movl	-30160(%rbp,%rax,4), %eax
	testl	%eax, %eax
	jle	.L17
	addl	$1, -30188(%rbp)
.L17:
	addl	$1, -30164(%rbp)
.L16:
	cmpl	$9, -30164(%rbp)
	jle	.L18
	jmp	.L13
.L24:
	nop
.L13:
	addl	$1, -30176(%rbp)
.L8:
	cmpl	$9, -30176(%rbp)
	jle	.L19
	jmp	.L7
.L23:
	nop
.L7:
	addl	$1, -30184(%rbp)
.L2:
	cmpl	$9, -30184(%rbp)
	jle	.L20
	movl	-30188(%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	.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	"%d%s"
.LC1:
	.string	"%d\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
	leaq	-28672(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$1520, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-30112(%rbp), %rdx
	leaq	-30192(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -30188(%rbp)
	movl	$0, -30184(%rbp)
	jmp	.L2
.L20:
	movl	$0, -30180(%rbp)
	jmp	.L3
.L5:
	addl	$1, -30180(%rbp)
.L3:
	movl	-30192(%rbp), %eax
	cmpl	%eax, -30180(%rbp)
	jge	.L4
	movl	-30180(%rbp), %eax
	cltq
	movzbl	-30112(%rbp,%rax), %eax
	movsbl	%al, %eax
	movl	-30184(%rbp), %edx
	addl	$48, %edx
	cmpl	%edx, %eax
	jne	.L5
.L4:
	movl	-30192(%rbp), %eax
	subl	$2, %eax
	cmpl	%eax, -30180(%rbp)
	jge	.L23
	movl	$0, -30176(%rbp)
	jmp	.L8
.L19:
	movl	-30180(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -30172(%rbp)
	jmp	.L9
.L11:
	addl	$1, -30172(%rbp)
.L9:
	movl	-30192(%rbp), %eax
	cmpl	%eax, -30172(%rbp)
	jge	.L10
	movl	-30172(%rbp), %eax
	cltq
	movzbl	-30112(%rbp,%rax), %eax
	movsbl	%al, %eax
	movl	-30176(%rbp), %edx
	addl	$48, %edx
	cmpl	%edx, %eax
	jne	.L11
.L10:
	movl	-30192(%rbp), %eax
	subl	$1, %eax
	cmpl	%eax, -30172(%rbp)
	jge	.L24
	movq	$0, -30160(%rbp)
	movq	$0, -30152(%rbp)
	movq	$0, -30144(%rbp)
	movq	$0, -30136(%rbp)
	movq	$0, -30128(%rbp)
	movl	-30172(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -30168(%rbp)
	jmp	.L14
.L15:
	movl	-30168(%rbp), %eax
	cltq
	movzbl	-30112(%rbp,%rax), %eax
	movsbl	%al, %eax
	subl	$48, %eax
	movslq	%eax, %rdx
	movl	-30160(%rbp,%rdx,4), %edx
	addl	$1, %edx
	cltq
	movl	%edx, -30160(%rbp,%rax,4)
	addl	$1, -30168(%rbp)
.L14:
	movl	-30192(%rbp), %eax
	cmpl	%eax, -30168(%rbp)
	jl	.L15
	movl	$0, -30164(%rbp)
	jmp	.L16
.L18:
	movl	-30164(%rbp), %eax
	cltq
	movl	-30160(%rbp,%rax,4), %eax
	testl	%eax, %eax
	jle	.L17
	addl	$1, -30188(%rbp)
.L17:
	addl	$1, -30164(%rbp)
.L16:
	cmpl	$9, -30164(%rbp)
	jle	.L18
	jmp	.L13
.L24:
	nop
.L13:
	addl	$1, -30176(%rbp)
.L8:
	cmpl	$9, -30176(%rbp)
	jle	.L19
	jmp	.L7
.L23:
	nop
.L7:
	addl	$1, -30184(%rbp)
.L2:
	cmpl	$9, -30184(%rbp)
	jle	.L20
	movl	-30188(%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	.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:
