SQL Server 2014: Compiling Tables and Stored Procedures to Native Code

In SQL Server 2014, you can compile the tables and stored procedures to native code. This concept is called Native Compilation.

Native Compilation:

Native Compilation is a new concept introduced in SQL Server 2014. Native compilation allows the tables and the stored procedures accessing them to be loaded on the memory. The tables and stored procedures loaded on the memory tends to be faster than the regular tables and stored procedures. The output of native compilation is DLL. These dlls are loaded to the SQL Server Process.

This dll creation process happens during the creation of memory optimized tables and memory optimized stored procedures. So there is no additional step for creating the dlls. This will be handled during the memory optimized object creation.

These memory optimized objects are re-compiled to dll, every time the sql server restarts.

Native Compilation of Tables:

The table is natively compiled when they are created using the table option memory_optimized=on. This option is used for creating the table optimized for In-Memory OLTP. On executing the create table script, the SQL Server Engine, compiles the script to native code and outputs a dll file. This dll file will be loaded to the memory for faster data access. For creating a memory optimized table, read the article Creating Table Optimized for In-Memory OLTP.

This resulting native compiled dll files are not stored in the database. Instead they are stored in the physical file system in the hard disk. You can see the location of the files using the dynamic management view dm_os_loaded_modules.

Select * From sys.dm_os_loaded_modules Where
	Name Like '%' + cast(object_id('dbo.MyTecBits_Names_1') AS Varchar(10)) + '%'

SQL-2014-Native-Compilation-01

This dmv gives you the location of the files created for the memory optimized table, including the native compiled dll. If you go to the folder you can see several files with the same object id. One of the file will be “C” native code file and another is the resultant dll.

SQL-2014-Native-Compilation-02

If you open the file with c extension, you can see the code written in c, so as to be compiled to a dll. Below is the sample c code. The table creation script is converted to c code and then compiled to a dll file. The natively compiled files for the table starts with the extension xtp_t_.

Sample Native c Code for Table:

#define __in
#define __out
#define __inout
#define __in_opt
#define __out_opt
#define __inout_opt
#define __in_ecount(x)
#define __out_ecount(x)
#define __deref_out_ecount(x)
#define __inout_ecount(x)
#define __in_bcount(x)
#define __out_bcount(x)
#define __deref_out_bcount(x)
#define __deref_out_range(x, y)
#define __success(x)
#define __inout_bcount(x)
#define __deref_opt_out
#define __deref_out
#define __checkReturn
#define __callback
#define __nullterminated

typedef unsigned char bool;
typedef unsigned short wchar_t;
typedef long HRESULT;

typedef unsigned __int64 ULONG_PTR;

#include "hkenggen.h"
#include "hkrtgen.h"
#include "hkgenlib.h"

#define ENABLE_INTSAFE_SIGNED_FUNCTIONS
#include "intsafe.h"

int _fltused = 0;

int memcmp(const void*, const void*, size_t);
void *memcpy(void*, const void*, size_t);
void *memset(void*, int, size_t);

#define offsetof(s,f)   ((size_t)&(((s*)0)->f))

struct NullBitsStruct_277576027
{
	unsigned char hkc_isnull_2:1;
	unsigned char hkc_isnull_3:1;
};
struct hkt_277576027
{
	long hkc_1;
	long hkc_2;
	struct NullBitsStruct_277576027 null_bits;
	unsigned short hkvdo[2];
};
struct hkis_27757602700002
{
	long hkc_1;
};
struct hkif_27757602700002
{
	long hkc_1;
};
unsigned short GetSerializeSize_277576027(
	struct HkRow const* hkRow)
{
	struct hkt_277576027 const* row = ((struct hkt_277576027 const*)hkRow);
	return ((row->hkvdo)[1]);
}
HRESULT Serialize_277576027(
	struct HkRow const* hkRow,
	unsigned char* buffer,
	unsigned short bufferSize,
	unsigned short* copySize)
{
	return (RowSerialize(hkRow, (GetSerializeSize_277576027(hkRow)), buffer, bufferSize, copySize));
}
HRESULT Deserialize_277576027(
	struct HkTransaction* tx,
	struct HkTable* table,
	unsigned char const* data,
	unsigned short datasize,
	struct HkRow** hkrow)
{
	return (RowDeserialize(tx, table, data, datasize, sizeof(struct hkt_277576027), (sizeof(struct hkt_277576027) + 30), hkrow));
}
unsigned short GetSerializeRecKeySize_277576027(
	struct HkRow const* hkRow)
{
	struct hkt_277576027 const* row = ((struct hkt_277576027 const*)hkRow);
	unsigned short size = sizeof(struct hkif_27757602700002);
	return size;
}
HRESULT SerializeRecKey_27757602700002(
	struct HkRow const* hkRow,
	unsigned char* hkKey,
	unsigned short bufferSize,
	unsigned short* keySize)
{
	struct hkt_277576027 const* row = ((struct hkt_277576027 const*)hkRow);
	struct hkif_27757602700002* key = ((struct hkif_27757602700002*)hkKey);
	(*keySize) = sizeof(struct hkif_27757602700002);
	if ((bufferSize < (*keySize))) 	{ 		return -2013265920; 	} 	(key->hkc_1) = (row->hkc_1);
	return 0;
}
HRESULT DeserializeRecKey_277576027(
	unsigned char const* data,
	unsigned short dataSize,
	struct HkSearchKey* key,
	unsigned short bufferSize)
{
	struct hkif_27757602700002 const* source = ((struct hkif_27757602700002 const*)data);
	struct hkis_27757602700002* target = ((struct hkis_27757602700002*)key);
	unsigned long targetSize = sizeof(struct hkis_27757602700002);
	if ((targetSize > bufferSize))
	{
		return -2013265920;
	}
	(target->hkc_1) = (source->hkc_1);
	return 0;
}
__int64 CompareSKeyToRow_27757602700002(
	struct HkSearchKey const* hkArg0,
	struct HkRow const* hkArg1)
{
	struct hkis_27757602700002* arg0 = ((struct hkis_27757602700002*)hkArg0);
	struct hkt_277576027* arg1 = ((struct hkt_277576027*)hkArg1);
	__int64 ret;
	ret = (CompareKeys_int((arg0->hkc_1), (arg1->hkc_1)));
	return ret;
}
__int64 CompareRowToRow_27757602700002(
	struct HkRow const* hkArg0,
	struct HkRow const* hkArg1)
{
	struct hkt_277576027* arg0 = ((struct hkt_277576027*)hkArg0);
	struct hkt_277576027* arg1 = ((struct hkt_277576027*)hkArg1);
	__int64 ret;
	ret = (CompareKeys_int((arg0->hkc_1), (arg1->hkc_1)));
	return ret;
}
unsigned long ComputeSKeyHash_27757602700002(
	struct HkSearchKey const* hkArg)
{
	struct hkis_27757602700002* arg = ((struct hkis_27757602700002*)hkArg);
	unsigned long hashState = 0;
	unsigned long hashValue = 0;
	hashValue = (ComputeHash_int((arg->hkc_1), (&hashState)));
	return hashValue;
}
unsigned long ComputeRowHash_27757602700002(
	struct HkRow const* hkArg)
{
	struct hkt_277576027* arg = ((struct hkt_277576027*)hkArg);
	unsigned long hashState = 0;
	unsigned long hashValue = 0;
	hashValue = (ComputeHash_int((arg->hkc_1), (&hashState)));
	return hashValue;
}
struct HkOffsetInfo const KeyOffsetArray_27757602700002[] =
{

	{
		offsetof(struct hkis_27757602700002, hkc_1),
		0,
		0,
	},
};
struct HkKeyColsInfo const KeyColsInfoArray_277576027[] =
{

	{
		sizeof(struct hkis_27757602700002),
		KeyOffsetArray_27757602700002,
		sizeof(struct hkis_27757602700002),
		sizeof(struct hkis_27757602700002),
	},
};
struct HkOffsetInfo const OffsetArray_277576027[] =
{

	{
		offsetof(struct hkt_277576027, hkc_1),
		0,
		0,
	},

	{
		offsetof(struct hkt_277576027, hkc_2),
		(offsetof(struct hkt_277576027, null_bits) + 0),
		1,
	},

	{
		(offsetof(struct hkt_277576027, hkvdo) + 0),
		(offsetof(struct hkt_277576027, null_bits) + 0),
		2,
	},
};
struct HkColsInfo const ColsInfo_277576027 =
{
	sizeof(struct hkt_277576027),
	OffsetArray_277576027,
	KeyColsInfoArray_277576027,
};
struct HkHashIndexMD HashIndexMD_277576027[] =
{

	{
		2,
		1,
		33554432,
		CompareSKeyToRow_27757602700002,
		CompareRowToRow_27757602700002,
		ComputeSKeyHash_27757602700002,
		ComputeRowHash_27757602700002,
	},
};
struct HkTableMD TableMD =
{
	sizeof(struct hkt_277576027),
	(sizeof(struct hkt_277576027) + 30),
	1,
	HashIndexMD_277576027,
	0,
	0,
	0,
	(&ColsInfo_277576027),
	277576027,
	0,
	GetSerializeSize_277576027,
	Serialize_277576027,
	Deserialize_277576027,
	GetSerializeRecKeySize_277576027,
	SerializeRecKey_27757602700002,
	DeserializeRecKey_277576027,
};
__declspec(dllexport)
struct HkTableBindings g_Bindings =
{
	277576027,
	(&TableMD),
};

Native Compilation of Stored procedures:

The stored procedure is natively compiled when they are created using the option NATIVE_COMPILATION. This option is used for creating the stored procedure optimized for In-Memory OLTP. On executing the create procedure script, the SQL Server Engine, compiles the script to native code and outputs a dll file. This dll file will be loaded to the memory for faster data access. For creating memory optimized stored procedure, read the article Natively Compiled Stored Procedure.

Just like the memory native compilation of tables, the resulting native compiled dll files for stored procedures are stored in the physical file system in the hard disk. You can see them in the same folder where you saw the compiled files for tables. You can also see the location of the files using the dynamic management view dm_os_loaded_modules.

Select * From sys.dm_os_loaded_modules Where
	Name Like '%' + cast(object_id('dbo.MTB_Insert_Records') AS Varchar(10)) + '%'

sQL-2014-Native-Compilation-03

Below is the sample c code created during the compilation of stored procedure. Just like the memory optimized tables the memory optimized stored procedure creation script is converted to c code and then compiled to a dll file. The natively compiled files for the table starts with the extension xtp_p_.

sQL-2014-Native-Compilation-04

Sample Native c Code for Stored Procedure:

#define __in
#define __out
#define __inout
#define __in_opt
#define __out_opt
#define __inout_opt
#define __in_ecount(x)
#define __out_ecount(x)
#define __deref_out_ecount(x)
#define __inout_ecount(x)
#define __in_bcount(x)
#define __out_bcount(x)
#define __deref_out_bcount(x)
#define __deref_out_range(x, y)
#define __success(x)
#define __inout_bcount(x)
#define __deref_opt_out
#define __deref_out
#define __checkReturn
#define __callback
#define __nullterminated

typedef unsigned char bool;
typedef unsigned short wchar_t;
typedef long HRESULT;

typedef unsigned __int64 ULONG_PTR;

#include "hkenggen.h"
#include "hkrtgen.h"
#include "hkgenlib.h"

#define ENABLE_INTSAFE_SIGNED_FUNCTIONS
#include "intsafe.h"

int _fltused = 0;

int memcmp(const void*, const void*, size_t);
void *memcpy(void*, const void*, size_t);
void *memset(void*, int, size_t);

#define offsetof(s,f)   ((size_t)&(((s*)0)->f))

struct NullBitsStruct_277576027
{
	unsigned char hkc_isnull_2:1;
	unsigned char hkc_isnull_3:1;
};
struct hkt_277576027
{
	long hkc_1;
	long hkc_2;
	struct NullBitsStruct_277576027 null_bits;
	unsigned short hkvdo[2];
};
struct hkis_27757602700002
{
	long hkc_1;
};
struct hkif_27757602700002
{
	long hkc_1;
};
struct NullBitsStruct_309576141
{
	unsigned char hkc_isnull_2:1;
	unsigned char hkc_isnull_3:1;
};
struct hkt_309576141
{
	long hkc_1;
	long hkc_2;
	struct NullBitsStruct_309576141 null_bits;
	unsigned short hkvdo[2];
};
struct hkis_30957614100002
{
	long hkc_1;
};
struct hkif_30957614100002
{
	long hkc_1;
};
unsigned long TableIds[] =
{
	277576027,
	309576141,
};
struct HkTable* Tables[2];
struct HkRootTableRow* TableStabilizeRootTableRows[2];
HRESULT hkp_421576540(
	struct HkProcContext* context,
	union HkValue valueArray[],
	unsigned char* nullArray)
{
	unsigned long yc = 0;
	long var_2 = (-2147483647 - 1);
	unsigned char var_isnull_2 = 1;
	long var_3 = (-2147483647 - 1);
	unsigned char var_isnull_3 = 1;
	long var_4 = (-2147483647 - 1);
	unsigned char var_isnull_4 = 1;
	long var_5 = (-2147483647 - 1);
	unsigned char var_isnull_5 = 1;
	struct HkCursorHash* cur_13 = 0;
	HRESULT hr = 0;
	struct HkCursorHash* cur_29 = 0;
	hr = (HkCursorHashAlloc((Tables[0]), 0, 0, 0, (context->ErrorObject), (&cur_13), 0));
	if ((FAILED(hr)))
	{
		goto l_1;
	}
	hr = (HkCursorHashAlloc((Tables[1]), 0, 0, 0, (context->ErrorObject), (&cur_29), 0));
	if ((FAILED(hr)))
	{
		goto l_1;
	}
	{
		long expr_7 = (-2147483647 - 1);
		unsigned char expr_isnull_7;
		struct hkt_277576027* rec1_14;
		goto l_21;
	l_15:;
		hr = (HkCursorHashGetFirst(cur_13, (context->Transaction), 0, 0, 1, ((struct HkRow const**)(&rec1_14))));
		if ((FAILED(hr)))
		{
			goto l_6;
		}
	l_18:;
		if ((hr == 0))
		{
			goto l_11;
		}
		else
		{
			goto l_12;
		}
	l_19:;
		hr = (HkCursorHashGetNext(cur_13, (context->ErrorObject), ((struct HkRow const**)(&rec1_14))));
		if ((FAILED(hr)))
		{
			goto l_6;
		}
		goto l_18;
	l_21:;
		expr_isnull_7 = 0;
		expr_7 = 0;
		goto l_15;
	l_11:;
		expr_7 = (expr_7 + 1);
		goto l_19;
	l_12:;
		goto l_10;
	l_10:;
		if ((! expr_isnull_7))
		{
			var_2 = expr_7;
			var_isnull_2 = 0;
		}
		else
		{
			var_isnull_2 = 1;
		}
		goto l_8;
	l_8:;
		goto l_9;
	l_9:;
	l_6:;
		if ((FAILED(hr)))
		{
			SetLineNumberForError((context->ErrorObject), 8);
			goto l_1;
		}
	}
	yc = (yc + 1);
	{
		long expr_23 = (-2147483647 - 1);
		unsigned char expr_isnull_23;
		struct hkt_309576141* rec1_30;
		goto l_37;
	l_31:;
		hr = (HkCursorHashGetFirst(cur_29, (context->Transaction), 0, 0, 1, ((struct HkRow const**)(&rec1_30))));
		if ((FAILED(hr)))
		{
			goto l_22;
		}
	l_34:;
		if ((hr == 0))
		{
			goto l_27;
		}
		else
		{
			goto l_28;
		}
	l_35:;
		hr = (HkCursorHashGetNext(cur_29, (context->ErrorObject), ((struct HkRow const**)(&rec1_30))));
		if ((FAILED(hr)))
		{
			goto l_22;
		}
		goto l_34;
	l_37:;
		expr_isnull_23 = 0;
		expr_23 = 0;
		goto l_31;
	l_27:;
		expr_23 = (expr_23 + 1);
		goto l_35;
	l_28:;
		goto l_26;
	l_26:;
		if ((! expr_isnull_23))
		{
			var_3 = expr_23;
			var_isnull_3 = 0;
		}
		else
		{
			var_isnull_3 = 1;
		}
		goto l_24;
	l_24:;
		goto l_25;
	l_25:;
	l_22:;
		if ((FAILED(hr)))
		{
			SetLineNumberForError((context->ErrorObject), 9);
			goto l_1;
		}
	}
	yc = (yc + 1);
	{
		unsigned char result_39;
		unsigned char result_40;
		long isnull_value_41;
		unsigned char result_42;
		long isnull_value_43;
		result_39 = 0;
		result_40 = 0;
		if (var_isnull_2)
		{
			isnull_value_41 = 0;
		}
		else
		{
			isnull_value_41 = var_2;
		}
		result_40 = (isnull_value_41 == 0);
		if ((! result_40))
		{
			goto l_39;
		}
		result_42 = 0;
		if (var_isnull_3)
		{
			isnull_value_43 = 0;
		}
		else
		{
			isnull_value_43 = var_3;
		}
		result_42 = (isnull_value_43 == 0);
		if ((! result_42))
		{
			goto l_39;
		}
		result_39 = 1;
	l_39:;
		if (result_39)
		{
			{
				var_4 = 1;
				var_isnull_4 = 0;
			}
			yc = (yc + 1);
			{
				while (1)
				{
					unsigned char result_48;
					unsigned char result_isnull_48;
					result_48 = 0;
					result_isnull_48 = 0;
					if ((! var_isnull_4))
					{
						result_48 = (var_4 <= 1000000);
					}
					else
					{
						result_isnull_48 = 1;
					}
					if ((result_isnull_48 || (! result_48)))
					{
						goto l_46;
					}
					hr = (YieldCheck(context, yc, 18));
					if ((FAILED(hr)))
					{
						goto l_1;
					}
					yc = 0;
					{
						double temp_50;
						__int64 temp_51;
						if ((! 0))
						{
							SetFloatingPointControl();
							__try
							{
								temp_50 = ((Rand()) * 9.9000000000000000e+001);
								ConvertDoubleTo64(temp_50, (&temp_51));
								if ((temp_51 < -99)) 								{ 									hr = -2113929211; 									{ 										hr = (CreateError((context->ErrorObject), hr, 2, 6, 9));
									}
									if ((FAILED(hr)))
									{
										goto l_49;
									}
								}
								if ((temp_51 > 99))
								{
									hr = -2113929212;
									{
										hr = (CreateError((context->ErrorObject), hr, 2, 6, 9));
									}
									if ((FAILED(hr)))
									{
										goto l_49;
									}
								}
								var_5 = ((long)((__int64)temp_51));
								var_isnull_5 = 0;
							}
							__except((ExceptionFilter((_exception_code()), (&hr))))
							{
								CreateError((context->ErrorObject), hr, 0);
								goto l_49;
							}
						}
						else
						{
							var_isnull_5 = 1;
						}
					l_49:;
						if ((FAILED(hr)))
						{
							SetLineNumberForError((context->ErrorObject), 18);
							goto l_1;
						}
					}
					yc = (yc + 1);
					{
						unsigned char* expr_55 = ((context->DeepDataBuffer) + 0);
						unsigned short exprl_55 = 0;
						unsigned char const* hktmp_60;
						short hktmp_length_60;
						unsigned char willTargetDestinationBufferRemainTheSame_60 = 1;
						static unsigned char const hkl_61[] =
						{
							78,
							97,
							109,
							101,
							32,
							45,
							32,
							83,
							111,
							109,
							101,
							32,
							78,
							97,
							109,
							101,
						};
						struct hkt_277576027* rec2_62 = 0;
						unsigned char freeRow_62 = 0;
						short rowLength;
						short varColLength;
						static wchar_t const hkl_63[] =
						{
							73,
							78,
							83,
							69,
							82,
							84,
						};
						static wchar_t const hkl_64[] =
						{
							91,
							77,
							121,
							84,
							101,
							99,
							66,
							105,
							116,
							115,
							95,
							78,
							97,
							109,
							101,
							115,
							95,
							49,
							93,
						};
						static wchar_t const hkl_65[] =
						{
							91,
							83,
							108,
							95,
							110,
							111,
							93,
						};
						goto l_59;
					l_59:;
						hktmp_length_60 = exprl_55;
						hktmp_60 = expr_55;
						exprl_55 = 0;
						exprl_55 = (exprl_55 + 16);
						memcpy(expr_55, hkl_61, 16);
						goto l_58;
					l_58:;
						rowLength = sizeof(struct hkt_277576027);
						varColLength = 0;
						varColLength = (varColLength + exprl_55);
						rowLength = (rowLength + varColLength);
						hr = (HkRowAlloc((context->Transaction), (Tables[0]), rowLength, ((struct HkRow**)(&rec2_62))));
						if ((FAILED(hr)))
						{
							goto l_54;
						}
						freeRow_62 = 1;
						if ((! var_isnull_4))
						{
							(rec2_62->hkc_1) = var_4;
						}
						else
						{
							hr = -2113929186;
							if ((FAILED(hr)))
							{
								{
									CreateError((context->ErrorObject), hr, 5, 14, hkl_65, 38, hkl_64, hkl_63);
								}
								if ((FAILED(hr)))
								{
									goto l_54;
								}
							}
						}
						if ((! var_isnull_5))
						{
							(rec2_62->hkc_2) = var_5;
							((rec2_62->null_bits).hkc_isnull_2) = 0;
						}
						else
						{
							((rec2_62->null_bits).hkc_isnull_2) = 1;
						}
						((rec2_62->hkvdo)[0]) = sizeof(struct hkt_277576027);
						memcpy((((unsigned char*)rec2_62) + ((rec2_62->hkvdo)[0])), expr_55, exprl_55);
						((rec2_62->null_bits).hkc_isnull_3) = 0;
						((rec2_62->null_bits).hkc_isnull_3) = 0;
						((rec2_62->hkvdo)[1]) = (((rec2_62->hkvdo)[0]) + varColLength);
						freeRow_62 = 0;
						hr = (HkTableInsert((Tables[0]), (context->Transaction), ((struct HkRow*)rec2_62)));
						if ((FAILED(hr)))
						{
							goto l_54;
						}
						goto l_56;
					l_56:;
						goto l_57;
					l_57:;
						hr = (HkRefreshStatementId((context->Transaction)));
						if ((FAILED(hr)))
						{
							goto l_54;
						}
					l_54:;
						if ((FAILED(hr)))
						{
							if (freeRow_62)
							{
								HkTableReleaseUnusedRow(((struct HkRow*)rec2_62), (Tables[0]), (context->Transaction));
							}
							SetLineNumberForError((context->ErrorObject), 19);
							goto l_1;
						}
					}
					yc = (yc + 1);
					{
						unsigned char* expr_67 = ((context->DeepDataBuffer) + 0);
						unsigned short exprl_67 = 0;
						unsigned char const* hktmp_72;
						short hktmp_length_72;
						unsigned char willTargetDestinationBufferRemainTheSame_72 = 1;
						static unsigned char const hkl_73[] =
						{
							78,
							97,
							109,
							101,
							32,
							45,
							32,
							83,
							111,
							109,
							101,
							32,
							78,
							97,
							109,
							101,
						};
						struct hkt_309576141* rec2_74 = 0;
						unsigned char freeRow_74 = 0;
						short rowLength;
						short varColLength;
						static wchar_t const hkl_75[] =
						{
							73,
							78,
							83,
							69,
							82,
							84,
						};
						static wchar_t const hkl_76[] =
						{
							91,
							77,
							121,
							84,
							101,
							99,
							66,
							105,
							116,
							115,
							95,
							78,
							97,
							109,
							101,
							115,
							95,
							50,
							93,
						};
						static wchar_t const hkl_77[] =
						{
							91,
							83,
							108,
							95,
							110,
							111,
							93,
						};
						goto l_71;
					l_71:;
						hktmp_length_72 = exprl_67;
						hktmp_72 = expr_67;
						exprl_67 = 0;
						exprl_67 = (exprl_67 + 16);
						memcpy(expr_67, hkl_73, 16);
						goto l_70;
					l_70:;
						rowLength = sizeof(struct hkt_309576141);
						varColLength = 0;
						varColLength = (varColLength + exprl_67);
						rowLength = (rowLength + varColLength);
						hr = (HkRowAlloc((context->Transaction), (Tables[1]), rowLength, ((struct HkRow**)(&rec2_74))));
						if ((FAILED(hr)))
						{
							goto l_66;
						}
						freeRow_74 = 1;
						if ((! var_isnull_4))
						{
							(rec2_74->hkc_1) = var_4;
						}
						else
						{
							hr = -2113929186;
							if ((FAILED(hr)))
							{
								{
									CreateError((context->ErrorObject), hr, 5, 14, hkl_77, 38, hkl_76, hkl_75);
								}
								if ((FAILED(hr)))
								{
									goto l_66;
								}
							}
						}
						if ((! var_isnull_5))
						{
							(rec2_74->hkc_2) = var_5;
							((rec2_74->null_bits).hkc_isnull_2) = 0;
						}
						else
						{
							((rec2_74->null_bits).hkc_isnull_2) = 1;
						}
						((rec2_74->hkvdo)[0]) = sizeof(struct hkt_309576141);
						memcpy((((unsigned char*)rec2_74) + ((rec2_74->hkvdo)[0])), expr_67, exprl_67);
						((rec2_74->null_bits).hkc_isnull_3) = 0;
						((rec2_74->null_bits).hkc_isnull_3) = 0;
						((rec2_74->hkvdo)[1]) = (((rec2_74->hkvdo)[0]) + varColLength);
						freeRow_74 = 0;
						hr = (HkTableInsert((Tables[1]), (context->Transaction), ((struct HkRow*)rec2_74)));
						if ((FAILED(hr)))
						{
							goto l_66;
						}
						goto l_68;
					l_68:;
						goto l_69;
					l_69:;
						hr = (HkRefreshStatementId((context->Transaction)));
						if ((FAILED(hr)))
						{
							goto l_66;
						}
					l_66:;
						if ((FAILED(hr)))
						{
							if (freeRow_74)
							{
								HkTableReleaseUnusedRow(((struct HkRow*)rec2_74), (Tables[1]), (context->Transaction));
							}
							SetLineNumberForError((context->ErrorObject), 20);
							goto l_1;
						}
					}
					yc = (yc + 1);
					{
						__int64 temp_79;
						if ((! var_isnull_4))
						{
							temp_79 = (((__int64)var_4) + ((__int64)1));
							if ((temp_79 < (-2147483647 - 1))) 							{ 								hr = -2113929211; 								{ 									hr = (CreateError((context->ErrorObject), hr, 2, 23, 0));
								}
								if ((FAILED(hr)))
								{
									goto l_78;
								}
							}
							if ((temp_79 > 2147483647))
							{
								hr = -2113929212;
								{
									hr = (CreateError((context->ErrorObject), hr, 2, 23, 0));
								}
								if ((FAILED(hr)))
								{
									goto l_78;
								}
							}
							var_4 = ((long)temp_79);
							var_isnull_4 = 0;
						}
						else
						{
							var_isnull_4 = 1;
						}
					l_78:;
						if ((FAILED(hr)))
						{
							SetLineNumberForError((context->ErrorObject), 21);
							goto l_1;
						}
					}
					yc = (yc + 1);
					if ((! 1))
					{
						var_5 = 0;
						var_isnull_5 = 0;
					}
					else
					{
						var_isnull_5 = 1;
					}
					yc = (yc + 1);
				}
			l_46:;
			}
			yc = (yc + 1);
		}
	}
	yc = (yc + 1);
	((valueArray[0]).SignedIntData) = 0;
l_1:;
	if (cur_13)
	{
		HkCursorHashFree(cur_13);
	}
	if (cur_29)
	{
		HkCursorHashFree(cur_29);
	}
	return hr;
}
struct HkProcInfo ProcInfo =
{
	hkp_421576540,
	30,
	0,
	0,
	0,
	0,
	0,
	0,
	0,
	0,
	0,
	0,
	1,
	2,
	TableStabilizeRootTableRows,
};
unsigned long TableIdsStabilize[] =
{
	277576027,
	309576141,
};
__declspec(dllexport)
struct HkProcBindings g_Bindings =
{
	0,
	2,
	TableIds,
	Tables,
	421576540,
	(&ProcInfo),
	TableIdsStabilize,
};

Refer: msdn.

Leave your thoughts...