// File: /workspace/github_cpp_makefile_star2_O3/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 0x1cc78
movabsq $0x100000006, %r14      # imm = 0x100000006
leaq 0xf0(%rsp), %rsi
movq %r14, (%rsi)
movl $0x0, 0xc(%rsi)
leaq 0x10(%rsp), %rdx
movq %rbx, %rdi
callq 0x7380
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 0x738a
leaq 0xb0(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x188eb(%rip), %rsi     # 0x1e0e6
leaq 0x188e8(%rip), %rdx     # 0x1e0ea
leaq 0xa0(%rsp), %rdi
callq 0x6006
leaq 0xf0(%rsp), %rsi
movl $0x1, (%rsi)
leaq 0xa0(%rsp), %rdx
leaq 0x8(%rsp), %rcx
leaq 0x30(%rsp), %r8
movq %rbx, %rdi
callq 0x7394
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 0x7380
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 0x738a
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 0x738a
leaq 0x8(%rsp), %rsi
leaq 0xc(%rsp), %rdx
leaq 0x70(%rsp), %rcx
movq %rbx, %rdi
callq 0x7414
leaq 0xd8(%rsp), %rdi
leaq 0x70(%rsp), %rdx
leaq 0x50(%rsp), %rcx
leaq 0x30(%rsp), %r8
movq %rbx, %rsi
callq 0x741e
movq 0xd8(%rsp), %rdi
testq %rdi, %rdi
je 0x591d
movq 0xe8(%rsp), %rsi
subq %rdi, %rsi
callq 0x4320
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 0x738a
leaq 0x8(%rsp), %rsi
leaq 0x10(%rsp), %rdx
movq %rbx, %rdi
callq 0x73bc
leaq 0xc0(%rsp), %rdi
leaq 0x10(%rsp), %rdx
leaq 0x30(%rsp), %rcx
movq %rbx, %rsi
callq 0x73c6
movq 0xc0(%rsp), %rdi
testq %rdi, %rdi
je 0x5995
movq 0xd0(%rsp), %rsi
subq %rdi, %rsi
callq 0x4320
movq 0x10(%rsp), %rax
cmpq %rax, 0x18(%rsp)
je 0x5a0a
xorl %r13d, %r13d
movq 0x2460d(%rip), %rbx     # 0x29fb8
leaq 0x88(%rsp), %r14
movzbl (%rax,%r13), %eax
movq %rax, 0x88(%rsp)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x5dea
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x4300
movsbl %al, %esi
movq %r15, %rdi
callq 0x4040
movq %rax, %rdi
callq 0x4260
incq %r13
movq 0x10(%rsp), %rax
movq 0x18(%rsp), %rcx
subq %rax, %rcx
cmpq %rcx, %r13
jb 0x59b3
movq 0x245a7(%rip), %rdi     # 0x29fb8
movq (%rdi), %rax
addq -0x18(%rax), %rdi
movl $0xa, %esi
callq 0x4300
movsbl %al, %esi
movq 0x2458c(%rip), %rbx     # 0x29fb8
movq %rbx, %rdi
callq 0x4040
movq %rax, %rdi
callq 0x4260
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x4300
movsbl %al, %esi
movq 0x2455e(%rip), %rdi     # 0x29fb8
callq 0x4040
movq %rax, %rdi
callq 0x4260
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x5a7e
movq 0x60(%rsp), %rsi
subq %rdi, %rsi
callq 0x4320
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x5a98
movq 0x80(%rsp), %rsi
subq %rdi, %rsi
callq 0x4320
movq 0xa0(%rsp), %rdi
cmpq %r12, %rdi
je 0x5ab5
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x4320
leaq 0xf0(%rsp), %rdi
callq 0x1cc96
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x5ad9
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x4320
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x5af0
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x4320
addq $0x140, %rsp            # imm = 0x140
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
jmp 0x5b1c
jmp 0x5b1c
movq %rax, %rbx
jmp 0x5b50
jmp 0x5b0e
jmp 0x5b0e
movq %rax, %rbx
jmp 0x5b6d
movq %rax, %rbx
jmp 0x5b91
jmp 0x5b1c
jmp 0x5b1c
movq %rax, %rbx
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x5b36
movq 0x60(%rsp), %rsi
subq %rdi, %rsi
callq 0x4320
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x5b50
movq 0x80(%rsp), %rsi
subq %rdi, %rsi
callq 0x4320
movq 0xa0(%rsp), %rdi
cmpq %r12, %rdi
je 0x5b6d
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x4320
leaq 0xf0(%rsp), %rdi
callq 0x1cc96
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x5b91
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x4320
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x5ba8
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x4320
movq %rbx, %rdi
callq 0x4550