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

```c
n;
typedef struct{
	int x1,y1,x2,y2;
	char link[21];
}Btn;
typedef struct{
	char title[21];
	int bn;
	Btn btn[100];
}Page;
Page page[100];
hist[99999],hidx,hmax;
main(){
	int W,H,m,i,j;
	char op[9];
	for(;scanf("%d",&n)*n;){
		scanf("%d%d",&W,&H);
		for(i=n;i--;){
			Page*p=page+i;
			scanf("%s%d",p->title,&p->bn);
			for(j=p->bn;j--;){
				Btn*b=p->btn+j;
				scanf("%d%d%d%d%s",&b->x1,&b->y1,&b->x2,&b->y2,b->link);
			}
		}
		*hist=n-1;
		hmax=0;
		hidx=0;
		scanf("%d",&m);
		for(;m--;){
			scanf("%s",op);
			if(strcmp(op,"click")==0){
				Page*p=page+hist[hidx];
				int x,y;
				scanf("%d%d",&x,&y);
				for(i=p->bn;i--;){
					Btn*b=p->btn+i;
					if(x>=b->x1&&x<=b->x2&&y>=b->y1&&y<=b->y2){
						for(j=n;j--;){
							if(strcmp(page[j].title,b->link)==0){
								hist[hmax=++hidx]=j;
							}
						}
					}
				}
			}
			if(strcmp(op,"back")==0){
				if(hidx>0)
					hidx--;
			}
			if(strcmp(op,"forward")==0){
				if(hidx<hmax)
					hidx++;
			}
			if(strcmp(op,"show")==0){
				puts(page[hist[hidx]].title);
			}
		}
	}
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	n
	.bss
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	page
	.align 32
	.type	page, @object
	.size	page, 402800
page:
	.zero	402800
	.globl	hist
	.align 32
	.type	hist, @object
	.size	hist, 399996
hist:
	.zero	399996
	.globl	hidx
	.align 4
	.type	hidx, @object
	.size	hidx, 4
hidx:
	.zero	4
	.globl	hmax
	.align 4
	.type	hmax, @object
	.size	hmax, 4
hmax:
	.zero	4
	.section	.rodata
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%s%d"
.LC2:
	.string	"%d%d%d%d%s"
.LC3:
	.string	"%d"
.LC4:
	.string	"%s"
.LC5:
	.string	"click"
.LC6:
	.string	"back"
.LC7:
	.string	"forward"
.LC8:
	.string	"show"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$96, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	jmp	.L2
.L16:
	leaq	-80(%rbp), %rdx
	leaq	-84(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movl	n(%rip), %eax
	movl	%eax, -64(%rbp)
	jmp	.L3
.L6:
	movl	-64(%rbp), %eax
	cltq
	imulq	$4028, %rax, %rax
	leaq	page(%rip), %rdx
	addq	%rdx, %rax
	movq	%rax, -40(%rbp)
	movq	-40(%rbp), %rax
	leaq	24(%rax), %rdx
	movq	-40(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movq	-40(%rbp), %rax
	movl	24(%rax), %eax
	movl	%eax, -60(%rbp)
	jmp	.L4
.L5:
	movq	-40(%rbp), %rax
	leaq	28(%rax), %rcx
	movl	-60(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	addq	%rcx, %rax
	movq	%rax, -32(%rbp)
	movq	-32(%rbp), %rax
	leaq	16(%rax), %rdi
	movq	-32(%rbp), %rax
	leaq	12(%rax), %rsi
	movq	-32(%rbp), %rax
	leaq	8(%rax), %rcx
	movq	-32(%rbp), %rax
	leaq	4(%rax), %rdx
	movq	-32(%rbp), %rax
	movq	%rdi, %r9
	movq	%rsi, %r8
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
.L4:
	movl	-60(%rbp), %eax
	leal	-1(%rax), %edx
	movl	%edx, -60(%rbp)
	testl	%eax, %eax
	jne	.L5
.L3:
	movl	-64(%rbp), %eax
	leal	-1(%rax), %edx
	movl	%edx, -64(%rbp)
	testl	%eax, %eax
	jne	.L6
	movl	n(%rip), %eax
	subl	$1, %eax
	movl	%eax, hist(%rip)
	movl	$0, hmax(%rip)
	movl	$0, hidx(%rip)
	leaq	-76(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	jmp	.L7
.L15:
	leaq	-17(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC4(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	leaq	-17(%rbp), %rax
	leaq	.LC5(%rip), %rdx
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L8
	movl	hidx(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	hist(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	imulq	$4028, %rax, %rax
	leaq	page(%rip), %rdx
	addq	%rdx, %rax
	movq	%rax, -56(%rbp)
	leaq	-68(%rbp), %rdx
	leaq	-72(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movq	-56(%rbp), %rax
	movl	24(%rax), %eax
	movl	%eax, -64(%rbp)
	jmp	.L9
.L12:
	movq	-56(%rbp), %rax
	leaq	28(%rax), %rcx
	movl	-64(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	addq	%rcx, %rax
	movq	%rax, -48(%rbp)
	movq	-48(%rbp), %rax
	movl	(%rax), %edx
	movl	-72(%rbp), %eax
	cmpl	%eax, %edx
	jg	.L9
	movq	-48(%rbp), %rax
	movl	8(%rax), %edx
	movl	-72(%rbp), %eax
	cmpl	%eax, %edx
	jl	.L9
	movq	-48(%rbp), %rax
	movl	4(%rax), %edx
	movl	-68(%rbp), %eax
	cmpl	%eax, %edx
	jg	.L9
	movq	-48(%rbp), %rax
	movl	12(%rax), %edx
	movl	-68(%rbp), %eax
	cmpl	%eax, %edx
	jl	.L9
	movl	n(%rip), %eax
	movl	%eax, -60(%rbp)
	jmp	.L10
.L11:
	movq	-48(%rbp), %rax
	leaq	16(%rax), %rdx
	movl	-60(%rbp), %eax
	cltq
	imulq	$4028, %rax, %rax
	leaq	page(%rip), %rcx
	addq	%rcx, %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L10
	movl	hidx(%rip), %eax
	addl	$1, %eax
	movl	%eax, hidx(%rip)
	movl	hidx(%rip), %eax
	movl	%eax, hmax(%rip)
	movl	hmax(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	hist(%rip), %rdx
	movl	-60(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
.L10:
	movl	-60(%rbp), %eax
	leal	-1(%rax), %edx
	movl	%edx, -60(%rbp)
	testl	%eax, %eax
	jne	.L11
.L9:
	movl	-64(%rbp), %eax
	leal	-1(%rax), %edx
	movl	%edx, -64(%rbp)
	testl	%eax, %eax
	jne	.L12
.L8:
	leaq	-17(%rbp), %rax
	leaq	.LC6(%rip), %rdx
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L13
	movl	hidx(%rip), %eax
	testl	%eax, %eax
	jle	.L13
	movl	hidx(%rip), %eax
	subl	$1, %eax
	movl	%eax, hidx(%rip)
.L13:
	leaq	-17(%rbp), %rax
	leaq	.LC7(%rip), %rdx
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L14
	movl	hidx(%rip), %edx
	movl	hmax(%rip), %eax
	cmpl	%eax, %edx
	jge	.L14
	movl	hidx(%rip), %eax
	addl	$1, %eax
	movl	%eax, hidx(%rip)
.L14:
	leaq	-17(%rbp), %rax
	leaq	.LC8(%rip), %rdx
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L7
	movl	hidx(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	hist(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	imulq	$4028, %rax, %rax
	leaq	page(%rip), %rdx
	addq	%rdx, %rax
	movq	%rax, %rdi
	call	puts@PLT
.L7:
	movl	-76(%rbp), %eax
	leal	-1(%rax), %edx
	movl	%edx, -76(%rbp)
	testl	%eax, %eax
	jne	.L15
.L2:
	leaq	n(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movl	n(%rip), %edx
	imull	%edx, %eax
	testl	%eax, %eax
	jne	.L16
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L18
	call	__stack_chk_fail@PLT
.L18:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.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
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%s%d"
.LC2:
	.string	"%d%d%d%d%s"
.LC3:
	.string	"%d"
.LC4:
	.string	"%s"
.LC5:
	.string	"click"
.LC6:
	.string	"back"
.LC7:
	.string	"forward"
.LC8:
	.string	"show"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB0:
	.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	$88, %rsp
	.cfi_def_cfa_offset 144
	movq	%fs:40, %rax
	movq	%rax, 72(%rsp)
	xorl	%eax, %eax
	.p2align 4,,10
	.p2align 3
.L2:
	leaq	n(%rip), %rsi
	leaq	.LC3(%rip), %rdi
	xorl	%eax, %eax
	call	scanf@PLT
	imull	n(%rip), %eax
	testl	%eax, %eax
	je	.L43
	leaq	44(%rsp), %rdx
	leaq	40(%rsp), %rsi
	xorl	%eax, %eax
	leaq	.LC0(%rip), %rdi
	call	scanf@PLT
	movl	n(%rip), %eax
	leal	-1(%rax), %edx
	testl	%eax, %eax
	je	.L32
	movslq	%eax, %r14
	movslq	%edx, %r12
	movl	%edx, %edx
	movq	%r14, %rax
	imulq	$4028, %r12, %r12
	leaq	page(%rip), %rsi
	subq	%rdx, %rax
	leaq	.LC1(%rip), %r15
	leaq	.LC2(%rip), %r13
	imulq	$4028, %rax, %r14
	leaq	-8056(%rsi), %rax
	addq	%rsi, %r12
	addq	%rax, %r14
	.p2align 4,,10
	.p2align 3
.L5:
	leaq	24(%r12), %rdx
	movq	%r12, %rsi
	movq	%r15, %rdi
	xorl	%eax, %eax
	call	scanf@PLT
	movl	24(%r12), %edx
	leal	-1(%rdx), %eax
	testl	%edx, %edx
	je	.L8
	movslq	%eax, %rdx
	movl	%eax, %eax
	leaq	(%rdx,%rdx,4), %rdx
	leaq	(%rax,%rax,4), %rax
	salq	$3, %rdx
	salq	$3, %rax
	leaq	-12(%r12,%rdx), %rbp
	leaq	28(%r12,%rdx), %rbx
	subq	%rax, %rbp
	.p2align 4,,10
	.p2align 3
.L7:
	leaq	8(%rbx), %rcx
	leaq	4(%rbx), %rdx
	movq	%rbx, %rsi
	movq	%r13, %rdi
	leaq	16(%rbx), %r9
	leaq	12(%rbx), %r8
	xorl	%eax, %eax
	subq	$40, %rbx
	call	scanf@PLT
	cmpq	%rbx, %rbp
	jne	.L7
.L8:
	subq	$4028, %r12
	cmpq	%r14, %r12
	jne	.L5
	movl	n(%rip), %eax
	subl	$1, %eax
.L3:
	movl	%eax, hist(%rip)
	leaq	48(%rsp), %rsi
	xorl	%eax, %eax
	leaq	.LC3(%rip), %rdi
	movl	$0, hmax(%rip)
	leaq	.LC4(%rip), %rbp
	movabsq	$28273260612448102, %rbx
	movl	$0, hidx(%rip)
	call	scanf@PLT
.L9:
	leaq	63(%rsp), %r15
	movq	%r15, %r14
	.p2align 4,,10
	.p2align 3
.L28:
	movl	48(%rsp), %eax
	leal	-1(%rax), %edx
	movl	%edx, 48(%rsp)
	testl	%eax, %eax
	je	.L2
	xorl	%eax, %eax
	movq	%r14, %rsi
	movq	%rbp, %rdi
	call	scanf@PLT
	cmpl	$1667853411, (%r14)
	je	.L44
.L12:
	cmpl	$1801675106, (%r14)
	je	.L45
.L22:
	cmpq	%rbx, (%r14)
	je	.L46
.L25:
	cmpl	$2003789939, (%r14)
	jne	.L28
	cmpb	$0, 4(%r14)
	jne	.L28
	movslq	hidx(%rip), %rax
	leaq	hist(%rip), %rdi
	movslq	(%rdi,%rax,4), %rdi
	leaq	page(%rip), %rax
	imulq	$4028, %rdi, %rdi
	addq	%rax, %rdi
	call	puts@PLT
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L46:
	movl	hidx(%rip), %eax
	cmpl	hmax(%rip), %eax
	jge	.L25
	addl	$1, %eax
	movl	%eax, hidx(%rip)
	jmp	.L25
	.p2align 4,,10
	.p2align 3
.L45:
	cmpb	$0, 4(%r14)
	jne	.L22
	movl	hidx(%rip), %eax
	testl	%eax, %eax
	jle	.L22
	subl	$1, %eax
	movl	%eax, hidx(%rip)
	jmp	.L22
	.p2align 4,,10
	.p2align 3
.L44:
	cmpw	$107, 4(%r14)
	jne	.L12
	movslq	hidx(%rip), %rax
	leaq	hist(%rip), %rsi
	leaq	56(%rsp), %rdx
	leaq	.LC0(%rip), %rdi
	movslq	(%rsi,%rax,4), %r12
	leaq	page(%rip), %rax
	leaq	52(%rsp), %rsi
	imulq	$4028, %r12, %r12
	addq	%rax, %r12
	xorl	%eax, %eax
	call	scanf@PLT
	movl	24(%r12), %edx
	leal	-1(%rdx), %eax
	testl	%edx, %edx
	je	.L12
	movl	56(%rsp), %esi
	movl	n(%rip), %edi
	movq	%r14, (%rsp)
	movl	52(%rsp), %edx
	movl	%esi, 8(%rsp)
	movslq	%eax, %rsi
	movl	%eax, %eax
	leaq	(%rsi,%rsi,4), %rsi
	movl	%edi, 12(%rsp)
	subl	$1, %edi
	leaq	(%rax,%rax,4), %rax
	salq	$3, %rsi
	salq	$3, %rax
	movl	%edi, 24(%rsp)
	leaq	4(%r12,%rsi), %r8
	leaq	44(%r12,%rsi), %r15
	movslq	%edi, %r12
	imulq	$4028, %r12, %r12
	subq	%rax, %r8
	leaq	page(%rip), %rax
	movq	%r8, %r14
	addq	%r12, %rax
	movl	%edx, %r12d
	movq	%rax, 16(%rsp)
	.p2align 4,,10
	.p2align 3
.L15:
	cmpl	%r12d, -16(%r15)
	jg	.L17
	cmpl	-8(%r15), %r12d
	jg	.L17
	movl	8(%rsp), %eax
	cmpl	%eax, -12(%r15)
	jg	.L17
	cmpl	-4(%r15), %eax
	jle	.L47
	.p2align 4,,10
	.p2align 3
.L17:
	subq	$40, %r15
	cmpq	%r15, %r14
	jne	.L15
	movq	(%rsp), %r14
	jmp	.L12
.L47:
	movl	12(%rsp), %eax
	testl	%eax, %eax
	je	.L17
	movq	16(%rsp), %rdi
	movl	24(%rsp), %r13d
	movl	%r12d, 28(%rsp)
	movq	%rdi, %r12
	.p2align 4,,10
	.p2align 3
.L19:
	movq	%r15, %rsi
	movq	%r12, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L18
	movl	hidx(%rip), %eax
	leaq	hist(%rip), %rsi
	addl	$1, %eax
	movl	%eax, hidx(%rip)
	movl	%eax, hmax(%rip)
	cltq
	movl	%r13d, (%rsi,%rax,4)
.L18:
	subl	$1, %r13d
	subq	$4028, %r12
	cmpl	$-1, %r13d
	jne	.L19
	movl	28(%rsp), %r12d
	jmp	.L17
.L43:
	movq	72(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L48
	addq	$88, %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
.L32:
	.cfi_restore_state
	movl	$-1, %eax
	jmp	.L3
.L48:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	hmax
	.bss
	.align 4
	.type	hmax, @object
	.size	hmax, 4
hmax:
	.zero	4
	.globl	hidx
	.align 4
	.type	hidx, @object
	.size	hidx, 4
hidx:
	.zero	4
	.globl	hist
	.align 32
	.type	hist, @object
	.size	hist, 399996
hist:
	.zero	399996
	.globl	page
	.align 32
	.type	page, @object
	.size	page, 402800
page:
	.zero	402800
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.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
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%s%d"
.LC2:
	.string	"%d%d%d%d%s"
.LC3:
	.string	"%d"
.LC4:
	.string	"%s"
.LC5:
	.string	"click"
.LC6:
	.string	"back"
.LC7:
	.string	"forward"
.LC8:
	.string	"show"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB0:
	.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	$88, %rsp
	.cfi_def_cfa_offset 144
	movq	%fs:40, %rax
	movq	%rax, 72(%rsp)
	xorl	%eax, %eax
	.p2align 4,,10
	.p2align 3
.L2:
	leaq	n(%rip), %rsi
	leaq	.LC3(%rip), %rdi
	xorl	%eax, %eax
	call	scanf@PLT
	imull	n(%rip), %eax
	testl	%eax, %eax
	je	.L43
	leaq	44(%rsp), %rdx
	leaq	40(%rsp), %rsi
	xorl	%eax, %eax
	leaq	.LC0(%rip), %rdi
	call	scanf@PLT
	movl	n(%rip), %eax
	leal	-1(%rax), %edx
	testl	%eax, %eax
	je	.L32
	movslq	%eax, %r14
	movslq	%edx, %r12
	movl	%edx, %edx
	movq	%r14, %rax
	imulq	$4028, %r12, %r12
	leaq	page(%rip), %rsi
	subq	%rdx, %rax
	leaq	.LC1(%rip), %r15
	leaq	.LC2(%rip), %r13
	imulq	$4028, %rax, %r14
	leaq	-8056(%rsi), %rax
	addq	%rsi, %r12
	addq	%rax, %r14
	.p2align 4,,10
	.p2align 3
.L5:
	leaq	24(%r12), %rdx
	movq	%r12, %rsi
	movq	%r15, %rdi
	xorl	%eax, %eax
	call	scanf@PLT
	movl	24(%r12), %edx
	leal	-1(%rdx), %eax
	testl	%edx, %edx
	je	.L8
	movslq	%eax, %rdx
	movl	%eax, %eax
	leaq	(%rdx,%rdx,4), %rdx
	leaq	(%rax,%rax,4), %rax
	salq	$3, %rdx
	salq	$3, %rax
	leaq	-12(%r12,%rdx), %rbp
	leaq	28(%r12,%rdx), %rbx
	subq	%rax, %rbp
	.p2align 4,,10
	.p2align 3
.L7:
	leaq	8(%rbx), %rcx
	leaq	4(%rbx), %rdx
	movq	%rbx, %rsi
	movq	%r13, %rdi
	leaq	16(%rbx), %r9
	leaq	12(%rbx), %r8
	xorl	%eax, %eax
	subq	$40, %rbx
	call	scanf@PLT
	cmpq	%rbx, %rbp
	jne	.L7
.L8:
	subq	$4028, %r12
	cmpq	%r14, %r12
	jne	.L5
	movl	n(%rip), %eax
	subl	$1, %eax
.L3:
	movl	%eax, hist(%rip)
	leaq	48(%rsp), %rsi
	xorl	%eax, %eax
	leaq	.LC3(%rip), %rdi
	movl	$0, hmax(%rip)
	leaq	.LC4(%rip), %rbp
	movabsq	$28273260612448102, %rbx
	movl	$0, hidx(%rip)
	call	scanf@PLT
.L9:
	leaq	63(%rsp), %r15
	movq	%r15, %r14
	.p2align 4,,10
	.p2align 3
.L28:
	movl	48(%rsp), %eax
	leal	-1(%rax), %edx
	movl	%edx, 48(%rsp)
	testl	%eax, %eax
	je	.L2
	xorl	%eax, %eax
	movq	%r14, %rsi
	movq	%rbp, %rdi
	call	scanf@PLT
	cmpl	$1667853411, (%r14)
	je	.L44
.L12:
	cmpl	$1801675106, (%r14)
	je	.L45
.L22:
	cmpq	%rbx, (%r14)
	je	.L46
.L25:
	cmpl	$2003789939, (%r14)
	jne	.L28
	cmpb	$0, 4(%r14)
	jne	.L28
	movslq	hidx(%rip), %rax
	leaq	hist(%rip), %rdi
	movslq	(%rdi,%rax,4), %rdi
	leaq	page(%rip), %rax
	imulq	$4028, %rdi, %rdi
	addq	%rax, %rdi
	call	puts@PLT
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L46:
	movl	hidx(%rip), %eax
	cmpl	hmax(%rip), %eax
	jge	.L25
	addl	$1, %eax
	movl	%eax, hidx(%rip)
	jmp	.L25
	.p2align 4,,10
	.p2align 3
.L45:
	cmpb	$0, 4(%r14)
	jne	.L22
	movl	hidx(%rip), %eax
	testl	%eax, %eax
	jle	.L22
	subl	$1, %eax
	movl	%eax, hidx(%rip)
	jmp	.L22
	.p2align 4,,10
	.p2align 3
.L44:
	cmpw	$107, 4(%r14)
	jne	.L12
	movslq	hidx(%rip), %rax
	leaq	hist(%rip), %rsi
	leaq	56(%rsp), %rdx
	leaq	.LC0(%rip), %rdi
	movslq	(%rsi,%rax,4), %r12
	leaq	page(%rip), %rax
	leaq	52(%rsp), %rsi
	imulq	$4028, %r12, %r12
	addq	%rax, %r12
	xorl	%eax, %eax
	call	scanf@PLT
	movl	24(%r12), %edx
	leal	-1(%rdx), %eax
	testl	%edx, %edx
	je	.L12
	movl	56(%rsp), %esi
	movl	n(%rip), %edi
	movq	%r14, (%rsp)
	movl	52(%rsp), %edx
	movl	%esi, 8(%rsp)
	movslq	%eax, %rsi
	movl	%eax, %eax
	leaq	(%rsi,%rsi,4), %rsi
	movl	%edi, 12(%rsp)
	subl	$1, %edi
	leaq	(%rax,%rax,4), %rax
	salq	$3, %rsi
	salq	$3, %rax
	movl	%edi, 24(%rsp)
	leaq	4(%r12,%rsi), %r8
	leaq	44(%r12,%rsi), %r15
	movslq	%edi, %r12
	imulq	$4028, %r12, %r12
	subq	%rax, %r8
	leaq	page(%rip), %rax
	movq	%r8, %r14
	addq	%r12, %rax
	movl	%edx, %r12d
	movq	%rax, 16(%rsp)
	.p2align 4,,10
	.p2align 3
.L15:
	cmpl	%r12d, -16(%r15)
	jg	.L17
	cmpl	-8(%r15), %r12d
	jg	.L17
	movl	8(%rsp), %eax
	cmpl	%eax, -12(%r15)
	jg	.L17
	cmpl	-4(%r15), %eax
	jle	.L47
	.p2align 4,,10
	.p2align 3
.L17:
	subq	$40, %r15
	cmpq	%r15, %r14
	jne	.L15
	movq	(%rsp), %r14
	jmp	.L12
.L47:
	movl	12(%rsp), %eax
	testl	%eax, %eax
	je	.L17
	movq	16(%rsp), %rdi
	movl	24(%rsp), %r13d
	movl	%r12d, 28(%rsp)
	movq	%rdi, %r12
	.p2align 4,,10
	.p2align 3
.L19:
	movq	%r15, %rsi
	movq	%r12, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L18
	movl	hidx(%rip), %eax
	leaq	hist(%rip), %rsi
	addl	$1, %eax
	movl	%eax, hidx(%rip)
	movl	%eax, hmax(%rip)
	cltq
	movl	%r13d, (%rsi,%rax,4)
.L18:
	subl	$1, %r13d
	subq	$4028, %r12
	cmpl	$-1, %r13d
	jne	.L19
	movl	28(%rsp), %r12d
	jmp	.L17
.L43:
	movq	72(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L48
	addq	$88, %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
.L32:
	.cfi_restore_state
	movl	$-1, %eax
	jmp	.L3
.L48:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	hmax
	.bss
	.align 4
	.type	hmax, @object
	.size	hmax, 4
hmax:
	.zero	4
	.globl	hidx
	.align 4
	.type	hidx, @object
	.size	hidx, 4
hidx:
	.zero	4
	.globl	hist
	.align 32
	.type	hist, @object
	.size	hist, 399996
hist:
	.zero	399996
	.globl	page
	.align 32
	.type	page, @object
	.size	page, 402800
page:
	.zero	402800
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.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:

n;
typedef struct{
	int x1,y1,x2,y2;
	char link[21];
}Btn;
typedef struct{
	char title[21];
	int bn;
	Btn btn[100];
}Page;
Page page[100];
hist[99999],hidx,hmax;
main(){
	int W,H,m,i,j;
	char op[9];
	for(;scanf("%d",&n)*n;){
		scanf("%d%d",&W,&H);
		for(i=n;i--;){
			Page*p=page+i;
			scanf("%s%d",p->title,&p->bn);
			for(j=p->bn;j--;){
				Btn*b=p->btn+j;
				scanf("%d%d%d%d%s",&b->x1,&b->y1,&b->x2,&b->y2,b->link);
			}
		}
		*hist=n-1;
		hmax=0;
		hidx=0;
		scanf("%d",&m);
		for(;m--;){
			scanf("%s",op);
			if(strcmp(op,"click")==0){
				Page*p=page+hist[hidx];
				int x,y;
				scanf("%d%d",&x,&y);
				for(i=p->bn;i--;){
					Btn*b=p->btn+i;
					if(x>=b->x1&&x<=b->x2&&y>=b->y1&&y<=b->y2){
						for(j=n;j--;){
							if(strcmp(page[j].title,b->link)==0){
								hist[hmax=++hidx]=j;
							}
						}
					}
				}
			}
			if(strcmp(op,"back")==0){
				if(hidx>0)
					hidx--;
			}
			if(strcmp(op,"forward")==0){
				if(hidx<hmax)
					hidx++;
			}
			if(strcmp(op,"show")==0){
				puts(page[hist[hidx]].title);
			}
		}
	}
}
3
800 600
index 1
842 100 700 200 profile
profile 2
100 100 400 200 index
100 400 400 500 link
link 1
100 100 300 200 index
9
click 600 150
show
click 200 450
show
back
back
show
forward
show
0
 3
800 600
index 1
842 100 700 200 profile
profile 2
100 100 400 200 index
100 400 400 500 link
link 1
100 100 300 200 index
9
click 600 150
show
click 200 450
show
back
back
show
forward
wohs
0
 3
800 600
index 1
500 100 700 200 profile
profile 2
100 100 400 200 index
100 400 400 965 link
link 1
100 100 300 200 index
9
click 600 150
show
click 200 450
show
back
back
show
forward
show
0
 3
800 600
index 1
842 100 700 200 profile
profile 2
100 110 400 200 index
100 742 400 500 link
link 1
100 100 300 200 index
9
click 600 150
show
click 200 450
show
back
back
sgow
forward
sgow
0
 3
800 600
indxe 1
842 100 700 200 profile
profile 2
100 100 400 200 index
100 742 400 500 link
link 1
100 100 300 200 index
9
click 600 150
show
click 200 450
show
back
back
show
forward
show
0
 3
800 600
inddx 1
500 100 700 200 profile
profile 2
100 100 400 200 index
100 400 400 965 link
link 1
100 100 300 200 index
9
click 600 150
show
click 200 578
show
back
back
show
forward
show
0
 3
800 600
inddx 1
500 100 700 145 profile
profile 2
100 100 400 200 index
100 400 400 965 link
link 1
100 100 300 200 index
9
click 600 150
show
click 200 578
show
back
back
show
forward
show
0
 3
800 600
indxf 1
1381 100 700 200 profile
profile 2
100 100 736 200 index
100 243 400 500 link
link 1
100 100 300 200 index
9
click 600 150
show
click 200 450
show
back
b`ck
show
forward
show
0
 3
800 600
index 1
842 110 700 200 profile
profile 2
100 100 400 200 imddx
110 400 400 500 link
link 1
100 100 82 200 index
9
click 600 150
ogsw
click 200 157
show
back
kcab
thow
forward
wphs
0
 3
800 600
jndex 1
905 110 700 200 orofile
prnfile 2
100 100 400 200 imddx
110 400 400 500 link
lknh 1
100 100 82 200 index
9
click 81 150
ogsw
click 200 157
show
cabk
kcab
tiow
forward
wphs
0

index
index
index
index
 index
index
index
 profile
link
index
profile
 index
index
 indxe
indxe
indxe
indxe
 profile
link
inddx
profile
 inddx
inddx
inddx
inddx
 indxf
indxf
indxf
indxf
 index
 jndex

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

```c
n;
typedef struct{
	int x1,y1,x2,y2;
	char link[21];
}Btn;
typedef struct{
	char title[21];
	int bn;
	Btn btn[100];
}Page;
Page page[100];
hist[99999],hidx,hmax;
main(){
	int W,H,m,i,j;
	char op[9];
	for(;scanf("%d",&n)*n;){
		scanf("%d%d",&W,&H);
		for(i=n;i--;){
			Page*p=page+i;
			scanf("%s%d",p->title,&p->bn);
			for(j=p->bn;j--;){
				Btn*b=p->btn+j;
				scanf("%d%d%d%d%s",&b->x1,&b->y1,&b->x2,&b->y2,b->link);
			}
		}
		*hist=n-1;
		hmax=0;
		hidx=0;
		scanf("%d",&m);
		for(;m--;){
			scanf("%s",op);
			if(strcmp(op,"click")==0){
				Page*p=page+hist[hidx];
				int x,y;
				scanf("%d%d",&x,&y);
				for(i=p->bn;i--;){
					Btn*b=p->btn+i;
					if(x>=b->x1&&x<=b->x2&&y>=b->y1&&y<=b->y2){
						for(j=n;j--;){
							if(strcmp(page[j].title,b->link)==0){
								hist[hmax=++hidx]=j;
							}
						}
					}
				}
			}
			if(strcmp(op,"back")==0){
				if(hidx>0)
					hidx--;
			}
			if(strcmp(op,"forward")==0){
				if(hidx<hmax)
					hidx++;
			}
			if(strcmp(op,"show")==0){
				puts(page[hist[hidx]].title);
			}
		}
	}
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	n
	.bss
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	page
	.align 32
	.type	page, @object
	.size	page, 402800
page:
	.zero	402800
	.globl	hist
	.align 32
	.type	hist, @object
	.size	hist, 399996
hist:
	.zero	399996
	.globl	hidx
	.align 4
	.type	hidx, @object
	.size	hidx, 4
hidx:
	.zero	4
	.globl	hmax
	.align 4
	.type	hmax, @object
	.size	hmax, 4
hmax:
	.zero	4
	.section	.rodata
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%s%d"
.LC2:
	.string	"%d%d%d%d%s"
.LC3:
	.string	"%d"
.LC4:
	.string	"%s"
.LC5:
	.string	"click"
.LC6:
	.string	"back"
.LC7:
	.string	"forward"
.LC8:
	.string	"show"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$96, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	jmp	.L2
.L16:
	leaq	-80(%rbp), %rdx
	leaq	-84(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movl	n(%rip), %eax
	movl	%eax, -64(%rbp)
	jmp	.L3
.L6:
	movl	-64(%rbp), %eax
	cltq
	imulq	$4028, %rax, %rax
	leaq	page(%rip), %rdx
	addq	%rdx, %rax
	movq	%rax, -40(%rbp)
	movq	-40(%rbp), %rax
	leaq	24(%rax), %rdx
	movq	-40(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movq	-40(%rbp), %rax
	movl	24(%rax), %eax
	movl	%eax, -60(%rbp)
	jmp	.L4
.L5:
	movq	-40(%rbp), %rax
	leaq	28(%rax), %rcx
	movl	-60(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	addq	%rcx, %rax
	movq	%rax, -32(%rbp)
	movq	-32(%rbp), %rax
	leaq	16(%rax), %rdi
	movq	-32(%rbp), %rax
	leaq	12(%rax), %rsi
	movq	-32(%rbp), %rax
	leaq	8(%rax), %rcx
	movq	-32(%rbp), %rax
	leaq	4(%rax), %rdx
	movq	-32(%rbp), %rax
	movq	%rdi, %r9
	movq	%rsi, %r8
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
.L4:
	movl	-60(%rbp), %eax
	leal	-1(%rax), %edx
	movl	%edx, -60(%rbp)
	testl	%eax, %eax
	jne	.L5
.L3:
	movl	-64(%rbp), %eax
	leal	-1(%rax), %edx
	movl	%edx, -64(%rbp)
	testl	%eax, %eax
	jne	.L6
	movl	n(%rip), %eax
	subl	$1, %eax
	movl	%eax, hist(%rip)
	movl	$0, hmax(%rip)
	movl	$0, hidx(%rip)
	leaq	-76(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	jmp	.L7
.L15:
	leaq	-17(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC4(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	leaq	-17(%rbp), %rax
	leaq	.LC5(%rip), %rdx
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L8
	movl	hidx(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	hist(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	imulq	$4028, %rax, %rax
	leaq	page(%rip), %rdx
	addq	%rdx, %rax
	movq	%rax, -56(%rbp)
	leaq	-68(%rbp), %rdx
	leaq	-72(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movq	-56(%rbp), %rax
	movl	24(%rax), %eax
	movl	%eax, -64(%rbp)
	jmp	.L9
.L12:
	movq	-56(%rbp), %rax
	leaq	28(%rax), %rcx
	movl	-64(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	addq	%rcx, %rax
	movq	%rax, -48(%rbp)
	movq	-48(%rbp), %rax
	movl	(%rax), %edx
	movl	-72(%rbp), %eax
	cmpl	%eax, %edx
	jg	.L9
	movq	-48(%rbp), %rax
	movl	8(%rax), %edx
	movl	-72(%rbp), %eax
	cmpl	%eax, %edx
	jl	.L9
	movq	-48(%rbp), %rax
	movl	4(%rax), %edx
	movl	-68(%rbp), %eax
	cmpl	%eax, %edx
	jg	.L9
	movq	-48(%rbp), %rax
	movl	12(%rax), %edx
	movl	-68(%rbp), %eax
	cmpl	%eax, %edx
	jl	.L9
	movl	n(%rip), %eax
	movl	%eax, -60(%rbp)
	jmp	.L10
.L11:
	movq	-48(%rbp), %rax
	leaq	16(%rax), %rdx
	movl	-60(%rbp), %eax
	cltq
	imulq	$4028, %rax, %rax
	leaq	page(%rip), %rcx
	addq	%rcx, %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L10
	movl	hidx(%rip), %eax
	addl	$1, %eax
	movl	%eax, hidx(%rip)
	movl	hidx(%rip), %eax
	movl	%eax, hmax(%rip)
	movl	hmax(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	hist(%rip), %rdx
	movl	-60(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
.L10:
	movl	-60(%rbp), %eax
	leal	-1(%rax), %edx
	movl	%edx, -60(%rbp)
	testl	%eax, %eax
	jne	.L11
.L9:
	movl	-64(%rbp), %eax
	leal	-1(%rax), %edx
	movl	%edx, -64(%rbp)
	testl	%eax, %eax
	jne	.L12
.L8:
	leaq	-17(%rbp), %rax
	leaq	.LC6(%rip), %rdx
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L13
	movl	hidx(%rip), %eax
	testl	%eax, %eax
	jle	.L13
	movl	hidx(%rip), %eax
	subl	$1, %eax
	movl	%eax, hidx(%rip)
.L13:
	leaq	-17(%rbp), %rax
	leaq	.LC7(%rip), %rdx
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L14
	movl	hidx(%rip), %edx
	movl	hmax(%rip), %eax
	cmpl	%eax, %edx
	jge	.L14
	movl	hidx(%rip), %eax
	addl	$1, %eax
	movl	%eax, hidx(%rip)
.L14:
	leaq	-17(%rbp), %rax
	leaq	.LC8(%rip), %rdx
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L7
	movl	hidx(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	hist(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	imulq	$4028, %rax, %rax
	leaq	page(%rip), %rdx
	addq	%rdx, %rax
	movq	%rax, %rdi
	call	puts@PLT
.L7:
	movl	-76(%rbp), %eax
	leal	-1(%rax), %edx
	movl	%edx, -76(%rbp)
	testl	%eax, %eax
	jne	.L15
.L2:
	leaq	n(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movl	n(%rip), %edx
	imull	%edx, %eax
	testl	%eax, %eax
	jne	.L16
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L18
	call	__stack_chk_fail@PLT
.L18:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.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	n
	.bss
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	page
	.align 32
	.type	page, @object
	.size	page, 402800
page:
	.zero	402800
	.globl	hist
	.align 32
	.type	hist, @object
	.size	hist, 399996
hist:
	.zero	399996
	.globl	hidx
	.align 4
	.type	hidx, @object
	.size	hidx, 4
hidx:
	.zero	4
	.globl	hmax
	.align 4
	.type	hmax, @object
	.size	hmax, 4
hmax:
	.zero	4
	.section	.rodata
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%s%d"
.LC2:
	.string	"%d%d%d%d%s"
.LC3:
	.string	"%d"
.LC4:
	.string	"%s"
.LC5:
	.string	"click"
.LC6:
	.string	"back"
.LC7:
	.string	"forward"
.LC8:
	.string	"show"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$96, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	jmp	.L2
.L16:
	leaq	-80(%rbp), %rdx
	leaq	-84(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movl	n(%rip), %eax
	movl	%eax, -64(%rbp)
	jmp	.L3
.L6:
	movl	-64(%rbp), %eax
	cltq
	imulq	$4028, %rax, %rax
	leaq	page(%rip), %rdx
	addq	%rdx, %rax
	movq	%rax, -40(%rbp)
	movq	-40(%rbp), %rax
	leaq	24(%rax), %rdx
	movq	-40(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movq	-40(%rbp), %rax
	movl	24(%rax), %eax
	movl	%eax, -60(%rbp)
	jmp	.L4
.L5:
	movq	-40(%rbp), %rax
	leaq	28(%rax), %rcx
	movl	-60(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	addq	%rcx, %rax
	movq	%rax, -32(%rbp)
	movq	-32(%rbp), %rax
	leaq	16(%rax), %rdi
	movq	-32(%rbp), %rax
	leaq	12(%rax), %rsi
	movq	-32(%rbp), %rax
	leaq	8(%rax), %rcx
	movq	-32(%rbp), %rax
	leaq	4(%rax), %rdx
	movq	-32(%rbp), %rax
	movq	%rdi, %r9
	movq	%rsi, %r8
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
.L4:
	movl	-60(%rbp), %eax
	leal	-1(%rax), %edx
	movl	%edx, -60(%rbp)
	testl	%eax, %eax
	jne	.L5
.L3:
	movl	-64(%rbp), %eax
	leal	-1(%rax), %edx
	movl	%edx, -64(%rbp)
	testl	%eax, %eax
	jne	.L6
	movl	n(%rip), %eax
	subl	$1, %eax
	movl	%eax, hist(%rip)
	movl	$0, hmax(%rip)
	movl	$0, hidx(%rip)
	leaq	-76(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	jmp	.L7
.L15:
	leaq	-17(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC4(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	leaq	-17(%rbp), %rax
	leaq	.LC5(%rip), %rdx
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L8
	movl	hidx(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	hist(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	imulq	$4028, %rax, %rax
	leaq	page(%rip), %rdx
	addq	%rdx, %rax
	movq	%rax, -56(%rbp)
	leaq	-68(%rbp), %rdx
	leaq	-72(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movq	-56(%rbp), %rax
	movl	24(%rax), %eax
	movl	%eax, -64(%rbp)
	jmp	.L9
.L12:
	movq	-56(%rbp), %rax
	leaq	28(%rax), %rcx
	movl	-64(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	addq	%rcx, %rax
	movq	%rax, -48(%rbp)
	movq	-48(%rbp), %rax
	movl	(%rax), %edx
	movl	-72(%rbp), %eax
	cmpl	%eax, %edx
	jg	.L9
	movq	-48(%rbp), %rax
	movl	8(%rax), %edx
	movl	-72(%rbp), %eax
	cmpl	%eax, %edx
	jl	.L9
	movq	-48(%rbp), %rax
	movl	4(%rax), %edx
	movl	-68(%rbp), %eax
	cmpl	%eax, %edx
	jg	.L9
	movq	-48(%rbp), %rax
	movl	12(%rax), %edx
	movl	-68(%rbp), %eax
	cmpl	%eax, %edx
	jl	.L9
	movl	n(%rip), %eax
	movl	%eax, -60(%rbp)
	jmp	.L10
.L11:
	movq	-48(%rbp), %rax
	leaq	16(%rax), %rdx
	movl	-60(%rbp), %eax
	cltq
	imulq	$4028, %rax, %rax
	leaq	page(%rip), %rcx
	addq	%rcx, %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L10
	movl	hidx(%rip), %eax
	addl	$1, %eax
	movl	%eax, hidx(%rip)
	movl	hidx(%rip), %eax
	movl	%eax, hmax(%rip)
	movl	hmax(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	hist(%rip), %rdx
	movl	-60(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
.L10:
	movl	-60(%rbp), %eax
	leal	-1(%rax), %edx
	movl	%edx, -60(%rbp)
	testl	%eax, %eax
	jne	.L11
.L9:
	movl	-64(%rbp), %eax
	leal	-1(%rax), %edx
	movl	%edx, -64(%rbp)
	testl	%eax, %eax
	jne	.L12
.L8:
	leaq	-17(%rbp), %rax
	leaq	.LC6(%rip), %rdx
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L13
	movl	hidx(%rip), %eax
	testl	%eax, %eax
	jle	.L13
	movl	hidx(%rip), %eax
	subl	$1, %eax
	movl	%eax, hidx(%rip)
.L13:
	leaq	-17(%rbp), %rax
	leaq	.LC7(%rip), %rdx
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L14
	movl	hidx(%rip), %edx
	movl	hmax(%rip), %eax
	cmpl	%eax, %edx
	jge	.L14
	movl	hidx(%rip), %eax
	addl	$1, %eax
	movl	%eax, hidx(%rip)
.L14:
	leaq	-17(%rbp), %rax
	leaq	.LC8(%rip), %rdx
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L7
	movl	hidx(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	hist(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	imulq	$4028, %rax, %rax
	leaq	page(%rip), %rdx
	addq	%rdx, %rax
	movq	%rax, %rdi
	call	puts@PLT
.L7:
	movl	-76(%rbp), %eax
	leal	-1(%rax), %edx
	movl	%edx, -76(%rbp)
	testl	%eax, %eax
	jne	.L15
.L2:
	leaq	n(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movl	n(%rip), %edx
	imull	%edx, %eax
	testl	%eax, %eax
	jne	.L16
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L18
	call	__stack_chk_fail@PLT
.L18:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.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:
