// File: /workspace/github_cpp_makefile_star2_O1/EmbeddedPaul166[P]SNMP-Agent/src/tree.cpp
// Function: Tree::addNode(unsigned int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, DataType, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, AccessType, StatusType, Node*)
Node * Tree::addNode(unsigned int objectIdentifier, std::string name, DataType dataType, std::string description, AccessType accessType, StatusType statusType, Node * pParentElement)
{ 
    std::list <Node *> emptyChildList;
    emptyChildList.clear();
    
    Node newNode(objectIdentifier, name, dataType, description, accessType, statusType, pParentElement, emptyChildList);    
    
    m_nodeList.push_back(newNode);
    
    if (pParentElement -> m_childElementPointerList.empty())
    {
        pParentElement -> m_childElementPointerList.push_back(&m_nodeList.back()); 
    }
    else
    {
        for (std::list<Node *>::iterator it = pParentElement -> m_childElementPointerList.begin(); it != pParentElement -> m_childElementPointerList.end(); it++)
        {
            int childObjectIdentifier = (*it) -> m_objectIdentifier;
            int newChildObjectIdentifier = m_nodeList.back().m_objectIdentifier;
            if (newChildObjectIdentifier < childObjectIdentifier)
            {
                pParentElement -> m_childElementPointerList.insert(it, &m_nodeList.back());
                break;
            }
            else if (pParentElement -> m_childElementPointerList.back() == (*it))
            {
                pParentElement -> m_childElementPointerList.push_back(&m_nodeList.back());
                break;
            }
        }
    }
    Node * pNewNode = &m_nodeList.back();
    return pNewNode;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x188, %rsp            # imm = 0x188
movl %r9d, %ebp
movq %r8, %r14
movq %rcx, %r12
movl %esi, %r15d
movq %rdi, %rbx
leaq 0x40(%rsp), %rax
movq %rax, 0x8(%rax)
movq %rax, (%rax)
movq $0x0, 0x10(%rax)
leaq 0x30(%rsp), %rax
movq %rax, -0x10(%rax)
movq (%rdx), %rsi
movq 0x8(%rdx), %rdx
addq %rsi, %rdx
leaq 0x20(%rsp), %rdi
callq 0x6f5e
movups (%r12), %xmm0
movups 0x10(%r12), %xmm1
leaq 0x90(%rsp), %r13
movaps %xmm1, -0x10(%r13)
movaps %xmm0, -0x20(%r13)
leaq 0x20(%r12), %rsi
movq %r13, %rdi
callq 0x8858
leaq 0xa8(%rsp), %rdi
addq $0x38, %r12
movq %r12, %rsi
callq 0x88e2
leaq 0x10(%rsp), %rax
movq %rax, -0x10(%rax)
movq (%r14), %rsi
movq 0x8(%r14), %rdx
addq %rsi, %rdx
movq %rsp, %rdi
callq 0x6f5e
leaq 0x58(%rsp), %r12
leaq 0x40(%rsp), %r14
movq %r12, %rdi
movq %r14, %rsi
callq 0x1e47a
movq 0x1c8(%rsp), %r13
movl 0x1c0(%rsp), %eax
subq $0x8, %rsp
leaq 0xd0(%rsp), %rdi
leaq 0x28(%rsp), %rdx
leaq 0x78(%rsp), %rcx
leaq 0x8(%rsp), %r8
movl %r15d, %esi
movl %ebp, %r9d
pushq %r12
pushq %r13
pushq %rax
callq 0x1e69c
addq $0x20, %rsp
movq 0x58(%rsp), %rdi
cmpq %r12, %rdi
je 0x1e086
movq (%rdi), %r15
movl $0x18, %esi
callq 0x5320
movq %r15, %rdi
cmpq %r12, %r15
jne 0x1e071
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x1e0a1
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x5320
leaq 0x70(%rsp), %rdi
callq 0x1dc56
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x1e0c7
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x5320
leaq 0x8(%rbx), %r15
leaq 0xc8(%rsp), %rsi
movq %r15, %rdi
callq 0x1e544
movq %rax, %rdi
movq %r15, %rsi
callq 0x5070
incq 0x18(%rbx)
leaq 0xa8(%r13), %r15
movq 0xa8(%r13), %r12
movq 0x10(%rbx), %rbp
cmpq %r15, %r12
je 0x1e125
movl 0x10(%rbp), %eax
movq 0x10(%r12), %rcx
cmpl (%rcx), %eax
jl 0x1e131
movq 0xb0(%r13), %rdx
cmpq %rcx, 0x10(%rdx)
je 0x1e14b
movq (%r12), %r12
cmpq %r15, %r12
jne 0x1e104
jmp 0x1e16f
movl $0x18, %edi
callq 0x5310
jmp 0x1e155
movl $0x18, %edi
callq 0x5310
addq $0x10, %rbp
movq %rbp, 0x10(%rax)
movq %rax, %rdi
movq %r12, %rsi
jmp 0x1e163
movl $0x18, %edi
callq 0x5310
addq $0x10, %rbp
movq %rbp, 0x10(%rax)
movq %rax, %rdi
movq %r15, %rsi
callq 0x5070
incq 0xb8(%r13)
movq 0x10(%rbx), %rbx
leaq 0xc8(%rsp), %rdi
callq 0x1e8a8
movq 0x40(%rsp), %rdi
cmpq %r14, %rdi
je 0x1e19f
movq (%rdi), %r15
movl $0x18, %esi
callq 0x5320
movq %r15, %rdi
cmpq %r14, %r15
jne 0x1e18a
addq $0x10, %rbx
movq %rbx, %rax
addq $0x188, %rsp            # imm = 0x188
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x1e1be
jmp 0x1e1be
jmp 0x1e1be
movq %rax, %rbx
leaq 0xc8(%rsp), %rdi
callq 0x1e8a8
jmp 0x1e257
movq %rax, %rbx
movq 0x58(%rsp), %rdi
cmpq %r12, %rdi
je 0x1e1fa
movq (%rdi), %r14
movl $0x18, %esi
callq 0x5320
movq %r14, %rdi
cmpq %r12, %r14
jne 0x1e1e0
jmp 0x1e1fa
movq %rax, %rbx
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x1e21a
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x5320
jmp 0x1e21a
movq %rax, %rbx
leaq 0x70(%rsp), %rdi
callq 0x1dc56
jmp 0x1e236
movq %rax, %rbx
movq %r13, %rdi
callq 0x6f02
jmp 0x1e236
movq %rax, %rbx
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x1e257
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x5320
jmp 0x1e257
movq %rax, %rbx
movq 0x40(%rsp), %rdi
leaq 0x40(%rsp), %r15
cmpq %r15, %rdi
je 0x1e27b
movq (%rdi), %r14
movl $0x18, %esi
callq 0x5320
movq %r14, %rdi
cmpq %r15, %r14
jne 0x1e266
movq %rbx, %rdi
callq 0x5550
nop