// File: /workspace/github_cpp_makefile_star2_O2/vsklad[P]cgen/./bal/variables/variablesio.cpp
// Function: bal::VariableTextReader::read_variable_element_(bal::Container<unsigned int>&, unsigned int)
inline container_size_t VariableTextReader::read_variable_element_(Container<literalid_t>& value, const unsigned level) {
        const container_size_t baseline_size = value.size_;
        container_size_t element_size = 1;
        
        const bool b_brackets = is_token(TextReader::ttSymbol) && is_symbol('{');
        if (b_brackets) {
            skip_symbol();
            skip_space();
        
            element_size = read_variable_element_(value, level + 1);
        
            // read more elements
            skip_space();
            while (is_symbol(',')) {
                skip_symbol();
                skip_space();
                
                const container_size_t other_size = read_variable_element_(value, level + 1);
                if (other_size != element_size) {
                    // there is no structure, assume a single element
                    element_size = 0;
                };
                
                skip_space();
            };
            
            read_symbol('}');
        } else {
            read_variable_element_item_(value);
            element_size = value.size_ - baseline_size;
        };
        
        if (!b_brackets || element_size == 0 || level >= 1 || is_variable_element_sequence_()) {
            element_size = value.size_ - baseline_size;
        };
        
        read_variable_elements_sequence_(value, element_size);
        
        return level <= 1 ? element_size : value.size_ - baseline_size;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %edx, %ebx
movq %rsi, %r14
movq %rdi, %r15
movl 0x8(%rsi), %r13d
movq (%rdi), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
pushq $0x6
popq %rsi
callq 0x18644
testb %al, %al
je 0x305dd
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
pushq $0x7b
popq %rsi
callq 0x18a92
testb %al, %al
je 0x305dd
movl %r13d, -0x2c(%rbp)
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
callq 0x197ba
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
callq 0x2d286
movq %rbx, -0x38(%rbp)
leal 0x1(%rbx), %r13d
movq %r15, %rdi
movq %r14, %rsi
movl %r13d, %edx
callq 0x304f4
movl %eax, %r12d
pushq $0x2c
popq %rbx
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
callq 0x2d286
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl %ebx, %esi
callq 0x18a92
movq (%r15), %rcx
movq -0x18(%rcx), %rdi
addq %r15, %rdi
testb %al, %al
je 0x305f3
callq 0x197ba
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
callq 0x2d286
movq %r15, %rdi
movq %r14, %rsi
movl %r13d, %edx
callq 0x304f4
cmpl %r12d, %eax
je 0x30583
xorl %r12d, %r12d
jmp 0x30583
movq %r15, %rdi
movq %r14, %rsi
callq 0x30650
movl 0x8(%r14), %r12d
subl %r13d, %r12d
movb $0x1, %al
jmp 0x30605
pushq $0x7d
popq %rsi
callq 0x18ac2
xorl %eax, %eax
movq -0x38(%rbp), %rbx
movl -0x2c(%rbp), %r13d
testl %ebx, %ebx
jne 0x3061e
testb %al, %al
jne 0x3061e
testl %r12d, %r12d
je 0x3061e
movq %r15, %rdi
callq 0x309be
testb %al, %al
je 0x30625
movl 0x8(%r14), %r12d
subl %r13d, %r12d
movq %r15, %rdi
movq %r14, %rsi
movl %r12d, %edx
callq 0x30a0e
movl 0x8(%r14), %eax
subl %r13d, %eax
cmpl $0x2, %ebx
cmovbl %r12d, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq