// File: /workspace/github_cpp_makefile_star2_O2/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 $0x188, %rsp            # imm = 0x188
movq %rdi, %rbx
leaq 0x78(%rsp), %rdi
movq %rsi, 0x28(%rsp)
callq 0x3fa6
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
movq %rbx, 0x10(%rsp)
andq $0x0, 0x10(%rbx)
xorl %edx, %edx
leaq 0xe8(%rsp), %rbp
leaq 0xd0(%rsp), %r15
leaq 0xa0(%rsp), %r12
cmpq $0xa, %rdx
je 0x2d7e
movl 0x78(%rsp,%rdx,4), %r14d
movq %rdx, %rax
shlq $0x4, %rax
movq 0x28(%rsp), %rcx
leaq (%rcx,%rax), %rbx
addq %rcx, %rax
addq $-0x10, %rax
movq %rax, 0x38(%rsp)
leaq 0x1(%rdx), %rax
movq %rax, 0x18(%rsp)
shlq $0x4, %rax
addq %rcx, %rax
movq %rax, 0x30(%rsp)
movq %rdx, 0x20(%rsp)
shlq $0x20, %rdx
movq %rdx, 0x48(%rsp)
movq %rbx, 0x40(%rsp)
movq %r14, %rax
decq %r14
testl %eax, %eax
jle 0x2d74
movzbl (%rbx,%r14), %ecx
testl %ecx, %ecx
je 0x2c07
cmpl $0xb, %ecx
je 0x2c07
cmpq $0xf, %rax
ja 0x2c64
cmpq $0x0, 0x20(%rsp)
je 0x2c4f
movq 0x38(%rsp), %rcx
cmpb $0x0, (%rcx,%rax)
je 0x2c64
cmpb $0x0, (%rbx,%rax)
je 0x2c64
cmpq $0x9, 0x20(%rsp)
jne 0x2c55
jmp 0x2d74
cmpb $0x0, (%rbx,%rax)
je 0x2c64
movq 0x30(%rsp), %rcx
cmpb $0x0, (%rcx,%rax)
jne 0x2d74
movl $0xa0, %edx
movq %rbp, %rdi
movq 0x28(%rsp), %rsi
callq 0x2130
movq 0x98(%rsp), %rax
movq %rax, 0x70(%rsp)
movups 0x78(%rsp), %xmm0
movups 0x88(%rsp), %xmm1
movaps %xmm1, 0x60(%rsp)
movaps %xmm0, 0x50(%rsp)
movq 0x48(%rsp), %rax
orq %r14, %rax
movq %rax, 0xa0(%rsp)
movq %r15, %rdi
movq %r12, %rsi
pushq $0x1
popq %rdx
leaq 0xc(%rsp), %rcx
callq 0x4150
movq %r12, %rdi
movq %rbp, %rsi
leaq 0x50(%rsp), %rbp
movq %rbp, %rdx
movq %r15, %rcx
callq 0x4186
movq %r15, %rdi
movq %r12, %rsi
callq 0xbe7e
movq %r12, %rbx
movq %r12, %rdi
callq 0xa6ce
leaq 0xb8(%rsp), %r12
movq %r12, %rdi
movq %r15, %r13
movq %r15, %rsi
callq 0x4102
leaq 0xe8(%rsp), %rdi
movq %rbp, %rsi
movq %r12, %rdx
pushq $0x1
popq %rcx
callq 0x42ac
movq %rax, 0xa0(%rsp)
movq %r12, %rdi
callq 0xa6ce
xorl %eax, %eax
xorl %ecx, %ecx
cmpq $0xa, %rax
je 0x2d3e
movl 0x78(%rsp,%rax,4), %edx
subl 0x50(%rsp,%rax,4), %edx
addl %edx, %ecx
incq %rax
jmp 0x2d29
movl %ecx, 0xc(%rsp)
movq 0x10(%rsp), %rdi
movq %rbx, %rsi
leaq 0xc(%rsp), %rdx
callq 0x43d8
movq %r13, %rdi
callq 0xa6ce
leaq 0xe8(%rsp), %rbp
movq %r13, %r15
movq %rbx, %r12
movq 0x40(%rsp), %rbx
jmp 0x2c07
movq 0x18(%rsp), %rdx
jmp 0x2bb4
movq 0x10(%rsp), %rdi
movq (%rdi), %rax
cmpq 0x8(%rdi), %rax
jne 0x2daa
leaq 0xe8(%rsp), %rsi
andq $0x0, (%rsi)
leaq 0x50(%rsp), %rdx
andl $0x0, (%rdx)
callq 0x4418
movq 0x10(%rsp), %rdi
movq %rdi, %rax
addq $0x188, %rsp            # imm = 0x188
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x2dd7
movq %rax, %rbx
leaq 0xb8(%rsp), %rdi
callq 0xa6ce
jmp 0x2ddf
jmp 0x2ddc
jmp 0x2ddc
movq %rax, %rbx
jmp 0x2dec
movq %rax, %rbx
leaq 0xd0(%rsp), %rdi
callq 0xa6ce
movq 0x10(%rsp), %rdi
callq 0x9f22
movq %rbx, %rdi
callq 0x2250