how many malloc calls does this program make in total?
/* 
 * Create a new user with the given name.  Insert it at the tail of the list 
 * of users whose head is pointed to by *user_ptr_add. 
 * 
 * Return: 
 *   - 0 if successful 
 *   - 1 if a user by this name already exists in this list 
 *   - 2 if the given name cannot fit in the 'name' array 
 *       (don't forget about the null terminator) 
 */  
int create_user(const char *name, User **user_ptr_add) { 

    if(strlen(name) > MAX_NAME - 1){
        return 2;
    }

    User *curr = *user_ptr_add;
    User *new_user = malloc(sizeof(User));

    if(curr == NULL){
  
        strcpy(new_user-> name, name); 
        new_user->name[MAX_NAME - 1] = '\0';
        new_user->first_post = NULL;
        new_user->next = NULL;
       
        *user_ptr_add = new_user;
        // fprintf(stdout, "%s\n", curr->name);
        return 0;
    }
    else{
        while(curr->next != NULL){

            if(strcmp(name, curr->name)==0){
                return 1;
            }
            curr = curr->next;
        }

        // Checking the last one
        if(strcmp(name, curr->name)==0){
                return 1;
        }

        strcpy(new_user-> name, name); 

        for(int i = 0; i < MAX_FRIENDS - 1; i++){
            new_user->friends[i] = NULL;
        }

        curr->next = new_user;
        // fprintf(stdout, "%s\n", curr->name);
        return 0;
    } 
}  
  
  
/* 
 * Return a pointer to the user with this name in 
 * the list starting with head. Return NULL if no such user exists. 
 * 
 * NOTE: You'll likely need to cast a (const User *) to a (User *) 
 * to satisfy the prototype without warnings. 
 */  
User *find_user(const char *name, const User *head) {  

   User *curr = (User *) head;

    while(curr != NULL){
        if(strcmp(name, curr->name)==0){
            return curr;
        }
        curr = curr->next;
    }
    return NULL; 
}  
  
  
/* 
 * Print the usernames of all users in the list starting at curr. 
 * Names should be printed to standard output, one per line. 
 */  
void list_users(const User *curr) {  

    User *current = (User*) curr;

    while(current != NULL){
        fprintf(stdout, "%s\n", current->name);
        current = current->next;
    }
}  
  
/* 
 * Change the filename for the profile pic of the given user. 
 * 
 * Return: 
 *   - 0 on success. 
 *   - 1 if the file does not exist or cannot be opened. 
 *   - 2 if the filename is too long. 
 */  
int update_pic(User *user, const char *filename) {  
    if(strlen(filename) > 31){
        return 2;
    }
    int res = -1;
    FILE *picture;
    picture = fopen(filename, "r");

    if(picture == NULL){
        // fprintf(stdout, "fail");
        res = 1;
    }else {
        strcpy(user-> profile_pic, filename);
        // fprintf(stdout, "success");
        res = 0;
    }

    fclose(picture);
    return res;
}  
  
  
/* 
 * Make two users friends with each other.  This is symmetric - a pointer to 
 * each user must be stored in the 'friends' array of the other. 
 * 
 * New friends must be added in the first empty spot in the 'friends' array. 
 * 
 * Return: 
 *   - 0 on success. 
 *   - 1 if the two users are already friends. 
 *   - 2 if the users are not already friends, but at least one already has 
 *     MAX_FRIENDS friends. 
 *   - 3 if the same user is passed in twice. 
 *   - 4 if at least one user does not exist. 
 * 
 * Do not modify either user if the result is a failure. 
 * NOTE: If multiple errors apply, return the *largest* error code that applies. 
 */  

 // ./friendme sample.txt

int make_friends(const char *name1, const char *name2, User *head){ 
    // struct user *friends[MAX_FRIENDS]; an array of users?

    int error = -1;

    // Case 3 if the same user is passed in twice.
    if(strcmp(name1, name2)==0){
        error = 3;
    }

    // Case 4 if at least one user does not exist. 
    User *user1 = find_user(name1, head);
    User *user2 = find_user(name2, head);

    if(user1 == NULL || user2 == NULL){
        return 4;
    }

    // Case 1 if the two users are already friends
    for(int i = 0;i < 9; i ++){
        // Is this symmetric?
        if(user1->friends[i] != NULL && strcmp(user1->friends[i]->name, name2)== 0){
           if(error < 1){
            error = 1;
           }
        } 
    
        // Case 2 if the users are not already friends, but at least one already has 
        // MAX_FRIENDS friends. 

        if(user1->friends[9] != NULL || user2->friends[9] != NULL){
            if(error < 2){
                error = 2;
            }
        }
    }
    if(error > 0){
        return error;
    }
    else{
        error = 0;
    }

    int done1 = 0;
    int done2 = 0;

    if(error == 0){
    // Case 0 make them friends
        for(int i = 0; i < 9; i++){
            if(done1 == 0){
                if(user1->friends[i] == NULL){
                    user1->friends[i] = user2; 
                    done1 = 1;
                }
            }
            if(done2 == 0){
                if(user2->friends[i] == NULL){
                    user2->friends[i] = user1; 
                    done2 = 1;
                }
            }
            // fprintf(stdout, "%s\n",user1->friends[i]->name);
            // fprintf(stdout, "%s\n",user2->friends[i]->name);
        }
    }  
    return error;    
}

/* 
 * Print a user profile. 
 * For an example of the required output format, see the example output 
 * linked from the handout. 
 * Return: 
 *   - 0 on success. 
 *   - 1 if the user is NULL. 
 */  
int print_user(const User *user) {  

    if(user == NULL){
        return 1;
    }

    // Print profile picture
    FILE *picture;
    picture = fopen(user->profile_pic, "r");

    char line[200];

    if(picture != NULL){
        while(fgets(line, 200, picture)!= NULL){
           fprintf(stdout, "%s", line); 
        }
        fprintf(stdout, "\n"); 
    }

    // Print Name
    fprintf(stdout, "Name: %s", user->name);
    fprintf(stdout, "\n------------------------------------------\n");

    // Print Friends
    fprintf(stdout, "Friends:\n");  
    for(int i = 0; i < MAX_FRIENDS - 1; i ++){
        if(user->friends[i] != NULL){
           fprintf(stdout, "%s", user->friends[i]->name);
           fprintf(stdout, "\n");  
        }
       
    }
    fprintf(stdout, "------------------------------------------\n");

    Post *p = user->first_post;

    fprintf(stdout, "Posts:\n");
    // Print posts
    while(p != NULL){

        // Print the Author
        fprintf(stdout, "From: %s",p->author);
        fprintf(stdout, "\n");  

        fprintf(stdout, "Date: %s",ctime(p->date));

        fprintf(stdout, "\n");  

        // Print the content
        fprintf(stdout, "%s",p->contents);
        fprintf(stdout, "\n"); 
        
        p = p->next; 

        if(p != NULL){
            fprintf(stdout, "\n");  
            fprintf(stdout, "===\n"); 
            fprintf(stdout, "\n");  
        }

    }

    fprintf(stdout, "------------------------------------------\n");
    return 0;

}  


/* 
 * Make a new post from 'author' to the 'target' user, 
 * containing the given contents, IF the users are friends. 
 * 
 * Insert the new post at the *front* of the user's list of posts. 
 * 
 * 'contents' is a pointer to heap-allocated memory - you do not need 
 * to allocate more memory to store the contents of the post. 
 * 
 * Return: 
 *   - 0 on success 
 *   - 1 if users exist but are not friends 
 *   - 2 if either User pointer is NULL 
 */  
int make_post(const User *author, User *target, char *contents) { 
    
    if(author == NULL || target == NULL){
        return 2;
    }
    // Check if the users are friends
    for(int i = 0; i < MAX_FRIENDS - 1; i++){
        // They have no friends
        if(author->friends[i] == NULL || target->friends[i] == NULL){
            return 1;
        // If they are friends
        }else if (strcmp(author->friends[i]->name, target->name) == 0){

            Post *p = malloc(sizeof(Post));

            strcpy(p-> author, author->name); 

            p->contents = contents;

            p->date = malloc(sizeof(time_t));
            time(p->date);
            p->next = target->first_post;
            target->first_post = p;
            
            return 0;
        }
    } 
    return 1; 
}
  
  
/* 
 * From the list pointed to by *user_ptr_del, delete the user 
 * with the given name. 
 * Remove the deleted user from any lists of friends. 
 * 
 * Return: 
 *   - 0 on success. 
 *   - 1 if a user with this name does not exist. 
 */  
int delete_user(const char *name, User **user_ptr_del) {  

    User *curr = *user_ptr_del;

    int index1 = 0;
    
    int i = 0;
    int j = 0;

    while(curr != NULL){
            //Delete user friend
            while(i < MAX_FRIENDS - 1 && curr->friends[i] != NULL){
                while(j < MAX_FRIENDS - 1 && curr->friends[i]->friends[j] != NULL){
                    if(strcmp(curr->friends[i]->friends[j]->name, name) == 0){
                        index1 = j;
                    }
                    j++;   
                }
                curr->friends[i]->friends[index1] = curr->friends[i]->friends[j - 1];
                curr->friends[i]->friends[j - 1] = NULL;
                i++;
            }
        curr = curr->next;
    }

    User *curr2 = *user_ptr_del;
    User *prev = NULL;
    Post *bye = NULL;

    while(curr2 != NULL){
        
        if(strcmp(name, curr2->name)==0){
            Post *p = curr2->first_post;

            while(p != NULL){
                free(p->date);
                free(p->contents);
                bye = p;
                p = p->next; 
                free(bye);
            }

            curr2->first_post = NULL;

            if(prev ==NULL){
                *user_ptr_del = curr2->next;
            }else{
                prev->next = curr2->next;
            }
            free(curr2);
            return 0;
        }
        prev = curr2;
        curr2 = curr2->next;
    }
       
    return 1;
}  