// File: pfnet-research[P]pml/src/parser.cpp
// Function: parser::multive_expr(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, unsigned long&)
expr_result_t multive_expr(std::string const& input, size_t& pos) {
    auto head_result = applicative_expr(input, pos);
    if (head_result.is_error())
        return head_result;
    auto acc = head_result.ok();

    while (true) {
        auto op_token = next_token(input, pos);
        if (op_token.kind != token_t::kind_t::Star && op_token.kind != token_t::kind_t::Slash)
            break;
        pos = op_token.pos + op_token.lexime.size();

        auto e_result = applicative_expr(input, pos);
        if (e_result.is_error())
            return e_result;
        auto e = e_result.ok();

        switch (op_token.kind) {
        case token_t::kind_t::Star:
            acc = make<ast::mul_expr_t>(acc, e);
            break;
        case token_t::kind_t::Slash:
            acc = make<ast::div_expr_t>(acc, e);
            break;
        default:
            throw std::logic_error{"invalid additive op"};
        }
    }
    return acc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x130, %rsp            # imm = 0x130
movq %rdi, -0xf8(%rbp)
movq %rdi, %rax
movq %rax, -0xf0(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
leaq -0x50(%rbp), %rdi
movq %rdi, -0xe8(%rbp)
callq 0x3e5d0
movq -0xe8(%rbp), %rdi
callq 0x41970
movb %al, -0xd9(%rbp)
jmp 0x3e904
movb -0xd9(%rbp), %al
testb $0x1, %al
jne 0x3e910
jmp 0x3e93f
movq -0xf8(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x41990
jmp 0x3e922
movl $0x1, -0x60(%rbp)
jmp 0x3ec1f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x3ec38
leaq -0x50(%rbp), %rdi
callq 0x419e0
movq %rax, -0x100(%rbp)
jmp 0x3e951
movq -0x100(%rbp), %rsi
leaq -0x70(%rbp), %rdi
callq 0x13050
jmp 0x3e963
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rax
movq (%rax), %rdx
leaq -0xa0(%rbp), %rdi
callq 0x355b0
jmp 0x3e97c
cmpl $0x10, -0xa0(%rbp)
je 0x3e9ab
cmpl $0x11, -0xa0(%rbp)
je 0x3e9ab
movl $0x3, -0x60(%rbp)
jmp 0x3eb9d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x3ec14
movq -0x98(%rbp), %rax
movq %rax, -0x108(%rbp)
leaq -0x90(%rbp), %rdi
callq 0xa280
movq -0x108(%rbp), %rcx
movq -0xf8(%rbp), %rdi
addq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
movb $0x0, -0xa1(%rbp)
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0x3e5d0
jmp 0x3e9f3
movq -0xf8(%rbp), %rdi
callq 0x41970
movb %al, -0x109(%rbp)
jmp 0x3ea07
movb -0x109(%rbp), %al
testb $0x1, %al
jne 0x3ea13
jmp 0x3ea48
movb $0x1, -0xa1(%rbp)
movl $0x1, -0x60(%rbp)
jmp 0x3eb86
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x3ebe2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x3ebd6
movq -0xf8(%rbp), %rdi
callq 0x419e0
movq %rax, -0x118(%rbp)
jmp 0x3ea5d
movq -0x118(%rbp), %rsi
leaq -0xb8(%rbp), %rdi
callq 0x13050
movl -0xa0(%rbp), %eax
movl %eax, -0x11c(%rbp)
subl $0x10, %eax
je 0x3ea93
jmp 0x3ea83
movl -0x11c(%rbp), %eax
subl $0x11, %eax
je 0x3eade
jmp 0x3eb15
leaq -0xc8(%rbp), %rdi
leaq -0x70(%rbp), %rsi
leaq -0xb8(%rbp), %rdx
callq 0x3ec50
jmp 0x3eaac
leaq -0x70(%rbp), %rdi
leaq -0xc8(%rbp), %rsi
callq 0x42070
leaq -0xc8(%rbp), %rdi
callq 0x420a0
jmp 0x3eb73
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x3ebca
leaq -0xd8(%rbp), %rdi
leaq -0x70(%rbp), %rsi
leaq -0xb8(%rbp), %rdx
callq 0x3ec90
jmp 0x3eaf7
leaq -0x70(%rbp), %rdi
leaq -0xd8(%rbp), %rsi
callq 0x420c0
leaq -0xd8(%rbp), %rdi
callq 0x420f0
jmp 0x3eb73
movl $0x10, %edi
callq 0xa1d0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x128(%rbp)
leaq 0x5df31(%rip), %rsi     # 0x9ca64
callq 0xa540
jmp 0x3eb3a
movq -0x128(%rbp), %rdi
movq 0xa8488(%rip), %rsi     # 0xe6fd0
movq 0xa8441(%rip), %rdx     # 0xe6f90
callq 0xa610
jmp 0x3ec4a
movq -0x128(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
callq 0xa2c0
jmp 0x3ebca
leaq -0xb8(%rbp), %rdi
callq 0x13080
movl $0x0, -0x60(%rbp)
testb $0x1, -0xa1(%rbp)
jne 0x3eb9b
movq -0xf8(%rbp), %rdi
callq 0x2ffa0
jmp 0x3eb9d
leaq -0xa0(%rbp), %rdi
callq 0x404f0
movl -0x60(%rbp), %eax
movl %eax, -0x12c(%rbp)
testl %eax, %eax
je 0x3ebc5
jmp 0x3ebb8
movl -0x12c(%rbp), %eax
subl $0x3, %eax
je 0x3ebf0
jmp 0x3ec09
jmp 0x3e961
leaq -0xb8(%rbp), %rdi
callq 0x13080
movq -0xf8(%rbp), %rdi
callq 0x2ffa0
leaq -0xa0(%rbp), %rdi
callq 0x404f0
jmp 0x3ec14
movq -0xf8(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x41f90
jmp 0x3ec02
movl $0x1, -0x60(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x13080
jmp 0x3ec1f
leaq -0x70(%rbp), %rdi
callq 0x13080
jmp 0x3ec38
leaq -0x50(%rbp), %rdi
callq 0x2ffa0
movq -0xf0(%rbp), %rax
addq $0x130, %rsp            # imm = 0x130
popq %rbp
retq
leaq -0x50(%rbp), %rdi
callq 0x2ffa0
movq -0x58(%rbp), %rdi
callq 0xa650
nopw (%rax,%rax)