printTopStaticPart

decompiled_code:
int printTopStaticPart()
{
puts("target triple = \"x86_64-unknown-linux-gnu\"\n");
printf("%%struct.CarElt = type {\n");
puts("\ti32,");
printf("\t%%struct.tInitCar,\n");
printf("\t%%struct.tPublicCar,\n");
printf("\t%%struct.tCarRaceInfo,\n");
printf("\t%%struct.tPrivCar,\n");
printf("\t%%struct.tCarCtrl,\n");
printf("\t%%struct.tCarPitCmd,\n");
printf("\t%%struct.RobotItf*,\n");
printf("\t%%struct.CarElt*\n");
puts("}\n");
printf("%%struct.tInitCar = type {\n");
puts("\t[32 x i8],");
puts("\t[32 x i8],");
puts("\t[32 x i8],");
puts("\t[32 x i8],");
puts("\ti32,");
puts("\ti32,");
puts("\ti32,");
puts("\ti32,");
puts("\t[3 x float],");
printf("\t%%struct.t3Dd,\n");
printf("\t%%struct.t3Dd,\n");
printf("\t%%struct.t3Dd,\n");
puts("\tfloat,");
puts("\tfloat,");
printf("\t%%struct.t3Dd,\n");
printf("\t[4 x %%struct.tWheelSpec],\n");
printf("\t%%struct.tVisualAttributes\n");
puts("}\n");
printf("%%struct.t3Dd = type {\n");
puts("\tfloat,");
puts("\tfloat,");
puts("\tfloat");
puts("}\n");
printf("%%struct.tWheelSpec = type {\n");
puts("\tfloat,");
puts("\tfloat,");
puts("\tfloat,");
puts("\tfloat,");
puts("\tfloat");
puts("}\n");
printf("%%struct.tVisualAttributes = type {\n");
puts("\ti32,");
printf("\t[2 x %%struct.t3Dd],\n");
puts("\tfloat");
puts("}\n");
printf("%%struct.tPublicCar = type {\n");
printf("\t%%struct.tDynPt,\n");
printf("\t%%struct.tDynPt,\n");
puts("\t[4 x [4 x float]],");
printf("\t%%struct.tTrkLocPos,\n");
puts("\ti32,");
printf("\t[4 x %%struct.tPosd]\n");
puts("}\n");
printf("%%struct.tDynPt = type {\n");
printf("\t%%struct.tPosd,\n");
printf("\t%%struct.tPosd,\n");
printf("\t%%struct.tPosd\n");
puts("}\n");
printf("%%struct.tPosd = type {\n");
puts("\tfloat,");
puts("\tfloat,");
puts("\tfloat,");
puts("\tfloat,");
puts("\tfloat,");
puts("\tfloat");
puts("}\n");
printf("%%struct.tTrkLocPos = type {\n");
printf("\t%%struct.trackSeg*,\n");
puts("\ti32,");
puts("\tfloat,");
puts("\tfloat,");
puts("\tfloat,");
puts("\tfloat");
puts("}\n");
printf("%%struct.trackSeg = type {\n");
puts("\ti8*,");
puts("\ti32,");
puts("\ti32,");
puts("\ti32,");
puts("\ti32,");
puts("\tfloat,");
puts("\tfloat,");
puts("\tfloat,");
puts("\tfloat,");
puts("\tfloat,");
puts("\tfloat,");
puts("\tfloat,");
puts("\tfloat,");
puts("\tfloat,");
printf("\t%%struct.t3Dd,\n");
printf("\t[4 x %%struct.t3Dd],\n");
puts("\t[7 x float],");
puts("\tfloat,");
puts("\tfloat,");
puts("\tfloat,");
printf("\t%%struct.t3Dd,\n");
puts("\ti32,");
puts("\tfloat,");
puts("\ti32,");
puts("\tfloat,");
printf("\t%%struct.SegExt*,\n");
printf("\t%%struct.trackSurface*,\n");
printf("\t[2 x %%struct.trackBarrier*],\n");
printf("\t%%struct.RoadCam*,\n");
printf("\t%%struct.trackSeg*,\n");
printf("\t%%struct.trackSeg*,\n");
printf("\t%%union.anon.0\n");
puts("}\n");
printf("%%struct.SegExt = type {\n");
puts("\ti32,");
puts("\ti32*");
puts("}\n");
printf("%%struct.trackSurface = type {\n");
printf("\t%%struct.trackSurface*,\n");
puts("\ti8*,");
puts("\tfloat,");
puts("\tfloat,");
puts("\tfloat,");
puts("\tfloat,");
puts("\tfloat,");
puts("\tfloat");
puts("}\n");
printf("%%struct.trackBarrier = type {\n");
puts("\ti32,");
puts("\tfloat,");
puts("\tfloat,");
printf("\t%%struct.trackSurface*,\n");
printf("\t%%class.v2t\n");
puts("}\n");
printf("%%class.v2t = type {\n");
printf("\t%%union.anon\n");
puts("}\n");
printf("%%union.anon = type {\n");
printf("\t%%struct.anon\n");
puts("}\n");
printf("%%struct.anon = type {\n");
puts("\tfloat,");
puts("\tfloat");
puts("}\n");
printf("%%struct.RoadCam = type {\n");
puts("\ti8*,");
printf("\t%%struct.t3Dd,\n");
printf("\t%%struct.RoadCam*\n");
puts("}\n");
printf("%%union.anon.0 = type {\n");
printf("\t%%struct.anon.1\n");
puts("}\n");
printf("%%struct.anon.1 = type {\n");
printf("\t%%struct.trackSeg*,\n");
printf("\t%%struct.trackSeg*\n");
puts("}\n");
printf("%%struct.tCarRaceInfo = type {\n");
puts("\tdouble,");
puts("\ti8,");
puts("\tdouble,");
puts("\tdouble,");
puts("\tdouble,");
puts("\tdouble,");
puts("\tfloat,");
puts("\tfloat,");
puts("\ti32,");
puts("\ti32,");
puts("\ti32,");
puts("\ti32,");
puts("\tdouble,");
puts("\ti32,");
puts("\tdouble,");
puts("\tdouble,");
puts("\tfloat,");
puts("\tfloat,");
puts("\tdouble,");
printf("\t%%struct.TrackOwnPit*,\n");
puts("\ti32,");
printf("\t%%struct.CarPenaltyHead\n");
puts("}\n");
printf("%%struct.TrackOwnPit = type {\n");
printf("\t%%struct.tTrkLocPos,\n");
puts("\ti32,");
puts("\tfloat,");
puts("\tfloat,");
puts("\ti32,");
printf("\t[4 x %%struct.CarElt*]\n");
puts("}\n");
printf("%%struct.CarPenaltyHead = type {\n");
printf("\t%%struct.CarPenalty*,\n");
printf("\t%%struct.CarPenalty**\n");
puts("}\n");
printf("%%struct.CarPenalty = type {\n");
puts("\ti32,");
puts("\ti32,");
printf("\t%%struct.anon.2\n");
puts("}\n");
printf("%%struct.anon.2 = type {\n");
printf("\t%%struct.CarPenalty*,\n");
printf("\t%%struct.CarPenalty**\n");
puts("}\n");
printf("%%struct.tPrivCar = type {\n");
puts("\ti8*,");
puts("\ti8*,");
puts("\ti32,");
puts("\t[32 x i8],");
printf("\t[4 x %%struct.tWheelState],\n");
printf("\t[4 x %%struct.tPosd],\n");
puts("\ti32,");
puts("\tfloat,");
puts("\tfloat,");
puts("\tfloat,");
puts("\tfloat,");
puts("\tfloat,");
puts("\tfloat,");
puts("\tfloat,");
puts("\tfloat,");
puts("\t[10 x float],");
puts("\ti32,");
puts("\ti32,");
puts("\t[4 x float],");
puts("\t[4 x float],");
puts("\ti32,");
puts("\ti32,");
puts("\tfloat,");
printf("\t%%struct.t3Dd,\n");
printf("\t%%struct.t3Dd,\n");
puts("\ti32,");
puts("\ti32,");
printf("\t%%struct.tCollisionState_\n");
puts("}\n");
printf("%%struct.tWheelState = type {\n");
printf("\t%%struct.tPosd,\n");
puts("\tfloat,");
puts("\tfloat,");
puts("\ti32,");
printf("\t%%struct.trackSeg*,\n");
puts("\tfloat,");
puts("\tfloat,");
puts("\tfloat,");
puts("\tfloat,");
puts("\tfloat,");
puts("\tfloat,");
puts("\tfloat,");
puts("\tfloat,");
puts("\tfloat,");
puts("\tfloat");
puts("}\n");
printf("%%struct.tCollisionState_ = type {\n");
puts("\ti32,");
puts("\t[3 x float],");
puts("\t[3 x float]");
puts("}\n");
printf("%%struct.tCarCtrl = type {\n");
puts("\tfloat,");
puts("\tfloat,");
puts("\tfloat,");
puts("\tfloat,");
puts("\ti32,");
puts("\ti32,");
puts("\t[4 x [32 x i8]],");
puts("\t[4 x float],");
puts("\ti32");
puts("}\n");
printf("%%struct.tCarPitCmd = type {\n");
puts("\tfloat,");
puts("\ti32,");
puts("\ti32,");
printf("\t%%struct.tCarPitSetup\n");
puts("}\n");
printf("%%struct.tCarPitSetup = type {\n");
printf("\t%%struct.tCarPitSetupValue,\n");
printf("\t[4 x %%struct.tCarPitSetupValue],\n");
printf("\t[4 x %%struct.tCarPitSetupValue],\n");
printf("\t[4 x %%struct.tCarPitSetupValue],\n");
printf("\t%%struct.tCarPitSetupValue,\n");
printf("\t%%struct.tCarPitSetupValue,\n");
printf("\t[4 x %%struct.tCarPitSetupValue],\n");
printf("\t[4 x %%struct.tCarPitSetupValue],\n");
printf("\t[4 x %%struct.tCarPitSetupValue],\n");
printf("\t[4 x %%struct.tCarPitSetupValue],\n");
printf("\t[4 x %%struct.tCarPitSetupValue],\n");
printf("\t[4 x %%struct.tCarPitSetupValue],\n");
printf("\t[2 x %%struct.tCarPitSetupValue],\n");
printf("\t[2 x %%struct.tCarPitSetupValue],\n");
printf("\t[2 x %%struct.tCarPitSetupValue],\n");
printf("\t[2 x %%struct.tCarPitSetupValue],\n");
printf("\t[2 x %%struct.tCarPitSetupValue],\n");
printf("\t[8 x %%struct.tCarPitSetupValue],\n");
printf("\t[2 x %%struct.tCarPitSetupValue],\n");
printf("\t[3 x %%struct.tCarPitSetupValue],\n");
printf("\t[3 x %%struct.tCarPitSetupValue],\n");
printf("\t[3 x %%struct.tCarPitSetupValue],\n");
printf("\t[3 x %%struct.tCarPitSetupValue],\n");
printf("\t[3 x %%struct.tCarPitSetupValue],\n");
printf("\t[3 x %%struct.tCarPitSetupValue],\n");
puts("\t[3 x i32]");
puts("}\n");
printf("%%struct.tCarPitSetupValue = type {\n");
puts("\tfloat,");
puts("\tfloat,");
puts("\tfloat");
puts("}\n");
printf("%%struct.RobotItf = type {\n");
printf("\tvoid (i32, %%struct.tTrack*, i8*, i8**, %%struct.Situation*)*,\n");
puts("\t {}*,");
puts("\t {}*,");
puts("\t {}*,");
printf("\t i32 (i32, %%struct.CarElt*, %%struct.Situation*)*,\n");
puts("\t void (i32)*,");
puts("\t i32");
puts("}\n");
printf("%%struct.tTrack = type {\n");
puts("\ti8*,");
puts("\ti8*,");
puts("\ti8*,");
puts("\ti8*,");
puts("\ti8*,");
puts("\ti8*,");
puts("\ti32,");
puts("\ti32,");
puts("\tfloat,");
puts("\tfloat,");
printf("\t%%struct.tTrackPitInfo,\n");
printf("\t%%struct.trackSeg*,\n");
printf("\t%%struct.trackSurface*,\n");
printf("\t%%struct.t3Dd,\n");
printf("\t%%struct.t3Dd,\n");
printf("\t%%struct.tTrackGraphicInfo\n");
puts("}\n");
printf("%%struct.tTrackPitInfo = type {\n");
puts("\ti32,");
puts("\ti32,");
puts("\ti32,");
puts("\ti32,");
puts("\tfloat,");
puts("\tfloat,");
puts("\tfloat,");
printf("\t%%struct.trackSeg*,\n");
printf("\t%%struct.trackSeg*,\n");
printf("\t%%struct.trackSeg*,\n");
printf("\t%%struct.trackSeg*,\n");
printf("\t%%struct.TrackOwnPit*,\n");
puts("\ti32,");
puts("\ti32");
puts("}\n");
printf("%%struct.tTrackGraphicInfo = type {\n");
puts("\ti8*,");
puts("\ti8*,");
puts("\ti32,");
puts("\t[3 x float],");
puts("\ti32,");
puts("\ti8**,");
printf("\t%%struct.tTurnMarksInfo\n");
puts("}\n");
printf("%%struct.tTurnMarksInfo = type {\n");
puts("\tfloat,");
puts("\tfloat,");
puts("\tfloat,");
puts("\tfloat");
puts("}\n");
printf("%%struct.Situation = type {\n");
printf("\t%%struct.tRaceAdmInfo,\n");
puts("\tdouble,");
puts("\tdouble,");
puts("\ti32,");
printf("\t%%struct.CarElt**\n");
puts("}\n");
printf("%%struct.tRaceAdmInfo = type {\n");
puts("\ti32,");
puts("\ti32,");
puts("\ti32,");
puts("\ti32,");
puts("\ti32,");
puts("\ti64");
return puts("}\n");
}

canonical_decompiled_code:
int func0()
{
puts("target triple = \"x86_64-unknown-linux-gnu\"\n");
printf("%%struct.CarElt = type {\n");
puts("\ti32,");
printf("\t%%struct.tInitCar,\n");
printf("\t%%struct.tPublicCar,\n");
printf("\t%%struct.tCarRaceInfo,\n");
printf("\t%%struct.tPrivCar,\n");
printf("\t%%struct.tCarCtrl,\n");
printf("\t%%struct.tCarPitCmd,\n");
printf("\t%%struct.RobotItf*,\n");
printf("\t%%struct.CarElt*\n");
puts("}\n");
printf("%%struct.tInitCar = type {\n");
puts("\t[32 x i8],");
puts("\t[32 x i8],");
puts("\t[32 x i8],");
puts("\t[32 x i8],");
puts("\ti32,");
puts("\ti32,");
puts("\ti32,");
puts("\ti32,");
puts("\t[3 x float],");
printf("\t%%struct.t3Dd,\n");
printf("\t%%struct.t3Dd,\n");
printf("\t%%struct.t3Dd,\n");
puts("\tfloat,");
puts("\tfloat,");
printf("\t%%struct.t3Dd,\n");
printf("\t[4 x %%struct.tWheelSpec],\n");
printf("\t%%struct.tVisualAttributes\n");
puts("}\n");
printf("%%struct.t3Dd = type {\n");
puts("\tfloat,");
puts("\tfloat,");
puts("\tfloat");
puts("}\n");
printf("%%struct.tWheelSpec = type {\n");
puts("\tfloat,");
puts("\tfloat,");
puts("\tfloat,");
puts("\tfloat,");
puts("\tfloat");
puts("}\n");
printf("%%struct.tVisualAttributes = type {\n");
puts("\ti32,");
printf("\t[2 x %%struct.t3Dd],\n");
puts("\tfloat");
puts("}\n");
printf("%%struct.tPublicCar = type {\n");
printf("\t%%struct.tDynPt,\n");
printf("\t%%struct.tDynPt,\n");
puts("\t[4 x [4 x float]],");
printf("\t%%struct.tTrkLocPos,\n");
puts("\ti32,");
printf("\t[4 x %%struct.tPosd]\n");
puts("}\n");
printf("%%struct.tDynPt = type {\n");
printf("\t%%struct.tPosd,\n");
printf("\t%%struct.tPosd,\n");
printf("\t%%struct.tPosd\n");
puts("}\n");
printf("%%struct.tPosd = type {\n");
puts("\tfloat,");
puts("\tfloat,");
puts("\tfloat,");
puts("\tfloat,");
puts("\tfloat,");
puts("\tfloat");
puts("}\n");
printf("%%struct.tTrkLocPos = type {\n");
printf("\t%%struct.trackSeg*,\n");
puts("\ti32,");
puts("\tfloat,");
puts("\tfloat,");
puts("\tfloat,");
puts("\tfloat");
puts("}\n");
printf("%%struct.trackSeg = type {\n");
puts("\ti8*,");
puts("\ti32,");
puts("\ti32,");
puts("\ti32,");
puts("\ti32,");
puts("\tfloat,");
puts("\tfloat,");
puts("\tfloat,");
puts("\tfloat,");
puts("\tfloat,");
puts("\tfloat,");
puts("\tfloat,");
puts("\tfloat,");
puts("\tfloat,");
printf("\t%%struct.t3Dd,\n");
printf("\t[4 x %%struct.t3Dd],\n");
puts("\t[7 x float],");
puts("\tfloat,");
puts("\tfloat,");
puts("\tfloat,");
printf("\t%%struct.t3Dd,\n");
puts("\ti32,");
puts("\tfloat,");
puts("\ti32,");
puts("\tfloat,");
printf("\t%%struct.SegExt*,\n");
printf("\t%%struct.trackSurface*,\n");
printf("\t[2 x %%struct.trackBarrier*],\n");
printf("\t%%struct.RoadCam*,\n");
printf("\t%%struct.trackSeg*,\n");
printf("\t%%struct.trackSeg*,\n");
printf("\t%%union.anon.0\n");
puts("}\n");
printf("%%struct.SegExt = type {\n");
puts("\ti32,");
puts("\ti32*");
puts("}\n");
printf("%%struct.trackSurface = type {\n");
printf("\t%%struct.trackSurface*,\n");
puts("\ti8*,");
puts("\tfloat,");
puts("\tfloat,");
puts("\tfloat,");
puts("\tfloat,");
puts("\tfloat,");
puts("\tfloat");
puts("}\n");
printf("%%struct.trackBarrier = type {\n");
puts("\ti32,");
puts("\tfloat,");
puts("\tfloat,");
printf("\t%%struct.trackSurface*,\n");
printf("\t%%class.v2t\n");
puts("}\n");
printf("%%class.v2t = type {\n");
printf("\t%%union.anon\n");
puts("}\n");
printf("%%union.anon = type {\n");
printf("\t%%struct.anon\n");
puts("}\n");
printf("%%struct.anon = type {\n");
puts("\tfloat,");
puts("\tfloat");
puts("}\n");
printf("%%struct.RoadCam = type {\n");
puts("\ti8*,");
printf("\t%%struct.t3Dd,\n");
printf("\t%%struct.RoadCam*\n");
puts("}\n");
printf("%%union.anon.0 = type {\n");
printf("\t%%struct.anon.1\n");
puts("}\n");
printf("%%struct.anon.1 = type {\n");
printf("\t%%struct.trackSeg*,\n");
printf("\t%%struct.trackSeg*\n");
puts("}\n");
printf("%%struct.tCarRaceInfo = type {\n");
puts("\tdouble,");
puts("\ti8,");
puts("\tdouble,");
puts("\tdouble,");
puts("\tdouble,");
puts("\tdouble,");
puts("\tfloat,");
puts("\tfloat,");
puts("\ti32,");
puts("\ti32,");
puts("\ti32,");
puts("\ti32,");
puts("\tdouble,");
puts("\ti32,");
puts("\tdouble,");
puts("\tdouble,");
puts("\tfloat,");
puts("\tfloat,");
puts("\tdouble,");
printf("\t%%struct.TrackOwnPit*,\n");
puts("\ti32,");
printf("\t%%struct.CarPenaltyHead\n");
puts("}\n");
printf("%%struct.TrackOwnPit = type {\n");
printf("\t%%struct.tTrkLocPos,\n");
puts("\ti32,");
puts("\tfloat,");
puts("\tfloat,");
puts("\ti32,");
printf("\t[4 x %%struct.CarElt*]\n");
puts("}\n");
printf("%%struct.CarPenaltyHead = type {\n");
printf("\t%%struct.CarPenalty*,\n");
printf("\t%%struct.CarPenalty**\n");
puts("}\n");
printf("%%struct.CarPenalty = type {\n");
puts("\ti32,");
puts("\ti32,");
printf("\t%%struct.anon.2\n");
puts("}\n");
printf("%%struct.anon.2 = type {\n");
printf("\t%%struct.CarPenalty*,\n");
printf("\t%%struct.CarPenalty**\n");
puts("}\n");
printf("%%struct.tPrivCar = type {\n");
puts("\ti8*,");
puts("\ti8*,");
puts("\ti32,");
puts("\t[32 x i8],");
printf("\t[4 x %%struct.tWheelState],\n");
printf("\t[4 x %%struct.tPosd],\n");
puts("\ti32,");
puts("\tfloat,");
puts("\tfloat,");
puts("\tfloat,");
puts("\tfloat,");
puts("\tfloat,");
puts("\tfloat,");
puts("\tfloat,");
puts("\tfloat,");
puts("\t[10 x float],");
puts("\ti32,");
puts("\ti32,");
puts("\t[4 x float],");
puts("\t[4 x float],");
puts("\ti32,");
puts("\ti32,");
puts("\tfloat,");
printf("\t%%struct.t3Dd,\n");
printf("\t%%struct.t3Dd,\n");
puts("\ti32,");
puts("\ti32,");
printf("\t%%struct.tCollisionState_\n");
puts("}\n");
printf("%%struct.tWheelState = type {\n");
printf("\t%%struct.tPosd,\n");
puts("\tfloat,");
puts("\tfloat,");
puts("\ti32,");
printf("\t%%struct.trackSeg*,\n");
puts("\tfloat,");
puts("\tfloat,");
puts("\tfloat,");
puts("\tfloat,");
puts("\tfloat,");
puts("\tfloat,");
puts("\tfloat,");
puts("\tfloat,");
puts("\tfloat,");
puts("\tfloat");
puts("}\n");
printf("%%struct.tCollisionState_ = type {\n");
puts("\ti32,");
puts("\t[3 x float],");
puts("\t[3 x float]");
puts("}\n");
printf("%%struct.tCarCtrl = type {\n");
puts("\tfloat,");
puts("\tfloat,");
puts("\tfloat,");
puts("\tfloat,");
puts("\ti32,");
puts("\ti32,");
puts("\t[4 x [32 x i8]],");
puts("\t[4 x float],");
puts("\ti32");
puts("}\n");
printf("%%struct.tCarPitCmd = type {\n");
puts("\tfloat,");
puts("\ti32,");
puts("\ti32,");
printf("\t%%struct.tCarPitSetup\n");
puts("}\n");
printf("%%struct.tCarPitSetup = type {\n");
printf("\t%%struct.tCarPitSetupValue,\n");
printf("\t[4 x %%struct.tCarPitSetupValue],\n");
printf("\t[4 x %%struct.tCarPitSetupValue],\n");
printf("\t[4 x %%struct.tCarPitSetupValue],\n");
printf("\t%%struct.tCarPitSetupValue,\n");
printf("\t%%struct.tCarPitSetupValue,\n");
printf("\t[4 x %%struct.tCarPitSetupValue],\n");
printf("\t[4 x %%struct.tCarPitSetupValue],\n");
printf("\t[4 x %%struct.tCarPitSetupValue],\n");
printf("\t[4 x %%struct.tCarPitSetupValue],\n");
printf("\t[4 x %%struct.tCarPitSetupValue],\n");
printf("\t[4 x %%struct.tCarPitSetupValue],\n");
printf("\t[2 x %%struct.tCarPitSetupValue],\n");
printf("\t[2 x %%struct.tCarPitSetupValue],\n");
printf("\t[2 x %%struct.tCarPitSetupValue],\n");
printf("\t[2 x %%struct.tCarPitSetupValue],\n");
printf("\t[2 x %%struct.tCarPitSetupValue],\n");
printf("\t[8 x %%struct.tCarPitSetupValue],\n");
printf("\t[2 x %%struct.tCarPitSetupValue],\n");
printf("\t[3 x %%struct.tCarPitSetupValue],\n");
printf("\t[3 x %%struct.tCarPitSetupValue],\n");
printf("\t[3 x %%struct.tCarPitSetupValue],\n");
printf("\t[3 x %%struct.tCarPitSetupValue],\n");
printf("\t[3 x %%struct.tCarPitSetupValue],\n");
printf("\t[3 x %%struct.tCarPitSetupValue],\n");
puts("\t[3 x i32]");
puts("}\n");
printf("%%struct.tCarPitSetupValue = type {\n");
puts("\tfloat,");
puts("\tfloat,");
puts("\tfloat");
puts("}\n");
printf("%%struct.RobotItf = type {\n");
printf("\tvoid (i32, %%struct.tTrack*, i8*, i8**, %%struct.Situation*)*,\n");
puts("\t {}*,");
puts("\t {}*,");
puts("\t {}*,");
printf("\t i32 (i32, %%struct.CarElt*, %%struct.Situation*)*,\n");
puts("\t void (i32)*,");
puts("\t i32");
puts("}\n");
printf("%%struct.tTrack = type {\n");
puts("\ti8*,");
puts("\ti8*,");
puts("\ti8*,");
puts("\ti8*,");
puts("\ti8*,");
puts("\ti8*,");
puts("\ti32,");
puts("\ti32,");
puts("\tfloat,");
puts("\tfloat,");
printf("\t%%struct.tTrackPitInfo,\n");
printf("\t%%struct.trackSeg*,\n");
printf("\t%%struct.trackSurface*,\n");
printf("\t%%struct.t3Dd,\n");
printf("\t%%struct.t3Dd,\n");
printf("\t%%struct.tTrackGraphicInfo\n");
puts("}\n");
printf("%%struct.tTrackPitInfo = type {\n");
puts("\ti32,");
puts("\ti32,");
puts("\ti32,");
puts("\ti32,");
puts("\tfloat,");
puts("\tfloat,");
puts("\tfloat,");
printf("\t%%struct.trackSeg*,\n");
printf("\t%%struct.trackSeg*,\n");
printf("\t%%struct.trackSeg*,\n");
printf("\t%%struct.trackSeg*,\n");
printf("\t%%struct.TrackOwnPit*,\n");
puts("\ti32,");
puts("\ti32");
puts("}\n");
printf("%%struct.tTrackGraphicInfo = type {\n");
puts("\ti8*,");
puts("\ti8*,");
puts("\ti32,");
puts("\t[3 x float],");
puts("\ti32,");
puts("\ti8**,");
printf("\t%%struct.tTurnMarksInfo\n");
puts("}\n");
printf("%%struct.tTurnMarksInfo = type {\n");
puts("\tfloat,");
puts("\tfloat,");
puts("\tfloat,");
puts("\tfloat");
puts("}\n");
printf("%%struct.Situation = type {\n");
printf("\t%%struct.tRaceAdmInfo,\n");
puts("\tdouble,");
puts("\tdouble,");
puts("\ti32,");
printf("\t%%struct.CarElt**\n");
puts("}\n");
printf("%%struct.tRaceAdmInfo = type {\n");
puts("\ti32,");
puts("\ti32,");
puts("\ti32,");
puts("\ti32,");
puts("\ti32,");
puts("\ti64");
return puts("}\n");
}

original_code:
void printTopStaticPart(void) {
printf("target triple = \"x86_64-unknown-linux-gnu\"\n\n");
printf("%%struct.CarElt = type {\n");
printf("	i32,\n");
printf("	%%struct.tInitCar,\n");
printf("	%%struct.tPublicCar,\n");
printf("	%%struct.tCarRaceInfo,\n");
printf("	%%struct.tPrivCar,\n");
printf("	%%struct.tCarCtrl,\n");
printf("	%%struct.tCarPitCmd,\n");
printf("	%%struct.RobotItf*,\n");
printf("	%%struct.CarElt*\n");
printf("}\n\n");
printf("%%struct.tInitCar = type {\n");
printf("	[32 x i8],\n");
printf("	[32 x i8],\n");
printf("	[32 x i8],\n");
printf("	[32 x i8],\n");
printf("	i32,\n");
printf("	i32,\n");
printf("	i32,\n");
printf("	i32,\n");
printf("	[3 x float],\n");
printf("	%%struct.t3Dd,\n");
printf("	%%struct.t3Dd,\n");
printf("	%%struct.t3Dd,\n");
printf("	float,\n");
printf("	float,\n");
printf("	%%struct.t3Dd,\n");
printf("	[4 x %%struct.tWheelSpec],\n");
printf("	%%struct.tVisualAttributes\n");
printf("}\n\n");
printf("%%struct.t3Dd = type {\n");
printf("	float,\n");
printf("	float,\n");
printf("	float\n");
printf("}\n\n");
printf("%%struct.tWheelSpec = type {\n");
printf("	float,\n");
printf("	float,\n");
printf("	float,\n");
printf("	float,\n");
printf("	float\n");
printf("}\n\n");
printf("%%struct.tVisualAttributes = type {\n");
printf("	i32,\n");
printf("	[2 x %%struct.t3Dd],\n");
printf("	float\n");
printf("}\n\n");
printf("%%struct.tPublicCar = type {\n");
printf("	%%struct.tDynPt,\n");
printf("	%%struct.tDynPt,\n");
printf("	[4 x [4 x float]],\n");
printf("	%%struct.tTrkLocPos,\n");
printf("	i32,\n");
printf("	[4 x %%struct.tPosd]\n");
printf("}\n\n");
printf("%%struct.tDynPt = type {\n");
printf("	%%struct.tPosd,\n");
printf("	%%struct.tPosd,\n");
printf("	%%struct.tPosd\n");
printf("}\n\n");
printf("%%struct.tPosd = type {\n");
printf("	float,\n");
printf("	float,\n");
printf("	float,\n");
printf("	float,\n");
printf("	float,\n");
printf("	float\n");
printf("}\n\n");
printf("%%struct.tTrkLocPos = type {\n");
printf("	%%struct.trackSeg*,\n");
printf("	i32,\n");
printf("	float,\n");
printf("	float,\n");
printf("	float,\n");
printf("	float\n");
printf("}\n\n");
printf("%%struct.trackSeg = type {\n");
printf("	i8*,\n");
printf("	i32,\n");
printf("	i32,\n");
printf("	i32,\n");
printf("	i32,\n");
printf("	float,\n");
printf("	float,\n");
printf("	float,\n");
printf("	float,\n");
printf("	float,\n");
printf("	float,\n");
printf("	float,\n");
printf("	float,\n");
printf("	float,\n");
printf("	%%struct.t3Dd,\n");
printf("	[4 x %%struct.t3Dd],\n");
printf("	[7 x float],\n");
printf("	float,\n");
printf("	float,\n");
printf("	float,\n");
printf("	%%struct.t3Dd,\n");
printf("	i32,\n");
printf("	float,\n");
printf("	i32,\n");
printf("	float,\n");
printf("	%%struct.SegExt*,\n");
printf("	%%struct.trackSurface*,\n");
printf("	[2 x %%struct.trackBarrier*],\n");
printf("	%%struct.RoadCam*,\n");
printf("	%%struct.trackSeg*,\n");
printf("	%%struct.trackSeg*,\n");
printf("	%%union.anon.0\n");
printf("}\n\n");
printf("%%struct.SegExt = type {\n");
printf("	i32,\n");
printf("	i32*\n");
printf("}\n\n");
printf("%%struct.trackSurface = type {\n");
printf("	%%struct.trackSurface*,\n");
printf("	i8*,\n");
printf("	float,\n");
printf("	float,\n");
printf("	float,\n");
printf("	float,\n");
printf("	float,\n");
printf("	float\n");
printf("}\n\n");
printf("%%struct.trackBarrier = type {\n");
printf("	i32,\n");
printf("	float,\n");
printf("	float,\n");
printf("	%%struct.trackSurface*,\n");
printf("	%%class.v2t\n");
printf("}\n\n");
printf("%%class.v2t = type {\n");
printf("	%%union.anon\n");
printf("}\n\n");
printf("%%union.anon = type {\n");
printf("	%%struct.anon\n");
printf("}\n\n");
printf("%%struct.anon = type {\n");
printf("	float,\n");
printf("	float\n");
printf("}\n\n");
printf("%%struct.RoadCam = type {\n");
printf("	i8*,\n");
printf("	%%struct.t3Dd,\n");
printf("	%%struct.RoadCam*\n");
printf("}\n\n");
printf("%%union.anon.0 = type {\n");
printf("	%%struct.anon.1\n");
printf("}\n\n");
printf("%%struct.anon.1 = type {\n");
printf("	%%struct.trackSeg*,\n");
printf("	%%struct.trackSeg*\n");
printf("}\n\n");
printf("%%struct.tCarRaceInfo = type {\n");
printf("	double,\n");
printf("	i8,\n");
printf("	double,\n");
printf("	double,\n");
printf("	double,\n");
printf("	double,\n");
printf("	float,\n");
printf("	float,\n");
printf("	i32,\n");
printf("	i32,\n");
printf("	i32,\n");
printf("	i32,\n");
printf("	double,\n");
printf("	i32,\n");
printf("	double,\n");
printf("	double,\n");
printf("	float,\n");
printf("	float,\n");
printf("	double,\n");
printf("	%%struct.TrackOwnPit*,\n");
printf("	i32,\n");
printf("	%%struct.CarPenaltyHead\n");
printf("}\n\n");
printf("%%struct.TrackOwnPit = type {\n");
printf("	%%struct.tTrkLocPos,\n");
printf("	i32,\n");
printf("	float,\n");
printf("	float,\n");
printf("	i32,\n");
printf("	[4 x %%struct.CarElt*]\n");
printf("}\n\n");
printf("%%struct.CarPenaltyHead = type {\n");
printf("	%%struct.CarPenalty*,\n");
printf("	%%struct.CarPenalty**\n");
printf("}\n\n");
printf("%%struct.CarPenalty = type {\n");
printf("	i32,\n");
printf("	i32,\n");
printf("	%%struct.anon.2\n");
printf("}\n\n");
printf("%%struct.anon.2 = type {\n");
printf("	%%struct.CarPenalty*,\n");
printf("	%%struct.CarPenalty**\n");
printf("}\n\n");
printf("%%struct.tPrivCar = type {\n");
printf("	i8*,\n");
printf("	i8*,\n");
printf("	i32,\n");
printf("	[32 x i8],\n");
printf("	[4 x %%struct.tWheelState],\n");
printf("	[4 x %%struct.tPosd],\n");
printf("	i32,\n");
printf("	float,\n");
printf("	float,\n");
printf("	float,\n");
printf("	float,\n");
printf("	float,\n");
printf("	float,\n");
printf("	float,\n");
printf("	float,\n");
printf("	[10 x float],\n");
printf("	i32,\n");
printf("	i32,\n");
printf("	[4 x float],\n");
printf("	[4 x float],\n");
printf("	i32,\n");
printf("	i32,\n");
printf("	float,\n");
printf("	%%struct.t3Dd,\n");
printf("	%%struct.t3Dd,\n");
printf("	i32,\n");
printf("	i32,\n");
printf("	%%struct.tCollisionState_\n");
printf("}\n\n");
printf("%%struct.tWheelState = type {\n");
printf("	%%struct.tPosd,\n");
printf("	float,\n");
printf("	float,\n");
printf("	i32,\n");
printf("	%%struct.trackSeg*,\n");
printf("	float,\n");
printf("	float,\n");
printf("	float,\n");
printf("	float,\n");
printf("	float,\n");
printf("	float,\n");
printf("	float,\n");
printf("	float,\n");
printf("	float,\n");
printf("	float\n");
printf("}\n\n");
printf("%%struct.tCollisionState_ = type {\n");
printf("	i32,\n");
printf("	[3 x float],\n");
printf("	[3 x float]\n");
printf("}\n\n");
printf("%%struct.tCarCtrl = type {\n");
printf("	float,\n");
printf("	float,\n");
printf("	float,\n");
printf("	float,\n");
printf("	i32,\n");
printf("	i32,\n");
printf("	[4 x [32 x i8]],\n");
printf("	[4 x float],\n");
printf("	i32\n");
printf("}\n\n");
printf("%%struct.tCarPitCmd = type {\n");
printf("	float,\n");
printf("	i32,\n");
printf("	i32,\n");
printf("	%%struct.tCarPitSetup\n");
printf("}\n\n");
printf("%%struct.tCarPitSetup = type {\n");
printf("	%%struct.tCarPitSetupValue,\n");
printf("	[4 x %%struct.tCarPitSetupValue],\n");
printf("	[4 x %%struct.tCarPitSetupValue],\n");
printf("	[4 x %%struct.tCarPitSetupValue],\n");
printf("	%%struct.tCarPitSetupValue,\n");
printf("	%%struct.tCarPitSetupValue,\n");
printf("	[4 x %%struct.tCarPitSetupValue],\n");
printf("	[4 x %%struct.tCarPitSetupValue],\n");
printf("	[4 x %%struct.tCarPitSetupValue],\n");
printf("	[4 x %%struct.tCarPitSetupValue],\n");
printf("	[4 x %%struct.tCarPitSetupValue],\n");
printf("	[4 x %%struct.tCarPitSetupValue],\n");
printf("	[2 x %%struct.tCarPitSetupValue],\n");
printf("	[2 x %%struct.tCarPitSetupValue],\n");
printf("	[2 x %%struct.tCarPitSetupValue],\n");
printf("	[2 x %%struct.tCarPitSetupValue],\n");
printf("	[2 x %%struct.tCarPitSetupValue],\n");
printf("	[8 x %%struct.tCarPitSetupValue],\n");
printf("	[2 x %%struct.tCarPitSetupValue],\n");
printf("	[3 x %%struct.tCarPitSetupValue],\n");
printf("	[3 x %%struct.tCarPitSetupValue],\n");
printf("	[3 x %%struct.tCarPitSetupValue],\n");
printf("	[3 x %%struct.tCarPitSetupValue],\n");
printf("	[3 x %%struct.tCarPitSetupValue],\n");
printf("	[3 x %%struct.tCarPitSetupValue],\n");
printf("	[3 x i32]\n");
printf("}\n\n");
printf("%%struct.tCarPitSetupValue = type {\n");
printf("	float,\n");
printf("	float,\n");
printf("	float\n");
printf("}\n\n");
printf("%%struct.RobotItf = type {\n");
printf("	void (i32, %%struct.tTrack*, i8*, i8**, %%struct.Situation*)*,\n");
printf("	 {}*,\n");
printf("	 {}*,\n");
printf("	 {}*,\n");
printf("	 i32 (i32, %%struct.CarElt*, %%struct.Situation*)*,\n");
printf("	 void (i32)*,\n");
printf("	 i32\n");
printf("}\n\n");
printf("%%struct.tTrack = type {\n");
printf("	i8*,\n");
printf("	i8*,\n");
printf("	i8*,\n");
printf("	i8*,\n");
printf("	i8*,\n");
printf("	i8*,\n");
printf("	i32,\n");
printf("	i32,\n");
printf("	float,\n");
printf("	float,\n");
printf("	%%struct.tTrackPitInfo,\n");
printf("	%%struct.trackSeg*,\n");
printf("	%%struct.trackSurface*,\n");
printf("	%%struct.t3Dd,\n");
printf("	%%struct.t3Dd,\n");
printf("	%%struct.tTrackGraphicInfo\n");
printf("}\n\n");
printf("%%struct.tTrackPitInfo = type {\n");
printf("	i32,\n");
printf("	i32,\n");
printf("	i32,\n");
printf("	i32,\n");
printf("	float,\n");
printf("	float,\n");
printf("	float,\n");
printf("	%%struct.trackSeg*,\n");
printf("	%%struct.trackSeg*,\n");
printf("	%%struct.trackSeg*,\n");
printf("	%%struct.trackSeg*,\n");
printf("	%%struct.TrackOwnPit*,\n");
printf("	i32,\n");
printf("	i32\n");
printf("}\n\n");
printf("%%struct.tTrackGraphicInfo = type {\n");
printf("	i8*,\n");
printf("	i8*,\n");
printf("	i32,\n");
printf("	[3 x float],\n");
printf("	i32,\n");
printf("	i8**,\n");
printf("	%%struct.tTurnMarksInfo\n");
printf("}\n\n");
printf("%%struct.tTurnMarksInfo = type {\n");
printf("	float,\n");
printf("	float,\n");
printf("	float,\n");
printf("	float\n");
printf("}\n\n");
printf("%%struct.Situation = type {\n");
printf("	%%struct.tRaceAdmInfo,\n");
printf("	double,\n");
printf("	double,\n");
printf("	i32,\n");
printf("	%%struct.CarElt**\n");
printf("}\n\n");
printf("%%struct.tRaceAdmInfo = type {\n");
printf("	i32,\n");
printf("	i32,\n");
printf("	i32,\n");
printf("	i32,\n");
printf("	i32,\n");
printf("	i64\n");
printf("}\n\n");
}

canonical_original_code:
void printTopStaticPart() {
printf("target triple = \"x86_64-unknown-linux-gnu\"\n\n");
printf("%%struct.CarElt = type {\n");
printf("	i32,\n");
printf("	%%struct.tInitCar,\n");
printf("	%%struct.tPublicCar,\n");
printf("	%%struct.tCarRaceInfo,\n");
printf("	%%struct.tPrivCar,\n");
printf("	%%struct.tCarCtrl,\n");
printf("	%%struct.tCarPitCmd,\n");
printf("	%%struct.RobotItf*,\n");
printf("	%%struct.CarElt*\n");
printf("}\n\n");
printf("%%struct.tInitCar = type {\n");
printf("	[32 x i8],\n");
printf("	[32 x i8],\n");
printf("	[32 x i8],\n");
printf("	[32 x i8],\n");
printf("	i32,\n");
printf("	i32,\n");
printf("	i32,\n");
printf("	i32,\n");
printf("	[3 x float],\n");
printf("	%%struct.t3Dd,\n");
printf("	%%struct.t3Dd,\n");
printf("	%%struct.t3Dd,\n");
printf("	float,\n");
printf("	float,\n");
printf("	%%struct.t3Dd,\n");
printf("	[4 x %%struct.tWheelSpec],\n");
printf("	%%struct.tVisualAttributes\n");
printf("}\n\n");
printf("%%struct.t3Dd = type {\n");
printf("	float,\n");
printf("	float,\n");
printf("	float\n");
printf("}\n\n");
printf("%%struct.tWheelSpec = type {\n");
printf("	float,\n");
printf("	float,\n");
printf("	float,\n");
printf("	float,\n");
printf("	float\n");
printf("}\n\n");
printf("%%struct.tVisualAttributes = type {\n");
printf("	i32,\n");
printf("	[2 x %%struct.t3Dd],\n");
printf("	float\n");
printf("}\n\n");
printf("%%struct.tPublicCar = type {\n");
printf("	%%struct.tDynPt,\n");
printf("	%%struct.tDynPt,\n");
printf("	[4 x [4 x float]],\n");
printf("	%%struct.tTrkLocPos,\n");
printf("	i32,\n");
printf("	[4 x %%struct.tPosd]\n");
printf("}\n\n");
printf("%%struct.tDynPt = type {\n");
printf("	%%struct.tPosd,\n");
printf("	%%struct.tPosd,\n");
printf("	%%struct.tPosd\n");
printf("}\n\n");
printf("%%struct.tPosd = type {\n");
printf("	float,\n");
printf("	float,\n");
printf("	float,\n");
printf("	float,\n");
printf("	float,\n");
printf("	float\n");
printf("}\n\n");
printf("%%struct.tTrkLocPos = type {\n");
printf("	%%struct.trackSeg*,\n");
printf("	i32,\n");
printf("	float,\n");
printf("	float,\n");
printf("	float,\n");
printf("	float\n");
printf("}\n\n");
printf("%%struct.trackSeg = type {\n");
printf("	i8*,\n");
printf("	i32,\n");
printf("	i32,\n");
printf("	i32,\n");
printf("	i32,\n");
printf("	float,\n");
printf("	float,\n");
printf("	float,\n");
printf("	float,\n");
printf("	float,\n");
printf("	float,\n");
printf("	float,\n");
printf("	float,\n");
printf("	float,\n");
printf("	%%struct.t3Dd,\n");
printf("	[4 x %%struct.t3Dd],\n");
printf("	[7 x float],\n");
printf("	float,\n");
printf("	float,\n");
printf("	float,\n");
printf("	%%struct.t3Dd,\n");
printf("	i32,\n");
printf("	float,\n");
printf("	i32,\n");
printf("	float,\n");
printf("	%%struct.SegExt*,\n");
printf("	%%struct.trackSurface*,\n");
printf("	[2 x %%struct.trackBarrier*],\n");
printf("	%%struct.RoadCam*,\n");
printf("	%%struct.trackSeg*,\n");
printf("	%%struct.trackSeg*,\n");
printf("	%%union.anon.0\n");
printf("}\n\n");
printf("%%struct.SegExt = type {\n");
printf("	i32,\n");
printf("	i32*\n");
printf("}\n\n");
printf("%%struct.trackSurface = type {\n");
printf("	%%struct.trackSurface*,\n");
printf("	i8*,\n");
printf("	float,\n");
printf("	float,\n");
printf("	float,\n");
printf("	float,\n");
printf("	float,\n");
printf("	float\n");
printf("}\n\n");
printf("%%struct.trackBarrier = type {\n");
printf("	i32,\n");
printf("	float,\n");
printf("	float,\n");
printf("	%%struct.trackSurface*,\n");
printf("	%%class.v2t\n");
printf("}\n\n");
printf("%%class.v2t = type {\n");
printf("	%%union.anon\n");
printf("}\n\n");
printf("%%union.anon = type {\n");
printf("	%%struct.anon\n");
printf("}\n\n");
printf("%%struct.anon = type {\n");
printf("	float,\n");
printf("	float\n");
printf("}\n\n");
printf("%%struct.RoadCam = type {\n");
printf("	i8*,\n");
printf("	%%struct.t3Dd,\n");
printf("	%%struct.RoadCam*\n");
printf("}\n\n");
printf("%%union.anon.0 = type {\n");
printf("	%%struct.anon.1\n");
printf("}\n\n");
printf("%%struct.anon.1 = type {\n");
printf("	%%struct.trackSeg*,\n");
printf("	%%struct.trackSeg*\n");
printf("}\n\n");
printf("%%struct.tCarRaceInfo = type {\n");
printf("	double,\n");
printf("	i8,\n");
printf("	double,\n");
printf("	double,\n");
printf("	double,\n");
printf("	double,\n");
printf("	float,\n");
printf("	float,\n");
printf("	i32,\n");
printf("	i32,\n");
printf("	i32,\n");
printf("	i32,\n");
printf("	double,\n");
printf("	i32,\n");
printf("	double,\n");
printf("	double,\n");
printf("	float,\n");
printf("	float,\n");
printf("	double,\n");
printf("	%%struct.TrackOwnPit*,\n");
printf("	i32,\n");
printf("	%%struct.CarPenaltyHead\n");
printf("}\n\n");
printf("%%struct.TrackOwnPit = type {\n");
printf("	%%struct.tTrkLocPos,\n");
printf("	i32,\n");
printf("	float,\n");
printf("	float,\n");
printf("	i32,\n");
printf("	[4 x %%struct.CarElt*]\n");
printf("}\n\n");
printf("%%struct.CarPenaltyHead = type {\n");
printf("	%%struct.CarPenalty*,\n");
printf("	%%struct.CarPenalty**\n");
printf("}\n\n");
printf("%%struct.CarPenalty = type {\n");
printf("	i32,\n");
printf("	i32,\n");
printf("	%%struct.anon.2\n");
printf("}\n\n");
printf("%%struct.anon.2 = type {\n");
printf("	%%struct.CarPenalty*,\n");
printf("	%%struct.CarPenalty**\n");
printf("}\n\n");
printf("%%struct.tPrivCar = type {\n");
printf("	i8*,\n");
printf("	i8*,\n");
printf("	i32,\n");
printf("	[32 x i8],\n");
printf("	[4 x %%struct.tWheelState],\n");
printf("	[4 x %%struct.tPosd],\n");
printf("	i32,\n");
printf("	float,\n");
printf("	float,\n");
printf("	float,\n");
printf("	float,\n");
printf("	float,\n");
printf("	float,\n");
printf("	float,\n");
printf("	float,\n");
printf("	[10 x float],\n");
printf("	i32,\n");
printf("	i32,\n");
printf("	[4 x float],\n");
printf("	[4 x float],\n");
printf("	i32,\n");
printf("	i32,\n");
printf("	float,\n");
printf("	%%struct.t3Dd,\n");
printf("	%%struct.t3Dd,\n");
printf("	i32,\n");
printf("	i32,\n");
printf("	%%struct.tCollisionState_\n");
printf("}\n\n");
printf("%%struct.tWheelState = type {\n");
printf("	%%struct.tPosd,\n");
printf("	float,\n");
printf("	float,\n");
printf("	i32,\n");
printf("	%%struct.trackSeg*,\n");
printf("	float,\n");
printf("	float,\n");
printf("	float,\n");
printf("	float,\n");
printf("	float,\n");
printf("	float,\n");
printf("	float,\n");
printf("	float,\n");
printf("	float,\n");
printf("	float\n");
printf("}\n\n");
printf("%%struct.tCollisionState_ = type {\n");
printf("	i32,\n");
printf("	[3 x float],\n");
printf("	[3 x float]\n");
printf("}\n\n");
printf("%%struct.tCarCtrl = type {\n");
printf("	float,\n");
printf("	float,\n");
printf("	float,\n");
printf("	float,\n");
printf("	i32,\n");
printf("	i32,\n");
printf("	[4 x [32 x i8]],\n");
printf("	[4 x float],\n");
printf("	i32\n");
printf("}\n\n");
printf("%%struct.tCarPitCmd = type {\n");
printf("	float,\n");
printf("	i32,\n");
printf("	i32,\n");
printf("	%%struct.tCarPitSetup\n");
printf("}\n\n");
printf("%%struct.tCarPitSetup = type {\n");
printf("	%%struct.tCarPitSetupValue,\n");
printf("	[4 x %%struct.tCarPitSetupValue],\n");
printf("	[4 x %%struct.tCarPitSetupValue],\n");
printf("	[4 x %%struct.tCarPitSetupValue],\n");
printf("	%%struct.tCarPitSetupValue,\n");
printf("	%%struct.tCarPitSetupValue,\n");
printf("	[4 x %%struct.tCarPitSetupValue],\n");
printf("	[4 x %%struct.tCarPitSetupValue],\n");
printf("	[4 x %%struct.tCarPitSetupValue],\n");
printf("	[4 x %%struct.tCarPitSetupValue],\n");
printf("	[4 x %%struct.tCarPitSetupValue],\n");
printf("	[4 x %%struct.tCarPitSetupValue],\n");
printf("	[2 x %%struct.tCarPitSetupValue],\n");
printf("	[2 x %%struct.tCarPitSetupValue],\n");
printf("	[2 x %%struct.tCarPitSetupValue],\n");
printf("	[2 x %%struct.tCarPitSetupValue],\n");
printf("	[2 x %%struct.tCarPitSetupValue],\n");
printf("	[8 x %%struct.tCarPitSetupValue],\n");
printf("	[2 x %%struct.tCarPitSetupValue],\n");
printf("	[3 x %%struct.tCarPitSetupValue],\n");
printf("	[3 x %%struct.tCarPitSetupValue],\n");
printf("	[3 x %%struct.tCarPitSetupValue],\n");
printf("	[3 x %%struct.tCarPitSetupValue],\n");
printf("	[3 x %%struct.tCarPitSetupValue],\n");
printf("	[3 x %%struct.tCarPitSetupValue],\n");
printf("	[3 x i32]\n");
printf("}\n\n");
printf("%%struct.tCarPitSetupValue = type {\n");
printf("	float,\n");
printf("	float,\n");
printf("	float\n");
printf("}\n\n");
printf("%%struct.RobotItf = type {\n");
printf("	void (i32, %%struct.tTrack*, i8*, i8**, %%struct.Situation*)*,\n");
printf("	 {}*,\n");
printf("	 {}*,\n");
printf("	 {}*,\n");
printf("	 i32 (i32, %%struct.CarElt*, %%struct.Situation*)*,\n");
printf("	 void (i32)*,\n");
printf("	 i32\n");
printf("}\n\n");
printf("%%struct.tTrack = type {\n");
printf("	i8*,\n");
printf("	i8*,\n");
printf("	i8*,\n");
printf("	i8*,\n");
printf("	i8*,\n");
printf("	i8*,\n");
printf("	i32,\n");
printf("	i32,\n");
printf("	float,\n");
printf("	float,\n");
printf("	%%struct.tTrackPitInfo,\n");
printf("	%%struct.trackSeg*,\n");
printf("	%%struct.trackSurface*,\n");
printf("	%%struct.t3Dd,\n");
printf("	%%struct.t3Dd,\n");
printf("	%%struct.tTrackGraphicInfo\n");
printf("}\n\n");
printf("%%struct.tTrackPitInfo = type {\n");
printf("	i32,\n");
printf("	i32,\n");
printf("	i32,\n");
printf("	i32,\n");
printf("	float,\n");
printf("	float,\n");
printf("	float,\n");
printf("	%%struct.trackSeg*,\n");
printf("	%%struct.trackSeg*,\n");
printf("	%%struct.trackSeg*,\n");
printf("	%%struct.trackSeg*,\n");
printf("	%%struct.TrackOwnPit*,\n");
printf("	i32,\n");
printf("	i32\n");
printf("}\n\n");
printf("%%struct.tTrackGraphicInfo = type {\n");
printf("	i8*,\n");
printf("	i8*,\n");
printf("	i32,\n");
printf("	[3 x float],\n");
printf("	i32,\n");
printf("	i8**,\n");
printf("	%%struct.tTurnMarksInfo\n");
printf("}\n\n");
printf("%%struct.tTurnMarksInfo = type {\n");
printf("	float,\n");
printf("	float,\n");
printf("	float,\n");
printf("	float\n");
printf("}\n\n");
printf("%%struct.Situation = type {\n");
printf("	%%struct.tRaceAdmInfo,\n");
printf("	double,\n");
printf("	double,\n");
printf("	i32,\n");
printf("	%%struct.CarElt**\n");
printf("}\n\n");
printf("%%struct.tRaceAdmInfo = type {\n");
printf("	i32,\n");
printf("	i32,\n");
printf("	i32,\n");
printf("	i32,\n");
printf("	i32,\n");
printf("	i64\n");
printf("}\n\n");
}


printBottomStaticPart

repo: ygarbage/compilation

decompiled_code:
int printBottomStaticPart()
{
printf("declare float @norm_pi_pi(float %%a)\n");
printf("declare float @get_track_angle(%%struct.tTrkLocPos*)\n");
printf("declare float @get_pos_to_right(%%struct.tTrkLocPos*)\n");
printf("declare float @get_pos_to_middle(%%struct.tTrkLocPos*)\n");
printf("declare float @get_pos_to_left(%%struct.tTrkLocPos*)\n");
printf("declare float @get_pos_to_start(%%struct.tTrkLocPos*)\n");
printf("declare float @get_track_seg_length(%%struct.trackSeg*)\n");
printf("declare float @get_track_seg_width(%%struct.trackSeg*)\n");
printf("declare float @get_track_seg_start_width(%%struct.trackSeg*)\n");
printf("declare float @get_track_seg_end_width(%%struct.trackSeg*)\n");
printf("declare float @get_track_seg_radius(%%struct.trackSeg*)\n");
printf("declare float @get_track_seg_right_radius(%%struct.trackSeg*)\n");
printf("declare float @get_track_seg_left_radius(%%struct.trackSeg*)\n");
printf("declare float @get_track_seg_arc(%%struct.trackSeg*)\n");
printf("declare %%struct.trackSeg* @get_track_seg_next(%%struct.trackSeg*)\n");
return printf("declare float @get_car_yaw(%%struct.CarElt*)\n");
}

canonical_decompiled_code:
int func1()
{
printf("declare float @norm_pi_pi(float %%a)\n");
printf("declare float @get_track_angle(%%struct.tTrkLocPos*)\n");
printf("declare float @get_pos_to_right(%%struct.tTrkLocPos*)\n");
printf("declare float @get_pos_to_middle(%%struct.tTrkLocPos*)\n");
printf("declare float @get_pos_to_left(%%struct.tTrkLocPos*)\n");
printf("declare float @get_pos_to_start(%%struct.tTrkLocPos*)\n");
printf("declare float @get_track_seg_length(%%struct.trackSeg*)\n");
printf("declare float @get_track_seg_width(%%struct.trackSeg*)\n");
printf("declare float @get_track_seg_start_width(%%struct.trackSeg*)\n");
printf("declare float @get_track_seg_end_width(%%struct.trackSeg*)\n");
printf("declare float @get_track_seg_radius(%%struct.trackSeg*)\n");
printf("declare float @get_track_seg_right_radius(%%struct.trackSeg*)\n");
printf("declare float @get_track_seg_left_radius(%%struct.trackSeg*)\n");
printf("declare float @get_track_seg_arc(%%struct.trackSeg*)\n");
printf("declare %%struct.trackSeg* @get_track_seg_next(%%struct.trackSeg*)\n");
return printf("declare float @get_car_yaw(%%struct.CarElt*)\n");
}

original_code:
void printBottomStaticPart(void) {
  printf("declare float @norm_pi_pi(float %%a)\n");
  printf("declare float @get_track_angle(%%struct.tTrkLocPos*)\n");
  printf("declare float @get_pos_to_right(%%struct.tTrkLocPos*)\n");
  printf("declare float @get_pos_to_middle(%%struct.tTrkLocPos*)\n");
  printf("declare float @get_pos_to_left(%%struct.tTrkLocPos*)\n");
  printf("declare float @get_pos_to_start(%%struct.tTrkLocPos*)\n");
  printf("declare float @get_track_seg_length(%%struct.trackSeg*)\n");
  printf("declare float @get_track_seg_width(%%struct.trackSeg*)\n");
  printf("declare float @get_track_seg_start_width(%%struct.trackSeg*)\n");
  printf("declare float @get_track_seg_end_width(%%struct.trackSeg*)\n");
  printf("declare float @get_track_seg_radius(%%struct.trackSeg*)\n");
  printf("declare float @get_track_seg_right_radius(%%struct.trackSeg*)\n");
  printf("declare float @get_track_seg_left_radius(%%struct.trackSeg*)\n");
  printf("declare float @get_track_seg_arc(%%struct.trackSeg*)\n");
  printf("declare %%struct.trackSeg* @get_track_seg_next(%%struct.trackSeg*)\n");
  printf("declare float @get_car_yaw(%%struct.CarElt*)\n");
}

canonical_original_code:
void printBottomStaticPart() {
  printf("declare float @norm_pi_pi(float %%a)\n");
  printf("declare float @get_track_angle(%%struct.tTrkLocPos*)\n");
  printf("declare float @get_pos_to_right(%%struct.tTrkLocPos*)\n");
  printf("declare float @get_pos_to_middle(%%struct.tTrkLocPos*)\n");
  printf("declare float @get_pos_to_left(%%struct.tTrkLocPos*)\n");
  printf("declare float @get_pos_to_start(%%struct.tTrkLocPos*)\n");
  printf("declare float @get_track_seg_length(%%struct.trackSeg*)\n");
  printf("declare float @get_track_seg_width(%%struct.trackSeg*)\n");
  printf("declare float @get_track_seg_start_width(%%struct.trackSeg*)\n");
  printf("declare float @get_track_seg_end_width(%%struct.trackSeg*)\n");
  printf("declare float @get_track_seg_radius(%%struct.trackSeg*)\n");
  printf("declare float @get_track_seg_right_radius(%%struct.trackSeg*)\n");
  printf("declare float @get_track_seg_left_radius(%%struct.trackSeg*)\n");
  printf("declare float @get_track_seg_arc(%%struct.trackSeg*)\n");
  printf("declare %%struct.trackSeg* @get_track_seg_next(%%struct.trackSeg*)\n");
  printf("declare float @get_car_yaw(%%struct.CarElt*)\n");
}

return_type: void


printDriveFunctionEnd

decompiled_code:
int printDriveFunctionEnd()
{
puts(" \tret void");
return puts("}\n");
}

canonical_decompiled_code:
int func2()
{
puts(" \tret void");
return puts("}\n");
}

original_code:
void printDriveFunctionEnd(void) {
  printf(" 	ret void\n");
  printf("}\n\n");
}

canonical_original_code:
void printDriveFunctionEnd() {
  printf(" 	ret void\n");
  printf("}\n\n");
}


cmp

decompiled_code:
__int64 __fastcall cmp(const void *a1, const void *a2)
{
return (*(_DWORD *)a1 > *(_DWORD *)a2) - (unsigned int)(*(_DWORD *)a1 < *(_DWORD *)a2);
}

canonical_decompiled_code:
__int64 __fastcall func0(const void *a1, const void *a2)
{
return (*(_DWORD *)a1 > *(_DWORD *)a2) - (unsigned int)(*(_DWORD *)a1 < *(_DWORD *)a2);
}

original_code:
static int cmp(const void *_lhs, const void *_rhs) {
  int lhs = * (const int *) _lhs;
  int rhs = * (const int *) _rhs;
  return (lhs > rhs) - (lhs < rhs);
}

canonical_original_code:
static int cmp(void *_lhs, void *_rhs) {
  int lhs = * (const int *) _lhs;
  int rhs = * (const int *) _rhs;
  return (lhs > rhs) - (lhs < rhs);
}

variable_types: lhs int

variable_types: rhs int

return_type: int


decompiled_code:
void __fastcall std_qsort(size_t nmemb, void *base)
{
qsort(base, nmemb, 4uLL, (__compar_fn_t)cmp);
}

canonical_decompiled_code:
void __fastcall func1(size_t nmemb, void *base)
{
qsort(base, nmemb, 4uLL, (__compar_fn_t)cmp);
}

original_code:
void std_qsort(size_t n, int *array) {
  qsort(array, n, sizeof(*array), &cmp);
}

canonical_original_code:
void std_qsort(unsigned long n, int *array) {
  qsort(array, n, sizeof(*array), &cmp);
}

variable_types:
n
unsigned long

variable_types:
array
int *


decompiled_code:
__int64 __fastcall select_method(__int64 a1, __int64 a2, __int64 a3, const char *a4)
{
__int64 v6; // rbx

if ( !a1 )
return 0LL;
v6 = 0LL;
while ( strcmp(a4, *(const char **)(a2 + 8 * v6)) )
{
if ( a1 == ++v6 )
return 0LL;
}
return *(_QWORD *)(a3 + 8 * v6);
}

canonical_decompiled_code:
__int64 __fastcall func1(__int64 a1, __int64 a2, __int64 a3, const char *a4)
{
__int64 v6; // rbx

if ( !a1 )
return 0LL;
v6 = 0LL;
while ( strcmp(a4, *(const char **)(a2 + 8 * v6)) )
{
if ( a1 == ++v6 )
return 0LL;
}
return *(_QWORD *)(a3 + 8 * v6);
}

original_code:
sorting_method select_method(size_t num_methods,
        const char * const * names,
        sorting_method * methods,
        const char *name) {
  size_t i = 0;
  for (i = 0; i < num_methods; ++i)
    if (strcmp(name, names[i]) == 0)
      return methods[i];
  return ((void *)0);
}

canonical_original_code:
void (*select_method(unsigned long num_methods, char **names, void (**methods)(unsigned long, int *), char *name))(unsigned long, int *) {
  unsigned long i = 0;
  for (i = 0; i < num_methods; ++i)
    if (strcmp(name, names[i]) == 0)
      return methods[i];
  return ((void *)0);
}

variable_types:
names
char **

variable_types:
methods
void (**)(unsigned long, int *)

variable_types:
name
char *

variable_types:
i
unsigned long

return_type: void (*)(unsigned long, int *)


main

canonical_name: main

decompiled_code:
// local variable allocation has failed, the output may be wrong!
int __cdecl main(int argc, const char **argv, const char **envp)
{
const char *v3; // rbp
void (__fastcall *v4)(__int64, void *); // rbx
void *ptr; // [rsp+0h] [rbp-A8h] BYREF
__int64 v7; // [rsp+8h] [rbp-A0h] BYREF
__int64 v8[8]; // [rsp+10h] [rbp-98h] BYREF
__int64 v9[11]; // [rsp+50h] [rbp-58h] BYREF

v9[0] = (__int64)"insertion_sort";
v9[1] = (__int64)"merge_sort";
v9[2] = (__int64)"quick_sort";
v9[3] = (__int64)"randomized_quick_sort";
v9[4] = (__int64)"std_qsort";
v9[5] = (__int64)"heap_sort";
v9[6] = (__int64)"radix_sort";
v8[0] = (__int64)&insertion_sort;
v8[1] = (__int64)&merge_sort;
v8[2] = (__int64)&quick_sort;
v8[3] = (__int64)&randomized_quick_sort;
v8[4] = (__int64)&std_qsort;
v8[5] = (__int64)&heap_sort;
v8[6] = (__int64)&radix_sort;
if ( argc != 2 )
display_usage(*(__int64 *)&argc, argv, 7LL, (__int64)v9);
v3 = argv[1];
v4 = (void (__fastcall *)(__int64, void *))select_method(7LL, (__int64)v9, (__int64)v8, v3);
if ( !v4 )
{
fprintf(stderr, "Incorrect method name: %s\n", v3);
exit(1);
}
read_data(&v7, &ptr);
v4(v7, ptr);
write_data(v7, ptr);
free(ptr);
return 0;
}

canonical_decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
const char *v3; // rbp
void (__fastcall *v4)(__int64, void *); // rbx
void *ptr; // [rsp+0h] [rbp-A8h] BYREF
__int64 v7; // [rsp+8h] [rbp-A0h] BYREF
__int64 v8[8]; // [rsp+10h] [rbp-98h] BYREF
__int64 v9[11]; // [rsp+50h] [rbp-58h] BYREF

v9[0] = (__int64)"insertion_sort";
v9[1] = (__int64)"merge_sort";
v9[2] = (__int64)"quick_sort";
v9[3] = (__int64)"randomized_quick_sort";
v9[4] = (__int64)"std_qsort";
v9[5] = (__int64)"heap_sort";
v9[6] = (__int64)"radix_sort";
v8[0] = (__int64)&insertion_sort;
v8[1] = (__int64)&merge_sort;
v8[2] = (__int64)&quick_sort;
v8[3] = (__int64)&randomized_quick_sort;
v8[4] = (__int64)&std_qsort;
v8[5] = (__int64)&heap_sort;
v8[6] = (__int64)&radix_sort;
if ( argc != 2 )
func0(*(__int64 *)&argc, argv, 7LL, (__int64)v9);
v3 = argv[1];
v4 = (void (__fastcall *)(__int64, void *))func1(7LL, (__int64)v9, (__int64)v8, v3);
if ( !v4 )
{
fprintf(stderr, "Incorrect method name: %s\n", v3);
exit(1);
}
read_data(&v7, &ptr);
v4(v7, ptr);
write_data(v7, ptr);
free(ptr);
return 0;
}

original_code:
int main(int argc, char **argv) {
  const char * const sorting_method_names[] = {
    "insertion_sort",
    "merge_sort",
    "quick_sort",
    "randomized_quick_sort",
    "std_qsort",
    "heap_sort",
    "radix_sort",
  };
  sorting_method methods[] = {
    &insertion_sort,
    &merge_sort,
    &quick_sort,
    &randomized_quick_sort,
    &std_qsort,
    &heap_sort,
    &radix_sort,
  };
  const size_t num_methods =
    sizeof(sorting_method_names) / sizeof(*sorting_method_names);
  if (argc != 2)
    display_usage(argc, argv, num_methods, sorting_method_names);
  sorting_method method = select_method(num_methods, sorting_method_names,
     methods, argv[1]);
  if (method == ((void *)0)) {
    fprintf(stderr, "Incorrect method name: %s\n", argv[1]);
    exit(1);
  }
  size_t n;
  int *array;
  read_data(&n, &array);
  (*method)(n, array);
  write_data(n, array);
  free(array);
  return 0;
}

canonical_original_code:
int main(int argc, char **argv) {
  char *sorting_method_names[] = {
    "insertion_sort",
    "merge_sort",
    "quick_sort",
    "randomized_quick_sort",
    "std_qsort",
    "heap_sort",
    "radix_sort",
  };
  void (*methods[])(unsigned long, int *) = {
    &insertion_sort,
    &merge_sort,
    &quick_sort,
    &randomized_quick_sort,
    &std_qsort,
    &heap_sort,
    &radix_sort,
  };
  unsigned long num_methods = sizeof(sorting_method_names) / sizeof(*sorting_method_names);
  if (argc != 2)
    display_usage(argc, argv, num_methods, sorting_method_names);
  void (*method)(unsigned long, int *) = select_method(num_methods, sorting_method_names,
     methods, argv[1]);
  if (method == ((void *)0)) {
    fprintf(stderr, "Incorrect method name: %s\n", argv[1]);
    exit(1);
  }
  unsigned long n;
  int *array;
  read_data(&n, &array);
  (*method)(n, array);
  write_data(n, array);
  free(array);
  return 0;
}

variable_types: argc int

variable_types:
argv
char **

variable_types:
methods
void (*[])(unsigned long, int *)

variable_types:
method
void (*)(unsigned long, int *)


decompiled_code:
__int64 __fastcall left_child(__int64 a1)
{
return 2 * a1 + 1;
}

canonical_decompiled_code:
__int64 __fastcall func0(__int64 a1)
{
return 2 * a1 + 1;
}

original_code:
static inline size_t left_child(size_t index) {
  return 2 * index + 1;
}

canonical_original_code:
static inline unsigned long left_child(unsigned long index) {
  return 2 * index + 1;
}

variable_types:
index
unsigned long

return_type: unsigned long


decompiled_code:
__int64 __fastcall right_child(__int64 a1)
{
return 2 * a1 + 2;
}

canonical_decompiled_code:
__int64 __fastcall func1(__int64 a1)
{
return 2 * a1 + 2;
}

original_code:
static inline size_t right_child(size_t index) {
  return 2 * index + 2;
}

canonical_original_code:
static inline unsigned long right_child(unsigned long index) {
  return 2 * index + 2;
}


parent

decompiled_code:
unsigned __int64 __fastcall parent(__int64 a1)
{
return (unsigned __int64)(a1 - 1) >> 1;
}

canonical_decompiled_code:
unsigned __int64 __fastcall func2(__int64 a1)
{
return (unsigned __int64)(a1 - 1) >> 1;
}

original_code:
static inline size_t parent(size_t index) {
  return (index - 1) / 2;
}

canonical_original_code:
static inline unsigned long parent(unsigned long index) {
  return (index - 1) / 2;
}


heapify

decompiled_code:
unsigned __int64 __fastcall heapify(unsigned __int64 a1, __int64 a2, __int64 a3)
{
int v4; // ebp
unsigned __int64 v5; // r14
unsigned __int64 result; // rax

v4 = a3;
v5 = left_child(a3);
result = right_child(a3);
if ( v5 < a1 && *(_DWORD *)(a2 + 4 * v5) > *(_DWORD *)(a2 + 4LL * (int)a3) )
v4 = v5;
if ( result < a1 && *(_DWORD *)(a2 + 4 * result) > *(_DWORD *)(a2 + 4LL * v4) )
v4 = result;
if ( v4 != a3 )
{
swap(a2, a3, v4);
result = heapify(a1, a2, v4);
}
return result;
}

canonical_decompiled_code:
unsigned __int64 __fastcall func3(unsigned __int64 a1, __int64 a2, __int64 a3)
{
int v4; // ebp
unsigned __int64 v5; // r14
unsigned __int64 result; // rax

v4 = a3;
v5 = func0(a3);
result = func1(a3);
if ( v5 < a1 && *(_DWORD *)(a2 + 4 * v5) > *(_DWORD *)(a2 + 4LL * (int)a3) )
v4 = v5;
if ( result < a1 && *(_DWORD *)(a2 + 4 * result) > *(_DWORD *)(a2 + 4LL * v4) )
v4 = result;
if ( v4 != a3 )
{
swap(a2, a3, v4);
result = func3(a1, a2, v4);
}
return result;
}

original_code:
static void heapify(size_t n, int *heap, size_t index) {
  int largest = index;
  size_t left = left_child(index);
  size_t right = right_child(index);
  if (left < n && heap[left] > heap[largest])
    largest = left;
  if (right < n && heap[right] > heap[largest])
    largest = right;
  if (largest != index) {
    swap(heap, index, largest);
    heapify(n, heap, largest);
  }
}

canonical_original_code:
static void heapify(unsigned long n, int *heap, unsigned long index) {
  int largest = index;
  unsigned long left = left_child(index);
  unsigned long right = right_child(index);
  if (left < n && heap[left] > heap[largest])
    largest = left;
  if (right < n && heap[right] > heap[largest])
    largest = right;
  if (largest != index) {
    swap(heap, index, largest);
    heapify(n, heap, largest);
  }
}

variable_types:
heap
int *

variable_types: largest int

variable_types:
left
unsigned long

variable_types:
right
unsigned long


decompiled_code:
unsigned __int64 __fastcall make_heap(unsigned __int64 a1, __int64 a2)
{
__int64 v2; // rbx
unsigned __int64 result; // rax

if ( a1 )
{
v2 = a1 - 1;
do
result = heapify(a1, a2, v2--);
while ( v2 != -1 );
}
return result;
}

canonical_decompiled_code:
unsigned __int64 __fastcall func5(unsigned __int64 a1, __int64 a2)
{
__int64 v2; // rbx
unsigned __int64 result; // rax

if ( a1 )
{
v2 = a1 - 1;
do
result = func3(a1, a2, v2--);
while ( v2 != -1 );
}
return result;
}

original_code:
void make_heap(size_t n, int *array) {
  size_t i;
  for (i = 0; i < n; ++i)
    heapify(n, array, n - i - 1);
}

canonical_original_code:
void make_heap(unsigned long n, int *array) {
  unsigned long i;
  for (i = 0; i < n; ++i)
    heapify(n, array, n - i - 1);
}


decompiled_code:
void __fastcall push_heap(__int64 a1, __int64 a2)
{
increase_key(a1, a2, a1 - 1);
}

canonical_decompiled_code:
void __fastcall func6(__int64 a1, __int64 a2)
{
func4(a1, a2, a1 - 1);
}

original_code:
void push_heap(size_t n, int *heap) {
  increase_key(n, heap, n - 1);
}

canonical_original_code:
void push_heap(unsigned long n, int *heap) {
  increase_key(n, heap, n - 1);
}


decompiled_code:
unsigned __int64 __fastcall pop_heap(unsigned __int64 a1, __int64 a2)
{
unsigned __int64 result; // rax

if ( a1 > 1 )
{
swap(a2, 0LL, a1 - 1);
result = heapify(a1 - 1, a2, 0LL);
}
return result;
}

canonical_decompiled_code:
unsigned __int64 __fastcall func7(unsigned __int64 a1, __int64 a2)
{
unsigned __int64 result; // rax

if ( a1 > 1 )
{
swap(a2, 0LL, a1 - 1);
result = func3(a1 - 1, a2, 0LL);
}
return result;
}

original_code:
void pop_heap(size_t n, int *heap) {
  if (n > 1) {
    swap(heap, 0, n - 1);
    heapify(n - 1, heap, 0);
  }
}

canonical_original_code:
void pop_heap(unsigned long n, int *heap) {
  if (n > 1) {
    swap(heap, 0, n - 1);
    heapify(n - 1, heap, 0);
  }
}


decompiled_code:
unsigned __int64 __fastcall heap_sort(unsigned __int64 a1, __int64 a2)
{
unsigned __int64 v2; // rbx
unsigned __int64 result; // rax

v2 = a1;
for ( result = make_heap(a1, a2); v2; --v2 )
result = pop_heap(v2, a2);
return result;
}

canonical_decompiled_code:
unsigned __int64 __fastcall func8(unsigned __int64 a1, __int64 a2)
{
unsigned __int64 v2; // rbx
unsigned __int64 result; // rax

v2 = a1;
for ( result = func5(a1, a2); v2; --v2 )
result = func7(v2, a2);
return result;
}

original_code:
void heap_sort(size_t n, int *array) {
  size_t i;
  make_heap(n, array);
  for (i = 0; i < n; ++i)
    pop_heap(n - i, array);
}

canonical_original_code:
void heap_sort(unsigned long n, int *array) {
  unsigned long i;
  make_heap(n, array);
  for (i = 0; i < n; ++i)
    pop_heap(n - i, array);
}


partition

original_code:
static void partition(size_t n, int *array, _Bool randomized,
        size_t *left, size_t *right) {
  size_t i;
  int pivot;
  if (randomized)
    swap(array, rand() % n, n - 1);
  pivot = array[n - 1];
  *left = 0;
  for (i = 0; i < n; ++i)
    if (array[i] < pivot) {
      swap(array, *left, i);
      ++*left;
    }
  *right = *left;
  for (i = *left; i < n; ++i)
    if (array[i] == pivot) {
      swap(array, *right, i);
      ++*right;
    }
}

canonical_original_code:
static void partition(unsigned long n, int *array, _Bool randomized, unsigned long *left, unsigned long *right) {
  unsigned long i;
  int pivot;
  if (randomized)
    swap(array, rand() % n, n - 1);
  pivot = array[n - 1];
  *left = 0;
  for (i = 0; i < n; ++i)
    if (array[i] < pivot) {
      swap(array, *left, i);
      ++*left;
    }
  *right = *left;
  for (i = *left; i < n; ++i)
    if (array[i] == pivot) {
      swap(array, *right, i);
      ++*right;
    }
}

variable_types:
left
unsigned long *

variable_types:
right
unsigned long *

variable_types: pivot int


decompiled_code:
__int64 __fastcall quick_sort(unsigned __int64 a1, __int64 a2)
{
__int64 result; // rax
unsigned __int64 v3; // [rsp+0h] [rbp-28h] BYREF
unsigned __int64 v4[4]; // [rsp+8h] [rbp-20h] BYREF

if ( a1 > 1 )
{
partition(a1, a2, 0, &v3, v4);
quick_sort(v3, a2);
result = quick_sort(a1 - v4[0], a2 + 4 * v4[0]);
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func1(unsigned __int64 a1, __int64 a2)
{
__int64 result; // rax
unsigned __int64 v3; // [rsp+0h] [rbp-28h] BYREF
unsigned __int64 v4[4]; // [rsp+8h] [rbp-20h] BYREF

if ( a1 > 1 )
{
func0(a1, a2, 0, &v3, v4);
func1(v3, a2);
result = func1(a1 - v4[0], a2 + 4 * v4[0]);
}
return result;
}

original_code:
void quick_sort(size_t n, int *array) {
  if (n >= 2) {
    size_t left, right;
    partition(n, array, 0, &left, &right);
    quick_sort(left, array);
    quick_sort(n - right, array + right);
  }
}

canonical_original_code:
void quick_sort(unsigned long n, int *array) {
  if (n >= 2) {
    unsigned long left; unsigned long right;
    partition(n, array, 0, &left, &right);
    quick_sort(left, array);
    quick_sort(n - right, array + right);
  }
}

variable_types:
n
unsigned long

variable_types:
array
int *


decompiled_code:
__int64 __fastcall randomized_quick_sort(unsigned __int64 a1, __int64 a2)
{
__int64 result; // rax
unsigned __int64 v3; // [rsp+0h] [rbp-28h] BYREF
unsigned __int64 v4[4]; // [rsp+8h] [rbp-20h] BYREF

if ( a1 > 1 )
{
partition(a1, a2, 1, &v3, v4);
randomized_quick_sort(v3, a2);
result = randomized_quick_sort(a1 - v4[0], a2 + 4 * v4[0]);
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func2(unsigned __int64 a1, __int64 a2)
{
__int64 result; // rax
unsigned __int64 v3; // [rsp+0h] [rbp-28h] BYREF
unsigned __int64 v4[4]; // [rsp+8h] [rbp-20h] BYREF

if ( a1 > 1 )
{
func0(a1, a2, 1, &v3, v4);
func2(v3, a2);
result = func2(a1 - v4[0], a2 + 4 * v4[0]);
}
return result;
}

original_code:
void randomized_quick_sort(size_t n, int *array) {
  if (n >= 2) {
    size_t left, right;
    partition(n, array, 1, &left, &right);
    randomized_quick_sort(left, array);
    randomized_quick_sort(n - right, array + right);
  }
}

canonical_original_code:
void randomized_quick_sort(unsigned long n, int *array) {
  if (n >= 2) {
    unsigned long left; unsigned long right;
    partition(n, array, 1, &left, &right);
    randomized_quick_sort(left, array);
    randomized_quick_sort(n - right, array + right);
  }
}


merge

original_code:
static void merge(size_t n, const int *a,
    size_t m, const int *b,
    int *c) {
  size_t i = 0, j = 0, k = 0;
  while (i < n && j < m) {
    if (a[i] < b[j])
      c[k++] = a[i++];
    else
      c[k++] = b[j++];
  }
  while (i < n)
    c[k++] = a[i++];
  while (j < m)
    c[k++] = b[j++];
}

canonical_original_code:
static void merge(unsigned long n, int *a, unsigned long m, int *b, int *c) {
  unsigned long i = 0; unsigned long j = 0; unsigned long k = 0;
  while (i < n && j < m) {
    if (a[i] < b[j])
      c[k++] = a[i++];
    else
      c[k++] = b[j++];
  }
  while (i < n)
    c[k++] = a[i++];
  while (j < m)
    c[k++] = b[j++];
}

variable_types:
a
int *

variable_types:
m
unsigned long

variable_types:
b
int *

variable_types:
c
int *

variable_types:
j
unsigned long

variable_types:
k
unsigned long


decompiled_code:
void __fastcall merge_sort(unsigned __int64 a1, char *a2)
{
unsigned __int64 v2; // r14
size_t v3; // r13
void *v4; // rbp
unsigned __int64 v5; // rbx
void *v6; // r12

if ( a1 > 1 )
{
v2 = a1 >> 1;
v3 = 4 * (a1 >> 1);
v4 = malloc(v3);
if ( !v4 )
{
fwrite("Can't allocate memory\n", 1uLL, 0x16uLL, stderr);
exit(1);
}
v5 = a1 - v2;
v6 = malloc(4 * (a1 - v2));
if ( !v6 )
{
fwrite("Can't allocate memory\n", 1uLL, 0x16uLL, stderr);
exit(1);
}
memcpy(v4, a2, v3);
memcpy(v6, &a2[v3], 4 * v5);
merge_sort(v2, v4);
merge_sort(v5, v6);
merge(v2, (__int64)v4, v5, (__int64)v6, (__int64)a2);
free(v4);
free(v6);
}
}

canonical_decompiled_code:
void __fastcall func1(unsigned __int64 a1, char *a2)
{
unsigned __int64 v2; // r14
size_t v3; // r13
void *v4; // rbp
unsigned __int64 v5; // rbx
void *v6; // r12

if ( a1 > 1 )
{
v2 = a1 >> 1;
v3 = 4 * (a1 >> 1);
v4 = malloc(v3);
if ( !v4 )
{
fwrite("Can't allocate memory\n", 1uLL, 0x16uLL, stderr);
exit(1);
}
v5 = a1 - v2;
v6 = malloc(4 * (a1 - v2));
if ( !v6 )
{
fwrite("Can't allocate memory\n", 1uLL, 0x16uLL, stderr);
exit(1);
}
memcpy(v4, a2, v3);
memcpy(v6, &a2[v3], 4 * v5);
func1(v2, v4);
func1(v5, v6);
func0(v2, (__int64)v4, v5, (__int64)v6, (__int64)a2);
free(v4);
free(v6);
}
}

original_code:
void merge_sort(size_t n, int *array) {
  size_t left_size, right_size;
  int *left_part, *right_part;
  if (n < 2)
    return;
  left_size = n / 2;
  left_part = (int*) malloc(left_size * sizeof(*left_part));
  if (left_part == ((void *)0)) {
    fprintf(stderr, "Can't allocate memory\n");
    exit(1);
  }
  right_size = n - left_size;
  right_part = (int*) malloc(right_size * sizeof(*right_part));
  if (right_part == ((void *)0)) {
    fprintf(stderr, "Can't allocate memory\n");
    exit(1);
  }
  memmove(left_part, array, left_size * sizeof(*left_part));
  memmove(right_part, array + left_size, right_size * sizeof(*right_part));
  merge_sort(left_size, left_part);
  merge_sort(right_size, right_part);
  merge(left_size, left_part, right_size, right_part, array);
  free(left_part);
  free(right_part);
}

canonical_original_code:
void merge_sort(unsigned long n, int *array) {
  unsigned long left_size; unsigned long right_size;
  int *left_part; int *right_part;
  if (n < 2)
    return;
  left_size = n / 2;
  left_part = (int *) malloc(left_size * sizeof(*left_part));
  if (left_part == ((void *)0)) {
    fprintf(stderr, "Can't allocate memory\n");
    exit(1);
  }
  right_size = n - left_size;
  right_part = (int *) malloc(right_size * sizeof(*right_part));
  if (right_part == ((void *)0)) {
    fprintf(stderr, "Can't allocate memory\n");
    exit(1);
  }
  memmove(left_part, array, left_size * sizeof(*left_part));
  memmove(right_part, array + left_size, right_size * sizeof(*right_part));
  merge_sort(left_size, left_part);
  merge_sort(right_size, right_part);
  merge(left_size, left_part, right_size, right_part, array);
  free(left_part);
  free(right_part);
}


decompiled_code:
int __fastcall write_data(__int64 a1, __int64 a2)
{
__int64 i; // rbx
int result; // eax

if ( a1 )
{
for ( i = 0LL; i != a1; ++i )
result = printf("%d\n", *(unsigned int *)(a2 + 4 * i));
}
return result;
}

canonical_decompiled_code:
int __fastcall func1(__int64 a1, __int64 a2)
{
__int64 i; // rbx
int result; // eax

if ( a1 )
{
for ( i = 0LL; i != a1; ++i )
result = printf("%d\n", *(unsigned int *)(a2 + 4 * i));
}
return result;
}

original_code:
void write_data(size_t n, const int *array) {
  size_t i;
  for (i = 0; i < n; ++i)
    printf("%d\n", array[i]);
}

canonical_original_code:
void write_data(unsigned long n, int *array) {
  unsigned long i;
  for (i = 0; i < n; ++i)
    printf("%d\n", array[i]);
}

variable_types:
i
unsigned long


decompiled_code:
void __fastcall radix_sort(size_t nmemb, void *src)
{
int *v2; // rax
int *v3; // r12
int i; // ebx
__int64 j; // rdx

v2 = (int *)calloc(nmemb, 4uLL);
if ( !v2 )
_assert_fail("keys != NULL", "src/radix_sort.c", 0x26u, "radix_sort");
v3 = v2;
for ( i = 0; i != 32; i += 8 )
{
if ( nmemb )
{
for ( j = 0LL; j != nmemb; ++j )
v3[j] = (unsigned __int8)(*((int *)src + j) >> i);
}
counting_sort(nmemb, src, 0x100uLL, v3);
}
free(v3);
}

canonical_decompiled_code:
void __fastcall func1(size_t nmemb, void *src)
{
int *v2; // rax
int *v3; // r12
int i; // ebx
__int64 j; // rdx

v2 = (int *)calloc(nmemb, 4uLL);
if ( !v2 )
_assert_fail("keys != NULL", "src/radix_sort.c", 0x26u, "radix_sort");
v3 = v2;
for ( i = 0; i != 32; i += 8 )
{
if ( nmemb )
{
for ( j = 0LL; j != nmemb; ++j )
v3[j] = (unsigned __int8)(*((int *)src + j) >> i);
}
func0(nmemb, src, 0x100uLL, v3);
}
free(v3);
}

original_code:
void radix_sort(size_t n, int *array) {
  const size_t k = 1 << 8, mask = (1 << 8) - 1;
  int *keys = (int*) calloc(n, sizeof(*array));
  size_t i, offset;
  ((void) sizeof ((keys != ((void *)0)) ? 1 : 0), __extension__ ({ if (keys != ((void *)0)) ; else __assert_fail ("keys != NULL", "src/radix_sort.c", 38, __extension__ __PRETTY_FUNCTION__); }));
  for (offset = 0; offset < sizeof(*array); ++offset) {
    const size_t num_bits = 8 * offset;
    for (i = 0; i < n; ++i)
      keys[i] = (array[i] >> num_bits) & mask;
    counting_sort(n, array, k, keys);
  }
  free(keys);
}

canonical_original_code:
void radix_sort(unsigned long n, int *array) {
  unsigned long k = 1 << 8; unsigned long mask = (1 << 8) - 1;
  int *keys = (int*) calloc(n, sizeof(*array));
  unsigned long i; unsigned long offset;
  ((void) sizeof ((keys != ((void *)0)) ? 1 : 0), __extension__ ({ if (keys != ((void *)0)) ; else __assert_fail ("keys != NULL", "src/radix_sort.c", 38, __extension__ __PRETTY_FUNCTION__); }));
  for (offset = 0; offset < sizeof(*array); ++offset) {
    unsigned long num_bits = 8 * offset;
    for (i = 0; i < n; ++i)
      keys[i] = (array[i] >> num_bits) & mask;
    counting_sort(n, array, k, keys);
  }
  free(keys);
}

variable_types:
mask
unsigned long

variable_types:
keys
int *

variable_types:
offset
unsigned long


repo: yichizhng/bwt

decompiled_code:
void *__fastcall hh_wrapper(void *a1)
{
histhelper(
*(_QWORD *)a1,
*((_DWORD *)a1 + 2),
*((_QWORD *)a1 + 2),
*((_QWORD *)a1 + 3),
*((_DWORD *)a1 + 8),
*((_DWORD *)a1 + 9),
1);
return 0LL;
}

original_code:
void *hh_wrapper(void *arg) {
  struct hh_args *args = (struct hh_args*)arg;
  histhelper(args->base, args->len, args->arr, args->aux,
      args->start, args->end, 1);
  return ((void *)0);
}

variable_types:
arg
void *

variable_types: struct hh_args { char *base; int len; int *arr; int *aux; int start; int end; } *

return_type: void *


histzero

original_code:
void histzero(const char *base, int len, int *arr, int *aux, int start, int end) {
  int lens[4] = {0}, i;
  int ptrs[4];
  struct hh_args *args[4];
  pthread_t threads[4];
  void *status;
  for (i = start; i != end; ++i) {
    lens[getbase(base,arr[i])]++;
  }
  ptrs[0] = start;
  ptrs[1] = ptrs[0] + lens[0];
  ptrs[2] = ptrs[1] + lens[1];
  ptrs[3] = ptrs[2] + lens[2];
  aux[0] = arr[0];
  for (i = start; i != end; ++i) {
    aux[ptrs[getbase(base,arr[i])]] = arr[i];
    ++ptrs[getbase(base,arr[i])];
  }
  for (i = 0; i < 4; ++i) {
    args[i] = malloc(sizeof(struct hh_args));
    args[i]->base = base;
    args[i]->len = len;
    args[i]->arr = aux;
    args[i]->aux = arr;
  }
  args[0]->start = start;
  args[1]->start = start + lens[0];
  args[2]->start = start + lens[0] + lens[1];
  args[3]->start = end - lens[3];
  args[0]->end = args[1]->start;
  args[1]->end = args[2]->start;
  args[2]->end = args[3]->start;
  args[3]->end = end;
  for (i = 0; i < 4; ++i) {
    pthread_create(&threads[i], ((void *)0), hh_wrapper, (void *) args[i]);
  }
  for (i = 0; i < 4; ++i) {
    pthread_join(threads[i], &status);
    free(args[i]);
  }
}

canonical_original_code:
void histzero(char *base, int len, int *arr, int *aux, int start, int end) {
  int lens[4] = {0}; int i;
  int ptrs[4];
  struct hh_args *args[4];
  unsigned long threads[4];
  void *status;
  for (i = start; i != end; ++i) {
    lens[getbase(base,arr[i])]++;
  }
  ptrs[0] = start;
  ptrs[1] = ptrs[0] + lens[0];
  ptrs[2] = ptrs[1] + lens[1];
  ptrs[3] = ptrs[2] + lens[2];
  aux[0] = arr[0];
  for (i = start; i != end; ++i) {
    aux[ptrs[getbase(base,arr[i])]] = arr[i];
    ++ptrs[getbase(base,arr[i])];
  }
  for (i = 0; i < 4; ++i) {
    args[i] = malloc(sizeof(struct hh_args));
    args[i]->base = base;
    args[i]->len = len;
    args[i]->arr = aux;
    args[i]->aux = arr;
  }
  args[0]->start = start;
  args[1]->start = start + lens[0];
  args[2]->start = start + lens[0] + lens[1];
  args[3]->start = end - lens[3];
  args[0]->end = args[1]->start;
  args[1]->end = args[2]->start;
  args[2]->end = args[3]->start;
  args[3]->end = end;
  for (i = 0; i < 4; ++i) {
    pthread_create(&threads[i], ((void *)0), hh_wrapper, (void *) args[i]);
  }
  for (i = 0; i < 4; ++i) {
    pthread_join(threads[i], &status);
    free(args[i]);
  }
}

variable_types:
base
char *

variable_types: len int

variable_types:
arr
int *

variable_types:
aux
int *

variable_types: start int

variable_types: end int

variable_types:
lens
int [4]

variable_types: i int

variable_types:
ptrs
int [4]

variable_types: struct hh_args { char *base; int len; int *arr; int *aux; int start; int end; } *[4]

variable_types:
threads
unsigned long [4]

variable_types:
status
void *


sprintcbwt

original_code:
unsigned int sprintcbwt(const char *str, unsigned int *idxs, unsigned int len, char *out) {
  unsigned int i, d = 0xFFFFFFFF;
  char c = 0, u=3;
  for (i=0; i<=len; ++i) {
    if (idxs[i]) {
      c ^= getbase(str, idxs[i]-1)<<(2*u);
      if (u-- == 0) {
 out[i/4] = c;
 c = 0;
 u = 3;
      }
    }
    else {
      d = i;
      break;
    }
  }
  for (++i; i<=len; ++i) {
    c ^= getbase(str, idxs[i]-1)<<(2*u);
    if (u-- == 0) {
      out[(i-1)/4] = c;
      c = 0;
      u = 3;
    }
  }
  if (u != 3)
    out[((len+3)/4)-1] = c;
  return d;
}

canonical_original_code:
unsigned int sprintcbwt(char *str, unsigned int *idxs, unsigned int len, char *out) {
  unsigned int i; unsigned int d = 0xFFFFFFFF;
  char c = 0; char u = 3;
  for (i=0; i<=len; ++i) {
    if (idxs[i]) {
      c ^= getbase(str, idxs[i]-1)<<(2*u);
      if (u-- == 0) {
 out[i/4] = c;
 c = 0;
 u = 3;
      }
    }
    else {
      d = i;
      break;
    }
  }
  for (++i; i<=len; ++i) {
    c ^= getbase(str, idxs[i]-1)<<(2*u);
    if (u-- == 0) {
      out[(i-1)/4] = c;
      c = 0;
      u = 3;
    }
  }
  if (u != 3)
    out[((len+3)/4)-1] = c;
  return d;
}

variable_types:
str
char *

variable_types:
idxs
unsigned int *

variable_types:
len
unsigned int

variable_types:
out
char *

variable_types:
i
unsigned int

variable_types:
d
unsigned int

variable_types: c char

variable_types: u char

return_type: unsigned int


makecbwt

decompiled_code:
__int64 __fastcall makecbwt(__int64 a1, unsigned int a2, __int64 a3)
{
_DWORD *v4; // rbx
unsigned int v5; // ebp

v4 = histsort(a1, a2);
v5 = sprintcbwt(a1, (__int64)v4, a2, a3);
free(v4);
return v5;
}

canonical_decompiled_code:
__int64 __fastcall func5(__int64 a1, unsigned int a2, __int64 a3)
{
_DWORD *v4; // rbx
unsigned int v5; // ebp

v4 = histsort(a1, a2);
v5 = func4(a1, (__int64)v4, a2, a3);
free(v4);
return v5;
}

original_code:
int makecbwt(const char *str, int len, char *out) {
  int *idxs, i;
  idxs = histsort(str, len);
  i = sprintcbwt(str, idxs, len, out);
  free(idxs);
  return i;
}

canonical_original_code:
int makecbwt(char *str, int len, char *out) {
  int *idxs; int i;
  idxs = histsort(str, len);
  i = sprintcbwt(str, idxs, len, out);
  free(idxs);
  return i;
}

variable_types: len int

variable_types:
idxs
int *


decompiled_code:
__int64 __fastcall saca_makecbwt(__int64 a1, unsigned int a2, __int64 a3)
{
void *v4; // rbx
unsigned int v5; // ebp

v4 = (void *)csuff_arr();
v5 = sprintcbwt(a1, (__int64)v4, a2, a3);
free(v4);
return v5;
}

canonical_decompiled_code:
__int64 __fastcall func6(__int64 a1, unsigned int a2, __int64 a3)
{
void *v4; // rbx
unsigned int v5; // ebp

v4 = (void *)csuff_arr();
v5 = func4(a1, (__int64)v4, a2, a3);
free(v4);
return v5;
}

original_code:
int saca_makecbwt(const char *str, int len, char *out) {
  unsigned int *idxs, i;
  idxs = csuff_arr(str, len);
  i = sprintcbwt(str, idxs, len, out);
  free(idxs);
  return i;
}

canonical_original_code:
int saca_makecbwt(char *str, int len, char *out) {
  unsigned int *idxs; unsigned int i;
  idxs = csuff_arr(str, len);
  i = sprintcbwt(str, idxs, len, out);
  free(idxs);
  return i;
}


getbase

original_code:
static inline unsigned char getbase(const char *str, int idx) {
  return ((str[idx>>2])>>(2*(3-(idx&3)))) & 3;
}

canonical_original_code:
static inline unsigned char getbase(char *str, int idx) {
  return ((str[idx>>2])>>(2*(3-(idx&3)))) & 3;
}

variable_types: idx int

return_type: unsigned char


histhelper

original_code:
void histhelper(const char *base, int len, int *arr, int *aux, int start, int end, int depth) {
  int lens[4] = {0}, i;
  int ptrs[4];
  if ((end - start) == 1) {
    if (arr == saux)
      aux[start] = arr[start];
    return;
  }
  if (end == start)
    return;
  for (i = start; i != end; ++i) {
    if(arr[i] + depth != len) {
      lens[getbase(base,arr[i]+depth)]++;
    }
    else {
      aux[start] = arr[i];
      arr[i] = arr[start];
      arr[start] = aux[start];
      ++start;
    }
  }
  ptrs[0] = start;
  ptrs[1] = ptrs[0] + lens[0];
  ptrs[2] = ptrs[1] + lens[1];
  ptrs[3] = ptrs[2] + lens[2];
  for (i = start; i != end; ++i) {
    aux[ptrs[getbase(base,arr[i]+depth)]] = arr[i];
    ++ptrs[getbase(base,arr[i]+depth)];
  }
  histhelper(base, len, aux, arr,
      start, start + lens[0], depth+1);
  histhelper(base, len, aux, arr,
      start+lens[0], start+lens[0]+lens[1], depth+1);
  histhelper(base, len, aux, arr,
      start+lens[0]+lens[1], end - lens[3],depth+1);
  histhelper(base, len, aux, arr,
      end - lens[3], end, depth+1);
}

canonical_original_code:
void histhelper(char *base, int len, int *arr, int *aux, int start, int end, int depth) {
  int lens[4] = {0}; int i;
  int ptrs[4];
  if ((end - start) == 1) {
    if (arr == saux)
      aux[start] = arr[start];
    return;
  }
  if (end == start)
    return;
  for (i = start; i != end; ++i) {
    if(arr[i] + depth != len) {
      lens[getbase(base,arr[i]+depth)]++;
    }
    else {
      aux[start] = arr[i];
      arr[i] = arr[start];
      arr[start] = aux[start];
      ++start;
    }
  }
  ptrs[0] = start;
  ptrs[1] = ptrs[0] + lens[0];
  ptrs[2] = ptrs[1] + lens[1];
  ptrs[3] = ptrs[2] + lens[2];
  for (i = start; i != end; ++i) {
    aux[ptrs[getbase(base,arr[i]+depth)]] = arr[i];
    ++ptrs[getbase(base,arr[i]+depth)];
  }
  histhelper(base, len, aux, arr,
      start, start + lens[0], depth+1);
  histhelper(base, len, aux, arr,
      start+lens[0], start+lens[0]+lens[1], depth+1);
  histhelper(base, len, aux, arr,
      start+lens[0]+lens[1], end - lens[3],depth+1);
  histhelper(base, len, aux, arr,
      end - lens[3], end, depth+1);
}

variable_types:
base
char *

variable_types:
arr
int *

variable_types:
aux
int *

variable_types: start int

variable_types: end int

variable_types: depth int

variable_types:
lens
int [4]


putsg

decompiled_code:
int __fastcall putsg(__int64 a1, __int64 a2, int a3)
{
int v4; // ebp
unsigned __int8 v5; // al
__int64 v6; // rbp
unsigned __int8 v7; // al

printf("%3d: ", a2);
if ( (_DWORD)a2 != a3 )
{
v4 = a2;
do
{
v5 = getbase(a1, v4);
putchar(v5 + 48);
++v4;
}
while ( a3 != v4 );
}
putchar(36);
if ( (_DWORD)a2 )
{
v6 = 0LL;
do
{
v7 = getbase(a1, v6);
putchar(v7 + 48);
++v6;
}
while ( v6 != (unsigned int)a2 );
}
return putchar(10);
}

canonical_decompiled_code:
int __fastcall func7(__int64 a1, __int64 a2, int a3)
{
int v4; // ebp
unsigned __int8 v5; // al
__int64 v6; // rbp
unsigned __int8 v7; // al

printf("%3d: ", a2);
if ( (_DWORD)a2 != a3 )
{
v4 = a2;
do
{
v5 = func0(a1, v4);
putchar(v5 + 48);
++v4;
}
while ( a3 != v4 );
}
putchar(36);
if ( (_DWORD)a2 )
{
v6 = 0LL;
do
{
v7 = func0(a1, v6);
putchar(v7 + 48);
++v6;
}
while ( v6 != (unsigned int)a2 );
}
return putchar(10);
}

original_code:
void putsg(const char *str, int idx, int len) {
  int i;
  printf("%3d: ", idx);
  for (i = idx; i != len; ++i) {
    putchar('0'+getbase(str, i));
  }
  putchar('$');
  for (i = 0; i != idx; ++i) {
    putchar('0'+getbase(str, i));
  }
  putchar('\n');
}

canonical_original_code:
void putsg(char *str, int idx, int len) {
  int i;
  printf("%3d: ", idx);
  for (i = idx; i != len; ++i) {
    putchar('0'+getbase(str, i));
  }
  putchar('$');
  for (i = 0; i != idx; ++i) {
    putchar('0'+getbase(str, i));
  }
  putchar('\n');
}

variable_types:
str
char *

variable_types: i int


putbwt

decompiled_code:
int __fastcall putbwt(__int64 a1, __int64 a2, int a3)
{
__int64 v5; // rbx
int v6; // esi
unsigned __int8 v7; // al

if ( a3 >= 0 )
{
v5 = 0LL;
do
{
v6 = *(_DWORD *)(a2 + 4 * v5);
if ( v6 )
{
v7 = getbase(a1, v6 - 1);
putchar(v7 + 48);
}
else
{
putchar(36);
}
++v5;
}
while ( a3 >= (int)v5 );
}
return putchar(10);
}

canonical_decompiled_code:
int __fastcall func10(__int64 a1, __int64 a2, int a3)
{
__int64 v5; // rbx
int v6; // esi
unsigned __int8 v7; // al

if ( a3 >= 0 )
{
v5 = 0LL;
do
{
v6 = *(_DWORD *)(a2 + 4 * v5);
if ( v6 )
{
v7 = func0(a1, v6 - 1);
putchar(v7 + 48);
}
else
{
putchar(36);
}
++v5;
}
while ( a3 >= (int)v5 );
}
return putchar(10);
}

original_code:
void putbwt(const char *str, const int *bwt, int len) {
  int i;
  for (i = 0; i <= len; ++i)
    if(bwt[i])
      putchar('0' + getbase(str,bwt[i]-1));
    else
      putchar('$');
  putchar('\n');
}

canonical_original_code:
void putbwt(char *str, int *bwt, int len) {
  int i;
  for (i = 0; i <= len; ++i)
    if(bwt[i])
      putchar('0' + getbase(str,bwt[i]-1));
    else
      putchar('$');
  putchar('\n');
}

variable_types:
bwt
int *


worker

decompiled_code:
void *__fastcall worker(void *a1)
{
__int64 v1; // rbx
int v2; // eax
unsigned __int64 v3; // r12

LODWORD(v1) = *((_DWORD *)a1 + 6);
v2 = *((_DWORD *)a1 + 2);
if ( (int)v1 < (int)v1 + v2 )
{
v1 = (int)v1;
v3 = (int)v1 + (unsigned __int64)(unsigned int)(v2 - 1) + 1;
do
reverse_search(*(_QWORD *)a1, *((_QWORD *)a1 + 2) + v1++, 12LL);
while ( v1 != v3 );
}
return 0LL;
}

canonical_decompiled_code:
void *__fastcall func0(void *a1)
{
__int64 v1; // rbx
int v2; // eax
unsigned __int64 v3; // r12

LODWORD(v1) = *((_DWORD *)a1 + 6);
v2 = *((_DWORD *)a1 + 2);
if ( (int)v1 < (int)v1 + v2 )
{
v1 = (int)v1;
v3 = (int)v1 + (unsigned __int64)(unsigned int)(v2 - 1) + 1;
do
reverse_search(*(_QWORD *)a1, *((_QWORD *)a1 + 2) + v1++, 12LL);
while ( v1 != v3 );
}
return 0LL;
}

original_code:
void *worker(void *arg) {
  int i, j, max;
  max = (((struct thread_args*)arg)->start) +
    (((struct thread_args*)arg)->num);
  for (i = ((int) ((struct thread_args*)arg)->start); i < max; i ++) {
    reverse_search(((struct thread_args*)arg)->fmi,
     ((struct thread_args*)arg)->pats + i, 12);
  }
  return ((void *)0);
}

canonical_original_code:
void *worker(void *arg) {
  int i; int j; int max;
  max = (((struct thread_args *)arg)->start) +
    (((struct thread_args *)arg)->num);
  for (i = ((int) ((struct thread_args *)arg)->start); i < max; i ++) {
    reverse_search(((struct thread_args *)arg)->fmi,
     ((struct thread_args *)arg)->pats + i, 12);
  }
  return ((void *)0);
}

variable_types:
arg
void *

variable_types: j int

variable_types: max int

user_defined_types: struct thread_args { struct _fmi *fmi; int num; char *pats; int start; }

user_defined_types: struct _fmi { char *bwt; int *idxs; int **rank_index; unsigned char *lookup; int endloc; int C[5]; int len; }


startWorkers

decompiled_code:
void __fastcall startWorkers(__int64 a1, int a2, __int64 a3)
{
int v3; // er13
char *v4; // rax
char *v5; // rbp
int v6; // esi
int v7; // er13
_QWORD *v8; // rbx
_QWORD *v9; // r15
int v10; // er12
_DWORD *v11; // rax
__int64 i; // rbx
__int64 j; // rbx
void *thread_return[12]; // [rsp+18h] [rbp-60h] BYREF

v3 = a2;
v4 = (char *)malloc(0x20uLL);
v5 = v4;
v6 = a2 + 3;
if ( v3 < 0 )
v3 = v6;
v7 = v3 >> 2;
v8 = v4;
v9 = v4 + 32;
v10 = 0;
do
{
v11 = malloc(0x20uLL);
*v8 = v11;
*(_QWORD *)v11 = a1;
v11[2] = v7;
*((_QWORD *)v11 + 2) = a3;
v11[6] = v10;
++v8;
v10 += v7;
}
while ( v8 != v9 );
for ( i = 0LL; i != 4; ++i )
pthread_create((pthread_t *)&thread_return[i + 1], 0LL, worker, *(void **)&v5[i * 8]);
for ( j = 0LL; j != 4; ++j )
{
pthread_join((pthread_t)thread_return[j + 1], thread_return);
free(*(void **)&v5[j * 8]);
}
free(v5);
}

canonical_decompiled_code:
void __fastcall func2(__int64 a1, int a2, __int64 a3)
{
int v3; // er13
char *v4; // rax
char *v5; // rbp
int v6; // esi
int v7; // er13
_QWORD *v8; // rbx
_QWORD *v9; // r15
int v10; // er12
_DWORD *v11; // rax
__int64 i; // rbx
__int64 j; // rbx
void *thread_return[12]; // [rsp+18h] [rbp-60h] BYREF

v3 = a2;
v4 = (char *)malloc(0x20uLL);
v5 = v4;
v6 = a2 + 3;
if ( v3 < 0 )
v3 = v6;
v7 = v3 >> 2;
v8 = v4;
v9 = v4 + 32;
v10 = 0;
do
{
v11 = malloc(0x20uLL);
*v8 = v11;
*(_QWORD *)v11 = a1;
v11[2] = v7;
*((_QWORD *)v11 + 2) = a3;
v11[6] = v10;
++v8;
v10 += v7;
}
while ( v8 != v9 );
for ( i = 0LL; i != 4; ++i )
pthread_create((pthread_t *)&thread_return[i + 1], 0LL, worker, *(void **)&v5[i * 8]);
for ( j = 0LL; j != 4; ++j )
{
pthread_join((pthread_t)thread_return[j + 1], thread_return);
free(*(void **)&v5[j * 8]);
}
free(v5);
}

original_code:
void startWorkers(fm_index *fmi, int num, char *pats) {
  pthread_t threads[4];
  int i;
  void *status;
  struct thread_args **ta = malloc(4 * sizeof (struct thread_args*));
  for (i = 0; i < 4; ++i) {
    ta[i] = malloc(sizeof(struct thread_args));
    ta[i]->fmi = fmi;
    ta[i]->num = num/4;
    ta[i]->pats = pats;
    ta[i]->start = i * (num/4);
  }
  for (i = 0; i < 4; ++i) {
    pthread_create(&threads[i], ((void *)0), worker, (void *)ta[i]);
  }
  for (i = 0; i < 4; ++i) {
    pthread_join(threads[i], &status);
    free(ta[i]);
  }
  free(ta);
  return;
}

canonical_original_code:
void startWorkers(struct _fmi *fmi, int num, char *pats) {
  unsigned long threads[4];
  int i;
  void *status;
  struct thread_args **ta = malloc(4 * sizeof (struct thread_args*));
  for (i = 0; i < 4; ++i) {
    ta[i] = malloc(sizeof(struct thread_args));
    ta[i]->fmi = fmi;
    ta[i]->num = num/4;
    ta[i]->pats = pats;
    ta[i]->start = i * (num/4);
  }
  for (i = 0; i < 4; ++i) {
    pthread_create(&threads[i], ((void *)0), worker, (void *)ta[i]);
  }
  for (i = 0; i < 4; ++i) {
    pthread_join(threads[i], &status);
    free(ta[i]);
  }
  free(ta);
  return;
}

variable_types: num int

variable_types:
pats
char *

variable_types:
threads
unsigned long [4]

variable_types:
status
void *

variable_types: struct thread_args { struct _fmi { char *bwt; int *idxs; int **rank_index; unsigned char *lookup; int endloc; int C[5]; int len; } *fmi; int num; char *pats; int start; } **


decompiled_code:
void __fastcall rna_seq(__int64 a1, char *a2, int a3)
{
char *v4; // r14
char *v5; // rbx
char v6[4]; // [rsp+8h] [rbp-40h] BYREF
char v7[60]; // [rsp+Ch] [rbp-3Ch] BYREF

v4 = (char *)malloc(2 * a3);
memcpy(&v4[a3], a2, a3);
if ( a3 )
{
v5 = &a2[a3];
do
loc_search(a1, v5--, 14LL, v7, v6);
while ( v5 != &a2[a3 - 1 - (a3 - 1)] );
}
free(v4);
}

canonical_decompiled_code:
void __fastcall func1(__int64 a1, char *a2, int a3)
{
char *v4; // r14
char *v5; // rbx
char v6[4]; // [rsp+8h] [rbp-40h] BYREF
char v7[60]; // [rsp+Ch] [rbp-3Ch] BYREF

v4 = (char *)malloc(2 * a3);
memcpy(&v4[a3], a2, a3);
if ( a3 )
{
v5 = &a2[a3];
do
loc_search(a1, v5--, 14LL, v7, v6);
while ( v5 != &a2[a3 - 1 - (a3 - 1)] );
}
free(v4);
}

original_code:
void rna_seq(const fm_index *fmi, const char *pattern, int len) {
  char *pat = malloc(2*len);
  int i, j, start, end;
  memcpy(pat, pattern, len);
  memcpy(pat+len, pattern, len);
  for (i = len; i; --i) {
    loc_search(fmi, pattern+i, 14, &start, &end);
    if (start < end) {
    }
  }
  free(pat);
}

canonical_original_code:
void rna_seq(struct _fmi *fmi, char *pattern, int len) {
  char *pat = malloc(2*len);
  int i; int j; int start; int end;
  memcpy(pat, pattern, len);
  memcpy(pat+len, pattern, len);
  for (i = len; i; --i) {
    loc_search(fmi, pattern+i, 14, &start, &end);
    if (start < end) {
    }
  }
  free(pat);
}

variable_types: struct _fmi { char *bwt; int *idxs; int **rank_index; unsigned char *lookup; int endloc; int C[5]; int len; } *

variable_types:
pattern
char *

variable_types: len int

variable_types:
pat
char *


main

decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
int v3; // er13
int v4; // ebp
_BYTE *v5; // r12
__int64 v6; // rbx
int v7; // eax
unsigned __int64 v8; // rbx
__int64 v9; // r14
__int64 v10; // rax
double v11; // rbx
_BYTE *v12; // r13
_BYTE *v13; // rbx
unsigned __int64 v14; // rbx
__int64 v15; // rsi
double v16; // rbx

if ( argc != 2 )
{
fwrite("Usage: fmitest len\n", 1uLL, 0x13uLL, stderr);
exit(-1);
}
v3 = atoi(argv[1]);
v4 = v3 / 4;
v5 = malloc(v3 / 4 + 1);
if ( v3 >= -3 )
{
v6 = 0LL;
do
v5[v6++] = rand();
while ( v4 >= (int)v6 );
}
v7 = v3 % 4;
if ( v3 % 4 == 2 )
{
v5[v4] &= 0xF0u;
}
else if ( v7 > 2 )
{
v5[v4] &= 0xFCu;
}
else if ( (v3 & 3) != 0 )
{
if ( v7 == 1 )
v5[v4] &= 0xC0u;
}
else
{
v5[v4] = 0;
}
v8 = __rdtsc();
v9 = make_fmi(v5, (unsigned int)v3);
v10 = __rdtsc() - v8;
if ( v10 < 0 )
v11 = (double)(int)(v10 & 1 | ((unsigned __int64)v10 >> 1)) + (double)(int)(v10 & 1 | ((unsigned __int64)v10 >> 1));
else
v11 = (double)(int)v10;
printf("Built index with %d base pairs in %lld cycles (%f s)\n", (unsigned int)v3, v10, v11 / 2500000000.0);
printf("(%f cycles per base pair (%e seconds))\n", v11 / (double)v3, v11 / (2500000000.0 * (double)v3));
v12 = malloc(0x98968BuLL);
v13 = v12;
do
*v13++ = rand() & 3;
while ( v13 != v12 + 10000011 );
v14 = __rdtsc();
startWorkers(v9, 10000000, (__int64)v12);
v15 = __rdtsc() - v14;
if ( v15 < 0 )
v16 = (double)(int)(v15 & 1 | ((unsigned __int64)v15 >> 1)) + (double)(int)(v15 & 1 | ((unsigned __int64)v15 >> 1));
else
v16 = (double)(int)v15;
printf("Searched 10000000 12bp sequences in %lld cycles (%f s)\n", v15, v16 / 2500000000.0);
printf("(%f cycles per base pair (%e seconds))\n", v16 / 120000000.0, v16 / 3.0e17);
destroy_fmi(v9);
free(v5);
free(v12);
return 0;
}

canonical_decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
int v3; // er13
int v4; // ebp
_BYTE *v5; // r12
__int64 v6; // rbx
int v7; // eax
unsigned __int64 v8; // rbx
__int64 v9; // r14
__int64 v10; // rax
double v11; // rbx
_BYTE *v12; // r13
_BYTE *v13; // rbx
unsigned __int64 v14; // rbx
__int64 v15; // rsi
double v16; // rbx

if ( argc != 2 )
{
fwrite("Usage: fmitest len\n", 1uLL, 0x13uLL, stderr);
exit(-1);
}
v3 = atoi(argv[1]);
v4 = v3 / 4;
v5 = malloc(v3 / 4 + 1);
if ( v3 >= -3 )
{
v6 = 0LL;
do
v5[v6++] = rand();
while ( v4 >= (int)v6 );
}
v7 = v3 % 4;
if ( v3 % 4 == 2 )
{
v5[v4] &= 0xF0u;
}
else if ( v7 > 2 )
{
v5[v4] &= 0xFCu;
}
else if ( (v3 & 3) != 0 )
{
if ( v7 == 1 )
v5[v4] &= 0xC0u;
}
else
{
v5[v4] = 0;
}
v8 = __rdtsc();
v9 = make_fmi(v5, (unsigned int)v3);
v10 = __rdtsc() - v8;
if ( v10 < 0 )
v11 = (double)(int)(v10 & 1 | ((unsigned __int64)v10 >> 1)) + (double)(int)(v10 & 1 | ((unsigned __int64)v10 >> 1));
else
v11 = (double)(int)v10;
printf("Built index with %d base pairs in %lld cycles (%f s)\n", (unsigned int)v3, v10, v11 / 2500000000.0);
printf("(%f cycles per base pair (%e seconds))\n", v11 / (double)v3, v11 / (2500000000.0 * (double)v3));
v12 = malloc(0x98968BuLL);
v13 = v12;
do
*v13++ = rand() & 3;
while ( v13 != v12 + 10000011 );
v14 = __rdtsc();
func2(v9, 10000000, (__int64)v12);
v15 = __rdtsc() - v14;
if ( v15 < 0 )
v16 = (double)(int)(v15 & 1 | ((unsigned __int64)v15 >> 1)) + (double)(int)(v15 & 1 | ((unsigned __int64)v15 >> 1));
else
v16 = (double)(int)v15;
printf("Searched 10000000 12bp sequences in %lld cycles (%f s)\n", v15, v16 / 2500000000.0);
printf("(%f cycles per base pair (%e seconds))\n", v16 / 120000000.0, v16 / 3.0e17);
destroy_fmi(v9);
free(v5);
free(v12);
return 0;
}

original_code:
int main(int argc, char **argv) {
  int len, i, j, k;
  char *str, *pats;
  fm_index *fmi;
  unsigned long long a, b;
  if (argc != 2) {
    fprintf(stderr, "Usage: fmitest len\n");
    exit(-1);
  }
  len = atoi(argv[1]);
  str = malloc(len/4 + 1);
  for (i = 0; i < len/4 + 1; ++i)
    str[i] = rand();
  switch (len % 4) {
  case 1:
    str[len/4] &= 0xC0;
    break;
  case 2:
    str[len/4] &= 0xF0;
    break;
  case 3:
    str[len/4] &= 0xFC;
    break;
  case 0:
    str[len/4] = 0;
  }
  __asm__ __volatile__ ("rdtsc\n\tshl $32, %%rdx\n\tor %%rdx, %%rax" : "=A" (a) : : "rdx");;
  fmi = make_fmi(str, len);
  __asm__ __volatile__ ("rdtsc\n\tshl $32, %%rdx\n\tor %%rdx, %%rax" : "=A" (b) : : "rdx");;
  printf("Built index with %d base pairs in %lld cycles (%f s)\n",
  len, b-a, ((double)(b-a)) / 2500000000.);
  printf("(%f cycles per base pair (%e seconds))\n", ((double)(b-a)) / len, ((double)(b-a)) / (len * 2500000000.));
  pats = malloc(sizeof(char) * 10000011);
  for (i = 0; i < 10000011; ++i) {
    pats[i] = rand() & 3;
  }
  __asm__ __volatile__ ("rdtsc\n\tshl $32, %%rdx\n\tor %%rdx, %%rax" : "=A" (a) : : "rdx");;
  startWorkers(fmi, 10000000, pats);
  __asm__ __volatile__ ("rdtsc\n\tshl $32, %%rdx\n\tor %%rdx, %%rax" : "=A" (b) : : "rdx");;
  printf("Searched 10000000 12bp sequences in %lld cycles (%f s)\n",
  b-a, ((double)(b-a)) / 2500000000.);
  printf("(%f cycles per base pair (%e seconds))\n", ((double)(b-a)) / 120000000., ((double)(b-a)) / 300000000000000000.);
  destroy_fmi(fmi);
  free(str);
  free(pats);
}

canonical_original_code:
int main(int argc, char **argv) {
  int len; int i; int j; int k;
  char *str; char *pats;
  struct _fmi *fmi;
  unsigned long long a; unsigned long long b;
  if (argc != 2) {
    fprintf(stderr, "Usage: fmitest len\n");
    exit(-1);
  }
  len = atoi(argv[1]);
  str = malloc(len/4 + 1);
  for (i = 0; i < len/4 + 1; ++i)
    str[i] = rand();
  switch (len % 4) {
  case 1:
    str[len/4] &= 0xC0;
    break;
  case 2:
    str[len/4] &= 0xF0;
    break;
  case 3:
    str[len/4] &= 0xFC;
    break;
  case 0:
    str[len/4] = 0;
  }
  __asm__ __volatile__ ("rdtsc\n\tshl $32, %%rdx\n\tor %%rdx, %%rax" : "=A" (a) : : "rdx");;
  fmi = make_fmi(str, len);
  __asm__ __volatile__ ("rdtsc\n\tshl $32, %%rdx\n\tor %%rdx, %%rax" : "=A" (b) : : "rdx");;
  printf("Built index with %d base pairs in %lld cycles (%f s)\n",
  len, b-a, ((double)(b-a)) / 2500000000.);
  printf("(%f cycles per base pair (%e seconds))\n", ((double)(b-a)) / len, ((double)(b-a)) / (len * 2500000000.));
  pats = malloc(sizeof(char) * 10000011);
  for (i = 0; i < 10000011; ++i) {
    pats[i] = rand() & 3;
  }
  __asm__ __volatile__ ("rdtsc\n\tshl $32, %%rdx\n\tor %%rdx, %%rax" : "=A" (a) : : "rdx");;
  startWorkers(fmi, 10000000, pats);
  __asm__ __volatile__ ("rdtsc\n\tshl $32, %%rdx\n\tor %%rdx, %%rax" : "=A" (b) : : "rdx");;
  printf("Searched 10000000 12bp sequences in %lld cycles (%f s)\n",
  b-a, ((double)(b-a)) / 2500000000.);
  printf("(%f cycles per base pair (%e seconds))\n", ((double)(b-a)) / 120000000., ((double)(b-a)) / 300000000000000000.);
  destroy_fmi(fmi);
  free(str);
  free(pats);
}

variable_types: argc int

variable_types:
argv
char **

variable_types: k int

variable_types:
a
unsigned long long

variable_types:
b
unsigned long long


decompiled_code:
double __fastcall log_4(double x, int a2)
{
double result; // xmm0_8

HIDWORD(result) = 0;
*(float *)&result = (float)(2 * a2);
return result;
}

canonical_decompiled_code:
double __fastcall func1(double x, int a2)
{
double result; // xmm0_8

HIDWORD(result) = 0;
*(float *)&result = (float)(2 * a2);
return result;
}

original_code:
int log_4(int x) {
  union {
    int i;
    float f;
  } blah;
  blah.f = (float)(2*x);
  return ((blah.i >> 24) - 63);
}

variable_types: x int

variable_types:
blah
union { int i; float f; }


decompiled_code:
__int64 __fastcall mms_search(__int64 a1, __int64 a2, int a3, _DWORD *a4, int a5)
{
unsigned int v5; // ebp
signed int v6; // er12
int v7; // eax
__int64 v8; // rbx
int v9; // er15
int v10; // er15
__int64 result; // rax

v5 = *(_DWORD *)(a1 + 4LL * *(char *)(a2 + a3 - 1) + 36);
v6 = *(_DWORD *)(a1 + 4LL * (*(char *)(a2 + a3 - 1) + 1) + 36);
v7 = a3 - 2;
if ( a3 - 2 < 0 )
{
LABEL_8:
*a4 = a3;
return unc_sa(a1, v5);
}
if ( (int)v5 < v6 )
{
v8 = a3 - 3;
do
{
v9 = *(_DWORD *)(a1 + 4LL * *(char *)(a2 + v8 + 1) + 36);
v5 = v9 + rank(a1, (unsigned int)*(char *)(a2 + v8 + 1), v5);
v10 = *(_DWORD *)(a1 + 4LL * *(char *)(a2 + v8 + 1) + 36);
v6 = v10 + rank(a1, (unsigned int)*(char *)(a2 + v8 + 1), (unsigned int)v6);
v7 = v8;
if ( (int)v8 < 0 )
goto LABEL_8;
--v8;
}
while ( (int)v5 < v6 );
}
*a4 = a3 - v7 + 1;
if ( a3 - v7 <= a5 )
result = 0xFFFFFFFFLL;
else
result = (unsigned int)unc_sa(a1, v5) + 1;
return result;
}

canonical_decompiled_code:
__int64 __fastcall func2(__int64 a1, __int64 a2, int a3, _DWORD *a4, int a5)
{
unsigned int v5; // ebp
signed int v6; // er12
int v7; // eax
__int64 v8; // rbx
int v9; // er15
int v10; // er15
__int64 result; // rax

v5 = *(_DWORD *)(a1 + 4LL * *(char *)(a2 + a3 - 1) + 36);
v6 = *(_DWORD *)(a1 + 4LL * (*(char *)(a2 + a3 - 1) + 1) + 36);
v7 = a3 - 2;
if ( a3 - 2 < 0 )
{
LABEL_8:
*a4 = a3;
return unc_sa(a1, v5);
}
if ( (int)v5 < v6 )
{
v8 = a3 - 3;
do
{
v9 = *(_DWORD *)(a1 + 4LL * *(char *)(a2 + v8 + 1) + 36);
v5 = v9 + rank(a1, (unsigned int)*(char *)(a2 + v8 + 1), v5);
v10 = *(_DWORD *)(a1 + 4LL * *(char *)(a2 + v8 + 1) + 36);
v6 = v10 + rank(a1, (unsigned int)*(char *)(a2 + v8 + 1), (unsigned int)v6);
v7 = v8;
if ( (int)v8 < 0 )
goto LABEL_8;
--v8;
}
while ( (int)v5 < v6 );
}
*a4 = a3 - v7 + 1;
if ( a3 - v7 <= a5 )
result = 0xFFFFFFFFLL;
else
result = (unsigned int)unc_sa(a1, v5) + 1;
return result;
}

original_code:
int mms_search(const fm_index *fmi, const char *pattern, int len,
        int *len_p, int cutoff) {
  int start, end, i;
  start = fmi->C[pattern[len-1]];
  end = fmi->C[pattern[len-1]+1];
  for (i = len-2; i >= 0; --i) {
    if (end <= start) {
      *len_p = len - i + 1;
      if (len - i > cutoff) {
 return unc_sa(fmi, start) + 1;
      }
      return -1;
    }
    start = fmi->C[pattern[i]] + rank(fmi, pattern[i], start);
    end = fmi->C[pattern[i]] + rank(fmi, pattern[i], end);
  }
  *len_p = len;
  return unc_sa(fmi, start);
}

canonical_original_code:
int mms_search(struct _fmi *fmi, char *pattern, int len, int *len_p, int cutoff) {
  int start; int end; int i;
  start = fmi->C[pattern[len-1]];
  end = fmi->C[pattern[len-1]+1];
  for (i = len-2; i >= 0; --i) {
    if (end <= start) {
      *len_p = len - i + 1;
      if (len - i > cutoff) {
 return unc_sa(fmi, start) + 1;
      }
      return -1;
    }
    start = fmi->C[pattern[i]] + rank(fmi, pattern[i], start);
    end = fmi->C[pattern[i]] + rank(fmi, pattern[i], end);
  }
  *len_p = len;
  return unc_sa(fmi, start);
}

variable_types: cutoff int

variable_types: start int

variable_types: end int

variable_types: i int


original_code:
int mms_gap(const fm_index *fmi, const char *pattern, int len,
   int *len_p, int cutoff, int lastpos) {
  int start, end, i, j, pos;
  int score;
  start = fmi->C[pattern[len-1]];
  end = fmi->C[pattern[len-1]+1];
  for (i = len-2; i >= 0; --i) {
    if (end <= start) {
      *len_p = len - i + 1;
      if (len - i > cutoff) {
 for (j = start; j < end; ++j) {
   pos = unc_sa(fmi, j) + 1;
   if (lastpos - (pos + (len - i)) > 3) {
     return pos;
   }
 }
      }
      return -1;
    }
    start = fmi->C[pattern[i]] + rank(fmi, pattern[i], start);
    end = fmi->C[pattern[i]] + rank(fmi, pattern[i], end);
  }
  *len_p = len;
  return unc_sa(fmi, start);
}

canonical_original_code:
int mms_gap(struct _fmi *fmi, char *pattern, int len, int *len_p, int cutoff, int lastpos) {
  int start; int end; int i; int j; int pos;
  int score;
  start = fmi->C[pattern[len-1]];
  end = fmi->C[pattern[len-1]+1];
  for (i = len-2; i >= 0; --i) {
    if (end <= start) {
      *len_p = len - i + 1;
      if (len - i > cutoff) {
 for (j = start; j < end; ++j) {
   pos = unc_sa(fmi, j) + 1;
   if (lastpos - (pos + (len - i)) > 3) {
     return pos;
   }
 }
      }
      return -1;
    }
    start = fmi->C[pattern[i]] + rank(fmi, pattern[i], start);
    end = fmi->C[pattern[i]] + rank(fmi, pattern[i], end);
  }
  *len_p = len;
  return unc_sa(fmi, start);
}

variable_types: lastpos int

variable_types: j int

variable_types: pos int

variable_types: score int


getbase

original_code:
static inline unsigned char getbase(const char *str, int idx) {
 return ((str[idx>>2])>>(2*(3-(idx&3)))) & 3;
}

canonical_original_code:
static inline unsigned char getbase(char *str, int idx) {
 return ((str[idx>>2])>>(2*(3-(idx&3)))) & 3;
}

variable_types:
str
char *

variable_types: idx int