// File: /workspace/github_c_makefile_star2_O0/masyagin1998[P]GCI/src/parser/parser.c
// Function: additive_expr_ast_read
static enum PARSER_CODES additive_expr_ast_read(struct PARSER*parser, struct ADDITIVE_EXPR_AST**additive_expr)
{
    enum PARSER_CODES r;

    struct MULTIPLICATIVE_EXPR_AST**multiplicative_exprs = NULL;
    size_t multiplicative_exprs_len = 0;
    size_t multiplicative_exprs_cap = 0;

    enum AST_ADDITIVE_OP*ops = NULL;
    size_t ops_len = 0;
    size_t ops_cap = 0;
    
    struct MULTIPLICATIVE_EXPR_AST*multiplicative_expr;

    r = multiplicative_expr_ast_read(parser, &multiplicative_expr);
    if (r != PARSER_OK) {
        goto err0;
    }

    PUSH_BACK(multiplicative_exprs, multiplicative_expr);

    while (((parser->tok)->token_type == TOKEN_TYPE_PLUS) || ((parser->tok)->token_type == TOKEN_TYPE_MINUS)) {
        if ((parser->tok)->token_type == TOKEN_TYPE_PLUS) {
            PUSH_BACK(ops, AST_ADDITIVE_OP_PLUS);
        } else if ((parser->tok)->token_type == TOKEN_TYPE_MINUS) {
            PUSH_BACK(ops, AST_ADDITIVE_OP_MINUS);
        }
        
        token_free((parser->tok));
        lexer_next_token(parser->lexer, &(parser->tok));

        r = multiplicative_expr_ast_read(parser, &multiplicative_expr);
        if (r != PARSER_OK) {
            goto err1;
        }

        PUSH_BACK(multiplicative_exprs, multiplicative_expr);
    }

    (*additive_expr) = create_additive_expr_ast(multiplicative_exprs, ops, multiplicative_exprs_len,
                                                (parser->tok)->frag.starting.line,
                                                (parser->tok)->frag.starting.pos);

    return PARSER_OK;

 err1:
    {
        size_t i;
        for (i = 0; i < multiplicative_exprs_len; i++) {
            multiplicative_expr_ast_free(multiplicative_exprs[i]);
        }
        SAFE_FREE(multiplicative_exprs);
    }
 err0:
    (*additive_expr) = NULL;
    return r;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq $0x0, -0x28(%rbp)
movq $0x0, -0x30(%rbp)
movq $0x0, -0x38(%rbp)
movq $0x0, -0x40(%rbp)
movq $0x0, -0x48(%rbp)
movq $0x0, -0x50(%rbp)
movq -0x10(%rbp), %rdi
leaq -0x58(%rbp), %rsi
callq 0x72d0
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0x6ddb
jmp 0x72b0
jmp 0x6ddd
movq -0x30(%rbp), %rax
cmpq -0x38(%rbp), %rax
jne 0x6ead
cmpq $0x0, -0x38(%rbp)
jne 0x6e4b
movq $0x1, -0x38(%rbp)
movq -0x38(%rbp), %rdi
shlq $0x3, %rdi
callq 0x1130
movq %rax, -0x28(%rbp)
cmpq $0x0, %rax
jne 0x6e47
movq 0x181d8(%rip), %rax     # 0x1eff0
movq (%rax), %rdi
movq -0x38(%rbp), %r8
shlq $0x3, %r8
leaq 0x117e4(%rip), %rsi     # 0x1860e
leaq 0x11a37(%rip), %rdx     # 0x18868
movl $0x2b6, %ecx            # imm = 0x2B6
movb $0x0, %al
callq 0x1100
movl $0x1, %edi
callq 0x1170
jmp 0x6e49
jmp 0x6eab
movq -0x38(%rbp), %rax
shlq %rax
movq %rax, -0x38(%rbp)
movq -0x28(%rbp), %rdi
movq -0x38(%rbp), %rsi
shlq $0x3, %rsi
callq 0x1150
movq %rax, -0x28(%rbp)
cmpq $0x0, %rax
jne 0x6ea7
movq 0x18178(%rip), %rax     # 0x1eff0
movq (%rax), %rdi
movq -0x38(%rbp), %r8
shlq $0x3, %r8
leaq 0x11b0b(%rip), %rsi     # 0x18995
leaq 0x119d7(%rip), %rdx     # 0x18868
movl $0x2b6, %ecx            # imm = 0x2B6
movb $0x0, %al
callq 0x1100
movl $0x1, %edi
callq 0x1170
jmp 0x6ea9
jmp 0x6eab
jmp 0x6ead
movq -0x58(%rbp), %rdx
movq -0x28(%rbp), %rax
movq -0x30(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x6ecb
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rcx
movb $0x1, %al
cmpl $0x16, (%rcx)
movb %al, -0x61(%rbp)
je 0x6eee
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
cmpl $0x17, (%rax)
sete %al
movb %al, -0x61(%rbp)
movb -0x61(%rbp), %al
testb $0x1, %al
jne 0x6efa
jmp 0x722e
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
cmpl $0x16, (%rax)
jne 0x6ffd
jmp 0x6f0d
movq -0x48(%rbp), %rax
cmpq -0x50(%rbp), %rax
jne 0x6fdd
cmpq $0x0, -0x50(%rbp)
jne 0x6f7b
movq $0x1, -0x50(%rbp)
movq -0x50(%rbp), %rdi
shlq $0x2, %rdi
callq 0x1130
movq %rax, -0x40(%rbp)
cmpq $0x0, %rax
jne 0x6f77
movq 0x180a8(%rip), %rax     # 0x1eff0
movq (%rax), %rdi
movq -0x50(%rbp), %r8
shlq $0x2, %r8
leaq 0x116b4(%rip), %rsi     # 0x1860e
leaq 0x11907(%rip), %rdx     # 0x18868
movl $0x2ba, %ecx            # imm = 0x2BA
movb $0x0, %al
callq 0x1100
movl $0x1, %edi
callq 0x1170
jmp 0x6f79
jmp 0x6fdb
movq -0x50(%rbp), %rax
shlq %rax
movq %rax, -0x50(%rbp)
movq -0x40(%rbp), %rdi
movq -0x50(%rbp), %rsi
shlq $0x2, %rsi
callq 0x1150
movq %rax, -0x40(%rbp)
cmpq $0x0, %rax
jne 0x6fd7
movq 0x18048(%rip), %rax     # 0x1eff0
movq (%rax), %rdi
movq -0x50(%rbp), %r8
shlq $0x2, %r8
leaq 0x119db(%rip), %rsi     # 0x18995
leaq 0x118a7(%rip), %rdx     # 0x18868
movl $0x2ba, %ecx            # imm = 0x2BA
movb $0x0, %al
callq 0x1100
movl $0x1, %edi
callq 0x1170
jmp 0x6fd9
jmp 0x6fdb
jmp 0x6fdd
movq -0x40(%rbp), %rax
movq -0x48(%rbp), %rcx
movl $0x0, (%rax,%rcx,4)
movq -0x48(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x48(%rbp)
jmp 0x70ff
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
cmpl $0x17, (%rax)
jne 0x70fd
jmp 0x7010
movq -0x48(%rbp), %rax
cmpq -0x50(%rbp), %rax
jne 0x70e0
cmpq $0x0, -0x50(%rbp)
jne 0x707e
movq $0x1, -0x50(%rbp)
movq -0x50(%rbp), %rdi
shlq $0x2, %rdi
callq 0x1130
movq %rax, -0x40(%rbp)
cmpq $0x0, %rax
jne 0x707a
movq 0x17fa5(%rip), %rax     # 0x1eff0
movq (%rax), %rdi
movq -0x50(%rbp), %r8
shlq $0x2, %r8
leaq 0x115b1(%rip), %rsi     # 0x1860e
leaq 0x11804(%rip), %rdx     # 0x18868
movl $0x2bc, %ecx            # imm = 0x2BC
movb $0x0, %al
callq 0x1100
movl $0x1, %edi
callq 0x1170
jmp 0x707c
jmp 0x70de
movq -0x50(%rbp), %rax
shlq %rax
movq %rax, -0x50(%rbp)
movq -0x40(%rbp), %rdi
movq -0x50(%rbp), %rsi
shlq $0x2, %rsi
callq 0x1150
movq %rax, -0x40(%rbp)
cmpq $0x0, %rax
jne 0x70da
movq 0x17f45(%rip), %rax     # 0x1eff0
movq (%rax), %rdi
movq -0x50(%rbp), %r8
shlq $0x2, %r8
leaq 0x118d8(%rip), %rsi     # 0x18995
leaq 0x117a4(%rip), %rdx     # 0x18868
movl $0x2bc, %ecx            # imm = 0x2BC
movb $0x0, %al
callq 0x1100
movl $0x1, %edi
callq 0x1170
jmp 0x70dc
jmp 0x70de
jmp 0x70e0
movq -0x40(%rbp), %rax
movq -0x48(%rbp), %rcx
movl $0x1, (%rax,%rcx,4)
movq -0x48(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x48(%rbp)
jmp 0x70fd
jmp 0x70ff
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x31b0
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x10(%rbp), %rsi
addq $0x8, %rsi
callq 0x1fd0
movq -0x10(%rbp), %rdi
leaq -0x58(%rbp), %rsi
callq 0x72d0
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0x713b
jmp 0x726a
jmp 0x713d
movq -0x30(%rbp), %rax
cmpq -0x38(%rbp), %rax
jne 0x720d
cmpq $0x0, -0x38(%rbp)
jne 0x71ab
movq $0x1, -0x38(%rbp)
movq -0x38(%rbp), %rdi
shlq $0x3, %rdi
callq 0x1130
movq %rax, -0x28(%rbp)
cmpq $0x0, %rax
jne 0x71a7
movq 0x17e78(%rip), %rax     # 0x1eff0
movq (%rax), %rdi
movq -0x38(%rbp), %r8
shlq $0x3, %r8
leaq 0x11484(%rip), %rsi     # 0x1860e
leaq 0x116d7(%rip), %rdx     # 0x18868
movl $0x2c7, %ecx            # imm = 0x2C7
movb $0x0, %al
callq 0x1100
movl $0x1, %edi
callq 0x1170
jmp 0x71a9
jmp 0x720b
movq -0x38(%rbp), %rax
shlq %rax
movq %rax, -0x38(%rbp)
movq -0x28(%rbp), %rdi
movq -0x38(%rbp), %rsi
shlq $0x3, %rsi
callq 0x1150
movq %rax, -0x28(%rbp)
cmpq $0x0, %rax
jne 0x7207
movq 0x17e18(%rip), %rax     # 0x1eff0
movq (%rax), %rdi
movq -0x38(%rbp), %r8
shlq $0x3, %r8
leaq 0x117ab(%rip), %rsi     # 0x18995
leaq 0x11677(%rip), %rdx     # 0x18868
movl $0x2c7, %ecx            # imm = 0x2C7
movb $0x0, %al
callq 0x1100
movl $0x1, %edi
callq 0x1170
jmp 0x7209
jmp 0x720b
jmp 0x720d
movq -0x58(%rbp), %rdx
movq -0x28(%rbp), %rax
movq -0x30(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x6ecb
movq -0x28(%rbp), %rdi
movq -0x40(%rbp), %rsi
movq -0x30(%rbp), %rdx
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x18(%rax), %rcx
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x20(%rax), %r8
callq 0xc420
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
movl $0x0, -0x4(%rbp)
jmp 0x72c1
movq $0x0, -0x60(%rbp)
movq -0x60(%rbp), %rax
cmpq -0x30(%rbp), %rax
jae 0x729b
movq -0x28(%rbp), %rax
movq -0x60(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0xc6d0
movq -0x60(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x60(%rbp)
jmp 0x7272
jmp 0x729d
movq -0x28(%rbp), %rdi
callq 0x1030
movq $0x0, -0x28(%rbp)
jmp 0x72b0
movq -0x18(%rbp), %rax
movq $0x0, (%rax)
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x70, %rsp
popq %rbp
retq
nopw (%rax,%rax)