Maybe just me but it might be easier to follow if `priority` and `flags` were declared with default values

    VALUE priority = INT2FIX(1)
    VALUE flags = INT2FIX(0)

Then overwrite if values are supplied:

    if (argc == 3) {
       priority = argv[1];
       flags = argv[2];
     }