let rec map_il write_map read_map = function
ILstmtIf( t, n, m ) -> ILstmtIf( t, read_map n, m )
| ILstmtSwitch( n, jump_table ) -> ILstmtSwitch( read_map n, jump_table )
| ILstmtGoto _ as i -> i
| ILstmtReturn None as i -> i
| ILstmtReturn (Some n) -> ILstmtReturn (Some (read_map n))
| ILstmtAssign( n, t, e ) -> ILstmtAssign( write_map n, t, map_expr read_map e )
| ILstmtRead( n, t, lv, l ) -> ILstmtRead( write_map n, t, map_lvalue read_map lv, l )
| ILstmtWrite( ILlvTemp _, _, _ ) -> assert false
| ILstmtWrite( lv, l, n ) -> ILstmtWrite( map_lvalue read_map lv, l, read_map n )
| ILstmtInitialize( n, t, i ) -> ILstmtInitialize( read_map n, t, i )
| ILstmtSequence l -> ILstmtSequence (List.map (map_il write_map read_map) l)
| ILstmtParallel l -> ILstmtParallel (List.map (map_il write_map read_map) l)