original_code:
int OnboardTelephoneNumbers_DecodeInt(OnboardTelephoneNumbers* p, const Metadata* data, const kcg_int* stream)
{
    if(data->nid_packet != 3)
    {
         return 0;
    }
    kcg_int startAddress = data->startAddress;
    p->header.NID_PACKET = stream[startAddress++];
    p->L_PACKET = stream[startAddress++];
    p->N_ITER_1 = stream[startAddress++];
    for (uint32_t i = 0; i < p->N_ITER_1; ++i)
    {
        OnboardTelephoneNumbers_1_DecodeInt(&(p->sub_1[i]), &startAddress, stream);
    }
    if(startAddress-1 != data->endAddress)
    {
         return 0;
    }
    return 1;
}

canonical_original_code:
int OnboardTelephoneNumbers_DecodeInt(struct OnboardTelephoneNumbers *p, struct MetadataElement_T_Common_Types_Pkg *data, int *stream)
{
    if(data->nid_packet != 3)
    {
         return 0;
    }
    int startAddress = data->startAddress;
    p->header.NID_PACKET = stream[startAddress++];
    p->L_PACKET = stream[startAddress++];
    p->N_ITER_1 = stream[startAddress++];
    for (unsigned int i = 0; i < p->N_ITER_1; ++i)
    {
        OnboardTelephoneNumbers_1_DecodeInt(&(p->sub_1[i]), &startAddress, stream);
    }
    if(startAddress-1 != data->endAddress)
    {
         return 0;
    }
    return 1;
}

variable_types:
stream
int *


repo: openETCS/dataDictionary

decompiled_code:
__int64 OnboardTelephoneNumbers_New()
{
__int64 *v0; // r8
__int64 v1; // r8
__int64 v3; // r8

if ( OnboardTelephoneNumbersMemoryFreeList == -1 )
{
if ( (unsigned __int64)OnboardTelephoneNumbersMemoryTop > 7 )
return 0LL;
v3 = 35 * OnboardTelephoneNumbersMemoryTop++;
v0 = &OnboardTelephoneNumbersMemory[v3];
}
else
{
v0 = &OnboardTelephoneNumbersMemory[35 * OnboardTelephoneNumbersMemoryFreeList];
OnboardTelephoneNumbersMemoryFreeList = *v0;
}
OnboardTelephoneNumbers_Init(v0);
return v1;
}

canonical_decompiled_code:
__int64 func8()
{
__int64 *v0; // r8
__int64 v1; // r8
__int64 v3; // r8

if ( OnboardTelephoneNumbersMemoryFreeList == -1 )
{
if ( (unsigned __int64)OnboardTelephoneNumbersMemoryTop > 7 )
return 0LL;
v3 = 35 * OnboardTelephoneNumbersMemoryTop++;
v0 = &OnboardTelephoneNumbersMemory[v3];
}
else
{
v0 = &OnboardTelephoneNumbersMemory[35 * OnboardTelephoneNumbersMemoryFreeList];
OnboardTelephoneNumbersMemoryFreeList = *v0;
}
func2(v0);
return v1;
}

original_code:
OnboardTelephoneNumbers* OnboardTelephoneNumbers_New(void)
{
    OnboardTelephoneNumbers* ptr;
    if (OnboardTelephoneNumbersMemoryFreeList != (-1))
    {
        ptr = &OnboardTelephoneNumbersMemory[OnboardTelephoneNumbersMemoryFreeList];
        OnboardTelephoneNumbersMemoryFreeList = OnboardTelephoneNumbersMemory[OnboardTelephoneNumbersMemoryFreeList].header.NID_PACKET;
    }
    else if (OnboardTelephoneNumbersMemoryTop < 8)
    {
        ptr = &OnboardTelephoneNumbersMemory[OnboardTelephoneNumbersMemoryTop];
        OnboardTelephoneNumbersMemoryTop += 1;
    }
    else
    {
        return 0;
    }
    OnboardTelephoneNumbers_Init(ptr);
    return ptr;
}

canonical_original_code:
struct OnboardTelephoneNumbers *OnboardTelephoneNumbers_New()
{
    struct OnboardTelephoneNumbers *ptr;
    if (OnboardTelephoneNumbersMemoryFreeList != (-1))
    {
        ptr = &OnboardTelephoneNumbersMemory[OnboardTelephoneNumbersMemoryFreeList];
        OnboardTelephoneNumbersMemoryFreeList = OnboardTelephoneNumbersMemory[OnboardTelephoneNumbersMemoryFreeList].header.NID_PACKET;
    }
    else if (OnboardTelephoneNumbersMemoryTop < 8)
    {
        ptr = &OnboardTelephoneNumbersMemory[OnboardTelephoneNumbersMemoryTop];
        OnboardTelephoneNumbersMemoryTop += 1;
    }
    else
    {
        return 0;
    }
    OnboardTelephoneNumbers_Init(ptr);
    return ptr;
}

variable_types: struct OnboardTelephoneNumbers { struct PacketHeader { unsigned long NID_PACKET; unsigned long list; } header; unsigned long L_PACKET; unsigned long N_ITER_1; struct OnboardTelephoneNumbers_1 { unsigned long NID_RADIO; } sub_1[31]; } *

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


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

*a1 = OnboardTelephoneNumbersMemoryFreeList;
result = 0xAF8AF8AF8AF8AF8BLL;
OnboardTelephoneNumbersMemoryFreeList = 0xAF8AF8AF8AF8AF8BLL * (a1 - OnboardTelephoneNumbersMemory);
return result;
}

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

*a1 = OnboardTelephoneNumbersMemoryFreeList;
result = 0xAF8AF8AF8AF8AF8BLL;
OnboardTelephoneNumbersMemoryFreeList = 0xAF8AF8AF8AF8AF8BLL * (a1 - OnboardTelephoneNumbersMemory);
return result;
}

original_code:
void OnboardTelephoneNumbers_Delete(OnboardTelephoneNumbers* ptr)
{
    ptr->header.NID_PACKET = OnboardTelephoneNumbersMemoryFreeList;
    OnboardTelephoneNumbersMemoryFreeList = ptr - OnboardTelephoneNumbersMemory;
}

canonical_original_code:
void OnboardTelephoneNumbers_Delete(struct OnboardTelephoneNumbers *ptr)
{
    ptr->header.NID_PACKET = OnboardTelephoneNumbersMemoryFreeList;
    OnboardTelephoneNumbersMemoryFreeList = ptr - OnboardTelephoneNumbersMemory;
}

return_type: void

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

user_defined_types: struct OnboardTelephoneNumbers_1 { unsigned long NID_RADIO; }


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: struct PacketHeader { unsigned long NID_PACKET; unsigned long list; } *

variable_types:
b
struct PacketHeader *

return_type: int


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

result = PacketHeader_Equal(a1, a2);
if ( result )
{
result = 0LL;
if ( a1[2] == a2[2] && a1[3] == a2[3] && a1[4] == a2[4] && a1[5] == a2[5] && a1[6] == a2[6] )
result = a1[7] == a2[7];
}
return result;
}

original_code:
static inline int AdhesionFactor_Equal(const AdhesionFactor* a, const AdhesionFactor* b)
{
    int status = PacketHeader_Equal(&a->header, &b->header);
    status = status && (a->Q_DIR == b->Q_DIR);
    status = status && (a->L_PACKET == b->L_PACKET);
    status = status && (a->Q_SCALE == b->Q_SCALE);
    status = status && (a->D_ADHESION == b->D_ADHESION);
    status = status && (a->L_ADHESION == b->L_ADHESION);
    status = status && (a->M_ADHESION == b->M_ADHESION);
    return status;
}

canonical_original_code:
static inline int AdhesionFactor_Equal(struct AdhesionFactor *a, struct AdhesionFactor *b)
{
    int status = PacketHeader_Equal(&a->header, &b->header);
    status = status && (a->Q_DIR == b->Q_DIR);
    status = status && (a->L_PACKET == b->L_PACKET);
    status = status && (a->Q_SCALE == b->Q_SCALE);
    status = status && (a->D_ADHESION == b->D_ADHESION);
    status = status && (a->L_ADHESION == b->L_ADHESION);
    status = status && (a->M_ADHESION == b->M_ADHESION);
    return status;
}

variable_types: struct AdhesionFactor { struct PacketHeader { unsigned long NID_PACKET; unsigned long list; } 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; } *

variable_types:
b
struct AdhesionFactor *

variable_types: status int

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; }


decompiled_code:
int AdhesionFactor_Tests()
{
__int64 *v0; // rbp
_QWORD *v1; // r14
_QWORD *v2; // r12
_QWORD *v3; // r13
_QWORD *v4; // rbp
_QWORD *v5; // r12
_QWORD *v6; // rbp
_QWORD *v7; // rax
__int64 v9[8]; // [rsp+0h] [rbp-A8h] BYREF
_QWORD v10[13]; // [rsp+40h] [rbp-68h] BYREF

puts("\nstart AdhesionFactor_Tests");
AdhesionFactor_Init(v9);
AdhesionFactor_Print(v9, stdout);
putchar(10);
AdhesionFactor_Init(v10);
if ( !AdhesionFactor_Equal(v9, v10) )
_assert_fail("AdhesionFactor_Equal(&a, &b)", "AdhesionFactor_Tests.c", 0x25u, "AdhesionFactor_Tests");
if ( !PacketHeader_Equal(v9, v10) )
_assert_fail("PacketHeader_Equal(&a.header, &b.header)", "AdhesionFactor_Tests.c", 0x27u, "AdhesionFactor_Tests");
v10[5] = 2LL;
if ( AdhesionFactor_Equal(v9, v10) )
_assert_fail("!AdhesionFactor_Equal(&a, &b)", "AdhesionFactor_Tests.c", 0x2Au, "AdhesionFactor_Tests");
if ( !PacketHeader_Equal(v9, v10) )
_assert_fail("PacketHeader_Equal(&a.header, &b.header)", "AdhesionFactor_Tests.c", 0x2Cu, "AdhesionFactor_Tests");
v0 = (__int64 *)PacketFactory_TrackToTrain(71LL, 1LL);
AdhesionFactor_Print(v0, stdout);
putchar(10);
if ( !AdhesionFactor_Equal(v9, v0) )
_assert_fail("AdhesionFactor_Equal(&a, p)", "AdhesionFactor_Tests.c", 0x33u, "AdhesionFactor_Tests");
AdhesionFactor_Delete(v0);
v1 = (_QWORD *)AdhesionFactor_New();
AdhesionFactor_Init(v1);
v2 = (_QWORD *)AdhesionFactor_New();
AdhesionFactor_Init(v2);
v3 = (_QWORD *)AdhesionFactor_New();
AdhesionFactor_Init(v3);
v4 = (_QWORD *)AdhesionFactor_New();
AdhesionFactor_Init(v4);
AdhesionFactor_Delete(v2);
AdhesionFactor_Delete(v4);
v5 = (_QWORD *)AdhesionFactor_New();
AdhesionFactor_Init(v5);
v6 = (_QWORD *)AdhesionFactor_New();
AdhesionFactor_Init(v6);
v7 = (_QWORD *)AdhesionFactor_New();
AdhesionFactor_Init(v7);
AdhesionFactor_Delete(v1);
AdhesionFactor_Delete(v3);
AdhesionFactor_Delete(v5);
AdhesionFactor_Delete(v6);
return puts("end AdhesionFactor_Test");
}

canonical_decompiled_code:
int func5()
{
__int64 *v0; // rbp
_QWORD *v1; // r14
_QWORD *v2; // r12
_QWORD *v3; // r13
_QWORD *v4; // rbp
_QWORD *v5; // r12
_QWORD *v6; // rbp
_QWORD *v7; // rax
__int64 v9[8]; // [rsp+0h] [rbp-A8h] BYREF
_QWORD v10[13]; // [rsp+40h] [rbp-68h] BYREF

puts("\nstart AdhesionFactor_Tests");
func1(v9);
func4(v9, stdout);
putchar(10);
func1(v10);
if ( !func2(v9, v10) )
_assert_fail("AdhesionFactor_Equal(&a, &b)", "AdhesionFactor_Tests.c", 0x25u, "AdhesionFactor_Tests");
if ( !func0(v9, v10) )
_assert_fail("PacketHeader_Equal(&a.header, &b.header)", "AdhesionFactor_Tests.c", 0x27u, "AdhesionFactor_Tests");
v10[5] = 2LL;
if ( func2(v9, v10) )
_assert_fail("!AdhesionFactor_Equal(&a, &b)", "AdhesionFactor_Tests.c", 0x2Au, "AdhesionFactor_Tests");
if ( !func0(v9, v10) )
_assert_fail("PacketHeader_Equal(&a.header, &b.header)", "AdhesionFactor_Tests.c", 0x2Cu, "AdhesionFactor_Tests");
v0 = (__int64 *)PacketFactory_TrackToTrain(71LL, 1LL);
func4(v0, stdout);
putchar(10);
if ( !func2(v9, v0) )
_assert_fail("AdhesionFactor_Equal(&a, p)", "AdhesionFactor_Tests.c", 0x33u, "AdhesionFactor_Tests");
AdhesionFactor_Delete(v0);
v1 = (_QWORD *)AdhesionFactor_New();
func1(v1);
v2 = (_QWORD *)AdhesionFactor_New();
func1(v2);
v3 = (_QWORD *)AdhesionFactor_New();
func1(v3);
v4 = (_QWORD *)AdhesionFactor_New();
func1(v4);
AdhesionFactor_Delete(v2);
AdhesionFactor_Delete(v4);
v5 = (_QWORD *)AdhesionFactor_New();
func1(v5);
v6 = (_QWORD *)AdhesionFactor_New();
func1(v6);
v7 = (_QWORD *)AdhesionFactor_New();
func1(v7);
AdhesionFactor_Delete(v1);
AdhesionFactor_Delete(v3);
AdhesionFactor_Delete(v5);
AdhesionFactor_Delete(v6);
return puts("end AdhesionFactor_Test");
}

original_code:
void AdhesionFactor_Tests(void)
{
    printf("\nstart AdhesionFactor_Tests\n");
    AdhesionFactor a;
    AdhesionFactor_Init(&a);
    AdhesionFactor_Print(&a, stdout);
    printf("\n");
    AdhesionFactor b;
    AdhesionFactor_Init(&b);
    ((AdhesionFactor_Equal(&a, &b)) ? (void) (0) : __assert_fail ("AdhesionFactor_Equal(&a, &b)", "AdhesionFactor_Tests.c", 37, __extension__ __PRETTY_FUNCTION__));
    ((PacketHeader_Equal(&a.header, &b.header)) ? (void) (0) : __assert_fail ("PacketHeader_Equal(&a.header, &b.header)", "AdhesionFactor_Tests.c", 39, __extension__ __PRETTY_FUNCTION__));
    b.D_ADHESION = 2;
    ((!AdhesionFactor_Equal(&a, &b)) ? (void) (0) : __assert_fail ("!AdhesionFactor_Equal(&a, &b)", "AdhesionFactor_Tests.c", 42, __extension__ __PRETTY_FUNCTION__));
    ((PacketHeader_Equal(&a.header, &b.header)) ? (void) (0) : __assert_fail ("PacketHeader_Equal(&a.header, &b.header)", "AdhesionFactor_Tests.c", 44, __extension__ __PRETTY_FUNCTION__));
    PacketHeader header = {71, 1};
    PacketHeader* base = PacketFactory_TrackToTrain(header);
    AdhesionFactor* p = (AdhesionFactor*)(base);
    AdhesionFactor_Print(p, stdout);
    printf("\n");
    ((AdhesionFactor_Equal(&a, p)) ? (void) (0) : __assert_fail ("AdhesionFactor_Equal(&a, p)", "AdhesionFactor_Tests.c", 51, __extension__ __PRETTY_FUNCTION__));
    AdhesionFactor_Delete(p);
    {
        AdhesionFactor* p = AdhesionFactor_New();
        AdhesionFactor_Init(p);
        AdhesionFactor* q = AdhesionFactor_New();
        AdhesionFactor_Init(q);
        AdhesionFactor* r = AdhesionFactor_New();
        AdhesionFactor_Init(r);
        AdhesionFactor* s = AdhesionFactor_New();
        AdhesionFactor_Init(s);
        AdhesionFactor_Delete(q);
        AdhesionFactor_Delete(s);
        AdhesionFactor* t = AdhesionFactor_New();
        AdhesionFactor_Init(t);
        AdhesionFactor* u = AdhesionFactor_New();
        AdhesionFactor_Init(u);
        AdhesionFactor* v = AdhesionFactor_New();
        AdhesionFactor_Init(v);
 AdhesionFactor_Delete(p);
 AdhesionFactor_Delete(r);
 AdhesionFactor_Delete(t);
 AdhesionFactor_Delete(u);
    }
    printf("end AdhesionFactor_Test\n");
}

canonical_original_code:
void AdhesionFactor_Tests()
{
    printf("\nstart AdhesionFactor_Tests\n");
    struct AdhesionFactor a;
    AdhesionFactor_Init(&a);
    AdhesionFactor_Print(&a, stdout);
    printf("\n");
    struct AdhesionFactor b;
    AdhesionFactor_Init(&b);
    ((AdhesionFactor_Equal(&a, &b)) ? (void) (0) : __assert_fail ("AdhesionFactor_Equal(&a, &b)", "AdhesionFactor_Tests.c", 37, __extension__ __PRETTY_FUNCTION__));
    ((PacketHeader_Equal(&a.header, &b.header)) ? (void) (0) : __assert_fail ("PacketHeader_Equal(&a.header, &b.header)", "AdhesionFactor_Tests.c", 39, __extension__ __PRETTY_FUNCTION__));
    b.D_ADHESION = 2;
    ((!AdhesionFactor_Equal(&a, &b)) ? (void) (0) : __assert_fail ("!AdhesionFactor_Equal(&a, &b)", "AdhesionFactor_Tests.c", 42, __extension__ __PRETTY_FUNCTION__));
    ((PacketHeader_Equal(&a.header, &b.header)) ? (void) (0) : __assert_fail ("PacketHeader_Equal(&a.header, &b.header)", "AdhesionFactor_Tests.c", 44, __extension__ __PRETTY_FUNCTION__));
    struct PacketHeader header = {71, 1};
    struct PacketHeader *base = PacketFactory_TrackToTrain(header);
    struct AdhesionFactor *p = (AdhesionFactor*)(base);
    AdhesionFactor_Print(p, stdout);
    printf("\n");
    ((AdhesionFactor_Equal(&a, p)) ? (void) (0) : __assert_fail ("AdhesionFactor_Equal(&a, p)", "AdhesionFactor_Tests.c", 51, __extension__ __PRETTY_FUNCTION__));
    AdhesionFactor_Delete(p);
    {
        struct AdhesionFactor *p = AdhesionFactor_New();
        AdhesionFactor_Init(p);
        struct AdhesionFactor *q = AdhesionFactor_New();
        AdhesionFactor_Init(q);
        struct AdhesionFactor *r = AdhesionFactor_New();
        AdhesionFactor_Init(r);
        struct AdhesionFactor *s = AdhesionFactor_New();
        AdhesionFactor_Init(s);
        AdhesionFactor_Delete(q);
        AdhesionFactor_Delete(s);
        struct AdhesionFactor *t = AdhesionFactor_New();
        AdhesionFactor_Init(t);
        struct AdhesionFactor *u = AdhesionFactor_New();
        AdhesionFactor_Init(u);
        struct AdhesionFactor *v = AdhesionFactor_New();
        AdhesionFactor_Init(v);
 AdhesionFactor_Delete(p);
 AdhesionFactor_Delete(r);
 AdhesionFactor_Delete(t);
 AdhesionFactor_Delete(u);
    }
    printf("end AdhesionFactor_Test\n");
}

variable_types: struct AdhesionFactor { struct PacketHeader { unsigned long NID_PACKET; unsigned long list; } 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; }


decompiled_code:
_BOOL8 __fastcall Level23TransitionInformation_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 Level23TransitionInformation_Equal(const Level23TransitionInformation* a, const Level23TransitionInformation* b)
{
    int status = PacketHeader_Equal(&a->header, &b->header);
    status = status && (a->L_PACKET == b->L_PACKET);
    status = status && (a->NID_LTRBG == b->NID_LTRBG);
    return status;
}

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

variable_types: struct Level23TransitionInformation { struct PacketHeader { unsigned long NID_PACKET; unsigned long list; } header; unsigned long L_PACKET; unsigned long NID_LTRBG; } *

variable_types:
b
struct Level23TransitionInformation *

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


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

puts("\nstart Level23TransitionInformation_Tests");
Level23TransitionInformation_Init(v2);
Level23TransitionInformation_Print(v2, stdout);
putchar(10);
Level23TransitionInformation_Init(v3);
if ( !Level23TransitionInformation_Equal(v2, v3) )
_assert_fail(
"Level23TransitionInformation_Equal(&a, &b)",
"Level23TransitionInformation_Tests.c",
0x25u,
"Level23TransitionInformation_Tests");
v3[3] = 17LL;
if ( Level23TransitionInformation_Equal(v2, v3) )
_assert_fail(
"!Level23TransitionInformation_Equal(&a, &b)",
"Level23TransitionInformation_Tests.c",
0x28u,
"Level23TransitionInformation_Tests");
v0 = (__int64 *)PacketFactory_TrainToTrack(9LL, 0LL);
Level23TransitionInformation_Print(v0, stdout);
putchar(10);
if ( !Level23TransitionInformation_Equal(v2, v0) )
_assert_fail(
"Level23TransitionInformation_Equal(&a, p)",
"Level23TransitionInformation_Tests.c",
0x2Fu,
"Level23TransitionInformation_Tests");
Level23TransitionInformation_Delete(v0);
return puts("end Level23TransitionInformation_Tests");
}

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

puts("\nstart Level23TransitionInformation_Tests");
func1(v2);
func4(v2, stdout);
putchar(10);
func1(v3);
if ( !func2(v2, v3) )
_assert_fail(
"Level23TransitionInformation_Equal(&a, &b)",
"Level23TransitionInformation_Tests.c",
0x25u,
"Level23TransitionInformation_Tests");
v3[3] = 17LL;
if ( func2(v2, v3) )
_assert_fail(
"!Level23TransitionInformation_Equal(&a, &b)",
"Level23TransitionInformation_Tests.c",
0x28u,
"Level23TransitionInformation_Tests");
v0 = (__int64 *)PacketFactory_TrainToTrack(9LL, 0LL);
func4(v0, stdout);
putchar(10);
if ( !func2(v2, v0) )
_assert_fail(
"Level23TransitionInformation_Equal(&a, p)",
"Level23TransitionInformation_Tests.c",
0x2Fu,
"Level23TransitionInformation_Tests");
Level23TransitionInformation_Delete(v0);
return puts("end Level23TransitionInformation_Tests");
}

original_code:
void Level23TransitionInformation_Tests(void)
{
    printf("\nstart Level23TransitionInformation_Tests\n");
    Level23TransitionInformation a;
    Level23TransitionInformation_Init(&a);
    Level23TransitionInformation_Print(&a, stdout);
    printf("\n");
    Level23TransitionInformation b;
    Level23TransitionInformation_Init(&b);
    ((Level23TransitionInformation_Equal(&a, &b)) ? (void) (0) : __assert_fail ("Level23TransitionInformation_Equal(&a, &b)", "Level23TransitionInformation_Tests.c", 37, __extension__ __PRETTY_FUNCTION__));
    b.NID_LTRBG = 17;
    ((!Level23TransitionInformation_Equal(&a, &b)) ? (void) (0) : __assert_fail ("!Level23TransitionInformation_Equal(&a, &b)", "Level23TransitionInformation_Tests.c", 40, __extension__ __PRETTY_FUNCTION__));
    PacketHeader header = {9, 0};
    PacketHeader* base = PacketFactory_TrainToTrack(header);
    Level23TransitionInformation* p = (Level23TransitionInformation*)(base);
    Level23TransitionInformation_Print(p, stdout);
    printf("\n");
    ((Level23TransitionInformation_Equal(&a, p)) ? (void) (0) : __assert_fail ("Level23TransitionInformation_Equal(&a, p)", "Level23TransitionInformation_Tests.c", 47, __extension__ __PRETTY_FUNCTION__));
    Level23TransitionInformation_Delete(p);
    printf("end Level23TransitionInformation_Tests\n");
}

canonical_original_code:
void Level23TransitionInformation_Tests()
{
    printf("\nstart Level23TransitionInformation_Tests\n");
    struct Level23TransitionInformation a;
    Level23TransitionInformation_Init(&a);
    Level23TransitionInformation_Print(&a, stdout);
    printf("\n");
    struct Level23TransitionInformation b;
    Level23TransitionInformation_Init(&b);
    ((Level23TransitionInformation_Equal(&a, &b)) ? (void) (0) : __assert_fail ("Level23TransitionInformation_Equal(&a, &b)", "Level23TransitionInformation_Tests.c", 37, __extension__ __PRETTY_FUNCTION__));
    b.NID_LTRBG = 17;
    ((!Level23TransitionInformation_Equal(&a, &b)) ? (void) (0) : __assert_fail ("!Level23TransitionInformation_Equal(&a, &b)", "Level23TransitionInformation_Tests.c", 40, __extension__ __PRETTY_FUNCTION__));
    struct PacketHeader header = {9, 0};
    struct PacketHeader *base = PacketFactory_TrainToTrack(header);
    struct Level23TransitionInformation *p = (Level23TransitionInformation*)(base);
    Level23TransitionInformation_Print(p, stdout);
    printf("\n");
    ((Level23TransitionInformation_Equal(&a, p)) ? (void) (0) : __assert_fail ("Level23TransitionInformation_Equal(&a, p)", "Level23TransitionInformation_Tests.c", 47, __extension__ __PRETTY_FUNCTION__));
    Level23TransitionInformation_Delete(p);
    printf("end Level23TransitionInformation_Tests\n");
}

variable_types: struct Level23TransitionInformation { struct PacketHeader { unsigned long NID_PACKET; unsigned long list; } header; unsigned long L_PACKET; unsigned long NID_LTRBG; }


decompiled_code:
_BOOL8 __fastcall UpperBitsNotSet64(unsigned __int64 a1, char a2)
{
return 1LL << a2 > a1;
}

canonical_decompiled_code:
_BOOL8 __fastcall func0(unsigned __int64 a1, char a2)
{
return 1LL << a2 > a1;
}

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:
_BOOL8 __fastcall TrainRunningNumberFromRBC_UpperBitsNotSet(__int64 a1)
{
_BOOL8 result; // rax
__int64 v2; // rdx
__int64 v3; // rdx

result = UpperBitsNotSet64(*(_QWORD *)(a1 + 16), 2);
if ( result )
{
result = UpperBitsNotSet64(*(_QWORD *)(v2 + 24), 13);
if ( result )
result = UpperBitsNotSet64(*(_QWORD *)(v3 + 32), 32);
}
return result;
}

canonical_decompiled_code:
_BOOL8 __fastcall func2(__int64 a1)
{
_BOOL8 result; // rax
__int64 v2; // rdx
__int64 v3; // rdx

result = func0(*(_QWORD *)(a1 + 16), 2);
if ( result )
{
result = func0(*(_QWORD *)(v2 + 24), 13);
if ( result )
result = func0(*(_QWORD *)(v3 + 32), 32);
}
return result;
}

original_code:
int TrainRunningNumberFromRBC_UpperBitsNotSet(const TrainRunningNumberFromRBC* p)
{
    int status = 1;
    status = status && UpperBitsNotSet64(p->Q_DIR, 2) ;
    status = status && UpperBitsNotSet64(p->L_PACKET, 13);
    status = status && UpperBitsNotSet64(p->NID_OPERATIONAL, 32);
    if (status)
    {
        return 1;
    }
    else
    {
        return 0;
    }
}

canonical_original_code:
int TrainRunningNumberFromRBC_UpperBitsNotSet(struct TrainRunningNumberFromRBC *p)
{
    int status = 1;
    status = status && UpperBitsNotSet64(p->Q_DIR, 2) ;
    status = status && UpperBitsNotSet64(p->L_PACKET, 13);
    status = status && UpperBitsNotSet64(p->NID_OPERATIONAL, 32);
    if (status)
    {
        return 1;
    }
    else
    {
        return 0;
    }
}

variable_types: struct TrainRunningNumberFromRBC { struct PacketHeader { unsigned long NID_PACKET; unsigned long list; } header; unsigned long Q_DIR; unsigned long L_PACKET; unsigned long NID_OPERATIONAL; } *

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


decompiled_code:
__int64 __fastcall TrainRunningNumberFromRBC_EncodeBit(_QWORD *a1, __int64 a2)
{
if ( !(unsigned int)Bitstream_Normal(a2, 47LL) )
return 0xFFFFFFFFLL;
if ( !TrainRunningNumberFromRBC_UpperBitsNotSet((__int64)a1) )
return 4294967294LL;
Bitstream_Write(a2, 2LL, a1[2]);
Bitstream_Write(a2, 13LL, a1[3]);
Bitstream_Write(a2, 32LL, a1[4]);
return 1LL;
}

canonical_decompiled_code:
__int64 __fastcall func3(_QWORD *a1, __int64 a2)
{
if ( !(unsigned int)Bitstream_Normal(a2, 47LL) )
return 0xFFFFFFFFLL;
if ( !func2((__int64)a1) )
return 4294967294LL;
Bitstream_Write(a2, 2LL, a1[2]);
Bitstream_Write(a2, 13LL, a1[3]);
Bitstream_Write(a2, 32LL, a1[4]);
return 1LL;
}

original_code:
int TrainRunningNumberFromRBC_EncodeBit(const TrainRunningNumberFromRBC* p, Bitstream* stream)
{
    if (Bitstream_Normal(stream, 47))
    {
        if (TrainRunningNumberFromRBC_UpperBitsNotSet(p))
        {
            Bitstream_Write(stream, 2, p->Q_DIR);
            Bitstream_Write(stream, 13, p->L_PACKET);
            Bitstream_Write(stream, 32, p->NID_OPERATIONAL);
            return 1;
        }
        else
        {
            return -2;
        }
    }
    else
    {
        return -1;
    }
}

canonical_original_code:
int TrainRunningNumberFromRBC_EncodeBit(struct TrainRunningNumberFromRBC *p, struct Bitstream *stream)
{
    if (Bitstream_Normal(stream, 47))
    {
        if (TrainRunningNumberFromRBC_UpperBitsNotSet(p))
        {
            Bitstream_Write(stream, 2, p->Q_DIR);
            Bitstream_Write(stream, 13, p->L_PACKET);
            Bitstream_Write(stream, 32, p->NID_OPERATIONAL);
            return 1;
        }
        else
        {
            return -2;
        }
    }
    else
    {
        return -1;
    }
}

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


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

result = Bitstream_Normal(a2, 47LL);
if ( (_DWORD)result )
{
a1[2] = Bitstream_Read(a2, 2LL);
a1[3] = Bitstream_Read(a2, 13LL);
a1[4] = Bitstream_Read(a2, 32LL);
result = 1LL;
}
return result;
}

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

result = Bitstream_Normal(a2, 47LL);
if ( (_DWORD)result )
{
a1[2] = Bitstream_Read(a2, 2LL);
a1[3] = Bitstream_Read(a2, 13LL);
a1[4] = Bitstream_Read(a2, 32LL);
result = 1LL;
}
return result;
}

original_code:
int TrainRunningNumberFromRBC_DecodeBit(TrainRunningNumberFromRBC* p, Bitstream* stream)
{
    if (Bitstream_Normal(stream, 47))
    {
        {
            p->Q_DIR = Bitstream_Read(stream, 2);
        }
        {
            p->L_PACKET = Bitstream_Read(stream, 13);
        }
        {
            p->NID_OPERATIONAL = Bitstream_Read(stream, 32);
        }
        return 1;
    }
    else
    {
        return 0;
    }
}

canonical_original_code:
int TrainRunningNumberFromRBC_DecodeBit(struct TrainRunningNumberFromRBC *p, struct Bitstream *stream)
{
    if (Bitstream_Normal(stream, 47))
    {
        {
            p->Q_DIR = Bitstream_Read(stream, 2);
        }
        {
            p->L_PACKET = Bitstream_Read(stream, 13);
        }
        {
            p->NID_OPERATIONAL = Bitstream_Read(stream, 32);
        }
        return 1;
    }
    else
    {
        return 0;
    }
}

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


original_code:
int TrainRunningNumberFromRBC_EncodeInt(const TrainRunningNumberFromRBC* p, Metadata* data, kcg_int* stream)
{
    data->nid_packet = 140;
    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->NID_OPERATIONAL;
    data->endAddress = startAddress-1;
    return 1;
}

canonical_original_code:
int TrainRunningNumberFromRBC_EncodeInt(struct TrainRunningNumberFromRBC *p, struct MetadataElement_T_Common_Types_Pkg *data, int *stream)
{
    data->nid_packet = 140;
    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->NID_OPERATIONAL;
    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: startAddress int


original_code:
int TrainRunningNumberFromRBC_DecodeInt(TrainRunningNumberFromRBC* p, const Metadata* data, const kcg_int* stream)
{
    if(data->nid_packet != 140)
    {
         return 0;
    }
    kcg_int startAddress = data->startAddress;
    p->header.NID_PACKET = stream[startAddress++];
    p->Q_DIR = stream[startAddress++];
    p->L_PACKET = stream[startAddress++];
    p->NID_OPERATIONAL = stream[startAddress++];
    if(startAddress-1 != data->endAddress)
    {
         return 0;
    }
    return 1;
}

canonical_original_code:
int TrainRunningNumberFromRBC_DecodeInt(struct TrainRunningNumberFromRBC *p, struct MetadataElement_T_Common_Types_Pkg *data, int *stream)
{
    if(data->nid_packet != 140)
    {
         return 0;
    }
    int startAddress = data->startAddress;
    p->header.NID_PACKET = stream[startAddress++];
    p->Q_DIR = stream[startAddress++];
    p->L_PACKET = stream[startAddress++];
    p->NID_OPERATIONAL = stream[startAddress++];
    if(startAddress-1 != data->endAddress)
    {
         return 0;
    }
    return 1;
}

variable_types:
stream
int *

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 TrainRunningNumberFromRBC_New()
{
__int64 *v0; // r8
__int64 v1; // r8
__int64 v3; // rdx

if ( TrainRunningNumberFromRBCMemoryFreeList == -1 )
{
if ( (unsigned __int64)TrainRunningNumberFromRBCMemoryTop > 7 )
return 0LL;
v3 = 5 * TrainRunningNumberFromRBCMemoryTop++;
v0 = &TrainRunningNumberFromRBCMemory[v3];
}
else
{
v0 = &TrainRunningNumberFromRBCMemory[5 * TrainRunningNumberFromRBCMemoryFreeList];
TrainRunningNumberFromRBCMemoryFreeList = *v0;
}
TrainRunningNumberFromRBC_Init(v0);
return v1;
}

canonical_decompiled_code:
__int64 func7()
{
__int64 *v0; // r8
__int64 v1; // r8
__int64 v3; // rdx

if ( TrainRunningNumberFromRBCMemoryFreeList == -1 )
{
if ( (unsigned __int64)TrainRunningNumberFromRBCMemoryTop > 7 )
return 0LL;
v3 = 5 * TrainRunningNumberFromRBCMemoryTop++;
v0 = &TrainRunningNumberFromRBCMemory[v3];
}
else
{
v0 = &TrainRunningNumberFromRBCMemory[5 * TrainRunningNumberFromRBCMemoryFreeList];
TrainRunningNumberFromRBCMemoryFreeList = *v0;
}
func1(v0);
return v1;
}

original_code:
TrainRunningNumberFromRBC* TrainRunningNumberFromRBC_New(void)
{
    TrainRunningNumberFromRBC* ptr;
    if (TrainRunningNumberFromRBCMemoryFreeList != (-1))
    {
        ptr = &TrainRunningNumberFromRBCMemory[TrainRunningNumberFromRBCMemoryFreeList];
        TrainRunningNumberFromRBCMemoryFreeList = TrainRunningNumberFromRBCMemory[TrainRunningNumberFromRBCMemoryFreeList].header.NID_PACKET;
    }
    else if (TrainRunningNumberFromRBCMemoryTop < 8)
    {
        ptr = &TrainRunningNumberFromRBCMemory[TrainRunningNumberFromRBCMemoryTop];
        TrainRunningNumberFromRBCMemoryTop += 1;
    }
    else
    {
        return 0;
    }
    TrainRunningNumberFromRBC_Init(ptr);
    return ptr;
}

canonical_original_code:
struct TrainRunningNumberFromRBC *TrainRunningNumberFromRBC_New()
{
    struct TrainRunningNumberFromRBC *ptr;
    if (TrainRunningNumberFromRBCMemoryFreeList != (-1))
    {
        ptr = &TrainRunningNumberFromRBCMemory[TrainRunningNumberFromRBCMemoryFreeList];
        TrainRunningNumberFromRBCMemoryFreeList = TrainRunningNumberFromRBCMemory[TrainRunningNumberFromRBCMemoryFreeList].header.NID_PACKET;
    }
    else if (TrainRunningNumberFromRBCMemoryTop < 8)
    {
        ptr = &TrainRunningNumberFromRBCMemory[TrainRunningNumberFromRBCMemoryTop];
        TrainRunningNumberFromRBCMemoryTop += 1;
    }
    else
    {
        return 0;
    }
    TrainRunningNumberFromRBC_Init(ptr);
    return ptr;
}

return_type: struct TrainRunningNumberFromRBC { struct PacketHeader { unsigned long NID_PACKET; unsigned long list; } header; unsigned long Q_DIR; unsigned long L_PACKET; unsigned long NID_OPERATIONAL; } *


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

*a1 = TrainRunningNumberFromRBCMemoryFreeList;
result = 0xCCCCCCCCCCCCCCCDLL;
TrainRunningNumberFromRBCMemoryFreeList = 0xCCCCCCCCCCCCCCCDLL * (a1 - TrainRunningNumberFromRBCMemory);
return result;
}

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

*a1 = TrainRunningNumberFromRBCMemoryFreeList;
result = 0xCCCCCCCCCCCCCCCDLL;
TrainRunningNumberFromRBCMemoryFreeList = 0xCCCCCCCCCCCCCCCDLL * (a1 - TrainRunningNumberFromRBCMemory);
return result;
}

original_code:
void TrainRunningNumberFromRBC_Delete(TrainRunningNumberFromRBC* ptr)
{
    ptr->header.NID_PACKET = TrainRunningNumberFromRBCMemoryFreeList;
    TrainRunningNumberFromRBCMemoryFreeList = ptr - TrainRunningNumberFromRBCMemory;
}

canonical_original_code:
void TrainRunningNumberFromRBC_Delete(struct TrainRunningNumberFromRBC *ptr)
{
    ptr->header.NID_PACKET = TrainRunningNumberFromRBCMemoryFreeList;
    TrainRunningNumberFromRBCMemoryFreeList = ptr - TrainRunningNumberFromRBCMemory;
}


decompiled_code:
__int64 UpperBitsNotSet64()
{
return 1LL;
}

canonical_decompiled_code:
__int64 func0()
{
return 1LL;
}


decompiled_code:
__int64 __fastcall Onboard_telephone_numbers_Core_1_Encode_Bit(__int64 a1, _QWORD *a2)
{
if ( !(unsigned int)Bitstream_Normal(a1, 64LL) )
return 0xFFFFFFFFLL;
if ( !Onboard_telephone_numbers_Core_1_UpperBitsNotSet(a2) )
return 4294967294LL;
Bitstream_Write(a1, 64LL, *a2);
return 1LL;
}

canonical_decompiled_code:
__int64 __fastcall func2(__int64 a1, _QWORD *a2)
{
if ( !(unsigned int)Bitstream_Normal(a1, 64LL) )
return 0xFFFFFFFFLL;
if ( !func1(a2) )
return 4294967294LL;
Bitstream_Write(a1, 64LL, *a2);
return 1LL;
}

original_code:
int Onboard_telephone_numbers_Core_1_Encode_Bit(Bitstream* stream, const Onboard_telephone_numbers_Core_1* p)
{
    if (Bitstream_Normal(stream, 64))
    {
        if (Onboard_telephone_numbers_Core_1_UpperBitsNotSet(p))
        {
            Bitstream_Write(stream, 64, p->NID_RADIO);
            return 1;
        }
        else
        {
            return -2;
        }
    }
    else
    {
        return -1;
    }
}

canonical_original_code:
int Onboard_telephone_numbers_Core_1_Encode_Bit(struct Bitstream *stream, struct Onboard_telephone_numbers_Core_1 *p)
{
    if (Bitstream_Normal(stream, 64))
    {
        if (Onboard_telephone_numbers_Core_1_UpperBitsNotSet(p))
        {
            Bitstream_Write(stream, 64, p->NID_RADIO);
            return 1;
        }
        else
        {
            return -2;
        }
    }
    else
    {
        return -1;
    }
}

variable_types: struct Onboard_telephone_numbers_Core_1 { unsigned long NID_RADIO; } *


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

result = Bitstream_Normal(a1, 64LL);
if ( (_DWORD)result )
{
*a2 = Bitstream_Read(a1, 64LL);
result = 1LL;
}
return result;
}

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

result = Bitstream_Normal(a1, 64LL);
if ( (_DWORD)result )
{
*a2 = Bitstream_Read(a1, 64LL);
result = 1LL;
}
return result;
}

original_code:
int Onboard_telephone_numbers_Core_1_Decode_Bit(Bitstream* stream, Onboard_telephone_numbers_Core_1* p)
{
    if (Bitstream_Normal(stream, 64))
    {
        {
            p->NID_RADIO = Bitstream_Read(stream, 64);
        }
        return 1;
    }
    else
    {
        return 0;
    }
}

canonical_original_code:
int Onboard_telephone_numbers_Core_1_Decode_Bit(struct Bitstream *stream, struct Onboard_telephone_numbers_Core_1 *p)
{
    if (Bitstream_Normal(stream, 64))
    {
        {
            p->NID_RADIO = Bitstream_Read(stream, 64);
        }
        return 1;
    }
    else
    {
        return 0;
    }
}

user_defined_types: struct Onboard_telephone_numbers_Core_1 { unsigned long NID_RADIO; }


decompiled_code:
__int64 __fastcall Onboard_telephone_numbers_Core_1_Encode_Int(__int64 a1, __int64 a2, __int64 *a3)
{
__int64 v3; // rax
__int64 v4; // rdx

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

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

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


decompiled_code:
__int64 __fastcall Onboard_telephone_numbers_Core_1_Decode_Int(__int64 a1, __int64 a2, _QWORD *a3)
{
__int64 v3; // rax

v3 = *(int *)(a1 + 12);
*(_DWORD *)(a1 + 12) = v3 + 1;
*a3 = *(int *)(a2 + 4 * v3);
return 1LL;
}

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

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


decompiled_code:
_BOOL8 __fastcall ListOfBalisesInSRAuthority_1_UpperBitsNotSet(unsigned __int64 *a1)
{
unsigned __int64 v1; // rdi
_BOOL8 result; // rax
__int64 v3; // rdx

v1 = *a1;
result = UpperBitsNotSet64(v1, 1);
if ( result && (v1 != 1 || (result = UpperBitsNotSet64(*(_QWORD *)(v3 + 8), 10))) )
result = UpperBitsNotSet64(*(_QWORD *)(v3 + 16), 14);
return result;
}

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

v1 = *a1;
result = func0(v1, 1);
if ( result && (v1 != 1 || (result = func0(*(_QWORD *)(v3 + 8), 10))) )
result = func0(*(_QWORD *)(v3 + 16), 14);
return result;
}

original_code:
int ListOfBalisesInSRAuthority_1_UpperBitsNotSet(const ListOfBalisesInSRAuthority_1* p)
{
    int status = 1;
    status = status && UpperBitsNotSet64(p->Q_NEWCOUNTRY, 1) ;
    if (p->Q_NEWCOUNTRY == 1)
    {
        status = status && UpperBitsNotSet64(p->NID_C, 10);
    }
    status = status && UpperBitsNotSet64(p->NID_BG, 14);
    if (status)
    {
        return 1;
    }
    else
    {
        return 0;
    }
}

canonical_original_code:
int ListOfBalisesInSRAuthority_1_UpperBitsNotSet(struct ListOfBalisesInSRAuthority_1 *p)
{
    int status = 1;
    status = status && UpperBitsNotSet64(p->Q_NEWCOUNTRY, 1) ;
    if (p->Q_NEWCOUNTRY == 1)
    {
        status = status && UpperBitsNotSet64(p->NID_C, 10);
    }
    status = status && UpperBitsNotSet64(p->NID_BG, 14);
    if (status)
    {
        return 1;
    }
    else
    {
        return 0;
    }
}

variable_types: struct ListOfBalisesInSRAuthority_1 { unsigned long Q_NEWCOUNTRY; unsigned long NID_C; unsigned long NID_BG; } *


decompiled_code:
__int64 __fastcall ListOfBalisesInSRAuthority_1_EncodeBit(unsigned __int64 *a1, __int64 a2)
{
if ( !(unsigned int)Bitstream_Normal(a2, 15LL) )
return 0xFFFFFFFFLL;
if ( !ListOfBalisesInSRAuthority_1_UpperBitsNotSet(a1) )
return 4294967294LL;
Bitstream_Write(a2, 1LL, *a1);
if ( *a1 == 1 )
Bitstream_Write(a2, 10LL, a1[1]);
Bitstream_Write(a2, 14LL, a1[2]);
return 1LL;
}

canonical_decompiled_code:
__int64 __fastcall func2(unsigned __int64 *a1, __int64 a2)
{
if ( !(unsigned int)Bitstream_Normal(a2, 15LL) )
return 0xFFFFFFFFLL;
if ( !func1(a1) )
return 4294967294LL;
Bitstream_Write(a2, 1LL, *a1);
if ( *a1 == 1 )
Bitstream_Write(a2, 10LL, a1[1]);
Bitstream_Write(a2, 14LL, a1[2]);
return 1LL;
}

original_code:
int ListOfBalisesInSRAuthority_1_EncodeBit(const ListOfBalisesInSRAuthority_1* p, Bitstream* stream)
{
    if (Bitstream_Normal(stream, 15))
    {
        if (ListOfBalisesInSRAuthority_1_UpperBitsNotSet(p))
        {
            Bitstream_Write(stream, 1, p->Q_NEWCOUNTRY);
            if (p->Q_NEWCOUNTRY == 1)
            {
                Bitstream_Write(stream, 10, p->NID_C);
            }
            Bitstream_Write(stream, 14, p->NID_BG);
            return 1;
        }
        else
        {
            return -2;
        }
    }
    else
    {
        return -1;
    }
}

canonical_original_code:
int ListOfBalisesInSRAuthority_1_EncodeBit(struct ListOfBalisesInSRAuthority_1 *p, struct Bitstream *stream)
{
    if (Bitstream_Normal(stream, 15))
    {
        if (ListOfBalisesInSRAuthority_1_UpperBitsNotSet(p))
        {
            Bitstream_Write(stream, 1, p->Q_NEWCOUNTRY);
            if (p->Q_NEWCOUNTRY == 1)
            {
                Bitstream_Write(stream, 10, p->NID_C);
            }
            Bitstream_Write(stream, 14, p->NID_BG);
            return 1;
        }
        else
        {
            return -2;
        }
    }
    else
    {
        return -1;
    }
}

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


decompiled_code:
__int64 __fastcall ListOfBalisesInSRAuthority_1_DecodeBit(__int64 *a1, __int64 a2)
{
__int64 result; // rax
__int64 v3; // rax

result = Bitstream_Normal(a2, 15LL);
if ( (_DWORD)result )
{
v3 = Bitstream_Read(a2, 1LL);
*a1 = v3;
if ( v3 == 1 )
a1[1] = Bitstream_Read(a2, 10LL);
a1[2] = Bitstream_Read(a2, 14LL);
result = 1LL;
}
return result;
}

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

result = Bitstream_Normal(a2, 15LL);
if ( (_DWORD)result )
{
v3 = Bitstream_Read(a2, 1LL);
*a1 = v3;
if ( v3 == 1 )
a1[1] = Bitstream_Read(a2, 10LL);
a1[2] = Bitstream_Read(a2, 14LL);
result = 1LL;
}
return result;
}

original_code:
int ListOfBalisesInSRAuthority_1_DecodeBit(ListOfBalisesInSRAuthority_1* p, Bitstream* stream)
{
    if (Bitstream_Normal(stream, 15))
    {
        {
            p->Q_NEWCOUNTRY = Bitstream_Read(stream, 1);
        }
        if (p->Q_NEWCOUNTRY == 1)
        {
            {
                p->NID_C = Bitstream_Read(stream, 10);
            }
        }
        {
            p->NID_BG = Bitstream_Read(stream, 14);
        }
        return 1;
    }
    else
    {
        return 0;
    }
}

canonical_original_code:
int ListOfBalisesInSRAuthority_1_DecodeBit(struct ListOfBalisesInSRAuthority_1 *p, struct Bitstream *stream)
{
    if (Bitstream_Normal(stream, 15))
    {
        {
            p->Q_NEWCOUNTRY = Bitstream_Read(stream, 1);
        }
        if (p->Q_NEWCOUNTRY == 1)
        {
            {
                p->NID_C = Bitstream_Read(stream, 10);
            }
        }
        {
            p->NID_BG = Bitstream_Read(stream, 14);
        }
        return 1;
    }
    else
    {
        return 0;
    }
}


original_code:
int ListOfBalisesInSRAuthority_1_EncodeInt(const ListOfBalisesInSRAuthority_1* p, kcg_int* startAddress, kcg_int* stream)
{
    stream[(*startAddress)++] = p->Q_NEWCOUNTRY;
    stream[(*startAddress)++] = p->NID_C;
    stream[(*startAddress)++] = p->NID_BG;
    return 1;
}

canonical_original_code:
int ListOfBalisesInSRAuthority_1_EncodeInt(struct ListOfBalisesInSRAuthority_1 *p, int *startAddress, int *stream)
{
    stream[(*startAddress)++] = p->Q_NEWCOUNTRY;
    stream[(*startAddress)++] = p->NID_C;
    stream[(*startAddress)++] = p->NID_BG;
    return 1;
}

variable_types:
startAddress
int *


original_code:
int ListOfBalisesInSRAuthority_1_DecodeInt(ListOfBalisesInSRAuthority_1* p, kcg_int* startAddress, const kcg_int* stream)
{
    p->Q_NEWCOUNTRY = stream[(*startAddress)++];
    p->NID_C = stream[(*startAddress)++];
    p->NID_BG = stream[(*startAddress)++];
    return 1;
}

canonical_original_code:
int ListOfBalisesInSRAuthority_1_DecodeInt(struct ListOfBalisesInSRAuthority_1 *p, int *startAddress, int *stream)
{
    p->Q_NEWCOUNTRY = stream[(*startAddress)++];
    p->NID_C = stream[(*startAddress)++];
    p->NID_BG = stream[(*startAddress)++];
    return 1;
}


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;
    }
}


decompiled_code:
_BOOL8 __fastcall ReversingSupervisionInformation_UpperBitsNotSet(__int64 a1)
{
_BOOL8 result; // rax
__int64 v2; // rdx
__int64 v3; // rdx
__int64 v4; // rdx
__int64 v5; // rdx

result = UpperBitsNotSet64(*(_QWORD *)(a1 + 16), 2);
if ( result )
{
result = UpperBitsNotSet64(*(_QWORD *)(v2 + 24), 13);
if ( result )
{
result = UpperBitsNotSet64(*(_QWORD *)(v3 + 32), 2);
if ( result )
{
result = UpperBitsNotSet64(*(_QWORD *)(v4 + 40), 15);
if ( result )
result = UpperBitsNotSet64(*(_QWORD *)(v5 + 48), 7);
}
}
}
return result;
}

canonical_decompiled_code:
_BOOL8 __fastcall func2(__int64 a1)
{
_BOOL8 result; // rax
__int64 v2; // rdx
__int64 v3; // rdx
__int64 v4; // rdx
__int64 v5; // rdx

result = func0(*(_QWORD *)(a1 + 16), 2);
if ( result )
{
result = func0(*(_QWORD *)(v2 + 24), 13);
if ( result )
{
result = func0(*(_QWORD *)(v3 + 32), 2);
if ( result )
{
result = func0(*(_QWORD *)(v4 + 40), 15);
if ( result )
result = func0(*(_QWORD *)(v5 + 48), 7);
}
}
}
return result;
}

original_code:
int ReversingSupervisionInformation_UpperBitsNotSet(const ReversingSupervisionInformation* 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->D_REVERSE, 15);
    status = status && UpperBitsNotSet64(p->V_REVERSE, 7) ;
    if (status)
    {
        return 1;
    }
    else
    {
        return 0;
    }
}

canonical_original_code:
int ReversingSupervisionInformation_UpperBitsNotSet(struct ReversingSupervisionInformation *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->D_REVERSE, 15);
    status = status && UpperBitsNotSet64(p->V_REVERSE, 7) ;
    if (status)
    {
        return 1;
    }
    else
    {
        return 0;
    }
}

variable_types: struct ReversingSupervisionInformation { struct PacketHeader { unsigned long NID_PACKET; unsigned long list; } 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 ReversingSupervisionInformation { struct PacketHeader header; unsigned long Q_DIR; unsigned long L_PACKET; unsigned long Q_SCALE; unsigned long D_REVERSE; unsigned long V_REVERSE; }


decompiled_code:
__int64 __fastcall ReversingSupervisionInformation_EncodeBit(_QWORD *a1, __int64 a2)
{
if ( !(unsigned int)Bitstream_Normal(a2, 39LL) )
return 0xFFFFFFFFLL;
if ( !ReversingSupervisionInformation_UpperBitsNotSet((__int64)a1) )
return 4294967294LL;
Bitstream_Write(a2, 2LL, a1[2]);
Bitstream_Write(a2, 13LL, a1[3]);
Bitstream_Write(a2, 2LL, a1[4]);
Bitstream_Write(a2, 15LL, a1[5]);
Bitstream_Write(a2, 7LL, a1[6]);
return 1LL;
}

canonical_decompiled_code:
__int64 __fastcall func3(_QWORD *a1, __int64 a2)
{
if ( !(unsigned int)Bitstream_Normal(a2, 39LL) )
return 0xFFFFFFFFLL;
if ( !func2((__int64)a1) )
return 4294967294LL;
Bitstream_Write(a2, 2LL, a1[2]);
Bitstream_Write(a2, 13LL, a1[3]);
Bitstream_Write(a2, 2LL, a1[4]);
Bitstream_Write(a2, 15LL, a1[5]);
Bitstream_Write(a2, 7LL, a1[6]);
return 1LL;
}

original_code:
int ReversingSupervisionInformation_EncodeBit(const ReversingSupervisionInformation* p, Bitstream* stream)
{
    if (Bitstream_Normal(stream, 39))
    {
        if (ReversingSupervisionInformation_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, 15, p->D_REVERSE);
            Bitstream_Write(stream, 7, p->V_REVERSE);
            return 1;
        }
        else
        {
            return -2;
        }
    }
    else
    {
        return -1;
    }
}

canonical_original_code:
int ReversingSupervisionInformation_EncodeBit(struct ReversingSupervisionInformation *p, struct Bitstream *stream)
{
    if (Bitstream_Normal(stream, 39))
    {
        if (ReversingSupervisionInformation_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, 15, p->D_REVERSE);
            Bitstream_Write(stream, 7, p->V_REVERSE);
            return 1;
        }
        else
        {
            return -2;
        }
    }
    else
    {
        return -1;
    }
}


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

result = Bitstream_Normal(a2, 39LL);
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, 15LL);
a1[6] = Bitstream_Read(a2, 7LL);
result = 1LL;
}
return result;
}

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

result = Bitstream_Normal(a2, 39LL);
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, 15LL);
a1[6] = Bitstream_Read(a2, 7LL);
result = 1LL;
}
return result;
}

original_code:
int ReversingSupervisionInformation_DecodeBit(ReversingSupervisionInformation* p, Bitstream* stream)
{
    if (Bitstream_Normal(stream, 39))
    {
        {
            p->Q_DIR = Bitstream_Read(stream, 2);
        }
        {
            p->L_PACKET = Bitstream_Read(stream, 13);
        }
        {
            p->Q_SCALE = Bitstream_Read(stream, 2);
        }
        {
            p->D_REVERSE = Bitstream_Read(stream, 15);
        }
        {
            p->V_REVERSE = Bitstream_Read(stream, 7);
        }
        return 1;
    }
    else
    {
        return 0;
    }
}

canonical_original_code:
int ReversingSupervisionInformation_DecodeBit(struct ReversingSupervisionInformation *p, struct Bitstream *stream)
{
    if (Bitstream_Normal(stream, 39))
    {
        {
            p->Q_DIR = Bitstream_Read(stream, 2);
        }
        {
            p->L_PACKET = Bitstream_Read(stream, 13);
        }
        {
            p->Q_SCALE = Bitstream_Read(stream, 2);
        }
        {
            p->D_REVERSE = Bitstream_Read(stream, 15);
        }
        {
            p->V_REVERSE = Bitstream_Read(stream, 7);
        }
        return 1;
    }
    else
    {
        return 0;
    }
}


original_code:
int ReversingSupervisionInformation_EncodeInt(const ReversingSupervisionInformation* p, Metadata* data, kcg_int* stream)
{
    data->nid_packet = 139;
    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->D_REVERSE;
    stream[startAddress++] = p->V_REVERSE;
    data->endAddress = startAddress-1;
    return 1;
}

canonical_original_code:
int ReversingSupervisionInformation_EncodeInt(struct ReversingSupervisionInformation *p, struct MetadataElement_T_Common_Types_Pkg *data, int *stream)
{
    data->nid_packet = 139;
    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->D_REVERSE;
    stream[startAddress++] = p->V_REVERSE;
    data->endAddress = startAddress-1;
    return 1;
}


original_code:
int ReversingSupervisionInformation_DecodeInt(ReversingSupervisionInformation* p, const Metadata* data, const kcg_int* stream)
{
    if(data->nid_packet != 139)
    {
         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->D_REVERSE = stream[startAddress++];
    p->V_REVERSE = stream[startAddress++];
    if(startAddress-1 != data->endAddress)
    {
         return 0;
    }
    return 1;
}

canonical_original_code:
int ReversingSupervisionInformation_DecodeInt(struct ReversingSupervisionInformation *p, struct MetadataElement_T_Common_Types_Pkg *data, int *stream)
{
    if(data->nid_packet != 139)
    {
         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->D_REVERSE = stream[startAddress++];
    p->V_REVERSE = stream[startAddress++];
    if(startAddress-1 != data->endAddress)
    {
         return 0;
    }
    return 1;
}


decompiled_code:
__int64 ReversingSupervisionInformation_New()
{
__int64 *v0; // r8
__int64 v1; // r8
__int64 v3; // rdx

if ( ReversingSupervisionInformationMemoryFreeList == -1 )
{
if ( (unsigned __int64)ReversingSupervisionInformationMemoryTop > 7 )
return 0LL;
v3 = 7 * ReversingSupervisionInformationMemoryTop++;
v0 = &ReversingSupervisionInformationMemory[v3];
}
else
{
v0 = &ReversingSupervisionInformationMemory[7 * ReversingSupervisionInformationMemoryFreeList];
ReversingSupervisionInformationMemoryFreeList = *v0;
}
ReversingSupervisionInformation_Init(v0);
return v1;
}

canonical_decompiled_code:
__int64 func7()
{
__int64 *v0; // r8
__int64 v1; // r8
__int64 v3; // rdx

if ( ReversingSupervisionInformationMemoryFreeList == -1 )
{
if ( (unsigned __int64)ReversingSupervisionInformationMemoryTop > 7 )
return 0LL;
v3 = 7 * ReversingSupervisionInformationMemoryTop++;
v0 = &ReversingSupervisionInformationMemory[v3];
}
else
{
v0 = &ReversingSupervisionInformationMemory[7 * ReversingSupervisionInformationMemoryFreeList];
ReversingSupervisionInformationMemoryFreeList = *v0;
}
func1(v0);
return v1;
}

original_code:
ReversingSupervisionInformation* ReversingSupervisionInformation_New(void)
{
    ReversingSupervisionInformation* ptr;
    if (ReversingSupervisionInformationMemoryFreeList != (-1))
    {
        ptr = &ReversingSupervisionInformationMemory[ReversingSupervisionInformationMemoryFreeList];
        ReversingSupervisionInformationMemoryFreeList = ReversingSupervisionInformationMemory[ReversingSupervisionInformationMemoryFreeList].header.NID_PACKET;
    }
    else if (ReversingSupervisionInformationMemoryTop < 8)
    {
        ptr = &ReversingSupervisionInformationMemory[ReversingSupervisionInformationMemoryTop];
        ReversingSupervisionInformationMemoryTop += 1;
    }
    else
    {
        return 0;
    }
    ReversingSupervisionInformation_Init(ptr);
    return ptr;
}

canonical_original_code:
struct ReversingSupervisionInformation *ReversingSupervisionInformation_New()
{
    struct ReversingSupervisionInformation *ptr;
    if (ReversingSupervisionInformationMemoryFreeList != (-1))
    {
        ptr = &ReversingSupervisionInformationMemory[ReversingSupervisionInformationMemoryFreeList];
        ReversingSupervisionInformationMemoryFreeList = ReversingSupervisionInformationMemory[ReversingSupervisionInformationMemoryFreeList].header.NID_PACKET;
    }
    else if (ReversingSupervisionInformationMemoryTop < 8)
    {
        ptr = &ReversingSupervisionInformationMemory[ReversingSupervisionInformationMemoryTop];
        ReversingSupervisionInformationMemoryTop += 1;
    }
    else
    {
        return 0;
    }
    ReversingSupervisionInformation_Init(ptr);
    return ptr;
}

return_type: struct ReversingSupervisionInformation { struct PacketHeader { unsigned long NID_PACKET; unsigned long list; } header; unsigned long Q_DIR; unsigned long L_PACKET; unsigned long Q_SCALE; unsigned long D_REVERSE; unsigned long V_REVERSE; } *


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

*a1 = ReversingSupervisionInformationMemoryFreeList;
result = 0x6DB6DB6DB6DB6DB7LL;
ReversingSupervisionInformationMemoryFreeList = 0x6DB6DB6DB6DB6DB7LL * (a1 - ReversingSupervisionInformationMemory);
return result;
}

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

*a1 = ReversingSupervisionInformationMemoryFreeList;
result = 0x6DB6DB6DB6DB6DB7LL;
ReversingSupervisionInformationMemoryFreeList = 0x6DB6DB6DB6DB6DB7LL * (a1 - ReversingSupervisionInformationMemory);
return result;
}

original_code:
void ReversingSupervisionInformation_Delete(ReversingSupervisionInformation* ptr)
{
    ptr->header.NID_PACKET = ReversingSupervisionInformationMemoryFreeList;
    ReversingSupervisionInformationMemoryFreeList = ptr - ReversingSupervisionInformationMemory;
}

canonical_original_code:
void ReversingSupervisionInformation_Delete(struct ReversingSupervisionInformation *ptr)
{
    ptr->header.NID_PACKET = ReversingSupervisionInformationMemoryFreeList;
    ReversingSupervisionInformationMemoryFreeList = ptr - ReversingSupervisionInformationMemory;
}


decompiled_code:
_BOOL8 __fastcall PositionReportParameters_1_UpperBitsNotSet(unsigned __int64 *a1)
{
_BOOL8 result; // rax
__int64 v2; // rdx

result = UpperBitsNotSet64(*a1, 15);
if ( result )
result = UpperBitsNotSet64(*(_QWORD *)(v2 + 8), 1);
return result;
}

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

result = func0(*a1, 15);
if ( result )
result = func0(*(_QWORD *)(v2 + 8), 1);
return result;
}

original_code:
int PositionReportParameters_1_UpperBitsNotSet(const PositionReportParameters_1* p)
{
    int status = 1;
    status = status && UpperBitsNotSet64(p->D_LOC, 15);
    status = status && UpperBitsNotSet64(p->Q_LGTLOC, 1) ;
    if (status)
    {
        return 1;
    }
    else
    {
        return 0;
    }
}

canonical_original_code:
int PositionReportParameters_1_UpperBitsNotSet(struct PositionReportParameters_1 *p)
{
    int status = 1;
    status = status && UpperBitsNotSet64(p->D_LOC, 15);
    status = status && UpperBitsNotSet64(p->Q_LGTLOC, 1) ;
    if (status)
    {
        return 1;
    }
    else
    {
        return 0;
    }
}

variable_types: struct PositionReportParameters_1 { unsigned long D_LOC; unsigned long Q_LGTLOC; } *

variable_types: status int


decompiled_code:
__int64 __fastcall PositionReportParameters_1_EncodeBit(unsigned __int64 *a1, __int64 a2)
{
if ( !(unsigned int)Bitstream_Normal(a2, 16LL) )
return 0xFFFFFFFFLL;
if ( !PositionReportParameters_1_UpperBitsNotSet(a1) )
return 4294967294LL;
Bitstream_Write(a2, 15LL, *a1);
Bitstream_Write(a2, 1LL, a1[1]);
return 1LL;
}

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

original_code:
int PositionReportParameters_1_EncodeBit(const PositionReportParameters_1* p, Bitstream* stream)
{
    if (Bitstream_Normal(stream, 16))
    {
        if (PositionReportParameters_1_UpperBitsNotSet(p))
        {
            Bitstream_Write(stream, 15, p->D_LOC);
            Bitstream_Write(stream, 1, p->Q_LGTLOC);
            return 1;
        }
        else
        {
            return -2;
        }
    }
    else
    {
        return -1;
    }
}

canonical_original_code:
int PositionReportParameters_1_EncodeBit(struct PositionReportParameters_1 *p, struct Bitstream *stream)
{
    if (Bitstream_Normal(stream, 16))
    {
        if (PositionReportParameters_1_UpperBitsNotSet(p))
        {
            Bitstream_Write(stream, 15, p->D_LOC);
            Bitstream_Write(stream, 1, p->Q_LGTLOC);
            return 1;
        }
        else
        {
            return -2;
        }
    }
    else
    {
        return -1;
    }
}

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


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

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

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

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

original_code:
int PositionReportParameters_1_DecodeBit(PositionReportParameters_1* p, Bitstream* stream)
{
    if (Bitstream_Normal(stream, 16))
    {
        {
            p->D_LOC = Bitstream_Read(stream, 15);
        }
        {
            p->Q_LGTLOC = Bitstream_Read(stream, 1);
        }
        return 1;
    }
    else
    {
        return 0;
    }
}

canonical_original_code:
int PositionReportParameters_1_DecodeBit(struct PositionReportParameters_1 *p, struct Bitstream *stream)
{
    if (Bitstream_Normal(stream, 16))
    {
        {
            p->D_LOC = Bitstream_Read(stream, 15);
        }
        {
            p->Q_LGTLOC = Bitstream_Read(stream, 1);
        }
        return 1;
    }
    else
    {
        return 0;
    }
}


original_code:
int PositionReportParameters_1_EncodeInt(const PositionReportParameters_1* p, kcg_int* startAddress, kcg_int* stream)
{
    stream[(*startAddress)++] = p->D_LOC;
    stream[(*startAddress)++] = p->Q_LGTLOC;
    return 1;
}

canonical_original_code:
int PositionReportParameters_1_EncodeInt(struct PositionReportParameters_1 *p, int *startAddress, int *stream)
{
    stream[(*startAddress)++] = p->D_LOC;
    stream[(*startAddress)++] = p->Q_LGTLOC;
    return 1;
}


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

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

original_code:
int PositionReportParameters_1_DecodeInt(PositionReportParameters_1* p, kcg_int* startAddress, const kcg_int* stream)
{
    p->D_LOC = stream[(*startAddress)++];
    p->Q_LGTLOC = stream[(*startAddress)++];
    return 1;
}

canonical_original_code:
int PositionReportParameters_1_DecodeInt(struct PositionReportParameters_1 *p, int *startAddress, int *stream)
{
    p->D_LOC = stream[(*startAddress)++];
    p->Q_LGTLOC = stream[(*startAddress)++];
    return 1;
}


decompiled_code:
_BOOL8 __fastcall ValidatedTrainData_1_UpperBitsNotSet(unsigned __int64 *a1)
{
return UpperBitsNotSet64_constprop_0(*a1);
}

canonical_decompiled_code:
_BOOL8 __fastcall func1(unsigned __int64 *a1)
{
return func0(*a1);
}

original_code:
int ValidatedTrainData_1_UpperBitsNotSet(const ValidatedTrainData_1* p)
{
    int status = 1;
    status = status && UpperBitsNotSet64(p->M_TRACTION, 8) ;
    if (status)
    {
        return 1;
    }
    else
    {
        return 0;
    }
}

canonical_original_code:
int ValidatedTrainData_1_UpperBitsNotSet(struct ValidatedTrainData_1 *p)
{
    int status = 1;
    status = status && UpperBitsNotSet64(p->M_TRACTION, 8) ;
    if (status)
    {
        return 1;
    }
    else
    {
        return 0;
    }
}

variable_types: struct ValidatedTrainData_1 { unsigned long M_TRACTION; } *


decompiled_code:
__int64 __fastcall ValidatedTrainData_1_EncodeBit(unsigned __int64 *a1, __int64 a2)
{
if ( !(unsigned int)Bitstream_Normal(a2, 8LL) )
return 0xFFFFFFFFLL;
if ( !ValidatedTrainData_1_UpperBitsNotSet(a1) )
return 4294967294LL;
Bitstream_Write(a2, 8LL, *a1);
return 1LL;
}

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

original_code:
int ValidatedTrainData_1_EncodeBit(const ValidatedTrainData_1* p, Bitstream* stream)
{
    if (Bitstream_Normal(stream, 8))
    {
        if (ValidatedTrainData_1_UpperBitsNotSet(p))
        {
            Bitstream_Write(stream, 8, p->M_TRACTION);
            return 1;
        }
        else
        {
            return -2;
        }
    }
    else
    {
        return -1;
    }
}

canonical_original_code:
int ValidatedTrainData_1_EncodeBit(struct ValidatedTrainData_1 *p, struct Bitstream *stream)
{
    if (Bitstream_Normal(stream, 8))
    {
        if (ValidatedTrainData_1_UpperBitsNotSet(p))
        {
            Bitstream_Write(stream, 8, p->M_TRACTION);
            return 1;
        }
        else
        {
            return -2;
        }
    }
    else
    {
        return -1;
    }
}

user_defined_types: struct ValidatedTrainData_1 { unsigned long M_TRACTION; }


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

result = Bitstream_Normal(a2, 8LL);
if ( (_DWORD)result )
{
*a1 = Bitstream_Read(a2, 8LL);
result = 1LL;
}
return result;
}

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

result = Bitstream_Normal(a2, 8LL);
if ( (_DWORD)result )
{
*a1 = Bitstream_Read(a2, 8LL);
result = 1LL;
}
return result;
}

original_code:
int ValidatedTrainData_1_DecodeBit(ValidatedTrainData_1* p, Bitstream* stream)
{
    if (Bitstream_Normal(stream, 8))
    {
        {
            p->M_TRACTION = Bitstream_Read(stream, 8);
        }
        return 1;
    }
    else
    {
        return 0;
    }
}

canonical_original_code:
int ValidatedTrainData_1_DecodeBit(struct ValidatedTrainData_1 *p, struct Bitstream *stream)
{
    if (Bitstream_Normal(stream, 8))
    {
        {
            p->M_TRACTION = Bitstream_Read(stream, 8);
        }
        return 1;
    }
    else
    {
        return 0;
    }
}


decompiled_code:
__int64 __fastcall ValidatedTrainData_1_EncodeInt(__int64 *a1, int *a2, __int64 a3)
{
__int64 v3; // rax
__int64 v4; // rcx

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

original_code:
int ValidatedTrainData_1_EncodeInt(const ValidatedTrainData_1* p, kcg_int* startAddress, kcg_int* stream)
{
    stream[(*startAddress)++] = p->M_TRACTION;
    return 1;
}

canonical_original_code:
int ValidatedTrainData_1_EncodeInt(struct ValidatedTrainData_1 *p, int *startAddress, int *stream)
{
    stream[(*startAddress)++] = p->M_TRACTION;
    return 1;
}


decompiled_code:
__int64 __fastcall ValidatedTrainData_1_DecodeInt(_QWORD *a1, int *a2, __int64 a3)
{
__int64 v3; // rax

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

original_code:
int ValidatedTrainData_1_DecodeInt(ValidatedTrainData_1* p, kcg_int* startAddress, const kcg_int* stream)
{
    p->M_TRACTION = stream[(*startAddress)++];
    return 1;
}

canonical_original_code:
int ValidatedTrainData_1_DecodeInt(struct ValidatedTrainData_1 *p, int *startAddress, int *stream)
{
    p->M_TRACTION = stream[(*startAddress)++];
    return 1;
}


decompiled_code:
_BOOL8 __fastcall UpperBitsNotSet64(unsigned __int64 a1, char a2)
{
return 1LL << a2 > a1;
}

canonical_decompiled_code:
_BOOL8 __fastcall func0(unsigned __int64 a1, char a2)
{
return 1LL << a2 > a1;
}

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;
    }
}


decompiled_code:
_BOOL8 __fastcall Level23TransitionInformation_UpperBitsNotSet(__int64 a1)
{
_BOOL8 result; // rax
__int64 v2; // rdx

result = UpperBitsNotSet64(*(_QWORD *)(a1 + 16), 13);
if ( result )
result = UpperBitsNotSet64(*(_QWORD *)(v2 + 24), 24);
return result;
}

canonical_decompiled_code:
_BOOL8 __fastcall func2(__int64 a1)
{
_BOOL8 result; // rax
__int64 v2; // rdx

result = func0(*(_QWORD *)(a1 + 16), 13);
if ( result )
result = func0(*(_QWORD *)(v2 + 24), 24);
return result;
}

original_code:
int Level23TransitionInformation_UpperBitsNotSet(const Level23TransitionInformation* p)
{
    int status = 1;
    status = status && UpperBitsNotSet64(p->L_PACKET, 13);
    status = status && UpperBitsNotSet64(p->NID_LTRBG, 24);
    if (status)
    {
        return 1;
    }
    else
    {
        return 0;
    }
}

canonical_original_code:
int Level23TransitionInformation_UpperBitsNotSet(struct Level23TransitionInformation *p)
{
    int status = 1;
    status = status && UpperBitsNotSet64(p->L_PACKET, 13);
    status = status && UpperBitsNotSet64(p->NID_LTRBG, 24);
    if (status)
    {
        return 1;
    }
    else
    {
        return 0;
    }
}

variable_types: struct Level23TransitionInformation { struct PacketHeader { unsigned long NID_PACKET; unsigned long list; } header; unsigned long L_PACKET; unsigned long NID_LTRBG; } *


decompiled_code:
__int64 __fastcall Level23TransitionInformation_EncodeBit(__int64 a1, __int64 a2)
{
if ( !(unsigned int)Bitstream_Normal(a2, 37LL) )
return 0xFFFFFFFFLL;
if ( !Level23TransitionInformation_UpperBitsNotSet(a1) )
return 4294967294LL;
Bitstream_Write(a2, 13LL, *(_QWORD *)(a1 + 16));
Bitstream_Write(a2, 24LL, *(_QWORD *)(a1 + 24));
return 1LL;
}

canonical_decompiled_code:
__int64 __fastcall func3(__int64 a1, __int64 a2)
{
if ( !(unsigned int)Bitstream_Normal(a2, 37LL) )
return 0xFFFFFFFFLL;
if ( !func2(a1) )
return 4294967294LL;
Bitstream_Write(a2, 13LL, *(_QWORD *)(a1 + 16));
Bitstream_Write(a2, 24LL, *(_QWORD *)(a1 + 24));
return 1LL;
}

original_code:
int Level23TransitionInformation_EncodeBit(const Level23TransitionInformation* p, Bitstream* stream)
{
    if (Bitstream_Normal(stream, 37))
    {
        if (Level23TransitionInformation_UpperBitsNotSet(p))
        {
            Bitstream_Write(stream, 13, p->L_PACKET);
            Bitstream_Write(stream, 24, p->NID_LTRBG);
            return 1;
        }
        else
        {
            return -2;
        }
    }
    else
    {
        return -1;
    }
}

canonical_original_code:
int Level23TransitionInformation_EncodeBit(struct Level23TransitionInformation *p, struct Bitstream *stream)
{
    if (Bitstream_Normal(stream, 37))
    {
        if (Level23TransitionInformation_UpperBitsNotSet(p))
        {
            Bitstream_Write(stream, 13, p->L_PACKET);
            Bitstream_Write(stream, 24, p->NID_LTRBG);
            return 1;
        }
        else
        {
            return -2;
        }
    }
    else
    {
        return -1;
    }
}


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

result = Bitstream_Normal(a2, 37LL);
if ( (_DWORD)result )
{
*(_QWORD *)(a1 + 16) = Bitstream_Read(a2, 13LL);
*(_QWORD *)(a1 + 24) = Bitstream_Read(a2, 24LL);
result = 1LL;
}
return result;
}

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

result = Bitstream_Normal(a2, 37LL);
if ( (_DWORD)result )
{
*(_QWORD *)(a1 + 16) = Bitstream_Read(a2, 13LL);
*(_QWORD *)(a1 + 24) = Bitstream_Read(a2, 24LL);
result = 1LL;
}
return result;
}

original_code:
int Level23TransitionInformation_DecodeBit(Level23TransitionInformation* p, Bitstream* stream)
{
    if (Bitstream_Normal(stream, 37))
    {
        {
            p->L_PACKET = Bitstream_Read(stream, 13);
        }
        {
            p->NID_LTRBG = Bitstream_Read(stream, 24);
        }
        return 1;
    }
    else
    {
        return 0;
    }
}

canonical_original_code:
int Level23TransitionInformation_DecodeBit(struct Level23TransitionInformation *p, struct Bitstream *stream)
{
    if (Bitstream_Normal(stream, 37))
    {
        {
            p->L_PACKET = Bitstream_Read(stream, 13);
        }
        {
            p->NID_LTRBG = Bitstream_Read(stream, 24);
        }
        return 1;
    }
    else
    {
        return 0;
    }
}


original_code:
int Level23TransitionInformation_EncodeInt(const Level23TransitionInformation* p, Metadata* data, kcg_int* stream)
{
    data->nid_packet = 9;
    data->valid = 1;
    kcg_int startAddress = data->startAddress;
    stream[startAddress++] = p->header.NID_PACKET;
    stream[startAddress++] = p->L_PACKET;
    stream[startAddress++] = p->NID_LTRBG;
    data->endAddress = startAddress-1;
    return 1;
}

canonical_original_code:
int Level23TransitionInformation_EncodeInt(struct Level23TransitionInformation *p, struct MetadataElement_T_Common_Types_Pkg *data, int *stream)
{
    data->nid_packet = 9;
    data->valid = 1;
    int startAddress = data->startAddress;
    stream[startAddress++] = p->header.NID_PACKET;
    stream[startAddress++] = p->L_PACKET;
    stream[startAddress++] = p->NID_LTRBG;
    data->endAddress = startAddress-1;
    return 1;
}


decompiled_code:
_BOOL8 __fastcall Level23TransitionInformation_DecodeInt(_QWORD *a1, _DWORD *a2, __int64 a3)
{
_BOOL8 result; // rax
__int64 v4; // rcx
bool v5; // zf
__int64 v6; // r8
__int64 v7; // rdx

result = 0LL;
if ( *a2 == 9 )
{
v4 = (int)a2[3];
v5 = a2[4] == a2[3] + 2;
*a1 = *(int *)(a3 + 4 * v4);
v6 = *(int *)(a3 + 4 * v4 + 4);
v7 = *(int *)(a3 + 4 * v4 + 8);
result = v5;
a1[2] = v6;
a1[3] = v7;
}
return result;
}

original_code:
int Level23TransitionInformation_DecodeInt(Level23TransitionInformation* p, const Metadata* data, const kcg_int* stream)
{
    if(data->nid_packet != 9)
    {
         return 0;
    }
    kcg_int startAddress = data->startAddress;
    p->header.NID_PACKET = stream[startAddress++];
    p->L_PACKET = stream[startAddress++];
    p->NID_LTRBG = stream[startAddress++];
    if(startAddress-1 != data->endAddress)
    {
         return 0;
    }
    return 1;
}

canonical_original_code:
int Level23TransitionInformation_DecodeInt(struct Level23TransitionInformation *p, struct MetadataElement_T_Common_Types_Pkg *data, int *stream)
{
    if(data->nid_packet != 9)
    {
         return 0;
    }
    int startAddress = data->startAddress;
    p->header.NID_PACKET = stream[startAddress++];
    p->L_PACKET = stream[startAddress++];
    p->NID_LTRBG = stream[startAddress++];
    if(startAddress-1 != data->endAddress)
    {
         return 0;
    }
    return 1;
}


decompiled_code:
__int64 Level23TransitionInformation_New()
{
__int64 *v0; // r8
__int64 v1; // r8
__int64 v3; // r8

if ( Level23TransitionInformationMemoryFreeList == -1 )
{
if ( (unsigned __int64)Level23TransitionInformationMemoryTop > 7 )
return 0LL;
v3 = 4 * Level23TransitionInformationMemoryTop++;
v0 = &Level23TransitionInformationMemory[v3];
}
else
{
v0 = &Level23TransitionInformationMemory[4 * Level23TransitionInformationMemoryFreeList];
Level23TransitionInformationMemoryFreeList = *v0;
}
Level23TransitionInformation_Init(v0);
return v1;
}

canonical_decompiled_code:
__int64 func7()
{
__int64 *v0; // r8
__int64 v1; // r8
__int64 v3; // r8

if ( Level23TransitionInformationMemoryFreeList == -1 )
{
if ( (unsigned __int64)Level23TransitionInformationMemoryTop > 7 )
return 0LL;
v3 = 4 * Level23TransitionInformationMemoryTop++;
v0 = &Level23TransitionInformationMemory[v3];
}
else
{
v0 = &Level23TransitionInformationMemory[4 * Level23TransitionInformationMemoryFreeList];
Level23TransitionInformationMemoryFreeList = *v0;
}
func1(v0);
return v1;
}

original_code:
Level23TransitionInformation* Level23TransitionInformation_New(void)
{
    Level23TransitionInformation* ptr;
    if (Level23TransitionInformationMemoryFreeList != (-1))
    {
        ptr = &Level23TransitionInformationMemory[Level23TransitionInformationMemoryFreeList];
        Level23TransitionInformationMemoryFreeList = Level23TransitionInformationMemory[Level23TransitionInformationMemoryFreeList].header.NID_PACKET;
    }
    else if (Level23TransitionInformationMemoryTop < 8)
    {
        ptr = &Level23TransitionInformationMemory[Level23TransitionInformationMemoryTop];
        Level23TransitionInformationMemoryTop += 1;
    }
    else
    {
        return 0;
    }
    Level23TransitionInformation_Init(ptr);
    return ptr;
}

canonical_original_code:
struct Level23TransitionInformation *Level23TransitionInformation_New()
{
    struct Level23TransitionInformation *ptr;
    if (Level23TransitionInformationMemoryFreeList != (-1))
    {
        ptr = &Level23TransitionInformationMemory[Level23TransitionInformationMemoryFreeList];
        Level23TransitionInformationMemoryFreeList = Level23TransitionInformationMemory[Level23TransitionInformationMemoryFreeList].header.NID_PACKET;
    }
    else if (Level23TransitionInformationMemoryTop < 8)
    {
        ptr = &Level23TransitionInformationMemory[Level23TransitionInformationMemoryTop];
        Level23TransitionInformationMemoryTop += 1;
    }
    else
    {
        return 0;
    }
    Level23TransitionInformation_Init(ptr);
    return ptr;
}

return_type: struct Level23TransitionInformation { struct PacketHeader { unsigned long NID_PACKET; unsigned long list; } header; unsigned long L_PACKET; unsigned long NID_LTRBG; } *


decompiled_code:
__int64 __fastcall Level23TransitionInformation_Delete(char *a1)
{
__int64 result; // rax

result = Level23TransitionInformationMemoryFreeList;
*(_QWORD *)a1 = Level23TransitionInformationMemoryFreeList;
Level23TransitionInformationMemoryFreeList = (a1 - (char *)Level23TransitionInformationMemory) >> 5;
return result;
}

canonical_decompiled_code:
__int64 __fastcall func8(char *a1)
{
__int64 result; // rax

result = Level23TransitionInformationMemoryFreeList;
*(_QWORD *)a1 = Level23TransitionInformationMemoryFreeList;
Level23TransitionInformationMemoryFreeList = (a1 - (char *)Level23TransitionInformationMemory) >> 5;
return result;
}

original_code:
void Level23TransitionInformation_Delete(Level23TransitionInformation* ptr)
{
    ptr->header.NID_PACKET = Level23TransitionInformationMemoryFreeList;
    Level23TransitionInformationMemoryFreeList = ptr - Level23TransitionInformationMemory;
}

canonical_original_code:
void Level23TransitionInformation_Delete(struct Level23TransitionInformation *ptr)
{
    ptr->header.NID_PACKET = Level23TransitionInformationMemoryFreeList;
    Level23TransitionInformationMemoryFreeList = ptr - Level23TransitionInformationMemory;
}


decompiled_code:
_BOOL8 __fastcall ConditionalLevelTransitionOrder_1_UpperBitsNotSet(unsigned __int64 *a1)
{
unsigned __int64 v1; // rdi
_BOOL8 result; // rax
__int64 v3; // rdx

v1 = *a1;
result = UpperBitsNotSet64(v1, 3);
if ( result )
{
result = 1LL;
if ( v1 == 1 )
result = UpperBitsNotSet64(*(_QWORD *)(v3 + 8), 8);
}
return result;
}

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

v1 = *a1;
result = func0(v1, 3);
if ( result )
{
result = 1LL;
if ( v1 == 1 )
result = func0(*(_QWORD *)(v3 + 8), 8);
}
return result;
}

original_code:
int ConditionalLevelTransitionOrder_1_UpperBitsNotSet(const ConditionalLevelTransitionOrder_1* p)
{
    int status = 1;
    status = status && UpperBitsNotSet64(p->M_LEVELTR, 3) ;
    if (p->M_LEVELTR == 1)
    {
        status = status && UpperBitsNotSet64(p->NID_STM, 8) ;
    }
    if (status)
    {
        return 1;
    }
    else
    {
        return 0;
    }
}

canonical_original_code:
int ConditionalLevelTransitionOrder_1_UpperBitsNotSet(struct ConditionalLevelTransitionOrder_1 *p)
{
    int status = 1;
    status = status && UpperBitsNotSet64(p->M_LEVELTR, 3) ;
    if (p->M_LEVELTR == 1)
    {
        status = status && UpperBitsNotSet64(p->NID_STM, 8) ;
    }
    if (status)
    {
        return 1;
    }
    else
    {
        return 0;
    }
}

variable_types: struct ConditionalLevelTransitionOrder_1 { unsigned long M_LEVELTR; unsigned long NID_STM; } *


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

if ( !(unsigned int)Bitstream_Normal(a2, 3LL) )
return 0xFFFFFFFFLL;
if ( !ConditionalLevelTransitionOrder_1_UpperBitsNotSet(a1) )
return 4294967294LL;
Bitstream_Write(a2, 3LL, *a1);
result = 1LL;
if ( *a1 == 1 )
{
Bitstream_Write(a2, 8LL, a1[1]);
result = 1LL;
}
return result;
}

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

if ( !(unsigned int)Bitstream_Normal(a2, 3LL) )
return 0xFFFFFFFFLL;
if ( !func1(a1) )
return 4294967294LL;
Bitstream_Write(a2, 3LL, *a1);
result = 1LL;
if ( *a1 == 1 )
{
Bitstream_Write(a2, 8LL, a1[1]);
result = 1LL;
}
return result;
}

original_code:
int ConditionalLevelTransitionOrder_1_EncodeBit(const ConditionalLevelTransitionOrder_1* p, Bitstream* stream)
{
    if (Bitstream_Normal(stream, 3))
    {
        if (ConditionalLevelTransitionOrder_1_UpperBitsNotSet(p))
        {
            Bitstream_Write(stream, 3, p->M_LEVELTR);
            if (p->M_LEVELTR == 1)
            {
                Bitstream_Write(stream, 8, p->NID_STM);
            }
            return 1;
        }
        else
        {
            return -2;
        }
    }
    else
    {
        return -1;
    }
}

canonical_original_code:
int ConditionalLevelTransitionOrder_1_EncodeBit(struct ConditionalLevelTransitionOrder_1 *p, struct Bitstream *stream)
{
    if (Bitstream_Normal(stream, 3))
    {
        if (ConditionalLevelTransitionOrder_1_UpperBitsNotSet(p))
        {
            Bitstream_Write(stream, 3, p->M_LEVELTR);
            if (p->M_LEVELTR == 1)
            {
                Bitstream_Write(stream, 8, p->NID_STM);
            }
            return 1;
        }
        else
        {
            return -2;
        }
    }
    else
    {
        return -1;
    }
}

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


decompiled_code:
__int64 __fastcall ConditionalLevelTransitionOrder_1_DecodeBit(__int64 *a1, __int64 a2)
{
unsigned int v2; // er12
__int64 v4; // rax

v2 = Bitstream_Normal(a2, 3LL);
if ( v2 )
{
v2 = 1;
v4 = Bitstream_Read(a2, 3LL);
*a1 = v4;
if ( v4 == 1 )
a1[1] = Bitstream_Read(a2, 8LL);
}
return v2;
}

canonical_decompiled_code:
__int64 __fastcall func3(__int64 *a1, __int64 a2)
{
unsigned int v2; // er12
__int64 v4; // rax

v2 = Bitstream_Normal(a2, 3LL);
if ( v2 )
{
v2 = 1;
v4 = Bitstream_Read(a2, 3LL);
*a1 = v4;
if ( v4 == 1 )
a1[1] = Bitstream_Read(a2, 8LL);
}
return v2;
}

original_code:
int ConditionalLevelTransitionOrder_1_DecodeBit(ConditionalLevelTransitionOrder_1* p, Bitstream* stream)
{
    if (Bitstream_Normal(stream, 3))
    {
        {
            p->M_LEVELTR = Bitstream_Read(stream, 3);
        }
        if (p->M_LEVELTR == 1)
        {
            {
                p->NID_STM = Bitstream_Read(stream, 8);
            }
        }
        return 1;
    }
    else
    {
        return 0;
    }
}

canonical_original_code:
int ConditionalLevelTransitionOrder_1_DecodeBit(struct ConditionalLevelTransitionOrder_1 *p, struct Bitstream *stream)
{
    if (Bitstream_Normal(stream, 3))
    {
        {
            p->M_LEVELTR = Bitstream_Read(stream, 3);
        }
        if (p->M_LEVELTR == 1)
        {
            {
                p->NID_STM = Bitstream_Read(stream, 8);
            }
        }
        return 1;
    }
    else
    {
        return 0;
    }
}


original_code:
int ConditionalLevelTransitionOrder_1_EncodeInt(const ConditionalLevelTransitionOrder_1* p, kcg_int* startAddress, kcg_int* stream)
{
    stream[(*startAddress)++] = p->M_LEVELTR;
    stream[(*startAddress)++] = p->NID_STM;
    return 1;
}

canonical_original_code:
int ConditionalLevelTransitionOrder_1_EncodeInt(struct ConditionalLevelTransitionOrder_1 *p, int *startAddress, int *stream)
{
    stream[(*startAddress)++] = p->M_LEVELTR;
    stream[(*startAddress)++] = p->NID_STM;
    return 1;
}


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

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

original_code:
int ConditionalLevelTransitionOrder_1_DecodeInt(ConditionalLevelTransitionOrder_1* p, kcg_int* startAddress, const kcg_int* stream)
{
    p->M_LEVELTR = stream[(*startAddress)++];
    p->NID_STM = stream[(*startAddress)++];
    return 1;
}

canonical_original_code:
int ConditionalLevelTransitionOrder_1_DecodeInt(struct ConditionalLevelTransitionOrder_1 *p, int *startAddress, int *stream)
{
    p->M_LEVELTR = stream[(*startAddress)++];
    p->NID_STM = stream[(*startAddress)++];
    return 1;
}


decompiled_code:
__int64 EndOfInformation_UpperBitsNotSet()
{
return 1LL;
}

canonical_decompiled_code:
__int64 func1()
{
return 1LL;
}

original_code:
int EndOfInformation_UpperBitsNotSet(const EndOfInformation* p)
{
    int status = 1;
    if (status)
    {
        return 1;
    }
    else
    {
        return 0;
    }
}

canonical_original_code:
int EndOfInformation_UpperBitsNotSet(struct EndOfInformation *p)
{
    int status = 1;
    if (status)
    {
        return 1;
    }
    else
    {
        return 0;
    }
}

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

user_defined_types: struct EndOfInformation { struct PacketHeader header; }


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

if ( (unsigned int)Bitstream_Normal(a2, 0LL) )
result = (unsigned int)EndOfInformation_UpperBitsNotSet(a1) == 0 ? -2 : 1;
else
result = 0xFFFFFFFFLL;
return result;
}

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

if ( (unsigned int)Bitstream_Normal(a2, 0LL) )
result = (unsigned int)func1(a1) == 0 ? -2 : 1;
else
result = 0xFFFFFFFFLL;
return result;
}

original_code:
int EndOfInformation_EncodeBit(const EndOfInformation* p, Bitstream* stream)
{
    if (Bitstream_Normal(stream, 0))
    {
        if (EndOfInformation_UpperBitsNotSet(p))
        {
            return 1;
        }
        else
        {
            return -2;
        }
    }
    else
    {
        return -1;
    }
}

canonical_original_code:
int EndOfInformation_EncodeBit(struct EndOfInformation *p, struct Bitstream *stream)
{
    if (Bitstream_Normal(stream, 0))
    {
        if (EndOfInformation_UpperBitsNotSet(p))
        {
            return 1;
        }
        else
        {
            return -2;
        }
    }
    else
    {
        return -1;
    }
}


decompiled_code:
_BOOL8 __fastcall EndOfInformation_DecodeBit(__int64 a1, __int64 a2)
{
return (unsigned int)Bitstream_Normal(a2, 0LL) != 0;
}

canonical_decompiled_code:
_BOOL8 __fastcall func3(__int64 a1, __int64 a2)
{
return (unsigned int)Bitstream_Normal(a2, 0LL) != 0;
}

original_code:
int EndOfInformation_DecodeBit(EndOfInformation* p, Bitstream* stream)
{
    if (Bitstream_Normal(stream, 0))
    {
        return 1;
    }
    else
    {
        return 0;
    }
}

canonical_original_code:
int EndOfInformation_DecodeBit(struct EndOfInformation *p, struct Bitstream *stream)
{
    if (Bitstream_Normal(stream, 0))
    {
        return 1;
    }
    else
    {
        return 0;
    }
}


decompiled_code:
__int64 __fastcall EndOfInformation_EncodeInt(__int64 *a1, __int64 a2, __int64 a3)
{
__int64 v3; // rcx
__int64 result; // rax
__int64 v5; // rdi

*(_BYTE *)(a2 + 8) = 1;
v3 = *(int *)(a2 + 12);
result = 1LL;
v5 = *a1;
*(_DWORD *)a2 = 255;
*(_DWORD *)(a3 + 4 * v3) = v5;
*(_DWORD *)(a2 + 16) = v3;
return result;
}

original_code:
int EndOfInformation_EncodeInt(const EndOfInformation* p, Metadata* data, kcg_int* stream)
{
    data->nid_packet = 255;
    data->valid = 1;
    kcg_int startAddress = data->startAddress;
    stream[startAddress++] = p->header.NID_PACKET;
    data->endAddress = startAddress-1;
    return 1;
}

canonical_original_code:
int EndOfInformation_EncodeInt(struct EndOfInformation *p, struct MetadataElement_T_Common_Types_Pkg *data, int *stream)
{
    data->nid_packet = 255;
    data->valid = 1;
    int startAddress = data->startAddress;
    stream[startAddress++] = p->header.NID_PACKET;
    data->endAddress = startAddress-1;
    return 1;
}


decompiled_code:
_BOOL8 __fastcall EndOfInformation_DecodeInt(_QWORD *a1, _DWORD *a2, __int64 a3)
{
_BOOL8 result; // rax
__int64 v4; // rcx

result = 0LL;
if ( *a2 == 255 )
{
v4 = (int)a2[3];
result = a2[4] == (_DWORD)v4;
*a1 = *(int *)(a3 + 4 * v4);
}
return result;
}

canonical_decompiled_code:
_BOOL8 __fastcall func5(_QWORD *a1, _DWORD *a2, __int64 a3)
{
_BOOL8 result; // rax
__int64 v4; // rcx

result = 0LL;
if ( *a2 == 255 )
{
v4 = (int)a2[3];
result = a2[4] == (_DWORD)v4;
*a1 = *(int *)(a3 + 4 * v4);
}
return result;
}

original_code:
int EndOfInformation_DecodeInt(EndOfInformation* p, const Metadata* data, const kcg_int* stream)
{
    if(data->nid_packet != 255)
    {
         return 0;
    }
    kcg_int startAddress = data->startAddress;
    p->header.NID_PACKET = stream[startAddress++];
    if(startAddress-1 != data->endAddress)
    {
         return 0;
    }
    return 1;
}

canonical_original_code:
int EndOfInformation_DecodeInt(struct EndOfInformation *p, struct MetadataElement_T_Common_Types_Pkg *data, int *stream)
{
    if(data->nid_packet != 255)
    {
         return 0;
    }
    int startAddress = data->startAddress;
    p->header.NID_PACKET = stream[startAddress++];
    if(startAddress-1 != data->endAddress)
    {
         return 0;
    }
    return 1;
}


decompiled_code:
__int64 EndOfInformation_New()
{
__int64 *v0; // r8
__int64 v1; // r8
__int64 v3; // r8

if ( EndOfInformationMemoryFreeList == -1 )
{
if ( (unsigned __int64)EndOfInformationMemoryTop > 7 )
return 0LL;
v3 = 2 * EndOfInformationMemoryTop++;
v0 = &EndOfInformationMemory[v3];
}
else
{
v0 = &EndOfInformationMemory[2 * EndOfInformationMemoryFreeList];
EndOfInformationMemoryFreeList = *v0;
}
EndOfInformation_Init(v0);
return v1;
}

canonical_decompiled_code:
__int64 func6()
{
__int64 *v0; // r8
__int64 v1; // r8
__int64 v3; // r8

if ( EndOfInformationMemoryFreeList == -1 )
{
if ( (unsigned __int64)EndOfInformationMemoryTop > 7 )
return 0LL;
v3 = 2 * EndOfInformationMemoryTop++;
v0 = &EndOfInformationMemory[v3];
}
else
{
v0 = &EndOfInformationMemory[2 * EndOfInformationMemoryFreeList];
EndOfInformationMemoryFreeList = *v0;
}
func0(v0);
return v1;
}

original_code:
EndOfInformation* EndOfInformation_New(void)
{
    EndOfInformation* ptr;
    if (EndOfInformationMemoryFreeList != (-1))
    {
        ptr = &EndOfInformationMemory[EndOfInformationMemoryFreeList];
        EndOfInformationMemoryFreeList = EndOfInformationMemory[EndOfInformationMemoryFreeList].header.NID_PACKET;
    }
    else if (EndOfInformationMemoryTop < 8)
    {
        ptr = &EndOfInformationMemory[EndOfInformationMemoryTop];
        EndOfInformationMemoryTop += 1;
    }
    else
    {
        return 0;
    }
    EndOfInformation_Init(ptr);
    return ptr;
}

canonical_original_code:
struct EndOfInformation *EndOfInformation_New()
{
    struct EndOfInformation *ptr;
    if (EndOfInformationMemoryFreeList != (-1))
    {
        ptr = &EndOfInformationMemory[EndOfInformationMemoryFreeList];
        EndOfInformationMemoryFreeList = EndOfInformationMemory[EndOfInformationMemoryFreeList].header.NID_PACKET;
    }
    else if (EndOfInformationMemoryTop < 8)
    {
        ptr = &EndOfInformationMemory[EndOfInformationMemoryTop];
        EndOfInformationMemoryTop += 1;
    }
    else
    {
        return 0;
    }
    EndOfInformation_Init(ptr);
    return ptr;
}

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


decompiled_code:
__int64 __fastcall EndOfInformation_Delete(char *a1)
{
__int64 result; // rax

result = EndOfInformationMemoryFreeList;
*(_QWORD *)a1 = EndOfInformationMemoryFreeList;
EndOfInformationMemoryFreeList = (a1 - (char *)EndOfInformationMemory) >> 4;
return result;
}

canonical_decompiled_code:
__int64 __fastcall func7(char *a1)
{
__int64 result; // rax

result = EndOfInformationMemoryFreeList;
*(_QWORD *)a1 = EndOfInformationMemoryFreeList;
EndOfInformationMemoryFreeList = (a1 - (char *)EndOfInformationMemory) >> 4;
return result;
}

original_code:
void EndOfInformation_Delete(EndOfInformation* ptr)
{
    ptr->header.NID_PACKET = EndOfInformationMemoryFreeList;
    EndOfInformationMemoryFreeList = ptr - EndOfInformationMemory;
}

canonical_original_code:
void EndOfInformation_Delete(struct EndOfInformation *ptr)
{
    ptr->header.NID_PACKET = EndOfInformationMemoryFreeList;
    EndOfInformationMemoryFreeList = ptr - EndOfInformationMemory;
}


decompiled_code:
_BOOL8 __fastcall UpperBitsNotSet64(unsigned __int64 a1, char a2)
{
return 1LL << a2 > a1;
}

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


decompiled_code:
_BOOL8 __fastcall AxleLoadSpeedProfile_2_UpperBitsNotSet(unsigned __int64 *a1)
{
_BOOL4 v2; // eax
unsigned __int64 v3; // rdx
_BOOL4 v4; // eax
unsigned __int64 v5; // rbx
unsigned __int64 v6; // rdi
int v7; // eax

v2 = UpperBitsNotSet64(*a1, 15);
v3 = a1[3];
if ( !v2 || !UpperBitsNotSet64(a1[1], 15) || !UpperBitsNotSet64(a1[2], 1) )
{
if ( !v3 )
return 0LL;
LODWORD(v5) = 0;
do
{
LABEL_12:
if ( (unsigned int)(v5 + 1) >= v3 )
break;
v5 = (unsigned int)(v5 + 2);
}
while ( v5 < v3 );
return 0LL;
}
v4 = UpperBitsNotSet64(v3, 5);
if ( v3 )
{
LODWORD(v5) = 0;
if ( v4 )
{
v6 = 0LL;
while ( 1 )
{
v7 = AxleLoadSpeedProfile_2_1_UpperBitsNotSet(&a1[2 * v6 + 4]);
v6 = (unsigned int)(v5 + 1);
LODWORD(v5) = v5 + 1;
if ( !v7 )
break;
if ( a1[3] <= v6 )
return 1LL;
}
v3 = a1[3];
if ( v3 > v6 )
goto LABEL_12;
return 0LL;
}
goto LABEL_12;
}
return v4;
}

canonical_decompiled_code:
_BOOL8 __fastcall func1(unsigned __int64 *a1)
{
_BOOL4 v2; // eax
unsigned __int64 v3; // rdx
_BOOL4 v4; // eax
unsigned __int64 v5; // rbx
unsigned __int64 v6; // rdi
int v7; // eax

v2 = func0(*a1, 15);
v3 = a1[3];
if ( !v2 || !func0(a1[1], 15) || !func0(a1[2], 1) )
{
if ( !v3 )
return 0LL;
LODWORD(v5) = 0;
do
{
LABEL_12:
if ( (unsigned int)(v5 + 1) >= v3 )
break;
v5 = (unsigned int)(v5 + 2);
}
while ( v5 < v3 );
return 0LL;
}
v4 = func0(v3, 5);
if ( v3 )
{
LODWORD(v5) = 0;
if ( v4 )
{
v6 = 0LL;
while ( 1 )
{
v7 = AxleLoadSpeedProfile_2_1_UpperBitsNotSet(&a1[2 * v6 + 4]);
v6 = (unsigned int)(v5 + 1);
LODWORD(v5) = v5 + 1;
if ( !v7 )
break;
if ( a1[3] <= v6 )
return 1LL;
}
v3 = a1[3];
if ( v3 > v6 )
goto LABEL_12;
return 0LL;
}
goto LABEL_12;
}
return v4;
}

original_code:
int AxleLoadSpeedProfile_2_UpperBitsNotSet(const AxleLoadSpeedProfile_2* p)
{
    int status = 1;
    status = status && UpperBitsNotSet64(p->D_AXLELOAD, 15);
    status = status && UpperBitsNotSet64(p->L_AXLELOAD, 15);
    status = status && UpperBitsNotSet64(p->Q_FRONT, 1) ;
    status = status && UpperBitsNotSet64(p->N_ITER_2_1, 5) ;
    for (uint32_t i = 0; i < p->N_ITER_2_1; ++i)
    {
        status = status && AxleLoadSpeedProfile_2_1_UpperBitsNotSet(&(p->sub_2_1[i]));
    }
    if (status)
    {
        return 1;
    }
    else
    {
        return 0;
    }
}

canonical_original_code:
int AxleLoadSpeedProfile_2_UpperBitsNotSet(struct AxleLoadSpeedProfile_2 *p)
{
    int status = 1;
    status = status && UpperBitsNotSet64(p->D_AXLELOAD, 15);
    status = status && UpperBitsNotSet64(p->L_AXLELOAD, 15);
    status = status && UpperBitsNotSet64(p->Q_FRONT, 1) ;
    status = status && UpperBitsNotSet64(p->N_ITER_2_1, 5) ;
    for (unsigned int i = 0; i < p->N_ITER_2_1; ++i)
    {
        status = status && AxleLoadSpeedProfile_2_1_UpperBitsNotSet(&(p->sub_2_1[i]));
    }
    if (status)
    {
        return 1;
    }
    else
    {
        return 0;
    }
}

variable_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 { unsigned long M_AXLELOAD; unsigned long V_AXLELOAD; } sub_2_1[31]; } *

variable_types:
i
unsigned int

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]; }