path from a location to the program entry

I want to find the path from a program location to main.entry. Lets
consider the following program where I am interested to find the path
from p = &a to main.entry.

int *p;
int a, b;

void foo(){
     ...
     p = &a; // <--- location
     ...
}

void bar(){
    ...
    p = &b;
    ...
}

void main(){

   foo();
   ...
}

Is there any transformation pass that inlines callees into callers or
vice versa and make a one-whole function so that I can backtrack from
fun_ptr = &foo to main.entry.

Thanks,
Syed