// File: /workspace/github_c_makefile_star2_O2/masyagin1998[P]GCI/src/parser/parser.c
// Function: logical_or_expr_ast_read
static enum PARSER_CODES logical_or_expr_ast_read(struct PARSER*parser, struct LOGICAL_OR_EXPR_AST**logical_or_expr)
{
    enum PARSER_CODES r;

    struct LOGICAL_AND_EXPR_AST**logical_and_exprs = NULL;
    size_t logical_and_exprs_len = 0;
    size_t logical_and_exprs_cap = 0;
    
    struct LOGICAL_AND_EXPR_AST*logical_and_expr;


    r = logical_and_expr_ast_read(parser, &logical_and_expr);
    if (r != PARSER_OK) {
        goto err0;
    }

    PUSH_BACK(logical_and_exprs, logical_and_expr);

    while ((parser->tok)->token_type == TOKEN_TYPE_OR) {
        token_free((parser->tok));
        lexer_next_token(parser->lexer, &(parser->tok));

        r = logical_and_expr_ast_read(parser, &logical_and_expr);
        if (r != PARSER_OK) {
            goto err1;
        }

        PUSH_BACK(logical_and_exprs, logical_and_expr);
    }

    (*logical_or_expr) = create_logical_or_expr_ast(logical_and_exprs, logical_and_exprs_len,
                                                    (parser->tok)->frag.starting.line,
                                                    (parser->tok)->frag.starting.pos);

    return PARSER_OK;

 err1:
    {
        size_t i;
        for (i = 0; i < logical_and_exprs_len; i++) {
            logical_and_expr_ast_free(logical_and_exprs[i]);
        }
        SAFE_FREE(logical_and_exprs);
    }
 err0:
    (*logical_or_expr) = NULL;
    return r;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %r14
movq %rdi, %r15
leaq 0x8(%rsp), %rsi
callq 0x47ec
testl %eax, %eax
je 0x4678
movl %eax, %ebx
xorl %eax, %eax
jmp 0x4763
movq %r14, 0x10(%rsp)
pushq $0x8
popq %rdi
callq 0x1130
testq %rax, %rax
je 0x47bc
movq %rax, %r14
leaq 0x8(%rsp), %rax
movq (%rax), %rax
movq %rax, (%r14)
leaq 0x8(%r15), %rbp
pushq $0x1
popq %r13
movq %r13, %r12
movq (%rbp), %rdi
cmpl $0xd, (%rdi)
jne 0x4725
callq 0x297c
movq (%r15), %rdi
movq %rbp, %rsi
callq 0x1c9f
movq %r15, %rdi
leaq 0x8(%rsp), %rsi
callq 0x47ec
testl %eax, %eax
jne 0x473c
cmpq %r13, %r12
jne 0x4717
testq %r12, %r12
je 0x46ff
movq %r12, %rbx
shlq $0x4, %rbx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x1160
testq %rax, %rax
je 0x4777
movq %rax, %r14
leaq (%r12,%r12), %r13
jmp 0x4717
pushq $0x8
popq %rdi
callq 0x1130
testq %rax, %rax
je 0x4799
movq %rax, %r14
pushq $0x1
popq %r13
movq 0x8(%rsp), %rax
movq %rax, (%r14,%r12,8)
incq %r12
jmp 0x46a7
movq 0x18(%rdi), %rdx
movq 0x20(%rdi), %rcx
movq %r14, %rdi
movq %r12, %rsi
callq 0x72b6
xorl %ebx, %ebx
jmp 0x475e
movl %eax, %ebx
xorl %r15d, %r15d
cmpq %r15, %r12
je 0x4754
movq (%r14,%r15,8), %rdi
callq 0x7442
incq %r15
jmp 0x4741
movq %r14, %rdi
callq 0x1030
xorl %eax, %eax
movq 0x10(%rsp), %r14
movq %rax, (%r14)
movl %ebx, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x11872(%rip), %rax     # 0x15ff0
movq (%rax), %rdi
leaq 0xa169(%rip), %rsi      # 0xe8f1
leaq 0xa035(%rip), %rdx      # 0xe7c4
movl $0x382, %ecx            # imm = 0x382
movq %rbx, %r8
jmp 0x47dd
movq 0x11850(%rip), %rax     # 0x15ff0
movq (%rax), %rdi
leaq 0x9e14(%rip), %rsi      # 0xe5be
leaq 0xa013(%rip), %rdx      # 0xe7c4
pushq $0x8
popq %r8
movl $0x382, %ecx            # imm = 0x382
jmp 0x47dd
movq 0x1182d(%rip), %rax     # 0x15ff0
movq (%rax), %rdi
leaq 0x9df1(%rip), %rsi      # 0xe5be
leaq 0x9ff0(%rip), %rdx      # 0xe7c4
pushq $0x8
popq %r8
movl $0x377, %ecx            # imm = 0x377
xorl %eax, %eax
callq 0x1100
pushq $0x1
popq %rdi
callq 0x1180