// File: /workspace/github_cpp_makefile_star2_O1/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
xorl %eax, %eax
movq %rsi, 0x40(%rsp)
movq %rsi, %rcx
xorl %edx, %edx
cmpb $0x0, (%rcx,%rdx)
je 0x2d80
incq %rdx
cmpq $0x10, %rdx
jne 0x2d6c
movl $0x10, %edx
movl %edx, 0xc0(%rsp,%rax,4)
incq %rax
addq $0x10, %rcx
cmpq $0xa, %rax
jne 0x2d6a
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
movq $0x0, 0x10(%rdi)
xorl %r14d, %r14d
leaq 0x90(%rsp), %r13
movq %rdi, 0x10(%rsp)
movl 0xc0(%rsp,%r14,4), %ebp
testl %ebp, %ebp
jle 0x3000
movq %r14, %rax
shlq $0x4, %rax
movq 0x40(%rsp), %rcx
leaq (%rcx,%rax), %rdx
addq %rcx, %rax
addq $-0x10, %rax
movq %rax, 0x38(%rsp)
movq %r14, %rax
shlq $0x20, %rax
movq %rax, 0x70(%rsp)
movq %rdx, 0x68(%rsp)
movq %r14, 0x60(%rsp)
leal -0x1(%rbp), %esi
movzbl (%rdx,%rsi), %eax
testl %eax, %eax
je 0x2e04
cmpl $0xb, %eax
jne 0x2e10
cmpl $0x1, %ebp
movl %esi, %ebp
jg 0x2df4
jmp 0x3000
movb $0x1, %r8b
cmpl $0xf, %ebp
jg 0x2e4c
movl %ebp, %eax
testq %r14, %r14
je 0x2e2a
movq 0x38(%rsp), %rcx
cmpb $0x0, (%rcx,%rax)
je 0x2e4c
cmpq $0x9, %r14
sete %cl
cmpb $0x0, (%rdx,%rax)
sete %r8b
orb %r8b, %cl
jne 0x2e4c
movq 0x38(%rsp), %rcx
cmpb $0x0, 0x20(%rcx,%rax)
sete %r8b
testb %r8b, %r8b
je 0x3000
movb %r8b, 0xf(%rsp)
movq %r13, %r12
movl $0xa0, %edx
leaq 0xe8(%rsp), %rbx
movq %rbx, %rdi
movq %rsi, %r15
movq 0x40(%rsp), %rsi
callq 0x2120
movq 0xe0(%rsp), %rax
movq %rax, 0xb0(%rsp)
movups 0xc0(%rsp), %xmm0
movups 0xd0(%rsp), %xmm1
movaps %xmm1, 0xa0(%rsp)
movaps %xmm0, 0x90(%rsp)
movq 0x70(%rsp), %rax
movq %r15, %r14
orq %r15, %rax
movq %rax, 0x20(%rsp)
movl $0x1, %edx
leaq 0x48(%rsp), %r15
movq %r15, %rdi
leaq 0x20(%rsp), %r13
movq %r13, %rsi
leaq 0x1c(%rsp), %rcx
callq 0x48ba
movq %r13, %rdi
movq %rbx, %rsi
movq %r12, %r13
movq %r12, %rdx
movq %r15, %rcx
callq 0x48ff
movq 0x48(%rsp), %rdi
movq 0x58(%rsp), %rsi
movq 0x20(%rsp), %rax
movq %rax, 0x48(%rsp)
movups 0x28(%rsp), %xmm0
movups %xmm0, 0x50(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rsp)
movq $0x0, 0x30(%rsp)
testq %rdi, %rdi
je 0x2f29
subq %rdi, %rsi
callq 0x2170
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
leaq 0x20(%rsp), %rbx
je 0x2f45
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x2170
leaq 0x78(%rsp), %r12
movq %r12, %rdi
movq %r15, %rsi
callq 0x483a
leaq 0xe8(%rsp), %rdi
movq %r13, %rsi
movq %r12, %rdx
movl $0x1, %ecx
callq 0x4a3d
movq %rax, 0x20(%rsp)
movq 0x78(%rsp), %rdi
testq %rdi, %rdi
je 0x2f8c
movq 0x88(%rsp), %rsi
subq %rdi, %rsi
callq 0x2170
movl $0x0, 0x1c(%rsp)
xorl %eax, %eax
xorl %ecx, %ecx
movl 0xc0(%rsp,%rax,4), %edx
subl 0x90(%rsp,%rax,4), %edx
addl %edx, %ecx
incq %rax
cmpq $0xa, %rax
jne 0x2f98
movl %ecx, 0x1c(%rsp)
movq 0x10(%rsp), %rdi
movq %rbx, %rsi
leaq 0x1c(%rsp), %rdx
callq 0x4bb4
movq 0x48(%rsp), %rdi
testq %rdi, %rdi
je 0x2fde
movq 0x58(%rsp), %rsi
subq %rdi, %rsi
callq 0x2170
cmpl $0x2, %ebp
setge %al
movl %r14d, %ebp
testb %al, 0xf(%rsp)
movq 0x10(%rsp), %rdi
movq 0x60(%rsp), %r14
movq 0x68(%rsp), %rdx
jne 0x2df4
incq %r14
cmpq $0xa, %r14
jne 0x2db2
movq (%rdi), %rax
cmpq 0x8(%rdi), %rax
jne 0x303d
leaq 0xe8(%rsp), %rsi
movq $0x0, (%rsi)
leaq 0x90(%rsp), %rdx
movl $0x0, (%rdx)
callq 0x4bec
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 0x3093
jmp 0x3077
movq %rax, %rbx
movq 0x78(%rsp), %rdi
testq %rdi, %rdi
je 0x307a
movq 0x88(%rsp), %rsi
subq %rdi, %rsi
callq 0x2170
jmp 0x307a
jmp 0x3077
movq %rax, %rbx
movq 0x48(%rsp), %rdi
testq %rdi, %rdi
je 0x3096
movq 0x58(%rsp), %rsi
subq %rdi, %rsi
callq 0x2170
jmp 0x3096
movq %rax, %rbx
movq 0x10(%rsp), %r15
movq (%r15), %rdi
testq %rdi, %rdi
je 0x30af
movq 0x10(%r15), %rsi
subq %rdi, %rsi
callq 0x2170
movq %rbx, %rdi
callq 0x2230