/*===========================================================================*/
/*   (Unsafe/hmac.scm)                                                       */
/*   Bigloo (4.5b)                                                           */
/*   Inria -- Sophia Antipolis (c)       Fri Dec 22 05:17:06 PM CET 2023     */
/*===========================================================================*/
/* COMPILATION: (/home/serrano/prgm/project/bigloo/bigloo/bin/bigloo -ldopt -L/home/serrano/prgm/project/bigloo/bigloo/libbacktrace/home/serrano/prgm/project/bigloo/bigloo/lib/bigloo/4.5b  -srfi enable-gmp -srfi bigloo-unsafe -O3 -fcfa-arithmetic -q -lib-dir /home/serrano/prgm/project/bigloo/bigloo/lib/bigloo/4.5b -rm -copt -w -lib-dir /home/serrano/prgm/project/bigloo/bigloo/lib/bigloo/4.5b -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;


	   
		 
		DEFINE_STRING(BGl_string1624z00zz__hmacz00,
		BgL_bgl_string1624za700za7za7_1629za7,
		"/tmp/bigloo/runtime/Unsafe/hmac.scm", 35);
	      DEFINE_STRING(BGl_string1625z00zz__hmacz00,
		BgL_bgl_string1625za700za7za7_1630za7, "&hmac-string", 12);
	      DEFINE_STRING(BGl_string1626z00zz__hmacz00,
		BgL_bgl_string1626za700za7za7_1631za7, "bstring", 7);
	      DEFINE_STRING(BGl_string1627z00zz__hmacz00,
		BgL_bgl_string1627za700za7za7_1632za7, "procedure", 9);
	      DEFINE_STRING(BGl_string1628z00zz__hmacz00,
		BgL_bgl_string1628za700za7za7_1633za7, "__hmac", 6);
	      DEFINE_EXPORT_BGL_PROCEDURE(BGl_hmaczd2stringzd2envz00zz__hmacz00,
		BgL_bgl_za762hmacza7d2string1634z00, BGl_z62hmaczd2stringzb0zz__hmacz00, 0L,
		BUNSPEC, 3);

/* 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_2011, char *BgL_fromz00_2012)
	{
		{
			if (CBOOL(BGl_requirezd2initializa7ationz75zz__hmacz00))
				{
					BGl_requirezd2initializa7ationz75zz__hmacz00 = BBOOL(((bool_t) 0));
					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_1282;

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

					BgL_ixorz00_1283 = make_string_sans_fill(64L);
					{	/* Unsafe/hmac.scm 64 */
						obj_t BgL_oxorz00_1284;

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

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

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

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

											BgL_arg1197z00_1288 =
												(VA_PROCEDUREP(BgL_hashz00_5) ? ((obj_t(*)(obj_t,
															...))
													PROCEDURE_ENTRY(BgL_hashz00_5)) (BgL_hashz00_5,
													BgL_keyz00_3, BEOA) : ((obj_t(*)(obj_t,
															obj_t))
													PROCEDURE_ENTRY(BgL_hashz00_5)) (BgL_hashz00_5,
													BgL_keyz00_3));
											BgL_arg1196z00_1287 =
												BGl_stringzd2hexzd2internz12z12zz__r4_strings_6_7z00
												(BgL_arg1197z00_1288);
										}
										blit_string(BgL_arg1196z00_1287, 0L, BgL_keybz00_1282, 0L,
											16L);
									}
								else
									{	/* Unsafe/hmac.scm 68 */
										blit_string(BgL_keyz00_3, 0L, BgL_keybz00_1282, 0L,
											BgL_keyzd2lengthzd2_1285);
									}
							}
							{
								long BgL_iz00_1290;

								BgL_iz00_1290 = 0L;
							BgL_zc3z04anonymousza31198ze3z87_1291:
								if ((BgL_iz00_1290 < 64L))
									{	/* Unsafe/hmac.scm 74 */
										long BgL_xiz00_1293;

										BgL_xiz00_1293 =
											(STRING_REF(BgL_keybz00_1282, BgL_iz00_1290));
										{	/* Unsafe/hmac.scm 75 */
											unsigned char BgL_tmpz00_2037;

											BgL_tmpz00_2037 = ((54L ^ BgL_xiz00_1293));
											STRING_SET(BgL_ixorz00_1283, BgL_iz00_1290,
												BgL_tmpz00_2037);
										}
										{	/* Unsafe/hmac.scm 76 */
											unsigned char BgL_tmpz00_2041;

											BgL_tmpz00_2041 = ((92L ^ BgL_xiz00_1293));
											STRING_SET(BgL_oxorz00_1284, BgL_iz00_1290,
												BgL_tmpz00_2041);
										}
										{
											long BgL_iz00_2045;

											BgL_iz00_2045 = (BgL_iz00_1290 + 1L);
											BgL_iz00_1290 = BgL_iz00_2045;
											goto BgL_zc3z04anonymousza31198ze3z87_1291;
										}
									}
								else
									{	/* Unsafe/hmac.scm 73 */
										((bool_t) 0);
									}
							}
							{	/* Unsafe/hmac.scm 82 */
								obj_t BgL_arg1209z00_1301;

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

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

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

											BgL_arg1214z00_1304 =
												string_append(BgL_ixorz00_1283, BgL_messagez00_4);
											BgL_arg1213z00_1303 =
												(VA_PROCEDUREP(BgL_hashz00_5) ? ((obj_t(*)(obj_t,
															...))
													PROCEDURE_ENTRY(BgL_hashz00_5)) (BgL_hashz00_5,
													BgL_arg1214z00_1304, BEOA) : ((obj_t(*)(obj_t,
															obj_t))
													PROCEDURE_ENTRY(BgL_hashz00_5)) (BgL_hashz00_5,
													BgL_arg1214z00_1304));
										}
										BgL_arg1211z00_1302 =
											BGl_stringzd2hexzd2internz12z12zz__r4_strings_6_7z00
											(BgL_arg1213z00_1303);
									}
									BgL_arg1209z00_1301 =
										string_append(BgL_oxorz00_1284, BgL_arg1211z00_1302);
								}
								return
									(VA_PROCEDUREP(BgL_hashz00_5) ? ((obj_t(*)(obj_t,
												...)) PROCEDURE_ENTRY(BgL_hashz00_5)) (BgL_hashz00_5,
										BgL_arg1209z00_1301, BEOA) : ((obj_t(*)(obj_t,
												obj_t)) PROCEDURE_ENTRY(BgL_hashz00_5)) (BgL_hashz00_5,
										BgL_arg1209z00_1301));
							}
						}
					}
				}
			}
		}

	}



/* &hmac-string */
	obj_t BGl_z62hmaczd2stringzb0zz__hmacz00(obj_t BgL_envz00_2001,
		obj_t BgL_keyz00_2002, obj_t BgL_messagez00_2003, obj_t BgL_hashz00_2004)
	{
		{	/* Unsafe/hmac.scm 57 */
			{	/* Unsafe/hmac.scm 59 */
				obj_t BgL_auxz00_2072;
				obj_t BgL_auxz00_2065;
				obj_t BgL_auxz00_2058;

				if (PROCEDUREP(BgL_hashz00_2004))
					{	/* Unsafe/hmac.scm 59 */
						BgL_auxz00_2072 = BgL_hashz00_2004;
					}
				else
					{
						obj_t BgL_auxz00_2075;

						BgL_auxz00_2075 =
							BGl_typezd2errorzd2zz__errorz00(BGl_string1624z00zz__hmacz00,
							BINT(2036L), BGl_string1625z00zz__hmacz00,
							BGl_string1627z00zz__hmacz00, BgL_hashz00_2004);
						FAILURE(BgL_auxz00_2075, BFALSE, BFALSE);
					}
				if (STRINGP(BgL_messagez00_2003))
					{	/* Unsafe/hmac.scm 59 */
						BgL_auxz00_2065 = BgL_messagez00_2003;
					}
				else
					{
						obj_t BgL_auxz00_2068;

						BgL_auxz00_2068 =
							BGl_typezd2errorzd2zz__errorz00(BGl_string1624z00zz__hmacz00,
							BINT(2036L), BGl_string1625z00zz__hmacz00,
							BGl_string1626z00zz__hmacz00, BgL_messagez00_2003);
						FAILURE(BgL_auxz00_2068, BFALSE, BFALSE);
					}
				if (STRINGP(BgL_keyz00_2002))
					{	/* Unsafe/hmac.scm 59 */
						BgL_auxz00_2058 = BgL_keyz00_2002;
					}
				else
					{
						obj_t BgL_auxz00_2061;

						BgL_auxz00_2061 =
							BGl_typezd2errorzd2zz__errorz00(BGl_string1624z00zz__hmacz00,
							BINT(2036L), BGl_string1625z00zz__hmacz00,
							BGl_string1626z00zz__hmacz00, BgL_keyz00_2002);
						FAILURE(BgL_auxz00_2061, BFALSE, BFALSE);
					}
				return
					BGl_hmaczd2stringzd2zz__hmacz00(BgL_auxz00_2058, BgL_auxz00_2065,
					BgL_auxz00_2072);
			}
		}

	}



/* 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_string1628z00zz__hmacz00));
			return
				BGl_modulezd2initializa7ationz75zz__base64z00(67813413L,
				BSTRING_TO_STRING(BGl_string1628z00zz__hmacz00));
		}

	}

#ifdef __cplusplus
}
#endif
