code: def to_int(s, rnd=None):
      """Convert a raw mpf to the nearest int. Rounding is done down by
      default (same as int(float) in Python), but can be changed. If the
      input is inf/nan, an exception is raised."""
      sign, man, exp, bc = s
      if (not man) and exp:
          raise ValueError("cannot convert inf or nan to int")
      if exp >= 0:
          if sign:
              return (-man) << exp
          return man << exp
      # Make default rounding fast
      if not rnd:
          if sign:
              return -(man >> (-exp))
          else:
              return man >> (-exp)
      if sign:
          return round_int(-man, -exp, rnd)
      else:
          return round_int(man, -exp, rnd)
  
imports: import math
  from bisect import bisect
  import sys
  from .backend import MPZ, MPZ_TYPE, MPZ_ZERO, MPZ_ONE, MPZ_TWO, MPZ_FIVE, BACKEND, STRICT, HASH_MODULUS, HASH_BITS, gmpy, sage, sage_utils
  from .libintmath import giant_steps, trailtable, bctable, lshift, rshift, bitcount, trailing, sqrt_fixed, numeral, isqrt, isqrt_fast, sqrtrem, bin_to_radix
label_desc: Use image node_id 13 for calling a global function with example usage: to_int(s, rnd) and returns: unknown, round_int, round_int, unknown, unknown, unknown