// File: pfnet-research[P]pml/src/parser.cpp
// Function: parser::dependent_type(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, unsigned long&)
depty_result_t dependent_type(std::string const& input, size_t& pos) {
    auto token = next_token(input, pos);
    std::vector<ast::refinement_type_t> args;
    if (token.kind == token_t::kind_t::LParen) {
        EXPECT(lparen_token, LParen);
        auto refty_result = refinement_type(input, pos);
        if (refty_result.is_error())
            return refty_result.convert<ast::dependent_type_t>();
        args.push_back(refty_result.ok());
        while (true) {
            if (next_token(input, pos).kind != token_t::kind_t::Comma)
                break;
            EXPECT(comma_token, Comma);
            auto refty_result = refinement_type(input, pos);
            if (refty_result.is_error())
                return refty_result.convert<ast::dependent_type_t>();
            args.push_back(refty_result.ok());
        }
        EXPECT(rparen_token, RParen);
    } else {
        auto refty_result = refinement_type(input, pos);
        if (refty_result.is_error())
            return refty_result.convert<ast::dependent_type_t>();
        args.push_back(refty_result.ok());
    }
    EXPECT(arrow_token, Arrow);
    auto retty_result = refinement_type(input, pos);
    if (retty_result.is_error())
        return retty_result.convert<ast::dependent_type_t>();
    return depty_result_t::ok(ast::dependent_type_t {
            args, retty_result.ok()
            });
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x470, %rsp            # imm = 0x470
movq %rdi, -0x3a0(%rbp)
movq %rdi, %rax
movq %rax, -0x398(%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 -0x48(%rbp), %rdi
callq 0x355b0
leaq -0x60(%rbp), %rdi
callq 0x41680
cmpl $0x1f, -0x48(%rbp)
jne 0x3b4bc
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rax
movq (%rax), %rdx
leaq -0x98(%rbp), %rdi
movl $0x1f, %ecx
callq 0x364d0
jmp 0x3af7d
leaq -0x98(%rbp), %rdi
callq 0x40510
movb %al, -0x3a1(%rbp)
jmp 0x3af91
movb -0x3a1(%rbp), %al
testb $0x1, %al
jne 0x3af9d
jmp 0x3b004
leaq -0x98(%rbp), %rdi
callq 0x405b0
movq %rax, -0x3b0(%rbp)
jmp 0x3afb2
movq -0x3b0(%rbp), %rsi
movq -0x3a0(%rbp), %rdi
callq 0x416a0
jmp 0x3afc7
movl $0x1, -0xa8(%rbp)
jmp 0x3b472
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
jmp 0x3b820
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
jmp 0x3b4ab
leaq -0x98(%rbp), %rdi
callq 0x40630
movq %rax, -0x3b8(%rbp)
jmp 0x3b019
movq -0x3b8(%rbp), %rsi
leaq -0xd8(%rbp), %rdi
callq 0x406b0
jmp 0x3b02e
movq -0xd0(%rbp), %rax
movq %rax, -0x3c0(%rbp)
leaq -0xc8(%rbp), %rdi
callq 0xa280
movq -0x3c0(%rbp), %rcx
addq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
leaq -0x118(%rbp), %rdi
callq 0x3ae30
jmp 0x3b06f
leaq -0x118(%rbp), %rdi
callq 0x41720
movb %al, -0x3c1(%rbp)
jmp 0x3b083
movb -0x3c1(%rbp), %al
testb $0x1, %al
jne 0x3b08f
jmp 0x3b0e1
movq -0x3a0(%rbp), %rdi
leaq -0x118(%rbp), %rsi
callq 0x41740
jmp 0x3b0a4
movl $0x1, -0xa8(%rbp)
jmp 0x3b45a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
jmp 0x3b49f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
jmp 0x3b493
leaq -0x118(%rbp), %rdi
callq 0x417f0
movq %rax, -0x3d0(%rbp)
jmp 0x3b0f6
movq -0x3d0(%rbp), %rsi
leaq -0x60(%rbp), %rdi
callq 0x41780
jmp 0x3b108
jmp 0x3b10a
jmp 0x3b10c
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rax
movq (%rax), %rdx
leaq -0x148(%rbp), %rdi
callq 0x355b0
jmp 0x3b125
movl -0x148(%rbp), %eax
movl %eax, -0x3d4(%rbp)
leaq -0x148(%rbp), %rdi
callq 0x404f0
movl -0x3d4(%rbp), %eax
cmpl $0x12, %eax
je 0x3b14d
jmp 0x3b345
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rax
movq (%rax), %rdx
leaq -0x180(%rbp), %rdi
movl $0x12, %ecx
callq 0x364d0
jmp 0x3b16b
leaq -0x180(%rbp), %rdi
callq 0x40510
movb %al, -0x3d5(%rbp)
jmp 0x3b17f
movb -0x3d5(%rbp), %al
testb $0x1, %al
jne 0x3b18b
jmp 0x3b1db
leaq -0x180(%rbp), %rdi
callq 0x405b0
movq %rax, -0x3e0(%rbp)
jmp 0x3b1a0
movq -0x3e0(%rbp), %rsi
movq -0x3a0(%rbp), %rdi
callq 0x416a0
jmp 0x3b1b5
movl $0x1, -0xa8(%rbp)
jmp 0x3b307
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
jmp 0x3b334
leaq -0x180(%rbp), %rdi
callq 0x40630
movq %rax, -0x3e8(%rbp)
jmp 0x3b1f0
movq -0x3e8(%rbp), %rsi
leaq -0x1b0(%rbp), %rdi
callq 0x406b0
jmp 0x3b205
movq -0x1a8(%rbp), %rax
movq %rax, -0x3f0(%rbp)
leaq -0x1a0(%rbp), %rdi
callq 0xa280
movq -0x3f0(%rbp), %rcx
addq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
leaq -0x1f0(%rbp), %rdi
callq 0x3ae30
jmp 0x3b246
leaq -0x1f0(%rbp), %rdi
callq 0x41720
movb %al, -0x3f1(%rbp)
jmp 0x3b25a
movb -0x3f1(%rbp), %al
testb $0x1, %al
jne 0x3b266
jmp 0x3b2be
movq -0x3a0(%rbp), %rdi
leaq -0x1f0(%rbp), %rsi
callq 0x41740
jmp 0x3b27b
movl $0x1, -0xa8(%rbp)
jmp 0x3b2ef
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
jmp 0x3b328
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
leaq -0x1f0(%rbp), %rdi
callq 0x41650
jmp 0x3b328
leaq -0x1f0(%rbp), %rdi
callq 0x417f0
movq %rax, -0x400(%rbp)
jmp 0x3b2d3
movq -0x400(%rbp), %rsi
leaq -0x60(%rbp), %rdi
callq 0x41780
jmp 0x3b2e5
movl $0x0, -0xa8(%rbp)
leaq -0x1f0(%rbp), %rdi
callq 0x41650
leaq -0x1b0(%rbp), %rdi
callq 0x404f0
leaq -0x180(%rbp), %rdi
callq 0x407c0
movl -0xa8(%rbp), %eax
testl %eax, %eax
jne 0x3b45a
jmp 0x3b323
jmp 0x3b10a
leaq -0x1b0(%rbp), %rdi
callq 0x404f0
leaq -0x180(%rbp), %rdi
callq 0x407c0
jmp 0x3b493
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rax
movq (%rax), %rdx
leaq -0x228(%rbp), %rdi
movl $0x20, %ecx
callq 0x364d0
jmp 0x3b363
leaq -0x228(%rbp), %rdi
callq 0x40510
movb %al, -0x401(%rbp)
jmp 0x3b377
movb -0x401(%rbp), %al
testb $0x1, %al
jne 0x3b383
jmp 0x3b3df
leaq -0x228(%rbp), %rdi
callq 0x405b0
movq %rax, -0x410(%rbp)
jmp 0x3b398
movq -0x410(%rbp), %rsi
movq -0x3a0(%rbp), %rdi
callq 0x416a0
jmp 0x3b3ad
movl $0x1, -0xa8(%rbp)
jmp 0x3b44e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
leaq -0x228(%rbp), %rdi
callq 0x407c0
jmp 0x3b493
leaq -0x228(%rbp), %rdi
callq 0x40630
movq %rax, -0x418(%rbp)
jmp 0x3b3f4
movq -0x418(%rbp), %rsi
leaq -0x258(%rbp), %rdi
callq 0x406b0
jmp 0x3b409
movq -0x250(%rbp), %rax
movq %rax, -0x420(%rbp)
leaq -0x258(%rbp), %rdi
addq $0x10, %rdi
callq 0xa280
movq -0x420(%rbp), %rcx
addq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
leaq -0x258(%rbp), %rdi
callq 0x404f0
movl $0x0, -0xa8(%rbp)
leaq -0x228(%rbp), %rdi
callq 0x407c0
leaq -0x118(%rbp), %rdi
callq 0x41650
leaq -0xd8(%rbp), %rdi
callq 0x404f0
leaq -0x98(%rbp), %rdi
callq 0x407c0
movl -0xa8(%rbp), %eax
testl %eax, %eax
jne 0x3b7fe
jmp 0x3b48e
jmp 0x3b585
leaq -0x118(%rbp), %rdi
callq 0x41650
leaq -0xd8(%rbp), %rdi
callq 0x404f0
leaq -0x98(%rbp), %rdi
callq 0x407c0
jmp 0x3b820
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
leaq -0x298(%rbp), %rdi
callq 0x3ae30
jmp 0x3b4d2
leaq -0x298(%rbp), %rdi
callq 0x41720
movb %al, -0x421(%rbp)
jmp 0x3b4e6
movb -0x421(%rbp), %al
testb $0x1, %al
jne 0x3b4f2
jmp 0x3b536
movq -0x3a0(%rbp), %rdi
leaq -0x298(%rbp), %rsi
callq 0x41740
jmp 0x3b507
movl $0x1, -0xa8(%rbp)
jmp 0x3b567
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
leaq -0x298(%rbp), %rdi
callq 0x41650
jmp 0x3b820
leaq -0x298(%rbp), %rdi
callq 0x417f0
movq %rax, -0x430(%rbp)
jmp 0x3b54b
movq -0x430(%rbp), %rsi
leaq -0x60(%rbp), %rdi
callq 0x41780
jmp 0x3b55d
movl $0x0, -0xa8(%rbp)
leaq -0x298(%rbp), %rdi
callq 0x41650
movl -0xa8(%rbp), %eax
testl %eax, %eax
jne 0x3b7fe
jmp 0x3b583
jmp 0x3b585
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rax
movq (%rax), %rdx
leaq -0x2d0(%rbp), %rdi
movl $0xb, %ecx
callq 0x364d0
jmp 0x3b5a3
leaq -0x2d0(%rbp), %rdi
callq 0x40510
movb %al, -0x431(%rbp)
jmp 0x3b5b7
movb -0x431(%rbp), %al
testb $0x1, %al
jne 0x3b5c3
jmp 0x3b613
leaq -0x2d0(%rbp), %rdi
callq 0x405b0
movq %rax, -0x440(%rbp)
jmp 0x3b5d8
movq -0x440(%rbp), %rsi
movq -0x3a0(%rbp), %rdi
callq 0x416a0
jmp 0x3b5ed
movl $0x1, -0xa8(%rbp)
jmp 0x3b7e2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
jmp 0x3b7f0
leaq -0x2d0(%rbp), %rdi
callq 0x40630
movq %rax, -0x448(%rbp)
jmp 0x3b628
movq -0x448(%rbp), %rsi
leaq -0x300(%rbp), %rdi
callq 0x406b0
jmp 0x3b63d
movq -0x2f8(%rbp), %rax
movq %rax, -0x450(%rbp)
leaq -0x2f0(%rbp), %rdi
callq 0xa280
movq -0x450(%rbp), %rcx
addq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
leaq -0x340(%rbp), %rdi
callq 0x3ae30
jmp 0x3b67e
leaq -0x340(%rbp), %rdi
callq 0x41720
movb %al, -0x451(%rbp)
jmp 0x3b692
movb -0x451(%rbp), %al
testb $0x1, %al
jne 0x3b69e
jmp 0x3b6f0
movq -0x3a0(%rbp), %rdi
leaq -0x340(%rbp), %rsi
callq 0x41740
jmp 0x3b6b3
movl $0x1, -0xa8(%rbp)
jmp 0x3b7ae
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
jmp 0x3b7d4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
jmp 0x3b7c8
leaq -0x390(%rbp), %rdi
movq %rdi, -0x460(%rbp)
leaq -0x60(%rbp), %rsi
callq 0x15910
jmp 0x3b709
leaq -0x378(%rbp), %rax
movq %rax, -0x470(%rbp)
leaq -0x340(%rbp), %rdi
callq 0x417f0
movq %rax, -0x468(%rbp)
jmp 0x3b72c
movq -0x468(%rbp), %rsi
movq -0x470(%rbp), %rdi
callq 0x15a00
jmp 0x3b741
movq -0x3a0(%rbp), %rdi
leaq -0x390(%rbp), %rsi
callq 0x41870
jmp 0x3b756
leaq -0x390(%rbp), %rdi
callq 0x17e50
movl $0x1, -0xa8(%rbp)
jmp 0x3b7ae
movq -0x460(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
callq 0x15a50
jmp 0x3b7c8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
leaq -0x390(%rbp), %rdi
callq 0x17e50
jmp 0x3b7c8
leaq -0x340(%rbp), %rdi
callq 0x41650
leaq -0x300(%rbp), %rdi
callq 0x404f0
jmp 0x3b7e2
leaq -0x340(%rbp), %rdi
callq 0x41650
leaq -0x300(%rbp), %rdi
callq 0x404f0
jmp 0x3b7f0
leaq -0x2d0(%rbp), %rdi
callq 0x407c0
jmp 0x3b7fe
leaq -0x2d0(%rbp), %rdi
callq 0x407c0
jmp 0x3b820
leaq -0x60(%rbp), %rdi
callq 0x15a50
leaq -0x48(%rbp), %rdi
callq 0x404f0
movq -0x398(%rbp), %rax
addq $0x470, %rsp            # imm = 0x470
popq %rbp
retq
leaq -0x60(%rbp), %rdi
callq 0x15a50
leaq -0x48(%rbp), %rdi
callq 0x404f0
movq -0xa0(%rbp), %rdi
callq 0xa650
nop