// File: /workspace/github_cpp_makefile_star2_O3/vsklad[P]cgen/./bal/variables/variablesio.cpp
// Function: bal::operator<<(std::ostream&, bal::VariablesArray const&)
std::ostream& operator << (std::ostream& stream, const VariablesArray& array) {
        const variableid_t size = array.size();
        const variableid_t element_size = array.element_size();
        const variableid_t elements_size = size / element_size;
        
        assert(elements_size * element_size == size);
        
        const literalid_t* literalid = array.data();
        bool bracket_1_open = false;
        
        size_t i = 0;
        while (i < elements_size) {
            if (i > 0) {
                stream << ", ";
            };
            
            // check and process the possible sequence of elements
            size_t elements_sequence_size = 1;
            int elements_sequence_step = 0;
            get_variables_range_sequence_(literalid, size - (i * element_size), element_size,
                                                    elements_sequence_size, elements_sequence_step);
            
            if (i == 0 && !bracket_1_open && size > element_size * elements_sequence_size) {
                stream << "{";
                bracket_1_open = true;
            };

            bool bracket_2_open = false;
            
            size_t j = 0;
            while(j < element_size) {
                size_t k;
                
                // output constant as much as possible, limit to 64 bit, align to 4 bits
                // look ahead bit by bit and compress
                uint64_t constant = 0;
                k = 0;
                while ((k < 64) && (j + k) < element_size) {
                    if (literal_t__is_constant(*(literalid + k))) {
                        constant = (constant << 1) | (literal_t__is_constant_1(*(literalid + k)) ? 1 : 0);
                        k++;
                        continue;
                    };
                    break;
                };
                if (k > 0) {
                    // constants that have number of bits mod 4 != 0, require brackets
                    // because they are split into bin and hex
                    if (j == 0 && ((k < element_size) || (k > 3 && k % 4 != 0)) && !bracket_2_open) {
                        stream << "{";
                        bracket_2_open = true;
                    } else if (j > 0) {
                        stream << ", ";
                    };
                    
                    // output the most significant bits to align to 4 from the lower end of the element
                    // if less than 4 bits total, output everything here
                    const size_t k_prefix = (k <= 3) ? k : ((element_size - j) & 0x3);
                    if (k_prefix > 0 && k > 0) {
                        uint64_t prefix_constant = constant >> (k > k_prefix ? k - k_prefix : 0);
                        stream << "0b";
                        stream << ((k_prefix > 2 && k > 2) ? (prefix_constant & 0b100) ? "1" : "0" : "");
                        stream << ((k_prefix > 1 && k > 1) ? (prefix_constant & 0b010) ? "1" : "0" : "");
                        stream <<                           ((prefix_constant & 0b001) ? "1" : "0");
                        // zero out b_prefix most significant bits
                        constant &= 0xFFFFFFFFFFFFFFFFull >> (64 - k + k_prefix);
                    };
                    
                    if (k > k_prefix) {
                        const size_t k_suffix = (k - k_prefix) & 0x3;
                        if (k - k_prefix > k_suffix) {
                            // output the main part of the constant aligned to 4 bits
                            if (k_prefix > 0) {
                                stream << ", "; // separate from the prefix
                            };
                            stream << "0x" << std::setfill('0') << std::setw((int)((k - k_prefix) >> 2));
                            stream << std::hex << (constant >> k_suffix);
                        };
                        
                        if (k_suffix > 0) {
                            // output the remaining least significant bits
                            if (k > k_suffix) {
                                stream << ", "; // separate from the hex constant
                            };
                            stream << "0b";
                            stream << (k_suffix > 2 ? (constant & 0b100) ? "1" : "0" : "");
                            stream << (k_suffix > 1 ? (constant & 0b010) ? "1" : "0" : "");
                            stream <<                ((constant & 0b001) ? "1" : "0");
                        };
                    };
                    
                    // skip the processed literals
                    literalid += k;
                    j += k;
                };
                
                // output variables as much as possible; compress sequential
                int sequence_step = 0;
                get_variables_sequence_(literalid, element_size - j, k, sequence_step);
                
                // elements_sequence_size == 1 && k > 1 means the sequence is within element
                // therefore must be bracketed in order to avoid confusion
                if (i == 0 && j == 0 && !bracket_1_open && elements_sequence_size == 1 && k > 1) {
                    stream << "{";
                    bracket_1_open = true;
                };
                
                if (k > 0) {
                    // k < element_size means there are more elements to output
                    // k > 1 sequence within element must always be bracketed
                    if (!bracket_2_open && j == 0 && (k < element_size || k > 1)) {
                        stream << "{";
                        bracket_2_open = true;
                    } else if (j > 0) {
                        stream << ", ";
                    };
                    stream << literal_t(*literalid);
                    write_sequence_parameters_(stream, k, sequence_step);
                    // skip the processed literals
                    literalid += k;
                    j += k;
                };
            };
            
            if (bracket_2_open) {
                stream << "}";
            };
            
            write_sequence_parameters_(stream, elements_sequence_size, elements_sequence_step);
            
            // skip processed elements
            i += elements_sequence_size;
            literalid += (elements_sequence_size - 1) * element_size;
        };
        
        if (bracket_1_open) {
            stream << "}";
        };
        return stream;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rdi, %rbx
movl 0x8(%rsi), %r14d
movl 0x1c(%rsi), %edi
movl %r14d, %eax
xorl %edx, %edx
divl %edi
movl %eax, %ecx
imull %edi, %ecx
cmpl %r14d, %ecx
jne 0x3db4d
movq %rdi, -0x38(%rbp)
cmpl %r14d, %edi
ja 0x3db1c
movl %eax, %eax
movq %rax, -0x80(%rbp)
movq (%rsi), %r8
movq $0x0, -0x40(%rbp)
xorl %r12d, %r12d
movq %r14, -0x88(%rbp)
movq %rbx, -0x30(%rbp)
testq %r12, %r12
je 0x3d4c4
movl $0x2, %edx
movq %rbx, %rdi
leaq 0x8f1d(%rip), %rsi      # 0x463d6
movq %r8, %r15
callq 0xb320
movq %r15, %r8
movq %r12, %rsi
movq -0x38(%rbp), %rdi
imulq %rdi, %rsi
movq %r14, %rcx
subq %rsi, %rcx
movq %rcx, %rax
xorl %edx, %edx
divq %rdi
testq %rdx, %rdx
jne 0x3db2e
xorl %eax, %eax
cmpq %rsi, %r14
setne %al
movq %rax, -0x50(%rbp)
xorl %r13d, %r13d
cmpq %rdi, %rcx
jbe 0x3d584
xorl %r13d, %r13d
cmpq %rdi, %rcx
jle 0x3d581
leaq (%r8,%rcx,4), %rax
leaq (%r8,%rdi,4), %rcx
xorl %esi, %esi
movq %r8, %rdx
xorl %r13d, %r13d
movq %r8, %r15
movq -0x38(%rbp), %rdi
leaq (%rcx,%rdi,4), %rdi
movl %r13d, %r8d
movl (%rcx), %r9d
leal 0x1(%r9), %r10d
cmpl $0x3, %r10d
jae 0x3d545
cmpl (%rdx), %r9d
jne 0x3d57e
addq $0x4, %rdx
addq $0x4, %rcx
cmpq %rdi, %rcx
jb 0x3d524
jmp 0x3d570
movl (%rdx), %r10d
leal 0x1(%r10), %r11d
cmpl $0x3, %r11d
jb 0x3d531
subl %r10d, %r9d
testb $0x1, %sil
je 0x3d565
movb $0x1, %sil
cmpl %r8d, %r9d
je 0x3d536
jmp 0x3d57e
movl %r9d, %r13d
movl %r9d, %r8d
movb $0x1, %sil
jmp 0x3d536
incq -0x50(%rbp)
cmpq %rax, %rcx
movq %r15, %r8
jb 0x3d516
jmp 0x3d581
movq %r15, %r8
sarl %r13d
testq %r12, %r12
movq %r12, -0x78(%rbp)
movl %r13d, -0x6c(%rbp)
jne 0x3d5c5
testb $0x1, -0x40(%rbp)
jne 0x3d5c5
movq -0x50(%rbp), %rax
imulq -0x38(%rbp), %rax
cmpq %r14, %rax
jae 0x3d5c5
movl $0x1, %edx
movq %rbx, %rdi
leaq 0xab29(%rip), %rsi      # 0x480dd
movq %r8, %r14
callq 0xb320
movq %r14, %r8
movb $0x1, %al
movq %rax, -0x40(%rbp)
movq $0x0, -0x48(%rbp)
xorl %r15d, %r15d
movq %r15, %rbx
movq -0x38(%rbp), %r14
xorl %r13d, %r13d
xorl %eax, %eax
cmpl $0x1, (%r8,%rax,4)
ja 0x3d604
sete %cl
movzbl %cl, %ecx
leaq (%rcx,%r13,2), %r13
leaq 0x1(%rax), %r12
incq %rbx
cmpq $0x3e, %rax
ja 0x3d610
movq %r12, %rax
cmpq %r14, %rbx
jb 0x3d5dc
jmp 0x3d610
movq %rax, %r12
testq %rax, %rax
je 0x3d9b5
testq %r15, %r15
movq %r8, -0x60(%rbp)
je 0x3d970
movl $0x2, %edx
movq -0x30(%rbp), %rdi
leaq 0x8da9(%rip), %rsi      # 0x463d6
callq 0xb320
subl %r15d, %r14d
andl $0x3, %r14d
cmpq $0x4, %r12
movq %r12, %r15
cmovaeq %r14, %r15
testq %r15, %r15
je 0x3d72b
movq %r14, -0x68(%rbp)
movq %r12, %rax
subq %r15, %rax
movl $0x0, %ecx
cmovaeq %rax, %rcx
movq %rcx, -0x58(%rbp)
movq %r13, %r14
shrq %cl, %r14
movl $0x2, %edx
movq -0x30(%rbp), %rdi
leaq 0xe872(%rip), %rsi      # 0x4beec
callq 0xb320
cmpq $0x3, %r15
setae %al
cmpq $0x3, %r12
setae %cl
andb %al, %cl
testb $0x4, %r14b
leaq 0x1c9a(%rip), %rsi      # 0x3f334
leaq 0x3e4d(%rip), %rax      # 0x414ee
cmoveq %rax, %rsi
testb %cl, %cl
leaq 0xe626(%rip), %rax      # 0x4bcd4
cmoveq %rax, %rsi
movzbl %cl, %edx
movq -0x30(%rbp), %rdi
callq 0xb320
testb $0x2, %r14b
leaq 0x1c6b(%rip), %rsi      # 0x3f334
leaq 0x3e1e(%rip), %rax      # 0x414ee
cmoveq %rax, %rsi
xorl %edx, %edx
cmpq $0x1, %r15
setne %dl
leaq 0xe5f0(%rip), %rax      # 0x4bcd4
cmoveq %rax, %rsi
movq -0x30(%rbp), %r14
movq %r14, %rdi
callq 0xb320
movq -0x58(%rbp), %rax
btq %rax, %r13
leaq 0x1c31(%rip), %rsi      # 0x3f334
leaq 0x3de4(%rip), %rax      # 0x414ee
cmovaeq %rax, %rsi
movl $0x1, %edx
movq %r14, %rdi
callq 0xb320
movq -0x68(%rbp), %r14
movl %r15d, %ecx
subl %r12d, %ecx
shlq %cl, %r13
shrq %cl, %r13
movq -0x60(%rbp), %r8
cmpq $0x4, %r12
jb 0x3d8bc
movq %r12, %rax
subq %r14, %rax
movl %eax, %r14d
andl $0x3, %r14d
cmpq $0x4, %rax
jb 0x3d7fc
movq %rax, -0x68(%rbp)
testq %r15, %r15
movq -0x30(%rbp), %r15
je 0x3d771
movl $0x2, %edx
movq %r15, %rdi
leaq 0x8c6a(%rip), %rsi      # 0x463d6
callq 0xb320
movl $0x2, %edx
movq %r15, %rdi
leaq 0xe76f(%rip), %rsi      # 0x4beef
callq 0xb320
movq (%r15), %rax
movq -0x18(%rax), %rcx
leaq (%r15,%rcx), %rdx
cmpb $0x0, 0xe1(%r15,%rcx)
jne 0x3d7bb
movq %rdx, -0x58(%rbp)
movq -0x58(%rbp), %rdi
movl $0x20, %esi
callq 0xb2a0
movq -0x58(%rbp), %rdx
movb $0x1, 0xe1(%rdx)
movq (%r15), %rax
movb $0x30, 0xe0(%rdx)
movq -0x18(%rax), %rcx
movq -0x68(%rbp), %rdx
sarq $0x2, %rdx
movq %rdx, 0x10(%r15,%rcx)
movq -0x18(%rax), %rax
movl 0x18(%r15,%rax), %ecx
andl $-0x4b, %ecx
orl $0x8, %ecx
movl %ecx, 0x18(%r15,%rax)
movq %r13, %rsi
movl %r14d, %ecx
shrq %cl, %rsi
movq %r15, %rdi
callq 0xb190
movq -0x60(%rbp), %r8
testq %r14, %r14
je 0x3d8bc
movl $0x2, %edx
movq -0x30(%rbp), %r15
movq %r15, %rdi
leaq 0x8bbe(%rip), %rsi      # 0x463d6
callq 0xb320
movl $0x2, %edx
movq %r15, %rdi
leaq 0xe6c0(%rip), %rsi      # 0x4beec
callq 0xb320
testb $0x4, %r13b
leaq 0x1af8(%rip), %rsi      # 0x3f334
leaq 0x3cab(%rip), %rax      # 0x414ee
cmoveq %rax, %rsi
xorl %edx, %edx
cmpq $0x3, %r14
sete %dl
leaq 0xe47d(%rip), %rax      # 0x4bcd4
cmovneq %rax, %rsi
movq %r15, %rdi
callq 0xb320
testb $0x2, %r13b
leaq 0x1ac6(%rip), %rsi      # 0x3f334
leaq 0x3c79(%rip), %rax      # 0x414ee
cmoveq %rax, %rsi
xorl %edx, %edx
cmpq $0x1, %r14
setne %dl
leaq 0xe44b(%rip), %rax      # 0x4bcd4
cmoveq %rax, %rsi
movq %r15, %rdi
callq 0xb320
testb $0x1, %r13b
leaq 0x1a94(%rip), %rsi      # 0x3f334
leaq 0x3c47(%rip), %rax      # 0x414ee
cmoveq %rax, %rsi
movl $0x1, %edx
movq %r15, %rdi
callq 0xb320
movq -0x60(%rbp), %r8
leaq (%r8,%r12,4), %r8
movq -0x38(%rbp), %r14
movq %r14, %rax
subq %rbx, %rax
je 0x3d8e3
movl (%r8), %edx
xorl %r13d, %r13d
cmpl $0x2, %edx
movq -0x30(%rbp), %r15
jae 0x3d8f2
xorl %r14d, %r14d
jmp 0x3d9d4
xorl %r14d, %r14d
xorl %r13d, %r13d
movq -0x30(%rbp), %r15
jmp 0x3d9d4
movl $0x1, %r14d
cmpq $0x1, %rax
je 0x3d9d4
movl 0x4(%r8), %ecx
cmpl $-0x1, %edx
je 0x3d9bd
leal 0x1(%rcx), %esi
cmpl $0x3, %esi
jb 0x3d9d4
subl %edx, %ecx
testb $0x1, %cl
jne 0x3d969
cmpq $0x3, %rax
jb 0x3d956
movl $0x2, %r14d
movl (%r8,%r14,4), %edx
leal 0x1(%rdx), %esi
cmpl $0x3, %esi
jb 0x3d950
movl -0x4(%r8,%r14,4), %esi
addl %ecx, %esi
cmpl %edx, %esi
jne 0x3d950
incq %r14
cmpq %r14, %rax
jne 0x3d92e
movq %rax, %r14
cmpq $0x2, %r14
jne 0x3d969
leal 0x2(%rcx), %eax
andl $-0x6, %eax
cmpl $0x1, %eax
movl $0x0, %r14d
adcq $0x1, %r14
sarl %ecx
movl %ecx, %r13d
jmp 0x3d9d4
cmpq %r14, %r12
jb 0x3d98b
cmpq $0x4, %r12
setb %al
testb $0x3, %r12b
sete %cl
orb %al, %cl
jne 0x3d632
testb $0x1, -0x48(%rbp)
jne 0x3d632
movl $0x1, %edx
movq -0x30(%rbp), %rdi
leaq 0xa738(%rip), %rsi      # 0x480dd
callq 0xb320
movb $0x1, %al
movq %rax, -0x48(%rbp)
jmp 0x3d632
movq %r15, %rbx
jmp 0x3d8c4
cmpl $-0x1, %ecx
jne 0x3d9d4
cmpl $-0x1, (%r8,%r14,4)
jne 0x3d9d4
incq %r14
cmpq %r14, %rax
jne 0x3d9c2
movq %rax, %r14
movq %rbx, %rax
orq -0x78(%rbp), %rax
je 0x3d9e7
testq %r14, %r14
jne 0x3da1a
jmp 0x3da9c
testb $0x1, -0x40(%rbp)
jne 0x3d9dd
cmpq $0x1, -0x50(%rbp)
jne 0x3d9dd
cmpq $0x2, %r14
jb 0x3d9dd
movl $0x1, %edx
movq %r15, %rdi
leaq 0xa6d4(%rip), %rsi      # 0x480dd
movq %r8, %r12
callq 0xb320
movq %r12, %r8
movb $0x1, %al
movq %rax, -0x40(%rbp)
testq %rbx, %rbx
jne 0x3da53
testb $0x1, -0x48(%rbp)
jne 0x3da53
cmpl $0x1, -0x38(%rbp)
ja 0x3da31
cmpq $0x1, %r14
je 0x3da72
movl $0x1, %edx
movq %r15, %rdi
leaq 0xa69d(%rip), %rsi      # 0x480dd
movq %r8, %r12
callq 0xb320
movq %r12, %r8
movb $0x1, %al
movq %rax, -0x48(%rbp)
jmp 0x3da72
testq %rbx, %rbx
je 0x3da72
movl $0x2, %edx
movq %r15, %rdi
leaq 0x896f(%rip), %rsi      # 0x463d6
movq %r8, %r12
callq 0xb320
movq %r12, %r8
movl (%r8), %eax
movl %eax, -0x70(%rbp)
movq %r15, %rdi
leaq -0x70(%rbp), %rsi
movq %r8, %r12
callq 0xf3a7
movq %r15, %rdi
movq %r14, %rsi
movl %r13d, %edx
callq 0x3d3b0
leaq (%r12,%r14,4), %r8
addq %r14, %rbx
movq %rbx, %r15
movq -0x38(%rbp), %r14
cmpq %r14, %rbx
jb 0x3d5d7
movq %r8, %r15
testb $0x1, -0x48(%rbp)
movq -0x30(%rbp), %rbx
je 0x3dacd
movl $0x1, %edx
movq %rbx, %rdi
leaq 0xa617(%rip), %rsi      # 0x480df
callq 0xb320
movq %rbx, %rdi
movq -0x50(%rbp), %r13
movq %r13, %rsi
movl -0x6c(%rbp), %edx
callq 0x3d3b0
movq -0x78(%rbp), %r12
addq %r13, %r12
decq %r13
imulq %r14, %r13
leaq (%r15,%r13,4), %r8
cmpq -0x80(%rbp), %r12
movq -0x88(%rbp), %r14
jb 0x3d4a5
testb $0x1, -0x40(%rbp)
je 0x3db1c
leaq 0xa5d0(%rip), %rsi      # 0x480df
movl $0x1, %edx
movq %rbx, %rdi
callq 0xb320
movq %rbx, %rax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xe3bd(%rip), %rdi      # 0x4bef2
leaq 0xe34a(%rip), %rsi      # 0x4be86
leaq 0xe3c6(%rip), %rcx      # 0x4bf09
movl $0x43, %edx
callq 0xb180
leaq 0xe30d(%rip), %rdi      # 0x4be61
leaq 0xe32b(%rip), %rsi      # 0x4be86
leaq 0xe344(%rip), %rcx      # 0x4bea6
movl $0x81, %edx
callq 0xb180