{-# LANGUAGE DuplicateRecordFields #-}

-- |
-- Module      : Binja.Mlil
-- Description : Medium Level IL instruction interface
-- License     : MIT
-- Maintainer  : hello@bloombit.dev
-- Stability   : alpha
--
-- @Binja.Mlil@ provides higher level types for medium level IL SSA-variant instructions and utility functions.
--
-- Official Mlil Documentation: <https://docs.binary.ninja/dev/bnil-mlil.html Binary Ninja Intermediate Language: Medium Level IL>
module Binja.Mlil
  ( Binja.Mlil.fromRef,
    Binja.Mlil.callerSites,
    Binja.Mlil.defSite,
    Binja.Mlil.useSites,
    Binja.Mlil.constantToSymbol,
    Binja.Mlil.extractCallDestSymbol,
    Binja.Mlil.instructions,
    Binja.Mlil.instructionsFromFunc,
    Binja.Mlil.instructionsFromFuncNoChildren,
    Binja.Mlil.children,
  )
where

import Binja.BinaryView
import Binja.FFI
import Binja.Function
import Binja.Llil
import Binja.ReferenceSource
import Binja.Types
import Control.Monad (zipWithM)
import Data.Maybe (catMaybes)

startIndex :: BNMlilFunctionPtr -> BNArchPtr -> Word64 -> IO CSize
startIndex :: BNMlilFunctionPtr -> BNArchPtr -> Word64 -> IO CSize
startIndex BNMlilFunctionPtr
func BNArchPtr
arch' Word64
addr = do
  if BNArchPtr
arch' BNArchPtr -> BNArchPtr -> Bool
forall a. Eq a => a -> a -> Bool
== BNArchPtr
forall a. Ptr a
nullPtr Bool -> Bool -> Bool
|| BNMlilFunctionPtr
func BNMlilFunctionPtr -> BNMlilFunctionPtr -> Bool
forall a. Eq a => a -> a -> Bool
== BNMlilFunctionPtr
forall a. Ptr a
nullPtr
    then [Char] -> IO CSize
forall a. HasCallStack => [Char] -> a
error [Char]
"Binja.Mlil.startIndex: called with nullPtr argument"
    else do
      startI <- BNMlilFunctionPtr -> BNArchPtr -> Word64 -> IO CSize
c_BNMediumLevelILGetInstructionStart BNMlilFunctionPtr
func BNArchPtr
arch' Word64
addr
      count' <- c_BNGetMediumLevelILInstructionCount func
      -- Ensure start index is less than total mlil instructions
      -- in function
      if startI >= count'
        then error $ "Binja.Mlil.startIndex: startI:" ++ show startI ++ " >= count:" ++ show count'
        else pure startI

-- | Construct a raw mlil instruction from a ssa function and expression index
mlilSSAByIndex :: BNMlilSSAFunctionPtr -> CSize -> IO BNMediumLevelILInstruction
mlilSSAByIndex :: BNMlilSSAFunctionPtr -> CSize -> IO BNMediumLevelILInstruction
mlilSSAByIndex BNMlilSSAFunctionPtr
func CSize
index' = do
  (Ptr BNMediumLevelILInstruction -> IO BNMediumLevelILInstruction)
-> IO BNMediumLevelILInstruction
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr BNMediumLevelILInstruction -> IO BNMediumLevelILInstruction)
 -> IO BNMediumLevelILInstruction)
-> (Ptr BNMediumLevelILInstruction
    -> IO BNMediumLevelILInstruction)
-> IO BNMediumLevelILInstruction
forall a b. (a -> b) -> a -> b
$ \Ptr BNMediumLevelILInstruction
p -> do
    _ <- Ptr BNMediumLevelILInstruction
-> BNMlilSSAFunctionPtr
-> CSize
-> IO (Ptr BNMediumLevelILInstruction)
c_BNGetMediumLevelILByIndexPtr Ptr BNMediumLevelILInstruction
p BNMlilSSAFunctionPtr
func CSize
index'
    peek p

-- | Retrieve the best MLIL SSA-variant instruction for the address in BNReferenceSource
fromRef :: BNReferenceSource -> IO MediumLevelILSSAInstruction
fromRef :: BNReferenceSource -> IO MediumLevelILSSAInstruction
fromRef BNReferenceSource
ref = do
  -- Get mlil (non-ssa) expression index
  func <- BNFunctionPtr -> IO BNMlilFunctionPtr
Binja.Function.mlil (BNReferenceSource -> BNFunctionPtr
bnFunc BNReferenceSource
ref)
  sIndex <- Binja.Mlil.startIndex func (bnArch ref) (bnAddr ref)
  exprIndex' <- c_BNGetMediumLevelILIndexForInstruction func (fromIntegral sIndex)
  -- Convert func and expression index to SSA
  funcSSA <- Binja.Function.mlilToSSA func
  ssaExprIndex <- c_BNGetMediumLevelILSSAExprIndex func exprIndex'
  create funcSSA ssaExprIndex

fromLlilRef :: BNReferenceSource -> IO MediumLevelILSSAInstruction
fromLlilRef :: BNReferenceSource -> IO MediumLevelILSSAInstruction
fromLlilRef BNReferenceSource
ref = do
  ssaExprIndex <- BNReferenceSource -> IO CSize
Binja.Llil.llilRefToMlilExprIndex BNReferenceSource
ref
  func <- Binja.Function.mlilSSA (bnFunc ref)
  create func ssaExprIndex

getExprList :: BNMlilSSAFunctionPtr -> CSize -> CSize -> IO [MediumLevelILSSAInstruction]
getExprList :: BNMlilSSAFunctionPtr
-> CSize -> CSize -> IO [MediumLevelILSSAInstruction]
getExprList BNMlilSSAFunctionPtr
func CSize
expr CSize
operand =
  (Ptr CSize -> IO [MediumLevelILSSAInstruction])
-> IO [MediumLevelILSSAInstruction]
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr CSize -> IO [MediumLevelILSSAInstruction])
 -> IO [MediumLevelILSSAInstruction])
-> (Ptr CSize -> IO [MediumLevelILSSAInstruction])
-> IO [MediumLevelILSSAInstruction]
forall a b. (a -> b) -> a -> b
$ \Ptr CSize
countPtr -> do
    rawPtr <- BNMlilSSAFunctionPtr
-> CSize -> CSize -> Ptr CSize -> IO (Ptr CULLong)
c_BNMediumLevelILGetOperandList BNMlilSSAFunctionPtr
func CSize
expr CSize
operand Ptr CSize
countPtr
    count' <- fromIntegral <$> peek countPtr
    xs <-
      if rawPtr == nullPtr || count' == 0
        then pure []
        else peekArray count' rawPtr
    when (rawPtr /= nullPtr) $ c_BNMediumLevelILFreeOperandList rawPtr
    mapM (create func . fromIntegral) xs

getExpr :: BNMlilSSAFunctionPtr -> CSize -> IO MediumLevelILSSAInstruction
getExpr :: BNMlilSSAFunctionPtr -> CSize -> IO MediumLevelILSSAInstruction
getExpr = BNMlilSSAFunctionPtr -> CSize -> IO MediumLevelILSSAInstruction
create

getInt :: BNMediumLevelILInstruction -> CSize -> IO Int
getInt :: BNMediumLevelILInstruction -> CSize -> IO Int
getInt BNMediumLevelILInstruction
inst CSize
operand = Int -> IO Int
forall a. a -> IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Int -> IO Int) -> Int -> IO Int
forall a b. (a -> b) -> a -> b
$ CSize -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral (CSize -> Int) -> CSize -> Int
forall a b. (a -> b) -> a -> b
$ BNMediumLevelILInstruction -> CSize -> CSize
getOp BNMediumLevelILInstruction
inst CSize
operand

getIntList :: BNMlilSSAFunctionPtr -> CSize -> CSize -> IO [Int]
getIntList :: BNMlilSSAFunctionPtr -> CSize -> CSize -> IO [Int]
getIntList BNMlilSSAFunctionPtr
func CSize
expr CSize
operand =
  (Ptr CSize -> IO [Int]) -> IO [Int]
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr CSize -> IO [Int]) -> IO [Int])
-> (Ptr CSize -> IO [Int]) -> IO [Int]
forall a b. (a -> b) -> a -> b
$ \Ptr CSize
countPtr -> do
    rawPtr <- BNMlilSSAFunctionPtr
-> CSize -> CSize -> Ptr CSize -> IO (Ptr CULLong)
c_BNMediumLevelILGetOperandList BNMlilSSAFunctionPtr
func CSize
expr CSize
operand Ptr CSize
countPtr
    count' <- fromIntegral <$> peek countPtr
    xs <-
      if rawPtr == nullPtr || count' == 0
        then pure []
        else peekArray count' rawPtr
    when (rawPtr /= nullPtr) $ c_BNMediumLevelILFreeOperandList rawPtr
    pure $ Prelude.map fromIntegral xs

varFromID :: CULLong -> IO BNVariable
varFromID :: CULLong -> IO BNVariable
varFromID CULLong
index' =
  (Ptr BNVariable -> IO BNVariable) -> IO BNVariable
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr BNVariable -> IO BNVariable) -> IO BNVariable)
-> (Ptr BNVariable -> IO BNVariable) -> IO BNVariable
forall a b. (a -> b) -> a -> b
$ \Ptr BNVariable
p -> do
    _ <- Ptr BNVariable -> CULLong -> IO ()
c_BNFromVariableIdentifierPtr Ptr BNVariable
p CULLong
index'
    peek p

getVarList :: BNMlilSSAFunctionPtr -> CSize -> CSize -> IO [BNVariable]
getVarList :: BNMlilSSAFunctionPtr -> CSize -> CSize -> IO [BNVariable]
getVarList BNMlilSSAFunctionPtr
func CSize
expr CSize
operand =
  (Ptr CSize -> IO [BNVariable]) -> IO [BNVariable]
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr CSize -> IO [BNVariable]) -> IO [BNVariable])
-> (Ptr CSize -> IO [BNVariable]) -> IO [BNVariable]
forall a b. (a -> b) -> a -> b
$ \Ptr CSize
countPtr -> do
    rawPtr <- BNMlilSSAFunctionPtr
-> CSize -> CSize -> Ptr CSize -> IO (Ptr CULLong)
c_BNMediumLevelILGetOperandList BNMlilSSAFunctionPtr
func CSize
expr CSize
operand Ptr CSize
countPtr
    count' <- fromIntegral <$> peek countPtr
    xs <-
      if rawPtr == nullPtr || count' == 0
        then pure []
        else peekArray count' rawPtr
    when (rawPtr /= nullPtr) $ c_BNMediumLevelILFreeOperandList rawPtr
    mapM varFromID xs

getSSAVarList :: BNMlilSSAFunctionPtr -> CSize -> CSize -> IO [BNSSAVariable]
getSSAVarList :: BNMlilSSAFunctionPtr -> CSize -> CSize -> IO [BNSSAVariable]
getSSAVarList BNMlilSSAFunctionPtr
func CSize
expr CSize
operand =
  (Ptr CSize -> IO [BNSSAVariable]) -> IO [BNSSAVariable]
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr CSize -> IO [BNSSAVariable]) -> IO [BNSSAVariable])
-> (Ptr CSize -> IO [BNSSAVariable]) -> IO [BNSSAVariable]
forall a b. (a -> b) -> a -> b
$ \Ptr CSize
countPtr -> do
    rawPtr <- BNMlilSSAFunctionPtr
-> CSize -> CSize -> Ptr CSize -> IO (Ptr CULLong)
c_BNMediumLevelILGetOperandList BNMlilSSAFunctionPtr
func CSize
expr CSize
operand Ptr CSize
countPtr
    count' <- fromIntegral <$> peek countPtr :: IO Int
    let pairCount = Int -> Int -> Int
forall a. Integral a => a -> a -> a
div Int
count' Int
2
    result <-
      if rawPtr == nullPtr || pairCount == 0
        then pure []
        else forM [0 .. pairCount - 1] $ \Int
j -> do
          varId <- Ptr CULLong -> Int -> IO CULLong
forall a. Storable a => Ptr a -> Int -> IO a
peekElemOff Ptr CULLong
rawPtr (Int
j Int -> Int -> Int
forall a. Num a => a -> a -> a
* Int
2)
          ver <- peekElemOff rawPtr (j * 2 + 1)
          v <- varFromID varId
          pure (BNSSAVariable v (fromIntegral ver))
    when (rawPtr /= nullPtr) $
      c_BNMediumLevelILFreeOperandList rawPtr
    pure result

getSSAVar :: BNMediumLevelILInstruction -> CSize -> CSize -> IO BNSSAVariable
getSSAVar :: BNMediumLevelILInstruction -> CSize -> CSize -> IO BNSSAVariable
getSSAVar BNMediumLevelILInstruction
inst CSize
varOP CSize
version' = do
  rawVar' <- CULLong -> IO BNVariable
varFromID (CULLong -> IO BNVariable) -> CULLong -> IO BNVariable
forall a b. (a -> b) -> a -> b
$ CSize -> CULLong
forall a b. (Integral a, Num b) => a -> b
fromIntegral (CSize -> CULLong) -> CSize -> CULLong
forall a b. (a -> b) -> a -> b
$ BNMediumLevelILInstruction -> CSize -> CSize
getOp BNMediumLevelILInstruction
inst CSize
varOP
  pure $ BNSSAVariable rawVar' $ fromIntegral $ getOp inst version'

getSSAVarAndDest :: BNMediumLevelILInstruction -> CSize -> CSize -> IO BNSSAVariable
getSSAVarAndDest :: BNMediumLevelILInstruction -> CSize -> CSize -> IO BNSSAVariable
getSSAVarAndDest = BNMediumLevelILInstruction -> CSize -> CSize -> IO BNSSAVariable
getSSAVar

getFloat :: BNMediumLevelILInstruction -> CSize -> IO Double
getFloat :: BNMediumLevelILInstruction -> CSize -> IO Double
getFloat BNMediumLevelILInstruction
inst CSize
index' =
  case BNMediumLevelILInstruction -> CSize
mlSize BNMediumLevelILInstruction
inst of
    CSize
4 -> Double -> IO Double
forall a. a -> IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Double -> IO Double) -> Double -> IO Double
forall a b. (a -> b) -> a -> b
$ Float -> Double
float2Double (Float -> Double) -> Float -> Double
forall a b. (a -> b) -> a -> b
$ Word32 -> Float
castWord32ToFloat Word32
w32
    CSize
8 -> Double -> IO Double
forall a. a -> IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Double -> IO Double) -> Double -> IO Double
forall a b. (a -> b) -> a -> b
$ Word64 -> Double
castWord64ToDouble Word64
w64
    CSize
_ -> Double -> IO Double
forall a. a -> IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Double -> IO Double) -> Double -> IO Double
forall a b. (a -> b) -> a -> b
$ CSize -> Double
forall a b. (Integral a, Num b) => a -> b
fromIntegral CSize
value
  where
    w64 :: Word64
w64 = CSize -> Word64
forall a b. (Integral a, Num b) => a -> b
fromIntegral CSize
value :: Word64
    w32 :: Word32
w32 = Word64 -> Word32
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Word64 -> Word32) -> Word64 -> Word32
forall a b. (a -> b) -> a -> b
$ Word64
w64 Word64 -> Word64 -> Word64
forall a. Bits a => a -> a -> a
.&. Word64
0xffffffff :: Word32
    value :: CSize
value = BNMediumLevelILInstruction -> CSize -> CSize
getOp BNMediumLevelILInstruction
inst CSize
index'

-- TODO: Lift BNDataBufferPtr into a higher type.
-- Currently this is uniquely used by MediumLevelILConstData
getConstantData :: BNFunctionPtr -> BNMediumLevelILInstruction -> CSize -> CSize -> IO BNDataBufferPtr
getConstantData :: BNFunctionPtr
-> BNMediumLevelILInstruction
-> CSize
-> CSize
-> IO BNDataBufferPtr
getConstantData BNFunctionPtr
func BNMediumLevelILInstruction
inst CSize
op1 CSize
op2 =
  BNFunctionPtr
-> CSize -> CSize -> CSize -> Ptr CInt -> IO BNDataBufferPtr
c_BNGetConstantData BNFunctionPtr
func CSize
state CSize
value (BNMediumLevelILInstruction -> CSize
mlSize BNMediumLevelILInstruction
inst) Ptr CInt
forall a. Ptr a
nullPtr
  where
    state :: CSize
state = BNMediumLevelILInstruction -> CSize -> CSize
getOp BNMediumLevelILInstruction
inst CSize
op1
    value :: CSize
value = BNMediumLevelILInstruction -> CSize -> CSize
getOp BNMediumLevelILInstruction
inst CSize
op2

getTargetMap :: BNMlilSSAFunctionPtr -> CSize -> CSize -> IO TargetMap
getTargetMap :: BNMlilSSAFunctionPtr -> CSize -> CSize -> IO TargetMap
getTargetMap BNMlilSSAFunctionPtr
func CSize
expr CSize
operand =
  (Ptr CSize -> IO TargetMap) -> IO TargetMap
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr CSize -> IO TargetMap) -> IO TargetMap)
-> (Ptr CSize -> IO TargetMap) -> IO TargetMap
forall a b. (a -> b) -> a -> b
$ \Ptr CSize
countPtr -> do
    rawPtr <- BNMlilSSAFunctionPtr
-> CSize -> CSize -> Ptr CSize -> IO (Ptr CULLong)
c_BNMediumLevelILGetOperandList BNMlilSSAFunctionPtr
func CSize
expr CSize
operand Ptr CSize
countPtr
    count' <- fromIntegral <$> peek countPtr :: IO Int
    let pairCount = Int -> Int -> Int
forall a. Integral a => a -> a -> a
div Int
count' Int
2
    pairs <-
      if rawPtr == nullPtr || pairCount == 0
        then pure []
        else forM [0 .. pairCount - 1] $ \Int
j -> do
          key <- Ptr CULLong -> Int -> IO CULLong
forall a. Storable a => Ptr a -> Int -> IO a
peekElemOff Ptr CULLong
rawPtr (Int
j Int -> Int -> Int
forall a. Num a => a -> a -> a
* Int
2)
          target' <- peekElemOff rawPtr (j * 2 + 1)
          pure (key, target')
    when (rawPtr /= nullPtr) $
      c_BNMediumLevelILFreeOperandList rawPtr
    pure pairs

getIntrinsicIL :: BNMediumLevelILInstruction -> BNMlilSSAFunctionPtr -> CSize -> IO ILIntrinsic
getIntrinsicIL :: BNMediumLevelILInstruction
-> BNMlilSSAFunctionPtr -> CSize -> IO ILIntrinsic
getIntrinsicIL BNMediumLevelILInstruction
inst BNMlilSSAFunctionPtr
func CSize
operand = do
  let index' :: CSize
index' = BNMediumLevelILInstruction -> CSize -> CSize
getOp BNMediumLevelILInstruction
inst CSize
operand
  rawFunc <- BNMlilSSAFunctionPtr -> IO BNFunctionPtr
Binja.Function.mlilToRawFunction BNMlilSSAFunctionPtr
func
  archTy <- Binja.Function.architecture func
  archHandle' <- c_BNGetFunctionArchitecture rawFunc
  intrinsic' <- getIntrinsic archTy index'
  pure $ ILIntrinsic index' archHandle' archTy intrinsic'

getConstraint :: BNMlilSSAFunctionPtr -> BNMediumLevelILInstruction -> CSize -> IO BNPossibleValueSet
getConstraint :: BNMlilSSAFunctionPtr
-> BNMediumLevelILInstruction -> CSize -> IO BNPossibleValueSet
getConstraint BNMlilSSAFunctionPtr
func BNMediumLevelILInstruction
inst CSize
operand = do
  (Ptr BNPossibleValueSet -> IO BNPossibleValueSet)
-> IO BNPossibleValueSet
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr BNPossibleValueSet -> IO BNPossibleValueSet)
 -> IO BNPossibleValueSet)
-> (Ptr BNPossibleValueSet -> IO BNPossibleValueSet)
-> IO BNPossibleValueSet
forall a b. (a -> b) -> a -> b
$ \Ptr BNPossibleValueSet
p -> do
    _ <- Ptr BNPossibleValueSet
-> BNMlilSSAFunctionPtr -> CSize -> IO (Ptr BNPossibleValueSet)
c_BNGetCachedMediumLevelILPossibleValueSetPtr Ptr BNPossibleValueSet
p BNMlilSSAFunctionPtr
func CSize
constraintIndex
    peek p
  where
    constraintIndex :: CSize
constraintIndex = BNMediumLevelILInstruction -> CSize -> CSize
getOp BNMediumLevelILInstruction
inst CSize
operand

-- | All top-level instructions in a specific function (children not included).
instructionsFromFuncNoChildren :: BNMlilSSAFunctionPtr -> IO [MediumLevelILSSAInstruction]
instructionsFromFuncNoChildren :: BNMlilSSAFunctionPtr -> IO [MediumLevelILSSAInstruction]
instructionsFromFuncNoChildren BNMlilSSAFunctionPtr
func = do
  count' <- CSize -> Word64
forall a b. (Integral a, Num b) => a -> b
fromIntegral (CSize -> Word64) -> IO CSize -> IO Word64
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> BNMlilSSAFunctionPtr -> IO CSize
c_BNGetMediumLevelILSSAInstructionCount BNMlilSSAFunctionPtr
func
  exprs <- mapM (c_BNGetMediumLevelILSSAIndexForInstruction func) [0 .. count' - 1]
  mapM (create func) exprs

-- | All instructions (children included) in a specific function.
instructionsFromFunc :: BNMlilSSAFunctionPtr -> IO [MediumLevelILSSAInstruction]
instructionsFromFunc :: BNMlilSSAFunctionPtr -> IO [MediumLevelILSSAInstruction]
instructionsFromFunc BNMlilSSAFunctionPtr
func = do
  count' <- BNMlilSSAFunctionPtr -> IO CSize
c_BNGetMediumLevelILSSAExprCount BNMlilSSAFunctionPtr
func
  mapM (create func) [0 .. count' - 1]

-- | All instructions (children included) in a binary view.
instructions :: BNBinaryViewPtr -> IO [MediumLevelILSSAInstruction]
instructions :: BNBinaryViewPtr -> IO [MediumLevelILSSAInstruction]
instructions BNBinaryViewPtr
view = do
  rawFuncs <- BNBinaryViewPtr -> IO [BNFunctionPtr]
Binja.BinaryView.functions BNBinaryViewPtr
view
  mlilSSAFuncs <- mapM Binja.Function.mlilSSA rawFuncs
  insts <- mapM instructionsFromFunc mlilSSAFuncs
  pure $ concat insts

callerSites :: BNBinaryViewPtr -> BNMlilSSAFunctionPtr -> IO [MediumLevelILSSAInstruction]
callerSites :: BNBinaryViewPtr
-> BNMlilSSAFunctionPtr -> IO [MediumLevelILSSAInstruction]
callerSites BNBinaryViewPtr
view BNMlilSSAFunctionPtr
func = do
  rawFunc <- BNMlilSSAFunctionPtr -> IO BNFunctionPtr
mlilToRawFunction BNMlilSSAFunctionPtr
func
  start' <- Binja.Function.start rawFunc
  -- These reference sources are llil.
  -- lift via fromLlilRef
  refs' <- Binja.ReferenceSource.codeRefs view start'
  insts' <- mapM Binja.Mlil.fromLlilRef refs'
  pure $ Prelude.filter isLocalcall insts'
  where
    isLocalcall :: MediumLevelILSSAInstruction -> Bool
    isLocalcall :: MediumLevelILSSAInstruction -> Bool
isLocalcall (Localcall Localcall
_) = Bool
True
    isLocalcall MediumLevelILSSAInstruction
_ = Bool
False

-- | Derive a definition site from a ssa variable in a medium level IL SSA-variant function if
--   exists. Function arguments and registers of version 0 do not have definition sites for example.
defSite :: BNSSAVariable -> BNMlilSSAFunctionPtr -> IO (Maybe MediumLevelILSSAInstruction)
defSite :: BNSSAVariable
-> BNMlilSSAFunctionPtr -> IO (Maybe MediumLevelILSSAInstruction)
defSite BNSSAVariable
ssaVar BNMlilSSAFunctionPtr
funcSSA =
  (Ptr BNVariable -> IO (Maybe MediumLevelILSSAInstruction))
-> IO (Maybe MediumLevelILSSAInstruction)
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr BNVariable -> IO (Maybe MediumLevelILSSAInstruction))
 -> IO (Maybe MediumLevelILSSAInstruction))
-> (Ptr BNVariable -> IO (Maybe MediumLevelILSSAInstruction))
-> IO (Maybe MediumLevelILSSAInstruction)
forall a b. (a -> b) -> a -> b
$ \Ptr BNVariable
varPtr' -> do
    Ptr BNVariable -> BNVariable -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr BNVariable
varPtr' (BNVariable -> IO ()) -> BNVariable -> IO ()
forall a b. (a -> b) -> a -> b
$ BNSSAVariable -> BNVariable
rawVar BNSSAVariable
ssaVar
    instrSSAIndex <-
      BNMlilSSAFunctionPtr -> Ptr BNVariable -> CSize -> IO CSize
c_BNGetMediumLevelILSSAVarDefinition
        BNMlilSSAFunctionPtr
funcSSA
        Ptr BNVariable
varPtr'
        (Int -> CSize
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CSize) -> Int -> CSize
forall a b. (a -> b) -> a -> b
$ BNSSAVariable -> Int
version BNSSAVariable
ssaVar)
    exprIndexSSA <- c_BNGetMediumLevelILSSAIndexForInstruction funcSSA $ fromIntegral instrSSAIndex
    instCount <- c_BNGetMediumLevelILSSAInstructionCount funcSSA
    if instrSSAIndex >= instCount
      then pure Nothing
      else Just <$> create funcSSA exprIndexSSA

useSites :: BNSSAVariable -> BNMlilSSAFunctionPtr -> IO [MediumLevelILSSAInstruction]
useSites :: BNSSAVariable
-> BNMlilSSAFunctionPtr -> IO [MediumLevelILSSAInstruction]
useSites BNSSAVariable
ssaVar BNMlilSSAFunctionPtr
funcSSA =
  (Ptr CULLong -> IO [MediumLevelILSSAInstruction])
-> IO [MediumLevelILSSAInstruction]
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr CULLong -> IO [MediumLevelILSSAInstruction])
 -> IO [MediumLevelILSSAInstruction])
-> (Ptr CULLong -> IO [MediumLevelILSSAInstruction])
-> IO [MediumLevelILSSAInstruction]
forall a b. (a -> b) -> a -> b
$ \Ptr CULLong
countPtr -> do
    (Ptr BNVariable -> IO [MediumLevelILSSAInstruction])
-> IO [MediumLevelILSSAInstruction]
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr BNVariable -> IO [MediumLevelILSSAInstruction])
 -> IO [MediumLevelILSSAInstruction])
-> (Ptr BNVariable -> IO [MediumLevelILSSAInstruction])
-> IO [MediumLevelILSSAInstruction]
forall a b. (a -> b) -> a -> b
$ \Ptr BNVariable
varPtr' -> do
      Ptr BNVariable -> BNVariable -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr BNVariable
varPtr' (BNVariable -> IO ()) -> BNVariable -> IO ()
forall a b. (a -> b) -> a -> b
$ BNSSAVariable -> BNVariable
rawVar BNSSAVariable
ssaVar
      rawResult <-
        BNMlilSSAFunctionPtr
-> Ptr BNVariable -> CULLong -> Ptr CULLong -> IO (Ptr CSize)
c_BNGetMediumLevelILSSAVarUses
          BNMlilSSAFunctionPtr
funcSSA
          Ptr BNVariable
varPtr'
          (Int -> CULLong
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CULLong) -> Int -> CULLong
forall a b. (a -> b) -> a -> b
$ BNSSAVariable -> Int
version BNSSAVariable
ssaVar)
          Ptr CULLong
countPtr
      count' <- fromIntegral <$> peek countPtr :: IO Int
      result <-
        if rawResult == nullPtr || count' == 0
          then pure []
          else peekArray count' rawResult
      exprIndexSSAList <- mapM (c_BNGetMediumLevelILSSAIndexForInstruction funcSSA . fromIntegral) result
      instCount <- c_BNGetMediumLevelILSSAInstructionCount funcSSA
      useSites' <-
        catMaybes
          <$> zipWithM
            ( \CSize
instrIndex CSize
exprIndex' ->
                CSize
-> CSize
-> CSize
-> BNMlilSSAFunctionPtr
-> IO (Maybe MediumLevelILSSAInstruction)
createMaybe CSize
instCount CSize
instrIndex CSize
exprIndex' BNMlilSSAFunctionPtr
funcSSA
            )
            result
            exprIndexSSAList
      when (rawResult /= nullPtr) $ c_BNFreeILInstructionList rawResult
      pure useSites'
  where
    createMaybe :: CSize -> CSize -> CSize -> BNMlilSSAFunctionPtr -> IO (Maybe MediumLevelILSSAInstruction)
    createMaybe :: CSize
-> CSize
-> CSize
-> BNMlilSSAFunctionPtr
-> IO (Maybe MediumLevelILSSAInstruction)
createMaybe CSize
instCount CSize
instrIndex CSize
exprIndex' BNMlilSSAFunctionPtr
funcSSA' =
      if CSize
instrIndex CSize -> CSize -> Bool
forall a. Ord a => a -> a -> Bool
>= CSize
instCount
        then Maybe MediumLevelILSSAInstruction
-> IO (Maybe MediumLevelILSSAInstruction)
forall a. a -> IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Maybe MediumLevelILSSAInstruction
forall a. Maybe a
Nothing
        else MediumLevelILSSAInstruction -> Maybe MediumLevelILSSAInstruction
forall a. a -> Maybe a
Just (MediumLevelILSSAInstruction -> Maybe MediumLevelILSSAInstruction)
-> IO MediumLevelILSSAInstruction
-> IO (Maybe MediumLevelILSSAInstruction)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> BNMlilSSAFunctionPtr -> CSize -> IO MediumLevelILSSAInstruction
create BNMlilSSAFunctionPtr
funcSSA' CSize
exprIndex'

-- Convert Constant instruction to symbol if possible
constantToSymbol :: BNBinaryViewPtr -> Constant -> IO (Maybe Symbol)
constantToSymbol :: BNBinaryViewPtr -> Constant -> IO (Maybe Symbol)
constantToSymbol BNBinaryViewPtr
view' (MediumLevelILConstPtr (MediumLevelILConstPtrRec {constant :: MediumLevelILConstPtrRec -> Int
constant = Int
c})) = do
  BNBinaryViewPtr -> Word64 -> IO (Maybe Symbol)
Binja.BinaryView.symbolAt BNBinaryViewPtr
view' (Word64 -> IO (Maybe Symbol)) -> Word64 -> IO (Maybe Symbol)
forall a b. (a -> b) -> a -> b
$ Int -> Word64
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
c
constantToSymbol BNBinaryViewPtr
view' (MediumLevelILImport (MediumLevelILImportRec {constant :: MediumLevelILImportRec -> Int
constant = Int
c})) = do
  BNBinaryViewPtr -> Word64 -> IO (Maybe Symbol)
Binja.BinaryView.symbolAt BNBinaryViewPtr
view' (Word64 -> IO (Maybe Symbol)) -> Word64 -> IO (Maybe Symbol)
forall a b. (a -> b) -> a -> b
$ Int -> Word64
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
c
constantToSymbol BNBinaryViewPtr
_ (MediumLevelILConst (MediumLevelILConstRec {constant :: MediumLevelILConstRec -> Int
constant = Int
c})) = do
  [Char] -> IO ()
forall a. Show a => a -> IO ()
Prelude.print ([Char] -> IO ()) -> [Char] -> IO ()
forall a b. (a -> b) -> a -> b
$ [Char]
"Unhandled constant: " [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ Int -> [Char]
forall a. Show a => a -> [Char]
show Int
c
  Maybe Symbol -> IO (Maybe Symbol)
forall a. a -> IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Maybe Symbol
forall a. Maybe a
Nothing
constantToSymbol BNBinaryViewPtr
_ (MediumLevelILFloatConst MediumLevelILFloatConstRec {constant :: MediumLevelILFloatConstRec -> Double
constant = Double
c}) = do
  [Char] -> IO ()
forall a. Show a => a -> IO ()
Prelude.print ([Char] -> IO ()) -> [Char] -> IO ()
forall a b. (a -> b) -> a -> b
$ [Char]
"Unhandled float constant: " [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ Double -> [Char]
forall a. Show a => a -> [Char]
show Double
c
  Maybe Symbol -> IO (Maybe Symbol)
forall a. a -> IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Maybe Symbol
forall a. Maybe a
Nothing
constantToSymbol BNBinaryViewPtr
_ (MediumLevelILConstData MediumLevelILConstDataRec {constant :: MediumLevelILConstDataRec -> BNDataBufferPtr
constant = BNDataBufferPtr
c}) = do
  [Char] -> IO ()
forall a. Show a => a -> IO ()
Prelude.print ([Char] -> IO ()) -> [Char] -> IO ()
forall a b. (a -> b) -> a -> b
$ [Char]
"Unhandled constant data: " [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ BNDataBufferPtr -> [Char]
forall a. Show a => a -> [Char]
show BNDataBufferPtr
c
  Maybe Symbol -> IO (Maybe Symbol)
forall a. a -> IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Maybe Symbol
forall a. Maybe a
Nothing
constantToSymbol BNBinaryViewPtr
view' (MediumLevelILExternPtr MediumLevelILExternPtrRec {constant :: MediumLevelILExternPtrRec -> Int
constant = Int
c}) = do
  BNBinaryViewPtr -> Word64 -> IO (Maybe Symbol)
Binja.BinaryView.symbolAt BNBinaryViewPtr
view' (Word64 -> IO (Maybe Symbol)) -> Word64 -> IO (Maybe Symbol)
forall a b. (a -> b) -> a -> b
$ Int -> Word64
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
c

extractCallDestSymbol :: BNBinaryViewPtr -> MediumLevelILSSAInstruction -> IO (Maybe Symbol)
extractCallDestSymbol :: BNBinaryViewPtr -> MediumLevelILSSAInstruction -> IO (Maybe Symbol)
extractCallDestSymbol BNBinaryViewPtr
view MediumLevelILSSAInstruction
callInst =
  case MediumLevelILSSAInstruction
callInst of
    Localcall Localcall
lc ->
      case Localcall
lc of
        (MediumLevelILCall MediumLevelILCallRec {dest :: MediumLevelILCallRec -> MediumLevelILSSAInstruction
dest = MediumLevelILSSAInstruction
d}) -> MediumLevelILSSAInstruction -> IO (Maybe Symbol)
processDest MediumLevelILSSAInstruction
d
        (MediumLevelILCallSsa MediumLevelILCallSsaRec {dest :: MediumLevelILCallSsaRec -> MediumLevelILSSAInstruction
dest = MediumLevelILSSAInstruction
d}) -> MediumLevelILSSAInstruction -> IO (Maybe Symbol)
processDest MediumLevelILSSAInstruction
d
        (MediumLevelILCallUntypedSsa MediumLevelILCallUntypedSsaRec {dest :: MediumLevelILCallUntypedSsaRec -> MediumLevelILSSAInstruction
dest = MediumLevelILSSAInstruction
d}) -> MediumLevelILSSAInstruction -> IO (Maybe Symbol)
processDest MediumLevelILSSAInstruction
d
        (MediumLevelILCallUntyped MediumLevelILCallUntypedRec {dest :: MediumLevelILCallUntypedRec -> MediumLevelILSSAInstruction
dest = MediumLevelILSSAInstruction
d}) -> MediumLevelILSSAInstruction -> IO (Maybe Symbol)
processDest MediumLevelILSSAInstruction
d
    Tailcall Tailcall
tc ->
      case Tailcall
tc of
        (MediumLevelILTailcallUntyped MediumLevelILTailcallUntypedRec {dest :: MediumLevelILTailcallUntypedRec -> MediumLevelILSSAInstruction
dest = MediumLevelILSSAInstruction
d}) -> MediumLevelILSSAInstruction -> IO (Maybe Symbol)
processDest MediumLevelILSSAInstruction
d
        (MediumLevelILTailcall MediumLevelILTailcallRec {dest :: MediumLevelILTailcallRec -> MediumLevelILSSAInstruction
dest = MediumLevelILSSAInstruction
d}) -> MediumLevelILSSAInstruction -> IO (Maybe Symbol)
processDest MediumLevelILSSAInstruction
d
        (MediumLevelILTailcallSsa MediumLevelILTailcallSsaRec {dest :: MediumLevelILTailcallSsaRec -> MediumLevelILSSAInstruction
dest = MediumLevelILSSAInstruction
d}) -> MediumLevelILSSAInstruction -> IO (Maybe Symbol)
processDest MediumLevelILSSAInstruction
d
        (MediumLevelILTailcallUntypedSsa MediumLevelILTailcallUntypedSsaRec {dest :: MediumLevelILTailcallUntypedSsaRec -> MediumLevelILSSAInstruction
dest = MediumLevelILSSAInstruction
d}) -> MediumLevelILSSAInstruction -> IO (Maybe Symbol)
processDest MediumLevelILSSAInstruction
d
    MediumLevelILSSAInstruction
_ -> [Char] -> IO (Maybe Symbol)
forall a. HasCallStack => [Char] -> a
error ([Char] -> IO (Maybe Symbol)) -> [Char] -> IO (Maybe Symbol)
forall a b. (a -> b) -> a -> b
$ [Char]
"Binja.Mlil.extractCallDestSymbol: unhandled instruction: " [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ MediumLevelILSSAInstruction -> [Char]
forall a. Show a => a -> [Char]
show MediumLevelILSSAInstruction
callInst
  where
    processDest :: MediumLevelILSSAInstruction -> IO (Maybe Symbol)
    processDest :: MediumLevelILSSAInstruction -> IO (Maybe Symbol)
processDest MediumLevelILSSAInstruction
dest' =
      case MediumLevelILSSAInstruction
dest' of
        Constant Constant
c -> BNBinaryViewPtr -> Constant -> IO (Maybe Symbol)
constantToSymbol BNBinaryViewPtr
view Constant
c
        MediumLevelILSSAInstruction
_ -> Maybe Symbol -> IO (Maybe Symbol)
forall a. a -> IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Maybe Symbol
forall a. Maybe a
Nothing

getOp :: BNMediumLevelILInstruction -> CSize -> CSize
getOp :: BNMediumLevelILInstruction -> CSize -> CSize
getOp BNMediumLevelILInstruction
inst CSize
operand =
  Word64 -> CSize
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Word64 -> CSize) -> Word64 -> CSize
forall a b. (a -> b) -> a -> b
$ case CSize
operand of
    CSize
0 -> BNMediumLevelILInstruction -> Word64
mlOp0 BNMediumLevelILInstruction
inst
    CSize
1 -> BNMediumLevelILInstruction -> Word64
mlOp1 BNMediumLevelILInstruction
inst
    CSize
2 -> BNMediumLevelILInstruction -> Word64
mlOp2 BNMediumLevelILInstruction
inst
    CSize
3 -> BNMediumLevelILInstruction -> Word64
mlOp3 BNMediumLevelILInstruction
inst
    CSize
4 -> BNMediumLevelILInstruction -> Word64
mlOp4 BNMediumLevelILInstruction
inst
    CSize
_ -> [Char] -> Word64
forall a. HasCallStack => [Char] -> a
error ([Char] -> Word64) -> [Char] -> Word64
forall a b. (a -> b) -> a -> b
$ [Char]
"getOp: " [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ CSize -> [Char]
forall a. Show a => a -> [Char]
show CSize
operand [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
" not in [0, .., 4]"

-- | Derive a higher level mlil ssa-variant instruction given a mlil ssa function handle
--   and mlil ssa expression index.
create :: BNMlilSSAFunctionPtr -> CSize -> IO MediumLevelILSSAInstruction
create :: BNMlilSSAFunctionPtr -> CSize -> IO MediumLevelILSSAInstruction
create BNMlilSSAFunctionPtr
func CSize
exprIndex' = do
  rawInst <- BNMlilSSAFunctionPtr -> CSize -> IO BNMediumLevelILInstruction
mlilSSAByIndex BNMlilSSAFunctionPtr
func CSize
exprIndex'
  let coreInst =
        CoreMediumLevelILInstruction
          { instr :: BNMediumLevelILInstruction
instr = BNMediumLevelILInstruction
rawInst,
            ilFunc :: BNMlilSSAFunctionPtr
ilFunc = BNMlilSSAFunctionPtr
func,
            exprIndex :: CSize
exprIndex = CSize
exprIndex'
          }
  case mlOperation rawInst of
    BNMediumLevelILOperation
MLIL_NOP -> do
      MediumLevelILSSAInstruction -> IO MediumLevelILSSAInstruction
forall a. a -> IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (MediumLevelILSSAInstruction -> IO MediumLevelILSSAInstruction)
-> MediumLevelILSSAInstruction -> IO MediumLevelILSSAInstruction
forall a b. (a -> b) -> a -> b
$ MediumLevelILNopRec -> MediumLevelILSSAInstruction
MediumLevelILNop (MediumLevelILNopRec -> MediumLevelILSSAInstruction)
-> MediumLevelILNopRec -> MediumLevelILSSAInstruction
forall a b. (a -> b) -> a -> b
$ MediumLevelILNopRec {core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst}
    BNMediumLevelILOperation
MLIL_SET_VAR -> do
      dest' <- CULLong -> IO BNVariable
varFromID (CULLong -> IO BNVariable) -> CULLong -> IO BNVariable
forall a b. (a -> b) -> a -> b
$ CSize -> CULLong
forall a b. (Integral a, Num b) => a -> b
fromIntegral (CSize -> CULLong) -> CSize -> CULLong
forall a b. (a -> b) -> a -> b
$ BNMediumLevelILInstruction -> CSize -> CSize
getOp BNMediumLevelILInstruction
rawInst CSize
0
      src' <- getExpr func $ getOp rawInst 1
      let rec =
            MediumLevelILSetVarRec
              { dest :: BNVariable
dest = BNVariable
dest',
                src :: MediumLevelILSSAInstruction
src = MediumLevelILSSAInstruction
src',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ SetVar $ MediumLevelILSetVar rec
    BNMediumLevelILOperation
MLIL_SET_VAR_FIELD -> do
      dest' <- CULLong -> IO BNVariable
varFromID (CULLong -> IO BNVariable) -> CULLong -> IO BNVariable
forall a b. (a -> b) -> a -> b
$ CSize -> CULLong
forall a b. (Integral a, Num b) => a -> b
fromIntegral (CSize -> CULLong) -> CSize -> CULLong
forall a b. (a -> b) -> a -> b
$ BNMediumLevelILInstruction -> CSize -> CSize
getOp BNMediumLevelILInstruction
rawInst CSize
0
      offset' <- getInt rawInst 1
      src' <- getExpr func $ getOp rawInst 2
      let rec =
            MediumLevelILSetVarFieldRec
              { dest :: BNVariable
dest = BNVariable
dest',
                offset :: Int
offset = Int
offset',
                src :: MediumLevelILSSAInstruction
src = MediumLevelILSSAInstruction
src',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ SetVar $ MediumLevelILSetVarField rec
    BNMediumLevelILOperation
MLIL_SET_VAR_SPLIT -> do
      high' <- CULLong -> IO BNVariable
varFromID (CULLong -> IO BNVariable) -> CULLong -> IO BNVariable
forall a b. (a -> b) -> a -> b
$ CSize -> CULLong
forall a b. (Integral a, Num b) => a -> b
fromIntegral (CSize -> CULLong) -> CSize -> CULLong
forall a b. (a -> b) -> a -> b
$ BNMediumLevelILInstruction -> CSize -> CSize
getOp BNMediumLevelILInstruction
rawInst CSize
0
      low' <- varFromID $ fromIntegral $ getOp rawInst 1
      src' <- getExpr func $ getOp rawInst 2
      let rec =
            MediumLevelILSetVarSplitRec
              { high :: BNVariable
high = BNVariable
high',
                low :: BNVariable
low = BNVariable
low',
                src :: MediumLevelILSSAInstruction
src = MediumLevelILSSAInstruction
src',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ SetVar $ MediumLevelILSetVarSplit rec
    BNMediumLevelILOperation
MLIL_ASSERT -> do
      src' <- CULLong -> IO BNVariable
varFromID (CULLong -> IO BNVariable) -> CULLong -> IO BNVariable
forall a b. (a -> b) -> a -> b
$ CSize -> CULLong
forall a b. (Integral a, Num b) => a -> b
fromIntegral (CSize -> CULLong) -> CSize -> CULLong
forall a b. (a -> b) -> a -> b
$ BNMediumLevelILInstruction -> CSize -> CSize
getOp BNMediumLevelILInstruction
rawInst CSize
0
      constraint' <- getConstraint func rawInst 1
      let rec =
            MediumLevelILAssertRec
              { src :: BNVariable
src = BNVariable
src',
                constraint :: BNPossibleValueSet
constraint = BNPossibleValueSet
constraint',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ MediumLevelILAssert rec
    BNMediumLevelILOperation
MLIL_FORCE_VER -> do
      dest' <- CULLong -> IO BNVariable
varFromID (CULLong -> IO BNVariable) -> CULLong -> IO BNVariable
forall a b. (a -> b) -> a -> b
$ CSize -> CULLong
forall a b. (Integral a, Num b) => a -> b
fromIntegral (CSize -> CULLong) -> CSize -> CULLong
forall a b. (a -> b) -> a -> b
$ BNMediumLevelILInstruction -> CSize -> CSize
getOp BNMediumLevelILInstruction
rawInst CSize
0
      src' <- varFromID $ fromIntegral $ getOp rawInst 1
      let rec =
            MediumLevelILForceVerRec
              { dest :: BNVariable
dest = BNVariable
dest',
                src :: BNVariable
src = BNVariable
src',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ MediumLevelILForceVer rec
    BNMediumLevelILOperation
MLIL_LOAD -> do
      src' <- BNMlilSSAFunctionPtr -> CSize -> IO MediumLevelILSSAInstruction
getExpr BNMlilSSAFunctionPtr
func (CSize -> IO MediumLevelILSSAInstruction)
-> CSize -> IO MediumLevelILSSAInstruction
forall a b. (a -> b) -> a -> b
$ BNMediumLevelILInstruction -> CSize -> CSize
getOp BNMediumLevelILInstruction
rawInst CSize
0
      let rec =
            MediumLevelILLoadRec
              { src :: MediumLevelILSSAInstruction
src = MediumLevelILSSAInstruction
src',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ Load $ MediumLevelILLoad rec
    BNMediumLevelILOperation
MLIL_LOAD_STRUCT -> do
      src' <- BNMlilSSAFunctionPtr -> CSize -> IO MediumLevelILSSAInstruction
getExpr BNMlilSSAFunctionPtr
func (CSize -> IO MediumLevelILSSAInstruction)
-> CSize -> IO MediumLevelILSSAInstruction
forall a b. (a -> b) -> a -> b
$ BNMediumLevelILInstruction -> CSize -> CSize
getOp BNMediumLevelILInstruction
rawInst CSize
0
      offset' <- getInt rawInst 1
      let rec =
            MediumLevelILLoadStructRec
              { src :: MediumLevelILSSAInstruction
src = MediumLevelILSSAInstruction
src',
                offset :: Int
offset = Int
offset',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ Load $ MediumLevelILLoadStruct rec
    BNMediumLevelILOperation
MLIL_STORE -> do
      src' <- BNMlilSSAFunctionPtr -> CSize -> IO MediumLevelILSSAInstruction
getExpr BNMlilSSAFunctionPtr
func (CSize -> IO MediumLevelILSSAInstruction)
-> CSize -> IO MediumLevelILSSAInstruction
forall a b. (a -> b) -> a -> b
$ BNMediumLevelILInstruction -> CSize -> CSize
getOp BNMediumLevelILInstruction
rawInst CSize
0
      dest' <- getExpr func $ getOp rawInst 1
      let rec =
            MediumLevelILStoreRec
              { src :: MediumLevelILSSAInstruction
src = MediumLevelILSSAInstruction
src',
                dest :: MediumLevelILSSAInstruction
dest = MediumLevelILSSAInstruction
dest',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ Store $ MediumLevelILStore rec
    BNMediumLevelILOperation
MLIL_STORE_STRUCT -> do
      src' <- BNMlilSSAFunctionPtr -> CSize -> IO MediumLevelILSSAInstruction
getExpr BNMlilSSAFunctionPtr
func (CSize -> IO MediumLevelILSSAInstruction)
-> CSize -> IO MediumLevelILSSAInstruction
forall a b. (a -> b) -> a -> b
$ BNMediumLevelILInstruction -> CSize -> CSize
getOp BNMediumLevelILInstruction
rawInst CSize
0
      offset' <- getInt rawInst 1
      dest' <- getExpr func $ getOp rawInst 2
      let rec =
            MediumLevelILStoreStructRec
              { src :: MediumLevelILSSAInstruction
src = MediumLevelILSSAInstruction
src',
                offset :: Int
offset = Int
offset',
                dest :: MediumLevelILSSAInstruction
dest = MediumLevelILSSAInstruction
dest',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ Store $ MediumLevelILStoreStruct rec
    BNMediumLevelILOperation
MLIL_VAR -> do
      src' <- CULLong -> IO BNVariable
varFromID (CULLong -> IO BNVariable) -> CULLong -> IO BNVariable
forall a b. (a -> b) -> a -> b
$ CSize -> CULLong
forall a b. (Integral a, Num b) => a -> b
fromIntegral (CSize -> CULLong) -> CSize -> CULLong
forall a b. (a -> b) -> a -> b
$ BNMediumLevelILInstruction -> CSize -> CSize
getOp BNMediumLevelILInstruction
rawInst CSize
0
      let rec =
            MediumLevelILVarRec
              { src :: BNVariable
src = BNVariable
src',
                var :: BNVariable
var = BNVariable
src',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ VariableInstruction $ MediumLevelILVar rec
    BNMediumLevelILOperation
MLIL_VAR_FIELD -> do
      src' <- CULLong -> IO BNVariable
varFromID (CULLong -> IO BNVariable) -> CULLong -> IO BNVariable
forall a b. (a -> b) -> a -> b
$ CSize -> CULLong
forall a b. (Integral a, Num b) => a -> b
fromIntegral (CSize -> CULLong) -> CSize -> CULLong
forall a b. (a -> b) -> a -> b
$ BNMediumLevelILInstruction -> CSize -> CSize
getOp BNMediumLevelILInstruction
rawInst CSize
0
      offset' <- getInt rawInst 1
      let rec =
            MediumLevelILVarFieldRec
              { src :: BNVariable
src = BNVariable
src',
                offset :: Int
offset = Int
offset',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ MediumLevelILVarField rec
    BNMediumLevelILOperation
MLIL_VAR_SPLIT -> do
      high' <- CULLong -> IO BNVariable
varFromID (CULLong -> IO BNVariable) -> CULLong -> IO BNVariable
forall a b. (a -> b) -> a -> b
$ CSize -> CULLong
forall a b. (Integral a, Num b) => a -> b
fromIntegral (CSize -> CULLong) -> CSize -> CULLong
forall a b. (a -> b) -> a -> b
$ BNMediumLevelILInstruction -> CSize -> CSize
getOp BNMediumLevelILInstruction
rawInst CSize
0
      low' <- varFromID $ fromIntegral $ getOp rawInst 1
      let rec =
            MediumLevelILVarSplitRec
              { high :: BNVariable
high = BNVariable
high',
                low :: BNVariable
low = BNVariable
low',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ MediumLevelILVarSplit rec
    BNMediumLevelILOperation
MLIL_ADDRESS_OF -> do
      src' <- CULLong -> IO BNVariable
varFromID (CULLong -> IO BNVariable) -> CULLong -> IO BNVariable
forall a b. (a -> b) -> a -> b
$ CSize -> CULLong
forall a b. (Integral a, Num b) => a -> b
fromIntegral (CSize -> CULLong) -> CSize -> CULLong
forall a b. (a -> b) -> a -> b
$ BNMediumLevelILInstruction -> CSize -> CSize
getOp BNMediumLevelILInstruction
rawInst CSize
0
      let rec =
            MediumLevelILAddressOfRec
              { src :: BNVariable
src = BNVariable
src',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ MediumLevelILAddressOf rec
    BNMediumLevelILOperation
MLIL_ADDRESS_OF_FIELD -> do
      src' <- CULLong -> IO BNVariable
varFromID (CULLong -> IO BNVariable) -> CULLong -> IO BNVariable
forall a b. (a -> b) -> a -> b
$ CSize -> CULLong
forall a b. (Integral a, Num b) => a -> b
fromIntegral (CSize -> CULLong) -> CSize -> CULLong
forall a b. (a -> b) -> a -> b
$ BNMediumLevelILInstruction -> CSize -> CSize
getOp BNMediumLevelILInstruction
rawInst CSize
0
      offset' <- getInt rawInst 1
      let rec =
            MediumLevelILAddressOfFieldRec
              { src :: BNVariable
src = BNVariable
src',
                offset :: Int
offset = Int
offset',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ MediumLevelILAddressOfField rec
    BNMediumLevelILOperation
MLIL_CONST -> do
      constant' <- BNMediumLevelILInstruction -> CSize -> IO Int
getInt BNMediumLevelILInstruction
rawInst CSize
0
      let rec =
            MediumLevelILConstRec
              { constant :: Int
constant = Int
constant',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ Constant $ MediumLevelILConst rec
    BNMediumLevelILOperation
MLIL_CONST_DATA -> do
      rawFunc <- BNMlilSSAFunctionPtr -> IO BNFunctionPtr
mlilToRawFunction BNMlilSSAFunctionPtr
func
      constant' <- getConstantData rawFunc rawInst 0 1
      let rec =
            MediumLevelILConstDataRec
              { constant :: BNDataBufferPtr
constant = BNDataBufferPtr
constant',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ Constant $ MediumLevelILConstData rec
    BNMediumLevelILOperation
MLIL_CONST_PTR -> do
      constant' <- BNMediumLevelILInstruction -> CSize -> IO Int
getInt BNMediumLevelILInstruction
rawInst CSize
0
      let rec =
            MediumLevelILConstPtrRec
              { constant :: Int
constant = Int
constant',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ Constant $ MediumLevelILConstPtr rec
    BNMediumLevelILOperation
MLIL_EXTERN_PTR -> do
      constant' <- BNMediumLevelILInstruction -> CSize -> IO Int
getInt BNMediumLevelILInstruction
rawInst CSize
0
      offset' <- getInt rawInst 1
      let rec =
            MediumLevelILExternPtrRec
              { constant :: Int
constant = Int
constant',
                offset :: Int
offset = Int
offset',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ Constant $ MediumLevelILExternPtr rec
    BNMediumLevelILOperation
MLIL_FLOAT_CONST -> do
      constant' <- BNMediumLevelILInstruction -> CSize -> IO Double
getFloat BNMediumLevelILInstruction
rawInst CSize
0
      let rec =
            MediumLevelILFloatConstRec
              { constant :: Double
constant = Double
constant',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ Constant $ MediumLevelILFloatConst rec
    BNMediumLevelILOperation
MLIL_IMPORT -> do
      constant' <- BNMediumLevelILInstruction -> CSize -> IO Int
getInt BNMediumLevelILInstruction
rawInst CSize
0
      let rec =
            MediumLevelILImportRec
              { constant :: Int
constant = Int
constant',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ Constant $ MediumLevelILImport rec
    BNMediumLevelILOperation
MLIL_ADD -> do
      left' <- BNMlilSSAFunctionPtr -> CSize -> IO MediumLevelILSSAInstruction
getExpr BNMlilSSAFunctionPtr
func (CSize -> IO MediumLevelILSSAInstruction)
-> CSize -> IO MediumLevelILSSAInstruction
forall a b. (a -> b) -> a -> b
$ BNMediumLevelILInstruction -> CSize -> CSize
getOp BNMediumLevelILInstruction
rawInst CSize
0
      right' <- getExpr func $ getOp rawInst 1
      let rec =
            MediumLevelILAddRec
              { left :: MediumLevelILSSAInstruction
left = MediumLevelILSSAInstruction
left',
                right :: MediumLevelILSSAInstruction
right = MediumLevelILSSAInstruction
right',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ Arithmetic $ MediumLevelILAdd rec
    BNMediumLevelILOperation
MLIL_ADC -> do
      left' <- BNMlilSSAFunctionPtr -> CSize -> IO MediumLevelILSSAInstruction
getExpr BNMlilSSAFunctionPtr
func (CSize -> IO MediumLevelILSSAInstruction)
-> CSize -> IO MediumLevelILSSAInstruction
forall a b. (a -> b) -> a -> b
$ BNMediumLevelILInstruction -> CSize -> CSize
getOp BNMediumLevelILInstruction
rawInst CSize
0
      right' <- getExpr func $ getOp rawInst 1
      carry' <- getExpr func $ getOp rawInst 2
      let rec =
            MediumLevelILAdcRec
              { left :: MediumLevelILSSAInstruction
left = MediumLevelILSSAInstruction
left',
                right :: MediumLevelILSSAInstruction
right = MediumLevelILSSAInstruction
right',
                carry :: MediumLevelILSSAInstruction
carry = MediumLevelILSSAInstruction
carry',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ Carry $ MediumLevelILAdc rec
    BNMediumLevelILOperation
MLIL_SUB -> do
      left' <- BNMlilSSAFunctionPtr -> CSize -> IO MediumLevelILSSAInstruction
getExpr BNMlilSSAFunctionPtr
func (CSize -> IO MediumLevelILSSAInstruction)
-> CSize -> IO MediumLevelILSSAInstruction
forall a b. (a -> b) -> a -> b
$ BNMediumLevelILInstruction -> CSize -> CSize
getOp BNMediumLevelILInstruction
rawInst CSize
0
      right' <- getExpr func $ getOp rawInst 1
      let rec =
            MediumLevelILSubRec
              { left :: MediumLevelILSSAInstruction
left = MediumLevelILSSAInstruction
left',
                right :: MediumLevelILSSAInstruction
right = MediumLevelILSSAInstruction
right',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ Arithmetic $ MediumLevelILSub rec
    BNMediumLevelILOperation
MLIL_SBB -> do
      left' <- BNMlilSSAFunctionPtr -> CSize -> IO MediumLevelILSSAInstruction
getExpr BNMlilSSAFunctionPtr
func (CSize -> IO MediumLevelILSSAInstruction)
-> CSize -> IO MediumLevelILSSAInstruction
forall a b. (a -> b) -> a -> b
$ BNMediumLevelILInstruction -> CSize -> CSize
getOp BNMediumLevelILInstruction
rawInst CSize
0
      right' <- getExpr func $ getOp rawInst 1
      carry' <- getExpr func $ getOp rawInst 2
      let rec =
            MediumLevelILSbbRec
              { left :: MediumLevelILSSAInstruction
left = MediumLevelILSSAInstruction
left',
                right :: MediumLevelILSSAInstruction
right = MediumLevelILSSAInstruction
right',
                carry :: MediumLevelILSSAInstruction
carry = MediumLevelILSSAInstruction
carry',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ Carry $ MediumLevelILSbb rec
    BNMediumLevelILOperation
MLIL_AND -> do
      left' <- BNMlilSSAFunctionPtr -> CSize -> IO MediumLevelILSSAInstruction
getExpr BNMlilSSAFunctionPtr
func (CSize -> IO MediumLevelILSSAInstruction)
-> CSize -> IO MediumLevelILSSAInstruction
forall a b. (a -> b) -> a -> b
$ BNMediumLevelILInstruction -> CSize -> CSize
getOp BNMediumLevelILInstruction
rawInst CSize
0
      right' <- getExpr func $ getOp rawInst 1
      let rec =
            MediumLevelILAndRec
              { left :: MediumLevelILSSAInstruction
left = MediumLevelILSSAInstruction
left',
                right :: MediumLevelILSSAInstruction
right = MediumLevelILSSAInstruction
right',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ Arithmetic $ MediumLevelILAnd rec
    BNMediumLevelILOperation
MLIL_OR -> do
      left' <- BNMlilSSAFunctionPtr -> CSize -> IO MediumLevelILSSAInstruction
getExpr BNMlilSSAFunctionPtr
func (CSize -> IO MediumLevelILSSAInstruction)
-> CSize -> IO MediumLevelILSSAInstruction
forall a b. (a -> b) -> a -> b
$ BNMediumLevelILInstruction -> CSize -> CSize
getOp BNMediumLevelILInstruction
rawInst CSize
0
      right' <- getExpr func $ getOp rawInst 1
      let rec =
            MediumLevelILOrRec
              { left :: MediumLevelILSSAInstruction
left = MediumLevelILSSAInstruction
left',
                right :: MediumLevelILSSAInstruction
right = MediumLevelILSSAInstruction
right',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ Arithmetic $ MediumLevelILOr rec
    BNMediumLevelILOperation
MLIL_XOR -> do
      left' <- BNMlilSSAFunctionPtr -> CSize -> IO MediumLevelILSSAInstruction
getExpr BNMlilSSAFunctionPtr
func (CSize -> IO MediumLevelILSSAInstruction)
-> CSize -> IO MediumLevelILSSAInstruction
forall a b. (a -> b) -> a -> b
$ BNMediumLevelILInstruction -> CSize -> CSize
getOp BNMediumLevelILInstruction
rawInst CSize
0
      right' <- getExpr func $ getOp rawInst 1
      let rec =
            MediumLevelILXorRec
              { left :: MediumLevelILSSAInstruction
left = MediumLevelILSSAInstruction
left',
                right :: MediumLevelILSSAInstruction
right = MediumLevelILSSAInstruction
right',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ Arithmetic $ MediumLevelILXor rec
    BNMediumLevelILOperation
MLIL_LSL -> do
      left' <- BNMlilSSAFunctionPtr -> CSize -> IO MediumLevelILSSAInstruction
getExpr BNMlilSSAFunctionPtr
func (CSize -> IO MediumLevelILSSAInstruction)
-> CSize -> IO MediumLevelILSSAInstruction
forall a b. (a -> b) -> a -> b
$ BNMediumLevelILInstruction -> CSize -> CSize
getOp BNMediumLevelILInstruction
rawInst CSize
0
      right' <- getExpr func $ getOp rawInst 1
      let rec =
            MediumLevelILLslRec
              { left :: MediumLevelILSSAInstruction
left = MediumLevelILSSAInstruction
left',
                right :: MediumLevelILSSAInstruction
right = MediumLevelILSSAInstruction
right',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ Arithmetic $ MediumLevelILLsl rec
    BNMediumLevelILOperation
MLIL_LSR -> do
      left' <- BNMlilSSAFunctionPtr -> CSize -> IO MediumLevelILSSAInstruction
getExpr BNMlilSSAFunctionPtr
func (CSize -> IO MediumLevelILSSAInstruction)
-> CSize -> IO MediumLevelILSSAInstruction
forall a b. (a -> b) -> a -> b
$ BNMediumLevelILInstruction -> CSize -> CSize
getOp BNMediumLevelILInstruction
rawInst CSize
0
      right' <- getExpr func $ getOp rawInst 1
      let rec =
            MediumLevelILLsrRec
              { left :: MediumLevelILSSAInstruction
left = MediumLevelILSSAInstruction
left',
                right :: MediumLevelILSSAInstruction
right = MediumLevelILSSAInstruction
right',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ Arithmetic $ MediumLevelILLsr rec
    BNMediumLevelILOperation
MLIL_ASR -> do
      left' <- BNMlilSSAFunctionPtr -> CSize -> IO MediumLevelILSSAInstruction
getExpr BNMlilSSAFunctionPtr
func (CSize -> IO MediumLevelILSSAInstruction)
-> CSize -> IO MediumLevelILSSAInstruction
forall a b. (a -> b) -> a -> b
$ BNMediumLevelILInstruction -> CSize -> CSize
getOp BNMediumLevelILInstruction
rawInst CSize
0
      right' <- getExpr func $ getOp rawInst 1
      let rec =
            MediumLevelILAsrRec
              { left :: MediumLevelILSSAInstruction
left = MediumLevelILSSAInstruction
left',
                right :: MediumLevelILSSAInstruction
right = MediumLevelILSSAInstruction
right',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ Arithmetic $ MediumLevelILAsr rec
    BNMediumLevelILOperation
MLIL_ROL -> do
      left' <- BNMlilSSAFunctionPtr -> CSize -> IO MediumLevelILSSAInstruction
getExpr BNMlilSSAFunctionPtr
func (CSize -> IO MediumLevelILSSAInstruction)
-> CSize -> IO MediumLevelILSSAInstruction
forall a b. (a -> b) -> a -> b
$ BNMediumLevelILInstruction -> CSize -> CSize
getOp BNMediumLevelILInstruction
rawInst CSize
0
      right' <- getExpr func $ getOp rawInst 1
      let rec =
            MediumLevelILRolRec
              { left :: MediumLevelILSSAInstruction
left = MediumLevelILSSAInstruction
left',
                right :: MediumLevelILSSAInstruction
right = MediumLevelILSSAInstruction
right',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ Arithmetic $ MediumLevelILRol rec
    BNMediumLevelILOperation
MLIL_RLC -> do
      left' <- BNMlilSSAFunctionPtr -> CSize -> IO MediumLevelILSSAInstruction
getExpr BNMlilSSAFunctionPtr
func (CSize -> IO MediumLevelILSSAInstruction)
-> CSize -> IO MediumLevelILSSAInstruction
forall a b. (a -> b) -> a -> b
$ BNMediumLevelILInstruction -> CSize -> CSize
getOp BNMediumLevelILInstruction
rawInst CSize
0
      right' <- getExpr func $ getOp rawInst 1
      carry' <- getExpr func $ getOp rawInst 2
      let rec =
            MediumLevelILRlcRec
              { left :: MediumLevelILSSAInstruction
left = MediumLevelILSSAInstruction
left',
                right :: MediumLevelILSSAInstruction
right = MediumLevelILSSAInstruction
right',
                carry :: MediumLevelILSSAInstruction
carry = MediumLevelILSSAInstruction
carry',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ Carry $ MediumLevelILRlc rec
    BNMediumLevelILOperation
MLIL_ROR -> do
      left' <- BNMlilSSAFunctionPtr -> CSize -> IO MediumLevelILSSAInstruction
getExpr BNMlilSSAFunctionPtr
func (CSize -> IO MediumLevelILSSAInstruction)
-> CSize -> IO MediumLevelILSSAInstruction
forall a b. (a -> b) -> a -> b
$ BNMediumLevelILInstruction -> CSize -> CSize
getOp BNMediumLevelILInstruction
rawInst CSize
0
      right' <- getExpr func $ getOp rawInst 1
      let rec =
            MediumLevelILRorRec
              { left :: MediumLevelILSSAInstruction
left = MediumLevelILSSAInstruction
left',
                right :: MediumLevelILSSAInstruction
right = MediumLevelILSSAInstruction
right',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ Arithmetic $ MediumLevelILRor rec
    BNMediumLevelILOperation
MLIL_RRC -> do
      left' <- BNMlilSSAFunctionPtr -> CSize -> IO MediumLevelILSSAInstruction
getExpr BNMlilSSAFunctionPtr
func (CSize -> IO MediumLevelILSSAInstruction)
-> CSize -> IO MediumLevelILSSAInstruction
forall a b. (a -> b) -> a -> b
$ BNMediumLevelILInstruction -> CSize -> CSize
getOp BNMediumLevelILInstruction
rawInst CSize
0
      right' <- getExpr func $ getOp rawInst 1
      carry' <- getExpr func $ getOp rawInst 2
      let rec =
            MediumLevelILRrcRec
              { left :: MediumLevelILSSAInstruction
left = MediumLevelILSSAInstruction
left',
                right :: MediumLevelILSSAInstruction
right = MediumLevelILSSAInstruction
right',
                carry :: MediumLevelILSSAInstruction
carry = MediumLevelILSSAInstruction
carry',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ Carry $ MediumLevelILRrc rec
    BNMediumLevelILOperation
MLIL_MUL -> do
      left' <- BNMlilSSAFunctionPtr -> CSize -> IO MediumLevelILSSAInstruction
getExpr BNMlilSSAFunctionPtr
func (CSize -> IO MediumLevelILSSAInstruction)
-> CSize -> IO MediumLevelILSSAInstruction
forall a b. (a -> b) -> a -> b
$ BNMediumLevelILInstruction -> CSize -> CSize
getOp BNMediumLevelILInstruction
rawInst CSize
0
      right' <- getExpr func $ getOp rawInst 1
      let rec =
            MediumLevelILMulRec
              { left :: MediumLevelILSSAInstruction
left = MediumLevelILSSAInstruction
left',
                right :: MediumLevelILSSAInstruction
right = MediumLevelILSSAInstruction
right',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ Arithmetic $ MediumLevelILMul rec
    BNMediumLevelILOperation
MLIL_MULU_DP -> do
      left' <- BNMlilSSAFunctionPtr -> CSize -> IO MediumLevelILSSAInstruction
getExpr BNMlilSSAFunctionPtr
func (CSize -> IO MediumLevelILSSAInstruction)
-> CSize -> IO MediumLevelILSSAInstruction
forall a b. (a -> b) -> a -> b
$ BNMediumLevelILInstruction -> CSize -> CSize
getOp BNMediumLevelILInstruction
rawInst CSize
0
      right' <- getExpr func $ getOp rawInst 1
      let rec =
            MediumLevelILMuluDpRec
              { left :: MediumLevelILSSAInstruction
left = MediumLevelILSSAInstruction
left',
                right :: MediumLevelILSSAInstruction
right = MediumLevelILSSAInstruction
right',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ MediumLevelILMuluDp rec
    BNMediumLevelILOperation
MLIL_MULS_DP -> do
      left' <- BNMlilSSAFunctionPtr -> CSize -> IO MediumLevelILSSAInstruction
getExpr BNMlilSSAFunctionPtr
func (CSize -> IO MediumLevelILSSAInstruction)
-> CSize -> IO MediumLevelILSSAInstruction
forall a b. (a -> b) -> a -> b
$ BNMediumLevelILInstruction -> CSize -> CSize
getOp BNMediumLevelILInstruction
rawInst CSize
0
      right' <- getExpr func $ getOp rawInst 1
      let rec =
            MediumLevelILMulsDpRec
              { left :: MediumLevelILSSAInstruction
left = MediumLevelILSSAInstruction
left',
                right :: MediumLevelILSSAInstruction
right = MediumLevelILSSAInstruction
right',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ MediumLevelILMulsDp rec
    BNMediumLevelILOperation
MLIL_DIVU -> do
      left' <- BNMlilSSAFunctionPtr -> CSize -> IO MediumLevelILSSAInstruction
getExpr BNMlilSSAFunctionPtr
func (CSize -> IO MediumLevelILSSAInstruction)
-> CSize -> IO MediumLevelILSSAInstruction
forall a b. (a -> b) -> a -> b
$ BNMediumLevelILInstruction -> CSize -> CSize
getOp BNMediumLevelILInstruction
rawInst CSize
0
      right' <- getExpr func $ getOp rawInst 1
      let rec =
            MediumLevelILDivuRec
              { left :: MediumLevelILSSAInstruction
left = MediumLevelILSSAInstruction
left',
                right :: MediumLevelILSSAInstruction
right = MediumLevelILSSAInstruction
right',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ Arithmetic $ MediumLevelILDivu rec
    BNMediumLevelILOperation
MLIL_DIVU_DP -> do
      left' <- BNMlilSSAFunctionPtr -> CSize -> IO MediumLevelILSSAInstruction
getExpr BNMlilSSAFunctionPtr
func (CSize -> IO MediumLevelILSSAInstruction)
-> CSize -> IO MediumLevelILSSAInstruction
forall a b. (a -> b) -> a -> b
$ BNMediumLevelILInstruction -> CSize -> CSize
getOp BNMediumLevelILInstruction
rawInst CSize
0
      right' <- getExpr func $ getOp rawInst 1
      let rec =
            MediumLevelILDivuDpRec
              { left :: MediumLevelILSSAInstruction
left = MediumLevelILSSAInstruction
left',
                right :: MediumLevelILSSAInstruction
right = MediumLevelILSSAInstruction
right',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ MediumLevelILDivuDp rec
    BNMediumLevelILOperation
MLIL_DIVS -> do
      left' <- BNMlilSSAFunctionPtr -> CSize -> IO MediumLevelILSSAInstruction
getExpr BNMlilSSAFunctionPtr
func (CSize -> IO MediumLevelILSSAInstruction)
-> CSize -> IO MediumLevelILSSAInstruction
forall a b. (a -> b) -> a -> b
$ BNMediumLevelILInstruction -> CSize -> CSize
getOp BNMediumLevelILInstruction
rawInst CSize
0
      right' <- getExpr func $ getOp rawInst 1
      let rec =
            MediumLevelILDivsRec
              { left :: MediumLevelILSSAInstruction
left = MediumLevelILSSAInstruction
left',
                right :: MediumLevelILSSAInstruction
right = MediumLevelILSSAInstruction
right',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ Arithmetic $ MediumLevelILDivs rec
    BNMediumLevelILOperation
MLIL_DIVS_DP -> do
      left' <- BNMlilSSAFunctionPtr -> CSize -> IO MediumLevelILSSAInstruction
getExpr BNMlilSSAFunctionPtr
func (CSize -> IO MediumLevelILSSAInstruction)
-> CSize -> IO MediumLevelILSSAInstruction
forall a b. (a -> b) -> a -> b
$ BNMediumLevelILInstruction -> CSize -> CSize
getOp BNMediumLevelILInstruction
rawInst CSize
0
      right' <- getExpr func $ getOp rawInst 1
      let rec =
            MediumLevelILDivsDpRec
              { left :: MediumLevelILSSAInstruction
left = MediumLevelILSSAInstruction
left',
                right :: MediumLevelILSSAInstruction
right = MediumLevelILSSAInstruction
right',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ MediumLevelILDivsDp rec
    BNMediumLevelILOperation
MLIL_MODU -> do
      left' <- BNMlilSSAFunctionPtr -> CSize -> IO MediumLevelILSSAInstruction
getExpr BNMlilSSAFunctionPtr
func (CSize -> IO MediumLevelILSSAInstruction)
-> CSize -> IO MediumLevelILSSAInstruction
forall a b. (a -> b) -> a -> b
$ BNMediumLevelILInstruction -> CSize -> CSize
getOp BNMediumLevelILInstruction
rawInst CSize
0
      right' <- getExpr func $ getOp rawInst 1
      let rec =
            MediumLevelILModuRec
              { left :: MediumLevelILSSAInstruction
left = MediumLevelILSSAInstruction
left',
                right :: MediumLevelILSSAInstruction
right = MediumLevelILSSAInstruction
right',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ Arithmetic $ MediumLevelILModu rec
    BNMediumLevelILOperation
MLIL_MODU_DP -> do
      left' <- BNMlilSSAFunctionPtr -> CSize -> IO MediumLevelILSSAInstruction
getExpr BNMlilSSAFunctionPtr
func (CSize -> IO MediumLevelILSSAInstruction)
-> CSize -> IO MediumLevelILSSAInstruction
forall a b. (a -> b) -> a -> b
$ BNMediumLevelILInstruction -> CSize -> CSize
getOp BNMediumLevelILInstruction
rawInst CSize
0
      right' <- getExpr func $ getOp rawInst 1
      let rec =
            MediumLevelILModuDpRec
              { left :: MediumLevelILSSAInstruction
left = MediumLevelILSSAInstruction
left',
                right :: MediumLevelILSSAInstruction
right = MediumLevelILSSAInstruction
right',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ MediumLevelILModuDp rec
    BNMediumLevelILOperation
MLIL_MODS -> do
      left' <- BNMlilSSAFunctionPtr -> CSize -> IO MediumLevelILSSAInstruction
getExpr BNMlilSSAFunctionPtr
func (CSize -> IO MediumLevelILSSAInstruction)
-> CSize -> IO MediumLevelILSSAInstruction
forall a b. (a -> b) -> a -> b
$ BNMediumLevelILInstruction -> CSize -> CSize
getOp BNMediumLevelILInstruction
rawInst CSize
0
      right' <- getExpr func $ getOp rawInst 1
      let rec =
            MediumLevelILModsRec
              { left :: MediumLevelILSSAInstruction
left = MediumLevelILSSAInstruction
left',
                right :: MediumLevelILSSAInstruction
right = MediumLevelILSSAInstruction
right',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ Arithmetic $ MediumLevelILMods rec
    BNMediumLevelILOperation
MLIL_MODS_DP -> do
      left' <- BNMlilSSAFunctionPtr -> CSize -> IO MediumLevelILSSAInstruction
getExpr BNMlilSSAFunctionPtr
func (CSize -> IO MediumLevelILSSAInstruction)
-> CSize -> IO MediumLevelILSSAInstruction
forall a b. (a -> b) -> a -> b
$ BNMediumLevelILInstruction -> CSize -> CSize
getOp BNMediumLevelILInstruction
rawInst CSize
0
      right' <- getExpr func $ getOp rawInst 1
      let rec =
            MediumLevelILModsDpRec
              { left :: MediumLevelILSSAInstruction
left = MediumLevelILSSAInstruction
left',
                right :: MediumLevelILSSAInstruction
right = MediumLevelILSSAInstruction
right',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ MediumLevelILModsDp rec
    BNMediumLevelILOperation
MLIL_NEG -> do
      src' <- BNMlilSSAFunctionPtr -> CSize -> IO MediumLevelILSSAInstruction
getExpr BNMlilSSAFunctionPtr
func (CSize -> IO MediumLevelILSSAInstruction)
-> CSize -> IO MediumLevelILSSAInstruction
forall a b. (a -> b) -> a -> b
$ BNMediumLevelILInstruction -> CSize -> CSize
getOp BNMediumLevelILInstruction
rawInst CSize
0
      let rec =
            MediumLevelILNegRec
              { src :: MediumLevelILSSAInstruction
src = MediumLevelILSSAInstruction
src',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ Arithmetic $ MediumLevelILNeg rec
    BNMediumLevelILOperation
MLIL_NOT -> do
      src' <- BNMlilSSAFunctionPtr -> CSize -> IO MediumLevelILSSAInstruction
getExpr BNMlilSSAFunctionPtr
func (CSize -> IO MediumLevelILSSAInstruction)
-> CSize -> IO MediumLevelILSSAInstruction
forall a b. (a -> b) -> a -> b
$ BNMediumLevelILInstruction -> CSize -> CSize
getOp BNMediumLevelILInstruction
rawInst CSize
0
      let rec =
            MediumLevelILNotRec
              { src :: MediumLevelILSSAInstruction
src = MediumLevelILSSAInstruction
src',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ Arithmetic $ MediumLevelILNot rec
    BNMediumLevelILOperation
MLIL_SX -> do
      src' <- BNMlilSSAFunctionPtr -> CSize -> IO MediumLevelILSSAInstruction
getExpr BNMlilSSAFunctionPtr
func (CSize -> IO MediumLevelILSSAInstruction)
-> CSize -> IO MediumLevelILSSAInstruction
forall a b. (a -> b) -> a -> b
$ BNMediumLevelILInstruction -> CSize -> CSize
getOp BNMediumLevelILInstruction
rawInst CSize
0
      let rec =
            MediumLevelILSxRec
              { src :: MediumLevelILSSAInstruction
src = MediumLevelILSSAInstruction
src',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ Arithmetic $ MediumLevelILSx rec
    BNMediumLevelILOperation
MLIL_ZX -> do
      src' <- BNMlilSSAFunctionPtr -> CSize -> IO MediumLevelILSSAInstruction
getExpr BNMlilSSAFunctionPtr
func (CSize -> IO MediumLevelILSSAInstruction)
-> CSize -> IO MediumLevelILSSAInstruction
forall a b. (a -> b) -> a -> b
$ BNMediumLevelILInstruction -> CSize -> CSize
getOp BNMediumLevelILInstruction
rawInst CSize
0
      let rec =
            MediumLevelILZxRec
              { src :: MediumLevelILSSAInstruction
src = MediumLevelILSSAInstruction
src',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ Arithmetic $ MediumLevelILZx rec
    BNMediumLevelILOperation
MLIL_LOW_PART -> do
      src' <- BNMlilSSAFunctionPtr -> CSize -> IO MediumLevelILSSAInstruction
getExpr BNMlilSSAFunctionPtr
func (CSize -> IO MediumLevelILSSAInstruction)
-> CSize -> IO MediumLevelILSSAInstruction
forall a b. (a -> b) -> a -> b
$ BNMediumLevelILInstruction -> CSize -> CSize
getOp BNMediumLevelILInstruction
rawInst CSize
0
      let rec =
            MediumLevelILLowPartRec
              { src :: MediumLevelILSSAInstruction
src = MediumLevelILSSAInstruction
src',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ Arithmetic $ MediumLevelILLowPart rec
    BNMediumLevelILOperation
MLIL_JUMP -> do
      dest' <- BNMlilSSAFunctionPtr -> CSize -> IO MediumLevelILSSAInstruction
getExpr BNMlilSSAFunctionPtr
func (CSize -> IO MediumLevelILSSAInstruction)
-> CSize -> IO MediumLevelILSSAInstruction
forall a b. (a -> b) -> a -> b
$ BNMediumLevelILInstruction -> CSize -> CSize
getOp BNMediumLevelILInstruction
rawInst CSize
1
      let rec =
            MediumLevelILJumpRec
              { dest :: MediumLevelILSSAInstruction
dest = MediumLevelILSSAInstruction
dest',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ Terminal $ MediumLevelILJump rec
    BNMediumLevelILOperation
MLIL_JUMP_TO -> do
      dest' <- BNMlilSSAFunctionPtr -> CSize -> IO MediumLevelILSSAInstruction
getExpr BNMlilSSAFunctionPtr
func (CSize -> IO MediumLevelILSSAInstruction)
-> CSize -> IO MediumLevelILSSAInstruction
forall a b. (a -> b) -> a -> b
$ BNMediumLevelILInstruction -> CSize -> CSize
getOp BNMediumLevelILInstruction
rawInst CSize
0
      target' <- getTargetMap func exprIndex' 1
      let rec =
            MediumLevelILJumpToRec
              { dest :: MediumLevelILSSAInstruction
dest = MediumLevelILSSAInstruction
dest',
                target :: TargetMap
target = TargetMap
target',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ Terminal $ MediumLevelILJumpTo rec
    BNMediumLevelILOperation
MLIL_RET_HINT -> do
      dest' <- BNMlilSSAFunctionPtr -> CSize -> IO MediumLevelILSSAInstruction
getExpr BNMlilSSAFunctionPtr
func (CSize -> IO MediumLevelILSSAInstruction)
-> CSize -> IO MediumLevelILSSAInstruction
forall a b. (a -> b) -> a -> b
$ BNMediumLevelILInstruction -> CSize -> CSize
getOp BNMediumLevelILInstruction
rawInst CSize
0
      let rec =
            MediumLevelILRetHintRec
              { dest :: MediumLevelILSSAInstruction
dest = MediumLevelILSSAInstruction
dest',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ ControlFlow $ MediumLevelILRetHint rec
    BNMediumLevelILOperation
MLIL_CALL -> do
      output' <- BNMlilSSAFunctionPtr -> CSize -> CSize -> IO [BNVariable]
getVarList BNMlilSSAFunctionPtr
func CSize
exprIndex' CSize
0
      dest' <- getExpr func $ getOp rawInst 2
      params' <- getExprList func exprIndex' 3
      let rec =
            MediumLevelILCallRec
              { output :: [BNVariable]
output = [BNVariable]
output',
                dest :: MediumLevelILSSAInstruction
dest = MediumLevelILSSAInstruction
dest',
                params :: [MediumLevelILSSAInstruction]
params = [MediumLevelILSSAInstruction]
params',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ Localcall $ MediumLevelILCall rec
    BNMediumLevelILOperation
MLIL_CALL_UNTYPED -> do
      outputInst <- BNMlilSSAFunctionPtr -> CSize -> IO MediumLevelILSSAInstruction
getExpr BNMlilSSAFunctionPtr
func (CSize -> IO MediumLevelILSSAInstruction)
-> CSize -> IO MediumLevelILSSAInstruction
forall a b. (a -> b) -> a -> b
$ BNMediumLevelILInstruction -> CSize -> CSize
getOp BNMediumLevelILInstruction
rawInst CSize
0
      output' <- case outputInst of
        MediumLevelILCallOutput (MediumLevelILCallOutputRec {dest :: MediumLevelILCallOutputRec -> [BNVariable]
dest = [BNVariable]
d}) -> [BNVariable] -> IO [BNVariable]
forall a. a -> IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure [BNVariable]
d
        MediumLevelILSSAInstruction
_ ->
          [Char] -> IO [BNVariable]
forall a. HasCallStack => [Char] -> a
error ([Char] -> IO [BNVariable]) -> [Char] -> IO [BNVariable]
forall a b. (a -> b) -> a -> b
$
            [Char]
"create: Output of MediumLevelILCallUntypedSsa: expected MediumLevelILCallOutputSsa : "
              [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ MediumLevelILSSAInstruction -> [Char]
forall a. Show a => a -> [Char]
show MediumLevelILSSAInstruction
outputInst
      dest' <- getExpr func $ getOp rawInst 1
      paramsInst <- getExpr func $ getOp rawInst 2
      params' <- case paramsInst of
        MediumLevelILCallParam (MediumLevelILCallParamRec {src :: MediumLevelILCallParamRec -> [MediumLevelILSSAInstruction]
src = [MediumLevelILSSAInstruction]
s}) -> [MediumLevelILSSAInstruction] -> IO [MediumLevelILSSAInstruction]
forall a. a -> IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure [MediumLevelILSSAInstruction]
s
        MediumLevelILSSAInstruction
_ ->
          [Char] -> IO [MediumLevelILSSAInstruction]
forall a. HasCallStack => [Char] -> a
error ([Char] -> IO [MediumLevelILSSAInstruction])
-> [Char] -> IO [MediumLevelILSSAInstruction]
forall a b. (a -> b) -> a -> b
$
            [Char]
"create: Params of MediumLevelILCallUntypedSsa: expected MediumLevelILCallParamsSsa : "
              [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ MediumLevelILSSAInstruction -> [Char]
forall a. Show a => a -> [Char]
show MediumLevelILSSAInstruction
outputInst
      stack' <- getExpr func $ getOp rawInst 3
      let rec =
            MediumLevelILCallUntypedRec
              { output :: [BNVariable]
output = [BNVariable]
output',
                dest :: MediumLevelILSSAInstruction
dest = MediumLevelILSSAInstruction
dest',
                params :: [MediumLevelILSSAInstruction]
params = [MediumLevelILSSAInstruction]
params',
                stack :: MediumLevelILSSAInstruction
stack = MediumLevelILSSAInstruction
stack',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ Localcall $ MediumLevelILCallUntyped rec
    BNMediumLevelILOperation
MLIL_CALL_OUTPUT -> do
      dest' <- BNMlilSSAFunctionPtr -> CSize -> CSize -> IO [BNVariable]
getVarList BNMlilSSAFunctionPtr
func CSize
exprIndex' CSize
0
      let rec =
            MediumLevelILCallOutputRec
              { dest :: [BNVariable]
dest = [BNVariable]
dest',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ MediumLevelILCallOutput rec
    BNMediumLevelILOperation
MLIL_CALL_PARAM -> do
      src' <- BNMlilSSAFunctionPtr
-> CSize -> CSize -> IO [MediumLevelILSSAInstruction]
getExprList BNMlilSSAFunctionPtr
func CSize
exprIndex' CSize
0
      let rec =
            MediumLevelILCallParamRec
              { src :: [MediumLevelILSSAInstruction]
src = [MediumLevelILSSAInstruction]
src',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ MediumLevelILCallParam rec
    BNMediumLevelILOperation
MLIL_SEPARATE_PARAM_LIST -> do
      params' <- BNMlilSSAFunctionPtr
-> CSize -> CSize -> IO [MediumLevelILSSAInstruction]
getExprList BNMlilSSAFunctionPtr
func CSize
exprIndex' CSize
0
      let rec =
            MediumLevelILSeparateParamListRec
              { params :: [MediumLevelILSSAInstruction]
params = [MediumLevelILSSAInstruction]
params',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ MediumLevelILSeparateParamList rec
    BNMediumLevelILOperation
MLIL_SHARED_PARAM_SLOT -> do
      params' <- BNMlilSSAFunctionPtr
-> CSize -> CSize -> IO [MediumLevelILSSAInstruction]
getExprList BNMlilSSAFunctionPtr
func CSize
exprIndex' CSize
0
      let rec =
            MediumLevelILSharedParamSlotRec
              { params :: [MediumLevelILSSAInstruction]
params = [MediumLevelILSSAInstruction]
params',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ MediumLevelILSharedParamSlot rec
    BNMediumLevelILOperation
MLIL_RET -> do
      src' <- BNMlilSSAFunctionPtr
-> CSize -> CSize -> IO [MediumLevelILSSAInstruction]
getExprList BNMlilSSAFunctionPtr
func CSize
exprIndex' CSize
0
      let rec =
            MediumLevelILRetRec
              { src :: [MediumLevelILSSAInstruction]
src = [MediumLevelILSSAInstruction]
src',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ Return $ MediumLevelILRet rec
    BNMediumLevelILOperation
MLIL_NORET -> do
      MediumLevelILSSAInstruction -> IO MediumLevelILSSAInstruction
forall a. a -> IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (MediumLevelILSSAInstruction -> IO MediumLevelILSSAInstruction)
-> MediumLevelILSSAInstruction -> IO MediumLevelILSSAInstruction
forall a b. (a -> b) -> a -> b
$ Terminal -> MediumLevelILSSAInstruction
Terminal (Terminal -> MediumLevelILSSAInstruction)
-> Terminal -> MediumLevelILSSAInstruction
forall a b. (a -> b) -> a -> b
$ MediumLevelILNoretRec -> Terminal
MediumLevelILNoret (MediumLevelILNoretRec -> Terminal)
-> MediumLevelILNoretRec -> Terminal
forall a b. (a -> b) -> a -> b
$ MediumLevelILNoretRec {core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst}
    BNMediumLevelILOperation
MLIL_IF -> do
      condition' <- BNMlilSSAFunctionPtr -> CSize -> IO MediumLevelILSSAInstruction
getExpr BNMlilSSAFunctionPtr
func (CSize -> IO MediumLevelILSSAInstruction)
-> CSize -> IO MediumLevelILSSAInstruction
forall a b. (a -> b) -> a -> b
$ BNMediumLevelILInstruction -> CSize -> CSize
getOp BNMediumLevelILInstruction
rawInst CSize
0
      true' <- getInt rawInst 1
      false' <- getInt rawInst 2
      let rec =
            MediumLevelILIfRec
              { condition :: MediumLevelILSSAInstruction
condition = MediumLevelILSSAInstruction
condition',
                true :: Int
true = Int
true',
                false :: Int
false = Int
false',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ Terminal $ MediumLevelILIf rec
    BNMediumLevelILOperation
MLIL_GOTO -> do
      dest' <- BNMediumLevelILInstruction -> CSize -> IO Int
getInt BNMediumLevelILInstruction
rawInst CSize
0
      let rec =
            MediumLevelILGotoRec
              { dest :: Int
dest = Int
dest',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ Terminal $ MediumLevelILGoto rec
    BNMediumLevelILOperation
MLIL_CMP_E -> do
      left' <- BNMlilSSAFunctionPtr -> CSize -> IO MediumLevelILSSAInstruction
getExpr BNMlilSSAFunctionPtr
func (CSize -> IO MediumLevelILSSAInstruction)
-> CSize -> IO MediumLevelILSSAInstruction
forall a b. (a -> b) -> a -> b
$ BNMediumLevelILInstruction -> CSize -> CSize
getOp BNMediumLevelILInstruction
rawInst CSize
0
      right' <- getExpr func $ getOp rawInst 1
      let rec =
            MediumLevelILCmpERec
              { left :: MediumLevelILSSAInstruction
left = MediumLevelILSSAInstruction
left',
                right :: MediumLevelILSSAInstruction
right = MediumLevelILSSAInstruction
right',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ Comparison $ MediumLevelILCmpE rec
    BNMediumLevelILOperation
MLIL_CMP_NE -> do
      left' <- BNMlilSSAFunctionPtr -> CSize -> IO MediumLevelILSSAInstruction
getExpr BNMlilSSAFunctionPtr
func (CSize -> IO MediumLevelILSSAInstruction)
-> CSize -> IO MediumLevelILSSAInstruction
forall a b. (a -> b) -> a -> b
$ BNMediumLevelILInstruction -> CSize -> CSize
getOp BNMediumLevelILInstruction
rawInst CSize
0
      right' <- getExpr func $ getOp rawInst 1
      let rec =
            MediumLevelILCmpNeRec
              { left :: MediumLevelILSSAInstruction
left = MediumLevelILSSAInstruction
left',
                right :: MediumLevelILSSAInstruction
right = MediumLevelILSSAInstruction
right',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ Comparison $ MediumLevelILCmpNe rec
    BNMediumLevelILOperation
MLIL_CMP_SLT -> do
      left' <- BNMlilSSAFunctionPtr -> CSize -> IO MediumLevelILSSAInstruction
getExpr BNMlilSSAFunctionPtr
func (CSize -> IO MediumLevelILSSAInstruction)
-> CSize -> IO MediumLevelILSSAInstruction
forall a b. (a -> b) -> a -> b
$ BNMediumLevelILInstruction -> CSize -> CSize
getOp BNMediumLevelILInstruction
rawInst CSize
0
      right' <- getExpr func $ getOp rawInst 1
      let rec =
            MediumLevelILCmpSltRec
              { left :: MediumLevelILSSAInstruction
left = MediumLevelILSSAInstruction
left',
                right :: MediumLevelILSSAInstruction
right = MediumLevelILSSAInstruction
right',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ Comparison $ MediumLevelILCmpSlt rec
    BNMediumLevelILOperation
MLIL_CMP_ULT -> do
      left' <- BNMlilSSAFunctionPtr -> CSize -> IO MediumLevelILSSAInstruction
getExpr BNMlilSSAFunctionPtr
func (CSize -> IO MediumLevelILSSAInstruction)
-> CSize -> IO MediumLevelILSSAInstruction
forall a b. (a -> b) -> a -> b
$ BNMediumLevelILInstruction -> CSize -> CSize
getOp BNMediumLevelILInstruction
rawInst CSize
0
      right' <- getExpr func $ getOp rawInst 1
      let rec =
            MediumLevelILCmpUltRec
              { left :: MediumLevelILSSAInstruction
left = MediumLevelILSSAInstruction
left',
                right :: MediumLevelILSSAInstruction
right = MediumLevelILSSAInstruction
right',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ Comparison $ MediumLevelILCmpUlt rec
    BNMediumLevelILOperation
MLIL_CMP_SLE -> do
      left' <- BNMlilSSAFunctionPtr -> CSize -> IO MediumLevelILSSAInstruction
getExpr BNMlilSSAFunctionPtr
func (CSize -> IO MediumLevelILSSAInstruction)
-> CSize -> IO MediumLevelILSSAInstruction
forall a b. (a -> b) -> a -> b
$ BNMediumLevelILInstruction -> CSize -> CSize
getOp BNMediumLevelILInstruction
rawInst CSize
0
      right' <- getExpr func $ getOp rawInst 1
      let rec =
            MediumLevelILCmpSleRec
              { left :: MediumLevelILSSAInstruction
left = MediumLevelILSSAInstruction
left',
                right :: MediumLevelILSSAInstruction
right = MediumLevelILSSAInstruction
right',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ Comparison $ MediumLevelILCmpSle rec
    BNMediumLevelILOperation
MLIL_CMP_ULE -> do
      left' <- BNMlilSSAFunctionPtr -> CSize -> IO MediumLevelILSSAInstruction
getExpr BNMlilSSAFunctionPtr
func (CSize -> IO MediumLevelILSSAInstruction)
-> CSize -> IO MediumLevelILSSAInstruction
forall a b. (a -> b) -> a -> b
$ BNMediumLevelILInstruction -> CSize -> CSize
getOp BNMediumLevelILInstruction
rawInst CSize
0
      right' <- getExpr func $ getOp rawInst 1
      let rec =
            MediumLevelILCmpUleRec
              { left :: MediumLevelILSSAInstruction
left = MediumLevelILSSAInstruction
left',
                right :: MediumLevelILSSAInstruction
right = MediumLevelILSSAInstruction
right',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ Comparison $ MediumLevelILCmpUle rec
    BNMediumLevelILOperation
MLIL_CMP_SGE -> do
      left' <- BNMlilSSAFunctionPtr -> CSize -> IO MediumLevelILSSAInstruction
getExpr BNMlilSSAFunctionPtr
func (CSize -> IO MediumLevelILSSAInstruction)
-> CSize -> IO MediumLevelILSSAInstruction
forall a b. (a -> b) -> a -> b
$ BNMediumLevelILInstruction -> CSize -> CSize
getOp BNMediumLevelILInstruction
rawInst CSize
0
      right' <- getExpr func $ getOp rawInst 1
      let rec =
            MediumLevelILCmpSgeRec
              { left :: MediumLevelILSSAInstruction
left = MediumLevelILSSAInstruction
left',
                right :: MediumLevelILSSAInstruction
right = MediumLevelILSSAInstruction
right',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ Comparison $ MediumLevelILCmpSge rec
    BNMediumLevelILOperation
MLIL_CMP_UGE -> do
      left' <- BNMlilSSAFunctionPtr -> CSize -> IO MediumLevelILSSAInstruction
getExpr BNMlilSSAFunctionPtr
func (CSize -> IO MediumLevelILSSAInstruction)
-> CSize -> IO MediumLevelILSSAInstruction
forall a b. (a -> b) -> a -> b
$ BNMediumLevelILInstruction -> CSize -> CSize
getOp BNMediumLevelILInstruction
rawInst CSize
0
      right' <- getExpr func $ getOp rawInst 1
      let rec =
            MediumLevelILCmpUgeRec
              { left :: MediumLevelILSSAInstruction
left = MediumLevelILSSAInstruction
left',
                right :: MediumLevelILSSAInstruction
right = MediumLevelILSSAInstruction
right',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ Comparison $ MediumLevelILCmpUge rec
    BNMediumLevelILOperation
MLIL_CMP_SGT -> do
      left' <- BNMlilSSAFunctionPtr -> CSize -> IO MediumLevelILSSAInstruction
getExpr BNMlilSSAFunctionPtr
func (CSize -> IO MediumLevelILSSAInstruction)
-> CSize -> IO MediumLevelILSSAInstruction
forall a b. (a -> b) -> a -> b
$ BNMediumLevelILInstruction -> CSize -> CSize
getOp BNMediumLevelILInstruction
rawInst CSize
0
      right' <- getExpr func $ getOp rawInst 1
      let rec =
            MediumLevelILCmpSgtRec
              { left :: MediumLevelILSSAInstruction
left = MediumLevelILSSAInstruction
left',
                right :: MediumLevelILSSAInstruction
right = MediumLevelILSSAInstruction
right',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ Comparison $ MediumLevelILCmpSgt rec
    BNMediumLevelILOperation
MLIL_CMP_UGT -> do
      left' <- BNMlilSSAFunctionPtr -> CSize -> IO MediumLevelILSSAInstruction
getExpr BNMlilSSAFunctionPtr
func (CSize -> IO MediumLevelILSSAInstruction)
-> CSize -> IO MediumLevelILSSAInstruction
forall a b. (a -> b) -> a -> b
$ BNMediumLevelILInstruction -> CSize -> CSize
getOp BNMediumLevelILInstruction
rawInst CSize
0
      right' <- getExpr func $ getOp rawInst 1
      let rec =
            MediumLevelILCmpUgtRec
              { left :: MediumLevelILSSAInstruction
left = MediumLevelILSSAInstruction
left',
                right :: MediumLevelILSSAInstruction
right = MediumLevelILSSAInstruction
right',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ Comparison $ MediumLevelILCmpUgt rec
    BNMediumLevelILOperation
MLIL_TEST_BIT -> do
      left' <- BNMlilSSAFunctionPtr -> CSize -> IO MediumLevelILSSAInstruction
getExpr BNMlilSSAFunctionPtr
func (CSize -> IO MediumLevelILSSAInstruction)
-> CSize -> IO MediumLevelILSSAInstruction
forall a b. (a -> b) -> a -> b
$ BNMediumLevelILInstruction -> CSize -> CSize
getOp BNMediumLevelILInstruction
rawInst CSize
0
      right' <- getExpr func $ getOp rawInst 1
      let rec =
            MediumLevelILTestBitRec
              { left :: MediumLevelILSSAInstruction
left = MediumLevelILSSAInstruction
left',
                right :: MediumLevelILSSAInstruction
right = MediumLevelILSSAInstruction
right',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ Comparison $ MediumLevelILTestBit rec
    BNMediumLevelILOperation
MLIL_BOOL_TO_INT -> do
      src' <- BNMlilSSAFunctionPtr -> CSize -> IO MediumLevelILSSAInstruction
getExpr BNMlilSSAFunctionPtr
func (CSize -> IO MediumLevelILSSAInstruction)
-> CSize -> IO MediumLevelILSSAInstruction
forall a b. (a -> b) -> a -> b
$ BNMediumLevelILInstruction -> CSize -> CSize
getOp BNMediumLevelILInstruction
rawInst CSize
0
      let rec =
            MediumLevelILBoolToIntRec
              { src :: MediumLevelILSSAInstruction
src = MediumLevelILSSAInstruction
src',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ MediumLevelILBoolToInt rec
    BNMediumLevelILOperation
MLIL_ADD_OVERFLOW -> do
      left' <- BNMlilSSAFunctionPtr -> CSize -> IO MediumLevelILSSAInstruction
getExpr BNMlilSSAFunctionPtr
func (CSize -> IO MediumLevelILSSAInstruction)
-> CSize -> IO MediumLevelILSSAInstruction
forall a b. (a -> b) -> a -> b
$ BNMediumLevelILInstruction -> CSize -> CSize
getOp BNMediumLevelILInstruction
rawInst CSize
0
      right' <- getExpr func $ getOp rawInst 1
      let rec =
            MediumLevelILAddOverflowRec
              { left :: MediumLevelILSSAInstruction
left = MediumLevelILSSAInstruction
left',
                right :: MediumLevelILSSAInstruction
right = MediumLevelILSSAInstruction
right',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ Arithmetic $ MediumLevelILAddOverflow rec
    BNMediumLevelILOperation
MLIL_SYSCALL -> do
      output' <- BNMlilSSAFunctionPtr -> CSize -> CSize -> IO [BNVariable]
getVarList BNMlilSSAFunctionPtr
func CSize
exprIndex' CSize
0
      params' <- getExprList func exprIndex' 2
      let rec =
            MediumLevelILSyscallRec
              { output :: [BNVariable]
output = [BNVariable]
output',
                params :: [MediumLevelILSSAInstruction]
params = [MediumLevelILSSAInstruction]
params',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ Syscall $ MediumLevelILSyscall rec
    BNMediumLevelILOperation
MLIL_SYSCALL_UNTYPED -> do
      outputInst <- BNMlilSSAFunctionPtr -> CSize -> IO MediumLevelILSSAInstruction
getExpr BNMlilSSAFunctionPtr
func (CSize -> IO MediumLevelILSSAInstruction)
-> CSize -> IO MediumLevelILSSAInstruction
forall a b. (a -> b) -> a -> b
$ BNMediumLevelILInstruction -> CSize -> CSize
getOp BNMediumLevelILInstruction
rawInst CSize
0
      output' <- case outputInst of
        MediumLevelILCallOutput (MediumLevelILCallOutputRec {dest :: MediumLevelILCallOutputRec -> [BNVariable]
dest = [BNVariable]
d}) -> [BNVariable] -> IO [BNVariable]
forall a. a -> IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure [BNVariable]
d
        MediumLevelILSSAInstruction
_ ->
          [Char] -> IO [BNVariable]
forall a. HasCallStack => [Char] -> a
error ([Char] -> IO [BNVariable]) -> [Char] -> IO [BNVariable]
forall a b. (a -> b) -> a -> b
$
            [Char]
"create: Output of MediumLevelILSyscallUntyped: expected MediumLevelILCallOutput : "
              [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ MediumLevelILSSAInstruction -> [Char]
forall a. Show a => a -> [Char]
show MediumLevelILSSAInstruction
outputInst
      paramInst <- getExpr func $ getOp rawInst 1
      params' <- case paramInst of
        MediumLevelILCallParam (MediumLevelILCallParamRec {src :: MediumLevelILCallParamRec -> [MediumLevelILSSAInstruction]
src = [MediumLevelILSSAInstruction]
s}) -> [MediumLevelILSSAInstruction] -> IO [MediumLevelILSSAInstruction]
forall a. a -> IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure [MediumLevelILSSAInstruction]
s
        MediumLevelILSSAInstruction
_ ->
          [Char] -> IO [MediumLevelILSSAInstruction]
forall a. HasCallStack => [Char] -> a
error ([Char] -> IO [MediumLevelILSSAInstruction])
-> [Char] -> IO [MediumLevelILSSAInstruction]
forall a b. (a -> b) -> a -> b
$
            [Char]
"create: Params of MediumLevelILSyscallUntyped: expected MediumLevelILCallParam : "
              [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ MediumLevelILSSAInstruction -> [Char]
forall a. Show a => a -> [Char]
show MediumLevelILSSAInstruction
paramInst
      stack' <- getExpr func $ getOp rawInst 2
      let rec =
            MediumLevelILSyscallUntypedRec
              { output :: [BNVariable]
output = [BNVariable]
output',
                params :: [MediumLevelILSSAInstruction]
params = [MediumLevelILSSAInstruction]
params',
                stack :: MediumLevelILSSAInstruction
stack = MediumLevelILSSAInstruction
stack',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ Syscall $ MediumLevelILSyscallUntyped rec
    BNMediumLevelILOperation
MLIL_TAILCALL -> do
      output' <- BNMlilSSAFunctionPtr -> CSize -> CSize -> IO [BNVariable]
getVarList BNMlilSSAFunctionPtr
func CSize
exprIndex' CSize
0
      dest' <- getExpr func $ getOp rawInst 2
      params' <- getExprList func exprIndex' 3
      let rec =
            MediumLevelILTailcallRec
              { output :: [BNVariable]
output = [BNVariable]
output',
                dest :: MediumLevelILSSAInstruction
dest = MediumLevelILSSAInstruction
dest',
                params :: [MediumLevelILSSAInstruction]
params = [MediumLevelILSSAInstruction]
params',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ Tailcall $ MediumLevelILTailcall rec
    BNMediumLevelILOperation
MLIL_TAILCALL_UNTYPED -> do
      outputInst <- BNMlilSSAFunctionPtr -> CSize -> IO MediumLevelILSSAInstruction
getExpr BNMlilSSAFunctionPtr
func (CSize -> IO MediumLevelILSSAInstruction)
-> CSize -> IO MediumLevelILSSAInstruction
forall a b. (a -> b) -> a -> b
$ BNMediumLevelILInstruction -> CSize -> CSize
getOp BNMediumLevelILInstruction
rawInst CSize
0
      output' <- case outputInst of
        MediumLevelILCallOutput (MediumLevelILCallOutputRec {dest :: MediumLevelILCallOutputRec -> [BNVariable]
dest = [BNVariable]
d}) -> [BNVariable] -> IO [BNVariable]
forall a. a -> IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure [BNVariable]
d
        MediumLevelILSSAInstruction
_ ->
          [Char] -> IO [BNVariable]
forall a. HasCallStack => [Char] -> a
error ([Char] -> IO [BNVariable]) -> [Char] -> IO [BNVariable]
forall a b. (a -> b) -> a -> b
$
            [Char]
"create: Output of MediumLevelILTailCallUntyped: expected MediumLevelILCallOutput : "
              [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ MediumLevelILSSAInstruction -> [Char]
forall a. Show a => a -> [Char]
show MediumLevelILSSAInstruction
outputInst
      dest' <- getExpr func $ getOp rawInst 1
      paramInst <- getExpr func $ getOp rawInst 2
      params' <- case paramInst of
        MediumLevelILCallParam (MediumLevelILCallParamRec {src :: MediumLevelILCallParamRec -> [MediumLevelILSSAInstruction]
src = [MediumLevelILSSAInstruction]
s}) -> [MediumLevelILSSAInstruction] -> IO [MediumLevelILSSAInstruction]
forall a. a -> IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure [MediumLevelILSSAInstruction]
s
        MediumLevelILSSAInstruction
_ ->
          [Char] -> IO [MediumLevelILSSAInstruction]
forall a. HasCallStack => [Char] -> a
error ([Char] -> IO [MediumLevelILSSAInstruction])
-> [Char] -> IO [MediumLevelILSSAInstruction]
forall a b. (a -> b) -> a -> b
$
            [Char]
"create: Param of MediumLevelILTailCallUntyped: expected MediumLevelILCallParam : "
              [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ MediumLevelILSSAInstruction -> [Char]
forall a. Show a => a -> [Char]
show MediumLevelILSSAInstruction
paramInst
      stack' <- getExpr func $ getOp rawInst 3
      let rec =
            MediumLevelILTailcallUntypedRec
              { output :: [BNVariable]
output = [BNVariable]
output',
                dest :: MediumLevelILSSAInstruction
dest = MediumLevelILSSAInstruction
dest',
                params :: [MediumLevelILSSAInstruction]
params = [MediumLevelILSSAInstruction]
params',
                stack :: MediumLevelILSSAInstruction
stack = MediumLevelILSSAInstruction
stack',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ Tailcall $ MediumLevelILTailcallUntyped rec
    BNMediumLevelILOperation
MLIL_INTRINSIC -> do
      output' <- BNMlilSSAFunctionPtr -> CSize -> CSize -> IO [BNVariable]
getVarList BNMlilSSAFunctionPtr
func CSize
exprIndex' CSize
0
      intrinsic' <- getIntrinsicIL rawInst func 2
      params' <- getExprList func exprIndex' 3
      let rec =
            MediumLevelILIntrinsicRec
              { output :: [BNVariable]
output = [BNVariable]
output',
                intrinsic :: ILIntrinsic
intrinsic = ILIntrinsic
intrinsic',
                params :: [MediumLevelILSSAInstruction]
params = [MediumLevelILSSAInstruction]
params',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ IntrinsicInstruction $ MediumLevelILIntrinsic rec
    BNMediumLevelILOperation
MLIL_FREE_VAR_SLOT -> do
      dest' <- CULLong -> IO BNVariable
varFromID (CULLong -> IO BNVariable) -> CULLong -> IO BNVariable
forall a b. (a -> b) -> a -> b
$ CSize -> CULLong
forall a b. (Integral a, Num b) => a -> b
fromIntegral (CSize -> CULLong) -> CSize -> CULLong
forall a b. (a -> b) -> a -> b
$ BNMediumLevelILInstruction -> CSize -> CSize
getOp BNMediumLevelILInstruction
rawInst CSize
0
      let rec =
            MediumLevelILFreeVarSlotRec
              { dest :: BNVariable
dest = BNVariable
dest',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ RegisterStack $ MediumLevelILFreeVarSlot rec
    BNMediumLevelILOperation
MLIL_BP -> do
      MediumLevelILSSAInstruction -> IO MediumLevelILSSAInstruction
forall a. a -> IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (MediumLevelILSSAInstruction -> IO MediumLevelILSSAInstruction)
-> MediumLevelILSSAInstruction -> IO MediumLevelILSSAInstruction
forall a b. (a -> b) -> a -> b
$ Terminal -> MediumLevelILSSAInstruction
Terminal (Terminal -> MediumLevelILSSAInstruction)
-> Terminal -> MediumLevelILSSAInstruction
forall a b. (a -> b) -> a -> b
$ MediumLevelILBpRec -> Terminal
MediumLevelILBp (MediumLevelILBpRec -> Terminal) -> MediumLevelILBpRec -> Terminal
forall a b. (a -> b) -> a -> b
$ MediumLevelILBpRec {core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst}
    BNMediumLevelILOperation
MLIL_TRAP -> do
      vector' <- BNMediumLevelILInstruction -> CSize -> IO Int
getInt BNMediumLevelILInstruction
rawInst CSize
0
      let rec =
            MediumLevelILTrapRec
              { vector :: Int
vector = Int
vector',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ Terminal $ MediumLevelILTrap rec
    BNMediumLevelILOperation
MLIL_UNDEF -> do
      MediumLevelILSSAInstruction -> IO MediumLevelILSSAInstruction
forall a. a -> IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (MediumLevelILSSAInstruction -> IO MediumLevelILSSAInstruction)
-> MediumLevelILSSAInstruction -> IO MediumLevelILSSAInstruction
forall a b. (a -> b) -> a -> b
$ MediumLevelILUndefRec -> MediumLevelILSSAInstruction
MediumLevelILUndef (MediumLevelILUndefRec -> MediumLevelILSSAInstruction)
-> MediumLevelILUndefRec -> MediumLevelILSSAInstruction
forall a b. (a -> b) -> a -> b
$ MediumLevelILUndefRec {core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst}
    BNMediumLevelILOperation
MLIL_UNIMPL -> do
      MediumLevelILSSAInstruction -> IO MediumLevelILSSAInstruction
forall a. a -> IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (MediumLevelILSSAInstruction -> IO MediumLevelILSSAInstruction)
-> MediumLevelILSSAInstruction -> IO MediumLevelILSSAInstruction
forall a b. (a -> b) -> a -> b
$ MediumLevelILUnimplRec -> MediumLevelILSSAInstruction
MediumLevelILUnimpl (MediumLevelILUnimplRec -> MediumLevelILSSAInstruction)
-> MediumLevelILUnimplRec -> MediumLevelILSSAInstruction
forall a b. (a -> b) -> a -> b
$ MediumLevelILUnimplRec {core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst}
    BNMediumLevelILOperation
MLIL_UNIMPL_MEM -> do
      src' <- BNMlilSSAFunctionPtr -> CSize -> IO MediumLevelILSSAInstruction
getExpr BNMlilSSAFunctionPtr
func (CSize -> IO MediumLevelILSSAInstruction)
-> CSize -> IO MediumLevelILSSAInstruction
forall a b. (a -> b) -> a -> b
$ BNMediumLevelILInstruction -> CSize -> CSize
getOp BNMediumLevelILInstruction
rawInst CSize
0
      let rec =
            MediumLevelILUnimplMemRec
              { src :: MediumLevelILSSAInstruction
src = MediumLevelILSSAInstruction
src',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ Memory $ MediumLevelILUnimplMem rec
    BNMediumLevelILOperation
MLIL_FADD -> do
      left' <- BNMlilSSAFunctionPtr -> CSize -> IO MediumLevelILSSAInstruction
getExpr BNMlilSSAFunctionPtr
func (CSize -> IO MediumLevelILSSAInstruction)
-> CSize -> IO MediumLevelILSSAInstruction
forall a b. (a -> b) -> a -> b
$ BNMediumLevelILInstruction -> CSize -> CSize
getOp BNMediumLevelILInstruction
rawInst CSize
0
      right' <- getExpr func $ getOp rawInst 1
      let rec =
            MediumLevelILFaddRec
              { left :: MediumLevelILSSAInstruction
left = MediumLevelILSSAInstruction
left',
                right :: MediumLevelILSSAInstruction
right = MediumLevelILSSAInstruction
right',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ Arithmetic $ MediumLevelILFadd rec
    BNMediumLevelILOperation
MLIL_FSUB -> do
      left' <- BNMlilSSAFunctionPtr -> CSize -> IO MediumLevelILSSAInstruction
getExpr BNMlilSSAFunctionPtr
func (CSize -> IO MediumLevelILSSAInstruction)
-> CSize -> IO MediumLevelILSSAInstruction
forall a b. (a -> b) -> a -> b
$ BNMediumLevelILInstruction -> CSize -> CSize
getOp BNMediumLevelILInstruction
rawInst CSize
0
      right' <- getExpr func $ getOp rawInst 1
      let rec =
            MediumLevelILFsubRec
              { left :: MediumLevelILSSAInstruction
left = MediumLevelILSSAInstruction
left',
                right :: MediumLevelILSSAInstruction
right = MediumLevelILSSAInstruction
right',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ Arithmetic $ MediumLevelILFsub rec
    BNMediumLevelILOperation
MLIL_FMUL -> do
      left' <- BNMlilSSAFunctionPtr -> CSize -> IO MediumLevelILSSAInstruction
getExpr BNMlilSSAFunctionPtr
func (CSize -> IO MediumLevelILSSAInstruction)
-> CSize -> IO MediumLevelILSSAInstruction
forall a b. (a -> b) -> a -> b
$ BNMediumLevelILInstruction -> CSize -> CSize
getOp BNMediumLevelILInstruction
rawInst CSize
0
      right' <- getExpr func $ getOp rawInst 1
      let rec =
            MediumLevelILFmulRec
              { left :: MediumLevelILSSAInstruction
left = MediumLevelILSSAInstruction
left',
                right :: MediumLevelILSSAInstruction
right = MediumLevelILSSAInstruction
right',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ Arithmetic $ MediumLevelILFmul rec
    BNMediumLevelILOperation
MLIL_FDIV -> do
      left' <- BNMlilSSAFunctionPtr -> CSize -> IO MediumLevelILSSAInstruction
getExpr BNMlilSSAFunctionPtr
func (CSize -> IO MediumLevelILSSAInstruction)
-> CSize -> IO MediumLevelILSSAInstruction
forall a b. (a -> b) -> a -> b
$ BNMediumLevelILInstruction -> CSize -> CSize
getOp BNMediumLevelILInstruction
rawInst CSize
0
      right' <- getExpr func $ getOp rawInst 1
      let rec =
            MediumLevelILFdivRec
              { left :: MediumLevelILSSAInstruction
left = MediumLevelILSSAInstruction
left',
                right :: MediumLevelILSSAInstruction
right = MediumLevelILSSAInstruction
right',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ Arithmetic $ MediumLevelILFdiv rec
    BNMediumLevelILOperation
MLIL_FSQRT -> do
      src' <- BNMlilSSAFunctionPtr -> CSize -> IO MediumLevelILSSAInstruction
getExpr BNMlilSSAFunctionPtr
func (CSize -> IO MediumLevelILSSAInstruction)
-> CSize -> IO MediumLevelILSSAInstruction
forall a b. (a -> b) -> a -> b
$ BNMediumLevelILInstruction -> CSize -> CSize
getOp BNMediumLevelILInstruction
rawInst CSize
0
      let rec =
            MediumLevelILFsqrtRec
              { src :: MediumLevelILSSAInstruction
src = MediumLevelILSSAInstruction
src',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ Arithmetic $ MediumLevelILFsqrt rec
    BNMediumLevelILOperation
MLIL_FNEG -> do
      src' <- BNMlilSSAFunctionPtr -> CSize -> IO MediumLevelILSSAInstruction
getExpr BNMlilSSAFunctionPtr
func (CSize -> IO MediumLevelILSSAInstruction)
-> CSize -> IO MediumLevelILSSAInstruction
forall a b. (a -> b) -> a -> b
$ BNMediumLevelILInstruction -> CSize -> CSize
getOp BNMediumLevelILInstruction
rawInst CSize
0
      let rec =
            MediumLevelILFnegRec
              { src :: MediumLevelILSSAInstruction
src = MediumLevelILSSAInstruction
src',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ Arithmetic $ MediumLevelILFneg rec
    BNMediumLevelILOperation
MLIL_FABS -> do
      src' <- BNMlilSSAFunctionPtr -> CSize -> IO MediumLevelILSSAInstruction
getExpr BNMlilSSAFunctionPtr
func (CSize -> IO MediumLevelILSSAInstruction)
-> CSize -> IO MediumLevelILSSAInstruction
forall a b. (a -> b) -> a -> b
$ BNMediumLevelILInstruction -> CSize -> CSize
getOp BNMediumLevelILInstruction
rawInst CSize
0
      let rec =
            MediumLevelILFabsRec
              { src :: MediumLevelILSSAInstruction
src = MediumLevelILSSAInstruction
src',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ Arithmetic $ MediumLevelILFabs rec
    BNMediumLevelILOperation
MLIL_FLOAT_TO_INT -> do
      src' <- BNMlilSSAFunctionPtr -> CSize -> IO MediumLevelILSSAInstruction
getExpr BNMlilSSAFunctionPtr
func (CSize -> IO MediumLevelILSSAInstruction)
-> CSize -> IO MediumLevelILSSAInstruction
forall a b. (a -> b) -> a -> b
$ BNMediumLevelILInstruction -> CSize -> CSize
getOp BNMediumLevelILInstruction
rawInst CSize
0
      let rec =
            MediumLevelILFloatToIntRec
              { src :: MediumLevelILSSAInstruction
src = MediumLevelILSSAInstruction
src',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ Arithmetic $ MediumLevelILFloatToInt rec
    BNMediumLevelILOperation
MLIL_INT_TO_FLOAT -> do
      src' <- BNMlilSSAFunctionPtr -> CSize -> IO MediumLevelILSSAInstruction
getExpr BNMlilSSAFunctionPtr
func (CSize -> IO MediumLevelILSSAInstruction)
-> CSize -> IO MediumLevelILSSAInstruction
forall a b. (a -> b) -> a -> b
$ BNMediumLevelILInstruction -> CSize -> CSize
getOp BNMediumLevelILInstruction
rawInst CSize
0
      let rec =
            MediumLevelILIntToFloatRec
              { src :: MediumLevelILSSAInstruction
src = MediumLevelILSSAInstruction
src',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ Arithmetic $ MediumLevelILIntToFloat rec
    BNMediumLevelILOperation
MLIL_FLOAT_CONV -> do
      src' <- BNMlilSSAFunctionPtr -> CSize -> IO MediumLevelILSSAInstruction
getExpr BNMlilSSAFunctionPtr
func (CSize -> IO MediumLevelILSSAInstruction)
-> CSize -> IO MediumLevelILSSAInstruction
forall a b. (a -> b) -> a -> b
$ BNMediumLevelILInstruction -> CSize -> CSize
getOp BNMediumLevelILInstruction
rawInst CSize
0
      let rec =
            MediumLevelILFloatConvRec
              { src :: MediumLevelILSSAInstruction
src = MediumLevelILSSAInstruction
src',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ Arithmetic $ MediumLevelILFloatConv rec
    BNMediumLevelILOperation
MLIL_ROUND_TO_INT -> do
      src' <- BNMlilSSAFunctionPtr -> CSize -> IO MediumLevelILSSAInstruction
getExpr BNMlilSSAFunctionPtr
func (CSize -> IO MediumLevelILSSAInstruction)
-> CSize -> IO MediumLevelILSSAInstruction
forall a b. (a -> b) -> a -> b
$ BNMediumLevelILInstruction -> CSize -> CSize
getOp BNMediumLevelILInstruction
rawInst CSize
0
      let rec =
            MediumLevelILRoundToIntRec
              { src :: MediumLevelILSSAInstruction
src = MediumLevelILSSAInstruction
src',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ Arithmetic $ MediumLevelILRoundToInt rec
    BNMediumLevelILOperation
MLIL_FLOOR -> do
      src' <- BNMlilSSAFunctionPtr -> CSize -> IO MediumLevelILSSAInstruction
getExpr BNMlilSSAFunctionPtr
func (CSize -> IO MediumLevelILSSAInstruction)
-> CSize -> IO MediumLevelILSSAInstruction
forall a b. (a -> b) -> a -> b
$ BNMediumLevelILInstruction -> CSize -> CSize
getOp BNMediumLevelILInstruction
rawInst CSize
0
      let rec =
            MediumLevelILFloorRec
              { src :: MediumLevelILSSAInstruction
src = MediumLevelILSSAInstruction
src',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ Arithmetic $ MediumLevelILFloor rec
    BNMediumLevelILOperation
MLIL_CEIL -> do
      src' <- BNMlilSSAFunctionPtr -> CSize -> IO MediumLevelILSSAInstruction
getExpr BNMlilSSAFunctionPtr
func (CSize -> IO MediumLevelILSSAInstruction)
-> CSize -> IO MediumLevelILSSAInstruction
forall a b. (a -> b) -> a -> b
$ BNMediumLevelILInstruction -> CSize -> CSize
getOp BNMediumLevelILInstruction
rawInst CSize
0
      let rec =
            MediumLevelILCeilRec
              { src :: MediumLevelILSSAInstruction
src = MediumLevelILSSAInstruction
src',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ Arithmetic $ MediumLevelILCeil rec
    BNMediumLevelILOperation
MLIL_FTRUNC -> do
      src' <- BNMlilSSAFunctionPtr -> CSize -> IO MediumLevelILSSAInstruction
getExpr BNMlilSSAFunctionPtr
func (CSize -> IO MediumLevelILSSAInstruction)
-> CSize -> IO MediumLevelILSSAInstruction
forall a b. (a -> b) -> a -> b
$ BNMediumLevelILInstruction -> CSize -> CSize
getOp BNMediumLevelILInstruction
rawInst CSize
0
      let rec =
            MediumLevelILFtruncRec
              { src :: MediumLevelILSSAInstruction
src = MediumLevelILSSAInstruction
src',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ Arithmetic $ MediumLevelILFtrunc rec
    BNMediumLevelILOperation
MLIL_FCMP_E -> do
      left' <- BNMlilSSAFunctionPtr -> CSize -> IO MediumLevelILSSAInstruction
getExpr BNMlilSSAFunctionPtr
func (CSize -> IO MediumLevelILSSAInstruction)
-> CSize -> IO MediumLevelILSSAInstruction
forall a b. (a -> b) -> a -> b
$ BNMediumLevelILInstruction -> CSize -> CSize
getOp BNMediumLevelILInstruction
rawInst CSize
0
      right' <- getExpr func $ getOp rawInst 1
      let rec =
            MediumLevelILFcmpERec
              { left :: MediumLevelILSSAInstruction
left = MediumLevelILSSAInstruction
left',
                right :: MediumLevelILSSAInstruction
right = MediumLevelILSSAInstruction
right',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ Comparison $ MediumLevelILFcmpE rec
    BNMediumLevelILOperation
MLIL_FCMP_NE -> do
      left' <- BNMlilSSAFunctionPtr -> CSize -> IO MediumLevelILSSAInstruction
getExpr BNMlilSSAFunctionPtr
func (CSize -> IO MediumLevelILSSAInstruction)
-> CSize -> IO MediumLevelILSSAInstruction
forall a b. (a -> b) -> a -> b
$ BNMediumLevelILInstruction -> CSize -> CSize
getOp BNMediumLevelILInstruction
rawInst CSize
0
      right' <- getExpr func $ getOp rawInst 1
      let rec =
            MediumLevelILFcmpNeRec
              { left :: MediumLevelILSSAInstruction
left = MediumLevelILSSAInstruction
left',
                right :: MediumLevelILSSAInstruction
right = MediumLevelILSSAInstruction
right',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ Comparison $ MediumLevelILFcmpNe rec
    BNMediumLevelILOperation
MLIL_FCMP_LT -> do
      left' <- BNMlilSSAFunctionPtr -> CSize -> IO MediumLevelILSSAInstruction
getExpr BNMlilSSAFunctionPtr
func (CSize -> IO MediumLevelILSSAInstruction)
-> CSize -> IO MediumLevelILSSAInstruction
forall a b. (a -> b) -> a -> b
$ BNMediumLevelILInstruction -> CSize -> CSize
getOp BNMediumLevelILInstruction
rawInst CSize
0
      right' <- getExpr func $ getOp rawInst 1
      let rec =
            MediumLevelILFcmpLtRec
              { left :: MediumLevelILSSAInstruction
left = MediumLevelILSSAInstruction
left',
                right :: MediumLevelILSSAInstruction
right = MediumLevelILSSAInstruction
right',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ Comparison $ MediumLevelILFcmpLt rec
    BNMediumLevelILOperation
MLIL_FCMP_LE -> do
      left' <- BNMlilSSAFunctionPtr -> CSize -> IO MediumLevelILSSAInstruction
getExpr BNMlilSSAFunctionPtr
func (CSize -> IO MediumLevelILSSAInstruction)
-> CSize -> IO MediumLevelILSSAInstruction
forall a b. (a -> b) -> a -> b
$ BNMediumLevelILInstruction -> CSize -> CSize
getOp BNMediumLevelILInstruction
rawInst CSize
0
      right' <- getExpr func $ getOp rawInst 1
      let rec =
            MediumLevelILFcmpLeRec
              { left :: MediumLevelILSSAInstruction
left = MediumLevelILSSAInstruction
left',
                right :: MediumLevelILSSAInstruction
right = MediumLevelILSSAInstruction
right',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ Comparison $ MediumLevelILFcmpLe rec
    BNMediumLevelILOperation
MLIL_FCMP_GE -> do
      left' <- BNMlilSSAFunctionPtr -> CSize -> IO MediumLevelILSSAInstruction
getExpr BNMlilSSAFunctionPtr
func (CSize -> IO MediumLevelILSSAInstruction)
-> CSize -> IO MediumLevelILSSAInstruction
forall a b. (a -> b) -> a -> b
$ BNMediumLevelILInstruction -> CSize -> CSize
getOp BNMediumLevelILInstruction
rawInst CSize
0
      right' <- getExpr func $ getOp rawInst 1
      let rec =
            MediumLevelILFcmpGeRec
              { left :: MediumLevelILSSAInstruction
left = MediumLevelILSSAInstruction
left',
                right :: MediumLevelILSSAInstruction
right = MediumLevelILSSAInstruction
right',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ Comparison $ MediumLevelILFcmpGe rec
    BNMediumLevelILOperation
MLIL_FCMP_GT -> do
      left' <- BNMlilSSAFunctionPtr -> CSize -> IO MediumLevelILSSAInstruction
getExpr BNMlilSSAFunctionPtr
func (CSize -> IO MediumLevelILSSAInstruction)
-> CSize -> IO MediumLevelILSSAInstruction
forall a b. (a -> b) -> a -> b
$ BNMediumLevelILInstruction -> CSize -> CSize
getOp BNMediumLevelILInstruction
rawInst CSize
0
      right' <- getExpr func $ getOp rawInst 1
      let rec =
            MediumLevelILFcmpGtRec
              { left :: MediumLevelILSSAInstruction
left = MediumLevelILSSAInstruction
left',
                right :: MediumLevelILSSAInstruction
right = MediumLevelILSSAInstruction
right',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ Comparison $ MediumLevelILFcmpGt rec
    BNMediumLevelILOperation
MLIL_FCMP_O -> do
      left' <- BNMlilSSAFunctionPtr -> CSize -> IO MediumLevelILSSAInstruction
getExpr BNMlilSSAFunctionPtr
func (CSize -> IO MediumLevelILSSAInstruction)
-> CSize -> IO MediumLevelILSSAInstruction
forall a b. (a -> b) -> a -> b
$ BNMediumLevelILInstruction -> CSize -> CSize
getOp BNMediumLevelILInstruction
rawInst CSize
0
      right' <- getExpr func $ getOp rawInst 1
      let rec =
            MediumLevelILFcmpORec
              { left :: MediumLevelILSSAInstruction
left = MediumLevelILSSAInstruction
left',
                right :: MediumLevelILSSAInstruction
right = MediumLevelILSSAInstruction
right',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ Comparison $ MediumLevelILFcmpO rec
    BNMediumLevelILOperation
MLIL_FCMP_UO -> do
      left' <- BNMlilSSAFunctionPtr -> CSize -> IO MediumLevelILSSAInstruction
getExpr BNMlilSSAFunctionPtr
func (CSize -> IO MediumLevelILSSAInstruction)
-> CSize -> IO MediumLevelILSSAInstruction
forall a b. (a -> b) -> a -> b
$ BNMediumLevelILInstruction -> CSize -> CSize
getOp BNMediumLevelILInstruction
rawInst CSize
0
      right' <- getExpr func $ getOp rawInst 1
      let rec =
            MediumLevelILFcmpUoRec
              { left :: MediumLevelILSSAInstruction
left = MediumLevelILSSAInstruction
left',
                right :: MediumLevelILSSAInstruction
right = MediumLevelILSSAInstruction
right',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ Comparison $ MediumLevelILFcmpUo rec
    BNMediumLevelILOperation
MLIL_SET_VAR_SSA -> do
      dest' <- BNMediumLevelILInstruction -> CSize -> CSize -> IO BNSSAVariable
getSSAVar BNMediumLevelILInstruction
rawInst CSize
0 CSize
1
      src' <- getExpr func $ getOp rawInst 2
      let rec =
            MediumLevelILSetVarSsaRec
              { dest :: BNSSAVariable
dest = BNSSAVariable
dest',
                src :: MediumLevelILSSAInstruction
src = MediumLevelILSSAInstruction
src',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ SetVar $ MediumLevelILSetVarSsa rec
    BNMediumLevelILOperation
MLIL_SET_VAR_SSA_FIELD -> do
      dest' <- BNMediumLevelILInstruction -> CSize -> CSize -> IO BNSSAVariable
getSSAVarAndDest BNMediumLevelILInstruction
rawInst CSize
0 CSize
1
      prev' <- getSSAVarAndDest rawInst 0 2
      offset' <- getInt rawInst 3
      src' <- getExpr func $ getOp rawInst 4
      let rec =
            MediumLevelILSetVarSsaFieldRec
              { dest :: BNSSAVariable
dest = BNSSAVariable
dest',
                prev :: BNSSAVariable
prev = BNSSAVariable
prev',
                offset :: Int
offset = Int
offset',
                src :: MediumLevelILSSAInstruction
src = MediumLevelILSSAInstruction
src',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ SetVar $ MediumLevelILSetVarSsaField rec
    BNMediumLevelILOperation
MLIL_SET_VAR_SPLIT_SSA -> do
      high' <- BNMediumLevelILInstruction -> CSize -> CSize -> IO BNSSAVariable
getSSAVar BNMediumLevelILInstruction
rawInst CSize
0 CSize
1
      low' <- getSSAVar rawInst 2 3
      src' <- getExpr func $ getOp rawInst 4
      let rec =
            MediumLevelILSetVarSplitSsaRec
              { high :: BNSSAVariable
high = BNSSAVariable
high',
                low :: BNSSAVariable
low = BNSSAVariable
low',
                src :: MediumLevelILSSAInstruction
src = MediumLevelILSSAInstruction
src',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ SetVar $ MediumLevelILSetVarSplitSsa rec
    BNMediumLevelILOperation
MLIL_SET_VAR_ALIASED -> do
      dest' <- BNMediumLevelILInstruction -> CSize -> CSize -> IO BNSSAVariable
getSSAVarAndDest BNMediumLevelILInstruction
rawInst CSize
0 CSize
1
      prev' <- getSSAVarAndDest rawInst 0 2
      src' <- getExpr func $ getOp rawInst 3
      let rec =
            MediumLevelILSetVarAliasedRec
              { dest :: BNSSAVariable
dest = BNSSAVariable
dest',
                prev :: BNSSAVariable
prev = BNSSAVariable
prev',
                src :: MediumLevelILSSAInstruction
src = MediumLevelILSSAInstruction
src',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ SetVar $ MediumLevelILSetVarAliased rec
    BNMediumLevelILOperation
MLIL_SET_VAR_ALIASED_FIELD -> do
      dest' <- BNMediumLevelILInstruction -> CSize -> CSize -> IO BNSSAVariable
getSSAVarAndDest BNMediumLevelILInstruction
rawInst CSize
0 CSize
1
      prev' <- getSSAVarAndDest rawInst 0 2
      offset' <- getInt rawInst 3
      src' <- getExpr func $ getOp rawInst 4
      let rec =
            MediumLevelILSetVarAliasedFieldRec
              { dest :: BNSSAVariable
dest = BNSSAVariable
dest',
                prev :: BNSSAVariable
prev = BNSSAVariable
prev',
                offset :: Int
offset = Int
offset',
                src :: MediumLevelILSSAInstruction
src = MediumLevelILSSAInstruction
src',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ SetVar $ MediumLevelILSetVarAliasedField rec
    BNMediumLevelILOperation
MLIL_VAR_SSA -> do
      src' <- BNMediumLevelILInstruction -> CSize -> CSize -> IO BNSSAVariable
getSSAVar BNMediumLevelILInstruction
rawInst CSize
0 CSize
1
      let rec =
            MediumLevelILVarSsaRec
              { src :: BNSSAVariable
src = BNSSAVariable
src',
                var :: BNSSAVariable
var = BNSSAVariable
src',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ VariableInstruction $ MediumLevelILVarSsa rec
    BNMediumLevelILOperation
MLIL_VAR_SSA_FIELD -> do
      src' <- BNMediumLevelILInstruction -> CSize -> CSize -> IO BNSSAVariable
getSSAVar BNMediumLevelILInstruction
rawInst CSize
0 CSize
1
      offset' <- getInt rawInst 2
      let rec =
            MediumLevelILVarSsaFieldRec
              { src :: BNSSAVariable
src = BNSSAVariable
src',
                offset :: Int
offset = Int
offset',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ VariableInstruction $ MediumLevelILVarSsaField rec
    BNMediumLevelILOperation
MLIL_VAR_ALIASED -> do
      src' <- BNMediumLevelILInstruction -> CSize -> CSize -> IO BNSSAVariable
getSSAVar BNMediumLevelILInstruction
rawInst CSize
0 CSize
1
      let rec =
            MediumLevelILVarAliasedRec
              { src :: BNSSAVariable
src = BNSSAVariable
src',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ VariableInstruction $ MediumLevelILVarAliased rec
    BNMediumLevelILOperation
MLIL_VAR_ALIASED_FIELD -> do
      src' <- BNMediumLevelILInstruction -> CSize -> CSize -> IO BNSSAVariable
getSSAVar BNMediumLevelILInstruction
rawInst CSize
0 CSize
1
      offset' <- getInt rawInst 2
      let rec =
            MediumLevelILVarAliasedFieldRec
              { src :: BNSSAVariable
src = BNSSAVariable
src',
                offset :: Int
offset = Int
offset',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ VariableInstruction $ MediumLevelILVarAliasedField rec
    BNMediumLevelILOperation
MLIL_VAR_SPLIT_SSA -> do
      high' <- BNMediumLevelILInstruction -> CSize -> CSize -> IO BNSSAVariable
getSSAVar BNMediumLevelILInstruction
rawInst CSize
0 CSize
1
      low' <- getSSAVar rawInst 2 3
      let rec =
            MediumLevelILVarSplitSsaRec
              { high :: BNSSAVariable
high = BNSSAVariable
high',
                low :: BNSSAVariable
low = BNSSAVariable
low',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ VariableInstruction $ MediumLevelILVarSplitSsa rec
    BNMediumLevelILOperation
MLIL_ASSERT_SSA -> do
      src' <- BNMediumLevelILInstruction -> CSize -> CSize -> IO BNSSAVariable
getSSAVar BNMediumLevelILInstruction
rawInst CSize
0 CSize
1
      constraint' <- getConstraint func rawInst 2
      let rec =
            MediumLevelILAssertSsaRec
              { src :: BNSSAVariable
src = BNSSAVariable
src',
                constraint :: BNPossibleValueSet
constraint = BNPossibleValueSet
constraint',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ MediumLevelILAssertSsa rec
    BNMediumLevelILOperation
MLIL_FORCE_VER_SSA -> do
      dest' <- BNMediumLevelILInstruction -> CSize -> CSize -> IO BNSSAVariable
getSSAVar BNMediumLevelILInstruction
rawInst CSize
0 CSize
1
      src' <- getSSAVar rawInst 2 3
      let rec =
            MediumLevelILForceVerSsaRec
              { dest :: BNSSAVariable
dest = BNSSAVariable
dest',
                src :: BNSSAVariable
src = BNSSAVariable
src',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ MediumLevelILForceVerSsa rec
    BNMediumLevelILOperation
MLIL_CALL_SSA -> do
      outputInst <- BNMlilSSAFunctionPtr -> CSize -> IO MediumLevelILSSAInstruction
getExpr BNMlilSSAFunctionPtr
func (CSize -> IO MediumLevelILSSAInstruction)
-> CSize -> IO MediumLevelILSSAInstruction
forall a b. (a -> b) -> a -> b
$ BNMediumLevelILInstruction -> CSize -> CSize
getOp BNMediumLevelILInstruction
rawInst CSize
0
      output' <- case outputInst of
        MediumLevelILCallOutputSsa (MediumLevelILCallOutputSsaRec {dest :: MediumLevelILCallOutputSsaRec -> [BNSSAVariable]
dest = [BNSSAVariable]
d}) -> [BNSSAVariable] -> IO [BNSSAVariable]
forall a. a -> IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure [BNSSAVariable]
d
        MediumLevelILSSAInstruction
_ ->
          [Char] -> IO [BNSSAVariable]
forall a. HasCallStack => [Char] -> a
error ([Char] -> IO [BNSSAVariable]) -> [Char] -> IO [BNSSAVariable]
forall a b. (a -> b) -> a -> b
$
            [Char]
"create: Output of MediumLevelILCallSsa: expected MediumLevelILCallOutputSsa : "
              [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ MediumLevelILSSAInstruction -> [Char]
forall a. Show a => a -> [Char]
show MediumLevelILSSAInstruction
outputInst
      dest' <- getExpr func $ getOp rawInst 1
      params' <- getExprList func exprIndex' 2
      srcMemory' <- getInt rawInst 4
      let rec =
            MediumLevelILCallSsaRec
              { output :: [BNSSAVariable]
output = [BNSSAVariable]
output',
                dest :: MediumLevelILSSAInstruction
dest = MediumLevelILSSAInstruction
dest',
                params :: [MediumLevelILSSAInstruction]
params = [MediumLevelILSSAInstruction]
params',
                srcMemory :: Int
srcMemory = Int
srcMemory',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ Localcall $ MediumLevelILCallSsa rec
    BNMediumLevelILOperation
MLIL_CALL_UNTYPED_SSA -> do
      outputInst <- BNMlilSSAFunctionPtr -> CSize -> IO MediumLevelILSSAInstruction
getExpr BNMlilSSAFunctionPtr
func (CSize -> IO MediumLevelILSSAInstruction)
-> CSize -> IO MediumLevelILSSAInstruction
forall a b. (a -> b) -> a -> b
$ BNMediumLevelILInstruction -> CSize -> CSize
getOp BNMediumLevelILInstruction
rawInst CSize
0
      output' <- case outputInst of
        MediumLevelILCallOutputSsa (MediumLevelILCallOutputSsaRec {dest :: MediumLevelILCallOutputSsaRec -> [BNSSAVariable]
dest = [BNSSAVariable]
d}) -> [BNSSAVariable] -> IO [BNSSAVariable]
forall a. a -> IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure [BNSSAVariable]
d
        MediumLevelILSSAInstruction
_ ->
          [Char] -> IO [BNSSAVariable]
forall a. HasCallStack => [Char] -> a
error ([Char] -> IO [BNSSAVariable]) -> [Char] -> IO [BNSSAVariable]
forall a b. (a -> b) -> a -> b
$
            [Char]
"create: Output of MediumLevelILCallUntypedSsa: expected MediumLevelILCallOutputSsa : "
              [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ MediumLevelILSSAInstruction -> [Char]
forall a. Show a => a -> [Char]
show MediumLevelILSSAInstruction
outputInst
      outputDestMemory' <- case outputInst of
        MediumLevelILCallOutputSsa (MediumLevelILCallOutputSsaRec {destMemory :: MediumLevelILCallOutputSsaRec -> Int
destMemory = Int
d}) -> Int -> IO Int
forall a. a -> IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Int
d
        MediumLevelILSSAInstruction
_ ->
          [Char] -> IO Int
forall a. HasCallStack => [Char] -> a
error ([Char] -> IO Int) -> [Char] -> IO Int
forall a b. (a -> b) -> a -> b
$
            [Char]
"create: Output of MediumLevelILCallUntypedSsa: expected MediumLevelILCallOutputSsa : "
              [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ MediumLevelILSSAInstruction -> [Char]
forall a. Show a => a -> [Char]
show MediumLevelILSSAInstruction
outputInst
      dest' <- getExpr func $ getOp rawInst 1
      paramsInst <- getExpr func $ getOp rawInst 2
      (params', paramsSrcMemory') <- case paramsInst of
        MediumLevelILCallParamSsa (MediumLevelILCallParamSsaRec {src :: MediumLevelILCallParamSsaRec -> [MediumLevelILSSAInstruction]
src = [MediumLevelILSSAInstruction]
s', srcMemory :: MediumLevelILCallParamSsaRec -> Int
srcMemory = Int
sm'}) -> ([MediumLevelILSSAInstruction], Int)
-> IO ([MediumLevelILSSAInstruction], Int)
forall a. a -> IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure ([MediumLevelILSSAInstruction]
s', Int
sm')
        MediumLevelILSSAInstruction
_ ->
          [Char] -> IO ([MediumLevelILSSAInstruction], Int)
forall a. HasCallStack => [Char] -> a
error ([Char] -> IO ([MediumLevelILSSAInstruction], Int))
-> [Char] -> IO ([MediumLevelILSSAInstruction], Int)
forall a b. (a -> b) -> a -> b
$
            [Char]
"create: Params of MediumLevelILCallUntypedSsa: expected MediumLevelILCallParamsSsa : "
              [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ MediumLevelILSSAInstruction -> [Char]
forall a. Show a => a -> [Char]
show MediumLevelILSSAInstruction
outputInst
      stack' <- getExpr func $ getOp rawInst 3
      let rec =
            MediumLevelILCallUntypedSsaRec
              { output :: [BNSSAVariable]
output = [BNSSAVariable]
output',
                outputDestMemory :: Int
outputDestMemory = Int
outputDestMemory',
                dest :: MediumLevelILSSAInstruction
dest = MediumLevelILSSAInstruction
dest',
                params :: [MediumLevelILSSAInstruction]
params = [MediumLevelILSSAInstruction]
params',
                paramsSrcMemory :: Int
paramsSrcMemory = Int
paramsSrcMemory',
                stack :: MediumLevelILSSAInstruction
stack = MediumLevelILSSAInstruction
stack',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ Localcall $ MediumLevelILCallUntypedSsa rec
    BNMediumLevelILOperation
MLIL_SYSCALL_SSA -> do
      outputInst <- BNMlilSSAFunctionPtr -> CSize -> IO MediumLevelILSSAInstruction
getExpr BNMlilSSAFunctionPtr
func (CSize -> IO MediumLevelILSSAInstruction)
-> CSize -> IO MediumLevelILSSAInstruction
forall a b. (a -> b) -> a -> b
$ BNMediumLevelILInstruction -> CSize -> CSize
getOp BNMediumLevelILInstruction
rawInst CSize
0
      (output', outputDestMemory') <- case outputInst of
        MediumLevelILCallOutputSsa (MediumLevelILCallOutputSsaRec {dest :: MediumLevelILCallOutputSsaRec -> [BNSSAVariable]
dest = [BNSSAVariable]
d, destMemory :: MediumLevelILCallOutputSsaRec -> Int
destMemory = Int
dm}) -> ([BNSSAVariable], Int) -> IO ([BNSSAVariable], Int)
forall a. a -> IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure ([BNSSAVariable]
d, Int
dm)
        MediumLevelILSSAInstruction
_ ->
          [Char] -> IO ([BNSSAVariable], Int)
forall a. HasCallStack => [Char] -> a
error ([Char] -> IO ([BNSSAVariable], Int))
-> [Char] -> IO ([BNSSAVariable], Int)
forall a b. (a -> b) -> a -> b
$
            [Char]
"create: Output of MediumLevelILSyscallSsa: expected MediumLevelILCallOutputSsa : "
              [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ MediumLevelILSSAInstruction -> [Char]
forall a. Show a => a -> [Char]
show MediumLevelILSSAInstruction
outputInst
      params' <- getExprList func exprIndex' 1
      srcMemory' <- getInt rawInst 3
      let rec =
            MediumLevelILSyscallSsaRec
              { output :: [BNSSAVariable]
output = [BNSSAVariable]
output',
                outputDestMemory :: Int
outputDestMemory = Int
outputDestMemory',
                params :: [MediumLevelILSSAInstruction]
params = [MediumLevelILSSAInstruction]
params',
                srcMemory :: Int
srcMemory = Int
srcMemory',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ Syscall $ MediumLevelILSyscallSsa rec
    BNMediumLevelILOperation
MLIL_SYSCALL_UNTYPED_SSA -> do
      outputInst <- BNMlilSSAFunctionPtr -> CSize -> IO MediumLevelILSSAInstruction
getExpr BNMlilSSAFunctionPtr
func (CSize -> IO MediumLevelILSSAInstruction)
-> CSize -> IO MediumLevelILSSAInstruction
forall a b. (a -> b) -> a -> b
$ BNMediumLevelILInstruction -> CSize -> CSize
getOp BNMediumLevelILInstruction
rawInst CSize
0
      (output', outputDestMemory') <- case outputInst of
        MediumLevelILCallOutputSsa (MediumLevelILCallOutputSsaRec {dest :: MediumLevelILCallOutputSsaRec -> [BNSSAVariable]
dest = [BNSSAVariable]
d, destMemory :: MediumLevelILCallOutputSsaRec -> Int
destMemory = Int
dm}) -> ([BNSSAVariable], Int) -> IO ([BNSSAVariable], Int)
forall a. a -> IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure ([BNSSAVariable]
d, Int
dm)
        MediumLevelILSSAInstruction
_ ->
          [Char] -> IO ([BNSSAVariable], Int)
forall a. HasCallStack => [Char] -> a
error ([Char] -> IO ([BNSSAVariable], Int))
-> [Char] -> IO ([BNSSAVariable], Int)
forall a b. (a -> b) -> a -> b
$
            [Char]
"create: Output of MediumLevelILSyscallUntypedSsa: expected MediumLevelILCallOutputSsa : "
              [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ MediumLevelILSSAInstruction -> [Char]
forall a. Show a => a -> [Char]
show MediumLevelILSSAInstruction
outputInst
      paramInst <- getExpr func $ getOp rawInst 1
      (params', paramsSrcMemory') <- case paramInst of
        MediumLevelILCallParamSsa (MediumLevelILCallParamSsaRec {src :: MediumLevelILCallParamSsaRec -> [MediumLevelILSSAInstruction]
src = [MediumLevelILSSAInstruction]
p, srcMemory :: MediumLevelILCallParamSsaRec -> Int
srcMemory = Int
psm}) -> ([MediumLevelILSSAInstruction], Int)
-> IO ([MediumLevelILSSAInstruction], Int)
forall a. a -> IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure ([MediumLevelILSSAInstruction]
p, Int
psm)
        MediumLevelILSSAInstruction
_ ->
          [Char] -> IO ([MediumLevelILSSAInstruction], Int)
forall a. HasCallStack => [Char] -> a
error ([Char] -> IO ([MediumLevelILSSAInstruction], Int))
-> [Char] -> IO ([MediumLevelILSSAInstruction], Int)
forall a b. (a -> b) -> a -> b
$
            [Char]
"create: Params of MediumLevelILCallOutputSsa: expected MediumLevelILCallParamSsa : "
              [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ MediumLevelILSSAInstruction -> [Char]
forall a. Show a => a -> [Char]
show MediumLevelILSSAInstruction
paramInst
      stack' <- getExpr func $ getOp rawInst 2
      let rec =
            MediumLevelILSyscallUntypedSsaRec
              { output :: [BNSSAVariable]
output = [BNSSAVariable]
output',
                outputDestMemory :: Int
outputDestMemory = Int
outputDestMemory',
                params :: [MediumLevelILSSAInstruction]
params = [MediumLevelILSSAInstruction]
params',
                paramsSrcMemory :: Int
paramsSrcMemory = Int
paramsSrcMemory',
                stack :: MediumLevelILSSAInstruction
stack = MediumLevelILSSAInstruction
stack',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ Syscall $ MediumLevelILSyscallUntypedSsa rec
    BNMediumLevelILOperation
MLIL_TAILCALL_SSA -> do
      outputInst <- BNMlilSSAFunctionPtr -> CSize -> IO MediumLevelILSSAInstruction
getExpr BNMlilSSAFunctionPtr
func (CSize -> IO MediumLevelILSSAInstruction)
-> CSize -> IO MediumLevelILSSAInstruction
forall a b. (a -> b) -> a -> b
$ BNMediumLevelILInstruction -> CSize -> CSize
getOp BNMediumLevelILInstruction
rawInst CSize
0
      (output', outputDestMemory') <- case outputInst of
        MediumLevelILCallOutputSsa (MediumLevelILCallOutputSsaRec {dest :: MediumLevelILCallOutputSsaRec -> [BNSSAVariable]
dest = [BNSSAVariable]
d, destMemory :: MediumLevelILCallOutputSsaRec -> Int
destMemory = Int
dM}) -> ([BNSSAVariable], Int) -> IO ([BNSSAVariable], Int)
forall a. a -> IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure ([BNSSAVariable]
d, Int
dM)
        MediumLevelILSSAInstruction
_ ->
          [Char] -> IO ([BNSSAVariable], Int)
forall a. HasCallStack => [Char] -> a
error ([Char] -> IO ([BNSSAVariable], Int))
-> [Char] -> IO ([BNSSAVariable], Int)
forall a b. (a -> b) -> a -> b
$
            [Char]
"create: Output of MediumLevelILTailcallSsa: expected MediumLevelILCallOutputSsa : "
              [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ MediumLevelILSSAInstruction -> [Char]
forall a. Show a => a -> [Char]
show MediumLevelILSSAInstruction
outputInst
      dest' <- getExpr func $ getOp rawInst 1
      params' <- getExprList func exprIndex' 2
      srcMemory' <- getInt rawInst 4
      let rec =
            MediumLevelILTailcallSsaRec
              { output :: [BNSSAVariable]
output = [BNSSAVariable]
output',
                outputDestMemory :: Int
outputDestMemory = Int
outputDestMemory',
                dest :: MediumLevelILSSAInstruction
dest = MediumLevelILSSAInstruction
dest',
                params :: [MediumLevelILSSAInstruction]
params = [MediumLevelILSSAInstruction]
params',
                srcMemory :: Int
srcMemory = Int
srcMemory',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ Tailcall $ MediumLevelILTailcallSsa rec
    BNMediumLevelILOperation
MLIL_TAILCALL_UNTYPED_SSA -> do
      outputInst <- BNMlilSSAFunctionPtr -> CSize -> IO MediumLevelILSSAInstruction
getExpr BNMlilSSAFunctionPtr
func (CSize -> IO MediumLevelILSSAInstruction)
-> CSize -> IO MediumLevelILSSAInstruction
forall a b. (a -> b) -> a -> b
$ BNMediumLevelILInstruction -> CSize -> CSize
getOp BNMediumLevelILInstruction
rawInst CSize
0
      (output', outputDestMemory') <- case outputInst of
        MediumLevelILCallOutputSsa (MediumLevelILCallOutputSsaRec {dest :: MediumLevelILCallOutputSsaRec -> [BNSSAVariable]
dest = [BNSSAVariable]
d, destMemory :: MediumLevelILCallOutputSsaRec -> Int
destMemory = Int
dM}) -> ([BNSSAVariable], Int) -> IO ([BNSSAVariable], Int)
forall a. a -> IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure ([BNSSAVariable]
d, Int
dM)
        MediumLevelILSSAInstruction
_ ->
          [Char] -> IO ([BNSSAVariable], Int)
forall a. HasCallStack => [Char] -> a
error ([Char] -> IO ([BNSSAVariable], Int))
-> [Char] -> IO ([BNSSAVariable], Int)
forall a b. (a -> b) -> a -> b
$
            [Char]
"create: Output of MediumLevelILTailcallSsa: expected MediumLevelILCallOutputSsa : "
              [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ MediumLevelILSSAInstruction -> [Char]
forall a. Show a => a -> [Char]
show MediumLevelILSSAInstruction
outputInst
      dest' <- getExpr func $ getOp rawInst 1
      paramInst <- getExpr func $ getOp rawInst 2
      params' <- case paramInst of
        MediumLevelILCallParamSsa (MediumLevelILCallParamSsaRec {src :: MediumLevelILCallParamSsaRec -> [MediumLevelILSSAInstruction]
src = [MediumLevelILSSAInstruction]
p}) -> [MediumLevelILSSAInstruction] -> IO [MediumLevelILSSAInstruction]
forall a. a -> IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure [MediumLevelILSSAInstruction]
p
        MediumLevelILSSAInstruction
_ ->
          [Char] -> IO [MediumLevelILSSAInstruction]
forall a. HasCallStack => [Char] -> a
error ([Char] -> IO [MediumLevelILSSAInstruction])
-> [Char] -> IO [MediumLevelILSSAInstruction]
forall a b. (a -> b) -> a -> b
$
            [Char]
"create: Params of MediumLevelILCallOutputSsa: expected MediumLevelILCallParamSsa : "
              [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ MediumLevelILSSAInstruction -> [Char]
forall a. Show a => a -> [Char]
show MediumLevelILSSAInstruction
paramInst
      stack' <- getExpr func $ getOp rawInst 3
      let rec =
            MediumLevelILTailcallUntypedSsaRec
              { output :: [BNSSAVariable]
output = [BNSSAVariable]
output',
                outputDestMemory :: Int
outputDestMemory = Int
outputDestMemory',
                dest :: MediumLevelILSSAInstruction
dest = MediumLevelILSSAInstruction
dest',
                params :: [MediumLevelILSSAInstruction]
params = [MediumLevelILSSAInstruction]
params',
                stack :: MediumLevelILSSAInstruction
stack = MediumLevelILSSAInstruction
stack',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ Tailcall $ MediumLevelILTailcallUntypedSsa rec
    BNMediumLevelILOperation
MLIL_CALL_PARAM_SSA -> do
      srcMemory' <- BNMediumLevelILInstruction -> CSize -> IO Int
getInt BNMediumLevelILInstruction
rawInst CSize
0
      src' <- getExprList func exprIndex' 1
      let rec =
            MediumLevelILCallParamSsaRec
              { srcMemory :: Int
srcMemory = Int
srcMemory',
                src :: [MediumLevelILSSAInstruction]
src = [MediumLevelILSSAInstruction]
src',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ MediumLevelILCallParamSsa rec
    BNMediumLevelILOperation
MLIL_CALL_OUTPUT_SSA -> do
      destMemory' <- BNMediumLevelILInstruction -> CSize -> IO Int
getInt BNMediumLevelILInstruction
rawInst CSize
0
      dest' <- getSSAVarList func exprIndex' 1
      let rec =
            MediumLevelILCallOutputSsaRec
              { destMemory :: Int
destMemory = Int
destMemory',
                dest :: [BNSSAVariable]
dest = [BNSSAVariable]
dest',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ MediumLevelILCallOutputSsa rec
    BNMediumLevelILOperation
MLIL_MEMORY_INTRINSIC_OUTPUT_SSA -> do
      destMemory' <- BNMediumLevelILInstruction -> CSize -> IO Int
getInt BNMediumLevelILInstruction
rawInst CSize
0
      output' <- getSSAVarList func exprIndex' 1
      let rec =
            MediumLevelILMemoryIntrinsicOutputSsaRec
              { destMemory :: Int
destMemory = Int
destMemory',
                output :: [BNSSAVariable]
output = [BNSSAVariable]
output',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ MediumLevelILMemoryIntrinsicOutputSsa rec
    BNMediumLevelILOperation
MLIL_LOAD_SSA -> do
      src' <- BNMlilSSAFunctionPtr -> CSize -> IO MediumLevelILSSAInstruction
getExpr BNMlilSSAFunctionPtr
func (CSize -> IO MediumLevelILSSAInstruction)
-> CSize -> IO MediumLevelILSSAInstruction
forall a b. (a -> b) -> a -> b
$ BNMediumLevelILInstruction -> CSize -> CSize
getOp BNMediumLevelILInstruction
rawInst CSize
0
      srcMemory' <- getInt rawInst 1
      let rec =
            MediumLevelILLoadSsaRec
              { src :: MediumLevelILSSAInstruction
src = MediumLevelILSSAInstruction
src',
                srcMemory :: Int
srcMemory = Int
srcMemory',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ Load $ MediumLevelILLoadSsa rec
    BNMediumLevelILOperation
MLIL_LOAD_STRUCT_SSA -> do
      src' <- BNMlilSSAFunctionPtr -> CSize -> IO MediumLevelILSSAInstruction
getExpr BNMlilSSAFunctionPtr
func (CSize -> IO MediumLevelILSSAInstruction)
-> CSize -> IO MediumLevelILSSAInstruction
forall a b. (a -> b) -> a -> b
$ BNMediumLevelILInstruction -> CSize -> CSize
getOp BNMediumLevelILInstruction
rawInst CSize
0
      offset' <- getInt rawInst 1
      srcMemory' <- getInt rawInst 2
      let rec =
            MediumLevelILLoadStructSsaRec
              { src :: MediumLevelILSSAInstruction
src = MediumLevelILSSAInstruction
src',
                offset :: Int
offset = Int
offset',
                srcMemory :: Int
srcMemory = Int
srcMemory',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ Load $ MediumLevelILLoadStructSsa rec
    BNMediumLevelILOperation
MLIL_STORE_SSA -> do
      dest' <- BNMlilSSAFunctionPtr -> CSize -> IO MediumLevelILSSAInstruction
getExpr BNMlilSSAFunctionPtr
func (CSize -> IO MediumLevelILSSAInstruction)
-> CSize -> IO MediumLevelILSSAInstruction
forall a b. (a -> b) -> a -> b
$ BNMediumLevelILInstruction -> CSize -> CSize
getOp BNMediumLevelILInstruction
rawInst CSize
0
      destMemory' <- getInt rawInst 1
      srcMemory' <- getInt rawInst 2
      src' <- getExpr func $ getOp rawInst 3
      let rec =
            MediumLevelILStoreSsaRec
              { dest :: MediumLevelILSSAInstruction
dest = MediumLevelILSSAInstruction
dest',
                destMemory :: Int
destMemory = Int
destMemory',
                srcMemory :: Int
srcMemory = Int
srcMemory',
                src :: MediumLevelILSSAInstruction
src = MediumLevelILSSAInstruction
src',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ Store $ MediumLevelILStoreSsa rec
    BNMediumLevelILOperation
MLIL_STORE_STRUCT_SSA -> do
      dest' <- BNMlilSSAFunctionPtr -> CSize -> IO MediumLevelILSSAInstruction
getExpr BNMlilSSAFunctionPtr
func (CSize -> IO MediumLevelILSSAInstruction)
-> CSize -> IO MediumLevelILSSAInstruction
forall a b. (a -> b) -> a -> b
$ BNMediumLevelILInstruction -> CSize -> CSize
getOp BNMediumLevelILInstruction
rawInst CSize
0
      offset' <- getInt rawInst 1
      destMemory' <- getInt rawInst 2
      srcMemory' <- getInt rawInst 3
      src' <- getExpr func $ getOp rawInst 4
      let rec =
            MediumLevelILStoreStructSsaRec
              { dest :: MediumLevelILSSAInstruction
dest = MediumLevelILSSAInstruction
dest',
                offset :: Int
offset = Int
offset',
                destMemory :: Int
destMemory = Int
destMemory',
                srcMemory :: Int
srcMemory = Int
srcMemory',
                src :: MediumLevelILSSAInstruction
src = MediumLevelILSSAInstruction
src',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ Store $ MediumLevelILStoreStructSsa rec
    BNMediumLevelILOperation
MLIL_INTRINSIC_SSA -> do
      output' <- BNMlilSSAFunctionPtr -> CSize -> CSize -> IO [BNSSAVariable]
getSSAVarList BNMlilSSAFunctionPtr
func CSize
exprIndex' CSize
0
      intrinsic' <- getIntrinsicIL rawInst func 2
      params' <- getExprList func exprIndex' 3
      let rec =
            MediumLevelILIntrinsicSsaRec
              { output :: [BNSSAVariable]
output = [BNSSAVariable]
output',
                intrinsic :: ILIntrinsic
intrinsic = ILIntrinsic
intrinsic',
                params :: [MediumLevelILSSAInstruction]
params = [MediumLevelILSSAInstruction]
params',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ IntrinsicInstruction $ MediumLevelILIntrinsicSsa rec
    BNMediumLevelILOperation
MLIL_MEMORY_INTRINSIC_SSA -> do
      outputInst <- BNMlilSSAFunctionPtr -> CSize -> IO MediumLevelILSSAInstruction
getExpr BNMlilSSAFunctionPtr
func (CSize -> IO MediumLevelILSSAInstruction)
-> CSize -> IO MediumLevelILSSAInstruction
forall a b. (a -> b) -> a -> b
$ BNMediumLevelILInstruction -> CSize -> CSize
getOp BNMediumLevelILInstruction
rawInst CSize
0
      (output', outputDestMemory') <- case outputInst of
        MediumLevelILMemoryIntrinsicOutputSsa (MediumLevelILMemoryIntrinsicOutputSsaRec {output :: MediumLevelILMemoryIntrinsicOutputSsaRec -> [BNSSAVariable]
output = [BNSSAVariable]
d, destMemory :: MediumLevelILMemoryIntrinsicOutputSsaRec -> Int
destMemory = Int
dM}) -> ([BNSSAVariable], Int) -> IO ([BNSSAVariable], Int)
forall a. a -> IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure ([BNSSAVariable]
d, Int
dM)
        MediumLevelILSSAInstruction
_ ->
          [Char] -> IO ([BNSSAVariable], Int)
forall a. HasCallStack => [Char] -> a
error ([Char] -> IO ([BNSSAVariable], Int))
-> [Char] -> IO ([BNSSAVariable], Int)
forall a b. (a -> b) -> a -> b
$
            [Char]
"create: Output of MediumLevelILMemoryIntrinsicOutputSsa: expected MediumLevelILMemoryIntrinsicOutputSsa : "
              [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ MediumLevelILSSAInstruction -> [Char]
forall a. Show a => a -> [Char]
show MediumLevelILSSAInstruction
outputInst
      intrinsic' <- getIntrinsicIL rawInst func 1
      params' <- getExprList func exprIndex' 2
      srcMemory' <- getInt rawInst 4
      let rec =
            MediumLevelILMemoryIntrinsicSsaRec
              { output :: [BNSSAVariable]
output = [BNSSAVariable]
output',
                destMemory :: Int
destMemory = Int
outputDestMemory',
                intrinsic :: ILIntrinsic
intrinsic = ILIntrinsic
intrinsic',
                params :: [MediumLevelILSSAInstruction]
params = [MediumLevelILSSAInstruction]
params',
                srcMemory :: Int
srcMemory = Int
srcMemory',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ IntrinsicInstruction $ MediumLevelILMemoryIntrinsicSsa rec
    BNMediumLevelILOperation
MLIL_FREE_VAR_SLOT_SSA -> do
      dest' <- BNMediumLevelILInstruction -> CSize -> CSize -> IO BNSSAVariable
getSSAVarAndDest BNMediumLevelILInstruction
rawInst CSize
0 CSize
1
      prev' <- getSSAVarAndDest rawInst 0 2
      let rec =
            MediumLevelILFreeVarSlotSsaRec
              { dest :: BNSSAVariable
dest = BNSSAVariable
dest',
                prev :: BNSSAVariable
prev = BNSSAVariable
prev',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ RegisterStack $ MediumLevelILFreeVarSlotSsa rec
    BNMediumLevelILOperation
MLIL_VAR_PHI -> do
      dest' <- BNMediumLevelILInstruction -> CSize -> CSize -> IO BNSSAVariable
getSSAVar BNMediumLevelILInstruction
rawInst CSize
0 CSize
1
      src' <- getSSAVarList func exprIndex' 2
      let rec =
            MediumLevelILVarPhiRec
              { dest :: BNSSAVariable
dest = BNSSAVariable
dest',
                src :: [BNSSAVariable]
src = [BNSSAVariable]
src',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ SetVar $ MediumLevelILVarPhi rec
    BNMediumLevelILOperation
MLIL_MEM_PHI -> do
      destMemory' <- BNMediumLevelILInstruction -> CSize -> IO Int
getInt BNMediumLevelILInstruction
rawInst CSize
0
      srcMemory' <- getIntList func exprIndex' 1
      let rec =
            MediumLevelILMemPhiRec
              { destMemory :: Int
destMemory = Int
destMemory',
                srcMemory :: [Int]
srcMemory = [Int]
srcMemory',
                core :: CoreMediumLevelILInstruction
core = CoreMediumLevelILInstruction
coreInst
              }
      pure $ Memory $ MediumLevelILMemPhi rec

-- | Deconstructs the provided instruction to derive the list of all child instructions.
children :: MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children :: MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children (Localcall Localcall
lc) =
  case Localcall
lc of
    MediumLevelILCall MediumLevelILCallRec {dest :: MediumLevelILCallRec -> MediumLevelILSSAInstruction
dest = MediumLevelILSSAInstruction
d, params :: MediumLevelILCallRec -> [MediumLevelILSSAInstruction]
params = [MediumLevelILSSAInstruction]
p} ->
      (MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction])
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children [MediumLevelILSSAInstruction]
p [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
d [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ [MediumLevelILSSAInstruction]
p [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ [MediumLevelILSSAInstruction
d]
    MediumLevelILCallSsa MediumLevelILCallSsaRec {dest :: MediumLevelILCallSsaRec -> MediumLevelILSSAInstruction
dest = MediumLevelILSSAInstruction
d, params :: MediumLevelILCallSsaRec -> [MediumLevelILSSAInstruction]
params = [MediumLevelILSSAInstruction]
p} ->
      (MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction])
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children [MediumLevelILSSAInstruction]
p [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
d [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ [MediumLevelILSSAInstruction]
p [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ [MediumLevelILSSAInstruction
d]
    MediumLevelILCallUntyped MediumLevelILCallUntypedRec {dest :: MediumLevelILCallUntypedRec -> MediumLevelILSSAInstruction
dest = MediumLevelILSSAInstruction
d, params :: MediumLevelILCallUntypedRec -> [MediumLevelILSSAInstruction]
params = [MediumLevelILSSAInstruction]
p} ->
      (MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction])
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children [MediumLevelILSSAInstruction]
p [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
d [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ [MediumLevelILSSAInstruction]
p [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ [MediumLevelILSSAInstruction
d]
    MediumLevelILCallUntypedSsa MediumLevelILCallUntypedSsaRec {dest :: MediumLevelILCallUntypedSsaRec -> MediumLevelILSSAInstruction
dest = MediumLevelILSSAInstruction
d, params :: MediumLevelILCallUntypedSsaRec -> [MediumLevelILSSAInstruction]
params = [MediumLevelILSSAInstruction]
p} ->
      (MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction])
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children [MediumLevelILSSAInstruction]
p [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
d [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ [MediumLevelILSSAInstruction]
p [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ [MediumLevelILSSAInstruction
d]
children (Constant Constant
_) = []
children (Comparison Comparison
cmp) =
  case Comparison
cmp of
    MediumLevelILCmpE MediumLevelILCmpERec {left :: MediumLevelILCmpERec -> MediumLevelILSSAInstruction
left = MediumLevelILSSAInstruction
l, right :: MediumLevelILCmpERec -> MediumLevelILSSAInstruction
right = MediumLevelILSSAInstruction
r} ->
      MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
l [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
r [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ [MediumLevelILSSAInstruction
l, MediumLevelILSSAInstruction
r]
    MediumLevelILFcmpE MediumLevelILFcmpERec {left :: MediumLevelILFcmpERec -> MediumLevelILSSAInstruction
left = MediumLevelILSSAInstruction
l, right :: MediumLevelILFcmpERec -> MediumLevelILSSAInstruction
right = MediumLevelILSSAInstruction
r} ->
      MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
l [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
r [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ [MediumLevelILSSAInstruction
l, MediumLevelILSSAInstruction
r]
    MediumLevelILCmpNe MediumLevelILCmpNeRec {left :: MediumLevelILCmpNeRec -> MediumLevelILSSAInstruction
left = MediumLevelILSSAInstruction
l, right :: MediumLevelILCmpNeRec -> MediumLevelILSSAInstruction
right = MediumLevelILSSAInstruction
r} ->
      MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
l [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
r [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ [MediumLevelILSSAInstruction
l, MediumLevelILSSAInstruction
r]
    MediumLevelILFcmpNe MediumLevelILFcmpNeRec {left :: MediumLevelILFcmpNeRec -> MediumLevelILSSAInstruction
left = MediumLevelILSSAInstruction
l, right :: MediumLevelILFcmpNeRec -> MediumLevelILSSAInstruction
right = MediumLevelILSSAInstruction
r} ->
      MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
l [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
r [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ [MediumLevelILSSAInstruction
l, MediumLevelILSSAInstruction
r]
    MediumLevelILFcmpLt MediumLevelILFcmpLtRec {left :: MediumLevelILFcmpLtRec -> MediumLevelILSSAInstruction
left = MediumLevelILSSAInstruction
l, right :: MediumLevelILFcmpLtRec -> MediumLevelILSSAInstruction
right = MediumLevelILSSAInstruction
r} ->
      MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
l [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
r [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ [MediumLevelILSSAInstruction
l, MediumLevelILSSAInstruction
r]
    MediumLevelILFcmpLe MediumLevelILFcmpLeRec {left :: MediumLevelILFcmpLeRec -> MediumLevelILSSAInstruction
left = MediumLevelILSSAInstruction
l, right :: MediumLevelILFcmpLeRec -> MediumLevelILSSAInstruction
right = MediumLevelILSSAInstruction
r} ->
      MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
l [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
r [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ [MediumLevelILSSAInstruction
l, MediumLevelILSSAInstruction
r]
    MediumLevelILFcmpGe MediumLevelILFcmpGeRec {left :: MediumLevelILFcmpGeRec -> MediumLevelILSSAInstruction
left = MediumLevelILSSAInstruction
l, right :: MediumLevelILFcmpGeRec -> MediumLevelILSSAInstruction
right = MediumLevelILSSAInstruction
r} ->
      MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
l [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
r [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ [MediumLevelILSSAInstruction
l, MediumLevelILSSAInstruction
r]
    MediumLevelILFcmpGt MediumLevelILFcmpGtRec {left :: MediumLevelILFcmpGtRec -> MediumLevelILSSAInstruction
left = MediumLevelILSSAInstruction
l, right :: MediumLevelILFcmpGtRec -> MediumLevelILSSAInstruction
right = MediumLevelILSSAInstruction
r} ->
      MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
l [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
r [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ [MediumLevelILSSAInstruction
l, MediumLevelILSSAInstruction
r]
    MediumLevelILCmpSlt MediumLevelILCmpSltRec {left :: MediumLevelILCmpSltRec -> MediumLevelILSSAInstruction
left = MediumLevelILSSAInstruction
l, right :: MediumLevelILCmpSltRec -> MediumLevelILSSAInstruction
right = MediumLevelILSSAInstruction
r} ->
      MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
l [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
r [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ [MediumLevelILSSAInstruction
l, MediumLevelILSSAInstruction
r]
    MediumLevelILCmpUlt MediumLevelILCmpUltRec {left :: MediumLevelILCmpUltRec -> MediumLevelILSSAInstruction
left = MediumLevelILSSAInstruction
l, right :: MediumLevelILCmpUltRec -> MediumLevelILSSAInstruction
right = MediumLevelILSSAInstruction
r} ->
      MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
l [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
r [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ [MediumLevelILSSAInstruction
l, MediumLevelILSSAInstruction
r]
    MediumLevelILCmpSle MediumLevelILCmpSleRec {left :: MediumLevelILCmpSleRec -> MediumLevelILSSAInstruction
left = MediumLevelILSSAInstruction
l, right :: MediumLevelILCmpSleRec -> MediumLevelILSSAInstruction
right = MediumLevelILSSAInstruction
r} ->
      MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
l [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
r [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ [MediumLevelILSSAInstruction
l, MediumLevelILSSAInstruction
r]
    MediumLevelILCmpUle MediumLevelILCmpUleRec {left :: MediumLevelILCmpUleRec -> MediumLevelILSSAInstruction
left = MediumLevelILSSAInstruction
l, right :: MediumLevelILCmpUleRec -> MediumLevelILSSAInstruction
right = MediumLevelILSSAInstruction
r} ->
      MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
l [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
r [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ [MediumLevelILSSAInstruction
l, MediumLevelILSSAInstruction
r]
    MediumLevelILCmpSge MediumLevelILCmpSgeRec {left :: MediumLevelILCmpSgeRec -> MediumLevelILSSAInstruction
left = MediumLevelILSSAInstruction
l, right :: MediumLevelILCmpSgeRec -> MediumLevelILSSAInstruction
right = MediumLevelILSSAInstruction
r} ->
      MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
l [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
r [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ [MediumLevelILSSAInstruction
l, MediumLevelILSSAInstruction
r]
    MediumLevelILCmpUge MediumLevelILCmpUgeRec {left :: MediumLevelILCmpUgeRec -> MediumLevelILSSAInstruction
left = MediumLevelILSSAInstruction
l, right :: MediumLevelILCmpUgeRec -> MediumLevelILSSAInstruction
right = MediumLevelILSSAInstruction
r} ->
      MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
l [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
r [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ [MediumLevelILSSAInstruction
l, MediumLevelILSSAInstruction
r]
    MediumLevelILCmpSgt MediumLevelILCmpSgtRec {left :: MediumLevelILCmpSgtRec -> MediumLevelILSSAInstruction
left = MediumLevelILSSAInstruction
l, right :: MediumLevelILCmpSgtRec -> MediumLevelILSSAInstruction
right = MediumLevelILSSAInstruction
r} ->
      MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
l [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
r [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ [MediumLevelILSSAInstruction
l, MediumLevelILSSAInstruction
r]
    MediumLevelILCmpUgt MediumLevelILCmpUgtRec {left :: MediumLevelILCmpUgtRec -> MediumLevelILSSAInstruction
left = MediumLevelILSSAInstruction
l, right :: MediumLevelILCmpUgtRec -> MediumLevelILSSAInstruction
right = MediumLevelILSSAInstruction
r} ->
      MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
l [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
r [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ [MediumLevelILSSAInstruction
l, MediumLevelILSSAInstruction
r]
    MediumLevelILFcmpO MediumLevelILFcmpORec {left :: MediumLevelILFcmpORec -> MediumLevelILSSAInstruction
left = MediumLevelILSSAInstruction
l, right :: MediumLevelILFcmpORec -> MediumLevelILSSAInstruction
right = MediumLevelILSSAInstruction
r} ->
      MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
l [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
r [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ [MediumLevelILSSAInstruction
l, MediumLevelILSSAInstruction
r]
    MediumLevelILFcmpUo MediumLevelILFcmpUoRec {left :: MediumLevelILFcmpUoRec -> MediumLevelILSSAInstruction
left = MediumLevelILSSAInstruction
l, right :: MediumLevelILFcmpUoRec -> MediumLevelILSSAInstruction
right = MediumLevelILSSAInstruction
r} ->
      MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
l [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
r [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ [MediumLevelILSSAInstruction
l, MediumLevelILSSAInstruction
r]
    MediumLevelILTestBit MediumLevelILTestBitRec {left :: MediumLevelILTestBitRec -> MediumLevelILSSAInstruction
left = MediumLevelILSSAInstruction
l, right :: MediumLevelILTestBitRec -> MediumLevelILSSAInstruction
right = MediumLevelILSSAInstruction
r} ->
      MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
l [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
r [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ [MediumLevelILSSAInstruction
l, MediumLevelILSSAInstruction
r]
children (Arithmetic Arithmetic
a) =
  case Arithmetic
a of
    MediumLevelILNeg MediumLevelILNegRec {src :: MediumLevelILNegRec -> MediumLevelILSSAInstruction
src = MediumLevelILSSAInstruction
s} -> MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
s [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ [MediumLevelILSSAInstruction
s]
    MediumLevelILNot MediumLevelILNotRec {src :: MediumLevelILNotRec -> MediumLevelILSSAInstruction
src = MediumLevelILSSAInstruction
s} -> MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
s [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ [MediumLevelILSSAInstruction
s]
    MediumLevelILSx MediumLevelILSxRec {src :: MediumLevelILSxRec -> MediumLevelILSSAInstruction
src = MediumLevelILSSAInstruction
s} -> MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
s [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ [MediumLevelILSSAInstruction
s]
    MediumLevelILZx MediumLevelILZxRec {src :: MediumLevelILZxRec -> MediumLevelILSSAInstruction
src = MediumLevelILSSAInstruction
s} -> MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
s [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ [MediumLevelILSSAInstruction
s]
    MediumLevelILLowPart MediumLevelILLowPartRec {src :: MediumLevelILLowPartRec -> MediumLevelILSSAInstruction
src = MediumLevelILSSAInstruction
s} -> MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
s [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ [MediumLevelILSSAInstruction
s]
    MediumLevelILFsqrt MediumLevelILFsqrtRec {src :: MediumLevelILFsqrtRec -> MediumLevelILSSAInstruction
src = MediumLevelILSSAInstruction
s} -> MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
s [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ [MediumLevelILSSAInstruction
s]
    MediumLevelILFneg MediumLevelILFnegRec {src :: MediumLevelILFnegRec -> MediumLevelILSSAInstruction
src = MediumLevelILSSAInstruction
s} -> MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
s [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ [MediumLevelILSSAInstruction
s]
    MediumLevelILFabs MediumLevelILFabsRec {src :: MediumLevelILFabsRec -> MediumLevelILSSAInstruction
src = MediumLevelILSSAInstruction
s} -> MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
s [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ [MediumLevelILSSAInstruction
s]
    MediumLevelILFloatToInt MediumLevelILFloatToIntRec {src :: MediumLevelILFloatToIntRec -> MediumLevelILSSAInstruction
src = MediumLevelILSSAInstruction
s} -> MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
s [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ [MediumLevelILSSAInstruction
s]
    MediumLevelILIntToFloat MediumLevelILIntToFloatRec {src :: MediumLevelILIntToFloatRec -> MediumLevelILSSAInstruction
src = MediumLevelILSSAInstruction
s} -> MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
s [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ [MediumLevelILSSAInstruction
s]
    MediumLevelILFloatConv MediumLevelILFloatConvRec {src :: MediumLevelILFloatConvRec -> MediumLevelILSSAInstruction
src = MediumLevelILSSAInstruction
s} -> MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
s [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ [MediumLevelILSSAInstruction
s]
    MediumLevelILRoundToInt MediumLevelILRoundToIntRec {src :: MediumLevelILRoundToIntRec -> MediumLevelILSSAInstruction
src = MediumLevelILSSAInstruction
s} -> MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
s [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ [MediumLevelILSSAInstruction
s]
    MediumLevelILFloor MediumLevelILFloorRec {src :: MediumLevelILFloorRec -> MediumLevelILSSAInstruction
src = MediumLevelILSSAInstruction
s} -> MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
s [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ [MediumLevelILSSAInstruction
s]
    MediumLevelILCeil MediumLevelILCeilRec {src :: MediumLevelILCeilRec -> MediumLevelILSSAInstruction
src = MediumLevelILSSAInstruction
s} -> MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
s [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ [MediumLevelILSSAInstruction
s]
    MediumLevelILFtrunc MediumLevelILFtruncRec {src :: MediumLevelILFtruncRec -> MediumLevelILSSAInstruction
src = MediumLevelILSSAInstruction
s} -> MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
s [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ [MediumLevelILSSAInstruction
s]
    MediumLevelILAdd MediumLevelILAddRec {left :: MediumLevelILAddRec -> MediumLevelILSSAInstruction
left = MediumLevelILSSAInstruction
l, right :: MediumLevelILAddRec -> MediumLevelILSSAInstruction
right = MediumLevelILSSAInstruction
r} ->
      MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
l [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
r [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ [MediumLevelILSSAInstruction
l, MediumLevelILSSAInstruction
r]
    MediumLevelILSub MediumLevelILSubRec {left :: MediumLevelILSubRec -> MediumLevelILSSAInstruction
left = MediumLevelILSSAInstruction
l, right :: MediumLevelILSubRec -> MediumLevelILSSAInstruction
right = MediumLevelILSSAInstruction
r} ->
      MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
l [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
r [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ [MediumLevelILSSAInstruction
l, MediumLevelILSSAInstruction
r]
    MediumLevelILAnd MediumLevelILAndRec {left :: MediumLevelILAndRec -> MediumLevelILSSAInstruction
left = MediumLevelILSSAInstruction
l, right :: MediumLevelILAndRec -> MediumLevelILSSAInstruction
right = MediumLevelILSSAInstruction
r} ->
      MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
l [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
r [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ [MediumLevelILSSAInstruction
l, MediumLevelILSSAInstruction
r]
    MediumLevelILOr MediumLevelILOrRec {left :: MediumLevelILOrRec -> MediumLevelILSSAInstruction
left = MediumLevelILSSAInstruction
l, right :: MediumLevelILOrRec -> MediumLevelILSSAInstruction
right = MediumLevelILSSAInstruction
r} ->
      MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
l [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
r [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ [MediumLevelILSSAInstruction
l, MediumLevelILSSAInstruction
r]
    MediumLevelILXor MediumLevelILXorRec {left :: MediumLevelILXorRec -> MediumLevelILSSAInstruction
left = MediumLevelILSSAInstruction
l, right :: MediumLevelILXorRec -> MediumLevelILSSAInstruction
right = MediumLevelILSSAInstruction
r} ->
      MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
l [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
r [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ [MediumLevelILSSAInstruction
l, MediumLevelILSSAInstruction
r]
    MediumLevelILLsl MediumLevelILLslRec {left :: MediumLevelILLslRec -> MediumLevelILSSAInstruction
left = MediumLevelILSSAInstruction
l, right :: MediumLevelILLslRec -> MediumLevelILSSAInstruction
right = MediumLevelILSSAInstruction
r} ->
      MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
l [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
r [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ [MediumLevelILSSAInstruction
l, MediumLevelILSSAInstruction
r]
    MediumLevelILLsr MediumLevelILLsrRec {left :: MediumLevelILLsrRec -> MediumLevelILSSAInstruction
left = MediumLevelILSSAInstruction
l, right :: MediumLevelILLsrRec -> MediumLevelILSSAInstruction
right = MediumLevelILSSAInstruction
r} ->
      MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
l [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
r [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ [MediumLevelILSSAInstruction
l, MediumLevelILSSAInstruction
r]
    MediumLevelILAsr MediumLevelILAsrRec {left :: MediumLevelILAsrRec -> MediumLevelILSSAInstruction
left = MediumLevelILSSAInstruction
l, right :: MediumLevelILAsrRec -> MediumLevelILSSAInstruction
right = MediumLevelILSSAInstruction
r} ->
      MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
l [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
r [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ [MediumLevelILSSAInstruction
l, MediumLevelILSSAInstruction
r]
    MediumLevelILRol MediumLevelILRolRec {left :: MediumLevelILRolRec -> MediumLevelILSSAInstruction
left = MediumLevelILSSAInstruction
l, right :: MediumLevelILRolRec -> MediumLevelILSSAInstruction
right = MediumLevelILSSAInstruction
r} ->
      MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
l [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
r [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ [MediumLevelILSSAInstruction
l, MediumLevelILSSAInstruction
r]
    MediumLevelILRor MediumLevelILRorRec {left :: MediumLevelILRorRec -> MediumLevelILSSAInstruction
left = MediumLevelILSSAInstruction
l, right :: MediumLevelILRorRec -> MediumLevelILSSAInstruction
right = MediumLevelILSSAInstruction
r} ->
      MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
l [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
r [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ [MediumLevelILSSAInstruction
l, MediumLevelILSSAInstruction
r]
    MediumLevelILMul MediumLevelILMulRec {left :: MediumLevelILMulRec -> MediumLevelILSSAInstruction
left = MediumLevelILSSAInstruction
l, right :: MediumLevelILMulRec -> MediumLevelILSSAInstruction
right = MediumLevelILSSAInstruction
r} ->
      MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
l [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
r [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ [MediumLevelILSSAInstruction
l, MediumLevelILSSAInstruction
r]
    MediumLevelILDivu MediumLevelILDivuRec {left :: MediumLevelILDivuRec -> MediumLevelILSSAInstruction
left = MediumLevelILSSAInstruction
l, right :: MediumLevelILDivuRec -> MediumLevelILSSAInstruction
right = MediumLevelILSSAInstruction
r} ->
      MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
l [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
r [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ [MediumLevelILSSAInstruction
l, MediumLevelILSSAInstruction
r]
    MediumLevelILDivs MediumLevelILDivsRec {left :: MediumLevelILDivsRec -> MediumLevelILSSAInstruction
left = MediumLevelILSSAInstruction
l, right :: MediumLevelILDivsRec -> MediumLevelILSSAInstruction
right = MediumLevelILSSAInstruction
r} ->
      MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
l [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
r [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ [MediumLevelILSSAInstruction
l, MediumLevelILSSAInstruction
r]
    MediumLevelILModu MediumLevelILModuRec {left :: MediumLevelILModuRec -> MediumLevelILSSAInstruction
left = MediumLevelILSSAInstruction
l, right :: MediumLevelILModuRec -> MediumLevelILSSAInstruction
right = MediumLevelILSSAInstruction
r} ->
      MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
l [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
r [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ [MediumLevelILSSAInstruction
l, MediumLevelILSSAInstruction
r]
    MediumLevelILMods MediumLevelILModsRec {left :: MediumLevelILModsRec -> MediumLevelILSSAInstruction
left = MediumLevelILSSAInstruction
l, right :: MediumLevelILModsRec -> MediumLevelILSSAInstruction
right = MediumLevelILSSAInstruction
r} ->
      MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
l [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
r [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ [MediumLevelILSSAInstruction
l, MediumLevelILSSAInstruction
r]
    MediumLevelILAddOverflow MediumLevelILAddOverflowRec {left :: MediumLevelILAddOverflowRec -> MediumLevelILSSAInstruction
left = MediumLevelILSSAInstruction
l, right :: MediumLevelILAddOverflowRec -> MediumLevelILSSAInstruction
right = MediumLevelILSSAInstruction
r} ->
      MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
l [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
r [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ [MediumLevelILSSAInstruction
l, MediumLevelILSSAInstruction
r]
    MediumLevelILFadd MediumLevelILFaddRec {left :: MediumLevelILFaddRec -> MediumLevelILSSAInstruction
left = MediumLevelILSSAInstruction
l, right :: MediumLevelILFaddRec -> MediumLevelILSSAInstruction
right = MediumLevelILSSAInstruction
r} ->
      MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
l [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
r [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ [MediumLevelILSSAInstruction
l, MediumLevelILSSAInstruction
r]
    MediumLevelILFsub MediumLevelILFsubRec {left :: MediumLevelILFsubRec -> MediumLevelILSSAInstruction
left = MediumLevelILSSAInstruction
l, right :: MediumLevelILFsubRec -> MediumLevelILSSAInstruction
right = MediumLevelILSSAInstruction
r} ->
      MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
l [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
r [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ [MediumLevelILSSAInstruction
l, MediumLevelILSSAInstruction
r]
    MediumLevelILFmul MediumLevelILFmulRec {left :: MediumLevelILFmulRec -> MediumLevelILSSAInstruction
left = MediumLevelILSSAInstruction
l, right :: MediumLevelILFmulRec -> MediumLevelILSSAInstruction
right = MediumLevelILSSAInstruction
r} ->
      MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
l [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
r [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ [MediumLevelILSSAInstruction
l, MediumLevelILSSAInstruction
r]
    MediumLevelILFdiv MediumLevelILFdivRec {left :: MediumLevelILFdivRec -> MediumLevelILSSAInstruction
left = MediumLevelILSSAInstruction
l, right :: MediumLevelILFdivRec -> MediumLevelILSSAInstruction
right = MediumLevelILSSAInstruction
r} ->
      MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
l [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
r [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ [MediumLevelILSSAInstruction
l, MediumLevelILSSAInstruction
r]
children (Terminal Terminal
t) =
  case Terminal
t of
    MediumLevelILNoret MediumLevelILNoretRec
_ -> []
    MediumLevelILBp MediumLevelILBpRec
_ -> []
    MediumLevelILJump MediumLevelILJumpRec {dest :: MediumLevelILJumpRec -> MediumLevelILSSAInstruction
dest = MediumLevelILSSAInstruction
d} -> MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
d [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ [MediumLevelILSSAInstruction
d]
    MediumLevelILGoto MediumLevelILGotoRec
_ -> []
    MediumLevelILTrap MediumLevelILTrapRec
_ -> []
    MediumLevelILJumpTo MediumLevelILJumpToRec {dest :: MediumLevelILJumpToRec -> MediumLevelILSSAInstruction
dest = MediumLevelILSSAInstruction
d} -> MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
d [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ [MediumLevelILSSAInstruction
d]
    MediumLevelILIf MediumLevelILIfRec {condition :: MediumLevelILIfRec -> MediumLevelILSSAInstruction
condition = MediumLevelILSSAInstruction
c} -> MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
c [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ [MediumLevelILSSAInstruction
c]
children (Syscall Syscall
s) =
  case Syscall
s of
    MediumLevelILSyscallUntyped MediumLevelILSyscallUntypedRec {params :: MediumLevelILSyscallUntypedRec -> [MediumLevelILSSAInstruction]
params = [MediumLevelILSSAInstruction]
p} ->
      (MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction])
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children [MediumLevelILSSAInstruction]
p [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ [MediumLevelILSSAInstruction]
p
    MediumLevelILSyscallSsa MediumLevelILSyscallSsaRec {params :: MediumLevelILSyscallSsaRec -> [MediumLevelILSSAInstruction]
params = [MediumLevelILSSAInstruction]
p} ->
      (MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction])
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children [MediumLevelILSSAInstruction]
p [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ [MediumLevelILSSAInstruction]
p
    MediumLevelILSyscall MediumLevelILSyscallRec {params :: MediumLevelILSyscallRec -> [MediumLevelILSSAInstruction]
params = [MediumLevelILSSAInstruction]
p} ->
      (MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction])
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children [MediumLevelILSSAInstruction]
p [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ [MediumLevelILSSAInstruction]
p
    MediumLevelILSyscallUntypedSsa MediumLevelILSyscallUntypedSsaRec {params :: MediumLevelILSyscallUntypedSsaRec -> [MediumLevelILSSAInstruction]
params = [MediumLevelILSSAInstruction]
p} ->
      (MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction])
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children [MediumLevelILSSAInstruction]
p [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ [MediumLevelILSSAInstruction]
p
children (Tailcall Tailcall
t) =
  case Tailcall
t of
    MediumLevelILTailcallUntyped MediumLevelILTailcallUntypedRec {dest :: MediumLevelILTailcallUntypedRec -> MediumLevelILSSAInstruction
dest = MediumLevelILSSAInstruction
d, params :: MediumLevelILTailcallUntypedRec -> [MediumLevelILSSAInstruction]
params = [MediumLevelILSSAInstruction]
p} ->
      MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
d [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ (MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction])
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children [MediumLevelILSSAInstruction]
p [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ [MediumLevelILSSAInstruction]
p [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ [MediumLevelILSSAInstruction
d]
    MediumLevelILTailcall MediumLevelILTailcallRec {dest :: MediumLevelILTailcallRec -> MediumLevelILSSAInstruction
dest = MediumLevelILSSAInstruction
d, params :: MediumLevelILTailcallRec -> [MediumLevelILSSAInstruction]
params = [MediumLevelILSSAInstruction]
p} ->
      MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
d [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ (MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction])
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children [MediumLevelILSSAInstruction]
p [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ [MediumLevelILSSAInstruction]
p [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ [MediumLevelILSSAInstruction
d]
    MediumLevelILTailcallSsa MediumLevelILTailcallSsaRec {dest :: MediumLevelILTailcallSsaRec -> MediumLevelILSSAInstruction
dest = MediumLevelILSSAInstruction
d, params :: MediumLevelILTailcallSsaRec -> [MediumLevelILSSAInstruction]
params = [MediumLevelILSSAInstruction]
p} ->
      MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
d [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ (MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction])
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children [MediumLevelILSSAInstruction]
p [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ [MediumLevelILSSAInstruction]
p [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ [MediumLevelILSSAInstruction
d]
    MediumLevelILTailcallUntypedSsa MediumLevelILTailcallUntypedSsaRec {dest :: MediumLevelILTailcallUntypedSsaRec -> MediumLevelILSSAInstruction
dest = MediumLevelILSSAInstruction
d, params :: MediumLevelILTailcallUntypedSsaRec -> [MediumLevelILSSAInstruction]
params = [MediumLevelILSSAInstruction]
p} ->
      MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
d [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ (MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction])
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children [MediumLevelILSSAInstruction]
p [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ [MediumLevelILSSAInstruction]
p [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ [MediumLevelILSSAInstruction
d]
children (ControlFlow (MediumLevelILRetHint MediumLevelILRetHintRec {dest :: MediumLevelILRetHintRec -> MediumLevelILSSAInstruction
dest = MediumLevelILSSAInstruction
d})) =
  MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
d [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ [MediumLevelILSSAInstruction
d]
children (Return (MediumLevelILRet MediumLevelILRetRec {src :: MediumLevelILRetRec -> [MediumLevelILSSAInstruction]
src = [MediumLevelILSSAInstruction]
s})) =
  (MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction])
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children [MediumLevelILSSAInstruction]
s [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ [MediumLevelILSSAInstruction]
s
children (Load Load
l) =
  case Load
l of
    MediumLevelILLoad MediumLevelILLoadRec {src :: MediumLevelILLoadRec -> MediumLevelILSSAInstruction
src = MediumLevelILSSAInstruction
s} ->
      MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
s [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ [MediumLevelILSSAInstruction
s]
    MediumLevelILLoadStruct MediumLevelILLoadStructRec {src :: MediumLevelILLoadStructRec -> MediumLevelILSSAInstruction
src = MediumLevelILSSAInstruction
s} ->
      MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
s [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ [MediumLevelILSSAInstruction
s]
    MediumLevelILLoadSsa MediumLevelILLoadSsaRec {src :: MediumLevelILLoadSsaRec -> MediumLevelILSSAInstruction
src = MediumLevelILSSAInstruction
s} ->
      MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
s [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ [MediumLevelILSSAInstruction
s]
    MediumLevelILLoadStructSsa MediumLevelILLoadStructSsaRec {src :: MediumLevelILLoadStructSsaRec -> MediumLevelILSSAInstruction
src = MediumLevelILSSAInstruction
s} ->
      MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
s [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ [MediumLevelILSSAInstruction
s]
children (Store Store
store') =
  case Store
store' of
    MediumLevelILStore MediumLevelILStoreRec {src :: MediumLevelILStoreRec -> MediumLevelILSSAInstruction
src = MediumLevelILSSAInstruction
s, dest :: MediumLevelILStoreRec -> MediumLevelILSSAInstruction
dest = MediumLevelILSSAInstruction
d} ->
      MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
s [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
d [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ [MediumLevelILSSAInstruction
s, MediumLevelILSSAInstruction
d]
    MediumLevelILStoreStruct MediumLevelILStoreStructRec {src :: MediumLevelILStoreStructRec -> MediumLevelILSSAInstruction
src = MediumLevelILSSAInstruction
s, dest :: MediumLevelILStoreStructRec -> MediumLevelILSSAInstruction
dest = MediumLevelILSSAInstruction
d} ->
      MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
s [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
d [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ [MediumLevelILSSAInstruction
s, MediumLevelILSSAInstruction
d]
    MediumLevelILStoreSsa MediumLevelILStoreSsaRec {src :: MediumLevelILStoreSsaRec -> MediumLevelILSSAInstruction
src = MediumLevelILSSAInstruction
s, dest :: MediumLevelILStoreSsaRec -> MediumLevelILSSAInstruction
dest = MediumLevelILSSAInstruction
d} ->
      MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
s [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
d [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ [MediumLevelILSSAInstruction
s, MediumLevelILSSAInstruction
d]
    MediumLevelILStoreStructSsa MediumLevelILStoreStructSsaRec {src :: MediumLevelILStoreStructSsaRec -> MediumLevelILSSAInstruction
src = MediumLevelILSSAInstruction
s, dest :: MediumLevelILStoreStructSsaRec -> MediumLevelILSSAInstruction
dest = MediumLevelILSSAInstruction
d} ->
      MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
s [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
d [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ [MediumLevelILSSAInstruction
s, MediumLevelILSSAInstruction
d]
children (Memory Memory
m) =
  case Memory
m of
    MediumLevelILUnimplMem MediumLevelILUnimplMemRec {src :: MediumLevelILUnimplMemRec -> MediumLevelILSSAInstruction
src = MediumLevelILSSAInstruction
s} ->
      MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
s [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ [MediumLevelILSSAInstruction
s]
    MediumLevelILMemPhi MediumLevelILMemPhiRec
_ -> []
children (Carry Carry
carry') =
  case Carry
carry' of
    MediumLevelILAdc MediumLevelILAdcRec {left :: MediumLevelILAdcRec -> MediumLevelILSSAInstruction
left = MediumLevelILSSAInstruction
l, right :: MediumLevelILAdcRec -> MediumLevelILSSAInstruction
right = MediumLevelILSSAInstruction
r, carry :: MediumLevelILAdcRec -> MediumLevelILSSAInstruction
carry = MediumLevelILSSAInstruction
c} ->
      MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
l [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
r [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
c [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ [MediumLevelILSSAInstruction
l, MediumLevelILSSAInstruction
r, MediumLevelILSSAInstruction
c]
    MediumLevelILSbb MediumLevelILSbbRec {left :: MediumLevelILSbbRec -> MediumLevelILSSAInstruction
left = MediumLevelILSSAInstruction
l, right :: MediumLevelILSbbRec -> MediumLevelILSSAInstruction
right = MediumLevelILSSAInstruction
r, carry :: MediumLevelILSbbRec -> MediumLevelILSSAInstruction
carry = MediumLevelILSSAInstruction
c} ->
      MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
l [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
r [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
c [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ [MediumLevelILSSAInstruction
l, MediumLevelILSSAInstruction
r, MediumLevelILSSAInstruction
c]
    MediumLevelILRlc MediumLevelILRlcRec {left :: MediumLevelILRlcRec -> MediumLevelILSSAInstruction
left = MediumLevelILSSAInstruction
l, right :: MediumLevelILRlcRec -> MediumLevelILSSAInstruction
right = MediumLevelILSSAInstruction
r, carry :: MediumLevelILRlcRec -> MediumLevelILSSAInstruction
carry = MediumLevelILSSAInstruction
c} ->
      MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
l [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
r [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
c [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ [MediumLevelILSSAInstruction
l, MediumLevelILSSAInstruction
r, MediumLevelILSSAInstruction
c]
    MediumLevelILRrc MediumLevelILRrcRec {left :: MediumLevelILRrcRec -> MediumLevelILSSAInstruction
left = MediumLevelILSSAInstruction
l, right :: MediumLevelILRrcRec -> MediumLevelILSSAInstruction
right = MediumLevelILSSAInstruction
r, carry :: MediumLevelILRrcRec -> MediumLevelILSSAInstruction
carry = MediumLevelILSSAInstruction
c} ->
      MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
l [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
r [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
c [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ [MediumLevelILSSAInstruction
l, MediumLevelILSSAInstruction
r, MediumLevelILSSAInstruction
c]
children (SetVar SetVar
sv) =
  case SetVar
sv of
    MediumLevelILSetVar MediumLevelILSetVarRec {src :: MediumLevelILSetVarRec -> MediumLevelILSSAInstruction
src = MediumLevelILSSAInstruction
s} ->
      MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
s [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ [MediumLevelILSSAInstruction
s]
    MediumLevelILVarPhi MediumLevelILVarPhiRec
_ -> []
    MediumLevelILSetVarSsa MediumLevelILSetVarSsaRec {src :: MediumLevelILSetVarSsaRec -> MediumLevelILSSAInstruction
src = MediumLevelILSSAInstruction
s} ->
      MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
s [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ [MediumLevelILSSAInstruction
s]
    MediumLevelILSetVarAliased MediumLevelILSetVarAliasedRec {src :: MediumLevelILSetVarAliasedRec -> MediumLevelILSSAInstruction
src = MediumLevelILSSAInstruction
s} ->
      MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
s [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ [MediumLevelILSSAInstruction
s]
    MediumLevelILSetVarSsaField MediumLevelILSetVarSsaFieldRec {src :: MediumLevelILSetVarSsaFieldRec -> MediumLevelILSSAInstruction
src = MediumLevelILSSAInstruction
s} ->
      MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
s [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ [MediumLevelILSSAInstruction
s]
    MediumLevelILSetVarSplitSsa MediumLevelILSetVarSplitSsaRec {src :: MediumLevelILSetVarSplitSsaRec -> MediumLevelILSSAInstruction
src = MediumLevelILSSAInstruction
s} ->
      MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
s [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ [MediumLevelILSSAInstruction
s]
    MediumLevelILSetVarAliasedField MediumLevelILSetVarAliasedFieldRec {src :: MediumLevelILSetVarAliasedFieldRec -> MediumLevelILSSAInstruction
src = MediumLevelILSSAInstruction
s} ->
      MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
s [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ [MediumLevelILSSAInstruction
s]
    MediumLevelILSetVarField MediumLevelILSetVarFieldRec {src :: MediumLevelILSetVarFieldRec -> MediumLevelILSSAInstruction
src = MediumLevelILSSAInstruction
s} ->
      MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
s [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ [MediumLevelILSSAInstruction
s]
    MediumLevelILSetVarSplit MediumLevelILSetVarSplitRec {src :: MediumLevelILSetVarSplitRec -> MediumLevelILSSAInstruction
src = MediumLevelILSSAInstruction
s} ->
      MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
s [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ [MediumLevelILSSAInstruction
s]
children (RegisterStack RegisterStack
_) = []
children (VariableInstruction VariableInstruction
_) = []
children (IntrinsicInstruction IntrinsicInstruction
ii) =
  case IntrinsicInstruction
ii of
    MediumLevelILIntrinsic MediumLevelILIntrinsicRec {params :: MediumLevelILIntrinsicRec -> [MediumLevelILSSAInstruction]
params = [MediumLevelILSSAInstruction]
p} ->
      (MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction])
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children [MediumLevelILSSAInstruction]
p [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ [MediumLevelILSSAInstruction]
p
    MediumLevelILIntrinsicSsa MediumLevelILIntrinsicSsaRec {params :: MediumLevelILIntrinsicSsaRec -> [MediumLevelILSSAInstruction]
params = [MediumLevelILSSAInstruction]
p} ->
      (MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction])
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children [MediumLevelILSSAInstruction]
p [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ [MediumLevelILSSAInstruction]
p
    MediumLevelILMemoryIntrinsicSsa MediumLevelILMemoryIntrinsicSsaRec {params :: MediumLevelILMemoryIntrinsicSsaRec -> [MediumLevelILSSAInstruction]
params = [MediumLevelILSSAInstruction]
p} ->
      (MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction])
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children [MediumLevelILSSAInstruction]
p [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ [MediumLevelILSSAInstruction]
p
children (MediumLevelILCallOutputSsa MediumLevelILCallOutputSsaRec
_) = []
children (MediumLevelILCallOutput MediumLevelILCallOutputRec
_) = []
children (MediumLevelILMemoryIntrinsicOutputSsa MediumLevelILMemoryIntrinsicOutputSsaRec
_) = []
children (MediumLevelILCallParamSsa MediumLevelILCallParamSsaRec {src :: MediumLevelILCallParamSsaRec -> [MediumLevelILSSAInstruction]
src = [MediumLevelILSSAInstruction]
s}) =
  (MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction])
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children [MediumLevelILSSAInstruction]
s [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ [MediumLevelILSSAInstruction]
s
children (MediumLevelILCallParam MediumLevelILCallParamRec {src :: MediumLevelILCallParamRec -> [MediumLevelILSSAInstruction]
src = [MediumLevelILSSAInstruction]
s}) =
  (MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction])
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children [MediumLevelILSSAInstruction]
s [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ [MediumLevelILSSAInstruction]
s
children (MediumLevelILNop MediumLevelILNopRec
_) = []
children (MediumLevelILAddressOf MediumLevelILAddressOfRec
_) = []
children (MediumLevelILAddressOfField MediumLevelILAddressOfFieldRec
_) = []
children (MediumLevelILMuluDp MediumLevelILMuluDpRec {left :: MediumLevelILMuluDpRec -> MediumLevelILSSAInstruction
left = MediumLevelILSSAInstruction
l, right :: MediumLevelILMuluDpRec -> MediumLevelILSSAInstruction
right = MediumLevelILSSAInstruction
r}) =
  MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
l [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
r [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ [MediumLevelILSSAInstruction
l, MediumLevelILSSAInstruction
r]
children (MediumLevelILMulsDp MediumLevelILMulsDpRec {left :: MediumLevelILMulsDpRec -> MediumLevelILSSAInstruction
left = MediumLevelILSSAInstruction
l, right :: MediumLevelILMulsDpRec -> MediumLevelILSSAInstruction
right = MediumLevelILSSAInstruction
r}) =
  MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
l [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
r [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ [MediumLevelILSSAInstruction
l, MediumLevelILSSAInstruction
r]
children (MediumLevelILDivuDp MediumLevelILDivuDpRec {left :: MediumLevelILDivuDpRec -> MediumLevelILSSAInstruction
left = MediumLevelILSSAInstruction
l, right :: MediumLevelILDivuDpRec -> MediumLevelILSSAInstruction
right = MediumLevelILSSAInstruction
r}) =
  MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
l [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
r [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ [MediumLevelILSSAInstruction
l, MediumLevelILSSAInstruction
r]
children (MediumLevelILDivsDp MediumLevelILDivsDpRec {left :: MediumLevelILDivsDpRec -> MediumLevelILSSAInstruction
left = MediumLevelILSSAInstruction
l, right :: MediumLevelILDivsDpRec -> MediumLevelILSSAInstruction
right = MediumLevelILSSAInstruction
r}) =
  MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
l [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
r [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ [MediumLevelILSSAInstruction
l, MediumLevelILSSAInstruction
r]
children (MediumLevelILModuDp MediumLevelILModuDpRec {left :: MediumLevelILModuDpRec -> MediumLevelILSSAInstruction
left = MediumLevelILSSAInstruction
l, right :: MediumLevelILModuDpRec -> MediumLevelILSSAInstruction
right = MediumLevelILSSAInstruction
r}) =
  MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
l [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
r [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ [MediumLevelILSSAInstruction
l, MediumLevelILSSAInstruction
r]
children (MediumLevelILModsDp MediumLevelILModsDpRec {left :: MediumLevelILModsDpRec -> MediumLevelILSSAInstruction
left = MediumLevelILSSAInstruction
l, right :: MediumLevelILModsDpRec -> MediumLevelILSSAInstruction
right = MediumLevelILSSAInstruction
r}) =
  MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
l [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
r [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ [MediumLevelILSSAInstruction
l, MediumLevelILSSAInstruction
r]
children (MediumLevelILBoolToInt MediumLevelILBoolToIntRec {src :: MediumLevelILBoolToIntRec -> MediumLevelILSSAInstruction
src = MediumLevelILSSAInstruction
s}) =
  MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children MediumLevelILSSAInstruction
s [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ [MediumLevelILSSAInstruction
s]
children (MediumLevelILAssert MediumLevelILAssertRec
_) = []
children (MediumLevelILAssertSsa MediumLevelILAssertSsaRec
_) = []
children (MediumLevelILForceVer MediumLevelILForceVerRec
_) = []
children (MediumLevelILForceVerSsa MediumLevelILForceVerSsaRec
_) = []
children (MediumLevelILVarField MediumLevelILVarFieldRec
_) = []
children (MediumLevelILVarSplit MediumLevelILVarSplitRec
_) = []
children (MediumLevelILUndef MediumLevelILUndefRec
_) = []
children (MediumLevelILUnimpl MediumLevelILUnimplRec
_) = []
children (MediumLevelILSeparateParamList MediumLevelILSeparateParamListRec {params :: MediumLevelILSeparateParamListRec -> [MediumLevelILSSAInstruction]
params = [MediumLevelILSSAInstruction]
p}) =
  (MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction])
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children [MediumLevelILSSAInstruction]
p [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ [MediumLevelILSSAInstruction]
p
children (MediumLevelILSharedParamSlot MediumLevelILSharedParamSlotRec {params :: MediumLevelILSharedParamSlotRec -> [MediumLevelILSSAInstruction]
params = [MediumLevelILSSAInstruction]
p}) =
  (MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction])
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap MediumLevelILSSAInstruction -> [MediumLevelILSSAInstruction]
children [MediumLevelILSSAInstruction]
p [MediumLevelILSSAInstruction]
-> [MediumLevelILSSAInstruction] -> [MediumLevelILSSAInstruction]
forall a. [a] -> [a] -> [a]
++ [MediumLevelILSSAInstruction]
p