from qiskit import *

q = QuantumRegister(3,'q')
c = ClassicalRegister(2,'c')
q1 = QuantumRegister(4,'q1')
c1 = ClassicalRegister(2,'c1')
res = ClassicalRegister(1,'r')

backend = Aer.get_backend('qasm_simulator')

qc = QuantumCircuit(q,c,res)
qc.x([0,1])
qc.measure([0,1],[0,1])
qc.h(2).c_if([c[0],c[1]],3)
qc.measure(2,res)

qjob = execute(qc,backend)
counts = qjob.result().get_counts()
print(counts)

qc.draw('mpl', cregbundle=False)

qc1 = QuantumCircuit(q,c,c1,res)
qc1.x([0,1])
qc1.measure([0,1],[c[0],c1[0]])
qc1.h(2).c_if([c[0],c1[1]],2)
qc1.measure(2,res)

qjob1 = execute(qc1,backend)
counts = qjob1.result().get_counts()
print(counts)

qc1.draw('mpl',cregbundle=False)