/*===========================================================================*/
/*   (Unsafe/hmac.scm)                                                       */
/*   Bigloo (4.7a)                                                           */
/*   Inria -- Sophia Antipolis (c)       Thu Feb 19 09:11:58 AM CET 2026     */
/*===========================================================================*/
/* COMPILATION: (/home/serrano/prgm/project/bigloo/4.7a/bin/bigloo -srfi bigloo-unsafe -O3 -fcfa-arithmetic -q -lib-dir /home/serrano/prgm/project/bigloo/4.7a/lib/bigloo/4.7a +rm -mklib -cc gcc -fsharing -q -no-hello -unsafe -safee -O4 -stdc -c Unsafe/hmac.scm -indent -o objs/obj_u/Unsafe/hmac.c) */
/* GC selection */
#define THE_GC BOEHM_GC

/* unsafe mode */
#define BIGLOO_UNSAFE 1

/* traces mode */
#define BIGLOO_TRACE 0

/* standard Bigloo include */
#include <bigloo.h>

#ifdef __cplusplus
extern "C"
{
#endif
#ifndef BGL_MODULE_TYPE_DEFINITIONS
#define BGL_MODULE_TYPE_DEFINITIONS
#ifndef BGL___HMAC_TYPE_DEFINITIONS
#define BGL___HMAC_TYPE_DEFINITIONS
#endif													// BGL___HMAC_TYPE_DEFINITIONS
#endif													// BGL_MODULE_TYPE_DEFINITIONS

	static obj_t BGl_requirezd2initializa7ationz75zz__hmacz00 = BUNSPEC;
	extern obj_t BGl_typezd2errorzd2zz__errorz00(obj_t, obj_t, obj_t, obj_t,
		obj_t);
	BGL_EXPORTED_DECL obj_t BGl_modulezd2initializa7ationz75zz__hmacz00(long,
		char *);
	extern obj_t BGl_modulezd2initializa7ationz75zz__base64z00(long, char *);
	extern obj_t BGl_modulezd2initializa7ationz75zz__paramz00(long, char *);
	static obj_t BGl_genericzd2initzd2zz__hmacz00(void);
	extern obj_t BGl_stringzd2hexzd2internz12z12zz__r4_strings_6_7z00(obj_t);
	static obj_t BGl_importedzd2moduleszd2initz00zz__hmacz00(void);
	static obj_t BGl_gczd2rootszd2initz00zz__hmacz00(void);
	static obj_t BGl_objectzd2initzd2zz__hmacz00(void);
	BGL_EXPORTED_DECL obj_t BGl_hmaczd2stringzd2zz__hmacz00(obj_t, obj_t, obj_t);
	static obj_t BGl_methodzd2initzd2zz__hmacz00(void);
	extern obj_t blit_string(obj_t, long, obj_t, long, long);
	extern obj_t make_string(long, unsigned char);
	extern obj_t string_append(obj_t, obj_t);
	extern obj_t make_string_sans_fill(long);
	static obj_t BGl_z62hmaczd2stringzb0zz__hmacz00(obj_t, obj_t, obj_t, obj_t);
	static obj_t *__cnst;


	   
		 
		BGL_DEFINE_STRING(BGl_string1641z00zz__hmacz00,
		BgL_bgl_string1641za700za7za7_1646za7,
		"/tmp/bigloo/runtime/Unsafe/hmac.scm", 35);
	      BGL_DEFINE_STRING(BGl_string1642z00zz__hmacz00,
		BgL_bgl_string1642za700za7za7_1647za7, "&hmac-string", 12);
	      BGL_DEFINE_STRING(BGl_string1643z00zz__hmacz00,
		BgL_bgl_string1643za700za7za7_1648za7, "bstring", 7);
	      BGL_DEFINE_STRING(BGl_string1644z00zz__hmacz00,
		BgL_bgl_string1644za700za7za7_1649za7, "procedure", 9);
	      BGL_DEFINE_STRING(BGl_string1645z00zz__hmacz00,
		BgL_bgl_string1645za700za7za7_1650za7, "__hmac", 6);
	      DEFINE_EXPORT_BGL_PROCEDURE(BGl_hmaczd2stringzd2envz00zz__hmacz00,
		BgL_bgl_za762hmacza7d2string1651z00, BGl_z62hmaczd2stringzb0zz__hmacz00, 0L,
		BUNSPEC, 3);

/* contant bindings */
	static void bgl_constant_bindings()
	{
		BGL_BIND_PROCEDURE(BGl_hmaczd2stringzd2envz00zz__hmacz00,
			BgL_bgl_za762hmacza7d2string1651z00);
		BGL_BIND_STRING(BGl_string1645z00zz__hmacz00,
			BgL_bgl_string1645za700za7za7_1650za7);
		BGL_BIND_STRING(BGl_string1644z00zz__hmacz00,
			BgL_bgl_string1644za700za7za7_1649za7);
		BGL_BIND_STRING(BGl_string1643z00zz__hmacz00,
			BgL_bgl_string1643za700za7za7_1648za7);
		BGL_BIND_STRING(BGl_string1642z00zz__hmacz00,
			BgL_bgl_string1642za700za7za7_1647za7);
		BGL_BIND_STRING(BGl_string1641z00zz__hmacz00,
			BgL_bgl_string1641za700za7za7_1646za7);
	}

/* GC roots registration */
	static obj_t bgl_gc_roots_register()
	{
#if defined( BGL_GC_ROOTS )
#define ADD_ROOT( addr ) (addr > roots_max ? roots_max = addr : (addr < roots_min ? roots_min = addr : 0))
		void *roots_min = (void *) ULONG_MAX, *roots_max = 0;

		ADD_ROOT((void *) (&BGl_requirezd2initializa7ationz75zz__hmacz00));
#undef ADD_ROOT
		if (roots_max > 0)
			GC_add_roots(roots_min, ((void **) roots_max) + 1);
#endif
		return BUNSPEC;
	}



/* module-initialization */
	BGL_EXPORTED_DEF obj_t BGl_modulezd2initializa7ationz75zz__hmacz00(long
		BgL_checksumz00_2019, char *BgL_fromz00_2020)
	{
		{
			if (CBOOL(BGl_requirezd2initializa7ationz75zz__hmacz00))
				{
					BGl_requirezd2initializa7ationz75zz__hmacz00 = BBOOL(((bool_t) 0));
					bgl_constant_bindings();
					BGl_gczd2rootszd2initz00zz__hmacz00();
					BGl_importedzd2moduleszd2initz00zz__hmacz00();
					return BGl_methodzd2initzd2zz__hmacz00();
				}
			else
				{
					return BUNSPEC;
				}
		}

	}



/* gc-roots-init */
	obj_t BGl_gczd2rootszd2initz00zz__hmacz00(void)
	{
		{	/* Unsafe/hmac.scm 15 */
			return bgl_gc_roots_register();
		}

	}



/* hmac-string */
	BGL_EXPORTED_DEF obj_t BGl_hmaczd2stringzd2zz__hmacz00(obj_t BgL_keyz00_3,
		obj_t BgL_messagez00_4, obj_t BgL_hashz00_5)
	{
		{	/* Unsafe/hmac.scm 57 */
			{	/* Unsafe/hmac.scm 61 */
				obj_t BgL_keybz00_1288;

				BgL_keybz00_1288 = make_string(64L, ((unsigned char) '\000'));
				{	/* Unsafe/hmac.scm 63 */
					obj_t BgL_ixorz00_1289;

					BgL_ixorz00_1289 = make_string_sans_fill(64L);
					{	/* Unsafe/hmac.scm 64 */
						obj_t BgL_oxorz00_1290;

						BgL_oxorz00_1290 = make_string_sans_fill(64L);
						{	/* Unsafe/hmac.scm 65 */

							{	/* Unsafe/hmac.scm 67 */
								long BgL_keyzd2lengthzd2_1291;

								BgL_keyzd2lengthzd2_1291 = STRING_LENGTH(BgL_keyz00_3);
								if ((BgL_keyzd2lengthzd2_1291 > 64L))
									{	/* Unsafe/hmac.scm 69 */
										obj_t BgL_arg1192z00_1293;

										{	/* Unsafe/hmac.scm 69 */
											obj_t BgL_arg1193z00_1294;

											BgL_arg1193z00_1294 =
												BGL_PROCEDURE_CALL1(BgL_hashz00_5, BgL_keyz00_3);
											BgL_arg1192z00_1293 =
												BGl_stringzd2hexzd2internz12z12zz__r4_strings_6_7z00
												(BgL_arg1193z00_1294);
										}
										blit_string(BgL_arg1192z00_1293, 0L, BgL_keybz00_1288, 0L,
											16L);
									}
								else
									{	/* Unsafe/hmac.scm 68 */
										blit_string(BgL_keyz00_3, 0L, BgL_keybz00_1288, 0L,
											BgL_keyzd2lengthzd2_1291);
									}
							}
							{
								long BgL_iz00_1296;

								BgL_iz00_1296 = 0L;
							BgL_zc3z04anonymousza31194ze3z87_1297:
								if ((BgL_iz00_1296 < 64L))
									{	/* Unsafe/hmac.scm 74 */
										long BgL_xiz00_1299;

										BgL_xiz00_1299 =
											(STRING_REF(BgL_keybz00_1288, BgL_iz00_1296));
										{	/* Unsafe/hmac.scm 75 */
											unsigned char BgL_tmpz00_2046;

											BgL_tmpz00_2046 = ((54L ^ BgL_xiz00_1299));
											STRING_SET(BgL_ixorz00_1289, BgL_iz00_1296,
												BgL_tmpz00_2046);
										}
										{	/* Unsafe/hmac.scm 76 */
											unsigned char BgL_tmpz00_2050;

											BgL_tmpz00_2050 = ((92L ^ BgL_xiz00_1299));
											STRING_SET(BgL_oxorz00_1290, BgL_iz00_1296,
												BgL_tmpz00_2050);
										}
										{
											long BgL_iz00_2054;

											BgL_iz00_2054 = (BgL_iz00_1296 + 1L);
											BgL_iz00_1296 = BgL_iz00_2054;
											goto BgL_zc3z04anonymousza31194ze3z87_1297;
										}
									}
								else
									{	/* Unsafe/hmac.scm 73 */
										((bool_t) 0);
									}
							}
							{	/* Unsafe/hmac.scm 82 */
								obj_t BgL_arg1207z00_1307;

								{	/* Unsafe/hmac.scm 82 */
									obj_t BgL_arg1208z00_1308;

									{	/* Unsafe/hmac.scm 82 */
										obj_t BgL_arg1211z00_1309;

										{	/* Unsafe/hmac.scm 82 */
											obj_t BgL_arg1213z00_1310;

											BgL_arg1213z00_1310 =
												string_append(BgL_ixorz00_1289, BgL_messagez00_4);
											BgL_arg1211z00_1309 =
												BGL_PROCEDURE_CALL1(BgL_hashz00_5, BgL_arg1213z00_1310);
										}
										BgL_arg1208z00_1308 =
											BGl_stringzd2hexzd2internz12z12zz__r4_strings_6_7z00
											(BgL_arg1211z00_1309);
									}
									BgL_arg1207z00_1307 =
										string_append(BgL_oxorz00_1290, BgL_arg1208z00_1308);
								}
								return BGL_PROCEDURE_CALL1(BgL_hashz00_5, BgL_arg1207z00_1307);
							}
						}
					}
				}
			}
		}

	}



/* &hmac-string */
	obj_t BGl_z62hmaczd2stringzb0zz__hmacz00(obj_t BgL_envz00_2009,
		obj_t BgL_keyz00_2010, obj_t BgL_messagez00_2011, obj_t BgL_hashz00_2012)
	{
		{	/* Unsafe/hmac.scm 57 */
			{	/* Unsafe/hmac.scm 59 */
				obj_t BgL_auxz00_2081;
				obj_t BgL_auxz00_2074;
				obj_t BgL_auxz00_2067;

				if (PROCEDUREP(BgL_hashz00_2012))
					{	/* Unsafe/hmac.scm 59 */
						BgL_auxz00_2081 = BgL_hashz00_2012;
					}
				else
					{
						obj_t BgL_auxz00_2084;

						BgL_auxz00_2084 =
							BGl_typezd2errorzd2zz__errorz00(BGl_string1641z00zz__hmacz00,
							BINT(2036L), BGl_string1642z00zz__hmacz00,
							BGl_string1644z00zz__hmacz00, BgL_hashz00_2012);
						FAILURE(BgL_auxz00_2084, BFALSE, BFALSE);
					}
				if (STRINGP(BgL_messagez00_2011))
					{	/* Unsafe/hmac.scm 59 */
						BgL_auxz00_2074 = BgL_messagez00_2011;
					}
				else
					{
						obj_t BgL_auxz00_2077;

						BgL_auxz00_2077 =
							BGl_typezd2errorzd2zz__errorz00(BGl_string1641z00zz__hmacz00,
							BINT(2036L), BGl_string1642z00zz__hmacz00,
							BGl_string1643z00zz__hmacz00, BgL_messagez00_2011);
						FAILURE(BgL_auxz00_2077, BFALSE, BFALSE);
					}
				if (STRINGP(BgL_keyz00_2010))
					{	/* Unsafe/hmac.scm 59 */
						BgL_auxz00_2067 = BgL_keyz00_2010;
					}
				else
					{
						obj_t BgL_auxz00_2070;

						BgL_auxz00_2070 =
							BGl_typezd2errorzd2zz__errorz00(BGl_string1641z00zz__hmacz00,
							BINT(2036L), BGl_string1642z00zz__hmacz00,
							BGl_string1643z00zz__hmacz00, BgL_keyz00_2010);
						FAILURE(BgL_auxz00_2070, BFALSE, BFALSE);
					}
				return
					BGl_hmaczd2stringzd2zz__hmacz00(BgL_auxz00_2067, BgL_auxz00_2074,
					BgL_auxz00_2081);
			}
		}

	}



/* object-init */
	obj_t BGl_objectzd2initzd2zz__hmacz00(void)
	{
		{	/* Unsafe/hmac.scm 15 */
			return BUNSPEC;
		}

	}



/* generic-init */
	obj_t BGl_genericzd2initzd2zz__hmacz00(void)
	{
		{	/* Unsafe/hmac.scm 15 */
			return BUNSPEC;
		}

	}



/* method-init */
	obj_t BGl_methodzd2initzd2zz__hmacz00(void)
	{
		{	/* Unsafe/hmac.scm 15 */
			return BUNSPEC;
		}

	}



/* imported-modules-init */
	obj_t BGl_importedzd2moduleszd2initz00zz__hmacz00(void)
	{
		{	/* Unsafe/hmac.scm 15 */
			BGl_modulezd2initializa7ationz75zz__paramz00(453939141L,
				BSTRING_TO_STRING(BGl_string1645z00zz__hmacz00));
			return
				BGl_modulezd2initializa7ationz75zz__base64z00(67813413L,
				BSTRING_TO_STRING(BGl_string1645z00zz__hmacz00));
		}

	}

#ifdef __cplusplus
}
#endif
