// File: kmyk[P]codevs-for-student-2016/Main.cpp
// Function: simulation::estimate_with_drop(primitive::blocks_t<16ul, 10ul> const&)
result_t estimate_with_drop(field_t const & field) {
        const array<int,width> height_map = make_height_map(field);
        result_t acc = { -1, 0 };
        repeat (x, width) {
            repeat_from (b,1,9+1) {
                blocks_t<height + 1, width> nfield = {};
                repeat (nx, width) repeat (y, height_map[nx]) nfield.at[nx][y] = field.at[nx][y];
                nfield.at[x][height_map[x]] = b;
                array<int,width> nheight_map = height_map;
                nheight_map[x] += 1;
                vector<point_t> modified_blocks { point(height_map[x], x) };
                result_t result = simulate(nfield, nheight_map, modified_blocks, 0);
                setmax(acc, result);
            }
        }
        return acc;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1c0, %rsp            # imm = 0x1C0
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rsi
leaq -0x38(%rbp), %rdi
callq 0x6940
movq 0x2253d(%rip), %rax     # 0x261c0
movq %rax, -0x8(%rbp)
movl $0x0, -0x3c(%rbp)
cmpl $0xa, -0x3c(%rbp)
jge 0x3f6f
movl $0x1, -0x40(%rbp)
cmpl $0xa, -0x40(%rbp)
jge 0x3f5f
leaq -0xea(%rbp), %rdi
xorl %esi, %esi
movl $0xaa, %edx
callq 0x2100
movl $0x0, -0xf0(%rbp)
cmpl $0xa, -0xf0(%rbp)
jge 0x3d81
movl $0x0, -0xf4(%rbp)
movl -0xf4(%rbp), %eax
movl %eax, -0x18c(%rbp)
movslq -0xf0(%rbp), %rsi
leaq -0x38(%rbp), %rdi
callq 0x6c60
movq %rax, %rcx
movl -0x18c(%rbp), %eax
cmpl (%rcx), %eax
jge 0x3d6b
movq -0x10(%rbp), %rdi
movslq -0xf0(%rbp), %rsi
callq 0x68e0
movq %rax, %rdi
movslq -0xf4(%rbp), %rsi
callq 0x6910
movb (%rax), %al
movb %al, -0x18d(%rbp)
leaq -0xea(%rbp), %rdi
movslq -0xf0(%rbp), %rsi
callq 0x7440
movq %rax, %rdi
movslq -0xf4(%rbp), %rsi
callq 0x7470
movb -0x18d(%rbp), %cl
movb %cl, (%rax)
movl -0xf4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xf4(%rbp)
jmp 0x3cdd
jmp 0x3d6d
movl -0xf0(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xf0(%rbp)
jmp 0x3cc6
movb -0x40(%rbp), %al
movb %al, -0x1a1(%rbp)
movslq -0x3c(%rbp), %rsi
leaq -0xea(%rbp), %rdi
callq 0x7440
movq %rax, -0x1b0(%rbp)
movslq -0x3c(%rbp), %rsi
leaq -0x38(%rbp), %rdi
movq %rdi, -0x1a0(%rbp)
callq 0x6c60
movq -0x1b0(%rbp), %rdi
movslq (%rax), %rsi
callq 0x7470
movb -0x1a1(%rbp), %cl
movb %cl, (%rax)
movq -0x18(%rbp), %rax
movq %rax, -0x100(%rbp)
movups -0x38(%rbp), %xmm0
movups -0x28(%rbp), %xmm1
movaps %xmm1, -0x110(%rbp)
movaps %xmm0, -0x120(%rbp)
movslq -0x3c(%rbp), %rsi
leaq -0x120(%rbp), %rdi
callq 0x67f0
movq -0x1a0(%rbp), %rdi
movl (%rax), %ecx
incl %ecx
movl %ecx, (%rax)
movslq -0x3c(%rbp), %rsi
callq 0x6c60
movl (%rax), %edi
movl -0x3c(%rbp), %esi
callq 0x2550
movq %rax, -0x150(%rbp)
leaq -0x150(%rbp), %rax
movq %rax, -0x148(%rbp)
movq $0x1, -0x140(%rbp)
leaq -0x151(%rbp), %rdi
movq %rdi, -0x198(%rbp)
callq 0x6d50
movq -0x198(%rbp), %rcx
movq -0x148(%rbp), %rsi
movq -0x140(%rbp), %rdx
leaq -0x138(%rbp), %rdi
callq 0x6d70
jmp 0x3e73
leaq -0x151(%rbp), %rdi
callq 0x6df0
leaq -0x188(%rbp), %rdi
leaq -0x138(%rbp), %rsi
callq 0x6b70
jmp 0x3e94
leaq -0xea(%rbp), %rdi
leaq -0x120(%rbp), %rsi
leaq -0x188(%rbp), %rdx
xorl %ecx, %ecx
callq 0x74a0
movq %rax, -0x1b8(%rbp)
jmp 0x3eb9
movq -0x1b8(%rbp), %rax
movq %rax, -0x16c(%rbp)
leaq -0x188(%rbp), %rdi
callq 0x6850
leaq -0x8(%rbp), %rdi
leaq -0x16c(%rbp), %rsi
callq 0x7620
jmp 0x3ee5
leaq -0x138(%rbp), %rdi
callq 0x6850
movl -0x40(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
jmp 0x3c9f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x160(%rbp)
movl %eax, -0x164(%rbp)
leaq -0x151(%rbp), %rdi
callq 0x6df0
jmp 0x3f7c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x160(%rbp)
movl %eax, -0x164(%rbp)
jmp 0x3f51
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x160(%rbp)
movl %eax, -0x164(%rbp)
leaq -0x188(%rbp), %rdi
callq 0x6850
leaq -0x138(%rbp), %rdi
callq 0x6850
jmp 0x3f7c
jmp 0x3f61
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x3c8e
movq -0x8(%rbp), %rax
addq $0x1c0, %rsp            # imm = 0x1C0
popq %rbp
retq
movq -0x160(%rbp), %rdi
callq 0x22f0
nopl (%rax,%rax)