def clo32(val):
    """ Count Leading Ones starting from bit 32. """
    # pylint: disable=line-too-long
    first_bit = val[31] ^ 0x0
    ctr = (1 & val[31]) + \
          (1 & val[30]) + \
          (1 & val[29] & val[30]) + \
          (1 & val[28] & val[30] & val[29]) + \
          (1 & val[27] & val[30] & val[29] & val[28]) + \
          (1 & val[26] & val[30] & val[29] & val[28] & val[27]) + \
          (1 & val[25] & val[30] & val[29] & val[28] & val[27] & val[26]) + \
          (1 & val[24] & val[30] & val[29] & val[28] & val[27] & val[26] & val[25]) + \
          (1 & val[23] & val[30] & val[29] & val[28] & val[27] & val[26] & val[25] & val[24]) + \
          (1 & val[22] & val[30] & val[29] & val[28] & val[27] & val[26] & val[25] & val[24] & val[23]) + \
          (1 & val[21] & val[30] & val[29] & val[28] & val[27] & val[26] & val[25] & val[24] & val[23] & val[22]) + \
          (1 & val[20] & val[30] & val[29] & val[28] & val[27] & val[26] & val[25] & val[24] & val[23] & val[22] & val[21]) + \
          (1 & val[19] & val[30] & val[29] & val[28] & val[27] & val[26] & val[25] & val[24] & val[23] & val[22] & val[21] & val[20]) + \
          (1 & val[18] & val[30] & val[29] & val[28] & val[27] & val[26] & val[25] & val[24] & val[23] & val[22] & val[21] & val[20] & val[19]) + \
          (1 & val[17] & val[30] & val[29] & val[28] & val[27] & val[26] & val[25] & val[24] & val[23] & val[22] & val[21] & val[20] & val[19] & val[18]) + \
          (1 & val[16] & val[30] & val[29] & val[28] & val[27] & val[26] & val[25] & val[24] & val[23] & val[22] & val[21] & val[20] & val[19] & val[18] & val[17]) + \
          (1 & val[15] & val[30] & val[29] & val[28] & val[27] & val[26] & val[25] & val[24] & val[23] & val[22] & val[21] & val[20] & val[19] & val[18] & val[17] & val[16]) + \
          (1 & val[14] & val[30] & val[29] & val[28] & val[27] & val[26] & val[25] & val[24] & val[23] & val[22] & val[21] & val[20] & val[19] & val[18] & val[17] & val[16] & val[15]) + \
          (1 & val[13] & val[30] & val[29] & val[28] & val[27] & val[26] & val[25] & val[24] & val[23] & val[22] & val[21] & val[20] & val[19] & val[18] & val[17] & val[16] & val[15] & val[14]) + \
          (1 & val[12] & val[30] & val[29] & val[28] & val[27] & val[26] & val[25] & val[24] & val[23] & val[22] & val[21] & val[20] & val[19] & val[18] & val[17] & val[16] & val[15] & val[14] & val[13]) + \
          (1 & val[11] & val[30] & val[29] & val[28] & val[27] & val[26] & val[25] & val[24] & val[23] & val[22] & val[21] & val[20] & val[19] & val[18] & val[17] & val[16] & val[15] & val[14] & val[13] & val[12]) + \
          (1 & val[10] & val[30] & val[29] & val[28] & val[27] & val[26] & val[25] & val[24] & val[23] & val[22] & val[21] & val[20] & val[19] & val[18] & val[17] & val[16] & val[15] & val[14] & val[13] & val[12] & val[11]) + \
          (1 & val[9]  & val[30] & val[29] & val[28] & val[27] & val[26] & val[25] & val[24] & val[23] & val[22] & val[21] & val[20] & val[19] & val[18] & val[17] & val[16] & val[15] & val[14] & val[13] & val[12] & val[11] & val[10]) + \
          (1 & val[8]  & val[30] & val[29] & val[28] & val[27] & val[26] & val[25] & val[24] & val[23] & val[22] & val[21] & val[20] & val[19] & val[18] & val[17] & val[16] & val[15] & val[14] & val[13] & val[12] & val[11] & val[10] & val[9]) + \
          (1 & val[7]  & val[30] & val[29] & val[28] & val[27] & val[26] & val[25] & val[24] & val[23] & val[22] & val[21] & val[20] & val[19] & val[18] & val[17] & val[16] & val[15] & val[14] & val[13] & val[12] & val[11] & val[10] & val[9] & val[8]) + \
          (1 & val[6]  & val[30] & val[29] & val[28] & val[27] & val[26] & val[25] & val[24] & val[23] & val[22] & val[21] & val[20] & val[19] & val[18] & val[17] & val[16] & val[15] & val[14] & val[13] & val[12] & val[11] & val[10] & val[9] & val[8] & val[7]) + \
          (1 & val[5]  & val[30] & val[29] & val[28] & val[27] & val[26] & val[25] & val[24] & val[23] & val[22] & val[21] & val[20] & val[19] & val[18] & val[17] & val[16] & val[15] & val[14] & val[13] & val[12] & val[11] & val[10] & val[9] & val[8] & val[7] & val[6]) + \
          (1 & val[4]  & val[30] & val[29] & val[28] & val[27] & val[26] & val[25] & val[24] & val[23] & val[22] & val[21] & val[20] & val[19] & val[18] & val[17] & val[16] & val[15] & val[14] & val[13] & val[12] & val[11] & val[10] & val[9] & val[8] & val[7] & val[6] & val[5]) + \
          (1 & val[3]  & val[30] & val[29] & val[28] & val[27] & val[26] & val[25] & val[24] & val[23] & val[22] & val[21] & val[20] & val[19] & val[18] & val[17] & val[16] & val[15] & val[14] & val[13] & val[12] & val[11] & val[10] & val[9] & val[8] & val[7] & val[6] & val[5] & val[4]) + \
          (1 & val[2]  & val[30] & val[29] & val[28] & val[27] & val[26] & val[25] & val[24] & val[23] & val[22] & val[21] & val[20] & val[19] & val[18] & val[17] & val[16] & val[15] & val[14] & val[13] & val[12] & val[11] & val[10] & val[9] & val[8] & val[7] & val[6] & val[5] & val[4] & val[3]) + \
          (1 & val[1]  & val[30] & val[29] & val[28] & val[27] & val[26] & val[25] & val[24] & val[23] & val[22] & val[21] & val[20] & val[19] & val[18] & val[17] & val[16] & val[15] & val[14] & val[13] & val[12] & val[11] & val[10] & val[9] & val[8] & val[7] & val[6] & val[5] & val[4] & val[3] & val[2]) + \
          (1 & val[0]  & val[30] & val[29] & val[28] & val[27] & val[26] & val[25] & val[24] & val[23] & val[22] & val[21] & val[20] & val[19] & val[18] & val[17] & val[16] & val[15] & val[14] & val[13] & val[12] & val[11] & val[10] & val[9] & val[8] & val[7] & val[6] & val[5] & val[4] & val[3] & val[2] & val[1])

    return ctr * first_bit