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 N;
int X[100];
int M;
int A[100];

void succ(int a)
{
  int x = X[a - 1];

  if (x == 2019)
  {
    return;
  }

  for (int i = 0; i < N; ++i)
  {
    if (X[i] == x + 1)
    {
      return;
    }
  }

  ++X[a - 1];
  return;
}

int main(void)
{

  scanf("%d", &N);

  for (int i = 0; i < N; ++i)
  {
    if (i == N - 1)
    {
      scanf("%d", &X[i]);
    }
    else
    {
      scanf("%d ", &X[i]);
    }
  }

  scanf("%d", &M);

  for (int i = 0; i < M; ++i)
  {
    if (i == M - 1)
    {
      scanf("%d", &A[i]);
    }
    else
    {
      scanf("%d ", &A[i]);
    }
  }

  // ===========================================

  for (int j = 0; j < M; ++j)
  {
    succ(A[j]);
  }

  for (int i = 0; i < N; ++i)
  {
    printf("%d\n", X[i]);
  }

  return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	N
	.bss
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	4
	.globl	X
	.align 32
	.type	X, @object
	.size	X, 400
X:
	.zero	400
	.globl	M
	.align 4
	.type	M, @object
	.size	M, 4
M:
	.zero	4
	.globl	A
	.align 32
	.type	A, @object
	.size	A, 400
A:
	.zero	400
	.text
	.globl	succ
	.type	succ, @function
succ:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -20(%rbp)
	movl	-20(%rbp), %eax
	subl	$1, %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	X(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -4(%rbp)
	cmpl	$2019, -4(%rbp)
	je	.L7
	movl	$0, -8(%rbp)
	jmp	.L4
.L6:
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	X(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-4(%rbp), %edx
	addl	$1, %edx
	cmpl	%edx, %eax
	je	.L8
	addl	$1, -8(%rbp)
.L4:
	movl	N(%rip), %eax
	cmpl	%eax, -8(%rbp)
	jl	.L6
	movl	-20(%rbp), %eax
	subl	$1, %eax
	movslq	%eax, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	X(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	leal	1(%rdx), %ecx
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	X(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	jmp	.L1
.L7:
	nop
	jmp	.L1
.L8:
	nop
.L1:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	succ, .-succ
	.section	.rodata
.LC0:
	.string	"%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
	leaq	N(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -16(%rbp)
	jmp	.L10
.L13:
	movl	N(%rip), %eax
	subl	$1, %eax
	cmpl	%eax, -16(%rbp)
	jne	.L11
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	X(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	jmp	.L12
.L11:
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	X(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
.L12:
	addl	$1, -16(%rbp)
.L10:
	movl	N(%rip), %eax
	cmpl	%eax, -16(%rbp)
	jl	.L13
	leaq	M(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -12(%rbp)
	jmp	.L14
.L17:
	movl	M(%rip), %eax
	subl	$1, %eax
	cmpl	%eax, -12(%rbp)
	jne	.L15
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	A(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	jmp	.L16
.L15:
	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
.L16:
	addl	$1, -12(%rbp)
.L14:
	movl	M(%rip), %eax
	cmpl	%eax, -12(%rbp)
	jl	.L17
	movl	$0, -8(%rbp)
	jmp	.L18
.L19:
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	A(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, %edi
	call	succ
	addl	$1, -8(%rbp)
.L18:
	movl	M(%rip), %eax
	cmpl	%eax, -8(%rbp)
	jl	.L19
	movl	$0, -4(%rbp)
	jmp	.L20
.L21:
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	X(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -4(%rbp)
.L20:
	movl	N(%rip), %eax
	cmpl	%eax, -4(%rbp)
	jl	.L21
	movl	$0, %eax
	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	succ
	.type	succ, @function
succ:
.LFB23:
	.cfi_startproc
	endbr64
	subl	$1, %edi
	leaq	X(%rip), %rsi
	movslq	%edi, %rdi
	movl	(%rsi,%rdi,4), %edx
	cmpl	$2019, %edx
	je	.L1
	movl	N(%rip), %ecx
	addl	$1, %edx
	testl	%ecx, %ecx
	jle	.L3
	leal	-1(%rcx), %r8d
	leaq	4(%rsi), %rcx
	movq	%rsi, %rax
	leaq	(%rcx,%r8,4), %rcx
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L10:
	addq	$4, %rax
	cmpq	%rcx, %rax
	je	.L3
.L4:
	cmpl	%edx, (%rax)
	jne	.L10
.L1:
	ret
	.p2align 4,,10
	.p2align 3
.L3:
	movl	%edx, (%rsi,%rdi,4)
	ret
	.cfi_endproc
.LFE23:
	.size	succ, .-succ
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%d "
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB24:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	N(%rip), %rsi
	xorl	%eax, %eax
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	leaq	.LC1(%rip), %r14
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	leaq	.LC0(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movq	%r13, %rdi
	leaq	X(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	xorl	%ebx, %ebx
	subq	$8, %rsp
	.cfi_def_cfa_offset 64
	call	__isoc99_scanf@PLT
	movl	N(%rip), %ebp
	testl	%ebp, %ebp
	jle	.L17
	.p2align 4,,10
	.p2align 3
.L18:
	leal	-1(%rbp), %eax
	movq	%r12, %rsi
	cmpl	%ebx, %eax
	je	.L43
	movq	%r14, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	addq	$4, %r12
	call	__isoc99_scanf@PLT
	movl	N(%rip), %ebp
	cmpl	%ebx, %ebp
	jg	.L18
.L17:
	leaq	M(%rip), %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	xorl	%r12d, %r12d
	call	__isoc99_scanf@PLT
	movl	M(%rip), %ebp
	leaq	A(%rip), %rbx
	leaq	.LC1(%rip), %r15
	movq	%rbx, %r14
	testl	%ebp, %ebp
	jle	.L44
	.p2align 4,,10
	.p2align 3
.L22:
	leal	-1(%rbp), %eax
	movq	%r14, %rsi
	cmpl	%r12d, %eax
	je	.L45
	movq	%r15, %rdi
	xorl	%eax, %eax
	addl	$1, %r12d
	addq	$4, %r14
	call	__isoc99_scanf@PLT
	movl	M(%rip), %ebp
	cmpl	%r12d, %ebp
	jg	.L22
.L21:
	movl	N(%rip), %edi
	testl	%ebp, %ebp
	jle	.L23
	leal	-1(%rbp), %edx
	leaq	4+A(%rip), %rax
	leaq	X(%rip), %rbp
	leaq	(%rax,%rdx,4), %r8
	leal	-1(%rdi), %eax
	leaq	4(%rbp), %rdx
	leaq	(%rdx,%rax,4), %rcx
	.p2align 4,,10
	.p2align 3
.L27:
	movl	(%rbx), %eax
	leal	-1(%rax), %esi
	movslq	%esi, %rsi
	movl	0(%rbp,%rsi,4), %edx
	cmpl	$2019, %edx
	je	.L24
	addl	$1, %edx
	testl	%edi, %edi
	jle	.L25
	movq	%rbp, %rax
	jmp	.L26
	.p2align 4,,10
	.p2align 3
.L46:
	addq	$4, %rax
	cmpq	%rax, %rcx
	je	.L25
.L26:
	cmpl	%edx, (%rax)
	jne	.L46
.L24:
	addq	$4, %rbx
	cmpq	%r8, %rbx
	jne	.L27
.L23:
	xorl	%ebx, %ebx
	leaq	X(%rip), %rbp
	leaq	.LC2(%rip), %r12
	testl	%edi, %edi
	jle	.L41
	.p2align 4,,10
	.p2align 3
.L28:
	movl	0(%rbp,%rbx,4), %edx
	xorl	%eax, %eax
	movq	%r12, %rsi
	movl	$1, %edi
	addq	$1, %rbx
	call	__printf_chk@PLT
	cmpl	%ebx, N(%rip)
	jg	.L28
.L41:
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L25:
	.cfi_restore_state
	addq	$4, %rbx
	movl	%edx, 0(%rbp,%rsi,4)
	cmpq	%r8, %rbx
	jne	.L27
	jmp	.L23
	.p2align 4,,10
	.p2align 3
.L45:
	movq	%r13, %rdi
	xorl	%eax, %eax
	movl	%ebp, %r12d
	addq	$4, %r14
	call	__isoc99_scanf@PLT
	movl	M(%rip), %ebp
	cmpl	%ebp, %r12d
	jl	.L22
	jmp	.L21
	.p2align 4,,10
	.p2align 3
.L43:
	movq	%r13, %rdi
	xorl	%eax, %eax
	movl	%ebp, %ebx
	addq	$4, %r12
	call	__isoc99_scanf@PLT
	movl	N(%rip), %ebp
	cmpl	%ebp, %ebx
	jl	.L18
	jmp	.L17
.L44:
	movl	N(%rip), %edi
	jmp	.L23
	.cfi_endproc
.LFE24:
	.size	main, .-main
	.globl	A
	.bss
	.align 32
	.type	A, @object
	.size	A, 400
A:
	.zero	400
	.globl	M
	.align 4
	.type	M, @object
	.size	M, 4
M:
	.zero	4
	.globl	X
	.align 32
	.type	X, @object
	.size	X, 400
X:
	.zero	400
	.globl	N
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	4
	.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	succ
	.type	succ, @function
succ:
.LFB23:
	.cfi_startproc
	endbr64
	subl	$1, %edi
	leaq	X(%rip), %rsi
	movslq	%edi, %rdi
	movl	(%rsi,%rdi,4), %edx
	cmpl	$2019, %edx
	je	.L1
	movl	N(%rip), %ecx
	addl	$1, %edx
	testl	%ecx, %ecx
	jle	.L3
	leal	-1(%rcx), %r8d
	leaq	4(%rsi), %rcx
	movq	%rsi, %rax
	leaq	(%rcx,%r8,4), %rcx
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L10:
	addq	$4, %rax
	cmpq	%rcx, %rax
	je	.L3
.L4:
	cmpl	%edx, (%rax)
	jne	.L10
.L1:
	ret
	.p2align 4,,10
	.p2align 3
.L3:
	movl	%edx, (%rsi,%rdi,4)
	ret
	.cfi_endproc
.LFE23:
	.size	succ, .-succ
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%d "
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB24:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	N(%rip), %rsi
	xorl	%eax, %eax
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	leaq	.LC1(%rip), %r14
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	leaq	.LC0(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movq	%r13, %rdi
	leaq	X(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	xorl	%ebx, %ebx
	subq	$8, %rsp
	.cfi_def_cfa_offset 64
	call	__isoc99_scanf@PLT
	movl	N(%rip), %ebp
	testl	%ebp, %ebp
	jle	.L17
	.p2align 4,,10
	.p2align 3
.L18:
	leal	-1(%rbp), %eax
	movq	%r12, %rsi
	cmpl	%ebx, %eax
	je	.L43
	movq	%r14, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	addq	$4, %r12
	call	__isoc99_scanf@PLT
	movl	N(%rip), %ebp
	cmpl	%ebx, %ebp
	jg	.L18
.L17:
	leaq	M(%rip), %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	xorl	%r12d, %r12d
	call	__isoc99_scanf@PLT
	movl	M(%rip), %ebp
	leaq	A(%rip), %rbx
	leaq	.LC1(%rip), %r15
	movq	%rbx, %r14
	testl	%ebp, %ebp
	jle	.L44
	.p2align 4,,10
	.p2align 3
.L22:
	leal	-1(%rbp), %eax
	movq	%r14, %rsi
	cmpl	%r12d, %eax
	je	.L45
	movq	%r15, %rdi
	xorl	%eax, %eax
	addl	$1, %r12d
	addq	$4, %r14
	call	__isoc99_scanf@PLT
	movl	M(%rip), %ebp
	cmpl	%r12d, %ebp
	jg	.L22
.L21:
	movl	N(%rip), %edi
	testl	%ebp, %ebp
	jle	.L23
	leal	-1(%rbp), %edx
	leaq	4+A(%rip), %rax
	leaq	X(%rip), %rbp
	leaq	(%rax,%rdx,4), %r8
	leal	-1(%rdi), %eax
	leaq	4(%rbp), %rdx
	leaq	(%rdx,%rax,4), %rcx
	.p2align 4,,10
	.p2align 3
.L27:
	movl	(%rbx), %eax
	leal	-1(%rax), %esi
	movslq	%esi, %rsi
	movl	0(%rbp,%rsi,4), %edx
	cmpl	$2019, %edx
	je	.L24
	addl	$1, %edx
	testl	%edi, %edi
	jle	.L25
	movq	%rbp, %rax
	jmp	.L26
	.p2align 4,,10
	.p2align 3
.L46:
	addq	$4, %rax
	cmpq	%rax, %rcx
	je	.L25
.L26:
	cmpl	%edx, (%rax)
	jne	.L46
.L24:
	addq	$4, %rbx
	cmpq	%r8, %rbx
	jne	.L27
.L23:
	xorl	%ebx, %ebx
	leaq	X(%rip), %rbp
	leaq	.LC2(%rip), %r12
	testl	%edi, %edi
	jle	.L41
	.p2align 4,,10
	.p2align 3
.L28:
	movl	0(%rbp,%rbx,4), %edx
	xorl	%eax, %eax
	movq	%r12, %rsi
	movl	$1, %edi
	addq	$1, %rbx
	call	__printf_chk@PLT
	cmpl	%ebx, N(%rip)
	jg	.L28
.L41:
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L25:
	.cfi_restore_state
	addq	$4, %rbx
	movl	%edx, 0(%rbp,%rsi,4)
	cmpq	%r8, %rbx
	jne	.L27
	jmp	.L23
	.p2align 4,,10
	.p2align 3
.L45:
	movq	%r13, %rdi
	xorl	%eax, %eax
	movl	%ebp, %r12d
	addq	$4, %r14
	call	__isoc99_scanf@PLT
	movl	M(%rip), %ebp
	cmpl	%ebp, %r12d
	jl	.L22
	jmp	.L21
	.p2align 4,,10
	.p2align 3
.L43:
	movq	%r13, %rdi
	xorl	%eax, %eax
	movl	%ebp, %ebx
	addq	$4, %r12
	call	__isoc99_scanf@PLT
	movl	N(%rip), %ebp
	cmpl	%ebp, %ebx
	jl	.L18
	jmp	.L17
.L44:
	movl	N(%rip), %edi
	jmp	.L23
	.cfi_endproc
.LFE24:
	.size	main, .-main
	.globl	A
	.bss
	.align 32
	.type	A, @object
	.size	A, 400
A:
	.zero	400
	.globl	M
	.align 4
	.type	M, @object
	.size	M, 4
M:
	.zero	4
	.globl	X
	.align 32
	.type	X, @object
	.size	X, 400
X:
	.zero	400
	.globl	N
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	4
	.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 N;
int X[100];
int M;
int A[100];

void succ(int a)
{
  int x = X[a - 1];

  if (x == 2019)
  {
    return;
  }

  for (int i = 0; i < N; ++i)
  {
    if (X[i] == x + 1)
    {
      return;
    }
  }

  ++X[a - 1];
  return;
}

int main(void)
{

  scanf("%d", &N);

  for (int i = 0; i < N; ++i)
  {
    if (i == N - 1)
    {
      scanf("%d", &X[i]);
    }
    else
    {
      scanf("%d ", &X[i]);
    }
  }

  scanf("%d", &M);

  for (int i = 0; i < M; ++i)
  {
    if (i == M - 1)
    {
      scanf("%d", &A[i]);
    }
    else
    {
      scanf("%d ", &A[i]);
    }
  }

  // ===========================================

  for (int j = 0; j < M; ++j)
  {
    succ(A[j]);
  }

  for (int i = 0; i < N; ++i)
  {
    printf("%d\n", X[i]);
  }

  return 0;
}

3
2 3 6
2
1 3

2
3
7

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 N;
int X[100];
int M;
int A[100];

void succ(int a)
{
  int x = X[a - 1];

  if (x == 2019)
  {
    return;
  }

  for (int i = 0; i < N; ++i)
  {
    if (X[i] == x + 1)
    {
      return;
    }
  }

  ++X[a - 1];
  return;
}

int main(void)
{

  scanf("%d", &N);

  for (int i = 0; i < N; ++i)
  {
    if (i == N - 1)
    {
      scanf("%d", &X[i]);
    }
    else
    {
      scanf("%d ", &X[i]);
    }
  }

  scanf("%d", &M);

  for (int i = 0; i < M; ++i)
  {
    if (i == M - 1)
    {
      scanf("%d", &A[i]);
    }
    else
    {
      scanf("%d ", &A[i]);
    }
  }

  // ===========================================

  for (int j = 0; j < M; ++j)
  {
    succ(A[j]);
  }

  for (int i = 0; i < N; ++i)
  {
    printf("%d\n", X[i]);
  }

  return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	N
	.bss
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	4
	.globl	X
	.align 32
	.type	X, @object
	.size	X, 400
X:
	.zero	400
	.globl	M
	.align 4
	.type	M, @object
	.size	M, 4
M:
	.zero	4
	.globl	A
	.align 32
	.type	A, @object
	.size	A, 400
A:
	.zero	400
	.text
	.globl	succ
	.type	succ, @function
succ:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -20(%rbp)
	movl	-20(%rbp), %eax
	subl	$1, %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	X(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -4(%rbp)
	cmpl	$2019, -4(%rbp)
	je	.L7
	movl	$0, -8(%rbp)
	jmp	.L4
.L6:
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	X(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-4(%rbp), %edx
	addl	$1, %edx
	cmpl	%edx, %eax
	je	.L8
	addl	$1, -8(%rbp)
.L4:
	movl	N(%rip), %eax
	cmpl	%eax, -8(%rbp)
	jl	.L6
	movl	-20(%rbp), %eax
	subl	$1, %eax
	movslq	%eax, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	X(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	leal	1(%rdx), %ecx
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	X(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	jmp	.L1
.L7:
	nop
	jmp	.L1
.L8:
	nop
.L1:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	succ, .-succ
	.section	.rodata
.LC0:
	.string	"%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
	leaq	N(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -16(%rbp)
	jmp	.L10
.L13:
	movl	N(%rip), %eax
	subl	$1, %eax
	cmpl	%eax, -16(%rbp)
	jne	.L11
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	X(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	jmp	.L12
.L11:
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	X(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
.L12:
	addl	$1, -16(%rbp)
.L10:
	movl	N(%rip), %eax
	cmpl	%eax, -16(%rbp)
	jl	.L13
	leaq	M(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -12(%rbp)
	jmp	.L14
.L17:
	movl	M(%rip), %eax
	subl	$1, %eax
	cmpl	%eax, -12(%rbp)
	jne	.L15
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	A(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	jmp	.L16
.L15:
	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
.L16:
	addl	$1, -12(%rbp)
.L14:
	movl	M(%rip), %eax
	cmpl	%eax, -12(%rbp)
	jl	.L17
	movl	$0, -8(%rbp)
	jmp	.L18
.L19:
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	A(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, %edi
	call	succ
	addl	$1, -8(%rbp)
.L18:
	movl	M(%rip), %eax
	cmpl	%eax, -8(%rbp)
	jl	.L19
	movl	$0, -4(%rbp)
	jmp	.L20
.L21:
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	X(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -4(%rbp)
.L20:
	movl	N(%rip), %eax
	cmpl	%eax, -4(%rbp)
	jl	.L21
	movl	$0, %eax
	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	N
	.bss
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	4
	.globl	X
	.align 32
	.type	X, @object
	.size	X, 400
X:
	.zero	400
	.globl	M
	.align 4
	.type	M, @object
	.size	M, 4
M:
	.zero	4
	.globl	A
	.align 32
	.type	A, @object
	.size	A, 400
A:
	.zero	400
	.text
	.globl	succ
	.type	succ, @function
succ:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -20(%rbp)
	movl	-20(%rbp), %eax
	subl	$1, %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	X(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -4(%rbp)
	cmpl	$2019, -4(%rbp)
	je	.L7
	movl	$0, -8(%rbp)
	jmp	.L4
.L6:
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	X(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-4(%rbp), %edx
	addl	$1, %edx
	cmpl	%edx, %eax
	je	.L8
	addl	$1, -8(%rbp)
.L4:
	movl	N(%rip), %eax
	cmpl	%eax, -8(%rbp)
	jl	.L6
	movl	-20(%rbp), %eax
	subl	$1, %eax
	movslq	%eax, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	X(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	leal	1(%rdx), %ecx
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	X(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	jmp	.L1
.L7:
	nop
	jmp	.L1
.L8:
	nop
.L1:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	succ, .-succ
	.section	.rodata
.LC0:
	.string	"%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
	leaq	N(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -16(%rbp)
	jmp	.L10
.L13:
	movl	N(%rip), %eax
	subl	$1, %eax
	cmpl	%eax, -16(%rbp)
	jne	.L11
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	X(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	jmp	.L12
.L11:
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	X(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
.L12:
	addl	$1, -16(%rbp)
.L10:
	movl	N(%rip), %eax
	cmpl	%eax, -16(%rbp)
	jl	.L13
	leaq	M(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -12(%rbp)
	jmp	.L14
.L17:
	movl	M(%rip), %eax
	subl	$1, %eax
	cmpl	%eax, -12(%rbp)
	jne	.L15
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	A(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	jmp	.L16
.L15:
	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
.L16:
	addl	$1, -12(%rbp)
.L14:
	movl	M(%rip), %eax
	cmpl	%eax, -12(%rbp)
	jl	.L17
	movl	$0, -8(%rbp)
	jmp	.L18
.L19:
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	A(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, %edi
	call	succ
	addl	$1, -8(%rbp)
.L18:
	movl	M(%rip), %eax
	cmpl	%eax, -8(%rbp)
	jl	.L19
	movl	$0, -4(%rbp)
	jmp	.L20
.L21:
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	X(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -4(%rbp)
.L20:
	movl	N(%rip), %eax
	cmpl	%eax, -4(%rbp)
	jl	.L21
	movl	$0, %eax
	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:
