// File: /workspace/github_cpp_makefile_star2_O2/kmyk[P]topcoder-marathon-match-100-same-color-pairs/./SameColorPairs.cpp
// Function: SameColorPairs::removePairs(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>)
vector<string> removePairs(vector<string> a_board) {
        double clock_begin = rdtsc();

        // parse input
        int H = a_board.size();
        int W = a_board[0].size();
        vector<vector<int> > board(H, vector<int>(W));
        int C = 0;
        REP (y, H) REP (x, W) {
            board[y][x] = a_board[y][x] - '0';
            chmax(C, board[y][x] + 1);
        }

        // assertion
        assert (10 <= H and H <= 100);
        assert (10 <= W and W <= 100);
        assert (2  <= C and C <= 6);

        // debug output
        cerr << "H = " << H << endl;
        cerr << "W = " << W << endl;
        cerr << "C = " << C << endl;
#ifdef LOCAL
        REP (y, H) {
            REP (x, W) {
                cerr << board[y][x];
            }
            cerr << endl;
        }
#endif

        // solve
        vector<array<int, 4> > result = solve(H, W, C, board);

        // make output
        vector<string> answer;
        for (auto rect : result) {
            ostringstream oss;
            oss << rect[0] << ' ';
            oss << rect[1] << ' ';
            oss << rect[2] << ' ';
            oss << rect[3];
            answer.push_back(oss.str());
        }
        double t = rdtsc() - clock_begin;
        cerr << "time = " << t << endl;
        cerr << "!\t" << H << "\t" << W << "\t" << C << "\t" << (H * W - 2 * int(answer.size())) << "\t" << t << endl;
        return answer;
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x218, %rsp            # imm = 0x218
movq %rdx, %r13
movq %rdi, 0x8(%rsp)
rdtsc
movl %eax, %ebp
movl %edx, %ebx
movq (%r13), %r14
movq 0x8(%r13), %r15
movq 0x8(%r14), %rax
movq %rax, 0x10(%rsp)
movslq %eax, %rsi
leaq 0xa0(%rsp), %rdi
leaq 0x80(%rsp), %rdx
callq 0x3bba
subq %r14, %r15
shrq $0x5, %r15
movslq %r15d, %rsi
leaq 0x58(%rsp), %rdi
leaq 0xa0(%rsp), %rdx
leaq 0x40(%rsp), %rcx
callq 0x3c0c
shlq $0x20, %rbx
movl %ebp, %eax
orq %rbx, %rax
movq %rax, %xmm0
punpckldq 0x3fef(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x3ff7(%rip), %xmm0     # 0x8020
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
mulsd 0x4003(%rip), %xmm1     # 0x8040
movapd %xmm1, 0x70(%rsp)
leaq 0xa0(%rsp), %rdi
callq 0x4908
xorl %eax, %eax
movq 0x10(%rsp), %r14
testl %r14d, %r14d
movl $0x0, %ecx
cmovgl %r14d, %ecx
testl %r15d, %r15d
movl $0x0, %edx
cmovgl %r15d, %edx
xorl %r12d, %r12d
movq %r15, %rbx
cmpq %rdx, %rax
je 0x40c2
imulq $0x18, %rax, %rsi
addq 0x58(%rsp), %rsi
movq %rax, %rdi
shlq $0x5, %rdi
xorl %r8d, %r8d
cmpq %r8, %rcx
je 0x40bd
movq (%r13), %r9
movq (%r9,%rdi), %r9
movsbl (%r9,%r8), %r9d
leal -0x30(%r9), %r10d
movq (%rsi), %r11
movl %r10d, (%r11,%r8,4)
addl $-0x2f, %r9d
cmpl %r9d, %r12d
cmovgl %r12d, %r9d
incq %r8
movl %r9d, %r12d
jmp 0x408d
incq %rax
jmp 0x4075
leal -0xa(%rbx), %eax
cmpl $0x5b, %eax
jae 0x4392
leal -0xa(%r14), %eax
cmpl $0x5b, %eax
jae 0x43b1
leal -0x2(%r12), %eax
cmpl $0x5, %eax
jae 0x43d0
movq 0x8f00(%rip), %rdi      # 0xcff0
leaq 0x4272(%rip), %rsi      # 0x8369
callq 0x2190
movq %rax, %rdi
movl %ebx, %esi
callq 0x2290
movq %rax, %rdi
callq 0x20a0
movq 0x8edb(%rip), %rdi      # 0xcff0
leaq 0x4252(%rip), %rsi      # 0x836e
callq 0x2190
movq %rax, %rdi
movl %r14d, %esi
callq 0x2290
movq %rax, %rdi
callq 0x20a0
movq 0x8eb5(%rip), %rdi      # 0xcff0
leaq 0x4231(%rip), %rsi      # 0x8373
callq 0x2190
movq %rax, %rdi
movl %r12d, %esi
callq 0x2290
movq %rax, %rdi
callq 0x20a0
leaq 0x40(%rsp), %rdi
leaq 0x58(%rsp), %r8
movq %rbx, 0x18(%rsp)
movl %ebx, %esi
movl %r14d, %edx
movl %r12d, %ecx
callq 0x2cda
movq 0x8(%rsp), %rax
andq $0x0, 0x10(%rax)
xorpd %xmm0, %xmm0
movupd %xmm0, (%rax)
movq 0x40(%rsp), %rbp
movq 0x48(%rsp), %rax
movq %rax, 0x38(%rsp)
leaq 0xa0(%rsp), %r14
cmpq 0x38(%rsp), %rbp
je 0x424f
movl (%rbp), %ebx
movl 0x4(%rbp), %r15d
movl 0x8(%rbp), %r13d
movl 0xc(%rbp), %eax
movl %eax, 0x20(%rsp)
movq %r14, %rdi
callq 0x21f0
movq %r14, %rdi
movl %ebx, %esi
callq 0x2290
movq %rax, %rdi
pushq $0x20
popq %rsi
callq 0x21c0
movq %r14, %rdi
movl %r15d, %esi
callq 0x2290
movq %rax, %rdi
pushq $0x20
popq %rsi
callq 0x21c0
movq %r14, %rdi
movl %r13d, %esi
callq 0x2290
movq %rax, %rdi
pushq $0x20
popq %rsi
callq 0x21c0
movq %r14, %rdi
movl 0x20(%rsp), %esi
callq 0x2290
leaq 0x80(%rsp), %rbx
movq %rbx, %rdi
leaq 0xa8(%rsp), %rsi
callq 0x2240
movq 0x8(%rsp), %rdi
movq %rbx, %rsi
callq 0x45f8
movq %rbx, %rdi
callq 0x2090
movq %r14, %rdi
callq 0x2030
addq $0x10, %rbp
jmp 0x419f
rdtsc
movl %edx, %ebx
movl %eax, %ebp
movq 0x8d94(%rip), %rdi      # 0xcff0
leaq 0x4115(%rip), %rsi      # 0x8378
callq 0x2190
shlq $0x20, %rbx
movl %ebp, %ecx
orq %rbx, %rcx
movq %rcx, %xmm1
punpckldq 0x3d92(%rip), %xmm1 # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x3d9a(%rip), %xmm1     # 0x8020
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
mulsd 0x3da6(%rip), %xmm0     # 0x8040
subsd 0x70(%rsp), %xmm0
movq %rax, %rdi
movapd %xmm0, 0x20(%rsp)
callq 0x2250
movq %rax, %rdi
callq 0x20a0
movq 0x8d33(%rip), %rdi      # 0xcff0
leaq 0x40bc(%rip), %rsi      # 0x8380
callq 0x2190
movq %rax, %rdi
movq 0x18(%rsp), %rsi
callq 0x2290
leaq 0x40a4(%rip), %rsi      # 0x8381
movq %rax, %rdi
callq 0x2190
movq %rax, %rdi
movq 0x10(%rsp), %rsi
callq 0x2290
leaq 0x4088(%rip), %rsi      # 0x8381
movq %rax, %rdi
callq 0x2190
movq %rax, %rdi
movl %r12d, %esi
callq 0x2290
leaq 0x406e(%rip), %rsi      # 0x8381
movq %rax, %rdi
callq 0x2190
movq 0x8(%rsp), %rdx
movq 0x8(%rdx), %rcx
subq (%rdx), %rcx
movq 0x18(%rsp), %rsi
imull 0x10(%rsp), %esi
shrq $0x4, %rcx
andl $-0x2, %ecx
subl %ecx, %esi
movq %rax, %rdi
callq 0x2290
leaq 0x4038(%rip), %rsi      # 0x8381
movq %rax, %rdi
callq 0x2190
movq %rax, %rdi
movapd 0x20(%rsp), %xmm0
callq 0x2250
movq %rax, %rdi
callq 0x20a0
leaq 0x40(%rsp), %rdi
callq 0x4cd0
leaq 0x58(%rsp), %rdi
callq 0x3c9e
movq 0x8(%rsp), %rax
addq $0x218, %rsp            # imm = 0x218
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x3f59(%rip), %rdi      # 0x82f2
leaq 0x3eac(%rip), %rsi      # 0x824c
leaq 0x3f60(%rip), %rcx      # 0x8307
movl $0x259, %edx            # imm = 0x259
callq 0x20f0
leaq 0x3f8a(%rip), %rdi      # 0x8342
leaq 0x3e8d(%rip), %rsi      # 0x824c
leaq 0x3f41(%rip), %rcx      # 0x8307
movl $0x25a, %edx            # imm = 0x25A
callq 0x20f0
leaq 0x3f80(%rip), %rdi      # 0x8357
leaq 0x3e6e(%rip), %rsi      # 0x824c
leaq 0x3f22(%rip), %rcx      # 0x8307
movl $0x25b, %edx            # imm = 0x25B
callq 0x20f0
jmp 0x4408
movq %rax, %r14
leaq 0xa0(%rsp), %rdi
callq 0x4908
jmp 0x4456
movq %rax, %r14
jmp 0x4456
movq %rax, %r14
jmp 0x444c
jmp 0x4411
jmp 0x4428
movq %rax, %r14
jmp 0x4438
movq %rax, %r14
leaq 0x80(%rsp), %rdi
callq 0x2090
jmp 0x442b
movq %rax, %r14
leaq 0xa0(%rsp), %rdi
callq 0x2030
movq 0x8(%rsp), %rdi
callq 0x44b2
leaq 0x40(%rsp), %rdi
callq 0x4cd0
leaq 0x58(%rsp), %rdi
callq 0x3c9e
movq %r14, %rdi
callq 0x22a0