    {-# OPTIONS_GHC -optc-DPROFILING #-}
    {-# LINE 1 "libraries/ghc-internal/src/GHC/Internal/Heap/InfoTableProf.hsc" #-}
    module GHC.Internal.Heap.InfoTableProf
        ( module GHC.Internal.Heap.InfoTable.Types
        , itblSize
        , peekItbl
        , pokeItbl
        ) where

    -- This file overrides InfoTable.hsc's implementation of peekItbl and pokeItbl.
    -- Manually defining PROFILING gives the #peek and #poke macros an accurate
    -- representation of StgInfoTable_ when hsc2hs runs.

    import GHC.Internal.Base
    import GHC.Internal.Real
    import GHC.Internal.Enum

    import GHC.Internal.Heap.InfoTable.Types

    {-# LINE 25 "libraries/ghc-internal/src/GHC/Internal/Heap/InfoTableProf.hsc" #-}
    import GHC.Internal.Data.Either
    import GHC.Internal.Foreign.Marshal.Array

    {-# LINE 28 "libraries/ghc-internal/src/GHC/Internal/Heap/InfoTableProf.hsc" #-}
    import GHC.Internal.Foreign.Ptr
    import GHC.Internal.Foreign.Storable

    -- | Read an InfoTable from the heap into a haskell type.
    -- WARNING: This code assumes it is passed a pointer to a "standard" info
    -- table. If tables_next_to_code is enabled, it will look 1 byte before the
    -- start for the entry field.
    peekItbl :: Ptr StgInfoTable -> IO StgInfoTable
    peekItbl :: Ptr StgInfoTable -> IO StgInfoTable
    peekItbl Ptr StgInfoTable
    a0 = do

    {-# LINE 41 "libraries/ghc-internal/src/GHC/Internal/Heap/InfoTableProf.hsc" #-}
      let ptr :: Ptr StgInfoTable
    ptr = Ptr StgInfoTable
    a0
          entry' :: Maybe a
    entry' = Maybe a
    forall a. Maybe a
    Nothing

    {-# LINE 44 "libraries/ghc-internal/src/GHC/Internal/Heap/InfoTableProf.hsc" #-}
      ptrs'   <- ((\hsc_ptr -> peekByteOff hsc_ptr 16)) ptr
    {-# LINE 45 "libraries/ghc-internal/src/GHC/Internal/Heap/InfoTableProf.hsc" #-}
      nptrs'  <- ((\hsc_ptr -> peekByteOff hsc_ptr 20)) ptr
    {-# LINE 46 "libraries/ghc-internal/src/GHC/Internal/Heap/InfoTableProf.hsc" #-}
      tipe'   <- ((\hsc_ptr -> peekByteOff hsc_ptr 24)) ptr
    {-# LINE 47 "libraries/ghc-internal/src/GHC/Internal/Heap/InfoTableProf.hsc" #-}
      srtlen' <- ((\hsc_ptr -> peekByteOff hsc_ptr 28)) a0
    {-# LINE 48 "libraries/ghc-internal/src/GHC/Internal/Heap/InfoTableProf.hsc" #-}
      return StgInfoTable
        { entry  = entry'
        , ptrs   = ptrs'
        , nptrs  = nptrs'
        , tipe   = toEnum (fromIntegral (tipe' :: HalfWord))
        , srtlen = srtlen'
        , code   = Nothing
        }

    pokeItbl :: Ptr StgInfoTable -> StgInfoTable -> IO ()
    pokeItbl :: Ptr StgInfoTable -> StgInfoTable -> IO ()
    pokeItbl Ptr StgInfoTable
    a0 StgInfoTable
    itbl = do

    {-# LINE 62 "libraries/ghc-internal/src/GHC/Internal/Heap/InfoTableProf.hsc" #-}
      ((\Ptr StgInfoTable
    hsc_ptr -> Ptr StgInfoTable -> Int -> HalfWord -> IO ()
    forall b. Ptr b -> Int -> HalfWord -> IO ()
    forall a b. Storable a => Ptr b -> Int -> a -> IO ()
    pokeByteOff Ptr StgInfoTable
    hsc_ptr Int
    16)) Ptr StgInfoTable
    a0 (StgInfoTable -> HalfWord
    ptrs StgInfoTable
    itbl)
    {-# LINE 63 "libraries/ghc-internal/src/GHC/Internal/Heap/InfoTableProf.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 20)) a0 (nptrs itbl)
    {-# LINE 64 "libraries/ghc-internal/src/GHC/Internal/Heap/InfoTableProf.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 24)) a0 (fromEnum (tipe itbl))
    {-# LINE 65 "libraries/ghc-internal/src/GHC/Internal/Heap/InfoTableProf.hsc" #-}
      ((\hsc_ptr -> pokeByteOff hsc_ptr 28)) a0 (srtlen itbl)
    {-# LINE 66 "libraries/ghc-internal/src/GHC/Internal/Heap/InfoTableProf.hsc" #-}

    {-# LINE 67 "libraries/ghc-internal/src/GHC/Internal/Heap/InfoTableProf.hsc" #-}
      let code_offset = a0 `plusPtr` ((32))
    {-# LINE 68 "libraries/ghc-internal/src/GHC/Internal/Heap/InfoTableProf.hsc" #-}
      case code itbl of
        Nothing -> return ()
        Just (Left xs) -> pokeArray code_offset xs
        Just (Right xs) -> pokeArray code_offset xs

    {-# LINE 73 "libraries/ghc-internal/src/GHC/Internal/Heap/InfoTableProf.hsc" #-}

    itblSize :: Int
    itblSize :: Int
    itblSize = ((Int
    32))
    {-# LINE 76 "libraries/ghc-internal/src/GHC/Internal/Heap/InfoTableProf.hsc" #-}