// File: /workspace/github_cpp_makefile_star2_O3/kmyk[P]codevs-for-student-2016/Main.cpp
// Function: simulation::estimate_with_erasing_all(primitive::blocks_t<16ul, 10ul> const&)
vector<pair<result_t, int> > estimate_with_erasing_all(field_t const & field) {
        const array<int,width> height_map = make_height_map(field);
        vector<pair<result_t, int> > acc;
        repeat (x, width) {
            repeat_reverse (y, height_map[x]) {
                if (field.at[x][y] == empty_block or field.at[x][y] == obstacle_block) continue;
                bool erasable =
                    y+1 >= height
                    or (x-1 >= 0    and field.at[x-1][y+1] == empty_block)
                    or (                field.at[x  ][y+1] == empty_block)
                    or (x+1 < width and field.at[x+1][y+1] == empty_block);
                if (not erasable) break;
                field_t nfield = field;
                array<int,width> nheight_map = height_map;
                vector<point_t> modified_blocks { point(y, x) };
                modified_blocks = erase_blocks(nfield, nheight_map, modified_blocks);
                result_t result = simulate(nfield, nheight_map, modified_blocks, 1);
                int consumed = 0;
                repeat (x, width) consumed += height_map[x] - nheight_map[x];
                acc.emplace_back(result, consumed);
            }
        }
        if (acc.empty()) acc.emplace_back((result_t) { 0, 0 }, 0);
        return acc;
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x198, %rsp            # imm = 0x198
xorl %eax, %eax
movq %rsi, 0x60(%rsp)
movq %rsi, %rcx
xorl %edx, %edx
cmpb $0x0, (%rcx,%rdx)
je 0x2ddc
incq %rdx
cmpq $0x10, %rdx
jne 0x2dc8
movl $0x10, %edx
movl %edx, 0xd0(%rsp,%rax,4)
incq %rax
addq $0x10, %rcx
cmpq $0xa, %rax
jne 0x2dc6
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
movq %rdi, 0x8(%rsp)
movq $0x0, 0x10(%rdi)
movq $0x0, 0x18(%rsp)
leaq 0x40(%rsp), %r13
leaq 0x20(%rsp), %r15
movq 0x18(%rsp), %rdx
movslq 0xd0(%rsp,%rdx,4), %r12
testq %r12, %r12
jle 0x3061
movq %rdx, %rax
shlq $0x4, %rax
movq 0x60(%rsp), %rcx
leaq (%rcx,%rax), %rsi
addq %rcx, %rax
addq $-0x10, %rax
movq %rax, 0x70(%rsp)
leaq 0x1(%rdx), %rax
movq %rax, 0x58(%rsp)
shlq $0x4, %rax
addq %rcx, %rax
movq %rax, 0x68(%rsp)
shlq $0x20, %rdx
movq %rdx, 0x80(%rsp)
movq %rsi, 0x78(%rsp)
movq %r12, %rbp
decq %r12
movzbl -0x1(%rsi,%rbp), %eax
testl %eax, %eax
je 0x3050
cmpl $0xb, %eax
je 0x3050
cmpq $0xf, %rbp
ja 0x2ecb
cmpq $0x0, 0x18(%rsp)
je 0x2eb6
movq 0x70(%rsp), %rax
cmpb $0x0, (%rax,%rbp)
je 0x2ecb
cmpb $0x0, (%rsi,%rbp)
je 0x2ecb
cmpq $0x9, 0x18(%rsp)
jne 0x2ebc
jmp 0x3073
cmpb $0x0, (%rsi,%rbp)
je 0x2ecb
movq 0x68(%rsp), %rax
cmpb $0x0, (%rax,%rbp)
jne 0x305a
movl $0xa0, %edx
movq %r13, %rbx
leaq 0xf8(%rsp), %r13
movq %r13, %rdi
movq 0x60(%rsp), %rsi
callq 0x2120
movq 0xf0(%rsp), %rax
movq %rax, 0xc0(%rsp)
movups 0xd0(%rsp), %xmm0
movups 0xe0(%rsp), %xmm1
movaps %xmm1, 0xb0(%rsp)
movaps %xmm0, 0xa0(%rsp)
movq 0x80(%rsp), %rax
orq %r12, %rax
movq %rax, 0x20(%rsp)
movl $0x1, %edx
movq %rbx, %rdi
movq %r15, %rsi
leaq 0x14(%rsp), %rcx
callq 0x4970
movq %r15, %r14
movq %r15, %rdi
movq %r13, %rsi
leaq 0xa0(%rsp), %rdx
movq %rbx, %rcx
callq 0x49b5
movq %rbx, %r13
movq 0x40(%rsp), %rdi
movq 0x50(%rsp), %rsi
movaps 0x20(%rsp), %xmm0
movaps %xmm0, 0x40(%rsp)
movq 0x30(%rsp), %rax
movq %rax, 0x50(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rsp)
movq $0x0, 0x30(%rsp)
testq %rdi, %rdi
je 0x2fac
subq %rdi, %rsi
callq 0x2170
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x2fac
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x2170
leaq 0x88(%rsp), %rbx
movq %rbx, %rdi
movq %r13, %rsi
callq 0x48f0
movq %r14, %r15
leaq 0xf8(%rsp), %rdi
leaq 0xa0(%rsp), %rsi
movq %rbx, %rdx
movl $0x1, %ecx
callq 0x4af8
movq %rax, 0x20(%rsp)
movq 0x88(%rsp), %rdi
testq %rdi, %rdi
je 0x3001
movq 0x98(%rsp), %rsi
subq %rdi, %rsi
callq 0x2170
xorl %eax, %eax
xorl %ecx, %ecx
movl 0xd0(%rsp,%rax,4), %edx
subl 0xa0(%rsp,%rax,4), %edx
addl %edx, %ecx
incq %rax
cmpq $0xa, %rax
jne 0x3005
movl %ecx, 0x14(%rsp)
movq 0x8(%rsp), %rdi
movq %r15, %rsi
leaq 0x14(%rsp), %rdx
callq 0x4cb0
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x304b
movq 0x50(%rsp), %rsi
subq %rdi, %rsi
callq 0x2170
movq 0x78(%rsp), %rsi
cmpq $0x1, %rbp
jg 0x2e6e
movq 0x58(%rsp), %rdx
jmp 0x3064
incq %rdx
movq %rdx, 0x18(%rsp)
cmpq $0xa, %rdx
jne 0x2e16
movq 0x8(%rsp), %r14
movq (%r14), %rax
cmpq 0x8(%r14), %rax
jne 0x30a6
leaq 0xf8(%rsp), %rsi
movq $0x0, (%rsi)
leaq 0xa0(%rsp), %rdx
movl $0x0, (%rdx)
movq %r14, %rdi
callq 0x4cf0
movq %r14, %rax
addq $0x198, %rsp            # imm = 0x198
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x310f
movq %rax, %rbx
movq 0x8(%rsp), %r14
jmp 0x310f
jmp 0x30f0
movq %rax, %rbx
movq 0x88(%rsp), %rdi
testq %rdi, %rdi
je 0x30f3
movq 0x98(%rsp), %rsi
subq %rdi, %rsi
callq 0x2170
jmp 0x30f3
jmp 0x30f0
movq %rax, %rbx
movq 0x8(%rsp), %r14
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x310f
movq 0x50(%rsp), %rsi
subq %rdi, %rsi
callq 0x2170
movq (%r14), %rdi
testq %rdi, %rdi
je 0x3123
movq 0x10(%r14), %rsi
subq %rdi, %rsi
callq 0x2170
movq %rbx, %rdi
callq 0x2230