LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O2/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:
movl 0x30(%rdi), %eax
movl 0x38(%rdi), %ecx
movl %ecx, %edx
negl %edx
cmpl %esi, %eax
jle 0x4210
leal (%rdx,%rax), %r8d
subl %ecx, %eax
movl %r8d, 0x30(%rdi)
jmp 0x4200
leal (%rcx,%rax), %edx
addl 0x34(%rdi), %eax
cmpl %esi, %eax
jg 0x4223
movl %edx, 0x30(%rdi)
addl %ecx, %eax
addl %ecx, %edx
jmp 0x4216
retq
// File: /workspace/github_cpp_makefile_star2_O2/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
pushq %r14
pushq %rbx
movq %rdi, %rbx
leaq 0x1f82(%rip), %r14      # 0x61b4
xorl %ebp, %ebp
cmpl 0x8(%rbx), %ebp
jge 0x425f
movq %rbx, %rdi
movl %ebp, %esi
xorl %edx, %edx
callq 0x3f68
movl 0x38(%rbx), %edx
imull %ebp, %edx
addl 0x30(%rbx), %edx
movq %rbx, %rdi
movq %r14, %rsi
xorl %eax, %eax
callq 0x3dd6
incl %ebp
jmp 0x4234
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %ebx
movq %rsi, %r14
movq %rdi, %r15
leaq 0x1f30(%rip), %r12      # 0x61ae
pushq $0x20
popq %rbp
xorl %esi, %esi
cmpl 0x8(%r15), %esi
jge 0x42ea
movl 0x40(%r15), %edx
movq %r15, %rdi
movl %esi, 0x4(%rsp)
callq 0x3f68
xorl %r13d, %r13d
movslq 0x38(%r15), %rax
cmpl %ebx, %eax
movl %ebx, %ecx
cmovll %eax, %ecx
movslq %ecx, %rcx
cmpq %rcx, %r13
jge 0x42dd
movzbl (%r14,%r13), %edx
movq %r15, %rdi
movq %r12, %rsi
xorl %eax, %eax
callq 0x3dd6
leal 0x1(%r13), %eax
cltd
idivl 0x2c(%r15)
testl %edx, %edx
jne 0x42d8
movq %r15, %rdi
movl %ebp, %esi
callq 0x3dc2
incq %r13
jmp 0x429c
addq %rax, %r14
subl %eax, %ebx
movl 0x4(%rsp), %esi
incl %esi
jmp 0x4283
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %ebx
movq %rsi, %r14
movq %rdi, %r15
xorl %esi, %esi
pushq $0x2e
popq %r13
cmpl 0x8(%r15), %esi
jge 0x436d
movl 0x48(%r15), %edx
movq %r15, %rdi
movq %rsi, (%rsp)
callq 0x3f68
xorl %r12d, %r12d
movslq 0x38(%r15), %rax
cmpl %ebx, %eax
movl %ebx, %ecx
cmovll %eax, %ecx
movslq %ecx, %rcx
cmpq %rcx, %r12
jge 0x4360
movzbl (%r14,%r12), %ebp
movl %ebp, %edi
callq 0x3430
testl %eax, %eax
cmovel %r13d, %ebp
movq %r15, %rdi
movl %ebp, %esi
callq 0x3dc2
incq %r12
jmp 0x432c
addq %rax, %r14
subl %eax, %ebx
movq (%rsp), %rsi
incl %esi
jmp 0x4313
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/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 %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x8(%rdi), %rax
movq 0x20(%rax), %rdi
movq (%rdi), %rax
leaq 0x180b(%rip), %rsi      # 0x62ca
callq *0x20(%rax)
movq 0x8(%rbx), %rax
movq 0x18(%rax), %rdi
callq 0x3f72
leaq 0x4(%rsp), %r14
movq 0x8(%rbx), %rax
movq 0x18(%rax), %rdi
movq %r14, %rsi
callq 0x3e76
testb %al, %al
je 0x4b1e
movq 0x8(%rbx), %rax
movq 0x10(%rax), %rdi
movzbl 0x4(%rsp), %esi
callq 0x3a9e
jmp 0x4ad4
movq %rax, %r14
cmpl $0x1, %edx
jne 0x4b3a
movq %r14, %rdi
callq 0x3120
movq 0x8(%rbx), %rax
movq 0x18(%rax), %rdi
callq 0x3f86
callq 0x33f0
movq 0x8(%rbx), %rax
movq 0x30(%rax), %rcx
movq %rcx, 0x28(%rax)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq %rax, %r14
callq 0x33f0
movq %r14, %rdi
callq 0x3420
movq %rax, %rdi
callq 0x37d6
// File: /workspace/github_cpp_makefile_star2_O2/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 %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x258, %rsp            # imm = 0x258
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x48(%rsp), %r15
movq %r15, %rdi
callq 0x3310
leaq 0x18(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
pushq $0x8
popq %rdx
movq %r15, %rdi
movq %r14, %rsi
callq 0x3200
movq 0x48(%rsp), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x68(%rsp,%rax)
jne 0x4e2d
leaq 0x48(%rsp), %r14
leaq 0x8(%rsp), %r15
leaq 0x28(%rsp), %r12
movl 0x68(%rsp,%rax), %eax
testb $0x2, %al
jne 0x4e15
testb $0x5, %al
jne 0x4e23
movq %r14, %rdi
movq %r15, %rsi
callq 0x3070
cmpq $0x0, 0x10(%rsp)
je 0x4e0a
movq %r12, %rdi
movq %r15, %rsi
callq 0x3360
movq %rbx, %rdi
movq %r12, %rsi
callq 0x4e84
movq %r12, %rdi
callq 0x3140
movq 0x48(%rsp), %rax
movq -0x18(%rax), %rax
jmp 0x4dcd
movb $0x1, %bl
leaq 0x48(%rsp), %rdi
callq 0x3040
jmp 0x4e2f
leaq 0x48(%rsp), %rdi
callq 0x3040
xorl %ebx, %ebx
leaq 0x8(%rsp), %rdi
callq 0x3140
leaq 0x48(%rsp), %rdi
callq 0x3090
movl %ebx, %eax
addq $0x258, %rsp            # imm = 0x258
popq %rbx
popq %r12
popq %r14
popq %r15
retq
jmp 0x4e65
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x3140
jmp 0x4e68
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x3140
leaq 0x48(%rsp), %rdi
callq 0x3090
movq %rbx, %rdi
callq 0x3420
// File: /workspace/github_cpp_makefile_star2_O2/jakubsvehla[P]hex/src/config.cpp
// Function: Config::ParseOption(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void Config::ParseOption (string line)
{
  string tokens[TOKEN_NUM];
  bool   boolean;

  Tokenize(line, tokens);

  boolean = true;
  if (tokens[0].find("no") == 0) {
    boolean = false;
    tokens[0] = tokens[0].substr(2);
  }

  if (tokens[0].compare("ascii") == 0) {
    m_ShowASCII = boolean;
  }
  if (tokens[0].compare("number") == 0) {
    m_Number = boolean;
  }
  if (tokens[0].compare("group") == 0) {
    if (!boolean) ; // FIXME: raise an exception

    m_Group = atoi(tokens[1].c_str());
  }

  // ...

}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x80, %rsp
movq %rdi, %rbx
pushq $0x10
popq %rax
leaq (%rsp,%rax), %rcx
movq %rcx, -0x10(%rcx)
andq $0x0, -0x8(%rcx)
movb $0x0, (%rcx)
addq $0x20, %rax
cmpq $0x50, %rax
jne 0x4e96
leaq 0x40(%rsp), %rdi
callq 0x3360
leaq 0x40(%rsp), %rsi
movq %rsp, %rdx
callq 0x4fbe
leaq 0x40(%rsp), %rdi
callq 0x3140
leaq 0x1434(%rip), %rsi      # 0x630c
movq %rsp, %rdi
xorl %edx, %edx
callq 0x3470
movq %rax, %r14
testq %rax, %rax
jne 0x4f15
leaq 0x60(%rsp), %rdi
movq %rsp, %rsi
pushq $0x2
popq %rdx
pushq $-0x1
popq %rcx
callq 0x3270
movq %rsp, %rdi
leaq 0x60(%rsp), %r15
movq %r15, %rsi
callq 0x3330
movq %r15, %rdi
callq 0x3140
leaq 0x13f3(%rip), %rsi      # 0x630f
movq %rsp, %rdi
callq 0x30c0
testl %eax, %eax
jne 0x4f2f
testq %r14, %r14
setne 0x1(%rbx)
leaq 0x13df(%rip), %rsi      # 0x6315
movq %rsp, %rdi
callq 0x30c0
testl %eax, %eax
jne 0x4f48
testq %r14, %r14
setne (%rbx)
leaq 0x13cd(%rip), %rsi      # 0x631c
movq %rsp, %rdi
callq 0x30c0
testl %eax, %eax
jne 0x4f68
movq 0x20(%rsp), %rdi
callq 0x33b0
movl %eax, 0x4(%rbx)
pushq $0x20
popq %rbx
leaq (%rsp,%rbx), %rdi
callq 0x3140
addq $-0x20, %rbx
cmpq $-0x20, %rbx
jne 0x4f6b
addq $0x80, %rsp
popq %rbx
popq %r14
popq %r15
retq
jmp 0x4f9c
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0x3140
jmp 0x4f9f
movq %rax, %rbx
pushq $0x20
popq %r14
leaq (%rsp,%r14), %rdi
callq 0x3140
addq $-0x20, %r14
cmpq $-0x20, %r14
jne 0x4fa3
movq %rbx, %rdi
callq 0x3420
// File: /workspace/github_cpp_makefile_star2_O2/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 %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r15
movq 0x8(%rsi), %rdi
incq %rdi
callq 0x3030
movq %rax, %r14
movq (%r15), %rsi
movq %rax, %rdi
callq 0x3210
leaq 0x11c5(%rip), %r15      # 0x61b2
movq %r14, %rdi
movq %r15, %rsi
callq 0x33c0
xorl %r12d, %r12d
cmpq $0x40, %r12
je 0x5022
testq %rax, %rax
je 0x5012
leaq (%rbx,%r12), %rdi
movq %rax, %rsi
callq 0x3460
xorl %edi, %edi
movq %r15, %rsi
callq 0x33c0
addq $0x20, %r12
jmp 0x4ffb
movq %r14, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x3350
// File: /workspace/github_cpp_makefile_star2_O2/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 %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x1aaad(%rip), %r14     # 0x20291
movb (%r14), %al
cmpb $0x1, %al
jne 0x5815
movq 0x1a7c6(%rip), %rax     # 0x1ffb8
movq (%rax), %rdi
leaq 0xf808(%rip), %rsi      # 0x15004
leaq 0xfa3f(%rip), %rdx      # 0x15242
movl $0xe4, %ecx
movq %rdx, %r8
xorl %eax, %eax
callq 0x5180
movb (%r14), %al
movb $0x0, 0x19(%rbx)
testb $0x1, %al
je 0x5844
movq 0x1a794(%rip), %rax     # 0x1ffb8
movq (%rax), %rdi
leaq 0xfa1c(%rip), %rsi      # 0x1524a
leaq 0xfa0d(%rip), %rdx      # 0x15242
movl $0xe6, %ecx
movq %rdx, %r8
xorl %eax, %eax
callq 0x5180
pushq $-0x1
popq %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/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 %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x1aa33(%rip), %r14     # 0x20291
movb (%r14), %al
cmpb $0x1, %al
jne 0x588f
movq 0x1a74c(%rip), %rax     # 0x1ffb8
movq (%rax), %rdi
leaq 0xf78e(%rip), %rsi      # 0x15004
leaq 0xf9f5(%rip), %rdx      # 0x15272
movl $0xeb, %ecx
movq %rdx, %r8
xorl %eax, %eax
callq 0x5180
movb (%r14), %al
andq $0x0, 0x24(%rbx)
testb $0x1, %al
je 0x58bf
movq 0x1a719(%rip), %rax     # 0x1ffb8
movq (%rax), %rdi
leaq 0xf9a1(%rip), %rsi      # 0x1524a
leaq 0xf9c2(%rip), %rdx      # 0x15272
movl $0xee, %ecx
movq %rdx, %r8
xorl %eax, %eax
callq 0x5180
pushq $-0x1
popq %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/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:
cmpb $0x1, 0x8(%rdi)
jne 0x593e
pushq %rbx
movq %rdi, %rbx
movb $0x0, 0x8(%rdi)
movq 0x30(%rdi), %rdi
testq %rdi, %rdi
je 0x593d
callq 0x5130
andq $0x0, 0x30(%rbx)
popq %rbx
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/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 %r15
pushq %r14
pushq %rbx
movb $0x0, 0x18(%rdi)
movq %rsi, 0x8(%rdi)
movq %rdx, 0x10(%rdi)
pushq $-0x1
popq %rbx
testq %rsi, %rsi
je 0x5a10
movq %rdx, %r15
movq %rdi, %r14
movq (%rsi), %rax
movq %rsi, %rdi
callq *0x18(%rax)
testq %r15, %r15
je 0x5a10
testb %al, %al
je 0x5a10
movq (%r15), %rax
movq %r15, %rdi
callq *0x90(%rax)
testb %al, %al
je 0x5a10
movb $0x1, 0x18(%r14)
xorl %ebx, %ebx
movl %ebx, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movslq %edx, %r15
leaq -0x2(%r15), %r14
xorl %eax, %eax
testl %r14d, %r14d
movl $0x0, %ecx
cmovgl %r14d, %ecx
xorl %ebp, %ebp
cmpq %rax, %rcx
je 0x6bc1
movzbl (%rbx,%rax), %esi
addl %esi, %ebp
incq %rax
jmp 0x6bb1
leaq 0x196c9(%rip), %rax     # 0x20291
cmpb $0x0, (%rax)
je 0x6c09
movq 0x193e4(%rip), %rax     # 0x1ffb8
movq (%rax), %rdi
movzwl %bp, %r8d
movzbl (%rbx,%r14), %eax
shll $0x8, %eax
movslq %edx, %r15
movzbl -0x1(%rbx,%r15), %r9d
orl %eax, %r9d
leaq 0xeff4(%rip), %rsi      # 0x15bea
leaq 0xf023(%rip), %rdx      # 0x15c20
pushq $0x23
popq %rcx
xorl %eax, %eax
callq 0x5180
jmp 0x6c0c
movslq %r14d, %r14
movzbl (%rbx,%r14), %eax
shll $0x8, %eax
movzbl -0x1(%rbx,%r15), %ecx
orl %eax, %ecx
subl %ecx, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/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 %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x19019(%rip), %r14     # 0x20291
cmpb $0x1, (%r14)
jne 0x72a0
movq 0x18d33(%rip), %rax     # 0x1ffb8
movq (%rax), %rdi
leaq 0xec60(%rip), %rsi      # 0x15eef
leaq 0xdfac(%rip), %rdx      # 0x15242
pushq $0x20
popq %rcx
xorl %eax, %eax
callq 0x5180
cmpq $0x0, 0x30(%rbx)
je 0x72d8
xorl %eax, %eax
xorl %ecx, %ecx
movslq %ecx, %rdx
cmpq $0x8, %rax
je 0x72cf
movq 0x30(%rbx), %rsi
movb 0xf(%rsi,%rax), %sil
testb %sil, %sil
je 0x72ca
leal 0x1(%rdx), %ecx
movb %sil, 0x19(%rbx,%rdx)
incq %rax
jmp 0x72ab
movb $0x0, 0x19(%rbx,%rdx)
xorl %ebx, %ebx
jmp 0x72db
pushq $-0x1
popq %rbx
cmpb $0x1, (%r14)
jne 0x7303
movq 0x18cd0(%rip), %rax     # 0x1ffb8
movq (%rax), %rdi
leaq 0xec31(%rip), %rsi      # 0x15f23
leaq 0xdf49(%rip), %rdx      # 0x15242
pushq $0x2f
popq %rcx
xorl %eax, %eax
callq 0x5180
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/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 %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x18f75(%rip), %r14     # 0x20291
movb (%r14), %al
cmpb $0x1, %al
jne 0x7348
movq 0x18c8e(%rip), %rax     # 0x1ffb8
movq (%rax), %rdi
leaq 0xec24(%rip), %rsi      # 0x15f58
leaq 0xdf37(%rip), %rdx      # 0x15272
pushq $0x35
popq %rcx
xorl %eax, %eax
callq 0x5180
movb (%r14), %al
movq 0x30(%rbx), %rcx
testq %rcx, %rcx
je 0x73b4
movzbl 0x18(%rcx), %edx
movl %edx, 0x24(%rbx)
movzbl 0x19(%rcx), %edx
shll $0x10, %edx
movzbl 0x1a(%rcx), %esi
shll $0x8, %esi
orl %edx, %esi
movl %esi, 0x28(%rbx)
xorl %ebx, %ebx
testb $0x1, %al
je 0x73b7
movq 0x18c40(%rip), %rax     # 0x1ffb8
movq (%rax), %rdi
movzbl 0x17(%rcx), %r8d
movzbl 0x18(%rcx), %r9d
movzbl 0x19(%rcx), %r10d
movzbl 0x1a(%rcx), %r11d
leaq 0xebf5(%rip), %rsi      # 0x15f8b
leaq 0xded5(%rip), %rdx      # 0x15272
xorl %ebx, %ebx
pushq $0x46
popq %rcx
xorl %eax, %eax
pushq %r11
pushq %r10
callq 0x5180
popq %rcx
popq %rdx
movb (%r14), %al
jmp 0x73b7
pushq $-0x1
popq %rbx
testb $0x1, %al
je 0x73e0
movq 0x18bf6(%rip), %rax     # 0x1ffb8
movq (%rax), %rdi
leaq 0xebf5(%rip), %rsi      # 0x15fc1
leaq 0xde9f(%rip), %rdx      # 0x15272
pushq $0x49
popq %rcx
movl %ebx, %r8d
xorl %eax, %eax
callq 0x5180
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/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
pushq %r14
pushq %rbx
subq $0x20, %rsp
movq %rdi, %r14
movb $0x0, 0x1c(%rsp)
andl $0x0, 0x10(%rsp)
andq $0x0, 0x8(%rsp)
movq (%rdi), %rax
leaq 0x7(%rsp), %rdx
pushq $0x1
popq %rcx
movl $0x8050, %esi           # imm = 0x8050
callq *0x20(%rax)
testl %eax, %eax
js 0x8fc4
movq (%r14), %rax
leaq 0x8(%rsp), %rdx
pushq $0xc
popq %rcx
movq %r14, %rdi
movl $0x8140, %esi           # imm = 0x8140
callq *0x20(%rax)
testl %eax, %eax
js 0x8fee
movl 0x8(%rsp), %eax
leaq 0x18(%rsp), %rdx
movl %eax, (%rdx)
movzbl 0x12(%rsp), %ebp
andl $0xf, %ebp
movq 0x17032(%rip), %r14     # 0x1ffb8
movq (%r14), %rdi
leaq 0xee29(%rip), %rsi      # 0x17db9
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x5180
movq (%r14), %rdi
leaq 0xee59(%rip), %rsi      # 0x17dfc
movl %ebp, %edx
xorl %eax, %eax
callq 0x5180
movq (%r14), %rdi
movzbl 0x7(%rsp), %edx
leaq 0xdb72(%rip), %rsi      # 0x16b2d
xorl %eax, %eax
callq 0x5180
jmp 0x8ffc
movl %eax, %ebx
leaq 0x172c4(%rip), %rax     # 0x20291
cmpb $0x1, (%rax)
jne 0x8ffc
movq 0x16fff(%rip), %rax     # 0x1ffd8
movq (%rax), %rdi
leaq 0xdb5a(%rip), %rsi      # 0x16b3d
leaq 0xdb7d(%rip), %rdx      # 0x16b67
pushq $0x66
jmp 0x9021
movl %eax, %ebx
leaq 0x1729a(%rip), %rax     # 0x20291
cmpb $0x1, (%rax)
je 0x9007
movl %ebx, %eax
addq $0x20, %rsp
popq %rbx
popq %r14
popq %rbp
retq
movq 0x16fca(%rip), %rax     # 0x1ffd8
movq (%rax), %rdi
leaq 0xdb5d(%rip), %rsi      # 0x16b75
leaq 0xdb48(%rip), %rdx      # 0x16b67
pushq $0x6b
popq %rcx
xorl %eax, %eax
callq 0x5180
jmp 0x8ffc
nop
// File: /workspace/github_cpp_makefile_star2_O2/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 %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x171fd(%rip), %r14     # 0x20291
cmpb $0x1, (%r14)
jne 0x90bf
movq 0x16f17(%rip), %rax     # 0x1ffb8
movq (%rax), %rdi
leaq 0xdafd(%rip), %rsi      # 0x16ba8
leaq 0xc190(%rip), %rdx      # 0x15242
pushq $0x21
popq %rcx
movq %rdx, %r8
xorl %eax, %eax
callq 0x5180
cmpq $0x0, 0x30(%rbx)
je 0x90f7
xorl %ecx, %ecx
pushq $-0x6
popq %rax
movslq %ecx, %rdx
testq %rax, %rax
je 0x90ee
movq 0x30(%rbx), %rsi
movb 0x15(%rsi,%rax), %sil
testb %sil, %sil
je 0x90e9
leal 0x1(%rdx), %ecx
movb %sil, 0x19(%rbx,%rdx)
incq %rax
jmp 0x90cb
movb $0x0, 0x19(%rbx,%rdx)
xorl %ebx, %ebx
jmp 0x90fa
pushq $-0x1
popq %rbx
cmpb $0x1, (%r14)
jne 0x9128
movq 0x16eb1(%rip), %rax     # 0x1ffb8
movq (%rax), %rdi
leaq 0xdac2(%rip), %rsi      # 0x16bd3
leaq 0xc12a(%rip), %rdx      # 0x15242
pushq $0x30
popq %rcx
movq %rdx, %r8
movl %ebx, %r9d
xorl %eax, %eax
callq 0x5180
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/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 %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x17151(%rip), %r14     # 0x20291
movb (%r14), %al
cmpb $0x1, %al
jne 0x916f
movq 0x16e6a(%rip), %rax     # 0x1ffb8
movq (%rax), %rdi
leaq 0xda50(%rip), %rsi      # 0x16ba8
leaq 0xc113(%rip), %rdx      # 0x15272
pushq $0x36
popq %rcx
movq %rdx, %r8
xorl %eax, %eax
callq 0x5180
movb (%r14), %al
movq 0x30(%rbx), %rcx
testq %rcx, %rcx
je 0x91d5
andl $0x0, 0x24(%rbx)
movzbl 0x15(%rcx), %edx
shll $0x10, %edx
movzbl 0x16(%rcx), %esi
shll $0x8, %esi
orl %edx, %esi
movzbl 0x17(%rcx), %edx
orl %esi, %edx
movl %edx, 0x28(%rbx)
xorl %ebx, %ebx
testb $0x1, %al
je 0x91d8
movq 0x16e16(%rip), %rax     # 0x1ffb8
movq (%rax), %rdi
movzbl 0x15(%rcx), %r8d
movzbl 0x16(%rcx), %r9d
movzbl 0x17(%rcx), %eax
movl %eax, (%rsp)
leaq 0xda4f(%rip), %rsi      # 0x16c0c
leaq 0xc0ae(%rip), %rdx      # 0x15272
xorl %ebx, %ebx
pushq $0x44
popq %rcx
xorl %eax, %eax
callq 0x5180
movb (%r14), %al
jmp 0x91d8
pushq $-0x1
popq %rbx
testb $0x1, %al
je 0x9204
movq 0x16dd5(%rip), %rax     # 0x1ffb8
movq (%rax), %rdi
leaq 0xd9e6(%rip), %rsi      # 0x16bd3
leaq 0xc07e(%rip), %rdx      # 0x15272
pushq $0x47
popq %rcx
movq %rdx, %r8
movl %ebx, %r9d
xorl %eax, %eax
callq 0x5180
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/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 %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x15d61(%rip), %r14     # 0x20291
cmpb $0x1, (%r14)
jne 0xa558
movq 0x15a7b(%rip), %rax     # 0x1ffb8
movq (%rax), %rdi
leaq 0xca2d(%rip), %rsi      # 0x16f74
leaq 0xacf4(%rip), %rdx      # 0x15242
pushq $0x20
popq %rcx
xorl %eax, %eax
callq 0x5180
cmpq $0x0, 0x30(%rbx)
je 0xa590
xorl %eax, %eax
xorl %ecx, %ecx
movslq %ecx, %rdx
cmpq $0x8, %rax
je 0xa587
movq 0x30(%rbx), %rsi
movb 0xf(%rsi,%rax), %sil
testb %sil, %sil
je 0xa582
leal 0x1(%rdx), %ecx
movb %sil, 0x19(%rbx,%rdx)
incq %rax
jmp 0xa563
movb $0x0, 0x19(%rbx,%rdx)
xorl %ebx, %ebx
jmp 0xa593
pushq $-0x1
popq %rbx
cmpb $0x1, (%r14)
jne 0xa5bb
movq 0x15a18(%rip), %rax     # 0x1ffb8
movq (%rax), %rdi
leaq 0xc9fb(%rip), %rsi      # 0x16fa5
leaq 0xac91(%rip), %rdx      # 0x15242
pushq $0x2f
popq %rcx
xorl %eax, %eax
callq 0x5180
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/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 %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x15cbd(%rip), %r14     # 0x20291
movb (%r14), %al
cmpb $0x1, %al
jne 0xa600
movq 0x159d6(%rip), %rax     # 0x1ffb8
movq (%rax), %rdi
leaq 0xc9eb(%rip), %rsi      # 0x16fd7
leaq 0xac7f(%rip), %rdx      # 0x15272
pushq $0x35
popq %rcx
xorl %eax, %eax
callq 0x5180
movb (%r14), %al
movq 0x30(%rbx), %rcx
testq %rcx, %rcx
je 0xa66c
movzbl 0x18(%rcx), %edx
movl %edx, 0x24(%rbx)
movzbl 0x19(%rcx), %edx
shll $0x10, %edx
movzbl 0x1a(%rcx), %esi
shll $0x8, %esi
orl %edx, %esi
movl %esi, 0x28(%rbx)
xorl %ebx, %ebx
testb $0x1, %al
je 0xa66f
movq 0x15988(%rip), %rax     # 0x1ffb8
movq (%rax), %rdi
movzbl 0x17(%rcx), %r8d
movzbl 0x18(%rcx), %r9d
movzbl 0x19(%rcx), %r10d
movzbl 0x1a(%rcx), %r11d
leaq 0xb93d(%rip), %rsi      # 0x15f8b
leaq 0xac1d(%rip), %rdx      # 0x15272
xorl %ebx, %ebx
pushq $0x46
popq %rcx
xorl %eax, %eax
pushq %r11
pushq %r10
callq 0x5180
popq %rcx
popq %rdx
movb (%r14), %al
jmp 0xa66f
pushq $-0x1
popq %rbx
testb $0x1, %al
je 0xa698
movq 0x1593e(%rip), %rax     # 0x1ffb8
movq (%rax), %rdi
leaq 0xc983(%rip), %rsi      # 0x17007
leaq 0xabe7(%rip), %rdx      # 0x15272
pushq $0x49
popq %rcx
movl %ebx, %r8d
xorl %eax, %eax
callq 0x5180
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/goodix[P]gdix_hid_firmware_update/gtx3/gtx3_update.cpp
// Function: need_upgrade_hid_subsystem(GTmodel*, FirmwareImage*)
bool need_upgrade_hid_subsystem(GTmodel *dev, FirmwareImage *fw_img)
{
	int dev_fw_ver = 0;
	int img_fw_ver = 0;
	int boundary_fw_ver =
		(HID_FORCE_UPDATE_VER_MAJOR << 16) | HID_FORCE_UPDATE_VER_MINOR;

	if (fw_img->GetUpdateFlag() & NEED_UPDATE_HID_SUBSYSTEM) {
		gdix_dbg("get hid subsystem update flag from fw_img file:0x%x\n",
				 fw_img->GetUpdateFlag());
		return true;
	}
	/* ignore the config_id byte */
	dev_fw_ver = (dev->GetFirmwareVersionMajor() << 16) |
				 ((dev->GetFirmwareVersionMinor() >> 8) & 0xFFFF);
	img_fw_ver = (fw_img->GetFirmwareVersionMajor() << 16) |
				 ((fw_img->GetFirmwareVersionMinor() >> 8) & 0xFFFF);

	gdix_dbg("boundery_ver 0x%x, dev_ver 0x%x, fw_ver 0x%x\n", boundary_fw_ver,
			 dev_fw_ver, img_fw_ver);
	if (dev_fw_ver < boundary_fw_ver || img_fw_ver < boundary_fw_ver) {
		gdix_dbg("hid subsystem need update judged by fw_ver\n");
		return true;
	}

	return false;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movq (%rsi), %rax
movq %rsi, %rdi
callq *0xa8(%rax)
testb %al, %al
js 0xaa4a
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x60(%rax)
movl %eax, %ebp
shll $0x10, %ebp
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x68(%rax)
movl %eax, %ebx
shrl $0x8, %ebx
movl $0xffff, %r12d          # imm = 0xFFFF
andl %r12d, %ebx
orl %ebp, %ebx
movq (%r14), %rax
movq %r14, %rdi
callq *0x28(%rax)
movl %eax, %r15d
shll $0x10, %r15d
movq (%r14), %rax
movq %r14, %rdi
callq *0x30(%rax)
movl %eax, %ebp
shrl $0x8, %ebp
andl %r12d, %ebp
orl %r15d, %ebp
leaq 0x15891(%rip), %r14     # 0x20291
cmpb $0x1, (%r14)
jne 0xaa36
movq 0x155ab(%rip), %rax     # 0x1ffb8
movq (%rax), %rdi
movl %ebp, (%rsp)
leaq 0xc6cd(%rip), %rsi      # 0x170e7
leaq 0xc6ab(%rip), %rdx      # 0x170cc
movl $0x91, %ecx
movl $0x117, %r8d            # imm = 0x117
movl %ebx, %r9d
xorl %eax, %eax
callq 0x5180
cmpl $0x117, %ebx            # imm = 0x117
jl 0xaa90
cmpl $0x116, %ebp            # imm = 0x116
jle 0xaa90
xorl %ebx, %ebx
jmp 0xaabc
leaq 0x15840(%rip), %rax     # 0x20291
movb $0x1, %bl
cmpb $0x1, (%rax)
jne 0xaabc
movq 0x15559(%rip), %rax     # 0x1ffb8
movq (%rax), %r15
movq (%r14), %rax
movq %r14, %rdi
callq *0xa8(%rax)
leaq 0xc611(%rip), %rsi      # 0x17086
leaq 0xc650(%rip), %rdx      # 0x170cc
movq %r15, %rdi
movl $0x87, %ecx
movl %eax, %r8d
xorl %eax, %eax
callq 0x5180
jmp 0xaabc
movb $0x1, %bl
cmpb $0x1, (%r14)
jne 0xaabc
movq 0x15519(%rip), %rax     # 0x1ffb8
movq (%rax), %rdi
leaq 0xc67d(%rip), %rsi      # 0x17126
leaq 0xc61c(%rip), %rdx      # 0x170cc
movl $0x93, %ecx
xorl %eax, %eax
callq 0x5180
movl %ebx, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/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:
leaq 0x13981(%rip), %rax     # 0x1f4c0
movq %rax, (%rdi)
andl $0x0, 0x14(%rdi)
xorps %xmm0, %xmm0
movups %xmm0, 0x28(%rdi)
andq $0x0, 0x38(%rdi)
movq $0x10, 0x18(%rdi)
andl $0x0, 0x1f(%rdi)
movl $0x1, 0x24(%rdi)
xorl %eax, %eax
movb %al, 0x8(%rdi)
movb %al, 0x40(%rdi)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movq %rax, 0xc(%rdi)
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %ecx, %ebp
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
movq (%rdi), %rax
callq *0x10(%rax)
testl %eax, %eax
je 0xbbca
leaq 0x146f6(%rip), %rax     # 0x20291
pushq $-0x1
popq %rbx
cmpb $0x1, (%rax)
jne 0xbbfc
movq 0x1440e(%rip), %rax     # 0x1ffb8
movq (%rax), %rdi
leaq 0xb78c(%rip), %rsi      # 0x17340
leaq 0xb7ad(%rip), %rdx      # 0x17368
pushq $0x3a
popq %rcx
movq %r15, %r8
xorl %eax, %eax
callq 0x5180
jmp 0xbbfc
movslq %ebp, %r15
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x60(%rax)
movl %eax, %ebp
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x68(%rax)
leaq 0xb791(%rip), %rdx      # 0x17379
xorl %ebx, %ebx
movq %r14, %rdi
movq %r15, %rsi
movl %ebp, %ecx
movl %eax, %r8d
xorl %eax, %eax
callq 0x51c0
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/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
pushq %r14
pushq %rbx
testq %rsi, %rsi
je 0xbc9c
movq %rdi, %rbx
pushq $0x2
popq %rax
movq %rsi, %rdi
movl %eax, %esi
xorl %eax, %eax
callq 0x51e0
movl %eax, 0xc(%rbx)
testl %eax, %eax
js 0xbca0
movb $0x1, 0x8(%rbx)
movabsq $0x4100000041, %rax     # imm = 0x4100000041
movq %rax, 0x28(%rbx)
pushq $0x41
popq %r14
movq %r14, %rdi
callq 0x5030
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movups %xmm0, 0x10(%rax)
movups %xmm0, 0x20(%rax)
movups %xmm0, 0x30(%rax)
xorl %ebp, %ebp
movb %bpl, 0x40(%rax)
movq %rax, 0x30(%rbx)
movq %r14, %rdi
callq 0x5030
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movups %xmm0, 0x10(%rax)
movups %xmm0, 0x20(%rax)
movups %xmm0, 0x30(%rax)
movb %bpl, 0x40(%rax)
movq %rax, 0x38(%rbx)
movq (%rbx), %rax
movq %rbx, %rdi
popq %rbx
popq %r14
popq %rbp
jmpq *0xa0(%rax)
pushq $-0x16
jmp 0xbca2
pushq $-0x1
popq %rax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/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:
cmpb $0x1, 0x8(%rdi)
jne 0xbce9
pushq %rbx
movq %rdi, %rbx
movl 0xc(%rdi), %edi
callq 0x5210
orl $-0x1, 0xc(%rbx)
movb $0x0, 0x8(%rbx)
movq 0x30(%rbx), %rdi
testq %rdi, %rdi
je 0xbcd0
callq 0x5130
andq $0x0, 0x30(%rbx)
movq 0x38(%rbx), %rdi
testq %rdi, %rdi
je 0xbce3
callq 0x5130
andq $0x0, 0x38(%rbx)
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/goodix[P]gdix_hid_firmware_update/gtx5/gtx5.cpp
// Function: GTx5Device::GetReport(unsigned char, unsigned char*)
int GTx5Device::GetReport(unsigned char reportId, unsigned char *buf)
{
	int ret;
	unsigned char rcv_buf[66] = {0};
	if (!m_deviceOpen)
		return -1;

	rcv_buf[0] = reportId;
	ret = ioctl(m_fd, HIDIOCGFEATURE(m_inputReportSize), rcv_buf);
	if (ret < 0) {
		gdix_dbg("failed get feature retry, ret=%d\n", ret);
		return ret;
	} else {
		if (rcv_buf[0] == reportId) {
			memcpy(buf, rcv_buf, 65);
			return 0;
		} else {
			gdix_dbg("Get Wrong reportId:id=0x%x\n", rcv_buf[0]);
			return -1;
		}
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x48, %rsp
xorps %xmm0, %xmm0
movaps %xmm0, 0x30(%rsp)
movaps %xmm0, 0x20(%rsp)
movaps %xmm0, 0x10(%rsp)
andw $0x0, 0x40(%rsp)
movaps %xmm0, (%rsp)
pushq $-0x1
popq %r15
cmpb $0x1, 0x8(%rdi)
jne 0xbdc5
movq %rdx, %rbx
movl %esi, %r14d
movq %rsp, %rdx
movb %r14b, (%rdx)
movl 0xc(%rdi), %eax
movl 0x28(%rdi), %esi
shll $0x10, %esi
orl $0xc0004807, %esi       # imm = 0xC0004807
movl %eax, %edi
xorl %eax, %eax
callq 0x5160
testl %eax, %eax
js 0xbd62
movzbl (%rsp), %r8d
cmpb %r14b, %r8b
jne 0xbd97
movq %rsp, %rsi
pushq $0x41
popq %rdx
movq %rbx, %rdi
callq 0x5090
xorl %ebp, %ebp
jmp 0xbdc8
movl %eax, %ebp
leaq 0x14526(%rip), %rax     # 0x20291
cmpb $0x1, (%rax)
jne 0xbdc8
movq 0x14241(%rip), %rax     # 0x1ffb8
movq (%rax), %rdi
leaq 0xb5fe(%rip), %rsi      # 0x1737f
leaq 0xb62a(%rip), %rdx      # 0x173b2
pushq $0x78
popq %rcx
movl %ebp, %r8d
xorl %eax, %eax
callq 0x5180
jmp 0xbdc8
leaq 0x144f3(%rip), %rax     # 0x20291
cmpb $0x1, (%rax)
jne 0xbdc5
movq 0x1420e(%rip), %rax     # 0x1ffb8
movq (%rax), %rdi
leaq 0xb608(%rip), %rsi      # 0x173bc
leaq 0xb5f7(%rip), %rdx      # 0x173b2
pushq $0x7f
popq %rcx
xorl %eax, %eax
callq 0x5180
movl %r15d, %ebp
movl %ebp, %eax
addq $0x48, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/goodix[P]gdix_hid_firmware_update/gtx5/gtx5.cpp
// Function: GTx5Device::Read(unsigned int, unsigned char*, unsigned int)
int GTx5Device::Read(unsigned int addr, unsigned char *buf, unsigned int len)
{
	int ret = 0;
	int i = 0;
	unsigned short tmp_addr;
	int pkg_size = m_inputReportSize - 10;
	int pkg_num;
	int read_len;
	int code_len = len;

	pkg_num = code_len / pkg_size + 1;
	tmp_addr = addr;
	read_len = pkg_size;
	for (i = 0; i < pkg_num; i++) {
		if (read_len > code_len)
			read_len = code_len;
		/*read data*/
		ret = ReadPkg(tmp_addr, &buf[tmp_addr - addr], read_len);
		if (ret < 0)
			return ret;
		tmp_addr += read_len;
		code_len -= read_len;
		if (code_len <= 0)
			break;
	}
	return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %ecx, %ebx
movq %rdx, 0x10(%rsp)
movl %esi, %ebp
movq %rdi, 0x8(%rsp)
movl 0x28(%rdi), %r12d
addl $-0xa, %r12d
movl %ecx, %eax
cltd
idivl %r12d
movl %eax, %r13d
xorl %r14d, %r14d
movl %esi, %r15d
xorl %eax, %eax
cmpl %r13d, %r14d
jg 0xc0e2
cmpl %ebx, %r12d
cmovgel %ebx, %r12d
movzwl %bp, %ebp
movl %ebp, %edx
subl %r15d, %edx
addq 0x10(%rsp), %rdx
movq 0x8(%rsp), %rdi
movl %ebp, %esi
movl %r12d, %ecx
callq 0xbdd6
testl %eax, %eax
js 0xc0e2
subl %r12d, %ebx
jle 0xc0e2
addl %r12d, %ebp
incl %r14d
jmp 0xc0a9
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/goodix[P]gdix_hid_firmware_update/gtx5/gtx5.cpp
// Function: GTx5Device::Write(unsigned char const*, unsigned int)
int GTx5Device::Write(const unsigned char *buf, unsigned int len)
{
	unsigned char temp_buf[65];
	int ret;
	int retry = GDIX_RETRY_TIMES;
	if (!m_deviceOpen)
		return -1;
	if (sizeof(temp_buf) < len)
		return -1;
	memset(temp_buf, 0, sizeof(temp_buf));
	memcpy(&temp_buf[0], buf, len);
	temp_buf[0] = 0x0E;
	gdix_dbg_array(temp_buf, len);
	do {
		ret = ioctl(m_fd, HIDIOCSFEATURE(len), temp_buf);
		if (ret < 0) {
			if (!m_deviceOpen || m_bCancel) {
				gdix_dbg("Operation beCancled or m_fd closed\n");
				break;
			}
			gdix_dbg("failed set feature, retry: ret=%d,retry:%d\n", ret,
					 retry);
			usleep(10000);
		} else {
			break;
		}
	} while (--retry);
	return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
pushq $-0x1
popq %rbp
cmpl $0x41, %edx
ja 0xc2fb
movq %rdi, %r14
cmpb $0x0, 0x8(%rdi)
je 0xc2fb
movl %edx, %ebx
movl %edx, %edx
xorps %xmm0, %xmm0
movq %rsp, %r15
movaps %xmm0, 0x30(%r15)
movaps %xmm0, 0x20(%r15)
movaps %xmm0, 0x10(%r15)
movaps %xmm0, (%r15)
movb $0x0, 0x40(%r15)
movq %r15, %rdi
callq 0x5090
movb $0xe, (%r15)
shll $0x10, %ebx
orl $0xc0004806, %ebx       # imm = 0xC0004806
pushq $0x6
popq %r12
leaq 0x14028(%rip), %r13     # 0x20291
movl 0xc(%r14), %edi
movq %rbx, %rsi
movq %r15, %rdx
xorl %eax, %eax
callq 0x5160
movl %eax, %ebp
testl %eax, %eax
jns 0xc2fb
cmpb $0x1, 0x8(%r14)
jne 0xc2d0
cmpb $0x1, 0x40(%r14)
je 0xc2d0
cmpb $0x1, (%r13)
jne 0xc2bf
movq 0x13d1c(%rip), %rax     # 0x1ffb8
movq (%rax), %rdi
leaq 0xb2bf(%rip), %rsi      # 0x17565
leaq 0xb27d(%rip), %rdx      # 0x1752a
movl $0x12e, %ecx            # imm = 0x12E
movl %ebp, %r8d
movl %r12d, %r9d
xorl %eax, %eax
callq 0x5180
movl $0x2710, %edi           # imm = 0x2710
callq 0x5170
decl %r12d
jne 0xc269
jmp 0xc2fb
cmpb $0x1, (%r13)
jne 0xc2fb
movq 0x13cda(%rip), %rax     # 0x1ffb8
movq (%rax), %rdi
leaq 0xb248(%rip), %rsi      # 0x17530
leaq 0xb23b(%rip), %rdx      # 0x1752a
movl $0x12a, %ecx            # imm = 0x12A
xorl %eax, %eax
callq 0x5180
movl %ebp, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/goodix[P]gdix_hid_firmware_update/gtx5/gtx5.cpp
// Function: GTx5Device::WriteSpeCmd(unsigned char const*, unsigned int)
int GTx5Device::WriteSpeCmd(const unsigned char *buf, unsigned int len)
{
	unsigned char temp_buf[65];
	int ret;
	int retry = GDIX_RETRY_TIMES;
	if (!m_deviceOpen)
		return -1;
	if (sizeof(temp_buf) < len)
		return -1;
	memset(temp_buf, 0, sizeof(temp_buf));
	memcpy(&temp_buf[0], buf, len);
	gdix_dbg_array(temp_buf, len);
	do {
		ret = ioctl(m_fd, HIDIOCSFEATURE(len), temp_buf);
		if (ret < 0) {
			if (!m_deviceOpen || m_bCancel) {
				gdix_dbg("Operation beCancled or m_fd closed\n");
				break;
			}
			gdix_dbg("failed set feature, retry: ret=%d,retry:%d\n", ret,
					 retry);
			usleep(10000);
		} else {
			break;
		}
	} while (--retry);
	return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
pushq $-0x1
popq %rbp
cmpl $0x41, %edx
ja 0xc403
movq %rdi, %r14
cmpb $0x0, 0x8(%rdi)
je 0xc403
movl %edx, %ebx
movl %edx, %edx
xorps %xmm0, %xmm0
movq %rsp, %r15
movaps %xmm0, 0x30(%r15)
movaps %xmm0, 0x20(%r15)
movaps %xmm0, 0x10(%r15)
movaps %xmm0, (%r15)
movb $0x0, 0x40(%r15)
movq %r15, %rdi
callq 0x5090
shll $0x10, %ebx
orl $0xc0004806, %ebx       # imm = 0xC0004806
pushq $0x6
popq %r12
leaq 0x13f20(%rip), %r13     # 0x20291
movl 0xc(%r14), %edi
movq %rbx, %rsi
movq %r15, %rdx
xorl %eax, %eax
callq 0x5160
movl %eax, %ebp
testl %eax, %eax
jns 0xc403
cmpb $0x1, 0x8(%r14)
jne 0xc3d8
cmpb $0x1, 0x40(%r14)
je 0xc3d8
cmpb $0x1, (%r13)
jne 0xc3c7
movq 0x13c14(%rip), %rax     # 0x1ffb8
movq (%rax), %rdi
leaq 0xb1b7(%rip), %rsi      # 0x17565
leaq 0xb1ed(%rip), %rdx      # 0x175a2
movl $0x14f, %ecx            # imm = 0x14F
movl %ebp, %r8d
movl %r12d, %r9d
xorl %eax, %eax
callq 0x5180
movl $0x2710, %edi           # imm = 0x2710
callq 0x5170
decl %r12d
jne 0xc371
jmp 0xc403
cmpb $0x1, (%r13)
jne 0xc403
movq 0x13bd2(%rip), %rax     # 0x1ffb8
movq (%rax), %rdi
leaq 0xb140(%rip), %rsi      # 0x17530
leaq 0xb1ab(%rip), %rdx      # 0x175a2
movl $0x14b, %ecx            # imm = 0x14B
xorl %eax, %eax
callq 0x5180
movl %ebp, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/goodix[P]gdix_hid_firmware_update/gtx5/gtx5.cpp
// Function: GTx5Device::SetBasicProperties()
int GTx5Device::SetBasicProperties()
{
	int ret;
	unsigned char fw_info[12] = {0};
	m_firmwareVersionMajor = 20;
	m_firmwareVersionMinor = 20;
	m_sensorID = 2;
	int retry = 10;
	if (!m_deviceOpen) {
		gdix_err("Please open device first\n");
		return -1;
	}

	do {
		ret = Read(GTX5_VERSION_ADDR, fw_info, sizeof(fw_info));
		if (ret < 0)
			gdix_dbg("Failed read VERSION, retry=%d\n", retry);
		else
			break;
	} while (--retry);
	if (!retry)
		return -1;
	memcpy(m_pid, fw_info, 4);
	m_pid[4] = '\0';
	m_sensorID = fw_info[10] & 0x0F;
	m_firmwareVersionMajor = (fw_info[5] >> 4) * 10 + (fw_info[5] & 0x0F);
	m_firmwareVersionMinor = (fw_info[6] >> 4) * 10 + (fw_info[6] & 0x0F);
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
andl $0x0, 0x10(%rsp)
andq $0x0, 0x8(%rsp)
movabsq $0x1400000014, %rax     # imm = 0x1400000014
movq %rax, 0x10(%rdi)
movl $0x2, 0x18(%rdi)
cmpb $0x1, 0x8(%rdi)
jne 0xc4b5
movq %rdi, %rbx
pushq $0xa
popq %r14
leaq 0x8(%rsp), %r15
pushq $0xc
popq %r12
leaq 0x13e32(%rip), %r13     # 0x20291
leaq 0x97f3(%rip), %rbp      # 0x15c59
movq (%rbx), %rax
movq %rbx, %rdi
movl $0x8240, %esi           # imm = 0x8240
movq %r15, %rdx
movl %r12d, %ecx
callq *0x20(%rax)
testl %eax, %eax
jns 0xc4ea
cmpb $0x1, (%r13)
jne 0xc4a8
movq 0x13b2c(%rip), %rax     # 0x1ffb8
movq (%rax), %rdi
leaq 0x988a(%rip), %rsi      # 0x15d20
movq %rbp, %rdx
movl $0x168, %ecx            # imm = 0x168
movl %r14d, %r8d
xorl %eax, %eax
callq 0x5180
decl %r14d
jne 0xc466
pushq $-0x1
popq %rbx
jmp 0xc539
leaq 0x13dd5(%rip), %rax     # 0x20291
pushq $-0x1
popq %rbx
cmpb $0x1, (%rax)
jne 0xc539
movq 0x13b0d(%rip), %rax     # 0x1ffd8
movq (%rax), %rdi
leaq 0x9759(%rip), %rsi      # 0x15c2e
leaq 0x977d(%rip), %rdx      # 0x15c59
movl $0x161, %ecx            # imm = 0x161
xorl %eax, %eax
callq 0x5180
jmp 0xc539
movl 0x8(%rsp), %eax
movl %eax, 0x1c(%rbx)
movb $0x0, 0x20(%rbx)
movzbl 0x12(%rsp), %eax
andl $0xf, %eax
movl %eax, 0x18(%rbx)
movzwl 0xd(%rsp), %eax
movd %eax, %xmm0
pxor %xmm1, %xmm1
punpcklbw %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1],xmm0[2],xmm1[2],xmm0[3],xmm1[3],xmm0[4],xmm1[4],xmm0[5],xmm1[5],xmm0[6],xmm1[6],xmm0[7],xmm1[7]
movdqa %xmm0, %xmm2
psrlw $0x4, %xmm2
pmullw 0xadfe(%rip), %xmm2     # 0x17320
pand 0xae06(%rip), %xmm0     # 0x17330
paddw %xmm2, %xmm0
punpcklwd %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1],xmm0[2],xmm1[2],xmm0[3],xmm1[3]
movq %xmm0, 0x10(%rbx)
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/goodix[P]gdix_hid_firmware_update/gtx5/gtx5.cpp
// Function: GTx5Device::ChecksumU8(unsigned char*, int)
unsigned char GTx5Device::ChecksumU8(unsigned char *data, int len)
{
	unsigned char chksum = 0;
	int i = 0;
	for (i = 0; i < len; i++)
		chksum += data[i];
	return chksum;
}

// Assembly:
xorl %ecx, %ecx
testl %edx, %edx
cmovlel %ecx, %edx
xorl %eax, %eax
cmpq %rcx, %rdx
je 0xc560
addb (%rsi,%rcx), %al
incq %rcx
jmp 0xc553
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/goodix[P]gdix_hid_firmware_update/gtx5/gtx5_firmware_image.cpp
// Function: GTX5FirmwareImage::InitPid()
int GTX5FirmwareImage::InitPid()
{
	gdix_dbg("GTX5FirmwareImage::InitPid run\n");
	int ret = -1;
	int i = 0;
	int j = 0;

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

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

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x13cc1(%rip), %r14     # 0x20291
cmpb $0x1, (%r14)
jne 0xc5f8
movq 0x139db(%rip), %rax     # 0x1ffb8
movq (%rax), %rdi
leaq 0xafdd(%rip), %rsi      # 0x175c4
leaq 0x8c54(%rip), %rdx      # 0x15242
pushq $0x25
popq %rcx
xorl %eax, %eax
callq 0x5180
cmpq $0x0, 0x30(%rbx)
je 0xc630
xorl %eax, %eax
xorl %ecx, %ecx
movslq %ecx, %rdx
cmpq $0x8, %rax
je 0xc627
movq 0x30(%rbx), %rsi
movb 0xf(%rsi,%rax), %sil
testb %sil, %sil
je 0xc622
leal 0x1(%rdx), %ecx
movb %sil, 0x19(%rbx,%rdx)
incq %rax
jmp 0xc603
movb $0x0, 0x19(%rbx,%rdx)
xorl %ebx, %ebx
jmp 0xc633
pushq $-0x1
popq %rbx
cmpb $0x1, (%r14)
jne 0xc65b
movq 0x13978(%rip), %rax     # 0x1ffb8
movq (%rax), %rdi
leaq 0xafab(%rip), %rsi      # 0x175f5
leaq 0x8bf1(%rip), %rdx      # 0x15242
pushq $0x34
popq %rcx
xorl %eax, %eax
callq 0x5180
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop