Insert Doubly Linked list in C by only one function

I am trying to work on insert function by doubly linked list in C. I could find how to do it by doing insert_head and insert_tail but is there any way that we can have only one function insert(int num) and insert the numbers? (not sorted, just displayed by order) so this is what I have set:

struct node {
int data;
struct node *next, *prev;

void insert(int num) {
struct node* temp = (struct node*) malloc (sizeof (struct node));
// doubly linked list