// File: /workspace/github_cpp_makefile_star2_O2/EmbeddedPaul166[P]SNMP-Agent/src/main.cpp
// Function: encodeASequenceInsideASequence(Manager&)
void encodeASequenceInsideASequence(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;
    manager.startASequence(dataType, beginVector);
    
    int x = 5;
    dataType.m_baseType = BaseDataType::INTEGER;
    dataType.m_complexity = EncodingComplexity::PRIMITIVE;
    manager.addInteger(dataType, x, lengthInBytes, endVector);
    
    std::string y = "kupa";
    dataType.m_baseType = BaseDataType::OCTET_STRING;
    manager.addOctetString(dataType, y, lengthInBytes, endVector);
    
    std::vector<std::byte> beginVector2;
    std::vector<std::byte> endVector2;
    int lengthInBytes2 = 0;
    
    dataType.m_baseType = BaseDataType::SEQUENCE_OF;
    dataType.m_complexity = EncodingComplexity::CONSTRUCTED;
    dataType.m_visibility = DataVisibility::UNIVERSAL;
    manager.startASequence(dataType, beginVector2);
    
    int l = 5;
    dataType.m_baseType = BaseDataType::INTEGER;
    dataType.m_complexity = EncodingComplexity::PRIMITIVE;
    manager.addInteger(dataType, l, lengthInBytes2, endVector2);
    
    int k = 10;
    dataType.m_baseType = BaseDataType::INTEGER;
    dataType.m_complexity = EncodingComplexity::PRIMITIVE;
    manager.addInteger(dataType, k, lengthInBytes2, endVector2);
    
    manager.endSubSequence(lengthInBytes, lengthInBytes2, beginVector2);
    manager.getEncodedSubSequence(beginVector2, endVector2, endVector);
    
    int j = 5;
    dataType.m_baseType = BaseDataType::INTEGER;
    dataType.m_complexity = EncodingComplexity::PRIMITIVE;
    manager.addInteger(dataType, j, lengthInBytes, endVector);

    manager.endASequence(lengthInBytes, beginVector);
    manager.getEncodedSequence(beginVector, endVector);
    
    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 %r15
pushq %r14
pushq %rbx
subq $0x140, %rsp            # imm = 0x140
movq %rdi, %rbx
xorps %xmm0, %xmm0
andq $0x0, 0x40(%rsp)
movaps %xmm0, 0x30(%rsp)
andq $0x0, 0x20(%rsp)
movaps %xmm0, 0x10(%rsp)
andl $0x0, 0x8(%rsp)
leaq 0xc0(%rsp), %rdi
callq 0x17fe4
movabsq $0x100000006, %r14      # imm = 0x100000006
leaq 0xc0(%rsp), %rsi
movq %r14, (%rsi)
andl $0x0, 0xc(%rsi)
leaq 0x30(%rsp), %rdx
movq %rbx, %rdi
callq 0x62a2
leaq 0x9c(%rsp), %rdx
movl $0x5, (%rdx)
leaq 0xc0(%rsp), %rsi
andq $0x0, (%rsi)
leaq 0x8(%rsp), %rcx
leaq 0x10(%rsp), %r8
movq %rbx, %rdi
callq 0x62ac
leaq 0x1416c(%rip), %rsi     # 0x190e6
leaq 0xa0(%rsp), %rdi
leaq 0x70(%rsp), %rdx
callq 0x5398
leaq 0xc0(%rsp), %rsi
movl $0x1, (%rsi)
leaq 0xa0(%rsp), %rdx
leaq 0x8(%rsp), %rcx
leaq 0x10(%rsp), %r8
movq %rbx, %rdi
callq 0x62b6
xorps %xmm0, %xmm0
leaq 0x70(%rsp), %rdx
movaps %xmm0, (%rdx)
andq $0x0, 0x10(%rdx)
movaps %xmm0, 0x50(%rsp)
andq $0x0, 0x60(%rsp)
andl $0x0, 0xc(%rsp)
leaq 0xc0(%rsp), %rsi
movq %r14, (%rsi)
andl $0x0, 0xc(%rsi)
movq %rbx, %rdi
callq 0x62a2
leaq 0x98(%rsp), %rdx
movl $0x5, (%rdx)
leaq 0xc0(%rsp), %rsi
andq $0x0, (%rsi)
leaq 0xc(%rsp), %rcx
leaq 0x50(%rsp), %r8
movq %rbx, %rdi
callq 0x62ac
leaq 0x94(%rsp), %rdx
movl $0xa, (%rdx)
leaq 0xc0(%rsp), %rsi
andq $0x0, (%rsi)
leaq 0xc(%rsp), %rcx
leaq 0x50(%rsp), %r8
movq %rbx, %rdi
callq 0x62ac
leaq 0x8(%rsp), %rsi
leaq 0xc(%rsp), %rdx
leaq 0x70(%rsp), %rcx
movq %rbx, %rdi
callq 0x6328
leaq 0x128(%rsp), %rdi
leaq 0x70(%rsp), %rdx
leaq 0x50(%rsp), %rcx
leaq 0x10(%rsp), %r8
movq %rbx, %rsi
callq 0x6332
leaq 0x128(%rsp), %rdi
callq 0x54f0
leaq 0x90(%rsp), %rdx
movl $0x5, (%rdx)
leaq 0xc0(%rsp), %rsi
andq $0x0, (%rsi)
leaq 0x8(%rsp), %rcx
leaq 0x10(%rsp), %r8
movq %rbx, %rdi
callq 0x62ac
leaq 0x8(%rsp), %rsi
leaq 0x30(%rsp), %rdx
movq %rbx, %rdi
callq 0x62de
leaq 0x110(%rsp), %rdi
leaq 0x30(%rsp), %rdx
leaq 0x10(%rsp), %rcx
movq %rbx, %rsi
callq 0x62e8
leaq 0x110(%rsp), %rdi
callq 0x54f0
xorl %r15d, %r15d
movq 0x22ebb(%rip), %rbx     # 0x27fb0
leaq 0x88(%rsp), %r14
movq 0x30(%rsp), %rax
movq 0x38(%rsp), %rcx
subq %rax, %rcx
cmpq %rcx, %r15
jae 0x5134
movzbl (%rax,%r15), %eax
movq %rax, 0x88(%rsp)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x53fc
movq %rax, %rdi
callq 0x4190
incq %r15
jmp 0x50fd
movq 0x22e75(%rip), %rdi     # 0x27fb0
callq 0x4190
movq 0x22e69(%rip), %rdi     # 0x27fb0
callq 0x4190
leaq 0x50(%rsp), %rdi
callq 0x54f0
leaq 0x70(%rsp), %rdi
callq 0x54f0
leaq 0xa0(%rsp), %rdi
callq 0x4170
leaq 0xc0(%rsp), %rdi
callq 0x18002
leaq 0x10(%rsp), %rdi
callq 0x54f0
leaq 0x30(%rsp), %rdi
callq 0x54f0
addq $0x140, %rsp            # imm = 0x140
popq %rbx
popq %r14
popq %r15
retq
jmp 0x51b6
jmp 0x51b6
movq %rax, %rbx
jmp 0x51cd
jmp 0x51a8
jmp 0x51a8
movq %rax, %rbx
jmp 0x51da
movq %rax, %rbx
jmp 0x51e7
jmp 0x51b6
jmp 0x51b6
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0x54f0
leaq 0x70(%rsp), %rdi
callq 0x54f0
leaq 0xa0(%rsp), %rdi
callq 0x4170
leaq 0xc0(%rsp), %rdi
callq 0x18002
leaq 0x10(%rsp), %rdi
callq 0x54f0
leaq 0x30(%rsp), %rdi
callq 0x54f0
movq %rbx, %rdi
callq 0x4540