// File: vsklad[P]cgen/commands.cpp
// Function: variable_generate_value(bal::Formula const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, CGenVariableInfo const&, bal::VariablesArray const&, bool, bool)
bal::VariablesArray variable_generate_value(const bal::Formula& formula,
                             const std::string name,
                             const CGenVariableInfo& src,
                             const bal::VariablesArray& dst_template,
                             const bool apply_except,
                             const bool reassign_in_formula) {
    bal::VariablesArray dst(dst_template.size() / dst_template.element_size(), dst_template.element_size());
    dst.assign_unassigned();
    
    // ensure that the value is provided/generated/computed
    if (src.data.size() != dst.size()) {
        std::stringstream error_message;
        error_message << "Invalid value for " << name;
        error_message << std::dec << "[" << dst.size() / dst.element_size() << "][" << dst.element_size() << "]";
        error_message << " due to wrong dimensions ";
        error_message << std::dec << "[" << src.data.size() / src.data.element_size() << "][" << src.data.element_size() << "]";
        throw std::invalid_argument(error_message.str());
    };
    
    _assert_level_0(src.data.size() > 0);
    bal::variables_size_t dst_changes_count = 0;
    
    const bal::literalid_t* p_src = src.data.data();
    const bal::literalid_t* p_tmp = dst_template.data();
    bal::literalid_t* p_dst = dst.data();
    
    if ((src.except_count > 0 || src.except_range_size > 0) && apply_except) {
        // generate list of element indexes to assign
        std::vector<unsigned int> assignable_indexes;

        // assignable are non-constant dst elements with corresponding constants in src
        // except for the exclusion range
        for (auto i = 0; i < src.data.size(); i++) {
            if ((src.except_range_size == 0 ||
                 i < src.except_range_first || i >= src.except_range_first + src.except_range_size)) {
                if ((literal_t__is_constant(p_src[i]) && literal_t__is_variable(p_tmp[i]) && reassign_in_formula) ||
                    (!literal_t__is_unassigned(p_src[i]) && literal_t__is_unassigned(p_tmp[i]))) {
                    assignable_indexes.push_back(i);
                } else if (literal_t__is_constant(p_src[i]) && literal_t__is_variable(p_tmp[i])) {
                    const bal::literalid_t formula_value = formula.get_variable_value(literal_t__variable_id(p_tmp[i]));
                    if (p_src[i] != literal_t__substitute_literal(p_tmp[i], formula_value)) {
                        assignable_indexes.push_back(i);
                    };
                } else if (!literal_t__is_unassigned(p_src[i]) && p_tmp[i] != p_src[i]) {
                    assignable_indexes.push_back(i);
                };
            };
        };
        
        if (src.except_count > 0) {
            if (assignable_indexes.size() > src.except_count) {
                // pick except_count elements randomly and remove them
                std::random_device rd;
                for (auto i = 0; i < src.except_count; i++) {
                    std::uniform_int_distribution<size_t> index_distribution(0, assignable_indexes.size() - i - 1);
                    size_t random_index = index_distribution(rd);
                    assignable_indexes[random_index] = assignable_indexes[assignable_indexes.size() - i - 1];
                };
                assignable_indexes.resize(assignable_indexes.size() - src.except_count);
            } else if (assignable_indexes.size() == src.except_count) {
                assignable_indexes.clear();
            } else {
                throw std::invalid_argument(ERROR_EXCEPT_NO_VARIABLES);
            };
        };
        
        if (assignable_indexes.size() > 0) {
            for (auto index: assignable_indexes) {
                _assert_level_0(literal_t__is_constant(p_src[index]) && !literal_t__is_constant(p_tmp[index]));
                p_dst[index] = p_src[index];
            };
            dst_changes_count = (bal::variables_size_t)assignable_indexes.size();
        };
    } else {
        // no except, simply copy the values, ignore unassigned src
        for (auto i = 0; i < src.data.size(); i++) {
            if ((literal_t__is_constant(p_src[i]) && literal_t__is_variable(p_tmp[i]) && reassign_in_formula) ||
                (!literal_t__is_unassigned(p_src[i]) && literal_t__is_unassigned(p_tmp[i]))) {
                p_dst[i] = p_src[i];
                dst_changes_count++;
            } else if (literal_t__is_constant(p_src[i]) && literal_t__is_variable(p_tmp[i])) {
                const bal::literalid_t formula_value = formula.get_variable_value(literal_t__variable_id(p_tmp[i]));
                if (p_src[i] != literal_t__substitute_literal(p_tmp[i], formula_value)) {
                    p_dst[i] = p_src[i];
                    dst_changes_count++;
                };
            } else if (!literal_t__is_unassigned(p_src[i]) && p_tmp[i] != p_src[i]) {
                p_dst[i] = p_src[i];
                dst_changes_count++;
            };
        };
    };
    
    if (dst_changes_count > 0) {
        std::cout << "Assigned " << std::dec << dst_changes_count << " bit(s) in \"" << name << "\"" << std::endl;
        std::cout << name << " = " << dst << std::endl;
    };
    
    return dst;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1770, %rsp           # imm = 0x1770
movl %r9d, %eax
movq %rcx, -0x1638(%rbp)
movq %rdx, %rcx
movq -0x1638(%rbp), %rdx
movq %rcx, -0x1630(%rbp)
movq %rsi, %rcx
movq -0x1630(%rbp), %rsi
movq %rcx, -0x1628(%rbp)
movq %rdi, %r9
movq -0x1628(%rbp), %rdi
movq %r9, -0x1610(%rbp)
movb %al, %cl
movq %r9, %rax
movq %rax, -0x1620(%rbp)
movb 0x10(%rbp), %al
movq %r9, -0x8(%rbp)
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
andb $0x1, %cl
movb %cl, -0x29(%rbp)
andb $0x1, %al
movb %al, -0x2a(%rbp)
movb $0x0, -0x2b(%rbp)
movq -0x28(%rbp), %rdi
callq 0x102f0
movl %eax, -0x1618(%rbp)
movq -0x28(%rbp), %rdi
callq 0x2e1a0
movl %eax, %ecx
movl -0x1618(%rbp), %eax
xorl %edx, %edx
divl %ecx
movl %eax, -0x1614(%rbp)
movq -0x28(%rbp), %rdi
callq 0x2e1a0
movl -0x1614(%rbp), %esi
movq -0x1610(%rbp), %rdi
movl %eax, %edx
callq 0x10330
movq -0x1610(%rbp), %rdi
callq 0x2e1c0
jmp 0x2b0af
movq -0x20(%rbp), %rdi
addq $0x18, %rdi
callq 0x102f0
movl %eax, -0x163c(%rbp)
jmp 0x2b0c4
movq -0x1610(%rbp), %rdi
callq 0x102f0
movl %eax, -0x1640(%rbp)
jmp 0x2b0d8
movl -0x163c(%rbp), %eax
movl -0x1640(%rbp), %ecx
cmpl %ecx, %eax
je 0x2b3e8
leaq -0x1c8(%rbp), %rdi
callq 0xd200
jmp 0x2b0fa
leaq -0x1b8(%rbp), %rdi
leaq 0x37484(%rip), %rsi     # 0x6258c
callq 0xd320
movq %rax, -0x1648(%rbp)
jmp 0x2b116
movq -0x1630(%rbp), %rsi
movq -0x1648(%rbp), %rdi
callq 0xd290
jmp 0x2b12b
leaq -0x1b8(%rbp), %rdi
leaq -0x1ae79(%rip), %rsi    # 0x102c0
callq 0xd0f0
movq %rax, -0x1650(%rbp)
jmp 0x2b147
movq -0x1650(%rbp), %rdi
leaq 0x3744b(%rip), %rsi     # 0x625a0
callq 0xd320
movq %rax, -0x1658(%rbp)
jmp 0x2b163
movq -0x1610(%rbp), %rdi
callq 0x102f0
movl %eax, -0x165c(%rbp)
jmp 0x2b177
movq -0x1610(%rbp), %rdi
callq 0x2e1a0
movl %eax, -0x1660(%rbp)
jmp 0x2b18b
movq -0x1658(%rbp), %rdi
movl -0x1660(%rbp), %ecx
movl -0x165c(%rbp), %eax
xorl %edx, %edx
divl %ecx
movl %eax, %esi
callq 0xd420
movq %rax, -0x1668(%rbp)
jmp 0x2b1b2
movq -0x1668(%rbp), %rdi
leaq 0x373df(%rip), %rsi     # 0x6259f
callq 0xd320
movq %rax, -0x1670(%rbp)
jmp 0x2b1ce
movq -0x1610(%rbp), %rdi
callq 0x2e1a0
movl %eax, -0x1674(%rbp)
jmp 0x2b1e2
movl -0x1674(%rbp), %esi
movq -0x1670(%rbp), %rdi
callq 0xd420
movq %rax, -0x1680(%rbp)
jmp 0x2b1fd
movq -0x1680(%rbp), %rdi
leaq 0x33fd0(%rip), %rsi     # 0x5f1db
callq 0xd320
jmp 0x2b212
leaq -0x1b8(%rbp), %rdi
leaq 0x37382(%rip), %rsi     # 0x625a2
callq 0xd320
jmp 0x2b227
leaq -0x1b8(%rbp), %rdi
leaq -0x1af75(%rip), %rsi    # 0x102c0
callq 0xd0f0
movq %rax, -0x1688(%rbp)
jmp 0x2b243
movq -0x1688(%rbp), %rdi
leaq 0x3734f(%rip), %rsi     # 0x625a0
callq 0xd320
movq %rax, -0x1690(%rbp)
jmp 0x2b25f
movq -0x20(%rbp), %rdi
addq $0x18, %rdi
callq 0x102f0
movl %eax, -0x1694(%rbp)
jmp 0x2b274
movq -0x20(%rbp), %rdi
addq $0x18, %rdi
callq 0x2e1a0
movl %eax, -0x1698(%rbp)
jmp 0x2b289
movq -0x1690(%rbp), %rdi
movl -0x1698(%rbp), %ecx
movl -0x1694(%rbp), %eax
xorl %edx, %edx
divl %ecx
movl %eax, %esi
callq 0xd420
movq %rax, -0x16a0(%rbp)
jmp 0x2b2b0
movq -0x16a0(%rbp), %rdi
leaq 0x372e1(%rip), %rsi     # 0x6259f
callq 0xd320
movq %rax, -0x16a8(%rbp)
jmp 0x2b2cc
movq -0x20(%rbp), %rdi
addq $0x18, %rdi
callq 0x2e1a0
movl %eax, -0x16ac(%rbp)
jmp 0x2b2e1
movl -0x16ac(%rbp), %esi
movq -0x16a8(%rbp), %rdi
callq 0xd420
movq %rax, -0x16b8(%rbp)
jmp 0x2b2fc
movq -0x16b8(%rbp), %rdi
leaq 0x33ed1(%rip), %rsi     # 0x5f1db
callq 0xd320
jmp 0x2b311
movb $0x1, -0x1e9(%rbp)
movl $0x10, %edi
callq 0xd150
movq %rax, -0x16c0(%rbp)
leaq -0x1e8(%rbp), %rdi
leaq -0x1c8(%rbp), %rsi
callq 0xd310
jmp 0x2b33e
movq -0x16c0(%rbp), %rdi
leaq -0x1e8(%rbp), %rsi
callq 0xd590
jmp 0x2b353
movq -0x16c0(%rbp), %rdi
movb $0x0, -0x1e9(%rbp)
movq 0x57c70(%rip), %rsi     # 0x82fd8
movq 0x57c51(%rip), %rdx     # 0x82fc0
callq 0xd570
jmp 0x2be95
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x2be80
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x2b3d7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x2b3be
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x1e8(%rbp), %rdi
callq 0xd1b0
testb $0x1, -0x1e9(%rbp)
jne 0x2b3c9
jmp 0x2b3d5
movq -0x16c0(%rbp), %rdi
callq 0xd210
jmp 0x2b3d7
leaq -0x1c8(%rbp), %rdi
callq 0xd230
jmp 0x2be80
movq -0x20(%rbp), %rdi
addq $0x18, %rdi
callq 0x102f0
movl %eax, -0x16c4(%rbp)
jmp 0x2b3fd
movl -0x16c4(%rbp), %eax
cmpl $0x0, %eax
jbe 0x2b40a
jmp 0x2b429
leaq 0x371ab(%rip), %rdi     # 0x625bc
leaq 0x37079(%rip), %rsi     # 0x62491
movl $0x10e, %edx            # imm = 0x10E
leaq 0x371ac(%rip), %rcx     # 0x625d0
callq 0xd1c0
movl $0x0, -0x1f0(%rbp)
movq -0x20(%rbp), %rdi
addq $0x18, %rdi
callq 0x2e180
movq %rax, -0x16d0(%rbp)
jmp 0x2b449
movq -0x16d0(%rbp), %rax
movq %rax, -0x1f8(%rbp)
movq -0x28(%rbp), %rdi
callq 0x2e180
movq %rax, -0x16d8(%rbp)
jmp 0x2b469
movq -0x1610(%rbp), %rdi
movq -0x16d8(%rbp), %rax
movq %rax, -0x200(%rbp)
callq 0x10310
movq %rax, -0x16e0(%rbp)
jmp 0x2b48c
movq -0x16e0(%rbp), %rax
movq %rax, -0x208(%rbp)
movq -0x20(%rbp), %rax
cmpl $0x0, 0x8(%rax)
ja 0x2b4b2
movq -0x20(%rbp), %rax
cmpl $0x0, 0x10(%rax)
jbe 0x2ba9f
testb $0x1, -0x29(%rbp)
je 0x2ba9f
leaq -0x220(%rbp), %rdi
callq 0x17e70
movl $0x0, -0x224(%rbp)
movl -0x224(%rbp), %eax
movl %eax, -0x16e8(%rbp)
movq -0x20(%rbp), %rdi
addq $0x18, %rdi
callq 0x102f0
movl %eax, -0x16e4(%rbp)
jmp 0x2b4f3
movl -0x16e8(%rbp), %eax
movl -0x16e4(%rbp), %ecx
cmpl %ecx, %eax
jae 0x2b769
movq -0x20(%rbp), %rax
cmpl $0x0, 0x10(%rax)
je 0x2b53c
movl -0x224(%rbp), %eax
movq -0x20(%rbp), %rcx
cmpl 0xc(%rcx), %eax
jb 0x2b53c
movl -0x224(%rbp), %eax
movq -0x20(%rbp), %rcx
movl 0xc(%rcx), %ecx
movq -0x20(%rbp), %rdx
addl 0x10(%rdx), %ecx
cmpl %ecx, %eax
jb 0x2b753
movq -0x1f8(%rbp), %rax
movslq -0x224(%rbp), %rcx
cmpl $0x1, (%rax,%rcx,4)
ja 0x2b599
movq -0x200(%rbp), %rcx
movslq -0x224(%rbp), %rdx
xorl %eax, %eax
cmpl $0x1, (%rcx,%rdx,4)
movb %al, -0x16e9(%rbp)
jbe 0x2b587
movq -0x200(%rbp), %rax
movslq -0x224(%rbp), %rcx
cmpl $-0x2, (%rax,%rcx,4)
setbe %al
movb %al, -0x16e9(%rbp)
movb -0x16e9(%rbp), %al
testb $0x1, %al
jne 0x2b593
jmp 0x2b599
testb $0x1, -0x2a(%rbp)
jne 0x2b5c1
movq -0x1f8(%rbp), %rax
movslq -0x224(%rbp), %rcx
cmpl $-0x1, (%rax,%rcx,4)
je 0x2b5f8
movq -0x200(%rbp), %rax
movslq -0x224(%rbp), %rcx
cmpl $-0x1, (%rax,%rcx,4)
jne 0x2b5f8
movl -0x224(%rbp), %eax
movl %eax, -0x228(%rbp)
leaq -0x220(%rbp), %rdi
leaq -0x228(%rbp), %rsi
callq 0xfa10
jmp 0x2b5e2
jmp 0x2b751
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x2ba8e
movq -0x1f8(%rbp), %rax
movslq -0x224(%rbp), %rcx
cmpl $0x1, (%rax,%rcx,4)
ja 0x2b6f2
movq -0x200(%rbp), %rcx
movslq -0x224(%rbp), %rdx
xorl %eax, %eax
cmpl $0x1, (%rcx,%rdx,4)
movb %al, -0x16ea(%rbp)
jbe 0x2b647
movq -0x200(%rbp), %rax
movslq -0x224(%rbp), %rcx
cmpl $-0x2, (%rax,%rcx,4)
setbe %al
movb %al, -0x16ea(%rbp)
movb -0x16ea(%rbp), %al
testb $0x1, %al
jne 0x2b656
jmp 0x2b6f2
movq -0x10(%rbp), %rdi
movq -0x200(%rbp), %rax
movslq -0x224(%rbp), %rcx
movl (%rax,%rcx,4), %esi
shrl %esi
decl %esi
movq (%rdi), %rax
movq 0x60(%rax), %rax
callq *%rax
movl %eax, -0x16f0(%rbp)
jmp 0x2b680
movl -0x16f0(%rbp), %eax
movl %eax, -0x22c(%rbp)
movq -0x1f8(%rbp), %rax
movslq -0x224(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl -0x22c(%rbp), %ecx
movq -0x200(%rbp), %rdx
movslq -0x224(%rbp), %rsi
movl (%rdx,%rsi,4), %edi
xorl $-0x1, %edi
andl $0x1, %edi
xorl %edx, %edx
movl $0x1, %esi
cmpl $0x0, %edi
cmovnel %esi, %edx
xorl %edx, %ecx
cmpl %ecx, %eax
je 0x2b6f0
movl -0x224(%rbp), %eax
movl %eax, -0x230(%rbp)
leaq -0x220(%rbp), %rdi
leaq -0x230(%rbp), %rsi
callq 0xfa10
jmp 0x2b6ee
jmp 0x2b6f0
jmp 0x2b74f
movq -0x1f8(%rbp), %rax
movslq -0x224(%rbp), %rcx
cmpl $-0x1, (%rax,%rcx,4)
je 0x2b74d
movq -0x200(%rbp), %rax
movslq -0x224(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movq -0x1f8(%rbp), %rcx
movslq -0x224(%rbp), %rdx
cmpl (%rcx,%rdx,4), %eax
je 0x2b74d
movl -0x224(%rbp), %eax
movl %eax, -0x234(%rbp)
leaq -0x220(%rbp), %rdi
leaq -0x234(%rbp), %rsi
callq 0xfa10
jmp 0x2b74b
jmp 0x2b74d
jmp 0x2b74f
jmp 0x2b751
jmp 0x2b753
jmp 0x2b755
movl -0x224(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x224(%rbp)
jmp 0x2b4d2
movq -0x20(%rbp), %rax
cmpl $0x0, 0x8(%rax)
jbe 0x2b95a
leaq -0x220(%rbp), %rdi
callq 0xf9f0
movq -0x20(%rbp), %rcx
movl 0x8(%rcx), %ecx
cmpq %rcx, %rax
jbe 0x2b8cf
leaq -0x15c0(%rbp), %rdi
callq 0x2dec0
jmp 0x2b7a1
movl $0x0, -0x15c4(%rbp)
movl -0x15c4(%rbp), %eax
movq -0x20(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jae 0x2b890
leaq -0x220(%rbp), %rdi
callq 0xf9f0
movslq -0x15c4(%rbp), %rdx
notq %rdx
addq %rax, %rdx
xorl %eax, %eax
movl %eax, %esi
leaq -0x15d8(%rbp), %rdi
callq 0x2e210
jmp 0x2b7e9
leaq -0x15d8(%rbp), %rdi
leaq -0x15c0(%rbp), %rsi
callq 0x2e240
movq %rax, -0x16f8(%rbp)
jmp 0x2b805
movq -0x16f8(%rbp), %rax
movq %rax, -0x15e0(%rbp)
leaq -0x220(%rbp), %rdi
callq 0xf9f0
movq %rax, %rsi
movslq -0x15c4(%rbp), %rax
subq %rax, %rsi
subq $0x1, %rsi
leaq -0x220(%rbp), %rdi
callq 0xfd50
movl (%rax), %eax
movl %eax, -0x16fc(%rbp)
movq -0x15e0(%rbp), %rsi
leaq -0x220(%rbp), %rdi
callq 0xfd50
movl -0x16fc(%rbp), %ecx
movl %ecx, (%rax)
movl -0x15c4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x15c4(%rbp)
jmp 0x2b7ab
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x15c0(%rbp), %rdi
callq 0x2e000
jmp 0x2ba8e
leaq -0x220(%rbp), %rdi
movq %rdi, -0x1708(%rbp)
callq 0xf9f0
movq -0x1708(%rbp), %rdi
movq %rax, %rsi
movq -0x20(%rbp), %rax
movl 0x8(%rax), %eax
subq %rax, %rsi
callq 0x2e270
jmp 0x2b8be
leaq -0x15c0(%rbp), %rdi
callq 0x2e000
jmp 0x2b958
leaq -0x220(%rbp), %rdi
callq 0xf9f0
movq -0x20(%rbp), %rcx
movl 0x8(%rcx), %ecx
cmpq %rcx, %rax
jne 0x2b8f5
leaq -0x220(%rbp), %rdi
callq 0xf9d0
jmp 0x2b956
movl $0x10, %edi
callq 0xd150
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x1710(%rbp)
leaq 0x36d61(%rip), %rsi     # 0x62674
callq 0xd5f0
jmp 0x2b91a
movq -0x1710(%rbp), %rdi
movq 0x576b0(%rip), %rsi     # 0x82fd8
movq 0x57691(%rip), %rdx     # 0x82fc0
callq 0xd570
jmp 0x2be95
movq -0x1710(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
callq 0xd210
jmp 0x2ba8e
jmp 0x2b958
jmp 0x2b95a
leaq -0x220(%rbp), %rdi
callq 0xf9f0
cmpq $0x0, %rax
jbe 0x2ba7d
leaq -0x220(%rbp), %rax
movq %rax, -0x15e8(%rbp)
movq -0x15e8(%rbp), %rdi
callq 0x10a10
movq %rax, -0x15f0(%rbp)
movq -0x15e8(%rbp), %rdi
callq 0x10ce0
movq %rax, -0x15f8(%rbp)
leaq -0x15f0(%rbp), %rdi
leaq -0x15f8(%rbp), %rsi
callq 0x10ca0
testb $0x1, %al
jne 0x2b9c0
jmp 0x2ba6b
leaq -0x15f0(%rbp), %rdi
callq 0x19b70
movl (%rax), %eax
movl %eax, -0x15fc(%rbp)
movq -0x1f8(%rbp), %rcx
movl -0x15fc(%rbp), %eax
movl %eax, %edx
xorl %eax, %eax
cmpl $0x1, (%rcx,%rdx,4)
movb %al, -0x1711(%rbp)
ja 0x2ba0d
movq -0x200(%rbp), %rax
movl -0x15fc(%rbp), %ecx
cmpl $0x1, (%rax,%rcx,4)
setbe %al
xorb $-0x1, %al
movb %al, -0x1711(%rbp)
movb -0x1711(%rbp), %al
testb $0x1, %al
jne 0x2ba19
jmp 0x2ba1b
jmp 0x2ba3a
leaq 0x36cd8(%rip), %rdi     # 0x626fa
leaq 0x36a68(%rip), %rsi     # 0x62491
movl $0x13f, %edx            # imm = 0x13F
leaq 0x36b9b(%rip), %rcx     # 0x625d0
callq 0xd1c0
movq -0x1f8(%rbp), %rax
movl -0x15fc(%rbp), %ecx
movl (%rax,%rcx,4), %edx
movq -0x208(%rbp), %rax
movl -0x15fc(%rbp), %ecx
movl %edx, (%rax,%rcx,4)
leaq -0x15f0(%rbp), %rdi
callq 0x19b50
jmp 0x2b9a4
leaq -0x220(%rbp), %rdi
callq 0xf9f0
movl %eax, -0x1f0(%rbp)
leaq -0x220(%rbp), %rdi
callq 0x18050
jmp 0x2bd26
leaq -0x220(%rbp), %rdi
callq 0x18050
jmp 0x2be80
movl $0x0, -0x1600(%rbp)
movl -0x1600(%rbp), %eax
movl %eax, -0x171c(%rbp)
movq -0x20(%rbp), %rdi
addq $0x18, %rdi
callq 0x102f0
movl %eax, -0x1718(%rbp)
jmp 0x2baca
movl -0x171c(%rbp), %eax
movl -0x1718(%rbp), %ecx
cmpl %ecx, %eax
jae 0x2bd24
movq -0x1f8(%rbp), %rax
movslq -0x1600(%rbp), %rcx
cmpl $0x1, (%rax,%rcx,4)
ja 0x2bb3b
movq -0x200(%rbp), %rcx
movslq -0x1600(%rbp), %rdx
xorl %eax, %eax
cmpl $0x1, (%rcx,%rdx,4)
movb %al, -0x171d(%rbp)
jbe 0x2bb29
movq -0x200(%rbp), %rax
movslq -0x1600(%rbp), %rcx
cmpl $-0x2, (%rax,%rcx,4)
setbe %al
movb %al, -0x171d(%rbp)
movb -0x171d(%rbp), %al
testb $0x1, %al
jne 0x2bb35
jmp 0x2bb3b
testb $0x1, -0x2a(%rbp)
jne 0x2bb63
movq -0x1f8(%rbp), %rax
movslq -0x1600(%rbp), %rcx
cmpl $-0x1, (%rax,%rcx,4)
je 0x2bb99
movq -0x200(%rbp), %rax
movslq -0x1600(%rbp), %rcx
cmpl $-0x1, (%rax,%rcx,4)
jne 0x2bb99
movq -0x1f8(%rbp), %rax
movslq -0x1600(%rbp), %rcx
movl (%rax,%rcx,4), %edx
movq -0x208(%rbp), %rax
movslq -0x1600(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x1f0(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1f0(%rbp)
jmp 0x2bd0e
movq -0x1f8(%rbp), %rax
movslq -0x1600(%rbp), %rcx
cmpl $0x1, (%rax,%rcx,4)
ja 0x2bca1
movq -0x200(%rbp), %rcx
movslq -0x1600(%rbp), %rdx
xorl %eax, %eax
cmpl $0x1, (%rcx,%rdx,4)
movb %al, -0x171e(%rbp)
jbe 0x2bbe8
movq -0x200(%rbp), %rax
movslq -0x1600(%rbp), %rcx
cmpl $-0x2, (%rax,%rcx,4)
setbe %al
movb %al, -0x171e(%rbp)
movb -0x171e(%rbp), %al
testb $0x1, %al
jne 0x2bbf7
jmp 0x2bca1
movq -0x10(%rbp), %rdi
movq -0x200(%rbp), %rax
movslq -0x1600(%rbp), %rcx
movl (%rax,%rcx,4), %esi
shrl %esi
decl %esi
movq (%rdi), %rax
movq 0x60(%rax), %rax
callq *%rax
movl %eax, -0x1724(%rbp)
jmp 0x2bc21
movl -0x1724(%rbp), %eax
movl %eax, -0x1604(%rbp)
movq -0x1f8(%rbp), %rax
movslq -0x1600(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl -0x1604(%rbp), %ecx
movq -0x200(%rbp), %rdx
movslq -0x1600(%rbp), %rsi
movl (%rdx,%rsi,4), %edi
xorl $-0x1, %edi
andl $0x1, %edi
xorl %edx, %edx
movl $0x1, %esi
cmpl $0x0, %edi
cmovnel %esi, %edx
xorl %edx, %ecx
cmpl %ecx, %eax
je 0x2bc9f
movq -0x1f8(%rbp), %rax
movslq -0x1600(%rbp), %rcx
movl (%rax,%rcx,4), %edx
movq -0x208(%rbp), %rax
movslq -0x1600(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x1f0(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1f0(%rbp)
jmp 0x2bd0c
movq -0x1f8(%rbp), %rax
movslq -0x1600(%rbp), %rcx
cmpl $-0x1, (%rax,%rcx,4)
je 0x2bd0a
movq -0x200(%rbp), %rax
movslq -0x1600(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movq -0x1f8(%rbp), %rcx
movslq -0x1600(%rbp), %rdx
cmpl (%rcx,%rdx,4), %eax
je 0x2bd0a
movq -0x1f8(%rbp), %rax
movslq -0x1600(%rbp), %rcx
movl (%rax,%rcx,4), %edx
movq -0x208(%rbp), %rax
movslq -0x1600(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x1f0(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1f0(%rbp)
jmp 0x2bd0c
jmp 0x2bd0e
jmp 0x2bd10
movl -0x1600(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1600(%rbp)
jmp 0x2baa9
jmp 0x2bd26
cmpl $0x0, -0x1f0(%rbp)
jbe 0x2be5a
movq 0x57266(%rip), %rdi     # 0x82fa0
leaq 0x36a1b(%rip), %rsi     # 0x6275c
callq 0xd320
movq %rax, -0x1730(%rbp)
jmp 0x2bd4f
movq -0x1730(%rbp), %rdi
leaq -0x1ba9d(%rip), %rsi    # 0x102c0
callq 0xd0f0
movq %rax, -0x1738(%rbp)
jmp 0x2bd6b
movq -0x1738(%rbp), %rdi
movl -0x1f0(%rbp), %esi
callq 0xd420
movq %rax, -0x1740(%rbp)
jmp 0x2bd86
movq -0x1740(%rbp), %rdi
leaq 0x369d2(%rip), %rsi     # 0x62766
callq 0xd320
movq %rax, -0x1748(%rbp)
jmp 0x2bda2
movq -0x1630(%rbp), %rsi
movq -0x1748(%rbp), %rdi
callq 0xd290
movq %rax, -0x1750(%rbp)
jmp 0x2bdbe
movq -0x1750(%rbp), %rdi
leaq 0x3b30a(%rip), %rsi     # 0x670d6
callq 0xd320
movq %rax, -0x1758(%rbp)
jmp 0x2bdda
movq -0x1758(%rbp), %rdi
movq 0x57198(%rip), %rsi     # 0x82f80
callq 0xd360
jmp 0x2bdef
movq -0x1630(%rbp), %rsi
movq 0x571a3(%rip), %rdi     # 0x82fa0
callq 0xd290
movq %rax, -0x1760(%rbp)
jmp 0x2be0b
movq -0x1760(%rbp), %rdi
leaq 0x2ff7d(%rip), %rsi     # 0x5bd96
callq 0xd320
movq %rax, -0x1768(%rbp)
jmp 0x2be27
movq -0x1610(%rbp), %rsi
movq -0x1768(%rbp), %rdi
callq 0x58fd0
movq %rax, -0x1770(%rbp)
jmp 0x2be43
movq -0x1770(%rbp), %rdi
movq 0x5712f(%rip), %rsi     # 0x82f80
callq 0xd360
jmp 0x2be58
jmp 0x2be5a
movb $0x1, -0x2b(%rbp)
testb $0x1, -0x2b(%rbp)
jne 0x2be70
movq -0x1610(%rbp), %rdi
callq 0x10850
movq -0x1620(%rbp), %rax
addq $0x1770, %rsp           # imm = 0x1770
popq %rbp
retq
movq -0x1610(%rbp), %rdi
callq 0x10850
movq -0x38(%rbp), %rdi
callq 0xd5a0
nopw %cs:(%rax,%rax)