// File: EmbeddedPaul166[P]SNMP-Agent/src/parser.cpp
// Function: Parser::parseNodeParameters(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&, unsigned int&, DataType&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&, AccessType&, StatusType&, Node**)
void Parser::parseNodeParameters(std::string & nodeString, std::string & nodeName, unsigned int & OID, DataType & dataType, std::string & description, AccessType & accessType, StatusType & statusType, Node ** pParent)
{
    std::regex pattern("(\\w+) OBJECT-TYPE");
    std::smatch match;
    
    if (std::regex_search(nodeString, match, pattern))
    {
        nodeName = match.str(1);
    }
    
    pattern.assign("(\\d+) \\}");
    if (std::regex_search(nodeString, match, pattern))
    {
        OID = std::stoi(match.str(1));
    }
    
    pattern.assign("SYNTAX  ((.*\\n)*?)    ACCESS");
    if (std::regex_search(nodeString, match, pattern))
    {
        std::string matchString = match.str(1);
        dataType = parseDataType(matchString);
    }
    
    pattern.assign("ACCESS  (.+)");
    if (std::regex_search(nodeString, match, pattern))
    {
        std::string accessString = match.str(1);
        if (accessString == "read-only")
        {
            accessType = AccessType::READ_ONLY;
        }
        else if (accessString == "write-only")
        {
            accessType = AccessType::WRITE_ONLY;
        }
        else if (accessString == "read-write")
        {
            accessType = AccessType::READ_WRITE;    
        }
        else if (accessString == "not-accessible")
        {
            accessType = AccessType::NOT_ACCESSIBLE;
        }
    }
    
    pattern.assign("STATUS  (.+)");
    if (std::regex_search(nodeString, match, pattern))
    {
        
        std::string statusString = match.str(1);
        if (statusString == "mandatory")
        {
            statusType = StatusType::MANDATORY;
        }
        else if (statusString == "optional")
        {
            statusType = StatusType::OPTIONAL;
        }
        else if (statusString == "obsolete")
        {
            statusType = StatusType::OBSOLETE;    
        }
    }
    
    pattern.assign("\"(.+?((.*\\n)+).+?)\"\\n");
    if (std::regex_search(nodeString, match, pattern))
    {
        description = match.str(1);
    }
    
    pattern.assign("\\{ (.+) \\d \\}");
    if (std::regex_search(nodeString, match, pattern))
    {
        std::string parentName = match.str(1);
        for (std::list<Node>::iterator it = m_pTree -> m_nodeList.begin(); it != m_pTree -> m_nodeList.end(); it++)
        {
            if ((*it).m_name == parentName)
            {
                *pParent = &(*it);
                break;
            }
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1f0, %rsp            # imm = 0x1F0
movq 0x20(%rbp), %rax
movq 0x18(%rbp), %rax
movq 0x10(%rbp), %rax
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq %r9, -0x30(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x1d0(%rbp)
leaq 0x32bb1(%rip), %rsi     # 0x48612
leaq -0x50(%rbp), %rdi
movl $0x10, %edx
callq 0x18ef0
leaq -0x70(%rbp), %rdi
callq 0x18eb0
jmp 0x15a7a
movq -0x10(%rbp), %rdi
leaq -0x70(%rbp), %rsi
leaq -0x50(%rbp), %rdx
xorl %ecx, %ecx
callq 0x18f90
movb %al, -0x1d1(%rbp)
jmp 0x15a95
movb -0x1d1(%rbp), %al
testb $0x1, %al
jne 0x15aa1
jmp 0x15af8
leaq -0xa0(%rbp), %rdi
leaq -0x70(%rbp), %rsi
movl $0x1, %edx
callq 0x18ff0
jmp 0x15ab8
movq -0x18(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x6560
leaq -0xa0(%rbp), %rdi
callq 0x62e0
jmp 0x15af8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0x1609c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0x16093
leaq 0x32b25(%rip), %rsi     # 0x48624
leaq -0x50(%rbp), %rdi
movl $0x10, %edx
callq 0x19040
jmp 0x15b0f
movq -0x10(%rbp), %rdi
leaq -0x70(%rbp), %rsi
leaq -0x50(%rbp), %rdx
xorl %ecx, %ecx
callq 0x18f90
movb %al, -0x1d2(%rbp)
jmp 0x15b2a
movb -0x1d2(%rbp), %al
testb $0x1, %al
jne 0x15b36
jmp 0x15ba1
leaq -0xc0(%rbp), %rdi
leaq -0x70(%rbp), %rsi
movl $0x1, %edx
callq 0x18ff0
jmp 0x15b4d
xorl %eax, %eax
movl %eax, %esi
leaq -0xc0(%rbp), %rdi
movl $0xa, %edx
callq 0x19840
movl %eax, -0x1d8(%rbp)
jmp 0x15b6a
movl -0x1d8(%rbp), %ecx
movq -0x20(%rbp), %rax
movl %ecx, (%rax)
leaq -0xc0(%rbp), %rdi
callq 0x62e0
jmp 0x15ba1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0xc0(%rbp), %rdi
callq 0x62e0
jmp 0x16093
leaq 0x32a85(%rip), %rsi     # 0x4862d
leaq -0x50(%rbp), %rdi
movl $0x10, %edx
callq 0x19040
jmp 0x15bb8
movq -0x10(%rbp), %rdi
leaq -0x70(%rbp), %rsi
leaq -0x50(%rbp), %rdx
xorl %ecx, %ecx
callq 0x18f90
movb %al, -0x1d9(%rbp)
jmp 0x15bd3
movb -0x1d9(%rbp), %al
testb $0x1, %al
jne 0x15be2
jmp 0x15c78
leaq -0xe0(%rbp), %rdi
leaq -0x70(%rbp), %rsi
movl $0x1, %edx
callq 0x18ff0
jmp 0x15bf9
movq -0x1d0(%rbp), %rsi
leaq -0x130(%rbp), %rdi
leaq -0xe0(%rbp), %rdx
callq 0x16210
jmp 0x15c15
movq -0x28(%rbp), %rdi
leaq -0x130(%rbp), %rsi
callq 0x199a0
jmp 0x15c27
leaq -0x130(%rbp), %rdi
callq 0x44a90
leaq -0xe0(%rbp), %rdi
callq 0x62e0
jmp 0x15c78
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0x15c67
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0x130(%rbp), %rdi
callq 0x44a90
leaq -0xe0(%rbp), %rdi
callq 0x62e0
jmp 0x16093
leaq 0x329cb(%rip), %rsi     # 0x4864a
leaq -0x50(%rbp), %rdi
movl $0x10, %edx
callq 0x19040
jmp 0x15c8f
movq -0x10(%rbp), %rdi
leaq -0x70(%rbp), %rsi
leaq -0x50(%rbp), %rdx
xorl %ecx, %ecx
callq 0x18f90
movb %al, -0x1da(%rbp)
jmp 0x15caa
movb -0x1da(%rbp), %al
testb $0x1, %al
jne 0x15cb9
jmp 0x15dcc
leaq -0x150(%rbp), %rdi
leaq -0x70(%rbp), %rsi
movl $0x1, %edx
callq 0x18ff0
jmp 0x15cd0
leaq 0x32980(%rip), %rsi     # 0x48657
leaq -0x150(%rbp), %rdi
callq 0xeb60
movb %al, -0x1db(%rbp)
jmp 0x15ceb
movb -0x1db(%rbp), %al
testb $0x1, %al
jne 0x15cf7
jmp 0x15d23
movq 0x10(%rbp), %rax
movl $0x0, (%rax)
jmp 0x15dc0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0x150(%rbp), %rdi
callq 0x62e0
jmp 0x16093
leaq 0x32937(%rip), %rsi     # 0x48661
leaq -0x150(%rbp), %rdi
callq 0xeb60
movb %al, -0x1dc(%rbp)
jmp 0x15d3e
movb -0x1dc(%rbp), %al
testb $0x1, %al
jne 0x15d4a
jmp 0x15d56
movq 0x10(%rbp), %rax
movl $0x1, (%rax)
jmp 0x15dbe
leaq 0x3290f(%rip), %rsi     # 0x4866c
leaq -0x150(%rbp), %rdi
callq 0xeb60
movb %al, -0x1dd(%rbp)
jmp 0x15d71
movb -0x1dd(%rbp), %al
testb $0x1, %al
jne 0x15d7d
jmp 0x15d89
movq 0x10(%rbp), %rax
movl $0x2, (%rax)
jmp 0x15dbc
leaq 0x328e7(%rip), %rsi     # 0x48677
leaq -0x150(%rbp), %rdi
callq 0xeb60
movb %al, -0x1de(%rbp)
jmp 0x15da4
movb -0x1de(%rbp), %al
testb $0x1, %al
jne 0x15db0
jmp 0x15dba
movq 0x10(%rbp), %rax
movl $0x3, (%rax)
jmp 0x15dbc
jmp 0x15dbe
jmp 0x15dc0
leaq -0x150(%rbp), %rdi
callq 0x62e0
leaq 0x328b3(%rip), %rsi     # 0x48686
leaq -0x50(%rbp), %rdi
movl $0x10, %edx
callq 0x19040
jmp 0x15de3
movq -0x10(%rbp), %rdi
leaq -0x70(%rbp), %rsi
leaq -0x50(%rbp), %rdx
xorl %ecx, %ecx
callq 0x18f90
movb %al, -0x1df(%rbp)
jmp 0x15dfe
movb -0x1df(%rbp), %al
testb $0x1, %al
jne 0x15e0d
jmp 0x15eeb
leaq -0x170(%rbp), %rdi
leaq -0x70(%rbp), %rsi
movl $0x1, %edx
callq 0x18ff0
jmp 0x15e24
leaq 0x32868(%rip), %rsi     # 0x48693
leaq -0x170(%rbp), %rdi
callq 0xeb60
movb %al, -0x1e0(%rbp)
jmp 0x15e3f
movb -0x1e0(%rbp), %al
testb $0x1, %al
jne 0x15e4b
jmp 0x15e77
movq 0x18(%rbp), %rax
movl $0x0, (%rax)
jmp 0x15edf
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0x170(%rbp), %rdi
callq 0x62e0
jmp 0x16093
leaq 0x3281f(%rip), %rsi     # 0x4869d
leaq -0x170(%rbp), %rdi
callq 0xeb60
movb %al, -0x1e1(%rbp)
jmp 0x15e92
movb -0x1e1(%rbp), %al
testb $0x1, %al
jne 0x15e9e
jmp 0x15eaa
movq 0x18(%rbp), %rax
movl $0x1, (%rax)
jmp 0x15edd
leaq 0x327f5(%rip), %rsi     # 0x486a6
leaq -0x170(%rbp), %rdi
callq 0xeb60
movb %al, -0x1e2(%rbp)
jmp 0x15ec5
movb -0x1e2(%rbp), %al
testb $0x1, %al
jne 0x15ed1
jmp 0x15edb
movq 0x18(%rbp), %rax
movl $0x2, (%rax)
jmp 0x15edd
jmp 0x15edf
leaq -0x170(%rbp), %rdi
callq 0x62e0
leaq 0x327bd(%rip), %rsi     # 0x486af
leaq -0x50(%rbp), %rdi
movl $0x10, %edx
callq 0x19040
jmp 0x15f02
movq -0x10(%rbp), %rdi
leaq -0x70(%rbp), %rsi
leaq -0x50(%rbp), %rdx
xorl %ecx, %ecx
callq 0x18f90
movb %al, -0x1e3(%rbp)
jmp 0x15f1d
movb -0x1e3(%rbp), %al
testb $0x1, %al
jne 0x15f29
jmp 0x15f5c
leaq -0x190(%rbp), %rdi
leaq -0x70(%rbp), %rsi
movl $0x1, %edx
callq 0x18ff0
jmp 0x15f40
movq -0x30(%rbp), %rdi
leaq -0x190(%rbp), %rsi
callq 0x6560
leaq -0x190(%rbp), %rdi
callq 0x62e0
leaq 0x32762(%rip), %rsi     # 0x486c5
leaq -0x50(%rbp), %rdi
movl $0x10, %edx
callq 0x19040
jmp 0x15f73
movq -0x10(%rbp), %rdi
leaq -0x70(%rbp), %rsi
leaq -0x50(%rbp), %rdx
xorl %ecx, %ecx
callq 0x18f90
movb %al, -0x1e4(%rbp)
jmp 0x15f8e
movb -0x1e4(%rbp), %al
testb $0x1, %al
jne 0x15f9d
jmp 0x16078
leaq -0x1b0(%rbp), %rdi
leaq -0x70(%rbp), %rsi
movl $0x1, %edx
callq 0x18ff0
jmp 0x15fb4
movq -0x1d0(%rbp), %rdi
addq $0x60, %rdi
callq 0x18e90
movq %rax, %rdi
addq $0x8, %rdi
callq 0x19880
movq %rax, -0x1b8(%rbp)
movq -0x1d0(%rbp), %rdi
addq $0x60, %rdi
callq 0x18e90
movq %rax, %rdi
addq $0x8, %rdi
callq 0x198e0
movq %rax, -0x1c0(%rbp)
leaq -0x1b8(%rbp), %rdi
leaq -0x1c0(%rbp), %rsi
callq 0x198b0
testb $0x1, %al
jne 0x16013
jmp 0x1606c
leaq -0x1b8(%rbp), %rdi
callq 0x19910
movq %rax, %rdi
addq $0x8, %rdi
leaq -0x1b0(%rbp), %rsi
callq 0x8220
testb $0x1, %al
jne 0x16038
jmp 0x16050
leaq -0x1b8(%rbp), %rdi
callq 0x19910
movq %rax, %rcx
movq 0x20(%rbp), %rax
movq %rcx, (%rax)
jmp 0x1606c
jmp 0x16052
leaq -0x1b8(%rbp), %rdi
xorl %esi, %esi
callq 0x19970
movq %rax, -0x1c8(%rbp)
jmp 0x15fd7
leaq -0x1b0(%rbp), %rdi
callq 0x62e0
leaq -0x70(%rbp), %rdi
callq 0x195a0
leaq -0x50(%rbp), %rdi
callq 0x19570
addq $0x1f0, %rsp            # imm = 0x1F0
popq %rbp
retq
leaq -0x70(%rbp), %rdi
callq 0x195a0
leaq -0x50(%rbp), %rdi
callq 0x19570
movq -0x78(%rbp), %rdi
callq 0x6790
nop