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>
#include <string.h>
#include <stdlib.h>
 
int i,n,loc,left,right;
char logg[2000],order[60];
 
int main(){
    for(scanf("%d",&n);n>0;n--){
        scanf("%s",logg);
        loc=30;left=30;right=30;
        order[30]=logg[0];
        for(i=1;i<(signed)strlen(logg);i+=3){
            if(logg[i]=='<'){
                if(loc==left)left--;
                loc--;
            }
            else{
                if(loc==right)right++;
                loc++;
            }
            order[loc]=logg[i+2];
        }
        for(i=left;i<=right;i++){printf("%c",order[i]);}
        printf("\n");
    }
 
    return 0;
}```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%s"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB51:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	n(%rip), %rsi
	leaq	.LC0(%rip), %rdi
	xorl	%eax, %eax
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	call	__isoc99_scanf@PLT
	movl	n(%rip), %eax
	testl	%eax, %eax
	jle	.L18
	leaq	logg(%rip), %rbp
	leaq	order(%rip), %r12
	leaq	2(%rbp), %r13
	.p2align 4,,10
	.p2align 3
.L2:
	movq	%rbp, %rsi
	xorl	%eax, %eax
	movl	$1, %r15d
	movl	$30, %ebx
	leaq	.LC1(%rip), %rdi
	movl	$30, %r14d
	call	__isoc99_scanf@PLT
	movzbl	0(%rbp), %eax
	movl	$30, loc(%rip)
	movl	$30, left(%rip)
	movl	$30, right(%rip)
	movb	%al, 30+order(%rip)
	movl	$30, 12(%rsp)
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L4:
	cmpl	%r14d, 12(%rsp)
	jne	.L7
	addl	$1, 12(%rsp)
	movl	12(%rsp), %eax
	movl	%eax, right(%rip)
.L7:
	addl	$1, %r14d
.L6:
	movzbl	0(%r13,%r15), %esi
	movslq	%r14d, %rax
	addq	$3, %r15
	movl	%r14d, loc(%rip)
	movb	%sil, (%r12,%rax)
.L3:
	movq	%rbp, %rdi
	movl	%r15d, i(%rip)
	call	strlen@PLT
	cmpl	%r15d, %eax
	jle	.L21
	cmpb	$60, 0(%rbp,%r15)
	jne	.L4
	cmpl	%r14d, %ebx
	jne	.L5
	subl	$1, %ebx
	movl	%ebx, left(%rip)
.L5:
	subl	$1, %r14d
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L21:
	movl	%ebx, i(%rip)
	cmpl	12(%rsp), %ebx
	jg	.L11
	.p2align 4,,10
	.p2align 3
.L9:
	movslq	%ebx, %rbx
	movsbl	(%r12,%rbx), %edi
	call	putchar@PLT
	movl	i(%rip), %eax
	leal	1(%rax), %ebx
	cmpl	right(%rip), %ebx
	movl	%ebx, i(%rip)
	jle	.L9
.L11:
	movl	$10, %edi
	call	putchar@PLT
	movl	n(%rip), %eax
	subl	$1, %eax
	movl	%eax, n(%rip)
	testl	%eax, %eax
	jg	.L2
.L18:
	addq	$24, %rsp
	.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
	.cfi_endproc
.LFE51:
	.size	main, .-main
	.globl	order
	.bss
	.align 32
	.type	order, @object
	.size	order, 60
order:
	.zero	60
	.globl	logg
	.align 32
	.type	logg, @object
	.size	logg, 2000
logg:
	.zero	2000
	.globl	right
	.align 4
	.type	right, @object
	.size	right, 4
right:
	.zero	4
	.globl	left
	.align 4
	.type	left, @object
	.size	left, 4
left:
	.zero	4
	.globl	loc
	.align 4
	.type	loc, @object
	.size	loc, 4
loc:
	.zero	4
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	i
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.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:
```

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

user
```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%s"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB51:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	n(%rip), %rsi
	leaq	.LC0(%rip), %rdi
	xorl	%eax, %eax
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	call	__isoc99_scanf@PLT
	movl	n(%rip), %eax
	testl	%eax, %eax
	jle	.L18
	leaq	logg(%rip), %rbp
	leaq	order(%rip), %r12
	leaq	2(%rbp), %r13
	.p2align 4,,10
	.p2align 3
.L2:
	movq	%rbp, %rsi
	xorl	%eax, %eax
	movl	$1, %r15d
	movl	$30, %ebx
	leaq	.LC1(%rip), %rdi
	movl	$30, %r14d
	call	__isoc99_scanf@PLT
	movzbl	0(%rbp), %eax
	movl	$30, loc(%rip)
	movl	$30, left(%rip)
	movl	$30, right(%rip)
	movb	%al, 30+order(%rip)
	movl	$30, 12(%rsp)
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L4:
	cmpl	%r14d, 12(%rsp)
	jne	.L7
	addl	$1, 12(%rsp)
	movl	12(%rsp), %eax
	movl	%eax, right(%rip)
.L7:
	addl	$1, %r14d
.L6:
	movzbl	0(%r13,%r15), %esi
	movslq	%r14d, %rax
	addq	$3, %r15
	movl	%r14d, loc(%rip)
	movb	%sil, (%r12,%rax)
.L3:
	movq	%rbp, %rdi
	movl	%r15d, i(%rip)
	call	strlen@PLT
	cmpl	%r15d, %eax
	jle	.L21
	cmpb	$60, 0(%rbp,%r15)
	jne	.L4
	cmpl	%r14d, %ebx
	jne	.L5
	subl	$1, %ebx
	movl	%ebx, left(%rip)
.L5:
	subl	$1, %r14d
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L21:
	movl	%ebx, i(%rip)
	cmpl	12(%rsp), %ebx
	jg	.L11
	.p2align 4,,10
	.p2align 3
.L9:
	movslq	%ebx, %rbx
	movsbl	(%r12,%rbx), %edi
	call	putchar@PLT
	movl	i(%rip), %eax
	leal	1(%rax), %ebx
	cmpl	right(%rip), %ebx
	movl	%ebx, i(%rip)
	jle	.L9
.L11:
	movl	$10, %edi
	call	putchar@PLT
	movl	n(%rip), %eax
	subl	$1, %eax
	movl	%eax, n(%rip)
	testl	%eax, %eax
	jg	.L2
.L18:
	addq	$24, %rsp
	.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
	.cfi_endproc
.LFE51:
	.size	main, .-main
	.globl	order
	.bss
	.align 32
	.type	order, @object
	.size	order, 60
order:
	.zero	60
	.globl	logg
	.align 32
	.type	logg, @object
	.size	logg, 2000
logg:
	.zero	2000
	.globl	right
	.align 4
	.type	right, @object
	.size	right, 4
right:
	.zero	4
	.globl	left
	.align 4
	.type	left, @object
	.size	left, 4
left:
	.zero	4
	.globl	loc
	.align 4
	.type	loc, @object
	.size	loc, 4
loc:
	.zero	4
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	i
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.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
```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%s"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB51:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	n(%rip), %rsi
	leaq	.LC0(%rip), %rdi
	xorl	%eax, %eax
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	call	__isoc99_scanf@PLT
	movl	n(%rip), %eax
	testl	%eax, %eax
	jle	.L18
	leaq	logg(%rip), %rbp
	leaq	order(%rip), %r12
	leaq	2(%rbp), %r13
	.p2align 4,,10
	.p2align 3
.L2:
	movq	%rbp, %rsi
	xorl	%eax, %eax
	movl	$1, %r15d
	movl	$30, %ebx
	leaq	.LC1(%rip), %rdi
	movl	$30, %r14d
	call	__isoc99_scanf@PLT
	movzbl	0(%rbp), %eax
	movl	$30, loc(%rip)
	movl	$30, left(%rip)
	movl	$30, right(%rip)
	movb	%al, 30+order(%rip)
	movl	$30, 12(%rsp)
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L4:
	cmpl	%r14d, 12(%rsp)
	jne	.L7
	addl	$1, 12(%rsp)
	movl	12(%rsp), %eax
	movl	%eax, right(%rip)
.L7:
	addl	$1, %r14d
.L6:
	movzbl	0(%r13,%r15), %esi
	movslq	%r14d, %rax
	addq	$3, %r15
	movl	%r14d, loc(%rip)
	movb	%sil, (%r12,%rax)
.L3:
	movq	%rbp, %rdi
	movl	%r15d, i(%rip)
	call	strlen@PLT
	cmpl	%r15d, %eax
	jle	.L21
	cmpb	$60, 0(%rbp,%r15)
	jne	.L4
	cmpl	%r14d, %ebx
	jne	.L5
	subl	$1, %ebx
	movl	%ebx, left(%rip)
.L5:
	subl	$1, %r14d
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L21:
	movl	%ebx, i(%rip)
	cmpl	12(%rsp), %ebx
	jg	.L11
	.p2align 4,,10
	.p2align 3
.L9:
	movslq	%ebx, %rbx
	movsbl	(%r12,%rbx), %edi
	call	putchar@PLT
	movl	i(%rip), %eax
	leal	1(%rax), %ebx
	cmpl	right(%rip), %ebx
	movl	%ebx, i(%rip)
	jle	.L9
.L11:
	movl	$10, %edi
	call	putchar@PLT
	movl	n(%rip), %eax
	subl	$1, %eax
	movl	%eax, n(%rip)
	testl	%eax, %eax
	jg	.L2
.L18:
	addq	$24, %rsp
	.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
	.cfi_endproc
.LFE51:
	.size	main, .-main
	.globl	order
	.bss
	.align 32
	.type	order, @object
	.size	order, 60
order:
	.zero	60
	.globl	logg
	.align 32
	.type	logg, @object
	.size	logg, 2000
logg:
	.zero	2000
	.globl	right
	.align 4
	.type	right, @object
	.size	right, 4
right:
	.zero	4
	.globl	left
	.align 4
	.type	left, @object
	.size	left, 4
left:
	.zero	4
	.globl	loc
	.align 4
	.type	loc, @object
	.size	loc, 4
loc:
	.zero	4
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	i
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.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:
```
```c
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
 
int i,n,loc,left,right;
char logg[2000],order[60];
 
int main(){
    for(scanf("%d",&n);n>0;n--){
        scanf("%s",logg);
        loc=30;left=30;right=30;
        order[30]=logg[0];
        for(i=1;i<(signed)strlen(logg);i+=3){
            if(logg[i]=='<'){
                if(loc==left)left--;
                loc--;
            }
            else{
                if(loc==right)right++;
                loc++;
            }
            order[loc]=logg[i+2];
        }
        for(i=left;i<=right;i++){printf("%c",order[i]);}
        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>
#include <string.h>
#include <stdlib.h>
 
int i,n,loc,left,right;
char logg[2000],order[60];
 
int main(){
    for(scanf("%d",&n);n>0;n--){
        scanf("%s",logg);
        loc=30;left=30;right=30;
        order[30]=logg[0];
        for(i=1;i<(signed)strlen(logg);i+=3){
            if(logg[i]=='<'){
                if(loc==left)left--;
                loc--;
            }
            else{
                if(loc==right)right++;
                loc++;
            }
            order[loc]=logg[i+2];
        }
        for(i=left;i<=right;i++){printf("%c",order[i]);}
        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:

4
a->f->c->b->d
b
 4
a->e->c->b->d
a
 4
a->f->c->b->d
a
 4
a->f->c->b->d
`
 4
a->e->c->b->d
c
 4
a->f->c->b->d
c
 4
`->f->c->b->d
c
 4
`->f->c->b->d
d
 4
a->e->c->b->d
d
 4
a->e->c->b->d
`

afcbd
b
b
b
 aecbd
a
a
a
 afcbd
a
a
a
 afcbd
`
`
`
 aecbd
c
c
c
 afcbd
c
c
c
 `fcbd
c
c
c
 `fcbd
d
d
d
 aecbd
d
d
d
 aecbd
`
`
`

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>
#include <string.h>
#include <stdlib.h>
 
int i,n,loc,left,right;
char logg[2000],order[60];
 
int main(){
    for(scanf("%d",&n);n>0;n--){
        scanf("%s",logg);
        loc=30;left=30;right=30;
        order[30]=logg[0];
        for(i=1;i<(signed)strlen(logg);i+=3){
            if(logg[i]=='<'){
                if(loc==left)left--;
                loc--;
            }
            else{
                if(loc==right)right++;
                loc++;
            }
            order[loc]=logg[i+2];
        }
        for(i=left;i<=right;i++){printf("%c",order[i]);}
        printf("\n");
    }
 
    return 0;
}```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%s"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB51:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	n(%rip), %rsi
	leaq	.LC0(%rip), %rdi
	xorl	%eax, %eax
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	call	__isoc99_scanf@PLT
	movl	n(%rip), %eax
	testl	%eax, %eax
	jle	.L18
	leaq	logg(%rip), %rbp
	leaq	order(%rip), %r12
	leaq	2(%rbp), %r13
	.p2align 4,,10
	.p2align 3
.L2:
	movq	%rbp, %rsi
	xorl	%eax, %eax
	movl	$1, %r15d
	movl	$30, %ebx
	leaq	.LC1(%rip), %rdi
	movl	$30, %r14d
	call	__isoc99_scanf@PLT
	movzbl	0(%rbp), %eax
	movl	$30, loc(%rip)
	movl	$30, left(%rip)
	movl	$30, right(%rip)
	movb	%al, 30+order(%rip)
	movl	$30, 12(%rsp)
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L4:
	cmpl	%r14d, 12(%rsp)
	jne	.L7
	addl	$1, 12(%rsp)
	movl	12(%rsp), %eax
	movl	%eax, right(%rip)
.L7:
	addl	$1, %r14d
.L6:
	movzbl	0(%r13,%r15), %esi
	movslq	%r14d, %rax
	addq	$3, %r15
	movl	%r14d, loc(%rip)
	movb	%sil, (%r12,%rax)
.L3:
	movq	%rbp, %rdi
	movl	%r15d, i(%rip)
	call	strlen@PLT
	cmpl	%r15d, %eax
	jle	.L21
	cmpb	$60, 0(%rbp,%r15)
	jne	.L4
	cmpl	%r14d, %ebx
	jne	.L5
	subl	$1, %ebx
	movl	%ebx, left(%rip)
.L5:
	subl	$1, %r14d
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L21:
	movl	%ebx, i(%rip)
	cmpl	12(%rsp), %ebx
	jg	.L11
	.p2align 4,,10
	.p2align 3
.L9:
	movslq	%ebx, %rbx
	movsbl	(%r12,%rbx), %edi
	call	putchar@PLT
	movl	i(%rip), %eax
	leal	1(%rax), %ebx
	cmpl	right(%rip), %ebx
	movl	%ebx, i(%rip)
	jle	.L9
.L11:
	movl	$10, %edi
	call	putchar@PLT
	movl	n(%rip), %eax
	subl	$1, %eax
	movl	%eax, n(%rip)
	testl	%eax, %eax
	jg	.L2
.L18:
	addq	$24, %rsp
	.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
	.cfi_endproc
.LFE51:
	.size	main, .-main
	.globl	order
	.bss
	.align 32
	.type	order, @object
	.size	order, 60
order:
	.zero	60
	.globl	logg
	.align 32
	.type	logg, @object
	.size	logg, 2000
logg:
	.zero	2000
	.globl	right
	.align 4
	.type	right, @object
	.size	right, 4
right:
	.zero	4
	.globl	left
	.align 4
	.type	left, @object
	.size	left, 4
left:
	.zero	4
	.globl	loc
	.align 4
	.type	loc, @object
	.size	loc, 4
loc:
	.zero	4
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	i
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.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:
```

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

train
```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%s"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB51:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	n(%rip), %rsi
	leaq	.LC0(%rip), %rdi
	xorl	%eax, %eax
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	call	__isoc99_scanf@PLT
	movl	n(%rip), %eax
	testl	%eax, %eax
	jle	.L18
	leaq	logg(%rip), %rbp
	leaq	order(%rip), %r12
	leaq	2(%rbp), %r13
	.p2align 4,,10
	.p2align 3
.L2:
	movq	%rbp, %rsi
	xorl	%eax, %eax
	movl	$1, %r15d
	movl	$30, %ebx
	leaq	.LC1(%rip), %rdi
	movl	$30, %r14d
	call	__isoc99_scanf@PLT
	movzbl	0(%rbp), %eax
	movl	$30, loc(%rip)
	movl	$30, left(%rip)
	movl	$30, right(%rip)
	movb	%al, 30+order(%rip)
	movl	$30, 12(%rsp)
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L4:
	cmpl	%r14d, 12(%rsp)
	jne	.L7
	addl	$1, 12(%rsp)
	movl	12(%rsp), %eax
	movl	%eax, right(%rip)
.L7:
	addl	$1, %r14d
.L6:
	movzbl	0(%r13,%r15), %esi
	movslq	%r14d, %rax
	addq	$3, %r15
	movl	%r14d, loc(%rip)
	movb	%sil, (%r12,%rax)
.L3:
	movq	%rbp, %rdi
	movl	%r15d, i(%rip)
	call	strlen@PLT
	cmpl	%r15d, %eax
	jle	.L21
	cmpb	$60, 0(%rbp,%r15)
	jne	.L4
	cmpl	%r14d, %ebx
	jne	.L5
	subl	$1, %ebx
	movl	%ebx, left(%rip)
.L5:
	subl	$1, %r14d
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L21:
	movl	%ebx, i(%rip)
	cmpl	12(%rsp), %ebx
	jg	.L11
	.p2align 4,,10
	.p2align 3
.L9:
	movslq	%ebx, %rbx
	movsbl	(%r12,%rbx), %edi
	call	putchar@PLT
	movl	i(%rip), %eax
	leal	1(%rax), %ebx
	cmpl	right(%rip), %ebx
	movl	%ebx, i(%rip)
	jle	.L9
.L11:
	movl	$10, %edi
	call	putchar@PLT
	movl	n(%rip), %eax
	subl	$1, %eax
	movl	%eax, n(%rip)
	testl	%eax, %eax
	jg	.L2
.L18:
	addq	$24, %rsp
	.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
	.cfi_endproc
.LFE51:
	.size	main, .-main
	.globl	order
	.bss
	.align 32
	.type	order, @object
	.size	order, 60
order:
	.zero	60
	.globl	logg
	.align 32
	.type	logg, @object
	.size	logg, 2000
logg:
	.zero	2000
	.globl	right
	.align 4
	.type	right, @object
	.size	right, 4
right:
	.zero	4
	.globl	left
	.align 4
	.type	left, @object
	.size	left, 4
left:
	.zero	4
	.globl	loc
	.align 4
	.type	loc, @object
	.size	loc, 4
loc:
	.zero	4
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	i
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.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:
```