def _get_cindex(circ, name, index):
    """
    Find the classical bit index.

    Args:
        circ: The Qiskit QuantumCircuit in question
        name: The name of the classical register
        index: The qubit's relative index inside the register

    Returns:
        The classical bit's absolute index if all registers are concatenated.
    """
    ret = 0
    for reg in circ.cregs:
        if name != reg.name:
            ret += reg.size
        else:
            return ret + index
    return ret + index