let merge_info_calls calls1 calls2 merge_a merge_b =
let merge_info (b1, sgn1) (b2, sgn2) =
let b = match b1, b2 with None, _ -> b2 | _, None -> b1
| Some b1, Some b2 -> Some (merge_b b1 b2)
in let sgn = Signature.merge sgn1 sgn2 merge_a in
(b, sgn)
in
let rec merge l1 l2 = match l1, l2 with
| [], _ -> l2
| _, [] -> l1
| ((call1, info1) as c1) :: tl1,
((call2, info2) as c2) :: tl2 ->
let id1 = call1.sid in
let id2 = call2.sid in
if id1 = id2 then
let info = merge_info info1 info2 in
(call1, info) :: (merge tl1 tl2)
else if id1 < id2 then c1 :: (merge tl1 l2)
else c2 :: (merge l1 tl2)
in merge calls1 calls2