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

```c
#include <stdbool.h>
#include <stdio.h>
int main() {
	int n, m = 0;
	bool a[200000], ball[200000];
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("%d", &a[i]);
		ball[i] = false;
	}
	for (int i = n; i > 0; i--) {
		int cnt = 0;
		for (int j = 1; j <= n / i; j++) {
			cnt += ball[i * j - 1];
		}
		if (cnt % 2 != a[i - 1]) {
			ball[i - 1] = true;
			m++;
		}
	}
	printf("%d\n", m);
	for (int i = 0; i < n; i++) {
		if (ball[i]) {
			printf("%d ", i + 1);
		}
	}
	return 0;
}```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%d\n"
.LC2:
	.string	"%d "
	.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
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	leaq	-397312(%rsp), %r11
	.cfi_def_cfa 11, 397352
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$2728, %rsp
	.cfi_def_cfa_offset 400080
	leaq	.LC0(%rip), %r12
	movq	%r12, %rdi
	movq	%fs:40, %rax
	movq	%rax, 400024(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	testl	%eax, %eax
	jle	.L2
	xorl	%ebx, %ebx
	leaq	16(%rsp), %r13
	leaq	200016(%rsp), %rbp
	.p2align 4,,10
	.p2align 3
.L3:
	leaq	0(%r13,%rbx), %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %r9d
	movb	$0, 0(%rbp,%rbx)
	addq	$1, %rbx
	cmpl	%ebx, %r9d
	jg	.L3
	testl	%r9d, %r9d
	jle	.L2
	movslq	%r9d, %r8
	xorl	%r11d, %r11d
	leaq	15(%rsp), %rbx
	leaq	0(%rbp,%r8), %r10
	.p2align 4,,10
	.p2align 3
.L4:
	movl	%r9d, %eax
	xorl	%esi, %esi
	cltd
	idivl	%r8d
	testl	%eax, %eax
	jle	.L9
	addl	$1, %eax
	movq	%r10, %rcx
	movl	$1, %edx
	xorl	%esi, %esi
	.p2align 4,,10
	.p2align 3
.L5:
	movzbl	-1(%rcx), %edi
	addl	$1, %edx
	addq	%r8, %rcx
	addl	%edi, %esi
	cmpl	%edx, %eax
	jne	.L5
	andl	$1, %esi
.L9:
	movzbl	(%rbx,%r8), %eax
	cmpl	%esi, %eax
	je	.L6
	movb	$1, -1(%r10)
	addl	$1, %r11d
.L6:
	subq	$1, %r8
	subq	$1, %r10
	testl	%r8d, %r8d
	jg	.L4
.L7:
	movl	%r11d, %edx
	leaq	.LC1(%rip), %rsi
	xorl	%eax, %eax
	xorl	%ebx, %ebx
	movl	$1, %edi
	leaq	200016(%rsp), %rbp
	leaq	.LC2(%rip), %r12
	call	__printf_chk@PLT
	movl	12(%rsp), %eax
	testl	%eax, %eax
	jle	.L13
	.p2align 4,,10
	.p2align 3
.L10:
	cmpb	$0, 0(%rbp,%rbx)
	leal	1(%rbx), %edx
	jne	.L22
	addq	$1, %rbx
	cmpl	%ebx, %eax
	jg	.L10
.L13:
	movq	400024(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L23
	addq	$400040, %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
.L22:
	.cfi_restore_state
	movq	%r12, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	addq	$1, %rbx
	call	__printf_chk@PLT
	movl	12(%rsp), %eax
	cmpl	%ebx, %eax
	jg	.L10
	jmp	.L13
.L2:
	xorl	%r11d, %r11d
	jmp	.L7
.L23:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```

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.
Optimized Assembly Code:

user
```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%d\n"
.LC2:
	.string	"%d "
	.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
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	leaq	-397312(%rsp), %r11
	.cfi_def_cfa 11, 397352
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$2728, %rsp
	.cfi_def_cfa_offset 400080
	leaq	.LC0(%rip), %r12
	movq	%r12, %rdi
	movq	%fs:40, %rax
	movq	%rax, 400024(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	testl	%eax, %eax
	jle	.L2
	xorl	%ebx, %ebx
	leaq	16(%rsp), %r13
	leaq	200016(%rsp), %rbp
	.p2align 4,,10
	.p2align 3
.L3:
	leaq	0(%r13,%rbx), %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %r9d
	movb	$0, 0(%rbp,%rbx)
	addq	$1, %rbx
	cmpl	%ebx, %r9d
	jg	.L3
	testl	%r9d, %r9d
	jle	.L2
	movslq	%r9d, %r8
	xorl	%r11d, %r11d
	leaq	15(%rsp), %rbx
	leaq	0(%rbp,%r8), %r10
	.p2align 4,,10
	.p2align 3
.L4:
	movl	%r9d, %eax
	xorl	%esi, %esi
	cltd
	idivl	%r8d
	testl	%eax, %eax
	jle	.L9
	addl	$1, %eax
	movq	%r10, %rcx
	movl	$1, %edx
	xorl	%esi, %esi
	.p2align 4,,10
	.p2align 3
.L5:
	movzbl	-1(%rcx), %edi
	addl	$1, %edx
	addq	%r8, %rcx
	addl	%edi, %esi
	cmpl	%edx, %eax
	jne	.L5
	andl	$1, %esi
.L9:
	movzbl	(%rbx,%r8), %eax
	cmpl	%esi, %eax
	je	.L6
	movb	$1, -1(%r10)
	addl	$1, %r11d
.L6:
	subq	$1, %r8
	subq	$1, %r10
	testl	%r8d, %r8d
	jg	.L4
.L7:
	movl	%r11d, %edx
	leaq	.LC1(%rip), %rsi
	xorl	%eax, %eax
	xorl	%ebx, %ebx
	movl	$1, %edi
	leaq	200016(%rsp), %rbp
	leaq	.LC2(%rip), %r12
	call	__printf_chk@PLT
	movl	12(%rsp), %eax
	testl	%eax, %eax
	jle	.L13
	.p2align 4,,10
	.p2align 3
.L10:
	cmpb	$0, 0(%rbp,%rbx)
	leal	1(%rbx), %edx
	jne	.L22
	addq	$1, %rbx
	cmpl	%ebx, %eax
	jg	.L10
.L13:
	movq	400024(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L23
	addq	$400040, %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
.L22:
	.cfi_restore_state
	movq	%r12, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	addq	$1, %rbx
	call	__printf_chk@PLT
	movl	12(%rsp), %eax
	cmpl	%ebx, %eax
	jg	.L10
	jmp	.L13
.L2:
	xorl	%r11d, %r11d
	jmp	.L7
.L23:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```
rule
```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%d\n"
.LC2:
	.string	"%d "
	.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
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	leaq	-397312(%rsp), %r11
	.cfi_def_cfa 11, 397352
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$2728, %rsp
	.cfi_def_cfa_offset 400080
	leaq	.LC0(%rip), %r12
	movq	%r12, %rdi
	movq	%fs:40, %rax
	movq	%rax, 400024(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	testl	%eax, %eax
	jle	.L2
	xorl	%ebx, %ebx
	leaq	16(%rsp), %r13
	leaq	200016(%rsp), %rbp
	.p2align 4,,10
	.p2align 3
.L3:
	leaq	0(%r13,%rbx), %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %r9d
	movb	$0, 0(%rbp,%rbx)
	addq	$1, %rbx
	cmpl	%ebx, %r9d
	jg	.L3
	testl	%r9d, %r9d
	jle	.L2
	movslq	%r9d, %r8
	xorl	%r11d, %r11d
	leaq	15(%rsp), %rbx
	leaq	0(%rbp,%r8), %r10
	.p2align 4,,10
	.p2align 3
.L4:
	movl	%r9d, %eax
	xorl	%esi, %esi
	cltd
	idivl	%r8d
	testl	%eax, %eax
	jle	.L9
	addl	$1, %eax
	movq	%r10, %rcx
	movl	$1, %edx
	xorl	%esi, %esi
	.p2align 4,,10
	.p2align 3
.L5:
	movzbl	-1(%rcx), %edi
	addl	$1, %edx
	addq	%r8, %rcx
	addl	%edi, %esi
	cmpl	%edx, %eax
	jne	.L5
	andl	$1, %esi
.L9:
	movzbl	(%rbx,%r8), %eax
	cmpl	%esi, %eax
	je	.L6
	movb	$1, -1(%r10)
	addl	$1, %r11d
.L6:
	subq	$1, %r8
	subq	$1, %r10
	testl	%r8d, %r8d
	jg	.L4
.L7:
	movl	%r11d, %edx
	leaq	.LC1(%rip), %rsi
	xorl	%eax, %eax
	xorl	%ebx, %ebx
	movl	$1, %edi
	leaq	200016(%rsp), %rbp
	leaq	.LC2(%rip), %r12
	call	__printf_chk@PLT
	movl	12(%rsp), %eax
	testl	%eax, %eax
	jle	.L13
	.p2align 4,,10
	.p2align 3
.L10:
	cmpb	$0, 0(%rbp,%rbx)
	leal	1(%rbx), %edx
	jne	.L22
	addq	$1, %rbx
	cmpl	%ebx, %eax
	jg	.L10
.L13:
	movq	400024(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L23
	addq	$400040, %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
.L22:
	.cfi_restore_state
	movq	%r12, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	addq	$1, %rbx
	call	__printf_chk@PLT
	movl	12(%rsp), %eax
	cmpl	%ebx, %eax
	jg	.L10
	jmp	.L13
.L2:
	xorl	%r11d, %r11d
	jmp	.L7
.L23:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```
```c
#include <stdbool.h>
#include <stdio.h>
int main() {
	int n, m = 0;
	bool a[200000], ball[200000];
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("%d", &a[i]);
		ball[i] = false;
	}
	for (int i = n; i > 0; i--) {
		int cnt = 0;
		for (int j = 1; j <= n / i; j++) {
			cnt += ball[i * j - 1];
		}
		if (cnt % 2 != a[i - 1]) {
			ball[i - 1] = true;
			m++;
		}
	}
	printf("%d\n", m);
	for (int i = 0; i < n; i++) {
		if (ball[i]) {
			printf("%d ", i + 1);
		}
	}
	return 0;
}```
Given the following C code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
#include <stdbool.h>
#include <stdio.h>
int main() {
	int n, m = 0;
	bool a[200000], ball[200000];
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("%d", &a[i]);
		ball[i] = false;
	}
	for (int i = n; i > 0; i--) {
		int cnt = 0;
		for (int j = 1; j <= n / i; j++) {
			cnt += ball[i * j - 1];
		}
		if (cnt % 2 != a[i - 1]) {
			ball[i - 1] = true;
			m++;
		}
	}
	printf("%d\n", m);
	for (int i = 0; i < n; i++) {
		if (ball[i]) {
			printf("%d ", i + 1);
		}
	}
	return 0;
}```

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.
Optimized Assembly Code:

3
1 0 1
 3
1 1 0
 3
0 0 0
 5
1 0 0 0 0
 5
1 0 0 0 1
 5
1 1 0 1 0
 5
1 0 1 0 0
 5
1 1 0 0 0
 5
1 0 0 0 0
 3
0 0 0

1
3  1
2  0
 1
1  1
5  1
4  1
3  1
2  1
1  0

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

```c
#include <stdbool.h>
#include <stdio.h>
int main() {
	int n, m = 0;
	bool a[200000], ball[200000];
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("%d", &a[i]);
		ball[i] = false;
	}
	for (int i = n; i > 0; i--) {
		int cnt = 0;
		for (int j = 1; j <= n / i; j++) {
			cnt += ball[i * j - 1];
		}
		if (cnt % 2 != a[i - 1]) {
			ball[i - 1] = true;
			m++;
		}
	}
	printf("%d\n", m);
	for (int i = 0; i < n; i++) {
		if (ball[i]) {
			printf("%d ", i + 1);
		}
	}
	return 0;
}```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%d\n"
.LC2:
	.string	"%d "
	.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
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	leaq	-397312(%rsp), %r11
	.cfi_def_cfa 11, 397352
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$2728, %rsp
	.cfi_def_cfa_offset 400080
	leaq	.LC0(%rip), %r12
	movq	%r12, %rdi
	movq	%fs:40, %rax
	movq	%rax, 400024(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	testl	%eax, %eax
	jle	.L2
	xorl	%ebx, %ebx
	leaq	16(%rsp), %r13
	leaq	200016(%rsp), %rbp
	.p2align 4,,10
	.p2align 3
.L3:
	leaq	0(%r13,%rbx), %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %r9d
	movb	$0, 0(%rbp,%rbx)
	addq	$1, %rbx
	cmpl	%ebx, %r9d
	jg	.L3
	testl	%r9d, %r9d
	jle	.L2
	movslq	%r9d, %r8
	xorl	%r11d, %r11d
	leaq	15(%rsp), %rbx
	leaq	0(%rbp,%r8), %r10
	.p2align 4,,10
	.p2align 3
.L4:
	movl	%r9d, %eax
	xorl	%esi, %esi
	cltd
	idivl	%r8d
	testl	%eax, %eax
	jle	.L9
	addl	$1, %eax
	movq	%r10, %rcx
	movl	$1, %edx
	xorl	%esi, %esi
	.p2align 4,,10
	.p2align 3
.L5:
	movzbl	-1(%rcx), %edi
	addl	$1, %edx
	addq	%r8, %rcx
	addl	%edi, %esi
	cmpl	%edx, %eax
	jne	.L5
	andl	$1, %esi
.L9:
	movzbl	(%rbx,%r8), %eax
	cmpl	%esi, %eax
	je	.L6
	movb	$1, -1(%r10)
	addl	$1, %r11d
.L6:
	subq	$1, %r8
	subq	$1, %r10
	testl	%r8d, %r8d
	jg	.L4
.L7:
	movl	%r11d, %edx
	leaq	.LC1(%rip), %rsi
	xorl	%eax, %eax
	xorl	%ebx, %ebx
	movl	$1, %edi
	leaq	200016(%rsp), %rbp
	leaq	.LC2(%rip), %r12
	call	__printf_chk@PLT
	movl	12(%rsp), %eax
	testl	%eax, %eax
	jle	.L13
	.p2align 4,,10
	.p2align 3
.L10:
	cmpb	$0, 0(%rbp,%rbx)
	leal	1(%rbx), %edx
	jne	.L22
	addq	$1, %rbx
	cmpl	%ebx, %eax
	jg	.L10
.L13:
	movq	400024(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L23
	addq	$400040, %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
.L22:
	.cfi_restore_state
	movq	%r12, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	addq	$1, %rbx
	call	__printf_chk@PLT
	movl	12(%rsp), %eax
	cmpl	%ebx, %eax
	jg	.L10
	jmp	.L13
.L2:
	xorl	%r11d, %r11d
	jmp	.L7
.L23:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```

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.
Optimized Assembly Code:

train
```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%d\n"
.LC2:
	.string	"%d "
	.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
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	leaq	-397312(%rsp), %r11
	.cfi_def_cfa 11, 397352
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$2728, %rsp
	.cfi_def_cfa_offset 400080
	leaq	.LC0(%rip), %r12
	movq	%r12, %rdi
	movq	%fs:40, %rax
	movq	%rax, 400024(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	testl	%eax, %eax
	jle	.L2
	xorl	%ebx, %ebx
	leaq	16(%rsp), %r13
	leaq	200016(%rsp), %rbp
	.p2align 4,,10
	.p2align 3
.L3:
	leaq	0(%r13,%rbx), %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %r9d
	movb	$0, 0(%rbp,%rbx)
	addq	$1, %rbx
	cmpl	%ebx, %r9d
	jg	.L3
	testl	%r9d, %r9d
	jle	.L2
	movslq	%r9d, %r8
	xorl	%r11d, %r11d
	leaq	15(%rsp), %rbx
	leaq	0(%rbp,%r8), %r10
	.p2align 4,,10
	.p2align 3
.L4:
	movl	%r9d, %eax
	xorl	%esi, %esi
	cltd
	idivl	%r8d
	testl	%eax, %eax
	jle	.L9
	addl	$1, %eax
	movq	%r10, %rcx
	movl	$1, %edx
	xorl	%esi, %esi
	.p2align 4,,10
	.p2align 3
.L5:
	movzbl	-1(%rcx), %edi
	addl	$1, %edx
	addq	%r8, %rcx
	addl	%edi, %esi
	cmpl	%edx, %eax
	jne	.L5
	andl	$1, %esi
.L9:
	movzbl	(%rbx,%r8), %eax
	cmpl	%esi, %eax
	je	.L6
	movb	$1, -1(%r10)
	addl	$1, %r11d
.L6:
	subq	$1, %r8
	subq	$1, %r10
	testl	%r8d, %r8d
	jg	.L4
.L7:
	movl	%r11d, %edx
	leaq	.LC1(%rip), %rsi
	xorl	%eax, %eax
	xorl	%ebx, %ebx
	movl	$1, %edi
	leaq	200016(%rsp), %rbp
	leaq	.LC2(%rip), %r12
	call	__printf_chk@PLT
	movl	12(%rsp), %eax
	testl	%eax, %eax
	jle	.L13
	.p2align 4,,10
	.p2align 3
.L10:
	cmpb	$0, 0(%rbp,%rbx)
	leal	1(%rbx), %edx
	jne	.L22
	addq	$1, %rbx
	cmpl	%ebx, %eax
	jg	.L10
.L13:
	movq	400024(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L23
	addq	$400040, %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
.L22:
	.cfi_restore_state
	movq	%r12, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	addq	$1, %rbx
	call	__printf_chk@PLT
	movl	12(%rsp), %eax
	cmpl	%ebx, %eax
	jg	.L10
	jmp	.L13
.L2:
	xorl	%r11d, %r11d
	jmp	.L7
.L23:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```