// File: /workspace/github_cpp_makefile_star2_O3/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 $0x78, %rsp
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
leaq 0x40(%rsp), %r12
movq %r12, %rdi
callq 0x1d4ba
movb 0x30(%r12), %al
testb %al, %al
je 0x1d7f9
leaq 0x40(%rsp), %rdi
callq 0x2495a
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rax
movq %rax, 0x8(%rsp)
testq %rax, %rax
je 0x1d853
movq 0x447c1(%rip), %rcx     # 0x61fb0
cmpb $0x0, (%rcx)
je 0x1d84f
incl 0x8(%rax)
jmp 0x1d853
movb %al, 0x30(%rbx)
leaq 0x60(%rsp), %rax
movups -0x20(%rax), %xmm0
movups %xmm0, (%rbx)
leaq 0x20(%rbx), %rcx
movq %rcx, 0x10(%rbx)
movq -0x10(%rax), %rdx
cmpq %rax, %rdx
je 0x1d828
movq %rdx, 0x10(%rbx)
movq 0x60(%rsp), %rcx
movq %rcx, 0x20(%rbx)
jmp 0x1d82e
movups (%rax), %xmm0
movups %xmm0, (%rcx)
movq 0x58(%rsp), %rcx
movq %rcx, 0x18(%rbx)
movq %rax, 0x50(%rsp)
movq $0x0, 0x58(%rsp)
movb $0x0, 0x60(%rsp)
jmp 0x1d9c8
lock
incl 0x8(%rax)
leaq 0x30(%rsp), %r12
leaq 0x10(%rsp), %r13
movq (%r14), %rdx
movq %r13, %rdi
movq %r15, %rsi
callq 0x1ba35
movl 0x10(%rsp), %eax
addl $-0x10, %eax
movl $0x3, %ebp
cmpl $-0x2, %eax
jb 0x1d988
movq 0x28(%rsp), %rax
addq 0x18(%rsp), %rax
movq %rax, (%r14)
movq %rbx, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x1d4ba
movl $0x1, %ebp
cmpb $0x0, 0x30(%rbx)
je 0x1d988
movl 0x10(%rsp), %eax
cmpl $0xf, %eax
je 0x1d90b
cmpl $0xe, %eax
jne 0x1d9e4
movq %rbx, %rdi
callq 0x2495a
movq %rax, %rbp
movl $0x38, %edi
callq 0x92d0
movq %rax, %r13
movabsq $0x100000001, %rax      # imm = 0x100000001
movq %rax, 0x8(%r13)
leaq 0x423df(%rip), %rax     # 0x5fcc8
movq %rax, (%r13)
movq %r13, %r12
addq $0x10, %r12
movq %r12, %rdi
movq %rsp, %rsi
movq %rbp, %rdx
callq 0x1873e
leaq 0x4240f(%rip), %rax     # 0x5fd18
jmp 0x1d958
movq %rbx, %rdi
callq 0x2495a
movq %rax, %rbp
movl $0x38, %edi
callq 0x92d0
movq %rax, %r13
movabsq $0x100000001, %rax      # imm = 0x100000001
movq %rax, 0x8(%r13)
leaq 0x42470(%rip), %rax     # 0x5fda8
movq %rax, (%r13)
movq %r13, %r12
addq $0x10, %r12
movq %r12, %rdi
movq %rsp, %rsi
movq %rbp, %rdx
callq 0x1873e
leaq 0x424a0(%rip), %rax     # 0x5fdf8
movq %rax, 0x10(%r13)
movq %r12, (%rsp)
movq 0x8(%rsp), %rdi
movq %r13, 0x8(%rsp)
testq %rdi, %rdi
je 0x1d974
callq 0xa946
movq %rbx, %rdi
callq 0x2809c
xorl %ebp, %ebp
leaq 0x30(%rsp), %r12
leaq 0x10(%rsp), %r13
movq 0x20(%rsp), %rdi
cmpq %r12, %rdi
je 0x1d99f
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x92e0
testl %ebp, %ebp
je 0x1d85d
cmpl $0x3, %ebp
jne 0x1d9b9
movb $0x1, 0x30(%rbx)
movaps (%rsp), %xmm0
movups %xmm0, (%rbx)
jmp 0x1d9c8
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x1d9c8
callq 0xa946
leaq 0x40(%rsp), %rdi
callq 0x2809c
movq %rbx, %rax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x10, %edi
callq 0x9150
movq %rax, %r15
leaq 0x2a918(%rip), %rsi     # 0x48310
movq %rax, %rdi
callq 0x93c0
movq 0x445c9(%rip), %rsi     # 0x61fd0
movq 0x4459a(%rip), %rdx     # 0x61fa8
movq %r15, %rdi
callq 0x94b0
movq %rax, %r14
jmp 0x1da6c
jmp 0x1da2c
movq %rax, %r14
movq %r15, %rdi
callq 0x9200
jmp 0x1da2f
jmp 0x1da2c
movq %rax, %r14
movq %rbx, %rdi
callq 0x2809c
jmp 0x1da3c
movq %rax, %r14
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x1da5d
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x92e0
jmp 0x1da5d
movq %rax, %r14
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x1da6c
callq 0xa946
leaq 0x40(%rsp), %rdi
callq 0x2809c
movq %r14, %rdi
callq 0x94e0