The following hypothetical function is a tricky one to calculate time complexity for. Not only is there recursion, but there are also for loops. The time complexity of calc() is $O(1)$.
void fun(int l, int r) {
if(r-l+1<=1234) return;
int m=(l+r)/2;
int m1=(l+m)/2, m2=(m+1+r)/2;
fun(l, m);
fun(m1+1, m2);
for(int k=1;k<=r-l+1;k++)
for(int i=1;i<=r-l+1;i++)
for(int j=l;j<=r;j+=i)
calc(j, i);
fun(m+1, r);
fun(m1+1, m2);
}
Assuming the initial input is l=1, r=N, what is the Big-O time complexity of this function, as tightly bounded as possible? Please explain how I could get the answer.