// File: /workspace/github_cpp_makefile_star2_O2/pfnet-research[P]pml/src/parser.cpp
// Function: parser::additive_term(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, unsigned long&)
term_result_t additive_term(std::string const& input, size_t& pos) {
    auto head_result = multive_term(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 term_result = multive_term(input, pos);
        if (term_result.is_error())
            return term_result;

        switch (op_token.kind) {
        case token_t::kind_t::Plus:
            acc = make<logic::add_term_t>(acc, term_result.ok());
            break;
        case token_t::kind_t::Minus:
            acc = make<logic::sub_term_t>(acc, term_result.ok());
            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 $0x88, %rsp
movq %rdx, %r15
movq %rsi, %r12
movq %rdi, %rbx
leaq 0x50(%rsp), %r14
movq %r14, %rdi
callq 0x1641c
cmpb $0x0, 0x30(%r14)
je 0x1671f
leaq 0x50(%rsp), %rdi
callq 0x1ad98
movq %rsp, %r13
movq %r13, %rdi
movq %rax, %rsi
callq 0x125ec
leaq 0x20(%rsp), %rbp
leaq 0x10(%rsp), %r14
movq (%r15), %rdx
movq %rbp, %rdi
movq %r12, %rsi
callq 0x1537c
movl 0x20(%rsp), %eax
addl $-0x10, %eax
cmpl $-0x2, %eax
jb 0x1672e
movq 0x38(%rsp), %rax
addq 0x28(%rsp), %rax
movq %rax, (%r15)
movq %rbx, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x1641c
cmpb $0x0, 0x30(%rbx)
je 0x16750
movl 0x20(%rsp), %eax
cmpl $0xf, %eax
je 0x166dd
cmpl $0xe, %eax
jne 0x16783
movq %rbx, %rdi
callq 0x1ad98
movq %r14, %rdi
movq %r13, %rsi
movq %rax, %rdx
callq 0x1bb8b
movq %r13, %rdi
movq %r14, %rsi
callq 0x1fc74
jmp 0x166fe
movq %rbx, %rdi
callq 0x1ad98
movq %r14, %rdi
movq %r13, %rsi
movq %rax, %rdx
callq 0x1bc77
movq %r13, %rdi
movq %r14, %rsi
callq 0x1fca2
leaq 0x18(%rsp), %rdi
callq 0xa248
movq %rbx, %rdi
callq 0x1fb90
leaq 0x30(%rsp), %rdi
callq 0x9130
jmp 0x16665
leaq 0x50(%rsp), %rsi
movq %rbx, %rdi
callq 0x1acd2
jmp 0x16764
leaq 0x30(%rsp), %rdi
callq 0x9130
movb $0x1, 0x30(%rbx)
movaps (%rsp), %xmm0
andq $0x0, 0x8(%rsp)
movups %xmm0, (%rbx)
andq $0x0, (%rsp)
jmp 0x1675a
leaq 0x30(%rsp), %rdi
callq 0x9130
leaq 0x8(%rsp), %rdi
callq 0xa248
leaq 0x50(%rsp), %rdi
callq 0x1fb90
movq %rbx, %rax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
pushq $0x10
popq %rdi
callq 0x9150
movq %rax, %r15
leaq 0x22e9b(%rip), %rsi     # 0x39630
movq %rax, %rdi
callq 0x93c0
movq 0x4582c(%rip), %rsi     # 0x5bfd0
movq 0x457ed(%rip), %rdx     # 0x5bf98
movq %r15, %rdi
callq 0x94b0
jmp 0x167b5
movq %rax, %r14
jmp 0x167f4
jmp 0x167cb
movq %rax, %r14
movq %r15, %rdi
callq 0x9210
jmp 0x167ce
jmp 0x167cb
movq %rax, %r14
movq %rbx, %rdi
callq 0x1fb90
jmp 0x167db
movq %rax, %r14
leaq 0x30(%rsp), %rdi
callq 0x9130
jmp 0x167ea
movq %rax, %r14
leaq 0x8(%rsp), %rdi
callq 0xa248
leaq 0x50(%rsp), %rdi
callq 0x1fb90
movq %r14, %rdi
callq 0x94d0