decompiled_code:
__int64 __fastcall Packet_DecodeInt(_QWORD *a1, __int64 a2, __int64 a3)
{
__int64 v4; // rdx
__int64 result; // rax

v4 = a1[1];
if ( v4 == 1 )
{
switch ( *a1 )
{
case 3LL:
NationalValues_DecodeInt(a1, a2, a3);
result = 1LL;
break;
case 5LL:
Linking_DecodeInt(a1, a2, a3);
result = 1LL;
break;
case 0xCLL:
Level1MovementAuthority_DecodeInt(a1, a2, a3);
result = 1LL;
break;
case 0xFLL:
Level23MovementAuthority_DecodeInt(a1, a2, a3);
result = 1LL;
break;
case 0x10LL:
RepositioningInformation_DecodeInt(a1, a2, a3);
result = 1LL;
break;
case 0x15LL:
GradientProfile_DecodeInt(a1, a2, a3);
result = 1LL;
break;
case 0x1BLL:
InternationalStaticSpeedProfile_DecodeInt(a1, a2, a3);
result = 1LL;
break;
case 0x27LL:
TrackConditionChangeOfTractionPower_DecodeInt(a1, a2, a3);
result = 1LL;
break;
case 0x29LL:
LevelTransitionOrder_DecodeInt(a1, a2, a3);
result = 1LL;
break;
case 0x2ALL:
SessionManagement_DecodeInt(a1, a2, a3);
result = 1LL;
break;
case 0x2CLL:
LABEL_12:
DataUsedByApplicationsOutsideTheERTMSETCSSystem_DecodeInt(a1, a2, a3);
result = 1LL;
break;
case 0x2DLL:
RadioNetworkRegistration_DecodeInt(a1, a2, a3);
result = 1LL;
break;
case 0x2ELL:
ConditionalLevelTransitionOrder_DecodeInt(a1, a2, a3);
result = 1LL;
break;
case 0x31LL:
ListOfBalisesForSHArea_DecodeInt(a1, a2, a3);
result = 1LL;
break;
case 0x33LL:
AxleLoadSpeedProfile_DecodeInt(a1, a2, a3);
result = 1LL;
break;
case 0x39LL:
MovementAuthorityRequestParameters_DecodeInt(a1, a2, a3);
result = 1LL;
break;
case 0x3ALL:
PositionReportParameters_DecodeInt(a1, a2, a3);
result = 1LL;
break;
case 0x3FLL:
ListOfBalisesInSRAuthority_DecodeInt(a1, a2, a3);
result = 1LL;
break;
case 0x41LL:
TemporarySpeedRestriction_DecodeInt(a1, a2, a3);
result = 1LL;
break;
case 0x42LL:
TemporarySpeedRestrictionRevocation_DecodeInt(a1, a2, a3);
result = 1LL;
break;
case 0x43LL:
TrackConditionBigMetalMasses_DecodeInt(a1, a2, a3);
result = 1LL;
break;
case 0x44LL:
TrackCondition_DecodeInt(a1, a2, a3);
result = 1LL;
break;
case 0x46LL:
RouteSuitabilityData_DecodeInt(a1, a2, a3);
result = 1LL;
break;
case 0x47LL:
AdhesionFactor_DecodeInt(a1, a2, a3);
result = 1LL;
break;
case 0x48LL:
PacketForSendingPlainTextMessages_DecodeInt(a1, a2, a3);
result = 1LL;
break;
case 0x4CLL:
PacketForSendingFixedTextMessages_DecodeInt(a1, a2, a3);
result = 1LL;
break;
case 0x4FLL:
GeographicalPositionInformation_DecodeInt(a1, a2, a3);
result = 1LL;
break;
case 0x50LL:
ModeProfile_DecodeInt(a1, a2, a3);
result = 1LL;
break;
case 0x5ALL:
TrackAheadFreeUpToLevel23TransitionLocation_DecodeInt(a1, a2, a3);
result = 1LL;
break;
case 0x83LL:
RBCTransitionOrder_DecodeInt(a1, a2, a3);
result = 1LL;
break;
case 0x84LL:
DangerForShuntingInformation_DecodeInt(a1, a2, a3);
result = 1LL;
break;
case 0x85LL:
RadioInfillAreaInformation_DecodeInt(a1, a2, a3);
result = 1LL;
break;
case 0x86LL:
EOLMPacket_DecodeInt(a1, a2, a3);
result = 1LL;
break;
case 0x88LL:
InfillLocationReference_DecodeInt(a1, a2, a3);
result = 1LL;
break;
case 0x89LL:
StopIfInStaffResponsible_DecodeInt(a1, a2, a3);
result = 1LL;
break;
case 0x8ALL:
ReversingAreaInformation_DecodeInt(a1, a2, a3);
result = 1LL;
break;
case 0x8BLL:
ReversingSupervisionInformation_DecodeInt(a1, a2, a3);
result = 1LL;
break;
case 0x8CLL:
TrainRunningNumberFromRBC_DecodeInt(a1, a2, a3);
result = 1LL;
break;
case 0x8DLL:
DefaultGradientForTemporarySpeedRestriction_DecodeInt(a1, a2, a3);
result = 1LL;
break;
case 0xFELL:
DefaultBaliseLoopOrRIUInformation_DecodeInt(a1, a2, a3);
result = 1LL;
break;
default:
LABEL_13:
fprintf(stderr, "Packet_DecodeInt: unexpected value for header->NID_PACKET = %lu\n", *a1);
result = 0LL;
break;
}
}
else if ( v4 == 2 )
{
if ( *a1 != 255LL )
_assert_fail("header->NID_PACKET == 255", "Packet_DecodeInt.c", 0x153u, "Packet_DecodeInt");
EndOfInformation_DecodeInt(a1, a2, a3);
result = 1LL;
}
else if ( v4 )
{
fprintf(stderr, "Packet_DecodeInt: unexpected value for header->list = %lu\n", v4);
result = 0LL;
}
else
{
switch ( *a1 )
{
case 0LL:
PositionReport_DecodeInt(a1, a2, a3);
result = 1LL;
break;
case 1LL:
PositionReportBasedOnTwoBaliseGroups_DecodeInt(a1, a2, a3);
result = 1LL;
break;
case 3LL:
OnboardTelephoneNumbers_DecodeInt(a1, a2, a3);
result = 1LL;
break;
case 4LL:
ErrorReporting_DecodeInt(a1, a2, a3);
result = 1LL;
break;
case 9LL:
Level23TransitionInformation_DecodeInt(a1, a2, a3);
result = 1LL;
break;
case 0xBLL:
ValidatedTrainData_DecodeInt(a1, a2, a3);
result = 1LL;
break;
case 0x2CLL:
goto LABEL_12;
default:
goto LABEL_13;
}
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func0(_QWORD *a1, __int64 a2, __int64 a3)
{
__int64 v4; // rdx
__int64 result; // rax

v4 = a1[1];
if ( v4 == 1 )
{
switch ( *a1 )
{
case 3LL:
NationalValues_DecodeInt(a1, a2, a3);
result = 1LL;
break;
case 5LL:
Linking_DecodeInt(a1, a2, a3);
result = 1LL;
break;
case 0xCLL:
Level1MovementAuthority_DecodeInt(a1, a2, a3);
result = 1LL;
break;
case 0xFLL:
Level23MovementAuthority_DecodeInt(a1, a2, a3);
result = 1LL;
break;
case 0x10LL:
RepositioningInformation_DecodeInt(a1, a2, a3);
result = 1LL;
break;
case 0x15LL:
GradientProfile_DecodeInt(a1, a2, a3);
result = 1LL;
break;
case 0x1BLL:
InternationalStaticSpeedProfile_DecodeInt(a1, a2, a3);
result = 1LL;
break;
case 0x27LL:
TrackConditionChangeOfTractionPower_DecodeInt(a1, a2, a3);
result = 1LL;
break;
case 0x29LL:
LevelTransitionOrder_DecodeInt(a1, a2, a3);
result = 1LL;
break;
case 0x2ALL:
SessionManagement_DecodeInt(a1, a2, a3);
result = 1LL;
break;
case 0x2CLL:
LABEL_12:
DataUsedByApplicationsOutsideTheERTMSETCSSystem_DecodeInt(a1, a2, a3);
result = 1LL;
break;
case 0x2DLL:
RadioNetworkRegistration_DecodeInt(a1, a2, a3);
result = 1LL;
break;
case 0x2ELL:
ConditionalLevelTransitionOrder_DecodeInt(a1, a2, a3);
result = 1LL;
break;
case 0x31LL:
ListOfBalisesForSHArea_DecodeInt(a1, a2, a3);
result = 1LL;
break;
case 0x33LL:
AxleLoadSpeedProfile_DecodeInt(a1, a2, a3);
result = 1LL;
break;
case 0x39LL:
MovementAuthorityRequestParameters_DecodeInt(a1, a2, a3);
result = 1LL;
break;
case 0x3ALL:
PositionReportParameters_DecodeInt(a1, a2, a3);
result = 1LL;
break;
case 0x3FLL:
ListOfBalisesInSRAuthority_DecodeInt(a1, a2, a3);
result = 1LL;
break;
case 0x41LL:
TemporarySpeedRestriction_DecodeInt(a1, a2, a3);
result = 1LL;
break;
case 0x42LL:
TemporarySpeedRestrictionRevocation_DecodeInt(a1, a2, a3);
result = 1LL;
break;
case 0x43LL:
TrackConditionBigMetalMasses_DecodeInt(a1, a2, a3);
result = 1LL;
break;
case 0x44LL:
TrackCondition_DecodeInt(a1, a2, a3);
result = 1LL;
break;
case 0x46LL:
RouteSuitabilityData_DecodeInt(a1, a2, a3);
result = 1LL;
break;
case 0x47LL:
AdhesionFactor_DecodeInt(a1, a2, a3);
result = 1LL;
break;
case 0x48LL:
PacketForSendingPlainTextMessages_DecodeInt(a1, a2, a3);
result = 1LL;
break;
case 0x4CLL:
PacketForSendingFixedTextMessages_DecodeInt(a1, a2, a3);
result = 1LL;
break;
case 0x4FLL:
GeographicalPositionInformation_DecodeInt(a1, a2, a3);
result = 1LL;
break;
case 0x50LL:
ModeProfile_DecodeInt(a1, a2, a3);
result = 1LL;
break;
case 0x5ALL:
TrackAheadFreeUpToLevel23TransitionLocation_DecodeInt(a1, a2, a3);
result = 1LL;
break;
case 0x83LL:
RBCTransitionOrder_DecodeInt(a1, a2, a3);
result = 1LL;
break;
case 0x84LL:
DangerForShuntingInformation_DecodeInt(a1, a2, a3);
result = 1LL;
break;
case 0x85LL:
RadioInfillAreaInformation_DecodeInt(a1, a2, a3);
result = 1LL;
break;
case 0x86LL:
EOLMPacket_DecodeInt(a1, a2, a3);
result = 1LL;
break;
case 0x88LL:
InfillLocationReference_DecodeInt(a1, a2, a3);
result = 1LL;
break;
case 0x89LL:
StopIfInStaffResponsible_DecodeInt(a1, a2, a3);
result = 1LL;
break;
case 0x8ALL:
ReversingAreaInformation_DecodeInt(a1, a2, a3);
result = 1LL;
break;
case 0x8BLL:
ReversingSupervisionInformation_DecodeInt(a1, a2, a3);
result = 1LL;
break;
case 0x8CLL:
TrainRunningNumberFromRBC_DecodeInt(a1, a2, a3);
result = 1LL;
break;
case 0x8DLL:
DefaultGradientForTemporarySpeedRestriction_DecodeInt(a1, a2, a3);
result = 1LL;
break;
case 0xFELL:
DefaultBaliseLoopOrRIUInformation_DecodeInt(a1, a2, a3);
result = 1LL;
break;
default:
LABEL_13:
fprintf(stderr, "Packet_DecodeInt: unexpected value for header->NID_PACKET = %lu\n", *a1);
result = 0LL;
break;
}
}
else if ( v4 == 2 )
{
if ( *a1 != 255LL )
_assert_fail("header->NID_PACKET == 255", "Packet_DecodeInt.c", 0x153u, "Packet_DecodeInt");
EndOfInformation_DecodeInt(a1, a2, a3);
result = 1LL;
}
else if ( v4 )
{
fprintf(stderr, "Packet_DecodeInt: unexpected value for header->list = %lu\n", v4);
result = 0LL;
}
else
{
switch ( *a1 )
{
case 0LL:
PositionReport_DecodeInt(a1, a2, a3);
result = 1LL;
break;
case 1LL:
PositionReportBasedOnTwoBaliseGroups_DecodeInt(a1, a2, a3);
result = 1LL;
break;
case 3LL:
OnboardTelephoneNumbers_DecodeInt(a1, a2, a3);
result = 1LL;
break;
case 4LL:
ErrorReporting_DecodeInt(a1, a2, a3);
result = 1LL;
break;
case 9LL:
Level23TransitionInformation_DecodeInt(a1, a2, a3);
result = 1LL;
break;
case 0xBLL:
ValidatedTrainData_DecodeInt(a1, a2, a3);
result = 1LL;
break;
case 0x2CLL:
goto LABEL_12;
default:
goto LABEL_13;
}
}
return result;
}

original_code:
int Packet_DecodeInt(PacketHeader* header, const Metadata* data, const kcg_int* stream)
{
    switch (header->list)
    {
        case 0 :
        {
            switch (header->NID_PACKET)
            {
                case 0 :
                {
                    PositionReport_DecodeInt((PositionReport*)(header), data, stream);
                    return 1;
                }
                case 1 :
                {
                    PositionReportBasedOnTwoBaliseGroups_DecodeInt((PositionReportBasedOnTwoBaliseGroups*)(header), data, stream);
                    return 1;
                }
                case 3 :
                {
                    OnboardTelephoneNumbers_DecodeInt((OnboardTelephoneNumbers*)(header), data, stream);
                    return 1;
                }
                case 4 :
                {
                    ErrorReporting_DecodeInt((ErrorReporting*)(header), data, stream);
                    return 1;
                }
                case 9 :
                {
                    Level23TransitionInformation_DecodeInt((Level23TransitionInformation*)(header), data, stream);
                    return 1;
                }
                case 11 :
                {
                    ValidatedTrainData_DecodeInt((ValidatedTrainData*)(header), data, stream);
                    return 1;
                }
                case 44 :
                {
                    DataUsedByApplicationsOutsideTheERTMSETCSSystem_DecodeInt((DataUsedByApplicationsOutsideTheERTMSETCSSystem*)(header), data, stream);
                    return 1;
                }
                default :
                {
                    fprintf(stderr, "Packet_DecodeInt: unexpected value for header->NID_PACKET = %lu\n", header->NID_PACKET);
                    return 0;
                }
            };
        }
        case 1 :
        {
            switch (header->NID_PACKET)
            {
                case 3 :
                {
                    NationalValues_DecodeInt((NationalValues*)(header), data, stream);
                    return 1;
                }
                case 5 :
                {
                    Linking_DecodeInt((Linking*)(header), data, stream);
                    return 1;
                }
                case 12 :
                {
                    Level1MovementAuthority_DecodeInt((Level1MovementAuthority*)(header), data, stream);
                    return 1;
                }
                case 15 :
                {
                    Level23MovementAuthority_DecodeInt((Level23MovementAuthority*)(header), data, stream);
                    return 1;
                }
                case 16 :
                {
                    RepositioningInformation_DecodeInt((RepositioningInformation*)(header), data, stream);
                    return 1;
                }
                case 21 :
                {
                    GradientProfile_DecodeInt((GradientProfile*)(header), data, stream);
                    return 1;
                }
                case 27 :
                {
                    InternationalStaticSpeedProfile_DecodeInt((InternationalStaticSpeedProfile*)(header), data, stream);
                    return 1;
                }
                case 39 :
                {
                    TrackConditionChangeOfTractionPower_DecodeInt((TrackConditionChangeOfTractionPower*)(header), data, stream);
                    return 1;
                }
                case 41 :
                {
                    LevelTransitionOrder_DecodeInt((LevelTransitionOrder*)(header), data, stream);
                    return 1;
                }
                case 42 :
                {
                    SessionManagement_DecodeInt((SessionManagement*)(header), data, stream);
                    return 1;
                }
                case 44 :
                {
                    DataUsedByApplicationsOutsideTheERTMSETCSSystem_DecodeInt((DataUsedByApplicationsOutsideTheERTMSETCSSystem*)(header), data, stream);
                    return 1;
                }
                case 45 :
                {
                    RadioNetworkRegistration_DecodeInt((RadioNetworkRegistration*)(header), data, stream);
                    return 1;
                }
                case 46 :
                {
                    ConditionalLevelTransitionOrder_DecodeInt((ConditionalLevelTransitionOrder*)(header), data, stream);
                    return 1;
                }
                case 49 :
                {
                    ListOfBalisesForSHArea_DecodeInt((ListOfBalisesForSHArea*)(header), data, stream);
                    return 1;
                }
                case 51 :
                {
                    AxleLoadSpeedProfile_DecodeInt((AxleLoadSpeedProfile*)(header), data, stream);
                    return 1;
                }
                case 57 :
                {
                    MovementAuthorityRequestParameters_DecodeInt((MovementAuthorityRequestParameters*)(header), data, stream);
                    return 1;
                }
                case 58 :
                {
                    PositionReportParameters_DecodeInt((PositionReportParameters*)(header), data, stream);
                    return 1;
                }
                case 63 :
                {
                    ListOfBalisesInSRAuthority_DecodeInt((ListOfBalisesInSRAuthority*)(header), data, stream);
                    return 1;
                }
                case 65 :
                {
                    TemporarySpeedRestriction_DecodeInt((TemporarySpeedRestriction*)(header), data, stream);
                    return 1;
                }
                case 66 :
                {
                    TemporarySpeedRestrictionRevocation_DecodeInt((TemporarySpeedRestrictionRevocation*)(header), data, stream);
                    return 1;
                }
                case 67 :
                {
                    TrackConditionBigMetalMasses_DecodeInt((TrackConditionBigMetalMasses*)(header), data, stream);
                    return 1;
                }
                case 68 :
                {
                    TrackCondition_DecodeInt((TrackCondition*)(header), data, stream);
                    return 1;
                }
                case 70 :
                {
                    RouteSuitabilityData_DecodeInt((RouteSuitabilityData*)(header), data, stream);
                    return 1;
                }
                case 71 :
                {
                    AdhesionFactor_DecodeInt((AdhesionFactor*)(header), data, stream);
                    return 1;
                }
                case 72 :
                {
                    PacketForSendingPlainTextMessages_DecodeInt((PacketForSendingPlainTextMessages*)(header), data, stream);
                    return 1;
                }
                case 76 :
                {
                    PacketForSendingFixedTextMessages_DecodeInt((PacketForSendingFixedTextMessages*)(header), data, stream);
                    return 1;
                }
                case 79 :
                {
                    GeographicalPositionInformation_DecodeInt((GeographicalPositionInformation*)(header), data, stream);
                    return 1;
                }
                case 80 :
                {
                    ModeProfile_DecodeInt((ModeProfile*)(header), data, stream);
                    return 1;
                }
                case 90 :
                {
                    TrackAheadFreeUpToLevel23TransitionLocation_DecodeInt((TrackAheadFreeUpToLevel23TransitionLocation*)(header), data, stream);
                    return 1;
                }
                case 131 :
                {
                    RBCTransitionOrder_DecodeInt((RBCTransitionOrder*)(header), data, stream);
                    return 1;
                }
                case 132 :
                {
                    DangerForShuntingInformation_DecodeInt((DangerForShuntingInformation*)(header), data, stream);
                    return 1;
                }
                case 133 :
                {
                    RadioInfillAreaInformation_DecodeInt((RadioInfillAreaInformation*)(header), data, stream);
                    return 1;
                }
                case 134 :
                {
                    EOLMPacket_DecodeInt((EOLMPacket*)(header), data, stream);
                    return 1;
                }
                case 136 :
                {
                    InfillLocationReference_DecodeInt((InfillLocationReference*)(header), data, stream);
                    return 1;
                }
                case 137 :
                {
                    StopIfInStaffResponsible_DecodeInt((StopIfInStaffResponsible*)(header), data, stream);
                    return 1;
                }
                case 138 :
                {
                    ReversingAreaInformation_DecodeInt((ReversingAreaInformation*)(header), data, stream);
                    return 1;
                }
                case 139 :
                {
                    ReversingSupervisionInformation_DecodeInt((ReversingSupervisionInformation*)(header), data, stream);
                    return 1;
                }
                case 140 :
                {
                    TrainRunningNumberFromRBC_DecodeInt((TrainRunningNumberFromRBC*)(header), data, stream);
                    return 1;
                }
                case 141 :
                {
                    DefaultGradientForTemporarySpeedRestriction_DecodeInt((DefaultGradientForTemporarySpeedRestriction*)(header), data, stream);
                    return 1;
                }
                case 254 :
                {
                    DefaultBaliseLoopOrRIUInformation_DecodeInt((DefaultBaliseLoopOrRIUInformation*)(header), data, stream);
                    return 1;
                }
                default :
                {
                    fprintf(stderr, "Packet_DecodeInt: unexpected value for header->NID_PACKET = %lu\n", header->NID_PACKET);
                    return 0;
                }
            };
        }
        case 2 :
        {
            ((header->NID_PACKET == 255) ? (void) (0) : __assert_fail ("header->NID_PACKET == 255", "Packet_DecodeInt.c", 339, __extension__ __PRETTY_FUNCTION__));
            EndOfInformation_DecodeInt((EndOfInformation*)header, data, stream);
            return 1;
        }
        default:
        {
            fprintf(stderr, "Packet_DecodeInt: unexpected value for header->list = %lu\n", header->list);
            return 0;
        }
    };
}

canonical_original_code:
int Packet_DecodeInt(struct PacketHeader *header, struct MetadataElement_T_Common_Types_Pkg *data, int *stream)
{
    switch (header->list)
    {
        case 0 :
        {
            switch (header->NID_PACKET)
            {
                case 0 :
                {
                    PositionReport_DecodeInt((struct PositionReport *)(header), data, stream);
                    return 1;
                }
                case 1 :
                {
                    PositionReportBasedOnTwoBaliseGroups_DecodeInt((struct PositionReportBasedOnTwoBaliseGroups *)(header), data, stream);
                    return 1;
                }
                case 3 :
                {
                    OnboardTelephoneNumbers_DecodeInt((struct OnboardTelephoneNumbers *)(header), data, stream);
                    return 1;
                }
                case 4 :
                {
                    ErrorReporting_DecodeInt((struct ErrorReporting *)(header), data, stream);
                    return 1;
                }
                case 9 :
                {
                    Level23TransitionInformation_DecodeInt((struct Level23TransitionInformation *)(header), data, stream);
                    return 1;
                }
                case 11 :
                {
                    ValidatedTrainData_DecodeInt((struct ValidatedTrainData *)(header), data, stream);
                    return 1;
                }
                case 44 :
                {
                    DataUsedByApplicationsOutsideTheERTMSETCSSystem_DecodeInt((struct DataUsedByApplicationsOutsideTheERTMSETCSSystem *)(header), data, stream);
                    return 1;
                }
                default :
                {
                    fprintf(stderr, "Packet_DecodeInt: unexpected value for header->NID_PACKET = %lu\n", header->NID_PACKET);
                    return 0;
                }
            };
        }
        case 1 :
        {
            switch (header->NID_PACKET)
            {
                case 3 :
                {
                    NationalValues_DecodeInt((struct NationalValues *)(header), data, stream);
                    return 1;
                }
                case 5 :
                {
                    Linking_DecodeInt((struct Linking *)(header), data, stream);
                    return 1;
                }
                case 12 :
                {
                    Level1MovementAuthority_DecodeInt((struct Level1MovementAuthority *)(header), data, stream);
                    return 1;
                }
                case 15 :
                {
                    Level23MovementAuthority_DecodeInt((struct Level23MovementAuthority *)(header), data, stream);
                    return 1;
                }
                case 16 :
                {
                    RepositioningInformation_DecodeInt((struct RepositioningInformation *)(header), data, stream);
                    return 1;
                }
                case 21 :
                {
                    GradientProfile_DecodeInt((struct GradientProfile *)(header), data, stream);
                    return 1;
                }
                case 27 :
                {
                    InternationalStaticSpeedProfile_DecodeInt((struct InternationalStaticSpeedProfile *)(header), data, stream);
                    return 1;
                }
                case 39 :
                {
                    TrackConditionChangeOfTractionPower_DecodeInt((struct TrackConditionChangeOfTractionPower *)(header), data, stream);
                    return 1;
                }
                case 41 :
                {
                    LevelTransitionOrder_DecodeInt((struct LevelTransitionOrder *)(header), data, stream);
                    return 1;
                }
                case 42 :
                {
                    SessionManagement_DecodeInt((struct SessionManagement *)(header), data, stream);
                    return 1;
                }
                case 44 :
                {
                    DataUsedByApplicationsOutsideTheERTMSETCSSystem_DecodeInt((struct DataUsedByApplicationsOutsideTheERTMSETCSSystem *)(header), data, stream);
                    return 1;
                }
                case 45 :
                {
                    RadioNetworkRegistration_DecodeInt((struct RadioNetworkRegistration *)(header), data, stream);
                    return 1;
                }
                case 46 :
                {
                    ConditionalLevelTransitionOrder_DecodeInt((struct ConditionalLevelTransitionOrder *)(header), data, stream);
                    return 1;
                }
                case 49 :
                {
                    ListOfBalisesForSHArea_DecodeInt((struct ListOfBalisesForSHArea *)(header), data, stream);
                    return 1;
                }
                case 51 :
                {
                    AxleLoadSpeedProfile_DecodeInt((struct AxleLoadSpeedProfile *)(header), data, stream);
                    return 1;
                }
                case 57 :
                {
                    MovementAuthorityRequestParameters_DecodeInt((struct MovementAuthorityRequestParameters *)(header), data, stream);
                    return 1;
                }
                case 58 :
                {
                    PositionReportParameters_DecodeInt((struct PositionReportParameters *)(header), data, stream);
                    return 1;
                }
                case 63 :
                {
                    ListOfBalisesInSRAuthority_DecodeInt((struct ListOfBalisesInSRAuthority *)(header), data, stream);
                    return 1;
                }
                case 65 :
                {
                    TemporarySpeedRestriction_DecodeInt((struct TemporarySpeedRestriction *)(header), data, stream);
                    return 1;
                }
                case 66 :
                {
                    TemporarySpeedRestrictionRevocation_DecodeInt((struct TemporarySpeedRestrictionRevocation *)(header), data, stream);
                    return 1;
                }
                case 67 :
                {
                    TrackConditionBigMetalMasses_DecodeInt((struct TrackConditionBigMetalMasses *)(header), data, stream);
                    return 1;
                }
                case 68 :
                {
                    TrackCondition_DecodeInt((struct TrackCondition *)(header), data, stream);
                    return 1;
                }
                case 70 :
                {
                    RouteSuitabilityData_DecodeInt((struct RouteSuitabilityData *)(header), data, stream);
                    return 1;
                }
                case 71 :
                {
                    AdhesionFactor_DecodeInt((struct AdhesionFactor *)(header), data, stream);
                    return 1;
                }
                case 72 :
                {
                    PacketForSendingPlainTextMessages_DecodeInt((struct PacketForSendingPlainTextMessages *)(header), data, stream);
                    return 1;
                }
                case 76 :
                {
                    PacketForSendingFixedTextMessages_DecodeInt((struct PacketForSendingFixedTextMessages *)(header), data, stream);
                    return 1;
                }
                case 79 :
                {
                    GeographicalPositionInformation_DecodeInt((struct GeographicalPositionInformation *)(header), data, stream);
                    return 1;
                }
                case 80 :
                {
                    ModeProfile_DecodeInt((struct ModeProfile *)(header), data, stream);
                    return 1;
                }
                case 90 :
                {
                    TrackAheadFreeUpToLevel23TransitionLocation_DecodeInt((struct TrackAheadFreeUpToLevel23TransitionLocation *)(header), data, stream);
                    return 1;
                }
                case 131 :
                {
                    RBCTransitionOrder_DecodeInt((struct RBCTransitionOrder *)(header), data, stream);
                    return 1;
                }
                case 132 :
                {
                    DangerForShuntingInformation_DecodeInt((struct DangerForShuntingInformation *)(header), data, stream);
                    return 1;
                }
                case 133 :
                {
                    RadioInfillAreaInformation_DecodeInt((struct RadioInfillAreaInformation *)(header), data, stream);
                    return 1;
                }
                case 134 :
                {
                    EOLMPacket_DecodeInt((struct EOLMPacket *)(header), data, stream);
                    return 1;
                }
                case 136 :
                {
                    InfillLocationReference_DecodeInt((struct InfillLocationReference *)(header), data, stream);
                    return 1;
                }
                case 137 :
                {
                    StopIfInStaffResponsible_DecodeInt((struct StopIfInStaffResponsible *)(header), data, stream);
                    return 1;
                }
                case 138 :
                {
                    ReversingAreaInformation_DecodeInt((struct ReversingAreaInformation *)(header), data, stream);
                    return 1;
                }
                case 139 :
                {
                    ReversingSupervisionInformation_DecodeInt((struct ReversingSupervisionInformation *)(header), data, stream);
                    return 1;
                }
                case 140 :
                {
                    TrainRunningNumberFromRBC_DecodeInt((struct TrainRunningNumberFromRBC *)(header), data, stream);
                    return 1;
                }
                case 141 :
                {
                    DefaultGradientForTemporarySpeedRestriction_DecodeInt((struct DefaultGradientForTemporarySpeedRestriction *)(header), data, stream);
                    return 1;
                }
                case 254 :
                {
                    DefaultBaliseLoopOrRIUInformation_DecodeInt((struct DefaultBaliseLoopOrRIUInformation *)(header), data, stream);
                    return 1;
                }
                default :
                {
                    fprintf(stderr, "Packet_DecodeInt: unexpected value for header->NID_PACKET = %lu\n", header->NID_PACKET);
                    return 0;
                }
            };
        }
        case 2 :
        {
            ((header->NID_PACKET == 255) ? (void) (0) : __assert_fail ("header->NID_PACKET == 255", "Packet_DecodeInt.c", 339, __extension__ __PRETTY_FUNCTION__));
            EndOfInformation_DecodeInt((struct EndOfInformation *)header, data, stream);
            return 1;
        }
        default:
        {
            fprintf(stderr, "Packet_DecodeInt: unexpected value for header->list = %lu\n", header->list);
            return 0;
        }
    };
}

user_defined_types: struct PositionReport { struct PacketHeader header; unsigned long L_PACKET; unsigned long Q_SCALE; unsigned long NID_LRBG; unsigned long D_LRBG; unsigned long Q_DIRLRBG; unsigned long Q_DLRBG; unsigned long L_DOUBTOVER; unsigned long L_DOUBTUNDER; unsigned long Q_LENGTH; unsigned long L_TRAININT; unsigned long V_TRAIN; unsigned long Q_DIRTRAIN; unsigned long M_MODE; unsigned long M_LEVEL; unsigned long NID_STM; }

user_defined_types: struct PositionReportBasedOnTwoBaliseGroups { struct PacketHeader header; unsigned long L_PACKET; unsigned long Q_SCALE; unsigned long NID_LRBG; unsigned long NID_PRVLRBG; unsigned long D_LRBG; unsigned long Q_DIRLRBG; unsigned long Q_DLRBG; unsigned long L_DOUBTOVER; unsigned long L_DOUBTUNDER; unsigned long Q_LENGTH; unsigned long L_TRAININT; unsigned long V_TRAIN; unsigned long Q_DIRTRAIN; unsigned long M_MODE; unsigned long M_LEVEL; unsigned long NID_STM; }

user_defined_types: struct OnboardTelephoneNumbers { struct PacketHeader header; unsigned long L_PACKET; unsigned long N_ITER_1; struct OnboardTelephoneNumbers_1 sub_1[31]; }

user_defined_types: struct ErrorReporting { struct PacketHeader header; unsigned long L_PACKET; unsigned long M_ERROR; }

user_defined_types: struct Level23TransitionInformation { struct PacketHeader header; unsigned long L_PACKET; unsigned long NID_LTRBG; }

user_defined_types: struct ValidatedTrainData { struct PacketHeader header; unsigned long L_PACKET; unsigned long NID_OPERATIONAL; unsigned long NC_TRAIN; unsigned long L_TRAIN; unsigned long V_MAXTRAIN; unsigned long M_LOADINGGAUGE; unsigned long M_AXLELOAD; unsigned long M_AIRTIGHT; unsigned long N_ITER_1; struct ValidatedTrainData_1 sub_1[31]; unsigned long N_ITER_2; struct ValidatedTrainData_2 sub_2[31]; }

user_defined_types: struct DataUsedByApplicationsOutsideTheERTMSETCSSystem { struct PacketHeader header; unsigned long L_PACKET; unsigned long NID_XUSER; unsigned long Other_data_depending_on__NID_XUSER; }

user_defined_types: struct NationalValues { struct PacketHeader header; unsigned long Q_DIR; unsigned long L_PACKET; unsigned long Q_SCALE; unsigned long D_VALIDNV; unsigned long N_ITER_1; struct NationalValues_1 sub_1[31]; unsigned long V_NVSHUNT; unsigned long V_NVSTFF; unsigned long V_NVONSIGHT; unsigned long V_NVUNFIT; unsigned long V_NVREL; unsigned long D_NVROLL; unsigned long Q_NVSRBKTRG; unsigned long Q_NVEMRRLS; unsigned long V_NVALLOWOVTRP; unsigned long V_NVSUPOVTRP; unsigned long D_NVOVTRP; unsigned long T_NVOVTRP; unsigned long D_NVPOTRP; unsigned long M_NVCONTACT; unsigned long T_NVCONTACT; unsigned long M_NVDERUN; unsigned long D_NVSTFF; unsigned long Q_NVDRIVER_ADHES; }

user_defined_types: struct Linking { struct PacketHeader header; unsigned long Q_DIR; unsigned long L_PACKET; unsigned long Q_SCALE; unsigned long D_LINK; unsigned long Q_NEWCOUNTRY; unsigned long NID_C; unsigned long NID_BG; unsigned long Q_LINKORIENTATION; unsigned long Q_LINKREACTION; unsigned long Q_LOCACC; unsigned long N_ITER_1; struct Linking_1 sub_1[31]; }

user_defined_types: struct Level1MovementAuthority { struct PacketHeader header; unsigned long Q_DIR; unsigned long L_PACKET; unsigned long Q_SCALE; unsigned long V_MAIN; unsigned long V_LOA; unsigned long T_LOA; unsigned long N_ITER_1; struct Level1MovementAuthority_1 sub_1[31]; unsigned long L_ENDSECTION; unsigned long Q_SECTIONTIMER; unsigned long T_SECTIONTIMER; unsigned long D_SECTIONTIMERSTOPLOC; unsigned long Q_ENDTIMER; unsigned long T_ENDTIMER; unsigned long D_ENDTIMERSTARTLOC; unsigned long Q_DANGERPOINT; unsigned long D_DP; unsigned long V_RELEASEDP; unsigned long Q_OVERLAP; unsigned long D_STARTOL; unsigned long T_OL; unsigned long D_OL; unsigned long V_RELEASEOL; }

user_defined_types: struct RepositioningInformation { struct PacketHeader header; unsigned long Q_DIR; unsigned long L_PACKET; unsigned long Q_SCALE; unsigned long L_SECTION; }

user_defined_types: struct GradientProfile { struct PacketHeader header; unsigned long Q_DIR; unsigned long L_PACKET; unsigned long Q_SCALE; unsigned long D_GRADIENT; unsigned long Q_GDIR; unsigned long G_A; unsigned long N_ITER_1; struct GradientProfile_1 sub_1[31]; }

user_defined_types: struct InternationalStaticSpeedProfile { struct PacketHeader header; unsigned long Q_DIR; unsigned long L_PACKET; unsigned long Q_SCALE; unsigned long D_STATIC; unsigned long V_STATIC; unsigned long Q_FRONT; unsigned long N_ITER_1; struct InternationalStaticSpeedProfile_1 sub_1[31]; unsigned long N_ITER_2; struct InternationalStaticSpeedProfile_2 sub_2[31]; }

user_defined_types: struct TrackConditionChangeOfTractionPower { struct PacketHeader header; unsigned long Q_DIR; unsigned long L_PACKET; unsigned long Q_SCALE; unsigned long D_TRACTION; unsigned long M_TRACTION; }

user_defined_types: struct LevelTransitionOrder { struct PacketHeader header; unsigned long Q_DIR; unsigned long L_PACKET; unsigned long Q_SCALE; unsigned long D_LEVELTR; unsigned long M_LEVELTR; unsigned long NID_STM; unsigned long L_ACKLEVELTR; unsigned long N_ITER_1; struct LevelTransitionOrder_1 sub_1[31]; }

user_defined_types: struct SessionManagement { struct PacketHeader header; unsigned long Q_DIR; unsigned long L_PACKET; unsigned long Q_RBC; unsigned long NID_C; unsigned long NID_RBC; unsigned long NID_RADIO; unsigned long Q_SLEEPSESSION; }

user_defined_types: struct RadioNetworkRegistration { struct PacketHeader header; unsigned long Q_DIR; unsigned long L_PACKET; unsigned long NID_MN; }

user_defined_types: struct ConditionalLevelTransitionOrder { struct PacketHeader header; unsigned long Q_DIR; unsigned long L_PACKET; unsigned long M_LEVELTR; unsigned long NID_STM; unsigned long N_ITER_1; struct ConditionalLevelTransitionOrder_1 sub_1[31]; }

user_defined_types: struct ListOfBalisesForSHArea { struct PacketHeader header; unsigned long Q_DIR; unsigned long L_PACKET; unsigned long N_ITER_1; struct ListOfBalisesForSHArea_1 sub_1[31]; }

user_defined_types: struct AxleLoadSpeedProfile { struct PacketHeader header; unsigned long Q_DIR; unsigned long L_PACKET; unsigned long Q_SCALE; unsigned long Q_TRACKINIT; unsigned long D_AXLELOAD; unsigned long L_AXLELOAD; unsigned long Q_FRONT; unsigned long N_ITER_1; struct AxleLoadSpeedProfile_1 sub_1[31]; unsigned long N_ITER_2; struct AxleLoadSpeedProfile_2 sub_2[31]; }

user_defined_types: struct MovementAuthorityRequestParameters { struct PacketHeader header; unsigned long Q_DIR; unsigned long L_PACKET; unsigned long T_MAR; unsigned long T_TIMEOUTRQST; unsigned long T_CYCRQST; }

user_defined_types: struct PositionReportParameters { struct PacketHeader header; unsigned long Q_DIR; unsigned long L_PACKET; unsigned long Q_SCALE; unsigned long T_CYCLOC; unsigned long D_CYCLOC; unsigned long M_LOC; unsigned long N_ITER_1; struct PositionReportParameters_1 sub_1[31]; }

user_defined_types: struct ListOfBalisesInSRAuthority { struct PacketHeader header; unsigned long Q_DIR; unsigned long L_PACKET; unsigned long N_ITER_1; struct ListOfBalisesInSRAuthority_1 sub_1[31]; }

user_defined_types: struct TemporarySpeedRestriction { struct PacketHeader header; unsigned long Q_DIR; unsigned long L_PACKET; unsigned long Q_SCALE; unsigned long NID_TSR; unsigned long D_TSR; unsigned long L_TSR; unsigned long Q_FRONT; unsigned long V_TSR; }

user_defined_types: struct TemporarySpeedRestrictionRevocation { struct PacketHeader header; unsigned long Q_DIR; unsigned long L_PACKET; unsigned long NID_TSR; }

user_defined_types: struct TrackConditionBigMetalMasses { struct PacketHeader header; unsigned long Q_DIR; unsigned long L_PACKET; unsigned long Q_SCALE; unsigned long D_TRACKCOND; unsigned long L_TRACKCOND; unsigned long N_ITER_1; struct TrackConditionBigMetalMasses_1 sub_1[31]; }

user_defined_types: struct TrackCondition { struct PacketHeader header; unsigned long Q_DIR; unsigned long L_PACKET; unsigned long Q_SCALE; unsigned long Q_TRACKINIT; unsigned long D_TRACKINIT; unsigned long D_TRACKCOND; unsigned long L_TRACKCOND; unsigned long M_TRACKCOND; unsigned long N_ITER_1; struct TrackCondition_1 sub_1[31]; }

user_defined_types: struct RouteSuitabilityData { struct PacketHeader header; unsigned long Q_DIR; unsigned long L_PACKET; unsigned long Q_SCALE; unsigned long Q_TRACKINIT; unsigned long D_TRACKINIT; unsigned long D_SUITABILITY; unsigned long Q_SUITABILITY; unsigned long M_LOADINGGAUGE; unsigned long M_AXLELOAD; unsigned long M_TRACTION; unsigned long N_ITER_1; struct RouteSuitabilityData_1 sub_1[31]; }

user_defined_types: struct AdhesionFactor { struct PacketHeader header; unsigned long Q_DIR; unsigned long L_PACKET; unsigned long Q_SCALE; unsigned long D_ADHESION; unsigned long L_ADHESION; unsigned long M_ADHESION; }

user_defined_types: struct PacketForSendingPlainTextMessages { struct PacketHeader header; unsigned long Q_DIR; unsigned long L_PACKET; unsigned long Q_SCALE; unsigned long Q_TEXTCLASS; unsigned long Q_TEXTDISPLAY; unsigned long D_TEXTDISPLAY; unsigned long M_MODETEXTDISPLAY_0; unsigned long M_LEVELTEXTDISPLAY_0; unsigned long NID_STM_0; unsigned long L_TEXTDISPLAY; unsigned long T_TEXTDISPLAY; unsigned long M_MODETEXTDISPLAY_1; unsigned long M_LEVELTEXTDISPLAY_1; unsigned long NID_STM_1; unsigned long Q_TEXTCONFIRM; unsigned long L_TEXT; unsigned long X_TEXT; }

user_defined_types: struct PacketForSendingFixedTextMessages { struct PacketHeader header; unsigned long Q_DIR; unsigned long L_PACKET; unsigned long Q_SCALE; unsigned long Q_TEXTCLASS; unsigned long Q_TEXTDISPLAY; unsigned long D_TEXTDISPLAY; unsigned long M_MODETEXTDISPLAY_0; unsigned long M_LEVELTEXTDISPLAY_0; unsigned long NID_STM_0; unsigned long L_TEXTDISPLAY; unsigned long T_TEXTDISPLAY; unsigned long M_MODETEXTDISPLAY_1; unsigned long M_LEVELTEXTDISPLAY_1; unsigned long NID_STM_1; unsigned long Q_TEXTCONFIRM; unsigned long Q_TEXT; }

user_defined_types: struct GeographicalPositionInformation { struct PacketHeader header; unsigned long Q_DIR; unsigned long L_PACKET; unsigned long Q_SCALE; unsigned long Q_NEWCOUNTRY; unsigned long NID_C; unsigned long NID_BG; unsigned long D_POSOFF; unsigned long Q_MPOSITION; unsigned long M_POSITION; unsigned long N_ITER_1; struct GeographicalPositionInformation_1 sub_1[31]; }

user_defined_types: struct ModeProfile { struct PacketHeader header; unsigned long Q_DIR; unsigned long L_PACKET; unsigned long Q_SCALE; unsigned long D_MAMODE; unsigned long M_MAMODE; unsigned long V_MAMODE; unsigned long L_MAMODE; unsigned long L_ACKMAMODE; unsigned long N_ITER_1; struct ModeProfile_1 sub_1[31]; }

user_defined_types: struct TrackAheadFreeUpToLevel23TransitionLocation { struct PacketHeader header; unsigned long Q_DIR; unsigned long L_PACKET; unsigned long Q_NEWCOUNTRY; unsigned long NID_C; unsigned long NID_BG; }

user_defined_types: struct RBCTransitionOrder { struct PacketHeader header; unsigned long Q_DIR; unsigned long L_PACKET; unsigned long Q_SCALE; unsigned long D_RBCTR; unsigned long NID_C; unsigned long NID_RBC; unsigned long NID_RADIO; unsigned long Q_SLEEPSESSION; }

user_defined_types: struct DangerForShuntingInformation { struct PacketHeader header; unsigned long Q_DIR; unsigned long L_PACKET; unsigned long Q_ASPECT; }

user_defined_types: struct RadioInfillAreaInformation { struct PacketHeader header; unsigned long Q_DIR; unsigned long L_PACKET; unsigned long Q_SCALE; unsigned long Q_RIU; unsigned long NID_C_0; unsigned long NID_RIU; unsigned long NID_RADIO; unsigned long D_INFILL; unsigned long NID_C_1; unsigned long NID_BG; }

user_defined_types: struct EOLMPacket { struct PacketHeader header; unsigned long Q_DIR; unsigned long L_PACKET; unsigned long Q_SCALE; unsigned long NID_LOOP; unsigned long D_LOOP; unsigned long L_LOOP; unsigned long Q_LOOPDIR; unsigned long Q_SSCODE; }

user_defined_types: struct StopIfInStaffResponsible { struct PacketHeader header; unsigned long Q_DIR; unsigned long L_PACKET; unsigned long Q_SRSTOP; }

user_defined_types: struct ReversingSupervisionInformation { struct PacketHeader header; unsigned long Q_DIR; unsigned long L_PACKET; unsigned long Q_SCALE; unsigned long D_REVERSE; unsigned long V_REVERSE; }

user_defined_types: struct TrainRunningNumberFromRBC { struct PacketHeader header; unsigned long Q_DIR; unsigned long L_PACKET; unsigned long NID_OPERATIONAL; }

user_defined_types: struct DefaultGradientForTemporarySpeedRestriction { struct PacketHeader header; unsigned long Q_DIR; unsigned long L_PACKET; unsigned long Q_GDIR; unsigned long G_TSR; }

user_defined_types: struct DefaultBaliseLoopOrRIUInformation { struct PacketHeader header; unsigned long Q_DIR; unsigned long L_PACKET; }

user_defined_types: struct EndOfInformation { struct PacketHeader header; }

user_defined_types: struct OnboardTelephoneNumbers_1 { unsigned long NID_RADIO; }

user_defined_types: struct ValidatedTrainData_1 { unsigned long M_TRACTION; }

user_defined_types: struct ValidatedTrainData_2 { unsigned long NID_STM; }

user_defined_types: struct NationalValues_1 { unsigned long NID_C; }

user_defined_types: struct Linking_1 { unsigned long D_LINK; unsigned long Q_NEWCOUNTRY; unsigned long NID_C; unsigned long NID_BG; unsigned long Q_LINKORIENTATION; unsigned long Q_LINKREACTION; unsigned long Q_LOCACC; }

user_defined_types: struct Level1MovementAuthority_1 { unsigned long L_SECTION; unsigned long Q_SECTIONTIMER; unsigned long T_SECTIONTIMER; unsigned long D_SECTIONTIMERSTOPLOC; }

user_defined_types: struct GradientProfile_1 { unsigned long D_GRADIENT; unsigned long Q_GDIR; unsigned long G_A; }

user_defined_types: struct InternationalStaticSpeedProfile_1 { unsigned long NC_DIFF; unsigned long V_DIFF; }

user_defined_types: struct InternationalStaticSpeedProfile_2 { unsigned long D_STATIC; unsigned long V_STATIC; unsigned long Q_FRONT; unsigned long N_ITER_2_1; struct InternationalStaticSpeedProfile_2_1 sub_2_1[31]; }

user_defined_types: struct LevelTransitionOrder_1 { unsigned long M_LEVELTR; unsigned long NID_STM; unsigned long L_ACKLEVELTR; }

user_defined_types: struct ConditionalLevelTransitionOrder_1 { unsigned long M_LEVELTR; unsigned long NID_STM; }

user_defined_types: struct ListOfBalisesForSHArea_1 { unsigned long Q_NEWCOUNTRY; unsigned long NID_C; unsigned long NID_BG; }

user_defined_types: struct AxleLoadSpeedProfile_1 { unsigned long M_AXLELOAD; unsigned long V_AXLELOAD; }

user_defined_types: struct AxleLoadSpeedProfile_2 { unsigned long D_AXLELOAD; unsigned long L_AXLELOAD; unsigned long Q_FRONT; unsigned long N_ITER_2_1; struct AxleLoadSpeedProfile_2_1 sub_2_1[31]; }

user_defined_types: struct PositionReportParameters_1 { unsigned long D_LOC; unsigned long Q_LGTLOC; }

user_defined_types: struct ListOfBalisesInSRAuthority_1 { unsigned long Q_NEWCOUNTRY; unsigned long NID_C; unsigned long NID_BG; }

user_defined_types: struct TrackConditionBigMetalMasses_1 { unsigned long D_TRACKCOND; unsigned long L_TRACKCOND; }

user_defined_types: struct TrackCondition_1 { unsigned long D_TRACKCOND; unsigned long L_TRACKCOND; unsigned long M_TRACKCOND; }

user_defined_types: struct GeographicalPositionInformation_1 { unsigned long Q_NEWCOUNTRY; unsigned long NID_C; unsigned long NID_BG; unsigned long D_POSOFF; unsigned long Q_MPOSITION; unsigned long M_POSITION; }

user_defined_types: struct ModeProfile_1 { unsigned long D_MAMODE; unsigned long M_MAMODE; unsigned long V_MAMODE; unsigned long L_MAMODE; unsigned long L_ACKMAMODE; }

user_defined_types: struct InternationalStaticSpeedProfile_2_1 { unsigned long NC_DIFF; unsigned long V_DIFF; }

user_defined_types: struct AxleLoadSpeedProfile_2_1 { unsigned long M_AXLELOAD; unsigned long V_AXLELOAD; }


repo: openETCS/dataDictionary

decompiled_code:
_BOOL8 __fastcall UpperBitsNotSet64(unsigned __int64 a1, int a2)
{
_BOOL8 result; // rax

result = 1LL;
if ( a2 != 64 )
result = 1LL << a2 > a1;
return result;
}

canonical_decompiled_code:
_BOOL8 __fastcall func0(unsigned __int64 a1, int a2)
{
_BOOL8 result; // rax

result = 1LL;
if ( a2 != 64 )
result = 1LL << a2 > a1;
return result;
}

original_code:
static inline int UpperBitsNotSet64(uint64_t value, uint32_t length)
{
    if (length == 64)
    {
        return 1;
    }
    else
    {
        const uint64_t MaxValue = ((uint64_t) 1) << length;
        return value < MaxValue;
    }
}

canonical_original_code:
static inline int UpperBitsNotSet64(unsigned long value, unsigned int length)
{
    if (length == 64)
    {
        return 1;
    }
    else
    {
        unsigned long MaxValue = ((uint64_t) 1) << length;
        return value < MaxValue;
    }
}

variable_types:
value
unsigned long

variable_types:
length
unsigned int

variable_types:
MaxValue
unsigned long

return_type: int


decompiled_code:
_BOOL8 __fastcall PositionReportParameters_UpperBitsNotSet(unsigned __int64 *a1)
{
_BOOL4 v1; // eax
unsigned int i; // ebx

v1 = UpperBitsNotSet64(a1[2], 2);
if ( v1 )
{
v1 = UpperBitsNotSet64(a1[3], 13);
if ( v1 )
{
v1 = UpperBitsNotSet64(a1[4], 2);
if ( v1 )
{
v1 = UpperBitsNotSet64(a1[5], 8);
if ( v1 )
{
v1 = UpperBitsNotSet64(a1[6], 15);
if ( v1 )
{
v1 = UpperBitsNotSet64(a1[7], 3);
if ( v1 )
v1 = UpperBitsNotSet64(a1[8], 5);
}
}
}
}
}
for ( i = 0; i < a1[8]; ++i )
{
if ( v1 )
v1 = PositionReportParameters_1_UpperBitsNotSet(&a1[2 * i + 9]) != 0;
}
return v1;
}

original_code:
int PositionReportParameters_UpperBitsNotSet(const PositionReportParameters* p)
{
    int status = 1;
    status = status && UpperBitsNotSet64(p->Q_DIR, 2) ;
    status = status && UpperBitsNotSet64(p->L_PACKET, 13);
    status = status && UpperBitsNotSet64(p->Q_SCALE, 2) ;
    status = status && UpperBitsNotSet64(p->T_CYCLOC, 8) ;
    status = status && UpperBitsNotSet64(p->D_CYCLOC, 15);
    status = status && UpperBitsNotSet64(p->M_LOC, 3) ;
    status = status && UpperBitsNotSet64(p->N_ITER_1, 5) ;
    for (uint32_t i = 0; i < p->N_ITER_1; ++i)
    {
        status = status && PositionReportParameters_1_UpperBitsNotSet(&(p->sub_1[i]));
    }
    if (status)
    {
        return 1;
    }
    else
    {
        return 0;
    }
}

canonical_original_code:
int PositionReportParameters_UpperBitsNotSet(struct PositionReportParameters *p)
{
    int status = 1;
    status = status && UpperBitsNotSet64(p->Q_DIR, 2) ;
    status = status && UpperBitsNotSet64(p->L_PACKET, 13);
    status = status && UpperBitsNotSet64(p->Q_SCALE, 2) ;
    status = status && UpperBitsNotSet64(p->T_CYCLOC, 8) ;
    status = status && UpperBitsNotSet64(p->D_CYCLOC, 15);
    status = status && UpperBitsNotSet64(p->M_LOC, 3) ;
    status = status && UpperBitsNotSet64(p->N_ITER_1, 5) ;
    for (unsigned int i = 0; i < p->N_ITER_1; ++i)
    {
        status = status && PositionReportParameters_1_UpperBitsNotSet(&(p->sub_1[i]));
    }
    if (status)
    {
        return 1;
    }
    else
    {
        return 0;
    }
}

variable_types: struct PositionReportParameters { struct PacketHeader { unsigned long NID_PACKET; unsigned long list; } header; unsigned long Q_DIR; unsigned long L_PACKET; unsigned long Q_SCALE; unsigned long T_CYCLOC; unsigned long D_CYCLOC; unsigned long M_LOC; unsigned long N_ITER_1; struct PositionReportParameters_1 { unsigned long D_LOC; unsigned long Q_LGTLOC; } sub_1[31]; } *

variable_types: status int

variable_types:
i
unsigned int

user_defined_types: struct PositionReportParameters { struct PacketHeader header; unsigned long Q_DIR; unsigned long L_PACKET; unsigned long Q_SCALE; unsigned long T_CYCLOC; unsigned long D_CYCLOC; unsigned long M_LOC; unsigned long N_ITER_1; struct PositionReportParameters_1 sub_1[31]; }


decompiled_code:
__int64 __fastcall PositionReportParameters_EncodeBit(unsigned __int64 *a1, __int64 a2)
{
unsigned int v2; // ebx

if ( !(unsigned int)Bitstream_Normal(a2, 48LL) )
return 0xFFFFFFFFLL;
if ( !PositionReportParameters_UpperBitsNotSet(a1) )
return 4294967294LL;
Bitstream_Write(a2, 2LL, a1[2]);
Bitstream_Write(a2, 13LL, a1[3]);
Bitstream_Write(a2, 2LL, a1[4]);
Bitstream_Write(a2, 8LL, a1[5]);
Bitstream_Write(a2, 15LL, a1[6]);
Bitstream_Write(a2, 3LL, a1[7]);
Bitstream_Write(a2, 5LL, a1[8]);
if ( !a1[8] )
return 1LL;
v2 = 0;
do
PositionReportParameters_1_EncodeBit(&a1[2 * v2++ + 9], a2);
while ( v2 < a1[8] );
return 1LL;
}

canonical_decompiled_code:
__int64 __fastcall func4(unsigned __int64 *a1, __int64 a2)
{
unsigned int v2; // ebx

if ( !(unsigned int)Bitstream_Normal(a2, 48LL) )
return 0xFFFFFFFFLL;
if ( !func3(a1) )
return 4294967294LL;
Bitstream_Write(a2, 2LL, a1[2]);
Bitstream_Write(a2, 13LL, a1[3]);
Bitstream_Write(a2, 2LL, a1[4]);
Bitstream_Write(a2, 8LL, a1[5]);
Bitstream_Write(a2, 15LL, a1[6]);
Bitstream_Write(a2, 3LL, a1[7]);
Bitstream_Write(a2, 5LL, a1[8]);
if ( !a1[8] )
return 1LL;
v2 = 0;
do
PositionReportParameters_1_EncodeBit(&a1[2 * v2++ + 9], a2);
while ( v2 < a1[8] );
return 1LL;
}

original_code:
int PositionReportParameters_EncodeBit(const PositionReportParameters* p, Bitstream* stream)
{
    if (Bitstream_Normal(stream, 48))
    {
        if (PositionReportParameters_UpperBitsNotSet(p))
        {
            Bitstream_Write(stream, 2, p->Q_DIR);
            Bitstream_Write(stream, 13, p->L_PACKET);
            Bitstream_Write(stream, 2, p->Q_SCALE);
            Bitstream_Write(stream, 8, p->T_CYCLOC);
            Bitstream_Write(stream, 15, p->D_CYCLOC);
            Bitstream_Write(stream, 3, p->M_LOC);
            Bitstream_Write(stream, 5, p->N_ITER_1);
            for (uint32_t i = 0; i < p->N_ITER_1; ++i)
            {
                PositionReportParameters_1_EncodeBit(&(p->sub_1[i]), stream);
            }
            return 1;
        }
        else
        {
            return -2;
        }
    }
    else
    {
        return -1;
    }
}

canonical_original_code:
int PositionReportParameters_EncodeBit(struct PositionReportParameters *p, struct Bitstream *stream)
{
    if (Bitstream_Normal(stream, 48))
    {
        if (PositionReportParameters_UpperBitsNotSet(p))
        {
            Bitstream_Write(stream, 2, p->Q_DIR);
            Bitstream_Write(stream, 13, p->L_PACKET);
            Bitstream_Write(stream, 2, p->Q_SCALE);
            Bitstream_Write(stream, 8, p->T_CYCLOC);
            Bitstream_Write(stream, 15, p->D_CYCLOC);
            Bitstream_Write(stream, 3, p->M_LOC);
            Bitstream_Write(stream, 5, p->N_ITER_1);
            for (unsigned int i = 0; i < p->N_ITER_1; ++i)
            {
                PositionReportParameters_1_EncodeBit(&(p->sub_1[i]), stream);
            }
            return 1;
        }
        else
        {
            return -2;
        }
    }
    else
    {
        return -1;
    }
}

variable_types: struct Bitstream { unsigned char *addr; unsigned int size; unsigned int bitpos; } *

user_defined_types: struct PacketHeader { unsigned long NID_PACKET; unsigned long list; }


decompiled_code:
__int64 __fastcall PositionReportParameters_DecodeBit(_QWORD *a1, __int64 a2)
{
__int64 result; // rax
__int64 v3; // rax
unsigned int v4; // ebx

result = Bitstream_Normal(a2, 48LL);
if ( (_DWORD)result )
{
a1[2] = Bitstream_Read(a2, 2LL);
a1[3] = Bitstream_Read(a2, 13LL);
a1[4] = Bitstream_Read(a2, 2LL);
a1[5] = Bitstream_Read(a2, 8LL);
a1[6] = Bitstream_Read(a2, 15LL);
a1[7] = Bitstream_Read(a2, 3LL);
v3 = Bitstream_Read(a2, 5LL);
a1[8] = v3;
if ( v3 )
{
v4 = 0;
do
PositionReportParameters_1_DecodeBit(&a1[2 * v4++ + 9], a2);
while ( (unsigned __int64)v4 < a1[8] );
result = 1LL;
}
else
{
result = 1LL;
}
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func5(_QWORD *a1, __int64 a2)
{
__int64 result; // rax
__int64 v3; // rax
unsigned int v4; // ebx

result = Bitstream_Normal(a2, 48LL);
if ( (_DWORD)result )
{
a1[2] = Bitstream_Read(a2, 2LL);
a1[3] = Bitstream_Read(a2, 13LL);
a1[4] = Bitstream_Read(a2, 2LL);
a1[5] = Bitstream_Read(a2, 8LL);
a1[6] = Bitstream_Read(a2, 15LL);
a1[7] = Bitstream_Read(a2, 3LL);
v3 = Bitstream_Read(a2, 5LL);
a1[8] = v3;
if ( v3 )
{
v4 = 0;
do
PositionReportParameters_1_DecodeBit(&a1[2 * v4++ + 9], a2);
while ( (unsigned __int64)v4 < a1[8] );
result = 1LL;
}
else
{
result = 1LL;
}
}
return result;
}

original_code:
int PositionReportParameters_DecodeBit(PositionReportParameters* p, Bitstream* stream)
{
    if (Bitstream_Normal(stream, 48))
    {
        {
            p->Q_DIR = Bitstream_Read(stream, 2);
        }
        {
            p->L_PACKET = Bitstream_Read(stream, 13);
        }
        {
            p->Q_SCALE = Bitstream_Read(stream, 2);
        }
        {
            p->T_CYCLOC = Bitstream_Read(stream, 8);
        }
        {
            p->D_CYCLOC = Bitstream_Read(stream, 15);
        }
        {
            p->M_LOC = Bitstream_Read(stream, 3);
        }
    {
            p->N_ITER_1 = Bitstream_Read(stream, 5);
        }
        for (uint32_t i = 0; i < p->N_ITER_1; ++i)
        {
            PositionReportParameters_1_DecodeBit(&(p->sub_1[i]), stream);
        }
        return 1;
    }
    else
    {
        return 0;
    }
}

canonical_original_code:
int PositionReportParameters_DecodeBit(struct PositionReportParameters *p, struct Bitstream *stream)
{
    if (Bitstream_Normal(stream, 48))
    {
        {
            p->Q_DIR = Bitstream_Read(stream, 2);
        }
        {
            p->L_PACKET = Bitstream_Read(stream, 13);
        }
        {
            p->Q_SCALE = Bitstream_Read(stream, 2);
        }
        {
            p->T_CYCLOC = Bitstream_Read(stream, 8);
        }
        {
            p->D_CYCLOC = Bitstream_Read(stream, 15);
        }
        {
            p->M_LOC = Bitstream_Read(stream, 3);
        }
    {
            p->N_ITER_1 = Bitstream_Read(stream, 5);
        }
        for (unsigned int i = 0; i < p->N_ITER_1; ++i)
        {
            PositionReportParameters_1_DecodeBit(&(p->sub_1[i]), stream);
        }
        return 1;
    }
    else
    {
        return 0;
    }
}

user_defined_types: struct Bitstream { unsigned char *addr; unsigned int size; unsigned int bitpos; }


original_code:
int PositionReportParameters_EncodeInt(const PositionReportParameters* p, Metadata* data, kcg_int* stream)
{
    data->nid_packet = 58;
    data->q_dir = p->Q_DIR;
    data->valid = 1;
    kcg_int startAddress = data->startAddress;
    stream[startAddress++] = p->header.NID_PACKET;
    stream[startAddress++] = p->Q_DIR;
    stream[startAddress++] = p->L_PACKET;
    stream[startAddress++] = p->Q_SCALE;
    stream[startAddress++] = p->T_CYCLOC;
    stream[startAddress++] = p->D_CYCLOC;
    stream[startAddress++] = p->M_LOC;
    stream[startAddress++] = p->N_ITER_1;
    for (uint32_t i = 0; i < p->N_ITER_1; ++i)
    {
        PositionReportParameters_1_EncodeInt(&(p->sub_1[i]), &startAddress, stream);
    }
    data->endAddress = startAddress-1;
    return 1;
}

canonical_original_code:
int PositionReportParameters_EncodeInt(struct PositionReportParameters *p, struct MetadataElement_T_Common_Types_Pkg *data, int *stream)
{
    data->nid_packet = 58;
    data->q_dir = p->Q_DIR;
    data->valid = 1;
    int startAddress = data->startAddress;
    stream[startAddress++] = p->header.NID_PACKET;
    stream[startAddress++] = p->Q_DIR;
    stream[startAddress++] = p->L_PACKET;
    stream[startAddress++] = p->Q_SCALE;
    stream[startAddress++] = p->T_CYCLOC;
    stream[startAddress++] = p->D_CYCLOC;
    stream[startAddress++] = p->M_LOC;
    stream[startAddress++] = p->N_ITER_1;
    for (unsigned int i = 0; i < p->N_ITER_1; ++i)
    {
        PositionReportParameters_1_EncodeInt(&(p->sub_1[i]), &startAddress, stream);
    }
    data->endAddress = startAddress-1;
    return 1;
}

variable_types: struct MetadataElement_T_Common_Types_Pkg { int nid_packet; int q_dir; unsigned char valid; int startAddress; int endAddress; } *

variable_types:
stream
int *

variable_types: startAddress int


original_code:
int PositionReportParameters_DecodeInt(PositionReportParameters* p, const Metadata* data, const kcg_int* stream)
{
    if(data->nid_packet != 58)
    {
         return 0;
    }
    kcg_int startAddress = data->startAddress;
    p->header.NID_PACKET = stream[startAddress++];
    p->Q_DIR = stream[startAddress++];
    p->L_PACKET = stream[startAddress++];
    p->Q_SCALE = stream[startAddress++];
    p->T_CYCLOC = stream[startAddress++];
    p->D_CYCLOC = stream[startAddress++];
    p->M_LOC = stream[startAddress++];
    p->N_ITER_1 = stream[startAddress++];
    for (uint32_t i = 0; i < p->N_ITER_1; ++i)
    {
        PositionReportParameters_1_DecodeInt(&(p->sub_1[i]), &startAddress, stream);
    }
    if(startAddress-1 != data->endAddress)
    {
         return 0;
    }
    return 1;
}

canonical_original_code:
int PositionReportParameters_DecodeInt(struct PositionReportParameters *p, struct MetadataElement_T_Common_Types_Pkg *data, int *stream)
{
    if(data->nid_packet != 58)
    {
         return 0;
    }
    int startAddress = data->startAddress;
    p->header.NID_PACKET = stream[startAddress++];
    p->Q_DIR = stream[startAddress++];
    p->L_PACKET = stream[startAddress++];
    p->Q_SCALE = stream[startAddress++];
    p->T_CYCLOC = stream[startAddress++];
    p->D_CYCLOC = stream[startAddress++];
    p->M_LOC = stream[startAddress++];
    p->N_ITER_1 = stream[startAddress++];
    for (unsigned int i = 0; i < p->N_ITER_1; ++i)
    {
        PositionReportParameters_1_DecodeInt(&(p->sub_1[i]), &startAddress, stream);
    }
    if(startAddress-1 != data->endAddress)
    {
         return 0;
    }
    return 1;
}

user_defined_types: struct MetadataElement_T_Common_Types_Pkg { int nid_packet; int q_dir; unsigned char valid; int startAddress; int endAddress; }


decompiled_code:
__int64 *PositionReportParameters_New()
{
__int64 *v0; // rbx

if ( PositionReportParametersMemoryFreeList == -1 )
{
if ( (unsigned __int64)PositionReportParametersMemoryTop > 7 )
return 0LL;
v0 = &PositionReportParametersMemory[71 * PositionReportParametersMemoryTop++];
}
else
{
v0 = &PositionReportParametersMemory[71 * PositionReportParametersMemoryFreeList];
PositionReportParametersMemoryFreeList = *v0;
}
PositionReportParameters_Init(v0);
return v0;
}

canonical_decompiled_code:
__int64 *func8()
{
__int64 *v0; // rbx

if ( PositionReportParametersMemoryFreeList == -1 )
{
if ( (unsigned __int64)PositionReportParametersMemoryTop > 7 )
return 0LL;
v0 = &PositionReportParametersMemory[71 * PositionReportParametersMemoryTop++];
}
else
{
v0 = &PositionReportParametersMemory[71 * PositionReportParametersMemoryFreeList];
PositionReportParametersMemoryFreeList = *v0;
}
func2(v0);
return v0;
}

original_code:
PositionReportParameters* PositionReportParameters_New(void)
{
    PositionReportParameters* ptr;
    if (PositionReportParametersMemoryFreeList != (-1))
    {
        ptr = &PositionReportParametersMemory[PositionReportParametersMemoryFreeList];
        PositionReportParametersMemoryFreeList = PositionReportParametersMemory[PositionReportParametersMemoryFreeList].header.NID_PACKET;
    }
    else if (PositionReportParametersMemoryTop < 8)
    {
        ptr = &PositionReportParametersMemory[PositionReportParametersMemoryTop];
        PositionReportParametersMemoryTop += 1;
    }
    else
    {
        return 0;
    }
    PositionReportParameters_Init(ptr);
    return ptr;
}

canonical_original_code:
struct PositionReportParameters *PositionReportParameters_New()
{
    struct PositionReportParameters *ptr;
    if (PositionReportParametersMemoryFreeList != (-1))
    {
        ptr = &PositionReportParametersMemory[PositionReportParametersMemoryFreeList];
        PositionReportParametersMemoryFreeList = PositionReportParametersMemory[PositionReportParametersMemoryFreeList].header.NID_PACKET;
    }
    else if (PositionReportParametersMemoryTop < 8)
    {
        ptr = &PositionReportParametersMemory[PositionReportParametersMemoryTop];
        PositionReportParametersMemoryTop += 1;
    }
    else
    {
        return 0;
    }
    PositionReportParameters_Init(ptr);
    return ptr;
}

return_type: struct PositionReportParameters { struct PacketHeader { unsigned long NID_PACKET; unsigned long list; } header; unsigned long Q_DIR; unsigned long L_PACKET; unsigned long Q_SCALE; unsigned long T_CYCLOC; unsigned long D_CYCLOC; unsigned long M_LOC; unsigned long N_ITER_1; struct PositionReportParameters_1 { unsigned long D_LOC; unsigned long Q_LGTLOC; } sub_1[31]; } *


decompiled_code:
__int64 __fastcall PositionReportParameters_Delete(_QWORD *a1)
{
__int64 result; // rax

*a1 = PositionReportParametersMemoryFreeList;
result = 0x193D4BB7E327A977LL;
PositionReportParametersMemoryFreeList = 0x193D4BB7E327A977LL * (a1 - PositionReportParametersMemory);
return result;
}

canonical_decompiled_code:
__int64 __fastcall func9(_QWORD *a1)
{
__int64 result; // rax

*a1 = PositionReportParametersMemoryFreeList;
result = 0x193D4BB7E327A977LL;
PositionReportParametersMemoryFreeList = 0x193D4BB7E327A977LL * (a1 - PositionReportParametersMemory);
return result;
}

original_code:
void PositionReportParameters_Delete(PositionReportParameters* ptr)
{
    ptr->header.NID_PACKET = PositionReportParametersMemoryFreeList;
    PositionReportParametersMemoryFreeList = ptr - PositionReportParametersMemory;
}

canonical_original_code:
void PositionReportParameters_Delete(struct PositionReportParameters *ptr)
{
    ptr->header.NID_PACKET = PositionReportParametersMemoryFreeList;
    PositionReportParametersMemoryFreeList = ptr - PositionReportParametersMemory;
}

return_type: void