import math


def dejmps_gates_and_measurement_alice(q1, q2):
    """
    Performs the gates and measurements for Alice's side of the DEJMPS protocol
    :param q1: Alice's qubit from the first entangled pair
    :param q2: Alice's qubit from the second entangled pair
    :return: Integer 0/1 indicating Alice's measurement outcome
    """
    q1.rot_X(angle=math.pi/2)
    q2.rot_X(angle=math.pi/2)
    q2.cnot(q1) # control = q2, target = q1
    a = q1.measure()
    #a = int(a) # cannot be executed before `alice.flush`

    return a