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

```c
// AOJ 0301: Baton Relay Game
// 2017.10.31

#include <stdio.h>

typedef struct { int pre, nxt; char f; } T;
T s[200002];
int n, m;
int a[200002];

void calc()
{
	int i, j, aa, cur = 0;
	
	for (i = 0; i < m; i++) {
		aa = a[i];
		if (aa & 1) for (j = 0; j < aa; j++) cur = s[cur].pre;
		else       for (j = 0; j < aa; j++) cur = s[cur].nxt;
		s[cur].f = 0;
		s[s[cur].pre].nxt = s[cur].nxt;
		s[s[cur].nxt].pre = s[cur].pre;
		cur = s[cur].nxt;
	}
}

int main()
{
	int q, i;

	scanf("%d%d%d", &n, &m, &q);
	for (i = 0; i < n; i++) s[i].f = 1, s[i].nxt = i+1, s[i].pre = i-1;
	s[0].pre = n-1, s[n-1].nxt = 0;
	for (i = 0; i < m; i++) scanf("%d", a+i);
	calc();
	while (q-- > 0) {
		scanf("%d", &i);
		printf("%d\n", s[i].f);
	}
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	s
	.bss
	.align 32
	.type	s, @object
	.size	s, 2400024
s:
	.zero	2400024
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	m
	.align 4
	.type	m, @object
	.size	m, 4
m:
	.zero	4
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 800008
a:
	.zero	800008
	.text
	.globl	calc
	.type	calc, @function
calc:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	$0, -8(%rbp)
	movl	$0, -16(%rbp)
	jmp	.L2
.L9:
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -4(%rbp)
	movl	-4(%rbp), %eax
	andl	$1, %eax
	testl	%eax, %eax
	je	.L3
	movl	$0, -12(%rbp)
	jmp	.L4
.L5:
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	leaq	s(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -8(%rbp)
	addl	$1, -12(%rbp)
.L4:
	movl	-12(%rbp), %eax
	cmpl	-4(%rbp), %eax
	jl	.L5
	jmp	.L6
.L3:
	movl	$0, -12(%rbp)
	jmp	.L7
.L8:
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	leaq	4+s(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -8(%rbp)
	addl	$1, -12(%rbp)
.L7:
	movl	-12(%rbp), %eax
	cmpl	-4(%rbp), %eax
	jl	.L8
.L6:
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	leaq	8+s(%rip), %rax
	movb	$0, (%rdx,%rax)
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	leaq	s(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	leaq	4+s(%rip), %rax
	movl	(%rdx,%rax), %edx
	movslq	%ecx, %rcx
	movq	%rcx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	salq	$2, %rax
	movq	%rax, %rcx
	leaq	4+s(%rip), %rax
	movl	%edx, (%rcx,%rax)
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	leaq	4+s(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	leaq	s(%rip), %rax
	movl	(%rdx,%rax), %edx
	movslq	%ecx, %rcx
	movq	%rcx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	salq	$2, %rax
	movq	%rax, %rcx
	leaq	s(%rip), %rax
	movl	%edx, (%rcx,%rax)
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	leaq	4+s(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -8(%rbp)
	addl	$1, -16(%rbp)
.L2:
	movl	m(%rip), %eax
	cmpl	%eax, -16(%rbp)
	jl	.L9
	nop
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	calc, .-calc
	.section	.rodata
.LC0:
	.string	"%d%d%d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-16(%rbp), %rax
	movq	%rax, %rcx
	leaq	m(%rip), %rax
	movq	%rax, %rdx
	leaq	n(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -12(%rbp)
	jmp	.L11
.L12:
	movl	-12(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	leaq	8+s(%rip), %rax
	movb	$1, (%rdx,%rax)
	movl	-12(%rbp), %edx
	movl	-12(%rbp), %eax
	leal	1(%rdx), %ecx
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	leaq	4+s(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	-12(%rbp), %edx
	movl	-12(%rbp), %eax
	leal	-1(%rdx), %ecx
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	leaq	s(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	-12(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -12(%rbp)
.L11:
	movl	-12(%rbp), %edx
	movl	n(%rip), %eax
	cmpl	%eax, %edx
	jl	.L12
	movl	n(%rip), %eax
	subl	$1, %eax
	movl	%eax, s(%rip)
	movl	n(%rip), %eax
	subl	$1, %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	leaq	4+s(%rip), %rax
	movl	$0, (%rdx,%rax)
	movl	$0, -12(%rbp)
	jmp	.L13
.L14:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-12(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -12(%rbp)
.L13:
	movl	-12(%rbp), %edx
	movl	m(%rip), %eax
	cmpl	%eax, %edx
	jl	.L14
	movl	$0, %eax
	call	calc
	jmp	.L15
.L16:
	leaq	-12(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-12(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	leaq	8+s(%rip), %rax
	movzbl	(%rdx,%rax), %eax
	movsbl	%al, %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L15:
	movl	-16(%rbp), %eax
	leal	-1(%rax), %edx
	movl	%edx, -16(%rbp)
	testl	%eax, %eax
	jg	.L16
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L18
	call	__stack_chk_fail@PLT
.L18:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```

Only output the optimized assembly code. Do not include any other text. Do not write any comments in the assembly code. Wrap the assembly code in ```assembly``` tags.
user
	.file	"temp.c"
	.text
	.p2align 4
	.globl	calc
	.type	calc, @function
calc:
.LFB23:
	.cfi_startproc
	endbr64
	movl	m(%rip), %eax
	testl	%eax, %eax
	jle	.L1
	leaq	a(%rip), %rdi
	leal	-1(%rax), %edx
	leaq	4(%rdi), %rax
	leaq	s(%rip), %rsi
	leaq	(%rax,%rdx,4), %r8
	xorl	%eax, %eax
	.p2align 4,,10
	.p2align 3
.L7:
	movl	(%rdi), %ecx
	movl	%ecx, %edx
	andl	$1, %edx
	jne	.L3
	testl	%ecx, %ecx
	jle	.L5
	.p2align 4,,10
	.p2align 3
.L4:
	leaq	(%rax,%rax,2), %rax
	addl	$1, %edx
	movslq	4(%rsi,%rax,4), %rax
	cmpl	%edx, %ecx
	jne	.L4
.L5:
	leaq	(%rax,%rax,2), %rax
	addq	$4, %rdi
	leaq	(%rsi,%rax,4), %rax
	movslq	(%rax), %rcx
	movl	4(%rax), %r9d
	movb	$0, 8(%rax)
	movq	%rcx, %rdx
	leaq	(%rcx,%rcx,2), %rcx
	movl	%r9d, 4(%rsi,%rcx,4)
	movslq	4(%rax), %rax
	leaq	(%rax,%rax,2), %rcx
	movl	%edx, (%rsi,%rcx,4)
	cmpq	%r8, %rdi
	jne	.L7
.L1:
	ret
	.p2align 4,,10
	.p2align 3
.L3:
	testl	%ecx, %ecx
	jle	.L5
	xorl	%edx, %edx
	.p2align 4,,10
	.p2align 3
.L6:
	leaq	(%rax,%rax,2), %rax
	addl	$1, %edx
	movslq	(%rsi,%rax,4), %rax
	cmpl	%edx, %ecx
	jne	.L6
	jmp	.L5
	.cfi_endproc
.LFE23:
	.size	calc, .-calc
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC1:
	.string	"%d%d%d"
.LC11:
	.string	"%d"
.LC12:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB24:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	leaq	m(%rip), %rdx
	leaq	n(%rip), %rsi
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	leaq	.LC1(%rip), %rdi
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	leaq	s(%rip), %rbx
	subq	$24, %rsp
	.cfi_def_cfa_offset 64
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rcx
	call	__isoc99_scanf@PLT
	movl	n(%rip), %edx
	leal	-1(%rdx), %esi
	testl	%edx, %edx
	jle	.L14
	cmpl	$14, %esi
	jbe	.L23
	movl	%edx, %ecx
	leaq	s(%rip), %rbx
	movdqa	.LC0(%rip), %xmm1
	movdqa	.LC2(%rip), %xmm15
	shrl	$4, %ecx
	leaq	192(%rbx), %rdi
	movq	%rbx, %rax
	movdqa	.LC3(%rip), %xmm14
	movdqa	.LC4(%rip), %xmm13
	subl	$1, %ecx
	movdqa	.LC5(%rip), %xmm12
	movdqa	.LC6(%rip), %xmm11
	leaq	(%rcx,%rcx,2), %rcx
	movdqa	.LC7(%rip), %xmm10
	movdqa	.LC8(%rip), %xmm9
	salq	$6, %rcx
	addq	%rdi, %rcx
	.p2align 4,,10
	.p2align 3
.L16:
	movdqa	.LC9(%rip), %xmm2
	movdqa	%xmm1, %xmm0
	movb	$1, 8(%rax)
	addq	$192, %rax
	movdqa	%xmm0, %xmm7
	movdqa	%xmm0, %xmm6
	movdqa	%xmm0, %xmm5
	movb	$1, -124(%rax)
	paddd	%xmm0, %xmm2
	movdqa	%xmm0, %xmm4
	movdqa	%xmm0, %xmm3
	movb	$1, -112(%rax)
	movdqa	%xmm0, %xmm8
	paddd	%xmm13, %xmm7
	paddd	%xmm12, %xmm6
	movb	$1, -172(%rax)
	paddd	%xmm14, %xmm8
	paddd	%xmm11, %xmm5
	movb	$1, -100(%rax)
	paddd	%xmm10, %xmm4
	paddd	%xmm9, %xmm3
	movb	$1, -160(%rax)
	paddd	.LC10(%rip), %xmm0
	movb	$1, -148(%rax)
	paddd	%xmm15, %xmm1
	movb	$1, -136(%rax)
	movb	$1, -88(%rax)
	movb	$1, -76(%rax)
	movb	$1, -64(%rax)
	movb	$1, -52(%rax)
	movb	$1, -40(%rax)
	movb	$1, -28(%rax)
	movb	$1, -16(%rax)
	movb	$1, -4(%rax)
	movq	%xmm8, -192(%rax)
	movhps	%xmm8, -180(%rax)
	movq	%xmm7, -168(%rax)
	movhps	%xmm7, -156(%rax)
	movq	%xmm6, -144(%rax)
	movhps	%xmm6, -132(%rax)
	movq	%xmm5, -120(%rax)
	movhps	%xmm5, -108(%rax)
	movq	%xmm4, -96(%rax)
	movhps	%xmm4, -84(%rax)
	movq	%xmm3, -72(%rax)
	movhps	%xmm3, -60(%rax)
	movq	%xmm2, -48(%rax)
	movhps	%xmm2, -36(%rax)
	movq	%xmm0, -24(%rax)
	movhps	%xmm0, -12(%rax)
	cmpq	%rcx, %rax
	jne	.L16
	movl	%edx, %eax
	andl	$-16, %eax
	testb	$15, %dl
	je	.L14
.L15:
	movslq	%eax, %rcx
	leal	1(%rax), %edi
	leal	-1(%rax), %r8d
	leaq	(%rcx,%rcx,2), %rcx
	leaq	(%rbx,%rcx,4), %rcx
	movb	$1, 8(%rcx)
	movl	%edi, 4(%rcx)
	movl	%r8d, (%rcx)
	cmpl	%edx, %edi
	jge	.L14
	movslq	%edi, %rcx
	leal	2(%rax), %r8d
	movd	%eax, %xmm0
	leaq	(%rcx,%rcx,2), %rcx
	movd	%r8d, %xmm1
	salq	$2, %rcx
	punpckldq	%xmm1, %xmm0
	movb	$1, 8(%rbx,%rcx)
	movq	%xmm0, (%rbx,%rcx)
	cmpl	%r8d, %edx
	jle	.L14
	movslq	%r8d, %rcx
	leal	3(%rax), %r9d
	imulq	$12, %rcx, %rcx
	addq	%rbx, %rcx
	movb	$1, 8(%rcx)
	movl	%r9d, 4(%rcx)
	movl	%edi, (%rcx)
	cmpl	%r9d, %edx
	jle	.L14
	movslq	%r9d, %rcx
	leal	4(%rax), %edi
	imulq	$12, %rcx, %rcx
	addq	%rbx, %rcx
	movb	$1, 8(%rcx)
	movl	%edi, 4(%rcx)
	movl	%r8d, (%rcx)
	cmpl	%edi, %edx
	jle	.L14
	movslq	%edi, %rcx
	leal	5(%rax), %r8d
	imulq	$12, %rcx, %rcx
	addq	%rbx, %rcx
	movb	$1, 8(%rcx)
	movl	%r8d, 4(%rcx)
	movl	%r9d, (%rcx)
	cmpl	%r8d, %edx
	jle	.L14
	movslq	%r8d, %rcx
	leal	6(%rax), %r9d
	imulq	$12, %rcx, %rcx
	addq	%rbx, %rcx
	movb	$1, 8(%rcx)
	movl	%r9d, 4(%rcx)
	movl	%edi, (%rcx)
	cmpl	%r9d, %edx
	jle	.L14
	movslq	%r9d, %rcx
	leal	7(%rax), %edi
	imulq	$12, %rcx, %rcx
	addq	%rbx, %rcx
	movb	$1, 8(%rcx)
	movl	%edi, 4(%rcx)
	movl	%r8d, (%rcx)
	cmpl	%edi, %edx
	jle	.L14
	movslq	%edi, %rcx
	leal	8(%rax), %r8d
	imulq	$12, %rcx, %rcx
	addq	%rbx, %rcx
	movb	$1, 8(%rcx)
	movl	%r8d, 4(%rcx)
	movl	%r9d, (%rcx)
	cmpl	%r8d, %edx
	jle	.L14
	movslq	%r8d, %rcx
	leal	9(%rax), %r9d
	imulq	$12, %rcx, %rcx
	addq	%rbx, %rcx
	movb	$1, 8(%rcx)
	movl	%r9d, 4(%rcx)
	movl	%edi, (%rcx)
	cmpl	%r9d, %edx
	jle	.L14
	movslq	%r9d, %rcx
	leal	10(%rax), %edi
	imulq	$12, %rcx, %rcx
	addq	%rbx, %rcx
	movb	$1, 8(%rcx)
	movl	%edi, 4(%rcx)
	movl	%r8d, (%rcx)
	cmpl	%edi, %edx
	jle	.L14
	movslq	%edi, %rcx
	leal	11(%rax), %r8d
	imulq	$12, %rcx, %rcx
	addq	%rbx, %rcx
	movb	$1, 8(%rcx)
	movl	%r8d, 4(%rcx)
	movl	%r9d, (%rcx)
	cmpl	%r8d, %edx
	jle	.L14
	movslq	%r8d, %rcx
	leal	12(%rax), %r9d
	imulq	$12, %rcx, %rcx
	addq	%rbx, %rcx
	movb	$1, 8(%rcx)
	movl	%r9d, 4(%rcx)
	movl	%edi, (%rcx)
	cmpl	%r9d, %edx
	jle	.L14
	movslq	%r9d, %rcx
	leal	13(%rax), %r10d
	imulq	$12, %rcx, %rcx
	addq	%rbx, %rcx
	movb	$1, 8(%rcx)
	movl	%r10d, 4(%rcx)
	movl	%r8d, (%rcx)
	cmpl	%r10d, %edx
	jle	.L14
	movslq	%r10d, %rdi
	leal	14(%rax), %ecx
	imulq	$12, %rdi, %rdi
	addq	%rbx, %rdi
	movb	$1, 8(%rdi)
	movl	%ecx, 4(%rdi)
	movl	%r9d, (%rdi)
	cmpl	%ecx, %edx
	jle	.L14
	movslq	%ecx, %rdx
	addl	$15, %eax
	imulq	$12, %rdx, %rdx
	addq	%rbx, %rdx
	movb	$1, 8(%rdx)
	movl	%eax, 4(%rdx)
	movl	%r10d, (%rdx)
	.p2align 4,,10
	.p2align 3
.L14:
	movl	%esi, s(%rip)
	movl	m(%rip), %edx
	movslq	%esi, %rsi
	leaq	a(%rip), %r12
	leaq	(%rsi,%rsi,2), %rax
	movl	$0, 4(%rsp)
	leaq	.LC11(%rip), %rbp
	movl	$0, 4(%rbx,%rax,4)
	xorl	%eax, %eax
	testl	%edx, %edx
	jle	.L21
	.p2align 4,,10
	.p2align 3
.L18:
	cltq
	movq	%rbp, %rdi
	leaq	(%r12,%rax,4), %rsi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %eax
	addl	$1, %eax
	cmpl	m(%rip), %eax
	movl	%eax, 4(%rsp)
	jl	.L18
.L21:
	xorl	%eax, %eax
	leaq	.LC11(%rip), %rbp
	leaq	4(%rsp), %r13
	call	calc
	movl	(%rsp), %eax
	leaq	.LC12(%rip), %r12
	leal	-1(%rax), %edx
	movl	%edx, (%rsp)
	testl	%eax, %eax
	jle	.L20
	.p2align 4,,10
	.p2align 3
.L19:
	movq	%r13, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	4(%rsp), %rax
	movq	%r12, %rsi
	movl	$1, %edi
	leaq	(%rax,%rax,2), %rax
	movsbl	8(%rbx,%rax,4), %edx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movl	(%rsp), %eax
	leal	-1(%rax), %edx
	movl	%edx, (%rsp)
	testl	%eax, %eax
	jg	.L19
.L20:
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L35
	addq	$24, %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
.L23:
	.cfi_restore_state
	xorl	%eax, %eax
	leaq	s(%rip), %rbx
	jmp	.L15
.L35:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE24:
	.size	main, .-main
	.globl	a
	.bss
	.align 32
	.type	a, @object
	.size	a, 800008
a:
	.zero	800008
	.globl	m
	.align 4
	.type	m, @object
	.size	m, 4
m:
	.zero	4
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	s
	.align 32
	.type	s, @object
	.size	s, 2400024
s:
	.zero	2400024
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC0:
	.long	0
	.long	0
	.long	1
	.long	1
	.align 16
.LC2:
	.long	16
	.long	16
	.long	16
	.long	16
	.align 16
.LC3:
	.long	-1
	.long	1
	.long	-1
	.long	1
	.align 16
.LC4:
	.long	1
	.long	3
	.long	1
	.long	3
	.align 16
.LC5:
	.long	3
	.long	5
	.long	3
	.long	5
	.align 16
.LC6:
	.long	5
	.long	7
	.long	5
	.long	7
	.align 16
.LC7:
	.long	7
	.long	9
	.long	7
	.long	9
	.align 16
.LC8:
	.long	9
	.long	11
	.long	9
	.long	11
	.align 16
.LC9:
	.long	11
	.long	13
	.long	11
	.long	13
	.align 16
.LC10:
	.long	13
	.long	15
	.long	13
	.long	15
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:

rule
	.file	"temp.c"
	.text
	.p2align 4
	.globl	calc
	.type	calc, @function
calc:
.LFB23:
	.cfi_startproc
	endbr64
	movl	m(%rip), %eax
	testl	%eax, %eax
	jle	.L1
	leaq	a(%rip), %rdi
	leal	-1(%rax), %edx
	leaq	4(%rdi), %rax
	leaq	s(%rip), %rsi
	leaq	(%rax,%rdx,4), %r8
	xorl	%eax, %eax
	.p2align 4,,10
	.p2align 3
.L7:
	movl	(%rdi), %ecx
	movl	%ecx, %edx
	andl	$1, %edx
	jne	.L3
	testl	%ecx, %ecx
	jle	.L5
	.p2align 4,,10
	.p2align 3
.L4:
	leaq	(%rax,%rax,2), %rax
	addl	$1, %edx
	movslq	4(%rsi,%rax,4), %rax
	cmpl	%edx, %ecx
	jne	.L4
.L5:
	leaq	(%rax,%rax,2), %rax
	addq	$4, %rdi
	leaq	(%rsi,%rax,4), %rax
	movslq	(%rax), %rcx
	movl	4(%rax), %r9d
	movb	$0, 8(%rax)
	movq	%rcx, %rdx
	leaq	(%rcx,%rcx,2), %rcx
	movl	%r9d, 4(%rsi,%rcx,4)
	movslq	4(%rax), %rax
	leaq	(%rax,%rax,2), %rcx
	movl	%edx, (%rsi,%rcx,4)
	cmpq	%r8, %rdi
	jne	.L7
.L1:
	ret
	.p2align 4,,10
	.p2align 3
.L3:
	testl	%ecx, %ecx
	jle	.L5
	xorl	%edx, %edx
	.p2align 4,,10
	.p2align 3
.L6:
	leaq	(%rax,%rax,2), %rax
	addl	$1, %edx
	movslq	(%rsi,%rax,4), %rax
	cmpl	%edx, %ecx
	jne	.L6
	jmp	.L5
	.cfi_endproc
.LFE23:
	.size	calc, .-calc
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC1:
	.string	"%d%d%d"
.LC11:
	.string	"%d"
.LC12:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB24:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	leaq	m(%rip), %rdx
	leaq	n(%rip), %rsi
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	leaq	.LC1(%rip), %rdi
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	leaq	s(%rip), %rbx
	subq	$24, %rsp
	.cfi_def_cfa_offset 64
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rcx
	call	__isoc99_scanf@PLT
	movl	n(%rip), %edx
	leal	-1(%rdx), %esi
	testl	%edx, %edx
	jle	.L14
	cmpl	$14, %esi
	jbe	.L23
	movl	%edx, %ecx
	leaq	s(%rip), %rbx
	movdqa	.LC0(%rip), %xmm1
	movdqa	.LC2(%rip), %xmm15
	shrl	$4, %ecx
	leaq	192(%rbx), %rdi
	movq	%rbx, %rax
	movdqa	.LC3(%rip), %xmm14
	movdqa	.LC4(%rip), %xmm13
	subl	$1, %ecx
	movdqa	.LC5(%rip), %xmm12
	movdqa	.LC6(%rip), %xmm11
	leaq	(%rcx,%rcx,2), %rcx
	movdqa	.LC7(%rip), %xmm10
	movdqa	.LC8(%rip), %xmm9
	salq	$6, %rcx
	addq	%rdi, %rcx
	.p2align 4,,10
	.p2align 3
.L16:
	movdqa	.LC9(%rip), %xmm2
	movdqa	%xmm1, %xmm0
	movb	$1, 8(%rax)
	addq	$192, %rax
	movdqa	%xmm0, %xmm7
	movdqa	%xmm0, %xmm6
	movdqa	%xmm0, %xmm5
	movb	$1, -124(%rax)
	paddd	%xmm0, %xmm2
	movdqa	%xmm0, %xmm4
	movdqa	%xmm0, %xmm3
	movb	$1, -112(%rax)
	movdqa	%xmm0, %xmm8
	paddd	%xmm13, %xmm7
	paddd	%xmm12, %xmm6
	movb	$1, -172(%rax)
	paddd	%xmm14, %xmm8
	paddd	%xmm11, %xmm5
	movb	$1, -100(%rax)
	paddd	%xmm10, %xmm4
	paddd	%xmm9, %xmm3
	movb	$1, -160(%rax)
	paddd	.LC10(%rip), %xmm0
	movb	$1, -148(%rax)
	paddd	%xmm15, %xmm1
	movb	$1, -136(%rax)
	movb	$1, -88(%rax)
	movb	$1, -76(%rax)
	movb	$1, -64(%rax)
	movb	$1, -52(%rax)
	movb	$1, -40(%rax)
	movb	$1, -28(%rax)
	movb	$1, -16(%rax)
	movb	$1, -4(%rax)
	movq	%xmm8, -192(%rax)
	movhps	%xmm8, -180(%rax)
	movq	%xmm7, -168(%rax)
	movhps	%xmm7, -156(%rax)
	movq	%xmm6, -144(%rax)
	movhps	%xmm6, -132(%rax)
	movq	%xmm5, -120(%rax)
	movhps	%xmm5, -108(%rax)
	movq	%xmm4, -96(%rax)
	movhps	%xmm4, -84(%rax)
	movq	%xmm3, -72(%rax)
	movhps	%xmm3, -60(%rax)
	movq	%xmm2, -48(%rax)
	movhps	%xmm2, -36(%rax)
	movq	%xmm0, -24(%rax)
	movhps	%xmm0, -12(%rax)
	cmpq	%rcx, %rax
	jne	.L16
	movl	%edx, %eax
	andl	$-16, %eax
	testb	$15, %dl
	je	.L14
.L15:
	movslq	%eax, %rcx
	leal	1(%rax), %edi
	leal	-1(%rax), %r8d
	leaq	(%rcx,%rcx,2), %rcx
	leaq	(%rbx,%rcx,4), %rcx
	movb	$1, 8(%rcx)
	movl	%edi, 4(%rcx)
	movl	%r8d, (%rcx)
	cmpl	%edx, %edi
	jge	.L14
	movslq	%edi, %rcx
	leal	2(%rax), %r8d
	movd	%eax, %xmm0
	leaq	(%rcx,%rcx,2), %rcx
	movd	%r8d, %xmm1
	salq	$2, %rcx
	punpckldq	%xmm1, %xmm0
	movb	$1, 8(%rbx,%rcx)
	movq	%xmm0, (%rbx,%rcx)
	cmpl	%r8d, %edx
	jle	.L14
	movslq	%r8d, %rcx
	leal	3(%rax), %r9d
	imulq	$12, %rcx, %rcx
	addq	%rbx, %rcx
	movb	$1, 8(%rcx)
	movl	%r9d, 4(%rcx)
	movl	%edi, (%rcx)
	cmpl	%r9d, %edx
	jle	.L14
	movslq	%r9d, %rcx
	leal	4(%rax), %edi
	imulq	$12, %rcx, %rcx
	addq	%rbx, %rcx
	movb	$1, 8(%rcx)
	movl	%edi, 4(%rcx)
	movl	%r8d, (%rcx)
	cmpl	%edi, %edx
	jle	.L14
	movslq	%edi, %rcx
	leal	5(%rax), %r8d
	imulq	$12, %rcx, %rcx
	addq	%rbx, %rcx
	movb	$1, 8(%rcx)
	movl	%r8d, 4(%rcx)
	movl	%r9d, (%rcx)
	cmpl	%r8d, %edx
	jle	.L14
	movslq	%r8d, %rcx
	leal	6(%rax), %r9d
	imulq	$12, %rcx, %rcx
	addq	%rbx, %rcx
	movb	$1, 8(%rcx)
	movl	%r9d, 4(%rcx)
	movl	%edi, (%rcx)
	cmpl	%r9d, %edx
	jle	.L14
	movslq	%r9d, %rcx
	leal	7(%rax), %edi
	imulq	$12, %rcx, %rcx
	addq	%rbx, %rcx
	movb	$1, 8(%rcx)
	movl	%edi, 4(%rcx)
	movl	%r8d, (%rcx)
	cmpl	%edi, %edx
	jle	.L14
	movslq	%edi, %rcx
	leal	8(%rax), %r8d
	imulq	$12, %rcx, %rcx
	addq	%rbx, %rcx
	movb	$1, 8(%rcx)
	movl	%r8d, 4(%rcx)
	movl	%r9d, (%rcx)
	cmpl	%r8d, %edx
	jle	.L14
	movslq	%r8d, %rcx
	leal	9(%rax), %r9d
	imulq	$12, %rcx, %rcx
	addq	%rbx, %rcx
	movb	$1, 8(%rcx)
	movl	%r9d, 4(%rcx)
	movl	%edi, (%rcx)
	cmpl	%r9d, %edx
	jle	.L14
	movslq	%r9d, %rcx
	leal	10(%rax), %edi
	imulq	$12, %rcx, %rcx
	addq	%rbx, %rcx
	movb	$1, 8(%rcx)
	movl	%edi, 4(%rcx)
	movl	%r8d, (%rcx)
	cmpl	%edi, %edx
	jle	.L14
	movslq	%edi, %rcx
	leal	11(%rax), %r8d
	imulq	$12, %rcx, %rcx
	addq	%rbx, %rcx
	movb	$1, 8(%rcx)
	movl	%r8d, 4(%rcx)
	movl	%r9d, (%rcx)
	cmpl	%r8d, %edx
	jle	.L14
	movslq	%r8d, %rcx
	leal	12(%rax), %r9d
	imulq	$12, %rcx, %rcx
	addq	%rbx, %rcx
	movb	$1, 8(%rcx)
	movl	%r9d, 4(%rcx)
	movl	%edi, (%rcx)
	cmpl	%r9d, %edx
	jle	.L14
	movslq	%r9d, %rcx
	leal	13(%rax), %r10d
	imulq	$12, %rcx, %rcx
	addq	%rbx, %rcx
	movb	$1, 8(%rcx)
	movl	%r10d, 4(%rcx)
	movl	%r8d, (%rcx)
	cmpl	%r10d, %edx
	jle	.L14
	movslq	%r10d, %rdi
	leal	14(%rax), %ecx
	imulq	$12, %rdi, %rdi
	addq	%rbx, %rdi
	movb	$1, 8(%rdi)
	movl	%ecx, 4(%rdi)
	movl	%r9d, (%rdi)
	cmpl	%ecx, %edx
	jle	.L14
	movslq	%ecx, %rdx
	addl	$15, %eax
	imulq	$12, %rdx, %rdx
	addq	%rbx, %rdx
	movb	$1, 8(%rdx)
	movl	%eax, 4(%rdx)
	movl	%r10d, (%rdx)
	.p2align 4,,10
	.p2align 3
.L14:
	movl	%esi, s(%rip)
	movl	m(%rip), %edx
	movslq	%esi, %rsi
	leaq	a(%rip), %r12
	leaq	(%rsi,%rsi,2), %rax
	movl	$0, 4(%rsp)
	leaq	.LC11(%rip), %rbp
	movl	$0, 4(%rbx,%rax,4)
	xorl	%eax, %eax
	testl	%edx, %edx
	jle	.L21
	.p2align 4,,10
	.p2align 3
.L18:
	cltq
	movq	%rbp, %rdi
	leaq	(%r12,%rax,4), %rsi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %eax
	addl	$1, %eax
	cmpl	m(%rip), %eax
	movl	%eax, 4(%rsp)
	jl	.L18
.L21:
	xorl	%eax, %eax
	leaq	.LC11(%rip), %rbp
	leaq	4(%rsp), %r13
	call	calc
	movl	(%rsp), %eax
	leaq	.LC12(%rip), %r12
	leal	-1(%rax), %edx
	movl	%edx, (%rsp)
	testl	%eax, %eax
	jle	.L20
	.p2align 4,,10
	.p2align 3
.L19:
	movq	%r13, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	4(%rsp), %rax
	movq	%r12, %rsi
	movl	$1, %edi
	leaq	(%rax,%rax,2), %rax
	movsbl	8(%rbx,%rax,4), %edx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movl	(%rsp), %eax
	leal	-1(%rax), %edx
	movl	%edx, (%rsp)
	testl	%eax, %eax
	jg	.L19
.L20:
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L35
	addq	$24, %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
.L23:
	.cfi_restore_state
	xorl	%eax, %eax
	leaq	s(%rip), %rbx
	jmp	.L15
.L35:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE24:
	.size	main, .-main
	.globl	a
	.bss
	.align 32
	.type	a, @object
	.size	a, 800008
a:
	.zero	800008
	.globl	m
	.align 4
	.type	m, @object
	.size	m, 4
m:
	.zero	4
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	s
	.align 32
	.type	s, @object
	.size	s, 2400024
s:
	.zero	2400024
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC0:
	.long	0
	.long	0
	.long	1
	.long	1
	.align 16
.LC2:
	.long	16
	.long	16
	.long	16
	.long	16
	.align 16
.LC3:
	.long	-1
	.long	1
	.long	-1
	.long	1
	.align 16
.LC4:
	.long	1
	.long	3
	.long	1
	.long	3
	.align 16
.LC5:
	.long	3
	.long	5
	.long	3
	.long	5
	.align 16
.LC6:
	.long	5
	.long	7
	.long	5
	.long	7
	.align 16
.LC7:
	.long	7
	.long	9
	.long	7
	.long	9
	.align 16
.LC8:
	.long	9
	.long	11
	.long	9
	.long	11
	.align 16
.LC9:
	.long	11
	.long	13
	.long	11
	.long	13
	.align 16
.LC10:
	.long	13
	.long	15
	.long	13
	.long	15
	.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:

// AOJ 0301: Baton Relay Game
// 2017.10.31

#include <stdio.h>

typedef struct { int pre, nxt; char f; } T;
T s[200002];
int n, m;
int a[200002];

void calc()
{
	int i, j, aa, cur = 0;
	
	for (i = 0; i < m; i++) {
		aa = a[i];
		if (aa & 1) for (j = 0; j < aa; j++) cur = s[cur].pre;
		else       for (j = 0; j < aa; j++) cur = s[cur].nxt;
		s[cur].f = 0;
		s[s[cur].pre].nxt = s[cur].nxt;
		s[s[cur].nxt].pre = s[cur].pre;
		cur = s[cur].nxt;
	}
}

int main()
{
	int q, i;

	scanf("%d%d%d", &n, &m, &q);
	for (i = 0; i < n; i++) s[i].f = 1, s[i].nxt = i+1, s[i].pre = i-1;
	s[0].pre = n-1, s[n-1].nxt = 0;
	for (i = 0; i < m; i++) scanf("%d", a+i);
	calc();
	while (q-- > 0) {
		scanf("%d", &i);
		printf("%d\n", s[i].f);
	}
	return 0;
}
10 5 3
2 6 5 18 3
3 0 5

1
0
1

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

```c
// AOJ 0301: Baton Relay Game
// 2017.10.31

#include <stdio.h>

typedef struct { int pre, nxt; char f; } T;
T s[200002];
int n, m;
int a[200002];

void calc()
{
	int i, j, aa, cur = 0;
	
	for (i = 0; i < m; i++) {
		aa = a[i];
		if (aa & 1) for (j = 0; j < aa; j++) cur = s[cur].pre;
		else       for (j = 0; j < aa; j++) cur = s[cur].nxt;
		s[cur].f = 0;
		s[s[cur].pre].nxt = s[cur].nxt;
		s[s[cur].nxt].pre = s[cur].pre;
		cur = s[cur].nxt;
	}
}

int main()
{
	int q, i;

	scanf("%d%d%d", &n, &m, &q);
	for (i = 0; i < n; i++) s[i].f = 1, s[i].nxt = i+1, s[i].pre = i-1;
	s[0].pre = n-1, s[n-1].nxt = 0;
	for (i = 0; i < m; i++) scanf("%d", a+i);
	calc();
	while (q-- > 0) {
		scanf("%d", &i);
		printf("%d\n", s[i].f);
	}
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	s
	.bss
	.align 32
	.type	s, @object
	.size	s, 2400024
s:
	.zero	2400024
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	m
	.align 4
	.type	m, @object
	.size	m, 4
m:
	.zero	4
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 800008
a:
	.zero	800008
	.text
	.globl	calc
	.type	calc, @function
calc:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	$0, -8(%rbp)
	movl	$0, -16(%rbp)
	jmp	.L2
.L9:
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -4(%rbp)
	movl	-4(%rbp), %eax
	andl	$1, %eax
	testl	%eax, %eax
	je	.L3
	movl	$0, -12(%rbp)
	jmp	.L4
.L5:
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	leaq	s(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -8(%rbp)
	addl	$1, -12(%rbp)
.L4:
	movl	-12(%rbp), %eax
	cmpl	-4(%rbp), %eax
	jl	.L5
	jmp	.L6
.L3:
	movl	$0, -12(%rbp)
	jmp	.L7
.L8:
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	leaq	4+s(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -8(%rbp)
	addl	$1, -12(%rbp)
.L7:
	movl	-12(%rbp), %eax
	cmpl	-4(%rbp), %eax
	jl	.L8
.L6:
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	leaq	8+s(%rip), %rax
	movb	$0, (%rdx,%rax)
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	leaq	s(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	leaq	4+s(%rip), %rax
	movl	(%rdx,%rax), %edx
	movslq	%ecx, %rcx
	movq	%rcx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	salq	$2, %rax
	movq	%rax, %rcx
	leaq	4+s(%rip), %rax
	movl	%edx, (%rcx,%rax)
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	leaq	4+s(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	leaq	s(%rip), %rax
	movl	(%rdx,%rax), %edx
	movslq	%ecx, %rcx
	movq	%rcx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	salq	$2, %rax
	movq	%rax, %rcx
	leaq	s(%rip), %rax
	movl	%edx, (%rcx,%rax)
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	leaq	4+s(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -8(%rbp)
	addl	$1, -16(%rbp)
.L2:
	movl	m(%rip), %eax
	cmpl	%eax, -16(%rbp)
	jl	.L9
	nop
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	calc, .-calc
	.section	.rodata
.LC0:
	.string	"%d%d%d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-16(%rbp), %rax
	movq	%rax, %rcx
	leaq	m(%rip), %rax
	movq	%rax, %rdx
	leaq	n(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -12(%rbp)
	jmp	.L11
.L12:
	movl	-12(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	leaq	8+s(%rip), %rax
	movb	$1, (%rdx,%rax)
	movl	-12(%rbp), %edx
	movl	-12(%rbp), %eax
	leal	1(%rdx), %ecx
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	leaq	4+s(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	-12(%rbp), %edx
	movl	-12(%rbp), %eax
	leal	-1(%rdx), %ecx
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	leaq	s(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	-12(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -12(%rbp)
.L11:
	movl	-12(%rbp), %edx
	movl	n(%rip), %eax
	cmpl	%eax, %edx
	jl	.L12
	movl	n(%rip), %eax
	subl	$1, %eax
	movl	%eax, s(%rip)
	movl	n(%rip), %eax
	subl	$1, %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	leaq	4+s(%rip), %rax
	movl	$0, (%rdx,%rax)
	movl	$0, -12(%rbp)
	jmp	.L13
.L14:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-12(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -12(%rbp)
.L13:
	movl	-12(%rbp), %edx
	movl	m(%rip), %eax
	cmpl	%eax, %edx
	jl	.L14
	movl	$0, %eax
	call	calc
	jmp	.L15
.L16:
	leaq	-12(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-12(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	leaq	8+s(%rip), %rax
	movzbl	(%rdx,%rax), %eax
	movsbl	%al, %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L15:
	movl	-16(%rbp), %eax
	leal	-1(%rax), %edx
	movl	%edx, -16(%rbp)
	testl	%eax, %eax
	jg	.L16
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L18
	call	__stack_chk_fail@PLT
.L18:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```

Only output the optimized assembly code. Do not include any other text. Do not write any comments in the assembly code. Wrap the assembly code in ```assembly``` tags.
train
	.file	"temp.c"
	.text
	.globl	s
	.bss
	.align 32
	.type	s, @object
	.size	s, 2400024
s:
	.zero	2400024
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	m
	.align 4
	.type	m, @object
	.size	m, 4
m:
	.zero	4
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 800008
a:
	.zero	800008
	.text
	.globl	calc
	.type	calc, @function
calc:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	$0, -8(%rbp)
	movl	$0, -16(%rbp)
	jmp	.L2
.L9:
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -4(%rbp)
	movl	-4(%rbp), %eax
	andl	$1, %eax
	testl	%eax, %eax
	je	.L3
	movl	$0, -12(%rbp)
	jmp	.L4
.L5:
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	leaq	s(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -8(%rbp)
	addl	$1, -12(%rbp)
.L4:
	movl	-12(%rbp), %eax
	cmpl	-4(%rbp), %eax
	jl	.L5
	jmp	.L6
.L3:
	movl	$0, -12(%rbp)
	jmp	.L7
.L8:
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	leaq	4+s(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -8(%rbp)
	addl	$1, -12(%rbp)
.L7:
	movl	-12(%rbp), %eax
	cmpl	-4(%rbp), %eax
	jl	.L8
.L6:
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	leaq	8+s(%rip), %rax
	movb	$0, (%rdx,%rax)
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	leaq	s(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	leaq	4+s(%rip), %rax
	movl	(%rdx,%rax), %edx
	movslq	%ecx, %rcx
	movq	%rcx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	salq	$2, %rax
	movq	%rax, %rcx
	leaq	4+s(%rip), %rax
	movl	%edx, (%rcx,%rax)
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	leaq	4+s(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	leaq	s(%rip), %rax
	movl	(%rdx,%rax), %edx
	movslq	%ecx, %rcx
	movq	%rcx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	salq	$2, %rax
	movq	%rax, %rcx
	leaq	s(%rip), %rax
	movl	%edx, (%rcx,%rax)
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	leaq	4+s(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -8(%rbp)
	addl	$1, -16(%rbp)
.L2:
	movl	m(%rip), %eax
	cmpl	%eax, -16(%rbp)
	jl	.L9
	nop
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	calc, .-calc
	.section	.rodata
.LC0:
	.string	"%d%d%d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-16(%rbp), %rax
	movq	%rax, %rcx
	leaq	m(%rip), %rax
	movq	%rax, %rdx
	leaq	n(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -12(%rbp)
	jmp	.L11
.L12:
	movl	-12(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	leaq	8+s(%rip), %rax
	movb	$1, (%rdx,%rax)
	movl	-12(%rbp), %edx
	movl	-12(%rbp), %eax
	leal	1(%rdx), %ecx
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	leaq	4+s(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	-12(%rbp), %edx
	movl	-12(%rbp), %eax
	leal	-1(%rdx), %ecx
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	leaq	s(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	-12(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -12(%rbp)
.L11:
	movl	-12(%rbp), %edx
	movl	n(%rip), %eax
	cmpl	%eax, %edx
	jl	.L12
	movl	n(%rip), %eax
	subl	$1, %eax
	movl	%eax, s(%rip)
	movl	n(%rip), %eax
	subl	$1, %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	leaq	4+s(%rip), %rax
	movl	$0, (%rdx,%rax)
	movl	$0, -12(%rbp)
	jmp	.L13
.L14:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-12(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -12(%rbp)
.L13:
	movl	-12(%rbp), %edx
	movl	m(%rip), %eax
	cmpl	%eax, %edx
	jl	.L14
	movl	$0, %eax
	call	calc
	jmp	.L15
.L16:
	leaq	-12(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-12(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	leaq	8+s(%rip), %rax
	movzbl	(%rdx,%rax), %eax
	movsbl	%al, %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L15:
	movl	-16(%rbp), %eax
	leal	-1(%rax), %edx
	movl	%edx, -16(%rbp)
	testl	%eax, %eax
	jg	.L16
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L18
	call	__stack_chk_fail@PLT
.L18:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
