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

```c
// AOJ 0525: Osenbei
// 2017.11.12 bal4u@uu

#include <stdio.h>
#include <stdlib.h>
#define TM 0
#if TM
#include <time.h>
#endif

char b[2][10][20010], *a[10];
char buf[20010];

int main()
{
	int r, c, i, j, k, s, lim, cnt, ans;
	char *p;
#if TM
	clock_t start, finish;
	start = clock();
#endif
	while (fgets(p=buf, 20, stdin) && *p != '0') {
		r = atoi(p); while (*p >= '0') p++;
		c = atoi(p);
		for (j = 0; j < r; j++) {
			fgets(p=buf, 20010, stdin);
			for (i = 0; i < c; i++, p+=2) {
				b[1][j][i] =    *p  & 1;
				b[0][j][i] = (1+*p) & 1;
			}
		}

		ans = 0;
		for (lim = 1 << r, k = 0; k < lim; k++) {
			for (j = 0; j < r; j++) a[j] = b[(k>>j)&1][j];
			cnt = 0; for (i = 0; i < c; i++) {
				s = 0; for (j = 0; j < r; j++) s += a[j][i];
				cnt += ((s<<1) < r) ? r-s : s;
			}
			if (cnt > ans) ans = cnt;
		}
		printf("%d\n", ans);
	}
#if TM
	finish = clock();
	printf("time %lf\n", (double)(finish-start)/CLOCKS_PER_SEC);
#endif
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	b
	.bss
	.align 32
	.type	b, @object
	.size	b, 400200
b:
	.zero	400200
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 80
a:
	.zero	80
	.globl	buf
	.align 32
	.type	buf, @object
	.size	buf, 20010
buf:
	.zero	20010
	.section	.rodata
.LC0:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$48, %rsp
	jmp	.L2
.L21:
	movq	-8(%rbp), %rax
	movq	%rax, %rdi
	call	atoi@PLT
	movl	%eax, -20(%rbp)
	jmp	.L3
.L4:
	addq	$1, -8(%rbp)
.L3:
	movq	-8(%rbp), %rax
	movzbl	(%rax), %eax
	cmpb	$47, %al
	jg	.L4
	movq	-8(%rbp), %rax
	movq	%rax, %rdi
	call	atoi@PLT
	movl	%eax, -16(%rbp)
	movl	$0, -40(%rbp)
	jmp	.L5
.L8:
	movq	stdin(%rip), %rdx
	leaq	buf(%rip), %rax
	movq	%rax, -8(%rbp)
	movq	-8(%rbp), %rax
	movl	$20010, %esi
	movq	%rax, %rdi
	call	fgets@PLT
	movl	$0, -44(%rbp)
	jmp	.L6
.L7:
	movq	-8(%rbp), %rax
	movzbl	(%rax), %eax
	andl	$1, %eax
	movl	%eax, %edx
	movl	-44(%rbp), %eax
	movslq	%eax, %rcx
	movl	-40(%rbp), %eax
	cltq
	imulq	$20010, %rax, %rax
	addq	%rax, %rcx
	leaq	200100+b(%rip), %rax
	addq	%rcx, %rax
	movb	%dl, (%rax)
	movq	-8(%rbp), %rax
	movzbl	(%rax), %eax
	addl	$1, %eax
	andl	$1, %eax
	movl	%eax, %edx
	movl	-44(%rbp), %eax
	movslq	%eax, %rcx
	movl	-40(%rbp), %eax
	cltq
	imulq	$20010, %rax, %rax
	addq	%rax, %rcx
	leaq	b(%rip), %rax
	addq	%rcx, %rax
	movb	%dl, (%rax)
	addl	$1, -44(%rbp)
	addq	$2, -8(%rbp)
.L6:
	movl	-44(%rbp), %eax
	cmpl	-16(%rbp), %eax
	jl	.L7
	addl	$1, -40(%rbp)
.L5:
	movl	-40(%rbp), %eax
	cmpl	-20(%rbp), %eax
	jl	.L8
	movl	$0, -24(%rbp)
	movl	-20(%rbp), %eax
	movl	$1, %edx
	movl	%eax, %ecx
	sall	%cl, %edx
	movl	%edx, %eax
	movl	%eax, -12(%rbp)
	movl	$0, -36(%rbp)
	jmp	.L9
.L19:
	movl	$0, -40(%rbp)
	jmp	.L10
.L11:
	movl	-40(%rbp), %eax
	movl	-36(%rbp), %edx
	movl	%eax, %ecx
	sarl	%cl, %edx
	movl	%edx, %eax
	andl	$1, %eax
	movl	%eax, %edx
	movl	-40(%rbp), %eax
	cltq
	imulq	$20010, %rax, %rcx
	movslq	%edx, %rax
	imulq	$200100, %rax, %rax
	leaq	(%rcx,%rax), %rdx
	leaq	b(%rip), %rax
	leaq	(%rdx,%rax), %rcx
	movl	-40(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movq	%rcx, (%rdx,%rax)
	addl	$1, -40(%rbp)
.L10:
	movl	-40(%rbp), %eax
	cmpl	-20(%rbp), %eax
	jl	.L11
	movl	$0, -28(%rbp)
	movl	$0, -44(%rbp)
	jmp	.L12
.L17:
	movl	$0, -32(%rbp)
	movl	$0, -40(%rbp)
	jmp	.L13
.L14:
	movl	-40(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movl	-44(%rbp), %eax
	cltq
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	addl	%eax, -32(%rbp)
	addl	$1, -40(%rbp)
.L13:
	movl	-40(%rbp), %eax
	cmpl	-20(%rbp), %eax
	jl	.L14
	movl	-32(%rbp), %eax
	addl	%eax, %eax
	cmpl	%eax, -20(%rbp)
	jle	.L15
	movl	-20(%rbp), %eax
	subl	-32(%rbp), %eax
	jmp	.L16
.L15:
	movl	-32(%rbp), %eax
.L16:
	addl	%eax, -28(%rbp)
	addl	$1, -44(%rbp)
.L12:
	movl	-44(%rbp), %eax
	cmpl	-16(%rbp), %eax
	jl	.L17
	movl	-28(%rbp), %eax
	cmpl	-24(%rbp), %eax
	jle	.L18
	movl	-28(%rbp), %eax
	movl	%eax, -24(%rbp)
.L18:
	addl	$1, -36(%rbp)
.L9:
	movl	-36(%rbp), %eax
	cmpl	-12(%rbp), %eax
	jl	.L19
	movl	-24(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L2:
	movq	stdin(%rip), %rdx
	leaq	buf(%rip), %rax
	movq	%rax, -8(%rbp)
	movq	-8(%rbp), %rax
	movl	$20, %esi
	movq	%rax, %rdi
	call	fgets@PLT
	testq	%rax, %rax
	je	.L20
	movq	-8(%rbp), %rax
	movzbl	(%rax), %eax
	cmpb	$48, %al
	jne	.L21
.L20:
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.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
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB39:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	buf(%rip), %r15
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$72, %rsp
	.cfi_def_cfa_offset 128
.L2:
	movq	stdin(%rip), %rdx
	movl	$20, %esi
	movq	%r15, %rdi
	call	fgets@PLT
	testq	%rax, %rax
	je	.L24
	cmpb	$48, (%r15)
	je	.L24
	xorl	%esi, %esi
	movq	%r15, %rdi
	movl	$10, %edx
	call	strtol@PLT
	cmpb	$47, (%r15)
	leaq	buf(%rip), %rdi
	movq	%rax, 40(%rsp)
	movl	%eax, %ebp
	jle	.L3
	.p2align 4,,10
	.p2align 3
.L4:
	addq	$1, %rdi
	cmpb	$47, (%rdi)
	jg	.L4
.L3:
	movl	$10, %edx
	xorl	%esi, %esi
	call	strtol@PLT
	movl	40(%rsp), %edx
	movq	%rax, 48(%rsp)
	movl	%eax, 56(%rsp)
	testl	%edx, %edx
	jle	.L10
	movq	%rax, %rbx
	movl	%eax, 32(%rsp)
	subl	$1, %eax
	xorl	%r14d, %r14d
	movl	%eax, 16(%rsp)
	movl	%ebx, %eax
	andl	$-16, %ebx
	leaq	200100+b(%rip), %r12
	shrl	$4, %eax
	movl	%ebp, 8(%rsp)
	leal	-1(%rax), %r13d
	movl	%ebx, %eax
	addq	$1, %r13
	leaq	(%r15,%rax,2), %rax
	salq	$4, %r13
	movq	%rax, 24(%rsp)
	movq	%r13, %rbp
	movq	%r12, %r13
	movl	%r14d, %r12d
	movl	56(%rsp), %r14d
	.p2align 4,,10
	.p2align 3
.L9:
	movq	stdin(%rip), %rdx
	movl	$20010, %esi
	movq	%r15, %rdi
	call	fgets@PLT
	testl	%r14d, %r14d
	movdqa	.LC0(%rip), %xmm2
	movdqa	.LC1(%rip), %xmm1
	jle	.L14
	cmpl	$14, 16(%rsp)
	jbe	.L28
	leaq	-200100(%r13), %rcx
	xorl	%eax, %eax
	leaq	16+buf(%rip), %rdx
	.p2align 4,,10
	.p2align 3
.L12:
	movdqa	(%r15,%rax,2), %xmm0
	movdqa	(%rdx,%rax,2), %xmm3
	pand	%xmm2, %xmm0
	pand	%xmm2, %xmm3
	packuswb	%xmm3, %xmm0
	movdqa	%xmm0, %xmm3
	paddb	%xmm1, %xmm0
	pand	%xmm1, %xmm3
	pand	%xmm1, %xmm0
	movups	%xmm3, 0(%r13,%rax)
	movups	%xmm0, (%rcx,%rax)
	addq	$16, %rax
	cmpq	%rbp, %rax
	jne	.L12
	cmpl	32(%rsp), %ebx
	je	.L14
	movq	24(%rsp), %rcx
	movl	%ebx, %eax
.L11:
	movslq	%r12d, %r10
	movzbl	(%rcx), %edi
	leaq	b(%rip), %r9
	movslq	%eax, %rsi
	imulq	$20010, %r10, %rdx
	movl	%edi, %r11d
	addl	$1, %edi
	andl	$1, %r11d
	andl	$1, %edi
	addq	%r9, %rdx
	addq	%rdx, %rsi
	movb	%r11b, 200100(%rsi)
	movb	%dil, (%rsi)
	leal	1(%rax), %esi
	cmpl	%esi, %r14d
	jle	.L14
	movzbl	2(%rcx), %edi
	movslq	%esi, %rsi
	addq	%rdx, %rsi
	movl	%edi, %r11d
	addl	$1, %edi
	andl	$1, %r11d
	andl	$1, %edi
	movb	%r11b, 200100(%rsi)
	movb	%dil, (%rsi)
	leal	2(%rax), %esi
	cmpl	%esi, %r14d
	jle	.L14
	movzbl	4(%rcx), %edi
	movslq	%esi, %rsi
	addq	%rdx, %rsi
	movl	%edi, %r11d
	addl	$1, %edi
	andl	$1, %r11d
	andl	$1, %edi
	movb	%r11b, 200100(%rsi)
	movb	%dil, (%rsi)
	leal	3(%rax), %esi
	cmpl	%esi, %r14d
	jle	.L14
	movzbl	6(%rcx), %edi
	movslq	%esi, %rsi
	addq	%rdx, %rsi
	movl	%edi, %r11d
	addl	$1, %edi
	andl	$1, %r11d
	andl	$1, %edi
	movb	%r11b, 200100(%rsi)
	movb	%dil, (%rsi)
	leal	4(%rax), %esi
	cmpl	%esi, %r14d
	jle	.L14
	movzbl	8(%rcx), %edi
	movslq	%esi, %rsi
	addq	%rdx, %rsi
	movl	%edi, %r11d
	addl	$1, %edi
	andl	$1, %r11d
	andl	$1, %edi
	movb	%r11b, 200100(%rsi)
	movb	%dil, (%rsi)
	leal	5(%rax), %esi
	cmpl	%esi, %r14d
	jle	.L14
	movzbl	10(%rcx), %edi
	movslq	%esi, %rsi
	addq	%rdx, %rsi
	movl	%edi, %r11d
	addl	$1, %edi
	andl	$1, %r11d
	andl	$1, %edi
	movb	%r11b, 200100(%rsi)
	movb	%dil, (%rsi)
	leal	6(%rax), %esi
	cmpl	%esi, %r14d
	jle	.L14
	movzbl	12(%rcx), %edi
	movslq	%esi, %rsi
	addq	%rdx, %rsi
	movl	%edi, %r11d
	addl	$1, %edi
	andl	$1, %r11d
	andl	$1, %edi
	movb	%r11b, 200100(%rsi)
	movb	%dil, (%rsi)
	leal	7(%rax), %esi
	cmpl	%esi, %r14d
	jle	.L14
	movzbl	14(%rcx), %edi
	movslq	%esi, %rsi
	addq	%rdx, %rsi
	movl	%edi, %r11d
	addl	$1, %edi
	andl	$1, %r11d
	andl	$1, %edi
	movb	%r11b, 200100(%rsi)
	movb	%dil, (%rsi)
	leal	8(%rax), %esi
	cmpl	%esi, %r14d
	jle	.L14
	movzbl	16(%rcx), %edi
	movslq	%esi, %rsi
	addq	%rdx, %rsi
	movl	%edi, %r11d
	addl	$1, %edi
	andl	$1, %edi
	andl	$1, %r11d
	movb	%dil, (%rsi)
	leal	9(%rax), %edi
	movb	%r11b, 200100(%rsi)
	cmpl	%edi, %r14d
	jle	.L14
	movzbl	18(%rcx), %esi
	movslq	%edi, %rdi
	addq	%rdi, %rdx
	movl	%esi, %edi
	addl	$1, %esi
	andl	$1, %esi
	andl	$1, %edi
	movb	%sil, (%rdx)
	leal	10(%rax), %esi
	movb	%dil, 200100(%rdx)
	cmpl	%esi, %r14d
	jle	.L14
	imulq	$20010, %r10, %rdx
	movzbl	20(%rcx), %r11d
	movslq	%esi, %rsi
	movl	%r11d, %edi
	addl	$1, %r11d
	addq	%r9, %rdx
	andl	$1, %edi
	andl	$1, %r11d
	addq	%rdx, %rsi
	movb	%dil, 200100(%rsi)
	movb	%r11b, (%rsi)
	leal	11(%rax), %esi
	cmpl	%esi, %r14d
	jle	.L14
	movzbl	22(%rcx), %edi
	movslq	%esi, %rsi
	addq	%rdx, %rsi
	movl	%edi, %r10d
	addl	$1, %edi
	andl	$1, %r10d
	andl	$1, %edi
	movb	%r10b, 200100(%rsi)
	movb	%dil, (%rsi)
	leal	12(%rax), %esi
	cmpl	%esi, %r14d
	jle	.L14
	movzbl	24(%rcx), %r10d
	movslq	%esi, %rsi
	addq	%rdx, %rsi
	movl	%r10d, %edi
	addl	$1, %r10d
	andl	$1, %edi
	andl	$1, %r10d
	movb	%dil, 200100(%rsi)
	movb	%r10b, (%rsi)
	leal	13(%rax), %esi
	cmpl	%esi, %r14d
	jle	.L14
	movzbl	26(%rcx), %r10d
	movslq	%esi, %rsi
	addl	$14, %eax
	addq	%rdx, %rsi
	movl	%r10d, %edi
	addl	$1, %r10d
	andl	$1, %edi
	andl	$1, %r10d
	movb	%dil, 200100(%rsi)
	movb	%r10b, (%rsi)
	cmpl	%eax, %r14d
	jle	.L14
	movzbl	28(%rcx), %ecx
	cltq
	addq	%rax, %rdx
	movl	%ecx, %eax
	addl	$1, %ecx
	andl	$1, %eax
	andl	$1, %ecx
	movb	%al, 200100(%rdx)
	movb	%cl, (%rdx)
	.p2align 4,,10
	.p2align 3
.L14:
	addl	$1, %r12d
	addq	$20010, %r13
	cmpl	8(%rsp), %r12d
	jne	.L9
	movl	8(%rsp), %ebp
.L10:
	movzbl	40(%rsp), %ecx
	movq	48(%rsp), %rbx
	movl	$1, %eax
	xorl	%r13d, %r13d
	movl	$0, 40(%rsp)
	sall	%cl, %eax
	leal	-1(%rbx), %r14d
	movl	%eax, 60(%rsp)
	testl	%eax, %eax
	jle	.L7
	.p2align 4,,10
	.p2align 3
.L6:
	testl	%ebp, %ebp
	jle	.L16
	movl	%r13d, %eax
	leaq	b(%rip), %rbx
	andl	$1, %eax
	imulq	$200100, %rax, %rax
	addq	%rbx, %rax
	movq	%rax, a(%rip)
	cmpl	$1, %ebp
	je	.L16
	movl	%r13d, %eax
	sarl	%eax
	andl	$1, %eax
	imulq	$200100, %rax, %rax
	leaq	20010(%rbx,%rax), %rax
	movq	%rax, 8+a(%rip)
	cmpl	$2, %ebp
	je	.L16
	movl	%r13d, %eax
	sarl	$2, %eax
	andl	$1, %eax
	imulq	$200100, %rax, %rax
	leaq	40020(%rbx,%rax), %rax
	movq	%rax, 16+a(%rip)
	cmpl	$3, %ebp
	je	.L16
	movl	%r13d, %eax
	sarl	$3, %eax
	andl	$1, %eax
	imulq	$200100, %rax, %rax
	leaq	60030(%rbx,%rax), %rax
	movq	%rax, 24+a(%rip)
	cmpl	$4, %ebp
	je	.L16
	movl	%r13d, %eax
	sarl	$4, %eax
	andl	$1, %eax
	imulq	$200100, %rax, %rax
	leaq	80040(%rbx,%rax), %rax
	movq	%rax, 32+a(%rip)
	cmpl	$5, %ebp
	je	.L16
	movl	%r13d, %eax
	sarl	$5, %eax
	andl	$1, %eax
	imulq	$200100, %rax, %rax
	leaq	100050(%rbx,%rax), %rax
	movq	%rax, 40+a(%rip)
	cmpl	$6, %ebp
	je	.L16
	movl	%r13d, %eax
	sarl	$6, %eax
	andl	$1, %eax
	imulq	$200100, %rax, %rax
	leaq	120060(%rbx,%rax), %rax
	movq	%rax, 48+a(%rip)
	cmpl	$7, %ebp
	je	.L16
	movl	%r13d, %eax
	sarl	$7, %eax
	andl	$1, %eax
	imulq	$200100, %rax, %rax
	leaq	140070(%rbx,%rax), %rax
	movq	%rax, 56+a(%rip)
	cmpl	$8, %ebp
	je	.L16
	movl	%r13d, %eax
	sarl	$8, %eax
	andl	$1, %eax
	imulq	$200100, %rax, %rax
	leaq	160080(%rbx,%rax), %rax
	movq	%rax, 64+a(%rip)
	cmpl	$9, %ebp
	je	.L16
	movl	%r13d, %eax
	sarl	$9, %eax
	andl	$1, %eax
	imulq	$200100, %rax, %rax
	leaq	180090(%rbx,%rax), %rax
	movq	%rax, 72+a(%rip)
.L16:
	movl	56(%rsp), %eax
	testl	%eax, %eax
	jle	.L29
	movq	48+a(%rip), %rcx
	movq	40+a(%rip), %rax
	xorl	%edx, %edx
	movl	%r13d, 48(%rsp)
	movq	a(%rip), %r9
	movq	8+a(%rip), %r10
	movq	%rcx, 8(%rsp)
	movq	56+a(%rip), %rcx
	movq	%rax, %r13
	movq	16+a(%rip), %r11
	movq	24+a(%rip), %rbx
	movq	%rcx, 16(%rsp)
	movq	64+a(%rip), %rcx
	movq	32+a(%rip), %r12
	movq	%rcx, 24(%rsp)
	movq	72+a(%rip), %rcx
	movq	%rcx, 32(%rsp)
	xorl	%ecx, %ecx
	jmp	.L18
	.p2align 4,,10
	.p2align 3
.L95:
	movq	%rax, %rdx
.L18:
	testl	%ebp, %ebp
	jle	.L21
	movsbl	(%r9,%rdx), %eax
	cmpl	$1, %ebp
	je	.L19
	movsbl	(%r10,%rdx), %esi
	addl	%esi, %eax
	cmpl	$2, %ebp
	je	.L19
	movsbl	(%r11,%rdx), %esi
	addl	%esi, %eax
	cmpl	$3, %ebp
	je	.L19
	movsbl	(%rbx,%rdx), %esi
	addl	%esi, %eax
	cmpl	$4, %ebp
	je	.L19
	movsbl	(%r12,%rdx), %esi
	addl	%esi, %eax
	cmpl	$5, %ebp
	je	.L19
	movsbl	0(%r13,%rdx), %esi
	addl	%esi, %eax
	cmpl	$6, %ebp
	je	.L19
	movq	8(%rsp), %rdi
	movsbl	(%rdi,%rdx), %esi
	addl	%esi, %eax
	cmpl	$7, %ebp
	je	.L19
	movq	16(%rsp), %rdi
	movsbl	(%rdi,%rdx), %esi
	addl	%esi, %eax
	cmpl	$8, %ebp
	je	.L19
	movq	24(%rsp), %rdi
	movsbl	(%rdi,%rdx), %esi
	addl	%esi, %eax
	cmpl	$9, %ebp
	je	.L19
	movq	32(%rsp), %rdi
	movsbl	(%rdi,%rdx), %esi
	addl	%esi, %eax
.L19:
	movl	%ebp, %esi
	leal	(%rax,%rax), %r8d
	leal	(%rcx,%rax), %edi
	subl	%eax, %esi
	addl	%ecx, %esi
	cmpl	%ebp, %r8d
	movl	%edi, %ecx
	cmovl	%esi, %ecx
.L21:
	leaq	1(%rdx), %rax
	cmpq	%rdx, %r14
	jne	.L95
	movl	48(%rsp), %r13d
.L17:
	movl	40(%rsp), %eax
	cmpl	%ecx, %eax
	cmovge	%eax, %ecx
	addl	$1, %r13d
	movl	%ecx, 40(%rsp)
	cmpl	%r13d, 60(%rsp)
	jne	.L6
.L7:
	movl	40(%rsp), %edx
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L2
.L29:
	xorl	%ecx, %ecx
	jmp	.L17
.L28:
	leaq	buf(%rip), %rcx
	xorl	%eax, %eax
	jmp	.L11
.L24:
	addq	$72, %rsp
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE39:
	.size	main, .-main
	.globl	buf
	.bss
	.align 32
	.type	buf, @object
	.size	buf, 20010
buf:
	.zero	20010
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 80
a:
	.zero	80
	.globl	b
	.align 32
	.type	b, @object
	.size	b, 400200
b:
	.zero	400200
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC0:
	.value	255
	.value	255
	.value	255
	.value	255
	.value	255
	.value	255
	.value	255
	.value	255
	.align 16
.LC1:
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.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
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB39:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	buf(%rip), %r15
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$72, %rsp
	.cfi_def_cfa_offset 128
.L2:
	movq	stdin(%rip), %rdx
	movl	$20, %esi
	movq	%r15, %rdi
	call	fgets@PLT
	testq	%rax, %rax
	je	.L24
	cmpb	$48, (%r15)
	je	.L24
	xorl	%esi, %esi
	movq	%r15, %rdi
	movl	$10, %edx
	call	strtol@PLT
	cmpb	$47, (%r15)
	leaq	buf(%rip), %rdi
	movq	%rax, 40(%rsp)
	movl	%eax, %ebp
	jle	.L3
	.p2align 4,,10
	.p2align 3
.L4:
	addq	$1, %rdi
	cmpb	$47, (%rdi)
	jg	.L4
.L3:
	movl	$10, %edx
	xorl	%esi, %esi
	call	strtol@PLT
	movl	40(%rsp), %edx
	movq	%rax, 48(%rsp)
	movl	%eax, 56(%rsp)
	testl	%edx, %edx
	jle	.L10
	movq	%rax, %rbx
	movl	%eax, 32(%rsp)
	subl	$1, %eax
	xorl	%r14d, %r14d
	movl	%eax, 16(%rsp)
	movl	%ebx, %eax
	andl	$-16, %ebx
	leaq	200100+b(%rip), %r12
	shrl	$4, %eax
	movl	%ebp, 8(%rsp)
	leal	-1(%rax), %r13d
	movl	%ebx, %eax
	addq	$1, %r13
	leaq	(%r15,%rax,2), %rax
	salq	$4, %r13
	movq	%rax, 24(%rsp)
	movq	%r13, %rbp
	movq	%r12, %r13
	movl	%r14d, %r12d
	movl	56(%rsp), %r14d
	.p2align 4,,10
	.p2align 3
.L9:
	movq	stdin(%rip), %rdx
	movl	$20010, %esi
	movq	%r15, %rdi
	call	fgets@PLT
	testl	%r14d, %r14d
	movdqa	.LC0(%rip), %xmm2
	movdqa	.LC1(%rip), %xmm1
	jle	.L14
	cmpl	$14, 16(%rsp)
	jbe	.L28
	leaq	-200100(%r13), %rcx
	xorl	%eax, %eax
	leaq	16+buf(%rip), %rdx
	.p2align 4,,10
	.p2align 3
.L12:
	movdqa	(%r15,%rax,2), %xmm0
	movdqa	(%rdx,%rax,2), %xmm3
	pand	%xmm2, %xmm0
	pand	%xmm2, %xmm3
	packuswb	%xmm3, %xmm0
	movdqa	%xmm0, %xmm3
	paddb	%xmm1, %xmm0
	pand	%xmm1, %xmm3
	pand	%xmm1, %xmm0
	movups	%xmm3, 0(%r13,%rax)
	movups	%xmm0, (%rcx,%rax)
	addq	$16, %rax
	cmpq	%rbp, %rax
	jne	.L12
	cmpl	32(%rsp), %ebx
	je	.L14
	movq	24(%rsp), %rcx
	movl	%ebx, %eax
.L11:
	movslq	%r12d, %r10
	movzbl	(%rcx), %edi
	leaq	b(%rip), %r9
	movslq	%eax, %rsi
	imulq	$20010, %r10, %rdx
	movl	%edi, %r11d
	addl	$1, %edi
	andl	$1, %r11d
	andl	$1, %edi
	addq	%r9, %rdx
	addq	%rdx, %rsi
	movb	%r11b, 200100(%rsi)
	movb	%dil, (%rsi)
	leal	1(%rax), %esi
	cmpl	%esi, %r14d
	jle	.L14
	movzbl	2(%rcx), %edi
	movslq	%esi, %rsi
	addq	%rdx, %rsi
	movl	%edi, %r11d
	addl	$1, %edi
	andl	$1, %r11d
	andl	$1, %edi
	movb	%r11b, 200100(%rsi)
	movb	%dil, (%rsi)
	leal	2(%rax), %esi
	cmpl	%esi, %r14d
	jle	.L14
	movzbl	4(%rcx), %edi
	movslq	%esi, %rsi
	addq	%rdx, %rsi
	movl	%edi, %r11d
	addl	$1, %edi
	andl	$1, %r11d
	andl	$1, %edi
	movb	%r11b, 200100(%rsi)
	movb	%dil, (%rsi)
	leal	3(%rax), %esi
	cmpl	%esi, %r14d
	jle	.L14
	movzbl	6(%rcx), %edi
	movslq	%esi, %rsi
	addq	%rdx, %rsi
	movl	%edi, %r11d
	addl	$1, %edi
	andl	$1, %r11d
	andl	$1, %edi
	movb	%r11b, 200100(%rsi)
	movb	%dil, (%rsi)
	leal	4(%rax), %esi
	cmpl	%esi, %r14d
	jle	.L14
	movzbl	8(%rcx), %edi
	movslq	%esi, %rsi
	addq	%rdx, %rsi
	movl	%edi, %r11d
	addl	$1, %edi
	andl	$1, %r11d
	andl	$1, %edi
	movb	%r11b, 200100(%rsi)
	movb	%dil, (%rsi)
	leal	5(%rax), %esi
	cmpl	%esi, %r14d
	jle	.L14
	movzbl	10(%rcx), %edi
	movslq	%esi, %rsi
	addq	%rdx, %rsi
	movl	%edi, %r11d
	addl	$1, %edi
	andl	$1, %r11d
	andl	$1, %edi
	movb	%r11b, 200100(%rsi)
	movb	%dil, (%rsi)
	leal	6(%rax), %esi
	cmpl	%esi, %r14d
	jle	.L14
	movzbl	12(%rcx), %edi
	movslq	%esi, %rsi
	addq	%rdx, %rsi
	movl	%edi, %r11d
	addl	$1, %edi
	andl	$1, %r11d
	andl	$1, %edi
	movb	%r11b, 200100(%rsi)
	movb	%dil, (%rsi)
	leal	7(%rax), %esi
	cmpl	%esi, %r14d
	jle	.L14
	movzbl	14(%rcx), %edi
	movslq	%esi, %rsi
	addq	%rdx, %rsi
	movl	%edi, %r11d
	addl	$1, %edi
	andl	$1, %r11d
	andl	$1, %edi
	movb	%r11b, 200100(%rsi)
	movb	%dil, (%rsi)
	leal	8(%rax), %esi
	cmpl	%esi, %r14d
	jle	.L14
	movzbl	16(%rcx), %edi
	movslq	%esi, %rsi
	addq	%rdx, %rsi
	movl	%edi, %r11d
	addl	$1, %edi
	andl	$1, %edi
	andl	$1, %r11d
	movb	%dil, (%rsi)
	leal	9(%rax), %edi
	movb	%r11b, 200100(%rsi)
	cmpl	%edi, %r14d
	jle	.L14
	movzbl	18(%rcx), %esi
	movslq	%edi, %rdi
	addq	%rdi, %rdx
	movl	%esi, %edi
	addl	$1, %esi
	andl	$1, %esi
	andl	$1, %edi
	movb	%sil, (%rdx)
	leal	10(%rax), %esi
	movb	%dil, 200100(%rdx)
	cmpl	%esi, %r14d
	jle	.L14
	imulq	$20010, %r10, %rdx
	movzbl	20(%rcx), %r11d
	movslq	%esi, %rsi
	movl	%r11d, %edi
	addl	$1, %r11d
	addq	%r9, %rdx
	andl	$1, %edi
	andl	$1, %r11d
	addq	%rdx, %rsi
	movb	%dil, 200100(%rsi)
	movb	%r11b, (%rsi)
	leal	11(%rax), %esi
	cmpl	%esi, %r14d
	jle	.L14
	movzbl	22(%rcx), %edi
	movslq	%esi, %rsi
	addq	%rdx, %rsi
	movl	%edi, %r10d
	addl	$1, %edi
	andl	$1, %r10d
	andl	$1, %edi
	movb	%r10b, 200100(%rsi)
	movb	%dil, (%rsi)
	leal	12(%rax), %esi
	cmpl	%esi, %r14d
	jle	.L14
	movzbl	24(%rcx), %r10d
	movslq	%esi, %rsi
	addq	%rdx, %rsi
	movl	%r10d, %edi
	addl	$1, %r10d
	andl	$1, %edi
	andl	$1, %r10d
	movb	%dil, 200100(%rsi)
	movb	%r10b, (%rsi)
	leal	13(%rax), %esi
	cmpl	%esi, %r14d
	jle	.L14
	movzbl	26(%rcx), %r10d
	movslq	%esi, %rsi
	addl	$14, %eax
	addq	%rdx, %rsi
	movl	%r10d, %edi
	addl	$1, %r10d
	andl	$1, %edi
	andl	$1, %r10d
	movb	%dil, 200100(%rsi)
	movb	%r10b, (%rsi)
	cmpl	%eax, %r14d
	jle	.L14
	movzbl	28(%rcx), %ecx
	cltq
	addq	%rax, %rdx
	movl	%ecx, %eax
	addl	$1, %ecx
	andl	$1, %eax
	andl	$1, %ecx
	movb	%al, 200100(%rdx)
	movb	%cl, (%rdx)
	.p2align 4,,10
	.p2align 3
.L14:
	addl	$1, %r12d
	addq	$20010, %r13
	cmpl	8(%rsp), %r12d
	jne	.L9
	movl	8(%rsp), %ebp
.L10:
	movzbl	40(%rsp), %ecx
	movq	48(%rsp), %rbx
	movl	$1, %eax
	xorl	%r13d, %r13d
	movl	$0, 40(%rsp)
	sall	%cl, %eax
	leal	-1(%rbx), %r14d
	movl	%eax, 60(%rsp)
	testl	%eax, %eax
	jle	.L7
	.p2align 4,,10
	.p2align 3
.L6:
	testl	%ebp, %ebp
	jle	.L16
	movl	%r13d, %eax
	leaq	b(%rip), %rbx
	andl	$1, %eax
	imulq	$200100, %rax, %rax
	addq	%rbx, %rax
	movq	%rax, a(%rip)
	cmpl	$1, %ebp
	je	.L16
	movl	%r13d, %eax
	sarl	%eax
	andl	$1, %eax
	imulq	$200100, %rax, %rax
	leaq	20010(%rbx,%rax), %rax
	movq	%rax, 8+a(%rip)
	cmpl	$2, %ebp
	je	.L16
	movl	%r13d, %eax
	sarl	$2, %eax
	andl	$1, %eax
	imulq	$200100, %rax, %rax
	leaq	40020(%rbx,%rax), %rax
	movq	%rax, 16+a(%rip)
	cmpl	$3, %ebp
	je	.L16
	movl	%r13d, %eax
	sarl	$3, %eax
	andl	$1, %eax
	imulq	$200100, %rax, %rax
	leaq	60030(%rbx,%rax), %rax
	movq	%rax, 24+a(%rip)
	cmpl	$4, %ebp
	je	.L16
	movl	%r13d, %eax
	sarl	$4, %eax
	andl	$1, %eax
	imulq	$200100, %rax, %rax
	leaq	80040(%rbx,%rax), %rax
	movq	%rax, 32+a(%rip)
	cmpl	$5, %ebp
	je	.L16
	movl	%r13d, %eax
	sarl	$5, %eax
	andl	$1, %eax
	imulq	$200100, %rax, %rax
	leaq	100050(%rbx,%rax), %rax
	movq	%rax, 40+a(%rip)
	cmpl	$6, %ebp
	je	.L16
	movl	%r13d, %eax
	sarl	$6, %eax
	andl	$1, %eax
	imulq	$200100, %rax, %rax
	leaq	120060(%rbx,%rax), %rax
	movq	%rax, 48+a(%rip)
	cmpl	$7, %ebp
	je	.L16
	movl	%r13d, %eax
	sarl	$7, %eax
	andl	$1, %eax
	imulq	$200100, %rax, %rax
	leaq	140070(%rbx,%rax), %rax
	movq	%rax, 56+a(%rip)
	cmpl	$8, %ebp
	je	.L16
	movl	%r13d, %eax
	sarl	$8, %eax
	andl	$1, %eax
	imulq	$200100, %rax, %rax
	leaq	160080(%rbx,%rax), %rax
	movq	%rax, 64+a(%rip)
	cmpl	$9, %ebp
	je	.L16
	movl	%r13d, %eax
	sarl	$9, %eax
	andl	$1, %eax
	imulq	$200100, %rax, %rax
	leaq	180090(%rbx,%rax), %rax
	movq	%rax, 72+a(%rip)
.L16:
	movl	56(%rsp), %eax
	testl	%eax, %eax
	jle	.L29
	movq	48+a(%rip), %rcx
	movq	40+a(%rip), %rax
	xorl	%edx, %edx
	movl	%r13d, 48(%rsp)
	movq	a(%rip), %r9
	movq	8+a(%rip), %r10
	movq	%rcx, 8(%rsp)
	movq	56+a(%rip), %rcx
	movq	%rax, %r13
	movq	16+a(%rip), %r11
	movq	24+a(%rip), %rbx
	movq	%rcx, 16(%rsp)
	movq	64+a(%rip), %rcx
	movq	32+a(%rip), %r12
	movq	%rcx, 24(%rsp)
	movq	72+a(%rip), %rcx
	movq	%rcx, 32(%rsp)
	xorl	%ecx, %ecx
	jmp	.L18
	.p2align 4,,10
	.p2align 3
.L95:
	movq	%rax, %rdx
.L18:
	testl	%ebp, %ebp
	jle	.L21
	movsbl	(%r9,%rdx), %eax
	cmpl	$1, %ebp
	je	.L19
	movsbl	(%r10,%rdx), %esi
	addl	%esi, %eax
	cmpl	$2, %ebp
	je	.L19
	movsbl	(%r11,%rdx), %esi
	addl	%esi, %eax
	cmpl	$3, %ebp
	je	.L19
	movsbl	(%rbx,%rdx), %esi
	addl	%esi, %eax
	cmpl	$4, %ebp
	je	.L19
	movsbl	(%r12,%rdx), %esi
	addl	%esi, %eax
	cmpl	$5, %ebp
	je	.L19
	movsbl	0(%r13,%rdx), %esi
	addl	%esi, %eax
	cmpl	$6, %ebp
	je	.L19
	movq	8(%rsp), %rdi
	movsbl	(%rdi,%rdx), %esi
	addl	%esi, %eax
	cmpl	$7, %ebp
	je	.L19
	movq	16(%rsp), %rdi
	movsbl	(%rdi,%rdx), %esi
	addl	%esi, %eax
	cmpl	$8, %ebp
	je	.L19
	movq	24(%rsp), %rdi
	movsbl	(%rdi,%rdx), %esi
	addl	%esi, %eax
	cmpl	$9, %ebp
	je	.L19
	movq	32(%rsp), %rdi
	movsbl	(%rdi,%rdx), %esi
	addl	%esi, %eax
.L19:
	movl	%ebp, %esi
	leal	(%rax,%rax), %r8d
	leal	(%rcx,%rax), %edi
	subl	%eax, %esi
	addl	%ecx, %esi
	cmpl	%ebp, %r8d
	movl	%edi, %ecx
	cmovl	%esi, %ecx
.L21:
	leaq	1(%rdx), %rax
	cmpq	%rdx, %r14
	jne	.L95
	movl	48(%rsp), %r13d
.L17:
	movl	40(%rsp), %eax
	cmpl	%ecx, %eax
	cmovge	%eax, %ecx
	addl	$1, %r13d
	movl	%ecx, 40(%rsp)
	cmpl	%r13d, 60(%rsp)
	jne	.L6
.L7:
	movl	40(%rsp), %edx
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L2
.L29:
	xorl	%ecx, %ecx
	jmp	.L17
.L28:
	leaq	buf(%rip), %rcx
	xorl	%eax, %eax
	jmp	.L11
.L24:
	addq	$72, %rsp
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE39:
	.size	main, .-main
	.globl	buf
	.bss
	.align 32
	.type	buf, @object
	.size	buf, 20010
buf:
	.zero	20010
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 80
a:
	.zero	80
	.globl	b
	.align 32
	.type	b, @object
	.size	b, 400200
b:
	.zero	400200
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC0:
	.value	255
	.value	255
	.value	255
	.value	255
	.value	255
	.value	255
	.value	255
	.value	255
	.align 16
.LC1:
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.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 0525: Osenbei
// 2017.11.12 bal4u@uu

#include <stdio.h>
#include <stdlib.h>
#define TM 0
#if TM
#include <time.h>
#endif

char b[2][10][20010], *a[10];
char buf[20010];

int main()
{
	int r, c, i, j, k, s, lim, cnt, ans;
	char *p;
#if TM
	clock_t start, finish;
	start = clock();
#endif
	while (fgets(p=buf, 20, stdin) && *p != '0') {
		r = atoi(p); while (*p >= '0') p++;
		c = atoi(p);
		for (j = 0; j < r; j++) {
			fgets(p=buf, 20010, stdin);
			for (i = 0; i < c; i++, p+=2) {
				b[1][j][i] =    *p  & 1;
				b[0][j][i] = (1+*p) & 1;
			}
		}

		ans = 0;
		for (lim = 1 << r, k = 0; k < lim; k++) {
			for (j = 0; j < r; j++) a[j] = b[(k>>j)&1][j];
			cnt = 0; for (i = 0; i < c; i++) {
				s = 0; for (j = 0; j < r; j++) s += a[j][i];
				cnt += ((s<<1) < r) ? r-s : s;
			}
			if (cnt > ans) ans = cnt;
		}
		printf("%d\n", ans);
	}
#if TM
	finish = clock();
	printf("time %lf\n", (double)(finish-start)/CLOCKS_PER_SEC);
#endif
	return 0;
}
2 5
0 1 0 1 0
1 0 0 0 1
3 6
1 0 1 0 1 0
1 1 1 0 1 0
1 0 1 1 0 1
0 0
 2 5
0 1 1 1 0
1 0 0 0 1
3 6
1 0 0 0 1 0
1 1 1 0 1 0
1 0 1 1 0 1
0 0
 2 5
0 1 0 1 0
1 0 0 0 1
3 6
1 0 0 0 1 1
1 1 1 0 1 0
1 0 1 1 0 1
0 0
 2 5
1 1 1 1 0
1 0 0 1 1
3 6
1 0 0 0 1 0
0 1 1 0 1 0
1 0 1 1 0 1
0 0
 2 5
0 1 0 1 0
1 0 0 0 1
3 6
1 0 1 0 1 0
1 1 1 0 1 0
1 0 1 0 0 0
0 0
 2 5
0 1 0 1 0
1 0 0 0 1
3 6
1 0 1 0 1 0
1 0 1 0 1 0
1 0 1 0 0 0
0 0
 2 5
0 1 1 1 0
0 0 0 1 1
3 6
1 1 0 0 1 0
0 0 1 0 1 0
1 0 1 0 0 1
0 0
 2 5
1 1 1 1 0
0 0 0 0 1
3 6
1 0 0 0 0 1
0 1 1 0 1 0
1 0 1 1 0 1
0 0
 2 5
1 1 1 1 0
1 0 1 0 1
3 6
1 0 0 0 0 1
0 1 1 0 1 0
1 0 1 1 0 1
0 0
 2 5
1 1 1 1 0
0 0 0 0 1
3 6
1 0 0 0 1 0
0 1 1 0 1 1
1 0 1 1 0 1
0 0

9
15
 10
15
 9
14
 8
15
 9
16
 9
17
 8
14
 10
16
 8
16
 10
14

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

```c
// AOJ 0525: Osenbei
// 2017.11.12 bal4u@uu

#include <stdio.h>
#include <stdlib.h>
#define TM 0
#if TM
#include <time.h>
#endif

char b[2][10][20010], *a[10];
char buf[20010];

int main()
{
	int r, c, i, j, k, s, lim, cnt, ans;
	char *p;
#if TM
	clock_t start, finish;
	start = clock();
#endif
	while (fgets(p=buf, 20, stdin) && *p != '0') {
		r = atoi(p); while (*p >= '0') p++;
		c = atoi(p);
		for (j = 0; j < r; j++) {
			fgets(p=buf, 20010, stdin);
			for (i = 0; i < c; i++, p+=2) {
				b[1][j][i] =    *p  & 1;
				b[0][j][i] = (1+*p) & 1;
			}
		}

		ans = 0;
		for (lim = 1 << r, k = 0; k < lim; k++) {
			for (j = 0; j < r; j++) a[j] = b[(k>>j)&1][j];
			cnt = 0; for (i = 0; i < c; i++) {
				s = 0; for (j = 0; j < r; j++) s += a[j][i];
				cnt += ((s<<1) < r) ? r-s : s;
			}
			if (cnt > ans) ans = cnt;
		}
		printf("%d\n", ans);
	}
#if TM
	finish = clock();
	printf("time %lf\n", (double)(finish-start)/CLOCKS_PER_SEC);
#endif
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	b
	.bss
	.align 32
	.type	b, @object
	.size	b, 400200
b:
	.zero	400200
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 80
a:
	.zero	80
	.globl	buf
	.align 32
	.type	buf, @object
	.size	buf, 20010
buf:
	.zero	20010
	.section	.rodata
.LC0:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$48, %rsp
	jmp	.L2
.L21:
	movq	-8(%rbp), %rax
	movq	%rax, %rdi
	call	atoi@PLT
	movl	%eax, -20(%rbp)
	jmp	.L3
.L4:
	addq	$1, -8(%rbp)
.L3:
	movq	-8(%rbp), %rax
	movzbl	(%rax), %eax
	cmpb	$47, %al
	jg	.L4
	movq	-8(%rbp), %rax
	movq	%rax, %rdi
	call	atoi@PLT
	movl	%eax, -16(%rbp)
	movl	$0, -40(%rbp)
	jmp	.L5
.L8:
	movq	stdin(%rip), %rdx
	leaq	buf(%rip), %rax
	movq	%rax, -8(%rbp)
	movq	-8(%rbp), %rax
	movl	$20010, %esi
	movq	%rax, %rdi
	call	fgets@PLT
	movl	$0, -44(%rbp)
	jmp	.L6
.L7:
	movq	-8(%rbp), %rax
	movzbl	(%rax), %eax
	andl	$1, %eax
	movl	%eax, %edx
	movl	-44(%rbp), %eax
	movslq	%eax, %rcx
	movl	-40(%rbp), %eax
	cltq
	imulq	$20010, %rax, %rax
	addq	%rax, %rcx
	leaq	200100+b(%rip), %rax
	addq	%rcx, %rax
	movb	%dl, (%rax)
	movq	-8(%rbp), %rax
	movzbl	(%rax), %eax
	addl	$1, %eax
	andl	$1, %eax
	movl	%eax, %edx
	movl	-44(%rbp), %eax
	movslq	%eax, %rcx
	movl	-40(%rbp), %eax
	cltq
	imulq	$20010, %rax, %rax
	addq	%rax, %rcx
	leaq	b(%rip), %rax
	addq	%rcx, %rax
	movb	%dl, (%rax)
	addl	$1, -44(%rbp)
	addq	$2, -8(%rbp)
.L6:
	movl	-44(%rbp), %eax
	cmpl	-16(%rbp), %eax
	jl	.L7
	addl	$1, -40(%rbp)
.L5:
	movl	-40(%rbp), %eax
	cmpl	-20(%rbp), %eax
	jl	.L8
	movl	$0, -24(%rbp)
	movl	-20(%rbp), %eax
	movl	$1, %edx
	movl	%eax, %ecx
	sall	%cl, %edx
	movl	%edx, %eax
	movl	%eax, -12(%rbp)
	movl	$0, -36(%rbp)
	jmp	.L9
.L19:
	movl	$0, -40(%rbp)
	jmp	.L10
.L11:
	movl	-40(%rbp), %eax
	movl	-36(%rbp), %edx
	movl	%eax, %ecx
	sarl	%cl, %edx
	movl	%edx, %eax
	andl	$1, %eax
	movl	%eax, %edx
	movl	-40(%rbp), %eax
	cltq
	imulq	$20010, %rax, %rcx
	movslq	%edx, %rax
	imulq	$200100, %rax, %rax
	leaq	(%rcx,%rax), %rdx
	leaq	b(%rip), %rax
	leaq	(%rdx,%rax), %rcx
	movl	-40(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movq	%rcx, (%rdx,%rax)
	addl	$1, -40(%rbp)
.L10:
	movl	-40(%rbp), %eax
	cmpl	-20(%rbp), %eax
	jl	.L11
	movl	$0, -28(%rbp)
	movl	$0, -44(%rbp)
	jmp	.L12
.L17:
	movl	$0, -32(%rbp)
	movl	$0, -40(%rbp)
	jmp	.L13
.L14:
	movl	-40(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movl	-44(%rbp), %eax
	cltq
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	addl	%eax, -32(%rbp)
	addl	$1, -40(%rbp)
.L13:
	movl	-40(%rbp), %eax
	cmpl	-20(%rbp), %eax
	jl	.L14
	movl	-32(%rbp), %eax
	addl	%eax, %eax
	cmpl	%eax, -20(%rbp)
	jle	.L15
	movl	-20(%rbp), %eax
	subl	-32(%rbp), %eax
	jmp	.L16
.L15:
	movl	-32(%rbp), %eax
.L16:
	addl	%eax, -28(%rbp)
	addl	$1, -44(%rbp)
.L12:
	movl	-44(%rbp), %eax
	cmpl	-16(%rbp), %eax
	jl	.L17
	movl	-28(%rbp), %eax
	cmpl	-24(%rbp), %eax
	jle	.L18
	movl	-28(%rbp), %eax
	movl	%eax, -24(%rbp)
.L18:
	addl	$1, -36(%rbp)
.L9:
	movl	-36(%rbp), %eax
	cmpl	-12(%rbp), %eax
	jl	.L19
	movl	-24(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L2:
	movq	stdin(%rip), %rdx
	leaq	buf(%rip), %rax
	movq	%rax, -8(%rbp)
	movq	-8(%rbp), %rax
	movl	$20, %esi
	movq	%rax, %rdi
	call	fgets@PLT
	testq	%rax, %rax
	je	.L20
	movq	-8(%rbp), %rax
	movzbl	(%rax), %eax
	cmpb	$48, %al
	jne	.L21
.L20:
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.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	b
	.bss
	.align 32
	.type	b, @object
	.size	b, 400200
b:
	.zero	400200
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 80
a:
	.zero	80
	.globl	buf
	.align 32
	.type	buf, @object
	.size	buf, 20010
buf:
	.zero	20010
	.section	.rodata
.LC0:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$48, %rsp
	jmp	.L2
.L21:
	movq	-8(%rbp), %rax
	movq	%rax, %rdi
	call	atoi@PLT
	movl	%eax, -20(%rbp)
	jmp	.L3
.L4:
	addq	$1, -8(%rbp)
.L3:
	movq	-8(%rbp), %rax
	movzbl	(%rax), %eax
	cmpb	$47, %al
	jg	.L4
	movq	-8(%rbp), %rax
	movq	%rax, %rdi
	call	atoi@PLT
	movl	%eax, -16(%rbp)
	movl	$0, -40(%rbp)
	jmp	.L5
.L8:
	movq	stdin(%rip), %rdx
	leaq	buf(%rip), %rax
	movq	%rax, -8(%rbp)
	movq	-8(%rbp), %rax
	movl	$20010, %esi
	movq	%rax, %rdi
	call	fgets@PLT
	movl	$0, -44(%rbp)
	jmp	.L6
.L7:
	movq	-8(%rbp), %rax
	movzbl	(%rax), %eax
	andl	$1, %eax
	movl	%eax, %edx
	movl	-44(%rbp), %eax
	movslq	%eax, %rcx
	movl	-40(%rbp), %eax
	cltq
	imulq	$20010, %rax, %rax
	addq	%rax, %rcx
	leaq	200100+b(%rip), %rax
	addq	%rcx, %rax
	movb	%dl, (%rax)
	movq	-8(%rbp), %rax
	movzbl	(%rax), %eax
	addl	$1, %eax
	andl	$1, %eax
	movl	%eax, %edx
	movl	-44(%rbp), %eax
	movslq	%eax, %rcx
	movl	-40(%rbp), %eax
	cltq
	imulq	$20010, %rax, %rax
	addq	%rax, %rcx
	leaq	b(%rip), %rax
	addq	%rcx, %rax
	movb	%dl, (%rax)
	addl	$1, -44(%rbp)
	addq	$2, -8(%rbp)
.L6:
	movl	-44(%rbp), %eax
	cmpl	-16(%rbp), %eax
	jl	.L7
	addl	$1, -40(%rbp)
.L5:
	movl	-40(%rbp), %eax
	cmpl	-20(%rbp), %eax
	jl	.L8
	movl	$0, -24(%rbp)
	movl	-20(%rbp), %eax
	movl	$1, %edx
	movl	%eax, %ecx
	sall	%cl, %edx
	movl	%edx, %eax
	movl	%eax, -12(%rbp)
	movl	$0, -36(%rbp)
	jmp	.L9
.L19:
	movl	$0, -40(%rbp)
	jmp	.L10
.L11:
	movl	-40(%rbp), %eax
	movl	-36(%rbp), %edx
	movl	%eax, %ecx
	sarl	%cl, %edx
	movl	%edx, %eax
	andl	$1, %eax
	movl	%eax, %edx
	movl	-40(%rbp), %eax
	cltq
	imulq	$20010, %rax, %rcx
	movslq	%edx, %rax
	imulq	$200100, %rax, %rax
	leaq	(%rcx,%rax), %rdx
	leaq	b(%rip), %rax
	leaq	(%rdx,%rax), %rcx
	movl	-40(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movq	%rcx, (%rdx,%rax)
	addl	$1, -40(%rbp)
.L10:
	movl	-40(%rbp), %eax
	cmpl	-20(%rbp), %eax
	jl	.L11
	movl	$0, -28(%rbp)
	movl	$0, -44(%rbp)
	jmp	.L12
.L17:
	movl	$0, -32(%rbp)
	movl	$0, -40(%rbp)
	jmp	.L13
.L14:
	movl	-40(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movl	-44(%rbp), %eax
	cltq
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	addl	%eax, -32(%rbp)
	addl	$1, -40(%rbp)
.L13:
	movl	-40(%rbp), %eax
	cmpl	-20(%rbp), %eax
	jl	.L14
	movl	-32(%rbp), %eax
	addl	%eax, %eax
	cmpl	%eax, -20(%rbp)
	jle	.L15
	movl	-20(%rbp), %eax
	subl	-32(%rbp), %eax
	jmp	.L16
.L15:
	movl	-32(%rbp), %eax
.L16:
	addl	%eax, -28(%rbp)
	addl	$1, -44(%rbp)
.L12:
	movl	-44(%rbp), %eax
	cmpl	-16(%rbp), %eax
	jl	.L17
	movl	-28(%rbp), %eax
	cmpl	-24(%rbp), %eax
	jle	.L18
	movl	-28(%rbp), %eax
	movl	%eax, -24(%rbp)
.L18:
	addl	$1, -36(%rbp)
.L9:
	movl	-36(%rbp), %eax
	cmpl	-12(%rbp), %eax
	jl	.L19
	movl	-24(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L2:
	movq	stdin(%rip), %rdx
	leaq	buf(%rip), %rax
	movq	%rax, -8(%rbp)
	movq	-8(%rbp), %rax
	movl	$20, %esi
	movq	%rax, %rdi
	call	fgets@PLT
	testq	%rax, %rax
	je	.L20
	movq	-8(%rbp), %rax
	movzbl	(%rax), %eax
	cmpb	$48, %al
	jne	.L21
.L20:
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.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:
