/*
 * This file was generated automatically by xsubpp version 1.9508 from the
 * contents of Pair.xs. Do not edit this file, edit Pair.xs instead.
 *
 *	ANY CHANGES MADE HERE WILL BE LOST!
 *
 */

#line 1 "Pair.xs"
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"

#include "ppport.h"


#line 18 "Pair.c"
XS(XS_TSH__Pair_Resolve); /* prototype to pass -Wmissing-prototypes */
XS(XS_TSH__Pair_Resolve)
{
    dXSARGS;
    if (items != 1)
	Perl_croak(aTHX_ "Usage: TSH::Pair::Resolve(playersp)");
    {
	SV *	playersp = ST(0);
	AV *	RETVAL;
#line 14 "Pair.xs"
    int i;
    int nplayers;
    AV *pairings;
    int *prefs;
    AV *players;
    /* players is not a reference */
    if (!SvROK(playersp)) { XSRETURN_UNDEF; }
    /* players is not a reference to an array */
    players = (AV *) SvRV(playersp);
    if (SvTYPE(players) != SVt_PVAV) { XSRETURN_UNDEF; }
    /* count players */
    nplayers = av_len(players) + 1;
    /* allocate return vector */
    pairings = (AV *) sv_2mortal((SV *)newAV());
    /* allocate working copies of preference lists */
    Newz(1, prefs, nplayers * nplayers, int);
#line 45 "Pair.c"
#line 31 "Pair.xs"
    av_push(pairings, newSVuv((UV) nplayers));
    Safefree(prefs);
    RETVAL = pairings;
#line 50 "Pair.c"
	ST(0) = newRV((SV*)RETVAL);
	sv_2mortal(ST(0));
    }
    XSRETURN(1);
}

#ifdef __cplusplus
extern "C"
#endif
XS(boot_TSH__Pair); /* prototype to pass -Wmissing-prototypes */
XS(boot_TSH__Pair)
{
    dXSARGS;
    char* file = __FILE__;

    XS_VERSION_BOOTCHECK ;

        newXS("TSH::Pair::Resolve", XS_TSH__Pair_Resolve, file);
    XSRETURN_YES;
}

