threadsIC ((d1 ::= d2,i):stms) j = 
    case (compare i j) of 
      LT -> (
             IfThen(E (Op2 Lt (Index "tid" []) (LitInt i))) 
                       [(d1 ::= d2)] 
                       
            ):(threadsIC stms j) 
      EQ -> (d1 ::= d2):(threadsIC stms j) 
      GT -> error "threadsIC: Impossible"
threadsIC ((d1 ::= d2,i):stms) j = 
    case (compare i j) of 
      LT -> (
             IfThen(E (Op2 Lt (Index "tid" []) (LitInt i))) 
                       [(d1 ::= d2)] 
                       
            ):(threadsIC stms j) 
      EQ -> (d1 ::= d2):(threadsIC stms j) 
      GT -> error "threadsIC: Impossible"
threadsIC ((d1 ::= d2,i):stms) j = 
    case (compare i j) of 
      LT -> (
             IfThen(E (Op2 Lt (Index "tid" []) (LitInt i))) 
                       [(d1 ::= d2)] 
                       
            ):(threadsIC stms j) 
      EQ -> (d1 ::= d2):(threadsIC stms j) 
      GT -> error "threadsIC: Impossible"