// File: helchr[P]reMap/sysinfo.cpp
// Function: SysInfo::readRegister(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, unsigned int)
unsigned int SysInfo::readRegister(const std::string& path, unsigned int offset)
{
    std::ifstream ifs(path,std::ios::in|std::ios::binary);
    if(!ifs.good())
    {
        throw(std::runtime_error("Can not open file at " + path));
    }
    ifs.ignore(offset);
    if(!ifs.good())
    {
        throw(std::runtime_error("Offset " + std::to_string(offset) + " is not within file " + path));
    }
    unsigned int reg = 0;
    ifs.read((char*)&reg,sizeof(reg));
    return reg;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x310, %rsp            # imm = 0x310
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x2e8(%rbp)
movl $0x8, %edi
movl $0x4, %esi
callq 0x1a5d0
movq -0x2e8(%rbp), %rsi
movl %eax, %edx
leaq -0x218(%rbp), %rdi
callq 0x68c0
movq -0x218(%rbp), %rax
movq -0x18(%rax), %rax
leaq -0x218(%rbp,%rax), %rdi
callq 0x6900
movb %al, -0x2d9(%rbp)
jmp 0x19101
movb -0x2d9(%rbp), %al
testb $0x1, %al
jne 0x191e2
jmp 0x19111
movb $0x1, -0x249(%rbp)
movl $0x10, %edi
callq 0x62b0
movq %rax, -0x2f0(%rbp)
movq -0x8(%rbp), %rdx
leaq 0x1a4c7(%rip), %rsi     # 0x335fb
leaq -0x248(%rbp), %rdi
callq 0x1a5f0
jmp 0x19142
movq -0x2f0(%rbp), %rdi
leaq -0x248(%rbp), %rsi
callq 0x68d0
jmp 0x19157
movq -0x2f0(%rbp), %rdi
movb $0x0, -0x249(%rbp)
movq 0x2ce84(%rip), %rsi     # 0x45ff0
movq 0x2ce1d(%rip), %rdx     # 0x45f90
callq 0x6910
jmp 0x193e8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x220(%rbp)
movl %eax, -0x224(%rbp)
jmp 0x193d0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x220(%rbp)
movl %eax, -0x224(%rbp)
jmp 0x191c6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x220(%rbp)
movl %eax, -0x224(%rbp)
leaq -0x248(%rbp), %rdi
callq 0x6a88
testb $0x1, -0x249(%rbp)
jne 0x191d1
jmp 0x191dd
movq -0x2f0(%rbp), %rdi
callq 0x6450
jmp 0x193d0
movl -0xc(%rbp), %eax
movl %eax, %esi
leaq -0x218(%rbp), %rdi
callq 0x6070
jmp 0x191f5
movq -0x218(%rbp), %rax
movq -0x18(%rax), %rax
leaq -0x218(%rbp,%rax), %rdi
callq 0x6900
movb %al, -0x2f1(%rbp)
jmp 0x19215
movb -0x2f1(%rbp), %al
testb $0x1, %al
jne 0x19385
jmp 0x19225
movb $0x1, -0x2d1(%rbp)
movl $0x10, %edi
callq 0x62b0
movq %rax, -0x300(%rbp)
movl -0xc(%rbp), %esi
leaq -0x2d0(%rbp), %rdi
callq 0x1a7f0
jmp 0x1924e
leaq 0x1a3bc(%rip), %rsi     # 0x33611
leaq -0x2b0(%rbp), %rdi
leaq -0x2d0(%rbp), %rdx
callq 0x1a7a0
jmp 0x1926a
leaq 0x1a3a8(%rip), %rdx     # 0x33619
leaq -0x290(%rbp), %rdi
leaq -0x2b0(%rbp), %rsi
callq 0x1a750
jmp 0x19286
movq -0x8(%rbp), %rdx
leaq -0x270(%rbp), %rdi
leaq -0x290(%rbp), %rsi
callq 0x1a700
jmp 0x1929f
movq -0x300(%rbp), %rdi
leaq -0x270(%rbp), %rsi
callq 0x68d0
jmp 0x192b4
movq -0x300(%rbp), %rdi
movb $0x0, -0x2d1(%rbp)
movq 0x2cd27(%rip), %rsi     # 0x45ff0
movq 0x2ccc0(%rip), %rdx     # 0x45f90
callq 0x6910
jmp 0x193e8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x220(%rbp)
movl %eax, -0x224(%rbp)
jmp 0x1936c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x220(%rbp)
movl %eax, -0x224(%rbp)
jmp 0x19360
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x220(%rbp)
movl %eax, -0x224(%rbp)
jmp 0x19354
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x220(%rbp)
movl %eax, -0x224(%rbp)
jmp 0x19348
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x220(%rbp)
movl %eax, -0x224(%rbp)
leaq -0x270(%rbp), %rdi
callq 0x6a88
leaq -0x290(%rbp), %rdi
callq 0x6a88
leaq -0x2b0(%rbp), %rdi
callq 0x6a88
leaq -0x2d0(%rbp), %rdi
callq 0x6a88
testb $0x1, -0x2d1(%rbp)
jne 0x19377
jmp 0x19383
movq -0x300(%rbp), %rdi
callq 0x6450
jmp 0x193d0
movl $0x0, -0x2d8(%rbp)
leaq -0x218(%rbp), %rdi
leaq -0x2d8(%rbp), %rsi
movl $0x4, %edx
callq 0x66b0
jmp 0x193a9
movl -0x2d8(%rbp), %eax
movl %eax, -0x304(%rbp)
leaq -0x218(%rbp), %rdi
callq 0x6170
movl -0x304(%rbp), %eax
addq $0x310, %rsp            # imm = 0x310
popq %rbp
retq
leaq -0x218(%rbp), %rdi
callq 0x6170
movq -0x220(%rbp), %rdi
callq 0x6950
nopl (%rax,%rax)