// File: /workspace/github_c_makefile_star2_O2/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 $0x28, %rsp
movq %rsi, %rbx
movq %rdi, %r15
leaq 0x10(%rsp), %rsi
callq 0x51d1
testl %eax, %eax
je 0x4e47
movl %eax, %r13d
xorl %eax, %eax
jmp 0x5077
movq %rbx, 0x18(%rsp)
pushq $0x8
popq %rdi
callq 0x1130
testq %rax, %rax
je 0x5142
movq %rax, %r14
leaq 0x10(%rsp), %rax
movq (%rax), %rax
movq %rax, (%r14)
leaq 0x8(%r15), %rax
movq %rax, 0x20(%rsp)
pushq $0x1
popq %rax
xorl %ebp, %ebp
movq %rax, %r12
movq %rax, 0x8(%rsp)
xorl %ebx, %ebx
movq $0x0, (%rsp)
movq 0x20(%rsp), %rax
movq (%rax), %rdx
movl (%rdx), %eax
leal -0x18(%rax), %ecx
cmpl $0x2, %ecx
ja 0x502d
cmpl $0x1a, %eax
je 0x4ee5
cmpl $0x19, %eax
jne 0x4f20
cmpq (%rsp), %rbx
jne 0x4ee1
testq %rbx, %rbx
je 0x4f54
leaq (,%rbx,8), %r13
movq %rbp, %rdi
movq %r13, %rsi
callq 0x1160
testq %rax, %rax
je 0x50f4
movq %rax, %rbp
leaq (%rbx,%rbx), %rax
movq %rax, (%rsp)
pushq $0x1
jmp 0x4f19
cmpq (%rsp), %rbx
jne 0x4f17
testq %rbx, %rbx
je 0x4f6c
leaq (,%rbx,8), %r13
movq %rbp, %rdi
movq %r13, %rsi
callq 0x1160
testq %rax, %rax
je 0x5113
movq %rax, %rbp
leaq (%rbx,%rbx), %rax
movq %rax, (%rsp)
pushq $0x2
popq %r13
jmp 0x4fa1
xorl %r13d, %r13d
cmpq (%rsp), %rbx
jne 0x4fa1
testq %rbx, %rbx
je 0x4f86
leaq (,%rbx,8), %rsi
movq %rbp, %rdi
movq %rsi, (%rsp)
callq 0x1160
testq %rax, %rax
je 0x50d1
movq %rax, %rbp
leaq (%rbx,%rbx), %rax
jmp 0x4f9d
pushq $0x4
popq %rdi
callq 0x1130
testq %rax, %rax
je 0x5188
movq %rax, %rbp
pushq $0x1
jmp 0x4f82
pushq $0x4
popq %rdi
callq 0x1130
testq %rax, %rax
je 0x51ab
movq %rax, %rbp
pushq $0x2
popq %r13
jmp 0x4f9a
pushq $0x4
popq %rdi
callq 0x1130
testq %rax, %rax
je 0x5165
movq %rax, %rbp
pushq $0x1
popq %rax
movq %rax, (%rsp)
movl %r13d, (%rbp,%rbx,4)
movq 0x8(%r15), %rdi
callq 0x297c
movq (%r15), %rdi
movq 0x20(%rsp), %rsi
callq 0x1c9f
movq %r15, %rdi
leaq 0x10(%rsp), %rsi
callq 0x51d1
testl %eax, %eax
jne 0x5048
cmpq 0x8(%rsp), %r12
jne 0x5019
testq %r12, %r12
je 0x4ffd
movq %r12, %r13
shlq $0x4, %r13
movq %r14, %rdi
movq %r13, %rsi
callq 0x1160
testq %rax, %rax
je 0x508c
movq %rax, %r14
leaq (%r12,%r12), %rax
jmp 0x5014
pushq $0x8
popq %rdi
callq 0x1130
testq %rax, %rax
je 0x50ae
movq %rax, %r14
pushq $0x1
popq %rax
movq %rax, 0x8(%rsp)
incq %rbx
movq 0x10(%rsp), %rax
movq %rax, (%r14,%r12,8)
incq %r12
jmp 0x4e8b
movq 0x18(%rdx), %rcx
movq 0x20(%rdx), %r8
movq %r14, %rdi
movq %rbp, %rsi
movq %r12, %rdx
callq 0x7ba1
xorl %r13d, %r13d
jmp 0x5072
movl %eax, %r13d
xorl %ebx, %ebx
cmpq %rbx, %r12
je 0x5060
movq (%r14,%rbx,8), %rdi
callq 0x7d45
incq %rbx
jmp 0x504d
movq %r14, %rdi
callq 0x1030
movq %rbp, %rdi
callq 0x1030
xorl %eax, %eax
movq 0x18(%rsp), %rbx
movq %rax, (%rbx)
movl %r13d, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x10f5d(%rip), %rax     # 0x15ff0
movq (%rax), %rdi
leaq 0x9854(%rip), %rsi      # 0xe8f1
leaq 0x9720(%rip), %rdx      # 0xe7c4
movl $0x28a, %ecx            # imm = 0x28A
jmp 0x5130
movq 0x10f3b(%rip), %rax     # 0x15ff0
movq (%rax), %rdi
leaq 0x94ff(%rip), %rsi      # 0xe5be
leaq 0x96fe(%rip), %rdx      # 0xe7c4
pushq $0x8
popq %r8
movl $0x28a, %ecx            # imm = 0x28A
jmp 0x5133
movq 0x10f18(%rip), %rax     # 0x15ff0
movq (%rax), %rdi
leaq 0x980f(%rip), %rsi      # 0xe8f1
leaq 0x96db(%rip), %rdx      # 0xe7c4
movl $0x27b, %ecx            # imm = 0x27B
movq (%rsp), %r8
jmp 0x5133
movq 0x10ef5(%rip), %rax     # 0x15ff0
movq (%rax), %rdi
leaq 0x97ec(%rip), %rsi      # 0xe8f1
leaq 0x96b8(%rip), %rdx      # 0xe7c4
movl $0x27d, %ecx            # imm = 0x27D
jmp 0x5130
movq 0x10ed6(%rip), %rax     # 0x15ff0
movq (%rax), %rdi
leaq 0x97cd(%rip), %rsi      # 0xe8f1
leaq 0x9699(%rip), %rdx      # 0xe7c4
movl $0x27f, %ecx            # imm = 0x27F
movq %r13, %r8
xorl %eax, %eax
callq 0x1100
pushq $0x1
popq %rdi
callq 0x1180
movq 0x10ea7(%rip), %rax     # 0x15ff0
movq (%rax), %rdi
leaq 0x946b(%rip), %rsi      # 0xe5be
leaq 0x966a(%rip), %rdx      # 0xe7c4
pushq $0x8
popq %r8
movl $0x277, %ecx            # imm = 0x277
jmp 0x5133
movq 0x10e84(%rip), %rax     # 0x15ff0
movq (%rax), %rdi
leaq 0x9448(%rip), %rsi      # 0xe5be
leaq 0x9647(%rip), %rdx      # 0xe7c4
pushq $0x4
popq %r8
movl $0x27b, %ecx            # imm = 0x27B
jmp 0x5133
movq 0x10e61(%rip), %rax     # 0x15ff0
movq (%rax), %rdi
leaq 0x9425(%rip), %rsi      # 0xe5be
leaq 0x9624(%rip), %rdx      # 0xe7c4
pushq $0x4
popq %r8
movl $0x27d, %ecx            # imm = 0x27D
jmp 0x5133
movq 0x10e3e(%rip), %rax     # 0x15ff0
movq (%rax), %rdi
leaq 0x9402(%rip), %rsi      # 0xe5be
leaq 0x9601(%rip), %rdx      # 0xe7c4
pushq $0x4
popq %r8
movl $0x27f, %ecx            # imm = 0x27F
jmp 0x5133