LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: jakubsvehla[P]hex/src/file_view.cpp
// Function: FileView::Render()
void FileView::Render ()
{
  int     pos;
  int     size;
  unsigned char  * buffer;

  // FIXME: check if file is not NULL

  // Get the position of the cursor in the file
  pos = m_File -> Tell();

  Scroll(pos);

  buffer = new unsigned char [m_BytesPerScreen];
  size = m_File -> Read(m_Offset, m_BytesPerScreen, buffer);

  Erase();

  // Render line numbers
  if (m_ShowNums)
    RenderLineNums();

  // Render hexadecimal
  RenderHexadecimal(buffer, size);

  // Render ASCII
  if (m_ShowASCII)
    RenderASCII(buffer, size);

  // Place the cursor at the right place
  MoveCursor(pos);

  // Refresh the screen
  Refresh();

  // Deallocate the buffer
  delete [] buffer;

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x20(%rbp)
movq 0x50(%rax), %rdi
callq 0x4290
movq -0x20(%rbp), %rdi
movl %eax, -0xc(%rbp)
movl -0xc(%rbp), %esi
callq 0x5190
movq -0x20(%rbp), %rax
movslq 0x34(%rax), %rdi
callq 0x3040
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, -0x18(%rbp)
movq 0x50(%rax), %rdi
movl 0x30(%rax), %esi
movl 0x34(%rax), %edx
movq -0x18(%rbp), %rcx
callq 0x4460
movq -0x20(%rbp), %rdi
movl %eax, -0x10(%rbp)
callq 0x4b20
movq -0x20(%rbp), %rax
testb $0x1, 0x3c(%rax)
je 0x5126
movq -0x20(%rbp), %rdi
callq 0x51f0
movq -0x20(%rbp), %rdi
movq -0x18(%rbp), %rsi
movl -0x10(%rbp), %edx
callq 0x5260
movq -0x20(%rbp), %rax
testb $0x1, 0x44(%rax)
je 0x5150
movq -0x20(%rbp), %rdi
movq -0x18(%rbp), %rsi
movl -0x10(%rbp), %edx
callq 0x5350
movq -0x20(%rbp), %rdi
movl -0xc(%rbp), %esi
callq 0x5030
movq -0x20(%rbp), %rdi
callq 0x4b00
movq -0x18(%rbp), %rax
movq %rax, -0x28(%rbp)
cmpq $0x0, %rax
je 0x517c
movq -0x28(%rbp), %rdi
callq 0x3430
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: jakubsvehla[P]hex/src/file_view.cpp
// Function: FileView::Scroll(int)
void FileView::Scroll (int pos)
{
  // Scroll up if the cursor is above the screen
  while (pos < m_Offset) {
    m_Offset -= m_BytesPerLine;
  }

  // Scroll down if the cursor is below the screen
  while (pos >= m_Offset + m_BytesPerScreen) {
    m_Offset += m_BytesPerLine;
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rcx
movl -0xc(%rbp), %eax
cmpl 0x30(%rcx), %eax
jge 0x51c0
movq -0x18(%rbp), %rax
movl 0x38(%rax), %edx
movl 0x30(%rax), %ecx
subl %edx, %ecx
movl %ecx, 0x30(%rax)
jmp 0x51a3
jmp 0x51c2
movq -0x18(%rbp), %rdx
movl -0xc(%rbp), %eax
movl 0x30(%rdx), %ecx
addl 0x34(%rdx), %ecx
cmpl %ecx, %eax
jl 0x51e2
movq -0x18(%rbp), %rax
movl 0x38(%rax), %ecx
addl 0x30(%rax), %ecx
movl %ecx, 0x30(%rax)
jmp 0x51c2
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: jakubsvehla[P]hex/src/file_view.cpp
// Function: FileView::RenderLineNums()
void FileView::RenderLineNums ()
{
  int i;

  for (i = 0; i < m_Height; i ++) {
    Move(i, 0);
    Print("%08lX", m_Offset + (i * m_BytesPerLine));
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x18(%rbp)
movl $0x0, -0xc(%rbp)
movq -0x18(%rbp), %rcx
movl -0xc(%rbp), %eax
cmpl 0x8(%rcx), %eax
jge 0x524e
movq -0x18(%rbp), %rdi
movl -0xc(%rbp), %esi
xorl %edx, %edx
callq 0x4ad0
movq -0x18(%rbp), %rdi
movl 0x30(%rdi), %edx
movl -0xc(%rbp), %eax
imull 0x38(%rdi), %eax
addl %eax, %edx
leaq 0x2f7e(%rip), %rsi      # 0x81ba
movb $0x0, %al
callq 0x4880
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x520b
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: jakubsvehla[P]hex/src/file_view.cpp
// Function: FileView::RenderHexadecimal(unsigned char*, int)
void FileView::RenderHexadecimal (unsigned char * buffer, int size)
{
  unsigned char * line = buffer;
  int i, j;

  for (i = 0; i < m_Height; i++) {

    Move(i, m_HexOffset);

    for (j = 0; j < min(m_BytesPerLine, size); j ++) {

      Print("%02X ", line[j]);

      // Print one space after every block
      if ((j + 1) % m_BlockSize == 0) Put(' ');

    }

    line += m_BytesPerLine;
    size -= m_BytesPerLine;
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x20(%rbp)
movl $0x0, -0x24(%rbp)
movq -0x30(%rbp), %rcx
movl -0x24(%rbp), %eax
cmpl 0x8(%rcx), %eax
jge 0x5348
movq -0x30(%rbp), %rdi
movl -0x24(%rbp), %esi
movl 0x40(%rdi), %edx
callq 0x4ad0
movl $0x0, -0x28(%rbp)
movq -0x30(%rbp), %rax
movl -0x28(%rbp), %ecx
movl %ecx, -0x34(%rbp)
movl 0x38(%rax), %edi
movl -0x14(%rbp), %esi
callq 0x5510
movl %eax, %ecx
movl -0x34(%rbp), %eax
cmpl %ecx, %eax
jge 0x531a
movq -0x30(%rbp), %rdi
movq -0x20(%rbp), %rax
movslq -0x28(%rbp), %rcx
movzbl (%rax,%rcx), %edx
leaq 0x2ecf(%rip), %rsi      # 0x81b4
movb $0x0, %al
callq 0x4880
movq -0x30(%rbp), %rcx
movl -0x28(%rbp), %eax
addl $0x1, %eax
cltd
idivl 0x2c(%rcx)
cmpl $0x0, %edx
jne 0x530d
movq -0x30(%rbp), %rdi
movl $0x20, %esi
callq 0x4830
jmp 0x530f
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x52b0
movq -0x30(%rbp), %rax
movl 0x38(%rax), %edx
movq -0x20(%rbp), %rcx
movslq %edx, %rdx
addq %rdx, %rcx
movq %rcx, -0x20(%rbp)
movl 0x38(%rax), %ecx
movl -0x14(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x14(%rbp)
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x528a
addq $0x40, %rsp
popq %rbp
retq
nop
// File: jakubsvehla[P]hex/src/file_view.cpp
// Function: FileView::RenderASCII(unsigned char*, int)
void FileView::RenderASCII (unsigned char * buffer, int size)
{
  unsigned char * line = buffer;
  int i, j;

  for (i = 0; i < m_Height; i++) {

    Move(i, m_ASCIIOffset);

    for (j = 0; j < min(m_BytesPerLine, size); j ++) {
      if (isprint(line[j]))
        Put(line[j]);
      else
        Put('.');
    }

    line += m_BytesPerLine;
    size -= m_BytesPerLine;
  }

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x20(%rbp)
movl $0x0, -0x24(%rbp)
movq -0x30(%rbp), %rcx
movl -0x24(%rbp), %eax
cmpl 0x8(%rcx), %eax
jge 0x5434
movq -0x30(%rbp), %rdi
movl -0x24(%rbp), %esi
movl 0x48(%rdi), %edx
callq 0x4ad0
movl $0x0, -0x28(%rbp)
movq -0x30(%rbp), %rax
movl -0x28(%rbp), %ecx
movl %ecx, -0x34(%rbp)
movl 0x38(%rax), %edi
movl -0x14(%rbp), %esi
callq 0x5510
movl %eax, %ecx
movl -0x34(%rbp), %eax
cmpl %ecx, %eax
jge 0x5406
movq -0x20(%rbp), %rax
movslq -0x28(%rbp), %rcx
movzbl (%rax,%rcx), %edi
callq 0x3550
cmpl $0x0, %eax
je 0x53eb
movq -0x30(%rbp), %rdi
movq -0x20(%rbp), %rax
movslq -0x28(%rbp), %rcx
movzbl (%rax,%rcx), %esi
callq 0x4830
jmp 0x53f9
movq -0x30(%rbp), %rdi
movl $0x2e, %esi
callq 0x4830
jmp 0x53fb
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x53a0
movq -0x30(%rbp), %rax
movl 0x38(%rax), %edx
movq -0x20(%rbp), %rcx
movslq %edx, %rdx
addq %rdx, %rcx
movq %rcx, -0x20(%rbp)
movl 0x38(%rax), %ecx
movl -0x14(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x14(%rbp)
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x537a
addq $0x40, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: jakubsvehla[P]hex/src/insert_mode.cpp
// Function: InsertMode::Run()
void InsertMode::Run ()
{
  int c;

  m_Editor -> m_CmdLineView -> Render("-- INSERT MODE --");
  m_Editor -> m_FileView -> Refresh();

  try {
    while (m_Editor -> m_FileView -> GetHex(c)) {
      m_Editor -> m_File -> Ins(c);
    }    
  }
  catch (NotHexadecimalValue) {
    m_Editor -> m_FileView -> Beep();    
  }

  m_Editor -> m_Mode = m_Editor -> m_NormalMode;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x28(%rbp)
movq 0x8(%rax), %rax
movq 0x20(%rax), %rdi
movq (%rdi), %rax
leaq 0x1e5a(%rip), %rsi      # 0x8280
callq *0x20(%rax)
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x18(%rax), %rdi
callq 0x4b00
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x18(%rax), %rdi
leaq -0xc(%rbp), %rsi
callq 0x4960
movb %al, -0x29(%rbp)
jmp 0x6454
movb -0x29(%rbp), %al
testb $0x1, %al
jne 0x645d
jmp 0x64c9
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x10(%rax), %rdi
movzbl -0xc(%rbp), %esi
callq 0x4010
jmp 0x6474
jmp 0x643a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movl $0x1, %ecx
cmpl %ecx, %eax
jne 0x64e0
movq -0x18(%rbp), %rdi
callq 0x3150
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x18(%rax), %rdi
callq 0x4b40
jmp 0x64aa
callq 0x34f0
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rcx
movq 0x30(%rcx), %rcx
movq 0x8(%rax), %rax
movq %rcx, 0x28(%rax)
addq $0x30, %rsp
popq %rbp
retq
jmp 0x64af
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
callq 0x34f0
jmp 0x64de
jmp 0x64e0
movq -0x18(%rbp), %rdi
callq 0x3540
movq %rax, %rdi
callq 0x3b80
nopw %cs:(%rax,%rax)
nopl (%rax,%rax)
// File: jakubsvehla[P]hex/src/config.cpp
// Function: Config::LoadFromFile(char const*)
bool Config::LoadFromFile (const char * name)
{
  fstream filestr;
  string  line;

  filestr.open(name, fstream::in);

  if (filestr.fail()) return false;

  while (true) {

    if (filestr.eof()) break;

    if (filestr.fail()) {
      filestr.close();
      return false;
    }

    getline(filestr, line);

    if (line.length() == 0) continue;

    ParseOption(line);

  }

  filestr.close();

  return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x290, %rsp            # imm = 0x290
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x288(%rbp)
leaq -0x228(%rbp), %rdi
movq %rdi, -0x280(%rbp)
callq 0x33e0
leaq -0x248(%rbp), %rdi
callq 0x3450
movq -0x280(%rbp), %rdi
movq -0x18(%rbp), %rsi
movl $0x8, %edx
callq 0x3280
jmp 0x71e4
movq -0x228(%rbp), %rax
movq -0x18(%rax), %rax
leaq -0x228(%rbp,%rax), %rdi
callq 0x3030
movb %al, -0x289(%rbp)
jmp 0x7204
movb -0x289(%rbp), %al
testb $0x1, %al
jne 0x7210
jmp 0x723a
movb $0x0, -0x1(%rbp)
movl $0x1, -0x258(%rbp)
jmp 0x735f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x250(%rbp)
movl %eax, -0x254(%rbp)
jmp 0x7385
jmp 0x723c
jmp 0x723e
movq -0x228(%rbp), %rax
movq -0x18(%rax), %rax
leaq -0x228(%rbp,%rax), %rdi
callq 0x3590
movb %al, -0x28a(%rbp)
jmp 0x725e
movb -0x28a(%rbp), %al
testb $0x1, %al
jne 0x726a
jmp 0x726f
jmp 0x7343
movq -0x228(%rbp), %rax
movq -0x18(%rax), %rax
leaq -0x228(%rbp,%rax), %rdi
callq 0x3030
movb %al, -0x28b(%rbp)
jmp 0x728f
movb -0x28b(%rbp), %al
testb $0x1, %al
jne 0x729b
jmp 0x72bc
leaq -0x228(%rbp), %rdi
callq 0x3050
jmp 0x72a9
movb $0x0, -0x1(%rbp)
movl $0x1, -0x258(%rbp)
jmp 0x735f
leaq -0x228(%rbp), %rdi
leaq -0x248(%rbp), %rsi
callq 0x3090
jmp 0x72d1
leaq -0x248(%rbp), %rdi
callq 0x3490
cmpq $0x0, %rax
jne 0x72e8
jmp 0x723c
leaq -0x278(%rbp), %rdi
leaq -0x248(%rbp), %rsi
callq 0x3170
jmp 0x72fd
movq -0x288(%rbp), %rdi
leaq -0x278(%rbp), %rsi
callq 0x73b0
jmp 0x7312
leaq -0x278(%rbp), %rdi
callq 0x31c0
jmp 0x723c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x250(%rbp)
movl %eax, -0x254(%rbp)
leaq -0x278(%rbp), %rdi
callq 0x31c0
jmp 0x7385
leaq -0x228(%rbp), %rdi
callq 0x3050
jmp 0x7351
movb $0x1, -0x1(%rbp)
movl $0x1, -0x258(%rbp)
leaq -0x248(%rbp), %rdi
callq 0x31c0
leaq -0x228(%rbp), %rdi
callq 0x30b0
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x290, %rsp            # imm = 0x290
popq %rbp
retq
leaq -0x248(%rbp), %rdi
callq 0x31c0
leaq -0x228(%rbp), %rdi
callq 0x30b0
movq -0x250(%rbp), %rdi
callq 0x3540
nopl (%rax)
// File: jakubsvehla[P]hex/src/config.cpp
// Function: Config::Tokenize(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*)
void Config::Tokenize (string line, string tokens [TOKEN_NUM])
{
  char * str;
  char * p;
  char   delim[] = " ";
  int    i = 0;

  str = new char [line.size()+1];
  strcpy(str, line.c_str());

  p = strtok(str, delim);
  for (i = 0; i < TOKEN_NUM; i ++) {
    if (p != NULL)
      tokens[i] = p;
    p = strtok(NULL, delim);
  }

  delete [] str;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rsi, -0x48(%rbp)
movq %rdi, %rax
movq -0x48(%rbp), %rdi
movq %rdi, -0x40(%rbp)
movq %rax, -0x8(%rbp)
movq %rdi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movw 0xb7e(%rip), %ax        # 0x81b8
movw %ax, -0x2a(%rbp)
movl $0x0, -0x30(%rbp)
callq 0x31e0
movq %rax, %rdi
addq $0x1, %rdi
callq 0x3040
movq -0x40(%rbp), %rdi
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x38(%rbp)
callq 0x3160
movq -0x38(%rbp), %rdi
movq %rax, %rsi
callq 0x3290
movq -0x20(%rbp), %rdi
leaq -0x2a(%rbp), %rsi
callq 0x34c0
movq %rax, -0x28(%rbp)
movl $0x0, -0x30(%rbp)
cmpl $0x2, -0x30(%rbp)
jge 0x76d0
cmpq $0x0, -0x28(%rbp)
je 0x76b4
movq -0x28(%rbp), %rsi
movq -0x18(%rbp), %rdi
movslq -0x30(%rbp), %rax
shlq $0x5, %rax
addq %rax, %rdi
callq 0x3440
leaq -0x2a(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edi
callq 0x34c0
movq %rax, -0x28(%rbp)
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x768f
movq -0x20(%rbp), %rax
movq %rax, -0x50(%rbp)
cmpq $0x0, %rax
je 0x76e7
movq -0x50(%rbp), %rdi
callq 0x3430
addq $0x50, %rsp
popq %rbp
retq
// File: goodix[P]gdix_hid_firmware_update/firmware_image.cpp
// Function: FirmwareImage::FirmwareImage()
FirmwareImage::FirmwareImage()
{
	m_initialized = false;
	m_firmwareSize = 0;
	m_configSize = 0;
	m_totalSize = 0;
	hasConfig = false;
	memset(m_pid, 0, sizeof(m_pid));
	m_firmwareVersionMajor = 0;
	m_firmwareVersionMinor = 0;
	m_firmwareData = NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x10(%rbp)
leaq 0x1f8bd(%rip), %rax     # 0x24be8
addq $0x10, %rax
movq %rax, (%rdi)
movb $0x0, 0x8(%rdi)
movl $0x0, 0x10(%rdi)
movl $0x0, 0x14(%rdi)
movl $0x0, 0xc(%rdi)
movb $0x0, 0x18(%rdi)
addq $0x19, %rdi
xorl %esi, %esi
movl $0x8, %edx
callq 0x50a0
movq -0x10(%rbp), %rax
movl $0x0, 0x24(%rax)
movl $0x0, 0x28(%rax)
movq $0x0, 0x30(%rax)
addq $0x10, %rsp
popq %rbp
retq
nop
// File: goodix[P]gdix_hid_firmware_update/firmware_image.cpp
// Function: FirmwareImage::InitPid()
int FirmwareImage::InitPid()
{
	gdix_dbg("FirmwareImage %s run\n", __func__);
	m_pid[0] = '\0';
	gdix_dbg("FirmwareImage %s exit\n", __func__);
	return -1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x10(%rbp)
leaq 0x207ee(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0x5ad7
movq 0x20501(%rip), %rax     # 0x25fb8
movq (%rax), %rdi
leaq 0x16543(%rip), %rsi     # 0x1c004
leaq 0x1677a(%rip), %r8      # 0x1c242
movl $0xe4, %ecx
movq %r8, %rdx
movb $0x0, %al
callq 0x5190
jmp 0x5ad9
movq -0x10(%rbp), %rax
movb $0x0, 0x19(%rax)
leaq 0x207b1(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0x5b14
movq 0x204c4(%rip), %rax     # 0x25fb8
movq (%rax), %rdi
leaq 0x1674c(%rip), %rsi     # 0x1c24a
leaq 0x1673d(%rip), %r8      # 0x1c242
movl $0xe6, %ecx
movq %r8, %rdx
movb $0x0, %al
callq 0x5190
jmp 0x5b16
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: goodix[P]gdix_hid_firmware_update/firmware_image.cpp
// Function: FirmwareImage::InitVid()
int FirmwareImage::InitVid()
{
	gdix_dbg("FirmwareImage %s run\n", __func__);
	m_firmwareVersionMajor = 0;
	m_firmwareVersionMinor = 0;
	gdix_dbg("FirmwareImage %s exit\n", __func__);
	return -1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x10(%rbp)
leaq 0x2074e(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0x5b77
movq 0x20461(%rip), %rax     # 0x25fb8
movq (%rax), %rdi
leaq 0x164a3(%rip), %rsi     # 0x1c004
leaq 0x1670a(%rip), %r8      # 0x1c272
movl $0xeb, %ecx
movq %r8, %rdx
movb $0x0, %al
callq 0x5190
jmp 0x5b79
movq -0x10(%rbp), %rax
movl $0x0, 0x24(%rax)
movl $0x0, 0x28(%rax)
leaq 0x20707(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0x5bbe
movq 0x2041a(%rip), %rax     # 0x25fb8
movq (%rax), %rdi
leaq 0x166a2(%rip), %rsi     # 0x1c24a
leaq 0x166c3(%rip), %r8      # 0x1c272
movl $0xee, %ecx
movq %r8, %rdx
movb $0x0, %al
callq 0x5190
jmp 0x5bc0
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: goodix[P]gdix_hid_firmware_update/firmware_image.cpp
// Function: FirmwareImage::Close()
void FirmwareImage::Close()
{
	if (!m_initialized)
		return;

	m_initialized = false;
	if (NULL != m_firmwareData) {
		delete[] m_firmwareData;
		m_firmwareData = NULL;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x10(%rbp)
testb $0x1, 0x8(%rax)
jne 0x5cec
jmp 0x5d23
movq -0x10(%rbp), %rcx
movb $0x0, 0x8(%rcx)
xorl %eax, %eax
cmpq 0x30(%rcx), %rax
je 0x5d23
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rax
movq %rax, -0x18(%rbp)
cmpq $0x0, %rax
je 0x5d17
movq -0x18(%rbp), %rdi
callq 0x5140
movq -0x10(%rbp), %rax
movq $0x0, 0x30(%rax)
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)
// File: goodix[P]gdix_hid_firmware_update/gt_update.cpp
// Function: GTupdate::Initialize(GTmodel*, FirmwareImage*)
int GTupdate::Initialize(GTmodel *dev, FirmwareImage *image)
{
	m_Initialized = false;
	this->dev = dev;
	this->image = image;
	if (dev != NULL && dev->IsOpened() && image != NULL && image->IsOpened()) {
		m_Initialized = true;
		return 0;
	}
	return -1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x28(%rbp)
movb $0x0, 0x18(%rax)
movq -0x18(%rbp), %rcx
movq %rcx, 0x8(%rax)
movq -0x20(%rbp), %rcx
movq %rcx, 0x10(%rax)
cmpq $0x0, -0x18(%rbp)
je 0x6012
movq -0x18(%rbp), %rdi
movq (%rdi), %rax
callq *0x18(%rax)
testb $0x1, %al
jne 0x5fe7
jmp 0x6012
cmpq $0x0, -0x20(%rbp)
je 0x6012
movq -0x20(%rbp), %rdi
movq (%rdi), %rax
callq *0x90(%rax)
testb $0x1, %al
jne 0x6001
jmp 0x6012
movq -0x28(%rbp), %rax
movb $0x1, 0x18(%rax)
movl $0x0, -0x4(%rbp)
jmp 0x6019
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: goodix[P]gdix_hid_firmware_update/main.cpp
// Function: printHelp(char const*)
static void printHelp(const char *prog_name)
{
	fprintf(stdout, "Usage: %s [OPTIONS] FIRMWAREFILE\n", prog_name);
	fprintf(stdout, "\t-h, --help\tPrint this message\n");
	fprintf(stdout,
			"\t-f, --force\tForce updating firmware with check PID and VID\n");
	fprintf(stdout,
			"\t-d, --device\thidraw device file associated with the device "
			"being updated.\n");
	fprintf(stdout,
			"\t-p, --fw-props\tPrint the firmware properties, format like PID "
			"7589:VID 1.1.\n");
	fprintf(stdout, "\t-v, --version\tPrint version number.\n");
	fprintf(stdout, "\t-t, --type\t device pid number.\n");
	fprintf(stdout,
			"\t-s, --series\t device series type number like 8589 or 7288.\n");
	fprintf(stdout,
			"\t-i, --info\t print detail info while the tool is running.\n");
	fprintf(stdout, "\t-m, --module\t print module/sensor ID.\n");
	fprintf(stdout,
			"\t-a, --i2c-addr\t if this option is set, will be upgraded by "
			"i2c.(only support berlinB)\n");
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq 0x1e515(%rip), %rax     # 0x25fb8
movq (%rax), %rdi
movq -0x8(%rbp), %rdx
leaq 0x14edf(%rip), %rsi     # 0x1c990
movb $0x0, %al
callq 0x5190
movq 0x1e4f9(%rip), %rax     # 0x25fb8
movq (%rax), %rdi
leaq 0x14ee9(%rip), %rsi     # 0x1c9b2
movb $0x0, %al
callq 0x5190
movq 0x1e4e1(%rip), %rax     # 0x25fb8
movq (%rax), %rdi
leaq 0x14ef1(%rip), %rsi     # 0x1c9d2
movb $0x0, %al
callq 0x5190
movq 0x1e4c9(%rip), %rax     # 0x25fb8
movq (%rax), %rdi
leaq 0x14f16(%rip), %rsi     # 0x1ca0f
movb $0x0, %al
callq 0x5190
movq 0x1e4b1(%rip), %rax     # 0x25fb8
movq (%rax), %rdi
leaq 0x14f4a(%rip), %rsi     # 0x1ca5b
movb $0x0, %al
callq 0x5190
movq 0x1e499(%rip), %rax     # 0x25fb8
movq (%rax), %rdi
leaq 0x14f80(%rip), %rsi     # 0x1caa9
movb $0x0, %al
callq 0x5190
movq 0x1e481(%rip), %rax     # 0x25fb8
movq (%rax), %rdi
leaq 0x14f8e(%rip), %rsi     # 0x1cacf
movb $0x0, %al
callq 0x5190
movq 0x1e469(%rip), %rax     # 0x25fb8
movq (%rax), %rdi
leaq 0x14f97(%rip), %rsi     # 0x1caf0
movb $0x0, %al
callq 0x5190
movq 0x1e451(%rip), %rax     # 0x25fb8
movq (%rax), %rdi
leaq 0x14fbc(%rip), %rsi     # 0x1cb2d
movb $0x0, %al
callq 0x5190
movq 0x1e439(%rip), %rax     # 0x25fb8
movq (%rax), %rdi
leaq 0x14fdf(%rip), %rsi     # 0x1cb68
movb $0x0, %al
callq 0x5190
movq 0x1e421(%rip), %rax     # 0x25fb8
movq (%rax), %rdi
leaq 0x14fef(%rip), %rsi     # 0x1cb90
movb $0x0, %al
callq 0x5190
addq $0x10, %rsp
popq %rbp
retq
nop
// File: goodix[P]gdix_hid_firmware_update/main.cpp
// Function: lowercase_str(unsigned char*)
static void lowercase_str(unsigned char *str)
{
	unsigned char *ptr = str;
	while (*ptr) {
		*ptr = tolower(*ptr);
		ptr++;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
cmpb $0x0, (%rax)
je 0x7c1f
movq -0x10(%rbp), %rax
movzbl (%rax), %edi
callq 0x51b0
movb %al, %cl
movq -0x10(%rbp), %rax
movb %cl, (%rax)
movq -0x10(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rbp)
jmp 0x7bf4
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nop
// File: goodix[P]gdix_hid_firmware_update/gt7868q/gt7868q.cpp
// Function: GT7868QDevice::ChecksumU8_ys(unsigned char*, int)
unsigned short GT7868QDevice::ChecksumU8_ys(unsigned char *data, int len)
{
	unsigned short chksum = 0;
	int i = 0;

	for (i = 0; i < len - 2; i++)
		chksum += data[i];
	gdix_dbg("calu chksum:0x%x, chksum in fw:0x%x\n", chksum,
			 ((data[len - 2] << 8) | data[len - 1]));
	return chksum - ((data[len - 2] << 8) | data[len - 1]);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movw $0x0, -0x16(%rbp)
movl $0x0, -0x1c(%rbp)
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movl -0x14(%rbp), %ecx
subl $0x2, %ecx
cmpl %ecx, %eax
jge 0x7e45
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movzbl (%rax,%rcx), %ecx
movzwl -0x16(%rbp), %eax
addl %ecx, %eax
movw %ax, -0x16(%rbp)
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x7e17
jmp 0x7e47
leaq 0x1e44b(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0x7ea6
movq 0x1e15e(%rip), %rax     # 0x25fb8
movq (%rax), %rdi
movzwl -0x16(%rbp), %r8d
movq -0x10(%rbp), %rax
movl -0x14(%rbp), %ecx
subl $0x2, %ecx
movslq %ecx, %rcx
movzbl (%rax,%rcx), %r9d
shll $0x8, %r9d
movq -0x10(%rbp), %rax
movl -0x14(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movzbl (%rax,%rcx), %eax
orl %eax, %r9d
leaq 0x14da8(%rip), %rsi     # 0x1cc3b
leaq 0x14dd7(%rip), %rdx     # 0x1cc71
movl $0x23, %ecx
movb $0x0, %al
callq 0x5190
jmp 0x7ea8
movzwl -0x16(%rbp), %eax
movq -0x10(%rbp), %rcx
movl -0x14(%rbp), %edx
subl $0x2, %edx
movslq %edx, %rdx
movzbl (%rcx,%rdx), %ecx
shll $0x8, %ecx
movq -0x10(%rbp), %rdx
movl -0x14(%rbp), %esi
subl $0x1, %esi
movslq %esi, %rsi
movzbl (%rdx,%rsi), %edx
orl %edx, %ecx
subl %ecx, %eax
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: goodix[P]gdix_hid_firmware_update/gt7868q/gt7868q_firmware_image.cpp
// Function: GT7868QFirmwareImage::InitPid()
int GT7868QFirmwareImage::InitPid()
{
	gdix_dbg("GT7868QFirmwareImage::InitPid run\n");
	int ret = -1;
	int i = 0;
	int j = 0;

	if (!m_firmwareData) {
		goto exit;
	}
	for (i = 0, j = 0; i < GT7868Q_FW_IMAGE_PID_LEN; i++)
		if (m_firmwareData[GT7868Q_FW_IMAGE_PID_OFFSET + i] != 0)
			m_pid[j++] = m_firmwareData[GT7868Q_FW_IMAGE_PID_OFFSET + i];
	m_pid[j] = '\0';
	ret = 0;

exit:
	gdix_dbg("GT7868QFirmwareImage::InitPid exit\n");
	return ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x20(%rbp)
leaq 0x1dade(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0x87e4
movq 0x1d7f1(%rip), %rax     # 0x25fb8
movq (%rax), %rdi
leaq 0x14774(%rip), %rsi     # 0x1cf45
leaq 0x13a6a(%rip), %rdx     # 0x1c242
movl $0x20, %ecx
movb $0x0, %al
callq 0x5190
jmp 0x87e6
movq -0x20(%rbp), %rax
movl $0xffffffff, -0xc(%rbp) # imm = 0xFFFFFFFF
movl $0x0, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
cmpq $0x0, 0x30(%rax)
jne 0x8808
jmp 0x887d
movl $0x0, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
cmpl $0x8, -0x10(%rbp)
jge 0x8869
movq -0x20(%rbp), %rax
movq 0x30(%rax), %rax
movl -0x10(%rbp), %ecx
addl $0xf, %ecx
movslq %ecx, %rcx
movzbl (%rax,%rcx), %eax
cmpl $0x0, %eax
je 0x885c
movq -0x20(%rbp), %rax
movq 0x30(%rax), %rcx
movl -0x10(%rbp), %edx
addl $0xf, %edx
movslq %edx, %rdx
movb (%rcx,%rdx), %dl
movl -0x14(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x14(%rbp)
movslq %ecx, %rcx
movb %dl, 0x19(%rax,%rcx)
jmp 0x885e
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x8816
movq -0x20(%rbp), %rax
movslq -0x14(%rbp), %rcx
movb $0x0, 0x19(%rax,%rcx)
movl $0x0, -0xc(%rbp)
jmp 0x887f
leaq 0x1da13(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0x88af
movq 0x1d726(%rip), %rax     # 0x25fb8
movq (%rax), %rdi
leaq 0x146dd(%rip), %rsi     # 0x1cf79
leaq 0x1399f(%rip), %rdx     # 0x1c242
movl $0x2f, %ecx
movb $0x0, %al
callq 0x5190
jmp 0x88b1
movl -0xc(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: goodix[P]gdix_hid_firmware_update/gt7868q/gt7868q_firmware_image.cpp
// Function: GT7868QFirmwareImage::InitVid()
int GT7868QFirmwareImage::InitVid()
{
	gdix_dbg("GT7868QFirmwareImage InitVid run\n");
	int ret = -1;

	if (!m_firmwareData)
		goto exit;

	m_firmwareVersionMajor = m_firmwareData[GT7868Q_FW_IMAGE_VID_OFFSET];
	/* |--vid2--|--vid3--|--cfg_id--|
	 * reserve the last byte for config ID.
	 */
	m_firmwareVersionMinor =
		(m_firmwareData[GT7868Q_FW_IMAGE_VID_OFFSET + 1] << 16) |
		(m_firmwareData[GT7868Q_FW_IMAGE_VID_OFFSET + 2] << 8);
	gdix_dbg("cid:0x%02x,vid 0x%02X,0x%02X,0x%02X\n",
			 m_firmwareData[GT7868Q_FW_IMAGE_CID_OFFSET],
			 m_firmwareData[GT7868Q_FW_IMAGE_VID_OFFSET],
			 m_firmwareData[GT7868Q_FW_IMAGE_VID_OFFSET + 1],
			 m_firmwareData[GT7868Q_FW_IMAGE_VID_OFFSET + 2]);
	ret = 0;
exit:
	gdix_dbg("GT7868QFirmwareImage InitVid exit,exit code:%d\n", ret);
	return ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x18(%rbp)
leaq 0x1d9be(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0x8904
movq 0x1d6d1(%rip), %rax     # 0x25fb8
movq (%rax), %rdi
leaq 0x146bd(%rip), %rsi     # 0x1cfae
leaq 0x1397a(%rip), %rdx     # 0x1c272
movl $0x35, %ecx
movb $0x0, %al
callq 0x5190
jmp 0x8906
movq -0x18(%rbp), %rax
movl $0xffffffff, -0xc(%rbp) # imm = 0xFFFFFFFF
cmpq $0x0, 0x30(%rax)
jne 0x891d
jmp 0x89af
movq -0x18(%rbp), %rax
movq 0x30(%rax), %rcx
movzbl 0x18(%rcx), %ecx
movl %ecx, 0x24(%rax)
movq 0x30(%rax), %rcx
movzbl 0x19(%rcx), %ecx
shll $0x10, %ecx
movq 0x30(%rax), %rdx
movzbl 0x1a(%rdx), %edx
shll $0x8, %edx
orl %edx, %ecx
movl %ecx, 0x28(%rax)
leaq 0x1d94b(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0x89a6
movq -0x18(%rbp), %rax
movq 0x1d65a(%rip), %rcx     # 0x25fb8
movq (%rcx), %rdi
movq 0x30(%rax), %rcx
movzbl 0x17(%rcx), %r8d
movq 0x30(%rax), %rcx
movzbl 0x18(%rcx), %r9d
movq 0x30(%rax), %rcx
movzbl 0x19(%rcx), %r10d
movq 0x30(%rax), %rax
movzbl 0x1a(%rax), %eax
leaq 0x14656(%rip), %rsi     # 0x1cfe1
leaq 0x138e0(%rip), %rdx     # 0x1c272
movl $0x46, %ecx
movl %r10d, (%rsp)
movl %eax, 0x8(%rsp)
movb $0x0, %al
callq 0x5190
jmp 0x89a8
movl $0x0, -0xc(%rbp)
jmp 0x89b1
leaq 0x1d8e1(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0x89e5
movq 0x1d5f4(%rip), %rax     # 0x25fb8
movq (%rax), %rdi
movl -0xc(%rbp), %r8d
leaq 0x14645(%rip), %rsi     # 0x1d017
leaq 0x13899(%rip), %rdx     # 0x1c272
movl $0x49, %ecx
movb $0x0, %al
callq 0x5190
jmp 0x89e7
movl -0xc(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
// File: goodix[P]gdix_hid_firmware_update/gt7868q/gt7868q_update.cpp
// Function: GT7868QUpdate::cmd_init(unsigned char*, unsigned char, unsigned short)
void GT7868QUpdate::cmd_init(unsigned char *cmd_buf, unsigned char cmd,
							 unsigned short cmd_data)
{
	unsigned short chksum;
	cmd_buf[0] = cmd;
	cmd_buf[1] = (cmd_data >> 8) & 0xff;
	cmd_buf[2] = cmd_data & 0xff;
	chksum = cmd_buf[0] + cmd_buf[1] + cmd_buf[2];
	cmd_buf[3] = (chksum >> 8) & 0xff;
	cmd_buf[4] = chksum & 0xff;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movw %cx, %ax
movb %dl, %cl
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movb %cl, -0x11(%rbp)
movw %ax, -0x14(%rbp)
movb -0x11(%rbp), %cl
movq -0x10(%rbp), %rax
movb %cl, (%rax)
movzwl -0x14(%rbp), %eax
sarl $0x8, %eax
andl $0xff, %eax
movb %al, %cl
movq -0x10(%rbp), %rax
movb %cl, 0x1(%rax)
movzwl -0x14(%rbp), %eax
andl $0xff, %eax
movb %al, %cl
movq -0x10(%rbp), %rax
movb %cl, 0x2(%rax)
movq -0x10(%rbp), %rax
movzbl (%rax), %eax
movq -0x10(%rbp), %rcx
movzbl 0x1(%rcx), %ecx
addl %ecx, %eax
movq -0x10(%rbp), %rcx
movzbl 0x2(%rcx), %ecx
addl %ecx, %eax
movw %ax, -0x16(%rbp)
movzwl -0x16(%rbp), %eax
sarl $0x8, %eax
andl $0xff, %eax
movb %al, %cl
movq -0x10(%rbp), %rax
movb %cl, 0x3(%rax)
movzwl -0x16(%rbp), %eax
andl $0xff, %eax
movb %al, %cl
movq -0x10(%rbp), %rax
movb %cl, 0x4(%rax)
popq %rbp
retq
// File: goodix[P]gdix_hid_firmware_update/gtx2/gtx2.cpp
// Function: GTx2Device::GetCfgVersion()
int GTx2Device::GetCfgVersion()
{
	int ret;
	unsigned char cfg_ver;
	unsigned char pid[5] = {0};
	int sensor_id;
	unsigned char fw_info[12] = {0};

	ret = Read(0x8050, &cfg_ver, 1);
	if (ret < 0) {
		gdix_err("Failed read cfg VERSION\n");
		return ret;
	}
	ret = Read(0x8140, fw_info, sizeof(fw_info));
	if (ret < 0) {
		gdix_err("Failed read VERSION\n");
		return ret;
	}

	memcpy(pid, fw_info, 4);
	sensor_id = fw_info[10] & 0x0f;
	fprintf(stdout, "PID:%s\n", pid);
	fprintf(stdout, "sensorID:%d\n", sensor_id);
	fprintf(stdout, "cfg version:%d\n", cfg_ver);
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x38(%rbp)
leaq -0x1a(%rbp), %rdi
xorl %esi, %esi
movl $0x5, %edx
callq 0x50a0
leaq -0x2c(%rbp), %rdi
xorl %esi, %esi
movl $0xc, %edx
callq 0x50a0
movq -0x38(%rbp), %rdi
movq (%rdi), %rax
movl $0x8050, %esi           # imm = 0x8050
leaq -0x15(%rbp), %rdx
movl $0x1, %ecx
callq *0x20(%rax)
movl %eax, -0x14(%rbp)
cmpl $0x0, -0x14(%rbp)
jge 0xade4
jmp 0xada7
leaq 0x1b4eb(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0xadd7
movq 0x1b21e(%rip), %rax     # 0x25fd8
movq (%rax), %rdi
leaq 0x12dde(%rip), %rsi     # 0x1dba2
leaq 0x12e01(%rip), %rdx     # 0x1dbcc
movl $0x66, %ecx
movb $0x0, %al
callq 0x5190
jmp 0xadd9
movl -0x14(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0xaeab
movq -0x38(%rbp), %rdi
leaq -0x2c(%rbp), %rdx
movq (%rdi), %rax
movl $0x8140, %esi           # imm = 0x8140
movl $0xc, %ecx
callq *0x20(%rax)
movl %eax, -0x14(%rbp)
cmpl $0x0, -0x14(%rbp)
jge 0xae41
jmp 0xae07
leaq 0x1b48b(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0xae37
movq 0x1b1be(%rip), %rax     # 0x25fd8
movq (%rax), %rdi
leaq 0x12db6(%rip), %rsi     # 0x1dbda
leaq 0x12da1(%rip), %rdx     # 0x1dbcc
movl $0x6b, %ecx
movb $0x0, %al
callq 0x5190
jmp 0xae39
movl -0x14(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0xaeab
movl -0x2c(%rbp), %eax
movl %eax, -0x1a(%rbp)
movzbl -0x22(%rbp), %eax
andl $0xf, %eax
movl %eax, -0x20(%rbp)
movq 0x1b160(%rip), %rax     # 0x25fb8
movq (%rax), %rdi
leaq -0x1a(%rbp), %rdx
leaq 0x13f91(%rip), %rsi     # 0x1edf7
movb $0x0, %al
callq 0x5190
movq 0x1b144(%rip), %rax     # 0x25fb8
movq (%rax), %rdi
movl -0x20(%rbp), %edx
leaq 0x13fb9(%rip), %rsi     # 0x1ee3a
movb $0x0, %al
callq 0x5190
movq 0x1b129(%rip), %rax     # 0x25fb8
movq (%rax), %rdi
movzbl -0x15(%rbp), %edx
leaq 0x12cf5(%rip), %rsi     # 0x1db92
movb $0x0, %al
callq 0x5190
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nop
// File: goodix[P]gdix_hid_firmware_update/gtx2/gtx2_firmware_image.cpp
// Function: GTX2FirmwareImage::InitPid()
int GTX2FirmwareImage::InitPid()
{
	gdix_dbg("GTX2FirmwareImage %s run\n", __func__);
	int ret = -1;
	int i = 0;
	int j = 0;

	if (!m_firmwareData) {
		goto exit;
	}

	for (i = 0, j = 0; i < GTX2_FW_IMAGE_PID_LEN; i++)
		if (m_firmwareData[GTX2_FW_IMAGE_PID_OFFSET + i] != 0)
			m_pid[j++] = m_firmwareData[GTX2_FW_IMAGE_PID_OFFSET + i];
	m_pid[j] = '\0';
	ret = 0;
exit:
	gdix_dbg("GTX2FirmwareImage %s exit,exit code:%d\n", __func__, ret);
	return ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x20(%rbp)
leaq 0x1b24e(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0xb077
movq 0x1af61(%rip), %rax     # 0x25fb8
movq (%rax), %rdi
leaq 0x12bac(%rip), %rsi     # 0x1dc0d
leaq 0x111da(%rip), %r8      # 0x1c242
movl $0x21, %ecx
movq %r8, %rdx
movb $0x0, %al
callq 0x5190
jmp 0xb079
movq -0x20(%rbp), %rax
movl $0xffffffff, -0xc(%rbp) # imm = 0xFFFFFFFF
movl $0x0, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
cmpq $0x0, 0x30(%rax)
jne 0xb09b
jmp 0xb110
movl $0x0, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
cmpl $0x6, -0x10(%rbp)
jge 0xb0fc
movq -0x20(%rbp), %rax
movq 0x30(%rax), %rax
movl -0x10(%rbp), %ecx
addl $0xf, %ecx
movslq %ecx, %rcx
movzbl (%rax,%rcx), %eax
cmpl $0x0, %eax
je 0xb0ef
movq -0x20(%rbp), %rax
movq 0x30(%rax), %rcx
movl -0x10(%rbp), %edx
addl $0xf, %edx
movslq %edx, %rdx
movb (%rcx,%rdx), %dl
movl -0x14(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x14(%rbp)
movslq %ecx, %rcx
movb %dl, 0x19(%rax,%rcx)
jmp 0xb0f1
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0xb0a9
movq -0x20(%rbp), %rax
movslq -0x14(%rbp), %rcx
movb $0x0, 0x19(%rax,%rcx)
movl $0x0, -0xc(%rbp)
jmp 0xb112
leaq 0x1b180(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0xb149
movq 0x1ae93(%rip), %rax     # 0x25fb8
movq (%rax), %rdi
movl -0xc(%rbp), %r9d
leaq 0x12b05(%rip), %rsi     # 0x1dc38
leaq 0x11108(%rip), %r8      # 0x1c242
movl $0x30, %ecx
movq %r8, %rdx
movb $0x0, %al
callq 0x5190
jmp 0xb14b
movl -0xc(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: goodix[P]gdix_hid_firmware_update/gtx2/gtx2_firmware_image.cpp
// Function: GTX2FirmwareImage::InitVid()
int GTX2FirmwareImage::InitVid()
{
	gdix_dbg("GTX2FirmwareImage %s run\n", __func__);
	int ret = -1;

	if (!m_firmwareData)
		goto exit;

	m_firmwareVersionMajor = 0;
	m_firmwareVersionMinor =
		((m_firmwareData[GTX2_FW_IMAGE_VID_OFFSET] << 16) |
		 (m_firmwareData[GTX2_FW_IMAGE_VID_OFFSET + 1] << 8) |
		 (m_firmwareData[GTX2_FW_IMAGE_VID_OFFSET + 2]));
	gdix_dbg("vid 0x%02X,0x%02X,0x%02X\n",
			 m_firmwareData[GTX2_FW_IMAGE_VID_OFFSET],
			 m_firmwareData[GTX2_FW_IMAGE_VID_OFFSET + 1],
			 m_firmwareData[GTX2_FW_IMAGE_VID_OFFSET + 2]);
	ret = 0;
exit:
	gdix_dbg("GTX2FirmwareImage %s exit,exit code:%d\n", __func__, ret);
	return ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x18(%rbp)
leaq 0x1b11e(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0xb1a7
movq 0x1ae31(%rip), %rax     # 0x25fb8
movq (%rax), %rdi
leaq 0x12a7c(%rip), %rsi     # 0x1dc0d
leaq 0x110da(%rip), %r8      # 0x1c272
movl $0x36, %ecx
movq %r8, %rdx
movb $0x0, %al
callq 0x5190
jmp 0xb1a9
movq -0x18(%rbp), %rax
movl $0xffffffff, -0xc(%rbp) # imm = 0xFFFFFFFF
cmpq $0x0, 0x30(%rax)
jne 0xb1c0
jmp 0xb24a
movq -0x18(%rbp), %rax
movl $0x0, 0x24(%rax)
movq 0x30(%rax), %rcx
movzbl 0x15(%rcx), %ecx
shll $0x10, %ecx
movq 0x30(%rax), %rdx
movzbl 0x16(%rdx), %edx
shll $0x8, %edx
orl %edx, %ecx
movq 0x30(%rax), %rdx
movzbl 0x17(%rdx), %edx
orl %edx, %ecx
movl %ecx, 0x28(%rax)
leaq 0x1b0a2(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0xb241
movq -0x18(%rbp), %rax
movq 0x1adb1(%rip), %rcx     # 0x25fb8
movq (%rcx), %rdi
movq 0x30(%rax), %rcx
movzbl 0x15(%rcx), %r8d
movq 0x30(%rax), %rcx
movzbl 0x16(%rcx), %r9d
movq 0x30(%rax), %rax
movzbl 0x17(%rax), %eax
leaq 0x12a46(%rip), %rsi     # 0x1dc71
leaq 0x11040(%rip), %rdx     # 0x1c272
movl $0x44, %ecx
movl %eax, (%rsp)
movb $0x0, %al
callq 0x5190
jmp 0xb243
movl $0x0, -0xc(%rbp)
jmp 0xb24c
leaq 0x1b046(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0xb283
movq 0x1ad59(%rip), %rax     # 0x25fb8
movq (%rax), %rdi
movl -0xc(%rbp), %r9d
leaq 0x129cb(%rip), %rsi     # 0x1dc38
leaq 0x10ffe(%rip), %r8      # 0x1c272
movl $0x47, %ecx
movq %r8, %rdx
movb $0x0, %al
callq 0x5190
jmp 0xb285
movl -0xc(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nop
// File: goodix[P]gdix_hid_firmware_update/gtx3/gtx3_firmware_image.cpp
// Function: GTX3FirmwareImage::InitPid()
int GTX3FirmwareImage::InitPid()
{
	gdix_dbg("GTX3FirmwareImage::InitPid run\n");
	int ret = -1;
	int i = 0;
	int j = 0;

	if (!m_firmwareData) {
		goto exit;
	}
	for (i = 0, j = 0; i < GTX3_FW_IMAGE_PID_LEN; i++)
		if (m_firmwareData[GTX3_FW_IMAGE_PID_OFFSET + i] != 0)
			m_pid[j++] = m_firmwareData[GTX3_FW_IMAGE_PID_OFFSET + i];
	m_pid[j] = '\0';
	ret = 0;

exit:
	gdix_dbg("GTX3FirmwareImage::InitPid exit\n");
	return ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x20(%rbp)
leaq 0x1964e(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0xcc74
movq 0x19361(%rip), %rax     # 0x25fb8
movq (%rax), %rdi
leaq 0x11378(%rip), %rsi     # 0x1dfd9
leaq 0xf5da(%rip), %rdx      # 0x1c242
movl $0x20, %ecx
movb $0x0, %al
callq 0x5190
jmp 0xcc76
movq -0x20(%rbp), %rax
movl $0xffffffff, -0xc(%rbp) # imm = 0xFFFFFFFF
movl $0x0, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
cmpq $0x0, 0x30(%rax)
jne 0xcc98
jmp 0xcd0d
movl $0x0, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
cmpl $0x8, -0x10(%rbp)
jge 0xccf9
movq -0x20(%rbp), %rax
movq 0x30(%rax), %rax
movl -0x10(%rbp), %ecx
addl $0xf, %ecx
movslq %ecx, %rcx
movzbl (%rax,%rcx), %eax
cmpl $0x0, %eax
je 0xccec
movq -0x20(%rbp), %rax
movq 0x30(%rax), %rcx
movl -0x10(%rbp), %edx
addl $0xf, %edx
movslq %edx, %rdx
movb (%rcx,%rdx), %dl
movl -0x14(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x14(%rbp)
movslq %ecx, %rcx
movb %dl, 0x19(%rax,%rcx)
jmp 0xccee
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0xcca6
movq -0x20(%rbp), %rax
movslq -0x14(%rbp), %rcx
movb $0x0, 0x19(%rax,%rcx)
movl $0x0, -0xc(%rbp)
jmp 0xcd0f
leaq 0x19583(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0xcd3f
movq 0x19296(%rip), %rax     # 0x25fb8
movq (%rax), %rdi
leaq 0x112de(%rip), %rsi     # 0x1e00a
leaq 0xf50f(%rip), %rdx      # 0x1c242
movl $0x2f, %ecx
movb $0x0, %al
callq 0x5190
jmp 0xcd41
movl -0xc(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: goodix[P]gdix_hid_firmware_update/gtx3/gtx3_firmware_image.cpp
// Function: GTX3FirmwareImage::InitVid()
int GTX3FirmwareImage::InitVid()
{
	gdix_dbg("GTX3FirmwareImage InitVid run\n");
	int ret = -1;

	if (!m_firmwareData)
		goto exit;

	m_firmwareVersionMajor = m_firmwareData[GTX3_FW_IMAGE_VID_OFFSET];
	/* |--vid2--|--vid3--|--cfg_id--|
	 * reserve the last byte for config ID.
	 */
	m_firmwareVersionMinor =
		(m_firmwareData[GTX3_FW_IMAGE_VID_OFFSET + 1] << 16) |
		(m_firmwareData[GTX3_FW_IMAGE_VID_OFFSET + 2] << 8);
	gdix_dbg("cid:0x%02x,vid 0x%02X,0x%02X,0x%02X\n",
			 m_firmwareData[GTX3_FW_IMAGE_CID_OFFSET],
			 m_firmwareData[GTX3_FW_IMAGE_VID_OFFSET],
			 m_firmwareData[GTX3_FW_IMAGE_VID_OFFSET + 1],
			 m_firmwareData[GTX3_FW_IMAGE_VID_OFFSET + 2]);
	ret = 0;
exit:
	gdix_dbg("GTX3FirmwareImage InitVid exit,exit code:%d\n", ret);
	return ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x18(%rbp)
leaq 0x1952e(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0xcd94
movq 0x19241(%rip), %rax     # 0x25fb8
movq (%rax), %rdi
leaq 0x112bb(%rip), %rsi     # 0x1e03c
leaq 0xf4ea(%rip), %rdx      # 0x1c272
movl $0x35, %ecx
movb $0x0, %al
callq 0x5190
jmp 0xcd96
movq -0x18(%rbp), %rax
movl $0xffffffff, -0xc(%rbp) # imm = 0xFFFFFFFF
cmpq $0x0, 0x30(%rax)
jne 0xcdad
jmp 0xce3f
movq -0x18(%rbp), %rax
movq 0x30(%rax), %rcx
movzbl 0x18(%rcx), %ecx
movl %ecx, 0x24(%rax)
movq 0x30(%rax), %rcx
movzbl 0x19(%rcx), %ecx
shll $0x10, %ecx
movq 0x30(%rax), %rdx
movzbl 0x1a(%rdx), %edx
shll $0x8, %edx
orl %edx, %ecx
movl %ecx, 0x28(%rax)
leaq 0x194bb(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0xce36
movq -0x18(%rbp), %rax
movq 0x191ca(%rip), %rcx     # 0x25fb8
movq (%rcx), %rdi
movq 0x30(%rax), %rcx
movzbl 0x17(%rcx), %r8d
movq 0x30(%rax), %rcx
movzbl 0x18(%rcx), %r9d
movq 0x30(%rax), %rcx
movzbl 0x19(%rcx), %r10d
movq 0x30(%rax), %rax
movzbl 0x1a(%rax), %eax
leaq 0x101c6(%rip), %rsi     # 0x1cfe1
leaq 0xf450(%rip), %rdx      # 0x1c272
movl $0x46, %ecx
movl %r10d, (%rsp)
movl %eax, 0x8(%rsp)
movb $0x0, %al
callq 0x5190
jmp 0xce38
movl $0x0, -0xc(%rbp)
jmp 0xce41
leaq 0x19451(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0xce75
movq 0x19164(%rip), %rax     # 0x25fb8
movq (%rax), %rdi
movl -0xc(%rbp), %r8d
leaq 0x1120a(%rip), %rsi     # 0x1e06c
leaq 0xf409(%rip), %rdx      # 0x1c272
movl $0x49, %ecx
movb $0x0, %al
callq 0x5190
jmp 0xce77
movl -0xc(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
// File: goodix[P]gdix_hid_firmware_update/gtx5/gtx5.cpp
// Function: GTx5Device::GTx5Device()
GTx5Device::GTx5Device()
{
	m_inputReportSize = 0;
	m_outputReportSize = 0;
	m_inputReport = nullptr;
	m_outputReport = nullptr;
	m_firmwareVersionMajor = 0;
	m_firmwareVersionMinor = 0;
	m_sensorID = 16; /* > 15 invalid ID */
	memset(m_pid, 0, sizeof(m_pid));
	m_hidDevType = HID_MACHINE;
	m_deviceOpen = false;
	m_bCancel = false;
	m_fd = -1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x10(%rbp)
callq 0xf7d0
movq -0x10(%rbp), %rdi
leaq 0x16a94(%rip), %rax     # 0x253e8
addq $0x10, %rax
movq %rax, (%rdi)
movl $0x0, 0x28(%rdi)
movl $0x0, 0x2c(%rdi)
movq $0x0, 0x30(%rdi)
movq $0x0, 0x38(%rdi)
movl $0x0, 0x10(%rdi)
movl $0x0, 0x14(%rdi)
movl $0x10, 0x18(%rdi)
addq $0x1c, %rdi
xorl %esi, %esi
movl $0x7, %edx
callq 0x50a0
movq -0x10(%rbp), %rax
movl $0x1, 0x24(%rax)
movb $0x0, 0x8(%rax)
movb $0x0, 0x40(%rax)
movl $0xffffffff, 0xc(%rax)  # imm = 0xFFFFFFFF
addq $0x10, %rsp
popq %rbp
retq
nop
// File: goodix[P]gdix_hid_firmware_update/gtx5/gtx5.cpp
// Function: GTx5Device::GetFirmwareProps(char const*, char*, int)
int GTx5Device::GetFirmwareProps(const char *deviceName, char *props_buf,
								 int len)
{
	int ret;

	ret = Open(deviceName);
	if (ret) {
		gdix_dbg("failed open device:%s\n", deviceName);
		return -1;
	}

	snprintf(props_buf, len, "%d.%d", GetFirmwareVersionMajor(),
			 GetFirmwareVersionMinor());
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movl %ecx, -0x24(%rbp)
movq -0x10(%rbp), %rdi
movq %rdi, -0x30(%rbp)
movq -0x18(%rbp), %rsi
movq (%rdi), %rax
callq *0x10(%rax)
movl %eax, -0x28(%rbp)
cmpl $0x0, -0x28(%rbp)
je 0xea33
jmp 0xe9f4
leaq 0x1789e(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0xea28
movq 0x175b1(%rip), %rax     # 0x25fb8
movq (%rax), %rdi
movq -0x18(%rbp), %r8
leaq 0xf969(%rip), %rsi      # 0x1e37e
leaq 0xf98a(%rip), %rdx      # 0x1e3a6
movl $0x3a, %ecx
movb $0x0, %al
callq 0x5190
jmp 0xea2a
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xea7d
movq -0x30(%rbp), %rdi
movq -0x20(%rbp), %rax
movq %rax, -0x48(%rbp)
movslq -0x24(%rbp), %rax
movq %rax, -0x40(%rbp)
movq (%rdi), %rax
callq *0x60(%rax)
movq -0x30(%rbp), %rdi
movl %eax, -0x34(%rbp)
movq (%rdi), %rax
callq *0x68(%rax)
movq -0x48(%rbp), %rdi
movq -0x40(%rbp), %rsi
movl -0x34(%rbp), %ecx
movl %eax, %r8d
leaq 0xf948(%rip), %rdx      # 0x1e3b7
movb $0x0, %al
callq 0x51c0
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: goodix[P]gdix_hid_firmware_update/gtx5/gtx5.cpp
// Function: GTx5Device::Open(char const*)
int GTx5Device::Open(const char *filename)
{
	int rc;

	if (!filename)
		return -EINVAL;
	m_fd = open(filename, O_RDWR);
	if (m_fd < 0)
		return -1;
	m_deviceOpen = true;
	m_inputReportSize = 65;
	m_outputReportSize = 65;
	m_inputReport = new unsigned char[m_inputReportSize]();
	if (!m_inputReport) {
		errno = -ENOMEM;
		rc = -1;
		goto error;
	}
	m_outputReport = new unsigned char[m_outputReportSize]();
	if (!m_outputReport) {
		errno = -ENOMEM;
		rc = -1;
		goto error;
	}
	/* get active firmware info */
	return SetBasicProperties();
error:
	Close();
	return rc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0xeabb
movl $0xffffffea, -0x4(%rbp) # imm = 0xFFFFFFEA
jmp 0xebb3
movq -0x18(%rbp), %rdi
movl $0x2, %esi
movb $0x0, %al
callq 0x51e0
movl %eax, %ecx
movq -0x28(%rbp), %rax
movl %ecx, 0xc(%rax)
cmpl $0x0, 0xc(%rax)
jge 0xeae6
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xebb3
movq -0x28(%rbp), %rax
movb $0x1, 0x8(%rax)
movl $0x41, 0x28(%rax)
movl $0x41, 0x2c(%rax)
movl 0x28(%rax), %eax
movl %eax, %edi
movq %rdi, -0x38(%rbp)
callq 0x5030
movq -0x38(%rbp), %rdx
movq %rax, %rdi
movq %rdi, -0x30(%rbp)
xorl %esi, %esi
callq 0x50a0
movq -0x30(%rbp), %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x30(%rax)
cmpq $0x0, 0x30(%rax)
jne 0xeb43
callq 0x5040
movl $0xfffffff4, (%rax)     # imm = 0xFFFFFFF4
movl $0xffffffff, -0x1c(%rbp) # imm = 0xFFFFFFFF
jmp 0xeba0
movq -0x28(%rbp), %rax
movl 0x2c(%rax), %eax
movl %eax, %edi
movq %rdi, -0x48(%rbp)
callq 0x5030
movq -0x48(%rbp), %rdx
movq %rax, %rdi
movq %rdi, -0x40(%rbp)
xorl %esi, %esi
callq 0x50a0
movq -0x40(%rbp), %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x38(%rax)
cmpq $0x0, 0x38(%rax)
jne 0xeb8e
callq 0x5040
movl $0xfffffff4, (%rax)     # imm = 0xFFFFFFF4
movl $0xffffffff, -0x1c(%rbp) # imm = 0xFFFFFFFF
jmp 0xeba0
movq -0x28(%rbp), %rdi
movq (%rdi), %rax
callq *0xa0(%rax)
movl %eax, -0x4(%rbp)
jmp 0xebb3
movq -0x28(%rbp), %rdi
movq (%rdi), %rax
callq *0xa8(%rax)
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax)
// File: goodix[P]gdix_hid_firmware_update/gtx5/gtx5.cpp
// Function: GTx5Device::Close()
void GTx5Device::Close()
{
	if (!m_deviceOpen)
		return;
	close(m_fd);
	m_fd = -1;
	m_deviceOpen = false;
	delete[] m_inputReport;
	m_inputReport = NULL;
	delete[] m_outputReport;
	m_outputReport = NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x10(%rbp)
testb $0x1, 0x8(%rax)
jne 0xebdc
jmp 0xec3d
movq -0x10(%rbp), %rax
movl 0xc(%rax), %edi
callq 0x5200
movq -0x10(%rbp), %rax
movl $0xffffffff, 0xc(%rax)  # imm = 0xFFFFFFFF
movb $0x0, 0x8(%rax)
movq 0x30(%rax), %rax
movq %rax, -0x18(%rbp)
cmpq $0x0, %rax
je 0xec0e
movq -0x18(%rbp), %rdi
callq 0x5140
movq -0x10(%rbp), %rax
movq $0x0, 0x30(%rax)
movq 0x38(%rax), %rax
movq %rax, -0x20(%rbp)
cmpq $0x0, %rax
je 0xec31
movq -0x20(%rbp), %rdi
callq 0x5140
movq -0x10(%rbp), %rax
movq $0x0, 0x38(%rax)
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)