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(){
  int n,count=0,i;
  char x[200002];
  scanf("%d",&n);
  scanf("%*c%s",x);
  for(i=0;i<n;i++){
    if(x[i]=='1')
      count++;
  }
  int popcount[200002];
  popcount[0]=0;
  for(i=1;i<200001;i++){
    int temp=i,check=0;
    while(temp!=0){
      if(temp%2==1)
        check++;
      temp/=2;
    }
    popcount[i]=popcount[i%check]+1;
  }
  int mod[n][2];
  int num[2]={0,0};
  for(i=n-1;i>=0;i--){
    if(i==n-1){
      mod[n-1][0]=1;
      mod[n-1][1]=1;
    }
    else{
      mod[i][0]=(2*mod[i+1][0])%(count+1);
      if(count>1)
        mod[i][1]=(2*mod[i+1][1])%(count-1);
      else
        mod[i][1]=0;
    }
    if(x[i]=='1'){
      num[0]=(num[0]+mod[i][0])%(count+1);
      if(count>1)
        num[1]=(num[1]+mod[i][1])%(count-1);
    }
  }
  for(i=0;i<n;i++){
    int ans;
    if(x[i]=='1' && count-1==0)
      ans=0;
    else if(x[i]=='1')
      ans=popcount[(num[1]-mod[i][1]+count-1)%(count-1)]+1;
    else
      ans=popcount[(num[0]+mod[i][0])%(count+1)]+1;
    printf("%d\n",ans);
  }
  return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%*c%s"
.LC2:
	.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
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	leaq	-999424(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$664, %rsp
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	movq	%rsp, %rax
	movq	%rax, %rbx
	movl	$0, -1000124(%rbp)
	leaq	-1000128(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-200064(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -1000120(%rbp)
	jmp	.L2
.L4:
	movl	-1000120(%rbp), %eax
	cltq
	movzbl	-200064(%rbp,%rax), %eax
	cmpb	$49, %al
	jne	.L3
	addl	$1, -1000124(%rbp)
.L3:
	addl	$1, -1000120(%rbp)
.L2:
	movl	-1000128(%rbp), %eax
	cmpl	%eax, -1000120(%rbp)
	jl	.L4
	movl	$0, -1000080(%rbp)
	movl	$1, -1000120(%rbp)
	jmp	.L5
.L9:
	movl	-1000120(%rbp), %eax
	movl	%eax, -1000116(%rbp)
	movl	$0, -1000112(%rbp)
	jmp	.L6
.L8:
	movl	-1000116(%rbp), %eax
	cltd
	shrl	$31, %edx
	addl	%edx, %eax
	andl	$1, %eax
	subl	%edx, %eax
	cmpl	$1, %eax
	jne	.L7
	addl	$1, -1000112(%rbp)
.L7:
	movl	-1000116(%rbp), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, -1000116(%rbp)
.L6:
	cmpl	$0, -1000116(%rbp)
	jne	.L8
	movl	-1000120(%rbp), %eax
	cltd
	idivl	-1000112(%rbp)
	movl	%edx, %eax
	cltq
	movl	-1000080(%rbp,%rax,4), %eax
	leal	1(%rax), %edx
	movl	-1000120(%rbp), %eax
	cltq
	movl	%edx, -1000080(%rbp,%rax,4)
	addl	$1, -1000120(%rbp)
.L5:
	cmpl	$200000, -1000120(%rbp)
	jle	.L9
	movl	-1000128(%rbp), %eax
	movslq	%eax, %rdx
	subq	$1, %rdx
	movq	%rdx, -1000104(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, %r14
	movl	$0, %r15d
	movslq	%eax, %rdx
	movq	%rdx, %r12
	movl	$0, %r13d
	cltq
	leaq	0(,%rax,8), %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %esi
	movl	$0, %edx
	divq	%rsi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L10:
	cmpq	%rdx, %rsp
	je	.L11
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L10
.L11:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L12
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L12:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -1000096(%rbp)
	movl	$0, -1000088(%rbp)
	movl	$0, -1000084(%rbp)
	movl	-1000128(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -1000120(%rbp)
	jmp	.L13
.L18:
	movl	-1000128(%rbp), %eax
	subl	$1, %eax
	cmpl	%eax, -1000120(%rbp)
	jne	.L14
	movl	-1000128(%rbp), %eax
	leal	-1(%rax), %edx
	movq	-1000096(%rbp), %rax
	movslq	%edx, %rdx
	movl	$1, (%rax,%rdx,8)
	movl	-1000128(%rbp), %eax
	leal	-1(%rax), %edx
	movq	-1000096(%rbp), %rax
	movslq	%edx, %rdx
	movl	$1, 4(%rax,%rdx,8)
	jmp	.L15
.L14:
	movl	-1000120(%rbp), %eax
	leal	1(%rax), %edx
	movq	-1000096(%rbp), %rax
	movslq	%edx, %rdx
	movl	(%rax,%rdx,8), %eax
	addl	%eax, %eax
	movl	-1000124(%rbp), %edx
	leal	1(%rdx), %ecx
	cltd
	idivl	%ecx
	movl	%edx, %ecx
	movq	-1000096(%rbp), %rax
	movl	-1000120(%rbp), %edx
	movslq	%edx, %rdx
	movl	%ecx, (%rax,%rdx,8)
	cmpl	$1, -1000124(%rbp)
	jle	.L16
	movl	-1000120(%rbp), %eax
	leal	1(%rax), %edx
	movq	-1000096(%rbp), %rax
	movslq	%edx, %rdx
	movl	4(%rax,%rdx,8), %eax
	addl	%eax, %eax
	movl	-1000124(%rbp), %edx
	leal	-1(%rdx), %ecx
	cltd
	idivl	%ecx
	movl	%edx, %ecx
	movq	-1000096(%rbp), %rax
	movl	-1000120(%rbp), %edx
	movslq	%edx, %rdx
	movl	%ecx, 4(%rax,%rdx,8)
	jmp	.L15
.L16:
	movq	-1000096(%rbp), %rax
	movl	-1000120(%rbp), %edx
	movslq	%edx, %rdx
	movl	$0, 4(%rax,%rdx,8)
.L15:
	movl	-1000120(%rbp), %eax
	cltq
	movzbl	-200064(%rbp,%rax), %eax
	cmpb	$49, %al
	jne	.L17
	movl	-1000088(%rbp), %ecx
	movq	-1000096(%rbp), %rax
	movl	-1000120(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,8), %eax
	addl	%ecx, %eax
	movl	-1000124(%rbp), %edx
	leal	1(%rdx), %ecx
	cltd
	idivl	%ecx
	movl	%edx, %eax
	movl	%eax, -1000088(%rbp)
	cmpl	$1, -1000124(%rbp)
	jle	.L17
	movl	-1000084(%rbp), %ecx
	movq	-1000096(%rbp), %rax
	movl	-1000120(%rbp), %edx
	movslq	%edx, %rdx
	movl	4(%rax,%rdx,8), %eax
	addl	%ecx, %eax
	movl	-1000124(%rbp), %edx
	leal	-1(%rdx), %ecx
	cltd
	idivl	%ecx
	movl	%edx, %eax
	movl	%eax, -1000084(%rbp)
.L17:
	subl	$1, -1000120(%rbp)
.L13:
	cmpl	$0, -1000120(%rbp)
	jns	.L18
	movl	$0, -1000120(%rbp)
	jmp	.L19
.L23:
	movl	-1000120(%rbp), %eax
	cltq
	movzbl	-200064(%rbp,%rax), %eax
	cmpb	$49, %al
	jne	.L20
	cmpl	$1, -1000124(%rbp)
	jne	.L20
	movl	$0, -1000108(%rbp)
	jmp	.L21
.L20:
	movl	-1000120(%rbp), %eax
	cltq
	movzbl	-200064(%rbp,%rax), %eax
	cmpb	$49, %al
	jne	.L22
	movl	-1000084(%rbp), %ecx
	movq	-1000096(%rbp), %rax
	movl	-1000120(%rbp), %edx
	movslq	%edx, %rdx
	movl	4(%rax,%rdx,8), %eax
	subl	%eax, %ecx
	movl	%ecx, %edx
	movl	-1000124(%rbp), %eax
	addl	%edx, %eax
	subl	$1, %eax
	movl	-1000124(%rbp), %edx
	leal	-1(%rdx), %ecx
	cltd
	idivl	%ecx
	movl	%edx, %eax
	cltq
	movl	-1000080(%rbp,%rax,4), %eax
	addl	$1, %eax
	movl	%eax, -1000108(%rbp)
	jmp	.L21
.L22:
	movl	-1000088(%rbp), %ecx
	movq	-1000096(%rbp), %rax
	movl	-1000120(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,8), %eax
	addl	%ecx, %eax
	movl	-1000124(%rbp), %edx
	leal	1(%rdx), %ecx
	cltd
	idivl	%ecx
	movl	%edx, %eax
	cltq
	movl	-1000080(%rbp,%rax,4), %eax
	addl	$1, %eax
	movl	%eax, -1000108(%rbp)
.L21:
	movl	-1000108(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -1000120(%rbp)
.L19:
	movl	-1000128(%rbp), %eax
	cmpl	%eax, -1000120(%rbp)
	jl	.L23
	movl	$0, %eax
	movq	%rbx, %rsp
	movq	-56(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L25
	call	__stack_chk_fail@PLT
.L25:
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.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"
.LC1:
	.string	"%*c%s"
.LC5:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	leaq	-999424(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$648, %rsp
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	leaq	.LC0(%rip), %rdi
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	leaq	-1000084(%rbp), %rsi
	leaq	-200064(%rbp), %r13
	call	__isoc99_scanf@PLT
	movq	%r13, %rsi
	leaq	.LC1(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	-1000084(%rbp), %r10
	testl	%r10d, %r10d
	jle	.L52
	leal	-1(%r10), %r9d
	cmpl	$14, %r9d
	jbe	.L53
	movl	%r10d, %edx
	pxor	%xmm1, %xmm1
	pxor	%xmm5, %xmm5
	movq	%r13, %rax
	shrl	$4, %edx
	movdqa	.LC2(%rip), %xmm7
	movdqa	.LC3(%rip), %xmm6
	pxor	%xmm4, %xmm4
	subl	$1, %edx
	salq	$4, %rdx
	leaq	-200048(%rbp,%rdx), %rdx
.L4:
	movdqa	%xmm7, %xmm0
	movdqa	%xmm5, %xmm3
	addq	$16, %rax
	pcmpeqb	-16(%rax), %xmm0
	pand	%xmm6, %xmm0
	pcmpgtb	%xmm0, %xmm3
	movdqa	%xmm0, %xmm2
	punpcklbw	%xmm3, %xmm2
	punpckhbw	%xmm3, %xmm0
	movdqa	%xmm4, %xmm3
	pcmpgtw	%xmm2, %xmm3
	movdqa	%xmm2, %xmm8
	punpcklwd	%xmm3, %xmm8
	punpckhwd	%xmm3, %xmm2
	movdqa	%xmm0, %xmm3
	paddd	%xmm8, %xmm1
	paddd	%xmm2, %xmm1
	movdqa	%xmm4, %xmm2
	pcmpgtw	%xmm0, %xmm2
	punpcklwd	%xmm2, %xmm3
	punpckhwd	%xmm2, %xmm0
	paddd	%xmm3, %xmm1
	paddd	%xmm0, %xmm1
	cmpq	%rdx, %rax
	jne	.L4
	movdqa	%xmm1, %xmm0
	movl	%r10d, %eax
	psrldq	$8, %xmm0
	andl	$-16, %eax
	paddd	%xmm0, %xmm1
	movdqa	%xmm1, %xmm0
	psrldq	$4, %xmm0
	paddd	%xmm0, %xmm1
	movd	%xmm1, %r12d
	testb	$15, %r10b
	je	.L2
.L3:
	movslq	%eax, %rdx
	cmpb	$49, -200064(%rbp,%rdx)
	jne	.L6
	addl	$1, %r12d
.L6:
	leal	1(%rax), %edx
	cmpl	%r10d, %edx
	jge	.L2
	movslq	%edx, %rdx
	cmpb	$49, -200064(%rbp,%rdx)
	je	.L75
.L7:
	leal	2(%rax), %edx
	cmpl	%edx, %r10d
	jle	.L2
	movslq	%edx, %rdx
	cmpb	$49, -200064(%rbp,%rdx)
	je	.L76
.L8:
	leal	3(%rax), %edx
	cmpl	%edx, %r10d
	jle	.L2
	movslq	%edx, %rdx
	cmpb	$49, -200064(%rbp,%rdx)
	je	.L77
.L9:
	leal	4(%rax), %edx
	cmpl	%edx, %r10d
	jle	.L2
	movslq	%edx, %rdx
	cmpb	$49, -200064(%rbp,%rdx)
	je	.L78
.L10:
	leal	5(%rax), %edx
	cmpl	%r10d, %edx
	jge	.L2
	movslq	%edx, %rdx
	cmpb	$49, -200064(%rbp,%rdx)
	jne	.L11
	addl	$1, %r12d
.L11:
	leal	6(%rax), %edx
	cmpl	%edx, %r10d
	jle	.L2
	movslq	%edx, %rdx
	cmpb	$49, -200064(%rbp,%rdx)
	jne	.L12
	addl	$1, %r12d
.L12:
	leal	7(%rax), %edx
	cmpl	%r10d, %edx
	jge	.L2
	movslq	%edx, %rdx
	cmpb	$49, -200064(%rbp,%rdx)
	jne	.L13
	addl	$1, %r12d
.L13:
	leal	8(%rax), %edx
	cmpl	%edx, %r10d
	jle	.L2
	movslq	%edx, %rdx
	cmpb	$49, -200064(%rbp,%rdx)
	jne	.L14
	addl	$1, %r12d
.L14:
	leal	9(%rax), %edx
	cmpl	%edx, %r10d
	jle	.L2
	movslq	%edx, %rdx
	cmpb	$49, -200064(%rbp,%rdx)
	je	.L79
.L15:
	leal	10(%rax), %edx
	cmpl	%edx, %r10d
	jle	.L2
	movslq	%edx, %rdx
	cmpb	$49, -200064(%rbp,%rdx)
	je	.L80
.L16:
	leal	11(%rax), %edx
	cmpl	%edx, %r10d
	jle	.L2
	movslq	%edx, %rdx
	cmpb	$49, -200064(%rbp,%rdx)
	je	.L81
.L17:
	leal	12(%rax), %edx
	cmpl	%edx, %r10d
	jle	.L2
	movslq	%edx, %rdx
	cmpb	$49, -200064(%rbp,%rdx)
	je	.L82
.L18:
	leal	13(%rax), %edx
	cmpl	%edx, %r10d
	jle	.L2
	movslq	%edx, %rdx
	cmpb	$49, -200064(%rbp,%rdx)
	jne	.L19
	addl	$1, %r12d
.L19:
	addl	$14, %eax
	cmpl	%eax, %r10d
	jle	.L2
	cltq
	cmpb	$49, -200064(%rbp,%rax)
	jne	.L2
	addl	$1, %r12d
.L2:
	movl	$0, -1000080(%rbp)
	movl	$1, %esi
	leaq	-1000080(%rbp), %rdi
	.p2align 4,,10
	.p2align 3
.L24:
	movl	%esi, %eax
	movl	%esi, %ebx
	xorl	%ecx, %ecx
	.p2align 4,,10
	.p2align 3
.L23:
	movl	%ebx, %edx
	andl	$1, %edx
	cmpl	$1, %edx
	sbbl	$-1, %ecx
	sarl	%ebx
	jne	.L23
	cltd
	idivl	%ecx
	movslq	%edx, %rdx
	movl	-1000080(%rbp,%rdx,4), %eax
	addl	$1, %eax
	movl	%eax, (%rdi,%rsi,4)
	addq	$1, %rsi
	cmpq	$200001, %rsi
	jne	.L24
	leaq	15(,%r10,8), %rdx
	movq	%rsp, %rcx
	movq	%rdx, %rax
	andq	$-4096, %rdx
	subq	%rdx, %rcx
	andq	$-16, %rax
	cmpq	%rcx, %rsp
	je	.L26
.L83:
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	cmpq	%rcx, %rsp
	jne	.L83
.L26:
	andl	$4095, %eax
	subq	%rax, %rsp
	testq	%rax, %rax
	jne	.L84
.L27:
	movq	%rsp, %r15
	testl	%r9d, %r9d
	js	.L54
	movl	$0, -1000100(%rbp)
	movslq	%r9d, %rcx
	cmpl	$1, %r12d
	jg	.L29
	leal	1(%r12), %esi
	jmp	.L34
.L66:
	leal	1(%rcx), %eax
	cltq
	movl	(%r15,%rax,8), %eax
	addl	%eax, %eax
	cltd
	idivl	%esi
	xorl	%eax, %eax
	movl	%edx, (%r15,%rcx,8)
.L33:
	cmpb	$49, 0(%r13,%rcx)
	movl	%eax, 4(%r15,%rcx,8)
	jne	.L32
	movl	-1000100(%rbp), %eax
	addl	(%r15,%rcx,8), %eax
	cltd
	idivl	%esi
	movl	%edx, -1000100(%rbp)
.L32:
	subq	$1, %rcx
	testl	%ecx, %ecx
	js	.L28
.L34:
	cmpl	%ecx, %r9d
	jne	.L66
	movl	$1, (%r15,%rcx,8)
	movl	$1, %eax
	jmp	.L33
.L76:
	addl	$1, %r12d
	jmp	.L8
.L75:
	addl	$1, %r12d
	jmp	.L7
.L77:
	addl	$1, %r12d
	jmp	.L9
.L54:
	movl	$0, -1000100(%rbp)
.L28:
	movl	-1000084(%rbp), %eax
	testl	%eax, %eax
	jle	.L45
	cmpl	$1, %r12d
	je	.L55
.L50:
	leal	-1(%r12), %eax
	xorl	%ecx, %ecx
	leaq	.LC5(%rip), %r14
	movl	%eax, -1000104(%rbp)
	jmp	.L46
.L85:
	movl	-1000100(%rbp), %eax
	addl	(%r15,%rcx,8), %eax
	leal	1(%r12), %esi
	movq	%rcx, -1000112(%rbp)
	cltd
	idivl	%esi
.L73:
	movslq	%edx, %rdx
	movq	%r14, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	movl	-1000080(%rbp,%rdx,4), %edx
	addl	$1, %edx
	call	__printf_chk@PLT
	movq	-1000112(%rbp), %rcx
	addq	$1, %rcx
	cmpl	%ecx, -1000084(%rbp)
	jle	.L45
.L46:
	cmpb	$49, 0(%r13,%rcx)
	jne	.L85
	movl	%ebx, %eax
	subl	4(%r15,%rcx,8), %eax
	movq	%rcx, -1000112(%rbp)
	leal	-1(%r12,%rax), %eax
	cltd
	idivl	-1000104(%rbp)
	jmp	.L73
.L55:
	xorl	%ebx, %ebx
	leaq	.LC5(%rip), %r14
.L42:
	xorl	%edx, %edx
	cmpb	$49, 0(%r13,%rbx)
	je	.L71
	movl	-1000100(%rbp), %eax
	addl	(%r15,%rbx,8), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	andl	$1, %eax
	subl	%edx, %eax
	cltq
	movl	-1000080(%rbp,%rax,4), %edx
	addl	$1, %edx
.L71:
	movq	%r14, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	addq	$1, %rbx
	call	__printf_chk@PLT
	cmpl	%ebx, -1000084(%rbp)
	jg	.L42
.L45:
	movq	-56(%rbp), %rax
	subq	%fs:40, %rax
	jne	.L86
	leaq	-40(%rbp), %rsp
	xorl	%eax, %eax
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.cfi_remember_state
	.cfi_def_cfa 7, 8
	ret
.L29:
	.cfi_restore_state
	movq	.LC4(%rip), %xmm0
	leal	1(%r12), %edi
	leal	-1(%r12), %r14d
	jmp	.L39
.L37:
	subq	$1, %rcx
	testl	%ecx, %ecx
	js	.L87
.L39:
	movzbl	0(%r13,%rcx), %r8d
	cmpl	%ecx, %r9d
	je	.L88
	leal	1(%rcx), %esi
	movslq	%esi, %rsi
	movl	(%r15,%rsi,8), %eax
	addl	%eax, %eax
	cltd
	idivl	%edi
	movl	4(%r15,%rsi,8), %eax
	addl	%eax, %eax
	movl	%edx, %r11d
	cltd
	idivl	%r14d
	movd	%r11d, %xmm1
	movd	%edx, %xmm5
	movl	%edx, %esi
	punpckldq	%xmm5, %xmm1
	movq	%xmm1, (%r15,%rcx,8)
	cmpb	$49, %r8b
	jne	.L37
	movl	-1000100(%rbp), %eax
	addl	%r11d, %eax
	cltd
	idivl	%edi
	movl	%edx, -1000100(%rbp)
.L49:
	leal	(%rbx,%rsi), %eax
	cltd
	idivl	%r14d
	movl	%edx, %ebx
	jmp	.L37
.L88:
	movq	%xmm0, (%r15,%rcx,8)
	cmpb	$49, %r8b
	jne	.L37
	movl	-1000100(%rbp), %eax
	movl	$1, %esi
	addl	$1, %eax
	cltd
	idivl	%edi
	movl	%edx, -1000100(%rbp)
	jmp	.L49
.L87:
	cmpl	$0, -1000084(%rbp)
	jg	.L50
	jmp	.L45
.L84:
	orq	$0, -8(%rsp,%rax)
	jmp	.L27
.L78:
	addl	$1, %r12d
	jmp	.L10
.L82:
	addl	$1, %r12d
	jmp	.L18
.L81:
	addl	$1, %r12d
	jmp	.L17
.L80:
	addl	$1, %r12d
	jmp	.L16
.L79:
	addl	$1, %r12d
	jmp	.L15
.L52:
	xorl	%r12d, %r12d
	leal	-1(%r10), %r9d
	jmp	.L2
.L53:
	xorl	%eax, %eax
	xorl	%r12d, %r12d
	jmp	.L3
.L86:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC2:
	.byte	49
	.byte	49
	.byte	49
	.byte	49
	.byte	49
	.byte	49
	.byte	49
	.byte	49
	.byte	49
	.byte	49
	.byte	49
	.byte	49
	.byte	49
	.byte	49
	.byte	49
	.byte	49
	.align 16
.LC3:
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.section	.rodata.cst8,"aM",@progbits,8
	.align 8
.LC4:
	.long	1
	.long	1
	.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"
.LC1:
	.string	"%*c%s"
.LC5:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	leaq	-999424(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$648, %rsp
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	leaq	.LC0(%rip), %rdi
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	leaq	-1000084(%rbp), %rsi
	leaq	-200064(%rbp), %r13
	call	__isoc99_scanf@PLT
	movq	%r13, %rsi
	leaq	.LC1(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	-1000084(%rbp), %r10
	testl	%r10d, %r10d
	jle	.L52
	leal	-1(%r10), %r9d
	cmpl	$14, %r9d
	jbe	.L53
	movl	%r10d, %edx
	pxor	%xmm1, %xmm1
	pxor	%xmm5, %xmm5
	movq	%r13, %rax
	shrl	$4, %edx
	movdqa	.LC2(%rip), %xmm7
	movdqa	.LC3(%rip), %xmm6
	pxor	%xmm4, %xmm4
	subl	$1, %edx
	salq	$4, %rdx
	leaq	-200048(%rbp,%rdx), %rdx
.L4:
	movdqa	%xmm7, %xmm0
	movdqa	%xmm5, %xmm3
	addq	$16, %rax
	pcmpeqb	-16(%rax), %xmm0
	pand	%xmm6, %xmm0
	pcmpgtb	%xmm0, %xmm3
	movdqa	%xmm0, %xmm2
	punpcklbw	%xmm3, %xmm2
	punpckhbw	%xmm3, %xmm0
	movdqa	%xmm4, %xmm3
	pcmpgtw	%xmm2, %xmm3
	movdqa	%xmm2, %xmm8
	punpcklwd	%xmm3, %xmm8
	punpckhwd	%xmm3, %xmm2
	movdqa	%xmm0, %xmm3
	paddd	%xmm8, %xmm1
	paddd	%xmm2, %xmm1
	movdqa	%xmm4, %xmm2
	pcmpgtw	%xmm0, %xmm2
	punpcklwd	%xmm2, %xmm3
	punpckhwd	%xmm2, %xmm0
	paddd	%xmm3, %xmm1
	paddd	%xmm0, %xmm1
	cmpq	%rdx, %rax
	jne	.L4
	movdqa	%xmm1, %xmm0
	movl	%r10d, %eax
	psrldq	$8, %xmm0
	andl	$-16, %eax
	paddd	%xmm0, %xmm1
	movdqa	%xmm1, %xmm0
	psrldq	$4, %xmm0
	paddd	%xmm0, %xmm1
	movd	%xmm1, %r12d
	testb	$15, %r10b
	je	.L2
.L3:
	movslq	%eax, %rdx
	cmpb	$49, -200064(%rbp,%rdx)
	jne	.L6
	addl	$1, %r12d
.L6:
	leal	1(%rax), %edx
	cmpl	%r10d, %edx
	jge	.L2
	movslq	%edx, %rdx
	cmpb	$49, -200064(%rbp,%rdx)
	je	.L75
.L7:
	leal	2(%rax), %edx
	cmpl	%edx, %r10d
	jle	.L2
	movslq	%edx, %rdx
	cmpb	$49, -200064(%rbp,%rdx)
	je	.L76
.L8:
	leal	3(%rax), %edx
	cmpl	%edx, %r10d
	jle	.L2
	movslq	%edx, %rdx
	cmpb	$49, -200064(%rbp,%rdx)
	je	.L77
.L9:
	leal	4(%rax), %edx
	cmpl	%edx, %r10d
	jle	.L2
	movslq	%edx, %rdx
	cmpb	$49, -200064(%rbp,%rdx)
	je	.L78
.L10:
	leal	5(%rax), %edx
	cmpl	%r10d, %edx
	jge	.L2
	movslq	%edx, %rdx
	cmpb	$49, -200064(%rbp,%rdx)
	jne	.L11
	addl	$1, %r12d
.L11:
	leal	6(%rax), %edx
	cmpl	%edx, %r10d
	jle	.L2
	movslq	%edx, %rdx
	cmpb	$49, -200064(%rbp,%rdx)
	jne	.L12
	addl	$1, %r12d
.L12:
	leal	7(%rax), %edx
	cmpl	%r10d, %edx
	jge	.L2
	movslq	%edx, %rdx
	cmpb	$49, -200064(%rbp,%rdx)
	jne	.L13
	addl	$1, %r12d
.L13:
	leal	8(%rax), %edx
	cmpl	%edx, %r10d
	jle	.L2
	movslq	%edx, %rdx
	cmpb	$49, -200064(%rbp,%rdx)
	jne	.L14
	addl	$1, %r12d
.L14:
	leal	9(%rax), %edx
	cmpl	%edx, %r10d
	jle	.L2
	movslq	%edx, %rdx
	cmpb	$49, -200064(%rbp,%rdx)
	je	.L79
.L15:
	leal	10(%rax), %edx
	cmpl	%edx, %r10d
	jle	.L2
	movslq	%edx, %rdx
	cmpb	$49, -200064(%rbp,%rdx)
	je	.L80
.L16:
	leal	11(%rax), %edx
	cmpl	%edx, %r10d
	jle	.L2
	movslq	%edx, %rdx
	cmpb	$49, -200064(%rbp,%rdx)
	je	.L81
.L17:
	leal	12(%rax), %edx
	cmpl	%edx, %r10d
	jle	.L2
	movslq	%edx, %rdx
	cmpb	$49, -200064(%rbp,%rdx)
	je	.L82
.L18:
	leal	13(%rax), %edx
	cmpl	%edx, %r10d
	jle	.L2
	movslq	%edx, %rdx
	cmpb	$49, -200064(%rbp,%rdx)
	jne	.L19
	addl	$1, %r12d
.L19:
	addl	$14, %eax
	cmpl	%eax, %r10d
	jle	.L2
	cltq
	cmpb	$49, -200064(%rbp,%rax)
	jne	.L2
	addl	$1, %r12d
.L2:
	movl	$0, -1000080(%rbp)
	movl	$1, %esi
	leaq	-1000080(%rbp), %rdi
	.p2align 4,,10
	.p2align 3
.L24:
	movl	%esi, %eax
	movl	%esi, %ebx
	xorl	%ecx, %ecx
	.p2align 4,,10
	.p2align 3
.L23:
	movl	%ebx, %edx
	andl	$1, %edx
	cmpl	$1, %edx
	sbbl	$-1, %ecx
	sarl	%ebx
	jne	.L23
	cltd
	idivl	%ecx
	movslq	%edx, %rdx
	movl	-1000080(%rbp,%rdx,4), %eax
	addl	$1, %eax
	movl	%eax, (%rdi,%rsi,4)
	addq	$1, %rsi
	cmpq	$200001, %rsi
	jne	.L24
	leaq	15(,%r10,8), %rdx
	movq	%rsp, %rcx
	movq	%rdx, %rax
	andq	$-4096, %rdx
	subq	%rdx, %rcx
	andq	$-16, %rax
	cmpq	%rcx, %rsp
	je	.L26
.L83:
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	cmpq	%rcx, %rsp
	jne	.L83
.L26:
	andl	$4095, %eax
	subq	%rax, %rsp
	testq	%rax, %rax
	jne	.L84
.L27:
	movq	%rsp, %r15
	testl	%r9d, %r9d
	js	.L54
	movl	$0, -1000100(%rbp)
	movslq	%r9d, %rcx
	cmpl	$1, %r12d
	jg	.L29
	leal	1(%r12), %esi
	jmp	.L34
.L66:
	leal	1(%rcx), %eax
	cltq
	movl	(%r15,%rax,8), %eax
	addl	%eax, %eax
	cltd
	idivl	%esi
	xorl	%eax, %eax
	movl	%edx, (%r15,%rcx,8)
.L33:
	cmpb	$49, 0(%r13,%rcx)
	movl	%eax, 4(%r15,%rcx,8)
	jne	.L32
	movl	-1000100(%rbp), %eax
	addl	(%r15,%rcx,8), %eax
	cltd
	idivl	%esi
	movl	%edx, -1000100(%rbp)
.L32:
	subq	$1, %rcx
	testl	%ecx, %ecx
	js	.L28
.L34:
	cmpl	%ecx, %r9d
	jne	.L66
	movl	$1, (%r15,%rcx,8)
	movl	$1, %eax
	jmp	.L33
.L76:
	addl	$1, %r12d
	jmp	.L8
.L75:
	addl	$1, %r12d
	jmp	.L7
.L77:
	addl	$1, %r12d
	jmp	.L9
.L54:
	movl	$0, -1000100(%rbp)
.L28:
	movl	-1000084(%rbp), %eax
	testl	%eax, %eax
	jle	.L45
	cmpl	$1, %r12d
	je	.L55
.L50:
	leal	-1(%r12), %eax
	xorl	%ecx, %ecx
	leaq	.LC5(%rip), %r14
	movl	%eax, -1000104(%rbp)
	jmp	.L46
.L85:
	movl	-1000100(%rbp), %eax
	addl	(%r15,%rcx,8), %eax
	leal	1(%r12), %esi
	movq	%rcx, -1000112(%rbp)
	cltd
	idivl	%esi
.L73:
	movslq	%edx, %rdx
	movq	%r14, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	movl	-1000080(%rbp,%rdx,4), %edx
	addl	$1, %edx
	call	__printf_chk@PLT
	movq	-1000112(%rbp), %rcx
	addq	$1, %rcx
	cmpl	%ecx, -1000084(%rbp)
	jle	.L45
.L46:
	cmpb	$49, 0(%r13,%rcx)
	jne	.L85
	movl	%ebx, %eax
	subl	4(%r15,%rcx,8), %eax
	movq	%rcx, -1000112(%rbp)
	leal	-1(%r12,%rax), %eax
	cltd
	idivl	-1000104(%rbp)
	jmp	.L73
.L55:
	xorl	%ebx, %ebx
	leaq	.LC5(%rip), %r14
.L42:
	xorl	%edx, %edx
	cmpb	$49, 0(%r13,%rbx)
	je	.L71
	movl	-1000100(%rbp), %eax
	addl	(%r15,%rbx,8), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	andl	$1, %eax
	subl	%edx, %eax
	cltq
	movl	-1000080(%rbp,%rax,4), %edx
	addl	$1, %edx
.L71:
	movq	%r14, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	addq	$1, %rbx
	call	__printf_chk@PLT
	cmpl	%ebx, -1000084(%rbp)
	jg	.L42
.L45:
	movq	-56(%rbp), %rax
	subq	%fs:40, %rax
	jne	.L86
	leaq	-40(%rbp), %rsp
	xorl	%eax, %eax
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.cfi_remember_state
	.cfi_def_cfa 7, 8
	ret
.L29:
	.cfi_restore_state
	movq	.LC4(%rip), %xmm0
	leal	1(%r12), %edi
	leal	-1(%r12), %r14d
	jmp	.L39
.L37:
	subq	$1, %rcx
	testl	%ecx, %ecx
	js	.L87
.L39:
	movzbl	0(%r13,%rcx), %r8d
	cmpl	%ecx, %r9d
	je	.L88
	leal	1(%rcx), %esi
	movslq	%esi, %rsi
	movl	(%r15,%rsi,8), %eax
	addl	%eax, %eax
	cltd
	idivl	%edi
	movl	4(%r15,%rsi,8), %eax
	addl	%eax, %eax
	movl	%edx, %r11d
	cltd
	idivl	%r14d
	movd	%r11d, %xmm1
	movd	%edx, %xmm5
	movl	%edx, %esi
	punpckldq	%xmm5, %xmm1
	movq	%xmm1, (%r15,%rcx,8)
	cmpb	$49, %r8b
	jne	.L37
	movl	-1000100(%rbp), %eax
	addl	%r11d, %eax
	cltd
	idivl	%edi
	movl	%edx, -1000100(%rbp)
.L49:
	leal	(%rbx,%rsi), %eax
	cltd
	idivl	%r14d
	movl	%edx, %ebx
	jmp	.L37
.L88:
	movq	%xmm0, (%r15,%rcx,8)
	cmpb	$49, %r8b
	jne	.L37
	movl	-1000100(%rbp), %eax
	movl	$1, %esi
	addl	$1, %eax
	cltd
	idivl	%edi
	movl	%edx, -1000100(%rbp)
	jmp	.L49
.L87:
	cmpl	$0, -1000084(%rbp)
	jg	.L50
	jmp	.L45
.L84:
	orq	$0, -8(%rsp,%rax)
	jmp	.L27
.L78:
	addl	$1, %r12d
	jmp	.L10
.L82:
	addl	$1, %r12d
	jmp	.L18
.L81:
	addl	$1, %r12d
	jmp	.L17
.L80:
	addl	$1, %r12d
	jmp	.L16
.L79:
	addl	$1, %r12d
	jmp	.L15
.L52:
	xorl	%r12d, %r12d
	leal	-1(%r10), %r9d
	jmp	.L2
.L53:
	xorl	%eax, %eax
	xorl	%r12d, %r12d
	jmp	.L3
.L86:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC2:
	.byte	49
	.byte	49
	.byte	49
	.byte	49
	.byte	49
	.byte	49
	.byte	49
	.byte	49
	.byte	49
	.byte	49
	.byte	49
	.byte	49
	.byte	49
	.byte	49
	.byte	49
	.byte	49
	.align 16
.LC3:
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.section	.rodata.cst8,"aM",@progbits,8
	.align 8
.LC4:
	.long	1
	.long	1
	.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(){
  int n,count=0,i;
  char x[200002];
  scanf("%d",&n);
  scanf("%*c%s",x);
  for(i=0;i<n;i++){
    if(x[i]=='1')
      count++;
  }
  int popcount[200002];
  popcount[0]=0;
  for(i=1;i<200001;i++){
    int temp=i,check=0;
    while(temp!=0){
      if(temp%2==1)
        check++;
      temp/=2;
    }
    popcount[i]=popcount[i%check]+1;
  }
  int mod[n][2];
  int num[2]={0,0};
  for(i=n-1;i>=0;i--){
    if(i==n-1){
      mod[n-1][0]=1;
      mod[n-1][1]=1;
    }
    else{
      mod[i][0]=(2*mod[i+1][0])%(count+1);
      if(count>1)
        mod[i][1]=(2*mod[i+1][1])%(count-1);
      else
        mod[i][1]=0;
    }
    if(x[i]=='1'){
      num[0]=(num[0]+mod[i][0])%(count+1);
      if(count>1)
        num[1]=(num[1]+mod[i][1])%(count-1);
    }
  }
  for(i=0;i<n;i++){
    int ans;
    if(x[i]=='1' && count-1==0)
      ans=0;
    else if(x[i]=='1')
      ans=popcount[(num[1]-mod[i][1]+count-1)%(count-1)]+1;
    else
      ans=popcount[(num[0]+mod[i][0])%(count+1)]+1;
    printf("%d\n",ans);
  }
  return 0;
}
23
00110111001011011001111
 3
111
 23
00110111001011011101111
 3
110
 23
00110111001011011101101
 3
101
 23
00110111001011011001101
 3
100
 23
01110111001011011101101
 3
001

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

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(){
  int n,count=0,i;
  char x[200002];
  scanf("%d",&n);
  scanf("%*c%s",x);
  for(i=0;i<n;i++){
    if(x[i]=='1')
      count++;
  }
  int popcount[200002];
  popcount[0]=0;
  for(i=1;i<200001;i++){
    int temp=i,check=0;
    while(temp!=0){
      if(temp%2==1)
        check++;
      temp/=2;
    }
    popcount[i]=popcount[i%check]+1;
  }
  int mod[n][2];
  int num[2]={0,0};
  for(i=n-1;i>=0;i--){
    if(i==n-1){
      mod[n-1][0]=1;
      mod[n-1][1]=1;
    }
    else{
      mod[i][0]=(2*mod[i+1][0])%(count+1);
      if(count>1)
        mod[i][1]=(2*mod[i+1][1])%(count-1);
      else
        mod[i][1]=0;
    }
    if(x[i]=='1'){
      num[0]=(num[0]+mod[i][0])%(count+1);
      if(count>1)
        num[1]=(num[1]+mod[i][1])%(count-1);
    }
  }
  for(i=0;i<n;i++){
    int ans;
    if(x[i]=='1' && count-1==0)
      ans=0;
    else if(x[i]=='1')
      ans=popcount[(num[1]-mod[i][1]+count-1)%(count-1)]+1;
    else
      ans=popcount[(num[0]+mod[i][0])%(count+1)]+1;
    printf("%d\n",ans);
  }
  return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%*c%s"
.LC2:
	.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
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	leaq	-999424(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$664, %rsp
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	movq	%rsp, %rax
	movq	%rax, %rbx
	movl	$0, -1000124(%rbp)
	leaq	-1000128(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-200064(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -1000120(%rbp)
	jmp	.L2
.L4:
	movl	-1000120(%rbp), %eax
	cltq
	movzbl	-200064(%rbp,%rax), %eax
	cmpb	$49, %al
	jne	.L3
	addl	$1, -1000124(%rbp)
.L3:
	addl	$1, -1000120(%rbp)
.L2:
	movl	-1000128(%rbp), %eax
	cmpl	%eax, -1000120(%rbp)
	jl	.L4
	movl	$0, -1000080(%rbp)
	movl	$1, -1000120(%rbp)
	jmp	.L5
.L9:
	movl	-1000120(%rbp), %eax
	movl	%eax, -1000116(%rbp)
	movl	$0, -1000112(%rbp)
	jmp	.L6
.L8:
	movl	-1000116(%rbp), %eax
	cltd
	shrl	$31, %edx
	addl	%edx, %eax
	andl	$1, %eax
	subl	%edx, %eax
	cmpl	$1, %eax
	jne	.L7
	addl	$1, -1000112(%rbp)
.L7:
	movl	-1000116(%rbp), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, -1000116(%rbp)
.L6:
	cmpl	$0, -1000116(%rbp)
	jne	.L8
	movl	-1000120(%rbp), %eax
	cltd
	idivl	-1000112(%rbp)
	movl	%edx, %eax
	cltq
	movl	-1000080(%rbp,%rax,4), %eax
	leal	1(%rax), %edx
	movl	-1000120(%rbp), %eax
	cltq
	movl	%edx, -1000080(%rbp,%rax,4)
	addl	$1, -1000120(%rbp)
.L5:
	cmpl	$200000, -1000120(%rbp)
	jle	.L9
	movl	-1000128(%rbp), %eax
	movslq	%eax, %rdx
	subq	$1, %rdx
	movq	%rdx, -1000104(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, %r14
	movl	$0, %r15d
	movslq	%eax, %rdx
	movq	%rdx, %r12
	movl	$0, %r13d
	cltq
	leaq	0(,%rax,8), %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %esi
	movl	$0, %edx
	divq	%rsi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L10:
	cmpq	%rdx, %rsp
	je	.L11
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L10
.L11:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L12
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L12:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -1000096(%rbp)
	movl	$0, -1000088(%rbp)
	movl	$0, -1000084(%rbp)
	movl	-1000128(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -1000120(%rbp)
	jmp	.L13
.L18:
	movl	-1000128(%rbp), %eax
	subl	$1, %eax
	cmpl	%eax, -1000120(%rbp)
	jne	.L14
	movl	-1000128(%rbp), %eax
	leal	-1(%rax), %edx
	movq	-1000096(%rbp), %rax
	movslq	%edx, %rdx
	movl	$1, (%rax,%rdx,8)
	movl	-1000128(%rbp), %eax
	leal	-1(%rax), %edx
	movq	-1000096(%rbp), %rax
	movslq	%edx, %rdx
	movl	$1, 4(%rax,%rdx,8)
	jmp	.L15
.L14:
	movl	-1000120(%rbp), %eax
	leal	1(%rax), %edx
	movq	-1000096(%rbp), %rax
	movslq	%edx, %rdx
	movl	(%rax,%rdx,8), %eax
	addl	%eax, %eax
	movl	-1000124(%rbp), %edx
	leal	1(%rdx), %ecx
	cltd
	idivl	%ecx
	movl	%edx, %ecx
	movq	-1000096(%rbp), %rax
	movl	-1000120(%rbp), %edx
	movslq	%edx, %rdx
	movl	%ecx, (%rax,%rdx,8)
	cmpl	$1, -1000124(%rbp)
	jle	.L16
	movl	-1000120(%rbp), %eax
	leal	1(%rax), %edx
	movq	-1000096(%rbp), %rax
	movslq	%edx, %rdx
	movl	4(%rax,%rdx,8), %eax
	addl	%eax, %eax
	movl	-1000124(%rbp), %edx
	leal	-1(%rdx), %ecx
	cltd
	idivl	%ecx
	movl	%edx, %ecx
	movq	-1000096(%rbp), %rax
	movl	-1000120(%rbp), %edx
	movslq	%edx, %rdx
	movl	%ecx, 4(%rax,%rdx,8)
	jmp	.L15
.L16:
	movq	-1000096(%rbp), %rax
	movl	-1000120(%rbp), %edx
	movslq	%edx, %rdx
	movl	$0, 4(%rax,%rdx,8)
.L15:
	movl	-1000120(%rbp), %eax
	cltq
	movzbl	-200064(%rbp,%rax), %eax
	cmpb	$49, %al
	jne	.L17
	movl	-1000088(%rbp), %ecx
	movq	-1000096(%rbp), %rax
	movl	-1000120(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,8), %eax
	addl	%ecx, %eax
	movl	-1000124(%rbp), %edx
	leal	1(%rdx), %ecx
	cltd
	idivl	%ecx
	movl	%edx, %eax
	movl	%eax, -1000088(%rbp)
	cmpl	$1, -1000124(%rbp)
	jle	.L17
	movl	-1000084(%rbp), %ecx
	movq	-1000096(%rbp), %rax
	movl	-1000120(%rbp), %edx
	movslq	%edx, %rdx
	movl	4(%rax,%rdx,8), %eax
	addl	%ecx, %eax
	movl	-1000124(%rbp), %edx
	leal	-1(%rdx), %ecx
	cltd
	idivl	%ecx
	movl	%edx, %eax
	movl	%eax, -1000084(%rbp)
.L17:
	subl	$1, -1000120(%rbp)
.L13:
	cmpl	$0, -1000120(%rbp)
	jns	.L18
	movl	$0, -1000120(%rbp)
	jmp	.L19
.L23:
	movl	-1000120(%rbp), %eax
	cltq
	movzbl	-200064(%rbp,%rax), %eax
	cmpb	$49, %al
	jne	.L20
	cmpl	$1, -1000124(%rbp)
	jne	.L20
	movl	$0, -1000108(%rbp)
	jmp	.L21
.L20:
	movl	-1000120(%rbp), %eax
	cltq
	movzbl	-200064(%rbp,%rax), %eax
	cmpb	$49, %al
	jne	.L22
	movl	-1000084(%rbp), %ecx
	movq	-1000096(%rbp), %rax
	movl	-1000120(%rbp), %edx
	movslq	%edx, %rdx
	movl	4(%rax,%rdx,8), %eax
	subl	%eax, %ecx
	movl	%ecx, %edx
	movl	-1000124(%rbp), %eax
	addl	%edx, %eax
	subl	$1, %eax
	movl	-1000124(%rbp), %edx
	leal	-1(%rdx), %ecx
	cltd
	idivl	%ecx
	movl	%edx, %eax
	cltq
	movl	-1000080(%rbp,%rax,4), %eax
	addl	$1, %eax
	movl	%eax, -1000108(%rbp)
	jmp	.L21
.L22:
	movl	-1000088(%rbp), %ecx
	movq	-1000096(%rbp), %rax
	movl	-1000120(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,8), %eax
	addl	%ecx, %eax
	movl	-1000124(%rbp), %edx
	leal	1(%rdx), %ecx
	cltd
	idivl	%ecx
	movl	%edx, %eax
	cltq
	movl	-1000080(%rbp,%rax,4), %eax
	addl	$1, %eax
	movl	%eax, -1000108(%rbp)
.L21:
	movl	-1000108(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -1000120(%rbp)
.L19:
	movl	-1000128(%rbp), %eax
	cmpl	%eax, -1000120(%rbp)
	jl	.L23
	movl	$0, %eax
	movq	%rbx, %rsp
	movq	-56(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L25
	call	__stack_chk_fail@PLT
.L25:
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.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"
.LC1:
	.string	"%*c%s"
.LC2:
	.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
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	leaq	-999424(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$664, %rsp
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	movq	%rsp, %rax
	movq	%rax, %rbx
	movl	$0, -1000124(%rbp)
	leaq	-1000128(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-200064(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -1000120(%rbp)
	jmp	.L2
.L4:
	movl	-1000120(%rbp), %eax
	cltq
	movzbl	-200064(%rbp,%rax), %eax
	cmpb	$49, %al
	jne	.L3
	addl	$1, -1000124(%rbp)
.L3:
	addl	$1, -1000120(%rbp)
.L2:
	movl	-1000128(%rbp), %eax
	cmpl	%eax, -1000120(%rbp)
	jl	.L4
	movl	$0, -1000080(%rbp)
	movl	$1, -1000120(%rbp)
	jmp	.L5
.L9:
	movl	-1000120(%rbp), %eax
	movl	%eax, -1000116(%rbp)
	movl	$0, -1000112(%rbp)
	jmp	.L6
.L8:
	movl	-1000116(%rbp), %eax
	cltd
	shrl	$31, %edx
	addl	%edx, %eax
	andl	$1, %eax
	subl	%edx, %eax
	cmpl	$1, %eax
	jne	.L7
	addl	$1, -1000112(%rbp)
.L7:
	movl	-1000116(%rbp), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, -1000116(%rbp)
.L6:
	cmpl	$0, -1000116(%rbp)
	jne	.L8
	movl	-1000120(%rbp), %eax
	cltd
	idivl	-1000112(%rbp)
	movl	%edx, %eax
	cltq
	movl	-1000080(%rbp,%rax,4), %eax
	leal	1(%rax), %edx
	movl	-1000120(%rbp), %eax
	cltq
	movl	%edx, -1000080(%rbp,%rax,4)
	addl	$1, -1000120(%rbp)
.L5:
	cmpl	$200000, -1000120(%rbp)
	jle	.L9
	movl	-1000128(%rbp), %eax
	movslq	%eax, %rdx
	subq	$1, %rdx
	movq	%rdx, -1000104(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, %r14
	movl	$0, %r15d
	movslq	%eax, %rdx
	movq	%rdx, %r12
	movl	$0, %r13d
	cltq
	leaq	0(,%rax,8), %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %esi
	movl	$0, %edx
	divq	%rsi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L10:
	cmpq	%rdx, %rsp
	je	.L11
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L10
.L11:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L12
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L12:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -1000096(%rbp)
	movl	$0, -1000088(%rbp)
	movl	$0, -1000084(%rbp)
	movl	-1000128(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -1000120(%rbp)
	jmp	.L13
.L18:
	movl	-1000128(%rbp), %eax
	subl	$1, %eax
	cmpl	%eax, -1000120(%rbp)
	jne	.L14
	movl	-1000128(%rbp), %eax
	leal	-1(%rax), %edx
	movq	-1000096(%rbp), %rax
	movslq	%edx, %rdx
	movl	$1, (%rax,%rdx,8)
	movl	-1000128(%rbp), %eax
	leal	-1(%rax), %edx
	movq	-1000096(%rbp), %rax
	movslq	%edx, %rdx
	movl	$1, 4(%rax,%rdx,8)
	jmp	.L15
.L14:
	movl	-1000120(%rbp), %eax
	leal	1(%rax), %edx
	movq	-1000096(%rbp), %rax
	movslq	%edx, %rdx
	movl	(%rax,%rdx,8), %eax
	addl	%eax, %eax
	movl	-1000124(%rbp), %edx
	leal	1(%rdx), %ecx
	cltd
	idivl	%ecx
	movl	%edx, %ecx
	movq	-1000096(%rbp), %rax
	movl	-1000120(%rbp), %edx
	movslq	%edx, %rdx
	movl	%ecx, (%rax,%rdx,8)
	cmpl	$1, -1000124(%rbp)
	jle	.L16
	movl	-1000120(%rbp), %eax
	leal	1(%rax), %edx
	movq	-1000096(%rbp), %rax
	movslq	%edx, %rdx
	movl	4(%rax,%rdx,8), %eax
	addl	%eax, %eax
	movl	-1000124(%rbp), %edx
	leal	-1(%rdx), %ecx
	cltd
	idivl	%ecx
	movl	%edx, %ecx
	movq	-1000096(%rbp), %rax
	movl	-1000120(%rbp), %edx
	movslq	%edx, %rdx
	movl	%ecx, 4(%rax,%rdx,8)
	jmp	.L15
.L16:
	movq	-1000096(%rbp), %rax
	movl	-1000120(%rbp), %edx
	movslq	%edx, %rdx
	movl	$0, 4(%rax,%rdx,8)
.L15:
	movl	-1000120(%rbp), %eax
	cltq
	movzbl	-200064(%rbp,%rax), %eax
	cmpb	$49, %al
	jne	.L17
	movl	-1000088(%rbp), %ecx
	movq	-1000096(%rbp), %rax
	movl	-1000120(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,8), %eax
	addl	%ecx, %eax
	movl	-1000124(%rbp), %edx
	leal	1(%rdx), %ecx
	cltd
	idivl	%ecx
	movl	%edx, %eax
	movl	%eax, -1000088(%rbp)
	cmpl	$1, -1000124(%rbp)
	jle	.L17
	movl	-1000084(%rbp), %ecx
	movq	-1000096(%rbp), %rax
	movl	-1000120(%rbp), %edx
	movslq	%edx, %rdx
	movl	4(%rax,%rdx,8), %eax
	addl	%ecx, %eax
	movl	-1000124(%rbp), %edx
	leal	-1(%rdx), %ecx
	cltd
	idivl	%ecx
	movl	%edx, %eax
	movl	%eax, -1000084(%rbp)
.L17:
	subl	$1, -1000120(%rbp)
.L13:
	cmpl	$0, -1000120(%rbp)
	jns	.L18
	movl	$0, -1000120(%rbp)
	jmp	.L19
.L23:
	movl	-1000120(%rbp), %eax
	cltq
	movzbl	-200064(%rbp,%rax), %eax
	cmpb	$49, %al
	jne	.L20
	cmpl	$1, -1000124(%rbp)
	jne	.L20
	movl	$0, -1000108(%rbp)
	jmp	.L21
.L20:
	movl	-1000120(%rbp), %eax
	cltq
	movzbl	-200064(%rbp,%rax), %eax
	cmpb	$49, %al
	jne	.L22
	movl	-1000084(%rbp), %ecx
	movq	-1000096(%rbp), %rax
	movl	-1000120(%rbp), %edx
	movslq	%edx, %rdx
	movl	4(%rax,%rdx,8), %eax
	subl	%eax, %ecx
	movl	%ecx, %edx
	movl	-1000124(%rbp), %eax
	addl	%edx, %eax
	subl	$1, %eax
	movl	-1000124(%rbp), %edx
	leal	-1(%rdx), %ecx
	cltd
	idivl	%ecx
	movl	%edx, %eax
	cltq
	movl	-1000080(%rbp,%rax,4), %eax
	addl	$1, %eax
	movl	%eax, -1000108(%rbp)
	jmp	.L21
.L22:
	movl	-1000088(%rbp), %ecx
	movq	-1000096(%rbp), %rax
	movl	-1000120(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,8), %eax
	addl	%ecx, %eax
	movl	-1000124(%rbp), %edx
	leal	1(%rdx), %ecx
	cltd
	idivl	%ecx
	movl	%edx, %eax
	cltq
	movl	-1000080(%rbp,%rax,4), %eax
	addl	$1, %eax
	movl	%eax, -1000108(%rbp)
.L21:
	movl	-1000108(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -1000120(%rbp)
.L19:
	movl	-1000128(%rbp), %eax
	cmpl	%eax, -1000120(%rbp)
	jl	.L23
	movl	$0, %eax
	movq	%rbx, %rsp
	movq	-56(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L25
	call	__stack_chk_fail@PLT
.L25:
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.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:
