def computeNumGates(ret_dict):
    """
    Does not change state of ret_dict, only returns number of gates

    xor component
        128 xor gates
    aes_round gates:
        num_xor 3072
        num_and 576
        num_zero 128
        num_one 128
        num_xor + num_and 3648
        total 3904
    """
    xor_gates_per_circuit = 128
    aes_round_gates_per_circuit = 3904 # this number seems high
    aes_final_gates_per_circuit = 3904
    num_gates = 0

    for component in ret_dict['components']:
        if component['type'] == 'XOR':
            num_gates += component['num'] * xor_gates_per_circuit
        elif component['type'] == 'AES_ROUND':
            num_gates += component['num'] * aes_round_gates_per_circuit
        elif component['type'] == 'AES_FINAL_ROUND':
            num_gates += component['num'] * aes_final_gates_per_circuit
        else:
            raise RuntimeError("type {} not detected".format(component['type']))
    return num_gates