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>

int main(void){
    int N, i, aa = 0, b, answer = 0;
    long int K;
    scanf("%d %ld", &N, &K);
    int A[N], check[N], jyun[N], recheck[N];
    for(i = 0; i < N; i++){
        scanf("%d", &A[i]);
        check[i] = 0;
        jyun[i] = 0;
        recheck[i] = 0;
    }
    //ループの開始地点を探す
    b = 1;
    int c = 0, start = 0;
    while(aa == 0){
        b -= 1;
        if(check[b] > 0){
            aa += 1;
            start = b + 1;
            jyun[c] += b + 1;
            break;
        }
        else {
        jyun[c] += b + 1;
        c += 1;
        check[b] += 1;
        b = A[b];
        }
        }
    int roop = 0, yobun; long int x;
    //Kがループの開始地点より前か後かを評価する
    if(K <= c){
        answer = jyun[K];
    }
    //
    else{
        int next = start;
        aa = 0;
        while(aa == 0){
            next -= 1;
            if(recheck[next] > 0){
                aa += 1;
                break;
            }
            roop += 1;
            recheck[next] += 1;
            next = A[next];
        }
        yobun = c - roop;
        K -= yobun;
        K = K % roop;
        x = K + yobun;
        answer = jyun[x];
    }
    printf("%d\n", answer);
    return 0;

}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d %ld"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d\n"
	.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
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$232, %rsp
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	movq	%rsp, %rax
	movq	%rax, %rbx
	movl	$0, -144(%rbp)
	movl	$0, -164(%rbp)
	leaq	-136(%rbp), %rdx
	leaq	-176(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-176(%rbp), %edx
	movslq	%edx, %rax
	subq	$1, %rax
	movq	%rax, -128(%rbp)
	movslq	%edx, %rax
	movq	%rax, %r12
	movl	$0, %r13d
	movslq	%edx, %rax
	movq	%rax, %r14
	movl	$0, %r15d
	movslq	%edx, %rax
	leaq	0(,%rax,4), %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %esi
	movl	$0, %edx
	divq	%rsi
	imulq	$16, %rax, %rdx
	movq	%rdx, %rax
	andq	$-4096, %rax
	movq	%rsp, %rcx
	subq	%rax, %rcx
.L2:
	cmpq	%rcx, %rsp
	je	.L3
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L2
.L3:
	movq	%rdx, %rax
	andl	$4095, %eax
	subq	%rax, %rsp
	movq	%rdx, %rax
	andl	$4095, %eax
	testq	%rax, %rax
	je	.L4
	movq	%rdx, %rax
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L4:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -120(%rbp)
	movl	-176(%rbp), %edx
	movslq	%edx, %rax
	subq	$1, %rax
	movq	%rax, -112(%rbp)
	movslq	%edx, %rax
	movq	%rax, -192(%rbp)
	movq	$0, -184(%rbp)
	movslq	%edx, %rax
	movq	%rax, -208(%rbp)
	movq	$0, -200(%rbp)
	movslq	%edx, %rax
	leaq	0(,%rax,4), %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %edi
	movl	$0, %edx
	divq	%rdi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L5:
	cmpq	%rdx, %rsp
	je	.L6
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L5
.L6:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L7
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L7:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -104(%rbp)
	movl	-176(%rbp), %eax
	movslq	%eax, %rdx
	subq	$1, %rdx
	movq	%rdx, -96(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, -224(%rbp)
	movq	$0, -216(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, -240(%rbp)
	movq	$0, -232(%rbp)
	cltq
	leaq	0(,%rax,4), %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %esi
	movl	$0, %edx
	divq	%rsi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L8:
	cmpq	%rdx, %rsp
	je	.L9
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L8
.L9:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L10
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L10:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -88(%rbp)
	movl	-176(%rbp), %eax
	movslq	%eax, %rdx
	subq	$1, %rdx
	movq	%rdx, -80(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, -256(%rbp)
	movq	$0, -248(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, -272(%rbp)
	movq	$0, -264(%rbp)
	cltq
	leaq	0(,%rax,4), %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %edi
	movl	$0, %edx
	divq	%rdi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L11:
	cmpq	%rdx, %rsp
	je	.L12
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L11
.L12:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L13
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L13:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -72(%rbp)
	movl	$0, -172(%rbp)
	jmp	.L14
.L15:
	movl	-172(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-120(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	-104(%rbp), %rax
	movl	-172(%rbp), %edx
	movslq	%edx, %rdx
	movl	$0, (%rax,%rdx,4)
	movq	-88(%rbp), %rax
	movl	-172(%rbp), %edx
	movslq	%edx, %rdx
	movl	$0, (%rax,%rdx,4)
	movq	-72(%rbp), %rax
	movl	-172(%rbp), %edx
	movslq	%edx, %rdx
	movl	$0, (%rax,%rdx,4)
	addl	$1, -172(%rbp)
.L14:
	movl	-176(%rbp), %eax
	cmpl	%eax, -172(%rbp)
	jl	.L15
	movl	$1, -168(%rbp)
	movl	$0, -160(%rbp)
	movl	$0, -156(%rbp)
	jmp	.L16
.L19:
	subl	$1, -168(%rbp)
	movq	-104(%rbp), %rax
	movl	-168(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	testl	%eax, %eax
	jle	.L17
	addl	$1, -144(%rbp)
	movl	-168(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -156(%rbp)
	movq	-88(%rbp), %rax
	movl	-160(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %edx
	movl	-168(%rbp), %eax
	addl	$1, %eax
	leal	(%rdx,%rax), %ecx
	movq	-88(%rbp), %rax
	movl	-160(%rbp), %edx
	movslq	%edx, %rdx
	movl	%ecx, (%rax,%rdx,4)
	jmp	.L18
.L17:
	movq	-88(%rbp), %rax
	movl	-160(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %edx
	movl	-168(%rbp), %eax
	addl	$1, %eax
	leal	(%rdx,%rax), %ecx
	movq	-88(%rbp), %rax
	movl	-160(%rbp), %edx
	movslq	%edx, %rdx
	movl	%ecx, (%rax,%rdx,4)
	addl	$1, -160(%rbp)
	movq	-104(%rbp), %rax
	movl	-168(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	leal	1(%rax), %ecx
	movq	-104(%rbp), %rax
	movl	-168(%rbp), %edx
	movslq	%edx, %rdx
	movl	%ecx, (%rax,%rdx,4)
	movq	-120(%rbp), %rax
	movl	-168(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	movl	%eax, -168(%rbp)
.L16:
	cmpl	$0, -144(%rbp)
	je	.L19
.L18:
	movl	$0, -152(%rbp)
	movl	-160(%rbp), %eax
	movslq	%eax, %rdx
	movq	-136(%rbp), %rax
	cmpq	%rax, %rdx
	jl	.L20
	movq	-136(%rbp), %rdx
	movq	-88(%rbp), %rax
	movl	(%rax,%rdx,4), %eax
	movl	%eax, -164(%rbp)
	jmp	.L21
.L20:
	movl	-156(%rbp), %eax
	movl	%eax, -148(%rbp)
	movl	$0, -144(%rbp)
	jmp	.L22
.L25:
	subl	$1, -148(%rbp)
	movq	-72(%rbp), %rax
	movl	-148(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	testl	%eax, %eax
	jle	.L23
	addl	$1, -144(%rbp)
	jmp	.L24
.L23:
	addl	$1, -152(%rbp)
	movq	-72(%rbp), %rax
	movl	-148(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	leal	1(%rax), %ecx
	movq	-72(%rbp), %rax
	movl	-148(%rbp), %edx
	movslq	%edx, %rdx
	movl	%ecx, (%rax,%rdx,4)
	movq	-120(%rbp), %rax
	movl	-148(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	movl	%eax, -148(%rbp)
.L22:
	cmpl	$0, -144(%rbp)
	je	.L25
.L24:
	movl	-160(%rbp), %eax
	subl	-152(%rbp), %eax
	movl	%eax, -140(%rbp)
	movq	-136(%rbp), %rax
	movl	-140(%rbp), %edx
	movslq	%edx, %rdx
	subq	%rdx, %rax
	movq	%rax, -136(%rbp)
	movq	-136(%rbp), %rax
	movl	-152(%rbp), %edx
	movslq	%edx, %rcx
	cqto
	idivq	%rcx
	movq	%rdx, %rax
	movq	%rax, -136(%rbp)
	movl	-140(%rbp), %eax
	movslq	%eax, %rdx
	movq	-136(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, -64(%rbp)
	movq	-88(%rbp), %rax
	movq	-64(%rbp), %rdx
	movl	(%rax,%rdx,4), %eax
	movl	%eax, -164(%rbp)
.L21:
	movl	-164(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	%rbx, %rsp
	movq	-56(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L27
	call	__stack_chk_fail@PLT
.L27:
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.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 %ld"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	leaq	.LC0(%rip), %rdi
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r15
	pushq	%r14
	leaq	-64(%rbp), %rdx
	leaq	-68(%rbp), %rsi
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$56, %rsp
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	-68(%rbp), %rax
	movq	%rsp, %rsi
	movq	%rax, %rcx
	leaq	15(,%rax,4), %rax
	movq	%rax, %rdi
	movq	%rax, %rdx
	andq	$-4096, %rdi
	andq	$-16, %rdx
	subq	%rdi, %rsi
	cmpq	%rsi, %rsp
	je	.L3
.L42:
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	cmpq	%rsi, %rsp
	jne	.L42
.L3:
	andl	$4095, %edx
	subq	%rdx, %rsp
	testq	%rdx, %rdx
	jne	.L43
.L4:
	movq	%rax, %rdi
	movq	%rsp, -88(%rbp)
	movq	%rax, %rdx
	movq	%rsp, %rsi
	andq	$-4096, %rdi
	andq	$-16, %rdx
	subq	%rdi, %rsi
.L5:
	cmpq	%rsi, %rsp
	je	.L6
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L5
.L43:
	orq	$0, -8(%rsp,%rdx)
	jmp	.L4
.L6:
	andl	$4095, %edx
	subq	%rdx, %rsp
	testq	%rdx, %rdx
	jne	.L44
.L7:
	leaq	3(%rsp), %r8
	movq	%rax, %rdx
	movq	%rsp, %rsi
	movq	%r8, %rdi
	andq	$-4, %r8
	andq	$-16, %rdx
	shrq	$2, %rdi
	movq	%r8, %r15
	movq	%rdi, -96(%rbp)
	movq	%rax, %rdi
	andq	$-4096, %rdi
	subq	%rdi, %rsi
.L8:
	cmpq	%rsi, %rsp
	je	.L9
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L8
.L44:
	orq	$0, -8(%rsp,%rdx)
	jmp	.L7
.L9:
	andl	$4095, %edx
	subq	%rdx, %rsp
	testq	%rdx, %rdx
	je	.L10
	orq	$0, -8(%rsp,%rdx)
.L10:
	movq	%rax, %rdx
	movq	%rsp, %rsi
	andq	$-4096, %rax
	movq	%rsp, %r12
	andq	$-16, %rdx
	subq	%rax, %rsi
.L11:
	cmpq	%rsi, %rsp
	je	.L12
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L11
.L12:
	movq	%rdx, %rax
	andl	$4095, %eax
	subq	%rax, %rsp
	testq	%rax, %rax
	je	.L13
	orq	$0, -8(%rsp,%rax)
.L13:
	movq	%rsp, %r13
	testl	%ecx, %ecx
	jle	.L14
	movq	-88(%rbp), %r14
	xorl	%ebx, %ebx
	.p2align 4,,10
	.p2align 3
.L15:
	movq	%r14, %rsi
	leaq	.LC1(%rip), %rdi
	xorl	%eax, %eax
	addq	$4, %r14
	call	__isoc99_scanf@PLT
	movl	$0, (%r15,%rbx,4)
	movl	$0, (%r12,%rbx,4)
	movl	$0, 0(%r13,%rbx,4)
	addq	$1, %rbx
	cmpl	%ebx, -68(%rbp)
	jg	.L15
.L14:
	movq	-96(%rbp), %rax
	movl	$1, %esi
	movl	$1, %edx
	movl	0(,%rax,4), %ecx
	xorl	%eax, %eax
	testl	%ecx, %ecx
	jg	.L45
	.p2align 4,,10
	.p2align 3
.L16:
	movq	-88(%rbp), %rbx
	addl	%edx, -4(%r12,%rsi,4)
	addl	$1, %ecx
	movl	%esi, %edi
	movl	%ecx, (%r15,%rax,4)
	addq	$1, %rsi
	movl	(%rbx,%rax,4), %edx
	leal	-1(%rdx), %eax
	cltq
	movl	(%r15,%rax,4), %ecx
	testl	%ecx, %ecx
	jle	.L16
.L20:
	movq	-64(%rbp), %rax
	movslq	%edi, %rcx
	addl	%edx, (%r12,%rcx,4)
	cmpq	%rax, %rcx
	jge	.L17
	subl	$1, %edx
	xorl	%esi, %esi
	movslq	%edx, %rdx
	movl	0(%r13,%rdx,4), %ecx
	testl	%ecx, %ecx
	jg	.L18
	.p2align 4,,10
	.p2align 3
.L19:
	movq	-88(%rbp), %rbx
	addl	$1, %ecx
	addl	$1, %esi
	movl	%ecx, 0(%r13,%rdx,4)
	movl	(%rbx,%rdx,4), %edx
	subl	$1, %edx
	movslq	%edx, %rdx
	movl	0(%r13,%rdx,4), %ecx
	testl	%ecx, %ecx
	jle	.L19
.L18:
	subl	%esi, %edi
	movslq	%esi, %rsi
	movslq	%edi, %rdi
	subq	%rdi, %rax
	cqto
	idivq	%rsi
	addq	%rdx, %rdi
	movq	%rdx, -64(%rbp)
	movl	(%r12,%rdi,4), %edx
.L21:
	xorl	%eax, %eax
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	-56(%rbp), %rax
	subq	%fs:40, %rax
	jne	.L46
	leaq	-40(%rbp), %rsp
	xorl	%eax, %eax
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.cfi_remember_state
	.cfi_def_cfa 7, 8
	ret
.L17:
	.cfi_restore_state
	movl	(%r12,%rax,4), %edx
	jmp	.L21
.L45:
	xorl	%edi, %edi
	jmp	.L20
.L46:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.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:

rule
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d %ld"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	leaq	.LC0(%rip), %rdi
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r15
	pushq	%r14
	leaq	-64(%rbp), %rdx
	leaq	-68(%rbp), %rsi
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$56, %rsp
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	-68(%rbp), %rax
	movq	%rsp, %rsi
	movq	%rax, %rcx
	leaq	15(,%rax,4), %rax
	movq	%rax, %rdi
	movq	%rax, %rdx
	andq	$-4096, %rdi
	andq	$-16, %rdx
	subq	%rdi, %rsi
	cmpq	%rsi, %rsp
	je	.L3
.L42:
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	cmpq	%rsi, %rsp
	jne	.L42
.L3:
	andl	$4095, %edx
	subq	%rdx, %rsp
	testq	%rdx, %rdx
	jne	.L43
.L4:
	movq	%rax, %rdi
	movq	%rsp, -88(%rbp)
	movq	%rax, %rdx
	movq	%rsp, %rsi
	andq	$-4096, %rdi
	andq	$-16, %rdx
	subq	%rdi, %rsi
.L5:
	cmpq	%rsi, %rsp
	je	.L6
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L5
.L43:
	orq	$0, -8(%rsp,%rdx)
	jmp	.L4
.L6:
	andl	$4095, %edx
	subq	%rdx, %rsp
	testq	%rdx, %rdx
	jne	.L44
.L7:
	leaq	3(%rsp), %r8
	movq	%rax, %rdx
	movq	%rsp, %rsi
	movq	%r8, %rdi
	andq	$-4, %r8
	andq	$-16, %rdx
	shrq	$2, %rdi
	movq	%r8, %r15
	movq	%rdi, -96(%rbp)
	movq	%rax, %rdi
	andq	$-4096, %rdi
	subq	%rdi, %rsi
.L8:
	cmpq	%rsi, %rsp
	je	.L9
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L8
.L44:
	orq	$0, -8(%rsp,%rdx)
	jmp	.L7
.L9:
	andl	$4095, %edx
	subq	%rdx, %rsp
	testq	%rdx, %rdx
	je	.L10
	orq	$0, -8(%rsp,%rdx)
.L10:
	movq	%rax, %rdx
	movq	%rsp, %rsi
	andq	$-4096, %rax
	movq	%rsp, %r12
	andq	$-16, %rdx
	subq	%rax, %rsi
.L11:
	cmpq	%rsi, %rsp
	je	.L12
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L11
.L12:
	movq	%rdx, %rax
	andl	$4095, %eax
	subq	%rax, %rsp
	testq	%rax, %rax
	je	.L13
	orq	$0, -8(%rsp,%rax)
.L13:
	movq	%rsp, %r13
	testl	%ecx, %ecx
	jle	.L14
	movq	-88(%rbp), %r14
	xorl	%ebx, %ebx
	.p2align 4,,10
	.p2align 3
.L15:
	movq	%r14, %rsi
	leaq	.LC1(%rip), %rdi
	xorl	%eax, %eax
	addq	$4, %r14
	call	__isoc99_scanf@PLT
	movl	$0, (%r15,%rbx,4)
	movl	$0, (%r12,%rbx,4)
	movl	$0, 0(%r13,%rbx,4)
	addq	$1, %rbx
	cmpl	%ebx, -68(%rbp)
	jg	.L15
.L14:
	movq	-96(%rbp), %rax
	movl	$1, %esi
	movl	$1, %edx
	movl	0(,%rax,4), %ecx
	xorl	%eax, %eax
	testl	%ecx, %ecx
	jg	.L45
	.p2align 4,,10
	.p2align 3
.L16:
	movq	-88(%rbp), %rbx
	addl	%edx, -4(%r12,%rsi,4)
	addl	$1, %ecx
	movl	%esi, %edi
	movl	%ecx, (%r15,%rax,4)
	addq	$1, %rsi
	movl	(%rbx,%rax,4), %edx
	leal	-1(%rdx), %eax
	cltq
	movl	(%r15,%rax,4), %ecx
	testl	%ecx, %ecx
	jle	.L16
.L20:
	movq	-64(%rbp), %rax
	movslq	%edi, %rcx
	addl	%edx, (%r12,%rcx,4)
	cmpq	%rax, %rcx
	jge	.L17
	subl	$1, %edx
	xorl	%esi, %esi
	movslq	%edx, %rdx
	movl	0(%r13,%rdx,4), %ecx
	testl	%ecx, %ecx
	jg	.L18
	.p2align 4,,10
	.p2align 3
.L19:
	movq	-88(%rbp), %rbx
	addl	$1, %ecx
	addl	$1, %esi
	movl	%ecx, 0(%r13,%rdx,4)
	movl	(%rbx,%rdx,4), %edx
	subl	$1, %edx
	movslq	%edx, %rdx
	movl	0(%r13,%rdx,4), %ecx
	testl	%ecx, %ecx
	jle	.L19
.L18:
	subl	%esi, %edi
	movslq	%esi, %rsi
	movslq	%edi, %rdi
	subq	%rdi, %rax
	cqto
	idivq	%rsi
	addq	%rdx, %rdi
	movq	%rdx, -64(%rbp)
	movl	(%r12,%rdi,4), %edx
.L21:
	xorl	%eax, %eax
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	-56(%rbp), %rax
	subq	%fs:40, %rax
	jne	.L46
	leaq	-40(%rbp), %rsp
	xorl	%eax, %eax
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.cfi_remember_state
	.cfi_def_cfa 7, 8
	ret
.L17:
	.cfi_restore_state
	movl	(%r12,%rax,4), %edx
	jmp	.L21
.L45:
	xorl	%edi, %edi
	jmp	.L20
.L46:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.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:

#include<stdio.h>

int main(void){
    int N, i, aa = 0, b, answer = 0;
    long int K;
    scanf("%d %ld", &N, &K);
    int A[N], check[N], jyun[N], recheck[N];
    for(i = 0; i < N; i++){
        scanf("%d", &A[i]);
        check[i] = 0;
        jyun[i] = 0;
        recheck[i] = 0;
    }
    //ループの開始地点を探す
    b = 1;
    int c = 0, start = 0;
    while(aa == 0){
        b -= 1;
        if(check[b] > 0){
            aa += 1;
            start = b + 1;
            jyun[c] += b + 1;
            break;
        }
        else {
        jyun[c] += b + 1;
        c += 1;
        check[b] += 1;
        b = A[b];
        }
        }
    int roop = 0, yobun; long int x;
    //Kがループの開始地点より前か後かを評価する
    if(K <= c){
        answer = jyun[K];
    }
    //
    else{
        int next = start;
        aa = 0;
        while(aa == 0){
            next -= 1;
            if(recheck[next] > 0){
                aa += 1;
                break;
            }
            roop += 1;
            recheck[next] += 1;
            next = A[next];
        }
        yobun = c - roop;
        K -= yobun;
        K = K % roop;
        x = K + yobun;
        answer = jyun[x];
    }
    printf("%d\n", answer);
    return 0;

}
6 727202214173249351
6 5 1 5 3 2
 4 9
3 2 4 1
 6 1007784494318310970
6 5 2 5 3 2
 6 237500909755776657
6 4 1 5 3 2
 6 727202214173249351
4 5 2 5 3 2
 6 165759462200935729
4 5 2 5 3 2
 6 727202214173249351
6 4 1 5 3 2
 4 0
3 2 4 1
 6 727202214173249351
6 4 1 1 3 2
 6 237500909755776657
2 4 1 5 3 2

6
 1
 3
 4
 5
 2
 3
 1
 4
 4

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>

int main(void){
    int N, i, aa = 0, b, answer = 0;
    long int K;
    scanf("%d %ld", &N, &K);
    int A[N], check[N], jyun[N], recheck[N];
    for(i = 0; i < N; i++){
        scanf("%d", &A[i]);
        check[i] = 0;
        jyun[i] = 0;
        recheck[i] = 0;
    }
    //ループの開始地点を探す
    b = 1;
    int c = 0, start = 0;
    while(aa == 0){
        b -= 1;
        if(check[b] > 0){
            aa += 1;
            start = b + 1;
            jyun[c] += b + 1;
            break;
        }
        else {
        jyun[c] += b + 1;
        c += 1;
        check[b] += 1;
        b = A[b];
        }
        }
    int roop = 0, yobun; long int x;
    //Kがループの開始地点より前か後かを評価する
    if(K <= c){
        answer = jyun[K];
    }
    //
    else{
        int next = start;
        aa = 0;
        while(aa == 0){
            next -= 1;
            if(recheck[next] > 0){
                aa += 1;
                break;
            }
            roop += 1;
            recheck[next] += 1;
            next = A[next];
        }
        yobun = c - roop;
        K -= yobun;
        K = K % roop;
        x = K + yobun;
        answer = jyun[x];
    }
    printf("%d\n", answer);
    return 0;

}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d %ld"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d\n"
	.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
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$232, %rsp
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	movq	%rsp, %rax
	movq	%rax, %rbx
	movl	$0, -144(%rbp)
	movl	$0, -164(%rbp)
	leaq	-136(%rbp), %rdx
	leaq	-176(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-176(%rbp), %edx
	movslq	%edx, %rax
	subq	$1, %rax
	movq	%rax, -128(%rbp)
	movslq	%edx, %rax
	movq	%rax, %r12
	movl	$0, %r13d
	movslq	%edx, %rax
	movq	%rax, %r14
	movl	$0, %r15d
	movslq	%edx, %rax
	leaq	0(,%rax,4), %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %esi
	movl	$0, %edx
	divq	%rsi
	imulq	$16, %rax, %rdx
	movq	%rdx, %rax
	andq	$-4096, %rax
	movq	%rsp, %rcx
	subq	%rax, %rcx
.L2:
	cmpq	%rcx, %rsp
	je	.L3
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L2
.L3:
	movq	%rdx, %rax
	andl	$4095, %eax
	subq	%rax, %rsp
	movq	%rdx, %rax
	andl	$4095, %eax
	testq	%rax, %rax
	je	.L4
	movq	%rdx, %rax
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L4:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -120(%rbp)
	movl	-176(%rbp), %edx
	movslq	%edx, %rax
	subq	$1, %rax
	movq	%rax, -112(%rbp)
	movslq	%edx, %rax
	movq	%rax, -192(%rbp)
	movq	$0, -184(%rbp)
	movslq	%edx, %rax
	movq	%rax, -208(%rbp)
	movq	$0, -200(%rbp)
	movslq	%edx, %rax
	leaq	0(,%rax,4), %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %edi
	movl	$0, %edx
	divq	%rdi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L5:
	cmpq	%rdx, %rsp
	je	.L6
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L5
.L6:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L7
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L7:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -104(%rbp)
	movl	-176(%rbp), %eax
	movslq	%eax, %rdx
	subq	$1, %rdx
	movq	%rdx, -96(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, -224(%rbp)
	movq	$0, -216(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, -240(%rbp)
	movq	$0, -232(%rbp)
	cltq
	leaq	0(,%rax,4), %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %esi
	movl	$0, %edx
	divq	%rsi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L8:
	cmpq	%rdx, %rsp
	je	.L9
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L8
.L9:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L10
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L10:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -88(%rbp)
	movl	-176(%rbp), %eax
	movslq	%eax, %rdx
	subq	$1, %rdx
	movq	%rdx, -80(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, -256(%rbp)
	movq	$0, -248(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, -272(%rbp)
	movq	$0, -264(%rbp)
	cltq
	leaq	0(,%rax,4), %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %edi
	movl	$0, %edx
	divq	%rdi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L11:
	cmpq	%rdx, %rsp
	je	.L12
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L11
.L12:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L13
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L13:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -72(%rbp)
	movl	$0, -172(%rbp)
	jmp	.L14
.L15:
	movl	-172(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-120(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	-104(%rbp), %rax
	movl	-172(%rbp), %edx
	movslq	%edx, %rdx
	movl	$0, (%rax,%rdx,4)
	movq	-88(%rbp), %rax
	movl	-172(%rbp), %edx
	movslq	%edx, %rdx
	movl	$0, (%rax,%rdx,4)
	movq	-72(%rbp), %rax
	movl	-172(%rbp), %edx
	movslq	%edx, %rdx
	movl	$0, (%rax,%rdx,4)
	addl	$1, -172(%rbp)
.L14:
	movl	-176(%rbp), %eax
	cmpl	%eax, -172(%rbp)
	jl	.L15
	movl	$1, -168(%rbp)
	movl	$0, -160(%rbp)
	movl	$0, -156(%rbp)
	jmp	.L16
.L19:
	subl	$1, -168(%rbp)
	movq	-104(%rbp), %rax
	movl	-168(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	testl	%eax, %eax
	jle	.L17
	addl	$1, -144(%rbp)
	movl	-168(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -156(%rbp)
	movq	-88(%rbp), %rax
	movl	-160(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %edx
	movl	-168(%rbp), %eax
	addl	$1, %eax
	leal	(%rdx,%rax), %ecx
	movq	-88(%rbp), %rax
	movl	-160(%rbp), %edx
	movslq	%edx, %rdx
	movl	%ecx, (%rax,%rdx,4)
	jmp	.L18
.L17:
	movq	-88(%rbp), %rax
	movl	-160(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %edx
	movl	-168(%rbp), %eax
	addl	$1, %eax
	leal	(%rdx,%rax), %ecx
	movq	-88(%rbp), %rax
	movl	-160(%rbp), %edx
	movslq	%edx, %rdx
	movl	%ecx, (%rax,%rdx,4)
	addl	$1, -160(%rbp)
	movq	-104(%rbp), %rax
	movl	-168(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	leal	1(%rax), %ecx
	movq	-104(%rbp), %rax
	movl	-168(%rbp), %edx
	movslq	%edx, %rdx
	movl	%ecx, (%rax,%rdx,4)
	movq	-120(%rbp), %rax
	movl	-168(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	movl	%eax, -168(%rbp)
.L16:
	cmpl	$0, -144(%rbp)
	je	.L19
.L18:
	movl	$0, -152(%rbp)
	movl	-160(%rbp), %eax
	movslq	%eax, %rdx
	movq	-136(%rbp), %rax
	cmpq	%rax, %rdx
	jl	.L20
	movq	-136(%rbp), %rdx
	movq	-88(%rbp), %rax
	movl	(%rax,%rdx,4), %eax
	movl	%eax, -164(%rbp)
	jmp	.L21
.L20:
	movl	-156(%rbp), %eax
	movl	%eax, -148(%rbp)
	movl	$0, -144(%rbp)
	jmp	.L22
.L25:
	subl	$1, -148(%rbp)
	movq	-72(%rbp), %rax
	movl	-148(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	testl	%eax, %eax
	jle	.L23
	addl	$1, -144(%rbp)
	jmp	.L24
.L23:
	addl	$1, -152(%rbp)
	movq	-72(%rbp), %rax
	movl	-148(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	leal	1(%rax), %ecx
	movq	-72(%rbp), %rax
	movl	-148(%rbp), %edx
	movslq	%edx, %rdx
	movl	%ecx, (%rax,%rdx,4)
	movq	-120(%rbp), %rax
	movl	-148(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	movl	%eax, -148(%rbp)
.L22:
	cmpl	$0, -144(%rbp)
	je	.L25
.L24:
	movl	-160(%rbp), %eax
	subl	-152(%rbp), %eax
	movl	%eax, -140(%rbp)
	movq	-136(%rbp), %rax
	movl	-140(%rbp), %edx
	movslq	%edx, %rdx
	subq	%rdx, %rax
	movq	%rax, -136(%rbp)
	movq	-136(%rbp), %rax
	movl	-152(%rbp), %edx
	movslq	%edx, %rcx
	cqto
	idivq	%rcx
	movq	%rdx, %rax
	movq	%rax, -136(%rbp)
	movl	-140(%rbp), %eax
	movslq	%eax, %rdx
	movq	-136(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, -64(%rbp)
	movq	-88(%rbp), %rax
	movq	-64(%rbp), %rdx
	movl	(%rax,%rdx,4), %eax
	movl	%eax, -164(%rbp)
.L21:
	movl	-164(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	%rbx, %rsp
	movq	-56(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L27
	call	__stack_chk_fail@PLT
.L27:
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.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
	.section	.rodata
.LC0:
	.string	"%d %ld"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d\n"
	.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
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$232, %rsp
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	movq	%rsp, %rax
	movq	%rax, %rbx
	movl	$0, -144(%rbp)
	movl	$0, -164(%rbp)
	leaq	-136(%rbp), %rdx
	leaq	-176(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-176(%rbp), %edx
	movslq	%edx, %rax
	subq	$1, %rax
	movq	%rax, -128(%rbp)
	movslq	%edx, %rax
	movq	%rax, %r12
	movl	$0, %r13d
	movslq	%edx, %rax
	movq	%rax, %r14
	movl	$0, %r15d
	movslq	%edx, %rax
	leaq	0(,%rax,4), %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %esi
	movl	$0, %edx
	divq	%rsi
	imulq	$16, %rax, %rdx
	movq	%rdx, %rax
	andq	$-4096, %rax
	movq	%rsp, %rcx
	subq	%rax, %rcx
.L2:
	cmpq	%rcx, %rsp
	je	.L3
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L2
.L3:
	movq	%rdx, %rax
	andl	$4095, %eax
	subq	%rax, %rsp
	movq	%rdx, %rax
	andl	$4095, %eax
	testq	%rax, %rax
	je	.L4
	movq	%rdx, %rax
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L4:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -120(%rbp)
	movl	-176(%rbp), %edx
	movslq	%edx, %rax
	subq	$1, %rax
	movq	%rax, -112(%rbp)
	movslq	%edx, %rax
	movq	%rax, -192(%rbp)
	movq	$0, -184(%rbp)
	movslq	%edx, %rax
	movq	%rax, -208(%rbp)
	movq	$0, -200(%rbp)
	movslq	%edx, %rax
	leaq	0(,%rax,4), %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %edi
	movl	$0, %edx
	divq	%rdi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L5:
	cmpq	%rdx, %rsp
	je	.L6
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L5
.L6:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L7
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L7:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -104(%rbp)
	movl	-176(%rbp), %eax
	movslq	%eax, %rdx
	subq	$1, %rdx
	movq	%rdx, -96(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, -224(%rbp)
	movq	$0, -216(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, -240(%rbp)
	movq	$0, -232(%rbp)
	cltq
	leaq	0(,%rax,4), %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %esi
	movl	$0, %edx
	divq	%rsi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L8:
	cmpq	%rdx, %rsp
	je	.L9
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L8
.L9:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L10
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L10:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -88(%rbp)
	movl	-176(%rbp), %eax
	movslq	%eax, %rdx
	subq	$1, %rdx
	movq	%rdx, -80(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, -256(%rbp)
	movq	$0, -248(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, -272(%rbp)
	movq	$0, -264(%rbp)
	cltq
	leaq	0(,%rax,4), %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %edi
	movl	$0, %edx
	divq	%rdi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L11:
	cmpq	%rdx, %rsp
	je	.L12
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L11
.L12:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L13
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L13:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -72(%rbp)
	movl	$0, -172(%rbp)
	jmp	.L14
.L15:
	movl	-172(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-120(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	-104(%rbp), %rax
	movl	-172(%rbp), %edx
	movslq	%edx, %rdx
	movl	$0, (%rax,%rdx,4)
	movq	-88(%rbp), %rax
	movl	-172(%rbp), %edx
	movslq	%edx, %rdx
	movl	$0, (%rax,%rdx,4)
	movq	-72(%rbp), %rax
	movl	-172(%rbp), %edx
	movslq	%edx, %rdx
	movl	$0, (%rax,%rdx,4)
	addl	$1, -172(%rbp)
.L14:
	movl	-176(%rbp), %eax
	cmpl	%eax, -172(%rbp)
	jl	.L15
	movl	$1, -168(%rbp)
	movl	$0, -160(%rbp)
	movl	$0, -156(%rbp)
	jmp	.L16
.L19:
	subl	$1, -168(%rbp)
	movq	-104(%rbp), %rax
	movl	-168(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	testl	%eax, %eax
	jle	.L17
	addl	$1, -144(%rbp)
	movl	-168(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -156(%rbp)
	movq	-88(%rbp), %rax
	movl	-160(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %edx
	movl	-168(%rbp), %eax
	addl	$1, %eax
	leal	(%rdx,%rax), %ecx
	movq	-88(%rbp), %rax
	movl	-160(%rbp), %edx
	movslq	%edx, %rdx
	movl	%ecx, (%rax,%rdx,4)
	jmp	.L18
.L17:
	movq	-88(%rbp), %rax
	movl	-160(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %edx
	movl	-168(%rbp), %eax
	addl	$1, %eax
	leal	(%rdx,%rax), %ecx
	movq	-88(%rbp), %rax
	movl	-160(%rbp), %edx
	movslq	%edx, %rdx
	movl	%ecx, (%rax,%rdx,4)
	addl	$1, -160(%rbp)
	movq	-104(%rbp), %rax
	movl	-168(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	leal	1(%rax), %ecx
	movq	-104(%rbp), %rax
	movl	-168(%rbp), %edx
	movslq	%edx, %rdx
	movl	%ecx, (%rax,%rdx,4)
	movq	-120(%rbp), %rax
	movl	-168(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	movl	%eax, -168(%rbp)
.L16:
	cmpl	$0, -144(%rbp)
	je	.L19
.L18:
	movl	$0, -152(%rbp)
	movl	-160(%rbp), %eax
	movslq	%eax, %rdx
	movq	-136(%rbp), %rax
	cmpq	%rax, %rdx
	jl	.L20
	movq	-136(%rbp), %rdx
	movq	-88(%rbp), %rax
	movl	(%rax,%rdx,4), %eax
	movl	%eax, -164(%rbp)
	jmp	.L21
.L20:
	movl	-156(%rbp), %eax
	movl	%eax, -148(%rbp)
	movl	$0, -144(%rbp)
	jmp	.L22
.L25:
	subl	$1, -148(%rbp)
	movq	-72(%rbp), %rax
	movl	-148(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	testl	%eax, %eax
	jle	.L23
	addl	$1, -144(%rbp)
	jmp	.L24
.L23:
	addl	$1, -152(%rbp)
	movq	-72(%rbp), %rax
	movl	-148(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	leal	1(%rax), %ecx
	movq	-72(%rbp), %rax
	movl	-148(%rbp), %edx
	movslq	%edx, %rdx
	movl	%ecx, (%rax,%rdx,4)
	movq	-120(%rbp), %rax
	movl	-148(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	movl	%eax, -148(%rbp)
.L22:
	cmpl	$0, -144(%rbp)
	je	.L25
.L24:
	movl	-160(%rbp), %eax
	subl	-152(%rbp), %eax
	movl	%eax, -140(%rbp)
	movq	-136(%rbp), %rax
	movl	-140(%rbp), %edx
	movslq	%edx, %rdx
	subq	%rdx, %rax
	movq	%rax, -136(%rbp)
	movq	-136(%rbp), %rax
	movl	-152(%rbp), %edx
	movslq	%edx, %rcx
	cqto
	idivq	%rcx
	movq	%rdx, %rax
	movq	%rax, -136(%rbp)
	movl	-140(%rbp), %eax
	movslq	%eax, %rdx
	movq	-136(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, -64(%rbp)
	movq	-88(%rbp), %rax
	movq	-64(%rbp), %rdx
	movl	(%rax,%rdx,4), %eax
	movl	%eax, -164(%rbp)
.L21:
	movl	-164(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	%rbx, %rsp
	movq	-56(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L27
	call	__stack_chk_fail@PLT
.L27:
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.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:
