// File: kmyk[P]topcoder-marathon-match-100-same-color-pairs/./SameColorPairs.cpp
// Function: with_transpose(int, int, int, std::vector<std::vector<int, std::allocator<int>>, std::allocator<std::vector<int, std::allocator<int>>>> const&, 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_transpose(int H, int W, int C, vector<vector<int> > const & original_board, function<vector<array<int, 4> > (int, int, int, vector<vector<int> > const &)> cont) {
    vector<vector<int> > board(W, vector<int>(H));
    REP (x, W) REP (y, H) {
        board[x][y] = original_board[y][x];
        if (board[x][y] < 0) board[x][y] = -1;
    }
    vector<array<int, 4> > rects = cont(W, H, C, board);
    for (auto & rect : rects) {
        swap(rect[0], rect[1]);
        swap(rect[2], rect[3]);
    }
    return rects;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xf0, %rsp
movq %r9, -0xd0(%rbp)
movq %rdi, -0xc8(%rbp)
movq %rdi, %rax
movq %rax, -0xc0(%rbp)
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movl %ecx, -0x14(%rbp)
movq %r8, -0x20(%rbp)
movq %r9, -0x28(%rbp)
movslq -0x10(%rbp), %rax
movq %rax, -0xb8(%rbp)
movslq -0xc(%rbp), %rax
movq %rax, -0xb0(%rbp)
leaq -0x59(%rbp), %rdi
movq %rdi, -0xa8(%rbp)
callq 0x6d30
movq -0xb0(%rbp), %rsi
movq -0xa8(%rbp), %rdx
leaq -0x58(%rbp), %rdi
callq 0x6d50
jmp 0x2d67
leaq -0x6d(%rbp), %rdi
movq %rdi, -0xd8(%rbp)
callq 0x6dc0
movq -0xb8(%rbp), %rsi
movq -0xd8(%rbp), %rcx
leaq -0x40(%rbp), %rdi
leaq -0x58(%rbp), %rdx
callq 0x6de0
jmp 0x2d94
leaq -0x6d(%rbp), %rdi
callq 0x6e60
leaq -0x58(%rbp), %rdi
callq 0x6e80
leaq -0x59(%rbp), %rdi
callq 0x6ee0
movl $0x0, -0x74(%rbp)
movl -0x74(%rbp), %eax
cmpl -0x10(%rbp), %eax
jge 0x2eb0
movl $0x0, -0x78(%rbp)
movl -0x78(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0x2ea0
movq -0x20(%rbp), %rdi
movslq -0x78(%rbp), %rsi
callq 0x6b60
movq %rax, %rdi
movslq -0x74(%rbp), %rsi
callq 0x6b80
movl (%rax), %eax
movl %eax, -0xdc(%rbp)
movslq -0x74(%rbp), %rsi
leaq -0x40(%rbp), %rdi
callq 0x6f20
movq %rax, %rdi
movslq -0x78(%rbp), %rsi
callq 0x6f00
movl -0xdc(%rbp), %ecx
movl %ecx, (%rax)
movslq -0x74(%rbp), %rsi
leaq -0x40(%rbp), %rdi
callq 0x6f20
movq %rax, %rdi
movslq -0x78(%rbp), %rsi
callq 0x6f00
cmpl $0x0, (%rax)
jge 0x2e90
movslq -0x74(%rbp), %rsi
leaq -0x40(%rbp), %rdi
callq 0x6f20
movq %rax, %rdi
movslq -0x78(%rbp), %rsi
callq 0x6f00
movl $0xffffffff, (%rax)     # imm = 0xFFFFFFFF
jmp 0x2e90
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0x2e82
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0x6d(%rbp), %rdi
callq 0x6e60
leaq -0x58(%rbp), %rdi
callq 0x6e80
leaq -0x59(%rbp), %rdi
callq 0x6ee0
jmp 0x3000
jmp 0x2e92
movl -0x78(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x78(%rbp)
jmp 0x2dc9
jmp 0x2ea2
movl -0x74(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x74(%rbp)
jmp 0x2db6
movq -0xd0(%rbp), %rsi
movq -0xc8(%rbp), %rdi
movb $0x0, -0x79(%rbp)
movl -0x10(%rbp), %edx
movl -0xc(%rbp), %ecx
movl -0x14(%rbp), %r8d
leaq -0x40(%rbp), %r9
callq 0x6f40
jmp 0x2ed7
movq -0xc8(%rbp), %rax
movq %rax, -0x88(%rbp)
movq -0x88(%rbp), %rdi
callq 0x6fb0
movq %rax, -0x90(%rbp)
movq -0x88(%rbp), %rdi
callq 0x6fe0
movq %rax, -0x98(%rbp)
leaq -0x90(%rbp), %rdi
leaq -0x98(%rbp), %rsi
callq 0x7010
testb $0x1, %al
jne 0x2f27
jmp 0x2fd1
leaq -0x90(%rbp), %rdi
callq 0x7050
movq %rax, -0xa0(%rbp)
movq -0xa0(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x7070
movq %rax, -0xf0(%rbp)
movq -0xa0(%rbp), %rdi
movl $0x1, %esi
callq 0x7070
movq -0xf0(%rbp), %rdi
movq %rax, %rsi
callq 0x71a0
movq -0xa0(%rbp), %rdi
movl $0x2, %esi
callq 0x7070
movq %rax, -0xe8(%rbp)
movq -0xa0(%rbp), %rdi
movl $0x3, %esi
callq 0x7070
movq -0xe8(%rbp), %rdi
movq %rax, %rsi
callq 0x71a0
leaq -0x90(%rbp), %rdi
callq 0x70a0
jmp 0x2f0b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x7120
jmp 0x3000
movb $0x1, -0x79(%rbp)
testb $0x1, -0x79(%rbp)
jne 0x2fe7
movq -0xc8(%rbp), %rdi
callq 0x70c0
leaq -0x40(%rbp), %rdi
callq 0x7120
movq -0xc0(%rbp), %rax
addq $0xf0, %rsp
popq %rbp
retq
movq -0x68(%rbp), %rdi
callq 0x2340
nopl (%rax)