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

```c
// AOJ 0638 Kingdom of JOIOI
// 2018.1.7 bal4u

#include <stdio.h>

#define INF 1000000001

int H, W;
int a[2002][2002];
int min, max;

//#define getchar_unlocked()  getchar()
int in()
{
	int n = 0;
	int c = getchar_unlocked();
	do n = (n<<3)+(n<<1) + (c & 0xf), c = getchar_unlocked();
	while (c >= '0');
	return n;
}

int check(int x)
{
	int r, c;
	int f = 0;
	for (r = 0; r < H; r++) {
		for (c = 0; c < W; c++) {
			if (a[r][c] < max - x) if (f < c+1) f = c+1;
		}
		for (c = 0; c < W; c++) {
			if (a[r][c] > min + x) if (c < f) return 0;
		}
	}
	return 1;
}

void flip_row()
{
	int r, c, t, h2;
	h2 = H >> 1;
	for (r = 0; r < h2; r++) for (c = 0; c < W; c++) {
		t = a[r][c], a[r][c] = a[H-1-r][c], a[H-1-r][c] = t;
	}
}

void flip_col()
{
	int r, c, t, w2;
	w2 = W >> 1;
	for (r = 0; r < H; r++) for (c = 0; c < w2; c++) {
		t = a[r][c], a[r][c] = a[r][W-1-c], a[r][W-1-c] = t;
	}
}

int solve()
{
	int lo, hi, mi;
	
	lo = 0, hi = max - min;
	while (hi-lo > 1) {
		mi = (lo + hi) >> 1;
		if (check(mi)) hi = mi; else lo = mi;
	}
	return hi;
}

int main()
{
	int r, c, v, t, ans;

	H = in(), W = in();
	min = INF, max = 0;
	for (r = 0; r < H; r++) for (c = 0; c < W; c++) {
		a[r][c] = v = in();
		if (min > v) min = v;
		if (max < v) max = v;
	}
	ans = solve();
	flip_row();	t = solve(); if (t < ans) ans = t;
	flip_col();	t = solve(); if (t < ans) ans = t;
	flip_row();	t = solve(); if (t < ans) ans = t;
	printf("%d\n", ans);
	return 0;
}

```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	H
	.bss
	.align 4
	.type	H, @object
	.size	H, 4
H:
	.zero	4
	.globl	W
	.align 4
	.type	W, @object
	.size	W, 4
W:
	.zero	4
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 16032016
a:
	.zero	16032016
	.globl	min
	.align 4
	.type	min, @object
	.size	min, 4
min:
	.zero	4
	.globl	max
	.align 4
	.type	max, @object
	.size	max, 4
max:
	.zero	4
	.text
	.globl	in
	.type	in, @function
in:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movl	$0, -8(%rbp)
	call	getchar_unlocked@PLT
	movl	%eax, -4(%rbp)
.L2:
	movl	-8(%rbp), %eax
	leal	0(,%rax,8), %edx
	movl	-8(%rbp), %eax
	addl	%eax, %eax
	addl	%eax, %edx
	movl	-4(%rbp), %eax
	andl	$15, %eax
	addl	%edx, %eax
	movl	%eax, -8(%rbp)
	call	getchar_unlocked@PLT
	movl	%eax, -4(%rbp)
	cmpl	$47, -4(%rbp)
	jg	.L2
	movl	-8(%rbp), %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	in, .-in
	.globl	check
	.type	check, @function
check:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -20(%rbp)
	movl	$0, -4(%rbp)
	movl	$0, -12(%rbp)
	jmp	.L5
.L13:
	movl	$0, -8(%rbp)
	jmp	.L6
.L8:
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movl	-12(%rbp), %eax
	cltq
	imulq	$2002, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	max(%rip), %eax
	subl	-20(%rbp), %eax
	cmpl	%eax, %edx
	jge	.L7
	movl	-8(%rbp), %eax
	cmpl	-4(%rbp), %eax
	jl	.L7
	movl	-8(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -4(%rbp)
.L7:
	addl	$1, -8(%rbp)
.L6:
	movl	W(%rip), %eax
	cmpl	%eax, -8(%rbp)
	jl	.L8
	movl	$0, -8(%rbp)
	jmp	.L9
.L12:
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movl	-12(%rbp), %eax
	cltq
	imulq	$2002, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	min(%rip), %ecx
	movl	-20(%rbp), %edx
	addl	%ecx, %edx
	cmpl	%edx, %eax
	jle	.L10
	movl	-8(%rbp), %eax
	cmpl	-4(%rbp), %eax
	jge	.L10
	movl	$0, %eax
	jmp	.L11
.L10:
	addl	$1, -8(%rbp)
.L9:
	movl	W(%rip), %eax
	cmpl	%eax, -8(%rbp)
	jl	.L12
	addl	$1, -12(%rbp)
.L5:
	movl	H(%rip), %eax
	cmpl	%eax, -12(%rbp)
	jl	.L13
	movl	$1, %eax
.L11:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	check, .-check
	.globl	flip_row
	.type	flip_row, @function
flip_row:
.LFB2:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	H(%rip), %eax
	sarl	%eax
	movl	%eax, -8(%rbp)
	movl	$0, -16(%rbp)
	jmp	.L15
.L18:
	movl	$0, -12(%rbp)
	jmp	.L16
.L17:
	movl	-12(%rbp), %eax
	movslq	%eax, %rdx
	movl	-16(%rbp), %eax
	cltq
	imulq	$2002, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -4(%rbp)
	movl	H(%rip), %eax
	subl	$1, %eax
	subl	-16(%rbp), %eax
	movl	-12(%rbp), %edx
	movslq	%edx, %rdx
	cltq
	imulq	$2002, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-12(%rbp), %edx
	movslq	%edx, %rcx
	movl	-16(%rbp), %edx
	movslq	%edx, %rdx
	imulq	$2002, %rdx, %rdx
	addq	%rcx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	a(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	H(%rip), %eax
	subl	$1, %eax
	subl	-16(%rbp), %eax
	movl	-12(%rbp), %edx
	movslq	%edx, %rdx
	cltq
	imulq	$2002, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rcx
	leaq	a(%rip), %rdx
	movl	-4(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	addl	$1, -12(%rbp)
.L16:
	movl	W(%rip), %eax
	cmpl	%eax, -12(%rbp)
	jl	.L17
	addl	$1, -16(%rbp)
.L15:
	movl	-16(%rbp), %eax
	cmpl	-8(%rbp), %eax
	jl	.L18
	nop
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	flip_row, .-flip_row
	.globl	flip_col
	.type	flip_col, @function
flip_col:
.LFB3:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	W(%rip), %eax
	sarl	%eax
	movl	%eax, -8(%rbp)
	movl	$0, -16(%rbp)
	jmp	.L20
.L23:
	movl	$0, -12(%rbp)
	jmp	.L21
.L22:
	movl	-12(%rbp), %eax
	movslq	%eax, %rdx
	movl	-16(%rbp), %eax
	cltq
	imulq	$2002, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -4(%rbp)
	movl	W(%rip), %eax
	subl	$1, %eax
	subl	-12(%rbp), %eax
	movslq	%eax, %rdx
	movl	-16(%rbp), %eax
	cltq
	imulq	$2002, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-12(%rbp), %edx
	movslq	%edx, %rcx
	movl	-16(%rbp), %edx
	movslq	%edx, %rdx
	imulq	$2002, %rdx, %rdx
	addq	%rcx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	a(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	W(%rip), %eax
	subl	$1, %eax
	subl	-12(%rbp), %eax
	movslq	%eax, %rdx
	movl	-16(%rbp), %eax
	cltq
	imulq	$2002, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rcx
	leaq	a(%rip), %rdx
	movl	-4(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	addl	$1, -12(%rbp)
.L21:
	movl	-12(%rbp), %eax
	cmpl	-8(%rbp), %eax
	jl	.L22
	addl	$1, -16(%rbp)
.L20:
	movl	H(%rip), %eax
	cmpl	%eax, -16(%rbp)
	jl	.L23
	nop
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE3:
	.size	flip_col, .-flip_col
	.globl	solve
	.type	solve, @function
solve:
.LFB4:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movl	$0, -12(%rbp)
	movl	max(%rip), %eax
	movl	min(%rip), %edx
	subl	%edx, %eax
	movl	%eax, -8(%rbp)
	jmp	.L25
.L27:
	movl	-12(%rbp), %edx
	movl	-8(%rbp), %eax
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, -4(%rbp)
	movl	-4(%rbp), %eax
	movl	%eax, %edi
	call	check
	testl	%eax, %eax
	je	.L26
	movl	-4(%rbp), %eax
	movl	%eax, -8(%rbp)
	jmp	.L25
.L26:
	movl	-4(%rbp), %eax
	movl	%eax, -12(%rbp)
.L25:
	movl	-8(%rbp), %eax
	subl	-12(%rbp), %eax
	cmpl	$1, %eax
	jg	.L27
	movl	-8(%rbp), %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE4:
	.size	solve, .-solve
	.section	.rodata
.LC0:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB5:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movl	$0, %eax
	call	in
	movl	%eax, H(%rip)
	movl	$0, %eax
	call	in
	movl	%eax, W(%rip)
	movl	$1000000001, min(%rip)
	movl	$0, max(%rip)
	movl	$0, -20(%rbp)
	jmp	.L30
.L35:
	movl	$0, -16(%rbp)
	jmp	.L31
.L34:
	movl	$0, %eax
	call	in
	movl	%eax, -4(%rbp)
	movl	-16(%rbp), %eax
	movslq	%eax, %rdx
	movl	-20(%rbp), %eax
	cltq
	imulq	$2002, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rcx
	leaq	a(%rip), %rdx
	movl	-4(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	min(%rip), %eax
	cmpl	%eax, -4(%rbp)
	jge	.L32
	movl	-4(%rbp), %eax
	movl	%eax, min(%rip)
.L32:
	movl	max(%rip), %eax
	cmpl	%eax, -4(%rbp)
	jle	.L33
	movl	-4(%rbp), %eax
	movl	%eax, max(%rip)
.L33:
	addl	$1, -16(%rbp)
.L31:
	movl	W(%rip), %eax
	cmpl	%eax, -16(%rbp)
	jl	.L34
	addl	$1, -20(%rbp)
.L30:
	movl	H(%rip), %eax
	cmpl	%eax, -20(%rbp)
	jl	.L35
	movl	$0, %eax
	call	solve
	movl	%eax, -12(%rbp)
	movl	$0, %eax
	call	flip_row
	movl	$0, %eax
	call	solve
	movl	%eax, -8(%rbp)
	movl	-8(%rbp), %eax
	cmpl	-12(%rbp), %eax
	jge	.L36
	movl	-8(%rbp), %eax
	movl	%eax, -12(%rbp)
.L36:
	movl	$0, %eax
	call	flip_col
	movl	$0, %eax
	call	solve
	movl	%eax, -8(%rbp)
	movl	-8(%rbp), %eax
	cmpl	-12(%rbp), %eax
	jge	.L37
	movl	-8(%rbp), %eax
	movl	%eax, -12(%rbp)
.L37:
	movl	$0, %eax
	call	flip_row
	movl	$0, %eax
	call	solve
	movl	%eax, -8(%rbp)
	movl	-8(%rbp), %eax
	cmpl	-12(%rbp), %eax
	jge	.L38
	movl	-8(%rbp), %eax
	movl	%eax, -12(%rbp)
.L38:
	movl	-12(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE5:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```

Only output the optimized assembly code. Do not include any other text. Do not write any comments in the assembly code. Wrap the assembly code in ```assembly``` tags.
user
	.file	"temp.c"
	.text
	.p2align 4
	.globl	in
	.type	in, @function
in:
.LFB23:
	.cfi_startproc
	endbr64
	movq	stdin(%rip), %rdi
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	movq	8(%rdi), %rax
	movq	16(%rdi), %rcx
	cmpq	%rcx, %rax
	jnb	.L11
	leaq	1(%rax), %rdx
	movq	%rdx, 8(%rdi)
	movzbl	(%rax), %eax
.L3:
	xorl	%r12d, %r12d
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L4:
	leaq	1(%rdx), %rax
	movq	%rax, 8(%rdi)
	movzbl	(%rdx), %eax
	cmpl	$47, %eax
	jle	.L1
.L5:
	movq	8(%rdi), %rdx
	movq	16(%rdi), %rcx
.L7:
	leal	(%r12,%r12,4), %esi
	andl	$15, %eax
	leal	(%rax,%rsi,2), %r12d
	cmpq	%rcx, %rdx
	jb	.L4
	call	__uflow@PLT
	cmpl	$47, %eax
	jle	.L1
	movq	stdin(%rip), %rdi
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L1:
	movl	%r12d, %eax
	popq	%r12
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L11:
	.cfi_restore_state
	call	__uflow@PLT
	movq	stdin(%rip), %rdi
	movq	8(%rdi), %rdx
	movq	16(%rdi), %rcx
	jmp	.L3
	.cfi_endproc
.LFE23:
	.size	in, .-in
	.p2align 4
	.globl	check
	.type	check, @function
check:
.LFB24:
	.cfi_startproc
	endbr64
	movl	H(%rip), %eax
	testl	%eax, %eax
	jle	.L22
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	leal	-1(%rax), %ebp
	movslq	W(%rip), %r10
	xorl	%edx, %edx
	imulq	$8008, %rbp, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	leaq	a(%rip), %r9
	movl	max(%rip), %ebx
	leaq	8008(%r9), %rax
	movq	%r10, %r11
	subl	%edi, %ebx
	addl	min(%rip), %edi
	addq	%rax, %rbp
.L14:
	movq	%r9, %rcx
	xorl	%eax, %eax
	testl	%r11d, %r11d
	jle	.L19
	.p2align 4,,10
	.p2align 3
.L16:
	cmpl	(%rcx), %ebx
	setg	%r8b
	cmpl	%eax, %edx
	setle	%sil
	addl	$1, %eax
	testb	%sil, %r8b
	cmovne	%eax, %edx
	addq	$4, %rcx
	cmpl	%eax, %r11d
	jne	.L16
	cmpl	%edi, (%r9)
	jle	.L28
	testl	%edx, %edx
	jg	.L27
.L28:
	movl	$1, %eax
	jmp	.L21
	.p2align 4,,10
	.p2align 3
.L18:
	cmpl	%edi, (%r9,%rax,4)
	setg	%sil
	cmpl	%eax, %edx
	setg	%cl
	addq	$1, %rax
	testb	%cl, %sil
	jne	.L27
.L21:
	cmpq	%rax, %r10
	jne	.L18
.L19:
	addq	$8008, %r9
	cmpq	%rbp, %r9
	jne	.L14
	movl	$1, %eax
	jmp	.L12
	.p2align 4,,10
	.p2align 3
.L27:
	xorl	%eax, %eax
.L12:
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
.L22:
	.cfi_restore 3
	.cfi_restore 6
	movl	$1, %eax
	ret
	.cfi_endproc
.LFE24:
	.size	check, .-check
	.p2align 4
	.globl	flip_row
	.type	flip_row, @function
flip_row:
.LFB25:
	.cfi_startproc
	endbr64
	movl	H(%rip), %eax
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	movl	%eax, %edi
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	sarl	%edi
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movl	%edi, -32(%rsp)
	testl	%edi, %edi
	jle	.L39
	movl	W(%rip), %r13d
	testl	%r13d, %r13d
	jle	.L39
	movslq	%eax, %rcx
	subl	$1, %eax
	leal	-1(%r13), %edi
	movl	%r13d, %r15d
	movl	%eax, -28(%rsp)
	movl	%r13d, %eax
	movl	$16, %r14d
	xorl	%r9d, %r9d
	andl	$3, %eax
	movl	%edi, -24(%rsp)
	movl	%r13d, %edi
	andl	$-4, %r15d
	shrl	$2, %edi
	movl	%eax, -20(%rsp)
	movl	%r13d, %eax
	xorl	%r8d, %r8d
	leal	-1(%rdi), %r11d
	salq	$2, %rax
	leaq	a(%rip), %rdx
	imulq	$2002, %rcx, %rdi
	movq	%rax, -16(%rsp)
	addq	$1, %r11
	subq	%rdx, %r14
	imulq	$8008, %rcx, %rsi
	salq	$4, %r11
	movq	%rdi, -40(%rsp)
	movq	%rdx, %rdi
	leaq	-8008(%rdx,%rsi), %rsi
	.p2align 4,,10
	.p2align 3
.L42:
	movl	-28(%rsp), %eax
	leaq	0(,%r9,4), %r10
	leaq	(%rsi,%r14), %rcx
	leaq	(%rdi,%r14), %rbx
	subl	%r8d, %eax
	cmpq	%rcx, %r10
	movq	%rsi, %r10
	setge	%cl
	subq	%rdx, %r10
	cmpq	%r10, %rbx
	setle	%r10b
	orb	%cl, %r10b
	je	.L52
	cmpl	$1, %r13d
	je	.L52
	cmpl	$2, -24(%rsp)
	jbe	.L53
	xorl	%ecx, %ecx
	.p2align 4,,10
	.p2align 3
.L44:
	movdqu	(%rdi,%rcx), %xmm0
	movdqu	(%rsi,%rcx), %xmm1
	movups	%xmm1, (%rdi,%rcx)
	movups	%xmm0, (%rsi,%rcx)
	addq	$16, %rcx
	cmpq	%r11, %rcx
	jne	.L44
	cmpl	%r15d, %r13d
	je	.L49
	movl	-20(%rsp), %ebx
	movl	%ebx, %r12d
	cmpl	$1, %ebx
	je	.L54
	movl	%r15d, %r10d
	movl	%r15d, %ecx
.L43:
	leaq	(%r10,%r9), %rbx
	leaq	(%rdx,%rbx,4), %rbp
	movq	-40(%rsp), %rbx
	subq	%r9, %rbx
	addq	%r10, %rbx
	leaq	-8008(%rdx,%rbx,4), %r10
	movq	0(%rbp), %rbx
	movq	(%r10), %xmm0
	movq	%xmm0, 0(%rbp)
	movq	%rbx, (%r10)
	movl	%r12d, %r10d
	andl	$-2, %r10d
	addl	%r10d, %ecx
	cmpl	%r10d, %r12d
	je	.L49
.L46:
	movslq	%r8d, %r10
	cltq
	movslq	%ecx, %rcx
	imulq	$2002, %r10, %r10
	imulq	$2002, %rax, %rax
	addq	%rcx, %r10
	addq	%rcx, %rax
	movl	(%rdx,%r10,4), %ebx
	movl	(%rdx,%rax,4), %ecx
	movl	%ecx, (%rdx,%r10,4)
	movl	%ebx, (%rdx,%rax,4)
.L49:
	addl	$1, %r8d
	addq	$8008, %rdi
	subq	$8008, %rsi
	addq	$2002, %r9
	cmpl	%r8d, -32(%rsp)
	jne	.L42
.L39:
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L52:
	.cfi_restore_state
	movq	-16(%rsp), %rax
	movq	%rsi, %rcx
	leaq	(%rax,%rdi), %rbx
	movq	%rdi, %rax
	.p2align 4,,10
	.p2align 3
.L48:
	movl	(%rcx), %ebp
	movl	(%rax), %r10d
	addq	$4, %rax
	addq	$4, %rcx
	movl	%ebp, -4(%rax)
	movl	%r10d, -4(%rcx)
	cmpq	%rax, %rbx
	jne	.L48
	jmp	.L49
.L53:
	movl	%r13d, %r12d
	xorl	%r10d, %r10d
	xorl	%ecx, %ecx
	jmp	.L43
.L54:
	movl	%r15d, %ecx
	jmp	.L46
	.cfi_endproc
.LFE25:
	.size	flip_row, .-flip_row
	.p2align 4
	.globl	flip_col
	.type	flip_col, @function
flip_col:
.LFB26:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movl	W(%rip), %eax
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	movl	%eax, %r13d
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	sarl	%r13d
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movl	H(%rip), %ebx
	movl	%ebx, -44(%rsp)
	testl	%ebx, %ebx
	jle	.L62
	testl	%r13d, %r13d
	jle	.L62
	movl	%r13d, %edx
	movslq	%eax, %r10
	movslq	%r13d, %r15
	movl	%r13d, %r14d
	shrl	$2, %edx
	leal	-1(%rax), %ebp
	negq	%r15
	salq	$2, %r10
	subl	$1, %edx
	salq	$2, %r15
	leal	-1(%r13), %ebx
	andl	$-4, %r14d
	leaq	1(%rdx), %rax
	movq	%r15, %rsi
	movl	%ebx, -24(%rsp)
	xorl	%r9d, %r9d
	salq	$4, %rax
	leaq	a(%rip), %rcx
	negq	%rsi
	xorl	%ebx, %ebx
	movq	%rax, -32(%rsp)
	movl	%r13d, %eax
	subq	%rcx, %rsi
	leaq	-16(%rcx,%r10), %r12
	andl	$3, %eax
	movq	%rsi, -40(%rsp)
	movq	%rcx, %r11
	movl	%eax, -20(%rsp)
	movl	%r13d, %eax
	salq	$2, %rax
	movq	%rax, -16(%rsp)
	.p2align 4,,10
	.p2align 3
.L65:
	movq	-40(%rsp), %rax
	leaq	(%rax,%r11), %rdx
	leaq	(%r15,%r10), %rax
	cmpq	%rax, %rdx
	leaq	0(,%rbx,4), %rax
	setle	%dl
	cmpq	%r10, %rax
	setge	%al
	orb	%dl, %al
	je	.L75
	cmpl	$1, %r13d
	je	.L75
	cmpl	$2, -24(%rsp)
	jbe	.L76
	movq	-32(%rsp), %rax
	movq	%r12, %rdx
	leaq	(%rax,%r11), %rsi
	movq	%r11, %rax
	.p2align 4,,10
	.p2align 3
.L67:
	movdqu	(%rdx), %xmm2
	movdqu	(%rax), %xmm0
	addq	$16, %rax
	subq	$16, %rdx
	pshufd	$27, %xmm2, %xmm1
	pshufd	$27, %xmm0, %xmm0
	movups	%xmm1, -16(%rax)
	movups	%xmm0, 16(%rdx)
	cmpq	%rsi, %rax
	jne	.L67
	cmpl	%r14d, %r13d
	je	.L72
	movl	-20(%rsp), %eax
	movl	%eax, %esi
	cmpl	$1, %eax
	je	.L77
	movl	%r14d, %eax
	movl	%r14d, %edi
.L66:
	leaq	(%rax,%rbx), %rdx
	negq	%rax
	leaq	-8(%r10,%rax,4), %rax
	leaq	(%rcx,%rdx,4), %rdx
	addq	%rcx, %rax
	movq	(%rdx), %xmm0
	movq	(%rax), %xmm1
	pshufd	$225, %xmm0, %xmm0
	pshufd	$225, %xmm1, %xmm1
	movq	%xmm1, (%rdx)
	movq	%xmm0, (%rax)
	movl	%esi, %eax
	andl	$-2, %eax
	addl	%eax, %edi
	cmpl	%eax, %esi
	je	.L72
.L69:
	movslq	%r9d, %rax
	movl	%ebp, %esi
	movslq	%edi, %rdx
	imulq	$2002, %rax, %rax
	subl	%edi, %esi
	movslq	%esi, %rsi
	addq	%rax, %rdx
	addq	%rsi, %rax
	movl	(%rcx,%rdx,4), %r8d
	movl	(%rcx,%rax,4), %esi
	movl	%esi, (%rcx,%rdx,4)
	movl	%r8d, (%rcx,%rax,4)
.L72:
	addl	$1, %r9d
	addq	$8008, %r10
	addq	$8008, %r11
	addq	$8008, %r12
	addq	$2002, %rbx
	cmpl	-44(%rsp), %r9d
	jne	.L65
.L62:
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L75:
	.cfi_restore_state
	movq	-16(%rsp), %rax
	leaq	12(%r12), %rdx
	leaq	(%rax,%r11), %rdi
	movq	%r11, %rax
	.p2align 4,,10
	.p2align 3
.L71:
	movl	(%rdx), %r8d
	movl	(%rax), %esi
	addq	$4, %rax
	subq	$4, %rdx
	movl	%r8d, -4(%rax)
	movl	%esi, 4(%rdx)
	cmpq	%rdi, %rax
	jne	.L71
	jmp	.L72
.L76:
	movl	%r13d, %esi
	xorl	%eax, %eax
	xorl	%edi, %edi
	jmp	.L66
.L77:
	movl	%r14d, %edi
	jmp	.L69
	.cfi_endproc
.LFE26:
	.size	flip_col, .-flip_col
	.p2align 4
	.globl	solve
	.type	solve, @function
solve:
.LFB27:
	.cfi_startproc
	endbr64
	movl	max(%rip), %eax
	movslq	W(%rip), %r11
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	movl	min(%rip), %r15d
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	xorl	%ebp, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movq	%r11, %rbx
	movl	%eax, -8(%rsp)
	subl	%r15d, %eax
	movl	%eax, %r13d
	movl	H(%rip), %eax
	leal	-1(%rax), %r14d
	movl	%eax, -4(%rsp)
	leaq	8008+a(%rip), %rax
	imulq	$8008, %r14, %r14
	addq	%rax, %r14
	.p2align 4,,10
	.p2align 3
.L112:
	movl	%r13d, %eax
	movl	%r13d, %r12d
	subl	%ebp, %eax
	cmpl	$1, %eax
	jle	.L85
	.p2align 4,,10
	.p2align 3
.L95:
	movl	-8(%rsp), %r10d
	movl	%r12d, %r13d
	movl	-4(%rsp), %eax
	xorl	%edx, %edx
	leal	0(%rbp,%r12), %r12d
	leaq	a(%rip), %r8
	sarl	%r12d
	subl	%r12d, %r10d
	leal	(%r15,%r12), %r9d
	testl	%eax, %eax
	jle	.L88
.L87:
	movq	%r8, %rcx
	xorl	%eax, %eax
	testl	%ebx, %ebx
	jle	.L94
	.p2align 4,,10
	.p2align 3
.L90:
	cmpl	(%rcx), %r10d
	setg	%dil
	cmpl	%eax, %edx
	setle	%sil
	addl	$1, %eax
	testb	%sil, %dil
	cmovne	%eax, %edx
	addq	$4, %rcx
	cmpl	%eax, %ebx
	jne	.L90
	cmpl	%r9d, (%r8)
	jle	.L104
	testl	%edx, %edx
	jg	.L103
.L104:
	movl	$1, %eax
	jmp	.L98
	.p2align 4,,10
	.p2align 3
.L92:
	cmpl	%r9d, (%r8,%rax,4)
	setg	%sil
	cmpl	%eax, %edx
	setg	%cl
	addq	$1, %rax
	testb	%cl, %sil
	jne	.L103
.L98:
	cmpq	%rax, %r11
	jne	.L92
.L94:
	addq	$8008, %r8
	cmpq	%r14, %r8
	jne	.L87
.L88:
	movl	%r12d, %eax
	subl	%ebp, %eax
	cmpl	$1, %eax
	jg	.L95
.L85:
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 48
	movl	%r12d, %eax
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L103:
	.cfi_restore_state
	movl	%r12d, %ebp
	jmp	.L112
	.cfi_endproc
.LFE27:
	.size	solve, .-solve
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB28:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	xorl	%eax, %eax
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	xorl	%ebp, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	leaq	a(%rip), %rbx
	subq	$8, %rsp
	.cfi_def_cfa_offset 48
	call	in
	movl	%eax, H(%rip)
	xorl	%eax, %eax
	call	in
	movl	H(%rip), %edx
	movl	$1000000001, min(%rip)
	movl	%eax, W(%rip)
	movl	$0, max(%rip)
	testl	%edx, %edx
	jle	.L120
	testl	%eax, %eax
	jle	.L120
	.p2align 4,,10
	.p2align 3
.L134:
	xorl	%r13d, %r13d
	.p2align 4,,10
	.p2align 3
.L131:
	movq	stdin(%rip), %rdi
	movq	8(%rdi), %rax
	movq	16(%rdi), %rcx
	cmpq	%rcx, %rax
	jnb	.L140
	leaq	1(%rax), %rdx
	movq	%rdx, 8(%rdi)
	movzbl	(%rax), %eax
.L122:
	xorl	%r12d, %r12d
	jmp	.L126
	.p2align 4,,10
	.p2align 3
.L123:
	leaq	1(%rdx), %rax
	movq	%rax, 8(%rdi)
	movzbl	(%rdx), %eax
	cmpl	$47, %eax
	jle	.L125
.L124:
	movq	8(%rdi), %rdx
	movq	16(%rdi), %rcx
.L126:
	leal	(%r12,%r12,4), %esi
	andl	$15, %eax
	leal	(%rax,%rsi,2), %r12d
	cmpq	%rcx, %rdx
	jb	.L123
	call	__uflow@PLT
	cmpl	$47, %eax
	jle	.L125
	movq	stdin(%rip), %rdi
	jmp	.L124
	.p2align 4,,10
	.p2align 3
.L125:
	cmpl	%r12d, min(%rip)
	movl	%r12d, (%rbx,%r13,4)
	jle	.L127
	movl	%r12d, min(%rip)
.L127:
	cmpl	%r12d, max(%rip)
	jge	.L128
	movl	W(%rip), %eax
	addq	$1, %r13
	movl	%r12d, max(%rip)
	cmpl	%r13d, %eax
	jg	.L131
.L130:
	addl	$1, %ebp
	cmpl	%ebp, H(%rip)
	jle	.L120
	addq	$8008, %rbx
	testl	%eax, %eax
	jg	.L134
.L120:
	xorl	%eax, %eax
	call	solve
	movl	%eax, %ebx
	xorl	%eax, %eax
	call	flip_row
	xorl	%eax, %eax
	call	solve
	cmpl	%eax, %ebx
	cmovg	%eax, %ebx
	xorl	%eax, %eax
	call	flip_col
	xorl	%eax, %eax
	call	solve
	cmpl	%eax, %ebx
	cmovg	%eax, %ebx
	xorl	%eax, %eax
	call	flip_row
	xorl	%eax, %eax
	call	solve
	leaq	.LC0(%rip), %rsi
	movl	$1, %edi
	cmpl	%eax, %ebx
	cmovle	%ebx, %eax
	movl	%eax, %edx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L128:
	.cfi_restore_state
	movl	W(%rip), %eax
	addq	$1, %r13
	cmpl	%r13d, %eax
	jg	.L131
	jmp	.L130
	.p2align 4,,10
	.p2align 3
.L140:
	call	__uflow@PLT
	movq	stdin(%rip), %rdi
	movq	8(%rdi), %rdx
	movq	16(%rdi), %rcx
	jmp	.L122
	.cfi_endproc
.LFE28:
	.size	main, .-main
	.globl	max
	.bss
	.align 4
	.type	max, @object
	.size	max, 4
max:
	.zero	4
	.globl	min
	.align 4
	.type	min, @object
	.size	min, 4
min:
	.zero	4
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 16032016
a:
	.zero	16032016
	.globl	W
	.align 4
	.type	W, @object
	.size	W, 4
W:
	.zero	4
	.globl	H
	.align 4
	.type	H, @object
	.size	H, 4
H:
	.zero	4
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:

rule
	.file	"temp.c"
	.text
	.p2align 4
	.globl	in
	.type	in, @function
in:
.LFB23:
	.cfi_startproc
	endbr64
	movq	stdin(%rip), %rdi
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	movq	8(%rdi), %rax
	movq	16(%rdi), %rcx
	cmpq	%rcx, %rax
	jnb	.L11
	leaq	1(%rax), %rdx
	movq	%rdx, 8(%rdi)
	movzbl	(%rax), %eax
.L3:
	xorl	%r12d, %r12d
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L4:
	leaq	1(%rdx), %rax
	movq	%rax, 8(%rdi)
	movzbl	(%rdx), %eax
	cmpl	$47, %eax
	jle	.L1
.L5:
	movq	8(%rdi), %rdx
	movq	16(%rdi), %rcx
.L7:
	leal	(%r12,%r12,4), %esi
	andl	$15, %eax
	leal	(%rax,%rsi,2), %r12d
	cmpq	%rcx, %rdx
	jb	.L4
	call	__uflow@PLT
	cmpl	$47, %eax
	jle	.L1
	movq	stdin(%rip), %rdi
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L1:
	movl	%r12d, %eax
	popq	%r12
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L11:
	.cfi_restore_state
	call	__uflow@PLT
	movq	stdin(%rip), %rdi
	movq	8(%rdi), %rdx
	movq	16(%rdi), %rcx
	jmp	.L3
	.cfi_endproc
.LFE23:
	.size	in, .-in
	.p2align 4
	.globl	check
	.type	check, @function
check:
.LFB24:
	.cfi_startproc
	endbr64
	movl	H(%rip), %eax
	testl	%eax, %eax
	jle	.L22
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	leal	-1(%rax), %ebp
	movslq	W(%rip), %r10
	xorl	%edx, %edx
	imulq	$8008, %rbp, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	leaq	a(%rip), %r9
	movl	max(%rip), %ebx
	leaq	8008(%r9), %rax
	movq	%r10, %r11
	subl	%edi, %ebx
	addl	min(%rip), %edi
	addq	%rax, %rbp
.L14:
	movq	%r9, %rcx
	xorl	%eax, %eax
	testl	%r11d, %r11d
	jle	.L19
	.p2align 4,,10
	.p2align 3
.L16:
	cmpl	(%rcx), %ebx
	setg	%r8b
	cmpl	%eax, %edx
	setle	%sil
	addl	$1, %eax
	testb	%sil, %r8b
	cmovne	%eax, %edx
	addq	$4, %rcx
	cmpl	%eax, %r11d
	jne	.L16
	cmpl	%edi, (%r9)
	jle	.L28
	testl	%edx, %edx
	jg	.L27
.L28:
	movl	$1, %eax
	jmp	.L21
	.p2align 4,,10
	.p2align 3
.L18:
	cmpl	%edi, (%r9,%rax,4)
	setg	%sil
	cmpl	%eax, %edx
	setg	%cl
	addq	$1, %rax
	testb	%cl, %sil
	jne	.L27
.L21:
	cmpq	%rax, %r10
	jne	.L18
.L19:
	addq	$8008, %r9
	cmpq	%rbp, %r9
	jne	.L14
	movl	$1, %eax
	jmp	.L12
	.p2align 4,,10
	.p2align 3
.L27:
	xorl	%eax, %eax
.L12:
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
.L22:
	.cfi_restore 3
	.cfi_restore 6
	movl	$1, %eax
	ret
	.cfi_endproc
.LFE24:
	.size	check, .-check
	.p2align 4
	.globl	flip_row
	.type	flip_row, @function
flip_row:
.LFB25:
	.cfi_startproc
	endbr64
	movl	H(%rip), %eax
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	movl	%eax, %edi
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	sarl	%edi
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movl	%edi, -32(%rsp)
	testl	%edi, %edi
	jle	.L39
	movl	W(%rip), %r13d
	testl	%r13d, %r13d
	jle	.L39
	movslq	%eax, %rcx
	subl	$1, %eax
	leal	-1(%r13), %edi
	movl	%r13d, %r15d
	movl	%eax, -28(%rsp)
	movl	%r13d, %eax
	movl	$16, %r14d
	xorl	%r9d, %r9d
	andl	$3, %eax
	movl	%edi, -24(%rsp)
	movl	%r13d, %edi
	andl	$-4, %r15d
	shrl	$2, %edi
	movl	%eax, -20(%rsp)
	movl	%r13d, %eax
	xorl	%r8d, %r8d
	leal	-1(%rdi), %r11d
	salq	$2, %rax
	leaq	a(%rip), %rdx
	imulq	$2002, %rcx, %rdi
	movq	%rax, -16(%rsp)
	addq	$1, %r11
	subq	%rdx, %r14
	imulq	$8008, %rcx, %rsi
	salq	$4, %r11
	movq	%rdi, -40(%rsp)
	movq	%rdx, %rdi
	leaq	-8008(%rdx,%rsi), %rsi
	.p2align 4,,10
	.p2align 3
.L42:
	movl	-28(%rsp), %eax
	leaq	0(,%r9,4), %r10
	leaq	(%rsi,%r14), %rcx
	leaq	(%rdi,%r14), %rbx
	subl	%r8d, %eax
	cmpq	%rcx, %r10
	movq	%rsi, %r10
	setge	%cl
	subq	%rdx, %r10
	cmpq	%r10, %rbx
	setle	%r10b
	orb	%cl, %r10b
	je	.L52
	cmpl	$1, %r13d
	je	.L52
	cmpl	$2, -24(%rsp)
	jbe	.L53
	xorl	%ecx, %ecx
	.p2align 4,,10
	.p2align 3
.L44:
	movdqu	(%rdi,%rcx), %xmm0
	movdqu	(%rsi,%rcx), %xmm1
	movups	%xmm1, (%rdi,%rcx)
	movups	%xmm0, (%rsi,%rcx)
	addq	$16, %rcx
	cmpq	%r11, %rcx
	jne	.L44
	cmpl	%r15d, %r13d
	je	.L49
	movl	-20(%rsp), %ebx
	movl	%ebx, %r12d
	cmpl	$1, %ebx
	je	.L54
	movl	%r15d, %r10d
	movl	%r15d, %ecx
.L43:
	leaq	(%r10,%r9), %rbx
	leaq	(%rdx,%rbx,4), %rbp
	movq	-40(%rsp), %rbx
	subq	%r9, %rbx
	addq	%r10, %rbx
	leaq	-8008(%rdx,%rbx,4), %r10
	movq	0(%rbp), %rbx
	movq	(%r10), %xmm0
	movq	%xmm0, 0(%rbp)
	movq	%rbx, (%r10)
	movl	%r12d, %r10d
	andl	$-2, %r10d
	addl	%r10d, %ecx
	cmpl	%r10d, %r12d
	je	.L49
.L46:
	movslq	%r8d, %r10
	cltq
	movslq	%ecx, %rcx
	imulq	$2002, %r10, %r10
	imulq	$2002, %rax, %rax
	addq	%rcx, %r10
	addq	%rcx, %rax
	movl	(%rdx,%r10,4), %ebx
	movl	(%rdx,%rax,4), %ecx
	movl	%ecx, (%rdx,%r10,4)
	movl	%ebx, (%rdx,%rax,4)
.L49:
	addl	$1, %r8d
	addq	$8008, %rdi
	subq	$8008, %rsi
	addq	$2002, %r9
	cmpl	%r8d, -32(%rsp)
	jne	.L42
.L39:
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L52:
	.cfi_restore_state
	movq	-16(%rsp), %rax
	movq	%rsi, %rcx
	leaq	(%rax,%rdi), %rbx
	movq	%rdi, %rax
	.p2align 4,,10
	.p2align 3
.L48:
	movl	(%rcx), %ebp
	movl	(%rax), %r10d
	addq	$4, %rax
	addq	$4, %rcx
	movl	%ebp, -4(%rax)
	movl	%r10d, -4(%rcx)
	cmpq	%rax, %rbx
	jne	.L48
	jmp	.L49
.L53:
	movl	%r13d, %r12d
	xorl	%r10d, %r10d
	xorl	%ecx, %ecx
	jmp	.L43
.L54:
	movl	%r15d, %ecx
	jmp	.L46
	.cfi_endproc
.LFE25:
	.size	flip_row, .-flip_row
	.p2align 4
	.globl	flip_col
	.type	flip_col, @function
flip_col:
.LFB26:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movl	W(%rip), %eax
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	movl	%eax, %r13d
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	sarl	%r13d
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movl	H(%rip), %ebx
	movl	%ebx, -44(%rsp)
	testl	%ebx, %ebx
	jle	.L62
	testl	%r13d, %r13d
	jle	.L62
	movl	%r13d, %edx
	movslq	%eax, %r10
	movslq	%r13d, %r15
	movl	%r13d, %r14d
	shrl	$2, %edx
	leal	-1(%rax), %ebp
	negq	%r15
	salq	$2, %r10
	subl	$1, %edx
	salq	$2, %r15
	leal	-1(%r13), %ebx
	andl	$-4, %r14d
	leaq	1(%rdx), %rax
	movq	%r15, %rsi
	movl	%ebx, -24(%rsp)
	xorl	%r9d, %r9d
	salq	$4, %rax
	leaq	a(%rip), %rcx
	negq	%rsi
	xorl	%ebx, %ebx
	movq	%rax, -32(%rsp)
	movl	%r13d, %eax
	subq	%rcx, %rsi
	leaq	-16(%rcx,%r10), %r12
	andl	$3, %eax
	movq	%rsi, -40(%rsp)
	movq	%rcx, %r11
	movl	%eax, -20(%rsp)
	movl	%r13d, %eax
	salq	$2, %rax
	movq	%rax, -16(%rsp)
	.p2align 4,,10
	.p2align 3
.L65:
	movq	-40(%rsp), %rax
	leaq	(%rax,%r11), %rdx
	leaq	(%r15,%r10), %rax
	cmpq	%rax, %rdx
	leaq	0(,%rbx,4), %rax
	setle	%dl
	cmpq	%r10, %rax
	setge	%al
	orb	%dl, %al
	je	.L75
	cmpl	$1, %r13d
	je	.L75
	cmpl	$2, -24(%rsp)
	jbe	.L76
	movq	-32(%rsp), %rax
	movq	%r12, %rdx
	leaq	(%rax,%r11), %rsi
	movq	%r11, %rax
	.p2align 4,,10
	.p2align 3
.L67:
	movdqu	(%rdx), %xmm2
	movdqu	(%rax), %xmm0
	addq	$16, %rax
	subq	$16, %rdx
	pshufd	$27, %xmm2, %xmm1
	pshufd	$27, %xmm0, %xmm0
	movups	%xmm1, -16(%rax)
	movups	%xmm0, 16(%rdx)
	cmpq	%rsi, %rax
	jne	.L67
	cmpl	%r14d, %r13d
	je	.L72
	movl	-20(%rsp), %eax
	movl	%eax, %esi
	cmpl	$1, %eax
	je	.L77
	movl	%r14d, %eax
	movl	%r14d, %edi
.L66:
	leaq	(%rax,%rbx), %rdx
	negq	%rax
	leaq	-8(%r10,%rax,4), %rax
	leaq	(%rcx,%rdx,4), %rdx
	addq	%rcx, %rax
	movq	(%rdx), %xmm0
	movq	(%rax), %xmm1
	pshufd	$225, %xmm0, %xmm0
	pshufd	$225, %xmm1, %xmm1
	movq	%xmm1, (%rdx)
	movq	%xmm0, (%rax)
	movl	%esi, %eax
	andl	$-2, %eax
	addl	%eax, %edi
	cmpl	%eax, %esi
	je	.L72
.L69:
	movslq	%r9d, %rax
	movl	%ebp, %esi
	movslq	%edi, %rdx
	imulq	$2002, %rax, %rax
	subl	%edi, %esi
	movslq	%esi, %rsi
	addq	%rax, %rdx
	addq	%rsi, %rax
	movl	(%rcx,%rdx,4), %r8d
	movl	(%rcx,%rax,4), %esi
	movl	%esi, (%rcx,%rdx,4)
	movl	%r8d, (%rcx,%rax,4)
.L72:
	addl	$1, %r9d
	addq	$8008, %r10
	addq	$8008, %r11
	addq	$8008, %r12
	addq	$2002, %rbx
	cmpl	-44(%rsp), %r9d
	jne	.L65
.L62:
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L75:
	.cfi_restore_state
	movq	-16(%rsp), %rax
	leaq	12(%r12), %rdx
	leaq	(%rax,%r11), %rdi
	movq	%r11, %rax
	.p2align 4,,10
	.p2align 3
.L71:
	movl	(%rdx), %r8d
	movl	(%rax), %esi
	addq	$4, %rax
	subq	$4, %rdx
	movl	%r8d, -4(%rax)
	movl	%esi, 4(%rdx)
	cmpq	%rdi, %rax
	jne	.L71
	jmp	.L72
.L76:
	movl	%r13d, %esi
	xorl	%eax, %eax
	xorl	%edi, %edi
	jmp	.L66
.L77:
	movl	%r14d, %edi
	jmp	.L69
	.cfi_endproc
.LFE26:
	.size	flip_col, .-flip_col
	.p2align 4
	.globl	solve
	.type	solve, @function
solve:
.LFB27:
	.cfi_startproc
	endbr64
	movl	max(%rip), %eax
	movslq	W(%rip), %r11
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	movl	min(%rip), %r15d
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	xorl	%ebp, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movq	%r11, %rbx
	movl	%eax, -8(%rsp)
	subl	%r15d, %eax
	movl	%eax, %r13d
	movl	H(%rip), %eax
	leal	-1(%rax), %r14d
	movl	%eax, -4(%rsp)
	leaq	8008+a(%rip), %rax
	imulq	$8008, %r14, %r14
	addq	%rax, %r14
	.p2align 4,,10
	.p2align 3
.L112:
	movl	%r13d, %eax
	movl	%r13d, %r12d
	subl	%ebp, %eax
	cmpl	$1, %eax
	jle	.L85
	.p2align 4,,10
	.p2align 3
.L95:
	movl	-8(%rsp), %r10d
	movl	%r12d, %r13d
	movl	-4(%rsp), %eax
	xorl	%edx, %edx
	leal	0(%rbp,%r12), %r12d
	leaq	a(%rip), %r8
	sarl	%r12d
	subl	%r12d, %r10d
	leal	(%r15,%r12), %r9d
	testl	%eax, %eax
	jle	.L88
.L87:
	movq	%r8, %rcx
	xorl	%eax, %eax
	testl	%ebx, %ebx
	jle	.L94
	.p2align 4,,10
	.p2align 3
.L90:
	cmpl	(%rcx), %r10d
	setg	%dil
	cmpl	%eax, %edx
	setle	%sil
	addl	$1, %eax
	testb	%sil, %dil
	cmovne	%eax, %edx
	addq	$4, %rcx
	cmpl	%eax, %ebx
	jne	.L90
	cmpl	%r9d, (%r8)
	jle	.L104
	testl	%edx, %edx
	jg	.L103
.L104:
	movl	$1, %eax
	jmp	.L98
	.p2align 4,,10
	.p2align 3
.L92:
	cmpl	%r9d, (%r8,%rax,4)
	setg	%sil
	cmpl	%eax, %edx
	setg	%cl
	addq	$1, %rax
	testb	%cl, %sil
	jne	.L103
.L98:
	cmpq	%rax, %r11
	jne	.L92
.L94:
	addq	$8008, %r8
	cmpq	%r14, %r8
	jne	.L87
.L88:
	movl	%r12d, %eax
	subl	%ebp, %eax
	cmpl	$1, %eax
	jg	.L95
.L85:
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 48
	movl	%r12d, %eax
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L103:
	.cfi_restore_state
	movl	%r12d, %ebp
	jmp	.L112
	.cfi_endproc
.LFE27:
	.size	solve, .-solve
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB28:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	xorl	%eax, %eax
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	xorl	%ebp, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	leaq	a(%rip), %rbx
	subq	$8, %rsp
	.cfi_def_cfa_offset 48
	call	in
	movl	%eax, H(%rip)
	xorl	%eax, %eax
	call	in
	movl	H(%rip), %edx
	movl	$1000000001, min(%rip)
	movl	%eax, W(%rip)
	movl	$0, max(%rip)
	testl	%edx, %edx
	jle	.L120
	testl	%eax, %eax
	jle	.L120
	.p2align 4,,10
	.p2align 3
.L134:
	xorl	%r13d, %r13d
	.p2align 4,,10
	.p2align 3
.L131:
	movq	stdin(%rip), %rdi
	movq	8(%rdi), %rax
	movq	16(%rdi), %rcx
	cmpq	%rcx, %rax
	jnb	.L140
	leaq	1(%rax), %rdx
	movq	%rdx, 8(%rdi)
	movzbl	(%rax), %eax
.L122:
	xorl	%r12d, %r12d
	jmp	.L126
	.p2align 4,,10
	.p2align 3
.L123:
	leaq	1(%rdx), %rax
	movq	%rax, 8(%rdi)
	movzbl	(%rdx), %eax
	cmpl	$47, %eax
	jle	.L125
.L124:
	movq	8(%rdi), %rdx
	movq	16(%rdi), %rcx
.L126:
	leal	(%r12,%r12,4), %esi
	andl	$15, %eax
	leal	(%rax,%rsi,2), %r12d
	cmpq	%rcx, %rdx
	jb	.L123
	call	__uflow@PLT
	cmpl	$47, %eax
	jle	.L125
	movq	stdin(%rip), %rdi
	jmp	.L124
	.p2align 4,,10
	.p2align 3
.L125:
	cmpl	%r12d, min(%rip)
	movl	%r12d, (%rbx,%r13,4)
	jle	.L127
	movl	%r12d, min(%rip)
.L127:
	cmpl	%r12d, max(%rip)
	jge	.L128
	movl	W(%rip), %eax
	addq	$1, %r13
	movl	%r12d, max(%rip)
	cmpl	%r13d, %eax
	jg	.L131
.L130:
	addl	$1, %ebp
	cmpl	%ebp, H(%rip)
	jle	.L120
	addq	$8008, %rbx
	testl	%eax, %eax
	jg	.L134
.L120:
	xorl	%eax, %eax
	call	solve
	movl	%eax, %ebx
	xorl	%eax, %eax
	call	flip_row
	xorl	%eax, %eax
	call	solve
	cmpl	%eax, %ebx
	cmovg	%eax, %ebx
	xorl	%eax, %eax
	call	flip_col
	xorl	%eax, %eax
	call	solve
	cmpl	%eax, %ebx
	cmovg	%eax, %ebx
	xorl	%eax, %eax
	call	flip_row
	xorl	%eax, %eax
	call	solve
	leaq	.LC0(%rip), %rsi
	movl	$1, %edi
	cmpl	%eax, %ebx
	cmovle	%ebx, %eax
	movl	%eax, %edx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L128:
	.cfi_restore_state
	movl	W(%rip), %eax
	addq	$1, %r13
	cmpl	%r13d, %eax
	jg	.L131
	jmp	.L130
	.p2align 4,,10
	.p2align 3
.L140:
	call	__uflow@PLT
	movq	stdin(%rip), %rdi
	movq	8(%rdi), %rdx
	movq	16(%rdi), %rcx
	jmp	.L122
	.cfi_endproc
.LFE28:
	.size	main, .-main
	.globl	max
	.bss
	.align 4
	.type	max, @object
	.size	max, 4
max:
	.zero	4
	.globl	min
	.align 4
	.type	min, @object
	.size	min, 4
min:
	.zero	4
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 16032016
a:
	.zero	16032016
	.globl	W
	.align 4
	.type	W, @object
	.size	W, 4
W:
	.zero	4
	.globl	H
	.align 4
	.type	H, @object
	.size	H, 4
H:
	.zero	4
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:

// AOJ 0638 Kingdom of JOIOI
// 2018.1.7 bal4u

#include <stdio.h>

#define INF 1000000001

int H, W;
int a[2002][2002];
int min, max;

//#define getchar_unlocked()  getchar()
int in()
{
	int n = 0;
	int c = getchar_unlocked();
	do n = (n<<3)+(n<<1) + (c & 0xf), c = getchar_unlocked();
	while (c >= '0');
	return n;
}

int check(int x)
{
	int r, c;
	int f = 0;
	for (r = 0; r < H; r++) {
		for (c = 0; c < W; c++) {
			if (a[r][c] < max - x) if (f < c+1) f = c+1;
		}
		for (c = 0; c < W; c++) {
			if (a[r][c] > min + x) if (c < f) return 0;
		}
	}
	return 1;
}

void flip_row()
{
	int r, c, t, h2;
	h2 = H >> 1;
	for (r = 0; r < h2; r++) for (c = 0; c < W; c++) {
		t = a[r][c], a[r][c] = a[H-1-r][c], a[H-1-r][c] = t;
	}
}

void flip_col()
{
	int r, c, t, w2;
	w2 = W >> 1;
	for (r = 0; r < H; r++) for (c = 0; c < w2; c++) {
		t = a[r][c], a[r][c] = a[r][W-1-c], a[r][W-1-c] = t;
	}
}

int solve()
{
	int lo, hi, mi;
	
	lo = 0, hi = max - min;
	while (hi-lo > 1) {
		mi = (lo + hi) >> 1;
		if (check(mi)) hi = mi; else lo = mi;
	}
	return hi;
}

int main()
{
	int r, c, v, t, ans;

	H = in(), W = in();
	min = INF, max = 0;
	for (r = 0; r < H; r++) for (c = 0; c < W; c++) {
		a[r][c] = v = in();
		if (min > v) min = v;
		if (max < v) max = v;
	}
	ans = solve();
	flip_row();	t = solve(); if (t < ans) ans = t;
	flip_col();	t = solve(); if (t < ans) ans = t;
	flip_row();	t = solve(); if (t < ans) ans = t;
	printf("%d\n", ans);
	return 0;
}


4 4
1 12 6 11
11 10 1 14
10 1 9 20
4 17 19 10
 1 4
1 12 6 6
11 10 1 14
10 1 9 20
4 17 19 10
 4 4
1 12 7 11
11 10 2 0
10 1 9 20
4 17 19 10
 2 4
1 12 6 14
5 10 1 14
10 1 5 20
4 17 19 10
 1 4
1 12 6 2
11 10 1 14
10 1 9 20
4 25 19 10
 1 4
1 12 6 14
5 10 1 14
10 1 5 20
4 17 19 10
 1 4
1 20 6 14
5 10 1 14
10 1 5 20
4 17 19 10
 1 4
2 14 7 11
11 10 2 1
10 1 9 20
7 12 19 2
 4 4
1 12 6 14
11 17 1 14
10 1 9 20
4 17 19 10
 1 4
2 3 6 2
11 6 1 14
10 1 9 27
4 48 19 10

11
 6
 12
 9
 10
 8
 14
 7
 16
 4

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

```c
// AOJ 0638 Kingdom of JOIOI
// 2018.1.7 bal4u

#include <stdio.h>

#define INF 1000000001

int H, W;
int a[2002][2002];
int min, max;

//#define getchar_unlocked()  getchar()
int in()
{
	int n = 0;
	int c = getchar_unlocked();
	do n = (n<<3)+(n<<1) + (c & 0xf), c = getchar_unlocked();
	while (c >= '0');
	return n;
}

int check(int x)
{
	int r, c;
	int f = 0;
	for (r = 0; r < H; r++) {
		for (c = 0; c < W; c++) {
			if (a[r][c] < max - x) if (f < c+1) f = c+1;
		}
		for (c = 0; c < W; c++) {
			if (a[r][c] > min + x) if (c < f) return 0;
		}
	}
	return 1;
}

void flip_row()
{
	int r, c, t, h2;
	h2 = H >> 1;
	for (r = 0; r < h2; r++) for (c = 0; c < W; c++) {
		t = a[r][c], a[r][c] = a[H-1-r][c], a[H-1-r][c] = t;
	}
}

void flip_col()
{
	int r, c, t, w2;
	w2 = W >> 1;
	for (r = 0; r < H; r++) for (c = 0; c < w2; c++) {
		t = a[r][c], a[r][c] = a[r][W-1-c], a[r][W-1-c] = t;
	}
}

int solve()
{
	int lo, hi, mi;
	
	lo = 0, hi = max - min;
	while (hi-lo > 1) {
		mi = (lo + hi) >> 1;
		if (check(mi)) hi = mi; else lo = mi;
	}
	return hi;
}

int main()
{
	int r, c, v, t, ans;

	H = in(), W = in();
	min = INF, max = 0;
	for (r = 0; r < H; r++) for (c = 0; c < W; c++) {
		a[r][c] = v = in();
		if (min > v) min = v;
		if (max < v) max = v;
	}
	ans = solve();
	flip_row();	t = solve(); if (t < ans) ans = t;
	flip_col();	t = solve(); if (t < ans) ans = t;
	flip_row();	t = solve(); if (t < ans) ans = t;
	printf("%d\n", ans);
	return 0;
}

```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	H
	.bss
	.align 4
	.type	H, @object
	.size	H, 4
H:
	.zero	4
	.globl	W
	.align 4
	.type	W, @object
	.size	W, 4
W:
	.zero	4
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 16032016
a:
	.zero	16032016
	.globl	min
	.align 4
	.type	min, @object
	.size	min, 4
min:
	.zero	4
	.globl	max
	.align 4
	.type	max, @object
	.size	max, 4
max:
	.zero	4
	.text
	.globl	in
	.type	in, @function
in:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movl	$0, -8(%rbp)
	call	getchar_unlocked@PLT
	movl	%eax, -4(%rbp)
.L2:
	movl	-8(%rbp), %eax
	leal	0(,%rax,8), %edx
	movl	-8(%rbp), %eax
	addl	%eax, %eax
	addl	%eax, %edx
	movl	-4(%rbp), %eax
	andl	$15, %eax
	addl	%edx, %eax
	movl	%eax, -8(%rbp)
	call	getchar_unlocked@PLT
	movl	%eax, -4(%rbp)
	cmpl	$47, -4(%rbp)
	jg	.L2
	movl	-8(%rbp), %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	in, .-in
	.globl	check
	.type	check, @function
check:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -20(%rbp)
	movl	$0, -4(%rbp)
	movl	$0, -12(%rbp)
	jmp	.L5
.L13:
	movl	$0, -8(%rbp)
	jmp	.L6
.L8:
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movl	-12(%rbp), %eax
	cltq
	imulq	$2002, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	max(%rip), %eax
	subl	-20(%rbp), %eax
	cmpl	%eax, %edx
	jge	.L7
	movl	-8(%rbp), %eax
	cmpl	-4(%rbp), %eax
	jl	.L7
	movl	-8(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -4(%rbp)
.L7:
	addl	$1, -8(%rbp)
.L6:
	movl	W(%rip), %eax
	cmpl	%eax, -8(%rbp)
	jl	.L8
	movl	$0, -8(%rbp)
	jmp	.L9
.L12:
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movl	-12(%rbp), %eax
	cltq
	imulq	$2002, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	min(%rip), %ecx
	movl	-20(%rbp), %edx
	addl	%ecx, %edx
	cmpl	%edx, %eax
	jle	.L10
	movl	-8(%rbp), %eax
	cmpl	-4(%rbp), %eax
	jge	.L10
	movl	$0, %eax
	jmp	.L11
.L10:
	addl	$1, -8(%rbp)
.L9:
	movl	W(%rip), %eax
	cmpl	%eax, -8(%rbp)
	jl	.L12
	addl	$1, -12(%rbp)
.L5:
	movl	H(%rip), %eax
	cmpl	%eax, -12(%rbp)
	jl	.L13
	movl	$1, %eax
.L11:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	check, .-check
	.globl	flip_row
	.type	flip_row, @function
flip_row:
.LFB2:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	H(%rip), %eax
	sarl	%eax
	movl	%eax, -8(%rbp)
	movl	$0, -16(%rbp)
	jmp	.L15
.L18:
	movl	$0, -12(%rbp)
	jmp	.L16
.L17:
	movl	-12(%rbp), %eax
	movslq	%eax, %rdx
	movl	-16(%rbp), %eax
	cltq
	imulq	$2002, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -4(%rbp)
	movl	H(%rip), %eax
	subl	$1, %eax
	subl	-16(%rbp), %eax
	movl	-12(%rbp), %edx
	movslq	%edx, %rdx
	cltq
	imulq	$2002, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-12(%rbp), %edx
	movslq	%edx, %rcx
	movl	-16(%rbp), %edx
	movslq	%edx, %rdx
	imulq	$2002, %rdx, %rdx
	addq	%rcx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	a(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	H(%rip), %eax
	subl	$1, %eax
	subl	-16(%rbp), %eax
	movl	-12(%rbp), %edx
	movslq	%edx, %rdx
	cltq
	imulq	$2002, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rcx
	leaq	a(%rip), %rdx
	movl	-4(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	addl	$1, -12(%rbp)
.L16:
	movl	W(%rip), %eax
	cmpl	%eax, -12(%rbp)
	jl	.L17
	addl	$1, -16(%rbp)
.L15:
	movl	-16(%rbp), %eax
	cmpl	-8(%rbp), %eax
	jl	.L18
	nop
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	flip_row, .-flip_row
	.globl	flip_col
	.type	flip_col, @function
flip_col:
.LFB3:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	W(%rip), %eax
	sarl	%eax
	movl	%eax, -8(%rbp)
	movl	$0, -16(%rbp)
	jmp	.L20
.L23:
	movl	$0, -12(%rbp)
	jmp	.L21
.L22:
	movl	-12(%rbp), %eax
	movslq	%eax, %rdx
	movl	-16(%rbp), %eax
	cltq
	imulq	$2002, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -4(%rbp)
	movl	W(%rip), %eax
	subl	$1, %eax
	subl	-12(%rbp), %eax
	movslq	%eax, %rdx
	movl	-16(%rbp), %eax
	cltq
	imulq	$2002, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-12(%rbp), %edx
	movslq	%edx, %rcx
	movl	-16(%rbp), %edx
	movslq	%edx, %rdx
	imulq	$2002, %rdx, %rdx
	addq	%rcx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	a(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	W(%rip), %eax
	subl	$1, %eax
	subl	-12(%rbp), %eax
	movslq	%eax, %rdx
	movl	-16(%rbp), %eax
	cltq
	imulq	$2002, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rcx
	leaq	a(%rip), %rdx
	movl	-4(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	addl	$1, -12(%rbp)
.L21:
	movl	-12(%rbp), %eax
	cmpl	-8(%rbp), %eax
	jl	.L22
	addl	$1, -16(%rbp)
.L20:
	movl	H(%rip), %eax
	cmpl	%eax, -16(%rbp)
	jl	.L23
	nop
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE3:
	.size	flip_col, .-flip_col
	.globl	solve
	.type	solve, @function
solve:
.LFB4:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movl	$0, -12(%rbp)
	movl	max(%rip), %eax
	movl	min(%rip), %edx
	subl	%edx, %eax
	movl	%eax, -8(%rbp)
	jmp	.L25
.L27:
	movl	-12(%rbp), %edx
	movl	-8(%rbp), %eax
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, -4(%rbp)
	movl	-4(%rbp), %eax
	movl	%eax, %edi
	call	check
	testl	%eax, %eax
	je	.L26
	movl	-4(%rbp), %eax
	movl	%eax, -8(%rbp)
	jmp	.L25
.L26:
	movl	-4(%rbp), %eax
	movl	%eax, -12(%rbp)
.L25:
	movl	-8(%rbp), %eax
	subl	-12(%rbp), %eax
	cmpl	$1, %eax
	jg	.L27
	movl	-8(%rbp), %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE4:
	.size	solve, .-solve
	.section	.rodata
.LC0:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB5:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movl	$0, %eax
	call	in
	movl	%eax, H(%rip)
	movl	$0, %eax
	call	in
	movl	%eax, W(%rip)
	movl	$1000000001, min(%rip)
	movl	$0, max(%rip)
	movl	$0, -20(%rbp)
	jmp	.L30
.L35:
	movl	$0, -16(%rbp)
	jmp	.L31
.L34:
	movl	$0, %eax
	call	in
	movl	%eax, -4(%rbp)
	movl	-16(%rbp), %eax
	movslq	%eax, %rdx
	movl	-20(%rbp), %eax
	cltq
	imulq	$2002, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rcx
	leaq	a(%rip), %rdx
	movl	-4(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	min(%rip), %eax
	cmpl	%eax, -4(%rbp)
	jge	.L32
	movl	-4(%rbp), %eax
	movl	%eax, min(%rip)
.L32:
	movl	max(%rip), %eax
	cmpl	%eax, -4(%rbp)
	jle	.L33
	movl	-4(%rbp), %eax
	movl	%eax, max(%rip)
.L33:
	addl	$1, -16(%rbp)
.L31:
	movl	W(%rip), %eax
	cmpl	%eax, -16(%rbp)
	jl	.L34
	addl	$1, -20(%rbp)
.L30:
	movl	H(%rip), %eax
	cmpl	%eax, -20(%rbp)
	jl	.L35
	movl	$0, %eax
	call	solve
	movl	%eax, -12(%rbp)
	movl	$0, %eax
	call	flip_row
	movl	$0, %eax
	call	solve
	movl	%eax, -8(%rbp)
	movl	-8(%rbp), %eax
	cmpl	-12(%rbp), %eax
	jge	.L36
	movl	-8(%rbp), %eax
	movl	%eax, -12(%rbp)
.L36:
	movl	$0, %eax
	call	flip_col
	movl	$0, %eax
	call	solve
	movl	%eax, -8(%rbp)
	movl	-8(%rbp), %eax
	cmpl	-12(%rbp), %eax
	jge	.L37
	movl	-8(%rbp), %eax
	movl	%eax, -12(%rbp)
.L37:
	movl	$0, %eax
	call	flip_row
	movl	$0, %eax
	call	solve
	movl	%eax, -8(%rbp)
	movl	-8(%rbp), %eax
	cmpl	-12(%rbp), %eax
	jge	.L38
	movl	-8(%rbp), %eax
	movl	%eax, -12(%rbp)
.L38:
	movl	-12(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE5:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```

Only output the optimized assembly code. Do not include any other text. Do not write any comments in the assembly code. Wrap the assembly code in ```assembly``` tags.
train
	.file	"temp.c"
	.text
	.globl	H
	.bss
	.align 4
	.type	H, @object
	.size	H, 4
H:
	.zero	4
	.globl	W
	.align 4
	.type	W, @object
	.size	W, 4
W:
	.zero	4
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 16032016
a:
	.zero	16032016
	.globl	min
	.align 4
	.type	min, @object
	.size	min, 4
min:
	.zero	4
	.globl	max
	.align 4
	.type	max, @object
	.size	max, 4
max:
	.zero	4
	.text
	.globl	in
	.type	in, @function
in:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movl	$0, -8(%rbp)
	call	getchar_unlocked@PLT
	movl	%eax, -4(%rbp)
.L2:
	movl	-8(%rbp), %eax
	leal	0(,%rax,8), %edx
	movl	-8(%rbp), %eax
	addl	%eax, %eax
	addl	%eax, %edx
	movl	-4(%rbp), %eax
	andl	$15, %eax
	addl	%edx, %eax
	movl	%eax, -8(%rbp)
	call	getchar_unlocked@PLT
	movl	%eax, -4(%rbp)
	cmpl	$47, -4(%rbp)
	jg	.L2
	movl	-8(%rbp), %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	in, .-in
	.globl	check
	.type	check, @function
check:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -20(%rbp)
	movl	$0, -4(%rbp)
	movl	$0, -12(%rbp)
	jmp	.L5
.L13:
	movl	$0, -8(%rbp)
	jmp	.L6
.L8:
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movl	-12(%rbp), %eax
	cltq
	imulq	$2002, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	max(%rip), %eax
	subl	-20(%rbp), %eax
	cmpl	%eax, %edx
	jge	.L7
	movl	-8(%rbp), %eax
	cmpl	-4(%rbp), %eax
	jl	.L7
	movl	-8(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -4(%rbp)
.L7:
	addl	$1, -8(%rbp)
.L6:
	movl	W(%rip), %eax
	cmpl	%eax, -8(%rbp)
	jl	.L8
	movl	$0, -8(%rbp)
	jmp	.L9
.L12:
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movl	-12(%rbp), %eax
	cltq
	imulq	$2002, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	min(%rip), %ecx
	movl	-20(%rbp), %edx
	addl	%ecx, %edx
	cmpl	%edx, %eax
	jle	.L10
	movl	-8(%rbp), %eax
	cmpl	-4(%rbp), %eax
	jge	.L10
	movl	$0, %eax
	jmp	.L11
.L10:
	addl	$1, -8(%rbp)
.L9:
	movl	W(%rip), %eax
	cmpl	%eax, -8(%rbp)
	jl	.L12
	addl	$1, -12(%rbp)
.L5:
	movl	H(%rip), %eax
	cmpl	%eax, -12(%rbp)
	jl	.L13
	movl	$1, %eax
.L11:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	check, .-check
	.globl	flip_row
	.type	flip_row, @function
flip_row:
.LFB2:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	H(%rip), %eax
	sarl	%eax
	movl	%eax, -8(%rbp)
	movl	$0, -16(%rbp)
	jmp	.L15
.L18:
	movl	$0, -12(%rbp)
	jmp	.L16
.L17:
	movl	-12(%rbp), %eax
	movslq	%eax, %rdx
	movl	-16(%rbp), %eax
	cltq
	imulq	$2002, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -4(%rbp)
	movl	H(%rip), %eax
	subl	$1, %eax
	subl	-16(%rbp), %eax
	movl	-12(%rbp), %edx
	movslq	%edx, %rdx
	cltq
	imulq	$2002, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-12(%rbp), %edx
	movslq	%edx, %rcx
	movl	-16(%rbp), %edx
	movslq	%edx, %rdx
	imulq	$2002, %rdx, %rdx
	addq	%rcx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	a(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	H(%rip), %eax
	subl	$1, %eax
	subl	-16(%rbp), %eax
	movl	-12(%rbp), %edx
	movslq	%edx, %rdx
	cltq
	imulq	$2002, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rcx
	leaq	a(%rip), %rdx
	movl	-4(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	addl	$1, -12(%rbp)
.L16:
	movl	W(%rip), %eax
	cmpl	%eax, -12(%rbp)
	jl	.L17
	addl	$1, -16(%rbp)
.L15:
	movl	-16(%rbp), %eax
	cmpl	-8(%rbp), %eax
	jl	.L18
	nop
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	flip_row, .-flip_row
	.globl	flip_col
	.type	flip_col, @function
flip_col:
.LFB3:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	W(%rip), %eax
	sarl	%eax
	movl	%eax, -8(%rbp)
	movl	$0, -16(%rbp)
	jmp	.L20
.L23:
	movl	$0, -12(%rbp)
	jmp	.L21
.L22:
	movl	-12(%rbp), %eax
	movslq	%eax, %rdx
	movl	-16(%rbp), %eax
	cltq
	imulq	$2002, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -4(%rbp)
	movl	W(%rip), %eax
	subl	$1, %eax
	subl	-12(%rbp), %eax
	movslq	%eax, %rdx
	movl	-16(%rbp), %eax
	cltq
	imulq	$2002, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-12(%rbp), %edx
	movslq	%edx, %rcx
	movl	-16(%rbp), %edx
	movslq	%edx, %rdx
	imulq	$2002, %rdx, %rdx
	addq	%rcx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	a(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	W(%rip), %eax
	subl	$1, %eax
	subl	-12(%rbp), %eax
	movslq	%eax, %rdx
	movl	-16(%rbp), %eax
	cltq
	imulq	$2002, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rcx
	leaq	a(%rip), %rdx
	movl	-4(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	addl	$1, -12(%rbp)
.L21:
	movl	-12(%rbp), %eax
	cmpl	-8(%rbp), %eax
	jl	.L22
	addl	$1, -16(%rbp)
.L20:
	movl	H(%rip), %eax
	cmpl	%eax, -16(%rbp)
	jl	.L23
	nop
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE3:
	.size	flip_col, .-flip_col
	.globl	solve
	.type	solve, @function
solve:
.LFB4:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movl	$0, -12(%rbp)
	movl	max(%rip), %eax
	movl	min(%rip), %edx
	subl	%edx, %eax
	movl	%eax, -8(%rbp)
	jmp	.L25
.L27:
	movl	-12(%rbp), %edx
	movl	-8(%rbp), %eax
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, -4(%rbp)
	movl	-4(%rbp), %eax
	movl	%eax, %edi
	call	check
	testl	%eax, %eax
	je	.L26
	movl	-4(%rbp), %eax
	movl	%eax, -8(%rbp)
	jmp	.L25
.L26:
	movl	-4(%rbp), %eax
	movl	%eax, -12(%rbp)
.L25:
	movl	-8(%rbp), %eax
	subl	-12(%rbp), %eax
	cmpl	$1, %eax
	jg	.L27
	movl	-8(%rbp), %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE4:
	.size	solve, .-solve
	.section	.rodata
.LC0:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB5:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movl	$0, %eax
	call	in
	movl	%eax, H(%rip)
	movl	$0, %eax
	call	in
	movl	%eax, W(%rip)
	movl	$1000000001, min(%rip)
	movl	$0, max(%rip)
	movl	$0, -20(%rbp)
	jmp	.L30
.L35:
	movl	$0, -16(%rbp)
	jmp	.L31
.L34:
	movl	$0, %eax
	call	in
	movl	%eax, -4(%rbp)
	movl	-16(%rbp), %eax
	movslq	%eax, %rdx
	movl	-20(%rbp), %eax
	cltq
	imulq	$2002, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rcx
	leaq	a(%rip), %rdx
	movl	-4(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	min(%rip), %eax
	cmpl	%eax, -4(%rbp)
	jge	.L32
	movl	-4(%rbp), %eax
	movl	%eax, min(%rip)
.L32:
	movl	max(%rip), %eax
	cmpl	%eax, -4(%rbp)
	jle	.L33
	movl	-4(%rbp), %eax
	movl	%eax, max(%rip)
.L33:
	addl	$1, -16(%rbp)
.L31:
	movl	W(%rip), %eax
	cmpl	%eax, -16(%rbp)
	jl	.L34
	addl	$1, -20(%rbp)
.L30:
	movl	H(%rip), %eax
	cmpl	%eax, -20(%rbp)
	jl	.L35
	movl	$0, %eax
	call	solve
	movl	%eax, -12(%rbp)
	movl	$0, %eax
	call	flip_row
	movl	$0, %eax
	call	solve
	movl	%eax, -8(%rbp)
	movl	-8(%rbp), %eax
	cmpl	-12(%rbp), %eax
	jge	.L36
	movl	-8(%rbp), %eax
	movl	%eax, -12(%rbp)
.L36:
	movl	$0, %eax
	call	flip_col
	movl	$0, %eax
	call	solve
	movl	%eax, -8(%rbp)
	movl	-8(%rbp), %eax
	cmpl	-12(%rbp), %eax
	jge	.L37
	movl	-8(%rbp), %eax
	movl	%eax, -12(%rbp)
.L37:
	movl	$0, %eax
	call	flip_row
	movl	$0, %eax
	call	solve
	movl	%eax, -8(%rbp)
	movl	-8(%rbp), %eax
	cmpl	-12(%rbp), %eax
	jge	.L38
	movl	-8(%rbp), %eax
	movl	%eax, -12(%rbp)
.L38:
	movl	-12(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE5:
	.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:
