// File: geoherna[P]lib605/./src/lib605.cpp
// Function: lib605::MSR::GetFirmwareVersion[abi:cxx11]()
std::string MSR::GetFirmwareVersion(void) {
		if(!this->MSRConected) {
#if defined(DEBUG)
			std::cout << "[*] Error: unable to get firmware version from non-connected device" << std::endl;
#endif
			return "ERROR";
		}
		char* version = new char[9];
		this->WriteAutoSize(MSR_REQ_FIRM_VER);
		if(this->ReadBytes(version, 9) == 9) {
#if defined(DEBUG)
			std::cout << "[*] Error: unable to get firmware version" << std::endl;
#endif
			return "ERROR";
		}
		if(memcmp((char*)version[0], MSR_ESC, 1) == 0) {
			version[8] = '\0';
			memmove(version, version+1, strlen(version));
			std::string ver(version);
			delete[] version;
			return ver;
		}
		return "ERROR";
	}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x50(%rbp)
movq %rdi, %rax
movq %rax, -0x48(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x40(%rbp)
testb $0x1, 0x4(%rax)
jne 0x6b57
leaq -0x11(%rbp), %rdi
movq %rdi, -0x58(%rbp)
callq 0x57c0
movq -0x50(%rbp), %rdi
movq -0x58(%rbp), %rdx
leaq 0x25ec(%rip), %rsi      # 0x9114
callq 0x5770
jmp 0x6b2f
leaq -0x11(%rbp), %rdi
callq 0x5490
jmp 0x6cf3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
leaq -0x11(%rbp), %rdi
callq 0x5490
jmp 0x6d00
movl $0x9, %edi
callq 0x5030
movq -0x40(%rbp), %rdi
movq %rax, -0x30(%rbp)
leaq 0x25af(%rip), %rsi      # 0x911f
callq 0x5240
movq -0x40(%rbp), %rdi
movq -0x30(%rbp), %rsi
movl $0x9, %edx
callq 0x5160
cmpl $0x9, %eax
jne 0x6bd7
leaq -0x31(%rbp), %rdi
movq %rdi, -0x60(%rbp)
callq 0x57c0
movq -0x50(%rbp), %rdi
movq -0x60(%rbp), %rdx
leaq 0x256c(%rip), %rsi      # 0x9114
callq 0x5770
jmp 0x6baf
leaq -0x31(%rbp), %rdi
callq 0x5490
jmp 0x6cf3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
leaq -0x31(%rbp), %rdi
callq 0x5490
jmp 0x6d00
movq -0x30(%rbp), %rax
movsbq (%rax), %rdi
leaq 0x2537(%rip), %rsi      # 0x911d
movl $0x1, %edx
callq 0x51f0
cmpl $0x0, %eax
jne 0x6ca8
movq -0x30(%rbp), %rax
movb $0x0, 0x8(%rax)
movq -0x30(%rbp), %rdi
movq %rdi, -0x80(%rbp)
movq %rdi, %rax
incq %rax
movq %rax, -0x78(%rbp)
callq 0x51e0
movq -0x80(%rbp), %rdi
movq -0x78(%rbp), %rsi
movq %rax, %rdx
callq 0x5700
movb $0x0, -0x32(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0x70(%rbp)
leaq -0x33(%rbp), %rdi
movq %rdi, -0x68(%rbp)
callq 0x57c0
movq -0x50(%rbp), %rdi
movq -0x70(%rbp), %rsi
movq -0x68(%rbp), %rdx
callq 0x5770
jmp 0x6c54
leaq -0x33(%rbp), %rdi
callq 0x5490
movq -0x30(%rbp), %rax
movq %rax, -0x88(%rbp)
cmpq $0x0, %rax
je 0x6c7a
movq -0x88(%rbp), %rdi
callq 0x5570
movb $0x1, -0x32(%rbp)
testb $0x1, -0x32(%rbp)
jne 0x6ca6
jmp 0x6c9d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
leaq -0x33(%rbp), %rdi
callq 0x5490
jmp 0x6d00
movq -0x50(%rbp), %rdi
callq 0x5260
jmp 0x6cf3
leaq -0x34(%rbp), %rdi
movq %rdi, -0x90(%rbp)
callq 0x57c0
movq -0x50(%rbp), %rdi
movq -0x90(%rbp), %rdx
leaq 0x244a(%rip), %rsi      # 0x9114
callq 0x5770
jmp 0x6cd1
leaq -0x34(%rbp), %rdi
callq 0x5490
jmp 0x6cf3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
leaq -0x34(%rbp), %rdi
callq 0x5490
jmp 0x6d00
movq -0x48(%rbp), %rax
addq $0x90, %rsp
popq %rbp
retq
movq -0x20(%rbp), %rdi
callq 0x57a0
nopl (%rax)