// File: /workspace/github_cpp_makefile_star2_O2/EmbeddedPaul166[P]SNMP-Agent/src/main.cpp
// Function: encodeASequence(Manager&)
void encodeASequence(Manager & manager)
{
    std::vector<std::byte> beginVector;
    std::vector<std::byte> endVector;
    int lengthInBytes = 0;
    
    DataType dataType;
    dataType.m_baseType = BaseDataType::SEQUENCE_OF;
    dataType.m_complexity = EncodingComplexity::CONSTRUCTED;
    dataType.m_visibility = DataVisibility::UNIVERSAL;
    
    //Validate sequence
    std::string nodeName = "ifTable";
    Node * pNode = manager.getNodeByName(nodeName);
    std::vector<std::string> nodeNameVector;
    
    if (manager.validate(dataType, pNode -> m_dataType, nodeNameVector))
    {
        std::cout << "Ok sequence " <<  nodeName <<std::endl;
        
    }
    else
    {
        std::cout << "Not ok sequence " <<  nodeName <<std::endl;
    }
    
    manager.startASequence(dataType, beginVector);
    
    //Validate integer element
    dataType.m_baseType = BaseDataType::INTEGER;
    dataType.m_complexity = EncodingComplexity::PRIMITIVE;
    nodeName = "ifType"; 
    bool isFound = false;
    int x = 5;
    pNode = manager.getNodeByName(nodeName);
    
    for (std::vector<std::string>::size_type i = nodeNameVector.size() - 1; i != (std::vector<std::string>::size_type) - 1; i--)
    {
        if (nodeNameVector[i] == pNode -> m_name)
        {
            isFound = true;
            break;
        }
    }
    
    if (isFound)
    {
        if (manager.validate(dataType, pNode -> m_dataType, x))
        {
            std::cout << "OK integer " <<  nodeName <<std::endl;
        }
        else
        {
            std::cout << "Not ok integer " <<  nodeName <<std::endl;
        }
    }
    else 
    {
        std::cout << "Not ok integer " <<  nodeName <<std::endl;
    }
    
    manager.addInteger(dataType, x, lengthInBytes, endVector);
    
    //Validate octet string element
    dataType.m_baseType = BaseDataType::OCTET_STRING;
    nodeName = "ifPhysAddress";  
    isFound = false;
    std::string y = "heh";
    pNode = manager.getNodeByName(nodeName);
    
    for (std::vector<std::string>::size_type i = nodeNameVector.size() - 1; i != (std::vector<std::string>::size_type) - 1; i--)
    {
        if (nodeNameVector[i] == pNode -> m_name)
        {
            isFound = true;
            break;
        }
    }
    
    if (isFound)
    {
        if (manager.validate(dataType, pNode -> m_dataType, y))
        {
            std::cout << "OK octet string " <<  nodeName <<std::endl;
        }
        else
        {
            std::cout << "Not ok octet string " <<  nodeName <<std::endl;
        }
    }
    else 
    {
        std::cout << "Not ok octet string " <<  nodeName <<std::endl;
    }
    
    manager.addOctetString(dataType, y, lengthInBytes, endVector);
    
    //Validate oid element
    dataType.m_baseType = BaseDataType::OBJECT_IDENTIFIER;
    nodeName = "ifLastChange";  
    isFound = false;
    std::vector<unsigned int> vec;
    vec.push_back(1);
    vec.push_back(3);
    vec.push_back(6); 
    pNode = manager.getNodeByName(nodeName);
    
    for (std::vector<std::string>::size_type i = nodeNameVector.size() - 1; i != (std::vector<std::string>::size_type) - 1; i--)
    {
        if (nodeNameVector[i] == pNode -> m_name)
        {
            isFound = true;
            break;
        }
    }
    
    if (isFound)
    {
        if (manager.validate(dataType, pNode -> m_dataType))
        {
            std::cout << "OK oid " <<  nodeName <<std::endl;
        }
        else
        {
            std::cout << "Not ok oid " <<  nodeName <<std::endl;
        }
    }
    else 
    {
        std::cout << "Not ok oid " <<  nodeName <<std::endl;
    } 
    
    manager.addObjectIdentifier(dataType, vec, lengthInBytes, endVector);

    //Validate bool element
    dataType.m_baseType = BaseDataType::BOOLEAN;
    nodeName = "ifOutDiscards";  
    isFound = false;
    bool z = true;
    pNode = manager.getNodeByName(nodeName);
    
    for (std::vector<std::string>::size_type i = nodeNameVector.size() - 1; i != (std::vector<std::string>::size_type) - 1; i--)
    {
        if (nodeNameVector[i] == pNode -> m_name)
        {
            isFound = true;
            break;
        }
    }
    
    if (isFound)
    {
        if (manager.validate(dataType, pNode -> m_dataType))
        {
            std::cout << "OK boolean " <<  nodeName <<std::endl;
        }
        else
        {
            std::cout << "Not ok boolean " <<  nodeName <<std::endl;
        }
    }
    else 
    {
        std::cout << "Not ok boolean " <<  nodeName <<std::endl;
    } 
    
    manager.addBoolean(dataType, z, lengthInBytes, endVector);
    
    //Validate NULL element 
    dataType.m_baseType = BaseDataType::NULL_D;
    nodeName = "ifOutDiscards";  
    isFound = false;
    pNode = manager.getNodeByName(nodeName);
    
    for (std::vector<std::string>::size_type i = nodeNameVector.size() - 1; i != (std::vector<std::string>::size_type) - 1; i--)
    {
        if (nodeNameVector[i] == pNode -> m_name)
        {
            isFound = true;
            break;
        }
    }
    
    if (isFound)
    {
        if (manager.validate(dataType, pNode -> m_dataType))
        {
            std::cout << "OK null " <<  nodeName <<std::endl;
        }
        else
        {
            std::cout << "Not ok null " <<  nodeName <<std::endl;
        }
    }
    else 
    {
        std::cout << "Not ok null " <<  nodeName <<std::endl;
    } 
    
    manager.addNULL(dataType, lengthInBytes, endVector);
    
    manager.endASequence(lengthInBytes, beginVector);
    manager.getEncodedSequence(beginVector, endVector);
    
    
    //Print sequence elements
    for (std::vector<std::byte>::size_type i = 0; i < beginVector.size(); i++)
    {
        std::bitset<8> x(std::to_integer<uint8_t>(beginVector[i]));
        std::cout << x << std::endl;
    } 
    
    std::cout << std::endl;
    std::cout << std::endl;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x148, %rsp            # imm = 0x148
movq %rdi, %rbx
xorps %xmm0, %xmm0
andq $0x0, 0x90(%rsp)
movaps %xmm0, 0x80(%rsp)
andq $0x0, 0x70(%rsp)
movaps %xmm0, 0x60(%rsp)
andl $0x0, 0xc(%rsp)
leaq 0xc0(%rsp), %rdi
callq 0x17fe4
movabsq $0x100000006, %rax      # imm = 0x100000006
movq %rax, 0xc0(%rsp)
andl $0x0, 0xcc(%rsp)
leaq 0x14802(%rip), %rsi     # 0x19004
leaq 0x40(%rsp), %rdi
leaq 0x110(%rsp), %rdx
callq 0x5398
leaq 0x40(%rsp), %rsi
movq %rbx, %rdi
callq 0x61f8
xorps %xmm0, %xmm0
leaq 0x10(%rsp), %rcx
movaps %xmm0, (%rcx)
andq $0x0, 0x10(%rcx)
addq $0x28, %rax
leaq 0xc0(%rsp), %rsi
movq %rbx, %rdi
movq %rax, %rdx
callq 0x599c
leaq 0x147bd(%rip), %rcx     # 0x1900c
leaq 0x147c3(%rip), %rsi     # 0x19019
testb %al, %al
cmovneq %rcx, %rsi
movq 0x2374d(%rip), %rdi     # 0x27fb0
callq 0x4300
leaq 0x40(%rsp), %rsi
movq %rax, %rdi
callq 0x42e0
movq %rax, %rdi
callq 0x4190
leaq 0xc0(%rsp), %rsi
leaq 0x80(%rsp), %rdx
movq %rbx, %rdi
callq 0x62a2
andq $0x0, 0xc0(%rsp)
leaq 0x14785(%rip), %rsi     # 0x1902a
leaq 0x40(%rsp), %rdi
callq 0x45a0
movl $0x5, 0x34(%rsp)
leaq 0x40(%rsp), %rsi
movq %rbx, %rdi
callq 0x61f8
movq %rax, %r14
movq 0x18(%rsp), %rdi
subq 0x10(%rsp), %rdi
movq %rdi, %r13
sarq $0x5, %r13
leaq 0x8(%rax), %r12
incq %r13
addq $-0x20, %rdi
leaq 0x14753(%rip), %r15     # 0x1903d
decq %r13
je 0x4937
leaq -0x20(%rdi), %rbp
addq 0x10(%rsp), %rdi
movq %r12, %rsi
callq 0x53d3
movq %rbp, %rdi
testb %al, %al
je 0x48ea
addq $0x28, %r14
leaq 0xc0(%rsp), %rsi
leaq 0x34(%rsp), %rcx
movq %rbx, %rdi
movq %r14, %rdx
callq 0x5aa0
leaq 0x14707(%rip), %rcx     # 0x19031
leaq 0x1470c(%rip), %r15     # 0x1903d
testb %al, %al
cmovneq %rcx, %r15
movq 0x23672(%rip), %rdi     # 0x27fb0
movq %r15, %rsi
callq 0x4300
leaq 0x40(%rsp), %rsi
movq %rax, %rdi
callq 0x42e0
movq %rax, %rdi
callq 0x4190
leaq 0xc0(%rsp), %rsi
leaq 0x34(%rsp), %rdx
leaq 0xc(%rsp), %rcx
leaq 0x60(%rsp), %r8
movq %rbx, %rdi
callq 0x62ac
movl $0x1, 0xc0(%rsp)
leaq 0x146c1(%rip), %rsi     # 0x1904d
leaq 0x40(%rsp), %rdi
callq 0x45a0
leaq 0x146be(%rip), %rsi     # 0x1905b
leaq 0x110(%rsp), %rdi
leaq 0xa0(%rsp), %rdx
callq 0x5398
leaq 0x40(%rsp), %rsi
movq %rbx, %rdi
callq 0x61f8
movq %rax, %r14
movq 0x18(%rsp), %rdi
subq 0x10(%rsp), %rdi
movq %rdi, %r13
sarq $0x5, %r13
leaq 0x8(%rax), %r12
incq %r13
addq $-0x20, %rdi
leaq 0x1468b(%rip), %r15     # 0x19070
decq %r13
je 0x4a35
leaq -0x20(%rdi), %rbp
addq 0x10(%rsp), %rdi
movq %r12, %rsi
callq 0x53d3
movq %rbp, %rdi
testb %al, %al
je 0x49e5
addq $0x28, %r14
leaq 0xc0(%rsp), %rsi
leaq 0x110(%rsp), %rcx
movq %rbx, %rdi
movq %r14, %rdx
callq 0x5aaa
leaq 0x14637(%rip), %rcx     # 0x1905f
leaq 0x14641(%rip), %r15     # 0x19070
testb %al, %al
cmovneq %rcx, %r15
movq 0x23574(%rip), %rdi     # 0x27fb0
movq %r15, %rsi
callq 0x4300
leaq 0x40(%rsp), %rsi
movq %rax, %rdi
callq 0x42e0
movq %rax, %rdi
callq 0x4190
leaq 0xc0(%rsp), %rsi
leaq 0x110(%rsp), %rdx
leaq 0xc(%rsp), %rcx
leaq 0x60(%rsp), %r8
movq %rbx, %rdi
callq 0x62b6
movl $0x2, 0xc0(%rsp)
leaq 0x145f8(%rip), %rsi     # 0x19085
leaq 0x40(%rsp), %rdi
callq 0x45a0
leaq 0xa0(%rsp), %rdi
andq $0x0, 0x10(%rdi)
xorps %xmm0, %xmm0
movaps %xmm0, (%rdi)
leaq 0x38(%rsp), %rsi
movl $0x1, (%rsi)
callq 0x5688
leaq 0x38(%rsp), %rsi
movl $0x3, (%rsi)
leaq 0xa0(%rsp), %rdi
callq 0x5688
leaq 0x38(%rsp), %rsi
movl $0x6, (%rsi)
leaq 0xa0(%rsp), %rdi
callq 0x5688
leaq 0x40(%rsp), %rsi
movq %rbx, %rdi
callq 0x61f8
movq %rax, %r14
movq 0x18(%rsp), %rdi
subq 0x10(%rsp), %rdi
movq %rdi, %r13
sarq $0x5, %r13
leaq 0x8(%rax), %r12
incq %r13
addq $-0x20, %rdi
leaq 0x1457d(%rip), %r15     # 0x1909a
decq %r13
je 0x4b65
leaq -0x20(%rdi), %rbp
addq 0x10(%rsp), %rdi
movq %r12, %rsi
callq 0x53d3
movq %rbp, %rdi
testb %al, %al
je 0x4b1d
addq $0x28, %r14
leaq 0xc0(%rsp), %rsi
movq %rbx, %rdi
movq %r14, %rdx
callq 0x5a96
leaq 0x1453a(%rip), %rcx     # 0x19092
leaq 0x1453b(%rip), %r15     # 0x1909a
testb %al, %al
cmovneq %rcx, %r15
movq 0x23444(%rip), %rdi     # 0x27fb0
movq %r15, %rsi
callq 0x4300
leaq 0x40(%rsp), %rsi
movq %rax, %rdi
callq 0x42e0
movq %rax, %rdi
callq 0x4190
leaq 0xc0(%rsp), %rsi
leaq 0xa0(%rsp), %rdx
leaq 0xc(%rsp), %rcx
leaq 0x60(%rsp), %r8
movq %rbx, %rdi
callq 0x62c0
movl $0x3, 0xc0(%rsp)
leaq 0x144e9(%rip), %rsi     # 0x190a6
leaq 0x40(%rsp), %rdi
callq 0x45a0
movb $0x1, 0xb(%rsp)
leaq 0x40(%rsp), %rsi
movq %rbx, %rdi
callq 0x61f8
movq %rax, %r14
movq 0x18(%rsp), %rdi
subq 0x10(%rsp), %rdi
movq %rdi, %r13
sarq $0x5, %r13
leaq 0x8(%rax), %r12
incq %r13
addq $-0x20, %rdi
leaq 0x144c1(%rip), %r15     # 0x190c0
decq %r13
je 0x4c47
leaq -0x20(%rdi), %rbp
addq 0x10(%rsp), %rdi
movq %r12, %rsi
callq 0x53d3
movq %rbp, %rdi
testb %al, %al
je 0x4bff
addq $0x28, %r14
leaq 0xc0(%rsp), %rsi
movq %rbx, %rdi
movq %r14, %rdx
callq 0x5a96
leaq 0x1447a(%rip), %rcx     # 0x190b4
leaq 0x1447f(%rip), %r15     # 0x190c0
testb %al, %al
cmovneq %rcx, %r15
movq 0x23362(%rip), %rdi     # 0x27fb0
movq %r15, %rsi
callq 0x4300
leaq 0x40(%rsp), %rsi
movq %rax, %rdi
callq 0x42e0
movq %rax, %rdi
callq 0x4190
leaq 0xc0(%rsp), %rsi
leaq 0xb(%rsp), %rdx
leaq 0xc(%rsp), %rcx
leaq 0x60(%rsp), %r8
movq %rbx, %rdi
callq 0x62ca
movl $0x4, 0xc0(%rsp)
leaq 0x1440a(%rip), %rsi     # 0x190a6
leaq 0x40(%rsp), %rdi
callq 0x45a0
leaq 0x40(%rsp), %rsi
movq %rbx, %rdi
callq 0x61f8
movq %rax, %r14
movq 0x18(%rsp), %rdi
subq 0x10(%rsp), %rdi
movq %rdi, %r13
sarq $0x5, %r13
leaq 0x8(%rax), %r12
incq %r13
addq $-0x20, %rdi
leaq 0x14400(%rip), %r15     # 0x190d9
decq %r13
je 0x4d21
leaq -0x20(%rdi), %rbp
addq 0x10(%rsp), %rdi
movq %r12, %rsi
callq 0x53d3
movq %rbp, %rdi
testb %al, %al
je 0x4cd9
addq $0x28, %r14
leaq 0xc0(%rsp), %rsi
movq %rbx, %rdi
movq %r14, %rdx
callq 0x5a96
leaq 0x143bc(%rip), %rcx     # 0x190d0
leaq 0x143be(%rip), %r15     # 0x190d9
testb %al, %al
cmovneq %rcx, %r15
movq 0x23288(%rip), %rdi     # 0x27fb0
movq %r15, %rsi
callq 0x4300
leaq 0x40(%rsp), %rsi
movq %rax, %rdi
callq 0x42e0
movq %rax, %rdi
callq 0x4190
leaq 0xc0(%rsp), %rsi
leaq 0xc(%rsp), %rdx
leaq 0x60(%rsp), %rcx
movq %rbx, %rdi
callq 0x62d4
leaq 0xc(%rsp), %rsi
leaq 0x80(%rsp), %rdx
movq %rbx, %rdi
callq 0x62de
leaq 0x130(%rsp), %rdi
leaq 0x80(%rsp), %rdx
leaq 0x60(%rsp), %rcx
movq %rbx, %rsi
callq 0x62e8
leaq 0x130(%rsp), %rdi
callq 0x54f0
xorl %r15d, %r15d
movq 0x23208(%rip), %rbx     # 0x27fb0
leaq 0x38(%rsp), %r14
movq 0x80(%rsp), %rax
movq 0x88(%rsp), %rcx
subq %rax, %rcx
cmpq %rcx, %r15
jae 0x4de7
movzbl (%rax,%r15), %eax
movq %rax, 0x38(%rsp)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x53fc
movq %rax, %rdi
callq 0x4190
incq %r15
jmp 0x4dad
movq 0x231c2(%rip), %rdi     # 0x27fb0
callq 0x4190
movq 0x231b6(%rip), %rdi     # 0x27fb0
callq 0x4190
leaq 0xa0(%rsp), %rdi
callq 0x5654
leaq 0x110(%rsp), %rdi
callq 0x4170
leaq 0x10(%rsp), %rdi
callq 0x54c4
leaq 0x40(%rsp), %rdi
callq 0x4170
leaq 0xc0(%rsp), %rdi
callq 0x18002
leaq 0x60(%rsp), %rdi
callq 0x54f0
leaq 0x80(%rsp), %rdi
callq 0x54f0
addq $0x148, %rsp            # imm = 0x148
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x4e8a
jmp 0x4e8a
jmp 0x4e8a
jmp 0x4e83
movq %rax, %rbx
jmp 0x4eb1
movq %rax, %rbx
jmp 0x4ebb
movq %rax, %rbx
jmp 0x4ec8
jmp 0x4e83
jmp 0x4e8a
movq %rax, %rbx
jmp 0x4e9a
movq %rax, %rbx
jmp 0x4ea7
jmp 0x4e8a
movq %rax, %rbx
leaq 0xa0(%rsp), %rdi
callq 0x5654
leaq 0x110(%rsp), %rdi
callq 0x4170
leaq 0x10(%rsp), %rdi
callq 0x54c4
leaq 0x40(%rsp), %rdi
callq 0x4170
leaq 0xc0(%rsp), %rdi
callq 0x18002
leaq 0x60(%rsp), %rdi
callq 0x54f0
leaq 0x80(%rsp), %rdi
callq 0x54f0
movq %rbx, %rdi
callq 0x4540