let convert_block ~f cur ~info = 
  let rec convert_instruction i = 
    let new_i = 
      match i with
        ILstmtIf(pol, condition, target) ->
          IL0stmtIf(pol, condition, convert_target ~info ~cur target)
      | ILstmtSwitch(temp_id, target_list) ->
          IL0stmtSwitch
            (temp_id, 
             List.map 
               (fun (l,target) -> l, convert_target ~info ~cur target)
               target_list)
      | ILstmtGoto target ->
          IL0stmtGoto(convert_target ~info ~cur target)
      | ILstmtReturn(i) ->
          IL0stmtReturn(i)
      | ILstmtAssign(id, ty, ILexpArgument i) ->
          IL0stmtReadToTemp(id, ty, ILlvVar(get_argument_name ~f i, ty), [])
      | ILstmtAssign(id, ty, ex) ->
          IL0stmtDefTemp(id, ty, ex)
      | ILstmtRead(id, ty, lv, fl) ->
          IL0stmtReadToTemp(id, ty, lv, fl)
      | ILstmtWrite(lv, fl, id) ->
          IL0stmtWrite(lv, fl, id)
      | ILstmtInitialize(id, ty, init) -> failwith "unimp"
      | ILstmtSequence(is) ->
          IL0stmtSequence(List.map convert_instruction is)
      | ILstmtParallel(is) ->
          IL0stmtParallel(List.map convert_instruction is)
    in
    make_il0 new_i
  in
  List.map convert_instruction f.body.(cur).code