// File: /workspace/github_cpp_makefile_star2_O2/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, %r15
movq %rcx, %r12
movq %rdx, %r13
movl %esi, %r14d
movq %rdi, %rbx
leaq 0x8(%rsp), %rdi
movq %rdi, 0x8(%rdi)
movq %rdi, (%rdi)
andq $0x0, 0x10(%rdi)
callq 0x18594
leaq 0x58(%rsp), %rdi
movq %r13, %rsi
callq 0x4410
leaq 0x78(%rsp), %rdi
movq %r12, %rsi
callq 0x65f4
leaq 0x38(%rsp), %rdi
movq %r15, %rsi
callq 0x4410
leaq 0x20(%rsp), %r15
leaq 0x8(%rsp), %rsi
movq %r15, %rdi
callq 0x185ac
movq 0x1c8(%rsp), %r12
movl 0x1c0(%rsp), %eax
subq $0x8, %rsp
leaq 0xd0(%rsp), %rdi
leaq 0x60(%rsp), %rdx
leaq 0x80(%rsp), %rcx
leaq 0x40(%rsp), %r8
movl %r14d, %esi
movl %ebp, %r9d
pushq %r15
pushq %r12
pushq %rax
callq 0x189b4
addq $0x20, %rsp
leaq 0x20(%rsp), %rdi
callq 0x18654
leaq 0x38(%rsp), %rdi
callq 0x4170
leaq 0x78(%rsp), %rdi
callq 0x18002
leaq 0x58(%rsp), %rdi
callq 0x4170
leaq 0x8(%rbx), %rdi
leaq 0xc8(%rsp), %rsi
callq 0x185e6
leaq 0xa8(%r12), %rdi
movq 0xa8(%r12), %rsi
cmpq %rdi, %rsi
je 0x1833d
movq 0x10(%rbx), %rax
addq $0x10, %rax
cmpq %rdi, %rsi
je 0x1836a
movq 0x10(%rsi), %rcx
movl (%rax), %edx
cmpl (%rcx), %edx
jl 0x18352
movq 0xb0(%r12), %rdx
cmpq %rcx, 0x10(%rdx)
je 0x1835f
movq (%rsi), %rsi
jmp 0x1831b
movq 0x10(%rbx), %rax
addq $0x10, %rax
movq %rsp, %rsi
movq %rax, (%rsi)
callq 0x185f2
jmp 0x1836a
movq %rsp, %rdx
movq %rax, (%rdx)
callq 0x18966
jmp 0x1836a
movq %rsp, %rsi
movq %rax, (%rsi)
callq 0x185f2
movq 0x10(%rbx), %rbx
addq $0x10, %rbx
leaq 0xc8(%rsp), %rdi
callq 0x18b56
leaq 0x8(%rsp), %rdi
callq 0x18654
movq %rbx, %rax
addq $0x188, %rsp            # imm = 0x188
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x183a4
jmp 0x183a4
jmp 0x183a4
movq %rax, %rbx
leaq 0xc8(%rsp), %rdi
callq 0x18b56
jmp 0x183f5
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x18654
jmp 0x183c8
movq %rax, %rbx
leaq 0x38(%rsp), %rdi
callq 0x4170
jmp 0x183d7
movq %rax, %rbx
leaq 0x78(%rsp), %rdi
callq 0x18002
jmp 0x183e6
movq %rax, %rbx
leaq 0x58(%rsp), %rdi
callq 0x4170
jmp 0x183f5
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x18654
movq %rbx, %rdi
callq 0x4540
nop