// File: /workspace/github_c_makefile_star2_O1/masyagin1998[P]GCI/src/parser/parser.c
// Function: multiplicative_expr_ast_read
static enum PARSER_CODES multiplicative_expr_ast_read(struct PARSER*parser, struct MULTIPLICATIVE_EXPR_AST**multiplicative_expr)
{
    enum PARSER_CODES r;

    struct LEFT_UNARY_EXPR_AST**left_unary_exprs = NULL;
    size_t left_unary_exprs_len = 0;
    size_t left_unary_exprs_cap = 0;

    enum AST_MULTIPLICATIVE_OP*ops = NULL;
    size_t ops_len = 0;
    size_t ops_cap = 0;
    
    struct LEFT_UNARY_EXPR_AST*left_unary_expr;

    r = left_unary_expr_ast_read(parser, &left_unary_expr);
    if (r != PARSER_OK) {
        goto err0;
    }

    PUSH_BACK(left_unary_exprs, left_unary_expr);

    while (((parser->tok)->token_type == TOKEN_TYPE_MUL) || ((parser->tok)->token_type == TOKEN_TYPE_DIV) || ((parser->tok)->token_type == TOKEN_TYPE_MOD)) {
        if ((parser->tok)->token_type == TOKEN_TYPE_MUL) {
            PUSH_BACK(ops, AST_MULTIPLICATIVE_OP_MUL);
        } else if ((parser->tok)->token_type == TOKEN_TYPE_DIV) {
            PUSH_BACK(ops, AST_MULTIPLICATIVE_OP_DIV);
        } else if ((parser->tok)->token_type == TOKEN_TYPE_MOD) {
            PUSH_BACK(ops, AST_MULTIPLICATIVE_OP_MOD);
        }
        
        token_free((parser->tok));
        lexer_next_token(parser->lexer, &(parser->tok));

        r = left_unary_expr_ast_read(parser, &left_unary_expr);
        if (r != PARSER_OK) {
            goto err1;
        }

        PUSH_BACK(left_unary_exprs, left_unary_expr);
    }

    (*multiplicative_expr) = create_multiplicative_expr_ast(left_unary_exprs, ops, left_unary_exprs_len,
                                                            (parser->tok)->frag.starting.line,
                                                            (parser->tok)->frag.starting.pos);

    return PARSER_OK;

 err1:
    {
        size_t i;
        for (i = 0; i < ops_len; i++) {
            left_unary_expr_ast_free(left_unary_exprs[i]);
        }
        SAFE_FREE(left_unary_exprs);
    }
    if (ops != NULL) {
        SAFE_FREE(ops);
    }    
 err0:
    (*multiplicative_expr) = NULL;
    return r;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rsi, %rbx
movq %rdi, %r12
leaq 0x28(%rsp), %rsi
callq 0x7c81
testl %eax, %eax
je 0x795d
movl %eax, %ecx
xorl %eax, %eax
jmp 0x7c34
movl $0x8, %edi
callq 0x1130
testq %rax, %rax
je 0x7c55
movq %rax, %r15
movq %rbx, 0x18(%rsp)
movq 0x28(%rsp), %rax
movq %rax, (%r15)
movq 0x8(%r12), %rdx
movl (%rdx), %eax
leal -0x18(%rax), %ecx
cmpl $0x2, %ecx
ja 0x7bc8
leaq 0x8(%r12), %r13
movl $0x1, %ecx
movq %rcx, 0x20(%rsp)
xorl %ecx, %ecx
xorl %ebx, %ebx
movq $0x0, 0x10(%rsp)
movl $0x1, %ebp
movq %r13, 0x30(%rsp)
cmpl $0x1a, %eax
je 0x7a68
cmpl $0x19, %eax
je 0x7a19
cmpl $0x18, %eax
jne 0x7aa9
xorl %r14d, %r14d
cmpq %rcx, %rbx
movq 0x10(%rsp), %rax
jne 0x7afc
testq %rcx, %rcx
je 0x7ae4
leaq (,%rcx,8), %r14
movq %rax, %rdi
movq %r14, %rsi
movq %rcx, %r13
callq 0x1160
testq %rax, %rax
je 0x7c5a
addq %r13, %r13
movq %r13, 0x8(%rsp)
xorl %r14d, %r14d
jmp 0x7b01
movl $0x1, %r14d
cmpq %rcx, %rbx
movq 0x10(%rsp), %rax
jne 0x7afc
testq %rcx, %rcx
je 0x7abc
leaq (,%rcx,8), %r14
movq %rax, %rdi
movq %r14, %rsi
movq %rcx, %r13
callq 0x1160
testq %rax, %rax
je 0x7c62
addq %r13, %r13
movq %r13, 0x8(%rsp)
movl $0x1, %r14d
jmp 0x7b01
movl $0x2, %r14d
cmpq %rcx, %rbx
jne 0x7ab0
testq %rcx, %rcx
movq 0x10(%rsp), %rdi
je 0x7ad0
leaq (,%rcx,8), %r14
movq %r14, %rsi
movq %rcx, %r13
callq 0x1160
testq %rax, %rax
je 0x7c6a
addq %r13, %r13
movq %r13, 0x8(%rsp)
movl $0x2, %r14d
jmp 0x7b01
movq %rcx, 0x8(%rsp)
jmp 0x7b12
movq %rcx, 0x8(%rsp)
movq 0x10(%rsp), %rax
jmp 0x7b01
movl $0x4, %edi
callq 0x1130
testq %rax, %rax
jne 0x7af7
jmp 0x7c77
movl $0x4, %edi
callq 0x1130
testq %rax, %rax
jne 0x7af7
jmp 0x7c7c
movl $0x4, %edi
callq 0x1130
testq %rax, %rax
je 0x7c72
movl $0x1, %ecx
movq %rcx, 0x8(%rsp)
movq %rax, 0x10(%rsp)
movl %r14d, (%rax,%rbx,4)
incq %rbx
movq 0x30(%rsp), %r13
movq 0x8(%r12), %rdi
callq 0x53b0
movq (%r12), %rdi
movq %r13, %rsi
callq 0x45b5
movq %r12, %rdi
leaq 0x28(%rsp), %rsi
callq 0x7c81
testl %eax, %eax
jne 0x7bf7
movq 0x20(%rsp), %rax
cmpq %rax, %rbp
jne 0x7ba3
testq %rax, %rax
je 0x7b83
movq %r15, %rdi
movq %rbx, %r15
movq %r12, %rbx
movq %rax, %r14
shlq $0x4, %r14
movq %r14, %rsi
movq %rax, %r12
callq 0x1160
testq %rax, %rax
je 0x7c48
addq %r12, %r12
movq %r12, 0x20(%rsp)
movq %rbx, %r12
movq %r15, %rbx
movq %rax, %r15
jmp 0x7ba3
movl $0x8, %edi
callq 0x1130
testq %rax, %rax
je 0x7c50
movq %rax, %r15
movl $0x1, %eax
movq %rax, 0x20(%rsp)
movq 0x28(%rsp), %rax
movq %rax, (%r15,%rbp,8)
incq %rbp
movq (%r13), %rdx
movl (%rdx), %eax
leal -0x18(%rax), %ecx
cmpl $0x3, %ecx
movq 0x8(%rsp), %rcx
jb 0x79b9
jmp 0x7bd6
movl $0x1, %ebp
movq $0x0, 0x10(%rsp)
movq 0x18(%rdx), %rcx
movq 0x20(%rdx), %r8
movq %r15, %rdi
movq 0x10(%rsp), %rsi
movq %rbp, %rdx
callq 0xa575
movq 0x18(%rsp), %rbx
xorl %ecx, %ecx
jmp 0x7c34
movl %eax, %r14d
testq %rbx, %rbx
je 0x7c13
xorl %r12d, %r12d
movq (%r15,%r12,8), %rdi
callq 0xa719
incq %r12
cmpq %r12, %rbx
jne 0x7c02
movq %r15, %rdi
callq 0x1030
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x7c2a
callq 0x1030
xorl %eax, %eax
movl %r14d, %ecx
movq 0x18(%rsp), %rbx
movq %rax, (%rbx)
movl %ecx, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r14, %rdi
callq 0x1c8d
callq 0x1cbd
callq 0x1cee
movq %r14, %rdi
callq 0x1c2c
movq %r14, %rdi
callq 0x1bcb
movq %r14, %rdi
callq 0x1b6a
callq 0x1c5c
callq 0x1bfb
callq 0x1b9a