// File: /workspace/github_cpp_makefile_star2_O1/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 %r13
pushq %r12
pushq %rbx
subq $0x140, %rsp            # imm = 0x140
movq %rdi, %rbx
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
xorl %eax, %eax
movq %rax, 0x20(%rsp)
movq %rax, 0x40(%rsp)
movaps %xmm0, 0x30(%rsp)
movl $0x0, 0x8(%rsp)
leaq 0xf0(%rsp), %rdi
callq 0x1dc38
movabsq $0x100000006, %r14      # imm = 0x100000006
leaq 0xf0(%rsp), %rsi
movq %r14, (%rsi)
movl $0x0, 0xc(%rsi)
leaq 0x10(%rsp), %rdx
movq %rbx, %rdi
callq 0x8362
leaq 0x9c(%rsp), %rdx
movl $0x5, (%rdx)
leaq 0xf0(%rsp), %rsi
movq $0x0, (%rsi)
leaq 0x8(%rsp), %rcx
leaq 0x30(%rsp), %r8
movq %rbx, %rdi
callq 0x836c
leaq 0xb0(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x188fa(%rip), %rsi     # 0x1f0e6
leaq 0x188f7(%rip), %rdx     # 0x1f0ea
leaq 0xa0(%rsp), %rdi
callq 0x6fee
leaq 0xf0(%rsp), %rsi
movl $0x1, (%rsi)
leaq 0xa0(%rsp), %rdx
leaq 0x8(%rsp), %rcx
leaq 0x30(%rsp), %r8
movq %rbx, %rdi
callq 0x8376
xorps %xmm0, %xmm0
leaq 0x70(%rsp), %rdx
movaps %xmm0, (%rdx)
xorl %eax, %eax
movq %rax, 0x10(%rdx)
movq %rax, 0x60(%rsp)
movaps %xmm0, 0x50(%rsp)
movl %eax, 0xc(%rsp)
leaq 0xf0(%rsp), %rsi
movq %r14, (%rsi)
movl %eax, 0xc(%rsi)
movq %rbx, %rdi
callq 0x8362
leaq 0x98(%rsp), %rdx
movl $0x5, (%rdx)
leaq 0xf0(%rsp), %rsi
movq $0x0, (%rsi)
leaq 0xc(%rsp), %rcx
leaq 0x50(%rsp), %r8
movq %rbx, %rdi
callq 0x836c
leaq 0x94(%rsp), %rdx
movl $0xa, (%rdx)
leaq 0xf0(%rsp), %rsi
movq $0x0, (%rsi)
leaq 0xc(%rsp), %rcx
leaq 0x50(%rsp), %r8
movq %rbx, %rdi
callq 0x836c
leaq 0x8(%rsp), %rsi
leaq 0xc(%rsp), %rdx
leaq 0x70(%rsp), %rcx
movq %rbx, %rdi
callq 0x83f6
leaq 0xd8(%rsp), %rdi
leaq 0x70(%rsp), %rdx
leaq 0x50(%rsp), %rcx
leaq 0x30(%rsp), %r8
movq %rbx, %rsi
callq 0x8400
movq 0xd8(%rsp), %rdi
testq %rdi, %rdi
je 0x690e
movq 0xe8(%rsp), %rsi
subq %rdi, %rsi
callq 0x5320
leaq 0x90(%rsp), %rdx
movl $0x5, (%rdx)
leaq 0xf0(%rsp), %rsi
movq $0x0, (%rsi)
leaq 0x8(%rsp), %rcx
leaq 0x30(%rsp), %r8
movq %rbx, %rdi
callq 0x836c
leaq 0x8(%rsp), %rsi
leaq 0x10(%rsp), %rdx
movq %rbx, %rdi
callq 0x839e
leaq 0xc0(%rsp), %rdi
leaq 0x10(%rsp), %rdx
leaq 0x30(%rsp), %rcx
movq %rbx, %rsi
callq 0x83a8
movq 0xc0(%rsp), %rdi
testq %rdi, %rdi
je 0x6986
movq 0xd0(%rsp), %rsi
subq %rdi, %rsi
callq 0x5320
movq 0x10(%rsp), %rax
cmpq %rax, 0x18(%rsp)
je 0x69fb
xorl %r13d, %r13d
movq 0x2461c(%rip), %rbx     # 0x2afb8
leaq 0x88(%rsp), %r14
movzbl (%rax,%r13), %eax
movq %rax, 0x88(%rsp)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x6ddb
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x5300
movsbl %al, %esi
movq %r15, %rdi
callq 0x5040
movq %rax, %rdi
callq 0x5260
incq %r13
movq 0x10(%rsp), %rax
movq 0x18(%rsp), %rcx
subq %rax, %rcx
cmpq %rcx, %r13
jb 0x69a4
movq 0x245b6(%rip), %rdi     # 0x2afb8
movq (%rdi), %rax
addq -0x18(%rax), %rdi
movl $0xa, %esi
callq 0x5300
movsbl %al, %esi
movq 0x2459b(%rip), %rbx     # 0x2afb8
movq %rbx, %rdi
callq 0x5040
movq %rax, %rdi
callq 0x5260
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x5300
movsbl %al, %esi
movq 0x2456d(%rip), %rdi     # 0x2afb8
callq 0x5040
movq %rax, %rdi
callq 0x5260
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x6a6f
movq 0x60(%rsp), %rsi
subq %rdi, %rsi
callq 0x5320
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x6a89
movq 0x80(%rsp), %rsi
subq %rdi, %rsi
callq 0x5320
movq 0xa0(%rsp), %rdi
cmpq %r12, %rdi
je 0x6aa6
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x5320
leaq 0xf0(%rsp), %rdi
callq 0x1dc56
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x6aca
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x5320
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x6ae1
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x5320
addq $0x140, %rsp            # imm = 0x140
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
jmp 0x6b0d
jmp 0x6b0d
movq %rax, %rbx
jmp 0x6b41
jmp 0x6aff
jmp 0x6aff
movq %rax, %rbx
jmp 0x6b5e
movq %rax, %rbx
jmp 0x6b6b
jmp 0x6b0d
jmp 0x6b0d
movq %rax, %rbx
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x6b27
movq 0x60(%rsp), %rsi
subq %rdi, %rsi
callq 0x5320
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x6b41
movq 0x80(%rsp), %rsi
subq %rdi, %rsi
callq 0x5320
movq 0xa0(%rsp), %rdi
cmpq %r12, %rdi
je 0x6b5e
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x5320
leaq 0xf0(%rsp), %rdi
callq 0x1dc56
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x6b82
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x5320
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x6b99
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x5320
movq %rbx, %rdi
callq 0x5550