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

```c
#include<stdio.h>

int main(){
  int i,j,n,A[100000],x,r,p,q,temp;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }
  r=n-1;/*rは配列Aの最後の要素を指す添字*/
  p=0;
  x=A[r];
  i=-1;
  for(j=p;j<=r-1;j++){
    if(A[j]<=x){
      i++;
      temp=A[i];
      A[i]=A[j];
      A[j]=temp;
    }
  }
  temp=A[i+1];
  A[i+1]=A[r];
  A[r]=temp;
  q=i+1;
  for(i=0;i<n;i++){
    if(i>0)printf(" ");
    if(i==q)printf("[");
    printf("%d",A[i]);
    if(i==q)printf("]");
  }
  printf("\n");
  return 0;
}
  
      
  

```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	leaq	-397312(%rsp), %r11
	.cfi_def_cfa 11, 397352
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$2728, %rsp
	.cfi_def_cfa_offset 400080
	leaq	.LC0(%rip), %r12
	movq	%r12, %rdi
	movq	%fs:40, %rax
	movq	%rax, 400024(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %edx
	testl	%edx, %edx
	jle	.L2
	leaq	16(%rsp), %rbp
	xorl	%ebx, %ebx
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%rbp, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %edx
	addq	$4, %rbp
	cmpl	%ebx, %edx
	jg	.L3
.L2:
	leal	-1(%rdx), %eax
	movslq	%eax, %r11
	movl	16(%rsp,%r11,4), %r8d
	testl	%eax, %eax
	jle	.L12
	leal	-2(%rdx), %ecx
	leaq	16(%rsp), %rax
	movl	$-1, %esi
	leaq	20(%rsp,%rcx,4), %r9
	.p2align 4,,10
	.p2align 3
.L6:
	movl	(%rax), %ecx
	cmpl	%r8d, %ecx
	jg	.L5
	addl	$1, %esi
	movslq	%esi, %rdi
	movl	16(%rsp,%rdi,4), %r10d
	movl	%ecx, 16(%rsp,%rdi,4)
	movl	%r10d, (%rax)
.L5:
	addq	$4, %rax
	cmpq	%r9, %rax
	jne	.L6
.L4:
	leal	1(%rsi), %ebp
	movl	16(%rsp,%r11,4), %esi
	xorl	%ebx, %ebx
	leaq	16(%rsp), %r13
	movslq	%ebp, %rax
	movl	16(%rsp,%rax,4), %ecx
	movl	%esi, 16(%rsp,%rax,4)
	movl	%ecx, 16(%rsp,%r11,4)
	testl	%edx, %edx
	jg	.L7
	jmp	.L10
	.p2align 4,,10
	.p2align 3
.L8:
	movl	0(%r13,%rbx,4), %edx
	movq	%r12, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	addq	$1, %rbx
	call	__printf_chk@PLT
	cmpl	%ebx, 12(%rsp)
	jle	.L10
.L9:
	movl	$32, %edi
	call	putchar@PLT
.L7:
	cmpl	%ebx, %ebp
	jne	.L8
	movl	$91, %edi
	call	putchar@PLT
	movl	0(%r13,%rbx,4), %edx
	movq	%r12, %rsi
	xorl	%eax, %eax
	movl	$1, %edi
	addq	$1, %rbx
	call	__printf_chk@PLT
	movl	$93, %edi
	call	putchar@PLT
	cmpl	%ebx, 12(%rsp)
	jg	.L9
	.p2align 4,,10
	.p2align 3
.L10:
	movl	$10, %edi
	call	putchar@PLT
	movq	400024(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L20
	addq	$400040, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
.L12:
	.cfi_restore_state
	orl	$-1, %esi
	jmp	.L4
.L20:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```

Only output the optimized assembly code. Do not include any other text. Do not write any comments in the assembly code. Wrap the assembly code in ```assembly``` tags.
Optimized Assembly Code:

user
```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	leaq	-397312(%rsp), %r11
	.cfi_def_cfa 11, 397352
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$2728, %rsp
	.cfi_def_cfa_offset 400080
	leaq	.LC0(%rip), %r12
	movq	%r12, %rdi
	movq	%fs:40, %rax
	movq	%rax, 400024(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %edx
	testl	%edx, %edx
	jle	.L2
	leaq	16(%rsp), %rbp
	xorl	%ebx, %ebx
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%rbp, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %edx
	addq	$4, %rbp
	cmpl	%ebx, %edx
	jg	.L3
.L2:
	leal	-1(%rdx), %eax
	movslq	%eax, %r11
	movl	16(%rsp,%r11,4), %r8d
	testl	%eax, %eax
	jle	.L12
	leal	-2(%rdx), %ecx
	leaq	16(%rsp), %rax
	movl	$-1, %esi
	leaq	20(%rsp,%rcx,4), %r9
	.p2align 4,,10
	.p2align 3
.L6:
	movl	(%rax), %ecx
	cmpl	%r8d, %ecx
	jg	.L5
	addl	$1, %esi
	movslq	%esi, %rdi
	movl	16(%rsp,%rdi,4), %r10d
	movl	%ecx, 16(%rsp,%rdi,4)
	movl	%r10d, (%rax)
.L5:
	addq	$4, %rax
	cmpq	%r9, %rax
	jne	.L6
.L4:
	leal	1(%rsi), %ebp
	movl	16(%rsp,%r11,4), %esi
	xorl	%ebx, %ebx
	leaq	16(%rsp), %r13
	movslq	%ebp, %rax
	movl	16(%rsp,%rax,4), %ecx
	movl	%esi, 16(%rsp,%rax,4)
	movl	%ecx, 16(%rsp,%r11,4)
	testl	%edx, %edx
	jg	.L7
	jmp	.L10
	.p2align 4,,10
	.p2align 3
.L8:
	movl	0(%r13,%rbx,4), %edx
	movq	%r12, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	addq	$1, %rbx
	call	__printf_chk@PLT
	cmpl	%ebx, 12(%rsp)
	jle	.L10
.L9:
	movl	$32, %edi
	call	putchar@PLT
.L7:
	cmpl	%ebx, %ebp
	jne	.L8
	movl	$91, %edi
	call	putchar@PLT
	movl	0(%r13,%rbx,4), %edx
	movq	%r12, %rsi
	xorl	%eax, %eax
	movl	$1, %edi
	addq	$1, %rbx
	call	__printf_chk@PLT
	movl	$93, %edi
	call	putchar@PLT
	cmpl	%ebx, 12(%rsp)
	jg	.L9
	.p2align 4,,10
	.p2align 3
.L10:
	movl	$10, %edi
	call	putchar@PLT
	movq	400024(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L20
	addq	$400040, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
.L12:
	.cfi_restore_state
	orl	$-1, %esi
	jmp	.L4
.L20:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```
rule
```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	leaq	-397312(%rsp), %r11
	.cfi_def_cfa 11, 397352
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$2728, %rsp
	.cfi_def_cfa_offset 400080
	leaq	.LC0(%rip), %r12
	movq	%r12, %rdi
	movq	%fs:40, %rax
	movq	%rax, 400024(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %edx
	testl	%edx, %edx
	jle	.L2
	leaq	16(%rsp), %rbp
	xorl	%ebx, %ebx
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%rbp, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %edx
	addq	$4, %rbp
	cmpl	%ebx, %edx
	jg	.L3
.L2:
	leal	-1(%rdx), %eax
	movslq	%eax, %r11
	movl	16(%rsp,%r11,4), %r8d
	testl	%eax, %eax
	jle	.L12
	leal	-2(%rdx), %ecx
	leaq	16(%rsp), %rax
	movl	$-1, %esi
	leaq	20(%rsp,%rcx,4), %r9
	.p2align 4,,10
	.p2align 3
.L6:
	movl	(%rax), %ecx
	cmpl	%r8d, %ecx
	jg	.L5
	addl	$1, %esi
	movslq	%esi, %rdi
	movl	16(%rsp,%rdi,4), %r10d
	movl	%ecx, 16(%rsp,%rdi,4)
	movl	%r10d, (%rax)
.L5:
	addq	$4, %rax
	cmpq	%r9, %rax
	jne	.L6
.L4:
	leal	1(%rsi), %ebp
	movl	16(%rsp,%r11,4), %esi
	xorl	%ebx, %ebx
	leaq	16(%rsp), %r13
	movslq	%ebp, %rax
	movl	16(%rsp,%rax,4), %ecx
	movl	%esi, 16(%rsp,%rax,4)
	movl	%ecx, 16(%rsp,%r11,4)
	testl	%edx, %edx
	jg	.L7
	jmp	.L10
	.p2align 4,,10
	.p2align 3
.L8:
	movl	0(%r13,%rbx,4), %edx
	movq	%r12, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	addq	$1, %rbx
	call	__printf_chk@PLT
	cmpl	%ebx, 12(%rsp)
	jle	.L10
.L9:
	movl	$32, %edi
	call	putchar@PLT
.L7:
	cmpl	%ebx, %ebp
	jne	.L8
	movl	$91, %edi
	call	putchar@PLT
	movl	0(%r13,%rbx,4), %edx
	movq	%r12, %rsi
	xorl	%eax, %eax
	movl	$1, %edi
	addq	$1, %rbx
	call	__printf_chk@PLT
	movl	$93, %edi
	call	putchar@PLT
	cmpl	%ebx, 12(%rsp)
	jg	.L9
	.p2align 4,,10
	.p2align 3
.L10:
	movl	$10, %edi
	call	putchar@PLT
	movq	400024(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L20
	addq	$400040, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
.L12:
	.cfi_restore_state
	orl	$-1, %esi
	jmp	.L4
.L20:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```
```c
#include<stdio.h>

int main(){
  int i,j,n,A[100000],x,r,p,q,temp;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }
  r=n-1;/*rは配列Aの最後の要素を指す添字*/
  p=0;
  x=A[r];
  i=-1;
  for(j=p;j<=r-1;j++){
    if(A[j]<=x){
      i++;
      temp=A[i];
      A[i]=A[j];
      A[j]=temp;
    }
  }
  temp=A[i+1];
  A[i+1]=A[r];
  A[r]=temp;
  q=i+1;
  for(i=0;i<n;i++){
    if(i>0)printf(" ");
    if(i==q)printf("[");
    printf("%d",A[i]);
    if(i==q)printf("]");
  }
  printf("\n");
  return 0;
}
  
      
  

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

```c
#include<stdio.h>

int main(){
  int i,j,n,A[100000],x,r,p,q,temp;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }
  r=n-1;/*rは配列Aの最後の要素を指す添字*/
  p=0;
  x=A[r];
  i=-1;
  for(j=p;j<=r-1;j++){
    if(A[j]<=x){
      i++;
      temp=A[i];
      A[i]=A[j];
      A[j]=temp;
    }
  }
  temp=A[i+1];
  A[i+1]=A[r];
  A[r]=temp;
  q=i+1;
  for(i=0;i<n;i++){
    if(i>0)printf(" ");
    if(i==q)printf("[");
    printf("%d",A[i]);
    if(i==q)printf("]");
  }
  printf("\n");
  return 0;
}
  
      
  

```

Only output the optimized assembly code. Do not include any other text. Do not write any comments in the assembly code. Wrap the assembly code in ```assembly``` tags.
Optimized Assembly Code:

12
13 19 9 5 12 8 7 4 21 2 10 11
 12
13 19 9 5 12 8 7 4 21 2 10 18
 12
13 19 9 5 12 8 7 4 21 0 10 18
 12
13 19 9 5 12 8 7 4 37 0 10 18
 12
13 19 9 5 12 8 7 4 13 0 10 18
 12
25 19 9 5 12 8 7 4 13 0 10 18
 12
25 19 9 5 12 8 7 4 13 -1 10 18
 12
25 19 9 9 12 8 7 4 13 -1 10 18
 12
25 19 9 9 12 8 7 4 13 -1 10 22
 12
23 19 9 9 12 8 7 4 13 -1 10 22

9 5 8 7 4 2 10 [11] 21 13 19 12
 13 9 5 12 8 7 4 2 10 [18] 21 19
 13 9 5 12 8 7 4 0 10 [18] 21 19
 13 9 5 12 8 7 4 0 10 [18] 37 19
 13 9 5 12 8 7 4 13 0 10 [18] 19
 9 5 12 8 7 4 13 0 10 [18] 25 19
 9 5 12 8 7 4 13 -1 10 [18] 25 19
 9 9 12 8 7 4 13 -1 10 [18] 25 19
 19 9 9 12 8 7 4 13 -1 10 [22] 25
 19 9 9 12 8 7 4 13 -1 10 [22] 23

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

```c
#include<stdio.h>

int main(){
  int i,j,n,A[100000],x,r,p,q,temp;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }
  r=n-1;/*rは配列Aの最後の要素を指す添字*/
  p=0;
  x=A[r];
  i=-1;
  for(j=p;j<=r-1;j++){
    if(A[j]<=x){
      i++;
      temp=A[i];
      A[i]=A[j];
      A[j]=temp;
    }
  }
  temp=A[i+1];
  A[i+1]=A[r];
  A[r]=temp;
  q=i+1;
  for(i=0;i<n;i++){
    if(i>0)printf(" ");
    if(i==q)printf("[");
    printf("%d",A[i]);
    if(i==q)printf("]");
  }
  printf("\n");
  return 0;
}
  
      
  

```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	leaq	-397312(%rsp), %r11
	.cfi_def_cfa 11, 397352
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$2728, %rsp
	.cfi_def_cfa_offset 400080
	leaq	.LC0(%rip), %r12
	movq	%r12, %rdi
	movq	%fs:40, %rax
	movq	%rax, 400024(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %edx
	testl	%edx, %edx
	jle	.L2
	leaq	16(%rsp), %rbp
	xorl	%ebx, %ebx
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%rbp, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %edx
	addq	$4, %rbp
	cmpl	%ebx, %edx
	jg	.L3
.L2:
	leal	-1(%rdx), %eax
	movslq	%eax, %r11
	movl	16(%rsp,%r11,4), %r8d
	testl	%eax, %eax
	jle	.L12
	leal	-2(%rdx), %ecx
	leaq	16(%rsp), %rax
	movl	$-1, %esi
	leaq	20(%rsp,%rcx,4), %r9
	.p2align 4,,10
	.p2align 3
.L6:
	movl	(%rax), %ecx
	cmpl	%r8d, %ecx
	jg	.L5
	addl	$1, %esi
	movslq	%esi, %rdi
	movl	16(%rsp,%rdi,4), %r10d
	movl	%ecx, 16(%rsp,%rdi,4)
	movl	%r10d, (%rax)
.L5:
	addq	$4, %rax
	cmpq	%r9, %rax
	jne	.L6
.L4:
	leal	1(%rsi), %ebp
	movl	16(%rsp,%r11,4), %esi
	xorl	%ebx, %ebx
	leaq	16(%rsp), %r13
	movslq	%ebp, %rax
	movl	16(%rsp,%rax,4), %ecx
	movl	%esi, 16(%rsp,%rax,4)
	movl	%ecx, 16(%rsp,%r11,4)
	testl	%edx, %edx
	jg	.L7
	jmp	.L10
	.p2align 4,,10
	.p2align 3
.L8:
	movl	0(%r13,%rbx,4), %edx
	movq	%r12, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	addq	$1, %rbx
	call	__printf_chk@PLT
	cmpl	%ebx, 12(%rsp)
	jle	.L10
.L9:
	movl	$32, %edi
	call	putchar@PLT
.L7:
	cmpl	%ebx, %ebp
	jne	.L8
	movl	$91, %edi
	call	putchar@PLT
	movl	0(%r13,%rbx,4), %edx
	movq	%r12, %rsi
	xorl	%eax, %eax
	movl	$1, %edi
	addq	$1, %rbx
	call	__printf_chk@PLT
	movl	$93, %edi
	call	putchar@PLT
	cmpl	%ebx, 12(%rsp)
	jg	.L9
	.p2align 4,,10
	.p2align 3
.L10:
	movl	$10, %edi
	call	putchar@PLT
	movq	400024(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L20
	addq	$400040, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
.L12:
	.cfi_restore_state
	orl	$-1, %esi
	jmp	.L4
.L20:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```

Only output the optimized assembly code. Do not include any other text. Do not write any comments in the assembly code. Wrap the assembly code in ```assembly``` tags.
Optimized Assembly Code:

train
```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	leaq	-397312(%rsp), %r11
	.cfi_def_cfa 11, 397352
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$2728, %rsp
	.cfi_def_cfa_offset 400080
	leaq	.LC0(%rip), %r12
	movq	%r12, %rdi
	movq	%fs:40, %rax
	movq	%rax, 400024(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %edx
	testl	%edx, %edx
	jle	.L2
	leaq	16(%rsp), %rbp
	xorl	%ebx, %ebx
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%rbp, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %edx
	addq	$4, %rbp
	cmpl	%ebx, %edx
	jg	.L3
.L2:
	leal	-1(%rdx), %eax
	movslq	%eax, %r11
	movl	16(%rsp,%r11,4), %r8d
	testl	%eax, %eax
	jle	.L12
	leal	-2(%rdx), %ecx
	leaq	16(%rsp), %rax
	movl	$-1, %esi
	leaq	20(%rsp,%rcx,4), %r9
	.p2align 4,,10
	.p2align 3
.L6:
	movl	(%rax), %ecx
	cmpl	%r8d, %ecx
	jg	.L5
	addl	$1, %esi
	movslq	%esi, %rdi
	movl	16(%rsp,%rdi,4), %r10d
	movl	%ecx, 16(%rsp,%rdi,4)
	movl	%r10d, (%rax)
.L5:
	addq	$4, %rax
	cmpq	%r9, %rax
	jne	.L6
.L4:
	leal	1(%rsi), %ebp
	movl	16(%rsp,%r11,4), %esi
	xorl	%ebx, %ebx
	leaq	16(%rsp), %r13
	movslq	%ebp, %rax
	movl	16(%rsp,%rax,4), %ecx
	movl	%esi, 16(%rsp,%rax,4)
	movl	%ecx, 16(%rsp,%r11,4)
	testl	%edx, %edx
	jg	.L7
	jmp	.L10
	.p2align 4,,10
	.p2align 3
.L8:
	movl	0(%r13,%rbx,4), %edx
	movq	%r12, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	addq	$1, %rbx
	call	__printf_chk@PLT
	cmpl	%ebx, 12(%rsp)
	jle	.L10
.L9:
	movl	$32, %edi
	call	putchar@PLT
.L7:
	cmpl	%ebx, %ebp
	jne	.L8
	movl	$91, %edi
	call	putchar@PLT
	movl	0(%r13,%rbx,4), %edx
	movq	%r12, %rsi
	xorl	%eax, %eax
	movl	$1, %edi
	addq	$1, %rbx
	call	__printf_chk@PLT
	movl	$93, %edi
	call	putchar@PLT
	cmpl	%ebx, 12(%rsp)
	jg	.L9
	.p2align 4,,10
	.p2align 3
.L10:
	movl	$10, %edi
	call	putchar@PLT
	movq	400024(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L20
	addq	$400040, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
.L12:
	.cfi_restore_state
	orl	$-1, %esi
	jmp	.L4
.L20:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```