// File: /workspace/github_c_makefile_star2_O3/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, %rbp
movq %rdi, %r12
leaq 0x20(%rsp), %rsi
callq 0x79ab
testl %eax, %eax
je 0x76c0
movl %eax, %ecx
xorl %eax, %eax
jmp 0x795d
movl $0x8, %edi
callq 0x1130
movq %rax, 0x10(%rsp)
testq %rax, %rax
je 0x797f
movq 0x20(%rsp), %rax
movq 0x10(%rsp), %rcx
movq %rax, (%rcx)
movq 0x8(%r12), %rdx
movl (%rdx), %eax
leal -0x18(%rax), %ecx
cmpl $0x2, %ecx
ja 0x78db
movq %rbp, 0x18(%rsp)
leaq 0x8(%r12), %rcx
movq %rcx, 0x28(%rsp)
movl $0x1, %esi
xorl %r14d, %r14d
xorl %ebx, %ebx
xorl %r13d, %r13d
movq %rbx, %rbp
cmpl $0x1a, %eax
movq %rsi, 0x30(%rsp)
je 0x775b
cmpl $0x19, %eax
jne 0x778c
movl $0x1, %r15d
cmpq %r14, %rbp
jne 0x77bf
testq %r14, %r14
je 0x788e
leaq (,%r14,8), %rbx
movq %r13, %rdi
movq %rbx, %rsi
callq 0x1160
testq %rax, %rax
jne 0x77b9
jmp 0x798c
movl $0x2, %r15d
cmpq %r14, %rbp
jne 0x77bf
testq %r14, %r14
je 0x78a2
leaq (,%r14,8), %rbx
movq %r13, %rdi
movq %rbx, %rsi
callq 0x1160
testq %rax, %rax
jne 0x77b9
jmp 0x7994
xorl %r15d, %r15d
cmpq %r14, %rbp
jne 0x77bf
testq %r14, %r14
je 0x78b6
leaq (,%r14,8), %rbx
movq %r13, %rdi
movq %rbx, %rsi
callq 0x1160
testq %rax, %rax
je 0x7984
movq %rax, %r13
addq %r14, %r14
movq %r14, 0x8(%rsp)
leaq 0x1(%rbp), %rbx
movl %r15d, (%r13,%rbp,4)
movq 0x8(%r12), %rdi
callq 0x53ac
movq (%r12), %rdi
movq 0x28(%rsp), %rsi
callq 0x45d6
movq %r12, %rdi
leaq 0x20(%rsp), %rsi
callq 0x79ab
testl %eax, %eax
jne 0x78e5
movq 0x30(%rsp), %rsi
cmpq %rsi, %rbx
jne 0x785f
testq %rsi, %rsi
je 0x7842
movq %r12, %r14
movq %r13, %r12
movq %rsi, %r15
shlq $0x4, %r15
movq 0x10(%rsp), %rdi
movq %rsi, %r13
movq %r15, %rsi
callq 0x1160
testq %rax, %rax
je 0x7972
addq %r13, %r13
movq %r13, %rsi
movq %r12, %r13
movq %r14, %r12
movq %rax, 0x10(%rsp)
jmp 0x785f
movl $0x8, %edi
callq 0x1130
movq %rax, 0x10(%rsp)
testq %rax, %rax
je 0x797a
movl $0x1, %esi
movq 0x8(%rsp), %r14
movq 0x20(%rsp), %rax
movq 0x10(%rsp), %rcx
movq %rax, 0x8(%rcx,%rbp,8)
movq 0x28(%rsp), %rax
movq (%rax), %rdx
movl (%rdx), %eax
leal -0x18(%rax), %ecx
cmpl $0x3, %ecx
jb 0x7714
jmp 0x791d
movl $0x4, %edi
callq 0x1130
testq %rax, %rax
jne 0x78c9
jmp 0x79a1
movl $0x4, %edi
callq 0x1130
testq %rax, %rax
jne 0x78c9
jmp 0x79a6
movl $0x4, %edi
callq 0x1130
testq %rax, %rax
je 0x799c
movq %rax, %r13
movl $0x1, %eax
movq %rax, 0x8(%rsp)
jmp 0x77c4
movl $0x1, %ebx
xorl %r13d, %r13d
jmp 0x7925
movl %eax, %r15d
cmpq $-0x1, %rbp
je 0x7941
xorl %r12d, %r12d
movq 0x18(%rsp), %rbp
movq 0x10(%rsp), %rax
movq (%rax,%r12,8), %rdi
callq 0xa349
incq %r12
cmpq %r12, %rbx
jne 0x78f6
movq 0x10(%rsp), %rdi
callq 0x1030
testq %r13, %r13
jne 0x7950
jmp 0x7958
incq %rbx
movq 0x18(%rsp), %rbp
movq 0x18(%rdx), %rcx
movq 0x20(%rdx), %r8
movq 0x10(%rsp), %rdi
movq %r13, %rsi
movq %rbx, %rdx
callq 0xa1bc
xorl %ecx, %ecx
jmp 0x795d
movq 0x10(%rsp), %rdi
callq 0x1030
movq 0x18(%rsp), %rbp
movq %r13, %rdi
callq 0x1030
xorl %eax, %eax
movl %r15d, %ecx
movq %rax, (%rbp)
movl %ecx, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r15, %rdi
callq 0x1c7a
callq 0x1caa
callq 0x1d0c
movq %rbx, %rdi
callq 0x1c4a
movq %rbx, %rdi
callq 0x1be9
movq %rbx, %rdi
callq 0x1b88
callq 0x1cdb
callq 0x1c19
callq 0x1bb8