// File: /workspace/github_cpp_makefile_star2_O2/pfnet-research[P]pml/src/parser.cpp
// Function: parser::additive_expr(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, unsigned long&)
expr_result_t additive_expr(std::string const& input, size_t& pos) {
    auto head_result = multive_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::Plus && op_token.kind != token_t::kind_t::Minus)
            break;
        pos = op_token.pos + op_token.lexime.size();

        auto e_result = multive_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::Plus:
            acc = make<ast::add_expr_t>(acc, e);
            break;
        case token_t::kind_t::Minus:
            acc = make<ast::sub_expr_t>(acc, e);
            break;
        default:
            throw std::logic_error{"invalid additive op"};
        }
    }
    return acc;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq %rdx, %r12
movq %rsi, %r13
movq %rdi, %rbx
leaq 0x60(%rsp), %r14
movq %r14, %rdi
callq 0x1a0a2
cmpb $0x0, 0x30(%r14)
je 0x1a3d6
leaq 0x60(%rsp), %rdi
callq 0x1b196
movq %rsp, %rbp
movq %rbp, %rdi
movq %rax, %rsi
callq 0xbde0
leaq 0x20(%rsp), %r15
leaq 0x10(%rsp), %r14
movq (%r12), %rdx
leaq 0x30(%rsp), %rdi
movq %r13, %rsi
callq 0x1537c
movl 0x30(%rsp), %eax
addl $-0x10, %eax
cmpl $-0x2, %eax
jb 0x1a3e5
movq 0x48(%rsp), %rax
addq 0x38(%rsp), %rax
movq %rax, (%r12)
movq %rbx, %rdi
movq %r13, %rsi
movq %r12, %rdx
callq 0x1a0a2
cmpb $0x0, 0x30(%rbx)
je 0x1a407
movq %rbx, %rdi
callq 0x1b196
movq %r15, %rdi
movq %rax, %rsi
callq 0xbde0
movl 0x30(%rsp), %eax
cmpl $0xe, %eax
je 0x1a392
cmpl $0xf, %eax
jne 0x1a43a
movq %r14, %rdi
movq %rbp, %rsi
movq %r15, %rdx
callq 0x1e495
movq %rbp, %rdi
movq %r14, %rsi
callq 0x20378
jmp 0x1a3ab
movq %r14, %rdi
movq %rbp, %rsi
movq %r15, %rdx
callq 0x1e25f
movq %rbp, %rdi
movq %r14, %rsi
callq 0x2034a
leaq 0x18(%rsp), %rdi
callq 0xa248
leaq 0x28(%rsp), %rdi
callq 0xa248
movq %rbx, %rdi
callq 0x13e4a
leaq 0x40(%rsp), %rdi
callq 0x9130
jmp 0x1a30b
leaq 0x60(%rsp), %rsi
movq %rbx, %rdi
callq 0x1b172
jmp 0x1a41b
leaq 0x40(%rsp), %rdi
callq 0x9130
movb $0x1, 0x30(%rbx)
movaps (%rsp), %xmm0
andq $0x0, 0x8(%rsp)
movups %xmm0, (%rbx)
andq $0x0, (%rsp)
jmp 0x1a411
leaq 0x40(%rsp), %rdi
callq 0x9130
leaq 0x8(%rsp), %rdi
callq 0xa248
leaq 0x60(%rsp), %rdi
callq 0x13e4a
movq %rbx, %rax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
pushq $0x10
popq %rdi
callq 0x9150
movq %rax, %r15
leaq 0x1f1e4(%rip), %rsi     # 0x39630
movq %rax, %rdi
callq 0x93c0
movq 0x41b75(%rip), %rsi     # 0x5bfd0
movq 0x41b36(%rip), %rdx     # 0x5bf98
movq %r15, %rdi
callq 0x94b0
jmp 0x1a46c
movq %rax, %r14
jmp 0x1a4ba
jmp 0x1a482
movq %rax, %r14
movq %r15, %rdi
callq 0x9210
jmp 0x1a485
jmp 0x1a482
movq %rax, %r14
leaq 0x28(%rsp), %rdi
callq 0xa248
jmp 0x1a494
movq %rax, %r14
movq %rbx, %rdi
callq 0x13e4a
jmp 0x1a4a1
movq %rax, %r14
leaq 0x40(%rsp), %rdi
callq 0x9130
jmp 0x1a4b0
movq %rax, %r14
leaq 0x8(%rsp), %rdi
callq 0xa248
leaq 0x60(%rsp), %rdi
callq 0x13e4a
movq %r14, %rdi
callq 0x94d0