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>
#include <string.h>
#include <stdlib.h>

int i,j,k,n,m,sss,sssss,dist[200];
char ppp,seat[200],next[200];


int main(){
	while(scanf("%d %d%*c",&n,&m)*n){
		for(k=0;k<n;k++){
			seat[k]='#';
			next[k]='#';
			dist[k]=99999;
		}
		seat[n]='\0';

		for(k=0;k<m;k++){
			scanf("%c%*c",&ppp);

			sss=-1;sssss=-1;
			switch(ppp){
				case 'A':
					for(i=0;i<n;i++){if(seat[i]=='#'){sss=i;break;}}
				break;
				case 'B':
					for(i=n-1;i>=0;i--){
						if(seat[i]=='#' && next[i]!='A'){sss=i;break;}
						if(sssss<0 && seat[i]=='#')sssss=i;
					}
					if(sss==-1)sss=sssss;
				break;
				case 'C':
					if(k==0)sss=n/2;
					else{
						for(i=0;i<n;i++){
							if(seat[i]!='#'){
								if(i+1<n && seat[i+1]=='#'){sss=i+1;break;}
								if(i-1>=0 && seat[i-1]=='#'){sss=i-1;break;}
							}
						}
					}
				break;
				case 'D':
					sssss=0;
					for(i=0;i<n;i++){
						if(dist[i]>sssss){sss=i;sssss=dist[i];}
					}
				break;
			}

			seat[sss]=ppp;
			if(sss>0)next[sss-1]=ppp;
			next[sss+1]=ppp;
			for(i=0;sss-i>=0;i++){if(dist[sss-i]>i)dist[sss-i]=i; else break;}
			for(i=1;sss+i<n;i++){if(dist[sss+i]>i)dist[sss+i]=i; else break;}


			//for(i=0;i<n;i++){printf("%c",seat[i]);}printf("\n");
			//for(i=0;i<n;i++){printf("%c",next[i]);}printf("\n");
			//for(i=0;i<n;i++){printf("%d",dist[i]);}printf("\n");
		}
		
		printf("%s\n",seat);
	}
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	i
	.bss
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.globl	j
	.align 4
	.type	j, @object
	.size	j, 4
j:
	.zero	4
	.globl	k
	.align 4
	.type	k, @object
	.size	k, 4
k:
	.zero	4
	.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	sss
	.align 4
	.type	sss, @object
	.size	sss, 4
sss:
	.zero	4
	.globl	sssss
	.align 4
	.type	sssss, @object
	.size	sssss, 4
sssss:
	.zero	4
	.globl	dist
	.align 32
	.type	dist, @object
	.size	dist, 800
dist:
	.zero	800
	.globl	ppp
	.type	ppp, @object
	.size	ppp, 1
ppp:
	.zero	1
	.globl	seat
	.align 32
	.type	seat, @object
	.size	seat, 200
seat:
	.zero	200
	.globl	next
	.align 32
	.type	next, @object
	.size	next, 200
next:
	.zero	200
	.section	.rodata
.LC0:
	.string	"%c%*c"
.LC1:
	.string	"%d %d%*c"
	.text
	.globl	main
	.type	main, @function
main:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	jmp	.L2
.L42:
	movl	$0, k(%rip)
	jmp	.L3
.L4:
	movl	k(%rip), %eax
	cltq
	leaq	seat(%rip), %rdx
	movb	$35, (%rax,%rdx)
	movl	k(%rip), %eax
	cltq
	leaq	next(%rip), %rdx
	movb	$35, (%rax,%rdx)
	movl	k(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	dist(%rip), %rax
	movl	$99999, (%rdx,%rax)
	movl	k(%rip), %eax
	addl	$1, %eax
	movl	%eax, k(%rip)
.L3:
	movl	k(%rip), %edx
	movl	n(%rip), %eax
	cmpl	%eax, %edx
	jl	.L4
	movl	n(%rip), %eax
	cltq
	leaq	seat(%rip), %rdx
	movb	$0, (%rax,%rdx)
	movl	$0, k(%rip)
	jmp	.L5
.L41:
	leaq	ppp(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$-1, sss(%rip)
	movl	$-1, sssss(%rip)
	movzbl	ppp(%rip), %eax
	movsbl	%al, %eax
	cmpl	$68, %eax
	je	.L6
	cmpl	$68, %eax
	jg	.L7
	cmpl	$67, %eax
	je	.L8
	cmpl	$67, %eax
	jg	.L7
	cmpl	$65, %eax
	je	.L9
	cmpl	$66, %eax
	je	.L10
	jmp	.L7
.L9:
	movl	$0, i(%rip)
	jmp	.L11
.L14:
	movl	i(%rip), %eax
	cltq
	leaq	seat(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	cmpb	$35, %al
	jne	.L12
	movl	i(%rip), %eax
	movl	%eax, sss(%rip)
	nop
	jmp	.L7
.L12:
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L11:
	movl	i(%rip), %edx
	movl	n(%rip), %eax
	cmpl	%eax, %edx
	jl	.L14
	jmp	.L7
.L10:
	movl	n(%rip), %eax
	subl	$1, %eax
	movl	%eax, i(%rip)
	jmp	.L15
.L19:
	movl	i(%rip), %eax
	cltq
	leaq	seat(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	cmpb	$35, %al
	jne	.L16
	movl	i(%rip), %eax
	cltq
	leaq	next(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	cmpb	$65, %al
	je	.L16
	movl	i(%rip), %eax
	movl	%eax, sss(%rip)
	jmp	.L17
.L16:
	movl	sssss(%rip), %eax
	testl	%eax, %eax
	jns	.L18
	movl	i(%rip), %eax
	cltq
	leaq	seat(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	cmpb	$35, %al
	jne	.L18
	movl	i(%rip), %eax
	movl	%eax, sssss(%rip)
.L18:
	movl	i(%rip), %eax
	subl	$1, %eax
	movl	%eax, i(%rip)
.L15:
	movl	i(%rip), %eax
	testl	%eax, %eax
	jns	.L19
.L17:
	movl	sss(%rip), %eax
	cmpl	$-1, %eax
	jne	.L44
	movl	sssss(%rip), %eax
	movl	%eax, sss(%rip)
	jmp	.L44
.L8:
	movl	k(%rip), %eax
	testl	%eax, %eax
	jne	.L21
	movl	n(%rip), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, sss(%rip)
	jmp	.L7
.L21:
	movl	$0, i(%rip)
	jmp	.L23
.L26:
	movl	i(%rip), %eax
	cltq
	leaq	seat(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	cmpb	$35, %al
	je	.L24
	movl	i(%rip), %eax
	leal	1(%rax), %edx
	movl	n(%rip), %eax
	cmpl	%eax, %edx
	jge	.L25
	movl	i(%rip), %eax
	addl	$1, %eax
	cltq
	leaq	seat(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	cmpb	$35, %al
	jne	.L25
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, sss(%rip)
	jmp	.L22
.L25:
	movl	i(%rip), %eax
	testl	%eax, %eax
	jle	.L24
	movl	i(%rip), %eax
	subl	$1, %eax
	cltq
	leaq	seat(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	cmpb	$35, %al
	jne	.L24
	movl	i(%rip), %eax
	subl	$1, %eax
	movl	%eax, sss(%rip)
	jmp	.L22
.L24:
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L23:
	movl	i(%rip), %edx
	movl	n(%rip), %eax
	cmpl	%eax, %edx
	jl	.L26
	jmp	.L7
.L22:
	jmp	.L7
.L6:
	movl	$0, sssss(%rip)
	movl	$0, i(%rip)
	jmp	.L27
.L29:
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	dist(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	sssss(%rip), %eax
	cmpl	%eax, %edx
	jle	.L28
	movl	i(%rip), %eax
	movl	%eax, sss(%rip)
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	dist(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, sssss(%rip)
.L28:
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L27:
	movl	i(%rip), %edx
	movl	n(%rip), %eax
	cmpl	%eax, %edx
	jl	.L29
	jmp	.L7
.L44:
	nop
.L7:
	movl	sss(%rip), %eax
	movzbl	ppp(%rip), %edx
	cltq
	leaq	seat(%rip), %rcx
	movb	%dl, (%rax,%rcx)
	movl	sss(%rip), %eax
	testl	%eax, %eax
	jle	.L30
	movl	sss(%rip), %eax
	subl	$1, %eax
	movzbl	ppp(%rip), %edx
	cltq
	leaq	next(%rip), %rcx
	movb	%dl, (%rax,%rcx)
.L30:
	movl	sss(%rip), %eax
	addl	$1, %eax
	movzbl	ppp(%rip), %edx
	cltq
	leaq	next(%rip), %rcx
	movb	%dl, (%rax,%rcx)
	movl	$0, i(%rip)
	jmp	.L31
.L35:
	movl	sss(%rip), %eax
	movl	i(%rip), %edx
	subl	%edx, %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	dist(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	i(%rip), %eax
	cmpl	%eax, %edx
	jle	.L45
	movl	sss(%rip), %eax
	movl	i(%rip), %ecx
	subl	%ecx, %eax
	movl	%eax, %edx
	movl	i(%rip), %eax
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	dist(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L31:
	movl	sss(%rip), %eax
	movl	i(%rip), %edx
	subl	%edx, %eax
	testl	%eax, %eax
	jns	.L35
	jmp	.L34
.L45:
	nop
.L34:
	movl	$1, i(%rip)
	jmp	.L36
.L40:
	movl	sss(%rip), %edx
	movl	i(%rip), %eax
	addl	%edx, %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	dist(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	i(%rip), %eax
	cmpl	%eax, %edx
	jle	.L46
	movl	sss(%rip), %edx
	movl	i(%rip), %eax
	addl	%eax, %edx
	movl	i(%rip), %eax
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	dist(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L36:
	movl	sss(%rip), %edx
	movl	i(%rip), %eax
	addl	%eax, %edx
	movl	n(%rip), %eax
	cmpl	%eax, %edx
	jl	.L40
	jmp	.L39
.L46:
	nop
.L39:
	movl	k(%rip), %eax
	addl	$1, %eax
	movl	%eax, k(%rip)
.L5:
	movl	k(%rip), %edx
	movl	m(%rip), %eax
	cmpl	%eax, %edx
	jl	.L41
	leaq	seat(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
.L2:
	leaq	m(%rip), %rax
	movq	%rax, %rdx
	leaq	n(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	n(%rip), %edx
	imull	%edx, %eax
	testl	%eax, %eax
	jne	.L42
	movl	$0, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```

Only output the optimized assembly code. Do not include any other text. Do not write any comments in the assembly code. Wrap the assembly code in ```assembly``` tags.
user
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC1:
	.string	"%c%*c"
.LC2:
	.string	"%d %d%*c"
	.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
	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	$8, %rsp
	.cfi_def_cfa_offset 64
	.p2align 4,,10
	.p2align 3
.L2:
	leaq	m(%rip), %rdx
	leaq	n(%rip), %rsi
	xorl	%eax, %eax
	leaq	.LC2(%rip), %rdi
	call	__isoc99_scanf@PLT
	movl	n(%rip), %ebx
	imull	%ebx, %eax
	testl	%eax, %eax
	je	.L100
	leaq	seat(%rip), %r13
	testl	%ebx, %ebx
	jle	.L3
	movl	%ebx, %r12d
	movl	$35, %esi
	movq	%r13, %rdi
	movq	%r12, %rdx
	leaq	next(%rip), %r15
	call	memset@PLT
	movq	%r12, %rdx
	movl	$35, %esi
	movq	%r15, %rdi
	call	memset@PLT
	leal	-1(%rbx), %eax
	cmpl	$2, %eax
	jbe	.L54
	movl	%ebx, %edx
	leaq	dist(%rip), %rcx
	shrl	$2, %edx
	leaq	16(%rcx), %rsi
	movq	%rcx, %rax
	subl	$1, %edx
	salq	$4, %rdx
	addq	%rsi, %rdx
	.p2align 4,,10
	.p2align 3
.L5:
	movdqa	.LC0(%rip), %xmm0
	addq	$16, %rax
	movaps	%xmm0, -16(%rax)
	cmpq	%rdx, %rax
	jne	.L5
	movl	%ebx, %eax
	andl	$-4, %eax
	testb	$3, %bl
	je	.L3
.L4:
	movslq	%eax, %rdx
	movl	$99999, (%rcx,%rdx,4)
	leal	1(%rax), %edx
	cmpl	%edx, %ebx
	jle	.L3
	movslq	%edx, %rdx
	addl	$2, %eax
	movl	$99999, (%rcx,%rdx,4)
	cmpl	%ebx, %eax
	jge	.L3
	cltq
	movl	$99999, (%rcx,%rax,4)
.L3:
	movl	m(%rip), %eax
	movslq	%ebx, %rbx
	movl	$0, k(%rip)
	leaq	next(%rip), %r15
	movb	$0, 0(%r13,%rbx)
	leaq	ppp(%rip), %r12
	leaq	dist(%rip), %rbx
	testl	%eax, %eax
	jle	.L49
	.p2align 4,,10
	.p2align 3
.L7:
	movq	%r12, %rsi
	leaq	.LC1(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movzbl	ppp(%rip), %edx
	movl	$-1, sss(%rip)
	movl	$-1, sssss(%rip)
	cmpb	$67, %dl
	je	.L8
	jg	.L9
	cmpb	$65, %dl
	je	.L10
	cmpb	$66, %dl
	jne	.L12
	movl	n(%rip), %esi
	movl	%esi, %eax
	subl	$1, %eax
	js	.L101
	cltq
	xorl	%edi, %edi
	movl	$-1, %ecx
	jmp	.L26
	.p2align 4,,10
	.p2align 3
.L21:
	subq	$1, %rax
	testl	%eax, %eax
	js	.L102
.L26:
	cmpb	$35, 0(%r13,%rax)
	movl	%eax, %ebp
	jne	.L21
	cmpb	$65, (%r15,%rax)
	jne	.L103
	testl	%ecx, %ecx
	jns	.L21
	movl	%eax, %ecx
	subq	$1, %rax
	movl	$1, %edi
	testl	%eax, %eax
	jns	.L26
	.p2align 4,,10
	.p2align 3
.L102:
	testb	%dil, %dil
	je	.L62
	movl	%ecx, sssss(%rip)
	leal	1(%rcx), %eax
.L51:
	movl	k(%rip), %edi
.L52:
	movl	%ecx, %ebp
	movl	%edi, %r8d
	movl	%ecx, sss(%rip)
	movslq	%ebp, %rdi
	movb	%dl, 0(%r13,%rdi)
	testl	%ebp, %ebp
	jg	.L33
.L39:
	movslq	%eax, %rcx
	movb	%dl, (%r15,%rcx)
	je	.L40
	.p2align 4,,10
	.p2align 3
.L41:
	movl	$1, i(%rip)
	xorl	%ecx, %ecx
	movl	$1, %edx
	cmpl	%esi, %eax
	jl	.L45
	jmp	.L46
	.p2align 4,,10
	.p2align 3
.L47:
	movl	%edx, (%rbx,%rax,4)
	addl	$1, %edx
	movl	$1, %ecx
	leal	0(%rbp,%rdx), %eax
	cmpl	%eax, %esi
	jle	.L104
	movl	%edx, %r14d
.L45:
	cltq
	cmpl	%edx, (%rbx,%rax,4)
	jg	.L47
	testb	%cl, %cl
	je	.L46
	movl	%r14d, i(%rip)
.L46:
	addl	$1, %r8d
	cmpl	m(%rip), %r8d
	movl	%r8d, k(%rip)
	jl	.L7
.L49:
	movq	%r13, %rdi
	call	puts@PLT
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L9:
	cmpb	$68, %dl
	jne	.L12
	movl	n(%rip), %esi
	movl	k(%rip), %r8d
	movl	$0, sssss(%rip)
	testl	%esi, %esi
	jle	.L15
	movslq	%esi, %r9
	xorl	%eax, %eax
	xorl	%r10d, %r10d
	xorl	%edi, %edi
	.p2align 4,,10
	.p2align 3
.L37:
	movl	(%rbx,%rax,4), %ecx
	cmpl	%edi, %ecx
	jle	.L36
	movl	%eax, %ebp
	movl	%ecx, %edi
	movl	$1, %r10d
.L36:
	addq	$1, %rax
	cmpq	%rax, %r9
	jne	.L37
	testb	%r10b, %r10b
	je	.L38
	movl	%ebp, sss(%rip)
	leal	1(%rbp), %eax
	movl	%edi, sssss(%rip)
.L18:
	movslq	%ebp, %rdi
	movb	%dl, 0(%r13,%rdi)
	testl	%ebp, %ebp
	jle	.L39
.L33:
	leal	-1(%rbp), %ecx
	movslq	%ecx, %rcx
	movb	%dl, (%r15,%rcx)
	movslq	%eax, %rcx
	movb	%dl, (%r15,%rcx)
.L40:
	leaq	(%rbx,%rdi,4), %rcx
	xorl	%edx, %edx
	leal	1(%rbp), %edi
	jmp	.L44
	.p2align 4,,10
	.p2align 3
.L105:
	movl	%edx, (%rcx)
	addl	$1, %edx
	subq	$4, %rcx
	cmpl	%edx, %edi
	je	.L41
.L44:
	cmpl	%edx, (%rcx)
	jg	.L105
	jmp	.L41
	.p2align 4,,10
	.p2align 3
.L104:
	movl	%edx, i(%rip)
	jmp	.L46
	.p2align 4,,10
	.p2align 3
.L12:
	movb	%dl, -1+seat(%rip)
	movl	k(%rip), %r8d
	movl	n(%rip), %esi
.L98:
	movb	%dl, (%r15)
	xorl	%eax, %eax
	movl	$-1, %ebp
	jmp	.L41
	.p2align 4,,10
	.p2align 3
.L10:
	movl	n(%rip), %esi
	movl	k(%rip), %r8d
	testl	%esi, %esi
	jle	.L15
	leaq	seat(%rip), %rcx
	xorl	%eax, %eax
	jmp	.L19
	.p2align 4,,10
	.p2align 3
.L16:
	addq	$1, %rcx
	cmpl	%eax, %esi
	je	.L15
.L19:
	movl	%eax, %ebp
	addl	$1, %eax
	cmpb	$35, (%rcx)
	jne	.L16
	movl	%ebp, sss(%rip)
	jmp	.L18
	.p2align 4,,10
	.p2align 3
.L8:
	movl	k(%rip), %r8d
	movl	n(%rip), %esi
	testl	%r8d, %r8d
	jne	.L28
	movl	%esi, %ebp
	shrl	$31, %ebp
	addl	%esi, %ebp
	sarl	%ebp
	movl	%ebp, sss(%rip)
.L97:
	leal	1(%rbp), %eax
	jmp	.L18
.L28:
	testl	%esi, %esi
	jle	.L15
	leaq	seat(%rip), %rdi
	movslq	%esi, %r10
	xorl	%ecx, %ecx
	xorl	%r9d, %r9d
	.p2align 4,,10
	.p2align 3
.L35:
	cmpb	$35, (%rdi)
	movl	%r9d, %eax
	leal	1(%r9), %r9d
	je	.L29
	cmpl	%esi, %r9d
	jge	.L30
	cmpb	$35, 1(%rdi)
	je	.L106
.L30:
	testq	%rcx, %rcx
	je	.L29
	cmpb	$35, -1(%rdi)
	leal	-1(%rcx), %ebp
	je	.L107
.L29:
	addq	$1, %rcx
	addq	$1, %rdi
	cmpq	%rcx, %r10
	jne	.L35
	.p2align 4,,10
	.p2align 3
.L15:
	movb	%dl, -1+seat(%rip)
	xorl	%eax, %eax
	movl	$-1, %ebp
	movb	%dl, (%r15)
	jmp	.L41
.L103:
	testb	%dil, %dil
	je	.L56
	movl	%ecx, sssss(%rip)
.L23:
	movl	k(%rip), %r8d
	movl	%ebp, sss(%rip)
	movl	%r8d, %edi
	cmpl	$-1, %ebp
	jne	.L97
	leal	1(%rcx), %eax
	jmp	.L52
	.p2align 4,,10
	.p2align 3
.L62:
	xorl	%eax, %eax
	movl	$-1, %ecx
	jmp	.L51
.L56:
	movl	$-1, %ecx
	jmp	.L23
.L38:
	movb	$68, -1+seat(%rip)
	jmp	.L98
.L100:
	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
.L107:
	.cfi_restore_state
	movslq	%ebp, %rdi
	movl	%ebp, sss(%rip)
	movb	$67, 0(%r13,%rdi)
	testl	%ebp, %ebp
	jne	.L33
	movslq	%eax, %rdx
	movb	$67, (%r15,%rdx)
	jmp	.L40
	.p2align 4,,10
	.p2align 3
.L101:
	movb	$66, -1+seat(%rip)
	movl	k(%rip), %r8d
	jmp	.L98
.L54:
	xorl	%eax, %eax
	leaq	dist(%rip), %rcx
	jmp	.L4
.L106:
	movslq	%r9d, %rdi
	movl	%r9d, sss(%rip)
	addl	$2, %eax
	movl	%r9d, %ebp
	movb	%dl, 0(%r13,%rdi)
	jmp	.L33
	.cfi_endproc
.LFE51:
	.size	main, .-main
	.globl	next
	.bss
	.align 32
	.type	next, @object
	.size	next, 200
next:
	.zero	200
	.globl	seat
	.align 32
	.type	seat, @object
	.size	seat, 200
seat:
	.zero	200
	.globl	ppp
	.type	ppp, @object
	.size	ppp, 1
ppp:
	.zero	1
	.globl	dist
	.align 32
	.type	dist, @object
	.size	dist, 800
dist:
	.zero	800
	.globl	sssss
	.align 4
	.type	sssss, @object
	.size	sssss, 4
sssss:
	.zero	4
	.globl	sss
	.align 4
	.type	sss, @object
	.size	sss, 4
sss:
	.zero	4
	.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	k
	.align 4
	.type	k, @object
	.size	k, 4
k:
	.zero	4
	.globl	j
	.align 4
	.type	j, @object
	.size	j, 4
j:
	.zero	4
	.globl	i
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC0:
	.long	99999
	.long	99999
	.long	99999
	.long	99999
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:

rule
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC1:
	.string	"%c%*c"
.LC2:
	.string	"%d %d%*c"
	.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
	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	$8, %rsp
	.cfi_def_cfa_offset 64
	.p2align 4,,10
	.p2align 3
.L2:
	leaq	m(%rip), %rdx
	leaq	n(%rip), %rsi
	xorl	%eax, %eax
	leaq	.LC2(%rip), %rdi
	call	__isoc99_scanf@PLT
	movl	n(%rip), %ebx
	imull	%ebx, %eax
	testl	%eax, %eax
	je	.L100
	leaq	seat(%rip), %r13
	testl	%ebx, %ebx
	jle	.L3
	movl	%ebx, %r12d
	movl	$35, %esi
	movq	%r13, %rdi
	movq	%r12, %rdx
	leaq	next(%rip), %r15
	call	memset@PLT
	movq	%r12, %rdx
	movl	$35, %esi
	movq	%r15, %rdi
	call	memset@PLT
	leal	-1(%rbx), %eax
	cmpl	$2, %eax
	jbe	.L54
	movl	%ebx, %edx
	leaq	dist(%rip), %rcx
	shrl	$2, %edx
	leaq	16(%rcx), %rsi
	movq	%rcx, %rax
	subl	$1, %edx
	salq	$4, %rdx
	addq	%rsi, %rdx
	.p2align 4,,10
	.p2align 3
.L5:
	movdqa	.LC0(%rip), %xmm0
	addq	$16, %rax
	movaps	%xmm0, -16(%rax)
	cmpq	%rdx, %rax
	jne	.L5
	movl	%ebx, %eax
	andl	$-4, %eax
	testb	$3, %bl
	je	.L3
.L4:
	movslq	%eax, %rdx
	movl	$99999, (%rcx,%rdx,4)
	leal	1(%rax), %edx
	cmpl	%edx, %ebx
	jle	.L3
	movslq	%edx, %rdx
	addl	$2, %eax
	movl	$99999, (%rcx,%rdx,4)
	cmpl	%ebx, %eax
	jge	.L3
	cltq
	movl	$99999, (%rcx,%rax,4)
.L3:
	movl	m(%rip), %eax
	movslq	%ebx, %rbx
	movl	$0, k(%rip)
	leaq	next(%rip), %r15
	movb	$0, 0(%r13,%rbx)
	leaq	ppp(%rip), %r12
	leaq	dist(%rip), %rbx
	testl	%eax, %eax
	jle	.L49
	.p2align 4,,10
	.p2align 3
.L7:
	movq	%r12, %rsi
	leaq	.LC1(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movzbl	ppp(%rip), %edx
	movl	$-1, sss(%rip)
	movl	$-1, sssss(%rip)
	cmpb	$67, %dl
	je	.L8
	jg	.L9
	cmpb	$65, %dl
	je	.L10
	cmpb	$66, %dl
	jne	.L12
	movl	n(%rip), %esi
	movl	%esi, %eax
	subl	$1, %eax
	js	.L101
	cltq
	xorl	%edi, %edi
	movl	$-1, %ecx
	jmp	.L26
	.p2align 4,,10
	.p2align 3
.L21:
	subq	$1, %rax
	testl	%eax, %eax
	js	.L102
.L26:
	cmpb	$35, 0(%r13,%rax)
	movl	%eax, %ebp
	jne	.L21
	cmpb	$65, (%r15,%rax)
	jne	.L103
	testl	%ecx, %ecx
	jns	.L21
	movl	%eax, %ecx
	subq	$1, %rax
	movl	$1, %edi
	testl	%eax, %eax
	jns	.L26
	.p2align 4,,10
	.p2align 3
.L102:
	testb	%dil, %dil
	je	.L62
	movl	%ecx, sssss(%rip)
	leal	1(%rcx), %eax
.L51:
	movl	k(%rip), %edi
.L52:
	movl	%ecx, %ebp
	movl	%edi, %r8d
	movl	%ecx, sss(%rip)
	movslq	%ebp, %rdi
	movb	%dl, 0(%r13,%rdi)
	testl	%ebp, %ebp
	jg	.L33
.L39:
	movslq	%eax, %rcx
	movb	%dl, (%r15,%rcx)
	je	.L40
	.p2align 4,,10
	.p2align 3
.L41:
	movl	$1, i(%rip)
	xorl	%ecx, %ecx
	movl	$1, %edx
	cmpl	%esi, %eax
	jl	.L45
	jmp	.L46
	.p2align 4,,10
	.p2align 3
.L47:
	movl	%edx, (%rbx,%rax,4)
	addl	$1, %edx
	movl	$1, %ecx
	leal	0(%rbp,%rdx), %eax
	cmpl	%eax, %esi
	jle	.L104
	movl	%edx, %r14d
.L45:
	cltq
	cmpl	%edx, (%rbx,%rax,4)
	jg	.L47
	testb	%cl, %cl
	je	.L46
	movl	%r14d, i(%rip)
.L46:
	addl	$1, %r8d
	cmpl	m(%rip), %r8d
	movl	%r8d, k(%rip)
	jl	.L7
.L49:
	movq	%r13, %rdi
	call	puts@PLT
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L9:
	cmpb	$68, %dl
	jne	.L12
	movl	n(%rip), %esi
	movl	k(%rip), %r8d
	movl	$0, sssss(%rip)
	testl	%esi, %esi
	jle	.L15
	movslq	%esi, %r9
	xorl	%eax, %eax
	xorl	%r10d, %r10d
	xorl	%edi, %edi
	.p2align 4,,10
	.p2align 3
.L37:
	movl	(%rbx,%rax,4), %ecx
	cmpl	%edi, %ecx
	jle	.L36
	movl	%eax, %ebp
	movl	%ecx, %edi
	movl	$1, %r10d
.L36:
	addq	$1, %rax
	cmpq	%rax, %r9
	jne	.L37
	testb	%r10b, %r10b
	je	.L38
	movl	%ebp, sss(%rip)
	leal	1(%rbp), %eax
	movl	%edi, sssss(%rip)
.L18:
	movslq	%ebp, %rdi
	movb	%dl, 0(%r13,%rdi)
	testl	%ebp, %ebp
	jle	.L39
.L33:
	leal	-1(%rbp), %ecx
	movslq	%ecx, %rcx
	movb	%dl, (%r15,%rcx)
	movslq	%eax, %rcx
	movb	%dl, (%r15,%rcx)
.L40:
	leaq	(%rbx,%rdi,4), %rcx
	xorl	%edx, %edx
	leal	1(%rbp), %edi
	jmp	.L44
	.p2align 4,,10
	.p2align 3
.L105:
	movl	%edx, (%rcx)
	addl	$1, %edx
	subq	$4, %rcx
	cmpl	%edx, %edi
	je	.L41
.L44:
	cmpl	%edx, (%rcx)
	jg	.L105
	jmp	.L41
	.p2align 4,,10
	.p2align 3
.L104:
	movl	%edx, i(%rip)
	jmp	.L46
	.p2align 4,,10
	.p2align 3
.L12:
	movb	%dl, -1+seat(%rip)
	movl	k(%rip), %r8d
	movl	n(%rip), %esi
.L98:
	movb	%dl, (%r15)
	xorl	%eax, %eax
	movl	$-1, %ebp
	jmp	.L41
	.p2align 4,,10
	.p2align 3
.L10:
	movl	n(%rip), %esi
	movl	k(%rip), %r8d
	testl	%esi, %esi
	jle	.L15
	leaq	seat(%rip), %rcx
	xorl	%eax, %eax
	jmp	.L19
	.p2align 4,,10
	.p2align 3
.L16:
	addq	$1, %rcx
	cmpl	%eax, %esi
	je	.L15
.L19:
	movl	%eax, %ebp
	addl	$1, %eax
	cmpb	$35, (%rcx)
	jne	.L16
	movl	%ebp, sss(%rip)
	jmp	.L18
	.p2align 4,,10
	.p2align 3
.L8:
	movl	k(%rip), %r8d
	movl	n(%rip), %esi
	testl	%r8d, %r8d
	jne	.L28
	movl	%esi, %ebp
	shrl	$31, %ebp
	addl	%esi, %ebp
	sarl	%ebp
	movl	%ebp, sss(%rip)
.L97:
	leal	1(%rbp), %eax
	jmp	.L18
.L28:
	testl	%esi, %esi
	jle	.L15
	leaq	seat(%rip), %rdi
	movslq	%esi, %r10
	xorl	%ecx, %ecx
	xorl	%r9d, %r9d
	.p2align 4,,10
	.p2align 3
.L35:
	cmpb	$35, (%rdi)
	movl	%r9d, %eax
	leal	1(%r9), %r9d
	je	.L29
	cmpl	%esi, %r9d
	jge	.L30
	cmpb	$35, 1(%rdi)
	je	.L106
.L30:
	testq	%rcx, %rcx
	je	.L29
	cmpb	$35, -1(%rdi)
	leal	-1(%rcx), %ebp
	je	.L107
.L29:
	addq	$1, %rcx
	addq	$1, %rdi
	cmpq	%rcx, %r10
	jne	.L35
	.p2align 4,,10
	.p2align 3
.L15:
	movb	%dl, -1+seat(%rip)
	xorl	%eax, %eax
	movl	$-1, %ebp
	movb	%dl, (%r15)
	jmp	.L41
.L103:
	testb	%dil, %dil
	je	.L56
	movl	%ecx, sssss(%rip)
.L23:
	movl	k(%rip), %r8d
	movl	%ebp, sss(%rip)
	movl	%r8d, %edi
	cmpl	$-1, %ebp
	jne	.L97
	leal	1(%rcx), %eax
	jmp	.L52
	.p2align 4,,10
	.p2align 3
.L62:
	xorl	%eax, %eax
	movl	$-1, %ecx
	jmp	.L51
.L56:
	movl	$-1, %ecx
	jmp	.L23
.L38:
	movb	$68, -1+seat(%rip)
	jmp	.L98
.L100:
	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
.L107:
	.cfi_restore_state
	movslq	%ebp, %rdi
	movl	%ebp, sss(%rip)
	movb	$67, 0(%r13,%rdi)
	testl	%ebp, %ebp
	jne	.L33
	movslq	%eax, %rdx
	movb	$67, (%r15,%rdx)
	jmp	.L40
	.p2align 4,,10
	.p2align 3
.L101:
	movb	$66, -1+seat(%rip)
	movl	k(%rip), %r8d
	jmp	.L98
.L54:
	xorl	%eax, %eax
	leaq	dist(%rip), %rcx
	jmp	.L4
.L106:
	movslq	%r9d, %rdi
	movl	%r9d, sss(%rip)
	addl	$2, %eax
	movl	%r9d, %ebp
	movb	%dl, 0(%r13,%rdi)
	jmp	.L33
	.cfi_endproc
.LFE51:
	.size	main, .-main
	.globl	next
	.bss
	.align 32
	.type	next, @object
	.size	next, 200
next:
	.zero	200
	.globl	seat
	.align 32
	.type	seat, @object
	.size	seat, 200
seat:
	.zero	200
	.globl	ppp
	.type	ppp, @object
	.size	ppp, 1
ppp:
	.zero	1
	.globl	dist
	.align 32
	.type	dist, @object
	.size	dist, 800
dist:
	.zero	800
	.globl	sssss
	.align 4
	.type	sssss, @object
	.size	sssss, 4
sssss:
	.zero	4
	.globl	sss
	.align 4
	.type	sss, @object
	.size	sss, 4
sss:
	.zero	4
	.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	k
	.align 4
	.type	k, @object
	.size	k, 4
k:
	.zero	4
	.globl	j
	.align 4
	.type	j, @object
	.size	j, 4
j:
	.zero	4
	.globl	i
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC0:
	.long	99999
	.long	99999
	.long	99999
	.long	99999
	.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>
#include <string.h>
#include <stdlib.h>

int i,j,k,n,m,sss,sssss,dist[200];
char ppp,seat[200],next[200];


int main(){
	while(scanf("%d %d%*c",&n,&m)*n){
		for(k=0;k<n;k++){
			seat[k]='#';
			next[k]='#';
			dist[k]=99999;
		}
		seat[n]='\0';

		for(k=0;k<m;k++){
			scanf("%c%*c",&ppp);

			sss=-1;sssss=-1;
			switch(ppp){
				case 'A':
					for(i=0;i<n;i++){if(seat[i]=='#'){sss=i;break;}}
				break;
				case 'B':
					for(i=n-1;i>=0;i--){
						if(seat[i]=='#' && next[i]!='A'){sss=i;break;}
						if(sssss<0 && seat[i]=='#')sssss=i;
					}
					if(sss==-1)sss=sssss;
				break;
				case 'C':
					if(k==0)sss=n/2;
					else{
						for(i=0;i<n;i++){
							if(seat[i]!='#'){
								if(i+1<n && seat[i+1]=='#'){sss=i+1;break;}
								if(i-1>=0 && seat[i-1]=='#'){sss=i-1;break;}
							}
						}
					}
				break;
				case 'D':
					sssss=0;
					for(i=0;i<n;i++){
						if(dist[i]>sssss){sss=i;sssss=dist[i];}
					}
				break;
			}

			seat[sss]=ppp;
			if(sss>0)next[sss-1]=ppp;
			next[sss+1]=ppp;
			for(i=0;sss-i>=0;i++){if(dist[sss-i]>i)dist[sss-i]=i; else break;}
			for(i=1;sss+i<n;i++){if(dist[sss+i]>i)dist[sss+i]=i; else break;}


			//for(i=0;i<n;i++){printf("%c",seat[i]);}printf("\n");
			//for(i=0;i<n;i++){printf("%c",next[i]);}printf("\n");
			//for(i=0;i<n;i++){printf("%d",dist[i]);}printf("\n");
		}
		
		printf("%s\n",seat);
	}
	return 0;
}
5 4
A
C
C
D
5 4
D
C
B
A
0 0
 5 4
A
C
C
D
5 4
D
D
B
A
0 0
 5 4
A
C
C
D
4 4
D
C
B
A
0 0
 5 4
A
D
C
D
5 4
D
D
B
A
0 0
 5 4
A
C
C
D
4 4
D
C
C
A
0 0
 5 4
A
C
B
D
4 4
D
C
C
A
0 0
 5 4
A
C
C
D
4 4
D
B
B
A
0 0
 5 4
A
B
B
D
4 4
D
C
C
A
0 0
 5 4
A
C
D
D
4 4
D
B
B
A
0 0
 5 4
A
C
D
D
8 4
D
B
B
A
0 0

ACC#D
DCA#B
 ACC#D
DA#BD
 ACC#D
DCAB
 ACD#D
DA#BD
 ACC#D
DCCA
 ACD#B
DCCA
 ACC#D
DABB
 AD#BB
DCCA
 ACD#D
DABB
 ACD#D
DA####BB

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>
#include <string.h>
#include <stdlib.h>

int i,j,k,n,m,sss,sssss,dist[200];
char ppp,seat[200],next[200];


int main(){
	while(scanf("%d %d%*c",&n,&m)*n){
		for(k=0;k<n;k++){
			seat[k]='#';
			next[k]='#';
			dist[k]=99999;
		}
		seat[n]='\0';

		for(k=0;k<m;k++){
			scanf("%c%*c",&ppp);

			sss=-1;sssss=-1;
			switch(ppp){
				case 'A':
					for(i=0;i<n;i++){if(seat[i]=='#'){sss=i;break;}}
				break;
				case 'B':
					for(i=n-1;i>=0;i--){
						if(seat[i]=='#' && next[i]!='A'){sss=i;break;}
						if(sssss<0 && seat[i]=='#')sssss=i;
					}
					if(sss==-1)sss=sssss;
				break;
				case 'C':
					if(k==0)sss=n/2;
					else{
						for(i=0;i<n;i++){
							if(seat[i]!='#'){
								if(i+1<n && seat[i+1]=='#'){sss=i+1;break;}
								if(i-1>=0 && seat[i-1]=='#'){sss=i-1;break;}
							}
						}
					}
				break;
				case 'D':
					sssss=0;
					for(i=0;i<n;i++){
						if(dist[i]>sssss){sss=i;sssss=dist[i];}
					}
				break;
			}

			seat[sss]=ppp;
			if(sss>0)next[sss-1]=ppp;
			next[sss+1]=ppp;
			for(i=0;sss-i>=0;i++){if(dist[sss-i]>i)dist[sss-i]=i; else break;}
			for(i=1;sss+i<n;i++){if(dist[sss+i]>i)dist[sss+i]=i; else break;}


			//for(i=0;i<n;i++){printf("%c",seat[i]);}printf("\n");
			//for(i=0;i<n;i++){printf("%c",next[i]);}printf("\n");
			//for(i=0;i<n;i++){printf("%d",dist[i]);}printf("\n");
		}
		
		printf("%s\n",seat);
	}
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	i
	.bss
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.globl	j
	.align 4
	.type	j, @object
	.size	j, 4
j:
	.zero	4
	.globl	k
	.align 4
	.type	k, @object
	.size	k, 4
k:
	.zero	4
	.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	sss
	.align 4
	.type	sss, @object
	.size	sss, 4
sss:
	.zero	4
	.globl	sssss
	.align 4
	.type	sssss, @object
	.size	sssss, 4
sssss:
	.zero	4
	.globl	dist
	.align 32
	.type	dist, @object
	.size	dist, 800
dist:
	.zero	800
	.globl	ppp
	.type	ppp, @object
	.size	ppp, 1
ppp:
	.zero	1
	.globl	seat
	.align 32
	.type	seat, @object
	.size	seat, 200
seat:
	.zero	200
	.globl	next
	.align 32
	.type	next, @object
	.size	next, 200
next:
	.zero	200
	.section	.rodata
.LC0:
	.string	"%c%*c"
.LC1:
	.string	"%d %d%*c"
	.text
	.globl	main
	.type	main, @function
main:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	jmp	.L2
.L42:
	movl	$0, k(%rip)
	jmp	.L3
.L4:
	movl	k(%rip), %eax
	cltq
	leaq	seat(%rip), %rdx
	movb	$35, (%rax,%rdx)
	movl	k(%rip), %eax
	cltq
	leaq	next(%rip), %rdx
	movb	$35, (%rax,%rdx)
	movl	k(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	dist(%rip), %rax
	movl	$99999, (%rdx,%rax)
	movl	k(%rip), %eax
	addl	$1, %eax
	movl	%eax, k(%rip)
.L3:
	movl	k(%rip), %edx
	movl	n(%rip), %eax
	cmpl	%eax, %edx
	jl	.L4
	movl	n(%rip), %eax
	cltq
	leaq	seat(%rip), %rdx
	movb	$0, (%rax,%rdx)
	movl	$0, k(%rip)
	jmp	.L5
.L41:
	leaq	ppp(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$-1, sss(%rip)
	movl	$-1, sssss(%rip)
	movzbl	ppp(%rip), %eax
	movsbl	%al, %eax
	cmpl	$68, %eax
	je	.L6
	cmpl	$68, %eax
	jg	.L7
	cmpl	$67, %eax
	je	.L8
	cmpl	$67, %eax
	jg	.L7
	cmpl	$65, %eax
	je	.L9
	cmpl	$66, %eax
	je	.L10
	jmp	.L7
.L9:
	movl	$0, i(%rip)
	jmp	.L11
.L14:
	movl	i(%rip), %eax
	cltq
	leaq	seat(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	cmpb	$35, %al
	jne	.L12
	movl	i(%rip), %eax
	movl	%eax, sss(%rip)
	nop
	jmp	.L7
.L12:
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L11:
	movl	i(%rip), %edx
	movl	n(%rip), %eax
	cmpl	%eax, %edx
	jl	.L14
	jmp	.L7
.L10:
	movl	n(%rip), %eax
	subl	$1, %eax
	movl	%eax, i(%rip)
	jmp	.L15
.L19:
	movl	i(%rip), %eax
	cltq
	leaq	seat(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	cmpb	$35, %al
	jne	.L16
	movl	i(%rip), %eax
	cltq
	leaq	next(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	cmpb	$65, %al
	je	.L16
	movl	i(%rip), %eax
	movl	%eax, sss(%rip)
	jmp	.L17
.L16:
	movl	sssss(%rip), %eax
	testl	%eax, %eax
	jns	.L18
	movl	i(%rip), %eax
	cltq
	leaq	seat(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	cmpb	$35, %al
	jne	.L18
	movl	i(%rip), %eax
	movl	%eax, sssss(%rip)
.L18:
	movl	i(%rip), %eax
	subl	$1, %eax
	movl	%eax, i(%rip)
.L15:
	movl	i(%rip), %eax
	testl	%eax, %eax
	jns	.L19
.L17:
	movl	sss(%rip), %eax
	cmpl	$-1, %eax
	jne	.L44
	movl	sssss(%rip), %eax
	movl	%eax, sss(%rip)
	jmp	.L44
.L8:
	movl	k(%rip), %eax
	testl	%eax, %eax
	jne	.L21
	movl	n(%rip), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, sss(%rip)
	jmp	.L7
.L21:
	movl	$0, i(%rip)
	jmp	.L23
.L26:
	movl	i(%rip), %eax
	cltq
	leaq	seat(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	cmpb	$35, %al
	je	.L24
	movl	i(%rip), %eax
	leal	1(%rax), %edx
	movl	n(%rip), %eax
	cmpl	%eax, %edx
	jge	.L25
	movl	i(%rip), %eax
	addl	$1, %eax
	cltq
	leaq	seat(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	cmpb	$35, %al
	jne	.L25
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, sss(%rip)
	jmp	.L22
.L25:
	movl	i(%rip), %eax
	testl	%eax, %eax
	jle	.L24
	movl	i(%rip), %eax
	subl	$1, %eax
	cltq
	leaq	seat(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	cmpb	$35, %al
	jne	.L24
	movl	i(%rip), %eax
	subl	$1, %eax
	movl	%eax, sss(%rip)
	jmp	.L22
.L24:
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L23:
	movl	i(%rip), %edx
	movl	n(%rip), %eax
	cmpl	%eax, %edx
	jl	.L26
	jmp	.L7
.L22:
	jmp	.L7
.L6:
	movl	$0, sssss(%rip)
	movl	$0, i(%rip)
	jmp	.L27
.L29:
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	dist(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	sssss(%rip), %eax
	cmpl	%eax, %edx
	jle	.L28
	movl	i(%rip), %eax
	movl	%eax, sss(%rip)
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	dist(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, sssss(%rip)
.L28:
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L27:
	movl	i(%rip), %edx
	movl	n(%rip), %eax
	cmpl	%eax, %edx
	jl	.L29
	jmp	.L7
.L44:
	nop
.L7:
	movl	sss(%rip), %eax
	movzbl	ppp(%rip), %edx
	cltq
	leaq	seat(%rip), %rcx
	movb	%dl, (%rax,%rcx)
	movl	sss(%rip), %eax
	testl	%eax, %eax
	jle	.L30
	movl	sss(%rip), %eax
	subl	$1, %eax
	movzbl	ppp(%rip), %edx
	cltq
	leaq	next(%rip), %rcx
	movb	%dl, (%rax,%rcx)
.L30:
	movl	sss(%rip), %eax
	addl	$1, %eax
	movzbl	ppp(%rip), %edx
	cltq
	leaq	next(%rip), %rcx
	movb	%dl, (%rax,%rcx)
	movl	$0, i(%rip)
	jmp	.L31
.L35:
	movl	sss(%rip), %eax
	movl	i(%rip), %edx
	subl	%edx, %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	dist(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	i(%rip), %eax
	cmpl	%eax, %edx
	jle	.L45
	movl	sss(%rip), %eax
	movl	i(%rip), %ecx
	subl	%ecx, %eax
	movl	%eax, %edx
	movl	i(%rip), %eax
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	dist(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L31:
	movl	sss(%rip), %eax
	movl	i(%rip), %edx
	subl	%edx, %eax
	testl	%eax, %eax
	jns	.L35
	jmp	.L34
.L45:
	nop
.L34:
	movl	$1, i(%rip)
	jmp	.L36
.L40:
	movl	sss(%rip), %edx
	movl	i(%rip), %eax
	addl	%edx, %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	dist(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	i(%rip), %eax
	cmpl	%eax, %edx
	jle	.L46
	movl	sss(%rip), %edx
	movl	i(%rip), %eax
	addl	%eax, %edx
	movl	i(%rip), %eax
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	dist(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L36:
	movl	sss(%rip), %edx
	movl	i(%rip), %eax
	addl	%eax, %edx
	movl	n(%rip), %eax
	cmpl	%eax, %edx
	jl	.L40
	jmp	.L39
.L46:
	nop
.L39:
	movl	k(%rip), %eax
	addl	$1, %eax
	movl	%eax, k(%rip)
.L5:
	movl	k(%rip), %edx
	movl	m(%rip), %eax
	cmpl	%eax, %edx
	jl	.L41
	leaq	seat(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
.L2:
	leaq	m(%rip), %rax
	movq	%rax, %rdx
	leaq	n(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	n(%rip), %edx
	imull	%edx, %eax
	testl	%eax, %eax
	jne	.L42
	movl	$0, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.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	i
	.bss
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.globl	j
	.align 4
	.type	j, @object
	.size	j, 4
j:
	.zero	4
	.globl	k
	.align 4
	.type	k, @object
	.size	k, 4
k:
	.zero	4
	.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	sss
	.align 4
	.type	sss, @object
	.size	sss, 4
sss:
	.zero	4
	.globl	sssss
	.align 4
	.type	sssss, @object
	.size	sssss, 4
sssss:
	.zero	4
	.globl	dist
	.align 32
	.type	dist, @object
	.size	dist, 800
dist:
	.zero	800
	.globl	ppp
	.type	ppp, @object
	.size	ppp, 1
ppp:
	.zero	1
	.globl	seat
	.align 32
	.type	seat, @object
	.size	seat, 200
seat:
	.zero	200
	.globl	next
	.align 32
	.type	next, @object
	.size	next, 200
next:
	.zero	200
	.section	.rodata
.LC0:
	.string	"%c%*c"
.LC1:
	.string	"%d %d%*c"
	.text
	.globl	main
	.type	main, @function
main:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	jmp	.L2
.L42:
	movl	$0, k(%rip)
	jmp	.L3
.L4:
	movl	k(%rip), %eax
	cltq
	leaq	seat(%rip), %rdx
	movb	$35, (%rax,%rdx)
	movl	k(%rip), %eax
	cltq
	leaq	next(%rip), %rdx
	movb	$35, (%rax,%rdx)
	movl	k(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	dist(%rip), %rax
	movl	$99999, (%rdx,%rax)
	movl	k(%rip), %eax
	addl	$1, %eax
	movl	%eax, k(%rip)
.L3:
	movl	k(%rip), %edx
	movl	n(%rip), %eax
	cmpl	%eax, %edx
	jl	.L4
	movl	n(%rip), %eax
	cltq
	leaq	seat(%rip), %rdx
	movb	$0, (%rax,%rdx)
	movl	$0, k(%rip)
	jmp	.L5
.L41:
	leaq	ppp(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$-1, sss(%rip)
	movl	$-1, sssss(%rip)
	movzbl	ppp(%rip), %eax
	movsbl	%al, %eax
	cmpl	$68, %eax
	je	.L6
	cmpl	$68, %eax
	jg	.L7
	cmpl	$67, %eax
	je	.L8
	cmpl	$67, %eax
	jg	.L7
	cmpl	$65, %eax
	je	.L9
	cmpl	$66, %eax
	je	.L10
	jmp	.L7
.L9:
	movl	$0, i(%rip)
	jmp	.L11
.L14:
	movl	i(%rip), %eax
	cltq
	leaq	seat(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	cmpb	$35, %al
	jne	.L12
	movl	i(%rip), %eax
	movl	%eax, sss(%rip)
	nop
	jmp	.L7
.L12:
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L11:
	movl	i(%rip), %edx
	movl	n(%rip), %eax
	cmpl	%eax, %edx
	jl	.L14
	jmp	.L7
.L10:
	movl	n(%rip), %eax
	subl	$1, %eax
	movl	%eax, i(%rip)
	jmp	.L15
.L19:
	movl	i(%rip), %eax
	cltq
	leaq	seat(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	cmpb	$35, %al
	jne	.L16
	movl	i(%rip), %eax
	cltq
	leaq	next(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	cmpb	$65, %al
	je	.L16
	movl	i(%rip), %eax
	movl	%eax, sss(%rip)
	jmp	.L17
.L16:
	movl	sssss(%rip), %eax
	testl	%eax, %eax
	jns	.L18
	movl	i(%rip), %eax
	cltq
	leaq	seat(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	cmpb	$35, %al
	jne	.L18
	movl	i(%rip), %eax
	movl	%eax, sssss(%rip)
.L18:
	movl	i(%rip), %eax
	subl	$1, %eax
	movl	%eax, i(%rip)
.L15:
	movl	i(%rip), %eax
	testl	%eax, %eax
	jns	.L19
.L17:
	movl	sss(%rip), %eax
	cmpl	$-1, %eax
	jne	.L44
	movl	sssss(%rip), %eax
	movl	%eax, sss(%rip)
	jmp	.L44
.L8:
	movl	k(%rip), %eax
	testl	%eax, %eax
	jne	.L21
	movl	n(%rip), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, sss(%rip)
	jmp	.L7
.L21:
	movl	$0, i(%rip)
	jmp	.L23
.L26:
	movl	i(%rip), %eax
	cltq
	leaq	seat(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	cmpb	$35, %al
	je	.L24
	movl	i(%rip), %eax
	leal	1(%rax), %edx
	movl	n(%rip), %eax
	cmpl	%eax, %edx
	jge	.L25
	movl	i(%rip), %eax
	addl	$1, %eax
	cltq
	leaq	seat(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	cmpb	$35, %al
	jne	.L25
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, sss(%rip)
	jmp	.L22
.L25:
	movl	i(%rip), %eax
	testl	%eax, %eax
	jle	.L24
	movl	i(%rip), %eax
	subl	$1, %eax
	cltq
	leaq	seat(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	cmpb	$35, %al
	jne	.L24
	movl	i(%rip), %eax
	subl	$1, %eax
	movl	%eax, sss(%rip)
	jmp	.L22
.L24:
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L23:
	movl	i(%rip), %edx
	movl	n(%rip), %eax
	cmpl	%eax, %edx
	jl	.L26
	jmp	.L7
.L22:
	jmp	.L7
.L6:
	movl	$0, sssss(%rip)
	movl	$0, i(%rip)
	jmp	.L27
.L29:
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	dist(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	sssss(%rip), %eax
	cmpl	%eax, %edx
	jle	.L28
	movl	i(%rip), %eax
	movl	%eax, sss(%rip)
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	dist(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, sssss(%rip)
.L28:
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L27:
	movl	i(%rip), %edx
	movl	n(%rip), %eax
	cmpl	%eax, %edx
	jl	.L29
	jmp	.L7
.L44:
	nop
.L7:
	movl	sss(%rip), %eax
	movzbl	ppp(%rip), %edx
	cltq
	leaq	seat(%rip), %rcx
	movb	%dl, (%rax,%rcx)
	movl	sss(%rip), %eax
	testl	%eax, %eax
	jle	.L30
	movl	sss(%rip), %eax
	subl	$1, %eax
	movzbl	ppp(%rip), %edx
	cltq
	leaq	next(%rip), %rcx
	movb	%dl, (%rax,%rcx)
.L30:
	movl	sss(%rip), %eax
	addl	$1, %eax
	movzbl	ppp(%rip), %edx
	cltq
	leaq	next(%rip), %rcx
	movb	%dl, (%rax,%rcx)
	movl	$0, i(%rip)
	jmp	.L31
.L35:
	movl	sss(%rip), %eax
	movl	i(%rip), %edx
	subl	%edx, %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	dist(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	i(%rip), %eax
	cmpl	%eax, %edx
	jle	.L45
	movl	sss(%rip), %eax
	movl	i(%rip), %ecx
	subl	%ecx, %eax
	movl	%eax, %edx
	movl	i(%rip), %eax
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	dist(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L31:
	movl	sss(%rip), %eax
	movl	i(%rip), %edx
	subl	%edx, %eax
	testl	%eax, %eax
	jns	.L35
	jmp	.L34
.L45:
	nop
.L34:
	movl	$1, i(%rip)
	jmp	.L36
.L40:
	movl	sss(%rip), %edx
	movl	i(%rip), %eax
	addl	%edx, %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	dist(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	i(%rip), %eax
	cmpl	%eax, %edx
	jle	.L46
	movl	sss(%rip), %edx
	movl	i(%rip), %eax
	addl	%eax, %edx
	movl	i(%rip), %eax
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	dist(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L36:
	movl	sss(%rip), %edx
	movl	i(%rip), %eax
	addl	%eax, %edx
	movl	n(%rip), %eax
	cmpl	%eax, %edx
	jl	.L40
	jmp	.L39
.L46:
	nop
.L39:
	movl	k(%rip), %eax
	addl	$1, %eax
	movl	%eax, k(%rip)
.L5:
	movl	k(%rip), %edx
	movl	m(%rip), %eax
	cmpl	%eax, %edx
	jl	.L41
	leaq	seat(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
.L2:
	leaq	m(%rip), %rax
	movq	%rax, %rdx
	leaq	n(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	n(%rip), %edx
	imull	%edx, %eax
	testl	%eax, %eax
	jne	.L42
	movl	$0, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.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:
