matchArg opts sc cc cs prepost actual@(RVal ref) expectedTy setupval =
  case setupval of
    MS.SetupVar var ->
      do assignVar cc (cs ^. MS.csLoc) var ref

    MS.SetupNull () ->
      do sym <- Ov.getSymInterface
         p   <- liftIO (CJ.refIsNull sym ref)
         addAssert p (Crucible.SimError (cs ^. MS.csLoc) (Crucible.AssertFailureSimError ("null-equality " ++ stateCond prepost) ""))

    MS.SetupGlobal empty _ -> absurd empty

    _ -> failure (cs ^. MS.csLoc) =<<
           mkStructuralMismatch opts cc sc cs actual setupval expectedTy
matchArg opts sc cc cs prepost actual@(RVal ref) expectedTy setupval =
  case setupval of
    MS.SetupVar var ->
      do assignVar cc (cs ^. MS.csLoc) var ref

    MS.SetupNull () ->
      do sym <- Ov.getSymInterface
         p   <- liftIO (CJ.refIsNull sym ref)
         addAssert p (Crucible.SimError (cs ^. MS.csLoc) (Crucible.AssertFailureSimError ("null-equality " ++ stateCond prepost) ""))

    MS.SetupGlobal empty _ -> absurd empty

    _ -> failure (cs ^. MS.csLoc) =<<
           mkStructuralMismatch opts cc sc cs actual setupval expectedTy
matchArg opts sc cc cs prepost actual@(RVal ref) expectedTy setupval =
  case setupval of
    MS.SetupVar var ->
      do assignVar cc (cs ^. MS.csLoc) var ref

    MS.SetupNull () ->
      do sym <- Ov.getSymInterface
         p   <- liftIO (CJ.refIsNull sym ref)
         addAssert p (Crucible.SimError (cs ^. MS.csLoc) (Crucible.AssertFailureSimError ("null-equality " ++ stateCond prepost) ""))

    MS.SetupGlobal empty _ -> absurd empty

    _ -> failure (cs ^. MS.csLoc) =<<
           mkStructuralMismatch opts cc sc cs actual setupval expectedTy