getArg s b i =
  let n = length (tmp s)
  in if (b - i) <= n
    then (tmp s)   !! (n - 1 - (n - (b - i)))
    else (stack s) !! ((length (stack s)) - 1 - (gap s) + (b - n) - i)
getArg s b i =
  let n = length (tmp s)
  in if (b - i) <= n
    then (tmp s)   !! (n - 1 - (n - (b - i)))
    else (stack s) !! ((length (stack s)) - 1 - (gap s) + (b - n) - i)
getArg s b i =
  let n = length (tmp s)
  in if (b - i) <= n
    then (tmp s)   !! (n - 1 - (n - (b - i)))
    else (stack s) !! ((length (stack s)) - 1 - (gap s) + (b - n) - i)