code: def population_count(x):
      assert np.issubdtype(x.dtype, np.integer)
      dtype = x.dtype
      iinfo = np.iinfo(x.dtype)
      if np.iinfo(x.dtype).bits < 32:
          assert iinfo.kind in ("i", "u")
          x = x.astype(np.uint32 if iinfo.kind == "u" else np.int32)
      if iinfo.kind == "i":
          x = x.view(f"uint{np.iinfo(x.dtype).bits}")
      assert x.dtype in (np.uint32, np.uint64)
      m = [
          np.uint64(0x5555555555555555),  # binary: 0101...
          np.uint64(0x3333333333333333),  # binary: 00110011..
          np.uint64(
              0x0F0F0F0F0F0F0F0F
          ),  # binary:  4 zeros,  4 ones ...
          np.uint64(
              0x00FF00FF00FF00FF
          ),  # binary:  8 zeros,  8 ones ...
          np.uint64(
              0x0000FFFF0000FFFF
          ),  # binary: 16 zeros, 16 ones ...
          np.uint64(0x00000000FFFFFFFF),  # binary: 32 zeros, 32 ones
      ]
  
      if x.dtype == np.uint32:
          m = list(map(np.uint32, m[:-1]))
  
      x = (x & m[0]) + (
          (x >> 1) & m[0]
      )  # put count of each  2 bits into those  2 bits
      x = (x & m[1]) + (
          (x >> 2) & m[1]
      )  # put count of each  4 bits into those  4 bits
      x = (x & m[2]) + (
          (x >> 4) & m[2]
      )  # put count of each  8 bits into those  8 bits
      x = (x & m[3]) + (
          (x >> 8) & m[3]
      )  # put count of each 16 bits into those 16 bits
      x = (x & m[4]) + (
          (x >> 16) & m[4]
      )  # put count of each 32 bits into those 32 bits
      if x.dtype == np.uint64:
          x = (x & m[5]) + (
              (x >> 32) & m[5]
          )  # put count of each 64 bits into those 64 bits
      return x.astype(dtype)
  
imports: import builtins
  import collections
  import itertools
  import numpy
  import opt_einsum
  import scipy.special
  from jax._src import dtypes
  from jax._src import util
label_desc: Use image node_id 15 for calling a global function with example usage: population_count(x) and returns: x