I haven't done this for user, but basically what you want is the user datamanager
your code will look *something* like this
PHP Code:
require_once('includes/functions.php');
$userdm = datamanager_init("User");
$userdm->do_set('username', $username);
$userdm->do_set('email', $email);
//heaps more stuff here
$userdm->save();
have a look at includes/class_dm_user.php, and note that some of the required params are bitfields, and will need to be set with set_bitfield.
Its not trivial.