rearrange :: Int -> GMHeap -> GMStack -> GMStack
rearrange n heap addrs
    = take n addrs' ++ drop n addrs 
    where addrs' = map (getArg . hLookup heap) (tail addrs) 
rearrange :: Int -> GMHeap -> GMStack -> GMStack
rearrange n heap addrs
    = take n addrs' ++ drop n addrs 
    where addrs' = map (getArg . hLookup heap) (tail addrs) 
rearrange n heap addrs
    = take n addrs' ++ drop n addrs 
    where addrs' = map (getArg . hLookup heap) (tail addrs) 