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>
int W,N,P[105],i,j,k,w,n;
char c;

int ch(int s)
{
	int i,r=0;
	for(i=s;i<W&&P[i]==-1;i++)r++;
	return r;
}

int main()
{
	for(;scanf("%d%d\n",&W,&N),W;)
	{
		memset(P,-1,sizeof(P));
		for(i=0;i<N;i++)
		{
			scanf("%c",&c);
			if(c=='s')
			{
				scanf("%d%d\n",&n,&w);
				for(j=0;j<W;j++)
				{
					if(P[j]==-1&&ch(j)>=w)
					{
						for(k=0;k<w;k++)P[j+k]=n;
						printf("%d\n",j);
						break;
					}
				}
				if(j==W)puts("impossible");
			}
			else
			{
				scanf("%d\n",&n);
				for(j=0;j<W;j++)
					if(P[j]==n)P[j]=-1;
			}
		}
		puts("END");
	}
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	W
	.bss
	.align 4
	.type	W, @object
	.size	W, 4
W:
	.zero	4
	.globl	N
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	4
	.globl	P
	.align 32
	.type	P, @object
	.size	P, 420
P:
	.zero	420
	.globl	i
	.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	w
	.align 4
	.type	w, @object
	.size	w, 4
w:
	.zero	4
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	c
	.type	c, @object
	.size	c, 1
c:
	.zero	1
	.text
	.globl	ch
	.type	ch, @function
ch:
.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	$0, -4(%rbp)
	movl	-20(%rbp), %eax
	movl	%eax, -8(%rbp)
	jmp	.L2
.L4:
	addl	$1, -4(%rbp)
	addl	$1, -8(%rbp)
.L2:
	movl	W(%rip), %eax
	cmpl	%eax, -8(%rbp)
	jge	.L3
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	P(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	$-1, %eax
	je	.L4
.L3:
	movl	-4(%rbp), %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	ch, .-ch
	.section	.rodata
.LC0:
	.string	"%c"
.LC1:
	.string	"%d%d\n"
.LC2:
	.string	"%d\n"
.LC3:
	.string	"impossible"
.LC4:
	.string	"END"
	.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
	jmp	.L7
.L21:
	movl	$420, %edx
	movl	$-1, %esi
	leaq	P(%rip), %rax
	movq	%rax, %rdi
	call	memset@PLT
	movl	$0, i(%rip)
	jmp	.L8
.L20:
	leaq	c(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movzbl	c(%rip), %eax
	cmpb	$115, %al
	jne	.L9
	leaq	w(%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	$0, j(%rip)
	jmp	.L10
.L15:
	movl	j(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	P(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	$-1, %eax
	jne	.L11
	movl	j(%rip), %eax
	movl	%eax, %edi
	call	ch
	movl	w(%rip), %edx
	cmpl	%edx, %eax
	jl	.L11
	movl	$0, k(%rip)
	jmp	.L12
.L13:
	movl	j(%rip), %edx
	movl	k(%rip), %eax
	addl	%eax, %edx
	movl	n(%rip), %eax
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	P(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	k(%rip), %eax
	addl	$1, %eax
	movl	%eax, k(%rip)
.L12:
	movl	k(%rip), %edx
	movl	w(%rip), %eax
	cmpl	%eax, %edx
	jl	.L13
	movl	j(%rip), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L14
.L11:
	movl	j(%rip), %eax
	addl	$1, %eax
	movl	%eax, j(%rip)
.L10:
	movl	j(%rip), %edx
	movl	W(%rip), %eax
	cmpl	%eax, %edx
	jl	.L15
.L14:
	movl	j(%rip), %edx
	movl	W(%rip), %eax
	cmpl	%eax, %edx
	jne	.L16
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L16
.L9:
	leaq	n(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, j(%rip)
	jmp	.L17
.L19:
	movl	j(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	P(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	n(%rip), %eax
	cmpl	%eax, %edx
	jne	.L18
	movl	j(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	P(%rip), %rax
	movl	$-1, (%rdx,%rax)
.L18:
	movl	j(%rip), %eax
	addl	$1, %eax
	movl	%eax, j(%rip)
.L17:
	movl	j(%rip), %edx
	movl	W(%rip), %eax
	cmpl	%eax, %edx
	jl	.L19
.L16:
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L8:
	movl	i(%rip), %edx
	movl	N(%rip), %eax
	cmpl	%eax, %edx
	jl	.L20
	leaq	.LC4(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
.L7:
	leaq	N(%rip), %rax
	movq	%rax, %rdx
	leaq	W(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	W(%rip), %eax
	testl	%eax, %eax
	jne	.L21
	movl	$0, %eax
	popq	%rbp
	.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	ch
	.type	ch, @function
ch:
.LFB35:
	.cfi_startproc
	endbr64
	movl	W(%rip), %ecx
	cmpl	%ecx, %edi
	jge	.L5
	leaq	P(%rip), %rax
	movslq	%edi, %rdx
	subl	%edi, %ecx
	leaq	(%rax,%rdx,4), %rdx
	xorl	%eax, %eax
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L4:
	addl	$1, %eax
	addq	$4, %rdx
	cmpl	%ecx, %eax
	je	.L1
.L3:
	cmpl	$-1, (%rdx)
	je	.L4
	ret
.L5:
	xorl	%eax, %eax
.L1:
	ret
	.cfi_endproc
.LFE35:
	.size	ch, .-ch
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"END"
.LC1:
	.string	"%c"
.LC2:
	.string	"%d%d\n"
.LC3:
	.string	"%d\n"
.LC4:
	.string	"impossible"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB36:
	.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
	leaq	.LC2(%rip), %r14
	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
.L9:
	leaq	N(%rip), %rdx
	leaq	W(%rip), %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	W(%rip), %eax
	testl	%eax, %eax
	je	.L43
	movl	$52, %ecx
	movq	$-1, %rax
	leaq	P(%rip), %rdi
	movl	N(%rip), %edx
	rep stosq
	leaq	c(%rip), %r12
	movl	$0, i(%rip)
	leaq	.LC1(%rip), %rbp
	leaq	n(%rip), %rbx
	leaq	.LC3(%rip), %r13
	movl	$-1, (%rdi)
	testl	%edx, %edx
	jle	.L27
	.p2align 4,,10
	.p2align 3
.L10:
	xorl	%eax, %eax
	movq	%r12, %rsi
	movq	%rbp, %rdi
	call	__isoc99_scanf@PLT
	cmpb	$115, c(%rip)
	je	.L44
	movq	%rbx, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	W(%rip), %esi
	movl	$0, j(%rip)
	testl	%esi, %esi
	jle	.L23
	leaq	P(%rip), %rax
	leal	-1(%rsi), %edx
	movl	n(%rip), %ecx
	leaq	4(%rax), %rdi
	leaq	(%rdi,%rdx,4), %rdx
	.p2align 4,,10
	.p2align 3
.L26:
	cmpl	%ecx, (%rax)
	jne	.L25
	movl	$-1, (%rax)
.L25:
	addq	$4, %rax
	cmpq	%rdx, %rax
	jne	.L26
	movl	%esi, j(%rip)
.L23:
	movl	i(%rip), %eax
	addl	$1, %eax
	cmpl	N(%rip), %eax
	movl	%eax, i(%rip)
	jl	.L10
.L27:
	leaq	.LC0(%rip), %rdi
	call	puts@PLT
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L44:
	movq	%r14, %rdi
	leaq	w(%rip), %rdx
	movq	%rbx, %rsi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	W(%rip), %edi
	movl	$0, j(%rip)
	testl	%edi, %edi
	jle	.L29
	movl	w(%rip), %r11d
	leal	1(%rdi), %r9d
	movl	$1, %eax
	xorl	%r8d, %r8d
	leaq	-4+P(%rip), %rsi
	jmp	.L21
	.p2align 4,,10
	.p2align 3
.L13:
	movl	%eax, %r15d
	addq	$1, %rax
	movl	$1, %r8d
	cmpq	%r9, %rax
	je	.L45
.L21:
	cmpl	$-1, (%rsi,%rax,4)
	leal	-1(%rax), %r10d
	jne	.L13
	movq	%rax, %rdx
	xorl	%ecx, %ecx
	jmp	.L15
	.p2align 4,,10
	.p2align 3
.L46:
	addq	$1, %rdx
	cmpl	$-1, (%rsi,%rdx,4)
	jne	.L14
.L15:
	addl	$1, %ecx
	cmpl	%edx, %edi
	jg	.L46
.L14:
	cmpl	%ecx, %r11d
	jg	.L13
	testb	%r8b, %r8b
	je	.L16
	movl	%r15d, j(%rip)
.L16:
	movl	$0, k(%rip)
	testl	%r11d, %r11d
	jle	.L17
	leal	-1(%r11), %eax
	movl	n(%rip), %ecx
	cmpl	$2, %eax
	jbe	.L30
	movl	%r11d, %edx
	movslq	%r10d, %rax
	leaq	P(%rip), %rdi
	shrl	$2, %edx
	movd	%ecx, %xmm1
	leaq	(%rdi,%rax,4), %rax
	salq	$4, %rdx
	pshufd	$0, %xmm1, %xmm0
	addq	%rax, %rdx
	.p2align 4,,10
	.p2align 3
.L19:
	movups	%xmm0, (%rax)
	addq	$16, %rax
	cmpq	%rdx, %rax
	jne	.L19
	movl	%r11d, %eax
	andl	$-4, %eax
	testb	$3, %r11b
	je	.L20
.L18:
	leal	(%rax,%r10), %edx
	leaq	P(%rip), %rdi
	movslq	%edx, %rdx
	movl	%ecx, (%rdi,%rdx,4)
	leal	1(%rax), %edx
	cmpl	%edx, %r11d
	jle	.L20
	addl	%r10d, %edx
	addl	$2, %eax
	movslq	%edx, %rdx
	movl	%ecx, (%rdi,%rdx,4)
	cmpl	%eax, %r11d
	jle	.L20
	addl	%r10d, %eax
	cltq
	movl	%ecx, (%rdi,%rax,4)
.L20:
	movl	%r11d, k(%rip)
.L17:
	movl	$1, %edi
	movl	%r10d, %edx
	movq	%r13, %rsi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movl	j(%rip), %r15d
	movl	W(%rip), %edi
	.p2align 4,,10
	.p2align 3
.L12:
	cmpl	%edi, %r15d
	jne	.L23
	leaq	.LC4(%rip), %rdi
	call	puts@PLT
	jmp	.L23
	.p2align 4,,10
	.p2align 3
.L45:
	movl	%r15d, j(%rip)
	jmp	.L12
.L29:
	xorl	%r15d, %r15d
	jmp	.L12
.L43:
	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
.L30:
	.cfi_restore_state
	xorl	%eax, %eax
	jmp	.L18
	.cfi_endproc
.LFE36:
	.size	main, .-main
	.globl	c
	.bss
	.type	c, @object
	.size	c, 1
c:
	.zero	1
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	w
	.align 4
	.type	w, @object
	.size	w, 4
w:
	.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
	.globl	P
	.align 32
	.type	P, @object
	.size	P, 420
P:
	.zero	420
	.globl	N
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	4
	.globl	W
	.align 4
	.type	W, @object
	.size	W, 4
W:
	.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	ch
	.type	ch, @function
ch:
.LFB35:
	.cfi_startproc
	endbr64
	movl	W(%rip), %ecx
	cmpl	%ecx, %edi
	jge	.L5
	leaq	P(%rip), %rax
	movslq	%edi, %rdx
	subl	%edi, %ecx
	leaq	(%rax,%rdx,4), %rdx
	xorl	%eax, %eax
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L4:
	addl	$1, %eax
	addq	$4, %rdx
	cmpl	%ecx, %eax
	je	.L1
.L3:
	cmpl	$-1, (%rdx)
	je	.L4
	ret
.L5:
	xorl	%eax, %eax
.L1:
	ret
	.cfi_endproc
.LFE35:
	.size	ch, .-ch
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"END"
.LC1:
	.string	"%c"
.LC2:
	.string	"%d%d\n"
.LC3:
	.string	"%d\n"
.LC4:
	.string	"impossible"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB36:
	.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
	leaq	.LC2(%rip), %r14
	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
.L9:
	leaq	N(%rip), %rdx
	leaq	W(%rip), %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	W(%rip), %eax
	testl	%eax, %eax
	je	.L43
	movl	$52, %ecx
	movq	$-1, %rax
	leaq	P(%rip), %rdi
	movl	N(%rip), %edx
	rep stosq
	leaq	c(%rip), %r12
	movl	$0, i(%rip)
	leaq	.LC1(%rip), %rbp
	leaq	n(%rip), %rbx
	leaq	.LC3(%rip), %r13
	movl	$-1, (%rdi)
	testl	%edx, %edx
	jle	.L27
	.p2align 4,,10
	.p2align 3
.L10:
	xorl	%eax, %eax
	movq	%r12, %rsi
	movq	%rbp, %rdi
	call	__isoc99_scanf@PLT
	cmpb	$115, c(%rip)
	je	.L44
	movq	%rbx, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	W(%rip), %esi
	movl	$0, j(%rip)
	testl	%esi, %esi
	jle	.L23
	leaq	P(%rip), %rax
	leal	-1(%rsi), %edx
	movl	n(%rip), %ecx
	leaq	4(%rax), %rdi
	leaq	(%rdi,%rdx,4), %rdx
	.p2align 4,,10
	.p2align 3
.L26:
	cmpl	%ecx, (%rax)
	jne	.L25
	movl	$-1, (%rax)
.L25:
	addq	$4, %rax
	cmpq	%rdx, %rax
	jne	.L26
	movl	%esi, j(%rip)
.L23:
	movl	i(%rip), %eax
	addl	$1, %eax
	cmpl	N(%rip), %eax
	movl	%eax, i(%rip)
	jl	.L10
.L27:
	leaq	.LC0(%rip), %rdi
	call	puts@PLT
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L44:
	movq	%r14, %rdi
	leaq	w(%rip), %rdx
	movq	%rbx, %rsi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	W(%rip), %edi
	movl	$0, j(%rip)
	testl	%edi, %edi
	jle	.L29
	movl	w(%rip), %r11d
	leal	1(%rdi), %r9d
	movl	$1, %eax
	xorl	%r8d, %r8d
	leaq	-4+P(%rip), %rsi
	jmp	.L21
	.p2align 4,,10
	.p2align 3
.L13:
	movl	%eax, %r15d
	addq	$1, %rax
	movl	$1, %r8d
	cmpq	%r9, %rax
	je	.L45
.L21:
	cmpl	$-1, (%rsi,%rax,4)
	leal	-1(%rax), %r10d
	jne	.L13
	movq	%rax, %rdx
	xorl	%ecx, %ecx
	jmp	.L15
	.p2align 4,,10
	.p2align 3
.L46:
	addq	$1, %rdx
	cmpl	$-1, (%rsi,%rdx,4)
	jne	.L14
.L15:
	addl	$1, %ecx
	cmpl	%edx, %edi
	jg	.L46
.L14:
	cmpl	%ecx, %r11d
	jg	.L13
	testb	%r8b, %r8b
	je	.L16
	movl	%r15d, j(%rip)
.L16:
	movl	$0, k(%rip)
	testl	%r11d, %r11d
	jle	.L17
	leal	-1(%r11), %eax
	movl	n(%rip), %ecx
	cmpl	$2, %eax
	jbe	.L30
	movl	%r11d, %edx
	movslq	%r10d, %rax
	leaq	P(%rip), %rdi
	shrl	$2, %edx
	movd	%ecx, %xmm1
	leaq	(%rdi,%rax,4), %rax
	salq	$4, %rdx
	pshufd	$0, %xmm1, %xmm0
	addq	%rax, %rdx
	.p2align 4,,10
	.p2align 3
.L19:
	movups	%xmm0, (%rax)
	addq	$16, %rax
	cmpq	%rdx, %rax
	jne	.L19
	movl	%r11d, %eax
	andl	$-4, %eax
	testb	$3, %r11b
	je	.L20
.L18:
	leal	(%rax,%r10), %edx
	leaq	P(%rip), %rdi
	movslq	%edx, %rdx
	movl	%ecx, (%rdi,%rdx,4)
	leal	1(%rax), %edx
	cmpl	%edx, %r11d
	jle	.L20
	addl	%r10d, %edx
	addl	$2, %eax
	movslq	%edx, %rdx
	movl	%ecx, (%rdi,%rdx,4)
	cmpl	%eax, %r11d
	jle	.L20
	addl	%r10d, %eax
	cltq
	movl	%ecx, (%rdi,%rax,4)
.L20:
	movl	%r11d, k(%rip)
.L17:
	movl	$1, %edi
	movl	%r10d, %edx
	movq	%r13, %rsi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movl	j(%rip), %r15d
	movl	W(%rip), %edi
	.p2align 4,,10
	.p2align 3
.L12:
	cmpl	%edi, %r15d
	jne	.L23
	leaq	.LC4(%rip), %rdi
	call	puts@PLT
	jmp	.L23
	.p2align 4,,10
	.p2align 3
.L45:
	movl	%r15d, j(%rip)
	jmp	.L12
.L29:
	xorl	%r15d, %r15d
	jmp	.L12
.L43:
	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
.L30:
	.cfi_restore_state
	xorl	%eax, %eax
	jmp	.L18
	.cfi_endproc
.LFE36:
	.size	main, .-main
	.globl	c
	.bss
	.type	c, @object
	.size	c, 1
c:
	.zero	1
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	w
	.align 4
	.type	w, @object
	.size	w, 4
w:
	.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
	.globl	P
	.align 32
	.type	P, @object
	.size	P, 420
P:
	.zero	420
	.globl	N
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	4
	.globl	W
	.align 4
	.type	W, @object
	.size	W, 4
W:
	.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>
#include<string.h>
int W,N,P[105],i,j,k,w,n;
char c;

int ch(int s)
{
	int i,r=0;
	for(i=s;i<W&&P[i]==-1;i++)r++;
	return r;
}

int main()
{
	for(;scanf("%d%d\n",&W,&N),W;)
	{
		memset(P,-1,sizeof(P));
		for(i=0;i<N;i++)
		{
			scanf("%c",&c);
			if(c=='s')
			{
				scanf("%d%d\n",&n,&w);
				for(j=0;j<W;j++)
				{
					if(P[j]==-1&&ch(j)>=w)
					{
						for(k=0;k<w;k++)P[j+k]=n;
						printf("%d\n",j);
						break;
					}
				}
				if(j==W)puts("impossible");
			}
			else
			{
				scanf("%d\n",&n);
				for(j=0;j<W;j++)
					if(P[j]==n)P[j]=-1;
			}
		}
		puts("END");
	}
	return 0;
}
4 6
s 0 2
s 1 2
s 2 1
w 0
s 3 3
s 4 2
3 3
s 0 1
s 1 1
s 2 1
0 0
 4 6
s 0 2
s 1 3
s 2 1
w 0
s 3 3
s 4 2
3 3
s 0 1
s 0 1
s 2 1
0 0
 4 6
s 0 2
s 1 2
s 2 1
w 0
s 3 3
s 4 2
4 3
s 0 1
s 1 2
s 2 1
0 0
 4 6
s 0 3
s 1 3
s 2 1
w 0
s 3 3
s 4 2
3 3
s 0 1
s 1 1
s 2 1
0 0
 4 6
s 0 2
s 2 3
s 2 1
w 0
s 3 3
s 4 2
2 3
s 0 1
s 1 1
s 2 1
0 0
 4 6
s 0 2
s 1 2
s 2 1
w 0
s 3 4
s 4 4
4 3
s 0 1
s 1 2
s 2 1
0 0
 4 6
s 0 3
s 1 3
s 2 2
w 0
s 3 3
s 4 2
3 3
s 0 1
s 1 1
s 2 1
0 0
 4 6
s 0 2
s 2 3
s 2 1
w 0
s 3 2
s 3 2
2 3
s 0 1
s 1 1
s 2 1
0 0
 4 6
s 0 3
s 2 3
s 2 1
w 0
s 5 2
s 3 2
2 3
s 0 1
s 1 1
s 2 1
0 0
 6 6
s 0 2
s 1 2
s 2 1
w 0
s 3 3
s 4 2
4 3
s 0 1
s 1 2
s 2 1
0 0

0
2
impossible
impossible
0
END
0
1
2
END
 0
impossible
2
impossible
0
END
0
1
2
END
 0
2
impossible
impossible
0
END
0
1
3
END
 0
impossible
3
0
impossible
END
0
1
2
END
 0
impossible
2
impossible
0
END
0
1
impossible
END
 0
2
impossible
impossible
impossible
END
0
1
3
END
 0
impossible
impossible
0
impossible
END
0
1
2
END
 0
impossible
2
0
impossible
END
0
1
impossible
END
 0
impossible
3
0
impossible
END
0
1
impossible
END
 0
2
4
impossible
0
END
0
1
3
END

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>
int W,N,P[105],i,j,k,w,n;
char c;

int ch(int s)
{
	int i,r=0;
	for(i=s;i<W&&P[i]==-1;i++)r++;
	return r;
}

int main()
{
	for(;scanf("%d%d\n",&W,&N),W;)
	{
		memset(P,-1,sizeof(P));
		for(i=0;i<N;i++)
		{
			scanf("%c",&c);
			if(c=='s')
			{
				scanf("%d%d\n",&n,&w);
				for(j=0;j<W;j++)
				{
					if(P[j]==-1&&ch(j)>=w)
					{
						for(k=0;k<w;k++)P[j+k]=n;
						printf("%d\n",j);
						break;
					}
				}
				if(j==W)puts("impossible");
			}
			else
			{
				scanf("%d\n",&n);
				for(j=0;j<W;j++)
					if(P[j]==n)P[j]=-1;
			}
		}
		puts("END");
	}
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	W
	.bss
	.align 4
	.type	W, @object
	.size	W, 4
W:
	.zero	4
	.globl	N
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	4
	.globl	P
	.align 32
	.type	P, @object
	.size	P, 420
P:
	.zero	420
	.globl	i
	.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	w
	.align 4
	.type	w, @object
	.size	w, 4
w:
	.zero	4
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	c
	.type	c, @object
	.size	c, 1
c:
	.zero	1
	.text
	.globl	ch
	.type	ch, @function
ch:
.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	$0, -4(%rbp)
	movl	-20(%rbp), %eax
	movl	%eax, -8(%rbp)
	jmp	.L2
.L4:
	addl	$1, -4(%rbp)
	addl	$1, -8(%rbp)
.L2:
	movl	W(%rip), %eax
	cmpl	%eax, -8(%rbp)
	jge	.L3
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	P(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	$-1, %eax
	je	.L4
.L3:
	movl	-4(%rbp), %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	ch, .-ch
	.section	.rodata
.LC0:
	.string	"%c"
.LC1:
	.string	"%d%d\n"
.LC2:
	.string	"%d\n"
.LC3:
	.string	"impossible"
.LC4:
	.string	"END"
	.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
	jmp	.L7
.L21:
	movl	$420, %edx
	movl	$-1, %esi
	leaq	P(%rip), %rax
	movq	%rax, %rdi
	call	memset@PLT
	movl	$0, i(%rip)
	jmp	.L8
.L20:
	leaq	c(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movzbl	c(%rip), %eax
	cmpb	$115, %al
	jne	.L9
	leaq	w(%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	$0, j(%rip)
	jmp	.L10
.L15:
	movl	j(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	P(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	$-1, %eax
	jne	.L11
	movl	j(%rip), %eax
	movl	%eax, %edi
	call	ch
	movl	w(%rip), %edx
	cmpl	%edx, %eax
	jl	.L11
	movl	$0, k(%rip)
	jmp	.L12
.L13:
	movl	j(%rip), %edx
	movl	k(%rip), %eax
	addl	%eax, %edx
	movl	n(%rip), %eax
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	P(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	k(%rip), %eax
	addl	$1, %eax
	movl	%eax, k(%rip)
.L12:
	movl	k(%rip), %edx
	movl	w(%rip), %eax
	cmpl	%eax, %edx
	jl	.L13
	movl	j(%rip), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L14
.L11:
	movl	j(%rip), %eax
	addl	$1, %eax
	movl	%eax, j(%rip)
.L10:
	movl	j(%rip), %edx
	movl	W(%rip), %eax
	cmpl	%eax, %edx
	jl	.L15
.L14:
	movl	j(%rip), %edx
	movl	W(%rip), %eax
	cmpl	%eax, %edx
	jne	.L16
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L16
.L9:
	leaq	n(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, j(%rip)
	jmp	.L17
.L19:
	movl	j(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	P(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	n(%rip), %eax
	cmpl	%eax, %edx
	jne	.L18
	movl	j(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	P(%rip), %rax
	movl	$-1, (%rdx,%rax)
.L18:
	movl	j(%rip), %eax
	addl	$1, %eax
	movl	%eax, j(%rip)
.L17:
	movl	j(%rip), %edx
	movl	W(%rip), %eax
	cmpl	%eax, %edx
	jl	.L19
.L16:
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L8:
	movl	i(%rip), %edx
	movl	N(%rip), %eax
	cmpl	%eax, %edx
	jl	.L20
	leaq	.LC4(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
.L7:
	leaq	N(%rip), %rax
	movq	%rax, %rdx
	leaq	W(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	W(%rip), %eax
	testl	%eax, %eax
	jne	.L21
	movl	$0, %eax
	popq	%rbp
	.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	W
	.bss
	.align 4
	.type	W, @object
	.size	W, 4
W:
	.zero	4
	.globl	N
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	4
	.globl	P
	.align 32
	.type	P, @object
	.size	P, 420
P:
	.zero	420
	.globl	i
	.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	w
	.align 4
	.type	w, @object
	.size	w, 4
w:
	.zero	4
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	c
	.type	c, @object
	.size	c, 1
c:
	.zero	1
	.text
	.globl	ch
	.type	ch, @function
ch:
.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	$0, -4(%rbp)
	movl	-20(%rbp), %eax
	movl	%eax, -8(%rbp)
	jmp	.L2
.L4:
	addl	$1, -4(%rbp)
	addl	$1, -8(%rbp)
.L2:
	movl	W(%rip), %eax
	cmpl	%eax, -8(%rbp)
	jge	.L3
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	P(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	$-1, %eax
	je	.L4
.L3:
	movl	-4(%rbp), %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	ch, .-ch
	.section	.rodata
.LC0:
	.string	"%c"
.LC1:
	.string	"%d%d\n"
.LC2:
	.string	"%d\n"
.LC3:
	.string	"impossible"
.LC4:
	.string	"END"
	.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
	jmp	.L7
.L21:
	movl	$420, %edx
	movl	$-1, %esi
	leaq	P(%rip), %rax
	movq	%rax, %rdi
	call	memset@PLT
	movl	$0, i(%rip)
	jmp	.L8
.L20:
	leaq	c(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movzbl	c(%rip), %eax
	cmpb	$115, %al
	jne	.L9
	leaq	w(%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	$0, j(%rip)
	jmp	.L10
.L15:
	movl	j(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	P(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	$-1, %eax
	jne	.L11
	movl	j(%rip), %eax
	movl	%eax, %edi
	call	ch
	movl	w(%rip), %edx
	cmpl	%edx, %eax
	jl	.L11
	movl	$0, k(%rip)
	jmp	.L12
.L13:
	movl	j(%rip), %edx
	movl	k(%rip), %eax
	addl	%eax, %edx
	movl	n(%rip), %eax
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	P(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	k(%rip), %eax
	addl	$1, %eax
	movl	%eax, k(%rip)
.L12:
	movl	k(%rip), %edx
	movl	w(%rip), %eax
	cmpl	%eax, %edx
	jl	.L13
	movl	j(%rip), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L14
.L11:
	movl	j(%rip), %eax
	addl	$1, %eax
	movl	%eax, j(%rip)
.L10:
	movl	j(%rip), %edx
	movl	W(%rip), %eax
	cmpl	%eax, %edx
	jl	.L15
.L14:
	movl	j(%rip), %edx
	movl	W(%rip), %eax
	cmpl	%eax, %edx
	jne	.L16
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L16
.L9:
	leaq	n(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, j(%rip)
	jmp	.L17
.L19:
	movl	j(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	P(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	n(%rip), %eax
	cmpl	%eax, %edx
	jne	.L18
	movl	j(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	P(%rip), %rax
	movl	$-1, (%rdx,%rax)
.L18:
	movl	j(%rip), %eax
	addl	$1, %eax
	movl	%eax, j(%rip)
.L17:
	movl	j(%rip), %edx
	movl	W(%rip), %eax
	cmpl	%eax, %edx
	jl	.L19
.L16:
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L8:
	movl	i(%rip), %edx
	movl	N(%rip), %eax
	cmpl	%eax, %edx
	jl	.L20
	leaq	.LC4(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
.L7:
	leaq	N(%rip), %rax
	movq	%rax, %rdx
	leaq	W(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	W(%rip), %eax
	testl	%eax, %eax
	jne	.L21
	movl	$0, %eax
	popq	%rbp
	.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:
