// File: EmbeddedPaul166[P]SNMP-Agent/src/coder.cpp
// Function: Coder::encodeObjectIdentifier(DataType&, std::vector<unsigned int, std::allocator<unsigned int>>&)
std::vector<std::byte> Coder::encodeObjectIdentifier(DataType & dataType, std::vector<unsigned int> & data)
{
    std::vector<std::byte> dataVector;
    dataVector.push_back(encodeID(dataType));
    int length = data.size() - 1;
    std::vector<std::byte> lengthInBytes = encodeLength(length);
    dataVector.insert(dataVector.end(), lengthInBytes.begin(), lengthInBytes.end());
    if (data.size() > 2)
    {
        uint8_t firstElement = 40*data[0] + data[1];
        firstElement |= (1 << 7);
        dataVector.push_back(static_cast<std::byte>(firstElement));
        for (std::vector<unsigned int>::size_type i = 2; i < data.size(); i++)
        {
            if (i == data.size() - 1)
            {
                uint8_t element = data[i];
                element &= ~(1 << 7);
                dataVector.push_back(static_cast<std::byte>(element));
            }
            else
            {
                uint8_t element = data[i];
                element |= (1 << 7);
                dataVector.push_back(static_cast<std::byte>(element));
            }
        }
    }
    else if (data.size() == 2)
    {
        uint8_t firstElement = 40*data[0] + data[1];
        firstElement &= ~(1 << 7);
        dataVector.push_back(static_cast<std::byte>(firstElement));
    }
    else
    {
        dataVector.push_back(static_cast<std::byte>(0));
    }
    return dataVector;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xe0, %rsp
movq %rdi, -0xa8(%rbp)
movq %rdi, %rax
movq %rax, -0xa0(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x98(%rbp)
movb $0x0, -0x21(%rbp)
callq 0x8110
movq -0x98(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0xff20
movb %al, -0x90(%rbp)
jmp 0x10828
movq -0xa8(%rbp), %rdi
movb -0x90(%rbp), %al
movb %al, -0x22(%rbp)
leaq -0x22(%rbp), %rsi
callq 0x11910
jmp 0x10843
movq -0x20(%rbp), %rdi
callq 0x9580
movq -0x98(%rbp), %rsi
decl %eax
movl %eax, -0x38(%rbp)
leaq -0x50(%rbp), %rdi
leaq -0x38(%rbp), %rdx
callq 0x10370
jmp 0x10867
movq -0xa8(%rbp), %rdi
callq 0x119f0
movq %rax, -0x60(%rbp)
leaq -0x58(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x11a20
leaq -0x50(%rbp), %rdi
movq %rdi, -0xb8(%rbp)
callq 0x11a60
movq -0xb8(%rbp), %rdi
movq %rax, -0x68(%rbp)
callq 0x119f0
movq -0xa8(%rbp), %rdi
movq %rax, -0x70(%rbp)
movq -0x58(%rbp), %rsi
movq -0x68(%rbp), %rdx
movq -0x70(%rbp), %rcx
callq 0x11940
movq %rax, -0xb0(%rbp)
jmp 0x108c9
movq -0xb0(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x20(%rbp), %rdi
callq 0x9580
cmpq $0x2, %rax
jbe 0x10a7e
movq -0x20(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0xba20
movl (%rax), %ecx
movl %ecx, %eax
leal (%rax,%rax,4), %eax
movl %eax, -0xbc(%rbp)
movq -0x20(%rbp), %rdi
movl $0x1, %esi
callq 0xba20
movq -0xa8(%rbp), %rdi
movq %rax, %rcx
movl -0xbc(%rbp), %eax
movl (%rcx), %edx
movl %eax, %ecx
movl %edx, %eax
leal (%rax,%rcx,8), %eax
movb %al, -0x79(%rbp)
movb -0x79(%rbp), %al
orb $-0x80, %al
movb %al, -0x79(%rbp)
movb -0x79(%rbp), %al
movb %al, -0x7a(%rbp)
leaq -0x7a(%rbp), %rsi
callq 0x11910
jmp 0x10944
movq $0x2, -0x88(%rbp)
movq -0x88(%rbp), %rax
movq %rax, -0xc8(%rbp)
movq -0x20(%rbp), %rdi
callq 0x9580
movq %rax, %rcx
movq -0xc8(%rbp), %rax
cmpq %rcx, %rax
jae 0x10a79
movq -0x88(%rbp), %rax
movq %rax, -0xd0(%rbp)
movq -0x20(%rbp), %rdi
callq 0x9580
movq %rax, %rcx
movq -0xd0(%rbp), %rax
subq $0x1, %rcx
cmpq %rcx, %rax
jne 0x10a17
movq -0x20(%rbp), %rdi
movq -0x88(%rbp), %rsi
callq 0xba20
movq -0xa8(%rbp), %rdi
movb (%rax), %al
movb %al, -0x89(%rbp)
movb -0x89(%rbp), %al
andb $0x7f, %al
movb %al, -0x89(%rbp)
movb -0x89(%rbp), %al
movb %al, -0x8a(%rbp)
leaq -0x8a(%rbp), %rsi
callq 0x11910
jmp 0x109ea
jmp 0x10a60
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0x10b4d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x8320
jmp 0x10b4d
movq -0x20(%rbp), %rdi
movq -0x88(%rbp), %rsi
callq 0xba20
movq -0xa8(%rbp), %rdi
movb (%rax), %al
movb %al, -0x8b(%rbp)
movb -0x8b(%rbp), %al
orb $-0x80, %al
movb %al, -0x8b(%rbp)
movb -0x8b(%rbp), %al
movb %al, -0x8c(%rbp)
leaq -0x8c(%rbp), %rsi
callq 0x11910
jmp 0x10a5e
jmp 0x10a60
jmp 0x10a62
movq -0x88(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x88(%rbp)
jmp 0x1094f
jmp 0x10b1e
movq -0x20(%rbp), %rdi
callq 0x9580
cmpq $0x2, %rax
jne 0x10afe
movq -0x20(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0xba20
movl (%rax), %ecx
movl %ecx, %eax
leal (%rax,%rax,4), %eax
movl %eax, -0xd4(%rbp)
movq -0x20(%rbp), %rdi
movl $0x1, %esi
callq 0xba20
movq -0xa8(%rbp), %rdi
movq %rax, %rcx
movl -0xd4(%rbp), %eax
movl (%rcx), %edx
movl %eax, %ecx
movl %edx, %eax
leal (%rax,%rcx,8), %eax
movb %al, -0x8d(%rbp)
movb -0x8d(%rbp), %al
andb $0x7f, %al
movb %al, -0x8d(%rbp)
movb -0x8d(%rbp), %al
movb %al, -0x8e(%rbp)
leaq -0x8e(%rbp), %rsi
callq 0x11910
jmp 0x10afc
jmp 0x10b1c
movq -0xa8(%rbp), %rdi
movb $0x0, -0x8f(%rbp)
leaq -0x8f(%rbp), %rsi
callq 0x11910
jmp 0x10b1a
jmp 0x10b1c
jmp 0x10b1e
movb $0x1, -0x21(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x8320
testb $0x1, -0x21(%rbp)
jne 0x10b3d
movq -0xa8(%rbp), %rdi
callq 0x8320
movq -0xa0(%rbp), %rax
addq $0xe0, %rsp
popq %rbp
retq
movq -0xa8(%rbp), %rdi
callq 0x8320
movq -0x30(%rbp), %rdi
callq 0x6790
nopw %cs:(%rax,%rax)