// File: /workspace/github_cpp_makefile_star2_O3/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
pushq %r15
pushq %r14
pushq %rbx
subq $0x288, %rsp            # imm = 0x288
movl %esi, %ebp
movq %rdi, %r14
leaq 0x80(%rsp), %rbx
movq %rbx, %rdi
movq %r14, %rsi
movl $0xc, %edx
callq 0x5720
movq (%rbx), %rax
movq -0x18(%rax), %rax
cmpl $0x0, 0xa0(%rsp,%rax)
jne 0xcb2b
movl %ebp, %esi
leaq 0x80(%rsp), %rdi
callq 0x5070
movq 0x80(%rsp), %rax
movq -0x18(%rax), %rax
cmpl $0x0, 0xa0(%rsp,%rax)
jne 0xcb75
movq %rsp, %rsi
movl $0x0, (%rsi)
leaq 0x80(%rsp), %rdi
movl $0x4, %edx
callq 0x5560
movl (%rsp), %ebx
leaq 0x80(%rsp), %rdi
callq 0x5120
movl %ebx, %eax
addq $0x288, %rsp            # imm = 0x288
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movl $0x10, %edi
callq 0x5240
movq %rax, %rbx
leaq 0x15a3a(%rip), %rsi     # 0x22579
movq %rsp, %rdi
movq %r14, %rdx
callq 0xe40e
movb $0x1, %bpl
movq %rsp, %rsi
movq %rbx, %rdi
callq 0x5730
xorl %ebp, %ebp
movq 0x1f48f(%rip), %rsi     # 0x2bff0
movq 0x1f428(%rip), %rdx     # 0x2bf90
movq %rbx, %rdi
callq 0x5760
jmp 0xcc30
movl $0x10, %edi
callq 0x5240
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
movl %ebp, %esi
callq 0xe560
leaq 0x159fa(%rip), %rsi     # 0x2258f
leaq 0x60(%rsp), %rdi
leaq 0x20(%rsp), %rdx
callq 0xe4f0
leaq 0x159ec(%rip), %rsi     # 0x22597
leaq 0x60(%rsp), %rdi
callq 0x5840
leaq 0x50(%rsp), %r15
movq %r15, -0x10(%r15)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
jne 0xcbd6
movups (%rcx), %xmm0
movups %xmm0, (%r15)
jmp 0xcbe3
movq %rdx, 0x40(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x50(%rsp)
movq 0x8(%rax), %rdx
leaq 0x40(%rsp), %rsi
movq %rdx, 0x8(%rsi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq %rsp, %rdi
movq %r14, %rdx
callq 0xe496
movb $0x1, %bpl
movq %rsp, %rsi
movq %rbx, %rdi
callq 0x5730
xorl %ebp, %ebp
movq 0x1f3cf(%rip), %rsi     # 0x2bff0
movq 0x1f368(%rip), %rdx     # 0x2bf90
movq %rbx, %rdi
callq 0x5760
movq %rax, %r14
leaq 0x10(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xcc56
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x5470
jmp 0xcc56
movq %rax, %r14
movb $0x1, %bpl
movq 0x40(%rsp), %rdi
cmpq %r15, %rdi
je 0xcc75
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x5470
jmp 0xcc75
movq %rax, %r14
movb $0x1, %bpl
leaq 0x70(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xcc90
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x5470
leaq 0x30(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xcce5
movq 0x30(%rsp), %rsi
jmp 0xccdd
movq %rax, %r14
leaq 0x30(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xccef
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x5470
jmp 0xccef
jmp 0xccec
movq %rax, %r14
leaq 0x10(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xcce5
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x5470
testb %bpl, %bpl
jne 0xccef
jmp 0xccfe
movq %rax, %r14
movq %rbx, %rdi
callq 0x5390
jmp 0xccfe
jmp 0xccfb
movq %rax, %r14
leaq 0x80(%rsp), %rdi
callq 0x5120
movq %r14, %rdi
callq 0x5790
nop