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

    while (true) {
        auto or_token = next_token(input, pos);
        if (or_token.kind != token_t::kind_t::Or)
            break;
        pos = or_token.pos + or_token.lexime.size();

        auto formula_result = and_formula(input, pos);
        if (formula_result.is_error())
            return formula_result;
        acc = make<logic::or_formula_t>(acc, formula_result.ok());
    }
    return acc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x100, %rsp            # imm = 0x100
movq %rdi, -0xd8(%rbp)
movq %rdi, %rax
movq %rax, -0xd0(%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, -0xc8(%rbp)
callq 0x38f40
movq -0xc8(%rbp), %rdi
callq 0x40890
movb %al, -0xb9(%rbp)
jmp 0x39274
movb -0xb9(%rbp), %al
testb $0x1, %al
jne 0x39280
jmp 0x392af
movq -0xd8(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x40e60
jmp 0x39292
movl $0x1, -0x60(%rbp)
jmp 0x3948a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x394a3
leaq -0x50(%rbp), %rdi
callq 0x408f0
movq %rax, -0xe0(%rbp)
jmp 0x392c1
movq -0xe0(%rbp), %rsi
leaq -0x70(%rbp), %rdi
callq 0x16250
jmp 0x392d3
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rax
movq (%rax), %rdx
leaq -0xa0(%rbp), %rdi
callq 0x355b0
jmp 0x392ec
cmpl $0x21, -0xa0(%rbp)
je 0x39312
movl $0x3, -0x60(%rbp)
jmp 0x39420
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x3947f
movq -0x98(%rbp), %rax
movq %rax, -0xe8(%rbp)
leaq -0x90(%rbp), %rdi
callq 0xa280
movq -0xe8(%rbp), %rcx
movq -0xd8(%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 0x38f40
jmp 0x3935a
movq -0xd8(%rbp), %rdi
callq 0x40890
movb %al, -0xe9(%rbp)
jmp 0x3936e
movb -0xe9(%rbp), %al
testb $0x1, %al
jne 0x3937a
jmp 0x393b8
movb $0x1, -0xa1(%rbp)
movl $0x1, -0x60(%rbp)
jmp 0x39409
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x3944d
movq -0xd8(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
callq 0x40970
jmp 0x3944d
movq -0xd8(%rbp), %rdi
callq 0x408f0
movq %rax, -0xf8(%rbp)
jmp 0x393cd
movq -0xf8(%rbp), %rdx
leaq -0xb8(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x394c0
jmp 0x393e6
leaq -0x70(%rbp), %rdi
leaq -0xb8(%rbp), %rsi
callq 0x40f80
leaq -0xb8(%rbp), %rdi
callq 0x25280
movl $0x0, -0x60(%rbp)
testb $0x1, -0xa1(%rbp)
jne 0x3941e
movq -0xd8(%rbp), %rdi
callq 0x40970
jmp 0x39420
leaq -0xa0(%rbp), %rdi
callq 0x404f0
movl -0x60(%rbp), %eax
movl %eax, -0xfc(%rbp)
testl %eax, %eax
je 0x39448
jmp 0x3943b
movl -0xfc(%rbp), %eax
subl $0x3, %eax
je 0x3945b
jmp 0x39474
jmp 0x392d1
leaq -0xa0(%rbp), %rdi
callq 0x404f0
jmp 0x3947f
movq -0xd8(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x40f50
jmp 0x3946d
movl $0x1, -0x60(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x16150
jmp 0x3948a
leaq -0x70(%rbp), %rdi
callq 0x16150
jmp 0x394a3
leaq -0x50(%rbp), %rdi
callq 0x40970
movq -0xd0(%rbp), %rax
addq $0x100, %rsp            # imm = 0x100
popq %rbp
retq
leaq -0x50(%rbp), %rdi
callq 0x40970
movq -0x58(%rbp), %rdi
callq 0xa650
nopw %cs:(%rax,%rax)