// File: kmyk[P]topcoder-marathon-match-100-same-color-pairs/./SameColorPairs.cpp
// Function: with_crop(int, int, int, std::vector<std::vector<int, std::allocator<int>>, std::allocator<std::vector<int, std::allocator<int>>>> const&, int, int, int, int, std::function<std::vector<std::array<int, 4ul>, std::allocator<std::array<int, 4ul>>> (int, int, int, std::vector<std::vector<int, std::allocator<int>>, std::allocator<std::vector<int, std::allocator<int>>>> const&)>)
vector<array<int, 4> > with_crop(int H, int W, int C, vector<vector<int> > const & original_board, int ly, int lx, int ry, int rx, function<vector<array<int, 4> > (int, int, int, vector<vector<int> > const &)> cont) {
    int h = ry - ly;
    int w = rx - lx;
    vector<vector<int> > board(h, vector<int>(w));
    REP (y, h) REP (x, w) {
        board[y][x] = original_board[ly + y][lx + x];
    }
    vector<array<int, 4> > rects = cont(h, w, C, board);
    for (auto & rect : rects) {
        rect[0] += ly;
        rect[1] += lx;
        rect[2] += ly;
        rect[3] += lx;
    }
    return rects;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x100, %rsp            # imm = 0x100
movq %rdi, -0xd8(%rbp)
movq %rdi, %rax
movq %rax, -0xd0(%rbp)
movq 0x28(%rbp), %rax
movq %rax, -0xc8(%rbp)
movl 0x20(%rbp), %eax
movl 0x18(%rbp), %eax
movl 0x10(%rbp), %eax
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movl %ecx, -0x14(%rbp)
movq %r8, -0x20(%rbp)
movl %r9d, -0x24(%rbp)
movl 0x18(%rbp), %eax
movl -0x24(%rbp), %ecx
subl %ecx, %eax
movl %eax, -0x28(%rbp)
movl 0x20(%rbp), %eax
movl 0x10(%rbp), %ecx
subl %ecx, %eax
movl %eax, -0x2c(%rbp)
movslq -0x28(%rbp), %rax
movq %rax, -0xc0(%rbp)
movslq -0x2c(%rbp), %rax
movq %rax, -0xb8(%rbp)
leaq -0x61(%rbp), %rdi
movq %rdi, -0xb0(%rbp)
callq 0x6d30
movq -0xb8(%rbp), %rsi
movq -0xb0(%rbp), %rdx
leaq -0x60(%rbp), %rdi
callq 0x6d50
jmp 0x319a
leaq -0x75(%rbp), %rdi
movq %rdi, -0xe0(%rbp)
callq 0x6dc0
movq -0xc0(%rbp), %rsi
movq -0xe0(%rbp), %rcx
leaq -0x48(%rbp), %rdi
leaq -0x60(%rbp), %rdx
callq 0x6de0
jmp 0x31c7
leaq -0x75(%rbp), %rdi
callq 0x6e60
leaq -0x60(%rbp), %rdi
callq 0x6e80
leaq -0x61(%rbp), %rdi
callq 0x6ee0
movl $0x0, -0x7c(%rbp)
movl -0x7c(%rbp), %eax
cmpl -0x28(%rbp), %eax
jge 0x32a9
movl $0x0, -0x80(%rbp)
movl -0x80(%rbp), %eax
cmpl -0x2c(%rbp), %eax
jge 0x3299
movq -0x20(%rbp), %rdi
movl -0x24(%rbp), %eax
addl -0x7c(%rbp), %eax
movslq %eax, %rsi
callq 0x6b60
movq %rax, %rdi
movl 0x10(%rbp), %eax
addl -0x80(%rbp), %eax
movslq %eax, %rsi
callq 0x6b80
movl (%rax), %eax
movl %eax, -0xe4(%rbp)
movslq -0x7c(%rbp), %rsi
leaq -0x48(%rbp), %rdi
callq 0x6f20
movq %rax, %rdi
movslq -0x80(%rbp), %rsi
callq 0x6f00
movl -0xe4(%rbp), %ecx
movl %ecx, (%rax)
movl -0x80(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x80(%rbp)
jmp 0x31fc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0x328b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0x75(%rbp), %rdi
callq 0x6e60
leaq -0x60(%rbp), %rdi
callq 0x6e80
leaq -0x61(%rbp), %rdi
callq 0x6ee0
jmp 0x3422
jmp 0x329b
movl -0x7c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x7c(%rbp)
jmp 0x31e9
movq -0xc8(%rbp), %rsi
movq -0xd8(%rbp), %rdi
movb $0x0, -0x81(%rbp)
movl -0x28(%rbp), %edx
movl -0x2c(%rbp), %ecx
movl -0x14(%rbp), %r8d
leaq -0x48(%rbp), %r9
callq 0x6f40
jmp 0x32d3
movq -0xd8(%rbp), %rax
movq %rax, -0x90(%rbp)
movq -0x90(%rbp), %rdi
callq 0x6fb0
movq %rax, -0x98(%rbp)
movq -0x90(%rbp), %rdi
callq 0x6fe0
movq %rax, -0xa0(%rbp)
leaq -0x98(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x7010
testb $0x1, %al
jne 0x3323
jmp 0x33ed
leaq -0x98(%rbp), %rdi
callq 0x7050
movq %rax, -0xa8(%rbp)
movl -0x24(%rbp), %eax
movl %eax, -0xf4(%rbp)
movq -0xa8(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x7070
movl -0xf4(%rbp), %ecx
addl (%rax), %ecx
movl %ecx, (%rax)
movl 0x10(%rbp), %eax
movl %eax, -0xf0(%rbp)
movq -0xa8(%rbp), %rdi
movl $0x1, %esi
callq 0x7070
movl -0xf0(%rbp), %ecx
addl (%rax), %ecx
movl %ecx, (%rax)
movl -0x24(%rbp), %eax
movl %eax, -0xec(%rbp)
movq -0xa8(%rbp), %rdi
movl $0x2, %esi
callq 0x7070
movl -0xec(%rbp), %ecx
addl (%rax), %ecx
movl %ecx, (%rax)
movl 0x10(%rbp), %eax
movl %eax, -0xe8(%rbp)
movq -0xa8(%rbp), %rdi
movl $0x3, %esi
callq 0x7070
movl -0xe8(%rbp), %ecx
addl (%rax), %ecx
movl %ecx, (%rax)
leaq -0x98(%rbp), %rdi
callq 0x70a0
jmp 0x3307
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x7120
jmp 0x3422
movb $0x1, -0x81(%rbp)
testb $0x1, -0x81(%rbp)
jne 0x3409
movq -0xd8(%rbp), %rdi
callq 0x70c0
leaq -0x48(%rbp), %rdi
callq 0x7120
movq -0xd0(%rbp), %rax
addq $0x100, %rsp            # imm = 0x100
popq %rbp
retq
movq -0x70(%rbp), %rdi
callq 0x2340
nopl (%rax,%rax)