// File: EmbeddedPaul166[P]SNMP-Agent/src/parser.cpp
// Function: Parser::isImportPresent(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
std::string Parser::isImportPresent(std::string fileContent)
{ 
    std::smatch match;
    std::regex pattern("IMPORTS\\s*((.*\\n)*?)\\s*OBJECT-TYPE");
    if (std::regex_search(fileContent, match, pattern))
    {
        std::string import = match.str(0); 
        
        pattern.assign("IMPORTS\\s*((.*\\n)*?)\\s*FROM");
        if (std::regex_search(import, match, pattern))
        {
            std::string importedDataTypes = match.str(1);
            pattern.assign("\\w+");
            std::sregex_iterator begin(importedDataTypes.cbegin(), importedDataTypes.cend(), pattern);
            std::sregex_iterator end;
            std::string customDataType;
            for (std::sregex_iterator it = begin; it != end; it++)
            {
                match = *it;
                m_customDataTypeNameVector.push_back(match.str(0));
            }
        }
        
        pattern.assign("FROM (.*)");
        if (std::regex_search(import, match, pattern))
        {
            std::string importPath(getenv("PROJECT_PATH"));
            importPath  = importPath + "/mibs/" + match.str(1) + ".txt";
            return importPath;
        }
    }
    return "";
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x2e0, %rsp            # imm = 0x2E0
movq %rdx, -0x2a8(%rbp)
movq %rdi, -0x2a0(%rbp)
movq %rdi, %rax
movq %rax, -0x298(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x290(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x18eb0
leaq 0x34a17(%rip), %rsi     # 0x484f1
leaq -0x58(%rbp), %rdi
movl $0x10, %edx
callq 0x18ef0
jmp 0x13aea
movq -0x2a8(%rbp), %rdi
leaq -0x38(%rbp), %rsi
leaq -0x58(%rbp), %rdx
xorl %ecx, %ecx
callq 0x18f90
movb %al, -0x2a9(%rbp)
jmp 0x13b08
movb -0x2a9(%rbp), %al
testb $0x1, %al
jne 0x13b17
jmp 0x14005
xorl %eax, %eax
movl %eax, %edx
leaq -0x88(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x18ff0
jmp 0x13b2d
leaq 0x349e0(%rip), %rsi     # 0x48514
leaq -0x58(%rbp), %rdi
movl $0x10, %edx
callq 0x19040
jmp 0x13b44
leaq -0x88(%rbp), %rdi
leaq -0x38(%rbp), %rsi
leaq -0x58(%rbp), %rdx
xorl %ecx, %ecx
callq 0x18f90
movb %al, -0x2aa(%rbp)
jmp 0x13b62
movb -0x2aa(%rbp), %al
testb $0x1, %al
jne 0x13b71
jmp 0x13dd4
leaq -0xa8(%rbp), %rdi
leaq -0x38(%rbp), %rsi
movl $0x1, %edx
callq 0x18ff0
jmp 0x13b88
leaq 0x349a1(%rip), %rsi     # 0x48530
leaq -0x58(%rbp), %rdi
movl $0x10, %edx
callq 0x19040
jmp 0x13b9f
leaq -0xa8(%rbp), %rdi
movq %rdi, -0x2b8(%rbp)
callq 0x61b0
movq -0x2b8(%rbp), %rdi
movq %rax, -0xf0(%rbp)
callq 0x60c0
movq %rax, -0xf8(%rbp)
movq -0xf0(%rbp), %rsi
movq -0xf8(%rbp), %rdx
leaq -0xe8(%rbp), %rdi
leaq -0x58(%rbp), %rcx
xorl %r8d, %r8d
callq 0x190a0
jmp 0x13bef
leaq -0x138(%rbp), %rdi
callq 0x191d0
jmp 0x13bfd
leaq -0x158(%rbp), %rdi
callq 0x6600
leaq -0x198(%rbp), %rdi
leaq -0xe8(%rbp), %rsi
callq 0x19220
jmp 0x13c1e
jmp 0x13c20
leaq -0x198(%rbp), %rdi
leaq -0x138(%rbp), %rsi
callq 0x19270
testb $0x1, %al
jne 0x13cae
leaq -0x198(%rbp), %rdi
callq 0x193b0
jmp 0x13d6d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x14091
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x14088
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x13ff4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x13dc3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x13db7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x13d9f
leaq -0x198(%rbp), %rdi
callq 0x192a0
movq %rax, %rsi
leaq -0x38(%rbp), %rdi
callq 0x192c0
jmp 0x13cc8
movq -0x290(%rbp), %rax
addq $0x18, %rax
movq %rax, -0x2c0(%rbp)
xorl %eax, %eax
movl %eax, %edx
leaq -0x1b8(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x18ff0
jmp 0x13cf0
movq -0x2c0(%rbp), %rdi
leaq -0x1b8(%rbp), %rsi
callq 0x19300
jmp 0x13d05
leaq -0x1b8(%rbp), %rdi
callq 0x62e0
leaq -0x1f8(%rbp), %rdi
leaq -0x198(%rbp), %rsi
xorl %edx, %edx
callq 0x19330
jmp 0x13d28
leaq -0x1f8(%rbp), %rdi
callq 0x193b0
jmp 0x13c20
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x13d5f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x1b8(%rbp), %rdi
callq 0x62e0
leaq -0x198(%rbp), %rdi
callq 0x193b0
jmp 0x13d9f
leaq -0x158(%rbp), %rdi
callq 0x62e0
leaq -0x138(%rbp), %rdi
callq 0x193b0
leaq -0xe8(%rbp), %rdi
callq 0x193b0
leaq -0xa8(%rbp), %rdi
callq 0x62e0
jmp 0x13dd4
leaq -0x158(%rbp), %rdi
callq 0x62e0
leaq -0x138(%rbp), %rdi
callq 0x193b0
leaq -0xe8(%rbp), %rdi
callq 0x193b0
leaq -0xa8(%rbp), %rdi
callq 0x62e0
jmp 0x13ff4
leaq 0x34759(%rip), %rsi     # 0x48534
leaq -0x58(%rbp), %rdi
movl $0x10, %edx
callq 0x19040
jmp 0x13deb
leaq -0x88(%rbp), %rdi
leaq -0x38(%rbp), %rsi
leaq -0x58(%rbp), %rdx
xorl %ecx, %ecx
callq 0x18f90
movb %al, -0x2c1(%rbp)
jmp 0x13e09
movb -0x2c1(%rbp), %al
testb $0x1, %al
jne 0x13e18
jmp 0x13fd0
movb $0x0, -0x1f9(%rbp)
leaq 0x342c5(%rip), %rdi     # 0x480eb
callq 0x6550
movq %rax, -0x2d8(%rbp)
leaq -0x1fa(%rbp), %rdi
movq %rdi, -0x2d0(%rbp)
callq 0x67a0
movq -0x2a0(%rbp), %rdi
movq -0x2d8(%rbp), %rsi
movq -0x2d0(%rbp), %rdx
callq 0x8130
jmp 0x13e61
leaq -0x1fa(%rbp), %rdi
callq 0x64d0
movq -0x2a0(%rbp), %rsi
leaq 0x346c3(%rip), %rdx     # 0x4853e
leaq -0x260(%rbp), %rdi
callq 0x194f0
jmp 0x13e89
leaq -0x280(%rbp), %rdi
leaq -0x38(%rbp), %rsi
movl $0x1, %edx
callq 0x18ff0
jmp 0x13ea0
leaq -0x240(%rbp), %rdi
leaq -0x260(%rbp), %rsi
leaq -0x280(%rbp), %rdx
callq 0x19420
jmp 0x13ebc
leaq 0x34267(%rip), %rdx     # 0x4812a
leaq -0x220(%rbp), %rdi
leaq -0x240(%rbp), %rsi
callq 0x193d0
jmp 0x13ed8
movq -0x2a0(%rbp), %rdi
leaq -0x220(%rbp), %rsi
callq 0x6560
leaq -0x220(%rbp), %rdi
callq 0x62e0
leaq -0x240(%rbp), %rdi
callq 0x62e0
leaq -0x280(%rbp), %rdi
callq 0x62e0
leaq -0x260(%rbp), %rdi
callq 0x62e0
movb $0x1, -0x1f9(%rbp)
movl $0x1, -0x284(%rbp)
testb $0x1, -0x1f9(%rbp)
jne 0x13fc0
jmp 0x13fb4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x1fa(%rbp), %rdi
callq 0x64d0
jmp 0x13ff4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x13fc2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x13fa6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x13f9a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x240(%rbp), %rdi
callq 0x62e0
leaq -0x280(%rbp), %rdi
callq 0x62e0
leaq -0x260(%rbp), %rdi
callq 0x62e0
jmp 0x13fc2
movq -0x2a0(%rbp), %rdi
callq 0x62e0
jmp 0x13fda
movq -0x2a0(%rbp), %rdi
callq 0x62e0
jmp 0x13ff4
movl $0x0, -0x284(%rbp)
leaq -0x88(%rbp), %rdi
callq 0x62e0
movl -0x284(%rbp), %eax
testl %eax, %eax
jne 0x14066
jmp 0x13ff2
jmp 0x14005
leaq -0x88(%rbp), %rdi
callq 0x62e0
jmp 0x14088
leaq -0x285(%rbp), %rdi
movq %rdi, -0x2e0(%rbp)
callq 0x67a0
movq -0x2a0(%rbp), %rdi
movq -0x2e0(%rbp), %rdx
leaq 0x34817(%rip), %rsi     # 0x48844
callq 0x8130
jmp 0x14034
leaq -0x285(%rbp), %rdi
callq 0x64d0
movl $0x1, -0x284(%rbp)
jmp 0x14066
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x285(%rbp), %rdi
callq 0x64d0
jmp 0x14088
leaq -0x58(%rbp), %rdi
callq 0x19570
leaq -0x38(%rbp), %rdi
callq 0x195a0
movq -0x298(%rbp), %rax
addq $0x2e0, %rsp            # imm = 0x2E0
popq %rbp
retq
leaq -0x58(%rbp), %rdi
callq 0x19570
leaq -0x38(%rbp), %rdi
callq 0x195a0
movq -0x60(%rbp), %rdi
callq 0x6790
nopw %cs:(%rax,%rax)