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 main(void){
	char num[1000];
	int total=0,count=0,i;
	while(1){
		scanf("%s",num);
		if(num[0]=='0') break;
		while(num[count]!='\0'){
			count++;
		}
		for(i=0;i<count;i++){
			total+=num[i]-'0';
		}
		printf("%d\n",total);
		total=0;
		count=0;
	}
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%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
	subq	$1024, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, -1020(%rbp)
	movl	$0, -1016(%rbp)
.L8:
	leaq	-1008(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movzbl	-1008(%rbp), %eax
	cmpb	$48, %al
	je	.L12
	jmp	.L4
.L5:
	addl	$1, -1016(%rbp)
.L4:
	movl	-1016(%rbp), %eax
	cltq
	movzbl	-1008(%rbp,%rax), %eax
	testb	%al, %al
	jne	.L5
	movl	$0, -1012(%rbp)
	jmp	.L6
.L7:
	movl	-1012(%rbp), %eax
	cltq
	movzbl	-1008(%rbp,%rax), %eax
	movsbl	%al, %eax
	subl	$48, %eax
	addl	%eax, -1020(%rbp)
	addl	$1, -1012(%rbp)
.L6:
	movl	-1012(%rbp), %eax
	cmpl	-1016(%rbp), %eax
	jl	.L7
	movl	-1020(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, -1020(%rbp)
	movl	$0, -1016(%rbp)
	jmp	.L8
.L12:
	nop
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L10
	call	__stack_chk_fail@PLT
.L10:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```

Only output the optimized assembly code. Do not include any other text. Do not write any comments in the assembly code. Wrap the assembly code in ```assembly``` tags.
user
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%s"
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	leaq	.LC2(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	leaq	.LC0(%rip), %rbx
	subq	$1016, %rsp
	.cfi_def_cfa_offset 1056
	movq	%fs:40, %rax
	movq	%rax, 1000(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %r13
	leaq	16(%rsp), %r12
	.p2align 4,,10
	.p2align 3
.L8:
	movq	%r13, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movzbl	(%rsp), %eax
	cmpb	$48, %al
	je	.L2
	testb	%al, %al
	movdqa	.LC1(%rip), %xmm4
	je	.L10
	xorl	%eax, %eax
	.p2align 4,,10
	.p2align 3
.L4:
	movl	%eax, %ecx
	addq	$1, %rax
	cmpb	$0, 0(%r13,%rax)
	jne	.L4
	leal	1(%rcx), %esi
	cmpl	$14, %ecx
	jbe	.L11
	movl	%esi, %edx
	pxor	%xmm1, %xmm1
	pxor	%xmm6, %xmm6
	movq	%r13, %rax
	shrl	$4, %edx
	pxor	%xmm5, %xmm5
	subl	$1, %edx
	salq	$4, %rdx
	addq	%r12, %rdx
	.p2align 4,,10
	.p2align 3
.L6:
	movdqa	(%rax), %xmm0
	movdqa	%xmm6, %xmm3
	addq	$16, %rax
	pcmpgtb	%xmm0, %xmm3
	movdqa	%xmm0, %xmm2
	punpcklbw	%xmm3, %xmm2
	punpckhbw	%xmm3, %xmm0
	movdqa	%xmm5, %xmm3
	paddw	%xmm4, %xmm2
	paddw	%xmm4, %xmm0
	pcmpgtw	%xmm2, %xmm3
	movdqa	%xmm2, %xmm7
	punpcklwd	%xmm3, %xmm7
	punpckhwd	%xmm3, %xmm2
	movdqa	%xmm0, %xmm3
	paddd	%xmm7, %xmm1
	paddd	%xmm2, %xmm1
	movdqa	%xmm5, %xmm2
	pcmpgtw	%xmm0, %xmm2
	punpcklwd	%xmm2, %xmm3
	punpckhwd	%xmm2, %xmm0
	paddd	%xmm3, %xmm1
	paddd	%xmm0, %xmm1
	cmpq	%rdx, %rax
	jne	.L6
	movdqa	%xmm1, %xmm0
	movl	%esi, %eax
	psrldq	$8, %xmm0
	andl	$-16, %eax
	andl	$15, %esi
	paddd	%xmm0, %xmm1
	movdqa	%xmm1, %xmm0
	psrldq	$4, %xmm0
	paddd	%xmm0, %xmm1
	movd	%xmm1, %edx
	je	.L3
.L5:
	movslq	%eax, %rsi
	movsbl	(%rsp,%rsi), %esi
	leal	-48(%rdx,%rsi), %edx
	leal	1(%rax), %esi
	cmpl	%eax, %ecx
	jle	.L3
	movslq	%esi, %rdi
	movsbl	(%rsp,%rdi), %edi
	leal	-48(%rdx,%rdi), %edx
	leal	2(%rax), %edi
	cmpl	%ecx, %esi
	jge	.L3
	movslq	%edi, %rsi
	movsbl	(%rsp,%rsi), %esi
	leal	-48(%rdx,%rsi), %edx
	leal	3(%rax), %esi
	cmpl	%edi, %ecx
	jle	.L3
	movslq	%esi, %rdi
	movsbl	(%rsp,%rdi), %edi
	leal	-48(%rdx,%rdi), %edx
	leal	4(%rax), %edi
	cmpl	%ecx, %esi
	jge	.L3
	movslq	%edi, %rsi
	movsbl	(%rsp,%rsi), %esi
	leal	-48(%rdx,%rsi), %edx
	leal	5(%rax), %esi
	cmpl	%edi, %ecx
	jle	.L3
	movslq	%esi, %rdi
	movsbl	(%rsp,%rdi), %edi
	leal	-48(%rdx,%rdi), %edx
	leal	6(%rax), %edi
	cmpl	%esi, %ecx
	jle	.L3
	movslq	%edi, %rsi
	movsbl	(%rsp,%rsi), %esi
	leal	-48(%rdx,%rsi), %edx
	leal	7(%rax), %esi
	cmpl	%edi, %ecx
	jle	.L3
	movslq	%esi, %rdi
	movsbl	(%rsp,%rdi), %edi
	leal	-48(%rdx,%rdi), %edx
	leal	8(%rax), %edi
	cmpl	%esi, %ecx
	jle	.L3
	movslq	%edi, %rsi
	movsbl	(%rsp,%rsi), %esi
	leal	-48(%rdx,%rsi), %edx
	leal	9(%rax), %esi
	cmpl	%edi, %ecx
	jle	.L3
	movslq	%esi, %rdi
	movsbl	(%rsp,%rdi), %edi
	leal	-48(%rdx,%rdi), %edx
	leal	10(%rax), %edi
	cmpl	%esi, %ecx
	jle	.L3
	movslq	%edi, %rsi
	movsbl	(%rsp,%rsi), %esi
	leal	-48(%rdx,%rsi), %edx
	leal	11(%rax), %esi
	cmpl	%edi, %ecx
	jle	.L3
	movslq	%esi, %rdi
	movsbl	(%rsp,%rdi), %edi
	leal	-48(%rdx,%rdi), %edx
	leal	12(%rax), %edi
	cmpl	%esi, %ecx
	jle	.L3
	movslq	%edi, %rsi
	movsbl	(%rsp,%rsi), %esi
	leal	-48(%rdx,%rsi), %edx
	leal	13(%rax), %esi
	cmpl	%edi, %ecx
	jle	.L3
	movslq	%esi, %rdi
	addl	$14, %eax
	movsbl	(%rsp,%rdi), %edi
	leal	-48(%rdx,%rdi), %edx
	cmpl	%esi, %ecx
	jle	.L3
	cltq
	movsbl	(%rsp,%rax), %eax
	leal	-48(%rdx,%rax), %edx
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%rbp, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L2:
	movq	1000(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L16
	addq	$1016, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L10:
	.cfi_restore_state
	xorl	%edx, %edx
	jmp	.L3
.L11:
	xorl	%eax, %eax
	xorl	%edx, %edx
	jmp	.L5
.L16:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC1:
	.value	-48
	.value	-48
	.value	-48
	.value	-48
	.value	-48
	.value	-48
	.value	-48
	.value	-48
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:

rule
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%s"
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	leaq	.LC2(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	leaq	.LC0(%rip), %rbx
	subq	$1016, %rsp
	.cfi_def_cfa_offset 1056
	movq	%fs:40, %rax
	movq	%rax, 1000(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %r13
	leaq	16(%rsp), %r12
	.p2align 4,,10
	.p2align 3
.L8:
	movq	%r13, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movzbl	(%rsp), %eax
	cmpb	$48, %al
	je	.L2
	testb	%al, %al
	movdqa	.LC1(%rip), %xmm4
	je	.L10
	xorl	%eax, %eax
	.p2align 4,,10
	.p2align 3
.L4:
	movl	%eax, %ecx
	addq	$1, %rax
	cmpb	$0, 0(%r13,%rax)
	jne	.L4
	leal	1(%rcx), %esi
	cmpl	$14, %ecx
	jbe	.L11
	movl	%esi, %edx
	pxor	%xmm1, %xmm1
	pxor	%xmm6, %xmm6
	movq	%r13, %rax
	shrl	$4, %edx
	pxor	%xmm5, %xmm5
	subl	$1, %edx
	salq	$4, %rdx
	addq	%r12, %rdx
	.p2align 4,,10
	.p2align 3
.L6:
	movdqa	(%rax), %xmm0
	movdqa	%xmm6, %xmm3
	addq	$16, %rax
	pcmpgtb	%xmm0, %xmm3
	movdqa	%xmm0, %xmm2
	punpcklbw	%xmm3, %xmm2
	punpckhbw	%xmm3, %xmm0
	movdqa	%xmm5, %xmm3
	paddw	%xmm4, %xmm2
	paddw	%xmm4, %xmm0
	pcmpgtw	%xmm2, %xmm3
	movdqa	%xmm2, %xmm7
	punpcklwd	%xmm3, %xmm7
	punpckhwd	%xmm3, %xmm2
	movdqa	%xmm0, %xmm3
	paddd	%xmm7, %xmm1
	paddd	%xmm2, %xmm1
	movdqa	%xmm5, %xmm2
	pcmpgtw	%xmm0, %xmm2
	punpcklwd	%xmm2, %xmm3
	punpckhwd	%xmm2, %xmm0
	paddd	%xmm3, %xmm1
	paddd	%xmm0, %xmm1
	cmpq	%rdx, %rax
	jne	.L6
	movdqa	%xmm1, %xmm0
	movl	%esi, %eax
	psrldq	$8, %xmm0
	andl	$-16, %eax
	andl	$15, %esi
	paddd	%xmm0, %xmm1
	movdqa	%xmm1, %xmm0
	psrldq	$4, %xmm0
	paddd	%xmm0, %xmm1
	movd	%xmm1, %edx
	je	.L3
.L5:
	movslq	%eax, %rsi
	movsbl	(%rsp,%rsi), %esi
	leal	-48(%rdx,%rsi), %edx
	leal	1(%rax), %esi
	cmpl	%eax, %ecx
	jle	.L3
	movslq	%esi, %rdi
	movsbl	(%rsp,%rdi), %edi
	leal	-48(%rdx,%rdi), %edx
	leal	2(%rax), %edi
	cmpl	%ecx, %esi
	jge	.L3
	movslq	%edi, %rsi
	movsbl	(%rsp,%rsi), %esi
	leal	-48(%rdx,%rsi), %edx
	leal	3(%rax), %esi
	cmpl	%edi, %ecx
	jle	.L3
	movslq	%esi, %rdi
	movsbl	(%rsp,%rdi), %edi
	leal	-48(%rdx,%rdi), %edx
	leal	4(%rax), %edi
	cmpl	%ecx, %esi
	jge	.L3
	movslq	%edi, %rsi
	movsbl	(%rsp,%rsi), %esi
	leal	-48(%rdx,%rsi), %edx
	leal	5(%rax), %esi
	cmpl	%edi, %ecx
	jle	.L3
	movslq	%esi, %rdi
	movsbl	(%rsp,%rdi), %edi
	leal	-48(%rdx,%rdi), %edx
	leal	6(%rax), %edi
	cmpl	%esi, %ecx
	jle	.L3
	movslq	%edi, %rsi
	movsbl	(%rsp,%rsi), %esi
	leal	-48(%rdx,%rsi), %edx
	leal	7(%rax), %esi
	cmpl	%edi, %ecx
	jle	.L3
	movslq	%esi, %rdi
	movsbl	(%rsp,%rdi), %edi
	leal	-48(%rdx,%rdi), %edx
	leal	8(%rax), %edi
	cmpl	%esi, %ecx
	jle	.L3
	movslq	%edi, %rsi
	movsbl	(%rsp,%rsi), %esi
	leal	-48(%rdx,%rsi), %edx
	leal	9(%rax), %esi
	cmpl	%edi, %ecx
	jle	.L3
	movslq	%esi, %rdi
	movsbl	(%rsp,%rdi), %edi
	leal	-48(%rdx,%rdi), %edx
	leal	10(%rax), %edi
	cmpl	%esi, %ecx
	jle	.L3
	movslq	%edi, %rsi
	movsbl	(%rsp,%rsi), %esi
	leal	-48(%rdx,%rsi), %edx
	leal	11(%rax), %esi
	cmpl	%edi, %ecx
	jle	.L3
	movslq	%esi, %rdi
	movsbl	(%rsp,%rdi), %edi
	leal	-48(%rdx,%rdi), %edx
	leal	12(%rax), %edi
	cmpl	%esi, %ecx
	jle	.L3
	movslq	%edi, %rsi
	movsbl	(%rsp,%rsi), %esi
	leal	-48(%rdx,%rsi), %edx
	leal	13(%rax), %esi
	cmpl	%edi, %ecx
	jle	.L3
	movslq	%esi, %rdi
	addl	$14, %eax
	movsbl	(%rsp,%rdi), %edi
	leal	-48(%rdx,%rdi), %edx
	cmpl	%esi, %ecx
	jle	.L3
	cltq
	movsbl	(%rsp,%rax), %eax
	leal	-48(%rdx,%rax), %edx
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%rbp, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L2:
	movq	1000(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L16
	addq	$1016, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L10:
	.cfi_restore_state
	xorl	%edx, %edx
	jmp	.L3
.L11:
	xorl	%eax, %eax
	xorl	%edx, %edx
	jmp	.L5
.L16:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC1:
	.value	-48
	.value	-48
	.value	-48
	.value	-48
	.value	-48
	.value	-48
	.value	-48
	.value	-48
	.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 main(void){
	char num[1000];
	int total=0,count=0,i;
	while(1){
		scanf("%s",num);
		if(num[0]=='0') break;
		while(num[count]!='\0'){
			count++;
		}
		for(i=0;i<count;i++){
			total+=num[i]-'0';
		}
		printf("%d\n",total);
		total=0;
		count=0;
	}
	return 0;
}
123
55
1001
0
 123
69
1000
0
 123
69
1010
0
 123
69
1110
0
 123
55
0001
0
 123
55
1101
0
 123
69
1111
0
 123
23
1001
0
 123
65
0001
0
 123
151
1101
0

6
10
2
 6
15
1
 6
15
2
 6
15
3
 6
10
 6
10
3
 6
15
4
 6
5
2
 6
11
 6
7
3

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 main(void){
	char num[1000];
	int total=0,count=0,i;
	while(1){
		scanf("%s",num);
		if(num[0]=='0') break;
		while(num[count]!='\0'){
			count++;
		}
		for(i=0;i<count;i++){
			total+=num[i]-'0';
		}
		printf("%d\n",total);
		total=0;
		count=0;
	}
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%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
	subq	$1024, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, -1020(%rbp)
	movl	$0, -1016(%rbp)
.L8:
	leaq	-1008(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movzbl	-1008(%rbp), %eax
	cmpb	$48, %al
	je	.L12
	jmp	.L4
.L5:
	addl	$1, -1016(%rbp)
.L4:
	movl	-1016(%rbp), %eax
	cltq
	movzbl	-1008(%rbp,%rax), %eax
	testb	%al, %al
	jne	.L5
	movl	$0, -1012(%rbp)
	jmp	.L6
.L7:
	movl	-1012(%rbp), %eax
	cltq
	movzbl	-1008(%rbp,%rax), %eax
	movsbl	%al, %eax
	subl	$48, %eax
	addl	%eax, -1020(%rbp)
	addl	$1, -1012(%rbp)
.L6:
	movl	-1012(%rbp), %eax
	cmpl	-1016(%rbp), %eax
	jl	.L7
	movl	-1020(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, -1020(%rbp)
	movl	$0, -1016(%rbp)
	jmp	.L8
.L12:
	nop
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L10
	call	__stack_chk_fail@PLT
.L10:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```

Only output the optimized assembly code. Do not include any other text. Do not write any comments in the assembly code. Wrap the assembly code in ```assembly``` tags.
train
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%s"
.LC1:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$1024, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, -1020(%rbp)
	movl	$0, -1016(%rbp)
.L8:
	leaq	-1008(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movzbl	-1008(%rbp), %eax
	cmpb	$48, %al
	je	.L12
	jmp	.L4
.L5:
	addl	$1, -1016(%rbp)
.L4:
	movl	-1016(%rbp), %eax
	cltq
	movzbl	-1008(%rbp,%rax), %eax
	testb	%al, %al
	jne	.L5
	movl	$0, -1012(%rbp)
	jmp	.L6
.L7:
	movl	-1012(%rbp), %eax
	cltq
	movzbl	-1008(%rbp,%rax), %eax
	movsbl	%al, %eax
	subl	$48, %eax
	addl	%eax, -1020(%rbp)
	addl	$1, -1012(%rbp)
.L6:
	movl	-1012(%rbp), %eax
	cmpl	-1016(%rbp), %eax
	jl	.L7
	movl	-1020(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, -1020(%rbp)
	movl	$0, -1016(%rbp)
	jmp	.L8
.L12:
	nop
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L10
	call	__stack_chk_fail@PLT
.L10:
	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:
