decompiled_code:
_BOOL8 __fastcall InternationalStaticSpeedProfile_2_1_UpperBitsNotSet(unsigned __int64 *a1)
{
_BOOL8 result; // rax

result = UpperBitsNotSet64(*a1, 4);
if ( result )
result = UpperBitsNotSet64(a1[1], 7);
return result;
}

canonical_decompiled_code:
_BOOL8 __fastcall func1(unsigned __int64 *a1)
{
_BOOL8 result; // rax

result = func0(*a1, 4);
if ( result )
result = func0(a1[1], 7);
return result;
}

original_code:
int InternationalStaticSpeedProfile_2_1_UpperBitsNotSet(const InternationalStaticSpeedProfile_2_1* p)
{
    int status = 1;
    status = status && UpperBitsNotSet64(p->NC_DIFF, 4) ;
    status = status && UpperBitsNotSet64(p->V_DIFF, 7) ;
    if (status)
    {
        return 1;
    }
    else
    {
        return 0;
    }
}

canonical_original_code:
int InternationalStaticSpeedProfile_2_1_UpperBitsNotSet(struct InternationalStaticSpeedProfile_2_1 *p)
{
    int status = 1;
    status = status && UpperBitsNotSet64(p->NC_DIFF, 4) ;
    status = status && UpperBitsNotSet64(p->V_DIFF, 7) ;
    if (status)
    {
        return 1;
    }
    else
    {
        return 0;
    }
}

variable_types: struct InternationalStaticSpeedProfile_2_1 { unsigned long NC_DIFF; unsigned long V_DIFF; } *


repo: openETCS/dataDictionary

decompiled_code:
__int64 __fastcall InternationalStaticSpeedProfile_2_1_EncodeBit(unsigned __int64 *a1, __int64 a2)
{
if ( !(unsigned int)Bitstream_Normal(a2, 11LL) )
return 0xFFFFFFFFLL;
if ( !InternationalStaticSpeedProfile_2_1_UpperBitsNotSet(a1) )
return 4294967294LL;
Bitstream_Write(a2, 4LL, *a1);
Bitstream_Write(a2, 7LL, a1[1]);
return 1LL;
}

canonical_decompiled_code:
__int64 __fastcall func2(unsigned __int64 *a1, __int64 a2)
{
if ( !(unsigned int)Bitstream_Normal(a2, 11LL) )
return 0xFFFFFFFFLL;
if ( !func1(a1) )
return 4294967294LL;
Bitstream_Write(a2, 4LL, *a1);
Bitstream_Write(a2, 7LL, a1[1]);
return 1LL;
}

original_code:
int InternationalStaticSpeedProfile_2_1_EncodeBit(const InternationalStaticSpeedProfile_2_1* p, Bitstream* stream)
{
    if (Bitstream_Normal(stream, 11))
    {
        if (InternationalStaticSpeedProfile_2_1_UpperBitsNotSet(p))
        {
            Bitstream_Write(stream, 4, p->NC_DIFF);
            Bitstream_Write(stream, 7, p->V_DIFF);
            return 1;
        }
        else
        {
            return -2;
        }
    }
    else
    {
        return -1;
    }
}

canonical_original_code:
int InternationalStaticSpeedProfile_2_1_EncodeBit(struct InternationalStaticSpeedProfile_2_1 *p, struct Bitstream *stream)
{
    if (Bitstream_Normal(stream, 11))
    {
        if (InternationalStaticSpeedProfile_2_1_UpperBitsNotSet(p))
        {
            Bitstream_Write(stream, 4, p->NC_DIFF);
            Bitstream_Write(stream, 7, p->V_DIFF);
            return 1;
        }
        else
        {
            return -2;
        }
    }
    else
    {
        return -1;
    }
}

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

return_type: int

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


decompiled_code:
__int64 __fastcall InternationalStaticSpeedProfile_2_1_DecodeBit(_QWORD *a1, __int64 a2)
{
__int64 result; // rax

result = Bitstream_Normal(a2, 11LL);
if ( (_DWORD)result )
{
*a1 = Bitstream_Read(a2, 4LL);
a1[1] = Bitstream_Read(a2, 7LL);
result = 1LL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func3(_QWORD *a1, __int64 a2)
{
__int64 result; // rax

result = Bitstream_Normal(a2, 11LL);
if ( (_DWORD)result )
{
*a1 = Bitstream_Read(a2, 4LL);
a1[1] = Bitstream_Read(a2, 7LL);
result = 1LL;
}
return result;
}

original_code:
int InternationalStaticSpeedProfile_2_1_DecodeBit(InternationalStaticSpeedProfile_2_1* p, Bitstream* stream)
{
    if (Bitstream_Normal(stream, 11))
    {
        {
            p->NC_DIFF = Bitstream_Read(stream, 4);
        }
        {
            p->V_DIFF = Bitstream_Read(stream, 7);
        }
        return 1;
    }
    else
    {
        return 0;
    }
}

canonical_original_code:
int InternationalStaticSpeedProfile_2_1_DecodeBit(struct InternationalStaticSpeedProfile_2_1 *p, struct Bitstream *stream)
{
    if (Bitstream_Normal(stream, 11))
    {
        {
            p->NC_DIFF = Bitstream_Read(stream, 4);
        }
        {
            p->V_DIFF = Bitstream_Read(stream, 7);
        }
        return 1;
    }
    else
    {
        return 0;
    }
}

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


decompiled_code:
__int64 __fastcall InternationalStaticSpeedProfile_2_1_EncodeInt(__int64 *a1, _DWORD *a2, __int64 a3)
{
__int64 v3; // rcx
int v4; // eax
__int64 v5; // rcx
int v6; // eax

v3 = *a1;
v4 = (*a2)++;
*(_DWORD *)(a3 + 4LL * v4) = v3;
v5 = a1[1];
v6 = (*a2)++;
*(_DWORD *)(a3 + 4LL * v6) = v5;
return 1LL;
}

original_code:
int InternationalStaticSpeedProfile_2_1_EncodeInt(const InternationalStaticSpeedProfile_2_1* p, kcg_int* startAddress, kcg_int* stream)
{
    stream[(*startAddress)++] = p->NC_DIFF;
    stream[(*startAddress)++] = p->V_DIFF;
    return 1;
}

canonical_original_code:
int InternationalStaticSpeedProfile_2_1_EncodeInt(struct InternationalStaticSpeedProfile_2_1 *p, int *startAddress, int *stream)
{
    stream[(*startAddress)++] = p->NC_DIFF;
    stream[(*startAddress)++] = p->V_DIFF;
    return 1;
}

variable_types:
startAddress
int *

variable_types:
stream
int *


decompiled_code:
__int64 __fastcall InternationalStaticSpeedProfile_2_1_DecodeInt(_QWORD *a1, _DWORD *a2, __int64 a3)
{
int v3; // eax
int v4; // eax

v3 = (*a2)++;
*a1 = *(int *)(a3 + 4LL * v3);
v4 = (*a2)++;
a1[1] = *(int *)(a3 + 4LL * v4);
return 1LL;
}

original_code:
int InternationalStaticSpeedProfile_2_1_DecodeInt(InternationalStaticSpeedProfile_2_1* p, kcg_int* startAddress, const kcg_int* stream)
{
    p->NC_DIFF = stream[(*startAddress)++];
    p->V_DIFF = stream[(*startAddress)++];
    return 1;
}

canonical_original_code:
int InternationalStaticSpeedProfile_2_1_DecodeInt(struct InternationalStaticSpeedProfile_2_1 *p, int *startAddress, int *stream)
{
    p->NC_DIFF = stream[(*startAddress)++];
    p->V_DIFF = stream[(*startAddress)++];
    return 1;
}


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


decompiled_code:
__int64 __fastcall Validated_train_data_Encode_Bit(__int64 a1, unsigned __int64 *a2)
{
unsigned int v2; // ebp
unsigned int v3; // ebp

if ( !(unsigned int)Bitstream_Normal(a1, 88LL) )
return 0xFFFFFFFFLL;
if ( !(unsigned int)Validated_train_data_UpperBitsNotSet(a2) )
return 4294967294LL;
Bitstream_Write(a1, 13LL, *a2);
Bitstream_Write(a1, 4LL, a2[1]);
Bitstream_Write(a1, 15LL, a2[2]);
Bitstream_Write(a1, 12LL, a2[3]);
Bitstream_Write(a1, 7LL, a2[4]);
Bitstream_Write(a1, 8LL, a2[5]);
Bitstream_Write(a1, 7LL, a2[6]);
Bitstream_Write(a1, 2LL, a2[7]);
Bitstream_Write(a1, 10LL, a2[8]);
Bitstream_Write(a1, 5LL, a2[9]);
if ( a2[9] )
{
v2 = 0;
do
Validated_train_data_Core_1_Encode_Bit(a1, &a2[2 * v2++ + 10]);
while ( v2 < a2[9] );
}
Bitstream_Write(a1, 5LL, a2[72]);
if ( !a2[72] )
return 1LL;
v3 = 0;
do
Validated_train_data_Core_2_Encode_Bit(a1, &a2[v3++ + 73]);
while ( v3 < a2[72] );
return 1LL;
}

canonical_decompiled_code:
__int64 __fastcall func3(__int64 a1, unsigned __int64 *a2)
{
unsigned int v2; // ebp
unsigned int v3; // ebp

if ( !(unsigned int)Bitstream_Normal(a1, 88LL) )
return 0xFFFFFFFFLL;
if ( !(unsigned int)func2(a2) )
return 4294967294LL;
Bitstream_Write(a1, 13LL, *a2);
Bitstream_Write(a1, 4LL, a2[1]);
Bitstream_Write(a1, 15LL, a2[2]);
Bitstream_Write(a1, 12LL, a2[3]);
Bitstream_Write(a1, 7LL, a2[4]);
Bitstream_Write(a1, 8LL, a2[5]);
Bitstream_Write(a1, 7LL, a2[6]);
Bitstream_Write(a1, 2LL, a2[7]);
Bitstream_Write(a1, 10LL, a2[8]);
Bitstream_Write(a1, 5LL, a2[9]);
if ( a2[9] )
{
v2 = 0;
do
Validated_train_data_Core_1_Encode_Bit(a1, &a2[2 * v2++ + 10]);
while ( v2 < a2[9] );
}
Bitstream_Write(a1, 5LL, a2[72]);
if ( !a2[72] )
return 1LL;
v3 = 0;
do
Validated_train_data_Core_2_Encode_Bit(a1, &a2[v3++ + 73]);
while ( v3 < a2[72] );
return 1LL;
}

original_code:
int Validated_train_data_Encode_Bit(Bitstream* stream, const Validated_train_data_Core* p)
{
    if (Bitstream_Normal(stream, 106))
    {
        if (Validated_train_data_UpperBitsNotSet(p))
        {
            Bitstream_Write(stream, 13, p->L_PACKET);
            Bitstream_Write(stream, 32, p->NID_OPERATIONAL);
            Bitstream_Write(stream, 15, p->NC_TRAIN);
            Bitstream_Write(stream, 12, p->L_TRAIN);
            Bitstream_Write(stream, 7, p->V_MAXTRAIN);
            Bitstream_Write(stream, 8, p->M_LOADINGGAUGE);
            Bitstream_Write(stream, 7, p->M_AXLELOAD);
            Bitstream_Write(stream, 2, p->M_AIRTIGHT);
            Bitstream_Write(stream, 5, p->N_ITER_1);
            for (uint32_t i = 0; i < p->N_ITER_1; ++i)
            {
                Validated_train_data_Core_1_Encode_Bit(stream, &(p->sub_1[i]));
            }
            Bitstream_Write(stream, 5, p->N_ITER_2);
            for (uint32_t i = 0; i < p->N_ITER_2; ++i)
            {
                Validated_train_data_Core_2_Encode_Bit(stream, &(p->sub_2[i]));
            }
            return 1;
        }
        else
        {
            return -2;
        }
    }
    else
    {
        return -1;
    }
}

canonical_original_code:
int Validated_train_data_Encode_Bit(struct Bitstream *stream, struct Validated_train_data_Core *p)
{
    if (Bitstream_Normal(stream, 106))
    {
        if (Validated_train_data_UpperBitsNotSet(p))
        {
            Bitstream_Write(stream, 13, p->L_PACKET);
            Bitstream_Write(stream, 32, p->NID_OPERATIONAL);
            Bitstream_Write(stream, 15, p->NC_TRAIN);
            Bitstream_Write(stream, 12, p->L_TRAIN);
            Bitstream_Write(stream, 7, p->V_MAXTRAIN);
            Bitstream_Write(stream, 8, p->M_LOADINGGAUGE);
            Bitstream_Write(stream, 7, p->M_AXLELOAD);
            Bitstream_Write(stream, 2, p->M_AIRTIGHT);
            Bitstream_Write(stream, 5, p->N_ITER_1);
            for (unsigned int i = 0; i < p->N_ITER_1; ++i)
            {
                Validated_train_data_Core_1_Encode_Bit(stream, &(p->sub_1[i]));
            }
            Bitstream_Write(stream, 5, p->N_ITER_2);
            for (unsigned int i = 0; i < p->N_ITER_2; ++i)
            {
                Validated_train_data_Core_2_Encode_Bit(stream, &(p->sub_2[i]));
            }
            return 1;
        }
        else
        {
            return -2;
        }
    }
    else
    {
        return -1;
    }
}

variable_types: struct Validated_train_data_Core { 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 Validated_train_data_Core_1 { unsigned long M_TRACTION; } sub_1[31]; unsigned long N_ITER_2; struct Validated_train_data_Core_2 { unsigned long NID_STM; } sub_2[31]; } *

variable_types:
i
unsigned int

user_defined_types: struct Validated_train_data_Core { 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 Validated_train_data_Core_1 sub_1[31]; unsigned long N_ITER_2; struct Validated_train_data_Core_2 sub_2[31]; }


decompiled_code:
__int64 __fastcall Validated_train_data_Decode_Bit(__int64 a1, _QWORD *a2)
{
__int64 result; // rax
__int64 v3; // rax
unsigned int v4; // er12
__int64 v5; // rax
unsigned int v6; // er12

result = Bitstream_Normal(a1, 88LL);
if ( (_DWORD)result )
{
*a2 = Bitstream_Read(a1, 13LL);
a2[1] = Bitstream_Read(a1, 4LL);
a2[2] = Bitstream_Read(a1, 15LL);
a2[3] = Bitstream_Read(a1, 12LL);
a2[4] = Bitstream_Read(a1, 7LL);
a2[5] = Bitstream_Read(a1, 8LL);
a2[6] = Bitstream_Read(a1, 7LL);
a2[7] = Bitstream_Read(a1, 2LL);
a2[8] = Bitstream_Read(a1, 10LL);
v3 = Bitstream_Read(a1, 5LL);
a2[9] = v3;
if ( v3 )
{
v4 = 0;
do
Validated_train_data_Core_1_Decode_Bit(a1, &a2[2 * v4++ + 10]);
while ( (unsigned __int64)v4 < a2[9] );
}
v5 = Bitstream_Read(a1, 5LL);
a2[72] = v5;
if ( v5 )
{
v6 = 0;
do
Validated_train_data_Core_2_Decode_Bit(a1, &a2[v6++ + 73]);
while ( (unsigned __int64)v6 < a2[72] );
result = 1LL;
}
else
{
result = 1LL;
}
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func4(__int64 a1, _QWORD *a2)
{
__int64 result; // rax
__int64 v3; // rax
unsigned int v4; // er12
__int64 v5; // rax
unsigned int v6; // er12

result = Bitstream_Normal(a1, 88LL);
if ( (_DWORD)result )
{
*a2 = Bitstream_Read(a1, 13LL);
a2[1] = Bitstream_Read(a1, 4LL);
a2[2] = Bitstream_Read(a1, 15LL);
a2[3] = Bitstream_Read(a1, 12LL);
a2[4] = Bitstream_Read(a1, 7LL);
a2[5] = Bitstream_Read(a1, 8LL);
a2[6] = Bitstream_Read(a1, 7LL);
a2[7] = Bitstream_Read(a1, 2LL);
a2[8] = Bitstream_Read(a1, 10LL);
v3 = Bitstream_Read(a1, 5LL);
a2[9] = v3;
if ( v3 )
{
v4 = 0;
do
Validated_train_data_Core_1_Decode_Bit(a1, &a2[2 * v4++ + 10]);
while ( (unsigned __int64)v4 < a2[9] );
}
v5 = Bitstream_Read(a1, 5LL);
a2[72] = v5;
if ( v5 )
{
v6 = 0;
do
Validated_train_data_Core_2_Decode_Bit(a1, &a2[v6++ + 73]);
while ( (unsigned __int64)v6 < a2[72] );
result = 1LL;
}
else
{
result = 1LL;
}
}
return result;
}

original_code:
int Validated_train_data_Decode_Bit(Bitstream* stream, Validated_train_data_Core* p)
{
    if (Bitstream_Normal(stream, 106))
    {
        {
            p->L_PACKET = Bitstream_Read(stream, 13);
        }
        {
            p->NID_OPERATIONAL = Bitstream_Read(stream, 32);
        }
        {
            p->NC_TRAIN = Bitstream_Read(stream, 15);
        }
        {
            p->L_TRAIN = Bitstream_Read(stream, 12);
        }
        {
            p->V_MAXTRAIN = Bitstream_Read(stream, 7);
        }
        {
            p->M_LOADINGGAUGE = Bitstream_Read(stream, 8);
        }
        {
            p->M_AXLELOAD = Bitstream_Read(stream, 7);
        }
        {
            p->M_AIRTIGHT = Bitstream_Read(stream, 2);
        }
    {
            p->N_ITER_1 = Bitstream_Read(stream, 5);
        }
        for (uint32_t i = 0; i < p->N_ITER_1; ++i)
        {
            Validated_train_data_Core_1_Decode_Bit(stream, &(p->sub_1[i]));
        }
    {
            p->N_ITER_2 = Bitstream_Read(stream, 5);
        }
        for (uint32_t i = 0; i < p->N_ITER_2; ++i)
        {
            Validated_train_data_Core_2_Decode_Bit(stream, &(p->sub_2[i]));
        }
        return 1;
    }
    else
    {
        return 0;
    }
}

canonical_original_code:
int Validated_train_data_Decode_Bit(struct Bitstream *stream, struct Validated_train_data_Core *p)
{
    if (Bitstream_Normal(stream, 106))
    {
        {
            p->L_PACKET = Bitstream_Read(stream, 13);
        }
        {
            p->NID_OPERATIONAL = Bitstream_Read(stream, 32);
        }
        {
            p->NC_TRAIN = Bitstream_Read(stream, 15);
        }
        {
            p->L_TRAIN = Bitstream_Read(stream, 12);
        }
        {
            p->V_MAXTRAIN = Bitstream_Read(stream, 7);
        }
        {
            p->M_LOADINGGAUGE = Bitstream_Read(stream, 8);
        }
        {
            p->M_AXLELOAD = Bitstream_Read(stream, 7);
        }
        {
            p->M_AIRTIGHT = Bitstream_Read(stream, 2);
        }
    {
            p->N_ITER_1 = Bitstream_Read(stream, 5);
        }
        for (unsigned int i = 0; i < p->N_ITER_1; ++i)
        {
            Validated_train_data_Core_1_Decode_Bit(stream, &(p->sub_1[i]));
        }
    {
            p->N_ITER_2 = Bitstream_Read(stream, 5);
        }
        for (unsigned int i = 0; i < p->N_ITER_2; ++i)
        {
            Validated_train_data_Core_2_Decode_Bit(stream, &(p->sub_2[i]));
        }
        return 1;
    }
    else
    {
        return 0;
    }
}

user_defined_types: struct Validated_train_data_Core_1 { unsigned long M_TRACTION; }

user_defined_types: struct Validated_train_data_Core_2 { unsigned long NID_STM; }


original_code:
int Validated_train_data_Encode_Int(PacketInfo* data, kcg_int* stream, const Validated_train_data_Core* p)
{
    return 0;
}

canonical_original_code:
int Validated_train_data_Encode_Int(struct MetadataElement_T_Common_Types_Pkg *data, int *stream, struct Validated_train_data_Core *p)
{
    return 0;
}

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


original_code:
int Validated_train_data_Decode_Int(PacketInfo* data, const kcg_int* stream, Validated_train_data_Core* p)
{
    return 0;
}

canonical_original_code:
int Validated_train_data_Decode_Int(struct MetadataElement_T_Common_Types_Pkg *data, int *stream, struct Validated_train_data_Core *p)
{
    return 0;
}

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 __fastcall PacketFactory_BothWays(__int64 a1)
{
__int64 result; // rax

result = 0LL;
if ( a1 == 255 )
result = EndOfInformation_New();
return result;
}

canonical_decompiled_code:
__int64 __fastcall func0(__int64 a1)
{
__int64 result; // rax

result = 0LL;
if ( a1 == 255 )
result = EndOfInformation_New();
return result;
}

original_code:
PacketHeader* PacketFactory_BothWays(PacketHeader header)
{
    switch (header.NID_PACKET)
    {
        case 255 :
        {
            EndOfInformation* ptr = EndOfInformation_New();
            PacketHeader* p = &(ptr->header);
            return p;
        }
        default :
        {
            return ((void *)0);
        }
    };
}

canonical_original_code:
struct PacketHeader *PacketFactory_BothWays(struct PacketHeader header)
{
    switch (header.NID_PACKET)
    {
        case 255 :
        {
            struct EndOfInformation *ptr = EndOfInformation_New();
            struct PacketHeader *p = &(ptr->header);
            return p;
        }
        default :
        {
            return ((void *)0);
        }
    };
}

variable_types:
header
struct PacketHeader

variable_types: struct EndOfInformation { struct PacketHeader { unsigned long NID_PACKET; unsigned long list; } header; } *

variable_types: struct PacketHeader { unsigned long NID_PACKET; unsigned long list; } *

user_defined_types: struct EndOfInformation { struct PacketHeader header; }


decompiled_code:
__int64 __fastcall Packet_Delete(__int64 *a1)
{
__int64 v1; // rdx
__int64 result; // rax
__int64 v3; // rdx

v1 = a1[1];
if ( v1 == 1 )
{
v3 = *a1;
switch ( *a1 )
{
case 3LL:
NationalValues_Delete();
result = 1LL;
break;
case 5LL:
Linking_Delete();
result = 1LL;
break;
case 12LL:
Level1MovementAuthority_Delete();
result = 1LL;
break;
case 15LL:
Level23MovementAuthority_Delete();
result = 1LL;
break;
case 16LL:
RepositioningInformation_Delete();
result = 1LL;
break;
case 21LL:
GradientProfile_Delete();
result = 1LL;
break;
case 27LL:
InternationalStaticSpeedProfile_Delete();
result = 1LL;
break;
case 39LL:
TrackConditionChangeOfTractionPower_Delete();
result = 1LL;
break;
case 41LL:
LevelTransitionOrder_Delete();
result = 1LL;
break;
case 42LL:
SessionManagement_Delete();
result = 1LL;
break;
case 44LL:
LABEL_12:
DataUsedByApplicationsOutsideTheERTMSETCSSystem_Delete();
result = 1LL;
break;
case 45LL:
RadioNetworkRegistration_Delete();
result = 1LL;
break;
case 46LL:
ConditionalLevelTransitionOrder_Delete();
result = 1LL;
break;
case 49LL:
ListOfBalisesForSHArea_Delete();
result = 1LL;
break;
case 51LL:
AxleLoadSpeedProfile_Delete();
result = 1LL;
break;
case 57LL:
MovementAuthorityRequestParameters_Delete();
result = 1LL;
break;
case 58LL:
PositionReportParameters_Delete();
result = 1LL;
break;
case 63LL:
ListOfBalisesInSRAuthority_Delete();
result = 1LL;
break;
case 65LL:
TemporarySpeedRestriction_Delete();
result = 1LL;
break;
case 66LL:
TemporarySpeedRestrictionRevocation_Delete();
result = 1LL;
break;
case 67LL:
TrackConditionBigMetalMasses_Delete();
result = 1LL;
break;
case 68LL:
TrackCondition_Delete();
result = 1LL;
break;
case 70LL:
RouteSuitabilityData_Delete();
result = 1LL;
break;
case 71LL:
AdhesionFactor_Delete();
result = 1LL;
break;
case 72LL:
PacketForSendingPlainTextMessages_Delete();
result = 1LL;
break;
case 76LL:
PacketForSendingFixedTextMessages_Delete();
result = 1LL;
break;
case 79LL:
GeographicalPositionInformation_Delete();
result = 1LL;
break;
case 80LL:
ModeProfile_Delete();
result = 1LL;
break;
case 90LL:
TrackAheadFreeUpToLevel23TransitionLocation_Delete();
result = 1LL;
break;
case 131LL:
RBCTransitionOrder_Delete();
result = 1LL;
break;
case 132LL:
DangerForShuntingInformation_Delete();
result = 1LL;
break;
case 133LL:
RadioInfillAreaInformation_Delete();
result = 1LL;
break;
case 134LL:
EOLMPacket_Delete();
result = 1LL;
break;
case 136LL:
InfillLocationReference_Delete();
result = 1LL;
break;
case 137LL:
StopIfInStaffResponsible_Delete();
result = 1LL;
break;
case 138LL:
ReversingAreaInformation_Delete();
result = 1LL;
break;
case 139LL:
ReversingSupervisionInformation_Delete();
result = 1LL;
break;
case 140LL:
TrainRunningNumberFromRBC_Delete();
result = 1LL;
break;
case 141LL:
DefaultGradientForTemporarySpeedRestriction_Delete();
result = 1LL;
break;
case 254LL:
DefaultBaliseLoopOrRIUInformation_Delete();
result = 1LL;
break;
default:
LABEL_13:
fprintf(stderr, "Packet_Delete: unexpected value for header->NID_PACKET = %lu\n", v3);
result = 0LL;
break;
}
}
else if ( v1 == 2 )
{
if ( *a1 != 255 )
_assert_fail("header->NID_PACKET == 255", "Packet_Delete.c", 0x153u, "Packet_Delete");
EndOfInformation_Delete();
result = 1LL;
}
else if ( v1 )
{
fprintf(stderr, "Packet_Delete: unexpected value for header->list = %lu\n", v1);
result = 0LL;
}
else
{
v3 = *a1;
switch ( *a1 )
{
case 0LL:
PositionReport_Delete();
result = 1LL;
break;
case 1LL:
PositionReportBasedOnTwoBaliseGroups_Delete();
result = 1LL;
break;
case 3LL:
OnboardTelephoneNumbers_Delete();
result = 1LL;
break;
case 4LL:
ErrorReporting_Delete();
result = 1LL;
break;
case 9LL:
Level23TransitionInformation_Delete();
result = 1LL;
break;
case 11LL:
ValidatedTrainData_Delete();
result = 1LL;
break;
case 44LL:
goto LABEL_12;
default:
goto LABEL_13;
}
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func0(__int64 *a1)
{
__int64 v1; // rdx
__int64 result; // rax
__int64 v3; // rdx

v1 = a1[1];
if ( v1 == 1 )
{
v3 = *a1;
switch ( *a1 )
{
case 3LL:
NationalValues_Delete();
result = 1LL;
break;
case 5LL:
Linking_Delete();
result = 1LL;
break;
case 12LL:
Level1MovementAuthority_Delete();
result = 1LL;
break;
case 15LL:
Level23MovementAuthority_Delete();
result = 1LL;
break;
case 16LL:
RepositioningInformation_Delete();
result = 1LL;
break;
case 21LL:
GradientProfile_Delete();
result = 1LL;
break;
case 27LL:
InternationalStaticSpeedProfile_Delete();
result = 1LL;
break;
case 39LL:
TrackConditionChangeOfTractionPower_Delete();
result = 1LL;
break;
case 41LL:
LevelTransitionOrder_Delete();
result = 1LL;
break;
case 42LL:
SessionManagement_Delete();
result = 1LL;
break;
case 44LL:
LABEL_12:
DataUsedByApplicationsOutsideTheERTMSETCSSystem_Delete();
result = 1LL;
break;
case 45LL:
RadioNetworkRegistration_Delete();
result = 1LL;
break;
case 46LL:
ConditionalLevelTransitionOrder_Delete();
result = 1LL;
break;
case 49LL:
ListOfBalisesForSHArea_Delete();
result = 1LL;
break;
case 51LL:
AxleLoadSpeedProfile_Delete();
result = 1LL;
break;
case 57LL:
MovementAuthorityRequestParameters_Delete();
result = 1LL;
break;
case 58LL:
PositionReportParameters_Delete();
result = 1LL;
break;
case 63LL:
ListOfBalisesInSRAuthority_Delete();
result = 1LL;
break;
case 65LL:
TemporarySpeedRestriction_Delete();
result = 1LL;
break;
case 66LL:
TemporarySpeedRestrictionRevocation_Delete();
result = 1LL;
break;
case 67LL:
TrackConditionBigMetalMasses_Delete();
result = 1LL;
break;
case 68LL:
TrackCondition_Delete();
result = 1LL;
break;
case 70LL:
RouteSuitabilityData_Delete();
result = 1LL;
break;
case 71LL:
AdhesionFactor_Delete();
result = 1LL;
break;
case 72LL:
PacketForSendingPlainTextMessages_Delete();
result = 1LL;
break;
case 76LL:
PacketForSendingFixedTextMessages_Delete();
result = 1LL;
break;
case 79LL:
GeographicalPositionInformation_Delete();
result = 1LL;
break;
case 80LL:
ModeProfile_Delete();
result = 1LL;
break;
case 90LL:
TrackAheadFreeUpToLevel23TransitionLocation_Delete();
result = 1LL;
break;
case 131LL:
RBCTransitionOrder_Delete();
result = 1LL;
break;
case 132LL:
DangerForShuntingInformation_Delete();
result = 1LL;
break;
case 133LL:
RadioInfillAreaInformation_Delete();
result = 1LL;
break;
case 134LL:
EOLMPacket_Delete();
result = 1LL;
break;
case 136LL:
InfillLocationReference_Delete();
result = 1LL;
break;
case 137LL:
StopIfInStaffResponsible_Delete();
result = 1LL;
break;
case 138LL:
ReversingAreaInformation_Delete();
result = 1LL;
break;
case 139LL:
ReversingSupervisionInformation_Delete();
result = 1LL;
break;
case 140LL:
TrainRunningNumberFromRBC_Delete();
result = 1LL;
break;
case 141LL:
DefaultGradientForTemporarySpeedRestriction_Delete();
result = 1LL;
break;
case 254LL:
DefaultBaliseLoopOrRIUInformation_Delete();
result = 1LL;
break;
default:
LABEL_13:
fprintf(stderr, "Packet_Delete: unexpected value for header->NID_PACKET = %lu\n", v3);
result = 0LL;
break;
}
}
else if ( v1 == 2 )
{
if ( *a1 != 255 )
_assert_fail("header->NID_PACKET == 255", "Packet_Delete.c", 0x153u, "Packet_Delete");
EndOfInformation_Delete();
result = 1LL;
}
else if ( v1 )
{
fprintf(stderr, "Packet_Delete: unexpected value for header->list = %lu\n", v1);
result = 0LL;
}
else
{
v3 = *a1;
switch ( *a1 )
{
case 0LL:
PositionReport_Delete();
result = 1LL;
break;
case 1LL:
PositionReportBasedOnTwoBaliseGroups_Delete();
result = 1LL;
break;
case 3LL:
OnboardTelephoneNumbers_Delete();
result = 1LL;
break;
case 4LL:
ErrorReporting_Delete();
result = 1LL;
break;
case 9LL:
Level23TransitionInformation_Delete();
result = 1LL;
break;
case 11LL:
ValidatedTrainData_Delete();
result = 1LL;
break;
case 44LL:
goto LABEL_12;
default:
goto LABEL_13;
}
}
return result;
}

original_code:
int Packet_Delete(PacketHeader* header)
{
    switch (header->list)
    {
        case 0 :
        {
            switch (header->NID_PACKET)
            {
                case 0 :
                {
                    PositionReport_Delete((PositionReport*)(header));
                    return 1;
                }
                case 1 :
                {
                    PositionReportBasedOnTwoBaliseGroups_Delete((PositionReportBasedOnTwoBaliseGroups*)(header));
                    return 1;
                }
                case 3 :
                {
                    OnboardTelephoneNumbers_Delete((OnboardTelephoneNumbers*)(header));
                    return 1;
                }
                case 4 :
                {
                    ErrorReporting_Delete((ErrorReporting*)(header));
                    return 1;
                }
                case 9 :
                {
                    Level23TransitionInformation_Delete((Level23TransitionInformation*)(header));
                    return 1;
                }
                case 11 :
                {
                    ValidatedTrainData_Delete((ValidatedTrainData*)(header));
                    return 1;
                }
                case 44 :
                {
                    DataUsedByApplicationsOutsideTheERTMSETCSSystem_Delete((DataUsedByApplicationsOutsideTheERTMSETCSSystem*)(header));
                    return 1;
                }
                default :
                {
                    fprintf(stderr, "Packet_Delete: unexpected value for header->NID_PACKET = %lu\n", header->NID_PACKET);
                    return 0;
                }
            };
        }
        case 1 :
        {
            switch (header->NID_PACKET)
            {
                case 3 :
                {
                    NationalValues_Delete((NationalValues*)(header));
                    return 1;
                }
                case 5 :
                {
                    Linking_Delete((Linking*)(header));
                    return 1;
                }
                case 12 :
                {
                    Level1MovementAuthority_Delete((Level1MovementAuthority*)(header));
                    return 1;
                }
                case 15 :
                {
                    Level23MovementAuthority_Delete((Level23MovementAuthority*)(header));
                    return 1;
                }
                case 16 :
                {
                    RepositioningInformation_Delete((RepositioningInformation*)(header));
                    return 1;
                }
                case 21 :
                {
                    GradientProfile_Delete((GradientProfile*)(header));
                    return 1;
                }
                case 27 :
                {
                    InternationalStaticSpeedProfile_Delete((InternationalStaticSpeedProfile*)(header));
                    return 1;
                }
                case 39 :
                {
                    TrackConditionChangeOfTractionPower_Delete((TrackConditionChangeOfTractionPower*)(header));
                    return 1;
                }
                case 41 :
                {
                    LevelTransitionOrder_Delete((LevelTransitionOrder*)(header));
                    return 1;
                }
                case 42 :
                {
                    SessionManagement_Delete((SessionManagement*)(header));
                    return 1;
                }
                case 44 :
                {
                    DataUsedByApplicationsOutsideTheERTMSETCSSystem_Delete((DataUsedByApplicationsOutsideTheERTMSETCSSystem*)(header));
                    return 1;
                }
                case 45 :
                {
                    RadioNetworkRegistration_Delete((RadioNetworkRegistration*)(header));
                    return 1;
                }
                case 46 :
                {
                    ConditionalLevelTransitionOrder_Delete((ConditionalLevelTransitionOrder*)(header));
                    return 1;
                }
                case 49 :
                {
                    ListOfBalisesForSHArea_Delete((ListOfBalisesForSHArea*)(header));
                    return 1;
                }
                case 51 :
                {
                    AxleLoadSpeedProfile_Delete((AxleLoadSpeedProfile*)(header));
                    return 1;
                }
                case 57 :
                {
                    MovementAuthorityRequestParameters_Delete((MovementAuthorityRequestParameters*)(header));
                    return 1;
                }
                case 58 :
                {
                    PositionReportParameters_Delete((PositionReportParameters*)(header));
                    return 1;
                }
                case 63 :
                {
                    ListOfBalisesInSRAuthority_Delete((ListOfBalisesInSRAuthority*)(header));
                    return 1;
                }
                case 65 :
                {
                    TemporarySpeedRestriction_Delete((TemporarySpeedRestriction*)(header));
                    return 1;
                }
                case 66 :
                {
                    TemporarySpeedRestrictionRevocation_Delete((TemporarySpeedRestrictionRevocation*)(header));
                    return 1;
                }
                case 67 :
                {
                    TrackConditionBigMetalMasses_Delete((TrackConditionBigMetalMasses*)(header));
                    return 1;
                }
                case 68 :
                {
                    TrackCondition_Delete((TrackCondition*)(header));
                    return 1;
                }
                case 70 :
                {
                    RouteSuitabilityData_Delete((RouteSuitabilityData*)(header));
                    return 1;
                }
                case 71 :
                {
                    AdhesionFactor_Delete((AdhesionFactor*)(header));
                    return 1;
                }
                case 72 :
                {
                    PacketForSendingPlainTextMessages_Delete((PacketForSendingPlainTextMessages*)(header));
                    return 1;
                }
                case 76 :
                {
                    PacketForSendingFixedTextMessages_Delete((PacketForSendingFixedTextMessages*)(header));
                    return 1;
                }
                case 79 :
                {
                    GeographicalPositionInformation_Delete((GeographicalPositionInformation*)(header));
                    return 1;
                }
                case 80 :
                {
                    ModeProfile_Delete((ModeProfile*)(header));
                    return 1;
                }
                case 90 :
                {
                    TrackAheadFreeUpToLevel23TransitionLocation_Delete((TrackAheadFreeUpToLevel23TransitionLocation*)(header));
                    return 1;
                }
                case 131 :
                {
                    RBCTransitionOrder_Delete((RBCTransitionOrder*)(header));
                    return 1;
                }
                case 132 :
                {
                    DangerForShuntingInformation_Delete((DangerForShuntingInformation*)(header));
                    return 1;
                }
                case 133 :
                {
                    RadioInfillAreaInformation_Delete((RadioInfillAreaInformation*)(header));
                    return 1;
                }
                case 134 :
                {
                    EOLMPacket_Delete((EOLMPacket*)(header));
                    return 1;
                }
                case 136 :
                {
                    InfillLocationReference_Delete((InfillLocationReference*)(header));
                    return 1;
                }
                case 137 :
                {
                    StopIfInStaffResponsible_Delete((StopIfInStaffResponsible*)(header));
                    return 1;
                }
                case 138 :
                {
                    ReversingAreaInformation_Delete((ReversingAreaInformation*)(header));
                    return 1;
                }
                case 139 :
                {
                    ReversingSupervisionInformation_Delete((ReversingSupervisionInformation*)(header));
                    return 1;
                }
                case 140 :
                {
                    TrainRunningNumberFromRBC_Delete((TrainRunningNumberFromRBC*)(header));
                    return 1;
                }
                case 141 :
                {
                    DefaultGradientForTemporarySpeedRestriction_Delete((DefaultGradientForTemporarySpeedRestriction*)(header));
                    return 1;
                }
                case 254 :
                {
                    DefaultBaliseLoopOrRIUInformation_Delete((DefaultBaliseLoopOrRIUInformation*)(header));
                    return 1;
                }
                default :
                {
                    fprintf(stderr, "Packet_Delete: 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_Delete.c", 339, __extension__ __PRETTY_FUNCTION__));
            EndOfInformation_Delete((EndOfInformation*)header);
            return 1;
        }
        default:
        {
            fprintf(stderr, "Packet_Delete: unexpected value for header->list = %lu\n", header->list);
            return 0;
        }
    };
}

canonical_original_code:
int Packet_Delete(struct PacketHeader *header)
{
    switch (header->list)
    {
        case 0 :
        {
            switch (header->NID_PACKET)
            {
                case 0 :
                {
                    PositionReport_Delete((struct PositionReport *)(header));
                    return 1;
                }
                case 1 :
                {
                    PositionReportBasedOnTwoBaliseGroups_Delete((struct PositionReportBasedOnTwoBaliseGroups *)(header));
                    return 1;
                }
                case 3 :
                {
                    OnboardTelephoneNumbers_Delete((struct OnboardTelephoneNumbers *)(header));
                    return 1;
                }
                case 4 :
                {
                    ErrorReporting_Delete((struct ErrorReporting *)(header));
                    return 1;
                }
                case 9 :
                {
                    Level23TransitionInformation_Delete((struct Level23TransitionInformation *)(header));
                    return 1;
                }
                case 11 :
                {
                    ValidatedTrainData_Delete((struct ValidatedTrainData *)(header));
                    return 1;
                }
                case 44 :
                {
                    DataUsedByApplicationsOutsideTheERTMSETCSSystem_Delete((struct DataUsedByApplicationsOutsideTheERTMSETCSSystem *)(header));
                    return 1;
                }
                default :
                {
                    fprintf(stderr, "Packet_Delete: unexpected value for header->NID_PACKET = %lu\n", header->NID_PACKET);
                    return 0;
                }
            };
        }
        case 1 :
        {
            switch (header->NID_PACKET)
            {
                case 3 :
                {
                    NationalValues_Delete((struct NationalValues *)(header));
                    return 1;
                }
                case 5 :
                {
                    Linking_Delete((struct Linking *)(header));
                    return 1;
                }
                case 12 :
                {
                    Level1MovementAuthority_Delete((struct Level1MovementAuthority *)(header));
                    return 1;
                }
                case 15 :
                {
                    Level23MovementAuthority_Delete((struct Level23MovementAuthority *)(header));
                    return 1;
                }
                case 16 :
                {
                    RepositioningInformation_Delete((struct RepositioningInformation *)(header));
                    return 1;
                }
                case 21 :
                {
                    GradientProfile_Delete((struct GradientProfile *)(header));
                    return 1;
                }
                case 27 :
                {
                    InternationalStaticSpeedProfile_Delete((struct InternationalStaticSpeedProfile *)(header));
                    return 1;
                }
                case 39 :
                {
                    TrackConditionChangeOfTractionPower_Delete((struct TrackConditionChangeOfTractionPower *)(header));
                    return 1;
                }
                case 41 :
                {
                    LevelTransitionOrder_Delete((struct LevelTransitionOrder *)(header));
                    return 1;
                }
                case 42 :
                {
                    SessionManagement_Delete((struct SessionManagement *)(header));
                    return 1;
                }
                case 44 :
                {
                    DataUsedByApplicationsOutsideTheERTMSETCSSystem_Delete((struct DataUsedByApplicationsOutsideTheERTMSETCSSystem *)(header));
                    return 1;
                }
                case 45 :
                {
                    RadioNetworkRegistration_Delete((struct RadioNetworkRegistration *)(header));
                    return 1;
                }
                case 46 :
                {
                    ConditionalLevelTransitionOrder_Delete((struct ConditionalLevelTransitionOrder *)(header));
                    return 1;
                }
                case 49 :
                {
                    ListOfBalisesForSHArea_Delete((struct ListOfBalisesForSHArea *)(header));
                    return 1;
                }
                case 51 :
                {
                    AxleLoadSpeedProfile_Delete((struct AxleLoadSpeedProfile *)(header));
                    return 1;
                }
                case 57 :
                {
                    MovementAuthorityRequestParameters_Delete((struct MovementAuthorityRequestParameters *)(header));
                    return 1;
                }
                case 58 :
                {
                    PositionReportParameters_Delete((struct PositionReportParameters *)(header));
                    return 1;
                }
                case 63 :
                {
                    ListOfBalisesInSRAuthority_Delete((struct ListOfBalisesInSRAuthority *)(header));
                    return 1;
                }
                case 65 :
                {
                    TemporarySpeedRestriction_Delete((struct TemporarySpeedRestriction *)(header));
                    return 1;
                }
                case 66 :
                {
                    TemporarySpeedRestrictionRevocation_Delete((struct TemporarySpeedRestrictionRevocation *)(header));
                    return 1;
                }
                case 67 :
                {
                    TrackConditionBigMetalMasses_Delete((struct TrackConditionBigMetalMasses *)(header));
                    return 1;
                }
                case 68 :
                {
                    TrackCondition_Delete((struct TrackCondition *)(header));
                    return 1;
                }
                case 70 :
                {
                    RouteSuitabilityData_Delete((struct RouteSuitabilityData *)(header));
                    return 1;
                }
                case 71 :
                {
                    AdhesionFactor_Delete((struct AdhesionFactor *)(header));
                    return 1;
                }
                case 72 :
                {
                    PacketForSendingPlainTextMessages_Delete((struct PacketForSendingPlainTextMessages *)(header));
                    return 1;
                }
                case 76 :
                {
                    PacketForSendingFixedTextMessages_Delete((struct PacketForSendingFixedTextMessages *)(header));
                    return 1;
                }
                case 79 :
                {
                    GeographicalPositionInformation_Delete((struct GeographicalPositionInformation *)(header));
                    return 1;
                }
                case 80 :
                {
                    ModeProfile_Delete((struct ModeProfile *)(header));
                    return 1;
                }
                case 90 :
                {
                    TrackAheadFreeUpToLevel23TransitionLocation_Delete((struct TrackAheadFreeUpToLevel23TransitionLocation *)(header));
                    return 1;
                }
                case 131 :
                {
                    RBCTransitionOrder_Delete((struct RBCTransitionOrder *)(header));
                    return 1;
                }
                case 132 :
                {
                    DangerForShuntingInformation_Delete((struct DangerForShuntingInformation *)(header));
                    return 1;
                }
                case 133 :
                {
                    RadioInfillAreaInformation_Delete((struct RadioInfillAreaInformation *)(header));
                    return 1;
                }
                case 134 :
                {
                    EOLMPacket_Delete((struct EOLMPacket *)(header));
                    return 1;
                }
                case 136 :
                {
                    InfillLocationReference_Delete((struct InfillLocationReference *)(header));
                    return 1;
                }
                case 137 :
                {
                    StopIfInStaffResponsible_Delete((struct StopIfInStaffResponsible *)(header));
                    return 1;
                }
                case 138 :
                {
                    ReversingAreaInformation_Delete((struct ReversingAreaInformation *)(header));
                    return 1;
                }
                case 139 :
                {
                    ReversingSupervisionInformation_Delete((struct ReversingSupervisionInformation *)(header));
                    return 1;
                }
                case 140 :
                {
                    TrainRunningNumberFromRBC_Delete((struct TrainRunningNumberFromRBC *)(header));
                    return 1;
                }
                case 141 :
                {
                    DefaultGradientForTemporarySpeedRestriction_Delete((struct DefaultGradientForTemporarySpeedRestriction *)(header));
                    return 1;
                }
                case 254 :
                {
                    DefaultBaliseLoopOrRIUInformation_Delete((struct DefaultBaliseLoopOrRIUInformation *)(header));
                    return 1;
                }
                default :
                {
                    fprintf(stderr, "Packet_Delete: 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_Delete.c", 339, __extension__ __PRETTY_FUNCTION__));
            EndOfInformation_Delete((struct EndOfInformation *)header);
            return 1;
        }
        default:
        {
            fprintf(stderr, "Packet_Delete: unexpected value for header->list = %lu\n", header->list);
            return 0;
        }
    };
}

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

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 Level23MovementAuthority { struct PacketHeader header; unsigned long Q_DIR; unsigned long L_PACKET; unsigned long Q_SCALE; unsigned long V_LOA; unsigned long T_LOA; unsigned long N_ITER_1; struct Level23MovementAuthority_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 InfillLocationReference { 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 StopIfInStaffResponsible { struct PacketHeader header; unsigned long Q_DIR; unsigned long L_PACKET; unsigned long Q_SRSTOP; }

user_defined_types: struct ReversingAreaInformation { struct PacketHeader header; unsigned long Q_DIR; unsigned long L_PACKET; unsigned long Q_SCALE; unsigned long D_STARTREVERSE; unsigned long L_REVERSEAREA; }

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 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 Level23MovementAuthority_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 RouteSuitabilityData_1 { unsigned long D_SUITABILITY; unsigned long Q_SUITABILITY; unsigned long M_LOADINGGAUGE; unsigned long M_AXLELOAD; unsigned long M_TRACTION; }

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 AxleLoadSpeedProfile_2_1 { unsigned long M_AXLELOAD; unsigned long V_AXLELOAD; }


decompiled_code:
_BOOL8 __fastcall PacketHeader_Equal(_QWORD *a1, _QWORD *a2)
{
_BOOL8 result; // rax

result = 0LL;
if ( *a1 == *a2 )
result = a1[1] == a2[1];
return result;
}

canonical_decompiled_code:
_BOOL8 __fastcall func0(_QWORD *a1, _QWORD *a2)
{
_BOOL8 result; // rax

result = 0LL;
if ( *a1 == *a2 )
result = a1[1] == a2[1];
return result;
}

original_code:
static inline int PacketHeader_Equal(const PacketHeader* a, const PacketHeader* b)
{
    return (a->NID_PACKET == b->NID_PACKET) && (a->list == b->list);
}

canonical_original_code:
static inline int PacketHeader_Equal(struct PacketHeader *a, struct PacketHeader *b)
{
    return (a->NID_PACKET == b->NID_PACKET) && (a->list == b->list);
}

variable_types:
b
struct PacketHeader *

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


decompiled_code:
_BOOL8 __fastcall ErrorReporting_Equal(_QWORD *a1, _QWORD *a2)
{
_BOOL8 result; // rax

result = PacketHeader_Equal(a1, a2);
if ( result )
{
result = 0LL;
if ( a1[2] == a2[2] )
result = a1[3] == a2[3];
}
return result;
}

canonical_decompiled_code:
_BOOL8 __fastcall func2(_QWORD *a1, _QWORD *a2)
{
_BOOL8 result; // rax

result = func0(a1, a2);
if ( result )
{
result = 0LL;
if ( a1[2] == a2[2] )
result = a1[3] == a2[3];
}
return result;
}

original_code:
static inline int ErrorReporting_Equal(const ErrorReporting* a, const ErrorReporting* b)
{
    int status = PacketHeader_Equal(&a->header, &b->header);
    status = status && (a->L_PACKET == b->L_PACKET);
    status = status && (a->M_ERROR == b->M_ERROR);
    return status;
}

canonical_original_code:
static inline int ErrorReporting_Equal(struct ErrorReporting *a, struct ErrorReporting *b)
{
    int status = PacketHeader_Equal(&a->header, &b->header);
    status = status && (a->L_PACKET == b->L_PACKET);
    status = status && (a->M_ERROR == b->M_ERROR);
    return status;
}

variable_types: struct ErrorReporting { struct PacketHeader { unsigned long NID_PACKET; unsigned long list; } header; unsigned long L_PACKET; unsigned long M_ERROR; } *

variable_types:
b
struct ErrorReporting *

variable_types: status int

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


decompiled_code:
int ErrorReporting_Tests()
{
_QWORD *v0; // rbx
_QWORD v2[4]; // [rsp+0h] [rbp-48h] BYREF
_QWORD v3[5]; // [rsp+20h] [rbp-28h] BYREF

puts("\nstart ErrorReporting_Tests");
ErrorReporting_Init(v3);
ErrorReporting_Print(v3, stdout);
putchar(10);
ErrorReporting_Init(v2);
if ( !ErrorReporting_Equal(v3, v2) )
_assert_fail("ErrorReporting_Equal(&a, &b)", "ErrorReporting_Tests.c", 0x25u, "ErrorReporting_Tests");
v2[3] = 4LL;
if ( ErrorReporting_Equal(v3, v2) )
_assert_fail("!ErrorReporting_Equal(&a, &b)", "ErrorReporting_Tests.c", 0x28u, "ErrorReporting_Tests");
v0 = (_QWORD *)PacketFactory_TrainToTrack(4LL, 0LL);
ErrorReporting_Print(v0, stdout);
putchar(10);
if ( !ErrorReporting_Equal(v3, v0) )
_assert_fail("ErrorReporting_Equal(&a, p)", "ErrorReporting_Tests.c", 0x2Fu, "ErrorReporting_Tests");
ErrorReporting_Delete(v0);
return puts("end ErrorReporting_Test");
}

canonical_decompiled_code:
int func5()
{
_QWORD *v0; // rbx
_QWORD v2[4]; // [rsp+0h] [rbp-48h] BYREF
_QWORD v3[5]; // [rsp+20h] [rbp-28h] BYREF

puts("\nstart ErrorReporting_Tests");
func1(v3);
func4(v3, stdout);
putchar(10);
func1(v2);
if ( !func2(v3, v2) )
_assert_fail("ErrorReporting_Equal(&a, &b)", "ErrorReporting_Tests.c", 0x25u, "ErrorReporting_Tests");
v2[3] = 4LL;
if ( func2(v3, v2) )
_assert_fail("!ErrorReporting_Equal(&a, &b)", "ErrorReporting_Tests.c", 0x28u, "ErrorReporting_Tests");
v0 = (_QWORD *)PacketFactory_TrainToTrack(4LL, 0LL);
func4(v0, stdout);
putchar(10);
if ( !func2(v3, v0) )
_assert_fail("ErrorReporting_Equal(&a, p)", "ErrorReporting_Tests.c", 0x2Fu, "ErrorReporting_Tests");
ErrorReporting_Delete(v0);
return puts("end ErrorReporting_Test");
}

original_code:
void ErrorReporting_Tests(void)
{
    printf("\nstart ErrorReporting_Tests\n");
    ErrorReporting a;
    ErrorReporting_Init(&a);
    ErrorReporting_Print(&a, stdout);
    printf("\n");
    ErrorReporting b;
    ErrorReporting_Init(&b);
    ((ErrorReporting_Equal(&a, &b)) ? (void) (0) : __assert_fail ("ErrorReporting_Equal(&a, &b)", "ErrorReporting_Tests.c", 37, __extension__ __PRETTY_FUNCTION__));
    b.M_ERROR = 4;
    ((!ErrorReporting_Equal(&a, &b)) ? (void) (0) : __assert_fail ("!ErrorReporting_Equal(&a, &b)", "ErrorReporting_Tests.c", 40, __extension__ __PRETTY_FUNCTION__));
    PacketHeader header = {4, 0};
    PacketHeader* base = PacketFactory_TrainToTrack(header);
    ErrorReporting* p = (ErrorReporting*)(base);
    ErrorReporting_Print(p, stdout);
    printf("\n");
    ((ErrorReporting_Equal(&a, p)) ? (void) (0) : __assert_fail ("ErrorReporting_Equal(&a, p)", "ErrorReporting_Tests.c", 47, __extension__ __PRETTY_FUNCTION__));
    ErrorReporting_Delete(p);
    printf("end ErrorReporting_Test\n");
}

canonical_original_code:
void ErrorReporting_Tests()
{
    printf("\nstart ErrorReporting_Tests\n");
    struct ErrorReporting a;
    ErrorReporting_Init(&a);
    ErrorReporting_Print(&a, stdout);
    printf("\n");
    struct ErrorReporting b;
    ErrorReporting_Init(&b);
    ((ErrorReporting_Equal(&a, &b)) ? (void) (0) : __assert_fail ("ErrorReporting_Equal(&a, &b)", "ErrorReporting_Tests.c", 37, __extension__ __PRETTY_FUNCTION__));
    b.M_ERROR = 4;
    ((!ErrorReporting_Equal(&a, &b)) ? (void) (0) : __assert_fail ("!ErrorReporting_Equal(&a, &b)", "ErrorReporting_Tests.c", 40, __extension__ __PRETTY_FUNCTION__));
    struct PacketHeader header = {4, 0};
    struct PacketHeader *base = PacketFactory_TrainToTrack(header);
    struct ErrorReporting *p = (ErrorReporting*)(base);
    ErrorReporting_Print(p, stdout);
    printf("\n");
    ((ErrorReporting_Equal(&a, p)) ? (void) (0) : __assert_fail ("ErrorReporting_Equal(&a, p)", "ErrorReporting_Tests.c", 47, __extension__ __PRETTY_FUNCTION__));
    ErrorReporting_Delete(p);
    printf("end ErrorReporting_Test\n");
}

variable_types: struct ErrorReporting { struct PacketHeader { unsigned long NID_PACKET; unsigned long list; } header; unsigned long L_PACKET; unsigned long M_ERROR; }

return_type: void