I don't have the reputation to comment, but I wanted to leave a link to SOFA Tools for Earth Attitude. Section 5 walks through several formulations using the SOFA library. Here's an example implementation from section 5.5. I know this answer is a bit late, but I thought it would still be helpful for future googlers.
#include "sofa.h"
/**
* Compute the celestial-to-terrestrial rotation matrix (ITRF to GCRF)
* IAU 2006/2000A, CIO based, using classical angles
*
* This method includes EOP corrections for both the terrestrial pole (Xp, Yp),
* and celestial pole (dX06, dY06).
*
* Implements Section 5.5 of “SOFA Tools for Earth Attitude”
*
* References:
* [1] “SOFA Tools for Earth Attitude”, International Astronomical Union
* Standards of Fundamental Astronomy; International Astronomical
* Union (13 July 2017)
*
* @param tta First part of two-part Julian date in TT timescale
* @param ttb Second part of two-part Julian date in TT timescale
* @param uta First part of two-part Julian date in UT1 timescale
* @param utb Second part of two-part Julian date in UT1 timescale
* @param dx06 Celestial intermediate pole correction (from EOP parameters) [radians]
* @param dy06 Celestial intermediate pole correction (from EOP parameters) [radians]
* @param xp Coordinate of the pole (from EOP parameters) [radians]
* @param yp Coordinate of the pole (from EOP parameters) [radians]
*
* @param rc2it (modified by routine) The celestial-terrestrial rotation matrix
*/
void rc2it2006CioClassicalAngles(double tta, double ttb, double uta, double utb, double dx06, double dy06, double xp, double yp, double rc2it[3][3])
{
double x, y, s;
double rc2i[3][3];
double rc2ti[3][3];
double rpom[3][3];
// CIP and CIO, IAU 2006/2000A
iauXys06a(tta, ttb, &x, &y, &s);
// Add CIP correction
x += dx06;
y += dy06;
// GCRS to CIRS matrix
iauC2ixys(x, y, s, rc2i);
// ERA
auto era = iauEra00(uta, utb);
// Form celestial-terrestrial matrix (no polar motion yet)
iauCr(rc2i, rc2ti);
iauRz(era, rc2ti);
// Polar motion matrix (TIRS->ITRS, IERS 2003)
auto sp = iauSp00(tta, ttb);
iauPom00(xp, yp, sp, rpom);
// Form celestial-terrestrial matrix (including polar motion)
iauRxr(rpom, rc2ti, rc2it);
}