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

```c
// Aizu Vol-3 0308: Deadlock
// 2017.8.27 bal4u@uu

#include <stdio.h>

#define MAX  200
#define BASE 100
char tbl[MAX+3][MAX+3];
int  Q[MAX+3], top, end;
int  count[MAX+3];

void topologicalSort(int size)
{
	int i, j;

//	memset(count, 0, sizeof(count));
	top = end = 0;
	for (i = 1; i <= size; i++) for (j = 1; j <= size; j++) if (tbl[i][j]) count[j]++;
	for (i = 1; i <= size; i++) if (!count[i]) Q[end++] = i;
	while (top < end) {
		i = Q[top++];
		for (j = 1; j <= size; j++) {
			if (tbl[i][j]) if (--count[j] == 0) Q[end++] = j;
		}
	}
}

int main(void)
{
	int N, u, d, i;
	char c[30];

	scanf("%d", &N);
//	memset(tbl, 0, sizeof(tbl));
	while (N-- > 0) {
		scanf("%d%s%d", &u, c, &d);
		if (*c == 'w') tbl[u][d+BASE] = 1;
		else           tbl[d+BASE][u] = 1;
	}
	topologicalSort(MAX);
	for (i = 1; i <= MAX; i++) if (count[i]) break;
	puts(i <= MAX ? "1" : "0");
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	tbl
	.bss
	.align 32
	.type	tbl, @object
	.size	tbl, 41209
tbl:
	.zero	41209
	.globl	Q
	.align 32
	.type	Q, @object
	.size	Q, 812
Q:
	.zero	812
	.globl	top
	.align 4
	.type	top, @object
	.size	top, 4
top:
	.zero	4
	.globl	end
	.align 4
	.type	end, @object
	.size	end, 4
end:
	.zero	4
	.globl	count
	.align 32
	.type	count, @object
	.size	count, 812
count:
	.zero	812
	.text
	.globl	topologicalSort
	.type	topologicalSort, @function
topologicalSort:
.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, end(%rip)
	movl	end(%rip), %eax
	movl	%eax, top(%rip)
	movl	$1, -8(%rbp)
	jmp	.L2
.L6:
	movl	$1, -4(%rbp)
	jmp	.L3
.L5:
	movl	-4(%rbp), %eax
	movslq	%eax, %rdx
	movl	-8(%rbp), %eax
	cltq
	imulq	$203, %rax, %rax
	addq	%rax, %rdx
	leaq	tbl(%rip), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	testb	%al, %al
	je	.L4
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	count(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	1(%rax), %ecx
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	count(%rip), %rax
	movl	%ecx, (%rdx,%rax)
.L4:
	addl	$1, -4(%rbp)
.L3:
	movl	-4(%rbp), %eax
	cmpl	-20(%rbp), %eax
	jle	.L5
	addl	$1, -8(%rbp)
.L2:
	movl	-8(%rbp), %eax
	cmpl	-20(%rbp), %eax
	jle	.L6
	movl	$1, -8(%rbp)
	jmp	.L7
.L9:
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	count(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	jne	.L8
	movl	end(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, end(%rip)
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	Q(%rip), %rdx
	movl	-8(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
.L8:
	addl	$1, -8(%rbp)
.L7:
	movl	-8(%rbp), %eax
	cmpl	-20(%rbp), %eax
	jle	.L9
	jmp	.L10
.L14:
	movl	top(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, top(%rip)
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	Q(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -8(%rbp)
	movl	$1, -4(%rbp)
	jmp	.L11
.L13:
	movl	-4(%rbp), %eax
	movslq	%eax, %rdx
	movl	-8(%rbp), %eax
	cltq
	imulq	$203, %rax, %rax
	addq	%rax, %rdx
	leaq	tbl(%rip), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	testb	%al, %al
	je	.L12
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	count(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	-1(%rax), %ecx
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	count(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	count(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	jne	.L12
	movl	end(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, end(%rip)
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	Q(%rip), %rdx
	movl	-4(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
.L12:
	addl	$1, -4(%rbp)
.L11:
	movl	-4(%rbp), %eax
	cmpl	-20(%rbp), %eax
	jle	.L13
.L10:
	movl	top(%rip), %edx
	movl	end(%rip), %eax
	cmpl	%eax, %edx
	jl	.L14
	nop
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	topologicalSort, .-topologicalSort
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d%s%d"
.LC2:
	.string	"1"
.LC3:
	.string	"0"
	.text
	.globl	main
	.type	main, @function
main:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$64, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-64(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	jmp	.L16
.L18:
	leaq	-56(%rbp), %rcx
	leaq	-48(%rbp), %rdx
	leaq	-60(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movzbl	-48(%rbp), %eax
	cmpb	$119, %al
	jne	.L17
	movl	-60(%rbp), %eax
	movl	-56(%rbp), %edx
	addl	$100, %edx
	movslq	%edx, %rdx
	cltq
	imulq	$203, %rax, %rax
	addq	%rax, %rdx
	leaq	tbl(%rip), %rax
	addq	%rdx, %rax
	movb	$1, (%rax)
	jmp	.L16
.L17:
	movl	-56(%rbp), %eax
	leal	100(%rax), %edx
	movl	-60(%rbp), %eax
	movslq	%eax, %rcx
	movslq	%edx, %rax
	imulq	$203, %rax, %rax
	leaq	(%rax,%rcx), %rdx
	leaq	tbl(%rip), %rax
	addq	%rdx, %rax
	movb	$1, (%rax)
.L16:
	movl	-64(%rbp), %eax
	leal	-1(%rax), %edx
	movl	%edx, -64(%rbp)
	testl	%eax, %eax
	jg	.L18
	movl	$200, %edi
	call	topologicalSort
	movl	$1, -52(%rbp)
	jmp	.L19
.L22:
	movl	-52(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	count(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	jne	.L27
	addl	$1, -52(%rbp)
.L19:
	cmpl	$200, -52(%rbp)
	jle	.L22
	jmp	.L21
.L27:
	nop
.L21:
	cmpl	$200, -52(%rbp)
	jg	.L23
	leaq	.LC2(%rip), %rax
	jmp	.L24
.L23:
	leaq	.LC3(%rip), %rax
.L24:
	movq	%rax, %rdi
	call	puts@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L26
	call	__stack_chk_fail@PLT
.L26:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```

Only output the optimized assembly code. Do not include any other text. Do not write any comments in the assembly code. Wrap the assembly code in ```assembly``` tags.
user
	.file	"temp.c"
	.text
	.p2align 4
	.globl	topologicalSort
	.type	topologicalSort, @function
topologicalSort:
.LFB23:
	.cfi_startproc
	endbr64
	movl	$0, end(%rip)
	movl	$0, top(%rip)
	testl	%edi, %edi
	jle	.L37
	movl	%edi, %r9d
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	movl	$1, %edi
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	leal	-1(%r9), %r11d
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	leaq	8+count(%rip), %rbx
	cmpl	$2, %r9d
	jle	.L4
	leal	-1(%r9), %eax
	leaq	8+count(%rip), %rbx
	movl	$2, %esi
	leaq	204+tbl(%rip), %r8
	movq	%rax, %r11
	leaq	(%rbx,%rax,4), %rcx
.L9:
	leaq	4+count(%rip), %rax
	movq	%r8, %rdx
	.p2align 4,,10
	.p2align 3
.L8:
	cmpb	$0, (%rdx)
	je	.L6
	addl	$1, (%rax)
.L6:
	cmpb	$0, 203(%rdx)
	je	.L7
	addl	$1, (%rax)
.L7:
	addq	$4, %rax
	addq	$1, %rdx
	cmpq	%rcx, %rax
	jne	.L8
	leal	1(%rsi), %edi
	addl	$2, %esi
	addq	$406, %r8
	cmpl	%esi, %r9d
	jg	.L9
.L4:
	movslq	%edi, %rax
	leaq	tbl(%rip), %r10
	movl	%r11d, %esi
	imulq	$203, %rax, %rax
	leaq	(%rbx,%rsi,4), %rcx
	leaq	1(%r10,%rax), %r8
	.p2align 4,,10
	.p2align 3
.L12:
	leaq	4+count(%rip), %rax
	movq	%r8, %rdx
	.p2align 4,,10
	.p2align 3
.L11:
	cmpb	$0, (%rdx)
	je	.L10
	addl	$1, (%rax)
.L10:
	addq	$4, %rax
	addq	$1, %rdx
	cmpq	%rcx, %rax
	jne	.L11
	addl	$1, %edi
	addq	$203, %r8
	cmpl	%edi, %r9d
	jge	.L12
	addq	$2, %rsi
	movl	$1, %eax
	xorl	%ebx, %ebx
	xorl	%r8d, %r8d
	leaq	count(%rip), %rdi
	leaq	Q(%rip), %rcx
	.p2align 4,,10
	.p2align 3
.L15:
	movl	(%rdi,%rax,4), %edx
	testl	%edx, %edx
	jne	.L14
	movslq	%r8d, %rdx
	movl	$1, %ebx
	addl	$1, %r8d
	movl	%eax, (%rcx,%rdx,4)
.L14:
	addq	$1, %rax
	cmpq	%rsi, %rax
	jne	.L15
	testb	%bl, %bl
	je	.L1
	movl	%r8d, end(%rip)
	testl	%r8d, %r8d
	je	.L1
	xorl	%r9d, %r9d
	xorl	%ebp, %ebp
	leaq	Q(%rip), %r11
	.p2align 4,,10
	.p2align 3
.L18:
	movslq	(%r11,%r9,4), %rcx
	leal	1(%r9), %r12d
	movl	$1, %eax
	imulq	$203, %rcx, %rcx
	addq	%r10, %rcx
	.p2align 4,,10
	.p2align 3
.L17:
	cmpb	$0, (%rcx,%rax)
	je	.L16
	subl	$1, (%rdi,%rax,4)
	jne	.L16
	movslq	%r8d, %rdx
	movl	%ebx, %ebp
	addl	$1, %r8d
	movl	%eax, (%r11,%rdx,4)
.L16:
	addq	$1, %rax
	cmpq	%rsi, %rax
	jne	.L17
	addq	$1, %r9
	cmpl	%r9d, %r8d
	jg	.L18
	movl	%r12d, top(%rip)
	testb	%bpl, %bpl
	je	.L1
	movl	%r8d, end(%rip)
.L1:
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
.L37:
	.cfi_restore 3
	.cfi_restore 6
	.cfi_restore 12
	ret
	.cfi_endproc
.LFE23:
	.size	topologicalSort, .-topologicalSort
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"1"
.LC1:
	.string	"0"
.LC2:
	.string	"%d"
.LC3:
	.string	"%d%s%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB24:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	leaq	.LC2(%rip), %rdi
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	subq	$64, %rsp
	.cfi_def_cfa_offset 112
	movq	%fs:40, %rax
	movq	%rax, 56(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %eax
	leal	-1(%rax), %edx
	movl	%edx, 4(%rsp)
	testl	%eax, %eax
	jle	.L42
	leaq	12(%rsp), %r14
	leaq	16(%rsp), %r13
	leaq	8(%rsp), %r12
	leaq	.LC3(%rip), %rbp
	leaq	tbl(%rip), %rbx
	jmp	.L45
	.p2align 4,,10
	.p2align 3
.L43:
	movl	12(%rsp), %eax
	movslq	8(%rsp), %rdx
	addl	$100, %eax
	cltq
	imulq	$203, %rax, %rax
	addq	%rbx, %rax
.L52:
	movb	$1, (%rax,%rdx)
	movl	4(%rsp), %eax
	leal	-1(%rax), %edx
	movl	%edx, 4(%rsp)
	testl	%eax, %eax
	jle	.L42
.L45:
	xorl	%eax, %eax
	movq	%r14, %rcx
	movq	%r13, %rdx
	movq	%r12, %rsi
	movq	%rbp, %rdi
	call	__isoc99_scanf@PLT
	cmpb	$119, 16(%rsp)
	jne	.L43
	movslq	8(%rsp), %rdx
	movl	12(%rsp), %eax
	imulq	$203, %rdx, %rdx
	addl	$100, %eax
	cltq
	addq	%rbx, %rdx
	jmp	.L52
	.p2align 4,,10
	.p2align 3
.L42:
	movl	$200, %edi
	call	topologicalSort
	leaq	4+count(%rip), %rax
	leaq	800(%rax), %rdx
	jmp	.L47
	.p2align 4,,10
	.p2align 3
.L54:
	addq	$4, %rax
	cmpq	%rdx, %rax
	je	.L53
.L47:
	movl	(%rax), %ecx
	testl	%ecx, %ecx
	je	.L54
	leaq	.LC0(%rip), %rdi
.L46:
	call	puts@PLT
	movq	56(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L55
	addq	$64, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 48
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
.L53:
	.cfi_restore_state
	leaq	.LC1(%rip), %rdi
	jmp	.L46
.L55:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE24:
	.size	main, .-main
	.globl	count
	.bss
	.align 32
	.type	count, @object
	.size	count, 812
count:
	.zero	812
	.globl	end
	.align 4
	.type	end, @object
	.size	end, 4
end:
	.zero	4
	.globl	top
	.align 4
	.type	top, @object
	.size	top, 4
top:
	.zero	4
	.globl	Q
	.align 32
	.type	Q, @object
	.size	Q, 812
Q:
	.zero	812
	.globl	tbl
	.align 32
	.type	tbl, @object
	.size	tbl, 41209
tbl:
	.zero	41209
	.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	topologicalSort
	.type	topologicalSort, @function
topologicalSort:
.LFB23:
	.cfi_startproc
	endbr64
	movl	$0, end(%rip)
	movl	$0, top(%rip)
	testl	%edi, %edi
	jle	.L37
	movl	%edi, %r9d
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	movl	$1, %edi
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	leal	-1(%r9), %r11d
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	leaq	8+count(%rip), %rbx
	cmpl	$2, %r9d
	jle	.L4
	leal	-1(%r9), %eax
	leaq	8+count(%rip), %rbx
	movl	$2, %esi
	leaq	204+tbl(%rip), %r8
	movq	%rax, %r11
	leaq	(%rbx,%rax,4), %rcx
.L9:
	leaq	4+count(%rip), %rax
	movq	%r8, %rdx
	.p2align 4,,10
	.p2align 3
.L8:
	cmpb	$0, (%rdx)
	je	.L6
	addl	$1, (%rax)
.L6:
	cmpb	$0, 203(%rdx)
	je	.L7
	addl	$1, (%rax)
.L7:
	addq	$4, %rax
	addq	$1, %rdx
	cmpq	%rcx, %rax
	jne	.L8
	leal	1(%rsi), %edi
	addl	$2, %esi
	addq	$406, %r8
	cmpl	%esi, %r9d
	jg	.L9
.L4:
	movslq	%edi, %rax
	leaq	tbl(%rip), %r10
	movl	%r11d, %esi
	imulq	$203, %rax, %rax
	leaq	(%rbx,%rsi,4), %rcx
	leaq	1(%r10,%rax), %r8
	.p2align 4,,10
	.p2align 3
.L12:
	leaq	4+count(%rip), %rax
	movq	%r8, %rdx
	.p2align 4,,10
	.p2align 3
.L11:
	cmpb	$0, (%rdx)
	je	.L10
	addl	$1, (%rax)
.L10:
	addq	$4, %rax
	addq	$1, %rdx
	cmpq	%rcx, %rax
	jne	.L11
	addl	$1, %edi
	addq	$203, %r8
	cmpl	%edi, %r9d
	jge	.L12
	addq	$2, %rsi
	movl	$1, %eax
	xorl	%ebx, %ebx
	xorl	%r8d, %r8d
	leaq	count(%rip), %rdi
	leaq	Q(%rip), %rcx
	.p2align 4,,10
	.p2align 3
.L15:
	movl	(%rdi,%rax,4), %edx
	testl	%edx, %edx
	jne	.L14
	movslq	%r8d, %rdx
	movl	$1, %ebx
	addl	$1, %r8d
	movl	%eax, (%rcx,%rdx,4)
.L14:
	addq	$1, %rax
	cmpq	%rsi, %rax
	jne	.L15
	testb	%bl, %bl
	je	.L1
	movl	%r8d, end(%rip)
	testl	%r8d, %r8d
	je	.L1
	xorl	%r9d, %r9d
	xorl	%ebp, %ebp
	leaq	Q(%rip), %r11
	.p2align 4,,10
	.p2align 3
.L18:
	movslq	(%r11,%r9,4), %rcx
	leal	1(%r9), %r12d
	movl	$1, %eax
	imulq	$203, %rcx, %rcx
	addq	%r10, %rcx
	.p2align 4,,10
	.p2align 3
.L17:
	cmpb	$0, (%rcx,%rax)
	je	.L16
	subl	$1, (%rdi,%rax,4)
	jne	.L16
	movslq	%r8d, %rdx
	movl	%ebx, %ebp
	addl	$1, %r8d
	movl	%eax, (%r11,%rdx,4)
.L16:
	addq	$1, %rax
	cmpq	%rsi, %rax
	jne	.L17
	addq	$1, %r9
	cmpl	%r9d, %r8d
	jg	.L18
	movl	%r12d, top(%rip)
	testb	%bpl, %bpl
	je	.L1
	movl	%r8d, end(%rip)
.L1:
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
.L37:
	.cfi_restore 3
	.cfi_restore 6
	.cfi_restore 12
	ret
	.cfi_endproc
.LFE23:
	.size	topologicalSort, .-topologicalSort
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"1"
.LC1:
	.string	"0"
.LC2:
	.string	"%d"
.LC3:
	.string	"%d%s%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB24:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	leaq	.LC2(%rip), %rdi
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	subq	$64, %rsp
	.cfi_def_cfa_offset 112
	movq	%fs:40, %rax
	movq	%rax, 56(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %eax
	leal	-1(%rax), %edx
	movl	%edx, 4(%rsp)
	testl	%eax, %eax
	jle	.L42
	leaq	12(%rsp), %r14
	leaq	16(%rsp), %r13
	leaq	8(%rsp), %r12
	leaq	.LC3(%rip), %rbp
	leaq	tbl(%rip), %rbx
	jmp	.L45
	.p2align 4,,10
	.p2align 3
.L43:
	movl	12(%rsp), %eax
	movslq	8(%rsp), %rdx
	addl	$100, %eax
	cltq
	imulq	$203, %rax, %rax
	addq	%rbx, %rax
.L52:
	movb	$1, (%rax,%rdx)
	movl	4(%rsp), %eax
	leal	-1(%rax), %edx
	movl	%edx, 4(%rsp)
	testl	%eax, %eax
	jle	.L42
.L45:
	xorl	%eax, %eax
	movq	%r14, %rcx
	movq	%r13, %rdx
	movq	%r12, %rsi
	movq	%rbp, %rdi
	call	__isoc99_scanf@PLT
	cmpb	$119, 16(%rsp)
	jne	.L43
	movslq	8(%rsp), %rdx
	movl	12(%rsp), %eax
	imulq	$203, %rdx, %rdx
	addl	$100, %eax
	cltq
	addq	%rbx, %rdx
	jmp	.L52
	.p2align 4,,10
	.p2align 3
.L42:
	movl	$200, %edi
	call	topologicalSort
	leaq	4+count(%rip), %rax
	leaq	800(%rax), %rdx
	jmp	.L47
	.p2align 4,,10
	.p2align 3
.L54:
	addq	$4, %rax
	cmpq	%rdx, %rax
	je	.L53
.L47:
	movl	(%rax), %ecx
	testl	%ecx, %ecx
	je	.L54
	leaq	.LC0(%rip), %rdi
.L46:
	call	puts@PLT
	movq	56(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L55
	addq	$64, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 48
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
.L53:
	.cfi_restore_state
	leaq	.LC1(%rip), %rdi
	jmp	.L46
.L55:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE24:
	.size	main, .-main
	.globl	count
	.bss
	.align 32
	.type	count, @object
	.size	count, 812
count:
	.zero	812
	.globl	end
	.align 4
	.type	end, @object
	.size	end, 4
end:
	.zero	4
	.globl	top
	.align 4
	.type	top, @object
	.size	top, 4
top:
	.zero	4
	.globl	Q
	.align 32
	.type	Q, @object
	.size	Q, 812
Q:
	.zero	812
	.globl	tbl
	.align 32
	.type	tbl, @object
	.size	tbl, 41209
tbl:
	.zero	41209
	.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:

// Aizu Vol-3 0308: Deadlock
// 2017.8.27 bal4u@uu

#include <stdio.h>

#define MAX  200
#define BASE 100
char tbl[MAX+3][MAX+3];
int  Q[MAX+3], top, end;
int  count[MAX+3];

void topologicalSort(int size)
{
	int i, j;

//	memset(count, 0, sizeof(count));
	top = end = 0;
	for (i = 1; i <= size; i++) for (j = 1; j <= size; j++) if (tbl[i][j]) count[j]++;
	for (i = 1; i <= size; i++) if (!count[i]) Q[end++] = i;
	while (top < end) {
		i = Q[top++];
		for (j = 1; j <= size; j++) {
			if (tbl[i][j]) if (--count[j] == 0) Q[end++] = j;
		}
	}
}

int main(void)
{
	int N, u, d, i;
	char c[30];

	scanf("%d", &N);
//	memset(tbl, 0, sizeof(tbl));
	while (N-- > 0) {
		scanf("%d%s%d", &u, c, &d);
		if (*c == 'w') tbl[u][d+BASE] = 1;
		else           tbl[d+BASE][u] = 1;
	}
	topologicalSort(MAX);
	for (i = 1; i <= MAX; i++) if (count[i]) break;
	puts(i <= MAX ? "1" : "0");
	return 0;
}
4
1 lock 1
2 lock 2
1 wait 2
2 wait 1

1

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

```c
// Aizu Vol-3 0308: Deadlock
// 2017.8.27 bal4u@uu

#include <stdio.h>

#define MAX  200
#define BASE 100
char tbl[MAX+3][MAX+3];
int  Q[MAX+3], top, end;
int  count[MAX+3];

void topologicalSort(int size)
{
	int i, j;

//	memset(count, 0, sizeof(count));
	top = end = 0;
	for (i = 1; i <= size; i++) for (j = 1; j <= size; j++) if (tbl[i][j]) count[j]++;
	for (i = 1; i <= size; i++) if (!count[i]) Q[end++] = i;
	while (top < end) {
		i = Q[top++];
		for (j = 1; j <= size; j++) {
			if (tbl[i][j]) if (--count[j] == 0) Q[end++] = j;
		}
	}
}

int main(void)
{
	int N, u, d, i;
	char c[30];

	scanf("%d", &N);
//	memset(tbl, 0, sizeof(tbl));
	while (N-- > 0) {
		scanf("%d%s%d", &u, c, &d);
		if (*c == 'w') tbl[u][d+BASE] = 1;
		else           tbl[d+BASE][u] = 1;
	}
	topologicalSort(MAX);
	for (i = 1; i <= MAX; i++) if (count[i]) break;
	puts(i <= MAX ? "1" : "0");
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	tbl
	.bss
	.align 32
	.type	tbl, @object
	.size	tbl, 41209
tbl:
	.zero	41209
	.globl	Q
	.align 32
	.type	Q, @object
	.size	Q, 812
Q:
	.zero	812
	.globl	top
	.align 4
	.type	top, @object
	.size	top, 4
top:
	.zero	4
	.globl	end
	.align 4
	.type	end, @object
	.size	end, 4
end:
	.zero	4
	.globl	count
	.align 32
	.type	count, @object
	.size	count, 812
count:
	.zero	812
	.text
	.globl	topologicalSort
	.type	topologicalSort, @function
topologicalSort:
.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, end(%rip)
	movl	end(%rip), %eax
	movl	%eax, top(%rip)
	movl	$1, -8(%rbp)
	jmp	.L2
.L6:
	movl	$1, -4(%rbp)
	jmp	.L3
.L5:
	movl	-4(%rbp), %eax
	movslq	%eax, %rdx
	movl	-8(%rbp), %eax
	cltq
	imulq	$203, %rax, %rax
	addq	%rax, %rdx
	leaq	tbl(%rip), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	testb	%al, %al
	je	.L4
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	count(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	1(%rax), %ecx
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	count(%rip), %rax
	movl	%ecx, (%rdx,%rax)
.L4:
	addl	$1, -4(%rbp)
.L3:
	movl	-4(%rbp), %eax
	cmpl	-20(%rbp), %eax
	jle	.L5
	addl	$1, -8(%rbp)
.L2:
	movl	-8(%rbp), %eax
	cmpl	-20(%rbp), %eax
	jle	.L6
	movl	$1, -8(%rbp)
	jmp	.L7
.L9:
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	count(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	jne	.L8
	movl	end(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, end(%rip)
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	Q(%rip), %rdx
	movl	-8(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
.L8:
	addl	$1, -8(%rbp)
.L7:
	movl	-8(%rbp), %eax
	cmpl	-20(%rbp), %eax
	jle	.L9
	jmp	.L10
.L14:
	movl	top(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, top(%rip)
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	Q(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -8(%rbp)
	movl	$1, -4(%rbp)
	jmp	.L11
.L13:
	movl	-4(%rbp), %eax
	movslq	%eax, %rdx
	movl	-8(%rbp), %eax
	cltq
	imulq	$203, %rax, %rax
	addq	%rax, %rdx
	leaq	tbl(%rip), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	testb	%al, %al
	je	.L12
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	count(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	-1(%rax), %ecx
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	count(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	count(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	jne	.L12
	movl	end(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, end(%rip)
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	Q(%rip), %rdx
	movl	-4(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
.L12:
	addl	$1, -4(%rbp)
.L11:
	movl	-4(%rbp), %eax
	cmpl	-20(%rbp), %eax
	jle	.L13
.L10:
	movl	top(%rip), %edx
	movl	end(%rip), %eax
	cmpl	%eax, %edx
	jl	.L14
	nop
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	topologicalSort, .-topologicalSort
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d%s%d"
.LC2:
	.string	"1"
.LC3:
	.string	"0"
	.text
	.globl	main
	.type	main, @function
main:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$64, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-64(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	jmp	.L16
.L18:
	leaq	-56(%rbp), %rcx
	leaq	-48(%rbp), %rdx
	leaq	-60(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movzbl	-48(%rbp), %eax
	cmpb	$119, %al
	jne	.L17
	movl	-60(%rbp), %eax
	movl	-56(%rbp), %edx
	addl	$100, %edx
	movslq	%edx, %rdx
	cltq
	imulq	$203, %rax, %rax
	addq	%rax, %rdx
	leaq	tbl(%rip), %rax
	addq	%rdx, %rax
	movb	$1, (%rax)
	jmp	.L16
.L17:
	movl	-56(%rbp), %eax
	leal	100(%rax), %edx
	movl	-60(%rbp), %eax
	movslq	%eax, %rcx
	movslq	%edx, %rax
	imulq	$203, %rax, %rax
	leaq	(%rax,%rcx), %rdx
	leaq	tbl(%rip), %rax
	addq	%rdx, %rax
	movb	$1, (%rax)
.L16:
	movl	-64(%rbp), %eax
	leal	-1(%rax), %edx
	movl	%edx, -64(%rbp)
	testl	%eax, %eax
	jg	.L18
	movl	$200, %edi
	call	topologicalSort
	movl	$1, -52(%rbp)
	jmp	.L19
.L22:
	movl	-52(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	count(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	jne	.L27
	addl	$1, -52(%rbp)
.L19:
	cmpl	$200, -52(%rbp)
	jle	.L22
	jmp	.L21
.L27:
	nop
.L21:
	cmpl	$200, -52(%rbp)
	jg	.L23
	leaq	.LC2(%rip), %rax
	jmp	.L24
.L23:
	leaq	.LC3(%rip), %rax
.L24:
	movq	%rax, %rdi
	call	puts@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L26
	call	__stack_chk_fail@PLT
.L26:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```

Only output the optimized assembly code. Do not include any other text. Do not write any comments in the assembly code. Wrap the assembly code in ```assembly``` tags.
train
	.file	"temp.c"
	.text
	.globl	tbl
	.bss
	.align 32
	.type	tbl, @object
	.size	tbl, 41209
tbl:
	.zero	41209
	.globl	Q
	.align 32
	.type	Q, @object
	.size	Q, 812
Q:
	.zero	812
	.globl	top
	.align 4
	.type	top, @object
	.size	top, 4
top:
	.zero	4
	.globl	end
	.align 4
	.type	end, @object
	.size	end, 4
end:
	.zero	4
	.globl	count
	.align 32
	.type	count, @object
	.size	count, 812
count:
	.zero	812
	.text
	.globl	topologicalSort
	.type	topologicalSort, @function
topologicalSort:
.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, end(%rip)
	movl	end(%rip), %eax
	movl	%eax, top(%rip)
	movl	$1, -8(%rbp)
	jmp	.L2
.L6:
	movl	$1, -4(%rbp)
	jmp	.L3
.L5:
	movl	-4(%rbp), %eax
	movslq	%eax, %rdx
	movl	-8(%rbp), %eax
	cltq
	imulq	$203, %rax, %rax
	addq	%rax, %rdx
	leaq	tbl(%rip), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	testb	%al, %al
	je	.L4
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	count(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	1(%rax), %ecx
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	count(%rip), %rax
	movl	%ecx, (%rdx,%rax)
.L4:
	addl	$1, -4(%rbp)
.L3:
	movl	-4(%rbp), %eax
	cmpl	-20(%rbp), %eax
	jle	.L5
	addl	$1, -8(%rbp)
.L2:
	movl	-8(%rbp), %eax
	cmpl	-20(%rbp), %eax
	jle	.L6
	movl	$1, -8(%rbp)
	jmp	.L7
.L9:
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	count(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	jne	.L8
	movl	end(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, end(%rip)
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	Q(%rip), %rdx
	movl	-8(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
.L8:
	addl	$1, -8(%rbp)
.L7:
	movl	-8(%rbp), %eax
	cmpl	-20(%rbp), %eax
	jle	.L9
	jmp	.L10
.L14:
	movl	top(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, top(%rip)
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	Q(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -8(%rbp)
	movl	$1, -4(%rbp)
	jmp	.L11
.L13:
	movl	-4(%rbp), %eax
	movslq	%eax, %rdx
	movl	-8(%rbp), %eax
	cltq
	imulq	$203, %rax, %rax
	addq	%rax, %rdx
	leaq	tbl(%rip), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	testb	%al, %al
	je	.L12
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	count(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	-1(%rax), %ecx
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	count(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	count(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	jne	.L12
	movl	end(%rip), %eax
	leal	1(%rax), %edx
	movl	%edx, end(%rip)
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	Q(%rip), %rdx
	movl	-4(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
.L12:
	addl	$1, -4(%rbp)
.L11:
	movl	-4(%rbp), %eax
	cmpl	-20(%rbp), %eax
	jle	.L13
.L10:
	movl	top(%rip), %edx
	movl	end(%rip), %eax
	cmpl	%eax, %edx
	jl	.L14
	nop
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	topologicalSort, .-topologicalSort
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d%s%d"
.LC2:
	.string	"1"
.LC3:
	.string	"0"
	.text
	.globl	main
	.type	main, @function
main:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$64, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-64(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	jmp	.L16
.L18:
	leaq	-56(%rbp), %rcx
	leaq	-48(%rbp), %rdx
	leaq	-60(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movzbl	-48(%rbp), %eax
	cmpb	$119, %al
	jne	.L17
	movl	-60(%rbp), %eax
	movl	-56(%rbp), %edx
	addl	$100, %edx
	movslq	%edx, %rdx
	cltq
	imulq	$203, %rax, %rax
	addq	%rax, %rdx
	leaq	tbl(%rip), %rax
	addq	%rdx, %rax
	movb	$1, (%rax)
	jmp	.L16
.L17:
	movl	-56(%rbp), %eax
	leal	100(%rax), %edx
	movl	-60(%rbp), %eax
	movslq	%eax, %rcx
	movslq	%edx, %rax
	imulq	$203, %rax, %rax
	leaq	(%rax,%rcx), %rdx
	leaq	tbl(%rip), %rax
	addq	%rdx, %rax
	movb	$1, (%rax)
.L16:
	movl	-64(%rbp), %eax
	leal	-1(%rax), %edx
	movl	%edx, -64(%rbp)
	testl	%eax, %eax
	jg	.L18
	movl	$200, %edi
	call	topologicalSort
	movl	$1, -52(%rbp)
	jmp	.L19
.L22:
	movl	-52(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	count(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	jne	.L27
	addl	$1, -52(%rbp)
.L19:
	cmpl	$200, -52(%rbp)
	jle	.L22
	jmp	.L21
.L27:
	nop
.L21:
	cmpl	$200, -52(%rbp)
	jg	.L23
	leaq	.LC2(%rip), %rax
	jmp	.L24
.L23:
	leaq	.LC3(%rip), %rax
.L24:
	movq	%rax, %rdi
	call	puts@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L26
	call	__stack_chk_fail@PLT
.L26:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
