Skip to content

Instantly share code, notes, and snippets.

@lqd
Last active October 5, 2016 06:14
Show Gist options
  • Save lqd/3d0b757faffca078255f5bb8dc797d86 to your computer and use it in GitHub Desktop.
Save lqd/3d0b757faffca078255f5bb8dc797d86 to your computer and use it in GitHub Desktop.
// beginning a Binaryen API trace
#include <math.h>
#include <map>
#include "src/binaryen-c.h"
int main() {
std::map<size_t, BinaryenFunctionTypeRef> functionTypes;
std::map<size_t, BinaryenExpressionRef> expressions;
std::map<size_t, BinaryenFunctionRef> functions;
std::map<size_t, RelooperBlockRef> relooperBlocks;
BinaryenModuleRef the_module = NULL;
RelooperRef the_relooper = NULL;
{
const char* segments[] = { 0 };
BinaryenExpressionRef segmentOffsets[] = { 0 };
BinaryenIndex segmentSizes[] = { 0 };
BinaryenSetMemory(the_module, 256, 256, "memory", segments, segmentOffsets, segmentSizes, 0);
}
the_relooper = RelooperCreate();
expressions[0] = BinaryenGetLocal(the_module, 0, 1);
expressions[1] = BinaryenTeeLocal(the_module, 2, expressions[0]);
expressions[2] = BinaryenDrop(the_module, expressions[1]);
expressions[3] = BinaryenGetLocal(the_module, 1, 1);
expressions[4] = BinaryenTeeLocal(the_module, 3, expressions[3]);
expressions[5] = BinaryenDrop(the_module, expressions[4]);
expressions[6] = BinaryenGetLocal(the_module, 2, 1);
expressions[7] = BinaryenTeeLocal(the_module, 4, expressions[6]);
expressions[8] = BinaryenDrop(the_module, expressions[7]);
expressions[9] = BinaryenGetLocal(the_module, 3, 1);
expressions[10] = BinaryenTeeLocal(the_module, 5, expressions[9]);
expressions[11] = BinaryenDrop(the_module, expressions[10]);
expressions[12] = BinaryenGetLocal(the_module, 4, 1);
expressions[13] = BinaryenGetLocal(the_module, 5, 1);
expressions[14] = BinaryenUnary(the_module, 22, expressions[12]);
expressions[15] = BinaryenUnary(the_module, 22, expressions[13]);
expressions[16] = BinaryenBinary(the_module, 25, expressions[14], expressions[15]);
expressions[17] = BinaryenSetLocal(the_module, 10, expressions[16]);
expressions[18] = BinaryenGetLocal(the_module, 10, 2);
expressions[19] = BinaryenUnary(the_module, 24, expressions[18]);
expressions[20] = BinaryenConst(the_module, BinaryenLiteralInt64(32));
expressions[21] = BinaryenGetLocal(the_module, 10, 2);
expressions[22] = BinaryenBinary(the_module, 36, expressions[21], expressions[20]);
expressions[23] = BinaryenUnary(the_module, 24, expressions[22]);
expressions[24] = BinaryenConst(the_module, BinaryenLiteralInt32(0));
expressions[25] = BinaryenLoad(the_module, 4, 0, 0, 0, 1, expressions[24]);
expressions[26] = BinaryenConst(the_module, BinaryenLiteralInt32(128));
expressions[27] = BinaryenBinary(the_module, 1, expressions[25], expressions[26]);
expressions[28] = BinaryenTeeLocal(the_module, 6, expressions[27]);
expressions[29] = BinaryenStore(the_module, 4, 0, 0, expressions[24], expressions[28], 1);
expressions[30] = BinaryenGetLocal(the_module, 6, 1);
expressions[31] = BinaryenStore(the_module, 4, 0, 0, expressions[30], expressions[19], 1);
expressions[32] = BinaryenStore(the_module, 4, 4, 0, expressions[30], expressions[23], 1);
{
BinaryenExpressionRef children[] = { expressions[2], expressions[5], expressions[8], expressions[11], expressions[17], expressions[29], expressions[31], expressions[32] };
expressions[33] = BinaryenBlock(the_module, "bb0", children, 8);
}
relooperBlocks[0] = RelooperAddBlock(the_relooper, expressions[33]);
expressions[34] = BinaryenGetLocal(the_module, 6, 1);
expressions[35] = BinaryenLoad(the_module, 4, 0, 0, 0, 1, expressions[34]);
expressions[36] = BinaryenTeeLocal(the_module, 7, expressions[35]);
expressions[37] = BinaryenDrop(the_module, expressions[36]);
expressions[38] = BinaryenGetLocal(the_module, 8, 1);
expressions[39] = BinaryenConst(the_module, BinaryenLiteralInt32(0));
expressions[40] = BinaryenStore(the_module, 4, 0, 0, expressions[39], expressions[38], 1);
expressions[41] = BinaryenGetLocal(the_module, 7, 1);
expressions[42] = BinaryenReturn(the_module, expressions[41]);
{
BinaryenExpressionRef children[] = { expressions[37], expressions[40], expressions[42] };
expressions[43] = BinaryenBlock(the_module, "bb1", children, 3);
}
relooperBlocks[1] = RelooperAddBlock(the_relooper, expressions[43]);
RelooperAddBranch(relooperBlocks[0], relooperBlocks[1], expressions[0], expressions[0]);
{
BinaryenIndex paramTypes[] = { 1, 1 };
functionTypes[0] = BinaryenAddFunctionType(the_module, "rustfn-0-13", 1, paramTypes, 2);
}
expressions[45] = BinaryenConst(the_module, BinaryenLiteralInt32(0));
expressions[46] = BinaryenLoad(the_module, 4, 0, 0, 0, 1, expressions[45]);
expressions[47] = BinaryenSetLocal(the_module, 8, expressions[46]);
relooperBlocks[2] = RelooperAddBlock(the_relooper, expressions[47]);
RelooperAddBranch(relooperBlocks[2], relooperBlocks[0], expressions[0], expressions[0]);
expressions[48] = RelooperRenderAndDispose(the_relooper, relooperBlocks[2], 9, the_module);
{
BinaryenType varTypes[] = { 1, 1, 1, 1, 1, 1, 1, 1, 2 };
functions[0] = BinaryenAddFunction(the_module, "_isize_as_Add_::add", functionTypes[0], varTypes, 9, expressions[48]);
}
BinaryenAddExport(the_module, "_isize_as_Add_::add", "_isize_as_Add_::add");
the_relooper = RelooperCreate();
{
BinaryenExpressionRef children[] = { 0 };
expressions[49] = BinaryenBlock(the_module, "bb0", children, 0);
}
relooperBlocks[0] = RelooperAddBlock(the_relooper, expressions[49]);
expressions[50] = BinaryenGetLocal(the_module, 0, 1);
expressions[51] = BinaryenConst(the_module, BinaryenLiteralInt32(0));
expressions[52] = BinaryenStore(the_module, 4, 0, 0, expressions[51], expressions[50], 1);
expressions[53] = BinaryenGetLocal(the_module, 0, 1);
expressions[54] = BinaryenReturn(the_module, expressions[53]);
{
BinaryenExpressionRef children[] = { expressions[52], expressions[54] };
expressions[55] = BinaryenBlock(the_module, "bb1", children, 2);
}
relooperBlocks[1] = RelooperAddBlock(the_relooper, expressions[55]);
RelooperAddBranch(relooperBlocks[0], relooperBlocks[1], expressions[0], expressions[0]);
{
BinaryenIndex paramTypes[] = { 0 };
functionTypes[1] = BinaryenAddFunctionType(the_module, "rustfn-0-25", 0, paramTypes, 0);
}
expressions[56] = BinaryenConst(the_module, BinaryenLiteralInt32(0));
expressions[57] = BinaryenLoad(the_module, 4, 0, 0, 0, 1, expressions[56]);
expressions[58] = BinaryenSetLocal(the_module, 0, expressions[57]);
relooperBlocks[2] = RelooperAddBlock(the_relooper, expressions[58]);
RelooperAddBranch(relooperBlocks[2], relooperBlocks[0], expressions[0], expressions[0]);
expressions[59] = RelooperRenderAndDispose(the_relooper, relooperBlocks[2], 1, the_module);
{
BinaryenType varTypes[] = { 1, 1, 2 };
functions[1] = BinaryenAddFunction(the_module, "eh_personality", functionTypes[1], varTypes, 3, expressions[59]);
}
BinaryenAddExport(the_module, "eh_personality", "eh_personality");
the_relooper = RelooperCreate();
{
BinaryenExpressionRef children[] = { 0 };
expressions[60] = BinaryenBlock(the_module, "bb0", children, 0);
}
relooperBlocks[0] = RelooperAddBlock(the_relooper, expressions[60]);
expressions[61] = BinaryenGetLocal(the_module, 0, 1);
expressions[62] = BinaryenConst(the_module, BinaryenLiteralInt32(0));
expressions[63] = BinaryenStore(the_module, 4, 0, 0, expressions[62], expressions[61], 1);
expressions[64] = BinaryenGetLocal(the_module, 0, 1);
expressions[65] = BinaryenReturn(the_module, expressions[64]);
{
BinaryenExpressionRef children[] = { expressions[63], expressions[65] };
expressions[66] = BinaryenBlock(the_module, "bb1", children, 2);
}
relooperBlocks[1] = RelooperAddBlock(the_relooper, expressions[66]);
RelooperAddBranch(relooperBlocks[0], relooperBlocks[1], expressions[0], expressions[0]);
expressions[67] = BinaryenConst(the_module, BinaryenLiteralInt32(0));
expressions[68] = BinaryenLoad(the_module, 4, 0, 0, 0, 1, expressions[67]);
expressions[69] = BinaryenSetLocal(the_module, 0, expressions[68]);
relooperBlocks[2] = RelooperAddBlock(the_relooper, expressions[69]);
RelooperAddBranch(relooperBlocks[2], relooperBlocks[0], expressions[0], expressions[0]);
expressions[70] = RelooperRenderAndDispose(the_relooper, relooperBlocks[2], 1, the_module);
{
BinaryenType varTypes[] = { 1, 1, 2 };
functions[2] = BinaryenAddFunction(the_module, "eh_unwind_resume", functionTypes[1], varTypes, 3, expressions[70]);
}
BinaryenAddExport(the_module, "eh_unwind_resume", "eh_unwind_resume");
the_relooper = RelooperCreate();
{
BinaryenExpressionRef children[] = { 0 };
expressions[71] = BinaryenBlock(the_module, "bb0", children, 0);
}
relooperBlocks[0] = RelooperAddBlock(the_relooper, expressions[71]);
{
BinaryenExpressionRef children[] = { 0 };
expressions[72] = BinaryenBlock(the_module, "bb1", children, 0);
}
relooperBlocks[1] = RelooperAddBlock(the_relooper, expressions[72]);
RelooperAddBranch(relooperBlocks[0], relooperBlocks[1], expressions[0], expressions[0]);
RelooperAddBranch(relooperBlocks[1], relooperBlocks[1], expressions[0], expressions[0]);
{
BinaryenIndex paramTypes[] = { 0 };
functionTypes[2] = BinaryenAddFunctionType(the_module, "rustfn-0-27", 1, paramTypes, 0);
}
expressions[73] = BinaryenConst(the_module, BinaryenLiteralInt32(0));
expressions[74] = BinaryenLoad(the_module, 4, 0, 0, 0, 1, expressions[73]);
expressions[75] = BinaryenSetLocal(the_module, 3, expressions[74]);
relooperBlocks[2] = RelooperAddBlock(the_relooper, expressions[75]);
RelooperAddBranch(relooperBlocks[2], relooperBlocks[0], expressions[0], expressions[0]);
expressions[76] = RelooperRenderAndDispose(the_relooper, relooperBlocks[2], 4, the_module);
{
BinaryenType varTypes[] = { 1, 1, 1, 1, 1, 2 };
functions[3] = BinaryenAddFunction(the_module, "panic_fmt", functionTypes[2], varTypes, 6, expressions[76]);
}
BinaryenAddExport(the_module, "panic_fmt", "panic_fmt");
the_relooper = RelooperCreate();
{
BinaryenExpressionRef children[] = { 0 };
expressions[77] = BinaryenBlock(the_module, "bb0", children, 0);
}
relooperBlocks[0] = RelooperAddBlock(the_relooper, expressions[77]);
expressions[78] = BinaryenGetLocal(the_module, 0, 1);
expressions[79] = BinaryenConst(the_module, BinaryenLiteralInt32(0));
expressions[80] = BinaryenStore(the_module, 4, 0, 0, expressions[79], expressions[78], 1);
expressions[81] = BinaryenGetLocal(the_module, 0, 1);
expressions[82] = BinaryenReturn(the_module, expressions[81]);
{
BinaryenExpressionRef children[] = { expressions[80], expressions[82] };
expressions[83] = BinaryenBlock(the_module, "bb1", children, 2);
}
relooperBlocks[1] = RelooperAddBlock(the_relooper, expressions[83]);
RelooperAddBranch(relooperBlocks[0], relooperBlocks[1], expressions[0], expressions[0]);
expressions[84] = BinaryenConst(the_module, BinaryenLiteralInt32(0));
expressions[85] = BinaryenLoad(the_module, 4, 0, 0, 0, 1, expressions[84]);
expressions[86] = BinaryenSetLocal(the_module, 0, expressions[85]);
relooperBlocks[2] = RelooperAddBlock(the_relooper, expressions[86]);
RelooperAddBranch(relooperBlocks[2], relooperBlocks[0], expressions[0], expressions[0]);
expressions[87] = RelooperRenderAndDispose(the_relooper, relooperBlocks[2], 1, the_module);
{
BinaryenType varTypes[] = { 1, 1, 2 };
functions[4] = BinaryenAddFunction(the_module, "rust_eh_register_frames", functionTypes[1], varTypes, 3, expressions[87]);
}
BinaryenAddExport(the_module, "rust_eh_register_frames", "rust_eh_register_frames");
the_relooper = RelooperCreate();
{
BinaryenExpressionRef children[] = { 0 };
expressions[88] = BinaryenBlock(the_module, "bb0", children, 0);
}
relooperBlocks[0] = RelooperAddBlock(the_relooper, expressions[88]);
expressions[89] = BinaryenGetLocal(the_module, 0, 1);
expressions[90] = BinaryenConst(the_module, BinaryenLiteralInt32(0));
expressions[91] = BinaryenStore(the_module, 4, 0, 0, expressions[90], expressions[89], 1);
expressions[92] = BinaryenGetLocal(the_module, 0, 1);
expressions[93] = BinaryenReturn(the_module, expressions[92]);
{
BinaryenExpressionRef children[] = { expressions[91], expressions[93] };
expressions[94] = BinaryenBlock(the_module, "bb1", children, 2);
}
relooperBlocks[1] = RelooperAddBlock(the_relooper, expressions[94]);
RelooperAddBranch(relooperBlocks[0], relooperBlocks[1], expressions[0], expressions[0]);
expressions[95] = BinaryenConst(the_module, BinaryenLiteralInt32(0));
expressions[96] = BinaryenLoad(the_module, 4, 0, 0, 0, 1, expressions[95]);
expressions[97] = BinaryenSetLocal(the_module, 0, expressions[96]);
relooperBlocks[2] = RelooperAddBlock(the_relooper, expressions[97]);
RelooperAddBranch(relooperBlocks[2], relooperBlocks[0], expressions[0], expressions[0]);
expressions[98] = RelooperRenderAndDispose(the_relooper, relooperBlocks[2], 1, the_module);
{
BinaryenType varTypes[] = { 1, 1, 2 };
functions[5] = BinaryenAddFunction(the_module, "rust_eh_unregister_frames", functionTypes[1], varTypes, 3, expressions[98]);
}
BinaryenAddExport(the_module, "rust_eh_unregister_frames", "rust_eh_unregister_frames");
the_relooper = RelooperCreate();
expressions[99] = BinaryenConst(the_module, BinaryenLiteralInt32(1));
expressions[100] = BinaryenTeeLocal(the_module, 0, expressions[99]);
expressions[101] = BinaryenDrop(the_module, expressions[100]);
expressions[102] = BinaryenGetLocal(the_module, 0, 1);
expressions[103] = BinaryenTeeLocal(the_module, 2, expressions[102]);
expressions[104] = BinaryenDrop(the_module, expressions[103]);
expressions[105] = BinaryenGetLocal(the_module, 2, 1);
expressions[106] = BinaryenConst(the_module, BinaryenLiteralInt32(2));
expressions[107] = BinaryenUnary(the_module, 22, expressions[105]);
expressions[108] = BinaryenUnary(the_module, 22, expressions[106]);
expressions[109] = BinaryenBinary(the_module, 25, expressions[107], expressions[108]);
expressions[110] = BinaryenSetLocal(the_module, 8, expressions[109]);
expressions[111] = BinaryenGetLocal(the_module, 8, 2);
expressions[112] = BinaryenUnary(the_module, 24, expressions[111]);
expressions[113] = BinaryenConst(the_module, BinaryenLiteralInt64(32));
expressions[114] = BinaryenGetLocal(the_module, 8, 2);
expressions[115] = BinaryenBinary(the_module, 36, expressions[114], expressions[113]);
expressions[116] = BinaryenUnary(the_module, 24, expressions[115]);
expressions[117] = BinaryenConst(the_module, BinaryenLiteralInt32(0));
expressions[118] = BinaryenLoad(the_module, 4, 0, 0, 0, 1, expressions[117]);
expressions[119] = BinaryenConst(the_module, BinaryenLiteralInt32(128));
expressions[120] = BinaryenBinary(the_module, 1, expressions[118], expressions[119]);
expressions[121] = BinaryenTeeLocal(the_module, 3, expressions[120]);
expressions[122] = BinaryenStore(the_module, 4, 0, 0, expressions[117], expressions[121], 1);
expressions[123] = BinaryenGetLocal(the_module, 3, 1);
expressions[124] = BinaryenStore(the_module, 4, 0, 0, expressions[123], expressions[112], 1);
expressions[125] = BinaryenStore(the_module, 4, 4, 0, expressions[123], expressions[116], 1);
{
BinaryenExpressionRef children[] = { expressions[101], expressions[104], expressions[110], expressions[122], expressions[124], expressions[125] };
expressions[126] = BinaryenBlock(the_module, "bb0", children, 6);
}
relooperBlocks[0] = RelooperAddBlock(the_relooper, expressions[126]);
expressions[127] = BinaryenGetLocal(the_module, 3, 1);
expressions[128] = BinaryenLoad(the_module, 4, 0, 0, 0, 1, expressions[127]);
expressions[129] = BinaryenTeeLocal(the_module, 1, expressions[128]);
expressions[130] = BinaryenDrop(the_module, expressions[129]);
expressions[131] = BinaryenGetLocal(the_module, 1, 1);
expressions[132] = BinaryenTeeLocal(the_module, 4, expressions[131]);
expressions[133] = BinaryenDrop(the_module, expressions[132]);
expressions[134] = BinaryenGetLocal(the_module, 4, 1);
expressions[135] = BinaryenTeeLocal(the_module, 5, expressions[134]);
expressions[136] = BinaryenDrop(the_module, expressions[135]);
expressions[137] = BinaryenGetLocal(the_module, 6, 1);
expressions[138] = BinaryenConst(the_module, BinaryenLiteralInt32(0));
expressions[139] = BinaryenStore(the_module, 4, 0, 0, expressions[138], expressions[137], 1);
expressions[140] = BinaryenGetLocal(the_module, 5, 1);
expressions[141] = BinaryenReturn(the_module, expressions[140]);
{
BinaryenExpressionRef children[] = { expressions[130], expressions[133], expressions[136], expressions[139], expressions[141] };
expressions[142] = BinaryenBlock(the_module, "bb1", children, 5);
}
relooperBlocks[1] = RelooperAddBlock(the_relooper, expressions[142]);
RelooperAddBranch(relooperBlocks[0], relooperBlocks[1], expressions[0], expressions[0]);
{
BinaryenIndex paramTypes[] = { 0 };
functionTypes[3] = BinaryenAddFunctionType(the_module, "rustfn-0-30", 1, paramTypes, 0);
}
expressions[143] = BinaryenConst(the_module, BinaryenLiteralInt32(0));
expressions[144] = BinaryenLoad(the_module, 4, 0, 0, 0, 1, expressions[143]);
expressions[145] = BinaryenSetLocal(the_module, 6, expressions[144]);
relooperBlocks[2] = RelooperAddBlock(the_relooper, expressions[145]);
RelooperAddBranch(relooperBlocks[2], relooperBlocks[0], expressions[0], expressions[0]);
expressions[146] = RelooperRenderAndDispose(the_relooper, relooperBlocks[2], 7, the_module);
{
BinaryenType varTypes[] = { 1, 1, 1, 1, 1, 1, 1, 1, 2 };
functions[6] = BinaryenAddFunction(the_module, "real_main", functionTypes[3], varTypes, 9, expressions[146]);
}
BinaryenAddExport(the_module, "real_main", "real_main");
the_relooper = RelooperCreate();
expressions[147] = BinaryenGetLocal(the_module, 0, 1);
expressions[148] = BinaryenTeeLocal(the_module, 2, expressions[147]);
expressions[149] = BinaryenDrop(the_module, expressions[148]);
{
BinaryenExpressionRef operands[] = { 0 };
expressions[150] = BinaryenCall(the_module, "real_main", operands, 0, 1);
}
expressions[151] = BinaryenSetLocal(the_module, 4, expressions[150]);
{
BinaryenExpressionRef children[] = { expressions[149], expressions[151] };
expressions[152] = BinaryenBlock(the_module, "bb0", children, 2);
}
relooperBlocks[0] = RelooperAddBlock(the_relooper, expressions[152]);
expressions[153] = BinaryenGetLocal(the_module, 4, 1);
expressions[154] = BinaryenConst(the_module, BinaryenLiteralInt32(3));
expressions[155] = BinaryenUnary(the_module, 22, expressions[153]);
expressions[156] = BinaryenUnary(the_module, 22, expressions[154]);
expressions[157] = BinaryenBinary(the_module, 25, expressions[155], expressions[156]);
expressions[158] = BinaryenSetLocal(the_module, 10, expressions[157]);
expressions[159] = BinaryenGetLocal(the_module, 10, 2);
expressions[160] = BinaryenUnary(the_module, 24, expressions[159]);
expressions[161] = BinaryenConst(the_module, BinaryenLiteralInt64(32));
expressions[162] = BinaryenGetLocal(the_module, 10, 2);
expressions[163] = BinaryenBinary(the_module, 36, expressions[162], expressions[161]);
expressions[164] = BinaryenUnary(the_module, 24, expressions[163]);
expressions[165] = BinaryenConst(the_module, BinaryenLiteralInt32(0));
expressions[166] = BinaryenLoad(the_module, 4, 0, 0, 0, 1, expressions[165]);
expressions[167] = BinaryenConst(the_module, BinaryenLiteralInt32(128));
expressions[168] = BinaryenBinary(the_module, 1, expressions[166], expressions[167]);
expressions[169] = BinaryenTeeLocal(the_module, 5, expressions[168]);
expressions[170] = BinaryenStore(the_module, 4, 0, 0, expressions[165], expressions[169], 1);
expressions[171] = BinaryenGetLocal(the_module, 5, 1);
expressions[172] = BinaryenStore(the_module, 4, 0, 0, expressions[171], expressions[160], 1);
expressions[173] = BinaryenStore(the_module, 4, 4, 0, expressions[171], expressions[164], 1);
{
BinaryenExpressionRef children[] = { expressions[158], expressions[170], expressions[172], expressions[173] };
expressions[174] = BinaryenBlock(the_module, "bb1", children, 4);
}
relooperBlocks[1] = RelooperAddBlock(the_relooper, expressions[174]);
expressions[175] = BinaryenGetLocal(the_module, 5, 1);
expressions[176] = BinaryenLoad(the_module, 4, 0, 0, 0, 1, expressions[175]);
expressions[177] = BinaryenTeeLocal(the_module, 3, expressions[176]);
expressions[178] = BinaryenDrop(the_module, expressions[177]);
expressions[179] = BinaryenGetLocal(the_module, 3, 1);
expressions[180] = BinaryenTeeLocal(the_module, 6, expressions[179]);
expressions[181] = BinaryenDrop(the_module, expressions[180]);
expressions[182] = BinaryenGetLocal(the_module, 6, 1);
expressions[183] = BinaryenTeeLocal(the_module, 7, expressions[182]);
expressions[184] = BinaryenDrop(the_module, expressions[183]);
expressions[185] = BinaryenGetLocal(the_module, 8, 1);
expressions[186] = BinaryenConst(the_module, BinaryenLiteralInt32(0));
expressions[187] = BinaryenStore(the_module, 4, 0, 0, expressions[186], expressions[185], 1);
expressions[188] = BinaryenGetLocal(the_module, 7, 1);
expressions[189] = BinaryenReturn(the_module, expressions[188]);
{
BinaryenExpressionRef children[] = { expressions[178], expressions[181], expressions[184], expressions[187], expressions[189] };
expressions[190] = BinaryenBlock(the_module, "bb2", children, 5);
}
relooperBlocks[2] = RelooperAddBlock(the_relooper, expressions[190]);
RelooperAddBranch(relooperBlocks[0], relooperBlocks[1], expressions[0], expressions[0]);
RelooperAddBranch(relooperBlocks[1], relooperBlocks[2], expressions[0], expressions[0]);
{
BinaryenIndex paramTypes[] = { 1, 1 };
functionTypes[4] = BinaryenAddFunctionType(the_module, "rustfn-0-33", 1, paramTypes, 2);
}
expressions[191] = BinaryenConst(the_module, BinaryenLiteralInt32(0));
expressions[192] = BinaryenLoad(the_module, 4, 0, 0, 0, 1, expressions[191]);
expressions[193] = BinaryenSetLocal(the_module, 8, expressions[192]);
relooperBlocks[3] = RelooperAddBlock(the_relooper, expressions[193]);
RelooperAddBranch(relooperBlocks[3], relooperBlocks[0], expressions[0], expressions[0]);
expressions[194] = RelooperRenderAndDispose(the_relooper, relooperBlocks[3], 9, the_module);
{
BinaryenType varTypes[] = { 1, 1, 1, 1, 1, 1, 1, 1, 2 };
functions[7] = BinaryenAddFunction(the_module, "main", functionTypes[4], varTypes, 9, expressions[194]);
}
BinaryenAddExport(the_module, "main", "main");
{
BinaryenIndex paramTypes[] = { 0 };
functionTypes[5] = BinaryenAddFunctionType(the_module, "__wasm_start", 0, paramTypes, 0);
}
{
const char* segments[] = { 0 };
BinaryenExpressionRef segmentOffsets[] = { 0 };
BinaryenIndex segmentSizes[] = { 0 };
BinaryenSetMemory(the_module, 1, 1, NULL, segments, segmentOffsets, segmentSizes, 0);
}
expressions[195] = BinaryenConst(the_module, BinaryenLiteralInt32(65535));
expressions[196] = BinaryenConst(the_module, BinaryenLiteralInt32(0));
expressions[197] = BinaryenStore(the_module, 4, 0, 0, expressions[196], expressions[195], 1);
expressions[198] = BinaryenConst(the_module, BinaryenLiteralInt32(0));
expressions[199] = BinaryenConst(the_module, BinaryenLiteralInt32(0));
{
BinaryenExpressionRef operands[] = { expressions[198], expressions[199] };
expressions[200] = BinaryenCall(the_module, "main", operands, 2, 1);
}
expressions[201] = BinaryenDrop(the_module, expressions[200]);
{
BinaryenExpressionRef children[] = { expressions[197], expressions[201] };
expressions[202] = BinaryenBlock(the_module, NULL, children, 2);
}
{
BinaryenType varTypes[] = { 0 };
functions[8] = BinaryenAddFunction(the_module, "__wasm_start", functionTypes[5], varTypes, 0, expressions[202]);
}
BinaryenSetStart(the_module, functions[8]);
BinaryenModuleValidate(the_module);
BinaryenModuleOptimize(the_module);
BinaryenModuleValidate(the_module);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment