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,M;
    scanf("%d %d",&N,&M);
    int A[N][M];
    for(int i=0;i<N;i++)for(int j=0;j<M;j++){
        scanf("%d",&A[i][j]);
    }
    int kibousya[M];
    int nozoki[M];
    for(int i=0;i<M;i++){kibousya[i]=0;nozoki[i]=0;}
    int ans=114514;
    for(int i=0;i<M;i++){
        for(int j=0;j<N;j++){
            for(int k=0;k<M;k++){
                if(nozoki[A[j][k]-1]==0){kibousya[A[j][k]-1]++;break;}
            }
        }
        int maxkibou=0;
        for(int j=0;j<M;j++)if(nozoki[j]==0&&kibousya[j]>=kibousya[maxkibou])maxkibou=j;
        if(ans>kibousya[maxkibou])ans=kibousya[maxkibou];
        nozoki[maxkibou]=1;
        for(int i=0;i<M;i++)kibousya[i]=0;
    }
    printf("%d",ans);
    return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d %d"
.LC1:
	.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	$248, %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, -280(%rbp)
	leaq	-156(%rbp), %rdx
	leaq	-160(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-156(%rbp), %esi
	movl	-160(%rbp), %edi
	movslq	%esi, %rax
	subq	$1, %rax
	movq	%rax, -112(%rbp)
	movslq	%esi, %rax
	movq	%rax, -208(%rbp)
	movq	$0, -200(%rbp)
	movslq	%esi, %rax
	leaq	0(,%rax,4), %rbx
	movslq	%edi, %rax
	subq	$1, %rax
	movq	%rax, -104(%rbp)
	movslq	%esi, %rax
	movq	%rax, %r14
	movl	$0, %r15d
	movslq	%edi, %rax
	movq	%rax, %r12
	movl	$0, %r13d
	movq	%r15, %rdx
	imulq	%r12, %rdx
	movq	%r13, %rax
	imulq	%r14, %rax
	leaq	(%rdx,%rax), %rcx
	movq	%r14, %rax
	mulq	%r12
	addq	%rdx, %rcx
	movq	%rcx, %rdx
	movslq	%esi, %rax
	movq	%rax, -176(%rbp)
	movq	$0, -168(%rbp)
	movslq	%edi, %rax
	movq	%rax, -192(%rbp)
	movq	$0, -184(%rbp)
	movq	-176(%rbp), %r8
	movq	-168(%rbp), %r9
	movq	%r9, %rdx
	movq	-192(%rbp), %r10
	movq	-184(%rbp), %r11
	imulq	%r10, %rdx
	movq	%r11, %rax
	imulq	%r8, %rax
	leaq	(%rdx,%rax), %rcx
	movq	%r8, %rax
	mulq	%r10
	addq	%rdx, %rcx
	movq	%rcx, %rdx
	movslq	%esi, %rdx
	movslq	%edi, %rax
	imulq	%rdx, %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
.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, -96(%rbp)
	movl	$0, -152(%rbp)
	jmp	.L5
.L8:
	movl	$0, -148(%rbp)
	jmp	.L6
.L7:
	movq	%rbx, %rdx
	shrq	$2, %rdx
	movl	-148(%rbp), %eax
	movslq	%eax, %rcx
	movl	-152(%rbp), %eax
	cltq
	imulq	%rdx, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	movq	-96(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -148(%rbp)
.L6:
	movl	-156(%rbp), %eax
	cmpl	%eax, -148(%rbp)
	jl	.L7
	addl	$1, -152(%rbp)
.L5:
	movl	-160(%rbp), %eax
	cmpl	%eax, -152(%rbp)
	jl	.L8
	movl	-156(%rbp), %eax
	movslq	%eax, %rdx
	subq	$1, %rdx
	movq	%rdx, -88(%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, %edi
	movl	$0, %edx
	divq	%rdi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L9:
	cmpq	%rdx, %rsp
	je	.L10
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L9
.L10:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L11
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L11:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -80(%rbp)
	movl	-156(%rbp), %eax
	movslq	%eax, %rdx
	subq	$1, %rdx
	movq	%rdx, -72(%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
.L12:
	cmpq	%rdx, %rsp
	je	.L13
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L12
.L13:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L14
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L14:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -64(%rbp)
	movl	$0, -144(%rbp)
	jmp	.L15
.L16:
	movq	-80(%rbp), %rax
	movl	-144(%rbp), %edx
	movslq	%edx, %rdx
	movl	$0, (%rax,%rdx,4)
	movq	-64(%rbp), %rax
	movl	-144(%rbp), %edx
	movslq	%edx, %rdx
	movl	$0, (%rax,%rdx,4)
	addl	$1, -144(%rbp)
.L15:
	movl	-156(%rbp), %eax
	cmpl	%eax, -144(%rbp)
	jl	.L16
	movl	$114514, -140(%rbp)
	movl	$0, -136(%rbp)
	jmp	.L17
.L30:
	movl	$0, -132(%rbp)
	jmp	.L18
.L23:
	movl	$0, -128(%rbp)
	jmp	.L19
.L22:
	movq	%rbx, %rcx
	shrq	$2, %rcx
	movq	-96(%rbp), %rax
	movl	-128(%rbp), %edx
	movslq	%edx, %rsi
	movl	-132(%rbp), %edx
	movslq	%edx, %rdx
	imulq	%rcx, %rdx
	addq	%rsi, %rdx
	movl	(%rax,%rdx,4), %eax
	leal	-1(%rax), %edx
	movq	-64(%rbp), %rax
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	testl	%eax, %eax
	jne	.L20
	movq	%rbx, %rcx
	shrq	$2, %rcx
	movq	-96(%rbp), %rax
	movl	-128(%rbp), %edx
	movslq	%edx, %rsi
	movl	-132(%rbp), %edx
	movslq	%edx, %rdx
	imulq	%rcx, %rdx
	addq	%rsi, %rdx
	movl	(%rax,%rdx,4), %eax
	subl	$1, %eax
	movq	-80(%rbp), %rdx
	movslq	%eax, %rcx
	movl	(%rdx,%rcx,4), %edx
	leal	1(%rdx), %ecx
	movq	-80(%rbp), %rdx
	cltq
	movl	%ecx, (%rdx,%rax,4)
	jmp	.L21
.L20:
	addl	$1, -128(%rbp)
.L19:
	movl	-156(%rbp), %eax
	cmpl	%eax, -128(%rbp)
	jl	.L22
.L21:
	addl	$1, -132(%rbp)
.L18:
	movl	-160(%rbp), %eax
	cmpl	%eax, -132(%rbp)
	jl	.L23
	movl	$0, -124(%rbp)
	movl	$0, -120(%rbp)
	jmp	.L24
.L26:
	movq	-64(%rbp), %rax
	movl	-120(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	testl	%eax, %eax
	jne	.L25
	movq	-80(%rbp), %rax
	movl	-120(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %ecx
	movq	-80(%rbp), %rax
	movl	-124(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	cmpl	%eax, %ecx
	jl	.L25
	movl	-120(%rbp), %eax
	movl	%eax, -124(%rbp)
.L25:
	addl	$1, -120(%rbp)
.L24:
	movl	-156(%rbp), %eax
	cmpl	%eax, -120(%rbp)
	jl	.L26
	movq	-80(%rbp), %rax
	movl	-124(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	cmpl	%eax, -140(%rbp)
	jle	.L27
	movq	-80(%rbp), %rax
	movl	-124(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	movl	%eax, -140(%rbp)
.L27:
	movq	-64(%rbp), %rax
	movl	-124(%rbp), %edx
	movslq	%edx, %rdx
	movl	$1, (%rax,%rdx,4)
	movl	$0, -116(%rbp)
	jmp	.L28
.L29:
	movq	-80(%rbp), %rax
	movl	-116(%rbp), %edx
	movslq	%edx, %rdx
	movl	$0, (%rax,%rdx,4)
	addl	$1, -116(%rbp)
.L28:
	movl	-156(%rbp), %eax
	cmpl	%eax, -116(%rbp)
	jl	.L29
	addl	$1, -136(%rbp)
.L17:
	movl	-156(%rbp), %eax
	cmpl	%eax, -136(%rbp)
	jl	.L30
	movl	-140(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-280(%rbp), %rsp
	movq	-56(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L32
	call	__stack_chk_fail@PLT
.L32:
	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"
	.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	$72, %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	-60(%rbp), %rdx
	movslq	-64(%rbp), %rax
	movq	%rsp, %rdi
	movq	%rax, %r8
	imulq	%rdx, %rax
	movq	%rdx, %rcx
	leaq	0(,%rdx,4), %r14
	leaq	15(,%rax,4), %rsi
	movq	%rsi, %rax
	andq	$-4096, %rsi
	subq	%rsi, %rdi
	andq	$-16, %rax
	cmpq	%rdi, %rsp
	je	.L3
.L49:
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	cmpq	%rdi, %rsp
	jne	.L49
.L3:
	andl	$4095, %eax
	subq	%rax, %rsp
	testq	%rax, %rax
	jne	.L50
.L4:
	movq	%rsp, -72(%rbp)
	leaq	.LC1(%rip), %r12
	testl	%r8d, %r8d
	jle	.L5
	movq	%r14, %rax
	movq	%r14, -88(%rbp)
	xorl	%r13d, %r13d
	xorl	%ebx, %ebx
	shrq	$2, %rax
	leaq	.LC1(%rip), %r12
	movq	%rax, -80(%rbp)
	testl	%ecx, %ecx
	jle	.L26
	.p2align 4,,10
	.p2align 3
.L9:
	movq	-72(%rbp), %rax
	xorl	%r14d, %r14d
	leaq	(%rax,%r13,4), %r15
	.p2align 4,,10
	.p2align 3
.L7:
	movq	%r15, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	addl	$1, %r14d
	call	__isoc99_scanf@PLT
	movl	-60(%rbp), %ecx
	addq	$4, %r15
	cmpl	%r14d, %ecx
	jg	.L7
	movl	-64(%rbp), %r8d
	addl	$1, %ebx
	cmpl	%ebx, %r8d
	jle	.L51
	addq	-80(%rbp), %r13
	testl	%ecx, %ecx
	jg	.L9
.L26:
	movl	$114514, %r11d
.L10:
	xorl	%eax, %eax
	movl	%r11d, %edx
	movq	%r12, %rsi
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	-56(%rbp), %rax
	subq	%fs:40, %rax
	jne	.L52
	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
.L51:
	.cfi_restore_state
	movq	-88(%rbp), %r14
	movslq	%ecx, %rdx
.L5:
	leaq	15(,%rdx,4), %rax
	movq	%rsp, %rsi
	movq	%rax, %rdi
	movq	%rax, %rdx
	andq	$-4096, %rdi
	andq	$-16, %rdx
	subq	%rdi, %rsi
.L11:
	cmpq	%rsi, %rsp
	je	.L12
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L11
.L12:
	andl	$4095, %edx
	subq	%rdx, %rsp
	testq	%rdx, %rdx
	jne	.L53
.L13:
	movq	%rax, %rdx
	movq	%rsp, %rsi
	andq	$-4096, %rax
	movq	%rsp, %r13
	andq	$-16, %rdx
	subq	%rax, %rsi
.L14:
	cmpq	%rsi, %rsp
	je	.L15
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L14
.L53:
	orq	$0, -8(%rsp,%rdx)
	jmp	.L13
.L50:
	orq	$0, -8(%rsp,%rax)
	jmp	.L4
.L15:
	movq	%rdx, %rax
	andl	$4095, %eax
	subq	%rax, %rsp
	testq	%rax, %rax
	jne	.L54
.L16:
	movl	%r8d, -112(%rbp)
	movq	%rsp, %rbx
	testl	%ecx, %ecx
	jle	.L26
	movl	%ecx, %r15d
	movq	%r13, %rdi
	xorl	%esi, %esi
	movl	%ecx, -88(%rbp)
	leaq	0(,%r15,4), %rax
	movq	%rax, %rdx
	movq	%rax, -80(%rbp)
	call	memset@PLT
	movq	-80(%rbp), %rdx
	movq	%rbx, %rdi
	xorl	%esi, %esi
	call	memset@PLT
	movl	-88(%rbp), %ecx
	movq	-72(%rbp), %rdi
	xorl	%r9d, %r9d
	movl	$114514, %r11d
	leal	-1(%rcx), %eax
	movl	%ecx, -100(%rbp)
	salq	$2, %rax
	movq	%rax, -96(%rbp)
	leaq	4(%rdi,%rax), %rax
	movq	%r13, %rdi
	movq	%r15, %r13
	movq	%rax, -88(%rbp)
	movq	%r14, %r15
	movl	-112(%rbp), %r14d
	movq	%r12, -112(%rbp)
	movl	%r11d, %r12d
	.p2align 4,,10
	.p2align 3
.L17:
	movq	$-4, %r10
	movq	-88(%rbp), %rsi
	xorl	%r8d, %r8d
	subq	-96(%rbp), %r10
	testl	%r14d, %r14d
	jle	.L21
	.p2align 4,,10
	.p2align 3
.L24:
	leaq	(%r10,%rsi), %rdx
	jmp	.L20
	.p2align 4,,10
	.p2align 3
.L18:
	addq	$4, %rdx
	cmpq	%rsi, %rdx
	je	.L19
.L20:
	movl	(%rdx), %eax
	subl	$1, %eax
	cltq
	movl	(%rbx,%rax,4), %ecx
	testl	%ecx, %ecx
	jne	.L18
	addl	$1, (%rdi,%rax,4)
.L19:
	addl	$1, %r8d
	addq	%r15, %rsi
	cmpl	%r14d, %r8d
	jne	.L24
.L21:
	movl	(%rdi), %esi
	xorl	%eax, %eax
	xorl	%r8d, %r8d
	.p2align 4,,10
	.p2align 3
.L23:
	movl	(%rbx,%rax,4), %edx
	testl	%edx, %edx
	jne	.L22
	movl	(%rdi,%rax,4), %edx
	cmpl	%esi, %edx
	jl	.L22
	movl	%edx, %esi
	movslq	%eax, %r8
.L22:
	addq	$1, %rax
	cmpq	%rax, %r13
	jne	.L23
	movl	$1, (%rbx,%r8,4)
	cmpl	%esi, %r12d
	movq	-80(%rbp), %rdx
	cmovg	%esi, %r12d
	xorl	%esi, %esi
	movl	%r9d, -72(%rbp)
	call	memset@PLT
	movl	-72(%rbp), %r9d
	movq	%rax, %rdi
	addl	$1, %r9d
	cmpl	-100(%rbp), %r9d
	jne	.L17
	movl	%r12d, %r11d
	movq	-112(%rbp), %r12
	jmp	.L10
.L54:
	orq	$0, -8(%rsp,%rax)
	jmp	.L16
.L52:
	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"
	.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	$72, %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	-60(%rbp), %rdx
	movslq	-64(%rbp), %rax
	movq	%rsp, %rdi
	movq	%rax, %r8
	imulq	%rdx, %rax
	movq	%rdx, %rcx
	leaq	0(,%rdx,4), %r14
	leaq	15(,%rax,4), %rsi
	movq	%rsi, %rax
	andq	$-4096, %rsi
	subq	%rsi, %rdi
	andq	$-16, %rax
	cmpq	%rdi, %rsp
	je	.L3
.L49:
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	cmpq	%rdi, %rsp
	jne	.L49
.L3:
	andl	$4095, %eax
	subq	%rax, %rsp
	testq	%rax, %rax
	jne	.L50
.L4:
	movq	%rsp, -72(%rbp)
	leaq	.LC1(%rip), %r12
	testl	%r8d, %r8d
	jle	.L5
	movq	%r14, %rax
	movq	%r14, -88(%rbp)
	xorl	%r13d, %r13d
	xorl	%ebx, %ebx
	shrq	$2, %rax
	leaq	.LC1(%rip), %r12
	movq	%rax, -80(%rbp)
	testl	%ecx, %ecx
	jle	.L26
	.p2align 4,,10
	.p2align 3
.L9:
	movq	-72(%rbp), %rax
	xorl	%r14d, %r14d
	leaq	(%rax,%r13,4), %r15
	.p2align 4,,10
	.p2align 3
.L7:
	movq	%r15, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	addl	$1, %r14d
	call	__isoc99_scanf@PLT
	movl	-60(%rbp), %ecx
	addq	$4, %r15
	cmpl	%r14d, %ecx
	jg	.L7
	movl	-64(%rbp), %r8d
	addl	$1, %ebx
	cmpl	%ebx, %r8d
	jle	.L51
	addq	-80(%rbp), %r13
	testl	%ecx, %ecx
	jg	.L9
.L26:
	movl	$114514, %r11d
.L10:
	xorl	%eax, %eax
	movl	%r11d, %edx
	movq	%r12, %rsi
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	-56(%rbp), %rax
	subq	%fs:40, %rax
	jne	.L52
	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
.L51:
	.cfi_restore_state
	movq	-88(%rbp), %r14
	movslq	%ecx, %rdx
.L5:
	leaq	15(,%rdx,4), %rax
	movq	%rsp, %rsi
	movq	%rax, %rdi
	movq	%rax, %rdx
	andq	$-4096, %rdi
	andq	$-16, %rdx
	subq	%rdi, %rsi
.L11:
	cmpq	%rsi, %rsp
	je	.L12
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L11
.L12:
	andl	$4095, %edx
	subq	%rdx, %rsp
	testq	%rdx, %rdx
	jne	.L53
.L13:
	movq	%rax, %rdx
	movq	%rsp, %rsi
	andq	$-4096, %rax
	movq	%rsp, %r13
	andq	$-16, %rdx
	subq	%rax, %rsi
.L14:
	cmpq	%rsi, %rsp
	je	.L15
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L14
.L53:
	orq	$0, -8(%rsp,%rdx)
	jmp	.L13
.L50:
	orq	$0, -8(%rsp,%rax)
	jmp	.L4
.L15:
	movq	%rdx, %rax
	andl	$4095, %eax
	subq	%rax, %rsp
	testq	%rax, %rax
	jne	.L54
.L16:
	movl	%r8d, -112(%rbp)
	movq	%rsp, %rbx
	testl	%ecx, %ecx
	jle	.L26
	movl	%ecx, %r15d
	movq	%r13, %rdi
	xorl	%esi, %esi
	movl	%ecx, -88(%rbp)
	leaq	0(,%r15,4), %rax
	movq	%rax, %rdx
	movq	%rax, -80(%rbp)
	call	memset@PLT
	movq	-80(%rbp), %rdx
	movq	%rbx, %rdi
	xorl	%esi, %esi
	call	memset@PLT
	movl	-88(%rbp), %ecx
	movq	-72(%rbp), %rdi
	xorl	%r9d, %r9d
	movl	$114514, %r11d
	leal	-1(%rcx), %eax
	movl	%ecx, -100(%rbp)
	salq	$2, %rax
	movq	%rax, -96(%rbp)
	leaq	4(%rdi,%rax), %rax
	movq	%r13, %rdi
	movq	%r15, %r13
	movq	%rax, -88(%rbp)
	movq	%r14, %r15
	movl	-112(%rbp), %r14d
	movq	%r12, -112(%rbp)
	movl	%r11d, %r12d
	.p2align 4,,10
	.p2align 3
.L17:
	movq	$-4, %r10
	movq	-88(%rbp), %rsi
	xorl	%r8d, %r8d
	subq	-96(%rbp), %r10
	testl	%r14d, %r14d
	jle	.L21
	.p2align 4,,10
	.p2align 3
.L24:
	leaq	(%r10,%rsi), %rdx
	jmp	.L20
	.p2align 4,,10
	.p2align 3
.L18:
	addq	$4, %rdx
	cmpq	%rsi, %rdx
	je	.L19
.L20:
	movl	(%rdx), %eax
	subl	$1, %eax
	cltq
	movl	(%rbx,%rax,4), %ecx
	testl	%ecx, %ecx
	jne	.L18
	addl	$1, (%rdi,%rax,4)
.L19:
	addl	$1, %r8d
	addq	%r15, %rsi
	cmpl	%r14d, %r8d
	jne	.L24
.L21:
	movl	(%rdi), %esi
	xorl	%eax, %eax
	xorl	%r8d, %r8d
	.p2align 4,,10
	.p2align 3
.L23:
	movl	(%rbx,%rax,4), %edx
	testl	%edx, %edx
	jne	.L22
	movl	(%rdi,%rax,4), %edx
	cmpl	%esi, %edx
	jl	.L22
	movl	%edx, %esi
	movslq	%eax, %r8
.L22:
	addq	$1, %rax
	cmpq	%rax, %r13
	jne	.L23
	movl	$1, (%rbx,%r8,4)
	cmpl	%esi, %r12d
	movq	-80(%rbp), %rdx
	cmovg	%esi, %r12d
	xorl	%esi, %esi
	movl	%r9d, -72(%rbp)
	call	memset@PLT
	movl	-72(%rbp), %r9d
	movq	%rax, %rdi
	addl	$1, %r9d
	cmpl	-100(%rbp), %r9d
	jne	.L17
	movl	%r12d, %r11d
	movq	-112(%rbp), %r12
	jmp	.L10
.L54:
	orq	$0, -8(%rsp,%rax)
	jmp	.L16
.L52:
	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,M;
    scanf("%d %d",&N,&M);
    int A[N][M];
    for(int i=0;i<N;i++)for(int j=0;j<M;j++){
        scanf("%d",&A[i][j]);
    }
    int kibousya[M];
    int nozoki[M];
    for(int i=0;i<M;i++){kibousya[i]=0;nozoki[i]=0;}
    int ans=114514;
    for(int i=0;i<M;i++){
        for(int j=0;j<N;j++){
            for(int k=0;k<M;k++){
                if(nozoki[A[j][k]-1]==0){kibousya[A[j][k]-1]++;break;}
            }
        }
        int maxkibou=0;
        for(int j=0;j<M;j++)if(nozoki[j]==0&&kibousya[j]>=kibousya[maxkibou])maxkibou=j;
        if(ans>kibousya[maxkibou])ans=kibousya[maxkibou];
        nozoki[maxkibou]=1;
        for(int i=0;i<M;i++)kibousya[i]=0;
    }
    printf("%d",ans);
    return 0;
}

2 5
5 1 3 4 2
2 5 3 1 4
2 3 1 4 5
2 5 4 3 1
 2 3
2 1 3
2 1 3
2 1 3
 2 5
5 1 3 4 2
2 5 3 1 4
2 3 1 6 5
2 5 4 3 1
 2 5
5 1 3 4 2
2 5 3 1 4
2 3 1 6 7
2 5 4 3 1
 2 5
5 1 3 4 2
2 5 3 1 4
2 0 1 4 5
2 5 4 3 1
 2 5
5 1 3 4 2
2 5 3 1 4
2 3 1 4 5
2 5 5 3 1
 2 5
5 1 3 4 2
2 5 3 1 4
2 3 1 6 10
2 5 4 3 1
 2 5
5 1 3 4 2
2 5 3 1 4
4 0 1 4 5
2 5 4 3 1
 2 5
5 1 3 4 2
2 5 3 1 4
2 3 1 6 10
2 5 4 2 1
 2 5
5 1 3 4 2
2 5 3 1 4
2 3 1 6 8
2 5 4 2 1

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

```c
#include <stdio.h>

int main(void){
    int N,M;
    scanf("%d %d",&N,&M);
    int A[N][M];
    for(int i=0;i<N;i++)for(int j=0;j<M;j++){
        scanf("%d",&A[i][j]);
    }
    int kibousya[M];
    int nozoki[M];
    for(int i=0;i<M;i++){kibousya[i]=0;nozoki[i]=0;}
    int ans=114514;
    for(int i=0;i<M;i++){
        for(int j=0;j<N;j++){
            for(int k=0;k<M;k++){
                if(nozoki[A[j][k]-1]==0){kibousya[A[j][k]-1]++;break;}
            }
        }
        int maxkibou=0;
        for(int j=0;j<M;j++)if(nozoki[j]==0&&kibousya[j]>=kibousya[maxkibou])maxkibou=j;
        if(ans>kibousya[maxkibou])ans=kibousya[maxkibou];
        nozoki[maxkibou]=1;
        for(int i=0;i<M;i++)kibousya[i]=0;
    }
    printf("%d",ans);
    return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d %d"
.LC1:
	.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	$248, %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, -280(%rbp)
	leaq	-156(%rbp), %rdx
	leaq	-160(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-156(%rbp), %esi
	movl	-160(%rbp), %edi
	movslq	%esi, %rax
	subq	$1, %rax
	movq	%rax, -112(%rbp)
	movslq	%esi, %rax
	movq	%rax, -208(%rbp)
	movq	$0, -200(%rbp)
	movslq	%esi, %rax
	leaq	0(,%rax,4), %rbx
	movslq	%edi, %rax
	subq	$1, %rax
	movq	%rax, -104(%rbp)
	movslq	%esi, %rax
	movq	%rax, %r14
	movl	$0, %r15d
	movslq	%edi, %rax
	movq	%rax, %r12
	movl	$0, %r13d
	movq	%r15, %rdx
	imulq	%r12, %rdx
	movq	%r13, %rax
	imulq	%r14, %rax
	leaq	(%rdx,%rax), %rcx
	movq	%r14, %rax
	mulq	%r12
	addq	%rdx, %rcx
	movq	%rcx, %rdx
	movslq	%esi, %rax
	movq	%rax, -176(%rbp)
	movq	$0, -168(%rbp)
	movslq	%edi, %rax
	movq	%rax, -192(%rbp)
	movq	$0, -184(%rbp)
	movq	-176(%rbp), %r8
	movq	-168(%rbp), %r9
	movq	%r9, %rdx
	movq	-192(%rbp), %r10
	movq	-184(%rbp), %r11
	imulq	%r10, %rdx
	movq	%r11, %rax
	imulq	%r8, %rax
	leaq	(%rdx,%rax), %rcx
	movq	%r8, %rax
	mulq	%r10
	addq	%rdx, %rcx
	movq	%rcx, %rdx
	movslq	%esi, %rdx
	movslq	%edi, %rax
	imulq	%rdx, %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
.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, -96(%rbp)
	movl	$0, -152(%rbp)
	jmp	.L5
.L8:
	movl	$0, -148(%rbp)
	jmp	.L6
.L7:
	movq	%rbx, %rdx
	shrq	$2, %rdx
	movl	-148(%rbp), %eax
	movslq	%eax, %rcx
	movl	-152(%rbp), %eax
	cltq
	imulq	%rdx, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	movq	-96(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -148(%rbp)
.L6:
	movl	-156(%rbp), %eax
	cmpl	%eax, -148(%rbp)
	jl	.L7
	addl	$1, -152(%rbp)
.L5:
	movl	-160(%rbp), %eax
	cmpl	%eax, -152(%rbp)
	jl	.L8
	movl	-156(%rbp), %eax
	movslq	%eax, %rdx
	subq	$1, %rdx
	movq	%rdx, -88(%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, %edi
	movl	$0, %edx
	divq	%rdi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L9:
	cmpq	%rdx, %rsp
	je	.L10
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L9
.L10:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L11
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L11:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -80(%rbp)
	movl	-156(%rbp), %eax
	movslq	%eax, %rdx
	subq	$1, %rdx
	movq	%rdx, -72(%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
.L12:
	cmpq	%rdx, %rsp
	je	.L13
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L12
.L13:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L14
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L14:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -64(%rbp)
	movl	$0, -144(%rbp)
	jmp	.L15
.L16:
	movq	-80(%rbp), %rax
	movl	-144(%rbp), %edx
	movslq	%edx, %rdx
	movl	$0, (%rax,%rdx,4)
	movq	-64(%rbp), %rax
	movl	-144(%rbp), %edx
	movslq	%edx, %rdx
	movl	$0, (%rax,%rdx,4)
	addl	$1, -144(%rbp)
.L15:
	movl	-156(%rbp), %eax
	cmpl	%eax, -144(%rbp)
	jl	.L16
	movl	$114514, -140(%rbp)
	movl	$0, -136(%rbp)
	jmp	.L17
.L30:
	movl	$0, -132(%rbp)
	jmp	.L18
.L23:
	movl	$0, -128(%rbp)
	jmp	.L19
.L22:
	movq	%rbx, %rcx
	shrq	$2, %rcx
	movq	-96(%rbp), %rax
	movl	-128(%rbp), %edx
	movslq	%edx, %rsi
	movl	-132(%rbp), %edx
	movslq	%edx, %rdx
	imulq	%rcx, %rdx
	addq	%rsi, %rdx
	movl	(%rax,%rdx,4), %eax
	leal	-1(%rax), %edx
	movq	-64(%rbp), %rax
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	testl	%eax, %eax
	jne	.L20
	movq	%rbx, %rcx
	shrq	$2, %rcx
	movq	-96(%rbp), %rax
	movl	-128(%rbp), %edx
	movslq	%edx, %rsi
	movl	-132(%rbp), %edx
	movslq	%edx, %rdx
	imulq	%rcx, %rdx
	addq	%rsi, %rdx
	movl	(%rax,%rdx,4), %eax
	subl	$1, %eax
	movq	-80(%rbp), %rdx
	movslq	%eax, %rcx
	movl	(%rdx,%rcx,4), %edx
	leal	1(%rdx), %ecx
	movq	-80(%rbp), %rdx
	cltq
	movl	%ecx, (%rdx,%rax,4)
	jmp	.L21
.L20:
	addl	$1, -128(%rbp)
.L19:
	movl	-156(%rbp), %eax
	cmpl	%eax, -128(%rbp)
	jl	.L22
.L21:
	addl	$1, -132(%rbp)
.L18:
	movl	-160(%rbp), %eax
	cmpl	%eax, -132(%rbp)
	jl	.L23
	movl	$0, -124(%rbp)
	movl	$0, -120(%rbp)
	jmp	.L24
.L26:
	movq	-64(%rbp), %rax
	movl	-120(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	testl	%eax, %eax
	jne	.L25
	movq	-80(%rbp), %rax
	movl	-120(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %ecx
	movq	-80(%rbp), %rax
	movl	-124(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	cmpl	%eax, %ecx
	jl	.L25
	movl	-120(%rbp), %eax
	movl	%eax, -124(%rbp)
.L25:
	addl	$1, -120(%rbp)
.L24:
	movl	-156(%rbp), %eax
	cmpl	%eax, -120(%rbp)
	jl	.L26
	movq	-80(%rbp), %rax
	movl	-124(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	cmpl	%eax, -140(%rbp)
	jle	.L27
	movq	-80(%rbp), %rax
	movl	-124(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	movl	%eax, -140(%rbp)
.L27:
	movq	-64(%rbp), %rax
	movl	-124(%rbp), %edx
	movslq	%edx, %rdx
	movl	$1, (%rax,%rdx,4)
	movl	$0, -116(%rbp)
	jmp	.L28
.L29:
	movq	-80(%rbp), %rax
	movl	-116(%rbp), %edx
	movslq	%edx, %rdx
	movl	$0, (%rax,%rdx,4)
	addl	$1, -116(%rbp)
.L28:
	movl	-156(%rbp), %eax
	cmpl	%eax, -116(%rbp)
	jl	.L29
	addl	$1, -136(%rbp)
.L17:
	movl	-156(%rbp), %eax
	cmpl	%eax, -136(%rbp)
	jl	.L30
	movl	-140(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-280(%rbp), %rsp
	movq	-56(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L32
	call	__stack_chk_fail@PLT
.L32:
	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"
	.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	$248, %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, -280(%rbp)
	leaq	-156(%rbp), %rdx
	leaq	-160(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-156(%rbp), %esi
	movl	-160(%rbp), %edi
	movslq	%esi, %rax
	subq	$1, %rax
	movq	%rax, -112(%rbp)
	movslq	%esi, %rax
	movq	%rax, -208(%rbp)
	movq	$0, -200(%rbp)
	movslq	%esi, %rax
	leaq	0(,%rax,4), %rbx
	movslq	%edi, %rax
	subq	$1, %rax
	movq	%rax, -104(%rbp)
	movslq	%esi, %rax
	movq	%rax, %r14
	movl	$0, %r15d
	movslq	%edi, %rax
	movq	%rax, %r12
	movl	$0, %r13d
	movq	%r15, %rdx
	imulq	%r12, %rdx
	movq	%r13, %rax
	imulq	%r14, %rax
	leaq	(%rdx,%rax), %rcx
	movq	%r14, %rax
	mulq	%r12
	addq	%rdx, %rcx
	movq	%rcx, %rdx
	movslq	%esi, %rax
	movq	%rax, -176(%rbp)
	movq	$0, -168(%rbp)
	movslq	%edi, %rax
	movq	%rax, -192(%rbp)
	movq	$0, -184(%rbp)
	movq	-176(%rbp), %r8
	movq	-168(%rbp), %r9
	movq	%r9, %rdx
	movq	-192(%rbp), %r10
	movq	-184(%rbp), %r11
	imulq	%r10, %rdx
	movq	%r11, %rax
	imulq	%r8, %rax
	leaq	(%rdx,%rax), %rcx
	movq	%r8, %rax
	mulq	%r10
	addq	%rdx, %rcx
	movq	%rcx, %rdx
	movslq	%esi, %rdx
	movslq	%edi, %rax
	imulq	%rdx, %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
.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, -96(%rbp)
	movl	$0, -152(%rbp)
	jmp	.L5
.L8:
	movl	$0, -148(%rbp)
	jmp	.L6
.L7:
	movq	%rbx, %rdx
	shrq	$2, %rdx
	movl	-148(%rbp), %eax
	movslq	%eax, %rcx
	movl	-152(%rbp), %eax
	cltq
	imulq	%rdx, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	movq	-96(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -148(%rbp)
.L6:
	movl	-156(%rbp), %eax
	cmpl	%eax, -148(%rbp)
	jl	.L7
	addl	$1, -152(%rbp)
.L5:
	movl	-160(%rbp), %eax
	cmpl	%eax, -152(%rbp)
	jl	.L8
	movl	-156(%rbp), %eax
	movslq	%eax, %rdx
	subq	$1, %rdx
	movq	%rdx, -88(%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, %edi
	movl	$0, %edx
	divq	%rdi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L9:
	cmpq	%rdx, %rsp
	je	.L10
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L9
.L10:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L11
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L11:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -80(%rbp)
	movl	-156(%rbp), %eax
	movslq	%eax, %rdx
	subq	$1, %rdx
	movq	%rdx, -72(%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
.L12:
	cmpq	%rdx, %rsp
	je	.L13
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L12
.L13:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L14
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L14:
	movq	%rsp, %rax
	addq	$3, %rax
	shrq	$2, %rax
	salq	$2, %rax
	movq	%rax, -64(%rbp)
	movl	$0, -144(%rbp)
	jmp	.L15
.L16:
	movq	-80(%rbp), %rax
	movl	-144(%rbp), %edx
	movslq	%edx, %rdx
	movl	$0, (%rax,%rdx,4)
	movq	-64(%rbp), %rax
	movl	-144(%rbp), %edx
	movslq	%edx, %rdx
	movl	$0, (%rax,%rdx,4)
	addl	$1, -144(%rbp)
.L15:
	movl	-156(%rbp), %eax
	cmpl	%eax, -144(%rbp)
	jl	.L16
	movl	$114514, -140(%rbp)
	movl	$0, -136(%rbp)
	jmp	.L17
.L30:
	movl	$0, -132(%rbp)
	jmp	.L18
.L23:
	movl	$0, -128(%rbp)
	jmp	.L19
.L22:
	movq	%rbx, %rcx
	shrq	$2, %rcx
	movq	-96(%rbp), %rax
	movl	-128(%rbp), %edx
	movslq	%edx, %rsi
	movl	-132(%rbp), %edx
	movslq	%edx, %rdx
	imulq	%rcx, %rdx
	addq	%rsi, %rdx
	movl	(%rax,%rdx,4), %eax
	leal	-1(%rax), %edx
	movq	-64(%rbp), %rax
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	testl	%eax, %eax
	jne	.L20
	movq	%rbx, %rcx
	shrq	$2, %rcx
	movq	-96(%rbp), %rax
	movl	-128(%rbp), %edx
	movslq	%edx, %rsi
	movl	-132(%rbp), %edx
	movslq	%edx, %rdx
	imulq	%rcx, %rdx
	addq	%rsi, %rdx
	movl	(%rax,%rdx,4), %eax
	subl	$1, %eax
	movq	-80(%rbp), %rdx
	movslq	%eax, %rcx
	movl	(%rdx,%rcx,4), %edx
	leal	1(%rdx), %ecx
	movq	-80(%rbp), %rdx
	cltq
	movl	%ecx, (%rdx,%rax,4)
	jmp	.L21
.L20:
	addl	$1, -128(%rbp)
.L19:
	movl	-156(%rbp), %eax
	cmpl	%eax, -128(%rbp)
	jl	.L22
.L21:
	addl	$1, -132(%rbp)
.L18:
	movl	-160(%rbp), %eax
	cmpl	%eax, -132(%rbp)
	jl	.L23
	movl	$0, -124(%rbp)
	movl	$0, -120(%rbp)
	jmp	.L24
.L26:
	movq	-64(%rbp), %rax
	movl	-120(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	testl	%eax, %eax
	jne	.L25
	movq	-80(%rbp), %rax
	movl	-120(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %ecx
	movq	-80(%rbp), %rax
	movl	-124(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	cmpl	%eax, %ecx
	jl	.L25
	movl	-120(%rbp), %eax
	movl	%eax, -124(%rbp)
.L25:
	addl	$1, -120(%rbp)
.L24:
	movl	-156(%rbp), %eax
	cmpl	%eax, -120(%rbp)
	jl	.L26
	movq	-80(%rbp), %rax
	movl	-124(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	cmpl	%eax, -140(%rbp)
	jle	.L27
	movq	-80(%rbp), %rax
	movl	-124(%rbp), %edx
	movslq	%edx, %rdx
	movl	(%rax,%rdx,4), %eax
	movl	%eax, -140(%rbp)
.L27:
	movq	-64(%rbp), %rax
	movl	-124(%rbp), %edx
	movslq	%edx, %rdx
	movl	$1, (%rax,%rdx,4)
	movl	$0, -116(%rbp)
	jmp	.L28
.L29:
	movq	-80(%rbp), %rax
	movl	-116(%rbp), %edx
	movslq	%edx, %rdx
	movl	$0, (%rax,%rdx,4)
	addl	$1, -116(%rbp)
.L28:
	movl	-156(%rbp), %eax
	cmpl	%eax, -116(%rbp)
	jl	.L29
	addl	$1, -136(%rbp)
.L17:
	movl	-156(%rbp), %eax
	cmpl	%eax, -136(%rbp)
	jl	.L30
	movl	-140(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-280(%rbp), %rsp
	movq	-56(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L32
	call	__stack_chk_fail@PLT
.L32:
	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:
