I would like to get the correspondent numbers between two integers intervals. My input is like that:

```
start1 end1 start2 end2
20 30 25 35
25 35 20 30
100 190 126 226
126 226 100 190
```

In the first and second line, the overlap from first(1) interval (2 first columns) to second(2) interval (2 last columns) was equal to 6 correspondents numbers (25,26,27,28,29 and 30).

My expected output is like that:

```
start1 end1 start2 end2 bp_overlapped
20 30 25 35 6
25 35 20 30 6
100 190 126 226 65
126 226 100 190 65
```

It is a matrix in R.

Thank you

Please indicate relevance of question to a specific bioinformatics research problem.