def METHOD_NAME(key, uid, nonce):
    state = 0
    for i in range(32, 48):
        state = (state << 1) | ((key >> i) & 1)
    for i in range(0, 32):
        state = (state << 1) | ((uid >> i) & 1)
    #print '%012x' % state
    #print '%012x' % (int("{0:048b}".format(state)[::-1],2))
    for i in range(0, 32):
        nonce_bit = (f20(state) ^ ((nonce >> (31-i)) & 1))
        #print nonce_bit
        state = (state >> 1) | (((nonce_bit ^ (key >> (31-i))) & 1) << 47)
    #print '%012x' % state
    #print '%012x' % (int("{0:048b}".format(state)[::-1],2))
    return state