LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: 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
movq %rsp, %rbp
subq $0x80, %rsp
movb %sil, %al
movq %rdi, -0x10(%rbp)
movb %al, -0x11(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x78(%rbp)
leaq -0x70(%rbp), %rdi
xorl %esi, %esi
movl $0x42, %edx
callq 0x50a0
movq -0x78(%rbp), %rax
testb $0x1, 0x8(%rax)
jne 0xec97
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xed6e
movq -0x78(%rbp), %rax
movb -0x11(%rbp), %cl
movb %cl, -0x70(%rbp)
movl 0xc(%rax), %edi
movl 0x28(%rax), %eax
shll $0x10, %eax
orl $0xc0004807, %eax       # imm = 0xC0004807
movl %eax, %eax
movl %eax, %esi
leaq -0x70(%rbp), %rdx
movb $0x0, %al
callq 0x5170
movl %eax, -0x24(%rbp)
cmpl $0x0, -0x24(%rbp)
jge 0xed07
jmp 0xecc9
leaq 0x175c9(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0xecfd
movq 0x172dc(%rip), %rax     # 0x25fb8
movq (%rax), %rdi
movl -0x24(%rbp), %r8d
leaq 0xf6d3(%rip), %rsi      # 0x1e3bd
leaq 0xf6ff(%rip), %rdx      # 0x1e3f0
movl $0x78, %ecx
movb $0x0, %al
callq 0x5190
jmp 0xecff
movl -0x24(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0xed6e
movzbl -0x70(%rbp), %eax
movzbl -0x11(%rbp), %ecx
cmpl %ecx, %eax
jne 0xed2e
movq -0x20(%rbp), %rdi
leaq -0x70(%rbp), %rsi
movl $0x41, %edx
callq 0x50b0
movl $0x0, -0x4(%rbp)
jmp 0xed6e
jmp 0xed30
leaq 0x17562(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0xed65
movq 0x17275(%rip), %rax     # 0x25fb8
movq (%rax), %rdi
movzbl -0x70(%rbp), %r8d
leaq 0xf6a8(%rip), %rsi      # 0x1e3fa
leaq 0xf697(%rip), %rdx      # 0x1e3f0
movl $0x7f, %ecx
movb $0x0, %al
callq 0x5190
jmp 0xed67
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl -0x4(%rbp), %eax
addq $0x80, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: 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
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
movl %ecx, -0x24(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x48(%rbp)
movl $0x0, -0x28(%rbp)
movl $0x0, -0x2c(%rbp)
movl 0x28(%rax), %eax
subl $0xa, %eax
movl %eax, -0x34(%rbp)
movl -0x24(%rbp), %eax
movl %eax, -0x40(%rbp)
movl -0x40(%rbp), %eax
cltd
idivl -0x34(%rbp)
addl $0x1, %eax
movl %eax, -0x38(%rbp)
movl -0x14(%rbp), %eax
movw %ax, -0x2e(%rbp)
movl -0x34(%rbp), %eax
movl %eax, -0x3c(%rbp)
movl $0x0, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
cmpl -0x38(%rbp), %eax
jge 0xf170
movl -0x3c(%rbp), %eax
cmpl -0x40(%rbp), %eax
jle 0xf112
movl -0x40(%rbp), %eax
movl %eax, -0x3c(%rbp)
movq -0x48(%rbp), %rdi
movzwl -0x2e(%rbp), %esi
movq -0x20(%rbp), %rdx
movzwl -0x2e(%rbp), %eax
subl -0x14(%rbp), %eax
movl %eax, %eax
addq %rax, %rdx
movl -0x3c(%rbp), %ecx
callq 0xed80
movl %eax, -0x28(%rbp)
cmpl $0x0, -0x28(%rbp)
jge 0xf143
movl -0x28(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0xf176
movl -0x3c(%rbp), %ecx
movzwl -0x2e(%rbp), %eax
addl %ecx, %eax
movw %ax, -0x2e(%rbp)
movl -0x3c(%rbp), %ecx
movl -0x40(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x40(%rbp)
cmpl $0x0, -0x40(%rbp)
jg 0xf163
jmp 0xf170
jmp 0xf165
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0xf0fc
movl -0x28(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nop
// File: 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
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x70(%rbp)
movl $0x6, -0x68(%rbp)
testb $0x1, 0x8(%rax)
jne 0xf394
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xf4b5
movl -0x1c(%rbp), %eax
movl %eax, %ecx
movl $0x41, %eax
cmpq %rcx, %rax
jae 0xf3af
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xf4b5
leaq -0x60(%rbp), %rdi
xorl %esi, %esi
movl $0x41, %edx
callq 0x50a0
leaq -0x60(%rbp), %rdi
movq -0x18(%rbp), %rsi
movl -0x1c(%rbp), %eax
movl %eax, %edx
callq 0x50b0
movb $0xe, -0x60(%rbp)
jmp 0xf3d7
jmp 0xf3d9
movq -0x70(%rbp), %rax
movl 0xc(%rax), %edi
movl -0x1c(%rbp), %eax
shll $0x10, %eax
orl $0xc0004806, %eax       # imm = 0xC0004806
movl %eax, %eax
movl %eax, %esi
leaq -0x60(%rbp), %rdx
movb $0x0, %al
callq 0x5170
movl %eax, -0x64(%rbp)
cmpl $0x0, -0x64(%rbp)
jge 0xf499
movq -0x70(%rbp), %rax
testb $0x1, 0x8(%rax)
je 0xf41b
movq -0x70(%rbp), %rax
testb $0x1, 0x40(%rax)
je 0xf451
jmp 0xf41d
leaq 0x16e75(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0xf44d
movq 0x16b88(%rip), %rax     # 0x25fb8
movq (%rax), %rdi
leaq 0xf134(%rip), %rsi      # 0x1e56e
leaq 0xf127(%rip), %rdx      # 0x1e568
movl $0x12a, %ecx            # imm = 0x12A
movb $0x0, %al
callq 0x5190
jmp 0xf44f
jmp 0xf4af
jmp 0xf453
leaq 0x16e3f(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0xf48b
movq 0x16b52(%rip), %rax     # 0x25fb8
movq (%rax), %rdi
movl -0x64(%rbp), %r8d
movl -0x68(%rbp), %r9d
leaq 0xf12b(%rip), %rsi      # 0x1e5a3
leaq 0xf0e9(%rip), %rdx      # 0x1e568
movl $0x12e, %ecx            # imm = 0x12E
movb $0x0, %al
callq 0x5190
jmp 0xf48d
movl $0x2710, %edi           # imm = 0x2710
callq 0x5180
jmp 0xf49b
jmp 0xf4af
jmp 0xf49d
movl -0x68(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x68(%rbp)
cmpl $0x0, %eax
jne 0xf3d9
movl -0x64(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x70, %rsp
popq %rbp
retq
nop
// File: 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
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x70(%rbp)
movl $0x6, -0x68(%rbp)
testb $0x1, 0x8(%rax)
jne 0xf4f4
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xf611
movl -0x1c(%rbp), %eax
movl %eax, %ecx
movl $0x41, %eax
cmpq %rcx, %rax
jae 0xf50f
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xf611
leaq -0x60(%rbp), %rdi
xorl %esi, %esi
movl $0x41, %edx
callq 0x50a0
leaq -0x60(%rbp), %rdi
movq -0x18(%rbp), %rsi
movl -0x1c(%rbp), %eax
movl %eax, %edx
callq 0x50b0
jmp 0xf533
jmp 0xf535
movq -0x70(%rbp), %rax
movl 0xc(%rax), %edi
movl -0x1c(%rbp), %eax
shll $0x10, %eax
orl $0xc0004806, %eax       # imm = 0xC0004806
movl %eax, %eax
movl %eax, %esi
leaq -0x60(%rbp), %rdx
movb $0x0, %al
callq 0x5170
movl %eax, -0x64(%rbp)
cmpl $0x0, -0x64(%rbp)
jge 0xf5f5
movq -0x70(%rbp), %rax
testb $0x1, 0x8(%rax)
je 0xf577
movq -0x70(%rbp), %rax
testb $0x1, 0x40(%rax)
je 0xf5ad
jmp 0xf579
leaq 0x16d19(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0xf5a9
movq 0x16a2c(%rip), %rax     # 0x25fb8
movq (%rax), %rdi
leaq 0xefd8(%rip), %rsi      # 0x1e56e
leaq 0xf043(%rip), %rdx      # 0x1e5e0
movl $0x14b, %ecx            # imm = 0x14B
movb $0x0, %al
callq 0x5190
jmp 0xf5ab
jmp 0xf60b
jmp 0xf5af
leaq 0x16ce3(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0xf5e7
movq 0x169f6(%rip), %rax     # 0x25fb8
movq (%rax), %rdi
movl -0x64(%rbp), %r8d
movl -0x68(%rbp), %r9d
leaq 0xefcf(%rip), %rsi      # 0x1e5a3
leaq 0xf005(%rip), %rdx      # 0x1e5e0
movl $0x14f, %ecx            # imm = 0x14F
movb $0x0, %al
callq 0x5190
jmp 0xf5e9
movl $0x2710, %edi           # imm = 0x2710
callq 0x5180
jmp 0xf5f7
jmp 0xf60b
jmp 0xf5f9
movl -0x68(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x68(%rbp)
cmpl $0x0, %eax
jne 0xf535
movl -0x64(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x70, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: 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
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x30(%rbp)
leaq -0x20(%rbp), %rdi
xorl %esi, %esi
movl $0xc, %edx
callq 0x50a0
movq -0x30(%rbp), %rax
movl $0x14, 0x10(%rax)
movl $0x14, 0x14(%rax)
movl $0x2, 0x18(%rax)
movl $0xa, -0x24(%rbp)
testb $0x1, 0x8(%rax)
jne 0xf6aa
jmp 0xf66c
leaq 0x16c26(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0xf69c
movq 0x16959(%rip), %rax     # 0x25fd8
movq (%rax), %rdi
leaq 0xd5f6(%rip), %rsi      # 0x1cc7f
leaq 0xd61a(%rip), %rdx      # 0x1ccaa
movl $0x161, %ecx            # imm = 0x161
movb $0x0, %al
callq 0x5190
jmp 0xf69e
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xf773
jmp 0xf6ac
movq -0x30(%rbp), %rdi
leaq -0x20(%rbp), %rdx
movq (%rdi), %rax
movl $0x8240, %esi           # imm = 0x8240
movl $0xc, %ecx
callq *0x20(%rax)
movl %eax, -0x14(%rbp)
cmpl $0x0, -0x14(%rbp)
jge 0xf707
jmp 0xf6cf
leaq 0x16bc3(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0xf703
movq 0x168d6(%rip), %rax     # 0x25fb8
movq (%rax), %rdi
movl -0x24(%rbp), %r8d
leaq 0xd681(%rip), %rsi      # 0x1cd71
leaq 0xd5b3(%rip), %rdx      # 0x1ccaa
movl $0x168, %ecx            # imm = 0x168
movb $0x0, %al
callq 0x5190
jmp 0xf705
jmp 0xf709
jmp 0xf719
jmp 0xf70b
movl -0x24(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x24(%rbp)
cmpl $0x0, %eax
jne 0xf6ac
cmpl $0x0, -0x24(%rbp)
jne 0xf728
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xf773
movq -0x30(%rbp), %rax
movl -0x20(%rbp), %ecx
movl %ecx, 0x1c(%rax)
movb $0x0, 0x20(%rax)
movzbl -0x16(%rbp), %ecx
andl $0xf, %ecx
movl %ecx, 0x18(%rax)
movzbl -0x1b(%rbp), %ecx
sarl $0x4, %ecx
imull $0xa, %ecx, %ecx
movzbl -0x1b(%rbp), %edx
andl $0xf, %edx
addl %edx, %ecx
movl %ecx, 0x10(%rax)
movzbl -0x1a(%rbp), %ecx
sarl $0x4, %ecx
imull $0xa, %ecx, %ecx
movzbl -0x1a(%rbp), %edx
andl $0xf, %edx
addl %edx, %ecx
movl %ecx, 0x14(%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)
// File: 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:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movb $0x0, -0x15(%rbp)
movl $0x0, -0x1c(%rbp)
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0xf7c9
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movzbl (%rax,%rcx), %ecx
movzbl -0x15(%rbp), %eax
addl %ecx, %eax
movb %al, -0x15(%rbp)
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0xf7a1
movb -0x15(%rbp), %al
popq %rbp
retq
nop
// File: 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 %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x20(%rbp)
leaq 0x167ce(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0xfaf4
movq 0x164e1(%rip), %rax     # 0x25fb8
movq (%rax), %rdi
leaq 0xeb21(%rip), %rsi      # 0x1e602
leaq 0xc75a(%rip), %rdx      # 0x1c242
movl $0x25, %ecx
movb $0x0, %al
callq 0x5190
jmp 0xfaf6
movq -0x20(%rbp), %rax
movl $0xffffffff, -0xc(%rbp) # imm = 0xFFFFFFFF
movl $0x0, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
cmpq $0x0, 0x30(%rax)
jne 0xfb18
jmp 0xfb8d
movl $0x0, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
cmpl $0x8, -0x10(%rbp)
jge 0xfb79
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 0xfb6c
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 0xfb6e
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0xfb26
movq -0x20(%rbp), %rax
movslq -0x14(%rbp), %rcx
movb $0x0, 0x19(%rax,%rcx)
movl $0x0, -0xc(%rbp)
jmp 0xfb8f
leaq 0x16703(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0xfbbf
movq 0x16416(%rip), %rax     # 0x25fb8
movq (%rax), %rdi
leaq 0xea87(%rip), %rsi      # 0x1e633
leaq 0xc68f(%rip), %rdx      # 0x1c242
movl $0x34, %ecx
movb $0x0, %al
callq 0x5190
jmp 0xfbc1
movl -0xc(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: goodix[P]gdix_hid_firmware_update/gtx5/gtx5_firmware_image.cpp
// Function: GTX5FirmwareImage::InitVid()
int GTX5FirmwareImage::InitVid()
{
	gdix_dbg("GTX5FirmwareImage InitVid run\n");
	int ret = -1;

	if (!m_firmwareData)
		goto exit;

	m_firmwareVersionMajor = m_firmwareData[GTX5_FW_IMAGE_CID_OFFSET];
	m_firmwareVersionMinor =
		((m_firmwareData[GTX5_FW_IMAGE_VID_OFFSET] << 16) |
		 (m_firmwareData[GTX5_FW_IMAGE_VID_OFFSET + 1] << 8) |
		 (m_firmwareData[GTX5_FW_IMAGE_VID_OFFSET + 2]));
	gdix_dbg("cid:0x%02x,vid 0x%02X,0x%02X,0x%02X\n",
			 m_firmwareData[GTX5_FW_IMAGE_CID_OFFSET],
			 m_firmwareData[GTX5_FW_IMAGE_VID_OFFSET],
			 m_firmwareData[GTX5_FW_IMAGE_VID_OFFSET + 1],
			 m_firmwareData[GTX5_FW_IMAGE_VID_OFFSET + 2]);
	ret = 0;
exit:
	gdix_dbg("GTX5FirmwareImage 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 0x166ae(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0xfc14
movq 0x163c1(%rip), %rax     # 0x25fb8
movq (%rax), %rdi
leaq 0xea64(%rip), %rsi      # 0x1e665
leaq 0xc66a(%rip), %rdx      # 0x1c272
movl $0x3a, %ecx
movb $0x0, %al
callq 0x5190
jmp 0xfc16
movq -0x18(%rbp), %rax
movl $0xffffffff, -0xc(%rbp) # imm = 0xFFFFFFFF
cmpq $0x0, 0x30(%rax)
jne 0xfc2d
jmp 0xfcc9
movq -0x18(%rbp), %rax
movq 0x30(%rax), %rcx
movzbl 0x17(%rcx), %ecx
movl %ecx, 0x24(%rax)
movq 0x30(%rax), %rcx
movzbl 0x18(%rcx), %ecx
shll $0x10, %ecx
movq 0x30(%rax), %rdx
movzbl 0x19(%rdx), %edx
shll $0x8, %edx
orl %edx, %ecx
movq 0x30(%rax), %rdx
movzbl 0x1a(%rdx), %edx
orl %edx, %ecx
movl %ecx, 0x28(%rax)
leaq 0x16631(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0xfcc0
movq -0x18(%rbp), %rax
movq 0x16340(%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 0xd33c(%rip), %rsi      # 0x1cfe1
leaq 0xc5c6(%rip), %rdx      # 0x1c272
movl $0x49, %ecx
movl %r10d, (%rsp)
movl %eax, 0x8(%rsp)
movb $0x0, %al
callq 0x5190
jmp 0xfcc2
movl $0x0, -0xc(%rbp)
jmp 0xfccb
leaq 0x165c7(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0xfcff
movq 0x162da(%rip), %rax     # 0x25fb8
movq (%rax), %rdi
movl -0xc(%rbp), %r8d
leaq 0xe9a9(%rip), %rsi      # 0x1e695
leaq 0xc57f(%rip), %rdx      # 0x1c272
movl $0x4c, %ecx
movb $0x0, %al
callq 0x5190
jmp 0xfd01
movl -0xc(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: goodix[P]gdix_hid_firmware_update/gtx8/gtx8_firmware_image.cpp
// Function: GTX8FirmwareImage::InitPid()
int GTX8FirmwareImage::InitPid()
{
	gdix_dbg("GTX8FirmwareImage::InitPid run\n");
	int ret = -1;
	int i = 0;
	int j = 0;

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

exit:
	gdix_dbg("GTX8FirmwareImage::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 0x1501e(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0x112a4
movq 0x14d31(%rip), %rax     # 0x25fb8
movq (%rax), %rdi
leaq 0xd543(%rip), %rsi      # 0x1e7d4
leaq 0xafaa(%rip), %rdx      # 0x1c242
movl $0x20, %ecx
movb $0x0, %al
callq 0x5190
jmp 0x112a6
movq -0x20(%rbp), %rax
movl $0xffffffff, -0xc(%rbp) # imm = 0xFFFFFFFF
movl $0x0, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
cmpq $0x0, 0x30(%rax)
jne 0x112c8
jmp 0x1133d
movl $0x0, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
cmpl $0x8, -0x10(%rbp)
jge 0x11329
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 0x1131c
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 0x1131e
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x112d6
movq -0x20(%rbp), %rax
movslq -0x14(%rbp), %rcx
movb $0x0, 0x19(%rax,%rcx)
movl $0x0, -0xc(%rbp)
jmp 0x1133f
leaq 0x14f53(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0x1136f
movq 0x14c66(%rip), %rax     # 0x25fb8
movq (%rax), %rdi
leaq 0xd4a9(%rip), %rsi      # 0x1e805
leaq 0xaedf(%rip), %rdx      # 0x1c242
movl $0x2f, %ecx
movb $0x0, %al
callq 0x5190
jmp 0x11371
movl -0xc(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: goodix[P]gdix_hid_firmware_update/gtx8/gtx8_firmware_image.cpp
// Function: GTX8FirmwareImage::InitVid()
int GTX8FirmwareImage::InitVid()
{
	gdix_dbg("GTX8FirmwareImage InitVid run\n");
	int ret = -1;

	if (!m_firmwareData)
		goto exit;

	m_firmwareVersionMajor = m_firmwareData[GTX8_FW_IMAGE_VID_OFFSET];
	/* |--vid2--|--vid3--|--cfg_id--|
	 * reserve the last byte for config ID.
	 */
	m_firmwareVersionMinor =
		(m_firmwareData[GTX8_FW_IMAGE_VID_OFFSET + 1] << 16) |
		(m_firmwareData[GTX8_FW_IMAGE_VID_OFFSET + 2] << 8);
	gdix_dbg("cid:0x%02x,vid 0x%02X,0x%02X,0x%02X\n",
			 m_firmwareData[GTX8_FW_IMAGE_CID_OFFSET],
			 m_firmwareData[GTX8_FW_IMAGE_VID_OFFSET],
			 m_firmwareData[GTX8_FW_IMAGE_VID_OFFSET + 1],
			 m_firmwareData[GTX8_FW_IMAGE_VID_OFFSET + 2]);
	ret = 0;
exit:
	gdix_dbg("GTX8FirmwareImage 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 0x14efe(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0x113c4
movq 0x14c11(%rip), %rax     # 0x25fb8
movq (%rax), %rdi
leaq 0xd486(%rip), %rsi      # 0x1e837
leaq 0xaeba(%rip), %rdx      # 0x1c272
movl $0x35, %ecx
movb $0x0, %al
callq 0x5190
jmp 0x113c6
movq -0x18(%rbp), %rax
movl $0xffffffff, -0xc(%rbp) # imm = 0xFFFFFFFF
cmpq $0x0, 0x30(%rax)
jne 0x113dd
jmp 0x1146f
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 0x14e8b(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0x11466
movq -0x18(%rbp), %rax
movq 0x14b9a(%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 0xbb96(%rip), %rsi      # 0x1cfe1
leaq 0xae20(%rip), %rdx      # 0x1c272
movl $0x46, %ecx
movl %r10d, (%rsp)
movl %eax, 0x8(%rsp)
movb $0x0, %al
callq 0x5190
jmp 0x11468
movl $0x0, -0xc(%rbp)
jmp 0x11471
leaq 0x14e21(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0x114a5
movq 0x14b34(%rip), %rax     # 0x25fb8
movq (%rax), %rdi
movl -0xc(%rbp), %r8d
leaq 0xd3d5(%rip), %rsi      # 0x1e867
leaq 0xadd9(%rip), %rdx      # 0x1c272
movl $0x49, %ecx
movb $0x0, %al
callq 0x5190
jmp 0x114a7
movl -0xc(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
// File: goodix[P]gdix_hid_firmware_update/gtx9/gtx9.cpp
// Function: GTx9Device::GTx9Device()
GTx9Device::GTx9Device()
{
	m_fd = -1;
	m_firmwareVersionMajor = 0;
	m_firmwareVersionMinor = 0;
	m_sensorID = 0;
	m_configID = 0;
	memset(m_pid, 0, sizeof(m_pid));
	memset(m_vid, 0, sizeof(m_vid));
	m_deviceOpen = false;
}

// 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 0x127a4(%rip), %rax     # 0x25938
addq $0x10, %rax
movq %rax, (%rdi)
movl $0xffffffff, 0xc(%rdi)  # imm = 0xFFFFFFFF
movl $0x0, 0x24(%rdi)
movl $0x0, 0x28(%rdi)
movb $0x0, 0x1c(%rdi)
movl $0x0, 0x20(%rdi)
addq $0x10, %rdi
xorl %esi, %esi
movl $0x8, %edx
callq 0x50a0
movq -0x10(%rbp), %rdi
addq $0x18, %rdi
xorl %esi, %esi
movl $0x4, %edx
callq 0x50a0
movq -0x10(%rbp), %rax
movb $0x0, 0x8(%rax)
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax)
// File: goodix[P]gdix_hid_firmware_update/gtx9/gtx9.cpp
// Function: GTx9Device::Open(char const*)
int GTx9Device::Open(const char *filename)
{
	if (!filename)
		return -EINVAL;

	m_fd = open(filename, O_RDWR);
	if (m_fd < 0)
		return -EINVAL;

	m_deviceOpen = true;

	return SetBasicProperties();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0x13218
movl $0xffffffea, -0x4(%rbp) # imm = 0xFFFFFFEA
jmp 0x13254
movq -0x18(%rbp), %rdi
movl $0x2, %esi
movb $0x0, %al
callq 0x51e0
movl %eax, %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0xc(%rax)
cmpl $0x0, 0xc(%rax)
jge 0x13240
movl $0xffffffea, -0x4(%rbp) # imm = 0xFFFFFFEA
jmp 0x13254
movq -0x20(%rbp), %rdi
movb $0x1, 0x8(%rdi)
movq (%rdi), %rax
callq *0xa0(%rax)
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)
// File: goodix[P]gdix_hid_firmware_update/gtx9/gtx9.cpp
// Function: GTx9Device::Close()
void GTx9Device::Close()
{
	if (!m_deviceOpen)
		return;
	close(m_fd);
	m_fd = -1;
	m_deviceOpen = false;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x10(%rbp)
testb $0x1, 0x8(%rax)
jne 0x1327c
jmp 0x13297
movq -0x10(%rbp), %rax
movl 0xc(%rax), %edi
callq 0x5200
movq -0x10(%rbp), %rax
movl $0xffffffff, 0xc(%rax)  # imm = 0xFFFFFFFF
movb $0x0, 0x8(%rax)
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax)
// File: goodix[P]gdix_hid_firmware_update/gtx9/gtx9.cpp
// Function: GTx9Device::SetReport(unsigned char*, int)
int GTx9Device::SetReport(unsigned char *buf, int len)
{
	int retry = 5;
	int ret;

	while (retry--) {
		ret = ioctl(m_fd, HIDIOCSFEATURE(len), buf);
		if (ret == len)
			return 0;
		usleep(1000);
	}

	gdix_err("Failed set report, ret:%d\n", ret);
	return -EINVAL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x30(%rbp)
movl $0x5, -0x20(%rbp)
movl -0x20(%rbp), %eax
movl %eax, %ecx
addl $-0x1, %ecx
movl %ecx, -0x20(%rbp)
cmpl $0x0, %eax
je 0x13513
movq -0x30(%rbp), %rax
movl 0xc(%rax), %edi
movl -0x1c(%rbp), %eax
shll $0x10, %eax
orl $0xc0004806, %eax       # imm = 0xC0004806
movl %eax, %eax
movl %eax, %esi
movq -0x18(%rbp), %rdx
movb $0x0, %al
callq 0x5170
movl %eax, -0x24(%rbp)
movl -0x24(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jne 0x13507
movl $0x0, -0x4(%rbp)
jmp 0x13552
movl $0x3e8, %edi            # imm = 0x3E8
callq 0x5180
jmp 0x134c2
jmp 0x13515
leaq 0x12d7d(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0x13549
movq 0x12ab0(%rip), %rax     # 0x25fd8
movq (%rax), %rdi
movl -0x24(%rbp), %r8d
leaq 0xb539(%rip), %rsi      # 0x1ea6f
leaq 0xb849(%rip), %rdx      # 0x1ed86
movl $0x155, %ecx            # imm = 0x155
movb $0x0, %al
callq 0x5190
jmp 0x1354b
movl $0xffffffea, -0x4(%rbp) # imm = 0xFFFFFFEA
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: goodix[P]gdix_hid_firmware_update/gtx9/gtx9.cpp
// Function: GTx9Device::GetReport(unsigned char*)
int GTx9Device::GetReport(unsigned char *buf)
{
	int ret;
	int retry = 5;
	uint8_t rcv_buf[PACKAGE_LEN + 1] = {0};

	while (retry--) {
		rcv_buf[0] = REPORT_ID;
		ret = ioctl(m_fd, HIDIOCGFEATURE(PACKAGE_LEN), rcv_buf);
		if (ret == PACKAGE_LEN && rcv_buf[0] == REPORT_ID) {
			memcpy(buf, rcv_buf, PACKAGE_LEN);
			return 0;
		}
		usleep(1000);
	}

	gdix_err("Failed get report ret:%d rcvbuf[0]:0x%02x\n", ret, rcv_buf[0]);
	return -EINVAL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x78(%rbp)
movl $0x5, -0x20(%rbp)
leaq -0x70(%rbp), %rdi
xorl %esi, %esi
movl $0x42, %edx
callq 0x50a0
movl -0x20(%rbp), %eax
movl %eax, %ecx
addl $-0x1, %ecx
movl %ecx, -0x20(%rbp)
cmpl $0x0, %eax
je 0x135f6
movq -0x78(%rbp), %rax
movb $0xe, -0x70(%rbp)
movl 0xc(%rax), %edi
leaq -0x70(%rbp), %rdx
movl $0xc0414807, %esi       # imm = 0xC0414807
movb $0x0, %al
callq 0x5170
movl %eax, -0x1c(%rbp)
cmpl $0x41, -0x1c(%rbp)
jne 0x135ea
movzbl -0x70(%rbp), %eax
cmpl $0xe, %eax
jne 0x135ea
movq -0x18(%rbp), %rdi
leaq -0x70(%rbp), %rsi
movl $0x41, %edx
callq 0x50b0
movl $0x0, -0x4(%rbp)
jmp 0x1363a
movl $0x3e8, %edi            # imm = 0x3E8
callq 0x5180
jmp 0x13592
jmp 0x135f8
leaq 0x12c9a(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0x13631
movq 0x129cd(%rip), %rax     # 0x25fd8
movq (%rax), %rdi
movl -0x1c(%rbp), %r8d
movzbl -0x70(%rbp), %r9d
leaq 0xb72c(%rip), %rsi      # 0x1ed4a
leaq 0xadcb(%rip), %rdx      # 0x1e3f0
movl $0x145, %ecx            # imm = 0x145
movb $0x0, %al
callq 0x5190
jmp 0x13633
movl $0xffffffea, -0x4(%rbp) # imm = 0xFFFFFFEA
movl -0x4(%rbp), %eax
addq $0x80, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: goodix[P]gdix_hid_firmware_update/gtx9/gtx9.cpp
// Function: GTx9Device::Read(unsigned int, unsigned char*, unsigned int)
int GTx9Device::Read(unsigned int addr, unsigned char *buf, unsigned int len)
{
	int ret = 0;
	int i = 0;
	uint32_t tmp_addr = addr;
	int offset = 0;
	int pkg_size = PACKAGE_LEN - 12;
	int remain_size;
	int pkg_num;

	if (!m_deviceOpen) {
		gdix_err("Device not open\n");
		return -EINVAL;
	}

	pkg_num = len / pkg_size;
	remain_size = len % pkg_size;

	for (i = 0; i < pkg_num; i++) {
		ret = ReadPkg(tmp_addr + offset, &buf[offset], pkg_size);
		if (ret < 0)
			return ret;
		offset += pkg_size;
	}

	if (remain_size > 0) {
		ret = ReadPkg(tmp_addr + offset, &buf[offset], remain_size);
		if (ret < 0)
			return ret;
	}

	return len;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
movl %ecx, -0x24(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x48(%rbp)
movl $0x0, -0x28(%rbp)
movl $0x0, -0x2c(%rbp)
movl -0x14(%rbp), %ecx
movl %ecx, -0x30(%rbp)
movl $0x0, -0x34(%rbp)
movl $0x35, -0x38(%rbp)
testb $0x1, 0x8(%rax)
jne 0x136d6
jmp 0x13698
leaq 0x12bfa(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0x136c8
movq 0x1292d(%rip), %rax     # 0x25fd8
movq (%rax), %rdi
leaq 0xb412(%rip), %rsi      # 0x1eac7
leaq 0xb42d(%rip), %rdx      # 0x1eae9
movl $0x7c, %ecx
movb $0x0, %al
callq 0x5190
jmp 0x136ca
movl $0xffffffea, -0x4(%rbp) # imm = 0xFFFFFFEA
jmp 0x13779
movl -0x24(%rbp), %eax
xorl %edx, %edx
divl -0x38(%rbp)
movl %eax, -0x40(%rbp)
movl -0x24(%rbp), %eax
xorl %edx, %edx
divl -0x38(%rbp)
movl %edx, -0x3c(%rbp)
movl $0x0, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
cmpl -0x40(%rbp), %eax
jge 0x1373d
movq -0x48(%rbp), %rdi
movl -0x30(%rbp), %esi
addl -0x34(%rbp), %esi
movq -0x20(%rbp), %rdx
movslq -0x34(%rbp), %rax
addq %rax, %rdx
movl -0x38(%rbp), %ecx
callq 0x132e0
movl %eax, -0x28(%rbp)
cmpl $0x0, -0x28(%rbp)
jge 0x13729
movl -0x28(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x13779
movl -0x38(%rbp), %eax
addl -0x34(%rbp), %eax
movl %eax, -0x34(%rbp)
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x136f3
cmpl $0x0, -0x3c(%rbp)
jle 0x13773
movq -0x48(%rbp), %rdi
movl -0x30(%rbp), %esi
addl -0x34(%rbp), %esi
movq -0x20(%rbp), %rdx
movslq -0x34(%rbp), %rax
addq %rax, %rdx
movl -0x3c(%rbp), %ecx
callq 0x132e0
movl %eax, -0x28(%rbp)
cmpl $0x0, -0x28(%rbp)
jge 0x13771
movl -0x28(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x13779
jmp 0x13773
movl -0x24(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: goodix[P]gdix_hid_firmware_update/gtx9/gtx9.cpp
// Function: GTx9Device::SendCmd(unsigned char, unsigned char*, int)
int GTx9Device::SendCmd(unsigned char cmd, unsigned char *data, int dataLen)
{
	uint8_t HidBuf[PACKAGE_LEN] = {0};
	int ret;

	if (!m_deviceOpen) {
		gdix_err("Device not open\n");
		return -EINVAL;
	}

	HidBuf[0] = REPORT_ID;
	HidBuf[1] = cmd;
	HidBuf[2] = 0x00;
	HidBuf[3] = 0x00;
	HidBuf[4] = (uint8_t)dataLen;
	memcpy(&HidBuf[5], data, dataLen);
	ret = SetReport(HidBuf, dataLen + 5);
	if (ret < 0)
		gdix_err("Failed send cmd 0x%02x\n", cmd);

	return ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movb %sil, %al
movq %rdi, -0x10(%rbp)
movb %al, -0x11(%rbp)
movq %rdx, -0x20(%rbp)
movl %ecx, -0x24(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x80(%rbp)
leaq -0x70(%rbp), %rdi
xorl %esi, %esi
movl $0x41, %edx
callq 0x50a0
movq -0x80(%rbp), %rax
testb $0x1, 0x8(%rax)
jne 0x13efe
jmp 0x13ec0
leaq 0x123d2(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0x13ef0
movq 0x12105(%rip), %rax     # 0x25fd8
movq (%rax), %rdi
leaq 0xabea(%rip), %rsi      # 0x1eac7
leaq 0xae35(%rip), %rdx      # 0x1ed19
movl $0x124, %ecx            # imm = 0x124
movb $0x0, %al
callq 0x5190
jmp 0x13ef2
movl $0xffffffea, -0x4(%rbp) # imm = 0xFFFFFFEA
jmp 0x13f88
movb $0xe, -0x70(%rbp)
movb -0x11(%rbp), %al
movb %al, -0x6f(%rbp)
movb $0x0, -0x6e(%rbp)
movb $0x0, -0x6d(%rbp)
movl -0x24(%rbp), %eax
movb %al, -0x6c(%rbp)
leaq -0x70(%rbp), %rdi
addq $0x5, %rdi
movq -0x20(%rbp), %rsi
movslq -0x24(%rbp), %rdx
callq 0x50b0
movq -0x80(%rbp), %rdi
leaq -0x70(%rbp), %rsi
movl -0x24(%rbp), %edx
addl $0x5, %edx
callq 0x134a0
movl %eax, -0x74(%rbp)
cmpl $0x0, -0x74(%rbp)
jge 0x13f82
jmp 0x13f49
leaq 0x12349(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0x13f7e
movq 0x1207c(%rip), %rax     # 0x25fd8
movq (%rax), %rdi
movzbl -0x11(%rbp), %r8d
leaq 0xadb6(%rip), %rsi      # 0x1ed21
leaq 0xada7(%rip), %rdx      # 0x1ed19
movl $0x130, %ecx            # imm = 0x130
movb $0x0, %al
callq 0x5190
jmp 0x13f80
jmp 0x13f82
movl -0x74(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x80, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: goodix[P]gdix_hid_firmware_update/gtx9/gtx9_firmware_image.cpp
// Function: GTX9FirmwareImage::GTX9FirmwareImage()
GTX9FirmwareImage::GTX9FirmwareImage()
{
	m_firmwareCfgID = 0;
	memset(m_firmwarePID, 0, sizeof(m_firmwarePID));
	memset(m_firmwareVID, 0, sizeof(m_firmwareVID));
	memset(&m_firmwareSummary, 0, sizeof(m_firmwareSummary));
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x10(%rbp)
callq 0x5310
movq -0x10(%rbp), %rdi
leaq 0x115a4(%rip), %rax     # 0x25a18
addq $0x10, %rax
movq %rax, (%rdi)
movl $0x0, 0x44(%rdi)
addq $0x38, %rdi
xorl %esi, %esi
movl $0x8, %edx
callq 0x50a0
movq -0x10(%rbp), %rdi
addq $0x40, %rdi
xorl %esi, %esi
movl $0x4, %edx
callq 0x50a0
movq -0x10(%rbp), %rdi
addq $0x48, %rdi
xorl %esi, %esi
movl $0x492, %edx            # imm = 0x492
callq 0x50a0
addq $0x10, %rsp
popq %rbp
retq
// File: goodix[P]gdix_hid_firmware_update/gtx9/gtx9_firmware_image.cpp
// Function: GTX9FirmwareImage::Initialize(char const*)
int GTX9FirmwareImage::Initialize(const char *filename)
{
	int ret;

	m_initialized = false;

	if (GetDataFromFile(filename) < 0) {
		gdix_err("Failed get firmware\n");
		return -EINVAL;
	}

	gdix_info("Parse firmware file\n");
	ret = ParseFirmware();
	if (ret < 0) {
		gdix_err("Failed parse firmware\n");
		return ret;
	}

	m_initialized = true;
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rdi
movq %rdi, -0x28(%rbp)
movb $0x0, 0x8(%rdi)
movq -0x18(%rbp), %rsi
movq (%rdi), %rax
callq *0xb0(%rax)
cmpl $0x0, %eax
jge 0x1452e
jmp 0x144f0
leaq 0x11da2(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0x14520
movq 0x11ad5(%rip), %rax     # 0x25fd8
movq (%rax), %rdi
leaq 0xa9a8(%rip), %rsi      # 0x1eeb5
leaq 0x7b17(%rip), %rdx      # 0x1c02b
movl $0x33, %ecx
movb $0x0, %al
callq 0x5190
jmp 0x14522
movl $0xffffffea, -0x4(%rbp) # imm = 0xFFFFFFEA
jmp 0x145bf
jmp 0x14530
leaq 0x11d62(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0x14560
movq 0x11a75(%rip), %rax     # 0x25fb8
movq (%rax), %rdi
leaq 0xa98e(%rip), %rsi      # 0x1eedb
leaq 0x7ad7(%rip), %rdx      # 0x1c02b
movl $0x37, %ecx
movb $0x0, %al
callq 0x5190
jmp 0x14562
movq -0x28(%rbp), %rdi
callq 0x145d0
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
jge 0x145b0
jmp 0x14576
leaq 0x11d1c(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0x145a6
movq 0x11a4f(%rip), %rax     # 0x25fd8
movq (%rax), %rdi
leaq 0xa96e(%rip), %rsi      # 0x1ef01
leaq 0x7a91(%rip), %rdx      # 0x1c02b
movl $0x3a, %ecx
movb $0x0, %al
callq 0x5190
jmp 0x145a8
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x145bf
movq -0x28(%rbp), %rax
movb $0x1, 0x8(%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: goodix[P]gdix_hid_firmware_update/gtx9/gtx9_i2c_update.cpp
// Function: checksum_cmp(unsigned char const*, int, int)
int checksum_cmp(const uint8_t *data, int size, int mode)
{
	uint32_t cal_checksum = 0;
	uint32_t r_checksum = 0;
	int i;

	if (mode == CHECKSUM_MODE_U8_LE) {
		if (size < 2)
			return 1;
		for (i = 0; i < size - 2; i++)
			cal_checksum += data[i];

		r_checksum = data[size - 2] + (data[size - 1] << 8);
		return (cal_checksum & 0xFFFF) == r_checksum ? 0 : 1;
	}

	if (size < 4)
		return 1;
	for (i = 0; i < size - 4; i += 2)
		cal_checksum += data[i] + (data[i + 1] << 8);
	r_checksum = data[size - 4] + (data[size - 3] << 8) +
				 (data[size - 2] << 16) + (data[size - 1] << 24);
	return cal_checksum == r_checksum ? 0 : 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl %edx, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
movl $0x0, -0x20(%rbp)
cmpl $0x0, -0x18(%rbp)
jne 0x14ef3
cmpl $0x2, -0x14(%rbp)
jge 0x14e78
movl $0x1, -0x4(%rbp)
jmp 0x14fb7
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
movl -0x14(%rbp), %ecx
subl $0x2, %ecx
cmpl %ecx, %eax
jge 0x14ea9
movq -0x10(%rbp), %rax
movslq -0x24(%rbp), %rcx
movzbl (%rax,%rcx), %eax
addl -0x1c(%rbp), %eax
movl %eax, -0x1c(%rbp)
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x14e7f
movq -0x10(%rbp), %rax
movl -0x14(%rbp), %ecx
subl $0x2, %ecx
movslq %ecx, %rcx
movzbl (%rax,%rcx), %eax
movq -0x10(%rbp), %rcx
movl -0x14(%rbp), %edx
subl $0x1, %edx
movslq %edx, %rdx
movzbl (%rcx,%rdx), %ecx
shll $0x8, %ecx
addl %ecx, %eax
movl %eax, -0x20(%rbp)
movl -0x1c(%rbp), %edx
andl $0xffff, %edx           # imm = 0xFFFF
movl -0x20(%rbp), %esi
movl $0x1, %eax
xorl %ecx, %ecx
cmpl %esi, %edx
cmovel %ecx, %eax
movl %eax, -0x4(%rbp)
jmp 0x14fb7
cmpl $0x4, -0x14(%rbp)
jge 0x14f05
movl $0x1, -0x4(%rbp)
jmp 0x14fb7
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
movl -0x14(%rbp), %ecx
subl $0x4, %ecx
cmpl %ecx, %eax
jge 0x14f4c
movq -0x10(%rbp), %rax
movslq -0x24(%rbp), %rcx
movzbl (%rax,%rcx), %eax
movq -0x10(%rbp), %rcx
movl -0x24(%rbp), %edx
addl $0x1, %edx
movslq %edx, %rdx
movzbl (%rcx,%rdx), %ecx
shll $0x8, %ecx
addl %ecx, %eax
addl -0x1c(%rbp), %eax
movl %eax, -0x1c(%rbp)
movl -0x24(%rbp), %eax
addl $0x2, %eax
movl %eax, -0x24(%rbp)
jmp 0x14f0c
movq -0x10(%rbp), %rax
movl -0x14(%rbp), %ecx
subl $0x4, %ecx
movslq %ecx, %rcx
movzbl (%rax,%rcx), %eax
movq -0x10(%rbp), %rcx
movl -0x14(%rbp), %edx
subl $0x3, %edx
movslq %edx, %rdx
movzbl (%rcx,%rdx), %ecx
shll $0x8, %ecx
addl %ecx, %eax
movq -0x10(%rbp), %rcx
movl -0x14(%rbp), %edx
subl $0x2, %edx
movslq %edx, %rdx
movzbl (%rcx,%rdx), %ecx
shll $0x10, %ecx
addl %ecx, %eax
movq -0x10(%rbp), %rcx
movl -0x14(%rbp), %edx
subl $0x1, %edx
movslq %edx, %rdx
movzbl (%rcx,%rdx), %ecx
shll $0x18, %ecx
addl %ecx, %eax
movl %eax, -0x20(%rbp)
movl -0x1c(%rbp), %edx
movl -0x20(%rbp), %esi
movl $0x1, %eax
xorl %ecx, %ecx
cmpl %esi, %edx
cmovel %ecx, %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
popq %rbp
retq
nopl (%rax)
// File: goodix[P]gdix_hid_firmware_update/gtx9/gtx9_i2c_update.cpp
// Function: gdix_append_checksum(unsigned char*, int, int)
uint32_t gdix_append_checksum(uint8_t *data, int len, int mode)
{
	uint32_t checksum = 0;
	int i;

	checksum = 0;
	if (mode == CHECKSUM_MODE_U8_LE) {
		for (i = 0; i < len; i++)
			checksum += data[i];
	} else {
		for (i = 0; i < len; i += 2)
			checksum += (data[i] + (data[i + 1] << 8));
	}

	if (mode == CHECKSUM_MODE_U8_LE) {
		data[len] = checksum & 0xff;
		data[len + 1] = (checksum >> 8) & 0xff;
		return 0xFFFF & checksum;
	}
	data[len] = checksum & 0xff;
	data[len + 1] = (checksum >> 8) & 0xff;
	data[len + 2] = (checksum >> 16) & 0xff;
	data[len + 3] = (checksum >> 24) & 0xff;
	return checksum;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl %edx, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
movl $0x0, -0x1c(%rbp)
cmpl $0x0, -0x18(%rbp)
jne 0x15010
movl $0x0, -0x20(%rbp)
movl -0x20(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0x1500e
movq -0x10(%rbp), %rax
movslq -0x20(%rbp), %rcx
movzbl (%rax,%rcx), %eax
addl -0x1c(%rbp), %eax
movl %eax, -0x1c(%rbp)
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x14fe9
jmp 0x15054
movl $0x0, -0x20(%rbp)
movl -0x20(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0x15052
movq -0x10(%rbp), %rax
movslq -0x20(%rbp), %rcx
movzbl (%rax,%rcx), %eax
movq -0x10(%rbp), %rcx
movl -0x20(%rbp), %edx
addl $0x1, %edx
movslq %edx, %rdx
movzbl (%rcx,%rdx), %ecx
shll $0x8, %ecx
addl %ecx, %eax
addl -0x1c(%rbp), %eax
movl %eax, -0x1c(%rbp)
movl -0x20(%rbp), %eax
addl $0x2, %eax
movl %eax, -0x20(%rbp)
jmp 0x15017
jmp 0x15054
cmpl $0x0, -0x18(%rbp)
jne 0x15099
movl -0x1c(%rbp), %eax
andl $0xff, %eax
movb %al, %dl
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movb %dl, (%rax,%rcx)
movl -0x1c(%rbp), %eax
shrl $0x8, %eax
andl $0xff, %eax
movb %al, %dl
movq -0x10(%rbp), %rax
movl -0x14(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
movl -0x1c(%rbp), %eax
andl $0xffff, %eax           # imm = 0xFFFF
movl %eax, -0x4(%rbp)
jmp 0x1510b
movl -0x1c(%rbp), %eax
andl $0xff, %eax
movb %al, %dl
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movb %dl, (%rax,%rcx)
movl -0x1c(%rbp), %eax
shrl $0x8, %eax
andl $0xff, %eax
movb %al, %dl
movq -0x10(%rbp), %rax
movl -0x14(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
movl -0x1c(%rbp), %eax
shrl $0x10, %eax
andl $0xff, %eax
movb %al, %dl
movq -0x10(%rbp), %rax
movl -0x14(%rbp), %ecx
addl $0x2, %ecx
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
movl -0x1c(%rbp), %eax
shrl $0x18, %eax
andl $0xff, %eax
movb %al, %dl
movq -0x10(%rbp), %rax
movl -0x14(%rbp), %ecx
addl $0x3, %ecx
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
popq %rbp
retq
// File: goodix[P]gdix_hid_firmware_update/gtx9/gtx9_i2c_update.cpp
// Function: switch_i2c_mode()
static int switch_i2c_mode(void)
{
	uint32_t addr = 0x3030aabb;
	uint8_t data = 0xCC;
	int ret, i, retry = 5;

	for (i = 0; i < retry; i++) {
		ret = i2c_write(addr, &data, 1);
		if (ret == 0) {
			gdix_dbg("switch i2c mode success\n");
			usleep(50000);
			return 0;
		}
	}

	gdix_err("switch i2c mode failed\n");
	return -1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movl $0x3030aabb, -0x8(%rbp) # imm = 0x3030AABB
movb $-0x34, -0x9(%rbp)
movl $0x5, -0x18(%rbp)
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
cmpl -0x18(%rbp), %eax
jge 0x153a7
movl -0x8(%rbp), %edi
leaq -0x9(%rbp), %rsi
movl $0x1, %edx
callq 0x15870
movl %eax, -0x10(%rbp)
cmpl $0x0, -0x10(%rbp)
jne 0x1539a
jmp 0x15355
leaq 0x10f3d(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0x15385
movq 0x10c50(%rip), %rax     # 0x25fb8
movq (%rax), %rdi
leaq 0x9f2f(%rip), %rsi      # 0x1f2a1
leaq 0x9f52(%rip), %rdx      # 0x1f2cb
movl $0x12b, %ecx            # imm = 0x12B
movb $0x0, %al
callq 0x5190
jmp 0x15387
movl $0xc350, %edi           # imm = 0xC350
callq 0x5180
movl $0x0, -0x4(%rbp)
jmp 0x153e2
jmp 0x1539c
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x15331
jmp 0x153a9
leaq 0x10ee9(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0x153d9
movq 0x10c1c(%rip), %rax     # 0x25fd8
movq (%rax), %rdi
leaq 0x9f15(%rip), %rsi      # 0x1f2db
leaq 0x9efe(%rip), %rdx      # 0x1f2cb
movl $0x131, %ecx            # imm = 0x131
movb $0x0, %al
callq 0x5190
jmp 0x153db
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: goodix[P]gdix_hid_firmware_update/gtx9/gtx9_i2c_update.cpp
// Function: gdix_fw_update_proc(fw_update_ctrl*)
static int gdix_fw_update_proc(struct fw_update_ctrl *fwu_ctrl)
{
	int ret;
	struct goodix_fw_version fw_ver;

	ret = gdix_read_version(&fw_ver);
	if (ret < 0)
		gdix_err("read current fw_version failed\n");

	ret = gdix_parse_firmware(&fwu_ctrl->fw_data);
	if (ret < 0) {
		gdix_err("failed to parse firmware\n");
		return ret;
	}

	ret = gdix_update_prepare(fwu_ctrl);
	if (ret < 0) {
		gdix_err("failed prepare ISP\n");
		goto err_fw_prepare;
	}

	ret = gdix_flash_firmware(fwu_ctrl);
	if (ret < 0) {
		gdix_err("failed flash frimware\n");
		goto err_fw_prepare;
	}

	gdix_dbg("flash fw data success, need reset\n");

err_fw_prepare:
	gdix_update_finish(fwu_ctrl);
	return ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x15b50
movl %eax, -0x14(%rbp)
cmpl $0x0, -0x14(%rbp)
jge 0x15734
jmp 0x15700
leaq 0x10b92(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0x15730
movq 0x108c5(%rip), %rax     # 0x25fd8
movq (%rax), %rdi
leaq 0x9c95(%rip), %rsi      # 0x1f3b2
leaq 0x9cbf(%rip), %rdx      # 0x1f3e3
movl $0x344, %ecx            # imm = 0x344
movb $0x0, %al
callq 0x5190
jmp 0x15732
jmp 0x15734
movq -0x10(%rbp), %rdi
callq 0x15db0
movl %eax, -0x14(%rbp)
cmpl $0x0, -0x14(%rbp)
jge 0x15785
jmp 0x15748
leaq 0x10b4a(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0x15778
movq 0x1087d(%rip), %rax     # 0x25fd8
movq (%rax), %rdi
leaq 0x9c92(%rip), %rsi      # 0x1f3f7
leaq 0x9c77(%rip), %rdx      # 0x1f3e3
movl $0x348, %ecx            # imm = 0x348
movb $0x0, %al
callq 0x5190
jmp 0x1577a
movl -0x14(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x1585a
movq -0x10(%rbp), %rdi
callq 0x162b0
movl %eax, -0x14(%rbp)
cmpl $0x0, -0x14(%rbp)
jge 0x157cd
jmp 0x15799
leaq 0x10af9(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0x157c9
movq 0x1082c(%rip), %rax     # 0x25fd8
movq (%rax), %rdi
leaq 0x9c6c(%rip), %rsi      # 0x1f422
leaq 0x9c26(%rip), %rdx      # 0x1f3e3
movl $0x34e, %ecx            # imm = 0x34E
movb $0x0, %al
callq 0x5190
jmp 0x157cb
jmp 0x1584b
movq -0x10(%rbp), %rdi
callq 0x165c0
movl %eax, -0x14(%rbp)
cmpl $0x0, -0x14(%rbp)
jge 0x15815
jmp 0x157e1
leaq 0x10ab1(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0x15811
movq 0x107e4(%rip), %rax     # 0x25fd8
movq (%rax), %rdi
leaq 0x9c49(%rip), %rsi      # 0x1f447
leaq 0x9bde(%rip), %rdx      # 0x1f3e3
movl $0x354, %ecx            # imm = 0x354
movb $0x0, %al
callq 0x5190
jmp 0x15813
jmp 0x1584b
jmp 0x15817
leaq 0x10a7b(%rip), %rax     # 0x26299
testb $0x1, (%rax)
je 0x15847
movq 0x1078e(%rip), %rax     # 0x25fb8
movq (%rax), %rdi
leaq 0x9c3b(%rip), %rsi      # 0x1f46f
leaq 0x9ba8(%rip), %rdx      # 0x1f3e3
movl $0x358, %ecx            # imm = 0x358
movb $0x0, %al
callq 0x5190
jmp 0x15849
jmp 0x1584b
movq -0x10(%rbp), %rdi
callq 0x168b0
movl -0x14(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: goodix[P]gdix_hid_firmware_update/gtx9/gtx9_i2c_update.cpp
// Function: gdix_soft_reset(int)
static void gdix_soft_reset(int delay)
{
	uint8_t val = 0;

	i2c_write(0xD808, &val, 1);
	if (delay > 0)
		usleep(delay * 1000);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movl %edi, -0x4(%rbp)
movb $0x0, -0x5(%rbp)
movl $0xd808, %edi           # imm = 0xD808
leaq -0x5(%rbp), %rsi
movl $0x1, %edx
callq 0x15870
cmpl $0x0, -0x4(%rbp)
jle 0x16c04
imull $0x3e8, -0x4(%rbp), %edi # imm = 0x3E8
callq 0x5180
addq $0x10, %rsp
popq %rbp
retq
nopw (%rax,%rax)