// File: /workspace/github_c_makefile_star2_O1/masyagin1998[P]GCI/src/parser/parser.c
// Function: variable_ast_read
static enum PARSER_CODES variable_ast_read(struct PARSER*parser, struct VARIABLE_AST**variable, struct IDENT_AST*ident)
{
    enum PARSER_CODES r;
    
    struct VARIABLE_PART_AST**parts = NULL;
    size_t parts_len = 0;
    size_t parts_cap = 0;

    while (((parser->tok)->token_type == TOKEN_TYPE_DOT) ||
           ((parser->tok)->token_type == TOKEN_TYPE_LBRACKET)) {
        struct VARIABLE_PART_AST*part;
        r = variable_part_ast_read(parser, &part);
        if (r != PARSER_OK) {
            goto err0;
        }

        PUSH_BACK(parts, part);
    }

    (*variable) = create_variable_ast(ident, parts, parts_len,
                                      (parser->tok)->frag.starting.line,
                                      (parser->tok)->frag.starting.pos);

    return PARSER_OK;

 err0:
    {
        size_t i;
        for (i = 0; i < parts_len; i++) {
            variable_part_ast_free(parts[i]);
        }
        SAFE_FREE(parts);
    }
    (*variable) = NULL;
    return r;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdx, 0x28(%rsp)
movq %rsi, 0x30(%rsp)
movq %rdi, %r13
leaq 0x8(%rdi), %rbp
movq $0x0, 0x8(%rsp)
leaq 0x18(%rsp), %r14
movq $0x0, 0x10(%rsp)
xorl %r15d, %r15d
movq (%rbp), %rdi
movl (%rdi), %eax
cmpl $0x1e, %eax
je 0x69c0
cmpl $0x24, %eax
jne 0x6b04
callq 0x53b0
movq (%r13), %rdi
movq %rbp, %rsi
callq 0x45b5
movq %r13, %rdi
movq %r14, %rsi
callq 0x5cbc
movl %eax, %r12d
testl %eax, %eax
jne 0x69b0
movq 0x18(%rsp), %rdi
xorl %esi, %esi
callq 0x94a5
movq %rax, 0x20(%rsp)
testl %r12d, %r12d
jne 0x6a51
xorl %ebx, %ebx
jmp 0x6a5d
callq 0x53b0
movq (%r13), %rdi
movq %rbp, %rsi
callq 0x45b5
movq %r13, %rdi
movq %r14, %rsi
callq 0x723e
xorl %ebx, %ebx
testl %eax, %eax
je 0x69ea
movl %eax, %r12d
xorl %r14d, %r14d
jmp 0x6a47
movq (%rbp), %rdi
cmpl $0x1f, (%rdi)
jne 0x6a20
callq 0x53b0
movq (%r13), %rdi
movq %rbp, %rsi
callq 0x45b5
movq 0x18(%rsp), %rdi
movl $0x1, %esi
callq 0x94a5
movq %rax, 0x20(%rsp)
movb $0x1, %r14b
xorl %r12d, %r12d
jmp 0x6a47
movq 0x18(%rsp), %rdi
callq 0x8f73
xorl %r14d, %r14d
movl $0x1, %esi
movq %r13, %rdi
movl $0x1f, %edx
xorl %eax, %eax
callq 0x5bec
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
testb %r14b, %r14b
leaq 0x18(%rsp), %r14
jne 0x6a5d
movq $0x0, 0x20(%rsp)
movl %r12d, %ebx
testl %ebx, %ebx
jne 0x6acd
cmpq %r15, 0x10(%rsp)
jne 0x6ab2
testq %r15, %r15
je 0x6a94
movq %r15, %r12
shlq $0x4, %r12
movq 0x8(%rsp), %rdi
movq %r12, %rsi
callq 0x1160
movq %rax, 0x8(%rsp)
testq %rax, %rax
je 0x6b3b
addq %r15, %r15
jmp 0x6ab2
movl $0x8, %edi
callq 0x1130
movq %rax, 0x8(%rsp)
testq %rax, %rax
je 0x6b43
movl $0x1, %r15d
movq 0x8(%rsp), %rax
movq 0x10(%rsp), %rcx
movq 0x20(%rsp), %rdx
movq %rdx, (%rax,%rcx,8)
incq %rcx
movq %rcx, 0x10(%rsp)
testl %ebx, %ebx
je 0x6968
movq 0x10(%rsp), %r15
testq %r15, %r15
movq 0x8(%rsp), %r12
je 0x6af8
xorl %r14d, %r14d
movq (%r12,%r14,8), %rdi
callq 0x9603
incq %r14
cmpq %r14, %r15
jne 0x6ae7
movq %r12, %rdi
callq 0x1030
xorl %eax, %eax
jmp 0x6b22
movq 0x18(%rdi), %rcx
movq 0x20(%rdi), %r8
movq 0x28(%rsp), %rdi
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
callq 0x9633
xorl %ebx, %ebx
movq 0x30(%rsp), %rcx
movq %rax, (%rcx)
movl %ebx, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r12, %rdi
callq 0x176d
callq 0x179d