// File: /workspace/github_cpp_makefile_star2_O3/acliusBackHome[P]kamaya/dist/ParseType.cpp
// Function: ParseType::dfs_convert(std::tuple<ExpressionType, unsigned long, unsigned long> const&)
size_t ParseType::dfs_convert(const OpAble &op_try) {
    const auto record = op_able.find(op_try);
    if (record != op_able.end()) {
        return record->second;
    }
    ExpressionType op_type = get<0>(op_try);
    size_t type1_id = get<1>(op_try), type2_id = get<2>(op_try);
    if (type1_id == type2_id) {
        // 完全一致
        op_able[op_try] = type1_id;
        return type1_id;
    }
    const ParseType &type1 = get_type(type1_id), &type2 = get_type(type2_id);
    if (type1.base_type != T_UNKNOWN && type2.base_type != T_UNKNOWN) {
        // 发现是基础类型的派生
        if (type1.base_type > type2.base_type) {
            op_able[op_try] = type1_id;
            return type1_id;
        }
        if (type1.base_type < type2.base_type) {
            op_able[op_try] = type2_id;
            return type2_id;
        }
        // base_type一致, 比较声明符号
        if (type1.specifier > type2.specifier) {
            op_able[op_try] = type1_id;
            return type1_id;
        }
        if (type1.specifier < type2.specifier) {
            op_able[op_try] = type2_id;
            return type2_id;
        }
        //完全一致
        op_able[op_try] = type1_id;
        return type1_id;
    }
    // 向下一层搜索
    op_trying.insert(op_try);
    // 拿到所有type1和type2能够无条件转化的类型
    vector<size_t> type1_to, type2_to;
    for (const auto &each : op_able) {
        // 遍历目前记录表能够拿到的所有记录
        // 这个可以用多层map进行优化, 但是...现在还没必要...
        const auto &op = each.first;
        if (get<0>(each.first) == E_UNDEFINED) {
            if (get<1>(each.first) == type1_id) {
                type1_to.emplace_back(each.second);
            } else if (get<1>(each.first) == type2_id) {
                type2_to.emplace_back(each.second);
            }
        }
    }
    for (size_t type1_convert_id : type1_to) {
        for (size_t type2_convert_id : type2_to) {
            OpAble op_try_next(op_type, type1_convert_id, type2_convert_id);
            if (op_trying.find(op_try_next) != op_trying.end()) {
                //这个已经有在之前搜索了, 跳过
                // 防止DFS环
                continue;
            }
            size_t try_res = dfs_convert(op_try_next);// op_try_next已经在下一层标记了
            if (try_res != (size_t) -1) {
                // 结果有效
                op_able[op_try] = try_res;
                return try_res;
            }
            // 无效继续搜索
        }
    }
    // 搜索完毕, type1和type2怎么转化都无法得到表达式op_type的返回值
    op_able[op_try] = (size_t) -1;
    return (size_t) -1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rdi, %rbx
leaq 0x33ac7(%rip), %rdi     # 0x5c358
movq %rbx, %rsi
callq 0x29f4c
leaq 0x33ac0(%rip), %r15     # 0x5c360
cmpq %r15, %rax
je 0x288ae
movq 0x38(%rax), %r14
jmp 0x28ab2
movq (%rbx), %r13
movq 0x8(%rbx), %r14
cmpq %r13, %r14
jne 0x288d1
leaq 0x33a97(%rip), %rdi     # 0x5c358
movq %rbx, %rsi
callq 0x28dd2
movq %r14, (%rax)
jmp 0x28ab2
movq %rbx, -0x30(%rbp)
movl 0x10(%rbx), %eax
movl %eax, -0x3c(%rbp)
movq %r14, %rdi
callq 0x2796c
movq %rax, %r12
movq %r13, %rdi
callq 0x2796c
movl (%r12), %ecx
testl %ecx, %ecx
je 0x28911
movl (%rax), %edx
testl %edx, %edx
je 0x28911
cmpl %edx, %ecx
jle 0x28a9a
leaq 0x33a4d(%rip), %rdi     # 0x5c358
movq -0x30(%rbp), %rsi
jmp 0x288c4
leaq 0x33a10(%rip), %rdi     # 0x5c328
movq -0x30(%rbp), %rsi
callq 0x2a24c
xorl %eax, %eax
movq %rax, -0x70(%rbp)
xorps %xmm0, %xmm0
movaps %xmm0, -0x80(%rbp)
movq %rax, -0x50(%rbp)
movaps %xmm0, -0x60(%rbp)
movq 0x33a33(%rip), %r12     # 0x5c370
cmpq %r15, %r12
je 0x28a49
leaq -0x58(%rbp), %rbx
cmpl $0x0, 0x30(%r12)
jne 0x289a2
movq 0x28(%r12), %rax
cmpq %r14, %rax
jne 0x28982
leaq 0x38(%r12), %rdx
movq -0x78(%rbp), %rsi
leaq -0x80(%rbp), %rdi
leaq -0x78(%rbp), %rax
cmpq -0x70(%rbp), %rsi
je 0x2899d
movq (%rdx), %rcx
movq %rcx, (%rsi)
addq $0x8, %rsi
movq %rsi, (%rax)
jmp 0x289a2
cmpq %r13, %rax
jne 0x289a2
leaq 0x38(%r12), %rdx
movq -0x58(%rbp), %rsi
leaq -0x60(%rbp), %rdi
movq %rbx, %rax
cmpq -0x50(%rbp), %rsi
jne 0x28973
callq 0x19bda
movq %r12, %rdi
callq 0x4230
movq %rax, %r12
cmpq %r15, %rax
jne 0x2894a
movq -0x80(%rbp), %rax
movq -0x78(%rbp), %rcx
movq %rax, -0x38(%rbp)
movq %rcx, -0x88(%rbp)
cmpq %rcx, %rax
je 0x28a49
leaq -0xa0(%rbp), %r12
movq -0x60(%rbp), %rbx
movq -0x58(%rbp), %r15
cmpq %r15, %rbx
je 0x28a34
movq -0x38(%rbp), %rax
movq (%rax), %r13
movq (%rbx), %rax
movq %rax, -0xa0(%rbp)
movq %r13, -0x98(%rbp)
movl -0x3c(%rbp), %eax
movl %eax, -0x90(%rbp)
leaq 0x33922(%rip), %rdi     # 0x5c328
movq %r12, %rsi
callq 0x2a3e0
leaq 0x3391b(%rip), %rcx     # 0x5c330
cmpq %rcx, %rax
jne 0x28a2b
movq %r12, %rdi
callq 0x28876
movq %rax, %r14
cmpq $-0x1, %rax
jne 0x28a69
addq $0x8, %rbx
cmpq %r15, %rbx
jne 0x289e5
movq -0x38(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x38(%rbp)
cmpq -0x88(%rbp), %rax
jne 0x289d1
leaq 0x33908(%rip), %rdi     # 0x5c358
movq -0x30(%rbp), %rsi
callq 0x28dd2
movq $-0x1, (%rax)
movq $-0x1, %r14
jmp 0x28a7c
leaq 0x338e8(%rip), %rdi     # 0x5c358
movq -0x30(%rbp), %rsi
callq 0x28dd2
movq %r14, (%rax)
movq -0x60(%rbp), %rdi
testq %rdi, %rdi
je 0x28a8a
callq 0x42b0
movq -0x80(%rbp), %rdi
testq %rdi, %rdi
je 0x28ab2
callq 0x42b0
jmp 0x28ab2
jge 0x28ac4
leaq 0x338b5(%rip), %rdi     # 0x5c358
movq -0x30(%rbp), %rsi
callq 0x28dd2
movq %r13, (%rax)
movq %r13, %r14
movq %r14, %rax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl 0x4(%r12), %ebx
movl 0x4(%rax), %r15d
cmpl %r15d, %ebx
jg 0x28904
leaq 0x3387b(%rip), %rdi     # 0x5c358
movq -0x30(%rbp), %rsi
callq 0x28dd2
cmpl %r15d, %ebx
jge 0x288c9
jmp 0x28aac
jmp 0x28af9
jmp 0x28af9
jmp 0x28af9
jmp 0x28af9
movq %rax, %rbx
movq -0x60(%rbp), %rdi
testq %rdi, %rdi
je 0x28b0a
callq 0x42b0
movq -0x80(%rbp), %rdi
testq %rdi, %rdi
je 0x28b18
callq 0x42b0
movq %rbx, %rdi
callq 0x4560