// File: pfnet-research[P]pml/src/parser.cpp
// Function: parser::predicate(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, unsigned long&)
predicate_result_t predicate(std::string const& input, size_t& pos) {
    EXPECT(backslash_token, BackSlash);

    EXPECT(arg_token, Ident);
    auto arg_name = arg_token.lexime;

    EXPECT(colon_token, Colon);

    auto stype_result = simple_type(input, pos);
    if (stype_result.is_error())
        return stype_result.convert<logic::predicate_t>();
    auto stype = stype_result.ok();

    EXPECT(fat_arrow_token, FatArrow);

    auto formula_result = formula(input, pos);
    if (formula_result.is_error())
        return formula_result.convert<logic::predicate_t>();
    auto formula = formula_result.ok();

    return predicate_result_t::ok(logic::predicate_t{arg_name, stype, formula});
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x370, %rsp            # imm = 0x370
movq %rdi, -0x2c8(%rbp)
movq %rdi, %rax
movq %rax, -0x2c0(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rax
movq (%rax), %rdx
leaq -0x50(%rbp), %rdi
movq %rdi, -0x2b8(%rbp)
movl $0x1a, %ecx
callq 0x364d0
movq -0x2b8(%rbp), %rdi
callq 0x40510
movb %al, -0x2a9(%rbp)
jmp 0x39a9c
movb -0x2a9(%rbp), %al
testb $0x1, %al
jne 0x39aa8
jmp 0x39aec
leaq -0x50(%rbp), %rdi
callq 0x405b0
movq %rax, -0x2d0(%rbp)
jmp 0x39aba
movq -0x2d0(%rbp), %rsi
movq -0x2c8(%rbp), %rdi
callq 0x41120
jmp 0x39acf
movl $0x1, -0x60(%rbp)
jmp 0x3a0f8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x3a111
leaq -0x50(%rbp), %rdi
callq 0x40630
movq %rax, -0x2d8(%rbp)
jmp 0x39afe
movq -0x2d8(%rbp), %rsi
leaq -0x90(%rbp), %rdi
callq 0x406b0
jmp 0x39b13
movq -0x88(%rbp), %rax
movq %rax, -0x2e0(%rbp)
leaq -0x80(%rbp), %rdi
callq 0xa280
movq -0x2e0(%rbp), %rcx
addq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rax
movq (%rax), %rdx
leaq -0xc8(%rbp), %rdi
movl $0xa, %ecx
callq 0x364d0
jmp 0x39b59
leaq -0xc8(%rbp), %rdi
callq 0x40510
movb %al, -0x2e1(%rbp)
jmp 0x39b6d
movb -0x2e1(%rbp), %al
testb $0x1, %al
jne 0x39b79
jmp 0x39bd1
leaq -0xc8(%rbp), %rdi
callq 0x405b0
movq %rax, -0x2f0(%rbp)
jmp 0x39b8e
movq -0x2f0(%rbp), %rsi
movq -0x2c8(%rbp), %rdi
callq 0x41120
jmp 0x39ba3
movl $0x1, -0x60(%rbp)
jmp 0x3a0c4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x3a0ea
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x3a0de
leaq -0xc8(%rbp), %rdi
callq 0x40630
movq %rax, -0x2f8(%rbp)
jmp 0x39be6
movq -0x2f8(%rbp), %rsi
leaq -0xf8(%rbp), %rdi
callq 0x406b0
jmp 0x39bfb
movq -0xf0(%rbp), %rax
movq %rax, -0x308(%rbp)
leaq -0xe8(%rbp), %rdi
movq %rdi, -0x300(%rbp)
callq 0xa280
movq -0x308(%rbp), %rcx
movq -0x300(%rbp), %rsi
addq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
leaq -0x118(%rbp), %rdi
callq 0xa190
jmp 0x39c42
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rax
movq (%rax), %rdx
leaq -0x150(%rbp), %rdi
movl $0x1c, %ecx
callq 0x364d0
jmp 0x39c60
leaq -0x150(%rbp), %rdi
callq 0x40510
movb %al, -0x309(%rbp)
jmp 0x39c74
movb -0x309(%rbp), %al
testb $0x1, %al
jne 0x39c80
jmp 0x39ce9
leaq -0x150(%rbp), %rdi
callq 0x405b0
movq %rax, -0x318(%rbp)
jmp 0x39c95
movq -0x318(%rbp), %rsi
movq -0x2c8(%rbp), %rdi
callq 0x41120
jmp 0x39caa
movl $0x1, -0x60(%rbp)
jmp 0x3a078
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x3a0b6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x3a0aa
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x3a09e
leaq -0x150(%rbp), %rdi
callq 0x40630
movq %rax, -0x320(%rbp)
jmp 0x39cfe
movq -0x320(%rbp), %rsi
leaq -0x180(%rbp), %rdi
callq 0x406b0
jmp 0x39d13
movq -0x178(%rbp), %rax
movq %rax, -0x328(%rbp)
leaq -0x170(%rbp), %rdi
callq 0xa280
movq -0x328(%rbp), %rcx
addq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
leaq -0x1b8(%rbp), %rdi
callq 0x397e0
jmp 0x39d54
leaq -0x1b8(%rbp), %rdi
callq 0x411a0
movb %al, -0x329(%rbp)
jmp 0x39d68
movb -0x329(%rbp), %al
testb $0x1, %al
jne 0x39d74
jmp 0x39db7
movq -0x2c8(%rbp), %rdi
leaq -0x1b8(%rbp), %rsi
callq 0x411c0
jmp 0x39d89
movl $0x1, -0x60(%rbp)
jmp 0x3a044
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x3a06a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x3a05e
leaq -0x1b8(%rbp), %rdi
callq 0x41200
movq %rax, -0x338(%rbp)
jmp 0x39dcc
movq -0x338(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x1bc(%rbp)
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rax
movq (%rax), %rdx
leaq -0x1f8(%rbp), %rdi
movl $0xc, %ecx
callq 0x364d0
jmp 0x39df9
leaq -0x1f8(%rbp), %rdi
callq 0x40510
movb %al, -0x339(%rbp)
jmp 0x39e0d
movb -0x339(%rbp), %al
testb $0x1, %al
jne 0x39e19
jmp 0x39e60
leaq -0x1f8(%rbp), %rdi
callq 0x405b0
movq %rax, -0x348(%rbp)
jmp 0x39e2e
movq -0x348(%rbp), %rsi
movq -0x2c8(%rbp), %rdi
callq 0x41120
jmp 0x39e43
movl $0x1, -0x60(%rbp)
jmp 0x3a028
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x3a036
leaq -0x1f8(%rbp), %rdi
callq 0x40630
movq %rax, -0x350(%rbp)
jmp 0x39e75
movq -0x350(%rbp), %rsi
leaq -0x228(%rbp), %rdi
callq 0x406b0
jmp 0x39e8a
movq -0x220(%rbp), %rax
movq %rax, -0x358(%rbp)
leaq -0x218(%rbp), %rdi
callq 0xa280
movq -0x358(%rbp), %rcx
addq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
leaq -0x260(%rbp), %rdi
callq 0x374b0
jmp 0x39ecb
leaq -0x260(%rbp), %rdi
callq 0x40890
movb %al, -0x359(%rbp)
jmp 0x39edf
movb -0x359(%rbp), %al
testb $0x1, %al
jne 0x39eeb
jmp 0x39f2e
movq -0x2c8(%rbp), %rdi
leaq -0x260(%rbp), %rsi
callq 0x41280
jmp 0x39f00
movl $0x1, -0x60(%rbp)
jmp 0x39ff4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x3a01a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x3a00e
leaq -0x260(%rbp), %rdi
callq 0x408f0
movq %rax, -0x368(%rbp)
jmp 0x39f43
movq -0x368(%rbp), %rsi
leaq -0x270(%rbp), %rdi
callq 0x16250
leaq -0x2a8(%rbp), %rdi
leaq -0x118(%rbp), %rsi
callq 0xa190
jmp 0x39f6b
movl -0x1bc(%rbp), %eax
movl %eax, -0x288(%rbp)
leaq -0x280(%rbp), %rdi
leaq -0x270(%rbp), %rsi
callq 0x16250
movq -0x2c8(%rbp), %rdi
leaq -0x2a8(%rbp), %rsi
callq 0x412c0
jmp 0x39f9f
leaq -0x2a8(%rbp), %rdi
callq 0x41340
movl $0x1, -0x60(%rbp)
leaq -0x270(%rbp), %rdi
callq 0x16150
jmp 0x39ff4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x39fe6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x2a8(%rbp), %rdi
callq 0x41340
leaq -0x270(%rbp), %rdi
callq 0x16150
jmp 0x3a00e
leaq -0x260(%rbp), %rdi
callq 0x40970
leaq -0x228(%rbp), %rdi
callq 0x404f0
jmp 0x3a028
leaq -0x260(%rbp), %rdi
callq 0x40970
leaq -0x228(%rbp), %rdi
callq 0x404f0
jmp 0x3a036
leaq -0x1f8(%rbp), %rdi
callq 0x407c0
jmp 0x3a044
leaq -0x1f8(%rbp), %rdi
callq 0x407c0
jmp 0x3a05e
leaq -0x1b8(%rbp), %rdi
callq 0x41370
leaq -0x180(%rbp), %rdi
callq 0x404f0
jmp 0x3a078
leaq -0x1b8(%rbp), %rdi
callq 0x41370
leaq -0x180(%rbp), %rdi
callq 0x404f0
jmp 0x3a09e
leaq -0x150(%rbp), %rdi
callq 0x407c0
leaq -0x118(%rbp), %rdi
callq 0xa240
leaq -0xf8(%rbp), %rdi
callq 0x404f0
jmp 0x3a0c4
leaq -0x150(%rbp), %rdi
callq 0x407c0
leaq -0x118(%rbp), %rdi
callq 0xa240
leaq -0xf8(%rbp), %rdi
callq 0x404f0
jmp 0x3a0de
leaq -0xc8(%rbp), %rdi
callq 0x407c0
leaq -0x90(%rbp), %rdi
callq 0x404f0
jmp 0x3a0f8
leaq -0xc8(%rbp), %rdi
callq 0x407c0
leaq -0x90(%rbp), %rdi
callq 0x404f0
jmp 0x3a111
leaq -0x50(%rbp), %rdi
callq 0x407c0
movq -0x2c0(%rbp), %rax
addq $0x370, %rsp            # imm = 0x370
popq %rbp
retq
leaq -0x50(%rbp), %rdi
callq 0x407c0
movq -0x58(%rbp), %rdi
callq 0xa650
nopw %cs:(%rax,%rax)