/* Machine generated file, do not modify */
#include "HsFFI.h"
static HugsAPI4 *hugs = 0;
#include "stdlib.h"

static void hugsprim_free_3(HugsStackPtr);
static void hugsprim_free_3(HugsStackPtr hugs_root)
{
    hugs->putAddr(&free);
}
#include "stdlib.h"

static void hugsprim_free_2(HugsStackPtr);
static void hugsprim_free_2(HugsStackPtr hugs_root)
{
    HsPtr arg1;
    arg1 = hugs->getPtr();
    free(arg1);
    
    hugs->returnIO(hugs_root,0);
}
#include "stdlib.h"

static void hugsprim_realloc_1(HugsStackPtr);
static void hugsprim_realloc_1(HugsStackPtr hugs_root)
{
    HsPtr arg1;
    HsInt arg2;
    HsPtr res1;
    arg1 = hugs->getPtr();
    arg2 = hugs->getInt();
    res1 = realloc(arg1, arg2);
    hugs->putPtr(res1);
    hugs->returnIO(hugs_root,1);
}
#include "stdlib.h"

static void hugsprim_malloc_0(HugsStackPtr);
static void hugsprim_malloc_0(HugsStackPtr hugs_root)
{
    HsInt arg1;
    HsPtr res1;
    arg1 = hugs->getInt();
    res1 = malloc(arg1);
    hugs->putPtr(res1);
    hugs->returnIO(hugs_root,1);
}

static struct hugs_primitive hugs_primTable[] = {
    {"finalizerFree", 0, hugsprim_free_3},
    {"_free", 3, hugsprim_free_2},
    {"_realloc", 4, hugsprim_realloc_1},
    {"_malloc", 3, hugsprim_malloc_0},
};

static void hugs_primControl(int);
static void hugs_primControl(what)
int what; {
}
static struct hugs_primInfo hugs_prims = { hugs_primControl, hugs_primTable, 0 };

#ifdef __cplusplus
extern "C" {
#endif
DLLEXPORT(void) initModule(HugsAPI4 *);
DLLEXPORT(void) initModule(HugsAPI4 *hugsAPI) {
    hugs = hugsAPI;
    hugs->registerPrims(&hugs_prims);
}
#ifdef __cplusplus
}
#endif

