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>

#define max(a, b) ((int)(a) > (int)(b) ? (a) : (b))
#define min(a, b) ((int)(a) > (int)(b) ? (b) : (a))

int main(void)
{
    int N, K;
    scanf("%d %d", &N, &K);

    int A[N + 1], lamp[N + 1];
    for(int i = 0; i < N; i++)
    {
        scanf("%d", &A[i]);
    }

    for(int i = 0; i < min(K, 50); i++)
    {
        for(int j = 0; j < N + 1; j++) { lamp[j] = 0; }
        for(int j = 0; j < N; j++)
        {
            lamp[max(0, j - A[j])] += 1;
            lamp[min(N, j + A[j] + 1)] -= 1;
        }

        for(int j = 1; j < N + 1; j++) { lamp[j] += lamp[j - 1]; }
        for(int j = 0; j < N + 1; j++) { A[j] = lamp[j]; }
    }

    for(int i = 0; i < N; i++)
    {
        printf("%d ", A[i]);
    }
    printf("\n");
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d "
	.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	$120, %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
	leaq	-120(%rbp), %rdx
	leaq	-124(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-124(%rbp), %eax
	addl	$1, %eax
	movslq	%eax, %rdx
	subq	$1, %rdx
	movq	%rdx, -88(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, -144(%rbp)
	movq	$0, -136(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, -160(%rbp)
	movq	$0, -152(%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
.L2:
	cmpq	%rdx, %rsp
	je	.L3
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L2
.L3:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L4
	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, -80(%rbp)
	movl	-124(%rbp), %eax
	addl	$1, %eax
	movslq	%eax, %rdx
	subq	$1, %rdx
	movq	%rdx, -72(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, %r14
	movl	$0, %r15d
	movslq	%eax, %rdx
	movq	%rdx, %r12
	movl	$0, %r13d
	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
.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, -64(%rbp)
	movl	$0, -116(%rbp)
	jmp	.L8
.L9:
	movl	-116(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-80(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -116(%rbp)
.L8:
	movl	-124(%rbp), %eax
	cmpl	%eax, -116(%rbp)
	jl	.L9
	movl	$0, -112(%rbp)
	jmp	.L10
.L19:
	movl	$0, -108(%rbp)
	jmp	.L11
.L12:
	movq	-64(%rbp), %rax
	movl	-108(%rbp), %edx
	movslq	%edx, %rdx
	movl	$0, (%rax,%rdx,4)
	addl	$1, -108(%rbp)
.L11:
	movl	-124(%rbp), %eax
	cmpl	%eax, -108(%rbp)
	jle	.L12
	movl	$0, -104(%rbp)
	jmp	.L13
.L14:
	movq	-80(%rbp), %rax
	movl	-104(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %edx
	movl	-104(%rbp), %eax
	subl	%edx, %eax
	movl	$0, %edx
	testl	%eax, %eax
	cmovns	%eax, %edx
	movq	-64(%rbp), %rax
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %ecx
	movq	-80(%rbp), %rax
	movl	-104(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %edx
	movl	-104(%rbp), %eax
	subl	%edx, %eax
	movl	$0, %edx
	testl	%eax, %eax
	cmovns	%eax, %edx
	addl	$1, %ecx
	movq	-64(%rbp), %rax
	movslq	%edx, %rdx
	movl	%ecx, (%rax,%rdx,4)
	movq	-80(%rbp), %rax
	movl	-104(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %edx
	movl	-104(%rbp), %eax
	addl	%edx, %eax
	leal	1(%rax), %edx
	movl	-124(%rbp), %eax
	cmpl	%eax, %edx
	cmovg	%eax, %edx
	movq	-64(%rbp), %rax
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %ecx
	movq	-80(%rbp), %rax
	movl	-104(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %edx
	movl	-104(%rbp), %eax
	addl	%edx, %eax
	leal	1(%rax), %edx
	movl	-124(%rbp), %eax
	cmpl	%eax, %edx
	cmovg	%eax, %edx
	subl	$1, %ecx
	movq	-64(%rbp), %rax
	movslq	%edx, %rdx
	movl	%ecx, (%rax,%rdx,4)
	addl	$1, -104(%rbp)
.L13:
	movl	-124(%rbp), %eax
	cmpl	%eax, -104(%rbp)
	jl	.L14
	movl	$1, -100(%rbp)
	jmp	.L15
.L16:
	movq	-64(%rbp), %rax
	movl	-100(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %ecx
	movl	-100(%rbp), %eax
	leal	-1(%rax), %edx
	movq	-64(%rbp), %rax
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	addl	%eax, %ecx
	movq	-64(%rbp), %rax
	movl	-100(%rbp), %edx
	movslq	%edx, %rdx
	movl	%ecx, (%rax,%rdx,4)
	addl	$1, -100(%rbp)
.L15:
	movl	-124(%rbp), %eax
	cmpl	%eax, -100(%rbp)
	jle	.L16
	movl	$0, -96(%rbp)
	jmp	.L17
.L18:
	movq	-64(%rbp), %rax
	movl	-96(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %ecx
	movq	-80(%rbp), %rax
	movl	-96(%rbp), %edx
	movslq	%edx, %rdx
	movl	%ecx, (%rax,%rdx,4)
	addl	$1, -96(%rbp)
.L17:
	movl	-124(%rbp), %eax
	cmpl	%eax, -96(%rbp)
	jle	.L18
	addl	$1, -112(%rbp)
.L10:
	movl	-120(%rbp), %eax
	movl	$50, %edx
	cmpl	%edx, %eax
	cmovg	%edx, %eax
	cmpl	%eax, -112(%rbp)
	jl	.L19
	movl	$0, -92(%rbp)
	jmp	.L20
.L21:
	movq	-80(%rbp), %rax
	movl	-92(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -92(%rbp)
.L20:
	movl	-124(%rbp), %eax
	cmpl	%eax, -92(%rbp)
	jl	.L21
	movl	$10, %edi
	call	putchar@PLT
	movq	%rbx, %rsp
	movl	$0, %eax
	movq	-56(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L23
	call	__stack_chk_fail@PLT
.L23:
	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 %d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d "
	.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	-60(%rbp), %rdx
	leaq	-64(%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	-64(%rbp), %r14
	movq	%rsp, %rsi
	leal	1(%r14), %eax
	cltq
	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
.L39:
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	cmpq	%rsi, %rsp
	jne	.L39
.L3:
	andl	$4095, %edx
	subq	%rdx, %rsp
	testq	%rdx, %rdx
	jne	.L40
.L4:
	movq	%rax, %rdx
	movq	%rsp, %rsi
	andq	$-4096, %rax
	movq	%rsp, %r12
	andq	$-16, %rdx
	subq	%rax, %rsi
.L5:
	cmpq	%rsi, %rsp
	je	.L6
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L5
.L40:
	orq	$0, -8(%rsp,%rdx)
	jmp	.L4
.L6:
	andl	$4095, %edx
	subq	%rdx, %rsp
	testq	%rdx, %rdx
	jne	.L41
.L7:
	movq	%rsp, %r15
	testl	%r14d, %r14d
	jle	.L8
	movq	%r12, %r13
	xorl	%ebx, %ebx
	.p2align 4,,10
	.p2align 3
.L9:
	movq	%r13, %rsi
	leaq	.LC1(%rip), %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	movslq	-64(%rbp), %r14
	addq	$4, %r13
	cmpl	%ebx, %r14d
	jg	.L9
	movl	-60(%rbp), %eax
	movl	$50, %edx
	cmpl	%edx, %eax
	cmovle	%eax, %edx
	movl	%edx, -72(%rbp)
	testl	%eax, %eax
	jle	.L10
.L19:
	movl	%r14d, %eax
	movl	$0, -68(%rbp)
	leal	-1(%r14), %ebx
	leaq	4(,%rax,4), %rax
	leaq	8(%r15,%rbx,4), %r13
	movq	%rax, -88(%rbp)
	xorl	%eax, %eax
	testl	%r14d, %r14d
	cmovns	%r14, %rax
	leaq	4(,%rax,4), %rax
	movq	%rax, -80(%rbp)
	.p2align 4,,10
	.p2align 3
.L11:
	testl	%r14d, %r14d
	js	.L16
	movq	-88(%rbp), %rdx
	xorl	%esi, %esi
	movq	%r15, %rdi
	call	memset@PLT
	testl	%r14d, %r14d
	je	.L12
	xorl	%edx, %edx
	.p2align 4,,10
	.p2align 3
.L13:
	movl	(%r12,%rdx,4), %esi
	movl	%edx, %eax
	movl	$0, %edi
	subl	%esi, %eax
	cmovs	%edi, %eax
	cltq
	addl	$1, (%r15,%rax,4)
	leal	1(%rsi,%rdx), %eax
	cmpl	%r14d, %eax
	cmovg	%r14d, %eax
	cltq
	subl	$1, (%r15,%rax,4)
	movq	%rdx, %rax
	addq	$1, %rdx
	cmpq	%rbx, %rax
	jne	.L13
	movl	(%r15), %edx
	leaq	4(%r15), %rax
	.p2align 4,,10
	.p2align 3
.L14:
	addl	(%rax), %edx
	addq	$4, %rax
	movl	%edx, -4(%rax)
	cmpq	%r13, %rax
	jne	.L14
.L12:
	movq	-80(%rbp), %rdx
	movq	%r15, %rsi
	movq	%r12, %rdi
	call	memcpy@PLT
.L16:
	addl	$1, -68(%rbp)
	movl	-68(%rbp), %eax
	cmpl	%eax, -72(%rbp)
	jg	.L11
.L10:
	xorl	%ebx, %ebx
	leaq	.LC2(%rip), %r13
	testl	%r14d, %r14d
	jle	.L18
	.p2align 4,,10
	.p2align 3
.L17:
	movl	(%r12,%rbx,4), %edx
	movq	%r13, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	addq	$1, %rbx
	call	__printf_chk@PLT
	cmpl	%ebx, -64(%rbp)
	jg	.L17
.L18:
	movl	$10, %edi
	call	putchar@PLT
	movq	-56(%rbp), %rax
	subq	%fs:40, %rax
	jne	.L42
	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
.L8:
	.cfi_restore_state
	movl	-60(%rbp), %eax
	movl	$50, %edx
	cmpl	%edx, %eax
	cmovle	%eax, %edx
	movl	%edx, -72(%rbp)
	testl	%eax, %eax
	jg	.L19
	jmp	.L18
.L41:
	orq	$0, -8(%rsp,%rdx)
	jmp	.L7
.L42:
	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 %d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d "
	.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	-60(%rbp), %rdx
	leaq	-64(%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	-64(%rbp), %r14
	movq	%rsp, %rsi
	leal	1(%r14), %eax
	cltq
	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
.L39:
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	cmpq	%rsi, %rsp
	jne	.L39
.L3:
	andl	$4095, %edx
	subq	%rdx, %rsp
	testq	%rdx, %rdx
	jne	.L40
.L4:
	movq	%rax, %rdx
	movq	%rsp, %rsi
	andq	$-4096, %rax
	movq	%rsp, %r12
	andq	$-16, %rdx
	subq	%rax, %rsi
.L5:
	cmpq	%rsi, %rsp
	je	.L6
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L5
.L40:
	orq	$0, -8(%rsp,%rdx)
	jmp	.L4
.L6:
	andl	$4095, %edx
	subq	%rdx, %rsp
	testq	%rdx, %rdx
	jne	.L41
.L7:
	movq	%rsp, %r15
	testl	%r14d, %r14d
	jle	.L8
	movq	%r12, %r13
	xorl	%ebx, %ebx
	.p2align 4,,10
	.p2align 3
.L9:
	movq	%r13, %rsi
	leaq	.LC1(%rip), %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	movslq	-64(%rbp), %r14
	addq	$4, %r13
	cmpl	%ebx, %r14d
	jg	.L9
	movl	-60(%rbp), %eax
	movl	$50, %edx
	cmpl	%edx, %eax
	cmovle	%eax, %edx
	movl	%edx, -72(%rbp)
	testl	%eax, %eax
	jle	.L10
.L19:
	movl	%r14d, %eax
	movl	$0, -68(%rbp)
	leal	-1(%r14), %ebx
	leaq	4(,%rax,4), %rax
	leaq	8(%r15,%rbx,4), %r13
	movq	%rax, -88(%rbp)
	xorl	%eax, %eax
	testl	%r14d, %r14d
	cmovns	%r14, %rax
	leaq	4(,%rax,4), %rax
	movq	%rax, -80(%rbp)
	.p2align 4,,10
	.p2align 3
.L11:
	testl	%r14d, %r14d
	js	.L16
	movq	-88(%rbp), %rdx
	xorl	%esi, %esi
	movq	%r15, %rdi
	call	memset@PLT
	testl	%r14d, %r14d
	je	.L12
	xorl	%edx, %edx
	.p2align 4,,10
	.p2align 3
.L13:
	movl	(%r12,%rdx,4), %esi
	movl	%edx, %eax
	movl	$0, %edi
	subl	%esi, %eax
	cmovs	%edi, %eax
	cltq
	addl	$1, (%r15,%rax,4)
	leal	1(%rsi,%rdx), %eax
	cmpl	%r14d, %eax
	cmovg	%r14d, %eax
	cltq
	subl	$1, (%r15,%rax,4)
	movq	%rdx, %rax
	addq	$1, %rdx
	cmpq	%rbx, %rax
	jne	.L13
	movl	(%r15), %edx
	leaq	4(%r15), %rax
	.p2align 4,,10
	.p2align 3
.L14:
	addl	(%rax), %edx
	addq	$4, %rax
	movl	%edx, -4(%rax)
	cmpq	%r13, %rax
	jne	.L14
.L12:
	movq	-80(%rbp), %rdx
	movq	%r15, %rsi
	movq	%r12, %rdi
	call	memcpy@PLT
.L16:
	addl	$1, -68(%rbp)
	movl	-68(%rbp), %eax
	cmpl	%eax, -72(%rbp)
	jg	.L11
.L10:
	xorl	%ebx, %ebx
	leaq	.LC2(%rip), %r13
	testl	%r14d, %r14d
	jle	.L18
	.p2align 4,,10
	.p2align 3
.L17:
	movl	(%r12,%rbx,4), %edx
	movq	%r13, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	addq	$1, %rbx
	call	__printf_chk@PLT
	cmpl	%ebx, -64(%rbp)
	jg	.L17
.L18:
	movl	$10, %edi
	call	putchar@PLT
	movq	-56(%rbp), %rax
	subq	%fs:40, %rax
	jne	.L42
	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
.L8:
	.cfi_restore_state
	movl	-60(%rbp), %eax
	movl	$50, %edx
	cmpl	%edx, %eax
	cmovle	%eax, %edx
	movl	%edx, -72(%rbp)
	testl	%eax, %eax
	jg	.L19
	jmp	.L18
.L41:
	orq	$0, -8(%rsp,%rdx)
	jmp	.L7
.L42:
	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>

#define max(a, b) ((int)(a) > (int)(b) ? (a) : (b))
#define min(a, b) ((int)(a) > (int)(b) ? (b) : (a))

int main(void)
{
    int N, K;
    scanf("%d %d", &N, &K);

    int A[N + 1], lamp[N + 1];
    for(int i = 0; i < N; i++)
    {
        scanf("%d", &A[i]);
    }

    for(int i = 0; i < min(K, 50); i++)
    {
        for(int j = 0; j < N + 1; j++) { lamp[j] = 0; }
        for(int j = 0; j < N; j++)
        {
            lamp[max(0, j - A[j])] += 1;
            lamp[min(N, j + A[j] + 1)] -= 1;
        }

        for(int j = 1; j < N + 1; j++) { lamp[j] += lamp[j - 1]; }
        for(int j = 0; j < N + 1; j++) { A[j] = lamp[j]; }
    }

    for(int i = 0; i < N; i++)
    {
        printf("%d ", A[i]);
    }
    printf("\n");
}

5 1
0 0 0 1 0
 5 2
0 0 0 1 0
 5 2
0 0 0 0 0
 5 2
1 0 0 0 0
 5 2
0 0 0 0 1
 5 0
0 0 0 0 1
 5 2
1 0 0 2 0
 5 2
0 0 0 2 0
 5 3
0 0 0 0 0
 5 2
0 1 0 0 1

1 1 2 1 2 
 3 3 4 3 3 
 2 3 3 3 2 
 2 3 3 4 2 
 2 4 3 3 2 
 0 0 0 0 1 
 3 3 4 4 4 
 3 3 4 4 3 
 4 4 5 4 4 
 3 4 4 3 3 

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>

#define max(a, b) ((int)(a) > (int)(b) ? (a) : (b))
#define min(a, b) ((int)(a) > (int)(b) ? (b) : (a))

int main(void)
{
    int N, K;
    scanf("%d %d", &N, &K);

    int A[N + 1], lamp[N + 1];
    for(int i = 0; i < N; i++)
    {
        scanf("%d", &A[i]);
    }

    for(int i = 0; i < min(K, 50); i++)
    {
        for(int j = 0; j < N + 1; j++) { lamp[j] = 0; }
        for(int j = 0; j < N; j++)
        {
            lamp[max(0, j - A[j])] += 1;
            lamp[min(N, j + A[j] + 1)] -= 1;
        }

        for(int j = 1; j < N + 1; j++) { lamp[j] += lamp[j - 1]; }
        for(int j = 0; j < N + 1; j++) { A[j] = lamp[j]; }
    }

    for(int i = 0; i < N; i++)
    {
        printf("%d ", A[i]);
    }
    printf("\n");
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d "
	.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	$120, %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
	leaq	-120(%rbp), %rdx
	leaq	-124(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-124(%rbp), %eax
	addl	$1, %eax
	movslq	%eax, %rdx
	subq	$1, %rdx
	movq	%rdx, -88(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, -144(%rbp)
	movq	$0, -136(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, -160(%rbp)
	movq	$0, -152(%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
.L2:
	cmpq	%rdx, %rsp
	je	.L3
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L2
.L3:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L4
	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, -80(%rbp)
	movl	-124(%rbp), %eax
	addl	$1, %eax
	movslq	%eax, %rdx
	subq	$1, %rdx
	movq	%rdx, -72(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, %r14
	movl	$0, %r15d
	movslq	%eax, %rdx
	movq	%rdx, %r12
	movl	$0, %r13d
	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
.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, -64(%rbp)
	movl	$0, -116(%rbp)
	jmp	.L8
.L9:
	movl	-116(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-80(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -116(%rbp)
.L8:
	movl	-124(%rbp), %eax
	cmpl	%eax, -116(%rbp)
	jl	.L9
	movl	$0, -112(%rbp)
	jmp	.L10
.L19:
	movl	$0, -108(%rbp)
	jmp	.L11
.L12:
	movq	-64(%rbp), %rax
	movl	-108(%rbp), %edx
	movslq	%edx, %rdx
	movl	$0, (%rax,%rdx,4)
	addl	$1, -108(%rbp)
.L11:
	movl	-124(%rbp), %eax
	cmpl	%eax, -108(%rbp)
	jle	.L12
	movl	$0, -104(%rbp)
	jmp	.L13
.L14:
	movq	-80(%rbp), %rax
	movl	-104(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %edx
	movl	-104(%rbp), %eax
	subl	%edx, %eax
	movl	$0, %edx
	testl	%eax, %eax
	cmovns	%eax, %edx
	movq	-64(%rbp), %rax
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %ecx
	movq	-80(%rbp), %rax
	movl	-104(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %edx
	movl	-104(%rbp), %eax
	subl	%edx, %eax
	movl	$0, %edx
	testl	%eax, %eax
	cmovns	%eax, %edx
	addl	$1, %ecx
	movq	-64(%rbp), %rax
	movslq	%edx, %rdx
	movl	%ecx, (%rax,%rdx,4)
	movq	-80(%rbp), %rax
	movl	-104(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %edx
	movl	-104(%rbp), %eax
	addl	%edx, %eax
	leal	1(%rax), %edx
	movl	-124(%rbp), %eax
	cmpl	%eax, %edx
	cmovg	%eax, %edx
	movq	-64(%rbp), %rax
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %ecx
	movq	-80(%rbp), %rax
	movl	-104(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %edx
	movl	-104(%rbp), %eax
	addl	%edx, %eax
	leal	1(%rax), %edx
	movl	-124(%rbp), %eax
	cmpl	%eax, %edx
	cmovg	%eax, %edx
	subl	$1, %ecx
	movq	-64(%rbp), %rax
	movslq	%edx, %rdx
	movl	%ecx, (%rax,%rdx,4)
	addl	$1, -104(%rbp)
.L13:
	movl	-124(%rbp), %eax
	cmpl	%eax, -104(%rbp)
	jl	.L14
	movl	$1, -100(%rbp)
	jmp	.L15
.L16:
	movq	-64(%rbp), %rax
	movl	-100(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %ecx
	movl	-100(%rbp), %eax
	leal	-1(%rax), %edx
	movq	-64(%rbp), %rax
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	addl	%eax, %ecx
	movq	-64(%rbp), %rax
	movl	-100(%rbp), %edx
	movslq	%edx, %rdx
	movl	%ecx, (%rax,%rdx,4)
	addl	$1, -100(%rbp)
.L15:
	movl	-124(%rbp), %eax
	cmpl	%eax, -100(%rbp)
	jle	.L16
	movl	$0, -96(%rbp)
	jmp	.L17
.L18:
	movq	-64(%rbp), %rax
	movl	-96(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %ecx
	movq	-80(%rbp), %rax
	movl	-96(%rbp), %edx
	movslq	%edx, %rdx
	movl	%ecx, (%rax,%rdx,4)
	addl	$1, -96(%rbp)
.L17:
	movl	-124(%rbp), %eax
	cmpl	%eax, -96(%rbp)
	jle	.L18
	addl	$1, -112(%rbp)
.L10:
	movl	-120(%rbp), %eax
	movl	$50, %edx
	cmpl	%edx, %eax
	cmovg	%edx, %eax
	cmpl	%eax, -112(%rbp)
	jl	.L19
	movl	$0, -92(%rbp)
	jmp	.L20
.L21:
	movq	-80(%rbp), %rax
	movl	-92(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -92(%rbp)
.L20:
	movl	-124(%rbp), %eax
	cmpl	%eax, -92(%rbp)
	jl	.L21
	movl	$10, %edi
	call	putchar@PLT
	movq	%rbx, %rsp
	movl	$0, %eax
	movq	-56(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L23
	call	__stack_chk_fail@PLT
.L23:
	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 %d"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d "
	.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	$120, %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
	leaq	-120(%rbp), %rdx
	leaq	-124(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-124(%rbp), %eax
	addl	$1, %eax
	movslq	%eax, %rdx
	subq	$1, %rdx
	movq	%rdx, -88(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, -144(%rbp)
	movq	$0, -136(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, -160(%rbp)
	movq	$0, -152(%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
.L2:
	cmpq	%rdx, %rsp
	je	.L3
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L2
.L3:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L4
	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, -80(%rbp)
	movl	-124(%rbp), %eax
	addl	$1, %eax
	movslq	%eax, %rdx
	subq	$1, %rdx
	movq	%rdx, -72(%rbp)
	movslq	%eax, %rdx
	movq	%rdx, %r14
	movl	$0, %r15d
	movslq	%eax, %rdx
	movq	%rdx, %r12
	movl	$0, %r13d
	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
.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, -64(%rbp)
	movl	$0, -116(%rbp)
	jmp	.L8
.L9:
	movl	-116(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-80(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -116(%rbp)
.L8:
	movl	-124(%rbp), %eax
	cmpl	%eax, -116(%rbp)
	jl	.L9
	movl	$0, -112(%rbp)
	jmp	.L10
.L19:
	movl	$0, -108(%rbp)
	jmp	.L11
.L12:
	movq	-64(%rbp), %rax
	movl	-108(%rbp), %edx
	movslq	%edx, %rdx
	movl	$0, (%rax,%rdx,4)
	addl	$1, -108(%rbp)
.L11:
	movl	-124(%rbp), %eax
	cmpl	%eax, -108(%rbp)
	jle	.L12
	movl	$0, -104(%rbp)
	jmp	.L13
.L14:
	movq	-80(%rbp), %rax
	movl	-104(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %edx
	movl	-104(%rbp), %eax
	subl	%edx, %eax
	movl	$0, %edx
	testl	%eax, %eax
	cmovns	%eax, %edx
	movq	-64(%rbp), %rax
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %ecx
	movq	-80(%rbp), %rax
	movl	-104(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %edx
	movl	-104(%rbp), %eax
	subl	%edx, %eax
	movl	$0, %edx
	testl	%eax, %eax
	cmovns	%eax, %edx
	addl	$1, %ecx
	movq	-64(%rbp), %rax
	movslq	%edx, %rdx
	movl	%ecx, (%rax,%rdx,4)
	movq	-80(%rbp), %rax
	movl	-104(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %edx
	movl	-104(%rbp), %eax
	addl	%edx, %eax
	leal	1(%rax), %edx
	movl	-124(%rbp), %eax
	cmpl	%eax, %edx
	cmovg	%eax, %edx
	movq	-64(%rbp), %rax
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %ecx
	movq	-80(%rbp), %rax
	movl	-104(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %edx
	movl	-104(%rbp), %eax
	addl	%edx, %eax
	leal	1(%rax), %edx
	movl	-124(%rbp), %eax
	cmpl	%eax, %edx
	cmovg	%eax, %edx
	subl	$1, %ecx
	movq	-64(%rbp), %rax
	movslq	%edx, %rdx
	movl	%ecx, (%rax,%rdx,4)
	addl	$1, -104(%rbp)
.L13:
	movl	-124(%rbp), %eax
	cmpl	%eax, -104(%rbp)
	jl	.L14
	movl	$1, -100(%rbp)
	jmp	.L15
.L16:
	movq	-64(%rbp), %rax
	movl	-100(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %ecx
	movl	-100(%rbp), %eax
	leal	-1(%rax), %edx
	movq	-64(%rbp), %rax
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	addl	%eax, %ecx
	movq	-64(%rbp), %rax
	movl	-100(%rbp), %edx
	movslq	%edx, %rdx
	movl	%ecx, (%rax,%rdx,4)
	addl	$1, -100(%rbp)
.L15:
	movl	-124(%rbp), %eax
	cmpl	%eax, -100(%rbp)
	jle	.L16
	movl	$0, -96(%rbp)
	jmp	.L17
.L18:
	movq	-64(%rbp), %rax
	movl	-96(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %ecx
	movq	-80(%rbp), %rax
	movl	-96(%rbp), %edx
	movslq	%edx, %rdx
	movl	%ecx, (%rax,%rdx,4)
	addl	$1, -96(%rbp)
.L17:
	movl	-124(%rbp), %eax
	cmpl	%eax, -96(%rbp)
	jle	.L18
	addl	$1, -112(%rbp)
.L10:
	movl	-120(%rbp), %eax
	movl	$50, %edx
	cmpl	%edx, %eax
	cmovg	%edx, %eax
	cmpl	%eax, -112(%rbp)
	jl	.L19
	movl	$0, -92(%rbp)
	jmp	.L20
.L21:
	movq	-80(%rbp), %rax
	movl	-92(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -92(%rbp)
.L20:
	movl	-124(%rbp), %eax
	cmpl	%eax, -92(%rbp)
	jl	.L21
	movl	$10, %edi
	call	putchar@PLT
	movq	%rbx, %rsp
	movl	$0, %eax
	movq	-56(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L23
	call	__stack_chk_fail@PLT
.L23:
	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:
